From 2ad9f3781d9fa4f8401d1657b33130e5a079a3d9 Mon Sep 17 00:00:00 2001 From: Guy Taylor Date: Thu, 4 Apr 2019 18:16:26 +0100 Subject: [PATCH] Regen all APIs from new JSON --- gen/abusiveexperiencereport1-cli/Cargo.toml | 4 +- gen/abusiveexperiencereport1-cli/README.md | 2 +- gen/abusiveexperiencereport1-cli/mkdocs.yml | 2 +- gen/abusiveexperiencereport1-cli/src/main.rs | 4 +- gen/abusiveexperiencereport1/Cargo.toml | 6 +- gen/abusiveexperiencereport1/README.md | 44 +- gen/abusiveexperiencereport1/src/lib.rs | 35 +- gen/acceleratedmobilepageurl1-cli/Cargo.toml | 4 +- gen/acceleratedmobilepageurl1-cli/README.md | 2 +- gen/acceleratedmobilepageurl1-cli/mkdocs.yml | 2 +- gen/acceleratedmobilepageurl1-cli/src/main.rs | 2 +- gen/acceleratedmobilepageurl1/Cargo.toml | 6 +- gen/acceleratedmobilepageurl1/README.md | 44 +- gen/acceleratedmobilepageurl1/src/lib.rs | 15 +- gen/accesscontextmanager1-cli/Cargo.toml | 42 + gen/accesscontextmanager1-cli/LICENSE.md | 30 + gen/accesscontextmanager1-cli/README.md | 133 + gen/accesscontextmanager1-cli/mkdocs.yml | 35 + gen/accesscontextmanager1-cli/src/cmn.rs | 799 + gen/accesscontextmanager1-cli/src/main.rs | 2162 + gen/accesscontextmanager1/Cargo.toml | 32 + gen/accesscontextmanager1/LICENSE.md | 30 + gen/accesscontextmanager1/README.md | 199 + gen/accesscontextmanager1/src/cmn.rs | 753 + gen/accesscontextmanager1/src/lib.rs | 6599 ++ gen/accesscontextmanager1_beta-cli/Cargo.toml | 4 +- gen/accesscontextmanager1_beta-cli/README.md | 2 +- gen/accesscontextmanager1_beta-cli/mkdocs.yml | 2 +- .../src/main.rs | 22 +- gen/accesscontextmanager1_beta/Cargo.toml | 6 +- gen/accesscontextmanager1_beta/README.md | 48 +- gen/accesscontextmanager1_beta/src/lib.rs | 493 +- gen/adexchangebuyer1d3/Cargo.toml | 2 +- gen/adexchangebuyer1d3/src/lib.rs | 189 +- gen/adexchangebuyer1d4/Cargo.toml | 2 +- gen/adexchangebuyer1d4/src/lib.rs | 342 +- gen/adexchangebuyer2_v2_beta1-cli/Cargo.toml | 4 +- gen/adexchangebuyer2_v2_beta1-cli/README.md | 2 +- gen/adexchangebuyer2_v2_beta1-cli/mkdocs.yml | 2 +- gen/adexchangebuyer2_v2_beta1-cli/src/main.rs | 82 +- gen/adexchangebuyer2_v2_beta1/Cargo.toml | 6 +- gen/adexchangebuyer2_v2_beta1/README.md | 44 +- gen/adexchangebuyer2_v2_beta1/src/lib.rs | 4304 +- gen/adexchangeseller2/Cargo.toml | 2 +- gen/adexchangeseller2/src/lib.rs | 126 +- gen/adexperiencereport1-cli/Cargo.toml | 4 +- gen/adexperiencereport1-cli/README.md | 2 +- gen/adexperiencereport1-cli/mkdocs.yml | 2 +- gen/adexperiencereport1-cli/src/main.rs | 4 +- gen/adexperiencereport1/Cargo.toml | 6 +- gen/adexperiencereport1/README.md | 44 +- gen/adexperiencereport1/src/lib.rs | 36 +- gen/admin1_directory-cli/Cargo.toml | 4 +- gen/admin1_directory-cli/README.md | 2 +- gen/admin1_directory-cli/mkdocs.yml | 2 +- gen/admin1_directory-cli/src/main.rs | 53 +- gen/admin1_directory/Cargo.toml | 6 +- gen/admin1_directory/README.md | 116 +- gen/admin1_directory/src/lib.rs | 1268 +- gen/admin1_reports-cli/Cargo.toml | 4 +- gen/admin1_reports-cli/README.md | 2 +- gen/admin1_reports-cli/mkdocs.yml | 2 +- gen/admin1_reports-cli/src/main.rs | 17 +- gen/admin1_reports/Cargo.toml | 6 +- gen/admin1_reports/README.md | 65 +- gen/admin1_reports/src/lib.rs | 161 +- gen/adsense1d4-cli/Cargo.toml | 4 +- gen/adsense1d4-cli/README.md | 2 +- gen/adsense1d4-cli/mkdocs.yml | 2 +- gen/adsense1d4-cli/src/main.rs | 2 +- gen/adsense1d4/Cargo.toml | 6 +- gen/adsense1d4/README.md | 72 +- gen/adsense1d4/src/lib.rs | 353 +- gen/adsensehost4d1-cli/Cargo.toml | 4 +- gen/adsensehost4d1-cli/README.md | 2 +- gen/adsensehost4d1-cli/mkdocs.yml | 2 +- gen/adsensehost4d1-cli/src/main.rs | 2 +- gen/adsensehost4d1/Cargo.toml | 6 +- gen/adsensehost4d1/README.md | 56 +- gen/adsensehost4d1/src/lib.rs | 236 +- gen/alertcenter1_beta1-cli/Cargo.toml | 4 +- gen/alertcenter1_beta1-cli/README.md | 10 +- gen/alertcenter1_beta1-cli/mkdocs.yml | 5 +- gen/alertcenter1_beta1-cli/src/main.rs | 373 +- gen/alertcenter1_beta1/Cargo.toml | 6 +- gen/alertcenter1_beta1/README.md | 55 +- gen/alertcenter1_beta1/src/lib.rs | 1942 +- gen/analytics3-cli/Cargo.toml | 4 +- gen/analytics3-cli/README.md | 2 +- gen/analytics3-cli/mkdocs.yml | 2 +- gen/analytics3-cli/src/main.rs | 40 +- gen/analytics3/Cargo.toml | 6 +- gen/analytics3/README.md | 52 +- gen/analytics3/src/lib.rs | 942 +- gen/analyticsreporting4-cli/Cargo.toml | 4 +- gen/analyticsreporting4-cli/README.md | 4 +- gen/analyticsreporting4-cli/mkdocs.yml | 3 +- gen/analyticsreporting4-cli/src/main.rs | 130 +- gen/analyticsreporting4/Cargo.toml | 6 +- gen/analyticsreporting4/README.md | 54 +- gen/analyticsreporting4/src/lib.rs | 881 +- gen/androiddeviceprovisioning1-cli/Cargo.toml | 4 +- gen/androiddeviceprovisioning1-cli/README.md | 2 +- gen/androiddeviceprovisioning1-cli/mkdocs.yml | 2 +- .../src/main.rs | 14 +- gen/androiddeviceprovisioning1/Cargo.toml | 6 +- gen/androiddeviceprovisioning1/README.md | 56 +- gen/androiddeviceprovisioning1/src/lib.rs | 419 +- gen/androidenterprise1-cli/Cargo.toml | 4 +- gen/androidenterprise1-cli/README.md | 11 +- gen/androidenterprise1-cli/mkdocs.yml | 10 +- gen/androidenterprise1-cli/src/main.rs | 818 +- gen/androidenterprise1/Cargo.toml | 6 +- gen/androidenterprise1/README.md | 109 +- gen/androidenterprise1/src/lib.rs | 8048 +- gen/androidmanagement1-cli/Cargo.toml | 4 +- gen/androidmanagement1-cli/README.md | 7 +- gen/androidmanagement1-cli/mkdocs.yml | 7 +- gen/androidmanagement1-cli/src/main.rs | 513 +- gen/androidmanagement1/Cargo.toml | 6 +- gen/androidmanagement1/README.md | 77 +- gen/androidmanagement1/src/lib.rs | 6376 +- gen/androidpublisher2-cli/Cargo.toml | 4 +- gen/androidpublisher2-cli/README.md | 2 +- gen/androidpublisher2-cli/mkdocs.yml | 2 +- gen/androidpublisher2-cli/src/main.rs | 2 +- gen/androidpublisher2/Cargo.toml | 6 +- gen/androidpublisher2/README.md | 62 +- gen/androidpublisher2/src/lib.rs | 527 +- gen/androidpublisher3-cli/Cargo.toml | 4 +- gen/androidpublisher3-cli/README.md | 2 +- gen/androidpublisher3-cli/mkdocs.yml | 2 +- gen/androidpublisher3-cli/src/main.rs | 2 +- gen/androidpublisher3/Cargo.toml | 6 +- gen/androidpublisher3/README.md | 62 +- gen/androidpublisher3/src/lib.rs | 501 +- gen/appengine1-cli/Cargo.toml | 4 +- gen/appengine1-cli/README.md | 2 +- gen/appengine1-cli/mkdocs.yml | 2 +- gen/appengine1-cli/src/main.rs | 76 +- gen/appengine1/Cargo.toml | 6 +- gen/appengine1/README.md | 42 +- gen/appengine1/src/lib.rs | 987 +- gen/appengine1_beta4-cli/src/main.rs | 22 +- gen/appengine1_beta4/Cargo.toml | 2 +- gen/appengine1_beta4/src/lib.rs | 472 +- gen/appengine1_beta5-cli/src/main.rs | 40 +- gen/appengine1_beta5/Cargo.toml | 2 +- gen/appengine1_beta5/src/lib.rs | 480 +- gen/appsactivity1-cli/Cargo.toml | 4 +- gen/appsactivity1-cli/README.md | 2 +- gen/appsactivity1-cli/mkdocs.yml | 2 +- gen/appsactivity1-cli/src/main.rs | 4 +- gen/appsactivity1/Cargo.toml | 6 +- gen/appsactivity1/README.md | 44 +- gen/appsactivity1/src/lib.rs | 17 +- gen/appstate1-cli/Cargo.toml | 4 +- gen/appstate1-cli/README.md | 2 +- gen/appstate1-cli/mkdocs.yml | 2 +- gen/appstate1-cli/src/main.rs | 2 +- gen/appstate1/Cargo.toml | 6 +- gen/appstate1/README.md | 42 +- gen/appstate1/src/lib.rs | 47 +- gen/autoscaler1_beta2/Cargo.toml | 2 +- gen/autoscaler1_beta2/src/lib.rs | 90 +- gen/bigquery2-cli/Cargo.toml | 4 +- gen/bigquery2-cli/README.md | 7 +- gen/bigquery2-cli/mkdocs.yml | 6 +- gen/bigquery2-cli/src/main.rs | 504 +- gen/bigquery2/Cargo.toml | 6 +- gen/bigquery2/README.md | 60 +- gen/bigquery2/src/lib.rs | 4113 +- gen/bigquerydatatransfer1-cli/Cargo.toml | 4 +- gen/bigquerydatatransfer1-cli/README.md | 4 +- gen/bigquerydatatransfer1-cli/mkdocs.yml | 4 +- gen/bigquerydatatransfer1-cli/src/main.rs | 308 +- gen/bigquerydatatransfer1/Cargo.toml | 6 +- gen/bigquerydatatransfer1/README.md | 47 +- gen/bigquerydatatransfer1/src/lib.rs | 1714 +- gen/bigtableadmin2-cli/Cargo.toml | 42 + gen/bigtableadmin2-cli/LICENSE.md | 30 + gen/bigtableadmin2-cli/README.md | 148 + gen/bigtableadmin2-cli/mkdocs.yml | 50 + gen/bigtableadmin2-cli/src/cmn.rs | 799 + gen/bigtableadmin2-cli/src/main.rs | 3765 + gen/bigtableadmin2/Cargo.toml | 32 + gen/bigtableadmin2/LICENSE.md | 30 + gen/bigtableadmin2/README.md | 195 + gen/bigtableadmin2/src/cmn.rs | 753 + gen/bigtableadmin2/src/lib.rs | 11687 +++ gen/binaryauthorization1_beta1-cli/Cargo.toml | 4 +- gen/binaryauthorization1_beta1-cli/README.md | 2 +- gen/binaryauthorization1_beta1-cli/mkdocs.yml | 2 +- .../src/main.rs | 13 +- gen/binaryauthorization1_beta1/Cargo.toml | 6 +- gen/binaryauthorization1_beta1/README.md | 42 +- gen/binaryauthorization1_beta1/src/lib.rs | 653 +- gen/blogger3/Cargo.toml | 2 +- gen/blogger3/src/lib.rs | 297 +- gen/books1-cli/Cargo.toml | 4 +- gen/books1-cli/README.md | 2 +- gen/books1-cli/mkdocs.yml | 2 +- gen/books1-cli/src/main.rs | 2 +- gen/books1/Cargo.toml | 6 +- gen/books1/README.md | 70 +- gen/books1/src/lib.rs | 486 +- gen/calendar3-cli/Cargo.toml | 4 +- gen/calendar3-cli/README.md | 2 +- gen/calendar3-cli/mkdocs.yml | 2 +- gen/calendar3-cli/src/main.rs | 2 +- gen/calendar3/Cargo.toml | 6 +- gen/calendar3/README.md | 86 +- gen/calendar3/src/lib.rs | 353 +- gen/chat1-cli/Cargo.toml | 4 +- gen/chat1-cli/README.md | 2 +- gen/chat1-cli/mkdocs.yml | 2 +- gen/chat1-cli/src/main.rs | 2 +- gen/chat1/Cargo.toml | 6 +- gen/chat1/README.md | 44 +- gen/chat1/src/lib.rs | 158 +- gen/classroom1-cli/Cargo.toml | 4 +- gen/classroom1-cli/README.md | 7 +- gen/classroom1-cli/mkdocs.yml | 7 +- gen/classroom1-cli/src/main.rs | 609 +- gen/classroom1/Cargo.toml | 6 +- gen/classroom1/README.md | 71 +- gen/classroom1/src/lib.rs | 4277 +- gen/cloudasset1-cli/Cargo.toml | 42 + gen/cloudasset1-cli/LICENSE.md | 30 + gen/cloudasset1-cli/README.md | 117 + gen/cloudasset1-cli/mkdocs.yml | 19 + gen/cloudasset1-cli/src/cmn.rs | 799 + gen/cloudasset1-cli/src/main.rs | 560 + gen/cloudasset1/Cargo.toml | 32 + gen/cloudasset1/LICENSE.md | 30 + gen/cloudasset1/README.md | 193 + gen/cloudasset1/src/cmn.rs | 753 + gen/cloudasset1/src/lib.rs | 1964 + gen/cloudasset1_beta1-cli/Cargo.toml | 6 +- gen/cloudasset1_beta1-cli/README.md | 7 +- gen/cloudasset1_beta1-cli/mkdocs.yml | 4 +- gen/cloudasset1_beta1-cli/src/main.rs | 243 +- gen/cloudasset1_beta1/Cargo.toml | 8 +- gen/cloudasset1_beta1/README.md | 54 +- gen/cloudasset1_beta1/src/lib.rs | 926 +- gen/cloudbilling1-cli/Cargo.toml | 4 +- gen/cloudbilling1-cli/README.md | 2 +- gen/cloudbilling1-cli/mkdocs.yml | 2 +- gen/cloudbilling1-cli/src/main.rs | 10 +- gen/cloudbilling1/Cargo.toml | 6 +- gen/cloudbilling1/README.md | 50 +- gen/cloudbilling1/src/lib.rs | 394 +- gen/cloudbuild1-cli/Cargo.toml | 4 +- gen/cloudbuild1-cli/README.md | 2 +- gen/cloudbuild1-cli/mkdocs.yml | 2 +- gen/cloudbuild1-cli/src/main.rs | 92 +- gen/cloudbuild1/Cargo.toml | 6 +- gen/cloudbuild1/README.md | 46 +- gen/cloudbuild1/src/lib.rs | 753 +- gen/clouddebugger2-cli/Cargo.toml | 4 +- gen/clouddebugger2-cli/README.md | 2 +- gen/clouddebugger2-cli/mkdocs.yml | 2 +- gen/clouddebugger2-cli/src/main.rs | 14 +- gen/clouddebugger2/Cargo.toml | 6 +- gen/clouddebugger2/README.md | 44 +- gen/clouddebugger2/src/lib.rs | 106 +- gen/clouderrorreporting1_beta1-cli/Cargo.toml | 4 +- gen/clouderrorreporting1_beta1-cli/README.md | 2 +- gen/clouderrorreporting1_beta1-cli/mkdocs.yml | 2 +- .../src/main.rs | 4 +- gen/clouderrorreporting1_beta1/Cargo.toml | 6 +- gen/clouderrorreporting1_beta1/README.md | 42 +- gen/clouderrorreporting1_beta1/src/lib.rs | 322 +- gen/cloudfunctions1-cli/Cargo.toml | 4 +- gen/cloudfunctions1-cli/README.md | 5 +- gen/cloudfunctions1-cli/mkdocs.yml | 5 +- gen/cloudfunctions1-cli/src/main.rs | 358 +- gen/cloudfunctions1/Cargo.toml | 6 +- gen/cloudfunctions1/README.md | 46 +- gen/cloudfunctions1/src/lib.rs | 1442 +- gen/cloudidentity1-cli/Cargo.toml | 42 + gen/cloudidentity1-cli/LICENSE.md | 30 + gen/cloudidentity1-cli/README.md | 125 + gen/cloudidentity1-cli/mkdocs.yml | 28 + gen/cloudidentity1-cli/src/cmn.rs | 799 + gen/cloudidentity1-cli/src/main.rs | 1370 + gen/cloudidentity1/Cargo.toml | 32 + gen/cloudidentity1/LICENSE.md | 30 + gen/cloudidentity1/README.md | 196 + gen/cloudidentity1/src/cmn.rs | 753 + gen/cloudidentity1/src/lib.rs | 4204 + gen/cloudiot1-cli/Cargo.toml | 4 +- gen/cloudiot1-cli/README.md | 6 +- gen/cloudiot1-cli/mkdocs.yml | 6 +- gen/cloudiot1-cli/src/main.rs | 528 +- gen/cloudiot1/Cargo.toml | 6 +- gen/cloudiot1/README.md | 44 +- gen/cloudiot1/src/lib.rs | 2585 +- gen/cloudkms1-cli/Cargo.toml | 4 +- gen/cloudkms1-cli/README.md | 5 +- gen/cloudkms1-cli/mkdocs.yml | 5 +- gen/cloudkms1-cli/src/main.rs | 327 +- gen/cloudkms1/Cargo.toml | 6 +- gen/cloudkms1/README.md | 60 +- gen/cloudkms1/src/lib.rs | 1346 +- gen/cloudkms1_beta1/Cargo.toml | 2 +- gen/cloudkms1_beta1/src/lib.rs | 264 +- gen/cloudlatencytest2/Cargo.toml | 2 +- gen/cloudlatencytest2/src/lib.rs | 18 +- gen/cloudmonitoring2_beta2/Cargo.toml | 2 +- gen/cloudmonitoring2_beta2/src/lib.rs | 54 +- gen/cloudprivatecatalog1_beta1-cli/Cargo.toml | 42 + gen/cloudprivatecatalog1_beta1-cli/LICENSE.md | 30 + gen/cloudprivatecatalog1_beta1-cli/README.md | 124 + gen/cloudprivatecatalog1_beta1-cli/mkdocs.yml | 25 + gen/cloudprivatecatalog1_beta1-cli/src/cmn.rs | 799 + .../src/main.rs | 1079 + gen/cloudprivatecatalog1_beta1/Cargo.toml | 32 + gen/cloudprivatecatalog1_beta1/LICENSE.md | 30 + gen/cloudprivatecatalog1_beta1/README.md | 191 + gen/cloudprivatecatalog1_beta1/src/cmn.rs | 753 + gen/cloudprivatecatalog1_beta1/src/lib.rs | 3635 + .../Cargo.toml | 42 + .../LICENSE.md | 30 + .../README.md | 143 + .../mkdocs.yml | 45 + .../src/cmn.rs | 799 + .../src/main.rs | 3122 + .../Cargo.toml | 32 + .../LICENSE.md | 30 + .../README.md | 195 + .../src/cmn.rs | 753 + .../src/lib.rs | 9821 +++ gen/cloudprofiler2-cli/Cargo.toml | 4 +- gen/cloudprofiler2-cli/README.md | 2 +- gen/cloudprofiler2-cli/mkdocs.yml | 2 +- gen/cloudprofiler2-cli/src/main.rs | 2 +- gen/cloudprofiler2/Cargo.toml | 6 +- gen/cloudprofiler2/README.md | 42 +- gen/cloudprofiler2/src/lib.rs | 35 +- gen/cloudresourcemanager1-cli/Cargo.toml | 4 +- gen/cloudresourcemanager1-cli/README.md | 2 +- gen/cloudresourcemanager1-cli/mkdocs.yml | 2 +- gen/cloudresourcemanager1-cli/src/main.rs | 28 +- gen/cloudresourcemanager1/Cargo.toml | 6 +- gen/cloudresourcemanager1/README.md | 58 +- gen/cloudresourcemanager1/src/lib.rs | 3774 +- .../Cargo.toml | 4 +- gen/cloudresourcemanager1_beta1-cli/README.md | 2 +- .../mkdocs.yml | 2 +- .../src/main.rs | 16 +- gen/cloudresourcemanager1_beta1/Cargo.toml | 6 +- gen/cloudresourcemanager1_beta1/README.md | 48 +- gen/cloudresourcemanager1_beta1/src/lib.rs | 371 +- gen/cloudresourcemanager2-cli/Cargo.toml | 4 +- gen/cloudresourcemanager2-cli/README.md | 2 +- gen/cloudresourcemanager2-cli/mkdocs.yml | 2 +- gen/cloudresourcemanager2-cli/src/main.rs | 14 +- gen/cloudresourcemanager2/Cargo.toml | 6 +- gen/cloudresourcemanager2/README.md | 48 +- gen/cloudresourcemanager2/src/lib.rs | 283 +- gen/cloudscheduler1_beta1-cli/Cargo.toml | 42 + gen/cloudscheduler1_beta1-cli/LICENSE.md | 30 + gen/cloudscheduler1_beta1-cli/README.md | 123 + gen/cloudscheduler1_beta1-cli/mkdocs.yml | 26 + gen/cloudscheduler1_beta1-cli/src/cmn.rs | 799 + gen/cloudscheduler1_beta1-cli/src/main.rs | 1357 + gen/cloudscheduler1_beta1/Cargo.toml | 32 + gen/cloudscheduler1_beta1/LICENSE.md | 30 + gen/cloudscheduler1_beta1/README.md | 194 + gen/cloudscheduler1_beta1/src/cmn.rs | 753 + gen/cloudscheduler1_beta1/src/lib.rs | 4188 + gen/cloudshell1-cli/Cargo.toml | 4 +- gen/cloudshell1-cli/README.md | 2 +- gen/cloudshell1-cli/mkdocs.yml | 2 +- gen/cloudshell1-cli/src/main.rs | 2 +- gen/cloudshell1/Cargo.toml | 6 +- gen/cloudshell1/README.md | 44 +- gen/cloudshell1/src/lib.rs | 56 +- gen/cloudtasks2-cli/Cargo.toml | 42 + gen/cloudtasks2-cli/LICENSE.md | 30 + gen/cloudtasks2-cli/README.md | 131 + gen/cloudtasks2-cli/mkdocs.yml | 34 + gen/cloudtasks2-cli/src/cmn.rs | 799 + gen/cloudtasks2-cli/src/main.rs | 2296 + gen/cloudtasks2/Cargo.toml | 32 + gen/cloudtasks2/LICENSE.md | 30 + gen/cloudtasks2/README.md | 194 + gen/cloudtasks2/src/cmn.rs | 753 + gen/cloudtasks2/src/lib.rs | 7342 ++ gen/cloudtasks2_beta2-cli/Cargo.toml | 4 +- gen/cloudtasks2_beta2-cli/README.md | 2 +- gen/cloudtasks2_beta2-cli/mkdocs.yml | 2 +- gen/cloudtasks2_beta2-cli/src/main.rs | 17 +- gen/cloudtasks2_beta2/Cargo.toml | 6 +- gen/cloudtasks2_beta2/README.md | 42 +- gen/cloudtasks2_beta2/src/lib.rs | 892 +- gen/cloudtasks2_beta3-cli/Cargo.toml | 4 +- gen/cloudtasks2_beta3-cli/README.md | 2 +- gen/cloudtasks2_beta3-cli/mkdocs.yml | 2 +- gen/cloudtasks2_beta3-cli/src/main.rs | 22 +- gen/cloudtasks2_beta3/Cargo.toml | 6 +- gen/cloudtasks2_beta3/README.md | 42 +- gen/cloudtasks2_beta3/src/lib.rs | 639 +- gen/cloudtrace1-cli/Cargo.toml | 4 +- gen/cloudtrace1-cli/README.md | 2 +- gen/cloudtrace1-cli/mkdocs.yml | 2 +- gen/cloudtrace1-cli/src/main.rs | 2 +- gen/cloudtrace1/Cargo.toml | 6 +- gen/cloudtrace1/README.md | 42 +- gen/cloudtrace1/src/lib.rs | 139 +- gen/cloudtrace2-cli/Cargo.toml | 4 +- gen/cloudtrace2-cli/README.md | 2 +- gen/cloudtrace2-cli/mkdocs.yml | 2 +- gen/cloudtrace2-cli/src/main.rs | 2 +- gen/cloudtrace2/Cargo.toml | 6 +- gen/cloudtrace2/README.md | 42 +- gen/cloudtrace2/src/lib.rs | 54 +- gen/clouduseraccountsvm_beta/Cargo.toml | 2 +- gen/clouduseraccountsvm_beta/src/lib.rs | 153 +- gen/composer1-cli/Cargo.toml | 4 +- gen/composer1-cli/README.md | 3 +- gen/composer1-cli/mkdocs.yml | 3 +- gen/composer1-cli/src/main.rs | 111 +- gen/composer1/Cargo.toml | 6 +- gen/composer1/README.md | 42 +- gen/composer1/src/lib.rs | 663 +- gen/compute1-cli/Cargo.toml | 4 +- gen/compute1-cli/README.md | 45 +- gen/compute1-cli/mkdocs.yml | 44 +- gen/compute1-cli/src/main.rs | 5371 +- gen/compute1/Cargo.toml | 6 +- gen/compute1/README.md | 264 +- gen/compute1/src/lib.rs | 30639 +++++-- gen/consumersurveys2/Cargo.toml | 2 +- gen/consumersurveys2/src/lib.rs | 99 +- gen/container1-cli/Cargo.toml | 4 +- gen/container1-cli/README.md | 4 +- gen/container1-cli/mkdocs.yml | 4 +- gen/container1-cli/src/main.rs | 307 +- gen/container1/Cargo.toml | 6 +- gen/container1/README.md | 46 +- gen/container1/src/lib.rs | 2177 +- gen/containeranalysis1_beta1-cli/Cargo.toml | 42 + gen/containeranalysis1_beta1-cli/LICENSE.md | 30 + gen/containeranalysis1_beta1-cli/README.md | 137 + gen/containeranalysis1_beta1-cli/mkdocs.yml | 40 + gen/containeranalysis1_beta1-cli/src/cmn.rs | 799 + gen/containeranalysis1_beta1-cli/src/main.rs | 2903 + gen/containeranalysis1_beta1/Cargo.toml | 32 + gen/containeranalysis1_beta1/LICENSE.md | 30 + gen/containeranalysis1_beta1/README.md | 192 + gen/containeranalysis1_beta1/src/cmn.rs | 753 + gen/containeranalysis1_beta1/src/lib.rs | 9521 ++ gen/content2-cli/Cargo.toml | 4 +- gen/content2-cli/README.md | 8 +- gen/content2-cli/mkdocs.yml | 2 +- gen/content2-cli/src/main.rs | 105 +- gen/content2/Cargo.toml | 6 +- gen/content2/README.md | 82 +- gen/content2/src/lib.rs | 1763 +- gen/content2_sandbox/Cargo.toml | 2 +- gen/content2_sandbox/src/lib.rs | 270 +- gen/coordinate1/Cargo.toml | 2 +- gen/coordinate1/src/lib.rs | 108 +- gen/customsearch1/Cargo.toml | 2 +- gen/customsearch1/src/lib.rs | 18 +- gen/dataproc1-cli/Cargo.toml | 4 +- gen/dataproc1-cli/README.md | 2 +- gen/dataproc1-cli/mkdocs.yml | 2 +- gen/dataproc1-cli/src/main.rs | 312 +- gen/dataproc1/Cargo.toml | 6 +- gen/dataproc1/README.md | 42 +- gen/dataproc1/src/lib.rs | 809 +- gen/datastore1-cli/Cargo.toml | 4 +- gen/datastore1-cli/README.md | 2 +- gen/datastore1-cli/mkdocs.yml | 2 +- gen/datastore1-cli/src/main.rs | 4 +- gen/datastore1/Cargo.toml | 6 +- gen/datastore1/README.md | 42 +- gen/datastore1/src/lib.rs | 2212 +- gen/datastore1_beta3-cli/Cargo.toml | 4 +- gen/datastore1_beta3-cli/README.md | 2 +- gen/datastore1_beta3-cli/mkdocs.yml | 2 +- gen/datastore1_beta3-cli/src/main.rs | 8 +- gen/datastore1_beta3/Cargo.toml | 6 +- gen/datastore1_beta3/README.md | 42 +- gen/datastore1_beta3/src/lib.rs | 411 +- gen/deploymentmanager2-cli/Cargo.toml | 4 +- gen/deploymentmanager2-cli/README.md | 2 +- gen/deploymentmanager2-cli/mkdocs.yml | 2 +- gen/deploymentmanager2-cli/src/main.rs | 17 +- gen/deploymentmanager2/Cargo.toml | 6 +- gen/deploymentmanager2/README.md | 60 +- gen/deploymentmanager2/src/lib.rs | 211 +- gen/deploymentmanager2_beta2/Cargo.toml | 2 +- gen/deploymentmanager2_beta2/src/lib.rs | 117 +- gen/dfareporting2d8/Cargo.toml | 2 +- gen/dfareporting2d8/src/lib.rs | 1845 +- gen/dfareporting3/Cargo.toml | 2 +- gen/dfareporting3/src/lib.rs | 1836 +- gen/dfareporting3d2-cli/Cargo.toml | 4 +- gen/dfareporting3d2-cli/README.md | 2 +- gen/dfareporting3d2-cli/mkdocs.yml | 2 +- gen/dfareporting3d2-cli/src/main.rs | 2 +- gen/dfareporting3d2/Cargo.toml | 6 +- gen/dfareporting3d2/README.md | 288 +- gen/dfareporting3d2/src/lib.rs | 1856 +- gen/dfareporting3d3-cli/Cargo.toml | 42 + gen/dfareporting3d3-cli/LICENSE.md | 30 + gen/dfareporting3d3-cli/README.md | 376 + gen/dfareporting3d3-cli/mkdocs.yml | 220 + gen/dfareporting3d3-cli/src/cmn.rs | 799 + gen/dfareporting3d3-cli/src/main.rs | 23819 +++++ gen/dfareporting3d3/Cargo.toml | 32 + gen/dfareporting3d3/LICENSE.md | 30 + gen/dfareporting3d3/README.md | 323 + gen/dfareporting3d3/src/cmn.rs | 753 + gen/dfareporting3d3/src/lib.rs | 71809 ++++++++++++++++ gen/dialogflow2-cli/Cargo.toml | 4 +- gen/dialogflow2-cli/README.md | 2 +- gen/dialogflow2-cli/mkdocs.yml | 2 +- gen/dialogflow2-cli/src/main.rs | 67 +- gen/dialogflow2/Cargo.toml | 6 +- gen/dialogflow2/README.md | 46 +- gen/dialogflow2/src/lib.rs | 1412 +- gen/dialogflow2_beta1-cli/Cargo.toml | 4 +- gen/dialogflow2_beta1-cli/README.md | 46 +- gen/dialogflow2_beta1-cli/mkdocs.yml | 46 +- gen/dialogflow2_beta1-cli/src/main.rs | 4733 +- gen/dialogflow2_beta1/Cargo.toml | 6 +- gen/dialogflow2_beta1/README.md | 63 +- gen/dialogflow2_beta1/src/lib.rs | 38246 +++----- gen/digitalassetlinks1-cli/Cargo.toml | 4 +- gen/digitalassetlinks1-cli/README.md | 2 +- gen/digitalassetlinks1-cli/mkdocs.yml | 2 +- gen/digitalassetlinks1-cli/src/main.rs | 4 +- gen/digitalassetlinks1/Cargo.toml | 6 +- gen/digitalassetlinks1/README.md | 46 +- gen/digitalassetlinks1/src/lib.rs | 34 +- gen/discovery1-cli/Cargo.toml | 4 +- gen/discovery1-cli/README.md | 2 +- gen/discovery1-cli/mkdocs.yml | 2 +- gen/discovery1-cli/src/main.rs | 2 +- gen/discovery1/Cargo.toml | 6 +- gen/discovery1/README.md | 42 +- gen/discovery1/src/lib.rs | 20 +- gen/dlp2-cli/Cargo.toml | 4 +- gen/dlp2-cli/README.md | 3 +- gen/dlp2-cli/mkdocs.yml | 3 +- gen/dlp2-cli/src/main.rs | 168 +- gen/dlp2/Cargo.toml | 6 +- gen/dlp2/README.md | 46 +- gen/dlp2/src/lib.rs | 2474 +- gen/dlp2_beta1/Cargo.toml | 2 +- gen/dlp2_beta1/src/lib.rs | 164 +- gen/dns1-cli/Cargo.toml | 4 +- gen/dns1-cli/README.md | 2 +- gen/dns1-cli/mkdocs.yml | 2 +- gen/dns1-cli/src/main.rs | 104 +- gen/dns1/Cargo.toml | 6 +- gen/dns1/README.md | 62 +- gen/dns1/src/lib.rs | 535 +- gen/docs1-cli/Cargo.toml | 42 + gen/docs1-cli/LICENSE.md | 30 + gen/docs1-cli/README.md | 116 + gen/docs1-cli/mkdocs.yml | 19 + gen/docs1-cli/src/cmn.rs | 799 + gen/docs1-cli/src/main.rs | 605 + gen/docs1/Cargo.toml | 32 + gen/docs1/LICENSE.md | 30 + gen/docs1/README.md | 185 + gen/docs1/src/cmn.rs | 753 + gen/docs1/src/lib.rs | 4839 ++ gen/doubleclickbidmanager1-cli/Cargo.toml | 4 +- gen/doubleclickbidmanager1-cli/README.md | 2 +- gen/doubleclickbidmanager1-cli/mkdocs.yml | 2 +- gen/doubleclickbidmanager1-cli/src/main.rs | 2 +- gen/doubleclickbidmanager1/Cargo.toml | 6 +- gen/doubleclickbidmanager1/README.md | 52 +- gen/doubleclickbidmanager1/src/lib.rs | 97 +- gen/doubleclicksearch2-cli/Cargo.toml | 4 +- gen/doubleclicksearch2-cli/README.md | 2 +- gen/doubleclicksearch2-cli/mkdocs.yml | 2 +- gen/doubleclicksearch2-cli/src/main.rs | 2 +- gen/doubleclicksearch2/Cargo.toml | 6 +- gen/doubleclicksearch2/README.md | 54 +- gen/doubleclicksearch2/src/lib.rs | 94 +- gen/drive2-cli/Cargo.toml | 4 +- gen/drive2-cli/README.md | 2 +- gen/drive2-cli/mkdocs.yml | 2 +- gen/drive2-cli/src/main.rs | 4 +- gen/drive2/Cargo.toml | 6 +- gen/drive2/README.md | 110 +- gen/drive2/src/lib.rs | 615 +- gen/drive3-cli/Cargo.toml | 4 +- gen/drive3-cli/README.md | 2 +- gen/drive3-cli/mkdocs.yml | 2 +- gen/drive3-cli/src/main.rs | 16 +- gen/drive3/Cargo.toml | 6 +- gen/drive3/README.md | 96 +- gen/drive3/src/lib.rs | 373 +- gen/driveactivity2-cli/Cargo.toml | 42 + gen/driveactivity2-cli/LICENSE.md | 30 + gen/driveactivity2-cli/README.md | 114 + gen/driveactivity2-cli/mkdocs.yml | 17 + gen/driveactivity2-cli/src/cmn.rs | 799 + gen/driveactivity2-cli/src/main.rs | 361 + gen/driveactivity2/Cargo.toml | 32 + gen/driveactivity2/LICENSE.md | 30 + gen/driveactivity2/README.md | 188 + gen/driveactivity2/src/cmn.rs | 753 + gen/driveactivity2/src/lib.rs | 1565 + gen/factchecktools1_alpha1-cli/Cargo.toml | 42 + gen/factchecktools1_alpha1-cli/LICENSE.md | 30 + gen/factchecktools1_alpha1-cli/README.md | 120 + gen/factchecktools1_alpha1-cli/mkdocs.yml | 22 + gen/factchecktools1_alpha1-cli/src/cmn.rs | 799 + gen/factchecktools1_alpha1-cli/src/main.rs | 833 + gen/factchecktools1_alpha1/Cargo.toml | 32 + gen/factchecktools1_alpha1/LICENSE.md | 30 + gen/factchecktools1_alpha1/README.md | 192 + gen/factchecktools1_alpha1/src/cmn.rs | 753 + gen/factchecktools1_alpha1/src/lib.rs | 2471 + gen/file1-cli/Cargo.toml | 42 + gen/file1-cli/LICENSE.md | 30 + gen/file1-cli/README.md | 124 + gen/file1-cli/mkdocs.yml | 27 + gen/file1-cli/src/cmn.rs | 799 + gen/file1-cli/src/main.rs | 1299 + gen/file1/Cargo.toml | 32 + gen/file1/LICENSE.md | 30 + gen/file1/README.md | 192 + gen/file1/src/cmn.rs | 753 + gen/file1/src/lib.rs | 4030 + gen/file1_beta1-cli/Cargo.toml | 4 +- gen/file1_beta1-cli/README.md | 2 +- gen/file1_beta1-cli/mkdocs.yml | 2 +- gen/file1_beta1-cli/src/main.rs | 2 +- gen/file1_beta1/Cargo.toml | 6 +- gen/file1_beta1/README.md | 42 +- gen/file1_beta1/src/lib.rs | 219 +- gen/firebasedynamiclinks1-cli/Cargo.toml | 4 +- gen/firebasedynamiclinks1-cli/README.md | 2 +- gen/firebasedynamiclinks1-cli/mkdocs.yml | 2 +- gen/firebasedynamiclinks1-cli/src/main.rs | 22 +- gen/firebasedynamiclinks1/Cargo.toml | 6 +- gen/firebasedynamiclinks1/README.md | 52 +- gen/firebasedynamiclinks1/src/lib.rs | 161 +- gen/firebasehosting1_beta1-cli/Cargo.toml | 4 +- gen/firebasehosting1_beta1-cli/README.md | 4 +- gen/firebasehosting1_beta1-cli/mkdocs.yml | 4 +- gen/firebasehosting1_beta1-cli/src/main.rs | 205 +- gen/firebasehosting1_beta1/Cargo.toml | 6 +- gen/firebasehosting1_beta1/README.md | 42 +- gen/firebasehosting1_beta1/src/lib.rs | 1389 +- gen/firebaseremoteconfig1/Cargo.toml | 2 +- gen/firebaseremoteconfig1/src/lib.rs | 22 +- gen/firestore1-cli/Cargo.toml | 4 +- gen/firestore1-cli/README.md | 24 +- gen/firestore1-cli/mkdocs.yml | 24 +- gen/firestore1-cli/src/main.rs | 2499 +- gen/firestore1/Cargo.toml | 6 +- gen/firestore1/README.md | 56 +- gen/firestore1/src/lib.rs | 8718 +- gen/firestore1_beta1-cli/Cargo.toml | 4 +- gen/firestore1_beta1-cli/README.md | 2 +- gen/firestore1_beta1-cli/mkdocs.yml | 2 +- gen/firestore1_beta1-cli/src/main.rs | 16 +- gen/firestore1_beta1/Cargo.toml | 6 +- gen/firestore1_beta1/README.md | 42 +- gen/firestore1_beta1/src/lib.rs | 866 +- gen/fitness1-cli/Cargo.toml | 4 +- gen/fitness1-cli/README.md | 3 +- gen/fitness1-cli/mkdocs.yml | 3 +- gen/fitness1-cli/src/main.rs | 142 +- gen/fitness1/Cargo.toml | 6 +- gen/fitness1/README.md | 47 +- gen/fitness1/src/lib.rs | 458 +- gen/fusiontables2/Cargo.toml | 2 +- gen/fusiontables2/src/lib.rs | 306 +- gen/games1-cli/Cargo.toml | 4 +- gen/games1-cli/README.md | 2 +- gen/games1-cli/mkdocs.yml | 2 +- gen/games1-cli/src/main.rs | 2 +- gen/games1/Cargo.toml | 6 +- gen/games1/README.md | 86 +- gen/games1/src/lib.rs | 489 +- .../Cargo.toml | 4 +- .../README.md | 2 +- .../mkdocs.yml | 2 +- .../src/main.rs | 2 +- .../Cargo.toml | 6 +- .../README.md | 54 +- .../src/lib.rs | 119 +- .../Cargo.toml | 4 +- gen/gamesmanagement1_management-cli/README.md | 2 +- .../mkdocs.yml | 2 +- .../src/main.rs | 2 +- gen/gamesmanagement1_management/Cargo.toml | 6 +- gen/gamesmanagement1_management/README.md | 58 +- gen/gamesmanagement1_management/src/lib.rs | 251 +- gen/gan1_beta1/Cargo.toml | 2 +- gen/gan1_beta1/src/lib.rs | 90 +- gen/genomics1-cli/Cargo.toml | 4 +- gen/genomics1-cli/README.md | 63 +- gen/genomics1-cli/mkdocs.yml | 53 +- gen/genomics1-cli/src/main.rs | 5652 +- gen/genomics1/Cargo.toml | 6 +- gen/genomics1/README.md | 88 +- gen/genomics1/src/lib.rs | 17878 +--- gen/groupsmigration1-cli/Cargo.toml | 4 +- gen/groupsmigration1-cli/README.md | 2 +- gen/groupsmigration1-cli/mkdocs.yml | 2 +- gen/groupsmigration1-cli/src/main.rs | 2 +- gen/groupsmigration1/Cargo.toml | 6 +- gen/groupsmigration1/README.md | 44 +- gen/groupsmigration1/src/lib.rs | 11 +- gen/groupssettings1-cli/Cargo.toml | 4 +- gen/groupssettings1-cli/README.md | 2 +- gen/groupssettings1-cli/mkdocs.yml | 2 +- gen/groupssettings1-cli/src/main.rs | 60 +- gen/groupssettings1/Cargo.toml | 6 +- gen/groupssettings1/README.md | 42 +- gen/groupssettings1/src/lib.rs | 103 +- gen/healthcare1_beta1-cli/Cargo.toml | 42 + gen/healthcare1_beta1-cli/LICENSE.md | 30 + gen/healthcare1_beta1-cli/README.md | 197 + gen/healthcare1_beta1-cli/mkdocs.yml | 100 + gen/healthcare1_beta1-cli/src/cmn.rs | 799 + gen/healthcare1_beta1-cli/src/main.rs | 8663 ++ gen/healthcare1_beta1/Cargo.toml | 32 + gen/healthcare1_beta1/LICENSE.md | 30 + gen/healthcare1_beta1/README.md | 217 + gen/healthcare1_beta1/src/cmn.rs | 753 + gen/healthcare1_beta1/src/lib.rs | 27117 ++++++ gen/iam1-cli/Cargo.toml | 4 +- gen/iam1-cli/README.md | 6 +- gen/iam1-cli/mkdocs.yml | 6 +- gen/iam1-cli/src/main.rs | 596 +- gen/iam1/Cargo.toml | 6 +- gen/iam1/README.md | 54 +- gen/iam1/src/lib.rs | 1920 +- gen/iamcredentials1-cli/Cargo.toml | 4 +- gen/iamcredentials1-cli/README.md | 2 +- gen/iamcredentials1-cli/mkdocs.yml | 2 +- gen/iamcredentials1-cli/src/main.rs | 23 +- gen/iamcredentials1/Cargo.toml | 6 +- gen/iamcredentials1/README.md | 42 +- gen/iamcredentials1/src/lib.rs | 110 +- gen/iap1-cli/Cargo.toml | 42 + gen/iap1-cli/LICENSE.md | 30 + gen/iap1-cli/README.md | 116 + gen/iap1-cli/mkdocs.yml | 19 + gen/iap1-cli/src/cmn.rs | 799 + gen/iap1-cli/src/main.rs | 607 + gen/iap1/Cargo.toml | 32 + gen/iap1/LICENSE.md | 30 + gen/iap1/README.md | 190 + gen/iap1/src/cmn.rs | 753 + gen/iap1/src/lib.rs | 1573 + gen/iap1_beta1-cli/Cargo.toml | 4 +- gen/iap1_beta1-cli/README.md | 25 +- gen/iap1_beta1-cli/mkdocs.yml | 23 +- gen/iap1_beta1-cli/src/main.rs | 1862 +- gen/iap1_beta1/Cargo.toml | 6 +- gen/iap1_beta1/README.md | 61 +- gen/iap1_beta1/src/lib.rs | 5128 +- gen/identitytoolkit3/Cargo.toml | 2 +- gen/identitytoolkit3/src/lib.rs | 180 +- gen/indexing3-cli/Cargo.toml | 4 +- gen/indexing3-cli/README.md | 2 +- gen/indexing3-cli/mkdocs.yml | 2 +- gen/indexing3-cli/src/main.rs | 4 +- gen/indexing3/Cargo.toml | 6 +- gen/indexing3/README.md | 44 +- gen/indexing3/src/lib.rs | 20 +- gen/jobs3-cli/Cargo.toml | 4 +- gen/jobs3-cli/README.md | 3 +- gen/jobs3-cli/mkdocs.yml | 3 +- gen/jobs3-cli/src/main.rs | 226 +- gen/jobs3/Cargo.toml | 6 +- gen/jobs3/README.md | 42 +- gen/jobs3/src/lib.rs | 2841 +- gen/language1-cli/Cargo.toml | 4 +- gen/language1-cli/README.md | 2 +- gen/language1-cli/mkdocs.yml | 2 +- gen/language1-cli/src/main.rs | 18 +- gen/language1/Cargo.toml | 6 +- gen/language1/README.md | 44 +- gen/language1/src/lib.rs | 204 +- gen/language1_beta1-cli/Cargo.toml | 4 +- gen/language1_beta1-cli/README.md | 2 +- gen/language1_beta1-cli/mkdocs.yml | 2 +- gen/language1_beta1-cli/src/main.rs | 16 +- gen/language1_beta1/Cargo.toml | 6 +- gen/language1_beta1/README.md | 44 +- gen/language1_beta1/src/lib.rs | 274 +- gen/libraryagent1-cli/Cargo.toml | 42 + gen/libraryagent1-cli/LICENSE.md | 30 + gen/libraryagent1-cli/README.md | 119 + gen/libraryagent1-cli/mkdocs.yml | 22 + gen/libraryagent1-cli/src/cmn.rs | 799 + gen/libraryagent1-cli/src/main.rs | 726 + gen/libraryagent1/Cargo.toml | 32 + gen/libraryagent1/LICENSE.md | 30 + gen/libraryagent1/README.md | 184 + gen/libraryagent1/src/cmn.rs | 753 + gen/libraryagent1/src/lib.rs | 2141 + gen/licensing1/Cargo.toml | 2 +- gen/licensing1/src/lib.rs | 63 +- gen/logging2-cli/Cargo.toml | 4 +- gen/logging2-cli/README.md | 2 +- gen/logging2-cli/mkdocs.yml | 2 +- gen/logging2-cli/src/main.rs | 258 +- gen/logging2/Cargo.toml | 6 +- gen/logging2/README.md | 60 +- gen/logging2/src/lib.rs | 3187 +- gen/logging2_beta1-cli/Cargo.toml | 4 +- gen/logging2_beta1-cli/README.md | 10 +- gen/logging2_beta1-cli/mkdocs.yml | 8 +- gen/logging2_beta1-cli/src/main.rs | 571 +- gen/logging2_beta1/Cargo.toml | 6 +- gen/logging2_beta1/README.md | 68 +- gen/logging2_beta1/src/lib.rs | 3339 +- gen/manager1_beta2/Cargo.toml | 2 +- gen/manager1_beta2/src/lib.rs | 72 +- gen/manufacturers1-cli/Cargo.toml | 4 +- gen/manufacturers1-cli/README.md | 2 +- gen/manufacturers1-cli/mkdocs.yml | 2 +- gen/manufacturers1-cli/src/main.rs | 10 +- gen/manufacturers1/Cargo.toml | 6 +- gen/manufacturers1/README.md | 42 +- gen/manufacturers1/src/lib.rs | 724 +- gen/mirror1-cli/Cargo.toml | 4 +- gen/mirror1-cli/README.md | 2 +- gen/mirror1-cli/mkdocs.yml | 2 +- gen/mirror1-cli/src/main.rs | 2 +- gen/mirror1/Cargo.toml | 6 +- gen/mirror1/README.md | 70 +- gen/mirror1/src/lib.rs | 218 +- gen/ml1-cli/Cargo.toml | 4 +- gen/ml1-cli/README.md | 5 +- gen/ml1-cli/mkdocs.yml | 4 +- gen/ml1-cli/src/main.rs | 305 +- gen/ml1/Cargo.toml | 6 +- gen/ml1/README.md | 44 +- gen/ml1/src/lib.rs | 1075 +- gen/monitoring3-cli/Cargo.toml | 4 +- gen/monitoring3-cli/README.md | 2 +- gen/monitoring3-cli/mkdocs.yml | 2 +- gen/monitoring3-cli/src/main.rs | 40 +- gen/monitoring3/Cargo.toml | 6 +- gen/monitoring3/README.md | 46 +- gen/monitoring3/src/lib.rs | 1381 +- gen/oslogin1-cli/Cargo.toml | 6 +- gen/oslogin1-cli/README.md | 4 +- gen/oslogin1-cli/mkdocs.yml | 2 +- gen/oslogin1-cli/src/main.rs | 9 +- gen/oslogin1/Cargo.toml | 8 +- gen/oslogin1/README.md | 44 +- gen/oslogin1/src/lib.rs | 160 +- gen/oslogin1_beta-cli/Cargo.toml | 6 +- gen/oslogin1_beta-cli/README.md | 4 +- gen/oslogin1_beta-cli/mkdocs.yml | 2 +- gen/oslogin1_beta-cli/src/main.rs | 9 +- gen/oslogin1_beta/Cargo.toml | 8 +- gen/oslogin1_beta/README.md | 44 +- gen/oslogin1_beta/src/lib.rs | 184 +- gen/pagespeedonline2-cli/Cargo.toml | 4 +- gen/pagespeedonline2-cli/README.md | 2 +- gen/pagespeedonline2-cli/mkdocs.yml | 2 +- gen/pagespeedonline2-cli/src/main.rs | 2 +- gen/pagespeedonline2/Cargo.toml | 6 +- gen/pagespeedonline2/README.md | 42 +- gen/pagespeedonline2/src/lib.rs | 11 +- gen/pagespeedonline4-cli/Cargo.toml | 4 +- gen/pagespeedonline4-cli/README.md | 2 +- gen/pagespeedonline4-cli/mkdocs.yml | 2 +- gen/pagespeedonline4-cli/src/main.rs | 2 +- gen/pagespeedonline4/Cargo.toml | 6 +- gen/pagespeedonline4/README.md | 42 +- gen/pagespeedonline4/src/lib.rs | 11 +- gen/pagespeedonline5-cli/Cargo.toml | 42 + gen/pagespeedonline5-cli/LICENSE.md | 30 + gen/pagespeedonline5-cli/README.md | 110 + gen/pagespeedonline5-cli/mkdocs.yml | 17 + gen/pagespeedonline5-cli/src/cmn.rs | 799 + gen/pagespeedonline5-cli/src/main.rs | 329 + gen/pagespeedonline5/Cargo.toml | 32 + gen/pagespeedonline5/LICENSE.md | 30 + gen/pagespeedonline5/README.md | 187 + gen/pagespeedonline5/src/cmn.rs | 753 + gen/pagespeedonline5/src/lib.rs | 1093 + gen/partners2/Cargo.toml | 2 +- gen/partners2/src/lib.rs | 153 +- gen/people1-cli/Cargo.toml | 4 +- gen/people1-cli/README.md | 2 +- gen/people1-cli/mkdocs.yml | 2 +- gen/people1-cli/src/main.rs | 16 +- gen/people1/Cargo.toml | 6 +- gen/people1/README.md | 46 +- gen/people1/src/lib.rs | 437 +- gen/photoslibrary1-cli/Cargo.toml | 4 +- gen/photoslibrary1-cli/README.md | 5 +- gen/photoslibrary1-cli/mkdocs.yml | 5 +- gen/photoslibrary1-cli/src/main.rs | 362 +- gen/photoslibrary1/Cargo.toml | 6 +- gen/photoslibrary1/README.md | 55 +- gen/photoslibrary1/src/lib.rs | 5602 +- gen/playcustomapp1/Cargo.toml | 2 +- gen/playcustomapp1/src/lib.rs | 9 +- gen/playmoviespartner1/Cargo.toml | 2 +- gen/playmoviespartner1/src/lib.rs | 54 +- gen/plus1-cli/Cargo.toml | 4 +- gen/plus1-cli/README.md | 2 +- gen/plus1-cli/mkdocs.yml | 2 +- gen/plus1-cli/src/main.rs | 16 +- gen/plus1/Cargo.toml | 6 +- gen/plus1/README.md | 50 +- gen/plus1/src/lib.rs | 115 +- gen/plusdomains1-cli/Cargo.toml | 4 +- gen/plusdomains1-cli/README.md | 11 +- gen/plusdomains1-cli/mkdocs.yml | 11 +- gen/plusdomains1-cli/src/main.rs | 992 +- gen/plusdomains1/Cargo.toml | 6 +- gen/plusdomains1/README.md | 82 +- gen/plusdomains1/src/lib.rs | 2801 +- gen/prediction1d6/Cargo.toml | 2 +- gen/prediction1d6/src/lib.rs | 72 +- gen/proximitybeacon1_beta1-cli/Cargo.toml | 4 +- gen/proximitybeacon1_beta1-cli/README.md | 2 +- gen/proximitybeacon1_beta1-cli/mkdocs.yml | 2 +- gen/proximitybeacon1_beta1-cli/src/main.rs | 14 +- gen/proximitybeacon1_beta1/Cargo.toml | 6 +- gen/proximitybeacon1_beta1/README.md | 52 +- gen/proximitybeacon1_beta1/src/lib.rs | 310 +- gen/pubsub1-cli/Cargo.toml | 4 +- gen/pubsub1-cli/README.md | 2 +- gen/pubsub1-cli/mkdocs.yml | 2 +- gen/pubsub1-cli/src/main.rs | 94 +- gen/pubsub1/Cargo.toml | 6 +- gen/pubsub1/README.md | 42 +- gen/pubsub1/src/lib.rs | 1427 +- gen/pubsub1_beta2-cli/Cargo.toml | 4 +- gen/pubsub1_beta2-cli/README.md | 2 +- gen/pubsub1_beta2-cli/mkdocs.yml | 2 +- gen/pubsub1_beta2-cli/src/main.rs | 12 +- gen/pubsub1_beta2/Cargo.toml | 6 +- gen/pubsub1_beta2/README.md | 42 +- gen/pubsub1_beta2/src/lib.rs | 315 +- gen/qpxexpress1/Cargo.toml | 2 +- gen/qpxexpress1/src/lib.rs | 9 +- gen/redis1-cli/Cargo.toml | 4 +- gen/redis1-cli/README.md | 3 +- gen/redis1-cli/mkdocs.yml | 3 +- gen/redis1-cli/src/main.rs | 133 +- gen/redis1/Cargo.toml | 6 +- gen/redis1/README.md | 43 +- gen/redis1/src/lib.rs | 569 +- gen/remotebuildexecution2-cli/Cargo.toml | 42 + gen/remotebuildexecution2-cli/LICENSE.md | 30 + gen/remotebuildexecution2-cli/README.md | 126 + gen/remotebuildexecution2-cli/mkdocs.yml | 25 + gen/remotebuildexecution2-cli/src/cmn.rs | 799 + gen/remotebuildexecution2-cli/src/main.rs | 1470 + gen/remotebuildexecution2/Cargo.toml | 32 + gen/remotebuildexecution2/LICENSE.md | 30 + gen/remotebuildexecution2/README.md | 199 + gen/remotebuildexecution2/src/cmn.rs | 753 + gen/remotebuildexecution2/src/lib.rs | 4710 + gen/replicapool1_beta2/Cargo.toml | 2 +- gen/replicapool1_beta2/src/lib.rs | 108 +- gen/replicapoolupdater1_beta1/Cargo.toml | 2 +- gen/replicapoolupdater1_beta1/src/lib.rs | 90 +- gen/reseller1_sandbox/Cargo.toml | 2 +- gen/reseller1_sandbox/src/lib.rs | 126 +- gen/resourceviews1_beta2/Cargo.toml | 2 +- gen/resourceviews1_beta2/src/lib.rs | 99 +- gen/run1-cli/Cargo.toml | 42 + gen/run1-cli/LICENSE.md | 30 + gen/run1-cli/README.md | 114 + gen/run1-cli/mkdocs.yml | 17 + gen/run1-cli/src/cmn.rs | 799 + gen/run1-cli/src/main.rs | 324 + gen/run1/Cargo.toml | 32 + gen/run1/LICENSE.md | 30 + gen/run1/README.md | 182 + gen/run1/src/cmn.rs | 753 + gen/run1/src/lib.rs | 711 + gen/runtimeconfig1-cli/Cargo.toml | 4 +- gen/runtimeconfig1-cli/README.md | 2 +- gen/runtimeconfig1-cli/mkdocs.yml | 2 +- gen/runtimeconfig1-cli/src/main.rs | 2 +- gen/runtimeconfig1/Cargo.toml | 6 +- gen/runtimeconfig1/README.md | 44 +- gen/runtimeconfig1/src/lib.rs | 95 +- gen/runtimeconfig1_beta1-cli/Cargo.toml | 4 +- gen/runtimeconfig1_beta1-cli/README.md | 2 +- gen/runtimeconfig1_beta1-cli/mkdocs.yml | 2 +- gen/runtimeconfig1_beta1-cli/src/main.rs | 6 +- gen/runtimeconfig1_beta1/Cargo.toml | 6 +- gen/runtimeconfig1_beta1/README.md | 46 +- gen/runtimeconfig1_beta1/src/lib.rs | 326 +- gen/safebrowsing4-cli/Cargo.toml | 4 +- gen/safebrowsing4-cli/README.md | 2 +- gen/safebrowsing4-cli/mkdocs.yml | 2 +- gen/safebrowsing4-cli/src/main.rs | 2 +- gen/safebrowsing4/Cargo.toml | 6 +- gen/safebrowsing4/README.md | 56 +- gen/safebrowsing4/src/lib.rs | 139 +- gen/searchconsole1-cli/Cargo.toml | 4 +- gen/searchconsole1-cli/README.md | 2 +- gen/searchconsole1-cli/mkdocs.yml | 2 +- gen/searchconsole1-cli/src/main.rs | 2 +- gen/searchconsole1/Cargo.toml | 6 +- gen/searchconsole1/README.md | 42 +- gen/searchconsole1/src/lib.rs | 15 +- gen/securitycenter1-cli/Cargo.toml | 42 + gen/securitycenter1-cli/LICENSE.md | 30 + gen/securitycenter1-cli/README.md | 136 + gen/securitycenter1-cli/mkdocs.yml | 39 + gen/securitycenter1-cli/src/cmn.rs | 799 + gen/securitycenter1-cli/src/main.rs | 2768 + gen/securitycenter1/Cargo.toml | 32 + gen/securitycenter1/LICENSE.md | 30 + gen/securitycenter1/README.md | 191 + gen/securitycenter1/src/cmn.rs | 753 + gen/securitycenter1/src/lib.rs | 8936 ++ gen/servicebroker1-cli/Cargo.toml | 4 +- gen/servicebroker1-cli/README.md | 2 +- gen/servicebroker1-cli/mkdocs.yml | 2 +- gen/servicebroker1-cli/src/main.rs | 2 +- gen/servicebroker1/Cargo.toml | 6 +- gen/servicebroker1/README.md | 46 +- gen/servicebroker1/src/lib.rs | 53 +- gen/servicecontrol1-cli/Cargo.toml | 4 +- gen/servicecontrol1-cli/README.md | 5 +- gen/servicecontrol1-cli/mkdocs.yml | 5 +- gen/servicecontrol1-cli/src/main.rs | 417 +- gen/servicecontrol1/Cargo.toml | 6 +- gen/servicecontrol1/README.md | 42 +- gen/servicecontrol1/src/lib.rs | 2516 +- gen/serviceregistryalpha/Cargo.toml | 2 +- gen/serviceregistryalpha/src/lib.rs | 72 +- gen/sheets4-cli/Cargo.toml | 4 +- gen/sheets4-cli/README.md | 2 +- gen/sheets4-cli/mkdocs.yml | 2 +- gen/sheets4-cli/src/main.rs | 26 +- gen/sheets4/Cargo.toml | 6 +- gen/sheets4/README.md | 44 +- gen/sheets4/src/lib.rs | 4476 +- gen/siteverification1/Cargo.toml | 2 +- gen/siteverification1/src/lib.rs | 63 +- gen/sourcerepo1-cli/Cargo.toml | 4 +- gen/sourcerepo1-cli/README.md | 2 +- gen/sourcerepo1-cli/mkdocs.yml | 2 +- gen/sourcerepo1-cli/src/main.rs | 12 +- gen/sourcerepo1/Cargo.toml | 6 +- gen/sourcerepo1/README.md | 42 +- gen/sourcerepo1/src/lib.rs | 148 +- gen/spanner1-cli/Cargo.toml | 4 +- gen/spanner1-cli/README.md | 3 +- gen/spanner1-cli/mkdocs.yml | 3 +- gen/spanner1-cli/src/main.rs | 155 +- gen/spanner1/Cargo.toml | 6 +- gen/spanner1/README.md | 42 +- gen/spanner1/src/lib.rs | 3482 +- gen/spectrum1_explorer/Cargo.toml | 2 +- gen/spectrum1_explorer/src/lib.rs | 54 +- gen/speech1-cli/Cargo.toml | 4 +- gen/speech1-cli/README.md | 6 +- gen/speech1-cli/mkdocs.yml | 5 +- gen/speech1-cli/src/main.rs | 297 +- gen/speech1/Cargo.toml | 6 +- gen/speech1/README.md | 50 +- gen/speech1/src/lib.rs | 1627 +- gen/speech1_beta1/Cargo.toml | 2 +- gen/speech1_beta1/src/lib.rs | 38 +- gen/sqladmin1_beta4-cli/Cargo.toml | 4 +- gen/sqladmin1_beta4-cli/README.md | 2 +- gen/sqladmin1_beta4-cli/mkdocs.yml | 2 +- gen/sqladmin1_beta4-cli/src/main.rs | 23 +- gen/sqladmin1_beta4/Cargo.toml | 6 +- gen/sqladmin1_beta4/README.md | 70 +- gen/sqladmin1_beta4/src/lib.rs | 574 +- gen/storage1-cli/Cargo.toml | 4 +- gen/storage1-cli/README.md | 2 +- gen/storage1-cli/mkdocs.yml | 2 +- gen/storage1-cli/src/main.rs | 16 +- gen/storage1/Cargo.toml | 6 +- gen/storage1/README.md | 76 +- gen/storage1/src/lib.rs | 705 +- gen/storagetransfer1-cli/Cargo.toml | 6 +- gen/storagetransfer1-cli/README.md | 4 +- gen/storagetransfer1-cli/mkdocs.yml | 2 +- gen/storagetransfer1-cli/src/main.rs | 22 +- gen/storagetransfer1/Cargo.toml | 8 +- gen/storagetransfer1/README.md | 54 +- gen/storagetransfer1/src/lib.rs | 217 +- gen/surveys2/Cargo.toml | 2 +- gen/surveys2/src/lib.rs | 72 +- gen/tagmanager1-cli/Cargo.toml | 4 +- gen/tagmanager1-cli/README.md | 3 +- gen/tagmanager1-cli/mkdocs.yml | 3 +- gen/tagmanager1-cli/src/main.rs | 147 +- gen/tagmanager1/Cargo.toml | 6 +- gen/tagmanager1/README.md | 45 +- gen/tagmanager1/src/lib.rs | 810 +- gen/tagmanager2-cli/Cargo.toml | 4 +- gen/tagmanager2-cli/README.md | 13 +- gen/tagmanager2-cli/mkdocs.yml | 13 +- gen/tagmanager2-cli/src/main.rs | 1118 +- gen/tagmanager2/Cargo.toml | 6 +- gen/tagmanager2/README.md | 67 +- gen/tagmanager2/src/lib.rs | 4261 +- gen/taskqueue1_beta2/Cargo.toml | 2 +- gen/taskqueue1_beta2/src/lib.rs | 72 +- gen/tasks1-cli/Cargo.toml | 4 +- gen/tasks1-cli/README.md | 2 +- gen/tasks1-cli/mkdocs.yml | 2 +- gen/tasks1-cli/src/main.rs | 4 +- gen/tasks1/Cargo.toml | 6 +- gen/tasks1/README.md | 46 +- gen/tasks1/src/lib.rs | 134 +- gen/testing1-cli/Cargo.toml | 4 +- gen/testing1-cli/README.md | 2 +- gen/testing1-cli/mkdocs.yml | 2 +- gen/testing1-cli/src/main.rs | 31 +- gen/testing1/Cargo.toml | 6 +- gen/testing1/README.md | 48 +- gen/testing1/src/lib.rs | 1175 +- gen/texttospeech1-cli/Cargo.toml | 4 +- gen/texttospeech1-cli/README.md | 2 +- gen/texttospeech1-cli/mkdocs.yml | 2 +- gen/texttospeech1-cli/src/main.rs | 9 +- gen/texttospeech1/Cargo.toml | 6 +- gen/texttospeech1/README.md | 46 +- gen/texttospeech1/src/lib.rs | 52 +- gen/tpu1-cli/Cargo.toml | 4 +- gen/tpu1-cli/README.md | 2 +- gen/tpu1-cli/mkdocs.yml | 2 +- gen/tpu1-cli/src/main.rs | 2 +- gen/tpu1/Cargo.toml | 6 +- gen/tpu1/README.md | 42 +- gen/tpu1/src/lib.rs | 715 +- gen/tpu1_alpha1-cli/Cargo.toml | 4 +- gen/tpu1_alpha1-cli/README.md | 2 +- gen/tpu1_alpha1-cli/mkdocs.yml | 2 +- gen/tpu1_alpha1-cli/src/main.rs | 6 +- gen/tpu1_alpha1/Cargo.toml | 6 +- gen/tpu1_alpha1/README.md | 42 +- gen/tpu1_alpha1/src/lib.rs | 723 +- gen/translate2/Cargo.toml | 2 +- gen/translate2/src/lib.rs | 91 +- gen/urlshortener1/Cargo.toml | 2 +- gen/urlshortener1/src/lib.rs | 27 +- gen/vault1-cli/Cargo.toml | 4 +- gen/vault1-cli/README.md | 6 +- gen/vault1-cli/mkdocs.yml | 6 +- gen/vault1-cli/src/main.rs | 403 +- gen/vault1/Cargo.toml | 6 +- gen/vault1/README.md | 52 +- gen/vault1/src/lib.rs | 1963 +- gen/videointelligence1-cli/Cargo.toml | 4 +- gen/videointelligence1-cli/README.md | 2 +- gen/videointelligence1-cli/mkdocs.yml | 2 +- gen/videointelligence1-cli/src/main.rs | 17 +- gen/videointelligence1/Cargo.toml | 6 +- gen/videointelligence1/README.md | 44 +- gen/videointelligence1/src/lib.rs | 294 +- gen/videointelligence1_beta1/Cargo.toml | 2 +- gen/videointelligence1_beta1/src/lib.rs | 9 +- gen/vision1-cli/Cargo.toml | 4 +- gen/vision1-cli/README.md | 21 +- gen/vision1-cli/mkdocs.yml | 20 +- gen/vision1-cli/src/main.rs | 1961 +- gen/vision1/Cargo.toml | 6 +- gen/vision1/README.md | 55 +- gen/vision1/src/lib.rs | 8133 +- gen/webfonts1/Cargo.toml | 2 +- gen/webfonts1/src/lib.rs | 9 +- gen/webmasters3/Cargo.toml | 2 +- gen/webmasters3/src/lib.rs | 117 +- gen/youtube3-cli/Cargo.toml | 4 +- gen/youtube3-cli/README.md | 2 +- gen/youtube3-cli/mkdocs.yml | 2 +- gen/youtube3-cli/src/main.rs | 14 +- gen/youtube3/Cargo.toml | 6 +- gen/youtube3/README.md | 154 +- gen/youtube3/src/lib.rs | 735 +- gen/youtubeanalytics1-cli/Cargo.toml | 4 +- gen/youtubeanalytics1-cli/README.md | 2 +- gen/youtubeanalytics1-cli/mkdocs.yml | 2 +- gen/youtubeanalytics1-cli/src/main.rs | 2 +- gen/youtubeanalytics1/Cargo.toml | 6 +- gen/youtubeanalytics1/README.md | 50 +- gen/youtubeanalytics1/src/lib.rs | 74 +- gen/youtubeanalytics2-cli/Cargo.toml | 4 +- gen/youtubeanalytics2-cli/README.md | 2 +- gen/youtubeanalytics2-cli/mkdocs.yml | 2 +- gen/youtubeanalytics2-cli/src/main.rs | 2 +- gen/youtubeanalytics2/Cargo.toml | 6 +- gen/youtubeanalytics2/README.md | 50 +- gen/youtubeanalytics2/src/lib.rs | 136 +- gen/youtubereporting1-cli/Cargo.toml | 4 +- gen/youtubereporting1-cli/README.md | 2 +- gen/youtubereporting1-cli/mkdocs.yml | 2 +- gen/youtubereporting1-cli/src/main.rs | 6 +- gen/youtubereporting1/Cargo.toml | 6 +- gen/youtubereporting1/README.md | 52 +- gen/youtubereporting1/src/lib.rs | 180 +- 1212 files changed, 440610 insertions(+), 142417 deletions(-) create mode 100644 gen/accesscontextmanager1-cli/Cargo.toml create mode 100644 gen/accesscontextmanager1-cli/LICENSE.md create mode 100644 gen/accesscontextmanager1-cli/README.md create mode 100644 gen/accesscontextmanager1-cli/mkdocs.yml create mode 100644 gen/accesscontextmanager1-cli/src/cmn.rs create mode 100644 gen/accesscontextmanager1-cli/src/main.rs create mode 100644 gen/accesscontextmanager1/Cargo.toml create mode 100644 gen/accesscontextmanager1/LICENSE.md create mode 100644 gen/accesscontextmanager1/README.md create mode 100644 gen/accesscontextmanager1/src/cmn.rs create mode 100644 gen/accesscontextmanager1/src/lib.rs create mode 100644 gen/bigtableadmin2-cli/Cargo.toml create mode 100644 gen/bigtableadmin2-cli/LICENSE.md create mode 100644 gen/bigtableadmin2-cli/README.md create mode 100644 gen/bigtableadmin2-cli/mkdocs.yml create mode 100644 gen/bigtableadmin2-cli/src/cmn.rs create mode 100644 gen/bigtableadmin2-cli/src/main.rs create mode 100644 gen/bigtableadmin2/Cargo.toml create mode 100644 gen/bigtableadmin2/LICENSE.md create mode 100644 gen/bigtableadmin2/README.md create mode 100644 gen/bigtableadmin2/src/cmn.rs create mode 100644 gen/bigtableadmin2/src/lib.rs create mode 100644 gen/cloudasset1-cli/Cargo.toml create mode 100644 gen/cloudasset1-cli/LICENSE.md create mode 100644 gen/cloudasset1-cli/README.md create mode 100644 gen/cloudasset1-cli/mkdocs.yml create mode 100644 gen/cloudasset1-cli/src/cmn.rs create mode 100644 gen/cloudasset1-cli/src/main.rs create mode 100644 gen/cloudasset1/Cargo.toml create mode 100644 gen/cloudasset1/LICENSE.md create mode 100644 gen/cloudasset1/README.md create mode 100644 gen/cloudasset1/src/cmn.rs create mode 100644 gen/cloudasset1/src/lib.rs create mode 100644 gen/cloudidentity1-cli/Cargo.toml create mode 100644 gen/cloudidentity1-cli/LICENSE.md create mode 100644 gen/cloudidentity1-cli/README.md create mode 100644 gen/cloudidentity1-cli/mkdocs.yml create mode 100644 gen/cloudidentity1-cli/src/cmn.rs create mode 100644 gen/cloudidentity1-cli/src/main.rs create mode 100644 gen/cloudidentity1/Cargo.toml create mode 100644 gen/cloudidentity1/LICENSE.md create mode 100644 gen/cloudidentity1/README.md create mode 100644 gen/cloudidentity1/src/cmn.rs create mode 100644 gen/cloudidentity1/src/lib.rs create mode 100644 gen/cloudprivatecatalog1_beta1-cli/Cargo.toml create mode 100644 gen/cloudprivatecatalog1_beta1-cli/LICENSE.md create mode 100644 gen/cloudprivatecatalog1_beta1-cli/README.md create mode 100644 gen/cloudprivatecatalog1_beta1-cli/mkdocs.yml create mode 100644 gen/cloudprivatecatalog1_beta1-cli/src/cmn.rs create mode 100644 gen/cloudprivatecatalog1_beta1-cli/src/main.rs create mode 100644 gen/cloudprivatecatalog1_beta1/Cargo.toml create mode 100644 gen/cloudprivatecatalog1_beta1/LICENSE.md create mode 100644 gen/cloudprivatecatalog1_beta1/README.md create mode 100644 gen/cloudprivatecatalog1_beta1/src/cmn.rs create mode 100644 gen/cloudprivatecatalog1_beta1/src/lib.rs create mode 100644 gen/cloudprivatecatalogproducer1_beta1-cli/Cargo.toml create mode 100644 gen/cloudprivatecatalogproducer1_beta1-cli/LICENSE.md create mode 100644 gen/cloudprivatecatalogproducer1_beta1-cli/README.md create mode 100644 gen/cloudprivatecatalogproducer1_beta1-cli/mkdocs.yml create mode 100644 gen/cloudprivatecatalogproducer1_beta1-cli/src/cmn.rs create mode 100644 gen/cloudprivatecatalogproducer1_beta1-cli/src/main.rs create mode 100644 gen/cloudprivatecatalogproducer1_beta1/Cargo.toml create mode 100644 gen/cloudprivatecatalogproducer1_beta1/LICENSE.md create mode 100644 gen/cloudprivatecatalogproducer1_beta1/README.md create mode 100644 gen/cloudprivatecatalogproducer1_beta1/src/cmn.rs create mode 100644 gen/cloudprivatecatalogproducer1_beta1/src/lib.rs create mode 100644 gen/cloudscheduler1_beta1-cli/Cargo.toml create mode 100644 gen/cloudscheduler1_beta1-cli/LICENSE.md create mode 100644 gen/cloudscheduler1_beta1-cli/README.md create mode 100644 gen/cloudscheduler1_beta1-cli/mkdocs.yml create mode 100644 gen/cloudscheduler1_beta1-cli/src/cmn.rs create mode 100644 gen/cloudscheduler1_beta1-cli/src/main.rs create mode 100644 gen/cloudscheduler1_beta1/Cargo.toml create mode 100644 gen/cloudscheduler1_beta1/LICENSE.md create mode 100644 gen/cloudscheduler1_beta1/README.md create mode 100644 gen/cloudscheduler1_beta1/src/cmn.rs create mode 100644 gen/cloudscheduler1_beta1/src/lib.rs create mode 100644 gen/cloudtasks2-cli/Cargo.toml create mode 100644 gen/cloudtasks2-cli/LICENSE.md create mode 100644 gen/cloudtasks2-cli/README.md create mode 100644 gen/cloudtasks2-cli/mkdocs.yml create mode 100644 gen/cloudtasks2-cli/src/cmn.rs create mode 100644 gen/cloudtasks2-cli/src/main.rs create mode 100644 gen/cloudtasks2/Cargo.toml create mode 100644 gen/cloudtasks2/LICENSE.md create mode 100644 gen/cloudtasks2/README.md create mode 100644 gen/cloudtasks2/src/cmn.rs create mode 100644 gen/cloudtasks2/src/lib.rs create mode 100644 gen/containeranalysis1_beta1-cli/Cargo.toml create mode 100644 gen/containeranalysis1_beta1-cli/LICENSE.md create mode 100644 gen/containeranalysis1_beta1-cli/README.md create mode 100644 gen/containeranalysis1_beta1-cli/mkdocs.yml create mode 100644 gen/containeranalysis1_beta1-cli/src/cmn.rs create mode 100644 gen/containeranalysis1_beta1-cli/src/main.rs create mode 100644 gen/containeranalysis1_beta1/Cargo.toml create mode 100644 gen/containeranalysis1_beta1/LICENSE.md create mode 100644 gen/containeranalysis1_beta1/README.md create mode 100644 gen/containeranalysis1_beta1/src/cmn.rs create mode 100644 gen/containeranalysis1_beta1/src/lib.rs create mode 100644 gen/dfareporting3d3-cli/Cargo.toml create mode 100644 gen/dfareporting3d3-cli/LICENSE.md create mode 100644 gen/dfareporting3d3-cli/README.md create mode 100644 gen/dfareporting3d3-cli/mkdocs.yml create mode 100644 gen/dfareporting3d3-cli/src/cmn.rs create mode 100644 gen/dfareporting3d3-cli/src/main.rs create mode 100644 gen/dfareporting3d3/Cargo.toml create mode 100644 gen/dfareporting3d3/LICENSE.md create mode 100644 gen/dfareporting3d3/README.md create mode 100644 gen/dfareporting3d3/src/cmn.rs create mode 100644 gen/dfareporting3d3/src/lib.rs create mode 100644 gen/docs1-cli/Cargo.toml create mode 100644 gen/docs1-cli/LICENSE.md create mode 100644 gen/docs1-cli/README.md create mode 100644 gen/docs1-cli/mkdocs.yml create mode 100644 gen/docs1-cli/src/cmn.rs create mode 100644 gen/docs1-cli/src/main.rs create mode 100644 gen/docs1/Cargo.toml create mode 100644 gen/docs1/LICENSE.md create mode 100644 gen/docs1/README.md create mode 100644 gen/docs1/src/cmn.rs create mode 100644 gen/docs1/src/lib.rs create mode 100644 gen/driveactivity2-cli/Cargo.toml create mode 100644 gen/driveactivity2-cli/LICENSE.md create mode 100644 gen/driveactivity2-cli/README.md create mode 100644 gen/driveactivity2-cli/mkdocs.yml create mode 100644 gen/driveactivity2-cli/src/cmn.rs create mode 100644 gen/driveactivity2-cli/src/main.rs create mode 100644 gen/driveactivity2/Cargo.toml create mode 100644 gen/driveactivity2/LICENSE.md create mode 100644 gen/driveactivity2/README.md create mode 100644 gen/driveactivity2/src/cmn.rs create mode 100644 gen/driveactivity2/src/lib.rs create mode 100644 gen/factchecktools1_alpha1-cli/Cargo.toml create mode 100644 gen/factchecktools1_alpha1-cli/LICENSE.md create mode 100644 gen/factchecktools1_alpha1-cli/README.md create mode 100644 gen/factchecktools1_alpha1-cli/mkdocs.yml create mode 100644 gen/factchecktools1_alpha1-cli/src/cmn.rs create mode 100644 gen/factchecktools1_alpha1-cli/src/main.rs create mode 100644 gen/factchecktools1_alpha1/Cargo.toml create mode 100644 gen/factchecktools1_alpha1/LICENSE.md create mode 100644 gen/factchecktools1_alpha1/README.md create mode 100644 gen/factchecktools1_alpha1/src/cmn.rs create mode 100644 gen/factchecktools1_alpha1/src/lib.rs create mode 100644 gen/file1-cli/Cargo.toml create mode 100644 gen/file1-cli/LICENSE.md create mode 100644 gen/file1-cli/README.md create mode 100644 gen/file1-cli/mkdocs.yml create mode 100644 gen/file1-cli/src/cmn.rs create mode 100644 gen/file1-cli/src/main.rs create mode 100644 gen/file1/Cargo.toml create mode 100644 gen/file1/LICENSE.md create mode 100644 gen/file1/README.md create mode 100644 gen/file1/src/cmn.rs create mode 100644 gen/file1/src/lib.rs create mode 100644 gen/healthcare1_beta1-cli/Cargo.toml create mode 100644 gen/healthcare1_beta1-cli/LICENSE.md create mode 100644 gen/healthcare1_beta1-cli/README.md create mode 100644 gen/healthcare1_beta1-cli/mkdocs.yml create mode 100644 gen/healthcare1_beta1-cli/src/cmn.rs create mode 100644 gen/healthcare1_beta1-cli/src/main.rs create mode 100644 gen/healthcare1_beta1/Cargo.toml create mode 100644 gen/healthcare1_beta1/LICENSE.md create mode 100644 gen/healthcare1_beta1/README.md create mode 100644 gen/healthcare1_beta1/src/cmn.rs create mode 100644 gen/healthcare1_beta1/src/lib.rs create mode 100644 gen/iap1-cli/Cargo.toml create mode 100644 gen/iap1-cli/LICENSE.md create mode 100644 gen/iap1-cli/README.md create mode 100644 gen/iap1-cli/mkdocs.yml create mode 100644 gen/iap1-cli/src/cmn.rs create mode 100644 gen/iap1-cli/src/main.rs create mode 100644 gen/iap1/Cargo.toml create mode 100644 gen/iap1/LICENSE.md create mode 100644 gen/iap1/README.md create mode 100644 gen/iap1/src/cmn.rs create mode 100644 gen/iap1/src/lib.rs create mode 100644 gen/libraryagent1-cli/Cargo.toml create mode 100644 gen/libraryagent1-cli/LICENSE.md create mode 100644 gen/libraryagent1-cli/README.md create mode 100644 gen/libraryagent1-cli/mkdocs.yml create mode 100644 gen/libraryagent1-cli/src/cmn.rs create mode 100644 gen/libraryagent1-cli/src/main.rs create mode 100644 gen/libraryagent1/Cargo.toml create mode 100644 gen/libraryagent1/LICENSE.md create mode 100644 gen/libraryagent1/README.md create mode 100644 gen/libraryagent1/src/cmn.rs create mode 100644 gen/libraryagent1/src/lib.rs create mode 100644 gen/pagespeedonline5-cli/Cargo.toml create mode 100644 gen/pagespeedonline5-cli/LICENSE.md create mode 100644 gen/pagespeedonline5-cli/README.md create mode 100644 gen/pagespeedonline5-cli/mkdocs.yml create mode 100644 gen/pagespeedonline5-cli/src/cmn.rs create mode 100644 gen/pagespeedonline5-cli/src/main.rs create mode 100644 gen/pagespeedonline5/Cargo.toml create mode 100644 gen/pagespeedonline5/LICENSE.md create mode 100644 gen/pagespeedonline5/README.md create mode 100644 gen/pagespeedonline5/src/cmn.rs create mode 100644 gen/pagespeedonline5/src/lib.rs create mode 100644 gen/remotebuildexecution2-cli/Cargo.toml create mode 100644 gen/remotebuildexecution2-cli/LICENSE.md create mode 100644 gen/remotebuildexecution2-cli/README.md create mode 100644 gen/remotebuildexecution2-cli/mkdocs.yml create mode 100644 gen/remotebuildexecution2-cli/src/cmn.rs create mode 100644 gen/remotebuildexecution2-cli/src/main.rs create mode 100644 gen/remotebuildexecution2/Cargo.toml create mode 100644 gen/remotebuildexecution2/LICENSE.md create mode 100644 gen/remotebuildexecution2/README.md create mode 100644 gen/remotebuildexecution2/src/cmn.rs create mode 100644 gen/remotebuildexecution2/src/lib.rs create mode 100644 gen/run1-cli/Cargo.toml create mode 100644 gen/run1-cli/LICENSE.md create mode 100644 gen/run1-cli/README.md create mode 100644 gen/run1-cli/mkdocs.yml create mode 100644 gen/run1-cli/src/cmn.rs create mode 100644 gen/run1-cli/src/main.rs create mode 100644 gen/run1/Cargo.toml create mode 100644 gen/run1/LICENSE.md create mode 100644 gen/run1/README.md create mode 100644 gen/run1/src/cmn.rs create mode 100644 gen/run1/src/lib.rs create mode 100644 gen/securitycenter1-cli/Cargo.toml create mode 100644 gen/securitycenter1-cli/LICENSE.md create mode 100644 gen/securitycenter1-cli/README.md create mode 100644 gen/securitycenter1-cli/mkdocs.yml create mode 100644 gen/securitycenter1-cli/src/cmn.rs create mode 100644 gen/securitycenter1-cli/src/main.rs create mode 100644 gen/securitycenter1/Cargo.toml create mode 100644 gen/securitycenter1/LICENSE.md create mode 100644 gen/securitycenter1/README.md create mode 100644 gen/securitycenter1/src/cmn.rs create mode 100644 gen/securitycenter1/src/lib.rs diff --git a/gen/abusiveexperiencereport1-cli/Cargo.toml b/gen/abusiveexperiencereport1-cli/Cargo.toml index 188f35cee4..18c99a4e12 100644 --- a/gen/abusiveexperiencereport1-cli/Cargo.toml +++ b/gen/abusiveexperiencereport1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-abusiveexperiencereport1-cli" -version = "1.0.8+20180904" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with Abusive Experience Report (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/abusiveexperiencereport1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-abusiveexperiencereport1] path = "../abusiveexperiencereport1" -version = "1.0.8+20180904" +version = "1.0.8+20190401" diff --git a/gen/abusiveexperiencereport1-cli/README.md b/gen/abusiveexperiencereport1-cli/README.md index f942b26249..5ef0f416ff 100644 --- a/gen/abusiveexperiencereport1-cli/README.md +++ b/gen/abusiveexperiencereport1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Abusive Experience Report* API at revision *20180904*. The CLI is at version *1.0.8*. +This documentation was generated from the *Abusive Experience Report* API at revision *20190401*. The CLI is at version *1.0.8*. ```bash abusiveexperiencereport1 [options] diff --git a/gen/abusiveexperiencereport1-cli/mkdocs.yml b/gen/abusiveexperiencereport1-cli/mkdocs.yml index ef79965d64..bb577d7bf1 100644 --- a/gen/abusiveexperiencereport1-cli/mkdocs.yml +++ b/gen/abusiveexperiencereport1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Abusive Experience Report v1.0.8+20180904 +site_name: Abusive Experience Report v1.0.8+20190401 site_url: http://byron.github.io/google-apis-rs/google-abusiveexperiencereport1-cli site_description: A complete library to interact with Abusive Experience Report (protocol v1) diff --git a/gen/abusiveexperiencereport1-cli/src/main.rs b/gen/abusiveexperiencereport1-cli/src/main.rs index 6ef6f05ee7..51b65083aa 100644 --- a/gen/abusiveexperiencereport1-cli/src/main.rs +++ b/gen/abusiveexperiencereport1-cli/src/main.rs @@ -317,8 +317,8 @@ fn main() { let mut app = App::new("abusiveexperiencereport1") .author("Sebastian Thiel ") - .version("1.0.8+20180904") - .about("View Abusive Experience Report data, and get a list of sites that have a significant number of abusive experiences.") + .version("1.0.8+20190401") + .about("Views Abusive Experience Report data, and gets a list of sites that have a significant number of abusive experiences.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_abusiveexperiencereport1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/abusiveexperiencereport1/Cargo.toml b/gen/abusiveexperiencereport1/Cargo.toml index 7eb5e234fe..c4506a7223 100644 --- a/gen/abusiveexperiencereport1/Cargo.toml +++ b/gen/abusiveexperiencereport1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-abusiveexperiencereport1" -version = "1.0.8+20180904" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with Abusive Experience Report (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/abusiveexperiencereport1" homepage = "https://developers.google.com/abusive-experience-report/" -documentation = "https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904" +documentation = "https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401" license = "MIT" keywords = ["abusiveexperiencerep", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/abusiveexperiencereport1/README.md b/gen/abusiveexperiencereport1/README.md index 83ed6f0947..a4e5c2fd1a 100644 --- a/gen/abusiveexperiencereport1/README.md +++ b/gen/abusiveexperiencereport1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-abusiveexperiencereport1` library allows access to all features of the *Google Abusive Experience Report* service. -This documentation was generated from *Abusive Experience Report* crate version *1.0.8+20180904*, where *20180904* is the exact revision of the *abusiveexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Abusive Experience Report* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *abusiveexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Abusive Experience Report* *v1* API can be found at the [official documentation site](https://developers.google.com/abusive-experience-report/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/struct.AbusiveExperienceReport.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/struct.AbusiveExperienceReport.html) ... * sites - * [*get*](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/struct.SiteGetCall.html) + * [*get*](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/struct.SiteGetCall.html) * violating sites - * [*list*](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/struct.ViolatingSiteListCall.html) + * [*list*](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/struct.ViolatingSiteListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/struct.AbusiveExperienceReport.html)** +* **[Hub](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/struct.AbusiveExperienceReport.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.Part.html)** + * **[Parts](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -126,17 +126,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -146,29 +146,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20180904/google_abusiveexperiencereport1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-abusiveexperiencereport1/1.0.8+20190401/google_abusiveexperiencereport1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/abusiveexperiencereport1/src/lib.rs b/gen/abusiveexperiencereport1/src/lib.rs index 4175c208cc..c2a0397aeb 100644 --- a/gen/abusiveexperiencereport1/src/lib.rs +++ b/gen/abusiveexperiencereport1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Abusive Experience Report* crate version *1.0.8+20180904*, where *20180904* is the exact revision of the *abusiveexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Abusive Experience Report* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *abusiveexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Abusive Experience Report* *v1* API can be found at the //! [official documentation site](https://developers.google.com/abusive-experience-report/). @@ -364,7 +364,6 @@ impl<'a, C, A> AbusiveExperienceReport // SCHEMAS ### // ########## /// Response message for GetSiteSummary. -/// Do not confuse with same message in google.ads.experiencereport.v1 /// /// # Activities /// @@ -387,15 +386,15 @@ pub struct SiteSummaryResponse { /// The name of the site reviewed. #[serde(rename="reviewedSite")] pub reviewed_site: Option, - /// A link that leads to a full abusive experience report. - #[serde(rename="reportUrl")] - pub report_url: Option, - /// The status of the site reviewed for the abusive experiences. - #[serde(rename="abusiveStatus")] - pub abusive_status: Option, /// The abusive experience enforcement status of the site. #[serde(rename="filterStatus")] pub filter_status: Option, + /// The status of the site reviewed for the abusive experiences. + #[serde(rename="abusiveStatus")] + pub abusive_status: Option, + /// A link that leads to a full abusive experience report. + #[serde(rename="reportUrl")] + pub report_url: Option, } impl ResponseResult for SiteSummaryResponse {} @@ -637,7 +636,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -653,10 +652,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -676,7 +672,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -761,7 +757,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -884,10 +880,7 @@ impl<'a, C, A> ViolatingSiteListCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -907,7 +900,7 @@ impl<'a, C, A> ViolatingSiteListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -975,7 +968,7 @@ impl<'a, C, A> ViolatingSiteListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/acceleratedmobilepageurl1-cli/Cargo.toml b/gen/acceleratedmobilepageurl1-cli/Cargo.toml index 2635b3f6a4..e88bb7187c 100644 --- a/gen/acceleratedmobilepageurl1-cli/Cargo.toml +++ b/gen/acceleratedmobilepageurl1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-acceleratedmobilepageurl1-cli" -version = "1.0.8+20180917" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with acceleratedmobilepageurl (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/acceleratedmobilepageurl1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-acceleratedmobilepageurl1] path = "../acceleratedmobilepageurl1" -version = "1.0.8+20180917" +version = "1.0.8+20190330" diff --git a/gen/acceleratedmobilepageurl1-cli/README.md b/gen/acceleratedmobilepageurl1-cli/README.md index 207be051f2..2e945bdd0f 100644 --- a/gen/acceleratedmobilepageurl1-cli/README.md +++ b/gen/acceleratedmobilepageurl1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *acceleratedmobilepageurl* API at revision *20180917*. The CLI is at version *1.0.8*. +This documentation was generated from the *acceleratedmobilepageurl* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash acceleratedmobilepageurl1 [options] diff --git a/gen/acceleratedmobilepageurl1-cli/mkdocs.yml b/gen/acceleratedmobilepageurl1-cli/mkdocs.yml index 8767726a53..da3d8eede6 100644 --- a/gen/acceleratedmobilepageurl1-cli/mkdocs.yml +++ b/gen/acceleratedmobilepageurl1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: acceleratedmobilepageurl v1.0.8+20180917 +site_name: acceleratedmobilepageurl v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-acceleratedmobilepageurl1-cli site_description: A complete library to interact with acceleratedmobilepageurl (protocol v1) diff --git a/gen/acceleratedmobilepageurl1-cli/src/main.rs b/gen/acceleratedmobilepageurl1-cli/src/main.rs index ff85d875b2..0d020a5306 100644 --- a/gen/acceleratedmobilepageurl1-cli/src/main.rs +++ b/gen/acceleratedmobilepageurl1-cli/src/main.rs @@ -260,7 +260,7 @@ fn main() { let mut app = App::new("acceleratedmobilepageurl1") .author("Sebastian Thiel ") - .version("1.0.8+20180917") + .version("1.0.8+20190330") .about("Retrieves the list of AMP URLs (and equivalent AMP Cache URLs) for a given list of public URL(s). ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_acceleratedmobilepageurl1_cli") diff --git a/gen/acceleratedmobilepageurl1/Cargo.toml b/gen/acceleratedmobilepageurl1/Cargo.toml index 0395d509c4..c450e6dde6 100644 --- a/gen/acceleratedmobilepageurl1/Cargo.toml +++ b/gen/acceleratedmobilepageurl1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-acceleratedmobilepageurl1" -version = "1.0.8+20180917" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with acceleratedmobilepageurl (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/acceleratedmobilepageurl1" homepage = "https://developers.google.com/amp/cache/" -documentation = "https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917" +documentation = "https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330" license = "MIT" keywords = ["acceleratedmobilepag", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/acceleratedmobilepageurl1/README.md b/gen/acceleratedmobilepageurl1/README.md index 30da8192d1..b8000524f6 100644 --- a/gen/acceleratedmobilepageurl1/README.md +++ b/gen/acceleratedmobilepageurl1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-acceleratedmobilepageurl1` library allows access to all features of the *Google acceleratedmobilepageurl* service. -This documentation was generated from *acceleratedmobilepageurl* crate version *1.0.8+20180917*, where *20180917* is the exact revision of the *acceleratedmobilepageurl:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *acceleratedmobilepageurl* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *acceleratedmobilepageurl:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *acceleratedmobilepageurl* *v1* API can be found at the [official documentation site](https://developers.google.com/amp/cache/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/struct.Acceleratedmobilepageurl.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/struct.Acceleratedmobilepageurl.html) ... -* [amp urls](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/struct.AmpUrl.html) - * [*batch get*](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/struct.AmpUrlBatchGetCall.html) +* [amp urls](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/struct.AmpUrl.html) + * [*batch get*](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/struct.AmpUrlBatchGetCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/struct.Acceleratedmobilepageurl.html)** +* **[Hub](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/struct.Acceleratedmobilepageurl.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.Part.html)** + * **[Parts](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -130,17 +130,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -150,29 +150,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20180917/google_acceleratedmobilepageurl1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-acceleratedmobilepageurl1/1.0.8+20190330/google_acceleratedmobilepageurl1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/acceleratedmobilepageurl1/src/lib.rs b/gen/acceleratedmobilepageurl1/src/lib.rs index 32280c1066..4003b24f58 100644 --- a/gen/acceleratedmobilepageurl1/src/lib.rs +++ b/gen/acceleratedmobilepageurl1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *acceleratedmobilepageurl* crate version *1.0.8+20180917*, where *20180917* is the exact revision of the *acceleratedmobilepageurl:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *acceleratedmobilepageurl* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *acceleratedmobilepageurl:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *acceleratedmobilepageurl* *v1* API can be found at the //! [official documentation site](https://developers.google.com/amp/cache/). @@ -603,10 +603,7 @@ impl<'a, C, A> AmpUrlBatchGetCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -625,7 +622,7 @@ impl<'a, C, A> AmpUrlBatchGetCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -704,7 +701,7 @@ impl<'a, C, A> AmpUrlBatchGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -712,12 +709,12 @@ impl<'a, C, A> AmpUrlBatchGetCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AmpUrlBatchGetCall<'a, C, A> diff --git a/gen/accesscontextmanager1-cli/Cargo.toml b/gen/accesscontextmanager1-cli/Cargo.toml new file mode 100644 index 0000000000..245bfda9dc --- /dev/null +++ b/gen/accesscontextmanager1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-accesscontextmanager1-cli" +version = "1.0.8+20190327" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Access Context Manager (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/accesscontextmanager1-cli" +homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/" +documentation = "http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli" +license = "MIT" +keywords = ["accesscontextmanager", "google", "cli"] +autobins = false + +[[bin]] +name = "accesscontextmanager1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-accesscontextmanager1] +path = "../accesscontextmanager1" +version = "1.0.8+20190327" diff --git a/gen/accesscontextmanager1-cli/LICENSE.md b/gen/accesscontextmanager1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/accesscontextmanager1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/accesscontextmanager1-cli/README.md b/gen/accesscontextmanager1-cli/README.md new file mode 100644 index 0000000000..8cf9c2a607 --- /dev/null +++ b/gen/accesscontextmanager1-cli/README.md @@ -0,0 +1,133 @@ + +The `accesscontextmanager1` command-line interface *(CLI)* allows to use most features of the *Google Access Context Manager* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Access Context Manager* API can be found at the +[official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-accesscontextmanager1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/accesscontextmanager1-cli). + +# Usage + +This documentation was generated from the *Access Context Manager* API at revision *20190327*. The CLI is at version *1.0.8*. + +```bash +accesscontextmanager1 [options] + access-policies + access-levels-create (-r )... [-p ]... [-o ] + access-levels-delete [-p ]... [-o ] + access-levels-get [-p ]... [-o ] + access-levels-list [-p ]... [-o ] + access-levels-patch (-r )... [-p ]... [-o ] + create (-r )... [-p ]... [-o ] + delete [-p ]... [-o ] + get [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + service-perimeters-create (-r )... [-p ]... [-o ] + service-perimeters-delete [-p ]... [-o ] + service-perimeters-get [-p ]... [-o ] + service-perimeters-list [-p ]... [-o ] + service-perimeters-patch (-r )... [-p ]... [-o ] + operations + cancel (-r )... [-p ]... [-o ] + delete [-p ]... [-o ] + get [-p ]... [-o ] + list [-p ]... [-o ] + accesscontextmanager1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `accesscontextmanager1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/accesscontextmanager1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/accesscontextmanager1-secret.json`, assuming that the required *accesscontextmanager* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `accesscontextmanager1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/accesscontextmanager1-cli/mkdocs.yml b/gen/accesscontextmanager1-cli/mkdocs.yml new file mode 100644 index 0000000000..e6831a5719 --- /dev/null +++ b/gen/accesscontextmanager1-cli/mkdocs.yml @@ -0,0 +1,35 @@ +site_name: Access Context Manager v1.0.8+20190327 +site_url: http://byron.github.io/google-apis-rs/google-accesscontextmanager1-cli +site_description: A complete library to interact with Access Context Manager (protocol v1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/accesscontextmanager1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['access-policies_access-levels-create.md', 'Access Policies', 'Access Levels Create'] +- ['access-policies_access-levels-delete.md', 'Access Policies', 'Access Levels Delete'] +- ['access-policies_access-levels-get.md', 'Access Policies', 'Access Levels Get'] +- ['access-policies_access-levels-list.md', 'Access Policies', 'Access Levels List'] +- ['access-policies_access-levels-patch.md', 'Access Policies', 'Access Levels Patch'] +- ['access-policies_create.md', 'Access Policies', 'Create'] +- ['access-policies_delete.md', 'Access Policies', 'Delete'] +- ['access-policies_get.md', 'Access Policies', 'Get'] +- ['access-policies_list.md', 'Access Policies', 'List'] +- ['access-policies_patch.md', 'Access Policies', 'Patch'] +- ['access-policies_service-perimeters-create.md', 'Access Policies', 'Service Perimeters Create'] +- ['access-policies_service-perimeters-delete.md', 'Access Policies', 'Service Perimeters Delete'] +- ['access-policies_service-perimeters-get.md', 'Access Policies', 'Service Perimeters Get'] +- ['access-policies_service-perimeters-list.md', 'Access Policies', 'Service Perimeters List'] +- ['access-policies_service-perimeters-patch.md', 'Access Policies', 'Service Perimeters Patch'] +- ['operations_cancel.md', 'Operations', 'Cancel'] +- ['operations_delete.md', 'Operations', 'Delete'] +- ['operations_get.md', 'Operations', 'Get'] +- ['operations_list.md', 'Operations', 'List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/accesscontextmanager1-cli/src/cmn.rs b/gen/accesscontextmanager1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/accesscontextmanager1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/accesscontextmanager1-cli/src/main.rs b/gen/accesscontextmanager1-cli/src/main.rs new file mode 100644 index 0000000000..ded40731cb --- /dev/null +++ b/gen/accesscontextmanager1-cli/src/main.rs @@ -0,0 +1,2162 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_accesscontextmanager1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::AccessContextManager>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _access_policies_access_levels_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "basic.combining-function" => Some(("basic.combiningFunction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["basic", "combining-function", "create-time", "description", "name", "title", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccessLevel = json::value::from_value(object).unwrap(); + let mut call = self.hub.access_policies().access_levels_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_access_levels_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.access_policies().access_levels_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_access_levels_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.access_policies().access_levels_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "access-level-format" => { + call = call.access_level_format(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["access-level-format"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_access_levels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.access_policies().access_levels_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "access-level-format" => { + call = call.access_level_format(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["access-level-format", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_access_levels_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "basic.combining-function" => Some(("basic.combiningFunction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["basic", "combining-function", "create-time", "description", "name", "title", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccessLevel = json::value::from_value(object).unwrap(); + let mut call = self.hub.access_policies().access_levels_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "name", "parent", "title", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccessPolicy = json::value::from_value(object).unwrap(); + let mut call = self.hub.access_policies().create(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.access_policies().delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.access_policies().get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.access_policies().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "parent" => { + call = call.parent(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size", "parent"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "name", "parent", "title", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccessPolicy = json::value::from_value(object).unwrap(); + let mut call = self.hub.access_policies().patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_service_perimeters_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status.restricted-services" => Some(("status.restrictedServices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "status.resources" => Some(("status.resources", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "status.access-levels" => Some(("status.accessLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "perimeter-type" => Some(("perimeterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["access-levels", "create-time", "description", "name", "perimeter-type", "resources", "restricted-services", "status", "title", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ServicePerimeter = json::value::from_value(object).unwrap(); + let mut call = self.hub.access_policies().service_perimeters_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_service_perimeters_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.access_policies().service_perimeters_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_service_perimeters_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.access_policies().service_perimeters_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_service_perimeters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.access_policies().service_perimeters_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _access_policies_service_perimeters_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status.restricted-services" => Some(("status.restrictedServices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "status.resources" => Some(("status.resources", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "status.access-levels" => Some(("status.accessLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "perimeter-type" => Some(("perimeterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["access-levels", "create-time", "description", "name", "perimeter-type", "resources", "restricted-services", "status", "title", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ServicePerimeter = json::value::from_value(object).unwrap(); + let mut call = self.hub.access_policies().service_perimeters_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CancelOperationRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.operations().cancel(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("access-policies", Some(opt)) => { + match opt.subcommand() { + ("access-levels-create", Some(opt)) => { + call_result = self._access_policies_access_levels_create(opt, dry_run, &mut err); + }, + ("access-levels-delete", Some(opt)) => { + call_result = self._access_policies_access_levels_delete(opt, dry_run, &mut err); + }, + ("access-levels-get", Some(opt)) => { + call_result = self._access_policies_access_levels_get(opt, dry_run, &mut err); + }, + ("access-levels-list", Some(opt)) => { + call_result = self._access_policies_access_levels_list(opt, dry_run, &mut err); + }, + ("access-levels-patch", Some(opt)) => { + call_result = self._access_policies_access_levels_patch(opt, dry_run, &mut err); + }, + ("create", Some(opt)) => { + call_result = self._access_policies_create(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._access_policies_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._access_policies_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._access_policies_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._access_policies_patch(opt, dry_run, &mut err); + }, + ("service-perimeters-create", Some(opt)) => { + call_result = self._access_policies_service_perimeters_create(opt, dry_run, &mut err); + }, + ("service-perimeters-delete", Some(opt)) => { + call_result = self._access_policies_service_perimeters_delete(opt, dry_run, &mut err); + }, + ("service-perimeters-get", Some(opt)) => { + call_result = self._access_policies_service_perimeters_get(opt, dry_run, &mut err); + }, + ("service-perimeters-list", Some(opt)) => { + call_result = self._access_policies_service_perimeters_list(opt, dry_run, &mut err); + }, + ("service-perimeters-patch", Some(opt)) => { + call_result = self._access_policies_service_perimeters_patch(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("access-policies".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("operations", Some(opt)) => { + match opt.subcommand() { + ("cancel", Some(opt)) => { + call_result = self._operations_cancel(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._operations_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._operations_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._operations_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "accesscontextmanager1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "accesscontextmanager1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::AccessContextManager::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("access-policies", "methods: 'access-levels-create', 'access-levels-delete', 'access-levels-get', 'access-levels-list', 'access-levels-patch', 'create', 'delete', 'get', 'list', 'patch', 'service-perimeters-create', 'service-perimeters-delete', 'service-perimeters-get', 'service-perimeters-list' and 'service-perimeters-patch'", vec![ + ("access-levels-create", + Some(r##"Create an Access Level. The longrunning + operation from this RPC will have a successful status once the Access + Level has + propagated to long-lasting storage. Access Levels containing + errors will result in an error response for the first error encountered."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_access-levels-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. Resource name for the access policy which owns this Access + Level. + + Format: `accessPolicies/{policy_id}`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("access-levels-delete", + Some(r##"Delete an Access Level by resource + name. The longrunning operation from this RPC will have a successful status + once the Access Level has been removed + from long-lasting storage."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_access-levels-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. Resource name for the Access Level. + + Format: + `accessPolicies/{policy_id}/accessLevels/{access_level_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("access-levels-get", + Some(r##"Get an Access Level by resource + name."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_access-levels-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. Resource name for the Access Level. + + Format: + `accessPolicies/{policy_id}/accessLevels/{access_level_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("access-levels-list", + Some(r##"List all Access Levels for an access + policy."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_access-levels-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. Resource name for the access policy to list Access Levels from. + + Format: + `accessPolicies/{policy_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("access-levels-patch", + Some(r##"Update an Access Level. The longrunning + operation from this RPC will have a successful status once the changes to + the Access Level have propagated + to long-lasting storage. Access Levels containing + errors will result in an error response for the first error encountered."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_access-levels-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. Resource name for the Access Level. The `short_name` component + must begin with a letter and only include alphanumeric and '_'. Format: + `accessPolicies/{policy_id}/accessLevels/{short_name}`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("create", + Some(r##"Create an `AccessPolicy`. Fails if this organization already has a + `AccessPolicy`. The longrunning Operation will have a successful status + once the `AccessPolicy` has propagated to long-lasting storage. + Syntactic and basic semantic errors will be returned in `metadata` as a + BadRequest proto."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_create", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Delete an AccessPolicy by resource + name. The longrunning Operation will have a successful status once the + AccessPolicy + has been removed from long-lasting storage."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. Resource name for the access policy to delete. + + Format `accessPolicies/{policy_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Get an AccessPolicy by name."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. Resource name for the access policy to get. + + Format `accessPolicies/{policy_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"List all AccessPolicies under a + container."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Update an AccessPolicy. The + longrunning Operation from this RPC will have a successful status once the + changes to the AccessPolicy have propagated + to long-lasting storage. Syntactic and basic semantic errors will be + returned in `metadata` as a BadRequest proto."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Output only. Resource name of the `AccessPolicy`. Format: + `accessPolicies/{policy_id}`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-perimeters-create", + Some(r##"Create an Service Perimeter. The + longrunning operation from this RPC will have a successful status once the + Service Perimeter has + propagated to long-lasting storage. Service Perimeters containing + errors will result in an error response for the first error encountered."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_service-perimeters-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. Resource name for the access policy which owns this Service + Perimeter. + + Format: `accessPolicies/{policy_id}`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-perimeters-delete", + Some(r##"Delete an Service Perimeter by resource + name. The longrunning operation from this RPC will have a successful status + once the Service Perimeter has been + removed from long-lasting storage."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_service-perimeters-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. Resource name for the Service Perimeter. + + Format: + `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-perimeters-get", + Some(r##"Get an Service Perimeter by resource + name."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_service-perimeters-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. Resource name for the Service Perimeter. + + Format: + `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-perimeters-list", + Some(r##"List all Service Perimeters for an + access policy."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_service-perimeters-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. Resource name for the access policy to list Service Perimeters from. + + Format: + `accessPolicies/{policy_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-perimeters-patch", + Some(r##"Update an Service Perimeter. The + longrunning operation from this RPC will have a successful status once the + changes to the Service Perimeter have + propagated to long-lasting storage. Service Perimeter containing + errors will result in an error response for the first error encountered."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/access-policies_service-perimeters-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. Resource name for the ServicePerimeter. The `short_name` + component must begin with a letter and only include alphanumeric and '_'. + Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("operations", "methods: 'cancel', 'delete', 'get' and 'list'", vec![ + ("cancel", + Some(r##"Starts asynchronous cancellation on a long-running operation. The server + makes a best effort to cancel the operation, but success is not + guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. Clients can use + Operations.GetOperation or + other methods to check whether the cancellation succeeded or whether the + operation completed despite cancellation. On successful cancellation, + the operation is not deleted; instead, it becomes an operation with + an Operation.error value with a google.rpc.Status.code of 1, + corresponding to `Code.CANCELLED`."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/operations_cancel", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be cancelled."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes a long-running operation. This method indicates that the client is + no longer interested in the operation result. It does not cancel the + operation. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/operations_delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be deleted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/operations_get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists operations that match the specified filter in the request. If the + server doesn't support this method, it returns `UNIMPLEMENTED`. + + NOTE: the `name` binding allows API services to override the binding + to use different resource name schemes, such as `users/*/operations`. To + override the binding, API services can add a binding such as + `"/v1/{name=users/*}/operations"` to their service configuration. + For backwards compatibility, the default name includes the operations + collection id, however overriding users must ensure the name binding + is the parent resource, without the operations collection id."##), + "Details at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli/operations_list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation's parent resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("accesscontextmanager1") + .author("Sebastian Thiel ") + .version("1.0.8+20190327") + .about("An API for setting attribute based access control to requests to GCP services.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/accesscontextmanager1/Cargo.toml b/gen/accesscontextmanager1/Cargo.toml new file mode 100644 index 0000000000..c17d2d85c5 --- /dev/null +++ b/gen/accesscontextmanager1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-accesscontextmanager1" +version = "1.0.8+20190327" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Access Context Manager (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/accesscontextmanager1" +homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/" +documentation = "https://docs.rs/google-accesscontextmanager1/1.0.8+20190327" +license = "MIT" +keywords = ["accesscontextmanager", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/accesscontextmanager1/LICENSE.md b/gen/accesscontextmanager1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/accesscontextmanager1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/accesscontextmanager1/README.md b/gen/accesscontextmanager1/README.md new file mode 100644 index 0000000000..8440e0020f --- /dev/null +++ b/gen/accesscontextmanager1/README.md @@ -0,0 +1,199 @@ + +The `google-accesscontextmanager1` library allows access to all features of the *Google Access Context Manager* service. + +This documentation was generated from *Access Context Manager* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *accesscontextmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Access Context Manager* *v1* API can be found at the +[official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessContextManager.html) ... + +* [access policies](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicy.html) + * [*access levels create*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyAccessLevelCreateCall.html), [*access levels delete*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyAccessLevelDeleteCall.html), [*access levels get*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyAccessLevelGetCall.html), [*access levels list*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyAccessLevelListCall.html), [*access levels patch*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyAccessLevelPatchCall.html), [*create*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyCreateCall.html), [*delete*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyDeleteCall.html), [*get*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyGetCall.html), [*list*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyListCall.html), [*patch*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyPatchCall.html), [*service perimeters create*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyServicePerimeterCreateCall.html), [*service perimeters delete*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyServicePerimeterDeleteCall.html), [*service perimeters get*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyServicePerimeterGetCall.html), [*service perimeters list*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyServicePerimeterListCall.html) and [*service perimeters patch*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessPolicyServicePerimeterPatchCall.html) +* [operations](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.Operation.html) + * [*cancel*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.OperationDeleteCall.html), [*get*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.OperationListCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/struct.AccessContextManager.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.operations().delete(...).doit() +let r = hub.access_policies().access_levels_create(...).doit() +let r = hub.operations().list(...).doit() +let r = hub.access_policies().service_perimeters_create(...).doit() +let r = hub.access_policies().service_perimeters_delete(...).doit() +let r = hub.access_policies().access_levels_patch(...).doit() +let r = hub.access_policies().create(...).doit() +let r = hub.access_policies().delete(...).doit() +let r = hub.operations().get(...).doit() +let r = hub.access_policies().service_perimeters_patch(...).doit() +let r = hub.access_policies().patch(...).doit() +let r = hub.access_policies().access_levels_delete(...).doit() +let r = hub.operations().cancel(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-accesscontextmanager1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_accesscontextmanager1 as accesscontextmanager1; +use accesscontextmanager1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use accesscontextmanager1::AccessContextManager; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.operations().list("name") + .page_token("sit") + .page_size(-65) + .filter("sed") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-accesscontextmanager1/1.0.8+20190327/google_accesscontextmanager1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **accesscontextmanager1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/accesscontextmanager1/src/cmn.rs b/gen/accesscontextmanager1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/accesscontextmanager1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/accesscontextmanager1/src/lib.rs b/gen/accesscontextmanager1/src/lib.rs new file mode 100644 index 0000000000..1a4eae0023 --- /dev/null +++ b/gen/accesscontextmanager1/src/lib.rs @@ -0,0 +1,6599 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Access Context Manager* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *accesscontextmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Access Context Manager* *v1* API can be found at the +//! [official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/accesscontextmanager1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.AccessContextManager.html) ... +//! +//! * [access policies](struct.AccessPolicy.html) +//! * [*access levels create*](struct.AccessPolicyAccessLevelCreateCall.html), [*access levels delete*](struct.AccessPolicyAccessLevelDeleteCall.html), [*access levels get*](struct.AccessPolicyAccessLevelGetCall.html), [*access levels list*](struct.AccessPolicyAccessLevelListCall.html), [*access levels patch*](struct.AccessPolicyAccessLevelPatchCall.html), [*create*](struct.AccessPolicyCreateCall.html), [*delete*](struct.AccessPolicyDeleteCall.html), [*get*](struct.AccessPolicyGetCall.html), [*list*](struct.AccessPolicyListCall.html), [*patch*](struct.AccessPolicyPatchCall.html), [*service perimeters create*](struct.AccessPolicyServicePerimeterCreateCall.html), [*service perimeters delete*](struct.AccessPolicyServicePerimeterDeleteCall.html), [*service perimeters get*](struct.AccessPolicyServicePerimeterGetCall.html), [*service perimeters list*](struct.AccessPolicyServicePerimeterListCall.html) and [*service perimeters patch*](struct.AccessPolicyServicePerimeterPatchCall.html) +//! * [operations](struct.Operation.html) +//! * [*cancel*](struct.OperationCancelCall.html), [*delete*](struct.OperationDeleteCall.html), [*get*](struct.OperationGetCall.html) and [*list*](struct.OperationListCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.AccessContextManager.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.operations().delete(...).doit() +//! let r = hub.access_policies().access_levels_create(...).doit() +//! let r = hub.operations().list(...).doit() +//! let r = hub.access_policies().service_perimeters_create(...).doit() +//! let r = hub.access_policies().service_perimeters_delete(...).doit() +//! let r = hub.access_policies().access_levels_patch(...).doit() +//! let r = hub.access_policies().create(...).doit() +//! let r = hub.access_policies().delete(...).doit() +//! let r = hub.operations().get(...).doit() +//! let r = hub.access_policies().service_perimeters_patch(...).doit() +//! let r = hub.access_policies().patch(...).doit() +//! let r = hub.access_policies().access_levels_delete(...).doit() +//! let r = hub.operations().cancel(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-accesscontextmanager1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_accesscontextmanager1 as accesscontextmanager1; +//! use accesscontextmanager1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use accesscontextmanager1::AccessContextManager; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.operations().list("name") +//! .page_token("dolores") +//! .page_size(-63) +//! .filter("accusam") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all AccessContextManager related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// use accesscontextmanager1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use accesscontextmanager1::AccessContextManager; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().list("name") +/// .page_token("justo") +/// .page_size(-1) +/// .filter("erat") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct AccessContextManager { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for AccessContextManager {} + +impl<'a, C, A> AccessContextManager + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> AccessContextManager { + AccessContextManager { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://accesscontextmanager.googleapis.com/".to_string(), + _root_url: "https://accesscontextmanager.googleapis.com/".to_string(), + } + } + + pub fn access_policies(&'a self) -> AccessPolicyMethods<'a, C, A> { + AccessPolicyMethods { hub: &self } + } + pub fn operations(&'a self) -> OperationMethods<'a, C, A> { + OperationMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://accesscontextmanager.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://accesscontextmanager.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// `ServicePerimeterConfig` specifies a set of GCP resources that describe +/// specific Service Perimeter configuration. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ServicePerimeterConfig { + /// GCP services that are subject to the Service Perimeter restrictions. For + /// example, if `storage.googleapis.com` is specified, access to the storage + /// buckets inside the perimeter must meet the perimeter's access restrictions. + #[serde(rename="restrictedServices")] + pub restricted_services: Option>, + /// A list of GCP resources that are inside of the service perimeter. + /// Currently only projects are allowed. Format: `projects/{project_number}` + pub resources: Option>, + /// A list of `AccessLevel` resource names that allow resources within the + /// `ServicePerimeter` to be accessed from the internet. `AccessLevels` listed + /// must be in the same policy as this `ServicePerimeter`. Referencing a + /// nonexistent `AccessLevel` is a syntax error. If no `AccessLevel` names are + /// listed, resources within the perimeter can only be accessed via GCP calls + /// with request origins within the perimeter. Example: + /// `"accessPolicies/MY_POLICY/accessLevels/MY_LEVEL"`. + /// For Service Perimeter Bridge, must be empty. + #[serde(rename="accessLevels")] + pub access_levels: Option>, +} + +impl Part for ServicePerimeterConfig {} + + +/// `BasicLevel` is an `AccessLevel` using a set of recommended features. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BasicLevel { + /// How the `conditions` list should be combined to determine if a request is + /// granted this `AccessLevel`. If AND is used, each `Condition` in + /// `conditions` must be satisfied for the `AccessLevel` to be applied. If OR + /// is used, at least one `Condition` in `conditions` must be satisfied for the + /// `AccessLevel` to be applied. Default behavior is AND. + #[serde(rename="combiningFunction")] + pub combining_function: Option, + /// Required. A list of requirements for the `AccessLevel` to be granted. + pub conditions: Option>, +} + +impl Part for BasicLevel {} + + +/// `DevicePolicy` specifies device specific restrictions necessary to acquire a +/// given access level. A `DevicePolicy` specifies requirements for requests from +/// devices to be granted access levels, it does not do any enforcement on the +/// device. `DevicePolicy` acts as an AND over all specified fields, and each +/// repeated field is an OR over its elements. Any unset fields are ignored. For +/// example, if the proto is { os_type : DESKTOP_WINDOWS, os_type : +/// DESKTOP_LINUX, encryption_status: ENCRYPTED}, then the DevicePolicy will be +/// true for requests originating from encrypted Linux desktops and encrypted +/// Windows desktops. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DevicePolicy { + /// Allowed encryptions statuses, an empty list allows all statuses. + #[serde(rename="allowedEncryptionStatuses")] + pub allowed_encryption_statuses: Option>, + /// Whether the device needs to be corp owned. + #[serde(rename="requireCorpOwned")] + pub require_corp_owned: Option, + /// Allowed device management levels, an empty list allows all management + /// levels. + #[serde(rename="allowedDeviceManagementLevels")] + pub allowed_device_management_levels: Option>, + /// Allowed OS versions, an empty list allows all types and all versions. + #[serde(rename="osConstraints")] + pub os_constraints: Option>, + /// Whether the device needs to be approved by the customer admin. + #[serde(rename="requireAdminApproval")] + pub require_admin_approval: Option, + /// Whether or not screenlock is required for the DevicePolicy to be true. + /// Defaults to `false`. + #[serde(rename="requireScreenlock")] + pub require_screenlock: Option, +} + +impl Part for DevicePolicy {} + + +/// `AccessPolicy` is a container for `AccessLevels` (which define the necessary +/// attributes to use GCP services) and `ServicePerimeters` (which define regions +/// of services able to freely pass data within a perimeter). An access policy is +/// globally visible within an organization, and the restrictions it specifies +/// apply to all projects within an organization. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [create access policies](struct.AccessPolicyCreateCall.html) (request) +/// * [patch access policies](struct.AccessPolicyPatchCall.html) (request) +/// * [get access policies](struct.AccessPolicyGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccessPolicy { + /// Output only. Time the `AccessPolicy` was updated in UTC. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Output only. Time the `AccessPolicy` was created in UTC. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. Resource name of the `AccessPolicy`. Format: + /// `accessPolicies/{policy_id}` + pub name: Option, + /// Required. The parent of this `AccessPolicy` in the Cloud Resource + /// Hierarchy. Currently immutable once created. Format: + /// `organizations/{organization_id}` + pub parent: Option, + /// Required. Human readable title. Does not affect behavior. + pub title: Option, +} + +impl RequestValue for AccessPolicy {} +impl ResponseResult for AccessPolicy {} + + +/// A response to `ListServicePerimetersRequest`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service perimeters list access policies](struct.AccessPolicyServicePerimeterListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListServicePerimetersResponse { + /// The pagination token to retrieve the next page of results. If the value is + /// empty, no further results remain. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of the Service Perimeter instances. + #[serde(rename="servicePerimeters")] + pub service_perimeters: Option>, +} + +impl ResponseResult for ListServicePerimetersResponse {} + + +/// A response to `ListAccessPoliciesRequest`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list access policies](struct.AccessPolicyListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListAccessPoliciesResponse { + /// The pagination token to retrieve the next page of results. If the value is + /// empty, no further results remain. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of the AccessPolicy instances. + #[serde(rename="accessPolicies")] + pub access_policies: Option>, +} + +impl ResponseResult for ListAccessPoliciesResponse {} + + +/// A response to `ListAccessLevelsRequest`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [access levels list access policies](struct.AccessPolicyAccessLevelListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListAccessLevelsResponse { + /// The pagination token to retrieve the next page of results. If the value is + /// empty, no further results remain. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of the Access Level instances. + #[serde(rename="accessLevels")] + pub access_levels: Option>, +} + +impl ResponseResult for ListAccessLevelsResponse {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete operations](struct.OperationDeleteCall.html) (response) +/// * [cancel operations](struct.OperationCancelCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operations](struct.OperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for ListOperationsResponse {} + + +/// `ServicePerimeter` describes a set of GCP resources which can freely import +/// and export data amongst themselves, but not export outside of the +/// `ServicePerimeter`. If a request with a source within this `ServicePerimeter` +/// has a target outside of the `ServicePerimeter`, the request will be blocked. +/// Otherwise the request is allowed. There are two types of Service Perimeter - +/// Regular and Bridge. Regular Service Perimeters cannot overlap, a single GCP +/// project can only belong to a single regular Service Perimeter. Service +/// Perimeter Bridges can contain only GCP projects as members, a single GCP +/// project may belong to multiple Service Perimeter Bridges. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service perimeters create access policies](struct.AccessPolicyServicePerimeterCreateCall.html) (request) +/// * [service perimeters get access policies](struct.AccessPolicyServicePerimeterGetCall.html) (response) +/// * [service perimeters patch access policies](struct.AccessPolicyServicePerimeterPatchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ServicePerimeter { + /// Current ServicePerimeter configuration. Specifies sets of resources, + /// restricted services and access levels that determine perimeter + /// content and boundaries. + pub status: Option, + /// Output only. Time the `ServicePerimeter` was updated in UTC. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Required. Resource name for the ServicePerimeter. The `short_name` + /// component must begin with a letter and only include alphanumeric and '_'. + /// Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` + pub name: Option, + /// Human readable title. Must be unique within the Policy. + pub title: Option, + /// Perimeter type indicator. A single project is + /// allowed to be a member of single regular perimeter, but multiple service + /// perimeter bridges. A project cannot be a included in a perimeter bridge + /// without being included in regular perimeter. For perimeter bridges, + /// the restricted service list as well as access level lists must be + /// empty. + #[serde(rename="perimeterType")] + pub perimeter_type: Option, + /// Output only. Time the `ServicePerimeter` was created in UTC. + #[serde(rename="createTime")] + pub create_time: Option, + /// Description of the `ServicePerimeter` and its use. Does not affect + /// behavior. + pub description: Option, +} + +impl RequestValue for ServicePerimeter {} +impl ResponseResult for ServicePerimeter {} + + +/// The request message for Operations.CancelOperation. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [cancel operations](struct.OperationCancelCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CancelOperationRequest { _never_set: Option } + +impl RequestValue for CancelOperationRequest {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete operations](struct.OperationDeleteCall.html) (none) +/// * [access levels create access policies](struct.AccessPolicyAccessLevelCreateCall.html) (response) +/// * [list operations](struct.OperationListCall.html) (none) +/// * [service perimeters create access policies](struct.AccessPolicyServicePerimeterCreateCall.html) (response) +/// * [service perimeters delete access policies](struct.AccessPolicyServicePerimeterDeleteCall.html) (response) +/// * [access levels patch access policies](struct.AccessPolicyAccessLevelPatchCall.html) (response) +/// * [create access policies](struct.AccessPolicyCreateCall.html) (response) +/// * [delete access policies](struct.AccessPolicyDeleteCall.html) (response) +/// * [get operations](struct.OperationGetCall.html) (response) +/// * [service perimeters patch access policies](struct.AccessPolicyServicePerimeterPatchCall.html) (response) +/// * [patch access policies](struct.AccessPolicyPatchCall.html) (response) +/// * [access levels delete access policies](struct.AccessPolicyAccessLevelDeleteCall.html) (response) +/// * [cancel operations](struct.OperationCancelCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl Resource for Operation {} +impl ResponseResult for Operation {} + + +/// An `AccessLevel` is a label that can be applied to requests to GCP services, +/// along with a list of requirements necessary for the label to be applied. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [access levels patch access policies](struct.AccessPolicyAccessLevelPatchCall.html) (request) +/// * [access levels create access policies](struct.AccessPolicyAccessLevelCreateCall.html) (request) +/// * [access levels get access policies](struct.AccessPolicyAccessLevelGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccessLevel { + /// Output only. Time the `AccessLevel` was updated in UTC. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Required. Resource name for the Access Level. The `short_name` component + /// must begin with a letter and only include alphanumeric and '_'. Format: + /// `accessPolicies/{policy_id}/accessLevels/{short_name}` + pub name: Option, + /// Human readable title. Must be unique within the Policy. + pub title: Option, + /// A `BasicLevel` composed of `Conditions`. + pub basic: Option, + /// Output only. Time the `AccessLevel` was created in UTC. + #[serde(rename="createTime")] + pub create_time: Option, + /// Description of the `AccessLevel` and its use. Does not affect behavior. + pub description: Option, +} + +impl RequestValue for AccessLevel {} +impl ResponseResult for AccessLevel {} + + +/// A condition necessary for an `AccessLevel` to be granted. The Condition is an +/// AND over its fields. So a Condition is true if: 1) the request IP is from one +/// of the listed subnetworks AND 2) the originating device complies with the +/// listed device policy AND 3) all listed access levels are granted AND 4) the +/// request was sent at a time allowed by the DateTimeRestriction. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Condition { + /// A list of other access levels defined in the same `Policy`, referenced by + /// resource name. Referencing an `AccessLevel` which does not exist is an + /// error. All access levels listed must be granted for the Condition + /// to be true. Example: + /// "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"` + #[serde(rename="requiredAccessLevels")] + pub required_access_levels: Option>, + /// The request must originate from one of the provided countries/regions. + /// Must be valid ISO 3166-1 alpha-2 codes. + pub regions: Option>, + /// The request must be made by one of the provided user or service + /// accounts. Groups are not supported. + /// Syntax: + /// `user:{emailid}` + /// `serviceAccount:{emailid}` + /// If not specified, a request may come from any user. + pub members: Option>, + /// Device specific restrictions, all restrictions must hold for the + /// Condition to be true. If not specified, all devices are allowed. + #[serde(rename="devicePolicy")] + pub device_policy: Option, + /// Whether to negate the Condition. If true, the Condition becomes a NAND over + /// its non-empty fields, each field must be false for the Condition overall to + /// be satisfied. Defaults to false. + pub negate: Option, + /// CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for + /// a CIDR IP address block, the specified IP address portion must be properly + /// truncated (i.e. all the host bits must be zero) or the input is considered + /// malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is + /// not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas + /// "2001:db8::1/32" is not. The originating IP of a request must be in one of + /// the listed subnets in order for this Condition to be true. If empty, all IP + /// addresses are allowed. + #[serde(rename="ipSubnetworks")] + pub ip_subnetworks: Option>, +} + +impl Part for Condition {} + + +/// A restriction on the OS type and version of devices making requests. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OsConstraint { + /// Required. The allowed OS type. + #[serde(rename="osType")] + pub os_type: Option, + /// Only allows requests from devices with a verified Chrome OS. + /// Verifications includes requirements that the device is enterprise-managed, + /// conformant to Dasher domain policies, and the caller has permission to call + /// the API targeted by the request. + #[serde(rename="requireVerifiedChromeOs")] + pub require_verified_chrome_os: Option, + /// The minimum allowed OS version. If not set, any version of this OS + /// satisfies the constraint. Format: `"major.minor.patch"`. + /// Examples: `"10.5.301"`, `"9.2.1"`. + #[serde(rename="minimumVersion")] + pub minimum_version: Option, +} + +impl Part for OsConstraint {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *operation* resources. +/// It is not used directly, but through the `AccessContextManager` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use accesscontextmanager1::AccessContextManager; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `cancel(...)`, `delete(...)`, `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.operations(); +/// # } +/// ``` +pub struct OperationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, +} + +impl<'a, C, A> MethodsBuilder for OperationMethods<'a, C, A> {} + +impl<'a, C, A> OperationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes a long-running operation. This method indicates that the client is + /// no longer interested in the operation result. It does not cancel the + /// operation. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource to be deleted. + pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, C, A> { + OperationDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists operations that match the specified filter in the request. If the + /// server doesn't support this method, it returns `UNIMPLEMENTED`. + /// + /// NOTE: the `name` binding allows API services to override the binding + /// to use different resource name schemes, such as `users/*/operations`. To + /// override the binding, API services can add a binding such as + /// `"/v1/{name=users/*}/operations"` to their service configuration. + /// For backwards compatibility, the default name includes the operations + /// collection id, however overriding users must ensure the name binding + /// is the parent resource, without the operations collection id. + /// + /// # Arguments + /// + /// * `name` - The name of the operation's parent resource. + pub fn list(&self, name: &str) -> OperationListCall<'a, C, A> { + OperationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn get(&self, name: &str) -> OperationGetCall<'a, C, A> { + OperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Starts asynchronous cancellation on a long-running operation. The server + /// makes a best effort to cancel the operation, but success is not + /// guaranteed. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use + /// Operations.GetOperation or + /// other methods to check whether the cancellation succeeded or whether the + /// operation completed despite cancellation. On successful cancellation, + /// the operation is not deleted; instead, it becomes an operation with + /// an Operation.error value with a google.rpc.Status.code of 1, + /// corresponding to `Code.CANCELLED`. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the operation resource to be cancelled. + pub fn cancel(&self, request: CancelOperationRequest, name: &str) -> OperationCancelCall<'a, C, A> { + OperationCancelCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accessPolicy* resources. +/// It is not used directly, but through the `AccessContextManager` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use accesscontextmanager1::AccessContextManager; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `access_levels_create(...)`, `access_levels_delete(...)`, `access_levels_get(...)`, `access_levels_list(...)`, `access_levels_patch(...)`, `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `patch(...)`, `service_perimeters_create(...)`, `service_perimeters_delete(...)`, `service_perimeters_get(...)`, `service_perimeters_list(...)` and `service_perimeters_patch(...)` +/// // to build up your call. +/// let rb = hub.access_policies(); +/// # } +/// ``` +pub struct AccessPolicyMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, +} + +impl<'a, C, A> MethodsBuilder for AccessPolicyMethods<'a, C, A> {} + +impl<'a, C, A> AccessPolicyMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// List all Access Levels for an access + /// policy. + /// + /// # Arguments + /// + /// * `parent` - Required. Resource name for the access policy to list Access Levels from. + /// Format: + /// `accessPolicies/{policy_id}` + pub fn access_levels_list(&self, parent: &str) -> AccessPolicyAccessLevelListCall<'a, C, A> { + AccessPolicyAccessLevelListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _access_level_format: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Create an Access Level. The longrunning + /// operation from this RPC will have a successful status once the Access + /// Level has + /// propagated to long-lasting storage. Access Levels containing + /// errors will result in an error response for the first error encountered. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. Resource name for the access policy which owns this Access + /// Level. + /// Format: `accessPolicies/{policy_id}` + pub fn access_levels_create(&self, request: AccessLevel, parent: &str) -> AccessPolicyAccessLevelCreateCall<'a, C, A> { + AccessPolicyAccessLevelCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Create an Service Perimeter. The + /// longrunning operation from this RPC will have a successful status once the + /// Service Perimeter has + /// propagated to long-lasting storage. Service Perimeters containing + /// errors will result in an error response for the first error encountered. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. Resource name for the access policy which owns this Service + /// Perimeter. + /// Format: `accessPolicies/{policy_id}` + pub fn service_perimeters_create(&self, request: ServicePerimeter, parent: &str) -> AccessPolicyServicePerimeterCreateCall<'a, C, A> { + AccessPolicyServicePerimeterCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Delete an Service Perimeter by resource + /// name. The longrunning operation from this RPC will have a successful status + /// once the Service Perimeter has been + /// removed from long-lasting storage. + /// + /// # Arguments + /// + /// * `name` - Required. Resource name for the Service Perimeter. + /// Format: + /// `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}` + pub fn service_perimeters_delete(&self, name: &str) -> AccessPolicyServicePerimeterDeleteCall<'a, C, A> { + AccessPolicyServicePerimeterDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Update an Access Level. The longrunning + /// operation from this RPC will have a successful status once the changes to + /// the Access Level have propagated + /// to long-lasting storage. Access Levels containing + /// errors will result in an error response for the first error encountered. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. Resource name for the Access Level. The `short_name` component + /// must begin with a letter and only include alphanumeric and '_'. Format: + /// `accessPolicies/{policy_id}/accessLevels/{short_name}` + pub fn access_levels_patch(&self, request: AccessLevel, name: &str) -> AccessPolicyAccessLevelPatchCall<'a, C, A> { + AccessPolicyAccessLevelPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Create an `AccessPolicy`. Fails if this organization already has a + /// `AccessPolicy`. The longrunning Operation will have a successful status + /// once the `AccessPolicy` has propagated to long-lasting storage. + /// Syntactic and basic semantic errors will be returned in `metadata` as a + /// BadRequest proto. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn create(&self, request: AccessPolicy) -> AccessPolicyCreateCall<'a, C, A> { + AccessPolicyCreateCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// List all Service Perimeters for an + /// access policy. + /// + /// # Arguments + /// + /// * `parent` - Required. Resource name for the access policy to list Service Perimeters from. + /// Format: + /// `accessPolicies/{policy_id}` + pub fn service_perimeters_list(&self, parent: &str) -> AccessPolicyServicePerimeterListCall<'a, C, A> { + AccessPolicyServicePerimeterListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// List all AccessPolicies under a + /// container. + pub fn list(&self) -> AccessPolicyListCall<'a, C, A> { + AccessPolicyListCall { + hub: self.hub, + _parent: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Get an Access Level by resource + /// name. + /// + /// # Arguments + /// + /// * `name` - Required. Resource name for the Access Level. + /// Format: + /// `accessPolicies/{policy_id}/accessLevels/{access_level_id}` + pub fn access_levels_get(&self, name: &str) -> AccessPolicyAccessLevelGetCall<'a, C, A> { + AccessPolicyAccessLevelGetCall { + hub: self.hub, + _name: name.to_string(), + _access_level_format: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Update an AccessPolicy. The + /// longrunning Operation from this RPC will have a successful status once the + /// changes to the AccessPolicy have propagated + /// to long-lasting storage. Syntactic and basic semantic errors will be + /// returned in `metadata` as a BadRequest proto. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Output only. Resource name of the `AccessPolicy`. Format: + /// `accessPolicies/{policy_id}` + pub fn patch(&self, request: AccessPolicy, name: &str) -> AccessPolicyPatchCall<'a, C, A> { + AccessPolicyPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Delete an Access Level by resource + /// name. The longrunning operation from this RPC will have a successful status + /// once the Access Level has been removed + /// from long-lasting storage. + /// + /// # Arguments + /// + /// * `name` - Required. Resource name for the Access Level. + /// Format: + /// `accessPolicies/{policy_id}/accessLevels/{access_level_id}` + pub fn access_levels_delete(&self, name: &str) -> AccessPolicyAccessLevelDeleteCall<'a, C, A> { + AccessPolicyAccessLevelDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Get an AccessPolicy by name. + /// + /// # Arguments + /// + /// * `name` - Required. Resource name for the access policy to get. + /// Format `accessPolicies/{policy_id}` + pub fn get(&self, name: &str) -> AccessPolicyGetCall<'a, C, A> { + AccessPolicyGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Get an Service Perimeter by resource + /// name. + /// + /// # Arguments + /// + /// * `name` - Required. Resource name for the Service Perimeter. + /// Format: + /// `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}` + pub fn service_perimeters_get(&self, name: &str) -> AccessPolicyServicePerimeterGetCall<'a, C, A> { + AccessPolicyServicePerimeterGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Delete an AccessPolicy by resource + /// name. The longrunning Operation will have a successful status once the + /// AccessPolicy + /// has been removed from long-lasting storage. + /// + /// # Arguments + /// + /// * `name` - Required. Resource name for the access policy to delete. + /// Format `accessPolicies/{policy_id}` + pub fn delete(&self, name: &str) -> AccessPolicyDeleteCall<'a, C, A> { + AccessPolicyDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Update an Service Perimeter. The + /// longrunning operation from this RPC will have a successful status once the + /// changes to the Service Perimeter have + /// propagated to long-lasting storage. Service Perimeter containing + /// errors will result in an error response for the first error encountered. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. Resource name for the ServicePerimeter. The `short_name` + /// component must begin with a letter and only include alphanumeric and '_'. + /// Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` + pub fn service_perimeters_patch(&self, request: ServicePerimeter, name: &str) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { + AccessPolicyServicePerimeterPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Deletes a long-running operation. This method indicates that the client is +/// no longer interested in the operation result. It does not cancel the +/// operation. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. +/// +/// A builder for the *delete* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().delete("name") +/// .doit(); +/// # } +/// ``` +pub struct OperationDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationDeleteCall<'a, C, A> {} + +impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.operations.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource to be deleted. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists operations that match the specified filter in the request. If the +/// server doesn't support this method, it returns `UNIMPLEMENTED`. +/// +/// NOTE: the `name` binding allows API services to override the binding +/// to use different resource name schemes, such as `users/*/operations`. To +/// override the binding, API services can add a binding such as +/// `"/v1/{name=users/*}/operations"` to their service configuration. +/// For backwards compatibility, the default name includes the operations +/// collection id, however overriding users must ensure the name binding +/// is the parent resource, without the operations collection id. +/// +/// A builder for the *list* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().list("name") +/// .page_token("nonumy") +/// .page_size(-19) +/// .filter("gubergren") +/// .doit(); +/// # } +/// ``` +pub struct OperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationListCall<'a, C, A> {} + +impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation's parent resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *get* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().get("name") +/// .doit(); +/// # } +/// ``` +pub struct OperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {} + +impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Starts asynchronous cancellation on a long-running operation. The server +/// makes a best effort to cancel the operation, but success is not +/// guaranteed. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. Clients can use +/// Operations.GetOperation or +/// other methods to check whether the cancellation succeeded or whether the +/// operation completed despite cancellation. On successful cancellation, +/// the operation is not deleted; instead, it becomes an operation with +/// an Operation.error value with a google.rpc.Status.code of 1, +/// corresponding to `Code.CANCELLED`. +/// +/// A builder for the *cancel* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// use accesscontextmanager1::CancelOperationRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CancelOperationRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().cancel(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct OperationCancelCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _request: CancelOperationRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationCancelCall<'a, C, A> {} + +impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.operations.cancel", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CancelOperationRequest) -> OperationCancelCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the operation resource to be cancelled. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationCancelCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationCancelCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationCancelCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// List all Access Levels for an access +/// policy. +/// +/// A builder for the *accessLevels.list* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().access_levels_list("parent") +/// .page_token("no") +/// .page_size(-21) +/// .access_level_format("justo") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyAccessLevelListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _parent: String, + _page_token: Option, + _page_size: Option, + _access_level_format: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyAccessLevelListCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyAccessLevelListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListAccessLevelsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.accessLevels.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._access_level_format { + params.push(("accessLevelFormat", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "accessLevelFormat"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/accessLevels"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. Resource name for the access policy to list Access Levels from. + /// + /// Format: + /// `accessPolicies/{policy_id}` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> AccessPolicyAccessLevelListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Next page token for the next batch of Access Level instances. + /// Defaults to the first page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccessPolicyAccessLevelListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Number of Access Levels to include in + /// the list. Default 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> AccessPolicyAccessLevelListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Whether to return `BasicLevels` in the Cloud Common Expression language, as + /// `CustomLevels`, rather than as `BasicLevels`. Defaults to returning + /// `AccessLevels` in the format they were defined. + /// + /// Sets the *access level format* query property to the given value. + pub fn access_level_format(mut self, new_value: &str) -> AccessPolicyAccessLevelListCall<'a, C, A> { + self._access_level_format = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyAccessLevelListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyAccessLevelListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyAccessLevelListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Create an Access Level. The longrunning +/// operation from this RPC will have a successful status once the Access +/// Level has +/// propagated to long-lasting storage. Access Levels containing +/// errors will result in an error response for the first error encountered. +/// +/// A builder for the *accessLevels.create* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// use accesscontextmanager1::AccessLevel; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccessLevel::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().access_levels_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyAccessLevelCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _request: AccessLevel, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyAccessLevelCreateCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyAccessLevelCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.accessLevels.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/accessLevels"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccessLevel) -> AccessPolicyAccessLevelCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. Resource name for the access policy which owns this Access + /// Level. + /// + /// Format: `accessPolicies/{policy_id}` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> AccessPolicyAccessLevelCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyAccessLevelCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyAccessLevelCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyAccessLevelCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Create an Service Perimeter. The +/// longrunning operation from this RPC will have a successful status once the +/// Service Perimeter has +/// propagated to long-lasting storage. Service Perimeters containing +/// errors will result in an error response for the first error encountered. +/// +/// A builder for the *servicePerimeters.create* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// use accesscontextmanager1::ServicePerimeter; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ServicePerimeter::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().service_perimeters_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyServicePerimeterCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _request: ServicePerimeter, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyServicePerimeterCreateCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyServicePerimeterCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.servicePerimeters.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/servicePerimeters"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ServicePerimeter) -> AccessPolicyServicePerimeterCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. Resource name for the access policy which owns this Service + /// Perimeter. + /// + /// Format: `accessPolicies/{policy_id}` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> AccessPolicyServicePerimeterCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyServicePerimeterCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyServicePerimeterCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyServicePerimeterCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Delete an Service Perimeter by resource +/// name. The longrunning operation from this RPC will have a successful status +/// once the Service Perimeter has been +/// removed from long-lasting storage. +/// +/// A builder for the *servicePerimeters.delete* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().service_perimeters_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyServicePerimeterDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyServicePerimeterDeleteCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyServicePerimeterDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.servicePerimeters.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. Resource name for the Service Perimeter. + /// + /// Format: + /// `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccessPolicyServicePerimeterDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyServicePerimeterDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyServicePerimeterDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyServicePerimeterDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Update an Access Level. The longrunning +/// operation from this RPC will have a successful status once the changes to +/// the Access Level have propagated +/// to long-lasting storage. Access Levels containing +/// errors will result in an error response for the first error encountered. +/// +/// A builder for the *accessLevels.patch* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// use accesscontextmanager1::AccessLevel; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccessLevel::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().access_levels_patch(req, "name") +/// .update_mask("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyAccessLevelPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _request: AccessLevel, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyAccessLevelPatchCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyAccessLevelPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.accessLevels.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccessLevel) -> AccessPolicyAccessLevelPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. Resource name for the Access Level. The `short_name` component + /// must begin with a letter and only include alphanumeric and '_'. Format: + /// `accessPolicies/{policy_id}/accessLevels/{short_name}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccessPolicyAccessLevelPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Required. Mask to control which fields get updated. Must be non-empty. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> AccessPolicyAccessLevelPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyAccessLevelPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyAccessLevelPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyAccessLevelPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Create an `AccessPolicy`. Fails if this organization already has a +/// `AccessPolicy`. The longrunning Operation will have a successful status +/// once the `AccessPolicy` has propagated to long-lasting storage. +/// Syntactic and basic semantic errors will be returned in `metadata` as a +/// BadRequest proto. +/// +/// A builder for the *create* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// use accesscontextmanager1::AccessPolicy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccessPolicy::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().create(req) +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _request: AccessPolicy, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyCreateCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/accessPolicies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccessPolicy) -> AccessPolicyCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// List all Service Perimeters for an +/// access policy. +/// +/// A builder for the *servicePerimeters.list* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().service_perimeters_list("parent") +/// .page_token("duo") +/// .page_size(-32) +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyServicePerimeterListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyServicePerimeterListCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyServicePerimeterListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListServicePerimetersResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.servicePerimeters.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/servicePerimeters"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. Resource name for the access policy to list Service Perimeters from. + /// + /// Format: + /// `accessPolicies/{policy_id}` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> AccessPolicyServicePerimeterListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Next page token for the next batch of Service Perimeter instances. + /// Defaults to the first page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccessPolicyServicePerimeterListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Number of Service Perimeters to include + /// in the list. Default 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> AccessPolicyServicePerimeterListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyServicePerimeterListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyServicePerimeterListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyServicePerimeterListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// List all AccessPolicies under a +/// container. +/// +/// A builder for the *list* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().list() +/// .parent("sea") +/// .page_token("Lorem") +/// .page_size(-75) +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _parent: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyListCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListAccessPoliciesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + if let Some(value) = self._parent { + params.push(("parent", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/accessPolicies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. Resource name for the container to list AccessPolicy instances + /// from. + /// + /// Format: + /// `organizations/{org_id}` + /// + /// Sets the *parent* query property to the given value. + pub fn parent(mut self, new_value: &str) -> AccessPolicyListCall<'a, C, A> { + self._parent = Some(new_value.to_string()); + self + } + /// Next page token for the next batch of AccessPolicy instances. Defaults to + /// the first page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccessPolicyListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Number of AccessPolicy instances to include in the list. Default 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> AccessPolicyListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Get an Access Level by resource +/// name. +/// +/// A builder for the *accessLevels.get* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().access_levels_get("name") +/// .access_level_format("sadipscing") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyAccessLevelGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _name: String, + _access_level_format: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyAccessLevelGetCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyAccessLevelGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccessLevel)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.accessLevels.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._access_level_format { + params.push(("accessLevelFormat", value.to_string())); + } + for &field in ["alt", "name", "accessLevelFormat"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. Resource name for the Access Level. + /// + /// Format: + /// `accessPolicies/{policy_id}/accessLevels/{access_level_id}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccessPolicyAccessLevelGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Whether to return `BasicLevels` in the Cloud Common Expression + /// Language rather than as `BasicLevels`. Defaults to AS_DEFINED, where + /// Access Levels + /// are returned as `BasicLevels` or `CustomLevels` based on how they were + /// created. If set to CEL, all Access Levels are returned as + /// `CustomLevels`. In the CEL case, `BasicLevels` are translated to equivalent + /// `CustomLevels`. + /// + /// Sets the *access level format* query property to the given value. + pub fn access_level_format(mut self, new_value: &str) -> AccessPolicyAccessLevelGetCall<'a, C, A> { + self._access_level_format = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyAccessLevelGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyAccessLevelGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyAccessLevelGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Update an AccessPolicy. The +/// longrunning Operation from this RPC will have a successful status once the +/// changes to the AccessPolicy have propagated +/// to long-lasting storage. Syntactic and basic semantic errors will be +/// returned in `metadata` as a BadRequest proto. +/// +/// A builder for the *patch* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// use accesscontextmanager1::AccessPolicy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccessPolicy::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().patch(req, "name") +/// .update_mask("eirmod") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _request: AccessPolicy, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyPatchCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccessPolicy) -> AccessPolicyPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Output only. Resource name of the `AccessPolicy`. Format: + /// `accessPolicies/{policy_id}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccessPolicyPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Required. Mask to control which fields get updated. Must be non-empty. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> AccessPolicyPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Delete an Access Level by resource +/// name. The longrunning operation from this RPC will have a successful status +/// once the Access Level has been removed +/// from long-lasting storage. +/// +/// A builder for the *accessLevels.delete* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().access_levels_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyAccessLevelDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyAccessLevelDeleteCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyAccessLevelDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.accessLevels.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. Resource name for the Access Level. + /// + /// Format: + /// `accessPolicies/{policy_id}/accessLevels/{access_level_id}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccessPolicyAccessLevelDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyAccessLevelDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyAccessLevelDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyAccessLevelDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Get an AccessPolicy by name. +/// +/// A builder for the *get* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().get("name") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyGetCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccessPolicy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. Resource name for the access policy to get. + /// + /// Format `accessPolicies/{policy_id}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccessPolicyGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Get an Service Perimeter by resource +/// name. +/// +/// A builder for the *servicePerimeters.get* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().service_perimeters_get("name") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyServicePerimeterGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyServicePerimeterGetCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ServicePerimeter)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.servicePerimeters.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. Resource name for the Service Perimeter. + /// + /// Format: + /// `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccessPolicyServicePerimeterGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyServicePerimeterGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyServicePerimeterGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyServicePerimeterGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Delete an AccessPolicy by resource +/// name. The longrunning Operation will have a successful status once the +/// AccessPolicy +/// has been removed from long-lasting storage. +/// +/// A builder for the *delete* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().delete("name") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyDeleteCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. Resource name for the access policy to delete. + /// + /// Format `accessPolicies/{policy_id}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccessPolicyDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Update an Service Perimeter. The +/// longrunning operation from this RPC will have a successful status once the +/// changes to the Service Perimeter have +/// propagated to long-lasting storage. Service Perimeter containing +/// errors will result in an error response for the first error encountered. +/// +/// A builder for the *servicePerimeters.patch* method supported by a *accessPolicy* resource. +/// It is not used directly, but through a `AccessPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_accesscontextmanager1 as accesscontextmanager1; +/// use accesscontextmanager1::ServicePerimeter; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use accesscontextmanager1::AccessContextManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ServicePerimeter::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.access_policies().service_perimeters_patch(req, "name") +/// .update_mask("dolore") +/// .doit(); +/// # } +/// ``` +pub struct AccessPolicyServicePerimeterPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AccessContextManager, + _request: ServicePerimeter, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccessPolicyServicePerimeterPatchCall<'a, C, A> {} + +impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.servicePerimeters.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ServicePerimeter) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. Resource name for the ServicePerimeter. The `short_name` + /// component must begin with a letter and only include alphanumeric and '_'. + /// Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Required. Mask to control which fields get updated. Must be non-empty. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/accesscontextmanager1_beta-cli/Cargo.toml b/gen/accesscontextmanager1_beta-cli/Cargo.toml index 9aa440374c..64905cdb23 100644 --- a/gen/accesscontextmanager1_beta-cli/Cargo.toml +++ b/gen/accesscontextmanager1_beta-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-accesscontextmanager1_beta-cli" -version = "1.0.8+20181010" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Access Context Manager (protocol v1beta)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/accesscontextmanager1_beta-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-accesscontextmanager1_beta] path = "../accesscontextmanager1_beta" -version = "1.0.8+20181010" +version = "1.0.8+20190327" diff --git a/gen/accesscontextmanager1_beta-cli/README.md b/gen/accesscontextmanager1_beta-cli/README.md index 51da36bdf2..6f71247ff4 100644 --- a/gen/accesscontextmanager1_beta-cli/README.md +++ b/gen/accesscontextmanager1_beta-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Access Context Manager* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *Access Context Manager* API at revision *20190327*. The CLI is at version *1.0.8*. ```bash accesscontextmanager1-beta [options] diff --git a/gen/accesscontextmanager1_beta-cli/mkdocs.yml b/gen/accesscontextmanager1_beta-cli/mkdocs.yml index 5e41058f7c..d770053852 100644 --- a/gen/accesscontextmanager1_beta-cli/mkdocs.yml +++ b/gen/accesscontextmanager1_beta-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Access Context Manager v1.0.8+20181010 +site_name: Access Context Manager v1.0.8+20190327 site_url: http://byron.github.io/google-apis-rs/google-accesscontextmanager1_beta-cli site_description: A complete library to interact with Access Context Manager (protocol v1beta) diff --git a/gen/accesscontextmanager1_beta-cli/src/main.rs b/gen/accesscontextmanager1_beta-cli/src/main.rs index c8afbd53d0..0ecf093c02 100644 --- a/gen/accesscontextmanager1_beta-cli/src/main.rs +++ b/gen/accesscontextmanager1_beta-cli/src/main.rs @@ -424,10 +424,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "name", "parent", "title", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -679,10 +679,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "name", "parent", "title", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -776,11 +776,11 @@ impl<'n> Engine<'n> { "status.resources" => Some(("status.resources", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "status.access-levels" => Some(("status.accessLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "perimeter-type" => Some(("perimeterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["access-levels", "create-time", "description", "name", "perimeter-type", "resources", "restricted-services", "status", "title", "unrestricted-services", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1033,11 +1033,11 @@ impl<'n> Engine<'n> { "status.resources" => Some(("status.resources", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "status.access-levels" => Some(("status.accessLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "perimeter-type" => Some(("perimeterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["access-levels", "create-time", "description", "name", "perimeter-type", "resources", "restricted-services", "status", "title", "unrestricted-services", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1768,7 +1768,7 @@ fn main() { let mut app = App::new("accesscontextmanager1-beta") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190327") .about("An API for setting attribute based access control to requests to GCP services.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_accesscontextmanager1_beta_cli") .arg(Arg::with_name("url") diff --git a/gen/accesscontextmanager1_beta/Cargo.toml b/gen/accesscontextmanager1_beta/Cargo.toml index f592892875..2cfe65e05d 100644 --- a/gen/accesscontextmanager1_beta/Cargo.toml +++ b/gen/accesscontextmanager1_beta/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-accesscontextmanager1_beta" -version = "1.0.8+20181010" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Access Context Manager (protocol v1beta)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/accesscontextmanager1_beta" homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/" -documentation = "https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010" +documentation = "https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327" license = "MIT" keywords = ["accesscontextmanager", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/accesscontextmanager1_beta/README.md b/gen/accesscontextmanager1_beta/README.md index 9954eb6225..1e3454fb0a 100644 --- a/gen/accesscontextmanager1_beta/README.md +++ b/gen/accesscontextmanager1_beta/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-accesscontextmanager1_beta` library allows access to all features of the *Google Access Context Manager* service. -This documentation was generated from *Access Context Manager* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *accesscontextmanager:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Access Context Manager* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *accesscontextmanager:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Access Context Manager* *v1_beta* API can be found at the [official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessContextManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessContextManager.html) ... -* [access policies](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicy.html) - * [*access levels create*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyAccessLevelCreateCall.html), [*access levels delete*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyAccessLevelDeleteCall.html), [*access levels get*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyAccessLevelGetCall.html), [*access levels list*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyAccessLevelListCall.html), [*access levels patch*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyAccessLevelPatchCall.html), [*create*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyCreateCall.html), [*delete*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyDeleteCall.html), [*get*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyGetCall.html), [*list*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyListCall.html), [*patch*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyPatchCall.html), [*service perimeters create*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyServicePerimeterCreateCall.html), [*service perimeters delete*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyServicePerimeterDeleteCall.html), [*service perimeters get*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyServicePerimeterGetCall.html), [*service perimeters list*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyServicePerimeterListCall.html) and [*service perimeters patch*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessPolicyServicePerimeterPatchCall.html) -* [operations](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.Operation.html) - * [*get*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.OperationGetCall.html) +* [access policies](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicy.html) + * [*access levels create*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyAccessLevelCreateCall.html), [*access levels delete*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyAccessLevelDeleteCall.html), [*access levels get*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyAccessLevelGetCall.html), [*access levels list*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyAccessLevelListCall.html), [*access levels patch*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyAccessLevelPatchCall.html), [*create*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyCreateCall.html), [*delete*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyDeleteCall.html), [*get*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyGetCall.html), [*list*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyListCall.html), [*patch*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyPatchCall.html), [*service perimeters create*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyServicePerimeterCreateCall.html), [*service perimeters delete*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyServicePerimeterDeleteCall.html), [*service perimeters get*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyServicePerimeterGetCall.html), [*service perimeters list*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyServicePerimeterListCall.html) and [*service perimeters patch*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessPolicyServicePerimeterPatchCall.html) +* [operations](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.Operation.html) + * [*get*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.OperationGetCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/struct.AccessContextManager.html)** +* **[Hub](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/struct.AccessContextManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.Part.html)** + * **[Parts](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -142,17 +142,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -162,29 +162,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.RequestValue.html) and -[decodable](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.RequestValue.html) and +[decodable](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20181010/google_accesscontextmanager1_beta/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-accesscontextmanager1_beta/1.0.8+20190327/google_accesscontextmanager1_beta/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/accesscontextmanager1_beta/src/lib.rs b/gen/accesscontextmanager1_beta/src/lib.rs index 7a6136ef4c..b1196825dc 100644 --- a/gen/accesscontextmanager1_beta/src/lib.rs +++ b/gen/accesscontextmanager1_beta/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Access Context Manager* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *accesscontextmanager:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Access Context Manager* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *accesscontextmanager:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Access Context Manager* *v1_beta* API can be found at the //! [official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/). @@ -386,17 +386,17 @@ impl<'a, C, A> AccessContextManager // ############ // SCHEMAS ### // ########## -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -517,17 +517,23 @@ pub struct DevicePolicy { /// Allowed encryptions statuses, an empty list allows all statuses. #[serde(rename="allowedEncryptionStatuses")] pub allowed_encryption_statuses: Option>, + /// Whether the device needs to be corp owned. + #[serde(rename="requireCorpOwned")] + pub require_corp_owned: Option, /// Allowed device management levels, an empty list allows all management /// levels. #[serde(rename="allowedDeviceManagementLevels")] pub allowed_device_management_levels: Option>, + /// Allowed OS versions, an empty list allows all types and all versions. + #[serde(rename="osConstraints")] + pub os_constraints: Option>, + /// Whether the device needs to be approved by the customer admin. + #[serde(rename="requireAdminApproval")] + pub require_admin_approval: Option, /// Whether or not screenlock is required for the DevicePolicy to be true. /// Defaults to `false`. #[serde(rename="requireScreenlock")] pub require_screenlock: Option, - /// Allowed OS versions, an empty list allows all types and all versions. - #[serde(rename="osConstraints")] - pub os_constraints: Option>, } impl Part for DevicePolicy {} @@ -553,8 +559,9 @@ pub struct AccessPolicy { /// Output only. Time the `AccessPolicy` was updated in UTC. #[serde(rename="updateTime")] pub update_time: Option, - /// Human readable title. Does not affect behavior. - pub title: Option, + /// Output only. Time the `AccessPolicy` was created in UTC. + #[serde(rename="createTime")] + pub create_time: Option, /// Output only. Resource name of the `AccessPolicy`. Format: /// `accessPolicies/{policy_id}` pub name: Option, @@ -562,9 +569,8 @@ pub struct AccessPolicy { /// Hierarchy. Currently immutable once created. Format: /// `organizations/{organization_id}` pub parent: Option, - /// Output only. Time the `AccessPolicy` was created in UTC. - #[serde(rename="createTime")] - pub create_time: Option, + /// Required. Human readable title. Does not affect behavior. + pub title: Option, } impl RequestValue for AccessPolicy {} @@ -610,8 +616,8 @@ impl ResponseResult for ListServicePerimetersResponse {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [service perimeters create access policies](struct.AccessPolicyServicePerimeterCreateCall.html) (request) -/// * [service perimeters patch access policies](struct.AccessPolicyServicePerimeterPatchCall.html) (request) /// * [service perimeters get access policies](struct.AccessPolicyServicePerimeterGetCall.html) (response) +/// * [service perimeters patch access policies](struct.AccessPolicyServicePerimeterPatchCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ServicePerimeter { @@ -622,9 +628,10 @@ pub struct ServicePerimeter { /// Output only. Time the `ServicePerimeter` was updated in UTC. #[serde(rename="updateTime")] pub update_time: Option, - /// Description of the `ServicePerimeter` and its use. Does not affect - /// behavior. - pub description: Option, + /// Required. Resource name for the ServicePerimeter. The `short_name` + /// component must begin with a letter and only include alphanumeric and '_'. + /// Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` + pub name: Option, /// Human readable title. Must be unique within the Policy. pub title: Option, /// Perimeter type indicator. A single project is @@ -638,10 +645,9 @@ pub struct ServicePerimeter { /// Output only. Time the `ServicePerimeter` was created in UTC. #[serde(rename="createTime")] pub create_time: Option, - /// Required. Resource name for the ServicePerimeter. The `short_name` - /// component must begin with a letter and only include alphanumeric and '_'. - /// Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` - pub name: Option, + /// Description of the `ServicePerimeter` and its use. Does not affect + /// behavior. + pub description: Option, } impl RequestValue for ServicePerimeter {} @@ -655,44 +661,28 @@ impl ResponseResult for ServicePerimeter {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ServicePerimeterConfig { - /// GCP services that are subject to the Service Perimeter restrictions. May - /// contain a list of services or a single wildcard "*". For example, if + /// GCP services that are subject to the Service Perimeter restrictions. Must + /// contain a list of services. For example, if /// `storage.googleapis.com` is specified, access to the storage buckets /// inside the perimeter must meet the perimeter's access restrictions. - /// - /// Wildcard means that unless explicitly specified by "unrestricted_services" - /// list, any service is treated as restricted. One of the fields - /// "restricted_services", "unrestricted_services" must contain a wildcard "*", - /// otherwise the Service Perimeter specification is invalid. It also means - /// that both field being empty is invalid as well. "restricted_services" can - /// be empty if and only if "unrestricted_services" list contains a "*" - /// wildcard. #[serde(rename="restrictedServices")] pub restricted_services: Option>, /// A list of GCP resources that are inside of the service perimeter. /// Currently only projects are allowed. Format: `projects/{project_number}` pub resources: Option>, - /// GCP services that are not subject to the Service Perimeter restrictions. - /// May contain a list of services or a single wildcard "*". For example, if - /// `logging.googleapis.com` is unrestricted, users can access logs inside the - /// perimeter as if the perimeter doesn't exist, and it also means VMs inside the perimeter - /// can access logs outside the perimeter. + /// GCP services that are not subject to the Service Perimeter + /// restrictions. Deprecated. Must be set to a single wildcard "*". /// /// The wildcard means that unless explicitly specified by - /// "restricted_services" list, any service is treated as unrestricted. One of - /// the fields "restricted_services", "unrestricted_services" must contain a - /// wildcard "*", otherwise the Service Perimeter specification is invalid. It - /// also means that both field being empty is invalid as well. - /// "unrestricted_services" can be empty if and only if "restricted_services" - /// list contains a "*" wildcard. + /// "restricted_services" list, any service is treated as unrestricted. #[serde(rename="unrestrictedServices")] pub unrestricted_services: Option>, /// A list of `AccessLevel` resource names that allow resources within the /// `ServicePerimeter` to be accessed from the internet. `AccessLevels` listed /// must be in the same policy as this `ServicePerimeter`. Referencing a /// nonexistent `AccessLevel` is a syntax error. If no `AccessLevel` names are - /// listed, resources within the perimeter can only be accessed via GCP calls with - /// request origins within the perimeter. Example: + /// listed, resources within the perimeter can only be accessed via GCP calls + /// with request origins within the perimeter. Example: /// `"accessPolicies/MY_POLICY/accessLevels/MY_LEVEL"`. /// For Service Perimeter Bridge, must be empty. #[serde(rename="accessLevels")] @@ -778,8 +768,6 @@ impl ResponseResult for Operation {} /// An `AccessLevel` is a label that can be applied to requests to GCP services, /// along with a list of requirements necessary for the label to be applied. -/// `AccessLevels` can be referenced in `AccessZones` and in the `Cloud Org -/// Policy` API. /// /// # Activities /// @@ -824,10 +812,6 @@ impl ResponseResult for AccessLevel {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Condition { - /// Device specific restrictions, all restrictions must hold for the - /// Condition to be true. If not specified, all devices are allowed. - #[serde(rename="devicePolicy")] - pub device_policy: Option, /// A list of other access levels defined in the same `Policy`, referenced by /// resource name. Referencing an `AccessLevel` which does not exist is an /// error. All access levels listed must be granted for the Condition @@ -835,15 +819,20 @@ pub struct Condition { /// "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"` #[serde(rename="requiredAccessLevels")] pub required_access_levels: Option>, - /// The signed-in user originating the request must be a part of one of the - /// provided members. + /// The request must originate from one of the provided countries/regions. + /// Must be valid ISO 3166-1 alpha-2 codes. + pub regions: Option>, + /// The request must be made by one of the provided user or service + /// accounts. Groups are not supported. /// Syntax: /// `user:{emailid}` - /// `group:{emailid}` /// `serviceAccount:{emailid}` - /// If not specified, a request may come from any user (logged in/not logged - /// in, not present in any groups, etc.). + /// If not specified, a request may come from any user. pub members: Option>, + /// Device specific restrictions, all restrictions must hold for the + /// Condition to be true. If not specified, all devices are allowed. + #[serde(rename="devicePolicy")] + pub device_policy: Option, /// Whether to negate the Condition. If true, the Condition becomes a NAND over /// its non-empty fields, each field must be false for the Condition overall to /// be satisfied. Defaults to false. @@ -872,6 +861,12 @@ pub struct OsConstraint { /// Required. The allowed OS type. #[serde(rename="osType")] pub os_type: Option, + /// Only allows requests from devices with a verified Chrome OS. + /// Verifications includes requirements that the device is enterprise-managed, + /// conformant to Dasher domain policies, and the caller has permission to call + /// the API targeted by the request. + #[serde(rename="requireVerifiedChromeOs")] + pub require_verified_chrome_os: Option, /// The minimum allowed OS version. If not set, any version of this OS /// satisfies the constraint. Format: `"major.minor.patch"`. /// Examples: `"10.5.301"`, `"9.2.1"`. @@ -1255,24 +1250,18 @@ impl<'a, C, A> AccessPolicyMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Update an Service Perimeter. The - /// longrunning operation from this RPC will have a successful status once the - /// changes to the Service Perimeter have - /// propagated to long-lasting storage. Service Perimeter containing - /// errors will result in an error response for the first error encountered. + /// Get an Service Perimeter by resource + /// name. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `name` - Required. Resource name for the ServicePerimeter. The `short_name` - /// component must begin with a letter and only include alphanumeric and '_'. - /// Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` - pub fn service_perimeters_patch(&self, request: ServicePerimeter, name: &str) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { - AccessPolicyServicePerimeterPatchCall { + /// * `name` - Required. Resource name for the Service Perimeter. + /// Format: + /// `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}` + pub fn service_perimeters_get(&self, name: &str) -> AccessPolicyServicePerimeterGetCall<'a, C, A> { + AccessPolicyServicePerimeterGetCall { hub: self.hub, - _request: request, _name: name.to_string(), - _update_mask: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1302,18 +1291,24 @@ impl<'a, C, A> AccessPolicyMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Get an Service Perimeter by resource - /// name. + /// Update an Service Perimeter. The + /// longrunning operation from this RPC will have a successful status once the + /// changes to the Service Perimeter have + /// propagated to long-lasting storage. Service Perimeter containing + /// errors will result in an error response for the first error encountered. /// /// # Arguments /// - /// * `name` - Required. Resource name for the Service Perimeter. - /// Format: - /// `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}` - pub fn service_perimeters_get(&self, name: &str) -> AccessPolicyServicePerimeterGetCall<'a, C, A> { - AccessPolicyServicePerimeterGetCall { + /// * `request` - No description provided. + /// * `name` - Required. Resource name for the ServicePerimeter. The `short_name` + /// component must begin with a letter and only include alphanumeric and '_'. + /// Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` + pub fn service_perimeters_patch(&self, request: ServicePerimeter, name: &str) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { + AccessPolicyServicePerimeterPatchCall { hub: self.hub, + _request: request, _name: name.to_string(), + _update_mask: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1417,7 +1412,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1433,10 +1428,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1456,7 +1448,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1534,7 +1526,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1684,7 +1676,7 @@ impl<'a, C, A> AccessPolicyAccessLevelListCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1723,7 +1712,7 @@ impl<'a, C, A> AccessPolicyAccessLevelListCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelListCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelCreateCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2025,7 +2011,7 @@ impl<'a, C, A> AccessPolicyAccessLevelCreateCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelCreateCall<'a, C, A> where C: BorrowMut AccessPolicyServicePerimeterCreateCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2279,10 +2265,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterCreateCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2314,7 +2297,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterCreateCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2407,7 +2390,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterCreateCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2544,7 +2527,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterDeleteCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2560,10 +2543,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterDeleteCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2583,7 +2563,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterDeleteCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2664,7 +2644,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterDeleteCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2814,7 +2794,7 @@ impl<'a, C, A> AccessPolicyAccessLevelPatchCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2865,7 +2842,7 @@ impl<'a, C, A> AccessPolicyAccessLevelPatchCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelPatchCall<'a, C, A> where C: BorrowMut AccessPolicyCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3133,7 +3107,7 @@ impl<'a, C, A> AccessPolicyCreateCall<'a, C, A> where C: BorrowMut AccessPolicyCreateCall<'a, C, A> where C: BorrowMut AccessPolicyGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3363,10 +3337,7 @@ impl<'a, C, A> AccessPolicyGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3386,7 +3357,7 @@ impl<'a, C, A> AccessPolicyGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3466,7 +3437,7 @@ impl<'a, C, A> AccessPolicyGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3605,10 +3576,7 @@ impl<'a, C, A> AccessPolicyListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3628,7 +3596,7 @@ impl<'a, C, A> AccessPolicyListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3722,7 +3690,7 @@ impl<'a, C, A> AccessPolicyListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3862,7 +3830,7 @@ impl<'a, C, A> AccessPolicyAccessLevelGetCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3901,7 +3866,7 @@ impl<'a, C, A> AccessPolicyAccessLevelGetCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelGetCall<'a, C, A> where C: BorrowMut AccessPolicyPatchCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4161,10 +4126,7 @@ impl<'a, C, A> AccessPolicyPatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4196,7 +4158,7 @@ impl<'a, C, A> AccessPolicyPatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4294,7 +4256,7 @@ impl<'a, C, A> AccessPolicyPatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4431,7 +4393,7 @@ impl<'a, C, A> AccessPolicyAccessLevelDeleteCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4470,7 +4429,7 @@ impl<'a, C, A> AccessPolicyAccessLevelDeleteCall<'a, C, A> where C: BorrowMut AccessPolicyAccessLevelDeleteCall<'a, C, A> where C: BorrowMut AccessPolicyServicePerimeterListCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4712,10 +4671,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4735,7 +4691,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4832,7 +4788,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4880,13 +4836,10 @@ impl<'a, C, A> AccessPolicyServicePerimeterListCall<'a, C, A> where C: BorrowMut } -/// Update an Service Perimeter. The -/// longrunning operation from this RPC will have a successful status once the -/// changes to the Service Perimeter have -/// propagated to long-lasting storage. Service Perimeter containing -/// errors will result in an error response for the first error encountered. +/// Get an Service Perimeter by resource +/// name. /// -/// A builder for the *servicePerimeters.patch* method supported by a *accessPolicy* resource. +/// A builder for the *servicePerimeters.get* method supported by a *accessPolicy* resource. /// It is not used directly, but through a `AccessPolicyMethods` instance. /// /// # Example @@ -4898,7 +4851,6 @@ impl<'a, C, A> AccessPolicyServicePerimeterListCall<'a, C, A> where C: BorrowMut /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta; -/// use accesscontextmanager1_beta::ServicePerimeter; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -4909,38 +4861,30 @@ impl<'a, C, A> AccessPolicyServicePerimeterListCall<'a, C, A> where C: BorrowMut /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ServicePerimeter::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.access_policies().service_perimeters_patch(req, "name") -/// .update_mask("duo") +/// let result = hub.access_policies().service_perimeters_get("name") /// .doit(); /// # } /// ``` -pub struct AccessPolicyServicePerimeterPatchCall<'a, C, A> +pub struct AccessPolicyServicePerimeterGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AccessContextManager, - _request: ServicePerimeter, _name: String, - _update_mask: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccessPolicyServicePerimeterPatchCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccessPolicyServicePerimeterGetCall<'a, C, A> {} -impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ServicePerimeter)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -4949,14 +4893,11 @@ impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.servicePerimeters.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.servicePerimeters.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { + for &field in ["alt", "name"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -4982,7 +4923,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4998,22 +4939,8 @@ impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -5030,15 +4957,11 @@ impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMu } }; let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -5089,41 +5012,26 @@ impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMu } - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ServicePerimeter) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. Resource name for the ServicePerimeter. The `short_name` - /// component must begin with a letter and only include alphanumeric and '_'. - /// Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` + /// Required. Resource name for the Service Perimeter. + /// + /// Format: + /// `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}` /// /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> AccessPolicyServicePerimeterGetCall<'a, C, A> { self._name = new_value.to_string(); self } - /// Required. Mask to control which fields get updated. Must be non-empty. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyServicePerimeterGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -5132,7 +5040,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5148,7 +5056,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMu /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccessPolicyServicePerimeterGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -5168,7 +5076,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMu /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccessPolicyServicePerimeterGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -5269,7 +5177,7 @@ impl<'a, C, A> AccessPolicyDeleteCall<'a, C, A> where C: BorrowMut AccessPolicyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5308,7 +5213,7 @@ impl<'a, C, A> AccessPolicyDeleteCall<'a, C, A> where C: BorrowMut AccessPolicyDeleteCall<'a, C, A> where C: BorrowMut AccessPolicyDeleteCall<'a, C, A> where C: BorrowMut AccessPolicyDeleteCall<'a, C, A> where C: BorrowMut AccessPolicyDeleteCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = AccessContextManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ServicePerimeter::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.access_policies().service_perimeters_get("name") +/// let result = hub.access_policies().service_perimeters_patch(req, "name") +/// .update_mask("sea") /// .doit(); /// # } /// ``` -pub struct AccessPolicyServicePerimeterGetCall<'a, C, A> +pub struct AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AccessContextManager, + _request: ServicePerimeter, _name: String, + _update_mask: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccessPolicyServicePerimeterGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccessPolicyServicePerimeterPatchCall<'a, C, A> {} -impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccessPolicyServicePerimeterPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ServicePerimeter)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -5493,11 +5410,14 @@ impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.servicePerimeters.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "accesscontextmanager.accessPolicies.servicePerimeters.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5523,7 +5443,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5539,11 +5459,19 @@ impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -5560,11 +5488,15 @@ impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut< } }; let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -5615,26 +5547,41 @@ impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut< } - /// Required. Resource name for the Service Perimeter. - /// - /// Format: - /// `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}` + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ServicePerimeter) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. Resource name for the ServicePerimeter. The `short_name` + /// component must begin with a letter and only include alphanumeric and '_'. + /// Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` /// /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> AccessPolicyServicePerimeterGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { self._name = new_value.to_string(); self } + /// Required. Mask to control which fields get updated. Must be non-empty. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyServicePerimeterGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -5643,7 +5590,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5659,7 +5606,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut< /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AccessPolicyServicePerimeterGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -5679,7 +5626,7 @@ impl<'a, C, A> AccessPolicyServicePerimeterGetCall<'a, C, A> where C: BorrowMut< /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccessPolicyServicePerimeterGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccessPolicyServicePerimeterPatchCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { diff --git a/gen/adexchangebuyer1d3/Cargo.toml b/gen/adexchangebuyer1d3/Cargo.toml index 54cfe501e3..ec86b8bb5e 100644 --- a/gen/adexchangebuyer1d3/Cargo.toml +++ b/gen/adexchangebuyer1d3/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/adexchangebuyer1d3/src/lib.rs b/gen/adexchangebuyer1d3/src/lib.rs index 4e3db476e8..9e41b62523 100644 --- a/gen/adexchangebuyer1d3/src/lib.rs +++ b/gen/adexchangebuyer1d3/src/lib.rs @@ -1949,10 +1949,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1972,7 +1969,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2050,7 +2047,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2169,10 +2166,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2192,7 +2186,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2260,7 +2254,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2379,10 +2373,7 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2402,7 +2393,7 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2470,7 +2461,7 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2612,10 +2603,7 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2635,7 +2623,7 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2713,7 +2701,7 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2864,10 +2852,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2899,7 +2884,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2999,7 +2984,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3150,10 +3135,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3185,7 +3167,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3285,7 +3267,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3429,10 +3411,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3452,7 +3431,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3540,7 +3519,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3666,10 +3645,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3701,7 +3677,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3781,7 +3757,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3929,10 +3905,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3952,7 +3925,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4057,7 +4030,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4201,10 +4174,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4224,7 +4194,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4312,7 +4282,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4461,10 +4431,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4496,7 +4463,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4586,7 +4553,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4735,10 +4702,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4770,7 +4734,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4860,7 +4824,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4979,10 +4943,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5002,7 +4963,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5070,7 +5031,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5212,10 +5173,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5235,7 +5193,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5313,7 +5271,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5448,10 +5406,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5471,7 +5426,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut PerformanceReportListCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5749,7 +5701,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6013,7 +5962,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6280,7 +6226,7 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut PretargetingConfigGetCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6552,7 +6495,7 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6807,7 +6747,7 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut PretargetingConfigListCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7071,7 +7008,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PubprofileListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3907,7 +3904,7 @@ impl<'a, C, A> PubprofileListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3985,7 +3982,7 @@ impl<'a, C, A> PubprofileListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4127,10 +4124,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4150,7 +4144,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4228,7 +4222,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4347,10 +4341,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4370,7 +4361,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4438,7 +4429,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4587,10 +4578,7 @@ impl<'a, C, A> MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4622,7 +4610,7 @@ impl<'a, C, A> MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut MarketplacedealInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4896,7 +4881,7 @@ impl<'a, C, A> MarketplacedealInsertCall<'a, C, A> where C: BorrowMut MarketplacedealInsertCall<'a, C, A> where C: BorrowMut MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5170,7 +5152,7 @@ impl<'a, C, A> MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut MarketplacedealListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5430,7 +5409,7 @@ impl<'a, C, A> MarketplacedealListCall<'a, C, A> where C: BorrowMut MarketplacedealListCall<'a, C, A> where C: BorrowMut MarketplaceprivateauctionUpdateproposalCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5698,7 +5674,7 @@ impl<'a, C, A> MarketplaceprivateauctionUpdateproposalCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5778,7 +5754,7 @@ impl<'a, C, A> MarketplaceprivateauctionUpdateproposalCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5902,10 +5878,7 @@ impl<'a, C, A> ProposalSearchCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5925,7 +5898,7 @@ impl<'a, C, A> ProposalSearchCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6000,7 +5973,7 @@ impl<'a, C, A> ProposalSearchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6126,10 +6099,7 @@ impl<'a, C, A> ProposalInsertCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6161,7 +6131,7 @@ impl<'a, C, A> ProposalInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6241,7 +6211,7 @@ impl<'a, C, A> ProposalInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6394,10 +6364,7 @@ impl<'a, C, A> ProposalUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6429,7 +6396,7 @@ impl<'a, C, A> ProposalUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6539,7 +6506,7 @@ impl<'a, C, A> ProposalUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6680,10 +6647,7 @@ impl<'a, C, A> ProposalSetupcompleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6703,7 +6667,7 @@ impl<'a, C, A> ProposalSetupcompleteCall<'a, C, A> where C: BorrowMut ProposalSetupcompleteCall<'a, C, A> where C: BorrowMut ProposalPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6959,7 +6920,7 @@ impl<'a, C, A> ProposalPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7069,7 +7030,7 @@ impl<'a, C, A> ProposalPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7211,10 +7172,7 @@ impl<'a, C, A> ProposalGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7234,7 +7192,7 @@ impl<'a, C, A> ProposalGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7312,7 +7270,7 @@ impl<'a, C, A> ProposalGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7463,10 +7421,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7498,7 +7453,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7598,7 +7553,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7742,10 +7697,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7765,7 +7717,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7853,7 +7805,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8004,10 +7956,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8039,7 +7988,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8139,7 +8088,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8274,10 +8223,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8297,7 +8243,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut PerformanceReportListCall<'a, C, A> where C: BorrowMut ProductSearchCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8556,7 +8499,7 @@ impl<'a, C, A> ProductSearchCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8631,7 +8574,7 @@ impl<'a, C, A> ProductSearchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8773,10 +8716,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8796,7 +8736,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8874,7 +8814,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9021,10 +8961,7 @@ impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9044,7 +8981,7 @@ impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut MarketplacenoteListCall<'a, C, A> where C: BorrowMut MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9313,7 +9247,7 @@ impl<'a, C, A> MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut AccountPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9592,7 +9523,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9689,7 +9620,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9808,10 +9739,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9831,7 +9759,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9899,7 +9827,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10041,10 +9969,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10064,7 +9989,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10142,7 +10067,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10296,10 +10221,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10331,7 +10253,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10428,7 +10350,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10581,10 +10503,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10604,7 +10523,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10716,7 +10635,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10861,10 +10780,7 @@ impl<'a, C, A> CreativeRemoveDealCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10884,7 +10800,7 @@ impl<'a, C, A> CreativeRemoveDealCall<'a, C, A> where C: BorrowMut CreativeRemoveDealCall<'a, C, A> where C: BorrowMut CreativeAddDealCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11140,7 +11053,7 @@ impl<'a, C, A> CreativeAddDealCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11228,7 +11141,7 @@ impl<'a, C, A> CreativeAddDealCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11372,10 +11285,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11395,7 +11305,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11483,7 +11393,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11609,10 +11519,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11644,7 +11551,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11724,7 +11631,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11868,10 +11775,7 @@ impl<'a, C, A> CreativeListDealCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11891,7 +11795,7 @@ impl<'a, C, A> CreativeListDealCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11979,7 +11883,7 @@ impl<'a, C, A> CreativeListDealCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12128,10 +12032,7 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12163,7 +12064,7 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12418,7 +12316,7 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut PretargetingConfigListCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12682,7 +12577,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12968,7 +12860,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13234,7 +13123,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13479,7 +13365,7 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut PretargetingConfigGetCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with AdExchangeBuyerII (protocol v2beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer2_v2_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-adexchangebuyer2_v2_beta1] path = "../adexchangebuyer2_v2_beta1" -version = "1.0.8+20181011" +version = "1.0.8+20190403" diff --git a/gen/adexchangebuyer2_v2_beta1-cli/README.md b/gen/adexchangebuyer2_v2_beta1-cli/README.md index e4bd14df54..123e79931e 100644 --- a/gen/adexchangebuyer2_v2_beta1-cli/README.md +++ b/gen/adexchangebuyer2_v2_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *AdExchangeBuyerII* API at revision *20181011*. The CLI is at version *1.0.8*. +This documentation was generated from the *AdExchangeBuyerII* API at revision *20190403*. The CLI is at version *1.0.8*. ```bash adexchangebuyer2-v2-beta1 [options] diff --git a/gen/adexchangebuyer2_v2_beta1-cli/mkdocs.yml b/gen/adexchangebuyer2_v2_beta1-cli/mkdocs.yml index 5950ded098..e91fb35d0e 100644 --- a/gen/adexchangebuyer2_v2_beta1-cli/mkdocs.yml +++ b/gen/adexchangebuyer2_v2_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AdExchangeBuyerII v1.0.8+20181011 +site_name: AdExchangeBuyerII v1.0.8+20190403 site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer2_v2_beta1-cli site_description: A complete library to interact with AdExchangeBuyerII (protocol v2beta1) diff --git a/gen/adexchangebuyer2_v2_beta1-cli/src/main.rs b/gen/adexchangebuyer2_v2_beta1-cli/src/main.rs index 072cf7e7ed..9ac2c15711 100644 --- a/gen/adexchangebuyer2_v2_beta1-cli/src/main.rs +++ b/gen/adexchangebuyer2_v2_beta1-cli/src/main.rs @@ -768,9 +768,9 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "impression-tracking-urls" => Some(("impressionTrackingUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "filtering-stats.date.month" => Some(("filteringStats.date.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "filtering-stats.date.day" => Some(("filteringStats.date.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "filtering-stats.date.year" => Some(("filteringStats.date.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "filtering-stats.date.day" => Some(("filteringStats.date.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "filtering-stats.date.month" => Some(("filteringStats.date.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "detected-languages" => Some(("detectedLanguages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "advertiser-name" => Some(("advertiserName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "click-through-urls" => Some(("clickThroughUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -779,21 +779,14 @@ impl<'n> Engine<'n> { "creative-id" => Some(("creativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "detected-advertiser-ids" => Some(("detectedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "ad-choices-destination-url" => Some(("adChoicesDestinationUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "vendor-ids" => Some(("vendorIds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), - "agency-id" => Some(("agencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "html.snippet" => Some(("html.snippet", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "html.width" => Some(("html.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "html.height" => Some(("html.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "api-update-time" => Some(("apiUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.body" => Some(("native.body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.video-url" => Some(("native.videoUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.headline" => Some(("native.headline", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.image.url" => Some(("native.image.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.image.width" => Some(("native.image.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "native.image.height" => Some(("native.image.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "native.click-tracking-url" => Some(("native.clickTrackingUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.star-rating" => Some(("native.starRating", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "native.store-url" => Some(("native.storeUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.advertiser-name" => Some(("native.advertiserName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.price-display-text" => Some(("native.priceDisplayText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.call-to-action" => Some(("native.callToAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -803,16 +796,23 @@ impl<'n> Engine<'n> { "native.app-icon.url" => Some(("native.appIcon.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.app-icon.width" => Some(("native.appIcon.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "native.app-icon.height" => Some(("native.appIcon.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "native.store-url" => Some(("native.storeUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "native.click-tracking-url" => Some(("native.clickTrackingUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.click-link-url" => Some(("native.clickLinkUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vendor-ids" => Some(("vendorIds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "video.video-url" => Some(("video.videoUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video.video-vast-xml" => Some(("video.videoVastXml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "agency-id" => Some(("agencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html.snippet" => Some(("html.snippet", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html.width" => Some(("html.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "html.height" => Some(("html.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "api-update-time" => Some(("apiUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "detected-product-categories" => Some(("detectedProductCategories", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "detected-domains" => Some(("detectedDomains", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "attributes" => Some(("attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "deals-status" => Some(("dealsStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "declared-click-through-urls" => Some(("declaredClickThroughUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "restricted-categories" => Some(("restrictedCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "video.video-url" => Some(("video.videoUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "video.video-vast-xml" => Some(("video.videoVastXml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attributes" => Some(("attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "ad-choices-destination-url", "advertiser-name", "agency-id", "api-update-time", "app-icon", "attributes", "body", "call-to-action", "click-link-url", "click-through-urls", "click-tracking-url", "creative-id", "date", "day", "deals-status", "declared-click-through-urls", "detected-advertiser-ids", "detected-domains", "detected-languages", "detected-product-categories", "detected-sensitive-categories", "filtering-stats", "headline", "height", "html", "image", "impression-tracking-urls", "logo", "month", "native", "open-auction-status", "price-display-text", "restricted-categories", "snippet", "star-rating", "store-url", "url", "vendor-ids", "version", "video", "video-url", "video-vast-xml", "width", "year"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1337,9 +1337,9 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "impression-tracking-urls" => Some(("impressionTrackingUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "filtering-stats.date.month" => Some(("filteringStats.date.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "filtering-stats.date.day" => Some(("filteringStats.date.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "filtering-stats.date.year" => Some(("filteringStats.date.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "filtering-stats.date.day" => Some(("filteringStats.date.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "filtering-stats.date.month" => Some(("filteringStats.date.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "detected-languages" => Some(("detectedLanguages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "advertiser-name" => Some(("advertiserName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "click-through-urls" => Some(("clickThroughUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1348,21 +1348,14 @@ impl<'n> Engine<'n> { "creative-id" => Some(("creativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "detected-advertiser-ids" => Some(("detectedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "ad-choices-destination-url" => Some(("adChoicesDestinationUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "vendor-ids" => Some(("vendorIds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), - "agency-id" => Some(("agencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "html.snippet" => Some(("html.snippet", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "html.width" => Some(("html.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "html.height" => Some(("html.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "api-update-time" => Some(("apiUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.body" => Some(("native.body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.video-url" => Some(("native.videoUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.headline" => Some(("native.headline", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.image.url" => Some(("native.image.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.image.width" => Some(("native.image.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "native.image.height" => Some(("native.image.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "native.click-tracking-url" => Some(("native.clickTrackingUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.star-rating" => Some(("native.starRating", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "native.store-url" => Some(("native.storeUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.advertiser-name" => Some(("native.advertiserName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.price-display-text" => Some(("native.priceDisplayText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.call-to-action" => Some(("native.callToAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1372,16 +1365,23 @@ impl<'n> Engine<'n> { "native.app-icon.url" => Some(("native.appIcon.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.app-icon.width" => Some(("native.appIcon.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "native.app-icon.height" => Some(("native.appIcon.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "native.store-url" => Some(("native.storeUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "native.click-tracking-url" => Some(("native.clickTrackingUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native.click-link-url" => Some(("native.clickLinkUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vendor-ids" => Some(("vendorIds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "video.video-url" => Some(("video.videoUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video.video-vast-xml" => Some(("video.videoVastXml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "agency-id" => Some(("agencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html.snippet" => Some(("html.snippet", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html.width" => Some(("html.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "html.height" => Some(("html.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "api-update-time" => Some(("apiUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "detected-product-categories" => Some(("detectedProductCategories", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "detected-domains" => Some(("detectedDomains", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "attributes" => Some(("attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "deals-status" => Some(("dealsStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "declared-click-through-urls" => Some(("declaredClickThroughUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "restricted-categories" => Some(("restrictedCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "video.video-url" => Some(("video.videoUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "video.video-vast-xml" => Some(("video.videoVastXml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attributes" => Some(("attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "ad-choices-destination-url", "advertiser-name", "agency-id", "api-update-time", "app-icon", "attributes", "body", "call-to-action", "click-link-url", "click-through-urls", "click-tracking-url", "creative-id", "date", "day", "deals-status", "declared-click-through-urls", "detected-advertiser-ids", "detected-domains", "detected-languages", "detected-product-categories", "detected-sensitive-categories", "filtering-stats", "headline", "height", "html", "image", "impression-tracking-urls", "logo", "month", "native", "open-auction-status", "price-display-text", "restricted-categories", "snippet", "star-rating", "store-url", "url", "vendor-ids", "version", "video", "video-url", "video-vast-xml", "width", "year"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1818,8 +1818,8 @@ impl<'n> Engine<'n> { "note.note" => Some(("note.note", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "note.creator-role" => Some(("note.creatorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "note.proposal-revision" => Some(("note.proposalRevision", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "note.note-id" => Some(("note.noteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "note.create-time" => Some(("note.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "note.note-id" => Some(("note.noteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "creator-role", "note", "note-id", "proposal-revision"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -2902,20 +2902,21 @@ impl<'n> Engine<'n> { "relative-date-range.duration-days" => Some(("relativeDateRange.durationDays", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "relative-date-range.offset-days" => Some(("relativeDateRange.offsetDays", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "publisher-identifiers" => Some(("publisherIdentifiers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "breakdown-dimensions" => Some(("breakdownDimensions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "deal-id" => Some(("dealId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "environment" => Some(("environment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "platforms" => Some(("platforms", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "absolute-date-range.start-date.month" => Some(("absoluteDateRange.startDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "absolute-date-range.start-date.day" => Some(("absoluteDateRange.startDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "absolute-date-range.start-date.year" => Some(("absoluteDateRange.startDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "absolute-date-range.end-date.month" => Some(("absoluteDateRange.endDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "absolute-date-range.end-date.day" => Some(("absoluteDateRange.endDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "absolute-date-range.start-date.day" => Some(("absoluteDateRange.startDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "absolute-date-range.start-date.month" => Some(("absoluteDateRange.startDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "absolute-date-range.end-date.year" => Some(("absoluteDateRange.endDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "absolute-date-range.end-date.day" => Some(("absoluteDateRange.endDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "absolute-date-range.end-date.month" => Some(("absoluteDateRange.endDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "formats" => Some(("formats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "realtime-time-range.start-timestamp" => Some(("realtimeTimeRange.startTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "seller-network-ids" => Some(("sellerNetworkIds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["absolute-date-range", "creative-id", "day", "deal-id", "duration-days", "end-date", "environment", "formats", "month", "name", "offset-days", "platforms", "publisher-identifiers", "realtime-time-range", "relative-date-range", "seller-network-ids", "start-date", "start-timestamp", "time-series-granularity", "year"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["absolute-date-range", "breakdown-dimensions", "creative-id", "day", "deal-id", "duration-days", "end-date", "environment", "formats", "month", "name", "offset-days", "platforms", "publisher-identifiers", "realtime-time-range", "relative-date-range", "seller-network-ids", "start-date", "start-timestamp", "time-series-granularity", "year"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3763,20 +3764,21 @@ impl<'n> Engine<'n> { "relative-date-range.duration-days" => Some(("relativeDateRange.durationDays", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "relative-date-range.offset-days" => Some(("relativeDateRange.offsetDays", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "publisher-identifiers" => Some(("publisherIdentifiers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "breakdown-dimensions" => Some(("breakdownDimensions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "deal-id" => Some(("dealId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "environment" => Some(("environment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "platforms" => Some(("platforms", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "absolute-date-range.start-date.month" => Some(("absoluteDateRange.startDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "absolute-date-range.start-date.day" => Some(("absoluteDateRange.startDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "absolute-date-range.start-date.year" => Some(("absoluteDateRange.startDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "absolute-date-range.end-date.month" => Some(("absoluteDateRange.endDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "absolute-date-range.end-date.day" => Some(("absoluteDateRange.endDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "absolute-date-range.start-date.day" => Some(("absoluteDateRange.startDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "absolute-date-range.start-date.month" => Some(("absoluteDateRange.startDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "absolute-date-range.end-date.year" => Some(("absoluteDateRange.endDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "absolute-date-range.end-date.day" => Some(("absoluteDateRange.endDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "absolute-date-range.end-date.month" => Some(("absoluteDateRange.endDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "formats" => Some(("formats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "realtime-time-range.start-timestamp" => Some(("realtimeTimeRange.startTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "seller-network-ids" => Some(("sellerNetworkIds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["absolute-date-range", "creative-id", "day", "deal-id", "duration-days", "end-date", "environment", "formats", "month", "name", "offset-days", "platforms", "publisher-identifiers", "realtime-time-range", "relative-date-range", "seller-network-ids", "start-date", "start-timestamp", "time-series-granularity", "year"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["absolute-date-range", "breakdown-dimensions", "creative-id", "day", "deal-id", "duration-days", "end-date", "environment", "formats", "month", "name", "offset-days", "platforms", "publisher-identifiers", "realtime-time-range", "relative-date-range", "seller-network-ids", "start-date", "start-timestamp", "time-series-granularity", "year"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -6837,7 +6839,7 @@ fn main() { let mut app = App::new("adexchangebuyer2-v2-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181011") + .version("1.0.8+20190403") .about("Accesses the latest features for managing Authorized Buyers accounts, Real-Time Bidding configurations and auction metrics, and Marketplace programmatic deals.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adexchangebuyer2_v2_beta1_cli") .arg(Arg::with_name("url") diff --git a/gen/adexchangebuyer2_v2_beta1/Cargo.toml b/gen/adexchangebuyer2_v2_beta1/Cargo.toml index 1d39b709b9..a0231b0b42 100644 --- a/gen/adexchangebuyer2_v2_beta1/Cargo.toml +++ b/gen/adexchangebuyer2_v2_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-adexchangebuyer2_v2_beta1" -version = "1.0.8+20181011" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdExchangeBuyerII (protocol v2beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer2_v2_beta1" homepage = "https://developers.google.com/authorized-buyers/apis/reference/rest/" -documentation = "https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011" +documentation = "https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403" license = "MIT" keywords = ["adexchangebuyer2", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/adexchangebuyer2_v2_beta1/README.md b/gen/adexchangebuyer2_v2_beta1/README.md index eacd3358ab..22d692a694 100644 --- a/gen/adexchangebuyer2_v2_beta1/README.md +++ b/gen/adexchangebuyer2_v2_beta1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-adexchangebuyer2_v2_beta1` library allows access to all features of the *Google AdExchangeBuyerII* service. -This documentation was generated from *AdExchangeBuyerII* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *adexchangebuyer2:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *AdExchangeBuyerII* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *adexchangebuyer2:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *AdExchangeBuyerII* *v2_beta1* API can be found at the [official documentation site](https://developers.google.com/authorized-buyers/apis/reference/rest/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AdExchangeBuyerII.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AdExchangeBuyerII.html) ... * accounts - * [*clients create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountClientCreateCall.html), [*clients get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountClientGetCall.html), [*clients invitations create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountClientInvitationCreateCall.html), [*clients invitations get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountClientInvitationGetCall.html), [*clients invitations list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountClientInvitationListCall.html), [*clients list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountClientListCall.html), [*clients update*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountClientUpdateCall.html), [*clients users get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountClientUserGetCall.html), [*clients users list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountClientUserListCall.html), [*clients users update*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountClientUserUpdateCall.html), [*creatives create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeCreateCall.html), [*creatives deal associations add*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeDealAssociationAddCall.html), [*creatives deal associations list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeDealAssociationListCall.html), [*creatives deal associations remove*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeDealAssociationRemoveCall.html), [*creatives get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeGetCall.html), [*creatives list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeListCall.html), [*creatives stop watching*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeStopWatchingCall.html), [*creatives update*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeUpdateCall.html), [*creatives watch*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeWatchCall.html), [*finalized proposals list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountFinalizedProposalListCall.html), [*products get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProductGetCall.html), [*products list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProductListCall.html), [*proposals accept*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProposalAcceptCall.html), [*proposals add note*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProposalAddNoteCall.html), [*proposals cancel negotiation*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProposalCancelNegotiationCall.html), [*proposals complete setup*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProposalCompleteSetupCall.html), [*proposals create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProposalCreateCall.html), [*proposals get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProposalGetCall.html), [*proposals list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProposalListCall.html), [*proposals pause*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProposalPauseCall.html), [*proposals resume*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProposalResumeCall.html), [*proposals update*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountProposalUpdateCall.html), [*publisher profiles get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountPublisherProfileGetCall.html) and [*publisher profiles list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AccountPublisherProfileListCall.html) + * [*clients create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountClientCreateCall.html), [*clients get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountClientGetCall.html), [*clients invitations create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountClientInvitationCreateCall.html), [*clients invitations get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountClientInvitationGetCall.html), [*clients invitations list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountClientInvitationListCall.html), [*clients list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountClientListCall.html), [*clients update*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountClientUpdateCall.html), [*clients users get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountClientUserGetCall.html), [*clients users list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountClientUserListCall.html), [*clients users update*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountClientUserUpdateCall.html), [*creatives create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeCreateCall.html), [*creatives deal associations add*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeDealAssociationAddCall.html), [*creatives deal associations list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeDealAssociationListCall.html), [*creatives deal associations remove*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeDealAssociationRemoveCall.html), [*creatives get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeGetCall.html), [*creatives list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeListCall.html), [*creatives stop watching*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeStopWatchingCall.html), [*creatives update*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeUpdateCall.html), [*creatives watch*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountCreativeWatchCall.html), [*finalized proposals list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountFinalizedProposalListCall.html), [*products get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProductGetCall.html), [*products list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProductListCall.html), [*proposals accept*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProposalAcceptCall.html), [*proposals add note*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProposalAddNoteCall.html), [*proposals cancel negotiation*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProposalCancelNegotiationCall.html), [*proposals complete setup*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProposalCompleteSetupCall.html), [*proposals create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProposalCreateCall.html), [*proposals get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProposalGetCall.html), [*proposals list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProposalListCall.html), [*proposals pause*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProposalPauseCall.html), [*proposals resume*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProposalResumeCall.html), [*proposals update*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountProposalUpdateCall.html), [*publisher profiles get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountPublisherProfileGetCall.html) and [*publisher profiles list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AccountPublisherProfileListCall.html) * bidders - * [*accounts creatives delete*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountCreativeDeleteCall.html), [*accounts filter sets bid metrics list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetBidMetricListCall.html), [*accounts filter sets bid response errors list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetBidResponseErrorListCall.html), [*accounts filter sets bid responses without bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetBidResponsesWithoutBidListCall.html), [*accounts filter sets create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetCreateCall.html), [*accounts filter sets delete*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetDeleteCall.html), [*accounts filter sets filtered bid requests list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetFilteredBidRequestListCall.html), [*accounts filter sets filtered bids creatives list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetFilteredBidCreativeListCall.html), [*accounts filter sets filtered bids details list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetFilteredBidDetailListCall.html), [*accounts filter sets filtered bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetFilteredBidListCall.html), [*accounts filter sets get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetGetCall.html), [*accounts filter sets impression metrics list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetImpressionMetricListCall.html), [*accounts filter sets list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetListCall.html), [*accounts filter sets losing bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetLosingBidListCall.html), [*accounts filter sets non billable winning bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetNonBillableWinningBidListCall.html), [*filter sets bid metrics list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetBidMetricListCall.html), [*filter sets bid response errors list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetBidResponseErrorListCall.html), [*filter sets bid responses without bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetBidResponsesWithoutBidListCall.html), [*filter sets create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetCreateCall.html), [*filter sets delete*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetDeleteCall.html), [*filter sets filtered bid requests list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetFilteredBidRequestListCall.html), [*filter sets filtered bids creatives list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetFilteredBidCreativeListCall.html), [*filter sets filtered bids details list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetFilteredBidDetailListCall.html), [*filter sets filtered bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetFilteredBidListCall.html), [*filter sets get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetGetCall.html), [*filter sets impression metrics list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetImpressionMetricListCall.html), [*filter sets list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetListCall.html), [*filter sets losing bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetLosingBidListCall.html) and [*filter sets non billable winning bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetNonBillableWinningBidListCall.html) + * [*accounts creatives delete*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountCreativeDeleteCall.html), [*accounts filter sets bid metrics list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetBidMetricListCall.html), [*accounts filter sets bid response errors list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetBidResponseErrorListCall.html), [*accounts filter sets bid responses without bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetBidResponsesWithoutBidListCall.html), [*accounts filter sets create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetCreateCall.html), [*accounts filter sets delete*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetDeleteCall.html), [*accounts filter sets filtered bid requests list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetFilteredBidRequestListCall.html), [*accounts filter sets filtered bids creatives list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetFilteredBidCreativeListCall.html), [*accounts filter sets filtered bids details list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetFilteredBidDetailListCall.html), [*accounts filter sets filtered bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetFilteredBidListCall.html), [*accounts filter sets get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetGetCall.html), [*accounts filter sets impression metrics list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetImpressionMetricListCall.html), [*accounts filter sets list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetListCall.html), [*accounts filter sets losing bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetLosingBidListCall.html), [*accounts filter sets non billable winning bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderAccountFilterSetNonBillableWinningBidListCall.html), [*filter sets bid metrics list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetBidMetricListCall.html), [*filter sets bid response errors list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetBidResponseErrorListCall.html), [*filter sets bid responses without bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetBidResponsesWithoutBidListCall.html), [*filter sets create*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetCreateCall.html), [*filter sets delete*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetDeleteCall.html), [*filter sets filtered bid requests list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetFilteredBidRequestListCall.html), [*filter sets filtered bids creatives list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetFilteredBidCreativeListCall.html), [*filter sets filtered bids details list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetFilteredBidDetailListCall.html), [*filter sets filtered bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetFilteredBidListCall.html), [*filter sets get*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetGetCall.html), [*filter sets impression metrics list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetImpressionMetricListCall.html), [*filter sets list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetListCall.html), [*filter sets losing bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetLosingBidListCall.html) and [*filter sets non billable winning bids list*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.BidderFilterSetNonBillableWinningBidListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/struct.AdExchangeBuyerII.html)** +* **[Hub](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/struct.AdExchangeBuyerII.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -139,17 +139,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -159,29 +159,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20181011/google_adexchangebuyer2_v2_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-adexchangebuyer2_v2_beta1/1.0.8+20190403/google_adexchangebuyer2_v2_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/adexchangebuyer2_v2_beta1/src/lib.rs b/gen/adexchangebuyer2_v2_beta1/src/lib.rs index 97402eb19a..e765a83a6a 100644 --- a/gen/adexchangebuyer2_v2_beta1/src/lib.rs +++ b/gen/adexchangebuyer2_v2_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *AdExchangeBuyerII* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *adexchangebuyer2:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *AdExchangeBuyerII* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *adexchangebuyer2:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *AdExchangeBuyerII* *v2_beta1* API can be found at the //! [official documentation site](https://developers.google.com/authorized-buyers/apis/reference/rest/). @@ -400,27 +400,36 @@ pub struct Image { impl Part for Image {} -/// A metric value, with an expected value and a variance; represents a count -/// that may be either exact or estimated (i.e. when sampled). +/// Response message for listing all details associated with a given filtered bid +/// reason. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [accounts filter sets filtered bids details list bidders](struct.BidderAccountFilterSetFilteredBidDetailListCall.html) (response) +/// * [filter sets filtered bids details list bidders](struct.BidderFilterSetFilteredBidDetailListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MetricValue { - /// The variance (i.e. square of the standard deviation) of the metric value. - /// If value is exact, variance is 0. - /// Can be used to calculate margin of error as a percentage of value, using - /// the following formula, where Z is the standard constant that depends on the - /// desired size of the confidence interval (e.g. for 90% confidence interval, - /// use Z = 1.645): - /// - /// marginOfError = 100 * Z * sqrt(variance) / value - pub variance: Option, - /// The expected value of the metric. - pub value: Option, +pub struct ListCreativeStatusBreakdownByDetailResponse { + /// A token to retrieve the next page of results. + /// Pass this value in the + /// ListCreativeStatusBreakdownByDetailRequest.pageToken + /// field in the subsequent call to the filteredBids.details.list + /// method to retrieve the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The type of detail that the detail IDs represent. + #[serde(rename="detailType")] + pub detail_type: Option, + /// List of rows, with counts of bids with a given creative status aggregated + /// by detail. + #[serde(rename="filteredBidDetailRows")] + pub filtered_bid_detail_rows: Option>, } -impl Part for MetricValue {} +impl ResponseResult for ListCreativeStatusBreakdownByDetailResponse {} /// @OutputOnly The reason and details for a disapproval. @@ -482,14 +491,14 @@ pub struct Note { /// @OutputOnly #[serde(rename="proposalRevision")] pub proposal_revision: Option, - /// The timestamp for when this note was created. - /// @OutputOnly - #[serde(rename="createTime")] - pub create_time: Option, /// The unique ID for the note. /// @OutputOnly #[serde(rename="noteId")] pub note_id: Option, + /// The timestamp for when this note was created. + /// @OutputOnly + #[serde(rename="createTime")] + pub create_time: Option, } impl ResponseResult for Note {} @@ -537,6 +546,11 @@ pub struct RowDimensions { /// The time interval that this row represents. #[serde(rename="timeInterval")] pub time_interval: Option, + /// The publisher identifier for this row, if a breakdown by + /// [BreakdownDimension.PUBLISHER_IDENTIFIER](https://developers.google.com/authorized-buyers/apis/reference/rest/v2beta1/bidders.accounts.filterSets#FilterSet.BreakdownDimension) + /// was requested. + #[serde(rename="publisherIdentifier")] + pub publisher_identifier: Option, } impl Part for RowDimensions {} @@ -557,36 +571,27 @@ pub struct CompleteSetupRequest { _never_set: Option } impl RequestValue for CompleteSetupRequest {} -/// Response message for listing all details associated with a given filtered bid -/// reason. +/// A metric value, with an expected value and a variance; represents a count +/// that may be either exact or estimated (i.e. when sampled). /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [accounts filter sets filtered bids details list bidders](struct.BidderAccountFilterSetFilteredBidDetailListCall.html) (response) -/// * [filter sets filtered bids details list bidders](struct.BidderFilterSetFilteredBidDetailListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListCreativeStatusBreakdownByDetailResponse { - /// A token to retrieve the next page of results. - /// Pass this value in the - /// ListCreativeStatusBreakdownByDetailRequest.pageToken - /// field in the subsequent call to the filteredBids.details.list - /// method to retrieve the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The type of detail that the detail IDs represent. - #[serde(rename="detailType")] - pub detail_type: Option, - /// List of rows, with counts of bids with a given creative status aggregated - /// by detail. - #[serde(rename="filteredBidDetailRows")] - pub filtered_bid_detail_rows: Option>, +pub struct MetricValue { + /// The variance (i.e. square of the standard deviation) of the metric value. + /// If value is exact, variance is 0. + /// Can be used to calculate margin of error as a percentage of value, using + /// the following formula, where Z is the standard constant that depends on the + /// desired size of the confidence interval (e.g. for 90% confidence interval, + /// use Z = 1.645): + /// + /// marginOfError = 100 * Z * sqrt(variance) / value + pub variance: Option, + /// The expected value of the metric. + pub value: Option, } -impl ResponseResult for ListCreativeStatusBreakdownByDetailResponse {} +impl Part for MetricValue {} /// Request message to resume (unpause) serving for an already-finalized @@ -690,13 +695,13 @@ impl ResponseResult for ListBidResponseErrorsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CalloutStatusRow { - /// The values of all dimensions associated with metric values in this row. - #[serde(rename="rowDimensions")] - pub row_dimensions: Option, /// The ID of the callout status. /// See [callout-status-codes](https://developers.google.com/authorized-buyers/rtb/downloads/callout-status-codes). #[serde(rename="calloutStatusId")] pub callout_status_id: Option, + /// The values of all dimensions associated with metric values in this row. + #[serde(rename="rowDimensions")] + pub row_dimensions: Option, /// The number of impressions for which there was a bid request or bid response /// with the specified callout status. #[serde(rename="impressionCount")] @@ -761,13 +766,13 @@ impl Part for NonGuaranteedFixedPriceTerms {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Reason { + /// The number of times the creative was filtered for the status. The + /// count is aggregated across all publishers on the exchange. + pub count: Option, /// The filtering status code. Please refer to the /// [creative-status-codes.txt](https://storage.googleapis.com/adx-rtb-dictionaries/creative-status-codes.txt) /// file for different statuses. pub status: Option, - /// The number of times the creative was filtered for the status. The - /// count is aggregated across all publishers on the exchange. - pub count: Option, } impl Part for Reason {} @@ -851,25 +856,26 @@ pub struct RemoveDealAssociationRequest { impl RequestValue for RemoveDealAssociationRequest {} -/// The number of filtered bids with the specified dimension values that have the -/// specified creative. +/// The number of impressions with the specified dimension values that were +/// considered to have no applicable bids, as described by the specified status. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct FilteredBidCreativeRow { - /// The ID of the creative. - #[serde(rename="creativeId")] - pub creative_id: Option, +pub struct BidResponseWithoutBidsStatusRow { + /// The status specifying why the bid responses were considered to have no + /// applicable bids. + pub status: Option, /// The values of all dimensions associated with metric values in this row. #[serde(rename="rowDimensions")] pub row_dimensions: Option, - /// The number of bids with the specified creative. - #[serde(rename="bidCount")] - pub bid_count: Option, + /// The number of impressions for which there was a bid response with the + /// specified status. + #[serde(rename="impressionCount")] + pub impression_count: Option, } -impl Part for FilteredBidCreativeRow {} +impl Part for BidResponseWithoutBidsStatusRow {} /// Represents a buyer of inventory. Each buyer is identified by a unique @@ -957,23 +963,25 @@ pub struct LocationContext { impl Part for LocationContext {} -/// An interval of time, with an absolute start and end. +/// Represents a list of targeted and excluded URLs (e.g., google.com). +/// For Private Auction and AdX Preferred Deals, URLs are either included or +/// excluded. +/// For Programmatic Guaranteed and Preferred Deals, this doesn't +/// apply. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TimeInterval { - /// The timestamp marking the end of the range (exclusive) for which data is - /// included. - #[serde(rename="endTime")] - pub end_time: Option, - /// The timestamp marking the start of the range (inclusive) for which data is - /// included. - #[serde(rename="startTime")] - pub start_time: Option, +pub struct UrlTargeting { + /// A list of URLs to be excluded. + #[serde(rename="excludedUrls")] + pub excluded_urls: Option>, + /// A list of URLs to be included. + #[serde(rename="targetedUrls")] + pub targeted_urls: Option>, } -impl Part for TimeInterval {} +impl Part for UrlTargeting {} /// Represents information for a creative that is associated with a Programmatic @@ -1076,48 +1084,33 @@ impl RequestValue for WatchCreativeRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Date { - /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without - /// a year. - pub year: Option, + /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a + /// month and day. + pub month: Option, /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0 /// if specifying a year by itself or a year and month where the day is not /// significant. pub day: Option, - /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a - /// month and day. - pub month: Option, + /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without + /// a year. + pub year: Option, } impl Part for Date {} -/// Response message for listing all creatives associated with a given filtered -/// bid reason. +/// @OutputOnly The auction type the restriction applies to. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [accounts filter sets filtered bids creatives list bidders](struct.BidderAccountFilterSetFilteredBidCreativeListCall.html) (response) -/// * [filter sets filtered bids creatives list bidders](struct.BidderFilterSetFilteredBidCreativeListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListCreativeStatusBreakdownByCreativeResponse { - /// A token to retrieve the next page of results. - /// Pass this value in the - /// ListCreativeStatusBreakdownByCreativeRequest.pageToken - /// field in the subsequent call to the filteredBids.creatives.list - /// method to retrieve the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// List of rows, with counts of bids with a given creative status aggregated - /// by creative. - #[serde(rename="filteredBidCreativeRows")] - pub filtered_bid_creative_rows: Option>, +pub struct AuctionContext { + /// The auction types this restriction applies to. + #[serde(rename="auctionTypes")] + pub auction_types: Option>, } -impl ResponseResult for ListCreativeStatusBreakdownByCreativeResponse {} +impl Part for AuctionContext {} /// A client resource represents a client buyer—an agency, a brand, or an @@ -1208,16 +1201,16 @@ impl ResponseResult for Client {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreativeStatusRow { - /// The values of all dimensions associated with metric values in this row. - #[serde(rename="rowDimensions")] - pub row_dimensions: Option, + /// The number of bids with the specified status. + #[serde(rename="bidCount")] + pub bid_count: Option, /// The ID of the creative status. /// See [creative-status-codes](https://developers.google.com/authorized-buyers/rtb/downloads/creative-status-codes). #[serde(rename="creativeStatusId")] pub creative_status_id: Option, - /// The number of bids with the specified status. - #[serde(rename="bidCount")] - pub bid_count: Option, + /// The values of all dimensions associated with metric values in this row. + #[serde(rename="rowDimensions")] + pub row_dimensions: Option, } impl Part for CreativeStatusRow {} @@ -1225,8 +1218,6 @@ impl Part for CreativeStatusRow {} /// A creative and its classification data. /// -/// Next ID: 38 -/// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. @@ -1247,6 +1238,9 @@ pub struct Creative { #[serde(rename="agencyId")] pub agency_id: Option, /// @OutputOnly The filtering stats for this creative. + /// Deprecated; please use + /// bidders.accounts.filterSets.filteredBids.creatives.list + /// method instead. #[serde(rename="filteringStats")] pub filtering_stats: Option, /// The set of declared destination URLs for the creative. @@ -1280,6 +1274,11 @@ pub struct Creative { /// excluded-sensitive-category field in the bid request to filter your bids. #[serde(rename="detectedSensitiveCategories")] pub detected_sensitive_categories: Option>, + /// All attributes for the ads that may be shown from this creative. + /// Can be used to filter the response of the + /// creatives.list + /// method. + pub attributes: Option>, /// @OutputOnly The top-level deals status of this creative. /// If disapproved, an entry for 'auctionType=DIRECT_DEALS' (or 'ALL') in /// serving_restrictions will also exist. Note @@ -1302,19 +1301,13 @@ pub struct Creative { /// The link to AdChoices destination page. #[serde(rename="adChoicesDestinationUrl")] pub ad_choices_destination_url: Option, - /// The account that this creative belongs to. - /// Can be used to filter the response of the - /// creatives.list - /// method. - #[serde(rename="accountId")] - pub account_id: Option, + /// A native creative. + pub native: Option, /// All vendor IDs for the ads that may be shown from this creative. /// See https://storage.googleapis.com/adx-rtb-dictionaries/vendors.txt /// for possible values. #[serde(rename="vendorIds")] pub vendor_ids: Option>, - /// A video creative. - pub video: Option, /// @OutputOnly Detected product categories, if any. /// See the ad-product-categories.txt file in the technical documentation /// for a list of IDs. @@ -1340,13 +1333,14 @@ pub struct Creative { /// The detected domains for this creative. #[serde(rename="detectedDomains")] pub detected_domains: Option>, - /// All attributes for the ads that may be shown from this creative. + /// A video creative. + pub video: Option, + /// The account that this creative belongs to. /// Can be used to filter the response of the /// creatives.list /// method. - pub attributes: Option>, - /// A native creative. - pub native: Option, + #[serde(rename="accountId")] + pub account_id: Option, } impl RequestValue for Creative {} @@ -1428,28 +1422,24 @@ pub struct PlacementTargeting { impl Part for PlacementTargeting {} -/// Terms for Programmatic Guaranteed Deals. +/// The number of winning bids with the specified dimension values for which the +/// buyer was not billed, as described by the specified status. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GuaranteedFixedPriceTerms { - /// Guaranteed impressions as a percentage. This is the percentage - /// of guaranteed looks that the buyer is guaranteeing to buy. - #[serde(rename="guaranteedImpressions")] - pub guaranteed_impressions: Option, - /// Fixed price for the specified buyer. - #[serde(rename="fixedPrices")] - pub fixed_prices: Option>, - /// Daily minimum looks for CPD deal types. - #[serde(rename="minimumDailyLooks")] - pub minimum_daily_looks: Option, - /// Count of guaranteed looks. Required for deal, optional for product. - #[serde(rename="guaranteedLooks")] - pub guaranteed_looks: Option, +pub struct NonBillableWinningBidStatusRow { + /// The status specifying why the winning bids were not billed. + pub status: Option, + /// The number of bids with the specified status. + #[serde(rename="bidCount")] + pub bid_count: Option, + /// The values of all dimensions associated with metric values in this row. + #[serde(rename="rowDimensions")] + pub row_dimensions: Option, } -impl Part for GuaranteedFixedPriceTerms {} +impl Part for NonBillableWinningBidStatusRow {} /// The serving context for this restriction. @@ -1526,24 +1516,28 @@ pub struct VideoTargeting { impl Part for VideoTargeting {} -/// The number of winning bids with the specified dimension values for which the -/// buyer was not billed, as described by the specified status. +/// Terms for Programmatic Guaranteed Deals. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NonBillableWinningBidStatusRow { - /// The status specifying why the winning bids were not billed. - pub status: Option, - /// The values of all dimensions associated with metric values in this row. - #[serde(rename="rowDimensions")] - pub row_dimensions: Option, - /// The number of bids with the specified status. - #[serde(rename="bidCount")] - pub bid_count: Option, +pub struct GuaranteedFixedPriceTerms { + /// Guaranteed impressions as a percentage. This is the percentage + /// of guaranteed looks that the buyer is guaranteeing to buy. + #[serde(rename="guaranteedImpressions")] + pub guaranteed_impressions: Option, + /// Fixed price for the specified buyer. + #[serde(rename="fixedPrices")] + pub fixed_prices: Option>, + /// Daily minimum looks for CPD deal types. + #[serde(rename="minimumDailyLooks")] + pub minimum_daily_looks: Option, + /// Count of guaranteed looks. Required for deal, optional for product. + #[serde(rename="guaranteedLooks")] + pub guaranteed_looks: Option, } -impl Part for NonBillableWinningBidStatusRow {} +impl Part for GuaranteedFixedPriceTerms {} /// Response message for listing all reasons that bids lost in the auction. @@ -1631,8 +1625,9 @@ impl ResponseResult for ListClientUsersResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DealTerms { - /// Publisher provided description for the terms. - pub description: Option, + /// Visibility of the URL in bid requests. (default: BRANDED) + #[serde(rename="brandingType")] + pub branding_type: Option, /// Non-binding estimate of the estimated gross spend for this deal. /// Can be set by buyer or seller. #[serde(rename="estimatedGrossSpend")] @@ -1656,49 +1651,123 @@ pub struct DealTerms { /// The terms for non-guaranteed auction deals. #[serde(rename="nonGuaranteedAuctionTerms")] pub non_guaranteed_auction_terms: Option, - /// Visibility of the URL in bid requests. (default: BRANDED) - #[serde(rename="brandingType")] - pub branding_type: Option, + /// Publisher provided description for the terms. + pub description: Option, } impl Part for DealTerms {} -/// Message depicting the size of the creative. The units of width and -/// height depend on the type of the targeting. +/// A set of filters that is applied to a request for data. +/// Within a filter set, an AND operation is performed across the filters +/// represented by each field. An OR operation is performed across the filters +/// represented by the multiple values of a repeated field, e.g., +/// "format=VIDEO AND deal_id=12 AND (seller_network_id=34 OR +/// seller_network_id=56)". +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [accounts filter sets create bidders](struct.BidderAccountFilterSetCreateCall.html) (request|response) +/// * [filter sets get bidders](struct.BidderFilterSetGetCall.html) (response) +/// * [accounts filter sets get bidders](struct.BidderAccountFilterSetGetCall.html) (response) +/// * [filter sets create bidders](struct.BidderFilterSetCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FilterSet { + /// A user-defined name of the filter set. Filter set names must be unique + /// globally and match one of the patterns: + /// + /// - `bidders/*/filterSets/*` (for accessing bidder-level troubleshooting + /// data) + /// - `bidders/*/accounts/*/filterSets/*` (for accessing account-level + /// troubleshooting data) + /// + /// This field is required in create operations. + pub name: Option, + /// For Authorized Buyers only. + /// The list of IDs of the seller (publisher) networks on which to filter; + /// may be empty. The filters represented by multiple seller network IDs are + /// ORed together (i.e., if non-empty, results must match any one of the + /// publisher networks). See + /// [seller-network-ids](https://developers.google.com/authorized-buyers/rtb/downloads/seller-network-ids) + /// file for the set of existing seller network IDs. + #[serde(rename="sellerNetworkIds")] + pub seller_network_ids: Option>, + /// A relative date range, defined by an offset from today and a duration. + /// Interpreted relative to Pacific time zone. + #[serde(rename="relativeDateRange")] + pub relative_date_range: Option, + /// For Open Bidding partners only. + /// The list of publisher identifiers on which to filter; may be empty. + /// The filters represented by multiple publisher identifiers are ORed + /// together. + #[serde(rename="publisherIdentifiers")] + pub publisher_identifiers: Option>, + /// The set of dimensions along which to break down the response; may be empty. + /// If multiple dimensions are requested, the breakdown is along the Cartesian + /// product of the requested dimensions. + #[serde(rename="breakdownDimensions")] + pub breakdown_dimensions: Option>, + /// An open-ended realtime time range, defined by the aggregation start + /// timestamp. + #[serde(rename="realtimeTimeRange")] + pub realtime_time_range: Option, + /// The ID of the deal on which to filter; optional. This field may be set + /// only for a filter set that accesses account-level troubleshooting data, + /// i.e., one whose name matches the `bidders/*/accounts/*/filterSets/*` + /// pattern. + #[serde(rename="dealId")] + pub deal_id: Option, + /// The environment on which to filter; optional. + pub environment: Option, + /// The list of platforms on which to filter; may be empty. The filters + /// represented by multiple platforms are ORed together (i.e., if non-empty, + /// results must match any one of the platforms). + pub platforms: Option>, + /// An absolute date range, defined by a start date and an end date. + /// Interpreted relative to Pacific time zone. + #[serde(rename="absoluteDateRange")] + pub absolute_date_range: Option, + /// The list of formats on which to filter; may be empty. The filters + /// represented by multiple formats are ORed together (i.e., if non-empty, + /// results must match any one of the formats). + pub formats: Option>, + /// The ID of the creative on which to filter; optional. This field may be set + /// only for a filter set that accesses account-level troubleshooting data, + /// i.e., one whose name matches the `bidders/*/accounts/*/filterSets/*` + /// pattern. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// The granularity of time intervals if a time series breakdown is desired; + /// optional. + #[serde(rename="timeSeriesGranularity")] + pub time_series_granularity: Option, +} + +impl RequestValue for FilterSet {} +impl ResponseResult for FilterSet {} + + +/// An interval of time, with an absolute start and end. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Size { - /// The width of the creative - pub width: Option, - /// The height of the creative. - pub height: Option, +pub struct TimeInterval { + /// The timestamp marking the end of the range (exclusive) for which data is + /// included. + #[serde(rename="endTime")] + pub end_time: Option, + /// The timestamp marking the start of the range (inclusive) for which data is + /// included. + #[serde(rename="startTime")] + pub start_time: Option, } -impl Part for Size {} - - -/// Represents a list of targeted and excluded URLs (e.g., google.com). -/// For Private Auction and AdX Preferred Deals, URLs are either included or -/// excluded. -/// For Programmatic Guaranteed and Preferred Deals, this doesn't -/// apply. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UrlTargeting { - /// A list of URLs to be excluded. - #[serde(rename="excludedUrls")] - pub excluded_urls: Option>, - /// A list of URLs to be included. - #[serde(rename="targetedUrls")] - pub targeted_urls: Option>, -} - -impl Part for UrlTargeting {} +impl Part for TimeInterval {} /// Response message for listing all reasons that bid requests were filtered and @@ -1749,26 +1818,25 @@ pub struct AcceptProposalRequest { impl RequestValue for AcceptProposalRequest {} -/// The number of impressions with the specified dimension values that were -/// considered to have no applicable bids, as described by the specified status. +/// The number of filtered bids with the specified dimension values that have the +/// specified creative. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BidResponseWithoutBidsStatusRow { - /// The status specifying why the bid responses were considered to have no - /// applicable bids. - pub status: Option, +pub struct FilteredBidCreativeRow { + /// The ID of the creative. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// The number of bids with the specified creative. + #[serde(rename="bidCount")] + pub bid_count: Option, /// The values of all dimensions associated with metric values in this row. #[serde(rename="rowDimensions")] pub row_dimensions: Option, - /// The number of impressions for which there was a bid response with the - /// specified status. - #[serde(rename="impressionCount")] - pub impression_count: Option, } -impl Part for BidResponseWithoutBidsStatusRow {} +impl Part for FilteredBidCreativeRow {} /// Buyers are allowed to store certain types of private data in a proposal/deal. @@ -2184,40 +2252,32 @@ impl RequestValue for AddDealAssociationRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FilteringStats { - /// The set of filtering reasons for this date. - pub reasons: Option>, /// The day during which the data was collected. /// The data is collected from 00:00:00 to 23:59:59 PT. /// During switches from PST to PDT and back, the day may /// contain 23 or 25 hours of data instead of the usual 24. pub date: Option, + /// The set of filtering reasons for this date. + pub reasons: Option>, } impl Part for FilteringStats {} -/// A relative date range, specified by an offset and a duration. -/// The supported range of dates begins 30 days before today and ends today, -/// i.e., the limits for these values are: -/// offset_days >= 0 -/// duration_days >= 1 -/// offset_days + duration_days <= 30 +/// Represents a price and a pricing type for a product / deal. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RelativeDateRange { - /// The number of days in the requested date range, e.g., for a range spanning - /// today: 1. For a range spanning the last 7 days: 7. - #[serde(rename="durationDays")] - pub duration_days: Option, - /// The end date of the filter set, specified as the number of days before - /// today, e.g., for a range where the last date is today: 0. - #[serde(rename="offsetDays")] - pub offset_days: Option, +pub struct Price { + /// The pricing type for the deal/product. (default: CPM) + #[serde(rename="pricingType")] + pub pricing_type: Option, + /// The actual price with currency specified. + pub amount: Option, } -impl Part for RelativeDateRange {} +impl Part for Price {} /// Contains information on how a buyer or seller can be reached. @@ -2279,12 +2339,12 @@ pub struct NativeContent { pub headline: Option, /// A large image. pub image: Option, + /// The URL to use for click tracking. + #[serde(rename="clickTrackingUrl")] + pub click_tracking_url: Option, /// The app rating in the app store. Must be in the range [0-5]. #[serde(rename="starRating")] pub star_rating: Option, - /// The URL to the app store to purchase/download the promoted app. - #[serde(rename="storeUrl")] - pub store_url: Option, /// The name of the advertiser or sponsor, to be displayed in the ad creative. #[serde(rename="advertiserName")] pub advertiser_name: Option, @@ -2299,9 +2359,9 @@ pub struct NativeContent { pub app_icon: Option, /// A smaller image, for the advertiser's logo. pub logo: Option, - /// The URL to use for click tracking. - #[serde(rename="clickTrackingUrl")] - pub click_tracking_url: Option, + /// The URL to the app store to purchase/download the promoted app. + #[serde(rename="storeUrl")] + pub store_url: Option, /// The URL that the browser/SDK will load when the user clicks the ad. #[serde(rename="clickLinkUrl")] pub click_link_url: Option, @@ -2486,6 +2546,9 @@ impl ResponseResult for ListProposalsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListImpressionMetricsResponse { + /// List of rows, each containing a set of impression metrics. + #[serde(rename="impressionMetricsRows")] + pub impression_metrics_rows: Option>, /// A token to retrieve the next page of results. /// Pass this value in the /// ListImpressionMetricsRequest.pageToken @@ -2493,9 +2556,6 @@ pub struct ListImpressionMetricsResponse { /// method to retrieve the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// List of rows, each containing a set of impression metrics. - #[serde(rename="impressionMetricsRows")] - pub impression_metrics_rows: Option>, } impl ResponseResult for ListImpressionMetricsResponse {} @@ -2822,12 +2882,12 @@ pub struct FilteredBidDetailRow { /// dictionary file corresponding to the DetailType in the response message. #[serde(rename="detailId")] pub detail_id: Option, - /// The values of all dimensions associated with metric values in this row. - #[serde(rename="rowDimensions")] - pub row_dimensions: Option, /// The number of bids with the specified detail. #[serde(rename="bidCount")] pub bid_count: Option, + /// The values of all dimensions associated with metric values in this row. + #[serde(rename="rowDimensions")] + pub row_dimensions: Option, } impl Part for FilteredBidDetailRow {} @@ -2839,22 +2899,22 @@ impl Part for FilteredBidDetailRow {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetingValue { - /// The string value to include/exclude. - #[serde(rename="stringValue")] - pub string_value: Option, - /// The long value to include/exclude. - #[serde(rename="longValue")] - pub long_value: Option, /// The daypart targeting to include / exclude. /// Filled in when the key is GOOG_DAYPART_TARGETING. /// The definition of this targeting is derived from the structure /// used by Ad Manager. #[serde(rename="dayPartTargetingValue")] pub day_part_targeting_value: Option, + /// The long value to include/exclude. + #[serde(rename="longValue")] + pub long_value: Option, /// The creative size value to include/exclude. /// Filled in when key = GOOG_CREATIVE_SIZE #[serde(rename="creativeSizeValue")] pub creative_size_value: Option, + /// The string value to include/exclude. + #[serde(rename="stringValue")] + pub string_value: Option, } impl Part for TargetingValue {} @@ -3031,9 +3091,6 @@ impl Part for Deal {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Money { - /// The whole units of the amount. - /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. - pub units: Option, /// Number of nano (10^-9) units of the amount. /// The value must be between -999,999,999 and +999,999,999 inclusive. /// If `units` is positive, `nanos` must be positive or zero. @@ -3041,6 +3098,9 @@ pub struct Money { /// If `units` is negative, `nanos` must be negative or zero. /// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. pub nanos: Option, + /// The whole units of the amount. + /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + pub units: Option, /// The 3-letter currency code defined in ISO 4217. #[serde(rename="currencyCode")] pub currency_code: Option, @@ -3067,18 +3127,33 @@ pub struct Correction { impl Part for Correction {} -/// @OutputOnly The auction type the restriction applies to. +/// Response message for listing all creatives associated with a given filtered +/// bid reason. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [accounts filter sets filtered bids creatives list bidders](struct.BidderAccountFilterSetFilteredBidCreativeListCall.html) (response) +/// * [filter sets filtered bids creatives list bidders](struct.BidderFilterSetFilteredBidCreativeListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AuctionContext { - /// The auction types this restriction applies to. - #[serde(rename="auctionTypes")] - pub auction_types: Option>, +pub struct ListCreativeStatusBreakdownByCreativeResponse { + /// A token to retrieve the next page of results. + /// Pass this value in the + /// ListCreativeStatusBreakdownByCreativeRequest.pageToken + /// field in the subsequent call to the filteredBids.creatives.list + /// method to retrieve the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of rows, with counts of bids with a given creative status aggregated + /// by creative. + #[serde(rename="filteredBidCreativeRows")] + pub filtered_bid_creative_rows: Option>, } -impl Part for AuctionContext {} +impl ResponseResult for ListCreativeStatusBreakdownByCreativeResponse {} /// Response message for profiles visible to the buyer. @@ -3168,7 +3243,7 @@ impl Part for BidMetricsRow {} pub struct PauseProposalRequest { /// The reason why the proposal is being paused. /// This human readable message will be displayed in the seller's UI. - /// (Max length: 100 unicode code units.) + /// (Max length: 1000 unicode code units.) pub reason: Option, } @@ -3191,108 +3266,44 @@ pub struct RealtimeTimeRange { impl Part for RealtimeTimeRange {} -/// A set of filters that is applied to a request for data. -/// Within a filter set, an AND operation is performed across the filters -/// represented by each field. An OR operation is performed across the filters -/// represented by the multiple values of a repeated field, e.g., -/// "format=VIDEO AND deal_id=12 AND (seller_network_id=34 OR -/// seller_network_id=56)". -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [accounts filter sets create bidders](struct.BidderAccountFilterSetCreateCall.html) (request|response) -/// * [filter sets get bidders](struct.BidderFilterSetGetCall.html) (response) -/// * [accounts filter sets get bidders](struct.BidderAccountFilterSetGetCall.html) (response) -/// * [filter sets create bidders](struct.BidderFilterSetCreateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct FilterSet { - /// A user-defined name of the filter set. Filter set names must be unique - /// globally and match one of the patterns: - /// - /// - `bidders/*/filterSets/*` (for accessing bidder-level troubleshooting - /// data) - /// - `bidders/*/accounts/*/filterSets/*` (for accessing account-level - /// troubleshooting data) - /// - /// This field is required in create operations. - pub name: Option, - /// For Authorized Buyers only. - /// The list of IDs of the seller (publisher) networks on which to filter; - /// may be empty. The filters represented by multiple seller network IDs are - /// ORed together (i.e., if non-empty, results must match any one of the - /// publisher networks). See - /// [seller-network-ids](https://developers.google.com/authorized-buyers/rtb/downloads/seller-network-ids) - /// file for the set of existing seller network IDs. - #[serde(rename="sellerNetworkIds")] - pub seller_network_ids: Option>, - /// A relative date range, defined by an offset from today and a duration. - /// Interpreted relative to Pacific time zone. - #[serde(rename="relativeDateRange")] - pub relative_date_range: Option, - /// For Open Bidding partners only. - /// The list of publisher identifiers on which to filter; may be empty. - /// The filters represented by multiple publisher identifiers are ORed - /// together. - #[serde(rename="publisherIdentifiers")] - pub publisher_identifiers: Option>, - /// An open-ended realtime time range, defined by the aggregation start - /// timestamp. - #[serde(rename="realtimeTimeRange")] - pub realtime_time_range: Option, - /// The ID of the deal on which to filter; optional. This field may be set - /// only for a filter set that accesses account-level troubleshooting data, - /// i.e., one whose name matches the `bidders/*/accounts/*/filterSets/*` - /// pattern. - #[serde(rename="dealId")] - pub deal_id: Option, - /// The environment on which to filter; optional. - pub environment: Option, - /// The list of platforms on which to filter; may be empty. The filters - /// represented by multiple platforms are ORed together (i.e., if non-empty, - /// results must match any one of the platforms). - pub platforms: Option>, - /// An absolute date range, defined by a start date and an end date. - /// Interpreted relative to Pacific time zone. - #[serde(rename="absoluteDateRange")] - pub absolute_date_range: Option, - /// The list of formats on which to filter; may be empty. The filters - /// represented by multiple formats are ORed together (i.e., if non-empty, - /// results must match any one of the formats). - pub formats: Option>, - /// The ID of the creative on which to filter; optional. This field may be set - /// only for a filter set that accesses account-level troubleshooting data, - /// i.e., one whose name matches the `bidders/*/accounts/*/filterSets/*` - /// pattern. - #[serde(rename="creativeId")] - pub creative_id: Option, - /// The granularity of time intervals if a time series breakdown is desired; - /// optional. - #[serde(rename="timeSeriesGranularity")] - pub time_series_granularity: Option, -} - -impl RequestValue for FilterSet {} -impl ResponseResult for FilterSet {} - - -/// Represents a price and a pricing type for a product / deal. +/// Message depicting the size of the creative. The units of width and +/// height depend on the type of the targeting. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Price { - /// The pricing type for the deal/product. (default: CPM) - #[serde(rename="pricingType")] - pub pricing_type: Option, - /// The actual price with currency specified. - pub amount: Option, +pub struct Size { + /// The width of the creative + pub width: Option, + /// The height of the creative. + pub height: Option, } -impl Part for Price {} +impl Part for Size {} + + +/// A relative date range, specified by an offset and a duration. +/// The supported range of dates begins 30 days before today and ends today, +/// i.e., the limits for these values are: +/// offset_days >= 0 +/// duration_days >= 1 +/// offset_days + duration_days <= 30 +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RelativeDateRange { + /// The number of days in the requested date range, e.g., for a range spanning + /// today: 1. For a range spanning the last 7 days: 7. + #[serde(rename="durationDays")] + pub duration_days: Option, + /// The end date of the filter set, specified as the number of days before + /// today, e.g., for a range where the last date is today: 0. + #[serde(rename="offsetDays")] + pub offset_days: Option, +} + +impl Part for RelativeDateRange {} /// Terms for Private Auctions. Note that Private Auctions can be created only @@ -4186,6 +4197,37 @@ impl<'a, C, A> MethodsBuilder for AccountMethods<'a, C, A> {} impl<'a, C, A> AccountMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Update the given proposal to resume serving. + /// This method will set the + /// `DealServingMetadata.DealPauseStatus.has_buyer_paused` bit to false for all + /// deals in the proposal. + /// + /// Note that if the `has_seller_paused` bit is also set, serving will not + /// resume until the seller also resumes. + /// + /// It is a no-op to resume an already-running proposal. + /// It is an error to call ResumeProposal for a proposal that is not + /// finalized or renegotiating. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `accountId` - Account ID of the buyer. + /// * `proposalId` - The ID of the proposal to resume. + pub fn proposals_resume(&self, request: ResumeProposalRequest, account_id: &str, proposal_id: &str) -> AccountProposalResumeCall<'a, C, A> { + AccountProposalResumeCall { + hub: self.hub, + _request: request, + _account_id: account_id.to_string(), + _proposal_id: proposal_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Create a new note and attach it to the proposal. The note is assigned @@ -4210,30 +4252,6 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// List all creative-deal associations. - /// - /// # Arguments - /// - /// * `accountId` - The account to list the associations from. - /// Specify "-" to list all creatives the current user has access to. - /// * `creativeId` - The creative ID to list the associations from. - /// Specify "-" to list all creatives under the above account. - pub fn creatives_deal_associations_list(&self, account_id: &str, creative_id: &str) -> AccountCreativeDealAssociationListCall<'a, C, A> { - AccountCreativeDealAssociationListCall { - hub: self.hub, - _account_id: account_id.to_string(), - _creative_id: creative_id.to_string(), - _query: Default::default(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Associate an existing deal with a creative. @@ -4257,29 +4275,19 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Update the given proposal to resume serving. - /// This method will set the - /// `DealServingMetadata.DealPauseStatus.has_buyer_paused` bit to false for all - /// deals in the proposal. - /// - /// Note that if the `has_seller_paused` bit is also set, serving will not - /// resume until the seller also resumes. - /// - /// It is a no-op to resume an already-running proposal. - /// It is an error to call ResumeProposal for a proposal that is not - /// finalized or renegotiating. + /// Lists creatives. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `accountId` - Account ID of the buyer. - /// * `proposalId` - The ID of the proposal to resume. - pub fn proposals_resume(&self, request: ResumeProposalRequest, account_id: &str, proposal_id: &str) -> AccountProposalResumeCall<'a, C, A> { - AccountProposalResumeCall { + /// * `accountId` - The account to list the creatives from. + /// Specify "-" to list all creatives the current user has access to. + pub fn creatives_list(&self, account_id: &str) -> AccountCreativeListCall<'a, C, A> { + AccountCreativeListCall { hub: self.hub, - _request: request, _account_id: account_id.to_string(), - _proposal_id: proposal_id.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -4381,17 +4389,16 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists creatives. + /// Lists all the clients for the current sponsor buyer. /// /// # Arguments /// - /// * `accountId` - The account to list the creatives from. - /// Specify "-" to list all creatives the current user has access to. - pub fn creatives_list(&self, account_id: &str) -> AccountCreativeListCall<'a, C, A> { - AccountCreativeListCall { + /// * `accountId` - Unique numerical account ID of the sponsor buyer to list the clients for. + pub fn clients_list(&self, account_id: &str) -> AccountClientListCall<'a, C, A> { + AccountClientListCall { hub: self.hub, _account_id: account_id.to_string(), - _query: Default::default(), + _partner_client_id: Default::default(), _page_token: Default::default(), _page_size: Default::default(), _delegate: Default::default(), @@ -4446,16 +4453,22 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a proposal given its ID. The proposal is returned at its head - /// revision. + /// Update the given proposal to indicate that setup has been completed. + /// This method is called by the buyer when the line items have been created + /// on their end for a finalized proposal and all the required creatives + /// have been uploaded using the creatives API. This call updates the + /// `is_setup_completed` bit on the proposal and also notifies the seller. + /// The server will advance the revision number of the most recent proposal. /// /// # Arguments /// + /// * `request` - No description provided. /// * `accountId` - Account ID of the buyer. - /// * `proposalId` - The unique ID of the proposal - pub fn proposals_get(&self, account_id: &str, proposal_id: &str) -> AccountProposalGetCall<'a, C, A> { - AccountProposalGetCall { + /// * `proposalId` - The ID of the proposal to mark as setup completed. + pub fn proposals_complete_setup(&self, request: CompleteSetupRequest, account_id: &str, proposal_id: &str) -> AccountProposalCompleteSetupCall<'a, C, A> { + AccountProposalCompleteSetupCall { hub: self.hub, + _request: request, _account_id: account_id.to_string(), _proposal_id: proposal_id.to_string(), _delegate: Default::default(), @@ -4489,37 +4502,21 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists all the clients for the current sponsor buyer. + /// Creates and sends out an email invitation to access + /// an Ad Exchange client buyer account. /// /// # Arguments /// - /// * `accountId` - Unique numerical account ID of the sponsor buyer to list the clients for. - pub fn clients_list(&self, account_id: &str) -> AccountClientListCall<'a, C, A> { - AccountClientListCall { + /// * `request` - No description provided. + /// * `accountId` - Numerical account ID of the client's sponsor buyer. (required) + /// * `clientAccountId` - Numerical account ID of the client buyer that the user + /// should be associated with. (required) + pub fn clients_invitations_create(&self, request: ClientUserInvitation, account_id: &str, client_account_id: &str) -> AccountClientInvitationCreateCall<'a, C, A> { + AccountClientInvitationCreateCall { hub: self.hub, + _request: request, _account_id: account_id.to_string(), - _partner_client_id: Default::default(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a creative. - /// - /// # Arguments - /// - /// * `accountId` - The account the creative belongs to. - /// * `creativeId` - The ID of the creative to retrieve. - pub fn creatives_get(&self, account_id: &str, creative_id: &str) -> AccountCreativeGetCall<'a, C, A> { - AccountCreativeGetCall { - hub: self.hub, - _account_id: account_id.to_string(), - _creative_id: creative_id.to_string(), + _client_account_id: client_account_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -4655,21 +4652,17 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates and sends out an email invitation to access - /// an Ad Exchange client buyer account. + /// Gets a creative. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `accountId` - Numerical account ID of the client's sponsor buyer. (required) - /// * `clientAccountId` - Numerical account ID of the client buyer that the user - /// should be associated with. (required) - pub fn clients_invitations_create(&self, request: ClientUserInvitation, account_id: &str, client_account_id: &str) -> AccountClientInvitationCreateCall<'a, C, A> { - AccountClientInvitationCreateCall { + /// * `accountId` - The account the creative belongs to. + /// * `creativeId` - The ID of the creative to retrieve. + pub fn creatives_get(&self, account_id: &str, creative_id: &str) -> AccountCreativeGetCall<'a, C, A> { + AccountCreativeGetCall { hub: self.hub, - _request: request, _account_id: account_id.to_string(), - _client_account_id: client_account_id.to_string(), + _creative_id: creative_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -4821,24 +4814,22 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Update the given proposal to indicate that setup has been completed. - /// This method is called by the buyer when the line items have been created - /// on their end for a finalized proposal and all the required creatives - /// have been uploaded using the creatives API. This call updates the - /// `is_setup_completed` bit on the proposal and also notifies the seller. - /// The server will advance the revision number of the most recent proposal. + /// List all creative-deal associations. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `accountId` - Account ID of the buyer. - /// * `proposalId` - The ID of the proposal to mark as setup completed. - pub fn proposals_complete_setup(&self, request: CompleteSetupRequest, account_id: &str, proposal_id: &str) -> AccountProposalCompleteSetupCall<'a, C, A> { - AccountProposalCompleteSetupCall { + /// * `accountId` - The account to list the associations from. + /// Specify "-" to list all creatives the current user has access to. + /// * `creativeId` - The creative ID to list the associations from. + /// Specify "-" to list all creatives under the above account. + pub fn creatives_deal_associations_list(&self, account_id: &str, creative_id: &str) -> AccountCreativeDealAssociationListCall<'a, C, A> { + AccountCreativeDealAssociationListCall { hub: self.hub, - _request: request, _account_id: account_id.to_string(), - _proposal_id: proposal_id.to_string(), + _creative_id: creative_id.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -4973,6 +4964,26 @@ impl<'a, C, A> AccountMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Gets a proposal given its ID. The proposal is returned at its head + /// revision. + /// + /// # Arguments + /// + /// * `accountId` - Account ID of the buyer. + /// * `proposalId` - The unique ID of the proposal + pub fn proposals_get(&self, account_id: &str, proposal_id: &str) -> AccountProposalGetCall<'a, C, A> { + AccountProposalGetCall { + hub: self.hub, + _account_id: account_id.to_string(), + _proposal_id: proposal_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -5070,7 +5081,7 @@ impl<'a, C, A> BidderAccountFilterSetGetCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5109,7 +5117,7 @@ impl<'a, C, A> BidderAccountFilterSetGetCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetGetCall<'a, C, A> where C: BorrowMut BidderFilterSetFilteredBidListCall<'a, C, A> where C: BorrowMut BidderFilterSetFilteredBidListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5381,7 +5386,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidListCall<'a, C, A> where C: BorrowMut BidderFilterSetFilteredBidListCall<'a, C, A> where C: BorrowMut BidderFilterSetListCall<'a, C, A> where C: BorrowMut BidderFilterSetListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5671,7 +5673,7 @@ impl<'a, C, A> BidderFilterSetListCall<'a, C, A> where C: BorrowMut BidderFilterSetListCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetCreateCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5975,7 +5974,7 @@ impl<'a, C, A> BidderAccountFilterSetCreateCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetCreateCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetBidMetricListCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6243,10 +6242,7 @@ impl<'a, C, A> BidderAccountFilterSetBidMetricListCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6266,7 +6262,7 @@ impl<'a, C, A> BidderAccountFilterSetBidMetricListCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6373,7 +6369,7 @@ impl<'a, C, A> BidderAccountFilterSetBidMetricListCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6520,7 +6516,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidCreativeListCall<'a, C, A> where } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6536,10 +6532,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidCreativeListCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6559,7 +6552,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidCreativeListCall<'a, C, A> where let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6679,7 +6672,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidCreativeListCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6814,7 +6807,7 @@ impl<'a, C, A> BidderAccountFilterSetDeleteCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6853,7 +6843,7 @@ impl<'a, C, A> BidderAccountFilterSetDeleteCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetDeleteCall<'a, C, A> where C: BorrowMut BidderAccountCreativeDeleteCall<'a, C, A> where C: BorrowMut BidderAccountCreativeDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7120,7 +7107,7 @@ impl<'a, C, A> BidderAccountCreativeDeleteCall<'a, C, A> where C: BorrowMut BidderAccountCreativeDeleteCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetFilteredBidRequestListCall<'a, C, A> where } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7376,10 +7363,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidRequestListCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7399,7 +7383,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidRequestListCall<'a, C, A> where let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7506,7 +7490,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidRequestListCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7653,7 +7637,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidCreativeListCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7669,10 +7653,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidCreativeListCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7692,7 +7673,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidCreativeListCall<'a, C, A> where C: Bor let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7812,7 +7793,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidCreativeListCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7947,7 +7928,7 @@ impl<'a, C, A> BidderFilterSetGetCall<'a, C, A> where C: BorrowMut BidderFilterSetGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7986,7 +7964,7 @@ impl<'a, C, A> BidderFilterSetGetCall<'a, C, A> where C: BorrowMut BidderFilterSetGetCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetListCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8257,7 +8232,7 @@ impl<'a, C, A> BidderAccountFilterSetListCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetListCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetBidResponseErrorListCall<'a, C, A> where C: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8525,10 +8500,7 @@ impl<'a, C, A> BidderAccountFilterSetBidResponseErrorListCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8548,7 +8520,7 @@ impl<'a, C, A> BidderAccountFilterSetBidResponseErrorListCall<'a, C, A> where C: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8655,7 +8627,7 @@ impl<'a, C, A> BidderAccountFilterSetBidResponseErrorListCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8790,7 +8762,7 @@ impl<'a, C, A> BidderFilterSetDeleteCall<'a, C, A> where C: BorrowMut BidderFilterSetDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8829,7 +8798,7 @@ impl<'a, C, A> BidderFilterSetDeleteCall<'a, C, A> where C: BorrowMut BidderFilterSetDeleteCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetImpressionMetricListCall<'a, C, A> where C: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9077,10 +9046,7 @@ impl<'a, C, A> BidderAccountFilterSetImpressionMetricListCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9100,7 +9066,7 @@ impl<'a, C, A> BidderAccountFilterSetImpressionMetricListCall<'a, C, A> where C: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9207,7 +9173,7 @@ impl<'a, C, A> BidderAccountFilterSetImpressionMetricListCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9352,7 +9318,7 @@ impl<'a, C, A> BidderFilterSetLosingBidListCall<'a, C, A> where C: BorrowMut BidderFilterSetLosingBidListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9391,7 +9354,7 @@ impl<'a, C, A> BidderFilterSetLosingBidListCall<'a, C, A> where C: BorrowMut BidderFilterSetLosingBidListCall<'a, C, A> where C: BorrowMut BidderAccountFilterSetFilteredBidDetailListCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9661,10 +9624,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidDetailListCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9684,7 +9644,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidDetailListCall<'a, C, A> where C let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9804,7 +9764,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidDetailListCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9949,7 +9909,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidListCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9965,10 +9925,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidListCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9988,7 +9945,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidListCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10095,7 +10052,7 @@ impl<'a, C, A> BidderAccountFilterSetFilteredBidListCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10240,7 +10197,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidRequestListCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10256,10 +10213,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidRequestListCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10279,7 +10233,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidRequestListCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10386,7 +10340,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidRequestListCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10531,7 +10485,7 @@ impl<'a, C, A> BidderAccountFilterSetBidResponsesWithoutBidListCall<'a, C, A> wh } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10547,10 +10501,7 @@ impl<'a, C, A> BidderAccountFilterSetBidResponsesWithoutBidListCall<'a, C, A> wh } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10570,7 +10521,7 @@ impl<'a, C, A> BidderAccountFilterSetBidResponsesWithoutBidListCall<'a, C, A> wh let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10677,7 +10628,7 @@ impl<'a, C, A> BidderAccountFilterSetBidResponsesWithoutBidListCall<'a, C, A> wh /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10822,7 +10773,7 @@ impl<'a, C, A> BidderAccountFilterSetLosingBidListCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10838,10 +10789,7 @@ impl<'a, C, A> BidderAccountFilterSetLosingBidListCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10861,7 +10809,7 @@ impl<'a, C, A> BidderAccountFilterSetLosingBidListCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10968,7 +10916,7 @@ impl<'a, C, A> BidderAccountFilterSetLosingBidListCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11113,7 +11061,7 @@ impl<'a, C, A> BidderFilterSetNonBillableWinningBidListCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11129,10 +11077,7 @@ impl<'a, C, A> BidderFilterSetNonBillableWinningBidListCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11152,7 +11097,7 @@ impl<'a, C, A> BidderFilterSetNonBillableWinningBidListCall<'a, C, A> where C: B let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11259,7 +11204,7 @@ impl<'a, C, A> BidderFilterSetNonBillableWinningBidListCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11403,7 +11348,7 @@ impl<'a, C, A> BidderFilterSetImpressionMetricListCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11419,10 +11364,7 @@ impl<'a, C, A> BidderFilterSetImpressionMetricListCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11442,7 +11384,7 @@ impl<'a, C, A> BidderFilterSetImpressionMetricListCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11549,7 +11491,7 @@ impl<'a, C, A> BidderFilterSetImpressionMetricListCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11696,7 +11638,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidDetailListCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11712,10 +11654,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidDetailListCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11735,7 +11674,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidDetailListCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11855,7 +11794,7 @@ impl<'a, C, A> BidderFilterSetFilteredBidDetailListCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12000,7 +11939,7 @@ impl<'a, C, A> BidderFilterSetBidResponseErrorListCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12016,10 +11955,7 @@ impl<'a, C, A> BidderFilterSetBidResponseErrorListCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12039,7 +11975,7 @@ impl<'a, C, A> BidderFilterSetBidResponseErrorListCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12146,7 +12082,7 @@ impl<'a, C, A> BidderFilterSetBidResponseErrorListCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12291,7 +12227,7 @@ impl<'a, C, A> BidderAccountFilterSetNonBillableWinningBidListCall<'a, C, A> whe } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12307,10 +12243,7 @@ impl<'a, C, A> BidderAccountFilterSetNonBillableWinningBidListCall<'a, C, A> whe } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12330,7 +12263,7 @@ impl<'a, C, A> BidderAccountFilterSetNonBillableWinningBidListCall<'a, C, A> whe let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12437,7 +12370,7 @@ impl<'a, C, A> BidderAccountFilterSetNonBillableWinningBidListCall<'a, C, A> whe /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12581,7 +12514,7 @@ impl<'a, C, A> BidderFilterSetBidMetricListCall<'a, C, A> where C: BorrowMut BidderFilterSetBidMetricListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12620,7 +12550,7 @@ impl<'a, C, A> BidderFilterSetBidMetricListCall<'a, C, A> where C: BorrowMut BidderFilterSetBidMetricListCall<'a, C, A> where C: BorrowMut BidderFilterSetBidResponsesWithoutBidListCall<'a, C, A> where C: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12888,10 +12818,7 @@ impl<'a, C, A> BidderFilterSetBidResponsesWithoutBidListCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12911,7 +12838,7 @@ impl<'a, C, A> BidderFilterSetBidResponsesWithoutBidListCall<'a, C, A> where C: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13018,7 +12945,7 @@ impl<'a, C, A> BidderFilterSetBidResponsesWithoutBidListCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13164,7 +13091,7 @@ impl<'a, C, A> BidderFilterSetCreateCall<'a, C, A> where C: BorrowMut BidderFilterSetCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13215,7 +13139,7 @@ impl<'a, C, A> BidderFilterSetCreateCall<'a, C, A> where C: BorrowMut BidderFilterSetCreateCall<'a, C, A> where C: BorrowMut BidderFilterSetCreateCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = AddNoteRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().proposals_add_note(req, "accountId", "proposalId") -/// .doit(); -/// # } -/// ``` -pub struct AccountProposalAddNoteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyerII, - _request: AddNoteRequest, - _account_id: String, - _proposal_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AccountProposalAddNoteCall<'a, C, A> {} - -impl<'a, C, A> AccountProposalAddNoteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Note)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.proposals.addNote", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("accountId", self._account_id.to_string())); - params.push(("proposalId", self._proposal_id.to_string())); - for &field in ["alt", "accountId", "proposalId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/accounts/{accountId}/proposals/{proposalId}:addNote"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{accountId}", "accountId"), ("{proposalId}", "proposalId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["proposalId", "accountId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: AddNoteRequest) -> AccountProposalAddNoteCall<'a, C, A> { - self._request = new_value; - self - } - /// Account ID of the buyer. - /// - /// Sets the *account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> AccountProposalAddNoteCall<'a, C, A> { - self._account_id = new_value.to_string(); - self - } - /// The ID of the proposal to attach the note to. - /// - /// Sets the *proposal id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn proposal_id(mut self, new_value: &str) -> AccountProposalAddNoteCall<'a, C, A> { - self._proposal_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountProposalAddNoteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AccountProposalAddNoteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountProposalAddNoteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// List all creative-deal associations. -/// -/// A builder for the *creatives.dealAssociations.list* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer2_v2_beta1 as adexchangebuyer2_v2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer2_v2_beta1::AdExchangeBuyerII; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().creatives_deal_associations_list("accountId", "creativeId") -/// .query("kasd") -/// .page_token("sanctus") -/// .page_size(-58) -/// .doit(); -/// # } -/// ``` -pub struct AccountCreativeDealAssociationListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyerII, - _account_id: String, - _creative_id: String, - _query: Option, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AccountCreativeDealAssociationListCall<'a, C, A> {} - -impl<'a, C, A> AccountCreativeDealAssociationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListDealAssociationsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.creatives.dealAssociations.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); - params.push(("accountId", self._account_id.to_string())); - params.push(("creativeId", self._creative_id.to_string())); - if let Some(value) = self._query { - params.push(("query", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "accountId", "creativeId", "query", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/accounts/{accountId}/creatives/{creativeId}/dealAssociations"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{accountId}", "accountId"), ("{creativeId}", "creativeId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["creativeId", "accountId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The account to list the associations from. - /// Specify "-" to list all creatives the current user has access to. - /// - /// Sets the *account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> AccountCreativeDealAssociationListCall<'a, C, A> { - self._account_id = new_value.to_string(); - self - } - /// The creative ID to list the associations from. - /// Specify "-" to list all creatives under the above account. - /// - /// Sets the *creative id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn creative_id(mut self, new_value: &str) -> AccountCreativeDealAssociationListCall<'a, C, A> { - self._creative_id = new_value.to_string(); - self - } - /// An optional query string to filter deal associations. If no filter is - /// specified, all associations will be returned. - /// Supported queries are: - ///
    - ///
  • accountId=account_id_string - ///
  • creativeId=creative_id_string - ///
  • dealsId=deals_id_string - ///
  • dealsStatus:{approved, conditionally_approved, disapproved, - /// not_checked} - ///
  • openAuctionStatus:{approved, conditionally_approved, disapproved, - /// not_checked} - ///
- /// Example: 'dealsId=12345 AND dealsStatus:disapproved' - /// - /// Sets the *query* query property to the given value. - pub fn query(mut self, new_value: &str) -> AccountCreativeDealAssociationListCall<'a, C, A> { - self._query = Some(new_value.to_string()); - self - } - /// A token identifying a page of results the server should return. - /// Typically, this is the value of - /// ListDealAssociationsResponse.next_page_token - /// returned from the previous call to 'ListDealAssociations' method. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> AccountCreativeDealAssociationListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Requested page size. Server may return fewer associations than requested. - /// If unspecified, server will pick an appropriate default. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> AccountCreativeDealAssociationListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountCreativeDealAssociationListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AccountCreativeDealAssociationListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountCreativeDealAssociationListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Associate an existing deal with a creative. -/// -/// A builder for the *creatives.dealAssociations.add* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer2_v2_beta1 as adexchangebuyer2_v2_beta1; -/// use adexchangebuyer2_v2_beta1::AddDealAssociationRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer2_v2_beta1::AdExchangeBuyerII; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = AddDealAssociationRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().creatives_deal_associations_add(req, "accountId", "creativeId") -/// .doit(); -/// # } -/// ``` -pub struct AccountCreativeDealAssociationAddCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyerII, - _request: AddDealAssociationRequest, - _account_id: String, - _creative_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AccountCreativeDealAssociationAddCall<'a, C, A> {} - -impl<'a, C, A> AccountCreativeDealAssociationAddCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.creatives.dealAssociations.add", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("accountId", self._account_id.to_string())); - params.push(("creativeId", self._creative_id.to_string())); - for &field in ["alt", "accountId", "creativeId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/accounts/{accountId}/creatives/{creativeId}/dealAssociations:add"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{accountId}", "accountId"), ("{creativeId}", "creativeId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["creativeId", "accountId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: AddDealAssociationRequest) -> AccountCreativeDealAssociationAddCall<'a, C, A> { - self._request = new_value; - self - } - /// The account the creative belongs to. - /// - /// Sets the *account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> AccountCreativeDealAssociationAddCall<'a, C, A> { - self._account_id = new_value.to_string(); - self - } - /// The ID of the creative associated with the deal. - /// - /// Sets the *creative id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn creative_id(mut self, new_value: &str) -> AccountCreativeDealAssociationAddCall<'a, C, A> { - self._creative_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountCreativeDealAssociationAddCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AccountCreativeDealAssociationAddCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountCreativeDealAssociationAddCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Update the given proposal to resume serving. /// This method will set the /// `DealServingMetadata.DealPauseStatus.has_buyer_paused` bit to false for all @@ -14384,10 +13412,7 @@ impl<'a, C, A> AccountProposalResumeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14419,7 +13444,7 @@ impl<'a, C, A> AccountProposalResumeCall<'a, C, A> where C: BorrowMut AccountProposalResumeCall<'a, C, A> where C: BorrowMut AccountProposalResumeCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AddNoteRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().proposals_add_note(req, "accountId", "proposalId") +/// .doit(); +/// # } +/// ``` +pub struct AccountProposalAddNoteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyerII, + _request: AddNoteRequest, + _account_id: String, + _proposal_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountProposalAddNoteCall<'a, C, A> {} + +impl<'a, C, A> AccountProposalAddNoteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Note)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.proposals.addNote", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("accountId", self._account_id.to_string())); + params.push(("proposalId", self._proposal_id.to_string())); + for &field in ["alt", "accountId", "proposalId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/accounts/{accountId}/proposals/{proposalId}:addNote"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{accountId}", "accountId"), ("{proposalId}", "proposalId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["proposalId", "accountId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AddNoteRequest) -> AccountProposalAddNoteCall<'a, C, A> { + self._request = new_value; + self + } + /// Account ID of the buyer. + /// + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: &str) -> AccountProposalAddNoteCall<'a, C, A> { + self._account_id = new_value.to_string(); + self + } + /// The ID of the proposal to attach the note to. + /// + /// Sets the *proposal id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn proposal_id(mut self, new_value: &str) -> AccountProposalAddNoteCall<'a, C, A> { + self._proposal_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountProposalAddNoteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccountProposalAddNoteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountProposalAddNoteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Associate an existing deal with a creative. +/// +/// A builder for the *creatives.dealAssociations.add* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer2_v2_beta1 as adexchangebuyer2_v2_beta1; +/// use adexchangebuyer2_v2_beta1::AddDealAssociationRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer2_v2_beta1::AdExchangeBuyerII; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AddDealAssociationRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().creatives_deal_associations_add(req, "accountId", "creativeId") +/// .doit(); +/// # } +/// ``` +pub struct AccountCreativeDealAssociationAddCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyerII, + _request: AddDealAssociationRequest, + _account_id: String, + _creative_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountCreativeDealAssociationAddCall<'a, C, A> {} + +impl<'a, C, A> AccountCreativeDealAssociationAddCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.creatives.dealAssociations.add", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("accountId", self._account_id.to_string())); + params.push(("creativeId", self._creative_id.to_string())); + for &field in ["alt", "accountId", "creativeId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/accounts/{accountId}/creatives/{creativeId}/dealAssociations:add"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{accountId}", "accountId"), ("{creativeId}", "creativeId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeId", "accountId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AddDealAssociationRequest) -> AccountCreativeDealAssociationAddCall<'a, C, A> { + self._request = new_value; + self + } + /// The account the creative belongs to. + /// + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: &str) -> AccountCreativeDealAssociationAddCall<'a, C, A> { + self._account_id = new_value.to_string(); + self + } + /// The ID of the creative associated with the deal. + /// + /// Sets the *creative id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_id(mut self, new_value: &str) -> AccountCreativeDealAssociationAddCall<'a, C, A> { + self._creative_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountCreativeDealAssociationAddCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccountCreativeDealAssociationAddCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountCreativeDealAssociationAddCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists creatives. +/// +/// A builder for the *creatives.list* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer2_v2_beta1 as adexchangebuyer2_v2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer2_v2_beta1::AdExchangeBuyerII; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().creatives_list("accountId") +/// .query("At") +/// .page_token("labore") +/// .page_size(-37) +/// .doit(); +/// # } +/// ``` +pub struct AccountCreativeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyerII, + _account_id: String, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountCreativeListCall<'a, C, A> {} + +impl<'a, C, A> AccountCreativeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListCreativesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.creatives.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("accountId", self._account_id.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "accountId", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/accounts/{accountId}/creatives"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{accountId}", "accountId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["accountId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The account to list the creatives from. + /// Specify "-" to list all creatives the current user has access to. + /// + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: &str) -> AccountCreativeListCall<'a, C, A> { + self._account_id = new_value.to_string(); + self + } + /// An optional query string to filter creatives. If no filter is specified, + /// all active creatives will be returned. + ///

Supported queries are: + ///

    + ///
  • accountId=account_id_string + ///
  • creativeId=creative_id_string + ///
  • dealsStatus: {approved, conditionally_approved, disapproved, + /// not_checked} + ///
  • openAuctionStatus: {approved, conditionally_approved, disapproved, + /// not_checked} + ///
  • attribute: {a numeric attribute from the list of attributes} + ///
  • disapprovalReason: {a reason from + /// DisapprovalReason} + ///
+ /// Example: 'accountId=12345 AND (dealsStatus:disapproved AND + /// disapprovalReason:unacceptable_content) OR attribute:47' + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> AccountCreativeListCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A token identifying a page of results the server should return. + /// Typically, this is the value of + /// ListCreativesResponse.next_page_token + /// returned from the previous call to 'ListCreatives' method. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountCreativeListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Requested page size. The server may return fewer creatives than requested + /// (due to timeout constraint) even if more are available via another call. + /// If unspecified, server will pick an appropriate default. + /// Acceptable values are 1 to 1000, inclusive. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> AccountCreativeListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountCreativeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccountCreativeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountCreativeListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Watches a creative. Will result in push notifications being sent to the /// topic when the creative changes status. /// @@ -14675,10 +14579,7 @@ impl<'a, C, A> AccountCreativeWatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14710,7 +14611,7 @@ impl<'a, C, A> AccountCreativeWatchCall<'a, C, A> where C: BorrowMut AccountCreativeWatchCall<'a, C, A> where C: BorrowMut AccountProposalAcceptCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15007,7 +14905,7 @@ impl<'a, C, A> AccountProposalAcceptCall<'a, C, A> where C: BorrowMut AccountProposalAcceptCall<'a, C, A> where C: BorrowMut AccountClientUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15297,7 +15192,7 @@ impl<'a, C, A> AccountClientUpdateCall<'a, C, A> where C: BorrowMut AccountClientUpdateCall<'a, C, A> where C: BorrowMut AccountClientUpdateCall<'a, C, A> where C: BorrowMut AccountProductListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15583,7 +15475,7 @@ impl<'a, C, A> AccountProductListCall<'a, C, A> where C: BorrowMut AccountProductListCall<'a, C, A> where C: BorrowMut AccountProductListCall<'a, C, A> where C: BorrowMut AccountProductListCall<'a, C, A> where C: BorrowMut +pub struct AccountClientListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyerII, _account_id: String, - _query: Option, + _partner_client_id: Option, _page_token: Option, _page_size: Option, _delegate: Option<&'a mut Delegate>, @@ -15783,13 +15675,13 @@ pub struct AccountCreativeListCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountCreativeListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountClientListCall<'a, C, A> {} -impl<'a, C, A> AccountCreativeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountClientListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListCreativesResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListClientsResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -15797,12 +15689,12 @@ impl<'a, C, A> AccountCreativeListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.creatives.list", + dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.clients.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); params.push(("accountId", self._account_id.to_string())); - if let Some(value) = self._query { - params.push(("query", value.to_string())); + if let Some(value) = self._partner_client_id { + params.push(("partnerClientId", value.to_string())); } if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -15810,7 +15702,7 @@ impl<'a, C, A> AccountCreativeListCall<'a, C, A> where C: BorrowMut AccountCreativeListCall<'a, C, A> where C: BorrowMut AccountCreativeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15872,7 +15761,7 @@ impl<'a, C, A> AccountCreativeListCall<'a, C, A> where C: BorrowMut AccountCreativeListCall<'a, C, A> where C: BorrowMut AccountCreativeListCall<'a, C, A> { + pub fn account_id(mut self, new_value: &str) -> AccountClientListCall<'a, C, A> { self._account_id = new_value.to_string(); self } - /// An optional query string to filter creatives. If no filter is specified, - /// all active creatives will be returned. - ///

Supported queries are: - ///

    - ///
  • accountId=account_id_string - ///
  • creativeId=creative_id_string - ///
  • dealsStatus: {approved, conditionally_approved, disapproved, - /// not_checked} - ///
  • openAuctionStatus: {approved, conditionally_approved, disapproved, - /// not_checked} - ///
  • attribute: {a numeric attribute from the list of attributes} - ///
  • disapprovalReason: {a reason from - /// DisapprovalReason} - ///
- /// Example: 'accountId=12345 AND (dealsStatus:disapproved AND - /// disapprovalReason:unacceptable_content) OR attribute:47' + /// Optional unique identifier (from the standpoint of an Ad Exchange sponsor + /// buyer partner) of the client to return. + /// If specified, at most one client will be returned in the response. /// - /// Sets the *query* query property to the given value. - pub fn query(mut self, new_value: &str) -> AccountCreativeListCall<'a, C, A> { - self._query = Some(new_value.to_string()); + /// Sets the *partner client id* query property to the given value. + pub fn partner_client_id(mut self, new_value: &str) -> AccountClientListCall<'a, C, A> { + self._partner_client_id = Some(new_value.to_string()); self } /// A token identifying a page of results the server should return. /// Typically, this is the value of - /// ListCreativesResponse.next_page_token - /// returned from the previous call to 'ListCreatives' method. + /// ListClientsResponse.nextPageToken + /// returned from the previous call to the + /// accounts.clients.list + /// method. /// /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> AccountCreativeListCall<'a, C, A> { + pub fn page_token(mut self, new_value: &str) -> AccountClientListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Requested page size. The server may return fewer creatives than requested - /// (due to timeout constraint) even if more are available via another call. - /// If unspecified, server will pick an appropriate default. - /// Acceptable values are 1 to 1000, inclusive. + /// Requested page size. The server may return fewer clients than requested. + /// If unspecified, the server will pick an appropriate default. /// /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> AccountCreativeListCall<'a, C, A> { + pub fn page_size(mut self, new_value: i32) -> AccountClientListCall<'a, C, A> { self._page_size = Some(new_value); self } @@ -15984,7 +15859,7 @@ impl<'a, C, A> AccountCreativeListCall<'a, C, A> where C: BorrowMut AccountCreativeListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountClientListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -15993,7 +15868,7 @@ impl<'a, C, A> AccountCreativeListCall<'a, C, A> where C: BorrowMut AccountCreativeListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AccountCreativeListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountClientListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -16029,7 +15904,7 @@ impl<'a, C, A> AccountCreativeListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountCreativeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountClientListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -16143,10 +16018,7 @@ impl<'a, C, A> AccountClientUserGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16166,7 +16038,7 @@ impl<'a, C, A> AccountClientUserGetCall<'a, C, A> where C: BorrowMut AccountClientUserGetCall<'a, C, A> where C: BorrowMut AccountClientInvitationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16438,7 +16307,7 @@ impl<'a, C, A> AccountClientInvitationGetCall<'a, C, A> where C: BorrowMut AccountClientInvitationGetCall<'a, C, A> where C: BorrowMut AccountClientInvitationGetCall<'a, C, A> where C: BorrowMut AccountClientInvitationGetCall<'a, C, A> where C: BorrowMut AccountClientInvitationGetCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CompleteSetupRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().proposals_get("accountId", "proposalId") +/// let result = hub.accounts().proposals_complete_setup(req, "accountId", "proposalId") /// .doit(); /// # } /// ``` -pub struct AccountProposalGetCall<'a, C, A> +pub struct AccountProposalCompleteSetupCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyerII, + _request: CompleteSetupRequest, _account_id: String, _proposal_id: String, _delegate: Option<&'a mut Delegate>, @@ -16628,9 +16508,9 @@ pub struct AccountProposalGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountProposalGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountProposalCompleteSetupCall<'a, C, A> {} -impl<'a, C, A> AccountProposalGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -16642,9 +16522,9 @@ impl<'a, C, A> AccountProposalGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.proposals.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.proposals.completeSetup", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("accountId", self._account_id.to_string())); params.push(("proposalId", self._proposal_id.to_string())); for &field in ["alt", "accountId", "proposalId"].iter() { @@ -16659,7 +16539,7 @@ impl<'a, C, A> AccountProposalGetCall<'a, C, A> where C: BorrowMut AccountProposalGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -16707,11 +16595,15 @@ impl<'a, C, A> AccountProposalGetCall<'a, C, A> where C: BorrowMut AccountProposalGetCall<'a, C, A> where C: BorrowMut AccountProposalCompleteSetupCall<'a, C, A> { + self._request = new_value; + self + } /// Account ID of the buyer. /// /// Sets the *account id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> AccountProposalGetCall<'a, C, A> { + pub fn account_id(mut self, new_value: &str) -> AccountProposalCompleteSetupCall<'a, C, A> { self._account_id = new_value.to_string(); self } - /// The unique ID of the proposal + /// The ID of the proposal to mark as setup completed. /// /// Sets the *proposal id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn proposal_id(mut self, new_value: &str) -> AccountProposalGetCall<'a, C, A> { + pub fn proposal_id(mut self, new_value: &str) -> AccountProposalCompleteSetupCall<'a, C, A> { self._proposal_id = new_value.to_string(); self } @@ -16788,7 +16689,7 @@ impl<'a, C, A> AccountProposalGetCall<'a, C, A> where C: BorrowMut AccountProposalGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountProposalCompleteSetupCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -16797,7 +16698,7 @@ impl<'a, C, A> AccountProposalGetCall<'a, C, A> where C: BorrowMut AccountProposalGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AccountProposalGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountProposalCompleteSetupCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -16833,7 +16734,7 @@ impl<'a, C, A> AccountProposalGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountProposalGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountProposalCompleteSetupCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -16954,10 +16855,7 @@ impl<'a, C, A> AccountProposalCancelNegotiationCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16989,7 +16887,7 @@ impl<'a, C, A> AccountProposalCancelNegotiationCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17089,7 +16987,7 @@ impl<'a, C, A> AccountProposalCancelNegotiationCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17137,9 +17035,10 @@ impl<'a, C, A> AccountProposalCancelNegotiationCall<'a, C, A> where C: BorrowMut } -/// Lists all the clients for the current sponsor buyer. +/// Creates and sends out an email invitation to access +/// an Ad Exchange client buyer account. /// -/// A builder for the *clients.list* method supported by a *account* resource. +/// A builder for the *clients.invitations.create* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. /// /// # Example @@ -17151,6 +17050,7 @@ impl<'a, C, A> AccountProposalCancelNegotiationCall<'a, C, A> where C: BorrowMut /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_adexchangebuyer2_v2_beta1 as adexchangebuyer2_v2_beta1; +/// use adexchangebuyer2_v2_beta1::ClientUserInvitation; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -17161,36 +17061,37 @@ impl<'a, C, A> AccountProposalCancelNegotiationCall<'a, C, A> where C: BorrowMut /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ClientUserInvitation::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().clients_list("accountId") -/// .partner_client_id("est") -/// .page_token("amet") -/// .page_size(-23) +/// let result = hub.accounts().clients_invitations_create(req, "accountId", "clientAccountId") /// .doit(); /// # } /// ``` -pub struct AccountClientListCall<'a, C, A> +pub struct AccountClientInvitationCreateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyerII, + _request: ClientUserInvitation, _account_id: String, - _partner_client_id: Option, - _page_token: Option, - _page_size: Option, + _client_account_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountClientListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountClientInvitationCreateCall<'a, C, A> {} -impl<'a, C, A> AccountClientListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListClientsResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ClientUserInvitation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -17198,20 +17099,12 @@ impl<'a, C, A> AccountClientListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.clients.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.clients.invitations.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("accountId", self._account_id.to_string())); - if let Some(value) = self._partner_client_id { - params.push(("partnerClientId", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "accountId", "partnerClientId", "pageToken", "pageSize"].iter() { + params.push(("clientAccountId", self._client_account_id.to_string())); + for &field in ["alt", "accountId", "clientAccountId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -17223,290 +17116,12 @@ impl<'a, C, A> AccountClientListCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v2beta1/accounts/{accountId}/clients"; + let mut url = self.hub._base_url.clone() + "v2beta1/accounts/{accountId}/clients/{clientAccountId}/invitations"; if self._scopes.len() == 0 { self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{accountId}", "accountId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["accountId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Unique numerical account ID of the sponsor buyer to list the clients for. - /// - /// Sets the *account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> AccountClientListCall<'a, C, A> { - self._account_id = new_value.to_string(); - self - } - /// Optional unique identifier (from the standpoint of an Ad Exchange sponsor - /// buyer partner) of the client to return. - /// If specified, at most one client will be returned in the response. - /// - /// Sets the *partner client id* query property to the given value. - pub fn partner_client_id(mut self, new_value: &str) -> AccountClientListCall<'a, C, A> { - self._partner_client_id = Some(new_value.to_string()); - self - } - /// A token identifying a page of results the server should return. - /// Typically, this is the value of - /// ListClientsResponse.nextPageToken - /// returned from the previous call to the - /// accounts.clients.list - /// method. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> AccountClientListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Requested page size. The server may return fewer clients than requested. - /// If unspecified, the server will pick an appropriate default. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> AccountClientListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountClientListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AccountClientListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountClientListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a creative. -/// -/// A builder for the *creatives.get* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer2_v2_beta1 as adexchangebuyer2_v2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer2_v2_beta1::AdExchangeBuyerII; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().creatives_get("accountId", "creativeId") -/// .doit(); -/// # } -/// ``` -pub struct AccountCreativeGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyerII, - _account_id: String, - _creative_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AccountCreativeGetCall<'a, C, A> {} - -impl<'a, C, A> AccountCreativeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.creatives.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("accountId", self._account_id.to_string())); - params.push(("creativeId", self._creative_id.to_string())); - for &field in ["alt", "accountId", "creativeId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/accounts/{accountId}/creatives/{creativeId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{accountId}", "accountId"), ("{creativeId}", "creativeId")].iter() { + for &(find_this, param_name) in [("{accountId}", "accountId"), ("{clientAccountId}", "clientAccountId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -17518,7 +17133,7 @@ impl<'a, C, A> AccountCreativeGetCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(2); - for param_name in ["creativeId", "accountId"].iter() { + for param_name in ["clientAccountId", "accountId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -17528,11 +17143,19 @@ impl<'a, C, A> AccountCreativeGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -17549,11 +17172,15 @@ impl<'a, C, A> AccountCreativeGetCall<'a, C, A> where C: BorrowMut AccountCreativeGetCall<'a, C, A> where C: BorrowMut AccountClientInvitationCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Numerical account ID of the client's sponsor buyer. (required) /// /// Sets the *account id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> AccountCreativeGetCall<'a, C, A> { + pub fn account_id(mut self, new_value: &str) -> AccountClientInvitationCreateCall<'a, C, A> { self._account_id = new_value.to_string(); self } - /// The ID of the creative to retrieve. + /// Numerical account ID of the client buyer that the user + /// should be associated with. (required) /// - /// Sets the *creative id* path property to the given value. + /// Sets the *client account id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn creative_id(mut self, new_value: &str) -> AccountCreativeGetCall<'a, C, A> { - self._creative_id = new_value.to_string(); + pub fn client_account_id(mut self, new_value: &str) -> AccountClientInvitationCreateCall<'a, C, A> { + self._client_account_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -17630,7 +17267,7 @@ impl<'a, C, A> AccountCreativeGetCall<'a, C, A> where C: BorrowMut AccountCreativeGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountClientInvitationCreateCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -17639,7 +17276,7 @@ impl<'a, C, A> AccountCreativeGetCall<'a, C, A> where C: BorrowMut AccountCreativeGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AccountCreativeGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountClientInvitationCreateCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -17675,7 +17312,7 @@ impl<'a, C, A> AccountCreativeGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountCreativeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountClientInvitationCreateCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -17721,7 +17358,7 @@ impl<'a, C, A> AccountCreativeGetCall<'a, C, A> where C: BorrowMut AccountCreativeCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17832,7 +17466,7 @@ impl<'a, C, A> AccountCreativeCreateCall<'a, C, A> where C: BorrowMut AccountCreativeCreateCall<'a, C, A> where C: BorrowMut AccountCreativeStopWatchingCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18124,7 +17755,7 @@ impl<'a, C, A> AccountCreativeStopWatchingCall<'a, C, A> where C: BorrowMut AccountCreativeStopWatchingCall<'a, C, A> where C: BorrowMut AccountProposalUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18427,7 +18055,7 @@ impl<'a, C, A> AccountProposalUpdateCall<'a, C, A> where C: BorrowMut AccountProposalUpdateCall<'a, C, A> where C: BorrowMut AccountClientUserUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18720,7 +18345,7 @@ impl<'a, C, A> AccountClientUserUpdateCall<'a, C, A> where C: BorrowMut AccountClientUserUpdateCall<'a, C, A> where C: BorrowMut AccountClientUserUpdateCall<'a, C, A> where C: BorrowMut AccountFinalizedProposalListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19022,7 +18644,7 @@ impl<'a, C, A> AccountFinalizedProposalListCall<'a, C, A> where C: BorrowMut AccountFinalizedProposalListCall<'a, C, A> where C: BorrowMut AccountFinalizedProposalListCall<'a, C, A> where C: BorrowMut AccountFinalizedProposalListCall<'a, C, A> where C: BorrowMut AccountFinalizedProposalListCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ClientUserInvitation::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().clients_invitations_create(req, "accountId", "clientAccountId") +/// let result = hub.accounts().creatives_get("accountId", "creativeId") /// .doit(); /// # } /// ``` -pub struct AccountClientInvitationCreateCall<'a, C, A> +pub struct AccountCreativeGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyerII, - _request: ClientUserInvitation, _account_id: String, - _client_account_id: String, + _creative_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountClientInvitationCreateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountCreativeGetCall<'a, C, A> {} -impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountCreativeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ClientUserInvitation)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -19245,12 +18859,12 @@ impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.clients.invitations.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.creatives.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("accountId", self._account_id.to_string())); - params.push(("clientAccountId", self._client_account_id.to_string())); - for &field in ["alt", "accountId", "clientAccountId"].iter() { + params.push(("creativeId", self._creative_id.to_string())); + for &field in ["alt", "accountId", "creativeId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -19262,12 +18876,12 @@ impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -19279,7 +18893,7 @@ impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(2); - for param_name in ["clientAccountId", "accountId"].iter() { + for param_name in ["creativeId", "accountId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -19289,22 +18903,8 @@ impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -19321,15 +18921,11 @@ impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut AccountClientInvitationCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Numerical account ID of the client's sponsor buyer. (required) + /// The account the creative belongs to. /// /// Sets the *account id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> AccountClientInvitationCreateCall<'a, C, A> { + pub fn account_id(mut self, new_value: &str) -> AccountCreativeGetCall<'a, C, A> { self._account_id = new_value.to_string(); self } - /// Numerical account ID of the client buyer that the user - /// should be associated with. (required) + /// The ID of the creative to retrieve. /// - /// Sets the *client account id* path property to the given value. + /// Sets the *creative id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn client_account_id(mut self, new_value: &str) -> AccountClientInvitationCreateCall<'a, C, A> { - self._client_account_id = new_value.to_string(); + pub fn creative_id(mut self, new_value: &str) -> AccountCreativeGetCall<'a, C, A> { + self._creative_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -19416,7 +19002,7 @@ impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut AccountClientInvitationCreateCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountCreativeGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -19425,7 +19011,7 @@ impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AccountClientInvitationCreateCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountCreativeGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -19461,7 +19047,7 @@ impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountClientInvitationCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountCreativeGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -19502,8 +19088,8 @@ impl<'a, C, A> AccountClientInvitationCreateCall<'a, C, A> where C: BorrowMut AccountClientUserListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19607,7 +19190,7 @@ impl<'a, C, A> AccountClientUserListCall<'a, C, A> where C: BorrowMut AccountClientUserListCall<'a, C, A> where C: BorrowMut AccountClientUserListCall<'a, C, A> where C: BorrowMut AccountPublisherProfileListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19898,7 +19478,7 @@ impl<'a, C, A> AccountPublisherProfileListCall<'a, C, A> where C: BorrowMut AccountPublisherProfileListCall<'a, C, A> where C: BorrowMut AccountProposalCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20179,7 +19756,7 @@ impl<'a, C, A> AccountProposalCreateCall<'a, C, A> where C: BorrowMut AccountProposalCreateCall<'a, C, A> where C: BorrowMut AccountClientCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20457,7 +20031,7 @@ impl<'a, C, A> AccountClientCreateCall<'a, C, A> where C: BorrowMut AccountClientCreateCall<'a, C, A> where C: BorrowMut AccountProductGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20719,7 +20290,7 @@ impl<'a, C, A> AccountProductGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20807,7 +20378,7 @@ impl<'a, C, A> AccountProductGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20955,10 +20526,7 @@ impl<'a, C, A> AccountPublisherProfileGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20978,7 +20546,7 @@ impl<'a, C, A> AccountPublisherProfileGetCall<'a, C, A> where C: BorrowMut AccountPublisherProfileGetCall<'a, C, A> where C: BorrowMut AccountClientGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21237,7 +20802,7 @@ impl<'a, C, A> AccountClientGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21325,7 +20890,7 @@ impl<'a, C, A> AccountClientGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21373,14 +20938,9 @@ impl<'a, C, A> AccountClientGetCall<'a, C, A> where C: BorrowMut, } -/// Update the given proposal to indicate that setup has been completed. -/// This method is called by the buyer when the line items have been created -/// on their end for a finalized proposal and all the required creatives -/// have been uploaded using the creatives API. This call updates the -/// `is_setup_completed` bit on the proposal and also notifies the seller. -/// The server will advance the revision number of the most recent proposal. +/// List all creative-deal associations. /// -/// A builder for the *proposals.completeSetup* method supported by a *account* resource. +/// A builder for the *creatives.dealAssociations.list* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. /// /// # Example @@ -21392,7 +20952,6 @@ impl<'a, C, A> AccountClientGetCall<'a, C, A> where C: BorrowMut, /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_adexchangebuyer2_v2_beta1 as adexchangebuyer2_v2_beta1; -/// use adexchangebuyer2_v2_beta1::CompleteSetupRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -21403,37 +20962,37 @@ impl<'a, C, A> AccountClientGetCall<'a, C, A> where C: BorrowMut, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = CompleteSetupRequest::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().proposals_complete_setup(req, "accountId", "proposalId") +/// let result = hub.accounts().creatives_deal_associations_list("accountId", "creativeId") +/// .query("takimata") +/// .page_token("elitr") +/// .page_size(-91) /// .doit(); /// # } /// ``` -pub struct AccountProposalCompleteSetupCall<'a, C, A> +pub struct AccountCreativeDealAssociationListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyerII, - _request: CompleteSetupRequest, _account_id: String, - _proposal_id: String, + _creative_id: String, + _query: Option, + _page_token: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountProposalCompleteSetupCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountCreativeDealAssociationListCall<'a, C, A> {} -impl<'a, C, A> AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountCreativeDealAssociationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Proposal)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListDealAssociationsResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -21441,12 +21000,21 @@ impl<'a, C, A> AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.proposals.completeSetup", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.creatives.dealAssociations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); params.push(("accountId", self._account_id.to_string())); - params.push(("proposalId", self._proposal_id.to_string())); - for &field in ["alt", "accountId", "proposalId"].iter() { + params.push(("creativeId", self._creative_id.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "accountId", "creativeId", "query", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -21458,12 +21026,12 @@ impl<'a, C, A> AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -21475,7 +21043,7 @@ impl<'a, C, A> AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(2); - for param_name in ["proposalId", "accountId"].iter() { + for param_name in ["creativeId", "accountId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -21485,22 +21053,8 @@ impl<'a, C, A> AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -21517,15 +21071,11 @@ impl<'a, C, A> AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut AccountProposalCompleteSetupCall<'a, C, A> { - self._request = new_value; - self - } - /// Account ID of the buyer. + /// The account to list the associations from. + /// Specify "-" to list all creatives the current user has access to. /// /// Sets the *account id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> AccountProposalCompleteSetupCall<'a, C, A> { + pub fn account_id(mut self, new_value: &str) -> AccountCreativeDealAssociationListCall<'a, C, A> { self._account_id = new_value.to_string(); self } - /// The ID of the proposal to mark as setup completed. + /// The creative ID to list the associations from. + /// Specify "-" to list all creatives under the above account. /// - /// Sets the *proposal id* path property to the given value. + /// Sets the *creative id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn proposal_id(mut self, new_value: &str) -> AccountProposalCompleteSetupCall<'a, C, A> { - self._proposal_id = new_value.to_string(); + pub fn creative_id(mut self, new_value: &str) -> AccountCreativeDealAssociationListCall<'a, C, A> { + self._creative_id = new_value.to_string(); + self + } + /// An optional query string to filter deal associations. If no filter is + /// specified, all associations will be returned. + /// Supported queries are: + ///
    + ///
  • accountId=account_id_string + ///
  • creativeId=creative_id_string + ///
  • dealsId=deals_id_string + ///
  • dealsStatus:{approved, conditionally_approved, disapproved, + /// not_checked} + ///
  • openAuctionStatus:{approved, conditionally_approved, disapproved, + /// not_checked} + ///
+ /// Example: 'dealsId=12345 AND dealsStatus:disapproved' + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> AccountCreativeDealAssociationListCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A token identifying a page of results the server should return. + /// Typically, this is the value of + /// ListDealAssociationsResponse.next_page_token + /// returned from the previous call to 'ListDealAssociations' method. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountCreativeDealAssociationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Requested page size. Server may return fewer associations than requested. + /// If unspecified, server will pick an appropriate default. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> AccountCreativeDealAssociationListCall<'a, C, A> { + self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -21611,7 +21191,7 @@ impl<'a, C, A> AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut AccountProposalCompleteSetupCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountCreativeDealAssociationListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -21620,7 +21200,7 @@ impl<'a, C, A> AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AccountProposalCompleteSetupCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountCreativeDealAssociationListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -21656,7 +21236,7 @@ impl<'a, C, A> AccountProposalCompleteSetupCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountProposalCompleteSetupCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountCreativeDealAssociationListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -21775,10 +21355,7 @@ impl<'a, C, A> AccountCreativeUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21810,7 +21387,7 @@ impl<'a, C, A> AccountCreativeUpdateCall<'a, C, A> where C: BorrowMut AccountCreativeUpdateCall<'a, C, A> where C: BorrowMut AccountCreativeDealAssociationRemoveCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22106,7 +21680,7 @@ impl<'a, C, A> AccountCreativeDealAssociationRemoveCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -22206,7 +21780,7 @@ impl<'a, C, A> AccountCreativeDealAssociationRemoveCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22368,10 +21942,7 @@ impl<'a, C, A> AccountProposalPauseCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22403,7 +21974,7 @@ impl<'a, C, A> AccountProposalPauseCall<'a, C, A> where C: BorrowMut AccountProposalPauseCall<'a, C, A> where C: BorrowMut AccountProposalPauseCall<'a, C, A> where C: BorrowMut AccountProposalListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22697,7 +22265,7 @@ impl<'a, C, A> AccountProposalListCall<'a, C, A> where C: BorrowMut AccountProposalListCall<'a, C, A> where C: BorrowMut AccountProposalListCall<'a, C, A> where C: BorrowMut AccountClientInvitationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22990,7 +22555,7 @@ impl<'a, C, A> AccountClientInvitationListCall<'a, C, A> where C: BorrowMut AccountClientInvitationListCall<'a, C, A> where C: BorrowMut AccountClientInvitationListCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = AdExchangeBuyerII::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().proposals_get("accountId", "proposalId") +/// .doit(); +/// # } +/// ``` +pub struct AccountProposalGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyerII, + _account_id: String, + _proposal_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountProposalGetCall<'a, C, A> {} + +impl<'a, C, A> AccountProposalGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Proposal)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer2.accounts.proposals.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("accountId", self._account_id.to_string())); + params.push(("proposalId", self._proposal_id.to_string())); + for &field in ["alt", "accountId", "proposalId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/accounts/{accountId}/proposals/{proposalId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{accountId}", "accountId"), ("{proposalId}", "proposalId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["proposalId", "accountId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Account ID of the buyer. + /// + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: &str) -> AccountProposalGetCall<'a, C, A> { + self._account_id = new_value.to_string(); + self + } + /// The unique ID of the proposal + /// + /// Sets the *proposal id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn proposal_id(mut self, new_value: &str) -> AccountProposalGetCall<'a, C, A> { + self._proposal_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountProposalGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccountProposalGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountProposalGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/adexchangeseller2/Cargo.toml b/gen/adexchangeseller2/Cargo.toml index 6986683c30..44de540cc0 100644 --- a/gen/adexchangeseller2/Cargo.toml +++ b/gen/adexchangeseller2/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/adexchangeseller2/src/lib.rs b/gen/adexchangeseller2/src/lib.rs index 33f35b5153..e7970a2644 100644 --- a/gen/adexchangeseller2/src/lib.rs +++ b/gen/adexchangeseller2/src/lib.rs @@ -1302,10 +1302,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1325,7 +1322,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1599,7 +1593,7 @@ impl<'a, C, A> AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1910,7 +1901,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2238,7 +2226,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountReportSavedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2515,7 +2500,7 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut AccountReportSavedListCall<'a, C, A> where C: BorrowMut AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2774,7 +2756,7 @@ impl<'a, C, A> AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3037,7 +3016,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3294,7 +3270,7 @@ impl<'a, C, A> AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3541,7 +3514,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3816,7 +3786,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4070,7 +4037,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4152,7 +4119,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4299,10 +4266,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4322,7 +4286,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4407,7 +4371,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4549,10 +4513,7 @@ impl<'a, C, A> AccountPreferreddealListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4572,7 +4533,7 @@ impl<'a, C, A> AccountPreferreddealListCall<'a, C, A> where C: BorrowMut AccountPreferreddealListCall<'a, C, A> where C: BorrowMut AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4815,7 +4773,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4893,7 +4851,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/adexperiencereport1-cli/Cargo.toml b/gen/adexperiencereport1-cli/Cargo.toml index f870286bb5..2de0204cff 100644 --- a/gen/adexperiencereport1-cli/Cargo.toml +++ b/gen/adexperiencereport1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexperiencereport1-cli" -version = "1.0.8+20180911" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Experience Report (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexperiencereport1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-adexperiencereport1] path = "../adexperiencereport1" -version = "1.0.8+20180911" +version = "1.0.8+20190401" diff --git a/gen/adexperiencereport1-cli/README.md b/gen/adexperiencereport1-cli/README.md index 513a492135..dbd0fdfe30 100644 --- a/gen/adexperiencereport1-cli/README.md +++ b/gen/adexperiencereport1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Ad Experience Report* API at revision *20180911*. The CLI is at version *1.0.8*. +This documentation was generated from the *Ad Experience Report* API at revision *20190401*. The CLI is at version *1.0.8*. ```bash adexperiencereport1 [options] diff --git a/gen/adexperiencereport1-cli/mkdocs.yml b/gen/adexperiencereport1-cli/mkdocs.yml index ec8a98e37f..5c6fbecd19 100644 --- a/gen/adexperiencereport1-cli/mkdocs.yml +++ b/gen/adexperiencereport1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Ad Experience Report v1.0.8+20180911 +site_name: Ad Experience Report v1.0.8+20190401 site_url: http://byron.github.io/google-apis-rs/google-adexperiencereport1-cli site_description: A complete library to interact with Ad Experience Report (protocol v1) diff --git a/gen/adexperiencereport1-cli/src/main.rs b/gen/adexperiencereport1-cli/src/main.rs index fcf42f550a..d4663803b8 100644 --- a/gen/adexperiencereport1-cli/src/main.rs +++ b/gen/adexperiencereport1-cli/src/main.rs @@ -316,8 +316,8 @@ fn main() { let mut app = App::new("adexperiencereport1") .author("Sebastian Thiel ") - .version("1.0.8+20180911") - .about("View Ad Experience Report data, and get a list of sites that have a significant number of annoying ads.") + .version("1.0.8+20190401") + .about("Views Ad Experience Report data, and gets a list of sites that have a significant number of annoying ads.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adexperiencereport1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/adexperiencereport1/Cargo.toml b/gen/adexperiencereport1/Cargo.toml index c2a22648a3..7f32ff4543 100644 --- a/gen/adexperiencereport1/Cargo.toml +++ b/gen/adexperiencereport1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-adexperiencereport1" -version = "1.0.8+20180911" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Experience Report (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexperiencereport1" homepage = "https://developers.google.com/ad-experience-report/" -documentation = "https://docs.rs/google-adexperiencereport1/1.0.8+20180911" +documentation = "https://docs.rs/google-adexperiencereport1/1.0.8+20190401" license = "MIT" keywords = ["adexperiencereport", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/adexperiencereport1/README.md b/gen/adexperiencereport1/README.md index bd232715c1..ab3f240acd 100644 --- a/gen/adexperiencereport1/README.md +++ b/gen/adexperiencereport1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-adexperiencereport1` library allows access to all features of the *Google Ad Experience Report* service. -This documentation was generated from *Ad Experience Report* crate version *1.0.8+20180911*, where *20180911* is the exact revision of the *adexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Ad Experience Report* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *adexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Ad Experience Report* *v1* API can be found at the [official documentation site](https://developers.google.com/ad-experience-report/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/struct.AdExperienceReport.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/struct.AdExperienceReport.html) ... * sites - * [*get*](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/struct.SiteGetCall.html) + * [*get*](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/struct.SiteGetCall.html) * violating sites - * [*list*](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/struct.ViolatingSiteListCall.html) + * [*list*](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/struct.ViolatingSiteListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/struct.AdExperienceReport.html)** +* **[Hub](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/struct.AdExperienceReport.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.Part.html)** + * **[Parts](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -126,17 +126,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -146,29 +146,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-adexperiencereport1/1.0.8+20180911/google_adexperiencereport1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-adexperiencereport1/1.0.8+20190401/google_adexperiencereport1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/adexperiencereport1/src/lib.rs b/gen/adexperiencereport1/src/lib.rs index eed7e7698d..d7adb1fcd8 100644 --- a/gen/adexperiencereport1/src/lib.rs +++ b/gen/adexperiencereport1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Ad Experience Report* crate version *1.0.8+20180911*, where *20180911* is the exact revision of the *adexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Ad Experience Report* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *adexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Ad Experience Report* *v1* API can be found at the //! [official documentation site](https://developers.google.com/ad-experience-report/). @@ -405,12 +405,12 @@ impl Part for PlatformSummary {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SiteSummaryResponse { - /// The name of the site reviewed. - #[serde(rename="reviewedSite")] - pub reviewed_site: Option, /// Summary for the desktop review of the site. #[serde(rename="desktopSummary")] pub desktop_summary: Option, + /// The name of the site reviewed. + #[serde(rename="reviewedSite")] + pub reviewed_site: Option, /// Summary for the mobile review of the site. #[serde(rename="mobileSummary")] pub mobile_summary: Option, @@ -654,7 +654,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -670,10 +670,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -693,7 +690,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -777,7 +774,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -785,12 +782,12 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SiteGetCall<'a, C, A> @@ -900,10 +897,7 @@ impl<'a, C, A> ViolatingSiteListCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -923,7 +917,7 @@ impl<'a, C, A> ViolatingSiteListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -991,7 +985,7 @@ impl<'a, C, A> ViolatingSiteListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -999,12 +993,12 @@ impl<'a, C, A> ViolatingSiteListCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ViolatingSiteListCall<'a, C, A> diff --git a/gen/admin1_directory-cli/Cargo.toml b/gen/admin1_directory-cli/Cargo.toml index 6907b38e21..e24a142cb5 100644 --- a/gen/admin1_directory-cli/Cargo.toml +++ b/gen/admin1_directory-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-admin1_directory-cli" -version = "1.0.8+20180917" +version = "1.0.8+20190214" authors = ["Sebastian Thiel "] description = "A complete library to interact with directory (protocol directory_v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-admin1_directory] path = "../admin1_directory" -version = "1.0.8+20180917" +version = "1.0.8+20190214" diff --git a/gen/admin1_directory-cli/README.md b/gen/admin1_directory-cli/README.md index 0759541455..016ab2d435 100644 --- a/gen/admin1_directory-cli/README.md +++ b/gen/admin1_directory-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *directory* API at revision *20180917*. The CLI is at version *1.0.8*. +This documentation was generated from the *directory* API at revision *20190214*. The CLI is at version *1.0.8*. ```bash admin1-directory [options] diff --git a/gen/admin1_directory-cli/mkdocs.yml b/gen/admin1_directory-cli/mkdocs.yml index e90635e3c4..65cefd2367 100644 --- a/gen/admin1_directory-cli/mkdocs.yml +++ b/gen/admin1_directory-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: directory v1.0.8+20180917 +site_name: directory v1.0.8+20190214 site_url: http://byron.github.io/google-apis-rs/google-admin1_directory-cli site_description: A complete library to interact with directory (protocol directory_v1) diff --git a/gen/admin1_directory-cli/src/main.rs b/gen/admin1_directory-cli/src/main.rs index 02b6ce0d6e..22c4d36313 100644 --- a/gen/admin1_directory-cli/src/main.rs +++ b/gen/admin1_directory-cli/src/main.rs @@ -3960,15 +3960,22 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "building-name" => Some(("buildingName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "coordinates.latitude" => Some(("coordinates.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "coordinates.longitude" => Some(("coordinates.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "etags" => Some(("etags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.language-code" => Some(("address.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.locality" => Some(("address.locality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.region-code" => Some(("address.regionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.administrative-area" => Some(("address.administrativeArea", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.address-lines" => Some(("address.addressLines", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "address.postal-code" => Some(("address.postalCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.sublocality" => Some(("address.sublocality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "floor-names" => Some(("floorNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "building-id" => Some(("buildingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "building-name" => Some(("buildingName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["building-id", "building-name", "coordinates", "description", "etags", "floor-names", "kind", "latitude", "longitude"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "address-lines", "administrative-area", "building-id", "building-name", "coordinates", "description", "etags", "floor-names", "kind", "language-code", "latitude", "locality", "longitude", "postal-code", "region-code", "sublocality"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3982,6 +3989,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "coordinates-source" => { + call = call.coordinates_source(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -3995,6 +4005,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["coordinates-source"].iter().map(|v|*v)); v } )); } } @@ -4111,15 +4122,22 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "building-name" => Some(("buildingName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "coordinates.latitude" => Some(("coordinates.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "coordinates.longitude" => Some(("coordinates.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "etags" => Some(("etags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.language-code" => Some(("address.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.locality" => Some(("address.locality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.region-code" => Some(("address.regionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.administrative-area" => Some(("address.administrativeArea", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.address-lines" => Some(("address.addressLines", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "address.postal-code" => Some(("address.postalCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.sublocality" => Some(("address.sublocality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "floor-names" => Some(("floorNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "building-id" => Some(("buildingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "building-name" => Some(("buildingName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["building-id", "building-name", "coordinates", "description", "etags", "floor-names", "kind", "latitude", "longitude"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "address-lines", "administrative-area", "building-id", "building-name", "coordinates", "description", "etags", "floor-names", "kind", "language-code", "latitude", "locality", "longitude", "postal-code", "region-code", "sublocality"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4133,6 +4151,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "coordinates-source" => { + call = call.coordinates_source(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -4146,6 +4167,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["coordinates-source"].iter().map(|v|*v)); v } )); } } @@ -4203,15 +4225,22 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "building-name" => Some(("buildingName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "coordinates.latitude" => Some(("coordinates.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "coordinates.longitude" => Some(("coordinates.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "etags" => Some(("etags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.language-code" => Some(("address.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.locality" => Some(("address.locality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.region-code" => Some(("address.regionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.administrative-area" => Some(("address.administrativeArea", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.address-lines" => Some(("address.addressLines", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "address.postal-code" => Some(("address.postalCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address.sublocality" => Some(("address.sublocality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "floor-names" => Some(("floorNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "building-id" => Some(("buildingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "building-name" => Some(("buildingName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["building-id", "building-name", "coordinates", "description", "etags", "floor-names", "kind", "latitude", "longitude"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "address-lines", "administrative-area", "building-id", "building-name", "coordinates", "description", "etags", "floor-names", "kind", "language-code", "latitude", "locality", "longitude", "postal-code", "region-code", "sublocality"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4225,6 +4254,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "coordinates-source" => { + call = call.coordinates_source(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -4238,6 +4270,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["coordinates-source"].iter().map(|v|*v)); v } )); } } @@ -11533,7 +11566,7 @@ fn main() { let mut app = App::new("admin1-directory") .author("Sebastian Thiel ") - .version("1.0.8+20180917") + .version("1.0.8+20190214") .about("Manages enterprise resources such as users and groups, administrative notifications, security features, and more.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_admin1_directory_cli") .arg(Arg::with_name("url") diff --git a/gen/admin1_directory/Cargo.toml b/gen/admin1_directory/Cargo.toml index 1383d59635..438686de10 100644 --- a/gen/admin1_directory/Cargo.toml +++ b/gen/admin1_directory/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-admin1_directory" -version = "1.0.8+20180917" +version = "1.0.8+20190214" authors = ["Sebastian Thiel "] description = "A complete library to interact with directory (protocol directory_v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory" homepage = "https://developers.google.com/admin-sdk/directory/" -documentation = "https://docs.rs/google-admin1_directory/1.0.8+20180917" +documentation = "https://docs.rs/google-admin1_directory/1.0.8+20190214" license = "MIT" keywords = ["admin", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/admin1_directory/README.md b/gen/admin1_directory/README.md index 7e826e751c..683eb50d77 100644 --- a/gen/admin1_directory/README.md +++ b/gen/admin1_directory/README.md @@ -5,63 +5,63 @@ DO NOT EDIT ! --> The `google-admin1_directory` library allows access to all features of the *Google directory* service. -This documentation was generated from *directory* crate version *1.0.8+20180917*, where *20180917* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *directory* crate version *1.0.8+20190214*, where *20190214* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *directory* *v1_directory* API can be found at the [official documentation site](https://developers.google.com/admin-sdk/directory/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Directory.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Directory.html) ... -* [asps](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Asp.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.AspDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.AspGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.AspListCall.html) -* [channels](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Channel.html) - * [*stop*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ChannelStopCall.html) +* [asps](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Asp.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.AspDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.AspGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.AspListCall.html) +* [channels](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Channel.html) + * [*stop*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ChannelStopCall.html) * chromeosdevices - * [*action*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ChromeosdeviceActionCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ChromeosdeviceGetCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ChromeosdeviceListCall.html), [*move devices to ou*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ChromeosdeviceMoveDevicesToOuCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ChromeosdevicePatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ChromeosdeviceUpdateCall.html) -* [customers](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Customer.html) - * [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.CustomerGetCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.CustomerPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.CustomerUpdateCall.html) + * [*action*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ChromeosdeviceActionCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ChromeosdeviceGetCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ChromeosdeviceListCall.html), [*move devices to ou*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ChromeosdeviceMoveDevicesToOuCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ChromeosdevicePatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ChromeosdeviceUpdateCall.html) +* [customers](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Customer.html) + * [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.CustomerGetCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.CustomerPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.CustomerUpdateCall.html) * domain aliases - * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.DomainAliaseDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.DomainAliaseGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.DomainAliaseInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.DomainAliaseListCall.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.DomainAliaseDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.DomainAliaseGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.DomainAliaseInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.DomainAliaseListCall.html) * domains - * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.DomainDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.DomainGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.DomainInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.DomainListCall.html) -* [groups](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Group.html) - * [*aliases delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.GroupAliaseDeleteCall.html), [*aliases insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.GroupAliaseInsertCall.html), [*aliases list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.GroupAliaseListCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.GroupDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.GroupGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.GroupListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.GroupPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.GroupUpdateCall.html) -* [members](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Member.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MemberDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MemberGetCall.html), [*has member*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MemberHasMemberCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MemberInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MemberListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MemberPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MemberUpdateCall.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.DomainDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.DomainGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.DomainInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.DomainListCall.html) +* [groups](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Group.html) + * [*aliases delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.GroupAliaseDeleteCall.html), [*aliases insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.GroupAliaseInsertCall.html), [*aliases list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.GroupAliaseListCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.GroupDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.GroupGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.GroupListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.GroupPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.GroupUpdateCall.html) +* [members](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Member.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MemberDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MemberGetCall.html), [*has member*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MemberHasMemberCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MemberInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MemberListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MemberPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MemberUpdateCall.html) * mobiledevices - * [*action*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MobiledeviceActionCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MobiledeviceDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MobiledeviceGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.MobiledeviceListCall.html) -* [notifications](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Notification.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.NotificationDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.NotificationGetCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.NotificationListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.NotificationPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.NotificationUpdateCall.html) + * [*action*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MobiledeviceActionCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MobiledeviceDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MobiledeviceGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.MobiledeviceListCall.html) +* [notifications](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Notification.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.NotificationDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.NotificationGetCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.NotificationListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.NotificationPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.NotificationUpdateCall.html) * orgunits - * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.OrgunitDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.OrgunitGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.OrgunitInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.OrgunitListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.OrgunitPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.OrgunitUpdateCall.html) -* [privileges](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Privilege.html) - * [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.PrivilegeListCall.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.OrgunitDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.OrgunitGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.OrgunitInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.OrgunitListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.OrgunitPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.OrgunitUpdateCall.html) +* [privileges](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Privilege.html) + * [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.PrivilegeListCall.html) * resolved app access settings - * [*get settings*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResolvedAppAccessSettingGetSettingCall.html) and [*list trusted apps*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResolvedAppAccessSettingListTrustedAppCall.html) + * [*get settings*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResolvedAppAccessSettingGetSettingCall.html) and [*list trusted apps*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResolvedAppAccessSettingListTrustedAppCall.html) * resources - * [*buildings delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceBuildingDeleteCall.html), [*buildings get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceBuildingGetCall.html), [*buildings insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceBuildingInsertCall.html), [*buildings list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceBuildingListCall.html), [*buildings patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceBuildingPatchCall.html), [*buildings update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceBuildingUpdateCall.html), [*calendars delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceCalendarDeleteCall.html), [*calendars get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceCalendarGetCall.html), [*calendars insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceCalendarInsertCall.html), [*calendars list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceCalendarListCall.html), [*calendars patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceCalendarPatchCall.html), [*calendars update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceCalendarUpdateCall.html), [*features delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceFeatureDeleteCall.html), [*features get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceFeatureGetCall.html), [*features insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceFeatureInsertCall.html), [*features list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceFeatureListCall.html), [*features patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceFeaturePatchCall.html), [*features rename*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceFeatureRenameCall.html) and [*features update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.ResourceFeatureUpdateCall.html) -* [role assignments](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RoleAssignment.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RoleAssignmentDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RoleAssignmentGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RoleAssignmentInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RoleAssignmentListCall.html) -* [roles](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Role.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RoleDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RoleGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RoleInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RoleListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RolePatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.RoleUpdateCall.html) -* [schemas](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Schema.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.SchemaDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.SchemaGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.SchemaInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.SchemaListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.SchemaPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.SchemaUpdateCall.html) -* [tokens](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Token.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.TokenDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.TokenGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.TokenListCall.html) -* [users](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.User.html) - * [*aliases delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserAliaseDeleteCall.html), [*aliases insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserAliaseInsertCall.html), [*aliases list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserAliaseListCall.html), [*aliases watch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserAliaseWatchCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserListCall.html), [*make admin*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserMakeAdminCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserPatchCall.html), [*photos delete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserPhotoDeleteCall.html), [*photos get*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserPhotoGetCall.html), [*photos patch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserPhotoPatchCall.html), [*photos update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserPhotoUpdateCall.html), [*undelete*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserUndeleteCall.html), [*update*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserUpdateCall.html) and [*watch*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserWatchCall.html) -* [verification codes](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.VerificationCode.html) - * [*generate*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.VerificationCodeGenerateCall.html), [*invalidate*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.VerificationCodeInvalidateCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.VerificationCodeListCall.html) + * [*buildings delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceBuildingDeleteCall.html), [*buildings get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceBuildingGetCall.html), [*buildings insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceBuildingInsertCall.html), [*buildings list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceBuildingListCall.html), [*buildings patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceBuildingPatchCall.html), [*buildings update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceBuildingUpdateCall.html), [*calendars delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceCalendarDeleteCall.html), [*calendars get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceCalendarGetCall.html), [*calendars insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceCalendarInsertCall.html), [*calendars list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceCalendarListCall.html), [*calendars patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceCalendarPatchCall.html), [*calendars update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceCalendarUpdateCall.html), [*features delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceFeatureDeleteCall.html), [*features get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceFeatureGetCall.html), [*features insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceFeatureInsertCall.html), [*features list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceFeatureListCall.html), [*features patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceFeaturePatchCall.html), [*features rename*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceFeatureRenameCall.html) and [*features update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.ResourceFeatureUpdateCall.html) +* [role assignments](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RoleAssignment.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RoleAssignmentDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RoleAssignmentGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RoleAssignmentInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RoleAssignmentListCall.html) +* [roles](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Role.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RoleDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RoleGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RoleInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RoleListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RolePatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.RoleUpdateCall.html) +* [schemas](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Schema.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.SchemaDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.SchemaGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.SchemaInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.SchemaListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.SchemaPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.SchemaUpdateCall.html) +* [tokens](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Token.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.TokenDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.TokenGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.TokenListCall.html) +* [users](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.User.html) + * [*aliases delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserAliaseDeleteCall.html), [*aliases insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserAliaseInsertCall.html), [*aliases list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserAliaseListCall.html), [*aliases watch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserAliaseWatchCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserListCall.html), [*make admin*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserMakeAdminCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserPatchCall.html), [*photos delete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserPhotoDeleteCall.html), [*photos get*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserPhotoGetCall.html), [*photos patch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserPhotoPatchCall.html), [*photos update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserPhotoUpdateCall.html), [*undelete*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserUndeleteCall.html), [*update*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserUpdateCall.html) and [*watch*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserWatchCall.html) +* [verification codes](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.VerificationCode.html) + * [*generate*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.VerificationCodeGenerateCall.html), [*invalidate*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.VerificationCodeInvalidateCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.VerificationCodeListCall.html) Subscription supported by ... -* [*list users*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserListCall.html) -* [*aliases watch users*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserAliaseWatchCall.html) -* [*watch users*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserWatchCall.html) -* [*aliases list users*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.UserAliaseListCall.html) -* [*aliases list groups*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.GroupAliaseListCall.html) +* [*list users*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserListCall.html) +* [*aliases watch users*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserAliaseWatchCall.html) +* [*watch users*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserWatchCall.html) +* [*aliases list users*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.UserAliaseListCall.html) +* [*aliases list groups*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.GroupAliaseListCall.html) @@ -69,17 +69,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/struct.Directory.html)** +* **[Hub](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/struct.Directory.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.Part.html)** + * **[Parts](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -204,17 +204,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -224,29 +224,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.RequestValue.html) and -[decodable](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.RequestValue.html) and +[decodable](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-admin1_directory/1.0.8+20180917/google_admin1_directory/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-admin1_directory/1.0.8+20190214/google_admin1_directory/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/admin1_directory/src/lib.rs b/gen/admin1_directory/src/lib.rs index b8f17faf09..2f60510001 100644 --- a/gen/admin1_directory/src/lib.rs +++ b/gen/admin1_directory/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *directory* crate version *1.0.8+20180917*, where *20180917* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *directory* crate version *1.0.8+20190214*, where *20190214* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *directory* *v1_directory* API can be found at the //! [official documentation site](https://developers.google.com/admin-sdk/directory/). @@ -1391,21 +1391,23 @@ impl Part for ChromeOsDeviceDiskVolumeReportsVolumeInfo {} pub struct Building { /// Kind of resource this is. pub kind: Option, + /// The building name as seen by users in Calendar. Must be unique for the customer. For example, "NYC-CHEL". The maximum length is 100 characters. + #[serde(rename="buildingName")] + pub building_name: Option, + /// The geographic coordinates of the center of the building, expressed as latitude and longitude in decimal degrees. + pub coordinates: Option, /// ETag of the resource. pub etags: Option, - /// A brief description of the building. For example, "Chelsea Market". - pub description: Option, + /// The postal address of the building. See PostalAddress for details. Note that only a single address line and region code are required. + pub address: Option, /// The display names for all floors in this building. The floors are expected to be sorted in ascending order, from lowest floor to highest floor. For example, ["B2", "B1", "L", "1", "2", "2M", "3", "PH"] Must contain at least one entry. #[serde(rename="floorNames")] pub floor_names: Option>, /// Unique identifier for the building. The maximum length is 100 characters. #[serde(rename="buildingId")] pub building_id: Option, - /// The geographic coordinates of the center of the building, expressed as latitude and longitude in decimal degrees. - pub coordinates: Option, - /// The building name as seen by users in Calendar. Must be unique for the customer. For example, "NYC-CHEL". The maximum length is 100 characters. - #[serde(rename="buildingName")] - pub building_name: Option, + /// A brief description of the building. For example, "Chelsea Market". + pub description: Option, } impl RequestValue for Building {} @@ -1682,26 +1684,34 @@ pub struct Features { impl ResponseResult for Features {} -/// JSON response template to list Domains in Directory API. +/// JSON template for the postal address of a building in Directory API. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list domains](struct.DomainListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Domains2 { - /// List of domain objects. - pub domains: Option>, - /// Kind of resource this is. - pub kind: Option, - /// ETag of the resource. - pub etag: Option, +pub struct BuildingAddress { + /// Optional. BCP-47 language code of the contents of this address (if known). + #[serde(rename="languageCode")] + pub language_code: Option, + /// Optional. Highest administrative subdivision which is used for postal addresses of a country or region. + #[serde(rename="administrativeArea")] + pub administrative_area: Option, + /// Required. CLDR region code of the country/region of the address. + #[serde(rename="regionCode")] + pub region_code: Option, + /// Optional. Generally refers to the city/town portion of the address. Examples: US city, IT comune, UK post town. In regions of the world where localities are not well defined or do not fit into this structure well, leave locality empty and use addressLines. + pub locality: Option, + /// Optional. Postal code of the address. + #[serde(rename="postalCode")] + pub postal_code: Option, + /// Optional. Sublocality of the address. + pub sublocality: Option, + /// Unstructured address lines describing the lower levels of an address. + #[serde(rename="addressLines")] + pub address_lines: Option>, } -impl ResponseResult for Domains2 {} +impl Part for BuildingAddress {} /// JSON template for token resource in Directory API. @@ -1743,6 +1753,28 @@ impl Resource for Token {} impl ResponseResult for Token {} +/// JSON response template to list Domains in Directory API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list domains](struct.DomainListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Domains2 { + /// List of domain objects. + pub domains: Option>, + /// Kind of resource this is. + pub kind: Option, + /// ETag of the resource. + pub etag: Option, +} + +impl ResponseResult for Domains2 {} + + /// JSON template for Trusted Apps response object of a user in Directory API. /// /// # Activities @@ -2037,6 +2069,35 @@ pub struct MembersHasMember { impl ResponseResult for MembersHasMember {} +/// JSON template for Alias object in Directory API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [aliases insert users](struct.UserAliaseInsertCall.html) (request|response) +/// * [aliases insert groups](struct.GroupAliaseInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Alias { + /// A alias email + pub alias: Option, + /// Kind of resource this is. + pub kind: Option, + /// ETag of the resource. + pub etag: Option, + /// Group's primary email (Read-only) User's primary email (Read-only) + #[serde(rename="primaryEmail")] + pub primary_email: Option, + /// Unique id of the group (Read-only) Unique id of the user (Read-only) + pub id: Option, +} + +impl RequestValue for Alias {} +impl ResponseResult for Alias {} + + /// Indexing spec for a numeric field. By default, only exact match queries will be supported for numeric fields. Setting the numericIndexingSpec allows range queries to be supported. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -2530,35 +2591,6 @@ pub struct UserUndelete { impl RequestValue for UserUndelete {} -/// JSON template for Alias object in Directory API. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [aliases insert users](struct.UserAliaseInsertCall.html) (request|response) -/// * [aliases insert groups](struct.GroupAliaseInsertCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Alias { - /// A alias email - pub alias: Option, - /// Kind of resource this is. - pub kind: Option, - /// ETag of the resource. - pub etag: Option, - /// Group's primary email (Read-only) User's primary email (Read-only) - #[serde(rename="primaryEmail")] - pub primary_email: Option, - /// Unique id of the group (Read-only) Unique id of the user (Read-only) - pub id: Option, -} - -impl RequestValue for Alias {} -impl ResponseResult for Alias {} - - /// The set of privileges that are granted to this role. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -5182,6 +5214,7 @@ impl<'a, C, A> ResourceMethods<'a, C, A> { _request: request, _customer: customer.to_string(), _building_id: building_id.to_string(), + _coordinates_source: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5260,6 +5293,7 @@ impl<'a, C, A> ResourceMethods<'a, C, A> { _request: request, _customer: customer.to_string(), _building_id: building_id.to_string(), + _coordinates_source: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5416,6 +5450,7 @@ impl<'a, C, A> ResourceMethods<'a, C, A> { hub: self.hub, _request: request, _customer: customer.to_string(), + _coordinates_source: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5966,10 +6001,7 @@ impl<'a, C, A> VerificationCodeGenerateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5989,7 +6021,7 @@ impl<'a, C, A> VerificationCodeGenerateCall<'a, C, A> where C: BorrowMut VerificationCodeGenerateCall<'a, C, A> where C: BorrowMut VerificationCodeInvalidateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6221,7 +6250,7 @@ impl<'a, C, A> VerificationCodeInvalidateCall<'a, C, A> where C: BorrowMut VerificationCodeInvalidateCall<'a, C, A> where C: BorrowMut VerificationCodeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6454,7 +6480,7 @@ impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut VerificationCodeListCall<'a, C, A> where C: BorrowMut CustomerPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6716,7 +6739,7 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6806,7 +6829,7 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6948,10 +6971,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6971,7 +6991,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7049,7 +7069,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7198,10 +7218,7 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7233,7 +7250,7 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7323,7 +7340,7 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7475,10 +7492,7 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7498,7 +7512,7 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7590,7 +7604,7 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7739,10 +7753,7 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7774,7 +7785,7 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7864,7 +7875,7 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8019,10 +8030,7 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8054,7 +8062,7 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8155,7 +8163,7 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8303,10 +8311,7 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8326,7 +8331,7 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8415,7 +8420,7 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8562,10 +8567,7 @@ impl<'a, C, A> OrgunitDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8585,7 +8587,7 @@ impl<'a, C, A> OrgunitDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8664,7 +8666,7 @@ impl<'a, C, A> OrgunitDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8819,10 +8821,7 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8854,7 +8853,7 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8955,7 +8954,7 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9096,10 +9095,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9119,7 +9115,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9187,7 +9183,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9346,10 +9342,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9369,7 +9362,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9493,7 +9486,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9642,10 +9635,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9677,7 +9667,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9767,7 +9757,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9893,10 +9883,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9928,7 +9915,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10008,7 +9995,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10157,10 +10144,7 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10192,7 +10176,7 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10282,7 +10266,7 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10424,10 +10408,7 @@ impl<'a, C, A> GroupAliaseListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10447,7 +10428,7 @@ impl<'a, C, A> GroupAliaseListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10525,7 +10506,7 @@ impl<'a, C, A> GroupAliaseListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10667,10 +10648,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10690,7 +10668,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10768,7 +10746,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10917,10 +10895,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10952,7 +10927,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11042,7 +11017,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11185,10 +11160,7 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11208,7 +11180,7 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11286,7 +11258,7 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11437,10 +11409,7 @@ impl<'a, C, A> RoleUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11472,7 +11441,7 @@ impl<'a, C, A> RoleUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11572,7 +11541,7 @@ impl<'a, C, A> RoleUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11716,10 +11685,7 @@ impl<'a, C, A> RoleGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11739,7 +11705,7 @@ impl<'a, C, A> RoleGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11827,7 +11793,7 @@ impl<'a, C, A> RoleGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11970,10 +11936,7 @@ impl<'a, C, A> RoleDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11993,7 +11956,7 @@ impl<'a, C, A> RoleDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12071,7 +12034,7 @@ impl<'a, C, A> RoleDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12222,10 +12185,7 @@ impl<'a, C, A> RolePatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12257,7 +12217,7 @@ impl<'a, C, A> RolePatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12357,7 +12317,7 @@ impl<'a, C, A> RolePatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12506,10 +12466,7 @@ impl<'a, C, A> RoleInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12541,7 +12498,7 @@ impl<'a, C, A> RoleInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12631,7 +12588,7 @@ impl<'a, C, A> RoleInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12783,10 +12740,7 @@ impl<'a, C, A> RoleListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12806,7 +12760,7 @@ impl<'a, C, A> RoleListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12898,7 +12852,7 @@ impl<'a, C, A> RoleListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13055,10 +13009,7 @@ impl<'a, C, A> NotificationListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13078,7 +13029,7 @@ impl<'a, C, A> NotificationListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13177,7 +13128,7 @@ impl<'a, C, A> NotificationListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13328,10 +13279,7 @@ impl<'a, C, A> NotificationUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13363,7 +13311,7 @@ impl<'a, C, A> NotificationUpdateCall<'a, C, A> where C: BorrowMut NotificationUpdateCall<'a, C, A> where C: BorrowMut NotificationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13629,7 +13574,7 @@ impl<'a, C, A> NotificationDeleteCall<'a, C, A> where C: BorrowMut NotificationDeleteCall<'a, C, A> where C: BorrowMut NotificationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13874,7 +13816,7 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13962,7 +13904,7 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14113,10 +14055,7 @@ impl<'a, C, A> NotificationPatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14148,7 +14087,7 @@ impl<'a, C, A> NotificationPatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14248,7 +14187,7 @@ impl<'a, C, A> NotificationPatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14390,10 +14329,7 @@ impl<'a, C, A> PrivilegeListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14413,7 +14349,7 @@ impl<'a, C, A> PrivilegeListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14491,7 +14427,7 @@ impl<'a, C, A> PrivilegeListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14618,17 +14554,14 @@ impl<'a, C, A> ResolvedAppAccessSettingGetSettingCall<'a, C, A> where C: BorrowM } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -14695,7 +14628,7 @@ impl<'a, C, A> ResolvedAppAccessSettingGetSettingCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14799,17 +14732,14 @@ impl<'a, C, A> ResolvedAppAccessSettingListTrustedAppCall<'a, C, A> where C: Bor } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -14876,7 +14806,7 @@ impl<'a, C, A> ResolvedAppAccessSettingListTrustedAppCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15002,10 +14932,7 @@ impl<'a, C, A> MobiledeviceGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15025,7 +14952,7 @@ impl<'a, C, A> MobiledeviceGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15120,7 +15047,7 @@ impl<'a, C, A> MobiledeviceGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15292,10 +15219,7 @@ impl<'a, C, A> MobiledeviceListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15315,7 +15239,7 @@ impl<'a, C, A> MobiledeviceListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15435,7 +15359,7 @@ impl<'a, C, A> MobiledeviceListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15578,10 +15502,7 @@ impl<'a, C, A> MobiledeviceDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15601,7 +15522,7 @@ impl<'a, C, A> MobiledeviceDeleteCall<'a, C, A> where C: BorrowMut MobiledeviceDeleteCall<'a, C, A> where C: BorrowMut MobiledeviceActionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15864,7 +15782,7 @@ impl<'a, C, A> MobiledeviceActionCall<'a, C, A> where C: BorrowMut MobiledeviceActionCall<'a, C, A> where C: BorrowMut ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16114,7 +16029,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16184,7 +16099,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16328,10 +16243,7 @@ impl<'a, C, A> TokenGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16351,7 +16263,7 @@ impl<'a, C, A> TokenGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16439,7 +16351,7 @@ impl<'a, C, A> TokenGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16581,10 +16493,7 @@ impl<'a, C, A> TokenListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16604,7 +16513,7 @@ impl<'a, C, A> TokenListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16682,7 +16591,7 @@ impl<'a, C, A> TokenListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16825,10 +16734,7 @@ impl<'a, C, A> TokenDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16848,7 +16754,7 @@ impl<'a, C, A> TokenDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16926,7 +16832,7 @@ impl<'a, C, A> TokenDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17075,10 +16981,7 @@ impl<'a, C, A> RoleAssignmentInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17110,7 +17013,7 @@ impl<'a, C, A> RoleAssignmentInsertCall<'a, C, A> where C: BorrowMut RoleAssignmentInsertCall<'a, C, A> where C: BorrowMut RoleAssignmentGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17367,7 +17267,7 @@ impl<'a, C, A> RoleAssignmentGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17455,7 +17355,7 @@ impl<'a, C, A> RoleAssignmentGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17598,10 +17498,7 @@ impl<'a, C, A> RoleAssignmentDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17621,7 +17518,7 @@ impl<'a, C, A> RoleAssignmentDeleteCall<'a, C, A> where C: BorrowMut RoleAssignmentDeleteCall<'a, C, A> where C: BorrowMut RoleAssignmentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17884,7 +17778,7 @@ impl<'a, C, A> RoleAssignmentListCall<'a, C, A> where C: BorrowMut RoleAssignmentListCall<'a, C, A> where C: BorrowMut ChromeosdeviceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18190,7 +18081,7 @@ impl<'a, C, A> ChromeosdeviceListCall<'a, C, A> where C: BorrowMut ChromeosdeviceListCall<'a, C, A> where C: BorrowMut ChromeosdevicePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18508,7 +18396,7 @@ impl<'a, C, A> ChromeosdevicePatchCall<'a, C, A> where C: BorrowMut ChromeosdevicePatchCall<'a, C, A> where C: BorrowMut ChromeosdeviceUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18806,7 +18691,7 @@ impl<'a, C, A> ChromeosdeviceUpdateCall<'a, C, A> where C: BorrowMut ChromeosdeviceUpdateCall<'a, C, A> where C: BorrowMut ChromeosdeviceGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19085,7 +18967,7 @@ impl<'a, C, A> ChromeosdeviceGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19180,7 +19062,7 @@ impl<'a, C, A> ChromeosdeviceGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19330,10 +19212,7 @@ impl<'a, C, A> ChromeosdeviceActionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19365,7 +19244,7 @@ impl<'a, C, A> ChromeosdeviceActionCall<'a, C, A> where C: BorrowMut ChromeosdeviceActionCall<'a, C, A> where C: BorrowMut ChromeosdeviceMoveDevicesToOuCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19640,7 +19516,7 @@ impl<'a, C, A> ChromeosdeviceMoveDevicesToOuCall<'a, C, A> where C: BorrowMut ChromeosdeviceMoveDevicesToOuCall<'a, C, A> where C: BorrowMut MemberHasMemberCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19897,7 +19770,7 @@ impl<'a, C, A> MemberHasMemberCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19985,7 +19858,7 @@ impl<'a, C, A> MemberHasMemberCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20134,10 +20007,7 @@ impl<'a, C, A> MemberInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20169,7 +20039,7 @@ impl<'a, C, A> MemberInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20259,7 +20129,7 @@ impl<'a, C, A> MemberInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20410,10 +20280,7 @@ impl<'a, C, A> MemberPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20445,7 +20312,7 @@ impl<'a, C, A> MemberPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20545,7 +20412,7 @@ impl<'a, C, A> MemberPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20696,10 +20563,7 @@ impl<'a, C, A> MemberUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20731,7 +20595,7 @@ impl<'a, C, A> MemberUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20831,7 +20695,7 @@ impl<'a, C, A> MemberUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20993,10 +20857,7 @@ impl<'a, C, A> MemberListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21016,7 +20877,7 @@ impl<'a, C, A> MemberListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21122,7 +20983,7 @@ impl<'a, C, A> MemberListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21266,10 +21127,7 @@ impl<'a, C, A> MemberGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21289,7 +21147,7 @@ impl<'a, C, A> MemberGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21377,7 +21235,7 @@ impl<'a, C, A> MemberGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21520,10 +21378,7 @@ impl<'a, C, A> MemberDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21543,7 +21398,7 @@ impl<'a, C, A> MemberDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21621,7 +21476,7 @@ impl<'a, C, A> MemberDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21765,10 +21620,7 @@ impl<'a, C, A> AspGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21788,7 +21640,7 @@ impl<'a, C, A> AspGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21876,7 +21728,7 @@ impl<'a, C, A> AspGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22019,10 +21871,7 @@ impl<'a, C, A> AspDeleteCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22042,7 +21891,7 @@ impl<'a, C, A> AspDeleteCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22120,7 +21969,7 @@ impl<'a, C, A> AspDeleteCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22262,10 +22111,7 @@ impl<'a, C, A> AspListCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22285,7 +22131,7 @@ impl<'a, C, A> AspListCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22363,7 +22209,7 @@ impl<'a, C, A> AspListCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22505,10 +22351,7 @@ impl<'a, C, A> DomainListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22528,7 +22371,7 @@ impl<'a, C, A> DomainListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22606,7 +22449,7 @@ impl<'a, C, A> DomainListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22750,10 +22593,7 @@ impl<'a, C, A> DomainGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22773,7 +22613,7 @@ impl<'a, C, A> DomainGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22861,7 +22701,7 @@ impl<'a, C, A> DomainGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23010,10 +22850,7 @@ impl<'a, C, A> DomainInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -23045,7 +22882,7 @@ impl<'a, C, A> DomainInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -23135,7 +22972,7 @@ impl<'a, C, A> DomainInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23278,10 +23115,7 @@ impl<'a, C, A> DomainDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23301,7 +23135,7 @@ impl<'a, C, A> DomainDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23379,7 +23213,7 @@ impl<'a, C, A> DomainDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23528,10 +23362,7 @@ impl<'a, C, A> DomainAliaseInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -23563,7 +23394,7 @@ impl<'a, C, A> DomainAliaseInsertCall<'a, C, A> where C: BorrowMut DomainAliaseInsertCall<'a, C, A> where C: BorrowMut DomainAliaseListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23823,7 +23651,7 @@ impl<'a, C, A> DomainAliaseListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23908,7 +23736,7 @@ impl<'a, C, A> DomainAliaseListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24052,10 +23880,7 @@ impl<'a, C, A> DomainAliaseGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24075,7 +23900,7 @@ impl<'a, C, A> DomainAliaseGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24163,7 +23988,7 @@ impl<'a, C, A> DomainAliaseGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24306,10 +24131,7 @@ impl<'a, C, A> DomainAliaseDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24329,7 +24151,7 @@ impl<'a, C, A> DomainAliaseDeleteCall<'a, C, A> where C: BorrowMut DomainAliaseDeleteCall<'a, C, A> where C: BorrowMut SchemaGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24574,7 +24393,7 @@ impl<'a, C, A> SchemaGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24662,7 +24481,7 @@ impl<'a, C, A> SchemaGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24813,10 +24632,7 @@ impl<'a, C, A> SchemaUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24848,7 +24664,7 @@ impl<'a, C, A> SchemaUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -24948,7 +24764,7 @@ impl<'a, C, A> SchemaUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25090,10 +24906,7 @@ impl<'a, C, A> SchemaListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25113,7 +24926,7 @@ impl<'a, C, A> SchemaListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -25191,7 +25004,7 @@ impl<'a, C, A> SchemaListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25342,10 +25155,7 @@ impl<'a, C, A> SchemaPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25377,7 +25187,7 @@ impl<'a, C, A> SchemaPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25477,7 +25287,7 @@ impl<'a, C, A> SchemaPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25626,10 +25436,7 @@ impl<'a, C, A> SchemaInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25661,7 +25468,7 @@ impl<'a, C, A> SchemaInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25751,7 +25558,7 @@ impl<'a, C, A> SchemaInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25894,10 +25701,7 @@ impl<'a, C, A> SchemaDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25917,7 +25721,7 @@ impl<'a, C, A> SchemaDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -25995,7 +25799,7 @@ impl<'a, C, A> SchemaDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26157,10 +25961,7 @@ impl<'a, C, A> ResourceCalendarListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26180,7 +25981,7 @@ impl<'a, C, A> ResourceCalendarListCall<'a, C, A> where C: BorrowMut ResourceCalendarListCall<'a, C, A> where C: BorrowMut ResourceFeatureRenameCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -26471,7 +26269,7 @@ impl<'a, C, A> ResourceFeatureRenameCall<'a, C, A> where C: BorrowMut ResourceFeatureRenameCall<'a, C, A> where C: BorrowMut ResourceFeatureInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -26745,7 +26540,7 @@ impl<'a, C, A> ResourceFeatureInsertCall<'a, C, A> where C: BorrowMut ResourceFeatureInsertCall<'a, C, A> where C: BorrowMut ResourceFeatureInsertCall<'a, C, A> where C: BorrowMut _request: Building, _customer: String, _building_id: String, + _coordinates_source: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -26944,10 +26741,13 @@ impl<'a, C, A> ResourceBuildingUpdateCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(5 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); params.push(("customer", self._customer.to_string())); params.push(("buildingId", self._building_id.to_string())); - for &field in ["alt", "customer", "buildingId"].iter() { + if let Some(value) = self._coordinates_source { + params.push(("coordinatesSource", value.to_string())); + } + for &field in ["alt", "customer", "buildingId", "coordinatesSource"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -26986,10 +26786,7 @@ impl<'a, C, A> ResourceBuildingUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27021,7 +26818,7 @@ impl<'a, C, A> ResourceBuildingUpdateCall<'a, C, A> where C: BorrowMut ResourceBuildingUpdateCall<'a, C, A> where C: BorrowMut ResourceBuildingUpdateCall<'a, C, A> { + self._coordinates_source = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -27121,7 +26925,7 @@ impl<'a, C, A> ResourceBuildingUpdateCall<'a, C, A> where C: BorrowMut ResourceBuildingDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -27287,7 +27088,7 @@ impl<'a, C, A> ResourceBuildingDeleteCall<'a, C, A> where C: BorrowMut ResourceBuildingDeleteCall<'a, C, A> where C: BorrowMut ResourceBuildingDeleteCall<'a, C, A> where C: BorrowMut ResourceFeatureListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -27540,7 +27338,7 @@ impl<'a, C, A> ResourceFeatureListCall<'a, C, A> where C: BorrowMut ResourceFeatureListCall<'a, C, A> where C: BorrowMut ResourceCalendarGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -27799,7 +27594,7 @@ impl<'a, C, A> ResourceCalendarGetCall<'a, C, A> where C: BorrowMut ResourceCalendarGetCall<'a, C, A> where C: BorrowMut ResourceCalendarGetCall<'a, C, A> where C: BorrowMut _request: Building, _customer: String, _building_id: String, + _coordinates_source: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -27996,10 +27793,13 @@ impl<'a, C, A> ResourceBuildingPatchCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(5 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); params.push(("customer", self._customer.to_string())); params.push(("buildingId", self._building_id.to_string())); - for &field in ["alt", "customer", "buildingId"].iter() { + if let Some(value) = self._coordinates_source { + params.push(("coordinatesSource", value.to_string())); + } + for &field in ["alt", "customer", "buildingId", "coordinatesSource"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -28038,10 +27838,7 @@ impl<'a, C, A> ResourceBuildingPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28073,7 +27870,7 @@ impl<'a, C, A> ResourceBuildingPatchCall<'a, C, A> where C: BorrowMut ResourceBuildingPatchCall<'a, C, A> where C: BorrowMut ResourceBuildingPatchCall<'a, C, A> { + self._coordinates_source = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -28173,7 +27977,7 @@ impl<'a, C, A> ResourceBuildingPatchCall<'a, C, A> where C: BorrowMut ResourceBuildingPatchCall<'a, C, A> where C: BorrowMut ResourceBuildingListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28348,7 +28149,7 @@ impl<'a, C, A> ResourceBuildingListCall<'a, C, A> where C: BorrowMut ResourceBuildingListCall<'a, C, A> where C: BorrowMut ResourceFeatureGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28607,7 +28405,7 @@ impl<'a, C, A> ResourceFeatureGetCall<'a, C, A> where C: BorrowMut ResourceFeatureGetCall<'a, C, A> where C: BorrowMut ResourceCalendarInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28879,7 +28674,7 @@ impl<'a, C, A> ResourceCalendarInsertCall<'a, C, A> where C: BorrowMut ResourceCalendarInsertCall<'a, C, A> where C: BorrowMut ResourceFeaturePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29155,7 +28947,7 @@ impl<'a, C, A> ResourceFeaturePatchCall<'a, C, A> where C: BorrowMut ResourceFeaturePatchCall<'a, C, A> where C: BorrowMut ResourceBuildingGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29422,7 +29211,7 @@ impl<'a, C, A> ResourceBuildingGetCall<'a, C, A> where C: BorrowMut ResourceBuildingGetCall<'a, C, A> where C: BorrowMut ResourceFeatureDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29676,7 +29462,7 @@ impl<'a, C, A> ResourceFeatureDeleteCall<'a, C, A> where C: BorrowMut ResourceFeatureDeleteCall<'a, C, A> where C: BorrowMut ResourceFeatureUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29940,7 +29723,7 @@ impl<'a, C, A> ResourceFeatureUpdateCall<'a, C, A> where C: BorrowMut ResourceFeatureUpdateCall<'a, C, A> where C: BorrowMut ResourceFeatureUpdateCall<'a, C, A> where C: BorrowMut hub: &'a Directory, _request: Building, _customer: String, + _coordinates_source: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -30148,9 +29933,12 @@ impl<'a, C, A> ResourceBuildingInsertCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(4 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("customer", self._customer.to_string())); - for &field in ["alt", "customer"].iter() { + if let Some(value) = self._coordinates_source { + params.push(("coordinatesSource", value.to_string())); + } + for &field in ["alt", "customer", "coordinatesSource"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -30189,10 +29977,7 @@ impl<'a, C, A> ResourceBuildingInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30224,7 +30009,7 @@ impl<'a, C, A> ResourceBuildingInsertCall<'a, C, A> where C: BorrowMut ResourceBuildingInsertCall<'a, C, A> where C: BorrowMut ResourceBuildingInsertCall<'a, C, A> { + self._coordinates_source = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -30314,7 +30106,7 @@ impl<'a, C, A> ResourceBuildingInsertCall<'a, C, A> where C: BorrowMut ResourceCalendarPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30502,7 +30291,7 @@ impl<'a, C, A> ResourceCalendarPatchCall<'a, C, A> where C: BorrowMut ResourceCalendarPatchCall<'a, C, A> where C: BorrowMut ResourceCalendarUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30790,7 +30576,7 @@ impl<'a, C, A> ResourceCalendarUpdateCall<'a, C, A> where C: BorrowMut ResourceCalendarUpdateCall<'a, C, A> where C: BorrowMut ResourceCalendarDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31056,7 +30839,7 @@ impl<'a, C, A> ResourceCalendarDeleteCall<'a, C, A> where C: BorrowMut ResourceCalendarDeleteCall<'a, C, A> where C: BorrowMut UserUndeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -31317,7 +31097,7 @@ impl<'a, C, A> UserUndeleteCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -31397,7 +31177,7 @@ impl<'a, C, A> UserUndeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31538,10 +31318,7 @@ impl<'a, C, A> UserPhotoDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31561,7 +31338,7 @@ impl<'a, C, A> UserPhotoDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31629,7 +31406,7 @@ impl<'a, C, A> UserPhotoDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31778,10 +31555,7 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -31813,7 +31587,7 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -31903,7 +31677,7 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32029,10 +31803,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32064,7 +31835,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -32144,7 +31915,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32293,10 +32064,7 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32328,7 +32096,7 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -32418,7 +32186,7 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32496,18 +32264,18 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().watch(req) -/// .view_type("consetetur") -/// .sort_order("vero") -/// .show_deleted("consetetur") -/// .query("eos") -/// .projection("justo") -/// .page_token("tempor") -/// .order_by("gubergren") -/// .max_results(-84) -/// .event("amet.") -/// .domain("dolore") -/// .customer("magna") -/// .custom_field_mask("elitr") +/// .view_type("eos") +/// .sort_order("justo") +/// .show_deleted("tempor") +/// .query("gubergren") +/// .projection("dolore") +/// .page_token("amet.") +/// .order_by("dolore") +/// .max_results(-83) +/// .event("elitr") +/// .domain("magna") +/// .customer("ipsum") +/// .custom_field_mask("invidunt") /// .doit(); /// # } /// ``` @@ -32604,10 +32372,7 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32639,7 +32404,7 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -32803,7 +32568,7 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32952,10 +32717,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32987,7 +32749,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -33077,7 +32839,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33219,10 +32981,7 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33242,7 +33001,7 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -33320,7 +33079,7 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33392,18 +33151,18 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().list() -/// .view_type("invidunt") -/// .sort_order("accusam") -/// .show_deleted("labore") +/// .view_type("diam") +/// .sort_order("nonumy") +/// .show_deleted("sed") /// .query("diam") -/// .projection("nonumy") -/// .page_token("sed") -/// .order_by("diam") -/// .max_results(-83) -/// .event("dolor") -/// .domain("Lorem") -/// .customer("dolor") -/// .custom_field_mask("vero") +/// .projection("magna") +/// .page_token("dolor") +/// .order_by("Lorem") +/// .max_results(-49) +/// .event("vero") +/// .domain("nonumy") +/// .customer("takimata") +/// .custom_field_mask("dolores") /// .doit(); /// # } /// ``` @@ -33499,10 +33258,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33522,7 +33278,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -33674,7 +33430,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33746,9 +33502,9 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().get("userKey") -/// .view_type("takimata") -/// .projection("dolores") -/// .custom_field_mask("consetetur") +/// .view_type("erat") +/// .projection("amet.") +/// .custom_field_mask("dolores") /// .doit(); /// # } /// ``` @@ -33831,10 +33587,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33854,7 +33607,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -33953,7 +33706,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34102,10 +33855,7 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34137,7 +33887,7 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -34227,7 +33977,7 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34299,7 +34049,7 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().aliases_list("userKey") -/// .event("dolores") +/// .event("sed") /// .doit(); /// # } /// ``` @@ -34374,10 +34124,7 @@ impl<'a, C, A> UserAliaseListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34397,7 +34144,7 @@ impl<'a, C, A> UserAliaseListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -34482,7 +34229,7 @@ impl<'a, C, A> UserAliaseListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34630,10 +34377,7 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34665,7 +34409,7 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -34745,7 +34489,7 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34894,10 +34638,7 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34929,7 +34670,7 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -35019,7 +34760,7 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -35162,10 +34903,7 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35185,7 +34923,7 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -35263,7 +35001,7 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -35341,7 +35079,7 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().aliases_watch(req, "userKey") -/// .event("nonumy") +/// .event("sadipscing") /// .doit(); /// # } /// ``` @@ -35417,10 +35155,7 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -35452,7 +35187,7 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -35549,7 +35284,7 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -35690,10 +35425,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35713,7 +35445,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -35781,7 +35513,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/admin1_reports-cli/Cargo.toml b/gen/admin1_reports-cli/Cargo.toml index 8c0afc3971..227c42636a 100644 --- a/gen/admin1_reports-cli/Cargo.toml +++ b/gen/admin1_reports-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-admin1_reports-cli" -version = "1.0.8+20180806" +version = "1.0.8+20190210" authors = ["Sebastian Thiel "] description = "A complete library to interact with reports (protocol reports_v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_reports-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-admin1_reports] path = "../admin1_reports" -version = "1.0.8+20180806" +version = "1.0.8+20190210" diff --git a/gen/admin1_reports-cli/README.md b/gen/admin1_reports-cli/README.md index b6b92cda1c..3a95b03e5c 100644 --- a/gen/admin1_reports-cli/README.md +++ b/gen/admin1_reports-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *reports* API at revision *20180806*. The CLI is at version *1.0.8*. +This documentation was generated from the *reports* API at revision *20190210*. The CLI is at version *1.0.8*. ```bash admin1-reports [options] diff --git a/gen/admin1_reports-cli/mkdocs.yml b/gen/admin1_reports-cli/mkdocs.yml index 4d3acb026b..6c84391ff9 100644 --- a/gen/admin1_reports-cli/mkdocs.yml +++ b/gen/admin1_reports-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: reports v1.0.8+20180806 +site_name: reports v1.0.8+20190210 site_url: http://byron.github.io/google-apis-rs/google-admin1_reports-cli site_description: A complete library to interact with reports (protocol reports_v1) diff --git a/gen/admin1_reports-cli/src/main.rs b/gen/admin1_reports-cli/src/main.rs index f5dfa96892..ffefe93d30 100644 --- a/gen/admin1_reports-cli/src/main.rs +++ b/gen/admin1_reports-cli/src/main.rs @@ -58,6 +58,9 @@ impl<'n> Engine<'n> { "page-token" => { call = call.page_token(value.unwrap_or("")); }, + "org-unit-id" => { + call = call.org_unit_id(value.unwrap_or("")); + }, "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, @@ -89,7 +92,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["start-time", "actor-ip-address", "max-results", "event-name", "page-token", "filters", "end-time", "customer-id"].iter().map(|v|*v)); + v.extend(["start-time", "actor-ip-address", "max-results", "event-name", "page-token", "filters", "end-time", "customer-id", "org-unit-id"].iter().map(|v|*v)); v } )); } } @@ -177,6 +180,9 @@ impl<'n> Engine<'n> { "page-token" => { call = call.page_token(value.unwrap_or("")); }, + "org-unit-id" => { + call = call.org_unit_id(value.unwrap_or("")); + }, "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, @@ -208,7 +214,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["start-time", "actor-ip-address", "max-results", "event-name", "page-token", "filters", "end-time", "customer-id"].iter().map(|v|*v)); + v.extend(["start-time", "actor-ip-address", "max-results", "event-name", "page-token", "filters", "end-time", "customer-id", "org-unit-id"].iter().map(|v|*v)); v } )); } } @@ -470,6 +476,9 @@ impl<'n> Engine<'n> { "page-token" => { call = call.page_token(value.unwrap_or("")); }, + "org-unit-id" => { + call = call.org_unit_id(value.unwrap_or("")); + }, "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, @@ -492,7 +501,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "filters", "max-results", "parameters", "customer-id"].iter().map(|v|*v)); + v.extend(["parameters", "max-results", "page-token", "filters", "customer-id", "org-unit-id"].iter().map(|v|*v)); v } )); } } @@ -852,7 +861,7 @@ fn main() { let mut app = App::new("admin1-reports") .author("Sebastian Thiel ") - .version("1.0.8+20180806") + .version("1.0.8+20190210") .about("Fetches reports for the administrators of G Suite customers about the usage, collaboration, security, and risk for their users.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_admin1_reports_cli") .arg(Arg::with_name("url") diff --git a/gen/admin1_reports/Cargo.toml b/gen/admin1_reports/Cargo.toml index e650d532dd..9eb6ee0503 100644 --- a/gen/admin1_reports/Cargo.toml +++ b/gen/admin1_reports/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-admin1_reports" -version = "1.0.8+20180806" +version = "1.0.8+20190210" authors = ["Sebastian Thiel "] description = "A complete library to interact with reports (protocol reports_v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_reports" homepage = "https://developers.google.com/admin-sdk/reports/" -documentation = "https://docs.rs/google-admin1_reports/1.0.8+20180806" +documentation = "https://docs.rs/google-admin1_reports/1.0.8+20190210" license = "MIT" keywords = ["admin", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/admin1_reports/README.md b/gen/admin1_reports/README.md index f0dfed09c1..ac0cbf2a4e 100644 --- a/gen/admin1_reports/README.md +++ b/gen/admin1_reports/README.md @@ -5,30 +5,30 @@ DO NOT EDIT ! --> The `google-admin1_reports` library allows access to all features of the *Google reports* service. -This documentation was generated from *reports* crate version *1.0.8+20180806*, where *20180806* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *reports* crate version *1.0.8+20190210*, where *20190210* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *reports* *v1_reports* API can be found at the [official documentation site](https://developers.google.com/admin-sdk/reports/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.Reports.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.Reports.html) ... -* [activities](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.Activity.html) - * [*list*](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.ActivityListCall.html) and [*watch*](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.ActivityWatchCall.html) -* [channels](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.Channel.html) - * [*stop*](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.ChannelStopCall.html) +* [activities](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.Activity.html) + * [*list*](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.ActivityListCall.html) and [*watch*](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.ActivityWatchCall.html) +* [channels](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.Channel.html) + * [*stop*](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.ChannelStopCall.html) * customer usage reports - * [*get*](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.CustomerUsageReportGetCall.html) + * [*get*](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.CustomerUsageReportGetCall.html) * entity usage reports - * [*get*](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.EntityUsageReportGetCall.html) + * [*get*](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.EntityUsageReportGetCall.html) * user usage report - * [*get*](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.UserUsageReportGetCall.html) + * [*get*](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.UserUsageReportGetCall.html) Subscription supported by ... -* [*list activities*](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.ActivityListCall.html) -* [*watch activities*](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.ActivityWatchCall.html) +* [*list activities*](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.ActivityListCall.html) +* [*watch activities*](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.ActivityWatchCall.html) @@ -36,17 +36,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/struct.Reports.html)** +* **[Hub](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/struct.Reports.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.Part.html)** + * **[Parts](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -116,9 +116,10 @@ let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnec // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.entity_usage_reports().get("entityType", "entityKey", "date") - .parameters("sed") - .page_token("et") +let result = hub.user_usage_report().get("userKey", "date") + .parameters("Stet") + .page_token("sed") + .org_unit_id("et") .max_results(83) .filters("kasd") .customer_id("accusam") @@ -144,17 +145,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -164,29 +165,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.RequestValue.html) and -[decodable](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.RequestValue.html) and +[decodable](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-admin1_reports/1.0.8+20180806/google_admin1_reports/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-admin1_reports/1.0.8+20190210/google_admin1_reports/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/admin1_reports/src/lib.rs b/gen/admin1_reports/src/lib.rs index 6383747d4e..d867f308aa 100644 --- a/gen/admin1_reports/src/lib.rs +++ b/gen/admin1_reports/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *reports* crate version *1.0.8+20180806*, where *20180806* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *reports* crate version *1.0.8+20190210*, where *20190210* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *reports* *v1_reports* API can be found at the //! [official documentation site](https://developers.google.com/admin-sdk/reports/). @@ -117,9 +117,10 @@ //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.entity_usage_reports().get("entityType", "entityKey", "date") -//! .parameters("erat") -//! .page_token("labore") +//! let result = hub.user_usage_report().get("userKey", "date") +//! .parameters("amet.") +//! .page_token("erat") +//! .org_unit_id("labore") //! .max_results(92) //! .filters("nonumy") //! .customer_id("dolores") @@ -305,9 +306,10 @@ impl Default for Scope { /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.entity_usage_reports().get("entityType", "entityKey", "date") -/// .parameters("ea") -/// .page_token("no") +/// let result = hub.user_usage_report().get("userKey", "date") +/// .parameters("aliquyam") +/// .page_token("ea") +/// .org_unit_id("no") /// .max_results(80) /// .filters("justo") /// .customer_id("et") @@ -912,6 +914,7 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { _application_name: application_name.to_string(), _start_time: Default::default(), _page_token: Default::default(), + _org_unit_id: Default::default(), _max_results: Default::default(), _filters: Default::default(), _event_name: Default::default(), @@ -941,6 +944,7 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { _application_name: application_name.to_string(), _start_time: Default::default(), _page_token: Default::default(), + _org_unit_id: Default::default(), _max_results: Default::default(), _filters: Default::default(), _event_name: Default::default(), @@ -1072,6 +1076,7 @@ impl<'a, C, A> UserUsageReportMethods<'a, C, A> { _date: date.to_string(), _parameters: Default::default(), _page_token: Default::default(), + _org_unit_id: Default::default(), _max_results: Default::default(), _filters: Default::default(), _customer_id: Default::default(), @@ -1171,10 +1176,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1206,7 +1208,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1276,7 +1278,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1447,10 +1449,7 @@ impl<'a, C, A> EntityUsageReportGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1470,7 +1469,7 @@ impl<'a, C, A> EntityUsageReportGetCall<'a, C, A> where C: BorrowMut EntityUsageReportGetCall<'a, C, A> where C: BorrowMut EntityUsageReportGetCall<'a, C, A> where C: BorrowMut _application_name: String, _start_time: Option, _page_token: Option, + _org_unit_id: Option, _max_results: Option, _filters: Option, _event_name: Option, @@ -1721,7 +1722,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: }; dlg.begin(MethodInfo { id: "reports.activities.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(12 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(13 + self._additional_params.len()); params.push(("userKey", self._user_key.to_string())); params.push(("applicationName", self._application_name.to_string())); if let Some(value) = self._start_time { @@ -1730,6 +1731,9 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); } + if let Some(value) = self._org_unit_id { + params.push(("orgUnitID", value.to_string())); + } if let Some(value) = self._max_results { params.push(("maxResults", value.to_string())); } @@ -1748,7 +1752,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: if let Some(value) = self._actor_ip_address { params.push(("actorIpAddress", value.to_string())); } - for &field in ["alt", "userKey", "applicationName", "startTime", "pageToken", "maxResults", "filters", "eventName", "endTime", "customerId", "actorIpAddress"].iter() { + for &field in ["alt", "userKey", "applicationName", "startTime", "pageToken", "orgUnitID", "maxResults", "filters", "eventName", "endTime", "customerId", "actorIpAddress"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1787,10 +1791,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1810,7 +1811,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1897,6 +1898,13 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: self._page_token = Some(new_value.to_string()); self } + /// the organizational unit's(OU) ID to filter activities from users belonging to a specific OU or one of its sub-OU(s) + /// + /// Sets the *org unit id* query property to the given value. + pub fn org_unit_id(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { + self._org_unit_id = Some(new_value.to_string()); + self + } /// Number of activity records to be shown in each page. /// /// Sets the *max results* query property to the given value. @@ -1954,7 +1962,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2032,14 +2040,15 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.activities().watch(req, "userKey", "applicationName") -/// .start_time("invidunt") -/// .page_token("aliquyam") -/// .max_results(-73) -/// .filters("Lorem") -/// .event_name("sea") +/// .start_time("aliquyam") +/// .page_token("accusam") +/// .org_unit_id("Lorem") +/// .max_results(-9) +/// .filters("et") +/// .event_name("duo") /// .end_time("et") -/// .customer_id("duo") -/// .actor_ip_address("et") +/// .customer_id("eirmod") +/// .actor_ip_address("sanctus") /// .doit(); /// # } /// ``` @@ -2052,6 +2061,7 @@ pub struct ActivityWatchCall<'a, C, A> _application_name: String, _start_time: Option, _page_token: Option, + _org_unit_id: Option, _max_results: Option, _filters: Option, _event_name: Option, @@ -2079,7 +2089,7 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: }; dlg.begin(MethodInfo { id: "reports.activities.watch", http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(13 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(14 + self._additional_params.len()); params.push(("userKey", self._user_key.to_string())); params.push(("applicationName", self._application_name.to_string())); if let Some(value) = self._start_time { @@ -2088,6 +2098,9 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); } + if let Some(value) = self._org_unit_id { + params.push(("orgUnitID", value.to_string())); + } if let Some(value) = self._max_results { params.push(("maxResults", value.to_string())); } @@ -2106,7 +2119,7 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: if let Some(value) = self._actor_ip_address { params.push(("actorIpAddress", value.to_string())); } - for &field in ["alt", "userKey", "applicationName", "startTime", "pageToken", "maxResults", "filters", "eventName", "endTime", "customerId", "actorIpAddress"].iter() { + for &field in ["alt", "userKey", "applicationName", "startTime", "pageToken", "orgUnitID", "maxResults", "filters", "eventName", "endTime", "customerId", "actorIpAddress"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2145,10 +2158,7 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2180,7 +2190,7 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2279,6 +2289,13 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: self._page_token = Some(new_value.to_string()); self } + /// the organizational unit's(OU) ID to filter activities from users belonging to a specific OU or one of its sub-OU(s) + /// + /// Sets the *org unit id* query property to the given value. + pub fn org_unit_id(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> { + self._org_unit_id = Some(new_value.to_string()); + self + } /// Number of activity records to be shown in each page. /// /// Sets the *max results* query property to the given value. @@ -2336,7 +2353,7 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2408,9 +2425,9 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.customer_usage_reports().get("date") -/// .parameters("sanctus") +/// .parameters("amet") /// .page_token("et") -/// .customer_id("amet") +/// .customer_id("consetetur") /// .doit(); /// # } /// ``` @@ -2493,10 +2510,7 @@ impl<'a, C, A> CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2516,7 +2530,7 @@ impl<'a, C, A> CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut _date: String, _parameters: Option, _page_token: Option, + _org_unit_id: Option, _max_results: Option, _filters: Option, _customer_id: Option, @@ -2727,7 +2743,7 @@ impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(9 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); params.push(("userKey", self._user_key.to_string())); params.push(("date", self._date.to_string())); if let Some(value) = self._parameters { @@ -2736,6 +2752,9 @@ impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut UserUsageReportGetCall<'a, C, A> where C: BorrowMut UserUsageReportGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2807,7 +2823,7 @@ impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut UserUsageReportGetCall<'a, C, A> where C: BorrowMut UserUsageReportGetCall<'a, C, A> { + self._org_unit_id = Some(new_value.to_string()); + self + } /// Maximum number of results to return. Maximum allowed is 1000 /// /// Sets the *max results* query property to the given value. @@ -2930,7 +2953,7 @@ impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with AdSense (protocol v1.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsense1d4-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-adsense1d4] path = "../adsense1d4" -version = "1.0.8+20181010" +version = "1.0.8+20190402" diff --git a/gen/adsense1d4-cli/README.md b/gen/adsense1d4-cli/README.md index 7fe735435b..30a7ff4142 100644 --- a/gen/adsense1d4-cli/README.md +++ b/gen/adsense1d4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *AdSense* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *AdSense* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash adsense1d4 [options] diff --git a/gen/adsense1d4-cli/mkdocs.yml b/gen/adsense1d4-cli/mkdocs.yml index 124219d6c9..5cdebfdd4e 100644 --- a/gen/adsense1d4-cli/mkdocs.yml +++ b/gen/adsense1d4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AdSense v1.0.8+20181010 +site_name: AdSense v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-adsense1d4-cli site_description: A complete library to interact with AdSense (protocol v1.4) diff --git a/gen/adsense1d4-cli/src/main.rs b/gen/adsense1d4-cli/src/main.rs index 025584ac99..2face8fabb 100644 --- a/gen/adsense1d4-cli/src/main.rs +++ b/gen/adsense1d4-cli/src/main.rs @@ -3564,7 +3564,7 @@ fn main() { let mut app = App::new("adsense1d4") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190402") .about("Accesses AdSense publishers' inventory and generates performance reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adsense1d4_cli") .arg(Arg::with_name("url") diff --git a/gen/adsense1d4/Cargo.toml b/gen/adsense1d4/Cargo.toml index a3d89f3b5d..95dd372ac2 100644 --- a/gen/adsense1d4/Cargo.toml +++ b/gen/adsense1d4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-adsense1d4" -version = "1.0.8+20181010" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdSense (protocol v1.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsense1d4" homepage = "https://developers.google.com/adsense/management/" -documentation = "https://docs.rs/google-adsense1d4/1.0.8+20181010" +documentation = "https://docs.rs/google-adsense1d4/1.0.8+20190402" license = "MIT" keywords = ["adsense", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/adsense1d4/README.md b/gen/adsense1d4/README.md index 8778120a35..b6c3513c4c 100644 --- a/gen/adsense1d4/README.md +++ b/gen/adsense1d4/README.md @@ -5,40 +5,40 @@ DO NOT EDIT ! --> The `google-adsense1d4` library allows access to all features of the *Google AdSense* service. -This documentation was generated from *AdSense* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *AdSense* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *AdSense* *v1d4* API can be found at the [official documentation site](https://developers.google.com/adsense/management/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AdSense.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AdSense.html) ... -* [accounts](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.Account.html) - * [*adclients get ad code*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountAdclientGetAdCodeCall.html), [*adclients list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountAdclientListCall.html), [*adunits customchannels list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountAdunitCustomchannelListCall.html), [*adunits get*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountAdunitGetCall.html), [*adunits get ad code*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountAdunitGetAdCodeCall.html), [*adunits list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountAdunitListCall.html), [*alerts delete*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountAlertDeleteCall.html), [*alerts list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountAlertListCall.html), [*customchannels adunits list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountCustomchannelAdunitListCall.html), [*customchannels get*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountCustomchannelGetCall.html), [*customchannels list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountCustomchannelListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountListCall.html), [*payments list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountPaymentListCall.html), [*reports generate*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountReportGenerateCall.html), [*reports saved generate*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountReportSavedGenerateCall.html), [*reports saved list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountReportSavedListCall.html), [*savedadstyles get*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountSavedadstyleGetCall.html), [*savedadstyles list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountSavedadstyleListCall.html) and [*urlchannels list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountUrlchannelListCall.html) +* [accounts](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.Account.html) + * [*adclients get ad code*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountAdclientGetAdCodeCall.html), [*adclients list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountAdclientListCall.html), [*adunits customchannels list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountAdunitCustomchannelListCall.html), [*adunits get*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountAdunitGetCall.html), [*adunits get ad code*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountAdunitGetAdCodeCall.html), [*adunits list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountAdunitListCall.html), [*alerts delete*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountAlertDeleteCall.html), [*alerts list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountAlertListCall.html), [*customchannels adunits list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountCustomchannelAdunitListCall.html), [*customchannels get*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountCustomchannelGetCall.html), [*customchannels list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountCustomchannelListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountListCall.html), [*payments list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountPaymentListCall.html), [*reports generate*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountReportGenerateCall.html), [*reports saved generate*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountReportSavedGenerateCall.html), [*reports saved list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountReportSavedListCall.html), [*savedadstyles get*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountSavedadstyleGetCall.html), [*savedadstyles list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountSavedadstyleListCall.html) and [*urlchannels list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountUrlchannelListCall.html) * adclients - * [*list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AdclientListCall.html) + * [*list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AdclientListCall.html) * adunits - * [*customchannels list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AdunitCustomchannelListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AdunitGetCall.html), [*get ad code*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AdunitGetAdCodeCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AdunitListCall.html) -* [alerts](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.Alert.html) - * [*delete*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AlertDeleteCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AlertListCall.html) + * [*customchannels list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AdunitCustomchannelListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AdunitGetCall.html), [*get ad code*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AdunitGetAdCodeCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AdunitListCall.html) +* [alerts](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.Alert.html) + * [*delete*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AlertDeleteCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AlertListCall.html) * customchannels - * [*adunits list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.CustomchannelAdunitListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.CustomchannelGetCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.CustomchannelListCall.html) -* [metadata](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.Metadata.html) - * [*dimensions list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.MetadataDimensionListCall.html) and [*metrics list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.MetadataMetricListCall.html) -* [payments](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.Payment.html) - * [*list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.PaymentListCall.html) + * [*adunits list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.CustomchannelAdunitListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.CustomchannelGetCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.CustomchannelListCall.html) +* [metadata](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.Metadata.html) + * [*dimensions list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.MetadataDimensionListCall.html) and [*metrics list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.MetadataMetricListCall.html) +* [payments](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.Payment.html) + * [*list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.PaymentListCall.html) * reports - * [*generate*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.ReportGenerateCall.html), [*saved generate*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.ReportSavedGenerateCall.html) and [*saved list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.ReportSavedListCall.html) + * [*generate*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.ReportGenerateCall.html), [*saved generate*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.ReportSavedGenerateCall.html) and [*saved list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.ReportSavedListCall.html) * savedadstyles - * [*get*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.SavedadstyleGetCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.SavedadstyleListCall.html) + * [*get*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.SavedadstyleGetCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.SavedadstyleListCall.html) * urlchannels - * [*list*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.UrlchannelListCall.html) + * [*list*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.UrlchannelListCall.html) Download supported by ... -* [*generate reports*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.ReportGenerateCall.html) -* [*reports generate accounts*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AccountReportGenerateCall.html) +* [*generate reports*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.ReportGenerateCall.html) +* [*reports generate accounts*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AccountReportGenerateCall.html) @@ -46,17 +46,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/struct.AdSense.html)** +* **[Hub](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/struct.AdSense.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.Part.html)** + * **[Parts](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -175,17 +175,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -195,29 +195,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-adsense1d4/1.0.8+20181010/google_adsense1d4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-adsense1d4/1.0.8+20190402/google_adsense1d4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/adsense1d4/src/lib.rs b/gen/adsense1d4/src/lib.rs index f753ece0f6..3072962b9e 100644 --- a/gen/adsense1d4/src/lib.rs +++ b/gen/adsense1d4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *AdSense* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *AdSense* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *AdSense* *v1d4* API can be found at the //! [official documentation site](https://developers.google.com/adsense/management/). @@ -2531,10 +2531,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2554,7 +2551,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2646,7 +2643,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2800,10 +2797,7 @@ impl<'a, C, A> AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2823,7 +2817,7 @@ impl<'a, C, A> AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3092,7 +3083,7 @@ impl<'a, C, A> AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3180,7 +3171,7 @@ impl<'a, C, A> AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3337,10 +3328,7 @@ impl<'a, C, A> AdunitListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3360,7 +3348,7 @@ impl<'a, C, A> AdunitListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3459,7 +3447,7 @@ impl<'a, C, A> AdunitListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3603,10 +3591,7 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3626,7 +3611,7 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3714,7 +3699,7 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3843,10 +3828,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3866,7 +3848,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3948,7 +3930,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4089,10 +4071,7 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4112,7 +4091,7 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4180,7 +4159,7 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4304,10 +4283,7 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4327,7 +4303,7 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4402,7 +4378,7 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4531,10 +4507,7 @@ impl<'a, C, A> SavedadstyleListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4554,7 +4527,7 @@ impl<'a, C, A> SavedadstyleListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4636,7 +4609,7 @@ impl<'a, C, A> SavedadstyleListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4778,10 +4751,7 @@ impl<'a, C, A> SavedadstyleGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4801,7 +4771,7 @@ impl<'a, C, A> SavedadstyleGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4879,7 +4849,7 @@ impl<'a, C, A> SavedadstyleGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5008,10 +4978,7 @@ impl<'a, C, A> ReportSavedListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5031,7 +4998,7 @@ impl<'a, C, A> ReportSavedListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5113,7 +5080,7 @@ impl<'a, C, A> ReportSavedListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5317,10 +5284,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5340,7 +5304,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5503,7 +5467,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5660,10 +5624,7 @@ impl<'a, C, A> ReportSavedGenerateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5683,7 +5644,7 @@ impl<'a, C, A> ReportSavedGenerateCall<'a, C, A> where C: BorrowMut ReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountAlertDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5948,7 +5906,7 @@ impl<'a, C, A> AccountAlertDeleteCall<'a, C, A> where C: BorrowMut AccountAlertDeleteCall<'a, C, A> where C: BorrowMut AccountAlertListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6196,7 +6151,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6281,7 +6236,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6440,10 +6395,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6463,7 +6415,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6724,7 +6673,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6806,7 +6755,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6948,10 +6897,7 @@ impl<'a, C, A> AccountPaymentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6971,7 +6917,7 @@ impl<'a, C, A> AccountPaymentListCall<'a, C, A> where C: BorrowMut AccountPaymentListCall<'a, C, A> where C: BorrowMut AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7216,7 +7159,7 @@ impl<'a, C, A> AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut AccountAdunitGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7473,7 +7413,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7571,7 +7511,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7717,10 +7657,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7740,7 +7677,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8022,7 +7956,7 @@ impl<'a, C, A> AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut AccountReportSavedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8316,7 +8247,7 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut AccountReportSavedListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8585,7 +8513,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountAdunitListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8869,7 +8794,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8978,7 +8903,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9198,10 +9123,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9221,7 +9143,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9561,7 +9480,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9830,7 +9746,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountSavedadstyleListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10107,7 +10020,7 @@ impl<'a, C, A> AccountSavedadstyleListCall<'a, C, A> where C: BorrowMut AccountSavedadstyleListCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10368,7 +10278,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10645,7 +10552,7 @@ impl<'a, C, A> AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10927,7 +10831,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11012,7 +10916,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11156,10 +11060,7 @@ impl<'a, C, A> AccountAdclientGetAdCodeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11179,7 +11080,7 @@ impl<'a, C, A> AccountAdclientGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdclientGetAdCodeCall<'a, C, A> where C: BorrowMut PaymentListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11409,7 +11307,7 @@ impl<'a, C, A> PaymentListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11477,7 +11375,7 @@ impl<'a, C, A> PaymentListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11596,10 +11494,7 @@ impl<'a, C, A> MetadataDimensionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11619,7 +11514,7 @@ impl<'a, C, A> MetadataDimensionListCall<'a, C, A> where C: BorrowMut MetadataDimensionListCall<'a, C, A> where C: BorrowMut MetadataMetricListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11829,7 +11721,7 @@ impl<'a, C, A> MetadataMetricListCall<'a, C, A> where C: BorrowMut MetadataMetricListCall<'a, C, A> where C: BorrowMut CustomchannelGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12064,7 +11953,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12152,7 +12041,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12304,10 +12193,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12327,7 +12213,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12419,7 +12305,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12578,10 +12464,7 @@ impl<'a, C, A> CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12601,7 +12484,7 @@ impl<'a, C, A> CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with AdSense Host (protocol v4.1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsensehost4d1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-adsensehost4d1] path = "../adsensehost4d1" -version = "1.0.8+20181010" +version = "1.0.8+20190402" diff --git a/gen/adsensehost4d1-cli/README.md b/gen/adsensehost4d1-cli/README.md index b3e5106d93..fc9be3f9c1 100644 --- a/gen/adsensehost4d1-cli/README.md +++ b/gen/adsensehost4d1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *AdSense Host* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *AdSense Host* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash adsensehost4d1 [options] diff --git a/gen/adsensehost4d1-cli/mkdocs.yml b/gen/adsensehost4d1-cli/mkdocs.yml index f2c20aa622..a63bf3deed 100644 --- a/gen/adsensehost4d1-cli/mkdocs.yml +++ b/gen/adsensehost4d1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AdSense Host v1.0.8+20181010 +site_name: AdSense Host v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-adsensehost4d1-cli site_description: A complete library to interact with AdSense Host (protocol v4.1) diff --git a/gen/adsensehost4d1-cli/src/main.rs b/gen/adsensehost4d1-cli/src/main.rs index 19011a4841..9eafd93053 100644 --- a/gen/adsensehost4d1-cli/src/main.rs +++ b/gen/adsensehost4d1-cli/src/main.rs @@ -2762,7 +2762,7 @@ fn main() { let mut app = App::new("adsensehost4d1") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190402") .about("Generates performance reports, generates ad codes, and provides publisher management capabilities for AdSense Hosts.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli") .arg(Arg::with_name("url") diff --git a/gen/adsensehost4d1/Cargo.toml b/gen/adsensehost4d1/Cargo.toml index 25e286726b..f49dd0790a 100644 --- a/gen/adsensehost4d1/Cargo.toml +++ b/gen/adsensehost4d1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-adsensehost4d1" -version = "1.0.8+20181010" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdSense Host (protocol v4.1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsensehost4d1" homepage = "https://developers.google.com/adsense/host/" -documentation = "https://docs.rs/google-adsensehost4d1/1.0.8+20181010" +documentation = "https://docs.rs/google-adsensehost4d1/1.0.8+20190402" license = "MIT" keywords = ["adsensehost", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/adsensehost4d1/README.md b/gen/adsensehost4d1/README.md index 64fa85df88..e2018a6ca6 100644 --- a/gen/adsensehost4d1/README.md +++ b/gen/adsensehost4d1/README.md @@ -5,26 +5,26 @@ DO NOT EDIT ! --> The `google-adsensehost4d1` library allows access to all features of the *Google AdSense Host* service. -This documentation was generated from *AdSense Host* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *AdSense Host* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *AdSense Host* *v4d1* API can be found at the [official documentation site](https://developers.google.com/adsense/host/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AdSenseHost.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AdSenseHost.html) ... -* [accounts](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.Account.html) - * [*adclients get*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountAdclientGetCall.html), [*adclients list*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountAdclientListCall.html), [*adunits delete*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountAdunitDeleteCall.html), [*adunits get*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountAdunitGetCall.html), [*adunits get ad code*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountAdunitGetAdCodeCall.html), [*adunits insert*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountAdunitInsertCall.html), [*adunits list*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountAdunitListCall.html), [*adunits patch*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountAdunitPatchCall.html), [*adunits update*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountAdunitUpdateCall.html), [*get*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountListCall.html) and [*reports generate*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AccountReportGenerateCall.html) +* [accounts](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.Account.html) + * [*adclients get*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountAdclientGetCall.html), [*adclients list*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountAdclientListCall.html), [*adunits delete*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountAdunitDeleteCall.html), [*adunits get*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountAdunitGetCall.html), [*adunits get ad code*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountAdunitGetAdCodeCall.html), [*adunits insert*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountAdunitInsertCall.html), [*adunits list*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountAdunitListCall.html), [*adunits patch*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountAdunitPatchCall.html), [*adunits update*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountAdunitUpdateCall.html), [*get*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountListCall.html) and [*reports generate*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AccountReportGenerateCall.html) * adclients - * [*get*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AdclientGetCall.html) and [*list*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AdclientListCall.html) + * [*get*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AdclientGetCall.html) and [*list*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AdclientListCall.html) * associationsessions - * [*start*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AssociationsessionStartCall.html) and [*verify*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AssociationsessionVerifyCall.html) + * [*start*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AssociationsessionStartCall.html) and [*verify*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AssociationsessionVerifyCall.html) * customchannels - * [*delete*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.CustomchannelDeleteCall.html), [*get*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.CustomchannelGetCall.html), [*insert*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.CustomchannelInsertCall.html), [*list*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.CustomchannelListCall.html), [*patch*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.CustomchannelPatchCall.html) and [*update*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.CustomchannelUpdateCall.html) -* [reports](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.Report.html) - * [*generate*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.ReportGenerateCall.html) + * [*delete*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.CustomchannelDeleteCall.html), [*get*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.CustomchannelGetCall.html), [*insert*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.CustomchannelInsertCall.html), [*list*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.CustomchannelListCall.html), [*patch*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.CustomchannelPatchCall.html) and [*update*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.CustomchannelUpdateCall.html) +* [reports](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.Report.html) + * [*generate*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.ReportGenerateCall.html) * urlchannels - * [*delete*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.UrlchannelDeleteCall.html), [*insert*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.UrlchannelInsertCall.html) and [*list*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.UrlchannelListCall.html) + * [*delete*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.UrlchannelDeleteCall.html), [*insert*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.UrlchannelInsertCall.html) and [*list*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.UrlchannelListCall.html) @@ -33,17 +33,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/struct.AdSenseHost.html)** +* **[Hub](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/struct.AdSenseHost.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.Part.html)** + * **[Parts](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -152,17 +152,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -172,29 +172,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-adsensehost4d1/1.0.8+20181010/google_adsensehost4d1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-adsensehost4d1/1.0.8+20190402/google_adsensehost4d1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/adsensehost4d1/src/lib.rs b/gen/adsensehost4d1/src/lib.rs index aea0b8346f..6b01913706 100644 --- a/gen/adsensehost4d1/src/lib.rs +++ b/gen/adsensehost4d1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *AdSense Host* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *AdSense Host* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *AdSense Host* *v4d1* API can be found at the //! [official documentation site](https://developers.google.com/adsense/host/). @@ -1820,10 +1820,7 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1855,7 +1852,7 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1945,7 +1942,7 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2089,10 +2086,7 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2112,7 +2106,7 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2200,7 +2194,7 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2352,10 +2346,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2375,7 +2366,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2467,7 +2458,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2596,10 +2587,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2619,7 +2607,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2701,7 +2689,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2843,10 +2831,7 @@ impl<'a, C, A> AdclientGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2866,7 +2851,7 @@ impl<'a, C, A> AdclientGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2944,7 +2929,7 @@ impl<'a, C, A> AdclientGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3081,10 +3066,7 @@ impl<'a, C, A> AssociationsessionStartCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3104,7 +3086,7 @@ impl<'a, C, A> AssociationsessionStartCall<'a, C, A> where C: BorrowMut AssociationsessionStartCall<'a, C, A> where C: BorrowMut AssociationsessionVerifyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3351,7 +3330,7 @@ impl<'a, C, A> AssociationsessionVerifyCall<'a, C, A> where C: BorrowMut AssociationsessionVerifyCall<'a, C, A> where C: BorrowMut ReportGenerateCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3618,7 +3594,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3759,7 +3735,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3918,10 +3894,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3941,7 +3914,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4050,7 +4023,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4175,10 +4148,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4198,7 +4168,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4277,7 +4247,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4430,10 +4400,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4453,7 +4420,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4771,7 +4735,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5091,7 +5052,7 @@ impl<'a, C, A> AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5364,7 +5322,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdunitPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5644,7 +5599,7 @@ impl<'a, C, A> AccountAdunitPatchCall<'a, C, A> where C: BorrowMut AccountAdunitPatchCall<'a, C, A> where C: BorrowMut AccountAdclientGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5921,7 +5873,7 @@ impl<'a, C, A> AccountAdclientGetCall<'a, C, A> where C: BorrowMut AccountAdclientGetCall<'a, C, A> where C: BorrowMut AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6174,7 +6123,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6252,7 +6201,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6403,10 +6352,7 @@ impl<'a, C, A> AccountAdunitInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6438,7 +6384,7 @@ impl<'a, C, A> AccountAdunitInsertCall<'a, C, A> where C: BorrowMut AccountAdunitInsertCall<'a, C, A> where C: BorrowMut AccountAdunitGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6707,7 +6650,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6805,7 +6748,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6956,10 +6899,7 @@ impl<'a, C, A> AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6991,7 +6931,7 @@ impl<'a, C, A> AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut CustomchannelGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7258,7 +7195,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7346,7 +7283,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7490,10 +7427,7 @@ impl<'a, C, A> CustomchannelDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7513,7 +7447,7 @@ impl<'a, C, A> CustomchannelDeleteCall<'a, C, A> where C: BorrowMut CustomchannelDeleteCall<'a, C, A> where C: BorrowMut CustomchannelUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7785,7 +7716,7 @@ impl<'a, C, A> CustomchannelUpdateCall<'a, C, A> where C: BorrowMut CustomchannelUpdateCall<'a, C, A> where C: BorrowMut CustomchannelListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8050,7 +7978,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8142,7 +8070,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8293,10 +8221,7 @@ impl<'a, C, A> CustomchannelPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8328,7 +8253,7 @@ impl<'a, C, A> CustomchannelPatchCall<'a, C, A> where C: BorrowMut CustomchannelPatchCall<'a, C, A> where C: BorrowMut CustomchannelInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8612,7 +8534,7 @@ impl<'a, C, A> CustomchannelInsertCall<'a, C, A> where C: BorrowMut CustomchannelInsertCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with AlertCenter (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/alertcenter1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-alertcenter1_beta1] path = "../alertcenter1_beta1" -version = "1.0.8+20181011" +version = "1.0.8+20190329" diff --git a/gen/alertcenter1_beta1-cli/README.md b/gen/alertcenter1_beta1-cli/README.md index 47d2071df9..179b5ee4e8 100644 --- a/gen/alertcenter1_beta1-cli/README.md +++ b/gen/alertcenter1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *AlertCenter* API at revision *20181011*. The CLI is at version *1.0.8*. +This documentation was generated from the *AlertCenter* API at revision *20190329*. The CLI is at version *1.0.8*. ```bash alertcenter1-beta1 [options] @@ -35,9 +35,17 @@ alertcenter1-beta1 [options] feedback-list [-p ]... [-o ] get [-p ]... [-o ] list [-p ]... [-o ] + undelete (-r )... [-p ]... [-o ] + methods + get-settings [-p ]... [-o ] + update-settings (-r )... [-p ]... [-o ] alertcenter1-beta1 --help Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. --config-dir A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. diff --git a/gen/alertcenter1_beta1-cli/mkdocs.yml b/gen/alertcenter1_beta1-cli/mkdocs.yml index 17aeddfd37..d860114c60 100644 --- a/gen/alertcenter1_beta1-cli/mkdocs.yml +++ b/gen/alertcenter1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AlertCenter v1.0.8+20181011 +site_name: AlertCenter v1.0.8+20190329 site_url: http://byron.github.io/google-apis-rs/google-alertcenter1_beta1-cli site_description: A complete library to interact with AlertCenter (protocol v1beta1) @@ -14,6 +14,9 @@ pages: - ['alerts_feedback-list.md', 'Alerts', 'Feedback List'] - ['alerts_get.md', 'Alerts', 'Get'] - ['alerts_list.md', 'Alerts', 'List'] +- ['alerts_undelete.md', 'Alerts', 'Undelete'] +- ['methods_get-settings.md', 'Methods', 'Get Settings'] +- ['methods_update-settings.md', 'Methods', 'Update Settings'] theme: readthedocs diff --git a/gen/alertcenter1_beta1-cli/src/main.rs b/gen/alertcenter1_beta1-cli/src/main.rs index 0ec742d742..7db1fbcdb8 100644 --- a/gen/alertcenter1_beta1-cli/src/main.rs +++ b/gen/alertcenter1_beta1-cli/src/main.rs @@ -79,6 +79,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -170,6 +173,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -196,6 +202,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "filter" => { + call = call.filter(value.unwrap_or("")); + }, "customer-id" => { call = call.customer_id(value.unwrap_or("")); }, @@ -212,7 +221,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["customer-id"].iter().map(|v|*v)); + v.extend(["filter", "customer-id"].iter().map(|v|*v)); v } )); } } @@ -223,6 +232,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -276,6 +288,9 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -341,6 +356,238 @@ impl<'n> Engine<'n> { Ok(()) } else { assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _alerts_undelete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "customer-id" => Some(("customerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["customer-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UndeleteAlertRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.alerts().undelete(request, opt.value_of("alert-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _methods_get_settings(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.methods().get_settings(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "customer-id" => { + call = call.customer_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["customer-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _methods_update_settings(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Settings = json::value::from_value(object).unwrap(); + let mut call = self.hub.methods().update_settings(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "customer-id" => { + call = call.customer_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["customer-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } let mut ostream = match writer_from_opts(opt.value_of("out")) { Ok(mut f) => f, Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), @@ -383,12 +630,29 @@ impl<'n> Engine<'n> { ("list", Some(opt)) => { call_result = self._alerts_list(opt, dry_run, &mut err); }, + ("undelete", Some(opt)) => { + call_result = self._alerts_undelete(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("alerts".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); } } }, + ("methods", Some(opt)) => { + match opt.subcommand() { + ("get-settings", Some(opt)) => { + call_result = self._methods_get_settings(opt, dry_run, &mut err); + }, + ("update-settings", Some(opt)) => { + call_result = self._methods_update_settings(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("methods".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, _ => { err.issues.push(CLIError::MissingCommandError); writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); @@ -474,14 +738,13 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("alerts", "methods: 'delete', 'feedback-create', 'feedback-list', 'get' and 'list'", vec![ + ("alerts", "methods: 'delete', 'feedback-create', 'feedback-list', 'get', 'list' and 'undelete'", vec![ ("delete", Some(r##"Marks the specified alert for deletion. An alert that has been marked for - deletion will be excluded from the results of a List operation by default, - and will be removed from the Alert Center after 30 days. - Marking an alert for deletion will have no effect on an alert which has + deletion is removed from Alert Center after 30 days. + Marking an alert for deletion has no effect on an alert which has already been marked for deletion. Attempting to mark a nonexistent alert - for deletion will return NOT_FOUND."##), + for deletion results in a `NOT_FOUND` error."##), "Details at http://byron.github.io/google-apis-rs/google_alertcenter1_beta1_cli/alerts_delete", vec![ (Some(r##"alert-id"##), @@ -503,13 +766,13 @@ fn main() { Some(false)), ]), ("feedback-create", - Some(r##"Creates a new alert feedback."##), + Some(r##"Creates new feedback for an alert. Attempting to create a feedback for + a non-existent alert returns `NOT_FOUND` error."##), "Details at http://byron.github.io/google-apis-rs/google_alertcenter1_beta1_cli/alerts_feedback-create", vec![ (Some(r##"alert-id"##), None, - Some(r##"Required. The identifier of the alert this feedback belongs to. - Returns a NOT_FOUND error if no such alert."##), + Some(r##"Required. The identifier of the alert this feedback belongs to."##), Some(true), Some(false)), @@ -532,13 +795,14 @@ fn main() { Some(false)), ]), ("feedback-list", - Some(r##"Lists all the feedback for an alert."##), + Some(r##"Lists all the feedback for an alert. Attempting to list feedbacks for + a non-existent alert returns `NOT_FOUND` error."##), "Details at http://byron.github.io/google-apis-rs/google_alertcenter1_beta1_cli/alerts_feedback-list", vec![ (Some(r##"alert-id"##), None, Some(r##"Required. The alert identifier. - If the alert does not exist returns a NOT_FOUND error."##), + The "-" wildcard could be used to represent all alerts."##), Some(true), Some(false)), @@ -555,7 +819,8 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Gets the specified alert."##), + Some(r##"Gets the specified alert. Attempting to get a nonexistent alert returns + `NOT_FOUND` error."##), "Details at http://byron.github.io/google-apis-rs/google_alertcenter1_beta1_cli/alerts_get", vec![ (Some(r##"alert-id"##), @@ -577,7 +842,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Lists all the alerts for the current user and application."##), + Some(r##"Lists the alerts."##), "Details at http://byron.github.io/google-apis-rs/google_alertcenter1_beta1_cli/alerts_list", vec![ (Some(r##"v"##), @@ -586,6 +851,79 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("undelete", + Some(r##"Restores, or "undeletes", an alert that was marked for deletion within the + past 30 days. Attempting to undelete an alert which was marked for deletion + over 30 days ago (which has been removed from the Alert Center database) or + a nonexistent alert returns a `NOT_FOUND` error. Attempting to + undelete an alert which has not been marked for deletion has no effect."##), + "Details at http://byron.github.io/google-apis-rs/google_alertcenter1_beta1_cli/alerts_undelete", + vec![ + (Some(r##"alert-id"##), + None, + Some(r##"Required. The identifier of the alert to undelete."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("methods", "methods: 'get-settings' and 'update-settings'", vec![ + ("get-settings", + Some(r##"Returns customer-level settings."##), + "Details at http://byron.github.io/google-apis-rs/google_alertcenter1_beta1_cli/methods_get-settings", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update-settings", + Some(r##"Updates the customer-level settings."##), + "Details at http://byron.github.io/google-apis-rs/google_alertcenter1_beta1_cli/methods_update-settings", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -598,9 +936,14 @@ fn main() { let mut app = App::new("alertcenter1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181011") - .about("G Suite Alert Center API to view and manage alerts on issues affecting your domain.") + .version("1.0.8+20190329") + .about("Manages alerts on issues affecting your domain.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_alertcenter1_beta1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) .arg(Arg::with_name("folder") .long("config-dir") .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") diff --git a/gen/alertcenter1_beta1/Cargo.toml b/gen/alertcenter1_beta1/Cargo.toml index ca0b3c2781..669fd4f14f 100644 --- a/gen/alertcenter1_beta1/Cargo.toml +++ b/gen/alertcenter1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-alertcenter1_beta1" -version = "1.0.8+20181011" +version = "1.0.8+20190329" authors = ["Sebastian Thiel "] description = "A complete library to interact with AlertCenter (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/alertcenter1_beta1" homepage = "https://developers.google.com/admin-sdk/alertcenter/" -documentation = "https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011" +documentation = "https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329" license = "MIT" keywords = ["alertcenter", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/alertcenter1_beta1/README.md b/gen/alertcenter1_beta1/README.md index 20a8ae3126..39de957344 100644 --- a/gen/alertcenter1_beta1/README.md +++ b/gen/alertcenter1_beta1/README.md @@ -5,17 +5,21 @@ DO NOT EDIT ! --> The `google-alertcenter1_beta1` library allows access to all features of the *Google AlertCenter* service. -This documentation was generated from *AlertCenter* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *alertcenter:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *AlertCenter* crate version *1.0.8+20190329*, where *20190329* is the exact revision of the *alertcenter:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *AlertCenter* *v1_beta1* API can be found at the [official documentation site](https://developers.google.com/admin-sdk/alertcenter/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/struct.AlertCenter.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.AlertCenter.html) ... -* [alerts](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/struct.Alert.html) - * [*delete*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/struct.AlertDeleteCall.html), [*feedback create*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/struct.AlertFeedbackCreateCall.html), [*feedback list*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/struct.AlertFeedbackListCall.html), [*get*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/struct.AlertGetCall.html) and [*list*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/struct.AlertListCall.html) +* [alerts](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.Alert.html) + * [*delete*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.AlertDeleteCall.html), [*feedback create*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.AlertFeedbackCreateCall.html), [*feedback list*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.AlertFeedbackListCall.html), [*get*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.AlertGetCall.html), [*list*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.AlertListCall.html) and [*undelete*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.AlertUndeleteCall.html) +Other activities are ... + +* [get settings](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.MethodGetSettingCall.html) +* [update settings](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.MethodUpdateSettingCall.html) @@ -23,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/struct.AlertCenter.html)** +* **[Hub](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/struct.AlertCenter.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -47,11 +51,12 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.alerts().feedback_list(...).doit() -let r = hub.alerts().get(...).doit() -let r = hub.alerts().feedback_create(...).doit() let r = hub.alerts().delete(...).doit() +let r = hub.alerts().undelete(...).doit() +let r = hub.alerts().get(...).doit() let r = hub.alerts().list(...).doit() +let r = hub.alerts().feedback_list(...).doit() +let r = hub.alerts().feedback_create(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -133,17 +138,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +158,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-alertcenter1_beta1/1.0.8+20181011/google_alertcenter1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-alertcenter1_beta1/1.0.8+20190329/google_alertcenter1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/alertcenter1_beta1/src/lib.rs b/gen/alertcenter1_beta1/src/lib.rs index 6a2b3c7b3e..13fad0293c 100644 --- a/gen/alertcenter1_beta1/src/lib.rs +++ b/gen/alertcenter1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *AlertCenter* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *alertcenter:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *AlertCenter* crate version *1.0.8+20190329*, where *20190329* is the exact revision of the *alertcenter:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *AlertCenter* *v1_beta1* API can be found at the //! [official documentation site](https://developers.google.com/admin-sdk/alertcenter/). @@ -12,8 +12,12 @@ //! Handle the following *Resources* with ease from the central [hub](struct.AlertCenter.html) ... //! //! * [alerts](struct.Alert.html) -//! * [*delete*](struct.AlertDeleteCall.html), [*feedback create*](struct.AlertFeedbackCreateCall.html), [*feedback list*](struct.AlertFeedbackListCall.html), [*get*](struct.AlertGetCall.html) and [*list*](struct.AlertListCall.html) +//! * [*delete*](struct.AlertDeleteCall.html), [*feedback create*](struct.AlertFeedbackCreateCall.html), [*feedback list*](struct.AlertFeedbackListCall.html), [*get*](struct.AlertGetCall.html), [*list*](struct.AlertListCall.html) and [*undelete*](struct.AlertUndeleteCall.html) //! +//! Other activities are ... +//! +//! * [get settings](struct.MethodGetSettingCall.html) +//! * [update settings](struct.MethodUpdateSettingCall.html) //! //! //! @@ -47,11 +51,12 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.alerts().feedback_list(...).doit() -//! let r = hub.alerts().get(...).doit() -//! let r = hub.alerts().feedback_create(...).doit() //! let r = hub.alerts().delete(...).doit() +//! let r = hub.alerts().undelete(...).doit() +//! let r = hub.alerts().get(...).doit() //! let r = hub.alerts().list(...).doit() +//! let r = hub.alerts().feedback_list(...).doit() +//! let r = hub.alerts().feedback_create(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -229,6 +234,28 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, // UTILITIES ### // ############ +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// See and delete your domain's G Suite alerts, and send alert feedback + AppAlert, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::AppAlert => "https://www.googleapis.com/auth/apps.alerts", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::AppAlert + } +} @@ -320,6 +347,9 @@ impl<'a, C, A> AlertCenter pub fn alerts(&'a self) -> AlertMethods<'a, C, A> { AlertMethods { hub: &self } } + pub fn methods(&'a self) -> MethodMethods<'a, C, A> { + MethodMethods { hub: &self } + } /// Set the user-agent header field to use in all requests to the server. /// It defaults to `google-api-rust-client/1.0.8`. @@ -350,6 +380,27 @@ impl<'a, C, A> AlertCenter // ############ // SCHEMAS ### // ########## +/// A request to undelete a specific alert that was marked for deletion. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [undelete alerts](struct.AlertUndeleteCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UndeleteAlertRequest { + /// Optional. The unique identifier of the G Suite organization account of the + /// customer the alert is associated with. + /// Inferred from the caller identity if not provided. + #[serde(rename="customerId")] + pub customer_id: Option, +} + +impl RequestValue for UndeleteAlertRequest {} + + /// Response message for an alert listing request. /// /// # Activities @@ -361,9 +412,10 @@ impl<'a, C, A> AlertCenter /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListAlertsResponse { - /// If not empty, indicates that there may be more alerts that match the - /// request; this value can be passed in a new ListAlertsRequest to get the - /// next page of values. + /// The token for the next page. If not empty, indicates that there may be more + /// alerts that match the listing request; this value can be used in a + /// subsequent ListAlertsRequest to get alerts continuing from last result + /// of the current list call. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// The list of alerts. @@ -373,6 +425,45 @@ pub struct ListAlertsResponse { impl ResponseResult for ListAlertsResponse {} +/// A reference to a Cloud Pubsub topic. +/// +/// To register for notifications, the owner of the topic must grant +/// `alerts-api-push-notifications@system.gserviceaccount.com` the +/// `projects.topics.publish` permission. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CloudPubsubTopic { + /// Optional. The format of the payload that would be sent. + /// If not specified the format will be JSON. + #[serde(rename="payloadFormat")] + pub payload_format: Option, + /// The `name` field of a Cloud Pubsub [Topic] + /// (https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#Topic). + #[serde(rename="topicName")] + pub topic_name: Option, +} + +impl Part for CloudPubsubTopic {} + + +/// Settings for callback notifications. +/// For more details see [G Suite Alert +/// Notification](/admin-sdk/alertcenter/guides/notifications). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Notification { + /// A Google Cloud Pub/sub topic destination. + #[serde(rename="cloudPubsubTopic")] + pub cloud_pubsub_topic: Option, +} + +impl Part for Notification {} + + /// A customer feedback about an alert. /// /// # Activities @@ -384,8 +475,7 @@ impl ResponseResult for ListAlertsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AlertFeedback { - /// Output only. A unique identifier for the feedback. When creating a new - /// feedback the system will assign one. + /// Output only. The unique identifier for the feedback. #[serde(rename="feedbackId")] pub feedback_id: Option, /// Output only. The alert identifier. @@ -397,7 +487,7 @@ pub struct AlertFeedback { /// Required. The type of the feedback. #[serde(rename="type")] pub type_: Option, - /// Output only. The time this feedback was created. Assigned by the server. + /// Output only. The time this feedback was created. #[serde(rename="createTime")] pub create_time: Option, /// Output only. The email of the user that provided the feedback. @@ -420,7 +510,7 @@ impl ResponseResult for AlertFeedback {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListAlertFeedbackResponse { /// The list of alert feedback. - /// Result is ordered descending by creation time. + /// Feedback entries for each alert are ordered by creation time descending. pub feedback: Option>, } @@ -450,79 +540,86 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// An alert affecting a customer. -/// All fields are read-only once created. +/// Customer-level settings. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update settings](struct.MethodUpdateSettingCall.html) (request|response) +/// * [get settings](struct.MethodGetSettingCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Settings { + /// The list of notifications. + pub notifications: Option>, +} + +impl RequestValue for Settings {} +impl ResponseResult for Settings {} + + +/// An alert affecting a customer. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [feedback list alerts](struct.AlertFeedbackListCall.html) (none) -/// * [get alerts](struct.AlertGetCall.html) (response) -/// * [feedback create alerts](struct.AlertFeedbackCreateCall.html) (none) /// * [delete alerts](struct.AlertDeleteCall.html) (none) +/// * [undelete alerts](struct.AlertUndeleteCall.html) (response) +/// * [get alerts](struct.AlertGetCall.html) (response) /// * [list alerts](struct.AlertListCall.html) (none) +/// * [feedback list alerts](struct.AlertFeedbackListCall.html) (none) +/// * [feedback create alerts](struct.AlertFeedbackCreateCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Alert { /// Output only. The unique identifier for the alert. #[serde(rename="alertId")] pub alert_id: Option, - /// Required. The type of the alert. + /// Output only. `True` if this alert is marked for deletion. + pub deleted: Option, + /// Optional. The data associated with this alert, for example + /// google.apps.alertcenter.type.DeviceCompromised. + pub data: Option>, + /// Output only. The time this alert was created. + #[serde(rename="createTime")] + pub create_time: Option, + /// Required. A unique identifier for the system that reported the alert. + /// This is output only after alert is created. /// - /// Supported types are any of the following: - /// * "Google Operations" - /// * "Device compromised" - /// * "Suspicious activity" - /// * "User reported phishing" - /// * "Misconfigured whitelist" - /// * "Customer takeout initiated" - /// * "Government attack warning" - /// * "User reported spam spike" - /// * "Suspicious message reported" - /// * "Phishing reclassification" - /// * "Malware reclassification" - /// LINT.IfChange - /// * "Suspicious login" - /// * "Suspicious login (less secure app)" - /// * "User suspended" - /// * "Leaked password" - /// * "User suspended (suspicious activity)" - /// * "User suspended (spam)" - /// * "User suspended (spam through relay)" - /// LINT.ThenChange(//depot/google3/apps/albert/data/albert_enums.proto) + /// Supported sources are any of the following: + /// + /// * Google Operations + /// * Mobile device management + /// * Gmail phishing + /// * Domain wide takeout + /// * Government attack warning + /// * Google identity + pub source: Option, + /// Required. The time the event that caused this alert was started or + /// detected. + #[serde(rename="startTime")] + pub start_time: Option, + /// Optional. The time the event that caused this alert ceased being active. + /// If provided, the end time must not be earlier than the start time. + /// If not provided, it indicates an ongoing alert. + #[serde(rename="endTime")] + pub end_time: Option, + /// Required. The type of the alert. + /// This is output only after alert is created. + /// For a list of available alert types see + /// [G Suite Alert types](/admin-sdk/alertcenter/reference/alert-types). #[serde(rename="type")] pub type_: Option, /// Output only. The unique identifier of the Google account of the customer. #[serde(rename="customerId")] pub customer_id: Option, - /// Required. A unique identifier for the system that is reported the alert. - /// - /// Supported sources are any of the following: - /// * "Google Operations" - /// * "Mobile device management" - /// * "Gmail phishing" - /// * "Domain wide takeout" - /// * "Government attack warning" - /// * "Google identity" - pub source: Option, - /// Required. The time this alert became active. - #[serde(rename="startTime")] - pub start_time: Option, - /// Optional. The time this alert was no longer active. If provided, the - /// end time must not be earlier than the start time. If not provided, the end - /// time will default to the start time. - #[serde(rename="endTime")] - pub end_time: Option, - /// Optional. Specific data associated with this alert. - /// e.g. google.apps.alertcenter.type.DeviceCompromised. - pub data: Option>, - /// Output only. The time this alert was created. Assigned by the server. - #[serde(rename="createTime")] - pub create_time: Option, - /// Output only. An optional Security Investigation Tool query for this - /// alert. + /// Output only. An optional + /// [Security Investigation Tool](https://support.google.com/a/answer/7575955) + /// query for this alert. #[serde(rename="securityInvestigationToolLink")] pub security_investigation_tool_link: Option, } @@ -560,7 +657,7 @@ impl ResponseResult for Alert {} /// ::default(), None); /// let mut hub = AlertCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `feedback_create(...)`, `feedback_list(...)`, `get(...)` and `list(...)` +/// // like `delete(...)`, `feedback_create(...)`, `feedback_list(...)`, `get(...)`, `list(...)` and `undelete(...)` /// // to build up your call. /// let rb = hub.alerts(); /// # } @@ -575,69 +672,13 @@ impl<'a, C, A> MethodsBuilder for AlertMethods<'a, C, A> {} impl<'a, C, A> AlertMethods<'a, C, A> { - /// Create a builder to help you perform the following task: - /// - /// Lists all the feedback for an alert. - /// - /// # Arguments - /// - /// * `alertId` - Required. The alert identifier. - /// If the alert does not exist returns a NOT_FOUND error. - pub fn feedback_list(&self, alert_id: &str) -> AlertFeedbackListCall<'a, C, A> { - AlertFeedbackListCall { - hub: self.hub, - _alert_id: alert_id.to_string(), - _customer_id: Default::default(), - _delegate: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the specified alert. - /// - /// # Arguments - /// - /// * `alertId` - Required. The identifier of the alert to retrieve. - pub fn get(&self, alert_id: &str) -> AlertGetCall<'a, C, A> { - AlertGetCall { - hub: self.hub, - _alert_id: alert_id.to_string(), - _customer_id: Default::default(), - _delegate: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new alert feedback. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `alertId` - Required. The identifier of the alert this feedback belongs to. - /// Returns a NOT_FOUND error if no such alert. - pub fn feedback_create(&self, request: AlertFeedback, alert_id: &str) -> AlertFeedbackCreateCall<'a, C, A> { - AlertFeedbackCreateCall { - hub: self.hub, - _request: request, - _alert_id: alert_id.to_string(), - _customer_id: Default::default(), - _delegate: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Marks the specified alert for deletion. An alert that has been marked for - /// deletion will be excluded from the results of a List operation by default, - /// and will be removed from the Alert Center after 30 days. - /// Marking an alert for deletion will have no effect on an alert which has + /// deletion is removed from Alert Center after 30 days. + /// Marking an alert for deletion has no effect on an alert which has /// already been marked for deletion. Attempting to mark a nonexistent alert - /// for deletion will return NOT_FOUND. + /// for deletion results in a `NOT_FOUND` error. /// /// # Arguments /// @@ -648,13 +689,56 @@ impl<'a, C, A> AlertMethods<'a, C, A> { _alert_id: alert_id.to_string(), _customer_id: Default::default(), _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// - /// Lists all the alerts for the current user and application. + /// Restores, or "undeletes", an alert that was marked for deletion within the + /// past 30 days. Attempting to undelete an alert which was marked for deletion + /// over 30 days ago (which has been removed from the Alert Center database) or + /// a nonexistent alert returns a `NOT_FOUND` error. Attempting to + /// undelete an alert which has not been marked for deletion has no effect. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `alertId` - Required. The identifier of the alert to undelete. + pub fn undelete(&self, request: UndeleteAlertRequest, alert_id: &str) -> AlertUndeleteCall<'a, C, A> { + AlertUndeleteCall { + hub: self.hub, + _request: request, + _alert_id: alert_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the specified alert. Attempting to get a nonexistent alert returns + /// `NOT_FOUND` error. + /// + /// # Arguments + /// + /// * `alertId` - Required. The identifier of the alert to retrieve. + pub fn get(&self, alert_id: &str) -> AlertGetCall<'a, C, A> { + AlertGetCall { + hub: self.hub, + _alert_id: alert_id.to_string(), + _customer_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the alerts. pub fn list(&self) -> AlertListCall<'a, C, A> { AlertListCall { hub: self.hub, @@ -664,6 +748,122 @@ impl<'a, C, A> AlertMethods<'a, C, A> { _filter: Default::default(), _customer_id: Default::default(), _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all the feedback for an alert. Attempting to list feedbacks for + /// a non-existent alert returns `NOT_FOUND` error. + /// + /// # Arguments + /// + /// * `alertId` - Required. The alert identifier. + /// The "-" wildcard could be used to represent all alerts. + pub fn feedback_list(&self, alert_id: &str) -> AlertFeedbackListCall<'a, C, A> { + AlertFeedbackListCall { + hub: self.hub, + _alert_id: alert_id.to_string(), + _filter: Default::default(), + _customer_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates new feedback for an alert. Attempting to create a feedback for + /// a non-existent alert returns `NOT_FOUND` error. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `alertId` - Required. The identifier of the alert this feedback belongs to. + pub fn feedback_create(&self, request: AlertFeedback, alert_id: &str) -> AlertFeedbackCreateCall<'a, C, A> { + AlertFeedbackCreateCall { + hub: self.hub, + _request: request, + _alert_id: alert_id.to_string(), + _customer_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all free methods, which are not associated with a particular resource. +/// It is not used directly, but through the `AlertCenter` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_alertcenter1_beta1 as alertcenter1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use alertcenter1_beta1::AlertCenter; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = AlertCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get_settings(...)` and `update_settings(...)` +/// // to build up your call. +/// let rb = hub.methods(); +/// # } +/// ``` +pub struct MethodMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AlertCenter, +} + +impl<'a, C, A> MethodsBuilder for MethodMethods<'a, C, A> {} + +impl<'a, C, A> MethodMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates the customer-level settings. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn update_settings(&self, request: Settings) -> MethodUpdateSettingCall<'a, C, A> { + MethodUpdateSettingCall { + hub: self.hub, + _request: request, + _customer_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns customer-level settings. + pub fn get_settings(&self) -> MethodGetSettingCall<'a, C, A> { + MethodGetSettingCall { + hub: self.hub, + _customer_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -677,9 +877,13 @@ impl<'a, C, A> AlertMethods<'a, C, A> { // CallBuilders ### // ################# -/// Lists all the feedback for an alert. +/// Marks the specified alert for deletion. An alert that has been marked for +/// deletion is removed from Alert Center after 30 days. +/// Marking an alert for deletion has no effect on an alert which has +/// already been marked for deletion. Attempting to mark a nonexistent alert +/// for deletion results in a `NOT_FOUND` error. /// -/// A builder for the *feedback.list* method supported by a *alert* resource. +/// A builder for the *delete* method supported by a *alert* resource. /// It is not used directly, but through a `AlertMethods` instance. /// /// # Example @@ -704,12 +908,12 @@ impl<'a, C, A> AlertMethods<'a, C, A> { /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.alerts().feedback_list("alertId") +/// let result = hub.alerts().delete("alertId") /// .customer_id("gubergren") /// .doit(); /// # } /// ``` -pub struct AlertFeedbackListCall<'a, C, A> +pub struct AlertDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AlertCenter, @@ -717,15 +921,16 @@ pub struct AlertFeedbackListCall<'a, C, A> _customer_id: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AlertFeedbackListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AlertDeleteCall<'a, C, A> {} -impl<'a, C, A> AlertFeedbackListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListAlertFeedbackResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -733,8 +938,8 @@ impl<'a, C, A> AlertFeedbackListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "alertcenter.alerts.feedback.list", - http_method: hyper::method::Method::Get }); + dlg.begin(MethodInfo { id: "alertcenter.alerts.delete", + http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("alertId", self._alert_id.to_string())); if let Some(value) = self._customer_id { @@ -752,18 +957,9 @@ impl<'a, C, A> AlertFeedbackListCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1beta1/alerts/{alertId}/feedback"; - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + let mut url = self.hub._base_url.clone() + "v1beta1/alerts/{alertId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AppAlert.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{alertId}", "alertId")].iter() { @@ -788,18 +984,29 @@ impl<'a, C, A> AlertFeedbackListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -850,23 +1057,22 @@ impl<'a, C, A> AlertFeedbackListCall<'a, C, A> where C: BorrowMut } - /// Required. The alert identifier. - /// If the alert does not exist returns a NOT_FOUND error. + /// Required. The identifier of the alert to delete. /// /// Sets the *alert id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn alert_id(mut self, new_value: &str) -> AlertFeedbackListCall<'a, C, A> { + pub fn alert_id(mut self, new_value: &str) -> AlertDeleteCall<'a, C, A> { self._alert_id = new_value.to_string(); self } - /// Optional. The unique identifier of the Google account of the customer the - /// alert is associated with. This is obfuscated and not the plain customer - /// ID as stored internally. Inferred from the caller identity if not provided. + /// Optional. The unique identifier of the G Suite organization account of the + /// customer the alert is associated with. + /// Inferred from the caller identity if not provided. /// /// Sets the *customer id* query property to the given value. - pub fn customer_id(mut self, new_value: &str) -> AlertFeedbackListCall<'a, C, A> { + pub fn customer_id(mut self, new_value: &str) -> AlertDeleteCall<'a, C, A> { self._customer_id = Some(new_value.to_string()); self } @@ -876,7 +1082,7 @@ impl<'a, C, A> AlertFeedbackListCall<'a, C, A> where C: BorrowMut /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlertFeedbackListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlertDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -885,7 +1091,7 @@ impl<'a, C, A> AlertFeedbackListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -893,24 +1099,327 @@ impl<'a, C, A> AlertFeedbackListCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AlertFeedbackListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AlertDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AppAlert`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlertDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } } -/// Gets the specified alert. +/// Restores, or "undeletes", an alert that was marked for deletion within the +/// past 30 days. Attempting to undelete an alert which was marked for deletion +/// over 30 days ago (which has been removed from the Alert Center database) or +/// a nonexistent alert returns a `NOT_FOUND` error. Attempting to +/// undelete an alert which has not been marked for deletion has no effect. +/// +/// A builder for the *undelete* method supported by a *alert* resource. +/// It is not used directly, but through a `AlertMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_alertcenter1_beta1 as alertcenter1_beta1; +/// use alertcenter1_beta1::UndeleteAlertRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use alertcenter1_beta1::AlertCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AlertCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UndeleteAlertRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.alerts().undelete(req, "alertId") +/// .doit(); +/// # } +/// ``` +pub struct AlertUndeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AlertCenter, + _request: UndeleteAlertRequest, + _alert_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AlertUndeleteCall<'a, C, A> {} + +impl<'a, C, A> AlertUndeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Alert)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "alertcenter.alerts.undelete", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("alertId", self._alert_id.to_string())); + for &field in ["alt", "alertId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/alerts/{alertId}:undelete"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AppAlert.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{alertId}", "alertId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["alertId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UndeleteAlertRequest) -> AlertUndeleteCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The identifier of the alert to undelete. + /// + /// Sets the *alert id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn alert_id(mut self, new_value: &str) -> AlertUndeleteCall<'a, C, A> { + self._alert_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlertUndeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AlertUndeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AppAlert`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlertUndeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the specified alert. Attempting to get a nonexistent alert returns +/// `NOT_FOUND` error. /// /// A builder for the *get* method supported by a *alert* resource. /// It is not used directly, but through a `AlertMethods` instance. @@ -938,7 +1447,7 @@ impl<'a, C, A> AlertFeedbackListCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.alerts().get("alertId") -/// .customer_id("aliquyam") +/// .customer_id("ea") /// .doit(); /// # } /// ``` @@ -950,6 +1459,7 @@ pub struct AlertGetCall<'a, C, A> _customer_id: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for AlertGetCall<'a, C, A> {} @@ -986,17 +1496,8 @@ impl<'a, C, A> AlertGetCall<'a, C, A> where C: BorrowMut, A: oaut params.push(("alt", "json".to_string())); let mut url = self.hub._base_url.clone() + "v1beta1/alerts/{alertId}"; - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AppAlert.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{alertId}", "alertId")].iter() { @@ -1021,18 +1522,29 @@ impl<'a, C, A> AlertGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -1093,9 +1605,9 @@ impl<'a, C, A> AlertGetCall<'a, C, A> where C: BorrowMut, A: oaut self._alert_id = new_value.to_string(); self } - /// Optional. The unique identifier of the Google account of the customer the - /// alert is associated with. This is obfuscated and not the plain customer - /// ID as stored internally. Inferred from the caller identity if not provided. + /// Optional. The unique identifier of the G Suite organization account of the + /// customer the alert is associated with. + /// Inferred from the caller identity if not provided. /// /// Sets the *customer id* query property to the given value. pub fn customer_id(mut self, new_value: &str) -> AlertGetCall<'a, C, A> { @@ -1117,7 +1629,7 @@ impl<'a, C, A> AlertGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1125,12 +1637,12 @@ impl<'a, C, A> AlertGetCall<'a, C, A> where C: BorrowMut, A: oaut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AlertGetCall<'a, C, A> @@ -1139,10 +1651,595 @@ impl<'a, C, A> AlertGetCall<'a, C, A> where C: BorrowMut, A: oaut self } + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AppAlert`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlertGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } } -/// Creates a new alert feedback. +/// Lists the alerts. +/// +/// A builder for the *list* method supported by a *alert* resource. +/// It is not used directly, but through a `AlertMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_alertcenter1_beta1 as alertcenter1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use alertcenter1_beta1::AlertCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AlertCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.alerts().list() +/// .page_token("no") +/// .page_size(-21) +/// .order_by("justo") +/// .filter("et") +/// .customer_id("et") +/// .doit(); +/// # } +/// ``` +pub struct AlertListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AlertCenter, + _page_token: Option, + _page_size: Option, + _order_by: Option, + _filter: Option, + _customer_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AlertListCall<'a, C, A> {} + +impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListAlertsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "alertcenter.alerts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + if let Some(value) = self._customer_id { + params.push(("customerId", value.to_string())); + } + for &field in ["alt", "pageToken", "pageSize", "orderBy", "filter", "customerId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/alerts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AppAlert.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Optional. A token identifying a page of results the server should return. + /// If empty, a new iteration is started. To continue an iteration, pass in + /// the value from the previous ListAlertsResponse's + /// next_page_token field. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AlertListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The requested page size. Server may return fewer items than + /// requested. If unspecified, server picks an appropriate default. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> AlertListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Optional. The sort order of the list results. + /// If not specified results may be returned in arbitrary order. + /// You can sort the results in descending order based on the creation + /// timestamp using `order_by="create_time desc"`. + /// Currently, only sorting by `create_time desc` is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> AlertListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// Optional. A query string for filtering alert results. + /// For more details, see [Query + /// filters](/admin-sdk/alertcenter/guides/query-filters) and [Supported + /// query filter + /// fields](/admin-sdk/alertcenter/reference/filter-fields#alerts.list). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> AlertListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// Optional. The unique identifier of the G Suite organization account of the + /// customer the alerts are associated with. + /// Inferred from the caller identity if not provided. + /// + /// Sets the *customer id* query property to the given value. + pub fn customer_id(mut self, new_value: &str) -> AlertListCall<'a, C, A> { + self._customer_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlertListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AlertListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AppAlert`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlertListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all the feedback for an alert. Attempting to list feedbacks for +/// a non-existent alert returns `NOT_FOUND` error. +/// +/// A builder for the *feedback.list* method supported by a *alert* resource. +/// It is not used directly, but through a `AlertMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_alertcenter1_beta1 as alertcenter1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use alertcenter1_beta1::AlertCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AlertCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.alerts().feedback_list("alertId") +/// .filter("ipsum") +/// .customer_id("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct AlertFeedbackListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AlertCenter, + _alert_id: String, + _filter: Option, + _customer_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AlertFeedbackListCall<'a, C, A> {} + +impl<'a, C, A> AlertFeedbackListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListAlertFeedbackResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "alertcenter.alerts.feedback.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("alertId", self._alert_id.to_string())); + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + if let Some(value) = self._customer_id { + params.push(("customerId", value.to_string())); + } + for &field in ["alt", "alertId", "filter", "customerId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/alerts/{alertId}/feedback"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AppAlert.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{alertId}", "alertId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["alertId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The alert identifier. + /// The "-" wildcard could be used to represent all alerts. + /// + /// Sets the *alert id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn alert_id(mut self, new_value: &str) -> AlertFeedbackListCall<'a, C, A> { + self._alert_id = new_value.to_string(); + self + } + /// Optional. A query string for filtering alert feedback results. + /// For more details, see [Query + /// filters](/admin-sdk/alertcenter/guides/query-filters) and [Supported + /// query filter + /// fields](/admin-sdk/alertcenter/reference/filter-fields#alerts.feedback.list). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> AlertFeedbackListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// Optional. The unique identifier of the G Suite organization account of the + /// customer the alert feedback are associated with. + /// Inferred from the caller identity if not provided. + /// + /// Sets the *customer id* query property to the given value. + pub fn customer_id(mut self, new_value: &str) -> AlertFeedbackListCall<'a, C, A> { + self._customer_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlertFeedbackListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AlertFeedbackListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AppAlert`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlertFeedbackListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates new feedback for an alert. Attempting to create a feedback for +/// a non-existent alert returns `NOT_FOUND` error. /// /// A builder for the *feedback.create* method supported by a *alert* resource. /// It is not used directly, but through a `AlertMethods` instance. @@ -1176,7 +2273,7 @@ impl<'a, C, A> AlertGetCall<'a, C, A> where C: BorrowMut, A: oaut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.alerts().feedback_create(req, "alertId") -/// .customer_id("no") +/// .customer_id("duo") /// .doit(); /// # } /// ``` @@ -1189,6 +2286,7 @@ pub struct AlertFeedbackCreateCall<'a, C, A> _customer_id: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } impl<'a, C, A> CallBuilder for AlertFeedbackCreateCall<'a, C, A> {} @@ -1225,17 +2323,8 @@ impl<'a, C, A> AlertFeedbackCreateCall<'a, C, A> where C: BorrowMut params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AppAlert.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{alertId}", "alertId")].iter() { @@ -1260,10 +2349,7 @@ impl<'a, C, A> AlertFeedbackCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1279,11 +2365,25 @@ impl<'a, C, A> AlertFeedbackCreateCall<'a, C, A> where C: BorrowMut token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); @@ -1347,7 +2447,6 @@ impl<'a, C, A> AlertFeedbackCreateCall<'a, C, A> where C: BorrowMut AlertFeedbackCreateCall<'a, C, A> where C: BorrowMut AlertFeedbackCreateCall<'a, C, A> { @@ -1382,7 +2480,7 @@ impl<'a, C, A> AlertFeedbackCreateCall<'a, C, A> where C: BorrowMut AlertFeedbackCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AlertFeedbackCreateCall<'a, C, A> @@ -1404,18 +2502,36 @@ impl<'a, C, A> AlertFeedbackCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AlertFeedbackCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } } -/// Marks the specified alert for deletion. An alert that has been marked for -/// deletion will be excluded from the results of a List operation by default, -/// and will be removed from the Alert Center after 30 days. -/// Marking an alert for deletion will have no effect on an alert which has -/// already been marked for deletion. Attempting to mark a nonexistent alert -/// for deletion will return NOT_FOUND. +/// Updates the customer-level settings. /// -/// A builder for the *delete* method supported by a *alert* resource. -/// It is not used directly, but through a `AlertMethods` instance. +/// A builder for the *updateSettings* method. +/// It is not used directly, but through a `MethodMethods` instance. /// /// # Example /// @@ -1426,6 +2542,7 @@ impl<'a, C, A> AlertFeedbackCreateCall<'a, C, A> where C: BorrowMut AlertFeedbackCreateCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = AlertCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Settings::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.alerts().delete("alertId") -/// .customer_id("justo") +/// let result = hub.methods().update_settings(req) +/// .customer_id("aliquyam") /// .doit(); /// # } /// ``` -pub struct AlertDeleteCall<'a, C, A> +pub struct MethodUpdateSettingCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AlertCenter, - _alert_id: String, + _request: Settings, _customer_id: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AlertDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for MethodUpdateSettingCall<'a, C, A> {} -impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> MethodUpdateSettingCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Settings)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -1468,14 +2591,13 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "alertcenter.alerts.delete", - http_method: hyper::method::Method::Delete }); + dlg.begin(MethodInfo { id: "alertcenter.updateSettings", + http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("alertId", self._alert_id.to_string())); if let Some(value) = self._customer_id { params.push(("customerId", value.to_string())); } - for &field in ["alt", "alertId", "customerId"].iter() { + for &field in ["alt", "customerId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1487,54 +2609,50 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1beta1/alerts/{alertId}"; - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + let mut url = self.hub._base_url.clone() + "v1beta1/settings"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AppAlert.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{alertId}", "alertId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["alertId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -1585,22 +2703,21 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o } - /// Required. The identifier of the alert to delete. /// - /// Sets the *alert id* path property to the given value. + /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn alert_id(mut self, new_value: &str) -> AlertDeleteCall<'a, C, A> { - self._alert_id = new_value.to_string(); + pub fn request(mut self, new_value: Settings) -> MethodUpdateSettingCall<'a, C, A> { + self._request = new_value; self } - /// Optional. The unique identifier of the Google account of the customer the - /// alert is associated with. This is obfuscated and not the plain customer - /// ID as stored internally. Inferred from the caller identity if not provided. + /// Optional. The unique identifier of the G Suite organization account of the + /// customer the alert settings are associated with. + /// Inferred from the caller identity if not provided. /// /// Sets the *customer id* query property to the given value. - pub fn customer_id(mut self, new_value: &str) -> AlertDeleteCall<'a, C, A> { + pub fn customer_id(mut self, new_value: &str) -> MethodUpdateSettingCall<'a, C, A> { self._customer_id = Some(new_value.to_string()); self } @@ -1610,7 +2727,7 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlertDeleteCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodUpdateSettingCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -1619,7 +2736,7 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1627,27 +2744,50 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AlertDeleteCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> MethodUpdateSettingCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AppAlert`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MethodUpdateSettingCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } } -/// Lists all the alerts for the current user and application. +/// Returns customer-level settings. /// -/// A builder for the *list* method supported by a *alert* resource. -/// It is not used directly, but through a `AlertMethods` instance. +/// A builder for the *getSettings* method. +/// It is not used directly, but through a `MethodMethods` instance. /// /// # Example /// @@ -1671,35 +2811,28 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.alerts().list() -/// .page_token("et") -/// .page_size(-17) -/// .order_by("diam") -/// .filter("ipsum") -/// .customer_id("Lorem") +/// let result = hub.methods().get_settings() +/// .customer_id("sea") /// .doit(); /// # } /// ``` -pub struct AlertListCall<'a, C, A> +pub struct MethodGetSettingCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AlertCenter, - _page_token: Option, - _page_size: Option, - _order_by: Option, - _filter: Option, _customer_id: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AlertListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for MethodGetSettingCall<'a, C, A> {} -impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> MethodGetSettingCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListAlertsResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Settings)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -1707,25 +2840,13 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "alertcenter.alerts.list", + dlg.begin(MethodInfo { id: "alertcenter.getSettings", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if let Some(value) = self._order_by { - params.push(("orderBy", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); if let Some(value) = self._customer_id { params.push(("customerId", value.to_string())); } - for &field in ["alt", "pageToken", "pageSize", "orderBy", "filter", "customerId"].iter() { + for &field in ["alt", "customerId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1737,33 +2858,35 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1beta1/alerts"; - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + let mut url = self.hub._base_url.clone() + "v1beta1/settings"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AppAlert.as_ref().to_string(), ()); } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -1814,116 +2937,12 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau } - /// Optional. A token identifying a page of results the server should return. - /// If empty, a new iteration is started. To continue an iteration, pass in - /// the value from the previous ListAlertsResponse's next_page_token field. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> AlertListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. Requested page size. Server may return fewer items than - /// requested. If unspecified, server will pick an appropriate default. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> AlertListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// Optional. Sort the list results by a certain order. - /// If not specified results may be returned in arbitrary order. - /// You can sort the results in a descending order based on the creation - /// timestamp using order_by="create_time desc". - /// Currently, only sorting by create_time desc is supported. - /// - /// Sets the *order by* query property to the given value. - pub fn order_by(mut self, new_value: &str) -> AlertListCall<'a, C, A> { - self._order_by = Some(new_value.to_string()); - self - } - /// Optional. Query string for filtering alert results. - /// This string must be specified as an expression or list of expressions, - /// using the following grammar: - /// - /// ### Expressions - /// - /// An expression has the general form ` `. - /// - /// A field or value which contains a space or a colon must be enclosed by - /// double quotes. - /// - /// #### Operators - /// - /// Operators follow the BNF specification: - /// - /// ` ::= "=" | ":"` - /// - /// ` ::= "<" | ">" | "<=" | ">="` - /// - /// Relational operators are defined only for timestamp fields. Equality - /// operators are defined only for string fields. - /// - /// #### Timestamp fields - /// - /// The value supplied for a timestamp field must be an - /// [RFC 3339](https://tools.ietf.org/html/rfc3339) date-time string. - /// - /// Supported timestamp fields are `create_time`, `start_time`, and `end_time`. - /// - /// #### String fields - /// - /// The value supplied for a string field may be an arbitrary string. - /// - /// #### Examples - /// - /// To query for all alerts created on or after April 5, 2018: - /// - /// `create_time >= "2018-04-05T00:00:00Z"` - /// - /// To query for all alerts from the source "Gmail phishing": - /// - /// `source:"Gmail phishing"` - /// - /// ### Joining expressions - /// - /// Expressions may be joined to form a more complex query. The BNF - /// specification is: - /// - /// ` ::= | - /// | ` - /// ` ::= "AND" | "OR" | ""` - /// ` ::= "NOT"` - /// - /// Using the empty string as a conjunction acts as an implicit AND. - /// - /// The precedence of joining operations, from highest to lowest, is NOT, AND, - /// OR. - /// - /// #### Examples - /// - /// To query for all alerts which started in 2017: - /// - /// `start_time >= "2017-01-01T00:00:00Z" AND start_time < - /// "2018-01-01T00:00:00Z"` - /// - /// To query for all user reported phishing alerts from the source - /// "Gmail phishing": - /// - /// `type:"User reported phishing" source:"Gmail phishing"` - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> AlertListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); - self - } - /// Optional. The unique identifier of the Google account of the customer the - /// alerts are associated with. This is obfuscated and not the plain - /// customer ID as stored internally. Inferred from the caller identity if not - /// provided. + /// Optional. The unique identifier of the G Suite organization account of the + /// customer the alert settings are associated with. + /// Inferred from the caller identity if not provided. /// /// Sets the *customer id* query property to the given value. - pub fn customer_id(mut self, new_value: &str) -> AlertListCall<'a, C, A> { + pub fn customer_id(mut self, new_value: &str) -> MethodGetSettingCall<'a, C, A> { self._customer_id = Some(new_value.to_string()); self } @@ -1933,7 +2952,7 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlertListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodGetSettingCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -1942,7 +2961,7 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1950,20 +2969,43 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AlertListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> MethodGetSettingCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AppAlert`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MethodGetSettingCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } } diff --git a/gen/analytics3-cli/Cargo.toml b/gen/analytics3-cli/Cargo.toml index 08c890a305..b7d348be23 100644 --- a/gen/analytics3-cli/Cargo.toml +++ b/gen/analytics3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-analytics3-cli" -version = "1.0.8+20180622" +version = "1.0.8+20180730" authors = ["Sebastian Thiel "] description = "A complete library to interact with analytics (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/analytics3-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-analytics3] path = "../analytics3" -version = "1.0.8+20180622" +version = "1.0.8+20180730" diff --git a/gen/analytics3-cli/README.md b/gen/analytics3-cli/README.md index 9c374339e7..8751fcd3b1 100644 --- a/gen/analytics3-cli/README.md +++ b/gen/analytics3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *analytics* API at revision *20180622*. The CLI is at version *1.0.8*. +This documentation was generated from the *analytics* API at revision *20180730*. The CLI is at version *1.0.8*. ```bash analytics3 [options] diff --git a/gen/analytics3-cli/mkdocs.yml b/gen/analytics3-cli/mkdocs.yml index 3c0b767c1b..3a5b327b94 100644 --- a/gen/analytics3-cli/mkdocs.yml +++ b/gen/analytics3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: analytics v1.0.8+20180622 +site_name: analytics v1.0.8+20180730 site_url: http://byron.github.io/google-apis-rs/google-analytics3-cli site_description: A complete library to interact with analytics (protocol v3) diff --git a/gen/analytics3-cli/src/main.rs b/gen/analytics3-cli/src/main.rs index 532d79052e..07e05d8a2c 100644 --- a/gen/analytics3-cli/src/main.rs +++ b/gen/analytics3-cli/src/main.rs @@ -6869,14 +6869,10 @@ impl<'n> Engine<'n> { "webproperty-name" => Some(("webpropertyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-name" => Some(("accountName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "website-url" => Some(("websiteUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "timezone" => Some(("timezone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile-name" => Some(("profileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "account-settings.share-with-specialists" => Some(("accountSettings.shareWithSpecialists", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "account-settings.share-with-support" => Some(("accountSettings.shareWithSupport", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "account-settings.share-anonymously-with-others" => Some(("accountSettings.shareAnonymouslyWithOthers", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "account-settings.share-with-google-products" => Some(("accountSettings.shareWithGoogleProducts", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "timezone" => Some(("timezone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-name", "account-settings", "kind", "profile-name", "share-anonymously-with-others", "share-with-google-products", "share-with-specialists", "share-with-support", "timezone", "webproperty-name", "website-url"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-name", "kind", "profile-name", "timezone", "webproperty-name", "website-url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -9805,7 +9801,7 @@ fn main() { Some(false)), ]), ("web-property-ad-words-links-delete", - Some(r##"Deletes a web property-AdWords link."##), + Some(r##"Deletes a web property-Google Ads link."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-delete", vec![ (Some(r##"account-id"##), @@ -9816,13 +9812,13 @@ fn main() { (Some(r##"web-property-id"##), None, - Some(r##"Web property ID to delete the AdWords link for."##), + Some(r##"Web property ID to delete the Google Ads link for."##), Some(true), Some(false)), (Some(r##"web-property-ad-words-link-id"##), None, - Some(r##"Web property AdWords link ID."##), + Some(r##"Web property Google Ads link ID."##), Some(true), Some(false)), @@ -9833,7 +9829,7 @@ fn main() { Some(true)), ]), ("web-property-ad-words-links-get", - Some(r##"Returns a web property-AdWords link to which the user has access."##), + Some(r##"Returns a web property-Google Ads link to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-get", vec![ (Some(r##"account-id"##), @@ -9844,13 +9840,13 @@ fn main() { (Some(r##"web-property-id"##), None, - Some(r##"Web property ID to retrieve the AdWords link for."##), + Some(r##"Web property ID to retrieve the Google Ads link for."##), Some(true), Some(false)), (Some(r##"web-property-ad-words-link-id"##), None, - Some(r##"Web property-AdWords link ID."##), + Some(r##"Web property-Google Ads link ID."##), Some(true), Some(false)), @@ -9867,7 +9863,7 @@ fn main() { Some(false)), ]), ("web-property-ad-words-links-insert", - Some(r##"Creates a webProperty-AdWords link."##), + Some(r##"Creates a webProperty-Google Ads link."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-insert", vec![ (Some(r##"account-id"##), @@ -9901,7 +9897,7 @@ fn main() { Some(false)), ]), ("web-property-ad-words-links-list", - Some(r##"Lists webProperty-AdWords links for a given web property."##), + Some(r##"Lists webProperty-Google Ads links for a given web property."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-list", vec![ (Some(r##"account-id"##), @@ -9912,7 +9908,7 @@ fn main() { (Some(r##"web-property-id"##), None, - Some(r##"Web property ID to retrieve the AdWords links for."##), + Some(r##"Web property ID to retrieve the Google Ads links for."##), Some(true), Some(false)), @@ -9929,7 +9925,7 @@ fn main() { Some(false)), ]), ("web-property-ad-words-links-patch", - Some(r##"Updates an existing webProperty-AdWords link. This method supports patch semantics."##), + Some(r##"Updates an existing webProperty-Google Ads link. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-patch", vec![ (Some(r##"account-id"##), @@ -9940,13 +9936,13 @@ fn main() { (Some(r##"web-property-id"##), None, - Some(r##"Web property ID to retrieve the AdWords link for."##), + Some(r##"Web property ID to retrieve the Google Ads link for."##), Some(true), Some(false)), (Some(r##"web-property-ad-words-link-id"##), None, - Some(r##"Web property-AdWords link ID."##), + Some(r##"Web property-Google Ads link ID."##), Some(true), Some(false)), @@ -9969,7 +9965,7 @@ fn main() { Some(false)), ]), ("web-property-ad-words-links-update", - Some(r##"Updates an existing webProperty-AdWords link."##), + Some(r##"Updates an existing webProperty-Google Ads link."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-update", vec![ (Some(r##"account-id"##), @@ -9980,13 +9976,13 @@ fn main() { (Some(r##"web-property-id"##), None, - Some(r##"Web property ID to retrieve the AdWords link for."##), + Some(r##"Web property ID to retrieve the Google Ads link for."##), Some(true), Some(false)), (Some(r##"web-property-ad-words-link-id"##), None, - Some(r##"Web property-AdWords link ID."##), + Some(r##"Web property-Google Ads link ID."##), Some(true), Some(false)), @@ -10387,7 +10383,7 @@ fn main() { let mut app = App::new("analytics3") .author("Sebastian Thiel ") - .version("1.0.8+20180622") + .version("1.0.8+20180730") .about("Views and manages your Google Analytics data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_analytics3_cli") .arg(Arg::with_name("url") diff --git a/gen/analytics3/Cargo.toml b/gen/analytics3/Cargo.toml index 9efa0b2d39..c9ca1d4a25 100644 --- a/gen/analytics3/Cargo.toml +++ b/gen/analytics3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-analytics3" -version = "1.0.8+20180622" +version = "1.0.8+20180730" authors = ["Sebastian Thiel "] description = "A complete library to interact with analytics (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/analytics3" homepage = "https://developers.google.com/analytics/" -documentation = "https://docs.rs/google-analytics3/1.0.8+20180622" +documentation = "https://docs.rs/google-analytics3/1.0.8+20180730" license = "MIT" keywords = ["analytics", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/analytics3/README.md b/gen/analytics3/README.md index 7c21dd1893..179b790f15 100644 --- a/gen/analytics3/README.md +++ b/gen/analytics3/README.md @@ -5,29 +5,29 @@ DO NOT EDIT ! --> The `google-analytics3` library allows access to all features of the *Google analytics* service. -This documentation was generated from *analytics* crate version *1.0.8+20180622*, where *20180622* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *analytics* crate version *1.0.8+20180730*, where *20180730* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *analytics* *v3* API can be found at the [official documentation site](https://developers.google.com/analytics/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.Analytics.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.Analytics.html) ... * data - * [*ga get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.DataGaGetCall.html), [*mcf get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.DataMcfGetCall.html) and [*realtime get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.DataRealtimeGetCall.html) + * [*ga get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.DataGaGetCall.html), [*mcf get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.DataMcfGetCall.html) and [*realtime get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.DataRealtimeGetCall.html) * management - * [*account summaries list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementAccountSummaryListCall.html), [*account user links delete*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementAccountUserLinkDeleteCall.html), [*account user links insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementAccountUserLinkInsertCall.html), [*account user links list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementAccountUserLinkListCall.html), [*account user links update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementAccountUserLinkUpdateCall.html), [*accounts list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementAccountListCall.html), [*client id hash client id*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementClientIdHashClientIdCall.html), [*custom data sources list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomDataSourceListCall.html), [*custom dimensions get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomDimensionGetCall.html), [*custom dimensions insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomDimensionInsertCall.html), [*custom dimensions list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomDimensionListCall.html), [*custom dimensions patch*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomDimensionPatchCall.html), [*custom dimensions update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomDimensionUpdateCall.html), [*custom metrics get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomMetricGetCall.html), [*custom metrics insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomMetricInsertCall.html), [*custom metrics list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomMetricListCall.html), [*custom metrics patch*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomMetricPatchCall.html), [*custom metrics update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementCustomMetricUpdateCall.html), [*experiments delete*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementExperimentDeleteCall.html), [*experiments get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementExperimentGetCall.html), [*experiments insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementExperimentInsertCall.html), [*experiments list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementExperimentListCall.html), [*experiments patch*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementExperimentPatchCall.html), [*experiments update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementExperimentUpdateCall.html), [*filters delete*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementFilterDeleteCall.html), [*filters get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementFilterGetCall.html), [*filters insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementFilterInsertCall.html), [*filters list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementFilterListCall.html), [*filters patch*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementFilterPatchCall.html), [*filters update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementFilterUpdateCall.html), [*goals get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementGoalGetCall.html), [*goals insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementGoalInsertCall.html), [*goals list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementGoalListCall.html), [*goals patch*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementGoalPatchCall.html), [*goals update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementGoalUpdateCall.html), [*profile filter links delete*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileFilterLinkDeleteCall.html), [*profile filter links get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileFilterLinkGetCall.html), [*profile filter links insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileFilterLinkInsertCall.html), [*profile filter links list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileFilterLinkListCall.html), [*profile filter links patch*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileFilterLinkPatchCall.html), [*profile filter links update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileFilterLinkUpdateCall.html), [*profile user links delete*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileUserLinkDeleteCall.html), [*profile user links insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileUserLinkInsertCall.html), [*profile user links list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileUserLinkListCall.html), [*profile user links update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileUserLinkUpdateCall.html), [*profiles delete*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileDeleteCall.html), [*profiles get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileGetCall.html), [*profiles insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileInsertCall.html), [*profiles list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileListCall.html), [*profiles patch*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfilePatchCall.html), [*profiles update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementProfileUpdateCall.html), [*remarketing audience delete*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementRemarketingAudienceDeleteCall.html), [*remarketing audience get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementRemarketingAudienceGetCall.html), [*remarketing audience insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementRemarketingAudienceInsertCall.html), [*remarketing audience list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementRemarketingAudienceListCall.html), [*remarketing audience patch*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementRemarketingAudiencePatchCall.html), [*remarketing audience update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementRemarketingAudienceUpdateCall.html), [*segments list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementSegmentListCall.html), [*unsampled reports delete*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementUnsampledReportDeleteCall.html), [*unsampled reports get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementUnsampledReportGetCall.html), [*unsampled reports insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementUnsampledReportInsertCall.html), [*unsampled reports list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementUnsampledReportListCall.html), [*uploads delete upload data*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementUploadDeleteUploadDataCall.html), [*uploads get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementUploadGetCall.html), [*uploads list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementUploadListCall.html), [*uploads upload data*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementUploadUploadDataCall.html), [*web property ad words links delete*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebPropertyAdWordsLinkDeleteCall.html), [*web property ad words links get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebPropertyAdWordsLinkGetCall.html), [*web property ad words links insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebPropertyAdWordsLinkInsertCall.html), [*web property ad words links list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebPropertyAdWordsLinkListCall.html), [*web property ad words links patch*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebPropertyAdWordsLinkPatchCall.html), [*web property ad words links update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebPropertyAdWordsLinkUpdateCall.html), [*webproperties get*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebpropertyGetCall.html), [*webproperties insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebpropertyInsertCall.html), [*webproperties list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebpropertyListCall.html), [*webproperties patch*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebpropertyPatchCall.html), [*webproperties update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebpropertyUpdateCall.html), [*webproperty user links delete*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebpropertyUserLinkDeleteCall.html), [*webproperty user links insert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebpropertyUserLinkInsertCall.html), [*webproperty user links list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebpropertyUserLinkListCall.html) and [*webproperty user links update*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementWebpropertyUserLinkUpdateCall.html) + * [*account summaries list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementAccountSummaryListCall.html), [*account user links delete*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementAccountUserLinkDeleteCall.html), [*account user links insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementAccountUserLinkInsertCall.html), [*account user links list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementAccountUserLinkListCall.html), [*account user links update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementAccountUserLinkUpdateCall.html), [*accounts list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementAccountListCall.html), [*client id hash client id*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementClientIdHashClientIdCall.html), [*custom data sources list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomDataSourceListCall.html), [*custom dimensions get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomDimensionGetCall.html), [*custom dimensions insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomDimensionInsertCall.html), [*custom dimensions list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomDimensionListCall.html), [*custom dimensions patch*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomDimensionPatchCall.html), [*custom dimensions update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomDimensionUpdateCall.html), [*custom metrics get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomMetricGetCall.html), [*custom metrics insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomMetricInsertCall.html), [*custom metrics list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomMetricListCall.html), [*custom metrics patch*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomMetricPatchCall.html), [*custom metrics update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementCustomMetricUpdateCall.html), [*experiments delete*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementExperimentDeleteCall.html), [*experiments get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementExperimentGetCall.html), [*experiments insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementExperimentInsertCall.html), [*experiments list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementExperimentListCall.html), [*experiments patch*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementExperimentPatchCall.html), [*experiments update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementExperimentUpdateCall.html), [*filters delete*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementFilterDeleteCall.html), [*filters get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementFilterGetCall.html), [*filters insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementFilterInsertCall.html), [*filters list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementFilterListCall.html), [*filters patch*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementFilterPatchCall.html), [*filters update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementFilterUpdateCall.html), [*goals get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementGoalGetCall.html), [*goals insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementGoalInsertCall.html), [*goals list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementGoalListCall.html), [*goals patch*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementGoalPatchCall.html), [*goals update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementGoalUpdateCall.html), [*profile filter links delete*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileFilterLinkDeleteCall.html), [*profile filter links get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileFilterLinkGetCall.html), [*profile filter links insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileFilterLinkInsertCall.html), [*profile filter links list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileFilterLinkListCall.html), [*profile filter links patch*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileFilterLinkPatchCall.html), [*profile filter links update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileFilterLinkUpdateCall.html), [*profile user links delete*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileUserLinkDeleteCall.html), [*profile user links insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileUserLinkInsertCall.html), [*profile user links list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileUserLinkListCall.html), [*profile user links update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileUserLinkUpdateCall.html), [*profiles delete*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileDeleteCall.html), [*profiles get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileGetCall.html), [*profiles insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileInsertCall.html), [*profiles list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileListCall.html), [*profiles patch*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfilePatchCall.html), [*profiles update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementProfileUpdateCall.html), [*remarketing audience delete*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementRemarketingAudienceDeleteCall.html), [*remarketing audience get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementRemarketingAudienceGetCall.html), [*remarketing audience insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementRemarketingAudienceInsertCall.html), [*remarketing audience list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementRemarketingAudienceListCall.html), [*remarketing audience patch*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementRemarketingAudiencePatchCall.html), [*remarketing audience update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementRemarketingAudienceUpdateCall.html), [*segments list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementSegmentListCall.html), [*unsampled reports delete*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementUnsampledReportDeleteCall.html), [*unsampled reports get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementUnsampledReportGetCall.html), [*unsampled reports insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementUnsampledReportInsertCall.html), [*unsampled reports list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementUnsampledReportListCall.html), [*uploads delete upload data*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementUploadDeleteUploadDataCall.html), [*uploads get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementUploadGetCall.html), [*uploads list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementUploadListCall.html), [*uploads upload data*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementUploadUploadDataCall.html), [*web property ad words links delete*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebPropertyAdWordsLinkDeleteCall.html), [*web property ad words links get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebPropertyAdWordsLinkGetCall.html), [*web property ad words links insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebPropertyAdWordsLinkInsertCall.html), [*web property ad words links list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebPropertyAdWordsLinkListCall.html), [*web property ad words links patch*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebPropertyAdWordsLinkPatchCall.html), [*web property ad words links update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebPropertyAdWordsLinkUpdateCall.html), [*webproperties get*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebpropertyGetCall.html), [*webproperties insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebpropertyInsertCall.html), [*webproperties list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebpropertyListCall.html), [*webproperties patch*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebpropertyPatchCall.html), [*webproperties update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebpropertyUpdateCall.html), [*webproperty user links delete*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebpropertyUserLinkDeleteCall.html), [*webproperty user links insert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebpropertyUserLinkInsertCall.html), [*webproperty user links list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebpropertyUserLinkListCall.html) and [*webproperty user links update*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementWebpropertyUserLinkUpdateCall.html) * metadata - * [*columns list*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.MetadataColumnListCall.html) + * [*columns list*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.MetadataColumnListCall.html) * provisioning - * [*create account ticket*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ProvisioningCreateAccountTicketCall.html) and [*create account tree*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ProvisioningCreateAccountTreeCall.html) + * [*create account ticket*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ProvisioningCreateAccountTicketCall.html) and [*create account tree*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ProvisioningCreateAccountTreeCall.html) * user deletion - * [*user deletion request upsert*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.UserDeletionUserDeletionRequestUpsertCall.html) + * [*user deletion request upsert*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.UserDeletionUserDeletionRequestUpsertCall.html) Upload supported by ... -* [*uploads upload data management*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.ManagementUploadUploadDataCall.html) +* [*uploads upload data management*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.ManagementUploadUploadDataCall.html) @@ -35,17 +35,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/struct.Analytics.html)** +* **[Hub](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/struct.Analytics.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.Part.html)** + * **[Parts](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -147,17 +147,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -167,29 +167,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-analytics3/1.0.8+20180622/google_analytics3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-analytics3/1.0.8+20180730/google_analytics3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/analytics3/src/lib.rs b/gen/analytics3/src/lib.rs index 13436a23e1..348d7137ba 100644 --- a/gen/analytics3/src/lib.rs +++ b/gen/analytics3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *analytics* crate version *1.0.8+20180622*, where *20180622* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *analytics* crate version *1.0.8+20180730*, where *20180730* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *analytics* *v3* API can be found at the //! [official documentation site](https://developers.google.com/analytics/). @@ -478,30 +478,6 @@ impl RequestValue for CustomMetric {} impl ResponseResult for CustomMetric {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AccountTreeRequestAccountSettings { - /// no description provided - #[serde(rename="shareWithSpecialists")] - pub share_with_specialists: Option, - /// no description provided - #[serde(rename="shareWithSupport")] - pub share_with_support: Option, - /// no description provided - #[serde(rename="shareAnonymouslyWithOthers")] - pub share_anonymously_with_others: Option, - /// no description provided - #[serde(rename="shareWithGoogleProducts")] - pub share_with_google_products: Option, -} - -impl NestedType for AccountTreeRequestAccountSettings {} -impl Part for AccountTreeRequestAccountSettings {} - - /// JSON template for Analytics goal resource. /// /// # Activities @@ -2044,7 +2020,7 @@ impl ResponseResult for RealtimeData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LinkedForeignAccount { - /// The foreign account ID. For example the an AdWords `linkedAccountId` has the following format XXX-XXX-XXXX. + /// The foreign account ID. For example the an Google Ads `linkedAccountId` has the following format XXX-XXX-XXXX. #[serde(rename="linkedAccountId")] pub linked_account_id: Option, /// The status of this foreign account link. @@ -2453,18 +2429,18 @@ impl NestedType for GaDataDataTableRows {} impl Part for GaDataDataTableRows {} -/// JSON template for an AdWords account. +/// JSON template for an Google Ads account. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AdWordsAccount { - /// Resource type for AdWords account. + /// Resource type for Google Ads account. pub kind: Option, - /// Customer ID. This field is required when creating an AdWords link. + /// Customer ID. This field is required when creating a Google Ads link. #[serde(rename="customerId")] pub customer_id: Option, - /// True if auto-tagging is enabled on the AdWords account. Read-only after the insert operation. + /// True if auto-tagging is enabled on the Google Ads account. Read-only after the insert operation. #[serde(rename="autoTaggingEnabled")] pub auto_tagging_enabled: Option, } @@ -2643,7 +2619,7 @@ impl RequestValue for Filter {} impl ResponseResult for Filter {} -/// JSON template for Analytics Entity AdWords Link. +/// JSON template for Analytics Entity Google Ads Link. /// /// # Activities /// @@ -2657,19 +2633,19 @@ impl ResponseResult for Filter {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct EntityAdWordsLink { - /// Resource type for entity AdWords link. + /// Resource type for entity Google Ads link. pub kind: Option, - /// Name of the link. This field is required when creating an AdWords link. + /// Name of the link. This field is required when creating a Google Ads link. pub name: Option, - /// A list of AdWords client accounts. These cannot be MCC accounts. This field is required when creating an AdWords link. It cannot be empty. + /// A list of Google Ads client accounts. These cannot be MCC accounts. This field is required when creating a Google Ads link. It cannot be empty. #[serde(rename="adWordsAccounts")] pub ad_words_accounts: Option>, /// IDs of linked Views (Profiles) represented as strings. #[serde(rename="profileIds")] pub profile_ids: Option>, - /// Entity AdWords link ID + /// Entity Google Ads link ID pub id: Option, - /// URL link for this Google Analytics - Google AdWords link. + /// URL link for this Google Analytics - Google Ads link. #[serde(rename="selfLink")] pub self_link: Option, /// Web property being linked. @@ -2735,9 +2711,6 @@ pub struct AccountTreeRequest { #[serde(rename="webpropertyName")] pub webproperty_name: Option, /// no description provided - #[serde(rename="accountSettings")] - pub account_settings: Option, - /// no description provided pub timezone: Option, /// no description provided #[serde(rename="profileName")] @@ -2841,9 +2814,6 @@ impl Part for CustomMetricParentLink {} pub struct AccountTreeResponse { /// View (Profile) for the account. pub profile: Option, - /// no description provided - #[serde(rename="accountSettings")] - pub account_settings: Option, /// The account created. pub account: Option, /// Web property for the account. @@ -2892,7 +2862,7 @@ impl NestedType for GoalParentLink {} impl Part for GoalParentLink {} -/// An entity AdWords link collection provides a list of GA-AdWords links Each resource in this collection corresponds to a single link. +/// An entity Google Ads link collection provides a list of GA-Google Ads links Each resource in this collection corresponds to a single link. /// /// # Activities /// @@ -2908,9 +2878,9 @@ pub struct EntityAdWordsLinks { /// The total number of results for the query, regardless of the number of results in the response. #[serde(rename="totalResults")] pub total_results: Option, - /// A list of entity AdWords links. + /// A list of entity Google Ads links. pub items: Option>, - /// Previous link for this AdWords link collection. + /// Previous link for this Google Ads link collection. #[serde(rename="previousLink")] pub previous_link: Option, /// The maximum number of entries the response can contain, regardless of the actual number of entries returned. Its value ranges from 1 to 1000 with a value of 1000 by default, or otherwise specified by the max-results query parameter. @@ -2919,7 +2889,7 @@ pub struct EntityAdWordsLinks { /// The starting index of the entries, which is 1 by default or otherwise specified by the start-index query parameter. #[serde(rename="startIndex")] pub start_index: Option, - /// Next link for this AdWords link collection. + /// Next link for this Google Ads link collection. #[serde(rename="nextLink")] pub next_link: Option, } @@ -3616,30 +3586,6 @@ pub struct CustomDataSource { impl Part for CustomDataSource {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AccountTreeResponseAccountSettings { - /// no description provided - #[serde(rename="shareWithSpecialists")] - pub share_with_specialists: Option, - /// no description provided - #[serde(rename="shareWithSupport")] - pub share_with_support: Option, - /// no description provided - #[serde(rename="shareAnonymouslyWithOthers")] - pub share_anonymously_with_others: Option, - /// no description provided - #[serde(rename="shareWithGoogleProducts")] - pub share_with_google_products: Option, -} - -impl NestedType for AccountTreeResponseAccountSettings {} -impl Part for AccountTreeResponseAccountSettings {} - - /// Parent link for the custom dimension. Points to the property to which the custom dimension belongs. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -3886,12 +3832,12 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists webProperty-AdWords links for a given web property. + /// Lists webProperty-Google Ads links for a given web property. /// /// # Arguments /// /// * `accountId` - ID of the account which the given web property belongs to. - /// * `webPropertyId` - Web property ID to retrieve the AdWords links for. + /// * `webPropertyId` - Web property ID to retrieve the Google Ads links for. pub fn web_property_ad_words_links_list(&self, account_id: &str, web_property_id: &str) -> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> { ManagementWebPropertyAdWordsLinkListCall { hub: self.hub, @@ -4012,13 +3958,13 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a web property-AdWords link. + /// Deletes a web property-Google Ads link. /// /// # Arguments /// /// * `accountId` - ID of the account which the given web property belongs to. - /// * `webPropertyId` - Web property ID to delete the AdWords link for. - /// * `webPropertyAdWordsLinkId` - Web property AdWords link ID. + /// * `webPropertyId` - Web property ID to delete the Google Ads link for. + /// * `webPropertyAdWordsLinkId` - Web property Google Ads link ID. pub fn web_property_ad_words_links_delete(&self, account_id: &str, web_property_id: &str, web_property_ad_words_link_id: &str) -> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> { ManagementWebPropertyAdWordsLinkDeleteCall { hub: self.hub, @@ -4056,7 +4002,7 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a webProperty-AdWords link. + /// Creates a webProperty-Google Ads link. /// /// # Arguments /// @@ -4163,14 +4109,14 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates an existing webProperty-AdWords link. + /// Updates an existing webProperty-Google Ads link. /// /// # Arguments /// /// * `request` - No description provided. /// * `accountId` - ID of the account which the given web property belongs to. - /// * `webPropertyId` - Web property ID to retrieve the AdWords link for. - /// * `webPropertyAdWordsLinkId` - Web property-AdWords link ID. + /// * `webPropertyId` - Web property ID to retrieve the Google Ads link for. + /// * `webPropertyAdWordsLinkId` - Web property-Google Ads link ID. pub fn web_property_ad_words_links_update(&self, request: EntityAdWordsLink, account_id: &str, web_property_id: &str, web_property_ad_words_link_id: &str) -> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> { ManagementWebPropertyAdWordsLinkUpdateCall { hub: self.hub, @@ -5154,13 +5100,13 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns a web property-AdWords link to which the user has access. + /// Returns a web property-Google Ads link to which the user has access. /// /// # Arguments /// /// * `accountId` - ID of the account which the given web property belongs to. - /// * `webPropertyId` - Web property ID to retrieve the AdWords link for. - /// * `webPropertyAdWordsLinkId` - Web property-AdWords link ID. + /// * `webPropertyId` - Web property ID to retrieve the Google Ads link for. + /// * `webPropertyAdWordsLinkId` - Web property-Google Ads link ID. pub fn web_property_ad_words_links_get(&self, account_id: &str, web_property_id: &str, web_property_ad_words_link_id: &str) -> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> { ManagementWebPropertyAdWordsLinkGetCall { hub: self.hub, @@ -5415,14 +5361,14 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates an existing webProperty-AdWords link. This method supports patch semantics. + /// Updates an existing webProperty-Google Ads link. This method supports patch semantics. /// /// # Arguments /// /// * `request` - No description provided. /// * `accountId` - ID of the account which the given web property belongs to. - /// * `webPropertyId` - Web property ID to retrieve the AdWords link for. - /// * `webPropertyAdWordsLinkId` - Web property-AdWords link ID. + /// * `webPropertyId` - Web property ID to retrieve the Google Ads link for. + /// * `webPropertyAdWordsLinkId` - Web property-Google Ads link ID. pub fn web_property_ad_words_links_patch(&self, request: EntityAdWordsLink, account_id: &str, web_property_id: &str, web_property_ad_words_link_id: &str) -> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> { ManagementWebPropertyAdWordsLinkPatchCall { hub: self.hub, @@ -5985,10 +5931,7 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6020,7 +5963,7 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6140,7 +6083,7 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6287,10 +6230,7 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6310,7 +6250,7 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6408,7 +6348,7 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6561,10 +6501,7 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6596,7 +6533,7 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6706,7 +6643,7 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6860,10 +6797,7 @@ impl<'a, C, A> ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6883,7 +6817,7 @@ impl<'a, C, A> ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7162,7 +7093,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7225,7 +7156,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro self._account_id = new_value.to_string(); self } - /// Web property ID to retrieve the AdWords links for. + /// Web property ID to retrieve the Google Ads links for. /// /// Sets the *web property id* path property to the given value. /// @@ -7235,14 +7166,14 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro self._web_property_id = new_value.to_string(); self } - /// An index of the first webProperty-AdWords link to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. + /// An index of the first webProperty-Google Ads link to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. /// /// Sets the *start-index* query property to the given value. pub fn start_index(mut self, new_value: i32) -> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> { self._start_index = Some(new_value); self } - /// The maximum number of webProperty-AdWords links to include in this response. + /// The maximum number of webProperty-Google Ads links to include in this response. /// /// Sets the *max-results* query property to the given value. pub fn max_results(mut self, new_value: i32) -> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> { @@ -7264,7 +7195,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7418,10 +7349,7 @@ impl<'a, C, A> ManagementProfileListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7441,7 +7369,7 @@ impl<'a, C, A> ManagementProfileListCall<'a, C, A> where C: BorrowMut ManagementProfileListCall<'a, C, A> where C: BorrowMut ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7727,7 +7652,7 @@ impl<'a, C, A> ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7817,7 +7742,7 @@ impl<'a, C, A> ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7968,10 +7893,7 @@ impl<'a, C, A> ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8003,7 +7925,7 @@ impl<'a, C, A> ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8280,7 +8199,7 @@ impl<'a, C, A> ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8561,7 +8477,7 @@ impl<'a, C, A> ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8841,7 +8754,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8894,7 +8807,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor self._account_id = new_value.to_string(); self } - /// Web property ID to delete the AdWords link for. + /// Web property ID to delete the Google Ads link for. /// /// Sets the *web property id* path property to the given value. /// @@ -8904,7 +8817,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor self._web_property_id = new_value.to_string(); self } - /// Web property AdWords link ID. + /// Web property Google Ads link ID. /// /// Sets the *web property ad words link id* path property to the given value. /// @@ -8929,7 +8842,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9081,10 +8994,7 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9116,7 +9026,7 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9216,7 +9126,7 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9260,7 +9170,7 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut } -/// Creates a webProperty-AdWords link. +/// Creates a webProperty-Google Ads link. /// /// A builder for the *webPropertyAdWordsLinks.insert* method supported by a *management* resource. /// It is not used directly, but through a `ManagementMethods` instance. @@ -9367,10 +9277,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9402,7 +9309,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9502,7 +9409,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9658,10 +9565,7 @@ impl<'a, C, A> ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9681,7 +9585,7 @@ impl<'a, C, A> ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9960,7 +9861,7 @@ impl<'a, C, A> ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10234,7 +10132,7 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10334,7 +10232,7 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10482,10 +10380,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10505,7 +10400,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10613,7 +10508,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10657,7 +10552,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut } -/// Updates an existing webProperty-AdWords link. +/// Updates an existing webProperty-Google Ads link. /// /// A builder for the *webPropertyAdWordsLinks.update* method supported by a *management* resource. /// It is not used directly, but through a `ManagementMethods` instance. @@ -10766,10 +10661,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10801,7 +10693,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10876,7 +10768,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor self._account_id = new_value.to_string(); self } - /// Web property ID to retrieve the AdWords link for. + /// Web property ID to retrieve the Google Ads link for. /// /// Sets the *web property id* path property to the given value. /// @@ -10886,7 +10778,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor self._web_property_id = new_value.to_string(); self } - /// Web property-AdWords link ID. + /// Web property-Google Ads link ID. /// /// Sets the *web property ad words link id* path property to the given value. /// @@ -10911,7 +10803,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11067,10 +10959,7 @@ impl<'a, C, A> ManagementUploadListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11090,7 +10979,7 @@ impl<'a, C, A> ManagementUploadListCall<'a, C, A> where C: BorrowMut ManagementUploadListCall<'a, C, A> where C: BorrowMut ManagementFilterListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11377,7 +11263,7 @@ impl<'a, C, A> ManagementFilterListCall<'a, C, A> where C: BorrowMut ManagementFilterListCall<'a, C, A> where C: BorrowMut ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11636,7 +11519,7 @@ impl<'a, C, A> ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11908,7 +11788,7 @@ impl<'a, C, A> ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12169,7 +12046,7 @@ impl<'a, C, A> ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12463,7 +12337,7 @@ impl<'a, C, A> ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12732,7 +12603,7 @@ impl<'a, C, A> ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13007,7 +12875,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13109,7 +12977,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13254,10 +13122,7 @@ impl<'a, C, A> ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13277,7 +13142,7 @@ impl<'a, C, A> ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13555,7 +13417,7 @@ impl<'a, C, A> ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut ManagementGoalListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13854,7 +13713,7 @@ impl<'a, C, A> ManagementGoalListCall<'a, C, A> where C: BorrowMut ManagementGoalListCall<'a, C, A> where C: BorrowMut ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14159,7 +14015,7 @@ impl<'a, C, A> ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14462,7 +14315,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14562,7 +14415,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14713,10 +14566,7 @@ impl<'a, C, A> ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14748,7 +14598,7 @@ impl<'a, C, A> ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportDeleteCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15018,7 +14865,7 @@ impl<'a, C, A> ManagementUnsampledReportDeleteCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15116,7 +14963,7 @@ impl<'a, C, A> ManagementUnsampledReportDeleteCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15261,10 +15108,7 @@ impl<'a, C, A> ManagementRemarketingAudienceDeleteCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15284,7 +15128,7 @@ impl<'a, C, A> ManagementRemarketingAudienceDeleteCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15372,7 +15216,7 @@ impl<'a, C, A> ManagementRemarketingAudienceDeleteCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15501,10 +15345,7 @@ impl<'a, C, A> ManagementAccountSummaryListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15524,7 +15365,7 @@ impl<'a, C, A> ManagementAccountSummaryListCall<'a, C, A> where C: BorrowMut ManagementAccountSummaryListCall<'a, C, A> where C: BorrowMut ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15776,7 +15614,7 @@ impl<'a, C, A> ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut ManagementProfileInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16060,7 +15895,7 @@ impl<'a, C, A> ManagementProfileInsertCall<'a, C, A> where C: BorrowMut ManagementProfileInsertCall<'a, C, A> where C: BorrowMut ManagementRemarketingAudienceListCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16342,7 +16174,7 @@ impl<'a, C, A> ManagementRemarketingAudienceListCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16450,7 +16282,7 @@ impl<'a, C, A> ManagementRemarketingAudienceListCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16604,10 +16436,7 @@ impl<'a, C, A> ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16627,7 +16456,7 @@ impl<'a, C, A> ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16898,7 +16724,7 @@ impl<'a, C, A> ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17175,7 +16998,7 @@ impl<'a, C, A> ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17287,7 +17110,7 @@ impl<'a, C, A> ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17440,10 +17263,7 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17475,7 +17295,7 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17585,7 +17405,7 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17736,10 +17556,7 @@ impl<'a, C, A> ManagementFilterPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17771,7 +17588,7 @@ impl<'a, C, A> ManagementFilterPatchCall<'a, C, A> where C: BorrowMut ManagementFilterPatchCall<'a, C, A> where C: BorrowMut ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18037,7 +17851,7 @@ impl<'a, C, A> ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18115,7 +17929,7 @@ impl<'a, C, A> ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18264,10 +18078,7 @@ impl<'a, C, A> ManagementFilterInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18299,7 +18110,7 @@ impl<'a, C, A> ManagementFilterInsertCall<'a, C, A> where C: BorrowMut ManagementFilterInsertCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18577,7 +18385,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18687,7 +18495,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18840,10 +18648,7 @@ impl<'a, C, A> ManagementRemarketingAudienceUpdateCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18875,7 +18680,7 @@ impl<'a, C, A> ManagementRemarketingAudienceUpdateCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18985,7 +18790,7 @@ impl<'a, C, A> ManagementRemarketingAudienceUpdateCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19133,10 +18938,7 @@ impl<'a, C, A> ManagementExperimentGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19156,7 +18958,7 @@ impl<'a, C, A> ManagementExperimentGetCall<'a, C, A> where C: BorrowMut ManagementExperimentGetCall<'a, C, A> where C: BorrowMut ManagementSegmentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19416,7 +19215,7 @@ impl<'a, C, A> ManagementSegmentListCall<'a, C, A> where C: BorrowMut ManagementSegmentListCall<'a, C, A> where C: BorrowMut ManagementGoalPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19688,7 +19484,7 @@ impl<'a, C, A> ManagementGoalPatchCall<'a, C, A> where C: BorrowMut ManagementGoalPatchCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20001,7 +19794,7 @@ impl<'a, C, A> ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20306,7 +20096,7 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20416,7 +20206,7 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20564,10 +20354,7 @@ impl<'a, C, A> ManagementUploadGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20587,7 +20374,7 @@ impl<'a, C, A> ManagementUploadGetCall<'a, C, A> where C: BorrowMut ManagementUploadGetCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20885,7 +20669,7 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21005,7 +20789,7 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21156,10 +20940,7 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21191,7 +20972,7 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21291,7 +21072,7 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21437,10 +21218,7 @@ impl<'a, C, A> ManagementRemarketingAudienceGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21460,7 +21238,7 @@ impl<'a, C, A> ManagementRemarketingAudienceGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21558,7 +21336,7 @@ impl<'a, C, A> ManagementRemarketingAudienceGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21687,10 +21465,7 @@ impl<'a, C, A> ManagementAccountListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21710,7 +21485,7 @@ impl<'a, C, A> ManagementAccountListCall<'a, C, A> where C: BorrowMut ManagementAccountListCall<'a, C, A> where C: BorrowMut ManagementProfileGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21961,7 +21733,7 @@ impl<'a, C, A> ManagementProfileGetCall<'a, C, A> where C: BorrowMut ManagementProfileGetCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22227,7 +21996,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22315,7 +22084,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22470,10 +22239,7 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22505,7 +22271,7 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -22625,7 +22391,7 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22783,10 +22549,7 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22818,7 +22581,7 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -22935,7 +22698,7 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23082,10 +22845,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23105,7 +22865,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23203,7 +22963,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23351,10 +23111,7 @@ impl<'a, C, A> ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23374,7 +23131,7 @@ impl<'a, C, A> ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23651,7 +23405,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23714,7 +23468,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow self._account_id = new_value.to_string(); self } - /// Web property ID to retrieve the AdWords link for. + /// Web property ID to retrieve the Google Ads link for. /// /// Sets the *web property id* path property to the given value. /// @@ -23724,7 +23478,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow self._web_property_id = new_value.to_string(); self } - /// Web property-AdWords link ID. + /// Web property-Google Ads link ID. /// /// Sets the *web property ad words link id* path property to the given value. /// @@ -23749,7 +23503,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23905,10 +23659,7 @@ impl<'a, C, A> ManagementExperimentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23928,7 +23679,7 @@ impl<'a, C, A> ManagementExperimentListCall<'a, C, A> where C: BorrowMut ManagementExperimentListCall<'a, C, A> where C: BorrowMut ManagementProfilePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24228,7 +23976,7 @@ impl<'a, C, A> ManagementProfilePatchCall<'a, C, A> where C: BorrowMut ManagementProfilePatchCall<'a, C, A> where C: BorrowMut ManagementGoalInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24526,7 +24271,7 @@ impl<'a, C, A> ManagementGoalInsertCall<'a, C, A> where C: BorrowMut ManagementGoalInsertCall<'a, C, A> where C: BorrowMut ManagementFilterGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24803,7 +24545,7 @@ impl<'a, C, A> ManagementFilterGetCall<'a, C, A> where C: BorrowMut ManagementFilterGetCall<'a, C, A> where C: BorrowMut ManagementAccountUserLinkListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25066,7 +24805,7 @@ impl<'a, C, A> ManagementAccountUserLinkListCall<'a, C, A> where C: BorrowMut ManagementAccountUserLinkListCall<'a, C, A> where C: BorrowMut ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25351,7 +25087,7 @@ impl<'a, C, A> ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25658,7 +25391,7 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25966,7 +25696,7 @@ impl<'a, C, A> ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -26268,7 +25995,7 @@ impl<'a, C, A> ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -26638,7 +26362,7 @@ impl<'a, C, A> ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26913,7 +26634,7 @@ impl<'a, C, A> ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27193,7 +26911,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -27268,7 +26986,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr self._account_id = new_value.to_string(); self } - /// Web property ID to retrieve the AdWords link for. + /// Web property ID to retrieve the Google Ads link for. /// /// Sets the *web property id* path property to the given value. /// @@ -27278,7 +26996,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr self._web_property_id = new_value.to_string(); self } - /// Web property-AdWords link ID. + /// Web property-Google Ads link ID. /// /// Sets the *web property ad words link id* path property to the given value. /// @@ -27303,7 +27021,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27456,10 +27174,7 @@ impl<'a, C, A> ManagementRemarketingAudiencePatchCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27491,7 +27206,7 @@ impl<'a, C, A> ManagementRemarketingAudiencePatchCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -27601,7 +27316,7 @@ impl<'a, C, A> ManagementRemarketingAudiencePatchCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27752,10 +27467,7 @@ impl<'a, C, A> ManagementRemarketingAudienceInsertCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27787,7 +27499,7 @@ impl<'a, C, A> ManagementRemarketingAudienceInsertCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -27887,7 +27599,7 @@ impl<'a, C, A> ManagementRemarketingAudienceInsertCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28040,10 +27752,7 @@ impl<'a, C, A> ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28075,7 +27784,7 @@ impl<'a, C, A> ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut ManagementClientIdHashClientIdCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28346,7 +28052,7 @@ impl<'a, C, A> ManagementClientIdHashClientIdCall<'a, C, A> where C: BorrowMut ManagementClientIdHashClientIdCall<'a, C, A> where C: BorrowMut ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28616,7 +28319,7 @@ impl<'a, C, A> ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28916,7 +28616,7 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -29066,7 +28766,7 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -29209,10 +28909,7 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29232,7 +28929,7 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -29348,7 +29045,7 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -29520,10 +29217,7 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29543,7 +29237,7 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -29714,7 +29408,7 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -29856,10 +29550,7 @@ impl<'a, C, A> MetadataColumnListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29879,7 +29570,7 @@ impl<'a, C, A> MetadataColumnListCall<'a, C, A> where C: BorrowMut MetadataColumnListCall<'a, C, A> where C: BorrowMut UserDeletionUserDeletionRequestUpsertCall<'a, C, A> where C: Borr } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30118,7 +29806,7 @@ impl<'a, C, A> UserDeletionUserDeletionRequestUpsertCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -30198,7 +29886,7 @@ impl<'a, C, A> UserDeletionUserDeletionRequestUpsertCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -30324,10 +30012,7 @@ impl<'a, C, A> ProvisioningCreateAccountTreeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30359,7 +30044,7 @@ impl<'a, C, A> ProvisioningCreateAccountTreeCall<'a, C, A> where C: BorrowMut ProvisioningCreateAccountTreeCall<'a, C, A> where C: BorrowMut ProvisioningCreateAccountTicketCall<'a, C, A> where C: BorrowMut< } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30600,7 +30282,7 @@ impl<'a, C, A> ProvisioningCreateAccountTicketCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -30680,7 +30362,7 @@ impl<'a, C, A> ProvisioningCreateAccountTicketCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/analyticsreporting4-cli/Cargo.toml b/gen/analyticsreporting4-cli/Cargo.toml index ff933db0f1..546355b7c9 100644 --- a/gen/analyticsreporting4-cli/Cargo.toml +++ b/gen/analyticsreporting4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-analyticsreporting4-cli" -version = "1.0.8+20181008" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with AnalyticsReporting (protocol v4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/analyticsreporting4-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-analyticsreporting4] path = "../analyticsreporting4" -version = "1.0.8+20181008" +version = "1.0.8+20190401" diff --git a/gen/analyticsreporting4-cli/README.md b/gen/analyticsreporting4-cli/README.md index 7d4e89fb3e..81b309f20a 100644 --- a/gen/analyticsreporting4-cli/README.md +++ b/gen/analyticsreporting4-cli/README.md @@ -25,12 +25,14 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *AnalyticsReporting* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *AnalyticsReporting* API at revision *20190401*. The CLI is at version *1.0.8*. ```bash analyticsreporting4 [options] reports batch-get (-r )... [-p ]... [-o ] + user-activity + search (-r )... [-p ]... [-o ] analyticsreporting4 --help Configuration: diff --git a/gen/analyticsreporting4-cli/mkdocs.yml b/gen/analyticsreporting4-cli/mkdocs.yml index f938343139..163f22407e 100644 --- a/gen/analyticsreporting4-cli/mkdocs.yml +++ b/gen/analyticsreporting4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AnalyticsReporting v1.0.8+20181008 +site_name: AnalyticsReporting v1.0.8+20190401 site_url: http://byron.github.io/google-apis-rs/google-analyticsreporting4-cli site_description: A complete library to interact with AnalyticsReporting (protocol v4) @@ -10,6 +10,7 @@ site_dir: build_html pages: - ['index.md', 'Home'] - ['reports_batch-get.md', 'Reports', 'Batch Get'] +- ['user-activity_search.md', 'User Activity', 'Search'] theme: readthedocs diff --git a/gen/analyticsreporting4-cli/src/main.rs b/gen/analyticsreporting4-cli/src/main.rs index fc0e1d38b8..855c710574 100644 --- a/gen/analyticsreporting4-cli/src/main.rs +++ b/gen/analyticsreporting4-cli/src/main.rs @@ -131,6 +131,98 @@ impl<'n> Engine<'n> { } } + fn _user_activity_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "date-range.start-date" => Some(("dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "date-range.end-date" => Some(("dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "activity-types" => Some(("activityTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user.user-id" => Some(("user.userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user.type" => Some(("user.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "view-id" => Some(("viewId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["activity-types", "date-range", "end-date", "page-size", "page-token", "start-date", "type", "user", "user-id", "view-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SearchUserActivityRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.user_activity().search(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); @@ -147,6 +239,17 @@ impl<'n> Engine<'n> { } } }, + ("user-activity", Some(opt)) => { + match opt.subcommand() { + ("search", Some(opt)) => { + call_result = self._user_activity_search(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-activity".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, _ => { err.issues.push(CLIError::MissingCommandError); writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); @@ -257,11 +360,36 @@ fn main() { ]), ]), + ("user-activity", "methods: 'search'", vec![ + ("search", + Some(r##"Returns User Activity data."##), + "Details at http://byron.github.io/google-apis-rs/google_analyticsreporting4_cli/user-activity_search", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ]; let mut app = App::new("analyticsreporting4") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190401") .about("Accesses Analytics report data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_analyticsreporting4_cli") .arg(Arg::with_name("url") diff --git a/gen/analyticsreporting4/Cargo.toml b/gen/analyticsreporting4/Cargo.toml index de3236f4d5..98522b080e 100644 --- a/gen/analyticsreporting4/Cargo.toml +++ b/gen/analyticsreporting4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-analyticsreporting4" -version = "1.0.8+20181008" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with AnalyticsReporting (protocol v4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/analyticsreporting4" homepage = "https://developers.google.com/analytics/devguides/reporting/core/v4/" -documentation = "https://docs.rs/google-analyticsreporting4/1.0.8+20181008" +documentation = "https://docs.rs/google-analyticsreporting4/1.0.8+20190401" license = "MIT" keywords = ["analyticsreporting", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/analyticsreporting4/README.md b/gen/analyticsreporting4/README.md index 638f8d2713..72faf177a0 100644 --- a/gen/analyticsreporting4/README.md +++ b/gen/analyticsreporting4/README.md @@ -5,16 +5,18 @@ DO NOT EDIT ! --> The `google-analyticsreporting4` library allows access to all features of the *Google AnalyticsReporting* service. -This documentation was generated from *AnalyticsReporting* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *analyticsreporting:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *AnalyticsReporting* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *analyticsreporting:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *AnalyticsReporting* *v4* API can be found at the [official documentation site](https://developers.google.com/analytics/devguides/reporting/core/v4/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/struct.AnalyticsReporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/struct.AnalyticsReporting.html) ... -* [reports](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/struct.Report.html) - * [*batch get*](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/struct.ReportBatchGetCall.html) +* [reports](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/struct.Report.html) + * [*batch get*](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/struct.ReportBatchGetCall.html) +* user activity + * [*search*](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/struct.UserActivitySearchCall.html) @@ -23,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/struct.AnalyticsReporting.html)** +* **[Hub](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/struct.AnalyticsReporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.Part.html)** + * **[Parts](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -47,7 +49,7 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.reports().batch_get(...).doit() +let r = hub.user_activity().search(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -81,7 +83,7 @@ extern crate hyper; extern crate hyper_rustls; extern crate yup_oauth2 as oauth2; extern crate google_analyticsreporting4 as analyticsreporting4; -use analyticsreporting4::GetReportsRequest; +use analyticsreporting4::SearchUserActivityRequest; use analyticsreporting4::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -102,12 +104,12 @@ let mut hub = AnalyticsReporting::new(hyper::Client::with_connector(hyper::net:: // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! -let mut req = GetReportsRequest::default(); +let mut req = SearchUserActivityRequest::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.reports().batch_get(req) +let result = hub.user_activity().search(req) .doit(); match result { @@ -130,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -150,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-analyticsreporting4/1.0.8+20181008/google_analyticsreporting4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-analyticsreporting4/1.0.8+20190401/google_analyticsreporting4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/analyticsreporting4/src/lib.rs b/gen/analyticsreporting4/src/lib.rs index 61ffc4e984..c5642b92de 100644 --- a/gen/analyticsreporting4/src/lib.rs +++ b/gen/analyticsreporting4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *AnalyticsReporting* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *analyticsreporting:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *AnalyticsReporting* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *analyticsreporting:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *AnalyticsReporting* *v4* API can be found at the //! [official documentation site](https://developers.google.com/analytics/devguides/reporting/core/v4/). @@ -13,6 +13,8 @@ //! //! * [reports](struct.Report.html) //! * [*batch get*](struct.ReportBatchGetCall.html) +//! * user activity +//! * [*search*](struct.UserActivitySearchCall.html) //! //! //! @@ -47,7 +49,7 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.reports().batch_get(...).doit() +//! let r = hub.user_activity().search(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -81,7 +83,7 @@ //! extern crate hyper_rustls; //! extern crate yup_oauth2 as oauth2; //! extern crate google_analyticsreporting4 as analyticsreporting4; -//! use analyticsreporting4::GetReportsRequest; +//! use analyticsreporting4::SearchUserActivityRequest; //! use analyticsreporting4::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -103,12 +105,12 @@ //! // As the method needs a request, you would usually fill it with the desired information //! // into the respective structure. Some of the parts shown here might not be applicable ! //! // Values shown here are possibly random and not representative ! -//! let mut req = GetReportsRequest::default(); +//! let mut req = SearchUserActivityRequest::default(); //! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.reports().batch_get(req) +//! let result = hub.user_activity().search(req) //! .doit(); //! //! match result { @@ -270,7 +272,7 @@ impl Default for Scope { /// extern crate hyper_rustls; /// extern crate yup_oauth2 as oauth2; /// extern crate google_analyticsreporting4 as analyticsreporting4; -/// use analyticsreporting4::GetReportsRequest; +/// use analyticsreporting4::SearchUserActivityRequest; /// use analyticsreporting4::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -292,12 +294,12 @@ impl Default for Scope { /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = GetReportsRequest::default(); +/// let mut req = SearchUserActivityRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.reports().batch_get(req) +/// let result = hub.user_activity().search(req) /// .doit(); /// /// match result { @@ -344,6 +346,9 @@ impl<'a, C, A> AnalyticsReporting pub fn reports(&'a self) -> ReportMethods<'a, C, A> { ReportMethods { hub: &self } } + pub fn user_activity(&'a self) -> UserActivityMethods<'a, C, A> { + UserActivityMethods { hub: &self } + } /// Set the user-agent header field to use in all requests to the server. /// It defaults to `google-api-rust-client/1.0.8`. @@ -517,6 +522,23 @@ pub struct DateRange { impl Part for DateRange {} +/// The headers for the metrics. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MetricHeader { + /// Headers for the metrics in the response. + #[serde(rename="metricHeaderEntries")] + pub metric_header_entries: Option>, + /// Headers for the pivots in the response. + #[serde(rename="pivotHeaders")] + pub pivot_headers: Option>, +} + +impl Part for MetricHeader {} + + /// The main response class which holds the reports from the Reporting API /// `batchGet` call. /// @@ -569,16 +591,15 @@ pub struct ReportRequest { /// Requests must specify at least one metric. Requests can have a /// total of 10 metrics. pub metrics: Option>, - /// Page size is for paging and specifies the maximum number of returned rows. - /// Page size should be >= 0. A query returns the default of 1,000 rows. - /// The Analytics Core Reporting API returns a maximum of 100,000 rows per - /// request, no matter how many you ask for. It can also return fewer rows - /// than requested, if there aren't as many dimension segments as you expect. - /// For instance, there are fewer than 300 possible values for `ga:country`, - /// so when segmenting only by country, you can't get more than 300 rows, - /// even if you set `pageSize` to a higher value. - #[serde(rename="pageSize")] - pub page_size: Option, + /// Dimension or metric filters that restrict the data returned for your + /// request. To use the `filtersExpression`, supply a dimension or metric on + /// which to filter, followed by the filter expression. For example, the + /// following expression selects `ga:browser` dimension which starts with + /// Firefox; `ga:browser=~^Firefox`. For more information on dimensions + /// and metric filters, see + /// [Filters reference](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters). + #[serde(rename="filtersExpression")] + pub filters_expression: Option, /// The Analytics /// [view ID](https://support.google.com/analytics/answer/1009618) /// from which to retrieve data. Every [ReportRequest](#ReportRequest) @@ -619,15 +640,25 @@ pub struct ReportRequest { /// metrics are aggregated. #[serde(rename="metricFilterClauses")] pub metric_filter_clauses: Option>, + /// The dimensions requested. + /// Requests can have a total of 7 dimensions. + pub dimensions: Option>, /// The pivot definitions. Requests can have a maximum of 2 pivots. pub pivots: Option>, /// If set to true, hides the total of all metrics for all the matching rows, /// for every date range. The default false and will return the totals. #[serde(rename="hideTotals")] pub hide_totals: Option, - /// The dimensions requested. - /// Requests can have a total of 7 dimensions. - pub dimensions: Option>, + /// Page size is for paging and specifies the maximum number of returned rows. + /// Page size should be >= 0. A query returns the default of 1,000 rows. + /// The Analytics Core Reporting API returns a maximum of 100,000 rows per + /// request, no matter how many you ask for. It can also return fewer rows + /// than requested, if there aren't as many dimension segments as you expect. + /// For instance, there are fewer than 300 possible values for `ga:country`, + /// so when segmenting only by country, you can't get more than 300 rows, + /// even if you set `pageSize` to a higher value. + #[serde(rename="pageSize")] + pub page_size: Option, /// The dimension filter clauses for filtering Dimension Values. They are /// logically combined with the `AND` operator. Note that filtering occurs /// before any dimensions are aggregated, so that the returned metrics @@ -650,15 +681,6 @@ pub struct ReportRequest { /// ranges in the output get the same row order. #[serde(rename="orderBys")] pub order_bys: Option>, - /// Dimension or metric filters that restrict the data returned for your - /// request. To use the `filtersExpression`, supply a dimension or metric on - /// which to filter, followed by the filter expression. For example, the - /// following expression selects `ga:browser` dimension which starts with - /// Firefox; `ga:browser=~^Firefox`. For more information on dimensions - /// and metric filters, see - /// [Filters reference](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters). - #[serde(rename="filtersExpression")] - pub filters_expression: Option, /// A continuation token to get the next page of the results. Adding this to /// the request will return the rows after the pageToken. The pageToken should /// be the value returned in the nextPageToken parameter in the response to @@ -674,6 +696,93 @@ pub struct ReportRequest { impl Part for ReportRequest {} +/// The response from `userActivity:get` call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search user activity](struct.UserActivitySearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SearchUserActivityResponse { + /// This token should be passed to + /// [SearchUserActivityRequest](#SearchUserActivityRequest) to retrieve the + /// next page. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// This field represents the + /// [sampling rate](https://support.google.com/analytics/answer/2637192) for + /// the given request and is a number between 0.0 to 1.0. See + /// [developer guide](/analytics/devguides/reporting/core/v4/basics#sampling) + /// for details. + #[serde(rename="sampleRate")] + pub sample_rate: Option, + /// Total rows returned by this query (across different pages). + #[serde(rename="totalRows")] + pub total_rows: Option, + /// Each record represents a session (device details, duration, etc). + pub sessions: Option>, +} + +impl ResponseResult for SearchUserActivityResponse {} + + +/// Details of the products in an e-commerce transaction. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ProductData { + /// Unique code that represents the product. + #[serde(rename="productSku")] + pub product_sku: Option, + /// The total revenue from purchased product items. + #[serde(rename="itemRevenue")] + pub item_revenue: Option, + /// Total number of this product units in the transaction. + #[serde(rename="productQuantity")] + pub product_quantity: Option, + /// The product name, supplied by the e-commerce tracking application, for + /// the purchased items. + #[serde(rename="productName")] + pub product_name: Option, +} + +impl Part for ProductData {} + + +/// This represents a user session performed on a specific device at a certain +/// time over a period of time. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserActivitySession { + /// Represents a detailed view into each of the activity in this session. + pub activities: Option>, + /// Unique ID of the session. + #[serde(rename="sessionId")] + pub session_id: Option, + /// Date of this session in ISO-8601 format. + #[serde(rename="sessionDate")] + pub session_date: Option, + /// The data source of a hit. By default, hits sent from analytics.js are + /// reported as "web" and hits sent from the mobile SDKs are reported as "app". + /// These values can be overridden in the Measurement Protocol. + #[serde(rename="dataSource")] + pub data_source: Option, + /// Platform on which the activity happened: "android", "ios" etc. + pub platform: Option, + /// The type of device used: "mobile", "tablet" etc. + #[serde(rename="deviceCategory")] + pub device_category: Option, +} + +impl Part for UserActivitySession {} + + /// Represents a group of metric filters. /// Set the operator value to specify how the filters are logically combined. /// @@ -735,27 +844,20 @@ pub struct SegmentFilter { impl Part for SegmentFilter {} -/// Specifies the sorting options. +/// Custom dimension. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OrderBy { - /// The order type. The default orderType is `VALUE`. - #[serde(rename="orderType")] - pub order_type: Option, - /// The field which to sort by. The default sort order is ascending. Example: - /// `ga:browser`. - /// Note, that you can only specify one field for sort here. For example, - /// `ga:browser, ga:city` is not valid. - #[serde(rename="fieldName")] - pub field_name: Option, - /// The sorting order for the field. - #[serde(rename="sortOrder")] - pub sort_order: Option, +pub struct CustomDimension { + /// Slot number of custom dimension. + pub index: Option, + /// Value of the custom dimension. Default value (i.e. empty string) indicates + /// clearing sesion/visitor scope custom dimension value. + pub value: Option, } -impl Part for OrderBy {} +impl Part for CustomDimension {} /// Sequence conditions consist of one or more steps, where each step is defined @@ -791,6 +893,54 @@ pub struct PivotValueRegion { impl Part for PivotValueRegion {} +/// The request to fetch User Report from Reporting API `userActivity:get` call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search user activity](struct.UserActivitySearchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SearchUserActivityRequest { + /// A continuation token to get the next page of the results. Adding this to + /// the request will return the rows after the pageToken. The pageToken should + /// be the value returned in the nextPageToken parameter in the response to + /// the [SearchUserActivityRequest](#SearchUserActivityRequest) request. + #[serde(rename="pageToken")] + pub page_token: Option, + /// Required. Unique user Id to query for. Every + /// [SearchUserActivityRequest](#SearchUserActivityRequest) must contain this + /// field. + pub user: Option, + /// Page size is for paging and specifies the maximum number of returned rows. + /// Page size should be > 0. If the value is 0 or if the field isn't specified, + /// the request returns the default of 1000 rows per page. + #[serde(rename="pageSize")] + pub page_size: Option, + /// Date range for which to retrieve the user activity. If a date range is not + /// provided, the default date range is (startDate: current date - 7 days, + /// endDate: current date - 1 day). + #[serde(rename="dateRange")] + pub date_range: Option, + /// Set of all activity types being requested. Only acvities matching these + /// types will be returned in the response. If empty, all activies will be + /// returned. + #[serde(rename="activityTypes")] + pub activity_types: Option>, + /// Required. The Analytics + /// [view ID](https://support.google.com/analytics/answer/1009618) + /// from which to retrieve data. Every + /// [SearchUserActivityRequest](#SearchUserActivityRequest) must contain the + /// `viewId`. + #[serde(rename="viewId")] + pub view_id: Option, +} + +impl RequestValue for SearchUserActivityRequest {} + + /// Column headers. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -807,6 +957,31 @@ pub struct ColumnHeader { impl Part for ColumnHeader {} +/// Represents details collected when the visitor performs a transaction on the +/// page. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TransactionData { + /// Total tax for the transaction. + #[serde(rename="transactionTax")] + pub transaction_tax: Option, + /// The transaction ID, supplied by the e-commerce tracking method, for the + /// purchase in the shopping cart. + #[serde(rename="transactionId")] + pub transaction_id: Option, + /// The total sale revenue (excluding shipping and tax) of the transaction. + #[serde(rename="transactionRevenue")] + pub transaction_revenue: Option, + /// Total cost of shipping. + #[serde(rename="transactionShipping")] + pub transaction_shipping: Option, +} + +impl Part for TransactionData {} + + /// Dynamic segment definition for defining the segment within the request. /// A segment can select users, sessions or both. /// @@ -843,6 +1018,24 @@ pub struct MetricHeaderEntry { impl Part for MetricHeaderEntry {} +/// Contains information to identify a particular user uniquely. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct User { + /// Type of the user in the request. The field `userId` is associated with this + /// type. + #[serde(rename="type")] + pub type_: Option, + /// Unique Id of the user for which the data is being requested. + #[serde(rename="userId")] + pub user_id: Option, +} + +impl Part for User {} + + /// The data response corresponding to the request. /// /// # Activities @@ -936,6 +1129,27 @@ pub struct PivotHeader { impl Part for PivotHeader {} +/// E-commerce details associated with the user activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EcommerceData { + /// The type of this e-commerce activity. + #[serde(rename="ecommerceType")] + pub ecommerce_type: Option, + /// Transaction details of this e-commerce action. + pub transaction: Option, + /// Action associated with this e-commerce action. + #[serde(rename="actionType")] + pub action_type: Option, + /// Details of the products in this transaction. + pub products: Option>, +} + +impl Part for EcommerceData {} + + /// A Simple segment conditions consist of one or more dimension/metric /// conditions that can be combined. /// @@ -972,6 +1186,23 @@ pub struct PivotHeaderEntry { impl Part for PivotHeaderEntry {} +/// Represents details collected when the visitor views a page. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PageviewData { + /// The title of the page that the visitor viewed. + #[serde(rename="pageTitle")] + pub page_title: Option, + /// The URL of the page that the visitor viewed. + #[serde(rename="pagePath")] + pub page_path: Option, +} + +impl Part for PageviewData {} + + /// Used to return a list of metrics for a single DateRange / dimension /// combination /// @@ -1046,6 +1277,41 @@ pub struct CohortGroup { impl Part for CohortGroup {} +/// Represents all the details pertaining to a goal. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoalData { + /// Total number of goal completions in this activity. + #[serde(rename="goalCompletions")] + pub goal_completions: Option, + /// Value in this goal. + #[serde(rename="goalValue")] + pub goal_value: Option, + /// Name of the goal. + #[serde(rename="goalName")] + pub goal_name: Option, + /// URL of the page one step prior to the goal completion. + #[serde(rename="goalPreviousStep1")] + pub goal_previous_step1: Option, + /// URL of the page three steps prior to the goal completion. + #[serde(rename="goalPreviousStep3")] + pub goal_previous_step3: Option, + /// URL of the page two steps prior to the goal completion. + #[serde(rename="goalPreviousStep2")] + pub goal_previous_step2: Option, + /// This identifies the goal as configured for the profile. + #[serde(rename="goalIndex")] + pub goal_index: Option, + /// URL of the page where this goal was completed. + #[serde(rename="goalCompletionLocation")] + pub goal_completion_location: Option, +} + +impl Part for GoalData {} + + /// Dimension filter specifies the filtering options on a dimension. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1055,8 +1321,9 @@ pub struct DimensionFilter { /// The dimension to filter on. A DimensionFilter must contain a dimension. #[serde(rename="dimensionName")] pub dimension_name: Option, - /// How to match the dimension to the expression. The default is REGEXP. - pub operator: Option, + /// Should the match be case sensitive? Default is false. + #[serde(rename="caseSensitive")] + pub case_sensitive: Option, /// Strings or regular expression to match against. Only the first value of /// the list is used for comparison unless the operator is `IN_LIST`. /// If `IN_LIST` operator, then the entire list is used to filter the @@ -1065,29 +1332,86 @@ pub struct DimensionFilter { /// Logical `NOT` operator. If this boolean is set to true, then the matching /// dimension values will be excluded in the report. The default is false. pub not: Option, - /// Should the match be case sensitive? Default is false. - #[serde(rename="caseSensitive")] - pub case_sensitive: Option, + /// How to match the dimension to the expression. The default is REGEXP. + pub operator: Option, } impl Part for DimensionFilter {} -/// The headers for the metrics. +/// An Activity represents data for an activity of a user. Note that an +/// Activity is different from a hit. +/// A hit might result in multiple Activity's. For example, if a hit +/// includes a transaction and a goal completion, there will be two +/// Activity protos for this hit, one for ECOMMERCE and one for GOAL. +/// Conversely, multiple hits can also construct one Activity. In classic +/// e-commerce, data for one transaction might be sent through multiple hits. +/// These hits will be merged into one ECOMMERCE Activity. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MetricHeader { - /// Headers for the pivots in the response. - #[serde(rename="pivotHeaders")] - pub pivot_headers: Option>, - /// Headers for the metrics in the response. - #[serde(rename="metricHeaderEntries")] - pub metric_header_entries: Option>, +pub struct Activity { + /// A list of all custom dimensions associated with this activity. + #[serde(rename="customDimension")] + pub custom_dimension: Option>, + /// The first page in users' sessions, or the landing page. + #[serde(rename="landingPagePath")] + pub landing_page_path: Option, + /// The hostname from which the tracking request was made. + pub hostname: Option, + /// This will be set if `activity_type` equals `ECOMMERCE`. + pub ecommerce: Option, + /// For manual campaign tracking, it is the value of the utm_term campaign + /// tracking parameter. For AdWords traffic, it contains the best matching + /// targeting criteria. For the display network, where multiple targeting + /// criteria could have caused the ad to show up, it returns the best matching + /// targeting criteria as selected by Ads. This could be display_keyword, site + /// placement, boomuserlist, user_interest, age, or gender. Otherwise its value + /// is (not set). + pub keyword: Option, + /// For manual campaign tracking, it is the value of the utm_campaign campaign + /// tracking parameter. For AdWords autotagging, it is the name(s) of the + /// online ad campaign(s) you use for the property. If you use neither, its + /// value is (not set). + pub campaign: Option, + /// Type of this activity. + #[serde(rename="activityType")] + pub activity_type: Option, + /// This will be set if `activity_type` equals `PAGEVIEW`. This field + /// contains all the details about the visitor and the page that was visited. + pub pageview: Option, + /// This will be set if `activity_type` equals `SCREEN_VIEW`. + pub appview: Option, + /// The source of referrals. For manual campaign tracking, it is the value of + /// the utm_source campaign tracking parameter. For AdWords autotagging, it is + /// google. If you use neither, it is the domain of the source + /// (e.g., document.referrer) referring the users. It may also contain a port + /// address. If users arrived without a referrer, its value is (direct). + pub source: Option, + /// The type of referrals. For manual campaign tracking, it is the value of the + /// utm_medium campaign tracking parameter. For AdWords autotagging, it is cpc. + /// If users came from a search engine detected by Google Analytics, it is + /// organic. If the referrer is not a search engine, it is referral. If users + /// came directly to the property and document.referrer is empty, its value is + /// (none). + pub medium: Option, + /// The Channel Group associated with an end user's session for this View + /// (defined by the View's Channel Groupings). + #[serde(rename="channelGrouping")] + pub channel_grouping: Option, + /// Timestamp of the activity. + #[serde(rename="activityTime")] + pub activity_time: Option, + /// This field contains all the details pertaining to an event and will be + /// set if `activity_type` equals `EVENT`. + pub event: Option, + /// This field contains a list of all the goals that were reached in this + /// activity when `activity_type` equals `GOAL`. + pub goals: Option, } -impl Part for MetricHeader {} +impl Part for Activity {} /// A segment sequence definition. @@ -1164,14 +1488,14 @@ impl Part for Dimension {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MetricFilter { + /// Logical `NOT` operator. If this boolean is set to true, then the matching + /// metric values will be excluded in the report. The default is false. + pub not: Option, /// Is the metric `EQUAL`, `LESS_THAN` or `GREATER_THAN` the /// comparisonValue, the default is `EQUAL`. If the operator is /// `IS_MISSING`, checks if the metric is missing and would ignore the /// comparisonValue. pub operator: Option, - /// Logical `NOT` operator. If this boolean is set to true, then the matching - /// metric values will be excluded in the report. The default is false. - pub not: Option, /// The value to compare against. #[serde(rename="comparisonValue")] pub comparison_value: Option, @@ -1185,6 +1509,55 @@ pub struct MetricFilter { impl Part for MetricFilter {} +/// Represents all the details pertaining to an event. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EventData { + /// Label attached with the event. + #[serde(rename="eventLabel")] + pub event_label: Option, + /// Numeric value associated with the event. + #[serde(rename="eventValue")] + pub event_value: Option, + /// Type of interaction with the object. Eg: 'play'. + #[serde(rename="eventAction")] + pub event_action: Option, + /// The object on the page that was interacted with. Eg: 'Video'. + #[serde(rename="eventCategory")] + pub event_category: Option, + /// Number of such events in this activity. + #[serde(rename="eventCount")] + pub event_count: Option, +} + +impl Part for EventData {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ScreenviewData { + /// Mobile manufacturer or branded name. Eg: "Google", "Apple" etc. + #[serde(rename="mobileDeviceBranding")] + pub mobile_device_branding: Option, + /// Mobile device model. Eg: "Pixel", "iPhone" etc. + #[serde(rename="mobileDeviceModel")] + pub mobile_device_model: Option, + /// The application name. + #[serde(rename="appName")] + pub app_name: Option, + /// The name of the screen. + #[serde(rename="screenName")] + pub screen_name: Option, +} + +impl Part for ScreenviewData {} + + /// [Metrics](https://support.google.com/analytics/answer/1033861) /// are the quantitative measurements. For example, the metric `ga:users` /// indicates the total number of users for the requested time period. @@ -1259,6 +1632,19 @@ pub struct OrFiltersForSegment { impl Part for OrFiltersForSegment {} +/// Represents a set of goals that were reached in an activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoalSetData { + /// All the goals that were reached in the current activity. + pub goals: Option>, +} + +impl Part for GoalSetData {} + + /// Filter Clause to be used in a segment definition, can be wither a metric or /// a dimension filter. /// @@ -1279,6 +1665,29 @@ pub struct SegmentFilterClause { impl Part for SegmentFilterClause {} +/// Specifies the sorting options. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderBy { + /// The order type. The default orderType is `VALUE`. + #[serde(rename="orderType")] + pub order_type: Option, + /// The field which to sort by. The default sort order is ascending. Example: + /// `ga:browser`. + /// Note, that you can only specify one field for sort here. For example, + /// `ga:browser, ga:city` is not valid. + #[serde(rename="fieldName")] + pub field_name: Option, + /// The sorting order for the field. + #[serde(rename="sortOrder")] + pub sort_order: Option, +} + +impl Part for OrderBy {} + + /// A group of dimension filters. Set the operator value to specify how /// the filters are logically combined. /// @@ -1338,6 +1747,23 @@ pub struct Pivot { /// The pivot metrics. Pivot metrics are part of the /// restriction on total number of metrics allowed in the request. pub metrics: Option>, + /// A list of dimensions to show as pivot columns. A Pivot can have a maximum + /// of 4 dimensions. Pivot dimensions are part of the restriction on the + /// total number of dimensions allowed in the request. + pub dimensions: Option>, + /// Specifies the maximum number of groups to return. + /// The default value is 10, also the maximum value is 1,000. + #[serde(rename="maxGroupCount")] + pub max_group_count: Option, + /// DimensionFilterClauses are logically combined with an `AND` operator: only + /// data that is included by all these DimensionFilterClauses contributes to + /// the values in this pivot region. Dimension filters can be used to restrict + /// the columns shown in the pivot region. For example if you have + /// `ga:browser` as the requested dimension in the pivot region, and you + /// specify key filters to restrict `ga:browser` to only "IE" or "Firefox", + /// then only those two browsers would show up as columns. + #[serde(rename="dimensionFilterClauses")] + pub dimension_filter_clauses: Option>, /// If k metrics were requested, then the response will contain some /// data-dependent multiple of k columns in the report. E.g., if you pivoted /// on the dimension `ga:browser` then you'd get k columns for "Firefox", k @@ -1353,23 +1779,6 @@ pub struct Pivot { /// included in the response. #[serde(rename="startGroup")] pub start_group: Option, - /// Specifies the maximum number of groups to return. - /// The default value is 10, also the maximum value is 1,000. - #[serde(rename="maxGroupCount")] - pub max_group_count: Option, - /// DimensionFilterClauses are logically combined with an `AND` operator: only - /// data that is included by all these DimensionFilterClauses contributes to - /// the values in this pivot region. Dimension filters can be used to restrict - /// the columns shown in the pivot region. For example if you have - /// `ga:browser` as the requested dimension in the pivot region, and you - /// specify key filters to restrict `ga:browser` to only "IE" or "Firefox", - /// then only those two browsers would show up as columns. - #[serde(rename="dimensionFilterClauses")] - pub dimension_filter_clauses: Option>, - /// A list of dimensions to show as pivot columns. A Pivot can have a maximum - /// of 4 dimensions. Pivot dimensions are part of the restriction on the - /// total number of dimensions allowed in the request. - pub dimensions: Option>, } impl Part for Pivot {} @@ -1380,6 +1789,65 @@ impl Part for Pivot {} // MethodBuilders ### // ################# +/// A builder providing access to all methods supported on *userActivity* resources. +/// It is not used directly, but through the `AnalyticsReporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_analyticsreporting4 as analyticsreporting4; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use analyticsreporting4::AnalyticsReporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = AnalyticsReporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `search(...)` +/// // to build up your call. +/// let rb = hub.user_activity(); +/// # } +/// ``` +pub struct UserActivityMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AnalyticsReporting, +} + +impl<'a, C, A> MethodsBuilder for UserActivityMethods<'a, C, A> {} + +impl<'a, C, A> UserActivityMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Returns User Activity data. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn search(&self, request: SearchUserActivityRequest) -> UserActivitySearchCall<'a, C, A> { + UserActivitySearchCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *report* resources. /// It is not used directly, but through the `AnalyticsReporting` hub. /// @@ -1445,6 +1913,248 @@ impl<'a, C, A> ReportMethods<'a, C, A> { // CallBuilders ### // ################# +/// Returns User Activity data. +/// +/// A builder for the *search* method supported by a *userActivity* resource. +/// It is not used directly, but through a `UserActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_analyticsreporting4 as analyticsreporting4; +/// use analyticsreporting4::SearchUserActivityRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use analyticsreporting4::AnalyticsReporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AnalyticsReporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SearchUserActivityRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_activity().search(req) +/// .doit(); +/// # } +/// ``` +pub struct UserActivitySearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AnalyticsReporting, + _request: SearchUserActivityRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserActivitySearchCall<'a, C, A> {} + +impl<'a, C, A> UserActivitySearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SearchUserActivityResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "analyticsreporting.userActivity.search", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v4/userActivity:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Analytic.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SearchUserActivityRequest) -> UserActivitySearchCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserActivitySearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> UserActivitySearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Analytic`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserActivitySearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Returns the Analytics data. /// /// A builder for the *batchGet* method supported by a *report* resource. @@ -1527,10 +2237,7 @@ impl<'a, C, A> ReportBatchGetCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1562,7 +2269,7 @@ impl<'a, C, A> ReportBatchGetCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1642,7 +2349,7 @@ impl<'a, C, A> ReportBatchGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1650,12 +2357,12 @@ impl<'a, C, A> ReportBatchGetCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ReportBatchGetCall<'a, C, A> diff --git a/gen/androiddeviceprovisioning1-cli/Cargo.toml b/gen/androiddeviceprovisioning1-cli/Cargo.toml index 3673dd45c1..70965a345b 100644 --- a/gen/androiddeviceprovisioning1-cli/Cargo.toml +++ b/gen/androiddeviceprovisioning1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androiddeviceprovisioning1-cli" -version = "1.0.8+20181007" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Provisioning Partner (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androiddeviceprovisioning1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-androiddeviceprovisioning1] path = "../androiddeviceprovisioning1" -version = "1.0.8+20181007" +version = "1.0.8+20190330" diff --git a/gen/androiddeviceprovisioning1-cli/README.md b/gen/androiddeviceprovisioning1-cli/README.md index 9fb5a2ba41..2dec62c4fe 100644 --- a/gen/androiddeviceprovisioning1-cli/README.md +++ b/gen/androiddeviceprovisioning1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Android Provisioning Partner* API at revision *20181007*. The CLI is at version *1.0.8*. +This documentation was generated from the *Android Provisioning Partner* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash androiddeviceprovisioning1 [options] diff --git a/gen/androiddeviceprovisioning1-cli/mkdocs.yml b/gen/androiddeviceprovisioning1-cli/mkdocs.yml index cb0a6dd932..c2e4464c76 100644 --- a/gen/androiddeviceprovisioning1-cli/mkdocs.yml +++ b/gen/androiddeviceprovisioning1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Provisioning Partner v1.0.8+20181007 +site_name: Android Provisioning Partner v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-androiddeviceprovisioning1-cli site_description: A complete library to interact with Android Provisioning Partner (protocol v1) diff --git a/gen/androiddeviceprovisioning1-cli/src/main.rs b/gen/androiddeviceprovisioning1-cli/src/main.rs index c773ab6216..765bc94b6b 100644 --- a/gen/androiddeviceprovisioning1-cli/src/main.rs +++ b/gen/androiddeviceprovisioning1-cli/src/main.rs @@ -1066,15 +1066,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "device-metadata.entries" => Some(("deviceMetadata.entries", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "device-identifier.imei" => Some(("deviceIdentifier.imei", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device-identifier.model" => Some(("deviceIdentifier.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device-identifier.serial-number" => Some(("deviceIdentifier.serialNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device-identifier.meid" => Some(("deviceIdentifier.meid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device-identifier.manufacturer" => Some(("deviceIdentifier.manufacturer", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "customer-id" => Some(("customerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "section-type" => Some(("sectionType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-id" => Some(("customerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["customer-id", "device-identifier", "imei", "manufacturer", "meid", "model", "section-type", "serial-number"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["customer-id", "device-identifier", "device-metadata", "entries", "imei", "manufacturer", "meid", "model", "section-type", "serial-number"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2414,8 +2415,9 @@ fn main() { ("customers-create", Some(r##"Creates a customer for zero-touch enrollment. After the method returns successfully, admin and owner roles can manage devices and EMM configs - by calling API methods or using their zero-touch enrollment portal. The API - doesn't notify the customer that they have access."##), + by calling API methods or using their zero-touch enrollment portal. + The customer receives an email that welcomes them to zero-touch enrollment + and explains how to sign into the portal."##), "Details at http://byron.github.io/google-apis-rs/google_androiddeviceprovisioning1_cli/partners_customers-create", vec![ (Some(r##"parent"##), @@ -2620,7 +2622,7 @@ fn main() { (Some(r##"device-id"##), None, - Some(r##"Required. The ID of the reseller partner."##), + Some(r##"Required. The ID of the device."##), Some(true), Some(false)), @@ -2783,7 +2785,7 @@ fn main() { let mut app = App::new("androiddeviceprovisioning1") .author("Sebastian Thiel ") - .version("1.0.8+20181007") + .version("1.0.8+20190330") .about("Automates Android zero-touch enrollment for device resellers, customers, and EMMs.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_androiddeviceprovisioning1_cli") .arg(Arg::with_name("folder") diff --git a/gen/androiddeviceprovisioning1/Cargo.toml b/gen/androiddeviceprovisioning1/Cargo.toml index 03ac9e55bd..cb6f791125 100644 --- a/gen/androiddeviceprovisioning1/Cargo.toml +++ b/gen/androiddeviceprovisioning1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-androiddeviceprovisioning1" -version = "1.0.8+20181007" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Provisioning Partner (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androiddeviceprovisioning1" homepage = "https://developers.google.com/zero-touch/" -documentation = "https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007" +documentation = "https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330" license = "MIT" keywords = ["androiddeviceprovisi", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/androiddeviceprovisioning1/README.md b/gen/androiddeviceprovisioning1/README.md index d6f766776d..d2c83127d2 100644 --- a/gen/androiddeviceprovisioning1/README.md +++ b/gen/androiddeviceprovisioning1/README.md @@ -5,20 +5,20 @@ DO NOT EDIT ! --> The `google-androiddeviceprovisioning1` library allows access to all features of the *Google Android Provisioning Partner* service. -This documentation was generated from *Android Provisioning Partner* crate version *1.0.8+20181007*, where *20181007* is the exact revision of the *androiddeviceprovisioning:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Android Provisioning Partner* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *androiddeviceprovisioning:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Android Provisioning Partner* *v1* API can be found at the [official documentation site](https://developers.google.com/zero-touch/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.AndroidProvisioningPartner.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.AndroidProvisioningPartner.html) ... * customers - * [*configurations create*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerConfigurationCreateCall.html), [*configurations delete*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerConfigurationDeleteCall.html), [*configurations get*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerConfigurationGetCall.html), [*configurations list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerConfigurationListCall.html), [*configurations patch*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerConfigurationPatchCall.html), [*devices apply configuration*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerDeviceApplyConfigurationCall.html), [*devices get*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerDeviceGetCall.html), [*devices list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerDeviceListCall.html), [*devices remove configuration*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerDeviceRemoveConfigurationCall.html), [*devices unclaim*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerDeviceUnclaimCall.html), [*dpcs list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerDpcListCall.html) and [*list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.CustomerListCall.html) -* [operations](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.Operation.html) - * [*get*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.OperationGetCall.html) + * [*configurations create*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerConfigurationCreateCall.html), [*configurations delete*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerConfigurationDeleteCall.html), [*configurations get*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerConfigurationGetCall.html), [*configurations list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerConfigurationListCall.html), [*configurations patch*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerConfigurationPatchCall.html), [*devices apply configuration*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerDeviceApplyConfigurationCall.html), [*devices get*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerDeviceGetCall.html), [*devices list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerDeviceListCall.html), [*devices remove configuration*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerDeviceRemoveConfigurationCall.html), [*devices unclaim*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerDeviceUnclaimCall.html), [*dpcs list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerDpcListCall.html) and [*list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.CustomerListCall.html) +* [operations](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.Operation.html) + * [*get*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.OperationGetCall.html) * partners - * [*customers create*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerCustomerCreateCall.html), [*customers list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerCustomerListCall.html), [*devices claim*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerDeviceClaimCall.html), [*devices claim async*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerDeviceClaimAsyncCall.html), [*devices find by identifier*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerDeviceFindByIdentifierCall.html), [*devices find by owner*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerDeviceFindByOwnerCall.html), [*devices get*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerDeviceGetCall.html), [*devices metadata*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerDeviceMetadataCall.html), [*devices unclaim*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerDeviceUnclaimCall.html), [*devices unclaim async*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerDeviceUnclaimAsyncCall.html), [*devices update metadata async*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerDeviceUpdateMetadataAsyncCall.html), [*vendors customers list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerVendorCustomerListCall.html) and [*vendors list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.PartnerVendorListCall.html) + * [*customers create*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerCustomerCreateCall.html), [*customers list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerCustomerListCall.html), [*devices claim*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerDeviceClaimCall.html), [*devices claim async*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerDeviceClaimAsyncCall.html), [*devices find by identifier*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerDeviceFindByIdentifierCall.html), [*devices find by owner*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerDeviceFindByOwnerCall.html), [*devices get*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerDeviceGetCall.html), [*devices metadata*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerDeviceMetadataCall.html), [*devices unclaim*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerDeviceUnclaimCall.html), [*devices unclaim async*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerDeviceUnclaimAsyncCall.html), [*devices update metadata async*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerDeviceUpdateMetadataAsyncCall.html), [*vendors customers list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerVendorCustomerListCall.html) and [*vendors list*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.PartnerVendorListCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/struct.AndroidProvisioningPartner.html)** +* **[Hub](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/struct.AndroidProvisioningPartner.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.Part.html)** + * **[Parts](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -51,8 +51,8 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.customers().devices_unclaim(...).doit() let r = hub.customers().devices_apply_configuration(...).doit() +let r = hub.customers().devices_unclaim(...).doit() let r = hub.customers().configurations_delete(...).doit() let r = hub.customers().devices_remove_configuration(...).doit() let r = hub.partners().devices_unclaim(...).doit() @@ -89,7 +89,7 @@ extern crate hyper; extern crate hyper_rustls; extern crate yup_oauth2 as oauth2; extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1; -use androiddeviceprovisioning1::CustomerUnclaimDeviceRequest; +use androiddeviceprovisioning1::CustomerApplyConfigurationRequest; use androiddeviceprovisioning1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -110,12 +110,12 @@ let mut hub = AndroidProvisioningPartner::new(hyper::Client::with_connector(hype // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! -let mut req = CustomerUnclaimDeviceRequest::default(); +let mut req = CustomerApplyConfigurationRequest::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.customers().devices_unclaim(req, "parent") +let result = hub.customers().devices_apply_configuration(req, "parent") .doit(); match result { @@ -138,17 +138,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -158,29 +158,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20181007/google_androiddeviceprovisioning1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-androiddeviceprovisioning1/1.0.8+20190330/google_androiddeviceprovisioning1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/androiddeviceprovisioning1/src/lib.rs b/gen/androiddeviceprovisioning1/src/lib.rs index d4a6107cb6..5ea2103633 100644 --- a/gen/androiddeviceprovisioning1/src/lib.rs +++ b/gen/androiddeviceprovisioning1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Android Provisioning Partner* crate version *1.0.8+20181007*, where *20181007* is the exact revision of the *androiddeviceprovisioning:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Android Provisioning Partner* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *androiddeviceprovisioning:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Android Provisioning Partner* *v1* API can be found at the //! [official documentation site](https://developers.google.com/zero-touch/). @@ -51,8 +51,8 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.customers().devices_unclaim(...).doit() //! let r = hub.customers().devices_apply_configuration(...).doit() +//! let r = hub.customers().devices_unclaim(...).doit() //! let r = hub.customers().configurations_delete(...).doit() //! let r = hub.customers().devices_remove_configuration(...).doit() //! let r = hub.partners().devices_unclaim(...).doit() @@ -89,7 +89,7 @@ //! extern crate hyper_rustls; //! extern crate yup_oauth2 as oauth2; //! extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1; -//! use androiddeviceprovisioning1::CustomerUnclaimDeviceRequest; +//! use androiddeviceprovisioning1::CustomerApplyConfigurationRequest; //! use androiddeviceprovisioning1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -111,12 +111,12 @@ //! // As the method needs a request, you would usually fill it with the desired information //! // into the respective structure. Some of the parts shown here might not be applicable ! //! // Values shown here are possibly random and not representative ! -//! let mut req = CustomerUnclaimDeviceRequest::default(); +//! let mut req = CustomerApplyConfigurationRequest::default(); //! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.customers().devices_unclaim(req, "parent") +//! let result = hub.customers().devices_apply_configuration(req, "parent") //! .doit(); //! //! match result { @@ -252,7 +252,7 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// extern crate hyper_rustls; /// extern crate yup_oauth2 as oauth2; /// extern crate google_androiddeviceprovisioning1 as androiddeviceprovisioning1; -/// use androiddeviceprovisioning1::CustomerUnclaimDeviceRequest; +/// use androiddeviceprovisioning1::CustomerApplyConfigurationRequest; /// use androiddeviceprovisioning1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -274,12 +274,12 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = CustomerUnclaimDeviceRequest::default(); +/// let mut req = CustomerApplyConfigurationRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.customers().devices_unclaim(req, "parent") +/// let result = hub.customers().devices_apply_configuration(req, "parent") /// .doit(); /// /// match result { @@ -523,15 +523,18 @@ impl RequestValue for CreateCustomerRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ClaimDeviceRequest { + /// Optional. The metadata to attach to the device. + #[serde(rename="deviceMetadata")] + pub device_metadata: Option, /// Required. The device identifier of the device to claim. #[serde(rename="deviceIdentifier")] pub device_identifier: Option, - /// Required. The ID of the customer for whom the device is being claimed. - #[serde(rename="customerId")] - pub customer_id: Option, /// Required. The section type of the device's provisioning record. #[serde(rename="sectionType")] pub section_type: Option, + /// Required. The ID of the customer for whom the device is being claimed. + #[serde(rename="customerId")] + pub customer_id: Option, } impl RequestValue for ClaimDeviceRequest {} @@ -552,8 +555,8 @@ impl RequestValue for ClaimDeviceRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [devices unclaim customers](struct.CustomerDeviceUnclaimCall.html) (response) /// * [devices apply configuration customers](struct.CustomerDeviceApplyConfigurationCall.html) (response) +/// * [devices unclaim customers](struct.CustomerDeviceUnclaimCall.html) (response) /// * [configurations delete customers](struct.CustomerConfigurationDeleteCall.html) (response) /// * [devices remove configuration customers](struct.CustomerDeviceRemoveConfigurationCall.html) (response) /// * [devices unclaim partners](struct.PartnerDeviceUnclaimCall.html) (response) @@ -589,17 +592,17 @@ pub struct ListVendorCustomersResponse { impl ResponseResult for ListVendorCustomersResponse {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -1095,15 +1098,15 @@ pub struct Dpc { /// using this identifier. #[serde(rename="packageName")] pub package_name: Option, + /// Output only. The title of the DPC app in Google Play. For example, _Google + /// Apps Device Policy_. Useful in an application's user interface. + #[serde(rename="dpcName")] + pub dpc_name: Option, /// Output only. The API resource name in the format /// `customers/[CUSTOMER_ID]/dpcs/[DPC_ID]`. Assigned by /// the server. To maintain a reference to a DPC across customer accounts, /// persist and match the last path component (`DPC_ID`). pub name: Option, - /// Output only. The title of the DPC app in Google Play. For example, _Google - /// Apps Device Policy_. Useful in an application's user interface. - #[serde(rename="dpcName")] - pub dpc_name: Option, } impl Part for Dpc {} @@ -1173,6 +1176,41 @@ pub struct DeviceReference { impl Part for DeviceReference {} +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [devices update metadata async partners](struct.PartnerDeviceUpdateMetadataAsyncCall.html) (response) +/// * [devices unclaim async partners](struct.PartnerDeviceUnclaimAsyncCall.html) (response) +/// * [get operations](struct.OperationGetCall.html) (response) +/// * [devices claim async partners](struct.PartnerDeviceClaimAsyncCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// This field will always be not set if the operation is created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`. In this case, error information for each device is set in `response.perDeviceStatus.result.status`. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// This field will contain a `DevicesLongRunningOperationResponse` object if the operation is created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// This field will contain a `DevicesLongRunningOperationMetadata` object if the operation is created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`. + pub metadata: Option>, +} + +impl Resource for Operation {} +impl ResponseResult for Operation {} + + /// Metadata entries that can be attached to a `Device`. To learn more, read /// [Device metadata](/zero-touch/guides/metadata). /// @@ -1276,53 +1314,18 @@ pub struct FindDevicesByDeviceIdentifierRequest { impl RequestValue for FindDevicesByDeviceIdentifierRequest {} -/// This resource represents a long-running operation that is the result of a -/// network API call. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [devices update metadata async partners](struct.PartnerDeviceUpdateMetadataAsyncCall.html) (response) -/// * [devices unclaim async partners](struct.PartnerDeviceUnclaimAsyncCall.html) (response) -/// * [get operations](struct.OperationGetCall.html) (response) -/// * [devices claim async partners](struct.PartnerDeviceClaimAsyncCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// This field will always be not set if the operation is created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`. In this case, error information for each device is set in `response.perDeviceStatus.result.status`. - pub error: Option, - /// If the value is `false`, it means the operation is still in progress. - /// If `true`, the operation is completed, and either `error` or `response` is - /// available. - pub done: Option, - /// This field will contain a `DevicesLongRunningOperationResponse` object if the operation is created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that - /// originally returns it. If you use the default HTTP mapping, the - /// `name` should have the format of `operations/some/unique/name`. - pub name: Option, - /// This field will contain a `DevicesLongRunningOperationMetadata` object if the operation is created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`. - pub metadata: Option>, -} - -impl Resource for Operation {} -impl ResponseResult for Operation {} - - /// Identifies one claim request. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PartnerClaim { - /// Required. Device identifier of the device. - #[serde(rename="deviceIdentifier")] - pub device_identifier: Option, /// Required. The metadata to attach to the device at claim. #[serde(rename="deviceMetadata")] pub device_metadata: Option, + /// Required. Device identifier of the device. + #[serde(rename="deviceIdentifier")] + pub device_identifier: Option, /// Required. The section type of the device's provisioning record. #[serde(rename="sectionType")] pub section_type: Option, @@ -1639,7 +1642,7 @@ impl<'a, C, A> PartnerMethods<'a, C, A> { /// /// * `request` - No description provided. /// * `metadataOwnerId` - Required. The owner of the newly set metadata. Set this to the partner ID. - /// * `deviceId` - Required. The ID of the reseller partner. + /// * `deviceId` - Required. The ID of the device. pub fn devices_metadata(&self, request: UpdateDeviceMetadataRequest, metadata_owner_id: &str, device_id: &str) -> PartnerDeviceMetadataCall<'a, C, A> { PartnerDeviceMetadataCall { hub: self.hub, @@ -1655,8 +1658,9 @@ impl<'a, C, A> PartnerMethods<'a, C, A> { /// /// Creates a customer for zero-touch enrollment. After the method returns /// successfully, admin and owner roles can manage devices and EMM configs - /// by calling API methods or using their zero-touch enrollment portal. The API - /// doesn't notify the customer that they have access. + /// by calling API methods or using their zero-touch enrollment portal. + /// The customer receives an email that welcomes them to zero-touch enrollment + /// and explains how to sign into the portal. /// /// # Arguments /// @@ -2063,7 +2067,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2079,17 +2083,14 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -2166,7 +2167,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2295,7 +2296,7 @@ impl<'a, C, A> PartnerDeviceUpdateMetadataAsyncCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2311,10 +2312,7 @@ impl<'a, C, A> PartnerDeviceUpdateMetadataAsyncCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2333,7 +2331,7 @@ impl<'a, C, A> PartnerDeviceUpdateMetadataAsyncCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -2422,7 +2420,7 @@ impl<'a, C, A> PartnerDeviceUpdateMetadataAsyncCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2541,7 +2539,7 @@ impl<'a, C, A> PartnerDeviceGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2557,17 +2555,14 @@ impl<'a, C, A> PartnerDeviceGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -2645,7 +2640,7 @@ impl<'a, C, A> PartnerDeviceGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2774,7 +2769,7 @@ impl<'a, C, A> PartnerDeviceFindByOwnerCall<'a, C, A> where C: BorrowMut PartnerDeviceFindByOwnerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2812,7 +2804,7 @@ impl<'a, C, A> PartnerDeviceFindByOwnerCall<'a, C, A> where C: BorrowMut PartnerDeviceFindByOwnerCall<'a, C, A> where C: BorrowMut PartnerCustomerListCall<'a, C, A> where C: BorrowMut PartnerCustomerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -3150,7 +3139,7 @@ impl<'a, C, A> PartnerCustomerListCall<'a, C, A> where C: BorrowMut PartnerDeviceFindByIdentifierCall<'a, C, A> where C: BorrowMut PartnerDeviceFindByIdentifierCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3314,7 +3300,7 @@ impl<'a, C, A> PartnerDeviceFindByIdentifierCall<'a, C, A> where C: BorrowMut PartnerDeviceFindByIdentifierCall<'a, C, A> where C: BorrowMut PartnerVendorCustomerListCall<'a, C, A> where C: BorrowMut PartnerVendorCustomerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -3650,7 +3633,7 @@ impl<'a, C, A> PartnerVendorCustomerListCall<'a, C, A> where C: BorrowMut PartnerVendorListCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3795,17 +3778,14 @@ impl<'a, C, A> PartnerVendorListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -3896,7 +3876,7 @@ impl<'a, C, A> PartnerVendorListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4024,7 +4004,7 @@ impl<'a, C, A> PartnerDeviceClaimAsyncCall<'a, C, A> where C: BorrowMut PartnerDeviceClaimAsyncCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4062,7 +4039,7 @@ impl<'a, C, A> PartnerDeviceClaimAsyncCall<'a, C, A> where C: BorrowMut PartnerDeviceClaimAsyncCall<'a, C, A> where C: BorrowMut PartnerDeviceClaimCall<'a, C, A> where C: BorrowMut PartnerDeviceClaimCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4316,7 +4290,7 @@ impl<'a, C, A> PartnerDeviceClaimCall<'a, C, A> where C: BorrowMut PartnerDeviceClaimCall<'a, C, A> where C: BorrowMut PartnerDeviceUnclaimAsyncCall<'a, C, A> where C: BorrowMut PartnerDeviceUnclaimAsyncCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4571,7 +4542,7 @@ impl<'a, C, A> PartnerDeviceUnclaimAsyncCall<'a, C, A> where C: BorrowMut PartnerDeviceUnclaimAsyncCall<'a, C, A> where C: BorrowMut PartnerDeviceMetadataCall<'a, C, A> where C: BorrowMut PartnerDeviceMetadataCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4826,7 +4794,7 @@ impl<'a, C, A> PartnerDeviceMetadataCall<'a, C, A> where C: BorrowMut PartnerDeviceMetadataCall<'a, C, A> where C: BorrowMut PartnerDeviceMetadataCall<'a, C, A> where C: BorrowMut PartnerDeviceMetadataCall<'a, C, A> where C: BorrowMut PartnerCustomerCreateCall<'a, C, A> where C: BorrowMut PartnerCustomerCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5092,7 +5058,7 @@ impl<'a, C, A> PartnerCustomerCreateCall<'a, C, A> where C: BorrowMut PartnerCustomerCreateCall<'a, C, A> where C: BorrowMut PartnerDeviceUnclaimCall<'a, C, A> where C: BorrowMut PartnerDeviceUnclaimCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5347,7 +5310,7 @@ impl<'a, C, A> PartnerDeviceUnclaimCall<'a, C, A> where C: BorrowMut PartnerDeviceUnclaimCall<'a, C, A> where C: BorrowMut CustomerDeviceRemoveConfigurationCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5578,10 +5541,7 @@ impl<'a, C, A> CustomerDeviceRemoveConfigurationCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5600,7 +5560,7 @@ impl<'a, C, A> CustomerDeviceRemoveConfigurationCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -5690,7 +5650,7 @@ impl<'a, C, A> CustomerDeviceRemoveConfigurationCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5821,7 +5781,7 @@ impl<'a, C, A> CustomerConfigurationPatchCall<'a, C, A> where C: BorrowMut CustomerConfigurationPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5859,7 +5816,7 @@ impl<'a, C, A> CustomerConfigurationPatchCall<'a, C, A> where C: BorrowMut CustomerConfigurationPatchCall<'a, C, A> where C: BorrowMut CustomerDeviceGetCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6095,17 +6052,14 @@ impl<'a, C, A> CustomerDeviceGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -6183,7 +6137,7 @@ impl<'a, C, A> CustomerDeviceGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6311,7 +6265,7 @@ impl<'a, C, A> CustomerDeviceApplyConfigurationCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6327,10 +6281,7 @@ impl<'a, C, A> CustomerDeviceApplyConfigurationCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6349,7 +6300,7 @@ impl<'a, C, A> CustomerDeviceApplyConfigurationCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -6439,7 +6390,7 @@ impl<'a, C, A> CustomerDeviceApplyConfigurationCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6558,7 +6509,7 @@ impl<'a, C, A> CustomerConfigurationGetCall<'a, C, A> where C: BorrowMut CustomerConfigurationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -6662,7 +6610,7 @@ impl<'a, C, A> CustomerConfigurationGetCall<'a, C, A> where C: BorrowMut CustomerConfigurationDeleteCall<'a, C, A> where C: BorrowMut CustomerConfigurationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -6887,7 +6832,7 @@ impl<'a, C, A> CustomerConfigurationDeleteCall<'a, C, A> where C: BorrowMut CustomerDeviceListCall<'a, C, A> where C: BorrowMut CustomerDeviceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -7135,7 +7077,7 @@ impl<'a, C, A> CustomerDeviceListCall<'a, C, A> where C: BorrowMut CustomerListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -7345,7 +7284,7 @@ impl<'a, C, A> CustomerListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7475,7 +7414,7 @@ impl<'a, C, A> CustomerDeviceUnclaimCall<'a, C, A> where C: BorrowMut CustomerDeviceUnclaimCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7513,7 +7449,7 @@ impl<'a, C, A> CustomerDeviceUnclaimCall<'a, C, A> where C: BorrowMut CustomerDeviceUnclaimCall<'a, C, A> where C: BorrowMut CustomerDpcListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7739,17 +7675,14 @@ impl<'a, C, A> CustomerDpcListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -7827,7 +7760,7 @@ impl<'a, C, A> CustomerDpcListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7946,7 +7879,7 @@ impl<'a, C, A> CustomerConfigurationListCall<'a, C, A> where C: BorrowMut CustomerConfigurationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -8050,7 +7980,7 @@ impl<'a, C, A> CustomerConfigurationListCall<'a, C, A> where C: BorrowMut CustomerConfigurationCreateCall<'a, C, A> where C: BorrowMut CustomerConfigurationCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8215,7 +8142,7 @@ impl<'a, C, A> CustomerConfigurationCreateCall<'a, C, A> where C: BorrowMut CustomerConfigurationCreateCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Android Enterprise (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidenterprise1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-androidenterprise1] path = "../androidenterprise1" -version = "1.0.8+20181003" +version = "1.0.8+20190401" diff --git a/gen/androidenterprise1-cli/README.md b/gen/androidenterprise1-cli/README.md index dfe3e2b203..3084f82a98 100644 --- a/gen/androidenterprise1-cli/README.md +++ b/gen/androidenterprise1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Android Enterprise* API at revision *20181003*. The CLI is at version *1.0.8*. +This documentation was generated from the *Android Enterprise* API at revision *20190401*. The CLI is at version *1.0.8*. ```bash androidenterprise1 [options] @@ -43,14 +43,12 @@ androidenterprise1 [options] enroll (-r )... [-p ]... [-o ] generate-signup-url [-p ]... [-o ] get [-p ]... [-o ] - get-android-device-policy-config [-p ]... [-o ] get-service-account [-p ]... [-o ] get-store-layout [-p ]... [-o ] list [-p ]... [-o ] pull-notification-set [-p ]... [-o ] send-test-push-notification [-p ]... [-o ] set-account (-r )... [-p ]... [-o ] - set-android-device-policy-config (-r )... [-p ]... [-o ] set-store-layout (-r )... [-p ]... [-o ] unenroll [-p ]... entitlements @@ -125,6 +123,13 @@ androidenterprise1 [options] revoke-token [-p ]... set-available-product-set (-r )... [-p ]... [-o ] update (-r )... [-p ]... [-o ] + webapps + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] androidenterprise1 --help Configuration: diff --git a/gen/androidenterprise1-cli/mkdocs.yml b/gen/androidenterprise1-cli/mkdocs.yml index f50b2c79ee..26b4b01948 100644 --- a/gen/androidenterprise1-cli/mkdocs.yml +++ b/gen/androidenterprise1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Enterprise v1.0.8+20181003 +site_name: Android Enterprise v1.0.8+20190401 site_url: http://byron.github.io/google-apis-rs/google-androidenterprise1-cli site_description: A complete library to interact with Android Enterprise (protocol v1) @@ -21,14 +21,12 @@ pages: - ['enterprises_enroll.md', 'Enterprises', 'Enroll'] - ['enterprises_generate-signup-url.md', 'Enterprises', 'Generate Signup Url'] - ['enterprises_get.md', 'Enterprises', 'Get'] -- ['enterprises_get-android-device-policy-config.md', 'Enterprises', 'Get Android Device Policy Config'] - ['enterprises_get-service-account.md', 'Enterprises', 'Get Service Account'] - ['enterprises_get-store-layout.md', 'Enterprises', 'Get Store Layout'] - ['enterprises_list.md', 'Enterprises', 'List'] - ['enterprises_pull-notification-set.md', 'Enterprises', 'Pull Notification Set'] - ['enterprises_send-test-push-notification.md', 'Enterprises', 'Send Test Push Notification'] - ['enterprises_set-account.md', 'Enterprises', 'Set Account'] -- ['enterprises_set-android-device-policy-config.md', 'Enterprises', 'Set Android Device Policy Config'] - ['enterprises_set-store-layout.md', 'Enterprises', 'Set Store Layout'] - ['enterprises_unenroll.md', 'Enterprises', 'Unenroll'] - ['entitlements_delete.md', 'Entitlements', 'Delete'] @@ -90,6 +88,12 @@ pages: - ['users_revoke-token.md', 'Users', 'Revoke Token'] - ['users_set-available-product-set.md', 'Users', 'Set Available Product Set'] - ['users_update.md', 'Users', 'Update'] +- ['webapps_delete.md', 'Webapps', 'Delete'] +- ['webapps_get.md', 'Webapps', 'Get'] +- ['webapps_insert.md', 'Webapps', 'Insert'] +- ['webapps_list.md', 'Webapps', 'List'] +- ['webapps_patch.md', 'Webapps', 'Patch'] +- ['webapps_update.md', 'Webapps', 'Update'] theme: readthedocs diff --git a/gen/androidenterprise1-cli/src/main.rs b/gen/androidenterprise1-cli/src/main.rs index b5b311c69a..58b7f618dc 100644 --- a/gen/androidenterprise1-cli/src/main.rs +++ b/gen/androidenterprise1-cli/src/main.rs @@ -616,8 +616,9 @@ impl<'n> Engine<'n> { "private-apps.enabled" => Some(("privateApps.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "permission" => Some(("permission", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "web-apps.enabled" => Some(("webApps.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "managed-configurations.enabled" => Some(("managedConfigurations.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["approve-apps", "enabled", "kind", "parent", "permission", "play-search", "private-apps", "store-builder", "web-apps"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["approve-apps", "enabled", "kind", "managed-configurations", "parent", "permission", "play-search", "private-apps", "store-builder", "web-apps"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -873,58 +874,6 @@ impl<'n> Engine<'n> { } } - fn _enterprises_get_android_device_policy_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.enterprises().get_android_device_policy_config(opt.value_of("enterprise-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _enterprises_get_service_account(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.enterprises().get_service_account(opt.value_of("enterprise-id").unwrap_or("")); @@ -1279,92 +1228,6 @@ impl<'n> Engine<'n> { } } - fn _enterprises_set_android_device_policy_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "state"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::AndroidDevicePolicyConfig = json::value::from_value(object).unwrap(); - let mut call = self.hub.enterprises().set_android_device_policy_config(request, opt.value_of("enterprise-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _enterprises_set_store_layout(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -5231,6 +5094,424 @@ impl<'n> Engine<'n> { } } + fn _webapps_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.webapps().delete(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("web-app-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _webapps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.webapps().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("web-app-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _webapps_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-mode" => Some(("displayMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "is-published" => Some(("isPublished", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "web-app-id" => Some(("webAppId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version-code" => Some(("versionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-url" => Some(("startUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-mode", "is-published", "start-url", "title", "version-code", "web-app-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::WebApp = json::value::from_value(object).unwrap(); + let mut call = self.hub.webapps().insert(request, opt.value_of("enterprise-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _webapps_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.webapps().list(opt.value_of("enterprise-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _webapps_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-mode" => Some(("displayMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "is-published" => Some(("isPublished", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "web-app-id" => Some(("webAppId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version-code" => Some(("versionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-url" => Some(("startUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-mode", "is-published", "start-url", "title", "version-code", "web-app-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::WebApp = json::value::from_value(object).unwrap(); + let mut call = self.hub.webapps().patch(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("web-app-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _webapps_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-mode" => Some(("displayMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "is-published" => Some(("isPublished", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "web-app-id" => Some(("webAppId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version-code" => Some(("versionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-url" => Some(("startUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-mode", "is-published", "start-url", "title", "version-code", "web-app-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::WebApp = json::value::from_value(object).unwrap(); + let mut call = self.hub.webapps().update(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("web-app-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); @@ -5282,9 +5563,6 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._enterprises_get(opt, dry_run, &mut err); }, - ("get-android-device-policy-config", Some(opt)) => { - call_result = self._enterprises_get_android_device_policy_config(opt, dry_run, &mut err); - }, ("get-service-account", Some(opt)) => { call_result = self._enterprises_get_service_account(opt, dry_run, &mut err); }, @@ -5303,9 +5581,6 @@ impl<'n> Engine<'n> { ("set-account", Some(opt)) => { call_result = self._enterprises_set_account(opt, dry_run, &mut err); }, - ("set-android-device-policy-config", Some(opt)) => { - call_result = self._enterprises_set_android_device_policy_config(opt, dry_run, &mut err); - }, ("set-store-layout", Some(opt)) => { call_result = self._enterprises_set_store_layout(opt, dry_run, &mut err); }, @@ -5599,6 +5874,32 @@ impl<'n> Engine<'n> { } } }, + ("webapps", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._webapps_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._webapps_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._webapps_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._webapps_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._webapps_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._webapps_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("webapps".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, _ => { err.issues.push(CLIError::MissingCommandError); writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); @@ -5900,7 +6201,7 @@ fn main() { ]), ]), - ("enterprises", "methods: 'acknowledge-notification-set', 'complete-signup', 'create-web-token', 'enroll', 'generate-signup-url', 'get', 'get-android-device-policy-config', 'get-service-account', 'get-store-layout', 'list', 'pull-notification-set', 'send-test-push-notification', 'set-account', 'set-android-device-policy-config', 'set-store-layout' and 'unenroll'", vec![ + ("enterprises", "methods: 'acknowledge-notification-set', 'complete-signup', 'create-web-token', 'enroll', 'generate-signup-url', 'get', 'get-service-account', 'get-store-layout', 'list', 'pull-notification-set', 'send-test-push-notification', 'set-account', 'set-store-layout' and 'unenroll'", vec![ ("acknowledge-notification-set", Some(r##"Acknowledges notifications that were received from Enterprises.PullNotificationSet to prevent subsequent calls from returning the same notifications."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_acknowledge-notification-set", @@ -6015,28 +6316,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get-android-device-policy-config", - Some(r##"Deprecated and unused."##), - "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_get-android-device-policy-config", - vec![ - (Some(r##"enterprise-id"##), - None, - Some(r##"The ID of the enterprise."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -6179,34 +6458,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("set-android-device-policy-config", - Some(r##"Deprecated and unused."##), - "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_set-android-device-policy-config", - vec![ - (Some(r##"enterprise-id"##), - None, - Some(r##"The ID of the enterprise."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -7823,6 +8074,8 @@ fn main() { ("generate-authentication-token", Some(r##"Generates an authentication token which the device policy client can use to provision the given EMM-managed user account on a device. The generated token is single-use and expires after a few minutes. + You can provision a maximum of 10 devices per user. + This call only works with EMM-managed accounts."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/users_generate-authentication-token", vec![ @@ -8149,11 +8402,182 @@ fn main() { ]), ]), + ("webapps", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing web app."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/webapps_delete", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"web-app-id"##), + None, + Some(r##"The ID of the web app."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets an existing web app."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/webapps_get", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"web-app-id"##), + None, + Some(r##"The ID of the web app."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Creates a new web app for the enterprise."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/webapps_insert", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the details of all web apps for a given enterprise."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/webapps_list", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing web app. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/webapps_patch", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"web-app-id"##), + None, + Some(r##"The ID of the web app."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing web app."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/webapps_update", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"web-app-id"##), + None, + Some(r##"The ID of the web app."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ]; let mut app = App::new("androidenterprise1") .author("Sebastian Thiel ") - .version("1.0.8+20181003") + .version("1.0.8+20190401") .about("Manages the deployment of apps to Android for Work users.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli") .arg(Arg::with_name("url") diff --git a/gen/androidenterprise1/Cargo.toml b/gen/androidenterprise1/Cargo.toml index 51875bbc85..ccf577bd91 100644 --- a/gen/androidenterprise1/Cargo.toml +++ b/gen/androidenterprise1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-androidenterprise1" -version = "1.0.8+20181003" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Enterprise (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidenterprise1" homepage = "https://developers.google.com/android/work/play/emm-api" -documentation = "https://docs.rs/google-androidenterprise1/1.0.8+20181003" +documentation = "https://docs.rs/google-androidenterprise1/1.0.8+20190401" license = "MIT" keywords = ["androidenterprise", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/androidenterprise1/README.md b/gen/androidenterprise1/README.md index 0a1f012aa1..73a07e6009 100644 --- a/gen/androidenterprise1/README.md +++ b/gen/androidenterprise1/README.md @@ -5,44 +5,46 @@ DO NOT EDIT ! --> The `google-androidenterprise1` library allows access to all features of the *Google Android Enterprise* service. -This documentation was generated from *Android Enterprise* crate version *1.0.8+20181003*, where *20181003* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Android Enterprise* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Android Enterprise* *v1* API can be found at the [official documentation site](https://developers.google.com/android/work/play/emm-api). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.AndroidEnterprise.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.AndroidEnterprise.html) ... -* [devices](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.Device.html) - * [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.DeviceGetCall.html), [*get state*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.DeviceGetStateCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.DeviceListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.DevicePatchCall.html), [*set state*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.DeviceSetStateCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.DeviceUpdateCall.html) -* [enterprises](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.Enterprise.html) - * [*acknowledge notification set*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseAcknowledgeNotificationSetCall.html), [*complete signup*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseCompleteSignupCall.html), [*create web token*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseCreateWebTokenCall.html), [*enroll*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseEnrollCall.html), [*generate signup url*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseGenerateSignupUrlCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseGetCall.html), [*get android device policy config*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseGetAndroidDevicePolicyConfigCall.html), [*get service account*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseGetServiceAccountCall.html), [*get store layout*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseGetStoreLayoutCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseListCall.html), [*pull notification set*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterprisePullNotificationSetCall.html), [*send test push notification*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseSetAccountCall.html), [*set android device policy config*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseSetAndroidDevicePolicyConfigCall.html), [*set store layout*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EnterpriseUnenrollCall.html) -* [entitlements](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.Entitlement.html) - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EntitlementDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EntitlementGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EntitlementListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EntitlementPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.EntitlementUpdateCall.html) +* [devices](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.Device.html) + * [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.DeviceGetCall.html), [*get state*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.DeviceGetStateCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.DeviceListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.DevicePatchCall.html), [*set state*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.DeviceSetStateCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.DeviceUpdateCall.html) +* [enterprises](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.Enterprise.html) + * [*acknowledge notification set*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseAcknowledgeNotificationSetCall.html), [*complete signup*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseCompleteSignupCall.html), [*create web token*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseCreateWebTokenCall.html), [*enroll*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseEnrollCall.html), [*generate signup url*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseGenerateSignupUrlCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseGetCall.html), [*get service account*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseGetServiceAccountCall.html), [*get store layout*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseGetStoreLayoutCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseListCall.html), [*pull notification set*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterprisePullNotificationSetCall.html), [*send test push notification*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseSetAccountCall.html), [*set store layout*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EnterpriseUnenrollCall.html) +* [entitlements](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.Entitlement.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EntitlementDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EntitlementGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EntitlementListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EntitlementPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.EntitlementUpdateCall.html) * grouplicenses - * [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.GrouplicenseGetCall.html) and [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.GrouplicenseListCall.html) + * [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.GrouplicenseGetCall.html) and [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.GrouplicenseListCall.html) * grouplicenseusers - * [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.GrouplicenseuserListCall.html) -* [installs](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.Install.html) - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.InstallDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.InstallGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.InstallListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.InstallPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.InstallUpdateCall.html) + * [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.GrouplicenseuserListCall.html) +* [installs](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.Install.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.InstallDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.InstallGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.InstallListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.InstallPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.InstallUpdateCall.html) * managedconfigurationsfordevice - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationsfordeviceDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationsfordeviceGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationsfordeviceListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationsfordevicePatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationsfordeviceUpdateCall.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationsfordeviceDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationsfordeviceGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationsfordeviceListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationsfordevicePatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationsfordeviceUpdateCall.html) * managedconfigurationsforuser - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationsforuserDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationsforuserGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationsforuserListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationsforuserPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationsforuserUpdateCall.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationsforuserDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationsforuserGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationsforuserListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationsforuserPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationsforuserUpdateCall.html) * managedconfigurationssettings - * [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ManagedconfigurationssettingListCall.html) -* [permissions](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.Permission.html) - * [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.PermissionGetCall.html) -* [products](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.Product.html) - * [*approve*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ProductApproveCall.html), [*generate approval url*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ProductGenerateApprovalUrlCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ProductGetCall.html), [*get app restrictions schema*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ProductGetAppRestrictionsSchemaCall.html), [*get permissions*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ProductGetPermissionCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ProductListCall.html) and [*unapprove*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ProductUnapproveCall.html) + * [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ManagedconfigurationssettingListCall.html) +* [permissions](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.Permission.html) + * [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.PermissionGetCall.html) +* [products](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.Product.html) + * [*approve*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ProductApproveCall.html), [*generate approval url*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ProductGenerateApprovalUrlCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ProductGetCall.html), [*get app restrictions schema*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ProductGetAppRestrictionsSchemaCall.html), [*get permissions*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ProductGetPermissionCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ProductListCall.html) and [*unapprove*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ProductUnapproveCall.html) * serviceaccountkeys - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ServiceaccountkeyDeleteCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ServiceaccountkeyInsertCall.html) and [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.ServiceaccountkeyListCall.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ServiceaccountkeyDeleteCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ServiceaccountkeyInsertCall.html) and [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.ServiceaccountkeyListCall.html) * storelayoutclusters - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutclusterDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutclusterGetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutclusterInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutclusterListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutclusterPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutclusterUpdateCall.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutclusterDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutclusterGetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutclusterInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutclusterListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutclusterPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutclusterUpdateCall.html) * storelayoutpages - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutpageDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutpageGetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutpageInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutpageListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutpagePatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.StorelayoutpageUpdateCall.html) -* [users](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.User.html) - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserDeleteCall.html), [*generate authentication token*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserGenerateAuthenticationTokenCall.html), [*generate token*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserGenerateTokenCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserGetCall.html), [*get available product set*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserGetAvailableProductSetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserPatchCall.html), [*revoke device access*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserRevokeDeviceAccesCall.html), [*revoke token*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserRevokeTokenCall.html), [*set available product set*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserSetAvailableProductSetCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.UserUpdateCall.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutpageDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutpageGetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutpageInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutpageListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutpagePatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.StorelayoutpageUpdateCall.html) +* [users](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.User.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserDeleteCall.html), [*generate authentication token*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserGenerateAuthenticationTokenCall.html), [*generate token*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserGenerateTokenCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserGetCall.html), [*get available product set*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserGetAvailableProductSetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserPatchCall.html), [*revoke device access*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserRevokeDeviceAccesCall.html), [*revoke token*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserRevokeTokenCall.html), [*set available product set*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserSetAvailableProductSetCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.UserUpdateCall.html) +* webapps + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.WebappDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.WebappGetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.WebappInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.WebappListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.WebappPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.WebappUpdateCall.html) @@ -51,17 +53,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/struct.AndroidEnterprise.html)** +* **[Hub](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/struct.AndroidEnterprise.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.Part.html)** + * **[Parts](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -76,21 +78,19 @@ Or specifically ... ```ignore let r = hub.enterprises().send_test_push_notification(...).doit() -let r = hub.enterprises().generate_signup_url(...).doit() -let r = hub.enterprises().get_android_device_policy_config(...).doit() +let r = hub.enterprises().get_store_layout(...).doit() +let r = hub.enterprises().get_service_account(...).doit() let r = hub.enterprises().acknowledge_notification_set(...).doit() let r = hub.enterprises().set_store_layout(...).doit() -let r = hub.enterprises().set_android_device_policy_config(...).doit() -let r = hub.enterprises().get_store_layout(...).doit() -let r = hub.enterprises().pull_notification_set(...).doit() -let r = hub.enterprises().list(...).doit() let r = hub.enterprises().complete_signup(...).doit() +let r = hub.enterprises().list(...).doit() +let r = hub.enterprises().unenroll(...).doit() let r = hub.enterprises().set_account(...).doit() +let r = hub.enterprises().pull_notification_set(...).doit() let r = hub.enterprises().enroll(...).doit() let r = hub.enterprises().create_web_token(...).doit() let r = hub.enterprises().get(...).doit() -let r = hub.enterprises().unenroll(...).doit() -let r = hub.enterprises().get_service_account(...).doit() +let r = hub.enterprises().generate_signup_url(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -124,7 +124,6 @@ extern crate hyper; extern crate hyper_rustls; extern crate yup_oauth2 as oauth2; extern crate google_androidenterprise1 as androidenterprise1; -use androidenterprise1::StoreLayout; use androidenterprise1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -142,15 +141,11 @@ let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), ::default(), None); let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -// As the method needs a request, you would usually fill it with the desired information -// into the respective structure. Some of the parts shown here might not be applicable ! -// Values shown here are possibly random and not representative ! -let mut req = StoreLayout::default(); - // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.enterprises().set_store_layout(req, "enterpriseId") +let result = hub.enterprises().get_service_account("enterpriseId") + .key_type("sit") .doit(); match result { @@ -173,17 +168,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -193,29 +188,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-androidenterprise1/1.0.8+20181003/google_androidenterprise1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-androidenterprise1/1.0.8+20190401/google_androidenterprise1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/androidenterprise1/src/lib.rs b/gen/androidenterprise1/src/lib.rs index 6f24e0da08..a64f183c75 100644 --- a/gen/androidenterprise1/src/lib.rs +++ b/gen/androidenterprise1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Android Enterprise* crate version *1.0.8+20181003*, where *20181003* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Android Enterprise* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Android Enterprise* *v1* API can be found at the //! [official documentation site](https://developers.google.com/android/work/play/emm-api). @@ -14,7 +14,7 @@ //! * [devices](struct.Device.html) //! * [*get*](struct.DeviceGetCall.html), [*get state*](struct.DeviceGetStateCall.html), [*list*](struct.DeviceListCall.html), [*patch*](struct.DevicePatchCall.html), [*set state*](struct.DeviceSetStateCall.html) and [*update*](struct.DeviceUpdateCall.html) //! * [enterprises](struct.Enterprise.html) -//! * [*acknowledge notification set*](struct.EnterpriseAcknowledgeNotificationSetCall.html), [*complete signup*](struct.EnterpriseCompleteSignupCall.html), [*create web token*](struct.EnterpriseCreateWebTokenCall.html), [*enroll*](struct.EnterpriseEnrollCall.html), [*generate signup url*](struct.EnterpriseGenerateSignupUrlCall.html), [*get*](struct.EnterpriseGetCall.html), [*get android device policy config*](struct.EnterpriseGetAndroidDevicePolicyConfigCall.html), [*get service account*](struct.EnterpriseGetServiceAccountCall.html), [*get store layout*](struct.EnterpriseGetStoreLayoutCall.html), [*list*](struct.EnterpriseListCall.html), [*pull notification set*](struct.EnterprisePullNotificationSetCall.html), [*send test push notification*](struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](struct.EnterpriseSetAccountCall.html), [*set android device policy config*](struct.EnterpriseSetAndroidDevicePolicyConfigCall.html), [*set store layout*](struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](struct.EnterpriseUnenrollCall.html) +//! * [*acknowledge notification set*](struct.EnterpriseAcknowledgeNotificationSetCall.html), [*complete signup*](struct.EnterpriseCompleteSignupCall.html), [*create web token*](struct.EnterpriseCreateWebTokenCall.html), [*enroll*](struct.EnterpriseEnrollCall.html), [*generate signup url*](struct.EnterpriseGenerateSignupUrlCall.html), [*get*](struct.EnterpriseGetCall.html), [*get service account*](struct.EnterpriseGetServiceAccountCall.html), [*get store layout*](struct.EnterpriseGetStoreLayoutCall.html), [*list*](struct.EnterpriseListCall.html), [*pull notification set*](struct.EnterprisePullNotificationSetCall.html), [*send test push notification*](struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](struct.EnterpriseSetAccountCall.html), [*set store layout*](struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](struct.EnterpriseUnenrollCall.html) //! * [entitlements](struct.Entitlement.html) //! * [*delete*](struct.EntitlementDeleteCall.html), [*get*](struct.EntitlementGetCall.html), [*list*](struct.EntitlementListCall.html), [*patch*](struct.EntitlementPatchCall.html) and [*update*](struct.EntitlementUpdateCall.html) //! * grouplicenses @@ -41,6 +41,8 @@ //! * [*delete*](struct.StorelayoutpageDeleteCall.html), [*get*](struct.StorelayoutpageGetCall.html), [*insert*](struct.StorelayoutpageInsertCall.html), [*list*](struct.StorelayoutpageListCall.html), [*patch*](struct.StorelayoutpagePatchCall.html) and [*update*](struct.StorelayoutpageUpdateCall.html) //! * [users](struct.User.html) //! * [*delete*](struct.UserDeleteCall.html), [*generate authentication token*](struct.UserGenerateAuthenticationTokenCall.html), [*generate token*](struct.UserGenerateTokenCall.html), [*get*](struct.UserGetCall.html), [*get available product set*](struct.UserGetAvailableProductSetCall.html), [*insert*](struct.UserInsertCall.html), [*list*](struct.UserListCall.html), [*patch*](struct.UserPatchCall.html), [*revoke device access*](struct.UserRevokeDeviceAccesCall.html), [*revoke token*](struct.UserRevokeTokenCall.html), [*set available product set*](struct.UserSetAvailableProductSetCall.html) and [*update*](struct.UserUpdateCall.html) +//! * webapps +//! * [*delete*](struct.WebappDeleteCall.html), [*get*](struct.WebappGetCall.html), [*insert*](struct.WebappInsertCall.html), [*list*](struct.WebappListCall.html), [*patch*](struct.WebappPatchCall.html) and [*update*](struct.WebappUpdateCall.html) //! //! //! @@ -76,21 +78,19 @@ //! //! ```ignore //! let r = hub.enterprises().send_test_push_notification(...).doit() -//! let r = hub.enterprises().generate_signup_url(...).doit() -//! let r = hub.enterprises().get_android_device_policy_config(...).doit() +//! let r = hub.enterprises().get_store_layout(...).doit() +//! let r = hub.enterprises().get_service_account(...).doit() //! let r = hub.enterprises().acknowledge_notification_set(...).doit() //! let r = hub.enterprises().set_store_layout(...).doit() -//! let r = hub.enterprises().set_android_device_policy_config(...).doit() -//! let r = hub.enterprises().get_store_layout(...).doit() -//! let r = hub.enterprises().pull_notification_set(...).doit() -//! let r = hub.enterprises().list(...).doit() //! let r = hub.enterprises().complete_signup(...).doit() +//! let r = hub.enterprises().list(...).doit() +//! let r = hub.enterprises().unenroll(...).doit() //! let r = hub.enterprises().set_account(...).doit() +//! let r = hub.enterprises().pull_notification_set(...).doit() //! let r = hub.enterprises().enroll(...).doit() //! let r = hub.enterprises().create_web_token(...).doit() //! let r = hub.enterprises().get(...).doit() -//! let r = hub.enterprises().unenroll(...).doit() -//! let r = hub.enterprises().get_service_account(...).doit() +//! let r = hub.enterprises().generate_signup_url(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -124,7 +124,6 @@ //! extern crate hyper_rustls; //! extern crate yup_oauth2 as oauth2; //! extern crate google_androidenterprise1 as androidenterprise1; -//! use androidenterprise1::StoreLayout; //! use androidenterprise1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -143,15 +142,11 @@ //! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), //! ::default(), None); //! let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -//! // As the method needs a request, you would usually fill it with the desired information -//! // into the respective structure. Some of the parts shown here might not be applicable ! -//! // Values shown here are possibly random and not representative ! -//! let mut req = StoreLayout::default(); -//! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.enterprises().set_store_layout(req, "enterpriseId") +//! let result = hub.enterprises().get_service_account("enterpriseId") +//! .key_type("sed") //! .doit(); //! //! match result { @@ -309,7 +304,6 @@ impl Default for Scope { /// extern crate hyper_rustls; /// extern crate yup_oauth2 as oauth2; /// extern crate google_androidenterprise1 as androidenterprise1; -/// use androidenterprise1::StoreLayout; /// use androidenterprise1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -328,15 +322,11 @@ impl Default for Scope { /// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// ::default(), None); /// let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = StoreLayout::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().set_store_layout(req, "enterpriseId") +/// let result = hub.enterprises().get_service_account("enterpriseId") +/// .key_type("dolores") /// .doit(); /// /// match result { @@ -425,6 +415,9 @@ impl<'a, C, A> AndroidEnterprise pub fn users(&'a self) -> UserMethods<'a, C, A> { UserMethods { hub: &self } } + pub fn webapps(&'a self) -> WebappMethods<'a, C, A> { + WebappMethods { hub: &self } + } /// Set the user-agent header field to use in all requests to the server. /// It defaults to `google-api-rust-client/1.0.8`. @@ -481,24 +474,47 @@ pub struct AppRestrictionsSchemaRestrictionRestrictionValue { impl Part for AppRestrictionsSchemaRestrictionRestrictionValue {} -/// The matching enterprise resources. +/// The existence of an Installs resource indicates that an app is installed on a particular device (or that an install is pending). +/// +/// The API can be used to create an install resource using the update method. This triggers the actual install of the app on the device. If the user does not already have an entitlement for the app, then an attempt is made to create one. If this fails (for example, because the app is not free and there is no available license), then the creation of the install fails. +/// +/// The API can also be used to update an installed app. If the update method is used on an existing install, then the app will be updated to the latest available version. +/// +/// Note that it is not possible to force the installation of a specific version of an app: the version code is read-only. +/// +/// If a user installs an app themselves (as permitted by the enterprise), then again an install resource and possibly an entitlement resource are automatically created. +/// +/// The API can also be used to delete an install resource, which triggers the removal of the app from the device. Note that deleting an install does not automatically remove the corresponding entitlement, even if there are no remaining installs. The install resource will also be deleted if the user uninstalls the app themselves. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list enterprises](struct.EnterpriseListCall.html) (response) +/// * [patch installs](struct.InstallPatchCall.html) (request|response) +/// * [list installs](struct.InstallListCall.html) (none) +/// * [delete installs](struct.InstallDeleteCall.html) (none) +/// * [update installs](struct.InstallUpdateCall.html) (request|response) +/// * [get installs](struct.InstallGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EnterprisesListResponse { - /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterprisesListResponse". +pub struct Install { + /// Install state. The state "installPending" means that an install request has recently been made and download to the device is in progress. The state "installed" means that the app has been installed. This field is read-only. + #[serde(rename="installState")] + pub install_state: Option, + /// The version of the installed product. Guaranteed to be set only if the install state is "installed". + #[serde(rename="versionCode")] + pub version_code: Option, + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#install". pub kind: Option, - /// An enterprise. - pub enterprise: Option>, + /// The ID of the product that the install is for. For example, "app:com.google.android.gm". + #[serde(rename="productId")] + pub product_id: Option, } -impl ResponseResult for EnterprisesListResponse {} +impl RequestValue for Install {} +impl Resource for Install {} +impl ResponseResult for Install {} /// The presence of an Entitlements resource indicates that a user has the right to use a particular app. Entitlements are user specific, not device specific. This allows a user with an entitlement to an app to install the app on all their devices. It's also possible for a user to hold an entitlement to an app without installing the app on any device. @@ -635,6 +651,54 @@ pub struct NewDeviceEvent { impl Part for NewDeviceEvent {} +/// A WebApps resource represents a web app created for an enterprise. Web apps are published to managed Google Play and can be distributed like other Android apps. On a user's device, a web app opens its specified URL. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert webapps](struct.WebappInsertCall.html) (request|response) +/// * [update webapps](struct.WebappUpdateCall.html) (request|response) +/// * [patch webapps](struct.WebappPatchCall.html) (request|response) +/// * [get webapps](struct.WebappGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WebApp { + /// The ID of the application. A string of the form "app:" where the package name always starts with the prefix "com.google.enterprise.webapp." followed by a random id. + #[serde(rename="webAppId")] + pub web_app_id: Option, + /// A list of icons representing this website. If absent, a default icon (for create) or the current icon (for update) will be used. + pub icons: Option>, + /// The current version of the app. + /// + /// + /// Note that the version can automatically increase during the lifetime of the web app, while Google does internal housekeeping to keep the web app up-to-date. + #[serde(rename="versionCode")] + pub version_code: Option, + /// The title of the web app as displayed to the user (e.g., amongst a list of other applications, or as a label for an icon). + pub title: Option, + /// The display mode of the web app. + /// + /// Possible values include: + /// - "minimalUi", the device's status bar, navigation bar, the app's URL, and a refresh button are visible when the app is open. For HTTP URLs, you can only select this option. + /// - "standalone", the device's status bar and navigation bar are visible when the app is open. + /// - "fullScreen", the app opens in full screen mode, hiding the device's status and navigation bars. All browser UI elements, page URL, system status bar and back button are not visible, and the web app takes up the entirety of the available display area. + #[serde(rename="displayMode")] + pub display_mode: Option, + /// A flag whether the app has been published to the Play store yet. + #[serde(rename="isPublished")] + pub is_published: Option, + /// The start URL, i.e. the URL that should load when the user opens the application. + #[serde(rename="startUrl")] + pub start_url: Option, +} + +impl RequestValue for WebApp {} +impl Resource for WebApp {} +impl ResponseResult for WebApp {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -648,39 +712,64 @@ pub struct AdministratorWebTokenSpecPrivateApps { impl Part for AdministratorWebTokenSpecPrivateApps {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AdministratorWebTokenSpecStoreBuilder { - /// Whether the Store Builder page is displayed. Default is true. - pub enabled: Option, -} - -impl Part for AdministratorWebTokenSpecStoreBuilder {} - - -/// Deprecated and unused. +/// Specification for a token used to generate iframes. The token specifies what data the admin is allowed to modify and the URI the iframe is allowed to communiate with. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [set android device policy config enterprises](struct.EnterpriseSetAndroidDevicePolicyConfigCall.html) (request|response) -/// * [get android device policy config enterprises](struct.EnterpriseGetAndroidDevicePolicyConfigCall.html) (response) +/// * [create web token enterprises](struct.EnterpriseCreateWebTokenCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AndroidDevicePolicyConfig { - /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#androidDevicePolicyConfig". +pub struct AdministratorWebTokenSpec { + /// Options for displaying the Organize apps page. + #[serde(rename="storeBuilder")] + pub store_builder: Option, + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#administratorWebTokenSpec". pub kind: Option, - /// Deprecated and unused. - pub state: Option, + /// Options for displaying the managed Play Search apps page. + #[serde(rename="playSearch")] + pub play_search: Option, + /// The URI of the parent frame hosting the iframe. To prevent XSS, the iframe may not be hosted at other URIs. This URI must be https. + pub parent: Option, + /// Options for displaying the Private Apps page. + #[serde(rename="privateApps")] + pub private_apps: Option, + /// Deprecated. Use PlaySearch.approveApps. + pub permission: Option>, + /// Options for displaying the Web Apps page. + #[serde(rename="webApps")] + pub web_apps: Option, + /// Options for displaying the Managed Configuration page. + #[serde(rename="managedConfigurations")] + pub managed_configurations: Option, } -impl RequestValue for AndroidDevicePolicyConfig {} -impl ResponseResult for AndroidDevicePolicyConfig {} +impl RequestValue for AdministratorWebTokenSpec {} + + +/// The state of a user's device, as accessed by the getState and setState methods on device resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get state devices](struct.DeviceGetStateCall.html) (response) +/// * [set state devices](struct.DeviceSetStateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeviceState { + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#deviceState". + pub kind: Option, + /// The state of the Google account on the device. "enabled" indicates that the Google account on the device can be used to access Google services (including Google Play), while "disabled" means that it cannot. A new device is initially in the "disabled" state. + #[serde(rename="accountState")] + pub account_state: Option, +} + +impl RequestValue for DeviceState {} +impl ResponseResult for DeviceState {} /// A managed configurations settings resource contains the set of managed properties that have been configured for an Android app to be applied to a set of users. The app's developer would have defined configurable properties in the managed configurations schema. @@ -780,6 +869,23 @@ pub struct Notification { impl Part for Notification {} +/// Icon for a web app. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WebAppIcon { + /// The actual bytes of the image in a base64url encoded string (c.f. RFC4648, section 5 "Base 64 Encoding with URL and Filename Safe Alphabet"). + /// - The image type can be png or jpg. + /// - The image should ideally be square. + /// - The image should ideally have a size of 512x512. + #[serde(rename="imageData")] + pub image_data: Option, +} + +impl Part for WebAppIcon {} + + /// An event generated whenever a product's availability changes. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -821,15 +927,19 @@ impl Part for ProductSigningCertificate {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [generate approval url products](struct.ProductGenerateApprovalUrlCall.html) (response) +/// * [send test push notification enterprises](struct.EnterpriseSendTestPushNotificationCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ProductsGenerateApprovalUrlResponse { - /// A URL that can be rendered in an iframe to display the permissions (if any) of a product. This URL can be used to approve the product only once and only within 24 hours of being generated, using the Products.approve call. If the product is currently unapproved and has no permissions, this URL will point to an empty page. If the product is currently approved, a URL will only be generated if that product has added permissions since it was last approved, and the URL will only display those new permissions that have not yet been accepted. - pub url: Option, +pub struct EnterprisesSendTestPushNotificationResponse { + /// The name of the Cloud Pub/Sub topic to which notifications for this enterprise's enrolled account will be sent. + #[serde(rename="topicName")] + pub topic_name: Option, + /// The message ID of the test push notification that was sent. + #[serde(rename="messageId")] + pub message_id: Option, } -impl ResponseResult for ProductsGenerateApprovalUrlResponse {} +impl ResponseResult for EnterprisesSendTestPushNotificationResponse {} /// A localized string with its locale. @@ -892,19 +1002,15 @@ impl Part for VariableSet {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [send test push notification enterprises](struct.EnterpriseSendTestPushNotificationCall.html) (response) +/// * [generate approval url products](struct.ProductGenerateApprovalUrlCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EnterprisesSendTestPushNotificationResponse { - /// The name of the Cloud Pub/Sub topic to which notifications for this enterprise's enrolled account will be sent. - #[serde(rename="topicName")] - pub topic_name: Option, - /// The message ID of the test push notification that was sent. - #[serde(rename="messageId")] - pub message_id: Option, +pub struct ProductsGenerateApprovalUrlResponse { + /// A URL that can be rendered in an iframe to display the permissions (if any) of a product. This URL can be used to approve the product only once and only within 24 hours of being generated, using the Products.approve call. If the product is currently unapproved and has no permissions, this URL will point to an empty page. If the product is currently approved, a URL will only be generated if that product has added permissions since it was last approved, and the URL will only display those new permissions that have not yet been accepted. + pub url: Option, } -impl ResponseResult for EnterprisesSendTestPushNotificationResponse {} +impl ResponseResult for ProductsGenerateApprovalUrlResponse {} /// A restriction in the App Restriction Schema represents a piece of configuration that may be pre-applied. @@ -1094,9 +1200,10 @@ impl ResponseResult for ServiceAccountKeysListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ProductVisibility { - /// Grants visibility to the specified track(s) of the product to the user. The track available to the user is based on the following order of preference: alpha, beta, production. For example, if an app has a prod version, a beta version and an alpha version and the enterprise has been granted visibility to both the alpha and beta tracks, if tracks is {"beta", "production"} the user will be able to install the app and they will get the beta version of the app. If there are no app versions in the specified track adding the "alpha" and "beta" values to the list of tracks will have no effect. Note that the enterprise requires access to alpha and/or beta tracks before users can be granted visibility to apps in those tracks. - /// - /// The allowed sets are: {} (considered equivalent to {"production"}) {"production"} {"beta", "production"} {"alpha", "beta", "production"} The order of elements is not relevant. Any other set of tracks will be rejected with an error. + /// Grants the user visibility to the specified product track(s), identified by trackIds. + #[serde(rename="trackIds")] + pub track_ids: Option>, + /// Deprecated. Use trackIds instead. pub tracks: Option>, /// The product ID to make visible to the user. Required for each item in the productVisibility list. #[serde(rename="productId")] @@ -1154,47 +1261,24 @@ pub struct DevicesListResponse { impl ResponseResult for DevicesListResponse {} -/// The existence of an Installs resource indicates that an app is installed on a particular device (or that an install is pending). -/// -/// The API can be used to create an install resource using the update method. This triggers the actual install of the app on the device. If the user does not already have an entitlement for the app, then an attempt is made to create one. If this fails (for example, because the app is not free and there is no available license), then the creation of the install fails. -/// -/// The API can also be used to update an installed app. If the update method is used on an existing install, then the app will be updated to the latest available version. -/// -/// Note that it is not possible to force the installation of a specific version of an app: the version code is read-only. -/// -/// If a user installs an app themselves (as permitted by the enterprise), then again an install resource and possibly an entitlement resource are automatically created. -/// -/// The API can also be used to delete an install resource, which triggers the removal of the app from the device. Note that deleting an install does not automatically remove the corresponding entitlement, even if there are no remaining installs. The install resource will also be deleted if the user uninstalls the app themselves. +/// The matching enterprise resources. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [patch installs](struct.InstallPatchCall.html) (request|response) -/// * [list installs](struct.InstallListCall.html) (none) -/// * [delete installs](struct.InstallDeleteCall.html) (none) -/// * [update installs](struct.InstallUpdateCall.html) (request|response) -/// * [get installs](struct.InstallGetCall.html) (response) +/// * [list enterprises](struct.EnterpriseListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Install { - /// Install state. The state "installPending" means that an install request has recently been made and download to the device is in progress. The state "installed" means that the app has been installed. This field is read-only. - #[serde(rename="installState")] - pub install_state: Option, - /// The version of the installed product. Guaranteed to be set only if the install state is "installed". - #[serde(rename="versionCode")] - pub version_code: Option, - /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#install". +pub struct EnterprisesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#enterprisesListResponse". pub kind: Option, - /// The ID of the product that the install is for. For example, "app:com.google.android.gm". - #[serde(rename="productId")] - pub product_id: Option, + /// An enterprise. + pub enterprise: Option>, } -impl RequestValue for Install {} -impl Resource for Install {} -impl ResponseResult for Install {} +impl ResponseResult for EnterprisesListResponse {} /// An Enterprises resource represents the binding between an EMM and a specific organization. That binding can be instantiated in one of two different ways using this API as follows: @@ -1207,21 +1291,19 @@ impl ResponseResult for Install {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [send test push notification enterprises](struct.EnterpriseSendTestPushNotificationCall.html) (none) -/// * [generate signup url enterprises](struct.EnterpriseGenerateSignupUrlCall.html) (none) -/// * [get android device policy config enterprises](struct.EnterpriseGetAndroidDevicePolicyConfigCall.html) (none) +/// * [get store layout enterprises](struct.EnterpriseGetStoreLayoutCall.html) (none) +/// * [get service account enterprises](struct.EnterpriseGetServiceAccountCall.html) (none) /// * [acknowledge notification set enterprises](struct.EnterpriseAcknowledgeNotificationSetCall.html) (none) /// * [set store layout enterprises](struct.EnterpriseSetStoreLayoutCall.html) (none) -/// * [set android device policy config enterprises](struct.EnterpriseSetAndroidDevicePolicyConfigCall.html) (none) -/// * [get store layout enterprises](struct.EnterpriseGetStoreLayoutCall.html) (none) -/// * [pull notification set enterprises](struct.EnterprisePullNotificationSetCall.html) (none) -/// * [list enterprises](struct.EnterpriseListCall.html) (none) /// * [complete signup enterprises](struct.EnterpriseCompleteSignupCall.html) (response) +/// * [list enterprises](struct.EnterpriseListCall.html) (none) +/// * [unenroll enterprises](struct.EnterpriseUnenrollCall.html) (none) /// * [set account enterprises](struct.EnterpriseSetAccountCall.html) (none) +/// * [pull notification set enterprises](struct.EnterprisePullNotificationSetCall.html) (none) /// * [enroll enterprises](struct.EnterpriseEnrollCall.html) (request|response) /// * [create web token enterprises](struct.EnterpriseCreateWebTokenCall.html) (none) /// * [get enterprises](struct.EnterpriseGetCall.html) (response) -/// * [unenroll enterprises](struct.EnterpriseUnenrollCall.html) (none) -/// * [get service account enterprises](struct.EnterpriseGetServiceAccountCall.html) (none) +/// * [generate signup url enterprises](struct.EnterpriseGenerateSignupUrlCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Enterprise { @@ -1269,38 +1351,17 @@ pub struct InstallFailureEvent { impl Part for InstallFailureEvent {} -/// Specification for a token used to generate iframes. The token specifies what data the admin is allowed to modify and the URI the iframe is allowed to communiate with. +/// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [create web token enterprises](struct.EnterpriseCreateWebTokenCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AdministratorWebTokenSpec { - /// Options for displaying the Store Builder page. - #[serde(rename="storeBuilder")] - pub store_builder: Option, - /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#administratorWebTokenSpec". - pub kind: Option, - /// Options for displaying the Play Search page. - #[serde(rename="playSearch")] - pub play_search: Option, - /// The URI of the parent frame hosting the iframe. To prevent XSS, the iframe may not be hosted at other URIs. This URI must be https. - pub parent: Option, - /// Options for displaying the Private Apps page. - #[serde(rename="privateApps")] - pub private_apps: Option, - /// Deprecated. Use PlaySearch.approveApps. - pub permission: Option>, - /// Options for displaying the Web Apps page. - #[serde(rename="webApps")] - pub web_apps: Option, +pub struct AdministratorWebTokenSpecStoreBuilder { + /// Whether the Organize apps page is displayed. Default is true. + pub enabled: Option, } -impl RequestValue for AdministratorWebTokenSpec {} +impl Part for AdministratorWebTokenSpecStoreBuilder {} /// Maintenance window for managed Google Play Accounts. This allows Play store to update the apps on the foreground in the designated window. @@ -1349,7 +1410,7 @@ pub struct AdministratorWebTokenSpecPlaySearch { /// Allow access to the iframe in approve mode. Default is false. #[serde(rename="approveApps")] pub approve_apps: Option, - /// Whether the Play Search page is displayed. Default is true. + /// Whether the managed Play Search apps page is displayed. Default is true. pub enabled: Option, } @@ -1362,13 +1423,20 @@ impl Part for AdministratorWebTokenSpecPlaySearch {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ProductPolicy { - /// Grants visibility to the specified track(s) of the product to the device. The track available to the device is based on the following order of preference: alpha, beta, production. For example, if an app has a prod version, a beta version and an alpha version and the enterprise has been granted visibility to both the alpha and beta tracks, if tracks is {"beta", "production"} then the beta version of the app is made available to the device. If there are no app versions in the specified track adding the "alpha" and "beta" values to the list of tracks will have no effect. Note that the enterprise requires access to alpha and/or beta tracks before users can be granted visibility to apps in those tracks. - /// - /// The allowed sets are: {} (considered equivalent to {"production"}) {"production"} {"beta", "production"} {"alpha", "beta", "production"} The order of elements is not relevant. Any other set of tracks will be rejected with an error. + /// The auto-install policy for the product. + #[serde(rename="autoInstallPolicy")] + pub auto_install_policy: Option, + /// Deprecated. Use trackIds instead. pub tracks: Option>, + /// The managed configuration for the product. + #[serde(rename="managedConfiguration")] + pub managed_configuration: Option, /// The ID of the product. For example, "app:com.google.android.gm". #[serde(rename="productId")] pub product_id: Option, + /// Grants the device visibility to the specified product release track(s), identified by trackIds. The list of release tracks of a product can be obtained by calling Products.Get. + #[serde(rename="trackIds")] + pub track_ids: Option>, } impl Part for ProductPolicy {} @@ -1388,6 +1456,26 @@ pub struct ManagedPropertyBundle { impl Part for ManagedPropertyBundle {} +/// The auto-install constraint. Defines a set of restrictions for installation. At least one of the fields must be set. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AutoInstallConstraint { + /// Charging state constraint. + #[serde(rename="chargingStateConstraint")] + pub charging_state_constraint: Option, + /// Device idle state constraint. + #[serde(rename="deviceIdleStateConstraint")] + pub device_idle_state_constraint: Option, + /// Network type constraint. + #[serde(rename="networkTypeConstraint")] + pub network_type_constraint: Option, +} + +impl Part for AutoInstallConstraint {} + + /// An event generated when a new app version is uploaded to Google Play and its app restrictions schema changed. To fetch the app restrictions schema for an app, use Products.getAppRestrictionsSchema on the EMM API. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1402,6 +1490,19 @@ pub struct AppRestrictionsSchemaChangeEvent { impl Part for AppRestrictionsSchemaChangeEvent {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdministratorWebTokenSpecManagedConfigurations { + /// Whether the Managed Configuration page is displayed. Default is true. + pub enabled: Option, +} + +impl Part for AdministratorWebTokenSpecManagedConfigurations {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1415,25 +1516,6 @@ pub struct AdministratorWebTokenSpecWebApps { impl Part for AdministratorWebTokenSpecWebApps {} -/// A configuration variables resource contains the managed configuration settings ID to be applied to a single user, as well as the variable set that is attributed to the user. The variable set will be used to replace placeholders in the managed configuration settings. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ConfigurationVariables { - /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#configurationVariables". - pub kind: Option, - /// The variable set that is attributed to the user. - #[serde(rename="variableSet")] - pub variable_set: Option>, - /// The ID of the managed configurations settings. - #[serde(rename="mcmId")] - pub mcm_id: Option, -} - -impl Part for ConfigurationVariables {} - - /// The device policy for a given managed device. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1457,6 +1539,65 @@ pub struct Policy { impl Part for Policy {} +/// A configuration variables resource contains the managed configuration settings ID to be applied to a single user, as well as the variable set that is attributed to the user. The variable set will be used to replace placeholders in the managed configuration settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConfigurationVariables { + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#configurationVariables". + pub kind: Option, + /// The variable set that is attributed to the user. + #[serde(rename="variableSet")] + pub variable_set: Option>, + /// The ID of the managed configurations settings. + #[serde(rename="mcmId")] + pub mcm_id: Option, +} + +impl Part for ConfigurationVariables {} + + +/// Id to name association of a track. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TrackInfo { + /// A modifiable name for a track. This is the visible name in the play developer console. + #[serde(rename="trackAlias")] + pub track_alias: Option, + /// Unmodifiable, unique track identifier. This identifier is the releaseTrackId in the url of the play developer console page that displays the track information. + #[serde(rename="trackId")] + pub track_id: Option, +} + +impl Part for TrackInfo {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AutoInstallPolicy { + /// The auto-install mode. If unset defaults to "doNotAutoInstall". + #[serde(rename="autoInstallMode")] + pub auto_install_mode: Option, + /// The constraints for auto-installing the app. You can specify a maximum of one constraint. + #[serde(rename="autoInstallConstraint")] + pub auto_install_constraint: Option>, + /// The priority of the install, as an unsigned integer. A lower number means higher priority. + #[serde(rename="autoInstallPriority")] + pub auto_install_priority: Option, + /// The minimum version of the app. If a lower version of the app is installed, then the app will be auto-updated according to the auto-install constraints, instead of waiting for the regular auto-update. + #[serde(rename="minimumVersionCode")] + pub minimum_version_code: Option, +} + +impl Part for AutoInstallPolicy {} + + /// A Products resource represents an app in the Google Play store that is available to at least some users in the enterprise. (Some apps are restricted to a single enterprise, and no information about them is made available outside that enterprise.) /// /// The information provided for each product (localized name, icon, link to the full Google Play details page) is intended to allow a basic representation of the product within an EMM user interface. @@ -1522,7 +1663,10 @@ pub struct Product { /// The content rating for this app. #[serde(rename="contentRating")] pub content_rating: Option, - /// The tracks that are visible to the enterprise. + /// The tracks visible to the enterprise. + #[serde(rename="appTracks")] + pub app_tracks: Option>, + /// Deprecated, use appTracks instead. #[serde(rename="availableTracks")] pub available_tracks: Option>, /// The name of the author of the product (for example, the app developer). @@ -1650,29 +1794,6 @@ impl RequestValue for ManagedConfiguration {} impl ResponseResult for ManagedConfiguration {} -/// The state of a user's device, as accessed by the getState and setState methods on device resources. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get state devices](struct.DeviceGetStateCall.html) (response) -/// * [set state devices](struct.DeviceSetStateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeviceState { - /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#deviceState". - pub kind: Option, - /// The state of the Google account on the device. "enabled" indicates that the Google account on the device can be used to access Google services (including Google Play), while "disabled" means that it cannot. A new device is initially in the "disabled" state. - #[serde(rename="accountState")] - pub account_state: Option, -} - -impl RequestValue for DeviceState {} -impl ResponseResult for DeviceState {} - - /// The user resources for the group license. /// /// # Activities @@ -1729,6 +1850,27 @@ pub struct AppRestrictionsSchema { impl ResponseResult for AppRestrictionsSchema {} +/// The web app details for an enterprise. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list webapps](struct.WebappListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WebAppsListResponse { + /// The manifest describing a web app. + #[serde(rename="webApp")] + pub web_app: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#webAppsListResponse". + pub kind: Option, +} + +impl ResponseResult for WebAppsListResponse {} + + /// The store page resources for the enterprise. /// /// # Activities @@ -1772,14 +1914,20 @@ impl Part for TokenPagination {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AppVersion { - /// The track that this app was published in. For example if track is "alpha", this is an alpha version of the app. + /// Deprecated, use trackId instead. pub track: Option, - /// Unique increasing identifier for the app version. - #[serde(rename="versionCode")] - pub version_code: Option, + /// Track ids that the app version is published in. Replaces the track field (deprecated), but doesn't include the production track (see isProduction instead). + #[serde(rename="trackId")] + pub track_id: Option>, /// The string used in the Play store by the app developer to identify the version. The string is not necessarily unique or localized (for example, the string could be "1.4"). #[serde(rename="versionString")] pub version_string: Option, + /// True if this version is a production APK. + #[serde(rename="isProduction")] + pub is_production: Option, + /// Unique increasing identifier for the app version. + #[serde(rename="versionCode")] + pub version_code: Option, } impl Part for AppVersion {} @@ -2611,6 +2759,8 @@ impl<'a, C, A> UserMethods<'a, C, A> { /// /// Generates an authentication token which the device policy client can use to provision the given EMM-managed user account on a device. The generated token is single-use and expires after a few minutes. /// + /// You can provision a maximum of 10 devices per user. + /// /// This call only works with EMM-managed accounts. /// /// # Arguments @@ -2915,7 +3065,7 @@ impl<'a, C, A> InstallMethods<'a, C, A> { -/// A builder providing access to all methods supported on *grouplicense* resources. +/// A builder providing access to all methods supported on *webapp* resources. /// It is not used directly, but through the `AndroidEnterprise` hub. /// /// # Example @@ -2939,34 +3089,34 @@ impl<'a, C, A> InstallMethods<'a, C, A> { /// ::default(), None); /// let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)` and `list(...)` +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` /// // to build up your call. -/// let rb = hub.grouplicenses(); +/// let rb = hub.webapps(); /// # } /// ``` -pub struct GrouplicenseMethods<'a, C, A> +pub struct WebappMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a AndroidEnterprise, } -impl<'a, C, A> MethodsBuilder for GrouplicenseMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for WebappMethods<'a, C, A> {} -impl<'a, C, A> GrouplicenseMethods<'a, C, A> { +impl<'a, C, A> WebappMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves details of an enterprise's group license for a product. + /// Creates a new web app for the enterprise. /// /// # Arguments /// + /// * `request` - No description provided. /// * `enterpriseId` - The ID of the enterprise. - /// * `groupLicenseId` - The ID of the product the group license is for, e.g. "app:com.google.android.gm". - pub fn get(&self, enterprise_id: &str, group_license_id: &str) -> GrouplicenseGetCall<'a, C, A> { - GrouplicenseGetCall { + pub fn insert(&self, request: WebApp, enterprise_id: &str) -> WebappInsertCall<'a, C, A> { + WebappInsertCall { hub: self.hub, + _request: request, _enterprise_id: enterprise_id.to_string(), - _group_license_id: group_license_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2975,13 +3125,13 @@ impl<'a, C, A> GrouplicenseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves IDs of all products for which the enterprise has a group license. + /// Retrieves the details of all web apps for a given enterprise. /// /// # Arguments /// /// * `enterpriseId` - The ID of the enterprise. - pub fn list(&self, enterprise_id: &str) -> GrouplicenseListCall<'a, C, A> { - GrouplicenseListCall { + pub fn list(&self, enterprise_id: &str) -> WebappListCall<'a, C, A> { + WebappListCall { hub: self.hub, _enterprise_id: enterprise_id.to_string(), _delegate: Default::default(), @@ -2989,6 +3139,86 @@ impl<'a, C, A> GrouplicenseMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Gets an existing web app. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `webAppId` - The ID of the web app. + pub fn get(&self, enterprise_id: &str, web_app_id: &str) -> WebappGetCall<'a, C, A> { + WebappGetCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _web_app_id: web_app_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing web app. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `webAppId` - The ID of the web app. + pub fn delete(&self, enterprise_id: &str, web_app_id: &str) -> WebappDeleteCall<'a, C, A> { + WebappDeleteCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _web_app_id: web_app_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing web app. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + /// * `webAppId` - The ID of the web app. + pub fn patch(&self, request: WebApp, enterprise_id: &str, web_app_id: &str) -> WebappPatchCall<'a, C, A> { + WebappPatchCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _web_app_id: web_app_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing web app. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + /// * `webAppId` - The ID of the web app. + pub fn update(&self, request: WebApp, enterprise_id: &str, web_app_id: &str) -> WebappUpdateCall<'a, C, A> { + WebappUpdateCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _web_app_id: web_app_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -3152,6 +3382,84 @@ impl<'a, C, A> ManagedconfigurationsfordeviceMethods<'a, C, A> { +/// A builder providing access to all methods supported on *grouplicense* resources. +/// It is not used directly, but through the `AndroidEnterprise` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_androidenterprise1 as androidenterprise1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use androidenterprise1::AndroidEnterprise; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.grouplicenses(); +/// # } +/// ``` +pub struct GrouplicenseMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, +} + +impl<'a, C, A> MethodsBuilder for GrouplicenseMethods<'a, C, A> {} + +impl<'a, C, A> GrouplicenseMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves details of an enterprise's group license for a product. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `groupLicenseId` - The ID of the product the group license is for, e.g. "app:com.google.android.gm". + pub fn get(&self, enterprise_id: &str, group_license_id: &str) -> GrouplicenseGetCall<'a, C, A> { + GrouplicenseGetCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _group_license_id: group_license_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves IDs of all products for which the enterprise has a group license. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + pub fn list(&self, enterprise_id: &str) -> GrouplicenseListCall<'a, C, A> { + GrouplicenseListCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *device* resources. /// It is not used directly, but through the `AndroidEnterprise` hub. /// @@ -3350,7 +3658,7 @@ impl<'a, C, A> DeviceMethods<'a, C, A> { /// ::default(), None); /// let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `acknowledge_notification_set(...)`, `complete_signup(...)`, `create_web_token(...)`, `enroll(...)`, `generate_signup_url(...)`, `get(...)`, `get_android_device_policy_config(...)`, `get_service_account(...)`, `get_store_layout(...)`, `list(...)`, `pull_notification_set(...)`, `send_test_push_notification(...)`, `set_account(...)`, `set_android_device_policy_config(...)`, `set_store_layout(...)` and `unenroll(...)` +/// // like `acknowledge_notification_set(...)`, `complete_signup(...)`, `create_web_token(...)`, `enroll(...)`, `generate_signup_url(...)`, `get(...)`, `get_service_account(...)`, `get_store_layout(...)`, `list(...)`, `pull_notification_set(...)`, `send_test_push_notification(...)`, `set_account(...)`, `set_store_layout(...)` and `unenroll(...)` /// // to build up your call. /// let rb = hub.enterprises(); /// # } @@ -3465,23 +3773,6 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Deprecated and unused. - /// - /// # Arguments - /// - /// * `enterpriseId` - The ID of the enterprise. - pub fn get_android_device_policy_config(&self, enterprise_id: &str) -> EnterpriseGetAndroidDevicePolicyConfigCall<'a, C, A> { - EnterpriseGetAndroidDevicePolicyConfigCall { - hub: self.hub, - _enterprise_id: enterprise_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Sets the store layout for the enterprise. By default, storeLayoutType is set to "basic" and the basic store layout is enabled. The basic layout only contains apps approved by the admin, and that have been added to the available product set for a user (using the setAvailableProductSet call). Apps on the page are sorted in order of their product ID value. If you create a custom store layout (by setting storeLayoutType = "custom" and setting a homepage), the basic store layout is disabled. @@ -3515,25 +3806,6 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Deprecated and unused. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `enterpriseId` - The ID of the enterprise. - pub fn set_android_device_policy_config(&self, request: AndroidDevicePolicyConfig, enterprise_id: &str) -> EnterpriseSetAndroidDevicePolicyConfigCall<'a, C, A> { - EnterpriseSetAndroidDevicePolicyConfigCall { - hub: self.hub, - _request: request, - _enterprise_id: enterprise_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending. @@ -3727,27 +3999,6 @@ impl<'a, C, A> StorelayoutclusterMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Deletes a cluster. - /// - /// # Arguments - /// - /// * `enterpriseId` - The ID of the enterprise. - /// * `pageId` - The ID of the page. - /// * `clusterId` - The ID of the cluster. - pub fn delete(&self, enterprise_id: &str, page_id: &str, cluster_id: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { - StorelayoutclusterDeleteCall { - hub: self.hub, - _enterprise_id: enterprise_id.to_string(), - _page_id: page_id.to_string(), - _cluster_id: cluster_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Updates a cluster. @@ -3771,27 +4022,6 @@ impl<'a, C, A> StorelayoutclusterMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Retrieves details of a cluster. - /// - /// # Arguments - /// - /// * `enterpriseId` - The ID of the enterprise. - /// * `pageId` - The ID of the page. - /// * `clusterId` - The ID of the cluster. - pub fn get(&self, enterprise_id: &str, page_id: &str, cluster_id: &str) -> StorelayoutclusterGetCall<'a, C, A> { - StorelayoutclusterGetCall { - hub: self.hub, - _enterprise_id: enterprise_id.to_string(), - _page_id: page_id.to_string(), - _cluster_id: cluster_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Inserts a new cluster in a page. @@ -3812,6 +4042,48 @@ impl<'a, C, A> StorelayoutclusterMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a cluster. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + /// * `clusterId` - The ID of the cluster. + pub fn delete(&self, enterprise_id: &str, page_id: &str, cluster_id: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { + StorelayoutclusterDeleteCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _cluster_id: cluster_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves details of a cluster. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + /// * `clusterId` - The ID of the cluster. + pub fn get(&self, enterprise_id: &str, page_id: &str, cluster_id: &str) -> StorelayoutclusterGetCall<'a, C, A> { + StorelayoutclusterGetCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _cluster_id: cluster_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -3855,6 +4127,26 @@ impl<'a, C, A> MethodsBuilder for ProductMethods<'a, C, A> {} impl<'a, C, A> ProductMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Retrieves details of a product for display to an enterprise admin. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `productId` - The ID of the product, e.g. "app:com.google.android.gm". + pub fn get(&self, enterprise_id: &str, product_id: &str) -> ProductGetCall<'a, C, A> { + ProductGetCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _product_id: product_id.to_string(), + _language: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Retrieves the Android app permissions required by this app. @@ -3874,6 +4166,28 @@ impl<'a, C, A> ProductMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Generates a URL that can be rendered in an iframe to display the permissions (if any) of a product. An enterprise admin must view these permissions and accept them on behalf of their organization in order to approve that product. + /// + /// Admins should accept the displayed permissions by interacting with a separate UI element in the EMM console, which in turn should trigger the use of this URL as the approvalUrlInfo.approvalUrl property in a Products.approve call to approve the product. This URL can only be used to display permissions for up to 1 day. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `productId` - The ID of the product. + pub fn generate_approval_url(&self, enterprise_id: &str, product_id: &str) -> ProductGenerateApprovalUrlCall<'a, C, A> { + ProductGenerateApprovalUrlCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _product_id: product_id.to_string(), + _language_code: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Unapproves the specified product (and the relevant app permissions, if any) @@ -3893,26 +4207,6 @@ impl<'a, C, A> ProductMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Retrieves details of a product for display to an enterprise admin. - /// - /// # Arguments - /// - /// * `enterpriseId` - The ID of the enterprise. - /// * `productId` - The ID of the product, e.g. "app:com.google.android.gm". - pub fn get(&self, enterprise_id: &str, product_id: &str) -> ProductGetCall<'a, C, A> { - ProductGetCall { - hub: self.hub, - _enterprise_id: enterprise_id.to_string(), - _product_id: product_id.to_string(), - _language: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Approves the specified product and the relevant app permissions, if any. The maximum number of products that you can approve per enterprise customer is 1,000. @@ -3977,28 +4271,6 @@ impl<'a, C, A> ProductMethods<'a, C, A> { _additional_params: Default::default(), } } - - /// Create a builder to help you perform the following task: - /// - /// Generates a URL that can be rendered in an iframe to display the permissions (if any) of a product. An enterprise admin must view these permissions and accept them on behalf of their organization in order to approve that product. - /// - /// Admins should accept the displayed permissions by interacting with a separate UI element in the EMM console, which in turn should trigger the use of this URL as the approvalUrlInfo.approvalUrl property in a Products.approve call to approve the product. This URL can only be used to display permissions for up to 1 day. - /// - /// # Arguments - /// - /// * `enterpriseId` - The ID of the enterprise. - /// * `productId` - The ID of the product. - pub fn generate_approval_url(&self, enterprise_id: &str, product_id: &str) -> ProductGenerateApprovalUrlCall<'a, C, A> { - ProductGenerateApprovalUrlCall { - hub: self.hub, - _enterprise_id: enterprise_id.to_string(), - _product_id: product_id.to_string(), - _language_code: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } } @@ -4065,6 +4337,29 @@ impl<'a, C, A> ManagedconfigurationsforuserMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Adds or updates the managed configuration settings for an app for the specified user. If you support the Managed configurations iframe, you can apply managed configurations to a user by specifying an mcmId and its associated configuration variables (if any) in the request. Alternatively, all EMMs can apply managed configurations by passing a list of managed properties. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + /// * `userId` - The ID of the user. + /// * `managedConfigurationForUserId` - The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm". + pub fn update(&self, request: ManagedConfiguration, enterprise_id: &str, user_id: &str, managed_configuration_for_user_id: &str) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { + ManagedconfigurationsforuserUpdateCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _user_id: user_id.to_string(), + _managed_configuration_for_user_id: managed_configuration_for_user_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Removes a per-user managed configuration for an app for the specified user. @@ -4105,29 +4400,6 @@ impl<'a, C, A> ManagedconfigurationsforuserMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Adds or updates the managed configuration settings for an app for the specified user. If you support the Managed configurations iframe, you can apply managed configurations to a user by specifying an mcmId and its associated configuration variables (if any) in the request. Alternatively, all EMMs can apply managed configurations by passing a list of managed properties. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `enterpriseId` - The ID of the enterprise. - /// * `userId` - The ID of the user. - /// * `managedConfigurationForUserId` - The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm". - pub fn update(&self, request: ManagedConfiguration, enterprise_id: &str, user_id: &str, managed_configuration_for_user_id: &str) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { - ManagedconfigurationsforuserUpdateCall { - hub: self.hub, - _request: request, - _enterprise_id: enterprise_id.to_string(), - _user_id: user_id.to_string(), - _managed_configuration_for_user_id: managed_configuration_for_user_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Retrieves details of a per-user managed configuration for an app for the specified user. @@ -4252,46 +4524,6 @@ impl<'a, C, A> MethodsBuilder for EntitlementMethods<'a, C, A> {} impl<'a, C, A> EntitlementMethods<'a, C, A> { - /// Create a builder to help you perform the following task: - /// - /// Removes an entitlement to an app for a user. - /// - /// # Arguments - /// - /// * `enterpriseId` - The ID of the enterprise. - /// * `userId` - The ID of the user. - /// * `entitlementId` - The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm". - pub fn delete(&self, enterprise_id: &str, user_id: &str, entitlement_id: &str) -> EntitlementDeleteCall<'a, C, A> { - EntitlementDeleteCall { - hub: self.hub, - _enterprise_id: enterprise_id.to_string(), - _user_id: user_id.to_string(), - _entitlement_id: entitlement_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists all entitlements for the specified user. Only the ID is set. - /// - /// # Arguments - /// - /// * `enterpriseId` - The ID of the enterprise. - /// * `userId` - The ID of the user. - pub fn list(&self, enterprise_id: &str, user_id: &str) -> EntitlementListCall<'a, C, A> { - EntitlementListCall { - hub: self.hub, - _enterprise_id: enterprise_id.to_string(), - _user_id: user_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Adds or updates an entitlement to an app for a user. @@ -4337,6 +4569,46 @@ impl<'a, C, A> EntitlementMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Lists all entitlements for the specified user. Only the ID is set. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `userId` - The ID of the user. + pub fn list(&self, enterprise_id: &str, user_id: &str) -> EntitlementListCall<'a, C, A> { + EntitlementListCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _user_id: user_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Removes an entitlement to an app for a user. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `userId` - The ID of the user. + /// * `entitlementId` - The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm". + pub fn delete(&self, enterprise_id: &str, user_id: &str, entitlement_id: &str) -> EntitlementDeleteCall<'a, C, A> { + EntitlementDeleteCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _user_id: user_id.to_string(), + _entitlement_id: entitlement_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Adds or updates an entitlement to an app for a user. This method supports patch semantics. @@ -4629,10 +4901,7 @@ impl<'a, C, A> ManagedconfigurationssettingListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4652,7 +4921,7 @@ impl<'a, C, A> ManagedconfigurationssettingListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4740,7 +5009,7 @@ impl<'a, C, A> ManagedconfigurationssettingListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4882,10 +5151,7 @@ impl<'a, C, A> StorelayoutpageListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4905,7 +5171,7 @@ impl<'a, C, A> StorelayoutpageListCall<'a, C, A> where C: BorrowMut StorelayoutpageListCall<'a, C, A> where C: BorrowMut StorelayoutpageDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5149,7 +5412,7 @@ impl<'a, C, A> StorelayoutpageDeleteCall<'a, C, A> where C: BorrowMut StorelayoutpageDeleteCall<'a, C, A> where C: BorrowMut StorelayoutpageGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5394,7 +5654,7 @@ impl<'a, C, A> StorelayoutpageGetCall<'a, C, A> where C: BorrowMut StorelayoutpageGetCall<'a, C, A> where C: BorrowMut StorelayoutpageInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5666,7 +5923,7 @@ impl<'a, C, A> StorelayoutpageInsertCall<'a, C, A> where C: BorrowMut StorelayoutpageInsertCall<'a, C, A> where C: BorrowMut StorelayoutpagePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5942,7 +6196,7 @@ impl<'a, C, A> StorelayoutpagePatchCall<'a, C, A> where C: BorrowMut StorelayoutpagePatchCall<'a, C, A> where C: BorrowMut StorelayoutpageUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6228,7 +6479,7 @@ impl<'a, C, A> StorelayoutpageUpdateCall<'a, C, A> where C: BorrowMut StorelayoutpageUpdateCall<'a, C, A> where C: BorrowMut UserRevokeTokenCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6494,7 +6742,7 @@ impl<'a, C, A> UserRevokeTokenCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6572,7 +6820,7 @@ impl<'a, C, A> UserRevokeTokenCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6725,10 +6973,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6760,7 +7005,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6860,7 +7105,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7004,10 +7249,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7027,7 +7269,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7115,7 +7357,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7260,10 +7502,7 @@ impl<'a, C, A> UserRevokeDeviceAccesCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7283,7 +7522,7 @@ impl<'a, C, A> UserRevokeDeviceAccesCall<'a, C, A> where C: BorrowMut UserRevokeDeviceAccesCall<'a, C, A> where C: BorrowMut UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7527,7 +7763,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7605,7 +7841,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7651,6 +7887,8 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// Generates an authentication token which the device policy client can use to provision the given EMM-managed user account on a device. The generated token is single-use and expires after a few minutes. /// +/// You can provision a maximum of 10 devices per user. +/// /// This call only works with EMM-managed accounts. /// /// A builder for the *generateAuthenticationToken* method supported by a *user* resource. @@ -7751,10 +7989,7 @@ impl<'a, C, A> UserGenerateAuthenticationTokenCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7774,7 +8009,7 @@ impl<'a, C, A> UserGenerateAuthenticationTokenCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7862,7 +8097,7 @@ impl<'a, C, A> UserGenerateAuthenticationTokenCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8006,10 +8241,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8029,7 +8261,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8117,7 +8349,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8270,10 +8502,7 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8305,7 +8534,7 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8405,7 +8634,7 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8557,10 +8786,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8592,7 +8818,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8682,7 +8908,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8828,10 +9054,7 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8851,7 +9074,7 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8939,7 +9162,7 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9090,10 +9313,7 @@ impl<'a, C, A> UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9125,7 +9345,7 @@ impl<'a, C, A> UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9392,7 +9609,7 @@ impl<'a, C, A> UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut InstallPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9670,7 +9884,7 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9790,7 +10004,7 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9938,10 +10152,7 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9961,7 +10172,7 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10069,7 +10280,7 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10215,10 +10426,7 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10238,7 +10446,7 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10336,7 +10544,7 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10483,10 +10691,7 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10506,7 +10711,7 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10604,7 +10809,7 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10759,10 +10964,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10794,7 +10996,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10914,7 +11116,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10958,10 +11160,10 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: } -/// Retrieves details of an enterprise's group license for a product. +/// Creates a new web app for the enterprise. /// -/// A builder for the *get* method supported by a *grouplicense* resource. -/// It is not used directly, but through a `GrouplicenseMethods` instance. +/// A builder for the *insert* method supported by a *webapp* resource. +/// It is not used directly, but through a `WebappMethods` instance. /// /// # Example /// @@ -10972,6 +11174,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::WebApp; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -10982,31 +11185,36 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = WebApp::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.grouplicenses().get("enterpriseId", "groupLicenseId") +/// let result = hub.webapps().insert(req, "enterpriseId") /// .doit(); /// # } /// ``` -pub struct GrouplicenseGetCall<'a, C, A> +pub struct WebappInsertCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AndroidEnterprise, + _request: WebApp, _enterprise_id: String, - _group_license_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for GrouplicenseGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for WebappInsertCall<'a, C, A> {} -impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> WebappInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GroupLicense)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, WebApp)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -11014,264 +11222,10 @@ impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.grouplicenses.get", - http_method: hyper::method::Method::Get }); + dlg.begin(MethodInfo { id: "androidenterprise.webapps.insert", + http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("enterpriseId", self._enterprise_id.to_string())); - params.push(("groupLicenseId", self._group_license_id.to_string())); - for &field in ["alt", "enterpriseId", "groupLicenseId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/groupLicenses/{groupLicenseId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{groupLicenseId}", "groupLicenseId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["groupLicenseId", "enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> GrouplicenseGetCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The ID of the product the group license is for, e.g. "app:com.google.android.gm". - /// - /// Sets the *group license id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn group_license_id(mut self, new_value: &str) -> GrouplicenseGetCall<'a, C, A> { - self._group_license_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> GrouplicenseGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> GrouplicenseGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> GrouplicenseGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves IDs of all products for which the enterprise has a group license. -/// -/// A builder for the *list* method supported by a *grouplicense* resource. -/// It is not used directly, but through a `GrouplicenseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidenterprise1 as androidenterprise1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidenterprise1::AndroidEnterprise; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.grouplicenses().list("enterpriseId") -/// .doit(); -/// # } -/// ``` -pub struct GrouplicenseListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _enterprise_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for GrouplicenseListCall<'a, C, A> {} - -impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GroupLicensesListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.grouplicenses.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("enterpriseId", self._enterprise_id.to_string())); for &field in ["alt", "enterpriseId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); @@ -11284,7 +11238,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/groupLicenses"; + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/webApps"; if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } @@ -11311,10 +11265,271 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: WebApp) -> WebappInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> WebappInsertCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> WebappInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> WebappInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> WebappInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the details of all web apps for a given enterprise. +/// +/// A builder for the *list* method supported by a *webapp* resource. +/// It is not used directly, but through a `WebappMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.webapps().list("enterpriseId") +/// .doit(); +/// # } +/// ``` +pub struct WebappListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for WebappListCall<'a, C, A> {} + +impl<'a, C, A> WebappListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, WebAppsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.webapps.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + for &field in ["alt", "enterpriseId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/webApps"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11334,7 +11549,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11393,7 +11608,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> GrouplicenseListCall<'a, C, A> { + pub fn enterprise_id(mut self, new_value: &str) -> WebappListCall<'a, C, A> { self._enterprise_id = new_value.to_string(); self } @@ -11403,7 +11618,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> GrouplicenseListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> WebappListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -11412,7 +11627,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11424,7 +11639,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> GrouplicenseListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> WebappListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -11444,7 +11659,1066 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> GrouplicenseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> WebappListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets an existing web app. +/// +/// A builder for the *get* method supported by a *webapp* resource. +/// It is not used directly, but through a `WebappMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.webapps().get("enterpriseId", "webAppId") +/// .doit(); +/// # } +/// ``` +pub struct WebappGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _web_app_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for WebappGetCall<'a, C, A> {} + +impl<'a, C, A> WebappGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, WebApp)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.webapps.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("webAppId", self._web_app_id.to_string())); + for &field in ["alt", "enterpriseId", "webAppId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/webApps/{webAppId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{webAppId}", "webAppId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["webAppId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> WebappGetCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the web app. + /// + /// Sets the *web app id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn web_app_id(mut self, new_value: &str) -> WebappGetCall<'a, C, A> { + self._web_app_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> WebappGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> WebappGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> WebappGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an existing web app. +/// +/// A builder for the *delete* method supported by a *webapp* resource. +/// It is not used directly, but through a `WebappMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.webapps().delete("enterpriseId", "webAppId") +/// .doit(); +/// # } +/// ``` +pub struct WebappDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _web_app_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for WebappDeleteCall<'a, C, A> {} + +impl<'a, C, A> WebappDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.webapps.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("webAppId", self._web_app_id.to_string())); + for &field in ["enterpriseId", "webAppId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/webApps/{webAppId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{webAppId}", "webAppId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["webAppId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> WebappDeleteCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the web app. + /// + /// Sets the *web app id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn web_app_id(mut self, new_value: &str) -> WebappDeleteCall<'a, C, A> { + self._web_app_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> WebappDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> WebappDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> WebappDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing web app. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *webapp* resource. +/// It is not used directly, but through a `WebappMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::WebApp; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = WebApp::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.webapps().patch(req, "enterpriseId", "webAppId") +/// .doit(); +/// # } +/// ``` +pub struct WebappPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: WebApp, + _enterprise_id: String, + _web_app_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for WebappPatchCall<'a, C, A> {} + +impl<'a, C, A> WebappPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, WebApp)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.webapps.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("webAppId", self._web_app_id.to_string())); + for &field in ["alt", "enterpriseId", "webAppId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/webApps/{webAppId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{webAppId}", "webAppId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["webAppId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: WebApp) -> WebappPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> WebappPatchCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the web app. + /// + /// Sets the *web app id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn web_app_id(mut self, new_value: &str) -> WebappPatchCall<'a, C, A> { + self._web_app_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> WebappPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> WebappPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> WebappPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing web app. +/// +/// A builder for the *update* method supported by a *webapp* resource. +/// It is not used directly, but through a `WebappMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::WebApp; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = WebApp::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.webapps().update(req, "enterpriseId", "webAppId") +/// .doit(); +/// # } +/// ``` +pub struct WebappUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: WebApp, + _enterprise_id: String, + _web_app_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for WebappUpdateCall<'a, C, A> {} + +impl<'a, C, A> WebappUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, WebApp)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.webapps.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("webAppId", self._web_app_id.to_string())); + for &field in ["alt", "enterpriseId", "webAppId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/webApps/{webAppId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{webAppId}", "webAppId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["webAppId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: WebApp) -> WebappUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> WebappUpdateCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the web app. + /// + /// Sets the *web app id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn web_app_id(mut self, new_value: &str) -> WebappUpdateCall<'a, C, A> { + self._web_app_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> WebappUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> WebappUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> WebappUpdateCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -11559,10 +12833,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceDeleteCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11582,7 +12853,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceDeleteCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11680,7 +12951,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceDeleteCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11826,10 +13097,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceListCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11849,7 +13117,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceListCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11947,7 +13215,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceListCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12102,10 +13370,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceUpdateCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12137,7 +13402,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceUpdateCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12257,7 +13522,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceUpdateCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12405,10 +13670,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceGetCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12428,7 +13690,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceGetCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12536,7 +13798,7 @@ impl<'a, C, A> ManagedconfigurationsfordeviceGetCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12691,10 +13953,7 @@ impl<'a, C, A> ManagedconfigurationsfordevicePatchCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12726,7 +13985,7 @@ impl<'a, C, A> ManagedconfigurationsfordevicePatchCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12846,7 +14105,7 @@ impl<'a, C, A> ManagedconfigurationsfordevicePatchCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12890,6 +14149,498 @@ impl<'a, C, A> ManagedconfigurationsfordevicePatchCall<'a, C, A> where C: Borrow } +/// Retrieves details of an enterprise's group license for a product. +/// +/// A builder for the *get* method supported by a *grouplicense* resource. +/// It is not used directly, but through a `GrouplicenseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.grouplicenses().get("enterpriseId", "groupLicenseId") +/// .doit(); +/// # } +/// ``` +pub struct GrouplicenseGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _group_license_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GrouplicenseGetCall<'a, C, A> {} + +impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GroupLicense)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.grouplicenses.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("groupLicenseId", self._group_license_id.to_string())); + for &field in ["alt", "enterpriseId", "groupLicenseId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/groupLicenses/{groupLicenseId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{groupLicenseId}", "groupLicenseId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["groupLicenseId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> GrouplicenseGetCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the product the group license is for, e.g. "app:com.google.android.gm". + /// + /// Sets the *group license id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn group_license_id(mut self, new_value: &str) -> GrouplicenseGetCall<'a, C, A> { + self._group_license_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GrouplicenseGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> GrouplicenseGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GrouplicenseGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves IDs of all products for which the enterprise has a group license. +/// +/// A builder for the *list* method supported by a *grouplicense* resource. +/// It is not used directly, but through a `GrouplicenseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.grouplicenses().list("enterpriseId") +/// .doit(); +/// # } +/// ``` +pub struct GrouplicenseListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GrouplicenseListCall<'a, C, A> {} + +impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GroupLicensesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.grouplicenses.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + for &field in ["alt", "enterpriseId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/groupLicenses"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> GrouplicenseListCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GrouplicenseListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> GrouplicenseListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GrouplicenseListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Sets whether a device's access to Google services is enabled or disabled. The device state takes effect only if enforcing EMM policies on Android devices is enabled in the Google Admin Console. Otherwise, the device state is ignored and all devices are allowed access to Google services. This is only supported for Google-managed users. /// /// A builder for the *setState* method supported by a *device* resource. @@ -12999,10 +14750,7 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13034,7 +14782,7 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13144,7 +14892,7 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13290,10 +15038,7 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13313,7 +15058,7 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13411,7 +15156,7 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13555,10 +15300,7 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13578,7 +15320,7 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13666,7 +15408,7 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13812,10 +15554,7 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13835,7 +15574,7 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13933,7 +15672,7 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14011,7 +15750,7 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.devices().update(req, "enterpriseId", "userId", "deviceId") -/// .update_mask("At") +/// .update_mask("labore") /// .doit(); /// # } /// ``` @@ -14091,10 +15830,7 @@ impl<'a, C, A> DeviceUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14126,7 +15862,7 @@ impl<'a, C, A> DeviceUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14245,7 +15981,7 @@ impl<'a, C, A> DeviceUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14323,7 +16059,7 @@ impl<'a, C, A> DeviceUpdateCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.devices().patch(req, "enterpriseId", "userId", "deviceId") -/// .update_mask("sadipscing") +/// .update_mask("aliquyam") /// .doit(); /// # } /// ``` @@ -14403,10 +16139,7 @@ impl<'a, C, A> DevicePatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14438,7 +16171,7 @@ impl<'a, C, A> DevicePatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14557,7 +16290,7 @@ impl<'a, C, A> DevicePatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14629,7 +16362,7 @@ impl<'a, C, A> DevicePatchCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.enterprises().acknowledge_notification_set() -/// .notification_set_id("rebum.") +/// .notification_set_id("eos") /// .doit(); /// # } /// ``` @@ -14680,10 +16413,7 @@ impl<'a, C, A> EnterpriseAcknowledgeNotificationSetCall<'a, C, A> where C: Borro } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14703,7 +16433,7 @@ impl<'a, C, A> EnterpriseAcknowledgeNotificationSetCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14768,7 +16498,7 @@ impl<'a, C, A> EnterpriseAcknowledgeNotificationSetCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14909,10 +16639,7 @@ impl<'a, C, A> EnterpriseUnenrollCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14932,7 +16659,7 @@ impl<'a, C, A> EnterpriseUnenrollCall<'a, C, A> where C: BorrowMut EnterpriseUnenrollCall<'a, C, A> where C: BorrowMut EnterpriseCreateWebTokenCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15184,7 +16908,7 @@ impl<'a, C, A> EnterpriseCreateWebTokenCall<'a, C, A> where C: BorrowMut EnterpriseCreateWebTokenCall<'a, C, A> where C: BorrowMut EnterpriseSendTestPushNotificationCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15439,7 +17160,7 @@ impl<'a, C, A> EnterpriseSendTestPushNotificationCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15517,7 +17238,7 @@ impl<'a, C, A> EnterpriseSendTestPushNotificationCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15638,10 +17359,7 @@ impl<'a, C, A> EnterpriseListCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15661,7 +17379,7 @@ impl<'a, C, A> EnterpriseListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15739,7 +17457,7 @@ impl<'a, C, A> EnterpriseListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15881,10 +17599,7 @@ impl<'a, C, A> EnterpriseGetStoreLayoutCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15904,7 +17619,7 @@ impl<'a, C, A> EnterpriseGetStoreLayoutCall<'a, C, A> where C: BorrowMut EnterpriseGetStoreLayoutCall<'a, C, A> where C: BorrowMut EnterpriseGetStoreLayoutCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().get_android_device_policy_config("enterpriseId") -/// .doit(); -/// # } -/// ``` -pub struct EnterpriseGetAndroidDevicePolicyConfigCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _enterprise_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EnterpriseGetAndroidDevicePolicyConfigCall<'a, C, A> {} - -impl<'a, C, A> EnterpriseGetAndroidDevicePolicyConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AndroidDevicePolicyConfig)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.enterprises.getAndroidDevicePolicyConfig", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("enterpriseId", self._enterprise_id.to_string())); - for &field in ["alt", "enterpriseId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/androidDevicePolicyConfig"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseGetAndroidDevicePolicyConfigCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseGetAndroidDevicePolicyConfigCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> EnterpriseGetAndroidDevicePolicyConfigCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EnterpriseGetAndroidDevicePolicyConfigCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Sets the store layout for the enterprise. By default, storeLayoutType is set to "basic" and the basic store layout is enabled. The basic layout only contains apps approved by the admin, and that have been added to the available product set for a user (using the setAvailableProductSet call). Apps on the page are sorted in order of their product ID value. If you create a custom store layout (by setting storeLayoutType = "custom" and setting a homepage), the basic store layout is disabled. /// /// A builder for the *setStoreLayout* method supported by a *enterprise* resource. @@ -16374,10 +17846,7 @@ impl<'a, C, A> EnterpriseSetStoreLayoutCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16409,7 +17878,7 @@ impl<'a, C, A> EnterpriseSetStoreLayoutCall<'a, C, A> where C: BorrowMut EnterpriseSetStoreLayoutCall<'a, C, A> where C: BorrowMut EnterpriseSetStoreLayoutCall<'a, C, A> where C: BorrowMut EnterpriseCompleteSignupCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16651,7 +18117,7 @@ impl<'a, C, A> EnterpriseCompleteSignupCall<'a, C, A> where C: BorrowMut EnterpriseCompleteSignupCall<'a, C, A> where C: BorrowMut EnterpriseCompleteSignupCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = AndroidDevicePolicyConfig::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().set_android_device_policy_config(req, "enterpriseId") -/// .doit(); -/// # } -/// ``` -pub struct EnterpriseSetAndroidDevicePolicyConfigCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _request: AndroidDevicePolicyConfig, - _enterprise_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EnterpriseSetAndroidDevicePolicyConfigCall<'a, C, A> {} - -impl<'a, C, A> EnterpriseSetAndroidDevicePolicyConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AndroidDevicePolicyConfig)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.enterprises.setAndroidDevicePolicyConfig", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("enterpriseId", self._enterprise_id.to_string())); - for &field in ["alt", "enterpriseId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/androidDevicePolicyConfig"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: AndroidDevicePolicyConfig) -> EnterpriseSetAndroidDevicePolicyConfigCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseSetAndroidDevicePolicyConfigCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseSetAndroidDevicePolicyConfigCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> EnterpriseSetAndroidDevicePolicyConfigCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EnterpriseSetAndroidDevicePolicyConfigCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Pulls and returns a notification set for the enterprises associated with the service account authenticated for the request. The notification set may be empty if no notification are pending. /// A notification set returned needs to be acknowledged within 20 seconds by calling Enterprises.AcknowledgeNotificationSet, unless the notification set is empty. /// Notifications that are not acknowledged within the 20 seconds will eventually be included again in the response to another PullNotificationSet request, and those that are never acknowledged will ultimately be deleted according to the Google Cloud Platform Pub/Sub system policy. @@ -17083,7 +18275,7 @@ impl<'a, C, A> EnterpriseSetAndroidDevicePolicyConfigCall<'a, C, A> where C: Bor /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.enterprises().pull_notification_set() -/// .request_mode("gubergren") +/// .request_mode("ut") /// .doit(); /// # } /// ``` @@ -17135,10 +18327,7 @@ impl<'a, C, A> EnterprisePullNotificationSetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17158,7 +18347,7 @@ impl<'a, C, A> EnterprisePullNotificationSetCall<'a, C, A> where C: BorrowMut EnterprisePullNotificationSetCall<'a, C, A> where C: BorrowMut EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17399,7 +18585,7 @@ impl<'a, C, A> EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17489,7 +18675,7 @@ impl<'a, C, A> EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17631,10 +18817,7 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17654,7 +18837,7 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17732,7 +18915,7 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17810,7 +18993,7 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.enterprises().get_service_account("enterpriseId") -/// .key_type("sea") +/// .key_type("accusam") /// .doit(); /// # } /// ``` @@ -17885,10 +19068,7 @@ impl<'a, C, A> EnterpriseGetServiceAccountCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17908,7 +19088,7 @@ impl<'a, C, A> EnterpriseGetServiceAccountCall<'a, C, A> where C: BorrowMut EnterpriseGetServiceAccountCall<'a, C, A> where C: BorrowMut EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18177,7 +19354,7 @@ impl<'a, C, A> EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut EnterpriseGenerateSignupUrlCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18414,7 +19588,7 @@ impl<'a, C, A> EnterpriseGenerateSignupUrlCall<'a, C, A> where C: BorrowMut EnterpriseGenerateSignupUrlCall<'a, C, A> where C: BorrowMut StorelayoutclusterPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18678,7 +19849,7 @@ impl<'a, C, A> StorelayoutclusterPatchCall<'a, C, A> where C: BorrowMut StorelayoutclusterPatchCall<'a, C, A> where C: BorrowMut StorelayoutclusterListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18955,7 +20123,7 @@ impl<'a, C, A> StorelayoutclusterListCall<'a, C, A> where C: BorrowMut StorelayoutclusterListCall<'a, C, A> where C: BorrowMut StorelayoutclusterListCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.storelayoutclusters().delete("enterpriseId", "pageId", "clusterId") -/// .doit(); -/// # } -/// ``` -pub struct StorelayoutclusterDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _enterprise_id: String, - _page_id: String, - _cluster_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for StorelayoutclusterDeleteCall<'a, C, A> {} - -impl<'a, C, A> StorelayoutclusterDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.storelayoutclusters.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("enterpriseId", self._enterprise_id.to_string())); - params.push(("pageId", self._page_id.to_string())); - params.push(("clusterId", self._cluster_id.to_string())); - for &field in ["enterpriseId", "pageId", "clusterId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId"), ("{clusterId}", "clusterId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["clusterId", "pageId", "enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The ID of the page. - /// - /// Sets the *page id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { - self._page_id = new_value.to_string(); - self - } - /// The ID of the cluster. - /// - /// Sets the *cluster id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { - self._cluster_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> StorelayoutclusterDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> StorelayoutclusterDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> StorelayoutclusterDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Updates a cluster. /// /// A builder for the *update* method supported by a *storelayoutcluster* resource. @@ -19452,10 +20364,7 @@ impl<'a, C, A> StorelayoutclusterUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19487,7 +20396,7 @@ impl<'a, C, A> StorelayoutclusterUpdateCall<'a, C, A> where C: BorrowMut StorelayoutclusterUpdateCall<'a, C, A> where C: BorrowMut StorelayoutclusterUpdateCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.storelayoutclusters().get("enterpriseId", "pageId", "clusterId") -/// .doit(); -/// # } -/// ``` -pub struct StorelayoutclusterGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _enterprise_id: String, - _page_id: String, - _cluster_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for StorelayoutclusterGetCall<'a, C, A> {} - -impl<'a, C, A> StorelayoutclusterGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, StoreCluster)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.storelayoutclusters.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("enterpriseId", self._enterprise_id.to_string())); - params.push(("pageId", self._page_id.to_string())); - params.push(("clusterId", self._cluster_id.to_string())); - for &field in ["alt", "enterpriseId", "pageId", "clusterId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId"), ("{clusterId}", "clusterId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["clusterId", "pageId", "enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The ID of the page. - /// - /// Sets the *page id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C, A> { - self._page_id = new_value.to_string(); - self - } - /// The ID of the cluster. - /// - /// Sets the *cluster id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C, A> { - self._cluster_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> StorelayoutclusterGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> StorelayoutclusterGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> StorelayoutclusterGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Inserts a new cluster in a page. /// /// A builder for the *insert* method supported by a *storelayoutcluster* resource. @@ -20015,10 +20657,7 @@ impl<'a, C, A> StorelayoutclusterInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20050,7 +20689,7 @@ impl<'a, C, A> StorelayoutclusterInsertCall<'a, C, A> where C: BorrowMut StorelayoutclusterInsertCall<'a, C, A> where C: BorrowMut StorelayoutclusterInsertCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.storelayoutclusters().delete("enterpriseId", "pageId", "clusterId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutclusterDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _page_id: String, + _cluster_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutclusterDeleteCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutclusterDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutclusters.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + params.push(("clusterId", self._cluster_id.to_string())); + for &field in ["enterpriseId", "pageId", "clusterId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId"), ("{clusterId}", "clusterId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["clusterId", "pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The ID of the cluster. + /// + /// Sets the *cluster id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { + self._cluster_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> StorelayoutclusterDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutclusterDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> StorelayoutclusterDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves details of a cluster. +/// +/// A builder for the *get* method supported by a *storelayoutcluster* resource. +/// It is not used directly, but through a `StorelayoutclusterMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.storelayoutclusters().get("enterpriseId", "pageId", "clusterId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutclusterGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _page_id: String, + _cluster_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutclusterGetCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutclusterGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StoreCluster)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutclusters.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + params.push(("clusterId", self._cluster_id.to_string())); + for &field in ["alt", "enterpriseId", "pageId", "clusterId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId"), ("{clusterId}", "clusterId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["clusterId", "pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The ID of the cluster. + /// + /// Sets the *cluster id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C, A> { + self._cluster_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> StorelayoutclusterGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutclusterGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> StorelayoutclusterGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves details of a product for display to an enterprise admin. +/// +/// A builder for the *get* method supported by a *product* resource. +/// It is not used directly, but through a `ProductMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.products().get("enterpriseId", "productId") +/// .language("rebum.") +/// .doit(); +/// # } +/// ``` +pub struct ProductGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _product_id: String, + _language: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProductGetCall<'a, C, A> {} + +impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Product)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.products.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("productId", self._product_id.to_string())); + if let Some(value) = self._language { + params.push(("language", value.to_string())); + } + for &field in ["alt", "enterpriseId", "productId", "language"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/products/{productId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{productId}", "productId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["productId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the product, e.g. "app:com.google.android.gm". + /// + /// Sets the *product id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn product_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { + self._product_id = new_value.to_string(); + self + } + /// The BCP47 tag for the user's preferred language (e.g. "en-US", "de"). + /// + /// Sets the *language* query property to the given value. + pub fn language(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { + self._language = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProductGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProductGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProductGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves the Android app permissions required by this app. /// /// A builder for the *getPermissions* method supported by a *product* resource. @@ -20294,10 +21714,7 @@ impl<'a, C, A> ProductGetPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20317,7 +21734,7 @@ impl<'a, C, A> ProductGetPermissionCall<'a, C, A> where C: BorrowMut ProductGetPermissionCall<'a, C, A> where C: BorrowMut ProductGetPermissionCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.products().generate_approval_url("enterpriseId", "productId") +/// .language_code("At") +/// .doit(); +/// # } +/// ``` +pub struct ProductGenerateApprovalUrlCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _product_id: String, + _language_code: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProductGenerateApprovalUrlCall<'a, C, A> {} + +impl<'a, C, A> ProductGenerateApprovalUrlCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ProductsGenerateApprovalUrlResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.products.generateApprovalUrl", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("productId", self._product_id.to_string())); + if let Some(value) = self._language_code { + params.push(("languageCode", value.to_string())); + } + for &field in ["alt", "enterpriseId", "productId", "languageCode"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/products/{productId}/generateApprovalUrl"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{productId}", "productId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["productId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> ProductGenerateApprovalUrlCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the product. + /// + /// Sets the *product id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn product_id(mut self, new_value: &str) -> ProductGenerateApprovalUrlCall<'a, C, A> { + self._product_id = new_value.to_string(); + self + } + /// The BCP 47 language code used for permission names and descriptions in the returned iframe, for instance "en-US". + /// + /// Sets the *language code* query property to the given value. + pub fn language_code(mut self, new_value: &str) -> ProductGenerateApprovalUrlCall<'a, C, A> { + self._language_code = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProductGenerateApprovalUrlCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProductGenerateApprovalUrlCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProductGenerateApprovalUrlCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Unapproves the specified product (and the relevant app permissions, if any) /// /// A builder for the *unapprove* method supported by a *product* resource. @@ -20548,10 +22231,7 @@ impl<'a, C, A> ProductUnapproveCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20571,7 +22251,7 @@ impl<'a, C, A> ProductUnapproveCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20649,7 +22329,7 @@ impl<'a, C, A> ProductUnapproveCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20693,273 +22373,6 @@ impl<'a, C, A> ProductUnapproveCall<'a, C, A> where C: BorrowMut, } -/// Retrieves details of a product for display to an enterprise admin. -/// -/// A builder for the *get* method supported by a *product* resource. -/// It is not used directly, but through a `ProductMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidenterprise1 as androidenterprise1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidenterprise1::AndroidEnterprise; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.products().get("enterpriseId", "productId") -/// .language("ea") -/// .doit(); -/// # } -/// ``` -pub struct ProductGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _enterprise_id: String, - _product_id: String, - _language: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProductGetCall<'a, C, A> {} - -impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Product)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.products.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("enterpriseId", self._enterprise_id.to_string())); - params.push(("productId", self._product_id.to_string())); - if let Some(value) = self._language { - params.push(("language", value.to_string())); - } - for &field in ["alt", "enterpriseId", "productId", "language"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/products/{productId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{productId}", "productId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["productId", "enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The ID of the product, e.g. "app:com.google.android.gm". - /// - /// Sets the *product id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn product_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { - self._product_id = new_value.to_string(); - self - } - /// The BCP47 tag for the user's preferred language (e.g. "en-US", "de"). - /// - /// Sets the *language* query property to the given value. - pub fn language(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { - self._language = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProductGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ProductGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProductGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Approves the specified product and the relevant app permissions, if any. The maximum number of products that you can approve per enterprise customer is 1,000. /// /// To learn how to use managed Google Play to design and create a store layout to display approved products to your users, see Store Layout Design. @@ -21068,10 +22481,7 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21103,7 +22513,7 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21193,7 +22603,7 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21265,7 +22675,7 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.products().get_app_restrictions_schema("enterpriseId", "productId") -/// .language("kasd") +/// .language("nonumy") /// .doit(); /// # } /// ``` @@ -21342,10 +22752,7 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21365,7 +22772,7 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21460,7 +22867,7 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21532,11 +22939,11 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.products().list("enterpriseId") -/// .token("rebum.") +/// .token("Lorem") /// .query("Lorem") -/// .max_results(38) -/// .language("invidunt") -/// .approved(false) +/// .max_results(59) +/// .language("ut") +/// .approved(true) /// .doit(); /// # } /// ``` @@ -21627,10 +23034,7 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21650,7 +23054,7 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21713,7 +23117,7 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o self._enterprise_id = new_value.to_string(); self } - /// A pagination token is contained in a request''s response when there are more products. The token can be used in a subsequent request to obtain more products, and so forth. This parameter cannot be used in the initial request. + /// A pagination token is contained in a request's response when there are more products. The token can be used in a subsequent request to obtain more products, and so forth. This parameter cannot be used in the initial request. /// /// Sets the *token* query property to the given value. pub fn token(mut self, new_value: &str) -> ProductListCall<'a, C, A> { @@ -21763,7 +23167,7 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21807,275 +23211,6 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o } -/// Generates a URL that can be rendered in an iframe to display the permissions (if any) of a product. An enterprise admin must view these permissions and accept them on behalf of their organization in order to approve that product. -/// -/// Admins should accept the displayed permissions by interacting with a separate UI element in the EMM console, which in turn should trigger the use of this URL as the approvalUrlInfo.approvalUrl property in a Products.approve call to approve the product. This URL can only be used to display permissions for up to 1 day. -/// -/// A builder for the *generateApprovalUrl* method supported by a *product* resource. -/// It is not used directly, but through a `ProductMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidenterprise1 as androidenterprise1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidenterprise1::AndroidEnterprise; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.products().generate_approval_url("enterpriseId", "productId") -/// .language_code("et") -/// .doit(); -/// # } -/// ``` -pub struct ProductGenerateApprovalUrlCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _enterprise_id: String, - _product_id: String, - _language_code: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProductGenerateApprovalUrlCall<'a, C, A> {} - -impl<'a, C, A> ProductGenerateApprovalUrlCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ProductsGenerateApprovalUrlResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.products.generateApprovalUrl", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("enterpriseId", self._enterprise_id.to_string())); - params.push(("productId", self._product_id.to_string())); - if let Some(value) = self._language_code { - params.push(("languageCode", value.to_string())); - } - for &field in ["alt", "enterpriseId", "productId", "languageCode"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/products/{productId}/generateApprovalUrl"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{productId}", "productId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["productId", "enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> ProductGenerateApprovalUrlCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The ID of the product. - /// - /// Sets the *product id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn product_id(mut self, new_value: &str) -> ProductGenerateApprovalUrlCall<'a, C, A> { - self._product_id = new_value.to_string(); - self - } - /// The BCP 47 language code used for permission names and descriptions in the returned iframe, for instance "en-US". - /// - /// Sets the *language code* query property to the given value. - pub fn language_code(mut self, new_value: &str) -> ProductGenerateApprovalUrlCall<'a, C, A> { - self._language_code = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProductGenerateApprovalUrlCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ProductGenerateApprovalUrlCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProductGenerateApprovalUrlCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Adds or updates the managed configuration settings for an app for the specified user. If you support the Managed configurations iframe, you can apply managed configurations to a user by specifying an mcmId and its associated configuration variables (if any) in the request. Alternatively, all EMMs can apply managed configurations by passing a list of managed properties. This method supports patch semantics. /// /// A builder for the *patch* method supported by a *managedconfigurationsforuser* resource. @@ -22185,10 +23320,7 @@ impl<'a, C, A> ManagedconfigurationsforuserPatchCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22220,7 +23352,7 @@ impl<'a, C, A> ManagedconfigurationsforuserPatchCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -22330,7 +23462,7 @@ impl<'a, C, A> ManagedconfigurationsforuserPatchCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22374,6 +23506,301 @@ impl<'a, C, A> ManagedconfigurationsforuserPatchCall<'a, C, A> where C: BorrowMu } +/// Adds or updates the managed configuration settings for an app for the specified user. If you support the Managed configurations iframe, you can apply managed configurations to a user by specifying an mcmId and its associated configuration variables (if any) in the request. Alternatively, all EMMs can apply managed configurations by passing a list of managed properties. +/// +/// A builder for the *update* method supported by a *managedconfigurationsforuser* resource. +/// It is not used directly, but through a `ManagedconfigurationsforuserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::ManagedConfiguration; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ManagedConfiguration::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.managedconfigurationsforuser().update(req, "enterpriseId", "userId", "managedConfigurationForUserId") +/// .doit(); +/// # } +/// ``` +pub struct ManagedconfigurationsforuserUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: ManagedConfiguration, + _enterprise_id: String, + _user_id: String, + _managed_configuration_for_user_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ManagedconfigurationsforuserUpdateCall<'a, C, A> {} + +impl<'a, C, A> ManagedconfigurationsforuserUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ManagedConfiguration)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.managedconfigurationsforuser.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("userId", self._user_id.to_string())); + params.push(("managedConfigurationForUserId", self._managed_configuration_for_user_id.to_string())); + for &field in ["alt", "enterpriseId", "userId", "managedConfigurationForUserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser/{managedConfigurationForUserId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId"), ("{managedConfigurationForUserId}", "managedConfigurationForUserId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["managedConfigurationForUserId", "userId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ManagedConfiguration) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the user. + /// + /// Sets the *user id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_id(mut self, new_value: &str) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { + self._user_id = new_value.to_string(); + self + } + /// The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm". + /// + /// Sets the *managed configuration for user id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn managed_configuration_for_user_id(mut self, new_value: &str) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { + self._managed_configuration_for_user_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Removes a per-user managed configuration for an app for the specified user. /// /// A builder for the *delete* method supported by a *managedconfigurationsforuser* resource. @@ -22475,10 +23902,7 @@ impl<'a, C, A> ManagedconfigurationsforuserDeleteCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22498,7 +23922,7 @@ impl<'a, C, A> ManagedconfigurationsforuserDeleteCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22586,7 +24010,7 @@ impl<'a, C, A> ManagedconfigurationsforuserDeleteCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22730,10 +24154,7 @@ impl<'a, C, A> ManagedconfigurationsforuserListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22753,7 +24174,7 @@ impl<'a, C, A> ManagedconfigurationsforuserListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22841,7 +24262,7 @@ impl<'a, C, A> ManagedconfigurationsforuserListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22885,304 +24306,6 @@ impl<'a, C, A> ManagedconfigurationsforuserListCall<'a, C, A> where C: BorrowMut } -/// Adds or updates the managed configuration settings for an app for the specified user. If you support the Managed configurations iframe, you can apply managed configurations to a user by specifying an mcmId and its associated configuration variables (if any) in the request. Alternatively, all EMMs can apply managed configurations by passing a list of managed properties. -/// -/// A builder for the *update* method supported by a *managedconfigurationsforuser* resource. -/// It is not used directly, but through a `ManagedconfigurationsforuserMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidenterprise1 as androidenterprise1; -/// use androidenterprise1::ManagedConfiguration; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidenterprise1::AndroidEnterprise; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ManagedConfiguration::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.managedconfigurationsforuser().update(req, "enterpriseId", "userId", "managedConfigurationForUserId") -/// .doit(); -/// # } -/// ``` -pub struct ManagedconfigurationsforuserUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _request: ManagedConfiguration, - _enterprise_id: String, - _user_id: String, - _managed_configuration_for_user_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ManagedconfigurationsforuserUpdateCall<'a, C, A> {} - -impl<'a, C, A> ManagedconfigurationsforuserUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ManagedConfiguration)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.managedconfigurationsforuser.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("enterpriseId", self._enterprise_id.to_string())); - params.push(("userId", self._user_id.to_string())); - params.push(("managedConfigurationForUserId", self._managed_configuration_for_user_id.to_string())); - for &field in ["alt", "enterpriseId", "userId", "managedConfigurationForUserId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/users/{userId}/managedConfigurationsForUser/{managedConfigurationForUserId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId"), ("{managedConfigurationForUserId}", "managedConfigurationForUserId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["managedConfigurationForUserId", "userId", "enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ManagedConfiguration) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The ID of the user. - /// - /// Sets the *user id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_id(mut self, new_value: &str) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { - self._user_id = new_value.to_string(); - self - } - /// The ID of the managed configuration (a product ID), e.g. "app:com.google.android.gm". - /// - /// Sets the *managed configuration for user id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn managed_configuration_for_user_id(mut self, new_value: &str) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { - self._managed_configuration_for_user_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ManagedconfigurationsforuserUpdateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Retrieves details of a per-user managed configuration for an app for the specified user. /// /// A builder for the *get* method supported by a *managedconfigurationsforuser* resource. @@ -23285,10 +24408,7 @@ impl<'a, C, A> ManagedconfigurationsforuserGetCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23308,7 +24428,7 @@ impl<'a, C, A> ManagedconfigurationsforuserGetCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23406,7 +24526,7 @@ impl<'a, C, A> ManagedconfigurationsforuserGetCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23550,10 +24670,7 @@ impl<'a, C, A> GrouplicenseuserListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23573,7 +24690,7 @@ impl<'a, C, A> GrouplicenseuserListCall<'a, C, A> where C: BorrowMut GrouplicenseuserListCall<'a, C, A> where C: BorrowMut GrouplicenseuserListCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.entitlements().delete("enterpriseId", "userId", "entitlementId") -/// .doit(); -/// # } -/// ``` -pub struct EntitlementDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _enterprise_id: String, - _user_id: String, - _entitlement_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EntitlementDeleteCall<'a, C, A> {} - -impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.entitlements.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("enterpriseId", self._enterprise_id.to_string())); - params.push(("userId", self._user_id.to_string())); - params.push(("entitlementId", self._entitlement_id.to_string())); - for &field in ["enterpriseId", "userId", "entitlementId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/users/{userId}/entitlements/{entitlementId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId"), ("{entitlementId}", "entitlementId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["entitlementId", "userId", "enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The ID of the user. - /// - /// Sets the *user id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C, A> { - self._user_id = new_value.to_string(); - self - } - /// The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm". - /// - /// Sets the *entitlement id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn entitlement_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C, A> { - self._entitlement_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EntitlementDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> EntitlementDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EntitlementDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists all entitlements for the specified user. Only the ID is set. -/// -/// A builder for the *list* method supported by a *entitlement* resource. -/// It is not used directly, but through a `EntitlementMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidenterprise1 as androidenterprise1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidenterprise1::AndroidEnterprise; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.entitlements().list("enterpriseId", "userId") -/// .doit(); -/// # } -/// ``` -pub struct EntitlementListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _enterprise_id: String, - _user_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EntitlementListCall<'a, C, A> {} - -impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, EntitlementsListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.entitlements.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("enterpriseId", self._enterprise_id.to_string())); - params.push(("userId", self._user_id.to_string())); - for &field in ["alt", "enterpriseId", "userId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/users/{userId}/entitlements"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["userId", "enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> EntitlementListCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The ID of the user. - /// - /// Sets the *user id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_id(mut self, new_value: &str) -> EntitlementListCall<'a, C, A> { - self._user_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EntitlementListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> EntitlementListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EntitlementListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Adds or updates an entitlement to an app for a user. /// /// A builder for the *update* method supported by a *entitlement* resource. @@ -24330,10 +24936,7 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24365,7 +24968,7 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -24482,7 +25085,7 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24628,10 +25231,7 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24651,7 +25251,7 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24749,7 +25349,7 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24793,6 +25393,511 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A } +/// Lists all entitlements for the specified user. Only the ID is set. +/// +/// A builder for the *list* method supported by a *entitlement* resource. +/// It is not used directly, but through a `EntitlementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.entitlements().list("enterpriseId", "userId") +/// .doit(); +/// # } +/// ``` +pub struct EntitlementListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _user_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EntitlementListCall<'a, C, A> {} + +impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EntitlementsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.entitlements.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("userId", self._user_id.to_string())); + for &field in ["alt", "enterpriseId", "userId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/users/{userId}/entitlements"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["userId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> EntitlementListCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the user. + /// + /// Sets the *user id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_id(mut self, new_value: &str) -> EntitlementListCall<'a, C, A> { + self._user_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EntitlementListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EntitlementListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EntitlementListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Removes an entitlement to an app for a user. +/// +/// A builder for the *delete* method supported by a *entitlement* resource. +/// It is not used directly, but through a `EntitlementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.entitlements().delete("enterpriseId", "userId", "entitlementId") +/// .doit(); +/// # } +/// ``` +pub struct EntitlementDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _user_id: String, + _entitlement_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EntitlementDeleteCall<'a, C, A> {} + +impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.entitlements.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("userId", self._user_id.to_string())); + params.push(("entitlementId", self._entitlement_id.to_string())); + for &field in ["enterpriseId", "userId", "entitlementId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "enterprises/{enterpriseId}/users/{userId}/entitlements/{entitlementId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{userId}", "userId"), ("{entitlementId}", "entitlementId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["entitlementId", "userId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the user. + /// + /// Sets the *user id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C, A> { + self._user_id = new_value.to_string(); + self + } + /// The ID of the entitlement (a product ID), e.g. "app:com.google.android.gm". + /// + /// Sets the *entitlement id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn entitlement_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C, A> { + self._entitlement_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EntitlementDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EntitlementDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EntitlementDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Adds or updates an entitlement to an app for a user. This method supports patch semantics. /// /// A builder for the *patch* method supported by a *entitlement* resource. @@ -24907,10 +26012,7 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24942,7 +26044,7 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25059,7 +26161,7 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25210,10 +26312,7 @@ impl<'a, C, A> ServiceaccountkeyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25245,7 +26344,7 @@ impl<'a, C, A> ServiceaccountkeyInsertCall<'a, C, A> where C: BorrowMut ServiceaccountkeyInsertCall<'a, C, A> where C: BorrowMut ServiceaccountkeyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25500,7 +26596,7 @@ impl<'a, C, A> ServiceaccountkeyListCall<'a, C, A> where C: BorrowMut ServiceaccountkeyListCall<'a, C, A> where C: BorrowMut ServiceaccountkeyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25744,7 +26837,7 @@ impl<'a, C, A> ServiceaccountkeyDeleteCall<'a, C, A> where C: BorrowMut ServiceaccountkeyDeleteCall<'a, C, A> where C: BorrowMut ServiceaccountkeyDeleteCall<'a, C, A> where C: BorrowMut PermissionGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25992,7 +27082,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26077,7 +27167,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/androidmanagement1-cli/Cargo.toml b/gen/androidmanagement1-cli/Cargo.toml index 8bd3c4fd4c..74da4d30f8 100644 --- a/gen/androidmanagement1-cli/Cargo.toml +++ b/gen/androidmanagement1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androidmanagement1-cli" -version = "1.0.8+20181001" +version = "1.0.8+20190329" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Management (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidmanagement1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-androidmanagement1] path = "../androidmanagement1" -version = "1.0.8+20181001" +version = "1.0.8+20190329" diff --git a/gen/androidmanagement1-cli/README.md b/gen/androidmanagement1-cli/README.md index 0e8d3254aa..288707a5fa 100644 --- a/gen/androidmanagement1-cli/README.md +++ b/gen/androidmanagement1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Android Management* API at revision *20181001*. The CLI is at version *1.0.8*. +This documentation was generated from the *Android Management* API at revision *20190329*. The CLI is at version *1.0.8*. ```bash androidmanagement1 [options] @@ -49,6 +49,11 @@ androidmanagement1 [options] policies-get [-p ]... [-o ] policies-list [-p ]... [-o ] policies-patch (-r )... [-p ]... [-o ] + web-apps-create (-r )... [-p ]... [-o ] + web-apps-delete [-p ]... [-o ] + web-apps-get [-p ]... [-o ] + web-apps-list [-p ]... [-o ] + web-apps-patch (-r )... [-p ]... [-o ] web-tokens-create (-r )... [-p ]... [-o ] signup-urls create [-p ]... [-o ] diff --git a/gen/androidmanagement1-cli/mkdocs.yml b/gen/androidmanagement1-cli/mkdocs.yml index fdecfc483f..19accb4633 100644 --- a/gen/androidmanagement1-cli/mkdocs.yml +++ b/gen/androidmanagement1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Management v1.0.8+20181001 +site_name: Android Management v1.0.8+20190329 site_url: http://byron.github.io/google-apis-rs/google-androidmanagement1-cli site_description: A complete library to interact with Android Management (protocol v1) @@ -28,6 +28,11 @@ pages: - ['enterprises_policies-get.md', 'Enterprises', 'Policies Get'] - ['enterprises_policies-list.md', 'Enterprises', 'Policies List'] - ['enterprises_policies-patch.md', 'Enterprises', 'Policies Patch'] +- ['enterprises_web-apps-create.md', 'Enterprises', 'Web Apps Create'] +- ['enterprises_web-apps-delete.md', 'Enterprises', 'Web Apps Delete'] +- ['enterprises_web-apps-get.md', 'Enterprises', 'Web Apps Get'] +- ['enterprises_web-apps-list.md', 'Enterprises', 'Web Apps List'] +- ['enterprises_web-apps-patch.md', 'Enterprises', 'Web Apps Patch'] - ['enterprises_web-tokens-create.md', 'Enterprises', 'Web Tokens Create'] - ['signup-urls_create.md', 'Signup Urls', 'Create'] diff --git a/gen/androidmanagement1-cli/src/main.rs b/gen/androidmanagement1-cli/src/main.rs index ade6971c80..f7fa798ae3 100644 --- a/gen/androidmanagement1-cli/src/main.rs +++ b/gen/androidmanagement1-cli/src/main.rs @@ -126,12 +126,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "enterprise-display-name" => Some(("enterpriseDisplayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enabled-notification-types" => Some(("enabledNotificationTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "pubsub-topic" => Some(("pubsubTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "primary-color" => Some(("primaryColor", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "logo.url" => Some(("logo.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "logo.sha256-hash" => Some(("logo.sha256Hash", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enterprise-display-name" => Some(("enterpriseDisplayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-color" => Some(("primaryColor", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "pubsub-topic" => Some(("pubsubTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "app-auto-approval-enabled" => Some(("appAutoApprovalEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["app-auto-approval-enabled", "enabled-notification-types", "enterprise-display-name", "logo", "name", "primary-color", "pubsub-topic", "sha256-hash", "url"]); @@ -706,7 +706,8 @@ impl<'n> Engine<'n> { "applied-policy-name" => Some(("appliedPolicyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-level" => Some(("apiLevel", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy-name" => Some(("policyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "management-mode" => Some(("managementMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled-reason.default-message" => Some(("disabledReason.defaultMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled-reason.localized-messages" => Some(("disabledReason.localizedMessages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "enrollment-token-data" => Some(("enrollmentTokenData", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "software-info.primary-language-code" => Some(("softwareInfo.primaryLanguageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "software-info.android-build-time" => Some(("softwareInfo.androidBuildTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -747,8 +748,7 @@ impl<'n> Engine<'n> { "network-info.network-operator-name" => Some(("networkInfo.networkOperatorName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network-info.meid" => Some(("networkInfo.meid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network-info.wifi-mac-address" => Some(("networkInfo.wifiMacAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled-reason.default-message" => Some(("disabledReason.defaultMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled-reason.localized-messages" => Some(("disabledReason.localizedMessages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "management-mode" => Some(("managementMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enrollment-token-name" => Some(("enrollmentTokenName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user.account-identifier" => Some(("user.accountIdentifier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "applied-policy-version" => Some(("appliedPolicyVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1046,12 +1046,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "enterprise-display-name" => Some(("enterpriseDisplayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enabled-notification-types" => Some(("enabledNotificationTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "pubsub-topic" => Some(("pubsubTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "primary-color" => Some(("primaryColor", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "logo.url" => Some(("logo.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "logo.sha256-hash" => Some(("logo.sha256Hash", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enterprise-display-name" => Some(("enterpriseDisplayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-color" => Some(("primaryColor", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "pubsub-topic" => Some(("pubsubTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "app-auto-approval-enabled" => Some(("appAutoApprovalEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["app-auto-approval-enabled", "enabled-notification-types", "enterprise-display-name", "logo", "name", "primary-color", "pubsub-topic", "sha256-hash", "url"]); @@ -1315,10 +1315,10 @@ impl<'n> Engine<'n> { "status-reporting-settings.memory-info-enabled" => Some(("statusReportingSettings.memoryInfoEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "status-reporting-settings.hardware-status-enabled" => Some(("statusReportingSettings.hardwareStatusEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "status-reporting-settings.device-settings-enabled" => Some(("statusReportingSettings.deviceSettingsEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "status-reporting-settings.application-reports-enabled" => Some(("statusReportingSettings.applicationReportsEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status-reporting-settings.display-info-enabled" => Some(("statusReportingSettings.displayInfoEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "status-reporting-settings.power-management-events-enabled" => Some(("statusReportingSettings.powerManagementEventsEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "status-reporting-settings.software-info-enabled" => Some(("statusReportingSettings.softwareInfoEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "status-reporting-settings.display-info-enabled" => Some(("statusReportingSettings.displayInfoEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status-reporting-settings.application-reports-enabled" => Some(("statusReportingSettings.applicationReportsEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "kiosk-custom-launcher-enabled" => Some(("kioskCustomLauncherEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "bluetooth-config-disabled" => Some(("bluetoothConfigDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "location-mode" => Some(("locationMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1334,6 +1334,7 @@ impl<'n> Engine<'n> { "account-types-with-management-disabled" => Some(("accountTypesWithManagementDisabled", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "frp-admin-emails" => Some(("frpAdminEmails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "keyguard-disabled" => Some(("keyguardDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "password-requirements.password-scope" => Some(("passwordRequirements.passwordScope", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "password-requirements.password-expiration-timeout" => Some(("passwordRequirements.passwordExpirationTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "password-requirements.maximum-failed-passwords-for-wipe" => Some(("passwordRequirements.maximumFailedPasswordsForWipe", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "password-requirements.password-minimum-symbols" => Some(("passwordRequirements.passwordMinimumSymbols", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -1367,8 +1368,8 @@ impl<'n> Engine<'n> { "always-on-vpn-package.package-name" => Some(("alwaysOnVpnPackage.packageName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "always-on-vpn-package.lockdown-enabled" => Some(("alwaysOnVpnPackage.lockdownEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "recommended-global-proxy.pac-uri" => Some(("recommendedGlobalProxy.pacUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "recommended-global-proxy.host" => Some(("recommendedGlobalProxy.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "recommended-global-proxy.excluded-hosts" => Some(("recommendedGlobalProxy.excludedHosts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "recommended-global-proxy.host" => Some(("recommendedGlobalProxy.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "recommended-global-proxy.port" => Some(("recommendedGlobalProxy.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "uninstall-apps-disabled" => Some(("uninstallAppsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "unmute-microphone-disabled" => Some(("unmuteMicrophoneDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1398,7 +1399,7 @@ impl<'n> Engine<'n> { "private-key-selection-enabled" => Some(("privateKeySelectionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "create-windows-disabled" => Some(("createWindowsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-types-with-management-disabled", "add-user-disabled", "adjust-volume-disabled", "always-on-vpn-package", "android-device-policy-tracks", "app-auto-update-policy", "application-reports-enabled", "auto-time-required", "block-applications-enabled", "bluetooth-config-disabled", "bluetooth-contact-sharing-disabled", "bluetooth-disabled", "camera-disabled", "cell-broadcasts-config-disabled", "create-windows-disabled", "credentials-config-disabled", "data-roaming-disabled", "debugging-features-allowed", "default-message", "default-permission-policy", "device-owner-lock-screen-info", "device-settings-enabled", "display-info-enabled", "encryption-policy", "end-minutes", "ensure-verify-apps-enabled", "excluded-hosts", "factory-reset-disabled", "frp-admin-emails", "fun-disabled", "hardware-status-enabled", "host", "install-apps-disabled", "install-unknown-sources-allowed", "keyguard-disabled", "keyguard-disabled-features", "kiosk-custom-launcher-enabled", "localized-messages", "location-mode", "lockdown-enabled", "long-support-message", "maximum-failed-passwords-for-wipe", "maximum-time-to-lock", "memory-info-enabled", "mobile-networks-config-disabled", "modify-accounts-disabled", "mount-physical-media-disabled", "name", "network-escape-hatch-enabled", "network-info-enabled", "network-reset-disabled", "outgoing-beam-disabled", "outgoing-calls-disabled", "pac-uri", "package-name", "package-names", "password-expiration-timeout", "password-history-length", "password-minimum-length", "password-minimum-letters", "password-minimum-lower-case", "password-minimum-non-letter", "password-minimum-numeric", "password-minimum-symbols", "password-minimum-upper-case", "password-quality", "password-requirements", "permitted-input-methods", "play-store-mode", "port", "power-management-events-enabled", "private-key-selection-enabled", "recommended-global-proxy", "remove-user-disabled", "safe-boot-disabled", "screen-capture-disabled", "set-user-icon-disabled", "set-wallpaper-disabled", "share-location-disabled", "short-support-message", "skip-first-use-hints-enabled", "sms-disabled", "software-info-enabled", "start-minutes", "status-bar-disabled", "status-reporting-settings", "stay-on-plugged-modes", "system-update", "tethering-config-disabled", "type", "uninstall-apps-disabled", "unmute-microphone-disabled", "usb-file-transfer-disabled", "usb-mass-storage-enabled", "version", "vpn-config-disabled", "wifi-config-disabled", "wifi-configs-lockdown-enabled"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-types-with-management-disabled", "add-user-disabled", "adjust-volume-disabled", "always-on-vpn-package", "android-device-policy-tracks", "app-auto-update-policy", "application-reports-enabled", "auto-time-required", "block-applications-enabled", "bluetooth-config-disabled", "bluetooth-contact-sharing-disabled", "bluetooth-disabled", "camera-disabled", "cell-broadcasts-config-disabled", "create-windows-disabled", "credentials-config-disabled", "data-roaming-disabled", "debugging-features-allowed", "default-message", "default-permission-policy", "device-owner-lock-screen-info", "device-settings-enabled", "display-info-enabled", "encryption-policy", "end-minutes", "ensure-verify-apps-enabled", "excluded-hosts", "factory-reset-disabled", "frp-admin-emails", "fun-disabled", "hardware-status-enabled", "host", "install-apps-disabled", "install-unknown-sources-allowed", "keyguard-disabled", "keyguard-disabled-features", "kiosk-custom-launcher-enabled", "localized-messages", "location-mode", "lockdown-enabled", "long-support-message", "maximum-failed-passwords-for-wipe", "maximum-time-to-lock", "memory-info-enabled", "mobile-networks-config-disabled", "modify-accounts-disabled", "mount-physical-media-disabled", "name", "network-escape-hatch-enabled", "network-info-enabled", "network-reset-disabled", "outgoing-beam-disabled", "outgoing-calls-disabled", "pac-uri", "package-name", "package-names", "password-expiration-timeout", "password-history-length", "password-minimum-length", "password-minimum-letters", "password-minimum-lower-case", "password-minimum-non-letter", "password-minimum-numeric", "password-minimum-symbols", "password-minimum-upper-case", "password-quality", "password-requirements", "password-scope", "permitted-input-methods", "play-store-mode", "port", "power-management-events-enabled", "private-key-selection-enabled", "recommended-global-proxy", "remove-user-disabled", "safe-boot-disabled", "screen-capture-disabled", "set-user-icon-disabled", "set-wallpaper-disabled", "share-location-disabled", "short-support-message", "skip-first-use-hints-enabled", "sms-disabled", "software-info-enabled", "start-minutes", "status-bar-disabled", "status-reporting-settings", "stay-on-plugged-modes", "system-update", "tethering-config-disabled", "type", "uninstall-apps-disabled", "unmute-microphone-disabled", "usb-file-transfer-disabled", "usb-mass-storage-enabled", "version", "vpn-config-disabled", "wifi-config-disabled", "wifi-configs-lockdown-enabled"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1462,6 +1463,351 @@ impl<'n> Engine<'n> { } } + fn _enterprises_web_apps_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "version-code" => Some(("versionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-url" => Some(("startUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-mode" => Some(("displayMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-mode", "name", "start-url", "title", "version-code"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::WebApp = json::value::from_value(object).unwrap(); + let mut call = self.hub.enterprises().web_apps_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _enterprises_web_apps_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.enterprises().web_apps_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _enterprises_web_apps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.enterprises().web_apps_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _enterprises_web_apps_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.enterprises().web_apps_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _enterprises_web_apps_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "version-code" => Some(("versionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-url" => Some(("startUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-mode" => Some(("displayMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-mode", "name", "start-url", "title", "version-code"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::WebApp = json::value::from_value(object).unwrap(); + let mut call = self.hub.enterprises().web_apps_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _enterprises_web_tokens_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -1673,6 +2019,21 @@ impl<'n> Engine<'n> { ("policies-patch", Some(opt)) => { call_result = self._enterprises_policies_patch(opt, dry_run, &mut err); }, + ("web-apps-create", Some(opt)) => { + call_result = self._enterprises_web_apps_create(opt, dry_run, &mut err); + }, + ("web-apps-delete", Some(opt)) => { + call_result = self._enterprises_web_apps_delete(opt, dry_run, &mut err); + }, + ("web-apps-get", Some(opt)) => { + call_result = self._enterprises_web_apps_get(opt, dry_run, &mut err); + }, + ("web-apps-list", Some(opt)) => { + call_result = self._enterprises_web_apps_list(opt, dry_run, &mut err); + }, + ("web-apps-patch", Some(opt)) => { + call_result = self._enterprises_web_apps_patch(opt, dry_run, &mut err); + }, ("web-tokens-create", Some(opt)) => { call_result = self._enterprises_web_tokens_create(opt, dry_run, &mut err); }, @@ -1778,7 +2139,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("enterprises", "methods: 'applications-get', 'create', 'devices-delete', 'devices-get', 'devices-issue-command', 'devices-list', 'devices-operations-cancel', 'devices-operations-delete', 'devices-operations-get', 'devices-operations-list', 'devices-patch', 'enrollment-tokens-create', 'enrollment-tokens-delete', 'get', 'patch', 'policies-delete', 'policies-get', 'policies-list', 'policies-patch' and 'web-tokens-create'", vec![ + ("enterprises", "methods: 'applications-get', 'create', 'devices-delete', 'devices-get', 'devices-issue-command', 'devices-list', 'devices-operations-cancel', 'devices-operations-delete', 'devices-operations-get', 'devices-operations-list', 'devices-patch', 'enrollment-tokens-create', 'enrollment-tokens-delete', 'get', 'patch', 'policies-delete', 'policies-get', 'policies-list', 'policies-patch', 'web-apps-create', 'web-apps-delete', 'web-apps-get', 'web-apps-list', 'web-apps-patch' and 'web-tokens-create'", vec![ ("applications-get", Some(r##"Gets info about an application."##), "Details at http://byron.github.io/google-apis-rs/google_androidmanagement1_cli/enterprises_applications-get", @@ -2221,6 +2582,128 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("web-apps-create", + Some(r##"Creates a web app."##), + "Details at http://byron.github.io/google-apis-rs/google_androidmanagement1_cli/enterprises_web-apps-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the enterprise in the form enterprises/{enterpriseId}."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("web-apps-delete", + Some(r##"Deletes a web app."##), + "Details at http://byron.github.io/google-apis-rs/google_androidmanagement1_cli/enterprises_web-apps-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("web-apps-get", + Some(r##"Gets a web app."##), + "Details at http://byron.github.io/google-apis-rs/google_androidmanagement1_cli/enterprises_web-apps-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the web app in the form enterprises/{enterpriseId}/webApp/{packageName}."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("web-apps-list", + Some(r##"Lists web apps for a given enterprise."##), + "Details at http://byron.github.io/google-apis-rs/google_androidmanagement1_cli/enterprises_web-apps-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the enterprise in the form enterprises/{enterpriseId}."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("web-apps-patch", + Some(r##"Updates a web app."##), + "Details at http://byron.github.io/google-apis-rs/google_androidmanagement1_cli/enterprises_web-apps-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -2280,7 +2763,7 @@ fn main() { let mut app = App::new("androidmanagement1") .author("Sebastian Thiel ") - .version("1.0.8+20181001") + .version("1.0.8+20190329") .about("The Android Management API provides remote enterprise management of Android devices and apps.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_androidmanagement1_cli") .arg(Arg::with_name("url") diff --git a/gen/androidmanagement1/Cargo.toml b/gen/androidmanagement1/Cargo.toml index 889166bd67..3faf1a30a2 100644 --- a/gen/androidmanagement1/Cargo.toml +++ b/gen/androidmanagement1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-androidmanagement1" -version = "1.0.8+20181001" +version = "1.0.8+20190329" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Management (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidmanagement1" homepage = "https://developers.google.com/android/management" -documentation = "https://docs.rs/google-androidmanagement1/1.0.8+20181001" +documentation = "https://docs.rs/google-androidmanagement1/1.0.8+20190329" license = "MIT" keywords = ["androidmanagement", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/androidmanagement1/README.md b/gen/androidmanagement1/README.md index da0fa786da..edc977c2d6 100644 --- a/gen/androidmanagement1/README.md +++ b/gen/androidmanagement1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-androidmanagement1` library allows access to all features of the *Google Android Management* service. -This documentation was generated from *Android Management* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *androidmanagement:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Android Management* crate version *1.0.8+20190329*, where *20190329* is the exact revision of the *androidmanagement:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Android Management* *v1* API can be found at the [official documentation site](https://developers.google.com/android/management). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.AndroidManagement.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.AndroidManagement.html) ... -* [enterprises](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.Enterprise.html) - * [*applications get*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseApplicationGetCall.html), [*create*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseCreateCall.html), [*devices delete*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseDeviceDeleteCall.html), [*devices get*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseDeviceGetCall.html), [*devices issue command*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseDeviceIssueCommandCall.html), [*devices list*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseDeviceListCall.html), [*devices operations cancel*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseDeviceOperationCancelCall.html), [*devices operations delete*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseDeviceOperationDeleteCall.html), [*devices operations get*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseDeviceOperationGetCall.html), [*devices operations list*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseDeviceOperationListCall.html), [*devices patch*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseDevicePatchCall.html), [*enrollment tokens create*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseEnrollmentTokenCreateCall.html), [*enrollment tokens delete*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseEnrollmentTokenDeleteCall.html), [*get*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseGetCall.html), [*patch*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterprisePatchCall.html), [*policies delete*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterprisePolicyDeleteCall.html), [*policies get*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterprisePolicyGetCall.html), [*policies list*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterprisePolicyListCall.html), [*policies patch*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterprisePolicyPatchCall.html) and [*web tokens create*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.EnterpriseWebTokenCreateCall.html) -* [signup urls](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.SignupUrl.html) - * [*create*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.SignupUrlCreateCall.html) +* [enterprises](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.Enterprise.html) + * [*applications get*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseApplicationGetCall.html), [*create*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseCreateCall.html), [*devices delete*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseDeviceDeleteCall.html), [*devices get*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseDeviceGetCall.html), [*devices issue command*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseDeviceIssueCommandCall.html), [*devices list*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseDeviceListCall.html), [*devices operations cancel*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseDeviceOperationCancelCall.html), [*devices operations delete*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseDeviceOperationDeleteCall.html), [*devices operations get*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseDeviceOperationGetCall.html), [*devices operations list*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseDeviceOperationListCall.html), [*devices patch*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseDevicePatchCall.html), [*enrollment tokens create*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseEnrollmentTokenCreateCall.html), [*enrollment tokens delete*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseEnrollmentTokenDeleteCall.html), [*get*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseGetCall.html), [*patch*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterprisePatchCall.html), [*policies delete*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterprisePolicyDeleteCall.html), [*policies get*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterprisePolicyGetCall.html), [*policies list*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterprisePolicyListCall.html), [*policies patch*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterprisePolicyPatchCall.html), [*web apps create*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseWebAppCreateCall.html), [*web apps delete*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseWebAppDeleteCall.html), [*web apps get*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseWebAppGetCall.html), [*web apps list*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseWebAppListCall.html), [*web apps patch*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseWebAppPatchCall.html) and [*web tokens create*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.EnterpriseWebTokenCreateCall.html) +* [signup urls](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.SignupUrl.html) + * [*create*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.SignupUrlCreateCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/struct.AndroidManagement.html)** +* **[Hub](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/struct.AndroidManagement.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.Part.html)** + * **[Parts](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -49,25 +49,30 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.enterprises().devices_list(...).doit() -let r = hub.enterprises().devices_patch(...).doit() -let r = hub.enterprises().devices_get(...).doit() +let r = hub.enterprises().policies_list(...).doit() +let r = hub.enterprises().web_apps_delete(...).doit() let r = hub.enterprises().policies_patch(...).doit() let r = hub.enterprises().create(...).doit() -let r = hub.enterprises().patch(...).doit() -let r = hub.enterprises().devices_operations_cancel(...).doit() -let r = hub.enterprises().get(...).doit() -let r = hub.enterprises().web_tokens_create(...).doit() +let r = hub.enterprises().web_apps_create(...).doit() let r = hub.enterprises().enrollment_tokens_create(...).doit() -let r = hub.enterprises().enrollment_tokens_delete(...).doit() -let r = hub.enterprises().policies_list(...).doit() +let r = hub.enterprises().web_apps_list(...).doit() +let r = hub.enterprises().devices_list(...).doit() let r = hub.enterprises().policies_delete(...).doit() -let r = hub.enterprises().policies_get(...).doit() -let r = hub.enterprises().devices_operations_get(...).doit() +let r = hub.enterprises().devices_operations_cancel(...).doit() let r = hub.enterprises().devices_operations_delete(...).doit() +let r = hub.enterprises().devices_operations_get(...).doit() +let r = hub.enterprises().devices_operations_list(...).doit() +let r = hub.enterprises().devices_patch(...).doit() +let r = hub.enterprises().patch(...).doit() +let r = hub.enterprises().policies_get(...).doit() +let r = hub.enterprises().web_tokens_create(...).doit() +let r = hub.enterprises().web_apps_patch(...).doit() +let r = hub.enterprises().enrollment_tokens_delete(...).doit() let r = hub.enterprises().devices_issue_command(...).doit() let r = hub.enterprises().devices_delete(...).doit() -let r = hub.enterprises().devices_operations_list(...).doit() +let r = hub.enterprises().web_apps_get(...).doit() +let r = hub.enterprises().devices_get(...).doit() +let r = hub.enterprises().get(...).doit() let r = hub.enterprises().applications_get(...).doit() ``` @@ -154,17 +159,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -174,29 +179,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-androidmanagement1/1.0.8+20181001/google_androidmanagement1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-androidmanagement1/1.0.8+20190329/google_androidmanagement1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/androidmanagement1/src/lib.rs b/gen/androidmanagement1/src/lib.rs index 2952c10ba6..a2a5673f27 100644 --- a/gen/androidmanagement1/src/lib.rs +++ b/gen/androidmanagement1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Android Management* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *androidmanagement:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Android Management* crate version *1.0.8+20190329*, where *20190329* is the exact revision of the *androidmanagement:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Android Management* *v1* API can be found at the //! [official documentation site](https://developers.google.com/android/management). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.AndroidManagement.html) ... //! //! * [enterprises](struct.Enterprise.html) -//! * [*applications get*](struct.EnterpriseApplicationGetCall.html), [*create*](struct.EnterpriseCreateCall.html), [*devices delete*](struct.EnterpriseDeviceDeleteCall.html), [*devices get*](struct.EnterpriseDeviceGetCall.html), [*devices issue command*](struct.EnterpriseDeviceIssueCommandCall.html), [*devices list*](struct.EnterpriseDeviceListCall.html), [*devices operations cancel*](struct.EnterpriseDeviceOperationCancelCall.html), [*devices operations delete*](struct.EnterpriseDeviceOperationDeleteCall.html), [*devices operations get*](struct.EnterpriseDeviceOperationGetCall.html), [*devices operations list*](struct.EnterpriseDeviceOperationListCall.html), [*devices patch*](struct.EnterpriseDevicePatchCall.html), [*enrollment tokens create*](struct.EnterpriseEnrollmentTokenCreateCall.html), [*enrollment tokens delete*](struct.EnterpriseEnrollmentTokenDeleteCall.html), [*get*](struct.EnterpriseGetCall.html), [*patch*](struct.EnterprisePatchCall.html), [*policies delete*](struct.EnterprisePolicyDeleteCall.html), [*policies get*](struct.EnterprisePolicyGetCall.html), [*policies list*](struct.EnterprisePolicyListCall.html), [*policies patch*](struct.EnterprisePolicyPatchCall.html) and [*web tokens create*](struct.EnterpriseWebTokenCreateCall.html) +//! * [*applications get*](struct.EnterpriseApplicationGetCall.html), [*create*](struct.EnterpriseCreateCall.html), [*devices delete*](struct.EnterpriseDeviceDeleteCall.html), [*devices get*](struct.EnterpriseDeviceGetCall.html), [*devices issue command*](struct.EnterpriseDeviceIssueCommandCall.html), [*devices list*](struct.EnterpriseDeviceListCall.html), [*devices operations cancel*](struct.EnterpriseDeviceOperationCancelCall.html), [*devices operations delete*](struct.EnterpriseDeviceOperationDeleteCall.html), [*devices operations get*](struct.EnterpriseDeviceOperationGetCall.html), [*devices operations list*](struct.EnterpriseDeviceOperationListCall.html), [*devices patch*](struct.EnterpriseDevicePatchCall.html), [*enrollment tokens create*](struct.EnterpriseEnrollmentTokenCreateCall.html), [*enrollment tokens delete*](struct.EnterpriseEnrollmentTokenDeleteCall.html), [*get*](struct.EnterpriseGetCall.html), [*patch*](struct.EnterprisePatchCall.html), [*policies delete*](struct.EnterprisePolicyDeleteCall.html), [*policies get*](struct.EnterprisePolicyGetCall.html), [*policies list*](struct.EnterprisePolicyListCall.html), [*policies patch*](struct.EnterprisePolicyPatchCall.html), [*web apps create*](struct.EnterpriseWebAppCreateCall.html), [*web apps delete*](struct.EnterpriseWebAppDeleteCall.html), [*web apps get*](struct.EnterpriseWebAppGetCall.html), [*web apps list*](struct.EnterpriseWebAppListCall.html), [*web apps patch*](struct.EnterpriseWebAppPatchCall.html) and [*web tokens create*](struct.EnterpriseWebTokenCreateCall.html) //! * [signup urls](struct.SignupUrl.html) //! * [*create*](struct.SignupUrlCreateCall.html) //! @@ -49,25 +49,30 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.enterprises().devices_list(...).doit() -//! let r = hub.enterprises().devices_patch(...).doit() -//! let r = hub.enterprises().devices_get(...).doit() +//! let r = hub.enterprises().policies_list(...).doit() +//! let r = hub.enterprises().web_apps_delete(...).doit() //! let r = hub.enterprises().policies_patch(...).doit() //! let r = hub.enterprises().create(...).doit() -//! let r = hub.enterprises().patch(...).doit() -//! let r = hub.enterprises().devices_operations_cancel(...).doit() -//! let r = hub.enterprises().get(...).doit() -//! let r = hub.enterprises().web_tokens_create(...).doit() +//! let r = hub.enterprises().web_apps_create(...).doit() //! let r = hub.enterprises().enrollment_tokens_create(...).doit() -//! let r = hub.enterprises().enrollment_tokens_delete(...).doit() -//! let r = hub.enterprises().policies_list(...).doit() +//! let r = hub.enterprises().web_apps_list(...).doit() +//! let r = hub.enterprises().devices_list(...).doit() //! let r = hub.enterprises().policies_delete(...).doit() -//! let r = hub.enterprises().policies_get(...).doit() -//! let r = hub.enterprises().devices_operations_get(...).doit() +//! let r = hub.enterprises().devices_operations_cancel(...).doit() //! let r = hub.enterprises().devices_operations_delete(...).doit() +//! let r = hub.enterprises().devices_operations_get(...).doit() +//! let r = hub.enterprises().devices_operations_list(...).doit() +//! let r = hub.enterprises().devices_patch(...).doit() +//! let r = hub.enterprises().patch(...).doit() +//! let r = hub.enterprises().policies_get(...).doit() +//! let r = hub.enterprises().web_tokens_create(...).doit() +//! let r = hub.enterprises().web_apps_patch(...).doit() +//! let r = hub.enterprises().enrollment_tokens_delete(...).doit() //! let r = hub.enterprises().devices_issue_command(...).doit() //! let r = hub.enterprises().devices_delete(...).doit() -//! let r = hub.enterprises().devices_operations_list(...).doit() +//! let r = hub.enterprises().web_apps_get(...).doit() +//! let r = hub.enterprises().devices_get(...).doit() +//! let r = hub.enterprises().get(...).doit() //! let r = hub.enterprises().applications_get(...).doit() //! ``` //! @@ -592,12 +597,12 @@ pub struct Application { /// The set of managed properties available to be pre-configured for the app. #[serde(rename="managedProperties")] pub managed_properties: Option>, - /// The title of the app. Localized. - pub title: Option, - /// The name of the app in the form enterprises/{enterpriseId}/applications/{package_name}. - pub name: Option, /// The permissions required by the app. pub permissions: Option>, + /// The name of the app in the form enterprises/{enterpriseId}/applications/{package_name}. + pub name: Option, + /// The title of the app. Localized. + pub title: Option, } impl ResponseResult for Application {} @@ -641,123 +646,6 @@ pub struct MemoryInfo { impl Part for MemoryInfo {} -/// An enrollment token. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [enrollment tokens create enterprises](struct.EnterpriseEnrollmentTokenCreateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EnrollmentToken { - /// Optional, arbitrary data associated with the enrollment token. This could contain, for example, the ID of an org unit the device is assigned to after enrollment. After a device enrolls with the token, this data will be exposed in the enrollment_token_data field of the Device resource. The data must be 1024 characters or less; otherwise, the creation request will fail. - #[serde(rename="additionalData")] - pub additional_data: Option, - /// The name of the enrollment token, which is generated by the server during creation, in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}. - pub name: Option, - /// Whether the enrollment token is for one time use only. If the flag is set to true, only one device can use it for registration. - #[serde(rename="oneTimeOnly")] - pub one_time_only: Option, - /// The name of the policy initially applied to the enrolled device, in the form enterprises/{enterpriseId}/policies/{policyId}. If not specified, the policy_name for the device’s user is applied. If user_name is also not specified, enterprises/{enterpriseId}/policies/default is applied by default. When updating this field, you can specify only the policyId as long as the policyId doesn’t contain any slashes. The rest of the policy name will be inferred. - #[serde(rename="policyName")] - pub policy_name: Option, - /// The token value that's passed to the device and authorizes the device to enroll. This is a read-only field generated by the server. - pub value: Option, - /// The length of time the enrollment token is valid, ranging from 1 minute to 30 days. If not specified, the default duration is 1 hour. - pub duration: Option, - /// The user associated with this enrollment token. If it's specified when the enrollment token is created and the user does not exist, the user will be created. This field must not contain personally identifiable information. Only the account_identifier field needs to be set. - pub user: Option, - /// A JSON string whose UTF-8 representation can be used to generate a QR code to enroll a device with this enrollment token. To enroll a device using NFC, the NFC record must contain a serialized java.util.Properties representation of the properties in the JSON. - #[serde(rename="qrCode")] - pub qr_code: Option, - /// The expiration time of the token. This is a read-only field generated by the server. - #[serde(rename="expirationTimestamp")] - pub expiration_timestamp: Option, -} - -impl RequestValue for EnrollmentToken {} -impl ResponseResult for EnrollmentToken {} - - -/// Configuration for an Android permission and its grant state. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PermissionGrant { - /// The policy for granting the permission. - pub policy: Option, - /// The Android permission or group, e.g. android.permission.READ_CALENDAR or android.permission_group.CALENDAR. - pub permission: Option, -} - -impl Part for PermissionGrant {} - - -/// An entry of a managed property. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ManagedPropertyEntry { - /// The human-readable name of the value. Localized. - pub name: Option, - /// The machine-readable value of the entry, which should be used in the configuration. Not localized. - pub value: Option, -} - -impl Part for ManagedPropertyEntry {} - - -/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// The JSON representation for Empty is empty JSON object {}. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [devices operations delete enterprises](struct.EnterpriseDeviceOperationDeleteCall.html) (response) -/// * [enrollment tokens delete enterprises](struct.EnterpriseEnrollmentTokenDeleteCall.html) (response) -/// * [policies delete enterprises](struct.EnterprisePolicyDeleteCall.html) (response) -/// * [devices delete enterprises](struct.EnterpriseDeviceDeleteCall.html) (response) -/// * [devices operations cancel enterprises](struct.EnterpriseDeviceOperationCancelCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - -/// The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be: -/// Simple to use and understand for most users -/// Flexible enough to meet unexpected needsOverviewThe Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc that can be used for common error conditions.Language mappingThe Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.Other usesThe error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.Example uses of this error model include: -/// Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors. -/// Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting. -/// Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response. -/// Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message. -/// Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Status { - /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. - pub message: Option, - /// The status code, which should be an enum value of google.rpc.Code. - pub code: Option, - /// A list of messages that carry the error details. There is a common set of message types for APIs to use. - pub details: Option>>, -} - -impl Part for Status {} - - /// A policy resources represents a group settings that govern the behavior of a managed device and the apps installed on it. /// /// # Activities @@ -854,9 +742,9 @@ pub struct Policy { /// Whether factory resetting from settings is disabled. #[serde(rename="factoryResetDisabled")] pub factory_reset_disabled: Option, - /// Whether bluetooth contact sharing is disabled. - #[serde(rename="bluetoothContactSharingDisabled")] - pub bluetooth_contact_sharing_disabled: Option, + /// Password requirement policies. Different policies can be set for work profile or fully managed devices by setting the password_scope field in the policy. + #[serde(rename="passwordPolicies")] + pub password_policies: Option>, /// Whether the network escape hatch is enabled. If a network connection can't be made at boot time, the escape hatch prompts the user to temporarily connect to a network in order to refresh the device policy. After applying policy, the temporary network will be forgotten and the device will continue booting. This prevents being unable to connect to a network if there is no suitable network in the last policy and the device boots into an app in lock task mode, or the user is otherwise unable to reach device settings. #[serde(rename="networkEscapeHatchEnabled")] pub network_escape_hatch_enabled: Option, @@ -886,13 +774,16 @@ pub struct Policy { /// Allows showing UI on a device for a user to choose a private key alias if there are no matching rules in ChoosePrivateKeyRules. For devices below Android P, setting this may leave enterprise keys vulnerable. #[serde(rename="privateKeySelectionEnabled")] pub private_key_selection_enabled: Option, + /// Actions to take during the setup process. + #[serde(rename="setupActions")] + pub setup_actions: Option>, /// Whether configuring tethering and portable hotspots is disabled. #[serde(rename="tetheringConfigDisabled")] pub tethering_config_disabled: Option, /// Whether all cameras on the device are disabled. #[serde(rename="cameraDisabled")] pub camera_disabled: Option, - /// Whether Wi-Fi networks defined in Open Network Configuration are locked so they can't be edited by the user. + /// DEPRECATED - Use wifi_config_disabled. #[serde(rename="wifiConfigsLockdownEnabled")] pub wifi_configs_lockdown_enabled: Option, /// Whether adding new users and profiles is disabled. @@ -916,7 +807,7 @@ pub struct Policy { /// Email addresses of device administrators for factory reset protection. When the device is factory reset, it will require one of these admins to log in with the Google account email and password to unlock the device. If no admins are specified, the device won't provide factory reset protection. #[serde(rename="frpAdminEmails")] pub frp_admin_emails: Option>, - /// Password requirements. + /// Password requirements. DEPRECATED - Use password_policies #[serde(rename="passwordRequirements")] pub password_requirements: Option, /// Maximum time in milliseconds for user activity until the device locks. A value of 0 means there is no restriction. @@ -948,10 +839,13 @@ pub struct Policy { /// The network-independent global HTTP proxy. Typically proxies should be configured per-network in open_network_configuration. However for unusual configurations like general internal filtering a global HTTP proxy may be useful. If the proxy is not accessible, network access may break. The global proxy is only a recommendation and some apps may ignore it. #[serde(rename="recommendedGlobalProxy")] pub recommended_global_proxy: Option, + /// Whether bluetooth contact sharing is disabled. + #[serde(rename="bluetoothContactSharingDisabled")] + pub bluetooth_contact_sharing_disabled: Option, /// Whether configuring Wi-Fi access points is disabled. #[serde(rename="wifiConfigDisabled")] pub wifi_config_disabled: Option, - /// Whether USB storage is enabled. + /// Whether USB storage is enabled. Deprecated. #[serde(rename="usbMassStorageEnabled")] pub usb_mass_storage_enabled: Option, /// Policy applied to apps. @@ -992,6 +886,132 @@ impl RequestValue for Policy {} impl ResponseResult for Policy {} +/// A web app. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [web apps create enterprises](struct.EnterpriseWebAppCreateCall.html) (request|response) +/// * [web apps patch enterprises](struct.EnterpriseWebAppPatchCall.html) (request|response) +/// * [web apps get enterprises](struct.EnterpriseWebAppGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WebApp { + /// The name of the web app, which is generated by the server during creation in the form enterprises/{enterpriseId}/webApps/{packageName}. + pub name: Option, + /// A list of icons for the web app. Must have at least one element. + pub icons: Option>, + /// The current version of the app.

Note that the version can automatically increase during the lifetime of the web app, while Google does internal housekeeping to keep the web app up-to-date. + #[serde(rename="versionCode")] + pub version_code: Option, + /// The title of the web app as displayed to the user (e.g., amongst a list of other applications, or as a label for an icon). + pub title: Option, + /// The display mode of the web app. + #[serde(rename="displayMode")] + pub display_mode: Option, + /// The start URL, i.e. the URL that should load when the user opens the application. + #[serde(rename="startUrl")] + pub start_url: Option, +} + +impl RequestValue for WebApp {} +impl ResponseResult for WebApp {} + + +/// Configuration for an Android permission and its grant state. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PermissionGrant { + /// The policy for granting the permission. + pub policy: Option, + /// The Android permission or group, e.g. android.permission.READ_CALENDAR or android.permission_group.CALENDAR. + pub permission: Option, +} + +impl Part for PermissionGrant {} + + +/// An entry of a managed property. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedPropertyEntry { + /// The human-readable name of the value. Localized. + pub name: Option, + /// The machine-readable value of the entry, which should be used in the configuration. Not localized. + pub value: Option, +} + +impl Part for ManagedPropertyEntry {} + + +/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// The JSON representation for Empty is empty JSON object {}. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [web apps delete enterprises](struct.EnterpriseWebAppDeleteCall.html) (response) +/// * [devices operations cancel enterprises](struct.EnterpriseDeviceOperationCancelCall.html) (response) +/// * [enrollment tokens delete enterprises](struct.EnterpriseEnrollmentTokenDeleteCall.html) (response) +/// * [devices operations delete enterprises](struct.EnterpriseDeviceOperationDeleteCall.html) (response) +/// * [policies delete enterprises](struct.EnterprisePolicyDeleteCall.html) (response) +/// * [devices delete enterprises](struct.EnterpriseDeviceDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be: +/// Simple to use and understand for most users +/// Flexible enough to meet unexpected needsOverviewThe Status message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc that can be used for common error conditions.Language mappingThe Status message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.Other usesThe error model and the Status message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.Example uses of this error model include: +/// Partial errors. If a service needs to return partial errors to the client, it may embed the Status in the normal response to indicate the partial errors. +/// Workflow errors. A typical workflow has multiple steps. Each step may have a Status message for error reporting. +/// Batch operations. If a client uses batch request and batch response, the Status message should be used directly inside batch response, one for each error sub-response. +/// Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the Status message. +/// Logging. If some API errors are stored in logs, the message Status could be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// An action to launch an app. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LaunchAppAction { + /// Package name of app to be launched + #[serde(rename="packageName")] + pub package_name: Option, +} + +impl Part for LaunchAppAction {} + + /// A compliance rule condition which is satisfied if the Android Framework API level on the device doesn't meet a minimum requirement. There can only be one rule with this type of condition per policy. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1006,6 +1026,20 @@ pub struct ApiLevelCondition { impl Part for ApiLevelCondition {} +/// An icon for a web app. Supported formats are: png, jpg and webp. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WebAppIcon { + /// The actual bytes of the image in a base64url encoded string (c.f. RFC4648, section 5 "Base 64 Encoding with URL and Filename Safe Alphabet").

  • The image type can be png or jpg.
  • The image should ideally be square.
  • The image should ideally have a size of 512x512.
+ #[serde(rename="imageData")] + pub image_data: Option, +} + +impl Part for WebAppIcon {} + + /// A user belonging to an enterprise. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1027,8 +1061,8 @@ impl Part for User {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [devices patch enterprises](struct.EnterpriseDevicePatchCall.html) (request|response) /// * [devices get enterprises](struct.EnterpriseDeviceGetCall.html) (response) +/// * [devices patch enterprises](struct.EnterpriseDevicePatchCall.html) (request|response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Device { @@ -1041,9 +1075,9 @@ pub struct Device { /// Device network information. This information is only available if networkInfoEnabled is true in the device's policy. #[serde(rename="networkInfo")] pub network_info: Option, - /// The type of management mode Android Device Policy takes on the device. This influences which policy settings are supported. - #[serde(rename="managementMode")] - pub management_mode: Option, + /// If the device state is DISABLED, an optional message that is displayed on the device indicating the reason the device is disabled. This field can be modified by a patch request. + #[serde(rename="disabledReason")] + pub disabled_reason: Option, /// Events related to memory and storage measurements in chronological order. This information is only available if memoryInfoEnabled is true in the device's policy. #[serde(rename="memoryEvents")] pub memory_events: Option>, @@ -1076,9 +1110,9 @@ pub struct Device { /// The name of the policy applied to the device, in the form enterprises/{enterpriseId}/policies/{policyId}. If not specified, the policy_name for the device's user is applied. This field can be modified by a patch request. You can specify only the policyId when calling enterprises.devices.patch, as long as the policyId doesn’t contain any slashes. The rest of the policy name is inferred. #[serde(rename="policyName")] pub policy_name: Option, - /// If the device state is DISABLED, an optional message that is displayed on the device indicating the reason the device is disabled. This field can be modified by a patch request. - #[serde(rename="disabledReason")] - pub disabled_reason: Option, + /// The type of management mode Android Device Policy takes on the device. This influences which policy settings are supported. + #[serde(rename="managementMode")] + pub management_mode: Option, /// If the device was enrolled with an enrollment token with additional data provided, this field contains that data. #[serde(rename="enrollmentTokenData")] pub enrollment_token_data: Option, @@ -1124,22 +1158,64 @@ impl RequestValue for Device {} impl ResponseResult for Device {} -/// A permission required by the app. +/// A resource containing sign in details for an enterprise. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ApplicationPermission { - /// An opaque string uniquely identifying the permission. Not localized. - #[serde(rename="permissionId")] - pub permission_id: Option, - /// The name of the permission. Localized. - pub name: Option, - /// A longer description of the permission, providing more detail on what it affects. Localized. - pub description: Option, +pub struct SigninDetail { + /// A JSON string whose UTF-8 representation can be used to generate a QR code to enroll a device with this enrollment token. To enroll a device using NFC, the NFC record must contain a serialized java.util.Properties representation of the properties in the JSON. This is a read-only field generated by the server. + #[serde(rename="qrCode")] + pub qr_code: Option, + /// An enterprise wide enrollment token used to trigger custom sign-in flow. This is a read-only field generated by the server. + #[serde(rename="signinEnrollmentToken")] + pub signin_enrollment_token: Option, + /// Sign-in URL for authentication when device is provisioned with a sign-in enrollment token. The sign-in endpoint should finish authentication flow with a URL in the form of https://enterprise.google.com/android/enroll?et= for a successful login, or https://enterprise.google.com/android/enroll/invalid for a failed login. + #[serde(rename="signinUrl")] + pub signin_url: Option, } -impl Part for ApplicationPermission {} +impl Part for SigninDetail {} + + +/// An enrollment token. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [enrollment tokens create enterprises](struct.EnterpriseEnrollmentTokenCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EnrollmentToken { + /// Optional, arbitrary data associated with the enrollment token. This could contain, for example, the ID of an org unit the device is assigned to after enrollment. After a device enrolls with the token, this data will be exposed in the enrollment_token_data field of the Device resource. The data must be 1024 characters or less; otherwise, the creation request will fail. + #[serde(rename="additionalData")] + pub additional_data: Option, + /// The name of the enrollment token, which is generated by the server during creation, in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}. + pub name: Option, + /// Whether the enrollment token is for one time use only. If the flag is set to true, only one device can use it for registration. + #[serde(rename="oneTimeOnly")] + pub one_time_only: Option, + /// The name of the policy initially applied to the enrolled device, in the form enterprises/{enterpriseId}/policies/{policyId}. If not specified, the policy_name for the device’s user is applied. If user_name is also not specified, enterprises/{enterpriseId}/policies/default is applied by default. When updating this field, you can specify only the policyId as long as the policyId doesn’t contain any slashes. The rest of the policy name will be inferred. + #[serde(rename="policyName")] + pub policy_name: Option, + /// The token value that's passed to the device and authorizes the device to enroll. This is a read-only field generated by the server. + pub value: Option, + /// The length of time the enrollment token is valid, ranging from 1 minute to 30 days. If not specified, the default duration is 1 hour. + pub duration: Option, + /// The user associated with this enrollment token. If it's specified when the enrollment token is created and the user does not exist, the user will be created. This field must not contain personally identifiable information. Only the account_identifier field needs to be set. + pub user: Option, + /// A JSON string whose UTF-8 representation can be used to generate a QR code to enroll a device with this enrollment token. To enroll a device using NFC, the NFC record must contain a serialized java.util.Properties representation of the properties in the JSON. + #[serde(rename="qrCode")] + pub qr_code: Option, + /// The expiration time of the token. This is a read-only field generated by the server. + #[serde(rename="expirationTimestamp")] + pub expiration_timestamp: Option, +} + +impl RequestValue for EnrollmentToken {} +impl ResponseResult for EnrollmentToken {} /// Information about device hardware. The fields related to temperature thresholds are only available if hardwareStatusEnabled is true in the device's policy. @@ -1197,24 +1273,27 @@ impl Part for HardwareInfo {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PasswordRequirements { + /// The scope that the password requirement applies to. + #[serde(rename="passwordScope")] + pub password_scope: Option, /// Password expiration timeout. #[serde(rename="passwordExpirationTimeout")] pub password_expiration_timeout: Option, /// Number of incorrect device-unlock passwords that can be entered before a device is wiped. A value of 0 means there is no restriction. #[serde(rename="maximumFailedPasswordsForWipe")] pub maximum_failed_passwords_for_wipe: Option, - /// The length of the password history. After setting this field, the user won't be able to enter a new password that is the same as any password in the history. A value of 0 means there is no restriction. - #[serde(rename="passwordHistoryLength")] - pub password_history_length: Option, /// Minimum number of symbols required in the password. Only enforced when password_quality is COMPLEX. #[serde(rename="passwordMinimumSymbols")] pub password_minimum_symbols: Option, - /// The required password quality. - #[serde(rename="passwordQuality")] - pub password_quality: Option, /// The minimum allowed password length. A value of 0 means there is no restriction. Only enforced when password_quality is NUMERIC, NUMERIC_COMPLEX, ALPHABETIC, ALPHANUMERIC, or COMPLEX. #[serde(rename="passwordMinimumLength")] pub password_minimum_length: Option, + /// The required password quality. + #[serde(rename="passwordQuality")] + pub password_quality: Option, + /// The length of the password history. After setting this field, the user won't be able to enter a new password that is the same as any password in the history. A value of 0 means there is no restriction. + #[serde(rename="passwordHistoryLength")] + pub password_history_length: Option, /// Minimum number of numerical digits required in the password. Only enforced when password_quality is COMPLEX. #[serde(rename="passwordMinimumNumeric")] pub password_minimum_numeric: Option, @@ -1235,6 +1314,28 @@ pub struct PasswordRequirements { impl Part for PasswordRequirements {} +/// Response to a request to list web apps for a given enterprise. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [web apps list enterprises](struct.EnterpriseWebAppListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListWebAppsResponse { + /// If there are more results, a token to retrieve next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of web apps. + #[serde(rename="webApps")] + pub web_apps: Option>, +} + +impl ResponseResult for ListWebAppsResponse {} + + /// A list of package names. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1296,12 +1397,12 @@ impl Part for SoftwareInfo {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ComplianceRule { - /// If set, the rule includes a mitigating action to disable apps specified in the list, but app data is preserved. - #[serde(rename="packageNamesToDisable")] - pub package_names_to_disable: Option>, /// A condition which is satisfied if the Android Framework API level on the device doesn't meet a minimum requirement. #[serde(rename="apiLevelCondition")] pub api_level_condition: Option, + /// If set, the rule includes a mitigating action to disable apps specified in the list, but app data is preserved. + #[serde(rename="packageNamesToDisable")] + pub package_names_to_disable: Option>, /// A condition which is satisfied if there exists any matching NonComplianceDetail for the device. #[serde(rename="nonComplianceDetailCondition")] pub non_compliance_detail_condition: Option, @@ -1387,6 +1488,24 @@ pub struct UserFacingMessage { impl Part for UserFacingMessage {} +/// An action executed during setup. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetupAction { + /// An action to launch an app. + #[serde(rename="launchApp")] + pub launch_app: Option, + /// Description of this action. + pub description: Option, + /// Title of this action. + pub title: Option, +} + +impl Part for SetupAction {} + + /// The configuration applied to an enterprise. /// /// # Activities @@ -1394,25 +1513,30 @@ impl Part for UserFacingMessage {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [devices list enterprises](struct.EnterpriseDeviceListCall.html) (none) -/// * [devices patch enterprises](struct.EnterpriseDevicePatchCall.html) (none) -/// * [devices get enterprises](struct.EnterpriseDeviceGetCall.html) (none) +/// * [policies list enterprises](struct.EnterprisePolicyListCall.html) (none) +/// * [web apps delete enterprises](struct.EnterpriseWebAppDeleteCall.html) (none) /// * [policies patch enterprises](struct.EnterprisePolicyPatchCall.html) (none) /// * [create enterprises](struct.EnterpriseCreateCall.html) (request|response) -/// * [patch enterprises](struct.EnterprisePatchCall.html) (request|response) -/// * [devices operations cancel enterprises](struct.EnterpriseDeviceOperationCancelCall.html) (none) -/// * [get enterprises](struct.EnterpriseGetCall.html) (response) -/// * [web tokens create enterprises](struct.EnterpriseWebTokenCreateCall.html) (none) +/// * [web apps create enterprises](struct.EnterpriseWebAppCreateCall.html) (none) /// * [enrollment tokens create enterprises](struct.EnterpriseEnrollmentTokenCreateCall.html) (none) -/// * [enrollment tokens delete enterprises](struct.EnterpriseEnrollmentTokenDeleteCall.html) (none) -/// * [policies list enterprises](struct.EnterprisePolicyListCall.html) (none) +/// * [web apps list enterprises](struct.EnterpriseWebAppListCall.html) (none) +/// * [devices list enterprises](struct.EnterpriseDeviceListCall.html) (none) /// * [policies delete enterprises](struct.EnterprisePolicyDeleteCall.html) (none) -/// * [policies get enterprises](struct.EnterprisePolicyGetCall.html) (none) -/// * [devices operations get enterprises](struct.EnterpriseDeviceOperationGetCall.html) (none) +/// * [devices operations cancel enterprises](struct.EnterpriseDeviceOperationCancelCall.html) (none) /// * [devices operations delete enterprises](struct.EnterpriseDeviceOperationDeleteCall.html) (none) +/// * [devices operations get enterprises](struct.EnterpriseDeviceOperationGetCall.html) (none) +/// * [devices operations list enterprises](struct.EnterpriseDeviceOperationListCall.html) (none) +/// * [devices patch enterprises](struct.EnterpriseDevicePatchCall.html) (none) +/// * [patch enterprises](struct.EnterprisePatchCall.html) (request|response) +/// * [policies get enterprises](struct.EnterprisePolicyGetCall.html) (none) +/// * [web tokens create enterprises](struct.EnterpriseWebTokenCreateCall.html) (none) +/// * [web apps patch enterprises](struct.EnterpriseWebAppPatchCall.html) (none) +/// * [enrollment tokens delete enterprises](struct.EnterpriseEnrollmentTokenDeleteCall.html) (none) /// * [devices issue command enterprises](struct.EnterpriseDeviceIssueCommandCall.html) (none) /// * [devices delete enterprises](struct.EnterpriseDeviceDeleteCall.html) (none) -/// * [devices operations list enterprises](struct.EnterpriseDeviceOperationListCall.html) (none) +/// * [web apps get enterprises](struct.EnterpriseWebAppGetCall.html) (none) +/// * [devices get enterprises](struct.EnterpriseDeviceGetCall.html) (none) +/// * [get enterprises](struct.EnterpriseGetCall.html) (response) /// * [applications get enterprises](struct.EnterpriseApplicationGetCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -1425,17 +1549,20 @@ pub struct Enterprise { /// The types of Google Pub/Sub notifications enabled for the enterprise. #[serde(rename="enabledNotificationTypes")] pub enabled_notification_types: Option>, + /// An image displayed as a logo during device provisioning. Supported types are: image/bmp, image/gif, image/x-ico, image/jpeg, image/png, image/webp, image/vnd.wap.wbmp, image/x-adobe-dng. + pub logo: Option, + /// Sign-in details of the enterprise. Maximum of 1 SigninDetail is supported. + #[serde(rename="signinDetails")] + pub signin_details: Option>, /// The name of the enterprise displayed to users. #[serde(rename="enterpriseDisplayName")] pub enterprise_display_name: Option, - /// The topic that Cloud Pub/Sub notifications are published to, in the form projects/{project}/topics/{topic}. This field is only required if Pub/Sub notifications are enabled. - #[serde(rename="pubsubTopic")] - pub pubsub_topic: Option, /// A color in RGB format that indicates the predominant color to display in the device management app UI. The color components are stored as follows: (red << 16) | (green << 8) | blue, where the value of each component is between 0 and 255, inclusive. #[serde(rename="primaryColor")] pub primary_color: Option, - /// An image displayed as a logo during device provisioning. Supported types are: image/bmp, image/gif, image/x-ico, image/jpeg, image/png, image/webp, image/vnd.wap.wbmp, image/x-adobe-dng. - pub logo: Option, + /// The topic that Cloud Pub/Sub notifications are published to, in the form projects/{project}/topics/{topic}. This field is only required if Pub/Sub notifications are enabled. + #[serde(rename="pubsubTopic")] + pub pubsub_topic: Option, /// Deprecated and unused. #[serde(rename="appAutoApprovalEnabled")] pub app_auto_approval_enabled: Option, @@ -1455,10 +1582,10 @@ pub struct PersistentPreferredActivity { /// The activity that should be the default intent handler. This should be an Android component name, e.g. com.android.enterprise.app/.MainActivity. Alternatively, the value may be the package name of an app, which causes Android Device Policy to choose an appropriate activity from the app to handle the intent. #[serde(rename="receiverActivity")] pub receiver_activity: Option, - /// The intent categories to match in the filter. An intent includes the categories that it requires, all of which must be included in the filter in order to match. In other words, adding a category to the filter has no impact on matching unless that category is specified in the intent. - pub categories: Option>, /// The intent actions to match in the filter. If any actions are included in the filter, then an intent's action must be one of those values for it to match. If no actions are included, the intent action is ignored. pub actions: Option>, + /// The intent categories to match in the filter. An intent includes the categories that it requires, all of which must be included in the filter in order to match. In other words, adding a category to the filter has no impact on matching unless that category is specified in the intent. + pub categories: Option>, } impl Part for PersistentPreferredActivity {} @@ -1523,6 +1650,27 @@ pub struct Display { impl Part for Display {} +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [devices operations list enterprises](struct.EnterpriseDeviceOperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for ListOperationsResponse {} + + /// A terms and conditions page to be accepted during provisioning. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1558,25 +1706,21 @@ pub struct MemoryEvent { impl Part for MemoryEvent {} -/// The response message for Operations.ListOperations. +/// The managed configurations template for the app, saved from the managed configurations iframe. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [devices operations list enterprises](struct.EnterpriseDeviceOperationListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListOperationsResponse { - /// A list of operations that matches the specified filter in the request. - pub operations: Option>, - /// The standard List next-page token. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, +pub struct ManagedConfigurationTemplate { + /// Optional, a map containing configuration variables defined for the configuration. + #[serde(rename="configurationVariables")] + pub configuration_variables: Option>, + /// The ID of the managed configurations template. + #[serde(rename="templateId")] + pub template_id: Option, } -impl ResponseResult for ListOperationsResponse {} +impl Part for ManagedConfigurationTemplate {} /// A power management event. @@ -1626,6 +1770,9 @@ impl Part for NetworkInfo {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ApplicationPolicy { + /// The managed configurations template for the app, saved from the managed configurations iframe. This field is ignored if managed_configuration is set. + #[serde(rename="managedConfigurationTemplate")] + pub managed_configuration_template: Option, /// Whether the app is allowed to lock itself in full-screen mode. #[serde(rename="lockTaskAllowed")] pub lock_task_allowed: Option, @@ -1702,6 +1849,24 @@ pub struct ManagedProperty { impl Part for ManagedProperty {} +/// A permission required by the app. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ApplicationPermission { + /// An opaque string uniquely identifying the permission. Not localized. + #[serde(rename="permissionId")] + pub permission_id: Option, + /// A longer description of the permission, providing more detail on what it affects. Localized. + pub description: Option, + /// The name of the permission. Localized. + pub name: Option, +} + +impl Part for ApplicationPermission {} + + /// A web token used to access the managed Google Play iframe. /// /// # Activities @@ -1746,18 +1911,18 @@ pub struct StatusReportingSettings { /// Whether device settings reporting is enabled. #[serde(rename="deviceSettingsEnabled")] pub device_settings_enabled: Option, - /// Whether displays reporting is enabled. - #[serde(rename="displayInfoEnabled")] - pub display_info_enabled: Option, + /// Whether app reports are enabled. + #[serde(rename="applicationReportsEnabled")] + pub application_reports_enabled: Option, /// Whether power management event reporting is enabled. #[serde(rename="powerManagementEventsEnabled")] pub power_management_events_enabled: Option, /// Whether software info reporting is enabled. #[serde(rename="softwareInfoEnabled")] pub software_info_enabled: Option, - /// Whether app reports are enabled. - #[serde(rename="applicationReportsEnabled")] - pub application_reports_enabled: Option, + /// Whether displays reporting is enabled. + #[serde(rename="displayInfoEnabled")] + pub display_info_enabled: Option, } impl Part for StatusReportingSettings {} @@ -1815,11 +1980,11 @@ pub struct ProxyInfo { /// The URI of the PAC script used to configure the proxy. #[serde(rename="pacUri")] pub pac_uri: Option, - /// The host of the direct proxy. - pub host: Option, /// For a direct proxy, the hosts for which the proxy is bypassed. The host names may contain wildcards such as *.example.com. #[serde(rename="excludedHosts")] pub excluded_hosts: Option>, + /// The host of the direct proxy. + pub host: Option, /// The port of the direct proxy. pub port: Option, } @@ -1836,12 +2001,12 @@ pub struct ChoosePrivateKeyRule { /// The package names for which outgoing requests are subject to this rule. If no package names are specified, then the rule applies to all packages. For each package name listed, the rule applies to that package and all other packages that shared the same Android UID. The SHA256 hash of the signing key signatures of each package_name will be verified against those provided by Play #[serde(rename="packageNames")] pub package_names: Option>, - /// The URL pattern to match against the URL of the outgoing request. The pattern may contain asterisk (*) wildcards. Any URL is matched if unspecified. - #[serde(rename="urlPattern")] - pub url_pattern: Option, /// The alias of the private key to be used. #[serde(rename="privateKeyAlias")] pub private_key_alias: Option, + /// The URL pattern to match against the URL of the outgoing request. The pattern may contain asterisk (*) wildcards. Any URL is matched if unspecified. + #[serde(rename="urlPattern")] + pub url_pattern: Option, } impl Part for ChoosePrivateKeyRule {} @@ -1932,7 +2097,7 @@ impl<'a, C, A> SignupUrlMethods<'a, C, A> { /// ::default(), None); /// let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `applications_get(...)`, `create(...)`, `devices_delete(...)`, `devices_get(...)`, `devices_issue_command(...)`, `devices_list(...)`, `devices_operations_cancel(...)`, `devices_operations_delete(...)`, `devices_operations_get(...)`, `devices_operations_list(...)`, `devices_patch(...)`, `enrollment_tokens_create(...)`, `enrollment_tokens_delete(...)`, `get(...)`, `patch(...)`, `policies_delete(...)`, `policies_get(...)`, `policies_list(...)`, `policies_patch(...)` and `web_tokens_create(...)` +/// // like `applications_get(...)`, `create(...)`, `devices_delete(...)`, `devices_get(...)`, `devices_issue_command(...)`, `devices_list(...)`, `devices_operations_cancel(...)`, `devices_operations_delete(...)`, `devices_operations_get(...)`, `devices_operations_list(...)`, `devices_patch(...)`, `enrollment_tokens_create(...)`, `enrollment_tokens_delete(...)`, `get(...)`, `patch(...)`, `policies_delete(...)`, `policies_get(...)`, `policies_list(...)`, `policies_patch(...)`, `web_apps_create(...)`, `web_apps_delete(...)`, `web_apps_get(...)`, `web_apps_list(...)`, `web_apps_patch(...)` and `web_tokens_create(...)` /// // to build up your call. /// let rb = hub.enterprises(); /// # } @@ -1949,31 +2114,13 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets info about an application. - /// - /// # Arguments - /// - /// * `name` - The name of the application in the form enterprises/{enterpriseId}/applications/{package_name}. - pub fn applications_get(&self, name: &str) -> EnterpriseApplicationGetCall<'a, C, A> { - EnterpriseApplicationGetCall { - hub: self.hub, - _name: name.to_string(), - _language_code: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists devices for a given enterprise. + /// Lists policies for a given enterprise. /// /// # Arguments /// /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}. - pub fn devices_list(&self, parent: &str) -> EnterpriseDeviceListCall<'a, C, A> { - EnterpriseDeviceListCall { + pub fn policies_list(&self, parent: &str) -> EnterprisePolicyListCall<'a, C, A> { + EnterprisePolicyListCall { hub: self.hub, _parent: parent.to_string(), _page_token: Default::default(), @@ -1986,33 +2133,13 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a device. + /// Deletes a web app. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `name` - The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}. - pub fn devices_patch(&self, request: Device, name: &str) -> EnterpriseDevicePatchCall<'a, C, A> { - EnterpriseDevicePatchCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a device. - /// - /// # Arguments - /// - /// * `name` - The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}. - pub fn devices_get(&self, name: &str) -> EnterpriseDeviceGetCall<'a, C, A> { - EnterpriseDeviceGetCall { + /// * `name` - The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}. + pub fn web_apps_delete(&self, name: &str) -> EnterpriseWebAppDeleteCall<'a, C, A> { + EnterpriseWebAppDeleteCall { hub: self.hub, _name: name.to_string(), _delegate: Default::default(), @@ -2063,68 +2190,14 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates an enterprise. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - The name of the enterprise in the form enterprises/{enterpriseId}. - pub fn patch(&self, request: Enterprise, name: &str) -> EnterprisePatchCall<'a, C, A> { - EnterprisePatchCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED. - /// - /// # Arguments - /// - /// * `name` - The name of the operation resource to be cancelled. - pub fn devices_operations_cancel(&self, name: &str) -> EnterpriseDeviceOperationCancelCall<'a, C, A> { - EnterpriseDeviceOperationCancelCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets an enterprise. - /// - /// # Arguments - /// - /// * `name` - The name of the enterprise in the form enterprises/{enterpriseId}. - pub fn get(&self, name: &str) -> EnterpriseGetCall<'a, C, A> { - EnterpriseGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a web token to access an embeddable managed Google Play web UI for a given enterprise. + /// Creates a web app. /// /// # Arguments /// /// * `request` - No description provided. /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}. - pub fn web_tokens_create(&self, request: WebToken, parent: &str) -> EnterpriseWebTokenCreateCall<'a, C, A> { - EnterpriseWebTokenCreateCall { + pub fn web_apps_create(&self, request: WebApp, parent: &str) -> EnterpriseWebAppCreateCall<'a, C, A> { + EnterpriseWebAppCreateCall { hub: self.hub, _request: request, _parent: parent.to_string(), @@ -2155,15 +2228,17 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes an enrollment token. This operation invalidates the token, preventing its future use. + /// Lists web apps for a given enterprise. /// /// # Arguments /// - /// * `name` - The name of the enrollment token in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}. - pub fn enrollment_tokens_delete(&self, name: &str) -> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> { - EnterpriseEnrollmentTokenDeleteCall { + /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}. + pub fn web_apps_list(&self, parent: &str) -> EnterpriseWebAppListCall<'a, C, A> { + EnterpriseWebAppListCall { hub: self.hub, - _name: name.to_string(), + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2172,13 +2247,13 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists policies for a given enterprise. + /// Lists devices for a given enterprise. /// /// # Arguments /// /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}. - pub fn policies_list(&self, parent: &str) -> EnterprisePolicyListCall<'a, C, A> { - EnterprisePolicyListCall { + pub fn devices_list(&self, parent: &str) -> EnterpriseDeviceListCall<'a, C, A> { + EnterpriseDeviceListCall { hub: self.hub, _parent: parent.to_string(), _page_token: Default::default(), @@ -2208,13 +2283,13 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. + /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED. /// /// # Arguments /// - /// * `name` - The name of the operation resource. - pub fn devices_operations_get(&self, name: &str) -> EnterpriseDeviceOperationGetCall<'a, C, A> { - EnterpriseDeviceOperationGetCall { + /// * `name` - The name of the operation resource to be cancelled. + pub fn devices_operations_cancel(&self, name: &str) -> EnterpriseDeviceOperationCancelCall<'a, C, A> { + EnterpriseDeviceOperationCancelCall { hub: self.hub, _name: name.to_string(), _delegate: Default::default(), @@ -2240,6 +2315,156 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn devices_operations_get(&self, name: &str) -> EnterpriseDeviceOperationGetCall<'a, C, A> { + EnterpriseDeviceOperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding allows API services to override the binding to use different resource name schemes, such as users/*/operations. To override the binding, API services can add a binding such as "/v1/{name=users/*}/operations" to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id. + /// + /// # Arguments + /// + /// * `name` - The name of the operation's parent resource. + pub fn devices_operations_list(&self, name: &str) -> EnterpriseDeviceOperationListCall<'a, C, A> { + EnterpriseDeviceOperationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a device. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}. + pub fn devices_patch(&self, request: Device, name: &str) -> EnterpriseDevicePatchCall<'a, C, A> { + EnterpriseDevicePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an enterprise. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the enterprise in the form enterprises/{enterpriseId}. + pub fn patch(&self, request: Enterprise, name: &str) -> EnterprisePatchCall<'a, C, A> { + EnterprisePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a policy. + /// + /// # Arguments + /// + /// * `name` - The name of the policy in the form enterprises/{enterpriseId}/policies/{policyId}. + pub fn policies_get(&self, name: &str) -> EnterprisePolicyGetCall<'a, C, A> { + EnterprisePolicyGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a web token to access an embeddable managed Google Play web UI for a given enterprise. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}. + pub fn web_tokens_create(&self, request: WebToken, parent: &str) -> EnterpriseWebTokenCreateCall<'a, C, A> { + EnterpriseWebTokenCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a web app. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}. + pub fn web_apps_patch(&self, request: WebApp, name: &str) -> EnterpriseWebAppPatchCall<'a, C, A> { + EnterpriseWebAppPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an enrollment token. This operation invalidates the token, preventing its future use. + /// + /// # Arguments + /// + /// * `name` - The name of the enrollment token in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}. + pub fn enrollment_tokens_delete(&self, name: &str) -> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> { + EnterpriseEnrollmentTokenDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Issues a command to a device. The Operation resource returned contains a Command in its metadata field. Use the get operation method to get the status of the command. @@ -2279,18 +2504,15 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding allows API services to override the binding to use different resource name schemes, such as users/*/operations. To override the binding, API services can add a binding such as "/v1/{name=users/*}/operations" to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id. + /// Gets a web app. /// /// # Arguments /// - /// * `name` - The name of the operation's parent resource. - pub fn devices_operations_list(&self, name: &str) -> EnterpriseDeviceOperationListCall<'a, C, A> { - EnterpriseDeviceOperationListCall { + /// * `name` - The name of the web app in the form enterprises/{enterpriseId}/webApp/{packageName}. + pub fn web_apps_get(&self, name: &str) -> EnterpriseWebAppGetCall<'a, C, A> { + EnterpriseWebAppGetCall { hub: self.hub, _name: name.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _filter: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2299,13 +2521,13 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a policy. + /// Gets a device. /// /// # Arguments /// - /// * `name` - The name of the policy in the form enterprises/{enterpriseId}/policies/{policyId}. - pub fn policies_get(&self, name: &str) -> EnterprisePolicyGetCall<'a, C, A> { - EnterprisePolicyGetCall { + /// * `name` - The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}. + pub fn devices_get(&self, name: &str) -> EnterpriseDeviceGetCall<'a, C, A> { + EnterpriseDeviceGetCall { hub: self.hub, _name: name.to_string(), _delegate: Default::default(), @@ -2313,6 +2535,41 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Gets an enterprise. + /// + /// # Arguments + /// + /// * `name` - The name of the enterprise in the form enterprises/{enterpriseId}. + pub fn get(&self, name: &str) -> EnterpriseGetCall<'a, C, A> { + EnterpriseGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets info about an application. + /// + /// # Arguments + /// + /// * `name` - The name of the application in the form enterprises/{enterpriseId}/applications/{package_name}. + pub fn applications_get(&self, name: &str) -> EnterpriseApplicationGetCall<'a, C, A> { + EnterpriseApplicationGetCall { + hub: self.hub, + _name: name.to_string(), + _language_code: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -2408,10 +2665,7 @@ impl<'a, C, A> SignupUrlCreateCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2431,7 +2685,7 @@ impl<'a, C, A> SignupUrlCreateCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2513,7 +2767,7 @@ impl<'a, C, A> SignupUrlCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2561,9 +2815,9 @@ impl<'a, C, A> SignupUrlCreateCall<'a, C, A> where C: BorrowMut, } -/// Gets info about an application. +/// Lists policies for a given enterprise. /// -/// A builder for the *applications.get* method supported by a *enterprise* resource. +/// A builder for the *policies.list* method supported by a *enterprise* resource. /// It is not used directly, but through a `EnterpriseMethods` instance. /// /// # Example @@ -2588,276 +2842,13 @@ impl<'a, C, A> SignupUrlCreateCall<'a, C, A> where C: BorrowMut, /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().applications_get("name") -/// .language_code("labore") +/// let result = hub.enterprises().policies_list("parent") +/// .page_token("labore") +/// .page_size(-9) /// .doit(); /// # } /// ``` -pub struct EnterpriseApplicationGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidManagement, - _name: String, - _language_code: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EnterpriseApplicationGetCall<'a, C, A> {} - -impl<'a, C, A> EnterpriseApplicationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Application)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.applications.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._language_code { - params.push(("languageCode", value.to_string())); - } - for &field in ["alt", "name", "languageCode"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The name of the application in the form enterprises/{enterpriseId}/applications/{package_name}. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> EnterpriseApplicationGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The preferred language for localized application info, as a BCP47 tag (e.g. "en-US", "de"). If not specified the default language of the application will be used. - /// - /// Sets the *language code* query property to the given value. - pub fn language_code(mut self, new_value: &str) -> EnterpriseApplicationGetCall<'a, C, A> { - self._language_code = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseApplicationGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> EnterpriseApplicationGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EnterpriseApplicationGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists devices for a given enterprise. -/// -/// A builder for the *devices.list* method supported by a *enterprise* resource. -/// It is not used directly, but through a `EnterpriseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidmanagement1 as androidmanagement1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidmanagement1::AndroidManagement; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().devices_list("parent") -/// .page_token("nonumy") -/// .page_size(-19) -/// .doit(); -/// # } -/// ``` -pub struct EnterpriseDeviceListCall<'a, C, A> +pub struct EnterprisePolicyListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AndroidManagement, @@ -2869,13 +2860,13 @@ pub struct EnterpriseDeviceListCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for EnterpriseDeviceListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for EnterprisePolicyListCall<'a, C, A> {} -impl<'a, C, A> EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> EnterprisePolicyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListDevicesResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListPoliciesResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -2884,7 +2875,7 @@ impl<'a, C, A> EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.list", + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.policies.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); @@ -2906,7 +2897,7 @@ impl<'a, C, A> EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2959,7 +2947,7 @@ impl<'a, C, A> EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut EnterpriseDeviceListCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> EnterprisePolicyListCall<'a, C, A> { self._parent = new_value.to_string(); self } /// A token identifying a page of results returned by the server. /// /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> EnterpriseDeviceListCall<'a, C, A> { + pub fn page_token(mut self, new_value: &str) -> EnterprisePolicyListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } /// The requested page size. The actual page size may be fixed to a min or max value. /// /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> EnterpriseDeviceListCall<'a, C, A> { + pub fn page_size(mut self, new_value: i32) -> EnterprisePolicyListCall<'a, C, A> { self._page_size = Some(new_value); self } @@ -3042,7 +3030,7 @@ impl<'a, C, A> EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut EnterpriseDeviceListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterprisePolicyListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -3051,7 +3039,7 @@ impl<'a, C, A> EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> EnterpriseDeviceListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> EnterprisePolicyListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -3087,7 +3075,7 @@ impl<'a, C, A> EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EnterpriseDeviceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterprisePolicyListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -3099,303 +3087,9 @@ impl<'a, C, A> EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Device::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().devices_patch(req, "name") -/// .update_mask("sadipscing") -/// .doit(); -/// # } -/// ``` -pub struct EnterpriseDevicePatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidManagement, - _request: Device, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EnterpriseDevicePatchCall<'a, C, A> {} - -impl<'a, C, A> EnterpriseDevicePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Device)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Device) -> EnterpriseDevicePatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> EnterpriseDevicePatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The field mask indicating the fields to update. If not set, all modifiable fields will be modified. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> EnterpriseDevicePatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseDevicePatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> EnterpriseDevicePatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EnterpriseDevicePatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a device. -/// -/// A builder for the *devices.get* method supported by a *enterprise* resource. +/// A builder for the *webApps.delete* method supported by a *enterprise* resource. /// It is not used directly, but through a `EnterpriseMethods` instance. /// /// # Example @@ -3420,11 +3114,11 @@ impl<'a, C, A> EnterpriseDevicePatchCall<'a, C, A> where C: BorrowMut +pub struct EnterpriseWebAppDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AndroidManagement, @@ -3434,13 +3128,13 @@ pub struct EnterpriseDeviceGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for EnterpriseDeviceGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for EnterpriseWebAppDeleteCall<'a, C, A> {} -impl<'a, C, A> EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> EnterpriseWebAppDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Device)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -3449,8 +3143,8 @@ impl<'a, C, A> EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.get", - http_method: hyper::method::Method::Get }); + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.webApps.delete", + http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); for &field in ["alt", "name"].iter() { @@ -3479,7 +3173,7 @@ impl<'a, C, A> EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3518,7 +3209,7 @@ impl<'a, C, A> EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> EnterpriseWebAppDeleteCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -3587,7 +3278,7 @@ impl<'a, C, A> EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseWebAppDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -3596,7 +3287,7 @@ impl<'a, C, A> EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> EnterpriseDeviceGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> EnterpriseWebAppDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -3632,7 +3323,7 @@ impl<'a, C, A> EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EnterpriseDeviceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseWebAppDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -3678,7 +3369,7 @@ impl<'a, C, A> EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut EnterprisePolicyPatchCall<'a, C, A> where C: BorrowMut EnterprisePolicyPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3793,7 +3481,7 @@ impl<'a, C, A> EnterprisePolicyPatchCall<'a, C, A> where C: BorrowMut EnterprisePolicyPatchCall<'a, C, A> where C: BorrowMut EnterprisePolicyPatchCall<'a, C, A> where C: BorrowMut EnterpriseCreateCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4070,7 +3755,7 @@ impl<'a, C, A> EnterpriseCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4171,7 +3856,7 @@ impl<'a, C, A> EnterpriseCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4219,9 +3904,9 @@ impl<'a, C, A> EnterpriseCreateCall<'a, C, A> where C: BorrowMut, } -/// Updates an enterprise. +/// Creates a web app. /// -/// A builder for the *patch* method supported by a *enterprise* resource. +/// A builder for the *webApps.create* method supported by a *enterprise* resource. /// It is not used directly, but through a `EnterpriseMethods` instance. /// /// # Example @@ -4233,7 +3918,7 @@ impl<'a, C, A> EnterpriseCreateCall<'a, C, A> where C: BorrowMut, /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_androidmanagement1 as androidmanagement1; -/// use androidmanagement1::Enterprise; +/// use androidmanagement1::WebApp; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -4247,829 +3932,33 @@ impl<'a, C, A> EnterpriseCreateCall<'a, C, A> where C: BorrowMut, /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = Enterprise::default(); +/// let mut req = WebApp::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().patch(req, "name") -/// .update_mask("diam") +/// let result = hub.enterprises().web_apps_create(req, "parent") /// .doit(); /// # } /// ``` -pub struct EnterprisePatchCall<'a, C, A> +pub struct EnterpriseWebAppCreateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AndroidManagement, - _request: Enterprise, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EnterprisePatchCall<'a, C, A> {} - -impl<'a, C, A> EnterprisePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Enterprise)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Enterprise) -> EnterprisePatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The name of the enterprise in the form enterprises/{enterpriseId}. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> EnterprisePatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The field mask indicating the fields to update. If not set, all modifiable fields will be modified. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> EnterprisePatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterprisePatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> EnterprisePatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EnterprisePatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED. -/// -/// A builder for the *devices.operations.cancel* method supported by a *enterprise* resource. -/// It is not used directly, but through a `EnterpriseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidmanagement1 as androidmanagement1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidmanagement1::AndroidManagement; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().devices_operations_cancel("name") -/// .doit(); -/// # } -/// ``` -pub struct EnterpriseDeviceOperationCancelCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidManagement, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EnterpriseDeviceOperationCancelCall<'a, C, A> {} - -impl<'a, C, A> EnterpriseDeviceOperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.operations.cancel", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The name of the operation resource to be cancelled. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> EnterpriseDeviceOperationCancelCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseDeviceOperationCancelCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> EnterpriseDeviceOperationCancelCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EnterpriseDeviceOperationCancelCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets an enterprise. -/// -/// A builder for the *get* method supported by a *enterprise* resource. -/// It is not used directly, but through a `EnterpriseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidmanagement1 as androidmanagement1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidmanagement1::AndroidManagement; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().get("name") -/// .doit(); -/// # } -/// ``` -pub struct EnterpriseGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidManagement, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EnterpriseGetCall<'a, C, A> {} - -impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Enterprise)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The name of the enterprise in the form enterprises/{enterpriseId}. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> EnterpriseGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> EnterpriseGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EnterpriseGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a web token to access an embeddable managed Google Play web UI for a given enterprise. -/// -/// A builder for the *webTokens.create* method supported by a *enterprise* resource. -/// It is not used directly, but through a `EnterpriseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidmanagement1 as androidmanagement1; -/// use androidmanagement1::WebToken; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidmanagement1::AndroidManagement; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = WebToken::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().web_tokens_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct EnterpriseWebTokenCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidManagement, - _request: WebToken, + _request: WebApp, _parent: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for EnterpriseWebTokenCreateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for EnterpriseWebAppCreateCall<'a, C, A> {} -impl<'a, C, A> EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> EnterpriseWebAppCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, WebToken)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, WebApp)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -5078,7 +3967,7 @@ impl<'a, C, A> EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.webTokens.create", + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.webApps.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); @@ -5094,7 +3983,7 @@ impl<'a, C, A> EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5159,7 +4045,7 @@ impl<'a, C, A> EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut EnterpriseWebTokenCreateCall<'a, C, A> { + pub fn request(mut self, new_value: WebApp) -> EnterpriseWebAppCreateCall<'a, C, A> { self._request = new_value; self } @@ -5230,7 +4116,7 @@ impl<'a, C, A> EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut EnterpriseWebTokenCreateCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> EnterpriseWebAppCreateCall<'a, C, A> { self._parent = new_value.to_string(); self } @@ -5240,7 +4126,7 @@ impl<'a, C, A> EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut EnterpriseWebTokenCreateCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseWebAppCreateCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -5249,7 +4135,7 @@ impl<'a, C, A> EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> EnterpriseWebTokenCreateCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> EnterpriseWebAppCreateCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -5285,7 +4171,7 @@ impl<'a, C, A> EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EnterpriseWebTokenCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseWebAppCreateCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -5390,7 +4276,7 @@ impl<'a, C, A> EnterpriseEnrollmentTokenCreateCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5406,10 +4292,7 @@ impl<'a, C, A> EnterpriseEnrollmentTokenCreateCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5441,7 +4324,7 @@ impl<'a, C, A> EnterpriseEnrollmentTokenCreateCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5531,7 +4414,7 @@ impl<'a, C, A> EnterpriseEnrollmentTokenCreateCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5579,9 +4462,9 @@ impl<'a, C, A> EnterpriseEnrollmentTokenCreateCall<'a, C, A> where C: BorrowMut< } -/// Deletes an enrollment token. This operation invalidates the token, preventing its future use. +/// Lists web apps for a given enterprise. /// -/// A builder for the *enrollmentTokens.delete* method supported by a *enterprise* resource. +/// A builder for the *webApps.list* method supported by a *enterprise* resource. /// It is not used directly, but through a `EnterpriseMethods` instance. /// /// # Example @@ -5606,264 +4489,13 @@ impl<'a, C, A> EnterpriseEnrollmentTokenCreateCall<'a, C, A> where C: BorrowMut< /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().enrollment_tokens_delete("name") +/// let result = hub.enterprises().web_apps_list("parent") +/// .page_token("et") +/// .page_size(-17) /// .doit(); /// # } /// ``` -pub struct EnterpriseEnrollmentTokenDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidManagement, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EnterpriseEnrollmentTokenDeleteCall<'a, C, A> {} - -impl<'a, C, A> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.enrollmentTokens.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The name of the enrollment token in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists policies for a given enterprise. -/// -/// A builder for the *policies.list* method supported by a *enterprise* resource. -/// It is not used directly, but through a `EnterpriseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidmanagement1 as androidmanagement1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidmanagement1::AndroidManagement; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().policies_list("parent") -/// .page_token("Lorem") -/// .page_size(-75) -/// .doit(); -/// # } -/// ``` -pub struct EnterprisePolicyListCall<'a, C, A> +pub struct EnterpriseWebAppListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AndroidManagement, @@ -5875,13 +4507,13 @@ pub struct EnterprisePolicyListCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for EnterprisePolicyListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for EnterpriseWebAppListCall<'a, C, A> {} -impl<'a, C, A> EnterprisePolicyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> EnterpriseWebAppListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListPoliciesResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListWebAppsResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -5890,7 +4522,7 @@ impl<'a, C, A> EnterprisePolicyListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.policies.list", + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.webApps.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); @@ -5912,7 +4544,7 @@ impl<'a, C, A> EnterprisePolicyListCall<'a, C, A> where C: BorrowMut EnterprisePolicyListCall<'a, C, A> where C: BorrowMut EnterprisePolicyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5965,7 +4594,7 @@ impl<'a, C, A> EnterprisePolicyListCall<'a, C, A> where C: BorrowMut EnterprisePolicyListCall<'a, C, A> where C: BorrowMut EnterprisePolicyListCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> EnterpriseWebAppListCall<'a, C, A> { self._parent = new_value.to_string(); self } /// A token identifying a page of results returned by the server. /// /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> EnterprisePolicyListCall<'a, C, A> { + pub fn page_token(mut self, new_value: &str) -> EnterpriseWebAppListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } /// The requested page size. The actual page size may be fixed to a min or max value. /// /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> EnterprisePolicyListCall<'a, C, A> { + pub fn page_size(mut self, new_value: i32) -> EnterpriseWebAppListCall<'a, C, A> { self._page_size = Some(new_value); self } @@ -6048,7 +4677,7 @@ impl<'a, C, A> EnterprisePolicyListCall<'a, C, A> where C: BorrowMut EnterprisePolicyListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseWebAppListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -6057,7 +4686,7 @@ impl<'a, C, A> EnterprisePolicyListCall<'a, C, A> where C: BorrowMut EnterprisePolicyListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> EnterprisePolicyListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> EnterpriseWebAppListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -6093,7 +4722,279 @@ impl<'a, C, A> EnterprisePolicyListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EnterprisePolicyListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseWebAppListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists devices for a given enterprise. +/// +/// A builder for the *devices.list* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().devices_list("parent") +/// .page_token("ipsum") +/// .page_size(-5) +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseDeviceListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseDeviceListCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseDeviceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListDevicesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/devices"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the enterprise in the form enterprises/{enterpriseId}. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> EnterpriseDeviceListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A token identifying a page of results returned by the server. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> EnterpriseDeviceListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The requested page size. The actual page size may be fixed to a min or max value. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> EnterpriseDeviceListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseDeviceListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterpriseDeviceListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseDeviceListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -6191,7 +5092,7 @@ impl<'a, C, A> EnterprisePolicyDeleteCall<'a, C, A> where C: BorrowMut EnterprisePolicyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6230,7 +5128,7 @@ impl<'a, C, A> EnterprisePolicyDeleteCall<'a, C, A> where C: BorrowMut EnterprisePolicyDeleteCall<'a, C, A> where C: BorrowMut EnterprisePolicyDeleteCall<'a, C, A> where C: BorrowMut EnterprisePolicyDeleteCall<'a, C, A> where C: BorrowMut +pub struct EnterpriseDeviceOperationCancelCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AndroidManagement, @@ -6397,13 +5295,13 @@ pub struct EnterpriseDeviceOperationGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for EnterpriseDeviceOperationGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for EnterpriseDeviceOperationCancelCall<'a, C, A> {} -impl<'a, C, A> EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> EnterpriseDeviceOperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -6412,8 +5310,8 @@ impl<'a, C, A> EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.operations.get", - http_method: hyper::method::Method::Get }); + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.operations.cancel", + http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); for &field in ["alt", "name"].iter() { @@ -6428,7 +5326,7 @@ impl<'a, C, A> EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6481,7 +5376,7 @@ impl<'a, C, A> EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceOperationGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> EnterpriseDeviceOperationCancelCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -6550,7 +5445,7 @@ impl<'a, C, A> EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceOperationGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseDeviceOperationCancelCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -6559,7 +5454,7 @@ impl<'a, C, A> EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> EnterpriseDeviceOperationGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> EnterpriseDeviceOperationCancelCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -6595,7 +5490,7 @@ impl<'a, C, A> EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EnterpriseDeviceOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseDeviceOperationCancelCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -6693,7 +5588,7 @@ impl<'a, C, A> EnterpriseDeviceOperationDeleteCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6709,10 +5604,7 @@ impl<'a, C, A> EnterpriseDeviceOperationDeleteCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6732,7 +5624,7 @@ impl<'a, C, A> EnterpriseDeviceOperationDeleteCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6810,7 +5702,7 @@ impl<'a, C, A> EnterpriseDeviceOperationDeleteCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6858,6 +5750,2186 @@ impl<'a, C, A> EnterpriseDeviceOperationDeleteCall<'a, C, A> where C: BorrowMut< } +/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. +/// +/// A builder for the *devices.operations.get* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().devices_operations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseDeviceOperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseDeviceOperationGetCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseDeviceOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> EnterpriseDeviceOperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseDeviceOperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterpriseDeviceOperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseDeviceOperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding allows API services to override the binding to use different resource name schemes, such as users/*/operations. To override the binding, API services can add a binding such as "/v1/{name=users/*}/operations" to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id. +/// +/// A builder for the *devices.operations.list* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().devices_operations_list("name") +/// .page_token("eos") +/// .page_size(-81) +/// .filter("sadipscing") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseDeviceOperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseDeviceOperationListCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseDeviceOperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation's parent resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> EnterpriseDeviceOperationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> EnterpriseDeviceOperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> EnterpriseDeviceOperationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> EnterpriseDeviceOperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseDeviceOperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterpriseDeviceOperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseDeviceOperationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a device. +/// +/// A builder for the *devices.patch* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// use androidmanagement1::Device; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Device::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().devices_patch(req, "name") +/// .update_mask("eirmod") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseDevicePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _request: Device, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseDevicePatchCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseDevicePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Device)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Device) -> EnterpriseDevicePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> EnterpriseDevicePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The field mask indicating the fields to update. If not set, all modifiable fields will be modified. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> EnterpriseDevicePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseDevicePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterpriseDevicePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseDevicePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an enterprise. +/// +/// A builder for the *patch* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// use androidmanagement1::Enterprise; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Enterprise::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().patch(req, "name") +/// .update_mask("amet") +/// .doit(); +/// # } +/// ``` +pub struct EnterprisePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _request: Enterprise, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterprisePatchCall<'a, C, A> {} + +impl<'a, C, A> EnterprisePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Enterprise)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Enterprise) -> EnterprisePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the enterprise in the form enterprises/{enterpriseId}. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> EnterprisePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The field mask indicating the fields to update. If not set, all modifiable fields will be modified. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> EnterprisePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterprisePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterprisePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterprisePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a policy. +/// +/// A builder for the *policies.get* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().policies_get("name") +/// .doit(); +/// # } +/// ``` +pub struct EnterprisePolicyGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterprisePolicyGetCall<'a, C, A> {} + +impl<'a, C, A> EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.policies.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the policy in the form enterprises/{enterpriseId}/policies/{policyId}. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> EnterprisePolicyGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterprisePolicyGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterprisePolicyGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterprisePolicyGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a web token to access an embeddable managed Google Play web UI for a given enterprise. +/// +/// A builder for the *webTokens.create* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// use androidmanagement1::WebToken; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = WebToken::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().web_tokens_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseWebTokenCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _request: WebToken, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseWebTokenCreateCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseWebTokenCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, WebToken)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.webTokens.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/webTokens"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: WebToken) -> EnterpriseWebTokenCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the enterprise in the form enterprises/{enterpriseId}. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> EnterpriseWebTokenCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseWebTokenCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterpriseWebTokenCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseWebTokenCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a web app. +/// +/// A builder for the *webApps.patch* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// use androidmanagement1::WebApp; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = WebApp::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().web_apps_patch(req, "name") +/// .update_mask("dolore") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseWebAppPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _request: WebApp, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseWebAppPatchCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseWebAppPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, WebApp)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.webApps.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: WebApp) -> EnterpriseWebAppPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> EnterpriseWebAppPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The field mask indicating the fields to update. If not set, all modifiable fields will be modified. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> EnterpriseWebAppPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseWebAppPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterpriseWebAppPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseWebAppPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an enrollment token. This operation invalidates the token, preventing its future use. +/// +/// A builder for the *enrollmentTokens.delete* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().enrollment_tokens_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseEnrollmentTokenDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseEnrollmentTokenDeleteCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.enrollmentTokens.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the enrollment token in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseEnrollmentTokenDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Issues a command to a device. The Operation resource returned contains a Command in its metadata field. Use the get operation method to get the status of the command. /// /// A builder for the *devices.issueCommand* method supported by a *enterprise* resource. @@ -6951,7 +8023,7 @@ impl<'a, C, A> EnterpriseDeviceIssueCommandCall<'a, C, A> where C: BorrowMut EnterpriseDeviceIssueCommandCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7002,7 +8071,7 @@ impl<'a, C, A> EnterpriseDeviceIssueCommandCall<'a, C, A> where C: BorrowMut EnterpriseDeviceIssueCommandCall<'a, C, A> where C: BorrowMut EnterpriseDeviceIssueCommandCall<'a, C, A> where C: BorrowMut EnterpriseDeviceDeleteCall<'a, C, A> where C: BorrowMut EnterpriseDeviceDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7272,7 +8338,7 @@ impl<'a, C, A> EnterpriseDeviceDeleteCall<'a, C, A> where C: BorrowMut EnterpriseDeviceDeleteCall<'a, C, A> where C: BorrowMut EnterpriseDeviceDeleteCall<'a, C, A> where C: BorrowMut EnterpriseDeviceDeleteCall<'a, C, A> where C: BorrowMut - where C: 'a, A: 'a { - - hub: &'a AndroidManagement, - _name: String, - _page_token: Option, - _page_size: Option, - _filter: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for EnterpriseDeviceOperationListCall<'a, C, A> {} - -impl<'a, C, A> EnterpriseDeviceOperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.operations.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } - for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The name of the operation's parent resource. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> EnterpriseDeviceOperationListCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The standard list page token. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> EnterpriseDeviceOperationListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// The standard list page size. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> EnterpriseDeviceOperationListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The standard list filter. - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> EnterpriseDeviceOperationListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseDeviceOperationListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> EnterpriseDeviceOperationListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> EnterpriseDeviceOperationListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a policy. -/// -/// A builder for the *policies.get* method supported by a *enterprise* resource. -/// It is not used directly, but through a `EnterpriseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidmanagement1 as androidmanagement1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidmanagement1::AndroidManagement; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.enterprises().policies_get("name") -/// .doit(); -/// # } -/// ``` -pub struct EnterprisePolicyGetCall<'a, C, A> +pub struct EnterpriseWebAppGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AndroidManagement, @@ -7734,13 +8513,13 @@ pub struct EnterprisePolicyGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for EnterprisePolicyGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for EnterpriseWebAppGetCall<'a, C, A> {} -impl<'a, C, A> EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> EnterpriseWebAppGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, WebApp)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -7749,7 +8528,7 @@ impl<'a, C, A> EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidmanagement.enterprises.policies.get", + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.webApps.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); @@ -7779,7 +8558,7 @@ impl<'a, C, A> EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7818,7 +8594,7 @@ impl<'a, C, A> EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut EnterprisePolicyGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> EnterpriseWebAppGetCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -7887,7 +8663,7 @@ impl<'a, C, A> EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut EnterprisePolicyGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseWebAppGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -7896,7 +8672,7 @@ impl<'a, C, A> EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> EnterprisePolicyGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> EnterpriseWebAppGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -7932,7 +8708,763 @@ impl<'a, C, A> EnterprisePolicyGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EnterprisePolicyGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseWebAppGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a device. +/// +/// A builder for the *devices.get* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().devices_get("name") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseDeviceGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseDeviceGetCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseDeviceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Device)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.devices.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> EnterpriseDeviceGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseDeviceGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterpriseDeviceGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseDeviceGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets an enterprise. +/// +/// A builder for the *get* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().get("name") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseGetCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Enterprise)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the enterprise in the form enterprises/{enterpriseId}. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> EnterpriseGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterpriseGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets info about an application. +/// +/// A builder for the *applications.get* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidmanagement1 as androidmanagement1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidmanagement1::AndroidManagement; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = AndroidManagement::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.enterprises().applications_get("name") +/// .language_code("eirmod") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseApplicationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidManagement, + _name: String, + _language_code: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseApplicationGetCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseApplicationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Application)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidmanagement.enterprises.applications.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._language_code { + params.push(("languageCode", value.to_string())); + } + for &field in ["alt", "name", "languageCode"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the application in the form enterprises/{enterpriseId}/applications/{package_name}. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> EnterpriseApplicationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The preferred language for localized application info, as a BCP47 tag (e.g. "en-US", "de"). If not specified the default language of the application will be used. + /// + /// Sets the *language code* query property to the given value. + pub fn language_code(mut self, new_value: &str) -> EnterpriseApplicationGetCall<'a, C, A> { + self._language_code = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EnterpriseApplicationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EnterpriseApplicationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EnterpriseApplicationGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { diff --git a/gen/androidpublisher2-cli/Cargo.toml b/gen/androidpublisher2-cli/Cargo.toml index 6136443f2a..e1c7a3e430 100644 --- a/gen/androidpublisher2-cli/Cargo.toml +++ b/gen/androidpublisher2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androidpublisher2-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Publisher (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidpublisher2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-androidpublisher2] path = "../androidpublisher2" -version = "1.0.8+20181009" +version = "1.0.8+20190402" diff --git a/gen/androidpublisher2-cli/README.md b/gen/androidpublisher2-cli/README.md index ea71b4468f..81258d36bc 100644 --- a/gen/androidpublisher2-cli/README.md +++ b/gen/androidpublisher2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Android Publisher* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *Android Publisher* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash androidpublisher2 [options] diff --git a/gen/androidpublisher2-cli/mkdocs.yml b/gen/androidpublisher2-cli/mkdocs.yml index 591b378130..1411bed644 100644 --- a/gen/androidpublisher2-cli/mkdocs.yml +++ b/gen/androidpublisher2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Publisher v1.0.8+20181009 +site_name: Android Publisher v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-androidpublisher2-cli site_description: A complete library to interact with Android Publisher (protocol v2) diff --git a/gen/androidpublisher2-cli/src/main.rs b/gen/androidpublisher2-cli/src/main.rs index 11694273e8..b365aae62b 100644 --- a/gen/androidpublisher2-cli/src/main.rs +++ b/gen/androidpublisher2-cli/src/main.rs @@ -6036,7 +6036,7 @@ fn main() { let mut app = App::new("androidpublisher2") .author("Sebastian Thiel ") - .version("1.0.8+20181009") + .version("1.0.8+20190402") .about("Accesses Android application developers' Google Play accounts.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli") .arg(Arg::with_name("url") diff --git a/gen/androidpublisher2/Cargo.toml b/gen/androidpublisher2/Cargo.toml index 61b3c00aa6..5ab915bb48 100644 --- a/gen/androidpublisher2/Cargo.toml +++ b/gen/androidpublisher2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-androidpublisher2" -version = "1.0.8+20181009" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Publisher (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidpublisher2" homepage = "https://developers.google.com/android-publisher" -documentation = "https://docs.rs/google-androidpublisher2/1.0.8+20181009" +documentation = "https://docs.rs/google-androidpublisher2/1.0.8+20190402" license = "MIT" keywords = ["androidpublisher", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/androidpublisher2/README.md b/gen/androidpublisher2/README.md index adf037525f..608ef92039 100644 --- a/gen/androidpublisher2/README.md +++ b/gen/androidpublisher2/README.md @@ -5,33 +5,33 @@ DO NOT EDIT ! --> The `google-androidpublisher2` library allows access to all features of the *Google Android Publisher* service. -This documentation was generated from *Android Publisher* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Android Publisher* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Android Publisher* *v2* API can be found at the [official documentation site](https://developers.google.com/android-publisher). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.AndroidPublisher.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.AndroidPublisher.html) ... * edits - * [*apklistings delete*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditApklistingDeleteCall.html), [*apklistings deleteall*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditApklistingDeleteallCall.html), [*apklistings get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditApklistingGetCall.html), [*apklistings list*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditApklistingListCall.html), [*apklistings patch*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditApklistingPatchCall.html), [*apklistings update*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditApklistingUpdateCall.html), [*apks addexternallyhosted*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditApkAddexternallyhostedCall.html), [*apks list*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditApkListCall.html), [*apks upload*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditApkUploadCall.html), [*bundles list*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditBundleListCall.html), [*bundles upload*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditBundleUploadCall.html), [*commit*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditCommitCall.html), [*delete*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditDeleteCall.html), [*deobfuscationfiles upload*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditDeobfuscationfileUploadCall.html), [*details get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditDetailGetCall.html), [*details patch*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditDetailPatchCall.html), [*details update*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditDetailUpdateCall.html), [*expansionfiles get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditExpansionfileGetCall.html), [*expansionfiles patch*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditExpansionfilePatchCall.html), [*expansionfiles update*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditExpansionfileUpdateCall.html), [*expansionfiles upload*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditExpansionfileUploadCall.html), [*get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditGetCall.html), [*images delete*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditImageDeleteCall.html), [*images deleteall*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditImageDeleteallCall.html), [*images list*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditImageListCall.html), [*images upload*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditImageUploadCall.html), [*insert*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditInsertCall.html), [*listings delete*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditListingDeleteCall.html), [*listings deleteall*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditListingDeleteallCall.html), [*listings get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditListingGetCall.html), [*listings list*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditListingListCall.html), [*listings patch*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditListingPatchCall.html), [*listings update*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditListingUpdateCall.html), [*testers get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditTesterGetCall.html), [*testers patch*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditTesterPatchCall.html), [*testers update*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditTesterUpdateCall.html), [*tracks get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditTrackGetCall.html), [*tracks list*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditTrackListCall.html), [*tracks patch*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditTrackPatchCall.html), [*tracks update*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditTrackUpdateCall.html) and [*validate*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditValidateCall.html) + * [*apklistings delete*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditApklistingDeleteCall.html), [*apklistings deleteall*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditApklistingDeleteallCall.html), [*apklistings get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditApklistingGetCall.html), [*apklistings list*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditApklistingListCall.html), [*apklistings patch*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditApklistingPatchCall.html), [*apklistings update*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditApklistingUpdateCall.html), [*apks addexternallyhosted*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditApkAddexternallyhostedCall.html), [*apks list*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditApkListCall.html), [*apks upload*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditApkUploadCall.html), [*bundles list*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditBundleListCall.html), [*bundles upload*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditBundleUploadCall.html), [*commit*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditCommitCall.html), [*delete*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditDeleteCall.html), [*deobfuscationfiles upload*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditDeobfuscationfileUploadCall.html), [*details get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditDetailGetCall.html), [*details patch*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditDetailPatchCall.html), [*details update*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditDetailUpdateCall.html), [*expansionfiles get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditExpansionfileGetCall.html), [*expansionfiles patch*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditExpansionfilePatchCall.html), [*expansionfiles update*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditExpansionfileUpdateCall.html), [*expansionfiles upload*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditExpansionfileUploadCall.html), [*get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditGetCall.html), [*images delete*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditImageDeleteCall.html), [*images deleteall*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditImageDeleteallCall.html), [*images list*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditImageListCall.html), [*images upload*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditImageUploadCall.html), [*insert*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditInsertCall.html), [*listings delete*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditListingDeleteCall.html), [*listings deleteall*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditListingDeleteallCall.html), [*listings get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditListingGetCall.html), [*listings list*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditListingListCall.html), [*listings patch*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditListingPatchCall.html), [*listings update*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditListingUpdateCall.html), [*testers get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditTesterGetCall.html), [*testers patch*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditTesterPatchCall.html), [*testers update*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditTesterUpdateCall.html), [*tracks get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditTrackGetCall.html), [*tracks list*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditTrackListCall.html), [*tracks patch*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditTrackPatchCall.html), [*tracks update*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditTrackUpdateCall.html) and [*validate*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditValidateCall.html) * inappproducts - * [*delete*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.InappproductDeleteCall.html), [*get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.InappproductGetCall.html), [*insert*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.InappproductInsertCall.html), [*list*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.InappproductListCall.html), [*patch*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.InappproductPatchCall.html) and [*update*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.InappproductUpdateCall.html) + * [*delete*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.InappproductDeleteCall.html), [*get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.InappproductGetCall.html), [*insert*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.InappproductInsertCall.html), [*list*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.InappproductListCall.html), [*patch*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.InappproductPatchCall.html) and [*update*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.InappproductUpdateCall.html) * orders - * [*refund*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.OrderRefundCall.html) + * [*refund*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.OrderRefundCall.html) * purchases - * [*products get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.PurchaseProductGetCall.html), [*subscriptions cancel*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.PurchaseSubscriptionCancelCall.html), [*subscriptions defer*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.PurchaseSubscriptionDeferCall.html), [*subscriptions get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.PurchaseSubscriptionGetCall.html), [*subscriptions refund*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.PurchaseSubscriptionRefundCall.html), [*subscriptions revoke*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.PurchaseSubscriptionRevokeCall.html) and [*voidedpurchases list*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.PurchaseVoidedpurchaseListCall.html) -* [reviews](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.Review.html) - * [*get*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.ReviewGetCall.html), [*list*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.ReviewListCall.html) and [*reply*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.ReviewReplyCall.html) + * [*products get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.PurchaseProductGetCall.html), [*subscriptions cancel*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.PurchaseSubscriptionCancelCall.html), [*subscriptions defer*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.PurchaseSubscriptionDeferCall.html), [*subscriptions get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.PurchaseSubscriptionGetCall.html), [*subscriptions refund*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.PurchaseSubscriptionRefundCall.html), [*subscriptions revoke*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.PurchaseSubscriptionRevokeCall.html) and [*voidedpurchases list*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.PurchaseVoidedpurchaseListCall.html) +* [reviews](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.Review.html) + * [*get*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.ReviewGetCall.html), [*list*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.ReviewListCall.html) and [*reply*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.ReviewReplyCall.html) Upload supported by ... -* [*deobfuscationfiles upload edits*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditDeobfuscationfileUploadCall.html) -* [*images upload edits*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditImageUploadCall.html) -* [*apks upload edits*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditApkUploadCall.html) -* [*expansionfiles upload edits*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditExpansionfileUploadCall.html) -* [*bundles upload edits*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.EditBundleUploadCall.html) +* [*deobfuscationfiles upload edits*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditDeobfuscationfileUploadCall.html) +* [*images upload edits*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditImageUploadCall.html) +* [*apks upload edits*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditApkUploadCall.html) +* [*expansionfiles upload edits*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditExpansionfileUploadCall.html) +* [*bundles upload edits*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.EditBundleUploadCall.html) @@ -39,17 +39,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/struct.AndroidPublisher.html)** +* **[Hub](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/struct.AndroidPublisher.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.Part.html)** + * **[Parts](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -150,17 +150,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -170,29 +170,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-androidpublisher2/1.0.8+20181009/google_androidpublisher2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-androidpublisher2/1.0.8+20190402/google_androidpublisher2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/androidpublisher2/src/lib.rs b/gen/androidpublisher2/src/lib.rs index d3807e6986..f67fa31b05 100644 --- a/gen/androidpublisher2/src/lib.rs +++ b/gen/androidpublisher2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Android Publisher* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Android Publisher* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Android Publisher* *v2* API can be found at the //! [official documentation site](https://developers.google.com/android-publisher). @@ -760,7 +760,8 @@ pub struct ProductPurchase { pub purchase_state: Option, /// The type of purchase of the inapp product. This field is only set if this purchase was not made using the standard in-app billing flow. Possible values are: /// - Test (i.e. purchased from a license testing account) - /// - Promo (i.e. purchased using a promo code) + /// - Promo (i.e. purchased using a promo code) + /// - Rewarded (i.e. from watching a video ad instead of paying) #[serde(rename="purchaseType")] pub purchase_type: Option, } @@ -3241,10 +3242,7 @@ impl<'a, C, A> ReviewReplyCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3276,7 +3274,7 @@ impl<'a, C, A> ReviewReplyCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3375,7 +3373,7 @@ impl<'a, C, A> ReviewReplyCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3524,10 +3522,7 @@ impl<'a, C, A> ReviewGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3547,7 +3542,7 @@ impl<'a, C, A> ReviewGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3640,7 +3635,7 @@ impl<'a, C, A> ReviewGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3802,10 +3797,7 @@ impl<'a, C, A> ReviewListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3825,7 +3817,7 @@ impl<'a, C, A> ReviewListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3927,7 +3919,7 @@ impl<'a, C, A> ReviewListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4072,10 +4064,7 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4095,7 +4084,7 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut PurchaseProductGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4352,7 +4338,7 @@ impl<'a, C, A> PurchaseProductGetCall<'a, C, A> where C: BorrowMut PurchaseProductGetCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4619,7 +4602,7 @@ impl<'a, C, A> PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut PurchaseVoidedpurchaseListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4907,7 +4887,7 @@ impl<'a, C, A> PurchaseVoidedpurchaseListCall<'a, C, A> where C: BorrowMut PurchaseVoidedpurchaseListCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5185,7 +5162,7 @@ impl<'a, C, A> PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5441,7 +5415,7 @@ impl<'a, C, A> PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5717,7 +5688,7 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut EditDeobfuscationfileUploadCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -6021,7 +5989,7 @@ impl<'a, C, A> EditDeobfuscationfileUploadCall<'a, C, A> where C: BorrowMut EditDeobfuscationfileUploadCall<'a, C, A> where C: BorrowMut EditImageUploadCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -6408,7 +6373,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -6601,7 +6566,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6756,10 +6721,7 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6791,7 +6753,7 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditDetailGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7077,7 +7036,7 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7165,7 +7124,7 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7312,10 +7271,7 @@ impl<'a, C, A> EditApklistingDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7335,7 +7291,7 @@ impl<'a, C, A> EditApklistingDeleteCall<'a, C, A> where C: BorrowMut EditApklistingDeleteCall<'a, C, A> where C: BorrowMut EditListingDeleteallCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7599,7 +7552,7 @@ impl<'a, C, A> EditListingDeleteallCall<'a, C, A> where C: BorrowMut EditListingDeleteallCall<'a, C, A> where C: BorrowMut EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7863,7 +7813,7 @@ impl<'a, C, A> EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8131,7 +8078,7 @@ impl<'a, C, A> EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut EditDetailUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8405,7 +8349,7 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8505,7 +8449,7 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8651,10 +8595,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8674,7 +8615,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8772,7 +8713,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8927,10 +8868,7 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8962,7 +8900,7 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditImageListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9252,7 +9187,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9359,7 +9294,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9512,10 +9447,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9547,7 +9479,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9657,7 +9589,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9810,10 +9742,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9845,7 +9774,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9955,7 +9884,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10099,10 +10028,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10122,7 +10048,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10210,7 +10136,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10359,10 +10285,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10382,7 +10305,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10489,7 +10412,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10641,10 +10564,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -10677,7 +10597,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -10851,7 +10771,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11006,10 +10926,7 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11041,7 +10958,7 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut EditApklistingUpdateCall<'a, C, A> where C: BorrowMut EditApkListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11326,7 +11240,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11414,7 +11328,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11569,10 +11483,7 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11604,7 +11515,7 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut EditApklistingPatchCall<'a, C, A> where C: BorrowMut EditListingGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11893,7 +11801,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11991,7 +11899,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12133,10 +12041,7 @@ impl<'a, C, A> EditBundleListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12156,7 +12061,7 @@ impl<'a, C, A> EditBundleListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12244,7 +12149,7 @@ impl<'a, C, A> EditBundleListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12387,10 +12292,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12410,7 +12312,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12488,7 +12390,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12646,10 +12548,7 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -12682,7 +12581,7 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13059,7 +12955,7 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13149,7 +13045,7 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13293,10 +13189,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13316,7 +13209,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13404,7 +13297,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13555,10 +13448,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13590,7 +13480,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13700,7 +13590,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13844,10 +13734,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13867,7 +13754,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13955,7 +13842,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14099,10 +13986,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14122,7 +14006,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14210,7 +14094,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14354,10 +14238,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14377,7 +14258,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14475,7 +14356,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14619,10 +14500,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14642,7 +14520,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14730,7 +14608,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14889,10 +14767,7 @@ impl<'a, C, A> EditBundleUploadCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -14925,7 +14800,7 @@ impl<'a, C, A> EditBundleUploadCall<'a, C, A> where C: BorrowMut, }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -15106,7 +14981,7 @@ impl<'a, C, A> EditBundleUploadCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15259,10 +15134,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15294,7 +15166,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15404,7 +15276,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15552,10 +15424,7 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15575,7 +15444,7 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut EditExpansionfileGetCall<'a, C, A> where C: BorrowMut EditImageDeleteallCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15853,7 +15719,7 @@ impl<'a, C, A> EditImageDeleteallCall<'a, C, A> where C: BorrowMut EditImageDeleteallCall<'a, C, A> where C: BorrowMut EditDetailPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16146,7 +16009,7 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16246,7 +16109,7 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16399,10 +16262,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16434,7 +16294,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16544,7 +16404,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16689,10 +16549,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16712,7 +16569,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16800,7 +16657,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16948,10 +16805,7 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16971,7 +16825,7 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17079,7 +16933,7 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17230,10 +17084,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17265,7 +17116,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17375,7 +17226,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17521,10 +17372,7 @@ impl<'a, C, A> EditApklistingListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17544,7 +17392,7 @@ impl<'a, C, A> EditApklistingListCall<'a, C, A> where C: BorrowMut EditApklistingListCall<'a, C, A> where C: BorrowMut OrderRefundCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17813,7 +17658,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17898,7 +17743,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18055,10 +17900,7 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18078,7 +17920,7 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18174,7 +18016,7 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18328,10 +18170,7 @@ impl<'a, C, A> InappproductInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18363,7 +18202,7 @@ impl<'a, C, A> InappproductInsertCall<'a, C, A> where C: BorrowMut InappproductInsertCall<'a, C, A> where C: BorrowMut InappproductDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18626,7 +18462,7 @@ impl<'a, C, A> InappproductDeleteCall<'a, C, A> where C: BorrowMut InappproductDeleteCall<'a, C, A> where C: BorrowMut InappproductGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18871,7 +18704,7 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18958,7 +18791,7 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19114,10 +18947,7 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19149,7 +18979,7 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut InappproductUpdateCall<'a, C, A> where C: BorrowMut InappproductPatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19447,7 +19274,7 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -19554,7 +19381,7 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/androidpublisher3-cli/Cargo.toml b/gen/androidpublisher3-cli/Cargo.toml index d871862ce6..9a3ae3edb4 100644 --- a/gen/androidpublisher3-cli/Cargo.toml +++ b/gen/androidpublisher3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androidpublisher3-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Publisher (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidpublisher3-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-androidpublisher3] path = "../androidpublisher3" -version = "1.0.8+20181009" +version = "1.0.8+20190402" diff --git a/gen/androidpublisher3-cli/README.md b/gen/androidpublisher3-cli/README.md index 2e7fc9227e..d30873d100 100644 --- a/gen/androidpublisher3-cli/README.md +++ b/gen/androidpublisher3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Android Publisher* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *Android Publisher* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash androidpublisher3 [options] diff --git a/gen/androidpublisher3-cli/mkdocs.yml b/gen/androidpublisher3-cli/mkdocs.yml index 91d6a39237..396beadd11 100644 --- a/gen/androidpublisher3-cli/mkdocs.yml +++ b/gen/androidpublisher3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Publisher v1.0.8+20181009 +site_name: Android Publisher v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-androidpublisher3-cli site_description: A complete library to interact with Android Publisher (protocol v3) diff --git a/gen/androidpublisher3-cli/src/main.rs b/gen/androidpublisher3-cli/src/main.rs index ed860f44a1..1c29623820 100644 --- a/gen/androidpublisher3-cli/src/main.rs +++ b/gen/androidpublisher3-cli/src/main.rs @@ -5416,7 +5416,7 @@ fn main() { let mut app = App::new("androidpublisher3") .author("Sebastian Thiel ") - .version("1.0.8+20181009") + .version("1.0.8+20190402") .about("Accesses Android application developers' Google Play accounts.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_androidpublisher3_cli") .arg(Arg::with_name("url") diff --git a/gen/androidpublisher3/Cargo.toml b/gen/androidpublisher3/Cargo.toml index 0451d621dc..f87ee5da68 100644 --- a/gen/androidpublisher3/Cargo.toml +++ b/gen/androidpublisher3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-androidpublisher3" -version = "1.0.8+20181009" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Publisher (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidpublisher3" homepage = "https://developers.google.com/android-publisher" -documentation = "https://docs.rs/google-androidpublisher3/1.0.8+20181009" +documentation = "https://docs.rs/google-androidpublisher3/1.0.8+20190402" license = "MIT" keywords = ["androidpublisher", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/androidpublisher3/README.md b/gen/androidpublisher3/README.md index af40c2676c..dd94267070 100644 --- a/gen/androidpublisher3/README.md +++ b/gen/androidpublisher3/README.md @@ -5,33 +5,33 @@ DO NOT EDIT ! --> The `google-androidpublisher3` library allows access to all features of the *Google Android Publisher* service. -This documentation was generated from *Android Publisher* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *androidpublisher:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Android Publisher* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *androidpublisher:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Android Publisher* *v3* API can be found at the [official documentation site](https://developers.google.com/android-publisher). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.AndroidPublisher.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.AndroidPublisher.html) ... * edits - * [*apks addexternallyhosted*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditApkAddexternallyhostedCall.html), [*apks list*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditApkListCall.html), [*apks upload*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditApkUploadCall.html), [*bundles list*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditBundleListCall.html), [*bundles upload*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditBundleUploadCall.html), [*commit*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditCommitCall.html), [*delete*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditDeleteCall.html), [*deobfuscationfiles upload*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditDeobfuscationfileUploadCall.html), [*details get*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditDetailGetCall.html), [*details patch*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditDetailPatchCall.html), [*details update*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditDetailUpdateCall.html), [*expansionfiles get*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditExpansionfileGetCall.html), [*expansionfiles patch*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditExpansionfilePatchCall.html), [*expansionfiles update*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditExpansionfileUpdateCall.html), [*expansionfiles upload*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditExpansionfileUploadCall.html), [*get*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditGetCall.html), [*images delete*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditImageDeleteCall.html), [*images deleteall*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditImageDeleteallCall.html), [*images list*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditImageListCall.html), [*images upload*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditImageUploadCall.html), [*insert*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditInsertCall.html), [*listings delete*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditListingDeleteCall.html), [*listings deleteall*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditListingDeleteallCall.html), [*listings get*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditListingGetCall.html), [*listings list*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditListingListCall.html), [*listings patch*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditListingPatchCall.html), [*listings update*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditListingUpdateCall.html), [*testers get*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditTesterGetCall.html), [*testers patch*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditTesterPatchCall.html), [*testers update*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditTesterUpdateCall.html), [*tracks get*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditTrackGetCall.html), [*tracks list*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditTrackListCall.html), [*tracks patch*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditTrackPatchCall.html), [*tracks update*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditTrackUpdateCall.html) and [*validate*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditValidateCall.html) + * [*apks addexternallyhosted*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditApkAddexternallyhostedCall.html), [*apks list*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditApkListCall.html), [*apks upload*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditApkUploadCall.html), [*bundles list*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditBundleListCall.html), [*bundles upload*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditBundleUploadCall.html), [*commit*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditCommitCall.html), [*delete*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditDeleteCall.html), [*deobfuscationfiles upload*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditDeobfuscationfileUploadCall.html), [*details get*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditDetailGetCall.html), [*details patch*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditDetailPatchCall.html), [*details update*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditDetailUpdateCall.html), [*expansionfiles get*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditExpansionfileGetCall.html), [*expansionfiles patch*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditExpansionfilePatchCall.html), [*expansionfiles update*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditExpansionfileUpdateCall.html), [*expansionfiles upload*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditExpansionfileUploadCall.html), [*get*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditGetCall.html), [*images delete*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditImageDeleteCall.html), [*images deleteall*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditImageDeleteallCall.html), [*images list*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditImageListCall.html), [*images upload*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditImageUploadCall.html), [*insert*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditInsertCall.html), [*listings delete*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditListingDeleteCall.html), [*listings deleteall*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditListingDeleteallCall.html), [*listings get*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditListingGetCall.html), [*listings list*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditListingListCall.html), [*listings patch*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditListingPatchCall.html), [*listings update*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditListingUpdateCall.html), [*testers get*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditTesterGetCall.html), [*testers patch*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditTesterPatchCall.html), [*testers update*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditTesterUpdateCall.html), [*tracks get*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditTrackGetCall.html), [*tracks list*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditTrackListCall.html), [*tracks patch*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditTrackPatchCall.html), [*tracks update*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditTrackUpdateCall.html) and [*validate*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditValidateCall.html) * inappproducts - * [*delete*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.InappproductDeleteCall.html), [*get*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.InappproductGetCall.html), [*insert*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.InappproductInsertCall.html), [*list*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.InappproductListCall.html), [*patch*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.InappproductPatchCall.html) and [*update*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.InappproductUpdateCall.html) + * [*delete*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.InappproductDeleteCall.html), [*get*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.InappproductGetCall.html), [*insert*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.InappproductInsertCall.html), [*list*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.InappproductListCall.html), [*patch*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.InappproductPatchCall.html) and [*update*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.InappproductUpdateCall.html) * orders - * [*refund*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.OrderRefundCall.html) + * [*refund*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.OrderRefundCall.html) * purchases - * [*products get*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.PurchaseProductGetCall.html), [*subscriptions cancel*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.PurchaseSubscriptionCancelCall.html), [*subscriptions defer*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.PurchaseSubscriptionDeferCall.html), [*subscriptions get*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.PurchaseSubscriptionGetCall.html), [*subscriptions refund*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.PurchaseSubscriptionRefundCall.html), [*subscriptions revoke*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.PurchaseSubscriptionRevokeCall.html) and [*voidedpurchases list*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.PurchaseVoidedpurchaseListCall.html) -* [reviews](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.Review.html) - * [*get*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.ReviewGetCall.html), [*list*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.ReviewListCall.html) and [*reply*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.ReviewReplyCall.html) + * [*products get*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.PurchaseProductGetCall.html), [*subscriptions cancel*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.PurchaseSubscriptionCancelCall.html), [*subscriptions defer*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.PurchaseSubscriptionDeferCall.html), [*subscriptions get*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.PurchaseSubscriptionGetCall.html), [*subscriptions refund*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.PurchaseSubscriptionRefundCall.html), [*subscriptions revoke*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.PurchaseSubscriptionRevokeCall.html) and [*voidedpurchases list*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.PurchaseVoidedpurchaseListCall.html) +* [reviews](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.Review.html) + * [*get*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.ReviewGetCall.html), [*list*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.ReviewListCall.html) and [*reply*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.ReviewReplyCall.html) Upload supported by ... -* [*deobfuscationfiles upload edits*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditDeobfuscationfileUploadCall.html) -* [*images upload edits*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditImageUploadCall.html) -* [*apks upload edits*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditApkUploadCall.html) -* [*expansionfiles upload edits*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditExpansionfileUploadCall.html) -* [*bundles upload edits*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.EditBundleUploadCall.html) +* [*deobfuscationfiles upload edits*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditDeobfuscationfileUploadCall.html) +* [*images upload edits*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditImageUploadCall.html) +* [*apks upload edits*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditApkUploadCall.html) +* [*expansionfiles upload edits*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditExpansionfileUploadCall.html) +* [*bundles upload edits*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.EditBundleUploadCall.html) @@ -39,17 +39,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/struct.AndroidPublisher.html)** +* **[Hub](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/struct.AndroidPublisher.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.Part.html)** + * **[Parts](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -150,17 +150,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -170,29 +170,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-androidpublisher3/1.0.8+20181009/google_androidpublisher3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-androidpublisher3/1.0.8+20190402/google_androidpublisher3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/androidpublisher3/src/lib.rs b/gen/androidpublisher3/src/lib.rs index 84f360c04e..3474161a68 100644 --- a/gen/androidpublisher3/src/lib.rs +++ b/gen/androidpublisher3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Android Publisher* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *androidpublisher:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Android Publisher* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *androidpublisher:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Android Publisher* *v3* API can be found at the //! [official documentation site](https://developers.google.com/android-publisher). @@ -450,9 +450,6 @@ impl RequestValue for SubscriptionPurchasesDeferRequest {} pub struct TrackRelease { /// The desired status of this release. pub status: Option, - /// The description of what is new in the app in this release. - #[serde(rename="releaseNotes")] - pub release_notes: Option>, /// Fraction of users who are eligible to receive the release. 0 < fraction < 1. To be set, release status must be "inProgress" or "halted". #[serde(rename="userFraction")] pub user_fraction: Option, @@ -461,6 +458,12 @@ pub struct TrackRelease { /// A list of all version codes of APKs that will be exposed to the users of this track when this release is rolled out. Note that this list should contain all versions you wish to be active, including those you wish to retain from previous releases. #[serde(rename="versionCodes")] pub version_codes: Option>, + /// The description of what is new in the app in this release. + #[serde(rename="releaseNotes")] + pub release_notes: Option>, + /// no description provided + #[serde(rename="countryTargeting")] + pub country_targeting: Option, } impl Part for TrackRelease {} @@ -784,7 +787,8 @@ pub struct ProductPurchase { pub purchase_state: Option, /// The type of purchase of the inapp product. This field is only set if this purchase was not made using the standard in-app billing flow. Possible values are: /// - Test (i.e. purchased from a license testing account) - /// - Promo (i.e. purchased using a promo code) + /// - Promo (i.e. purchased using a promo code) + /// - Rewarded (i.e. from watching a video ad instead of paying) #[serde(rename="purchaseType")] pub purchase_type: Option, } @@ -916,6 +920,22 @@ pub struct Bundle { impl ResponseResult for Bundle {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CountryTargeting { + /// no description provided + #[serde(rename="includeRestOfWorld")] + pub include_rest_of_world: Option, + /// no description provided + pub countries: Option>, +} + +impl Part for CountryTargeting {} + + /// Defines an APK available for this application that is hosted externally and not uploaded to Google Play. This function is only available to enterprises who are using Google Play for Work, and whos application is restricted to the enterprise private channel /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1401,6 +1421,9 @@ pub struct SubscriptionPurchase { /// ISO 4217 currency code for the subscription price. For example, if the price is specified in British pounds sterling, price_currency_code is "GBP". #[serde(rename="priceCurrencyCode")] pub price_currency_code: Option, + /// Time at which the subscription will be automatically resumed, in milliseconds since the Epoch. Only present if the user has requested to pause the subscription. + #[serde(rename="autoResumeTimeMillis")] + pub auto_resume_time_millis: Option, /// Time at which the subscription will expire, in milliseconds since the Epoch. #[serde(rename="expiryTimeMillis")] pub expiry_time_millis: Option, @@ -3094,10 +3117,7 @@ impl<'a, C, A> ReviewReplyCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3129,7 +3149,7 @@ impl<'a, C, A> ReviewReplyCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3228,7 +3248,7 @@ impl<'a, C, A> ReviewReplyCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3377,10 +3397,7 @@ impl<'a, C, A> ReviewGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3400,7 +3417,7 @@ impl<'a, C, A> ReviewGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3493,7 +3510,7 @@ impl<'a, C, A> ReviewGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3655,10 +3672,7 @@ impl<'a, C, A> ReviewListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3678,7 +3692,7 @@ impl<'a, C, A> ReviewListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3780,7 +3794,7 @@ impl<'a, C, A> ReviewListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3925,10 +3939,7 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3948,7 +3959,7 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut PurchaseProductGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4205,7 +4213,7 @@ impl<'a, C, A> PurchaseProductGetCall<'a, C, A> where C: BorrowMut PurchaseProductGetCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4472,7 +4477,7 @@ impl<'a, C, A> PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut PurchaseVoidedpurchaseListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4760,7 +4762,7 @@ impl<'a, C, A> PurchaseVoidedpurchaseListCall<'a, C, A> where C: BorrowMut PurchaseVoidedpurchaseListCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5038,7 +5037,7 @@ impl<'a, C, A> PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5294,7 +5290,7 @@ impl<'a, C, A> PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5570,7 +5563,7 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut EditDeobfuscationfileUploadCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -5874,7 +5864,7 @@ impl<'a, C, A> EditDeobfuscationfileUploadCall<'a, C, A> where C: BorrowMut EditDeobfuscationfileUploadCall<'a, C, A> where C: BorrowMut EditImageUploadCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -6261,7 +6248,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -6454,7 +6441,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6609,10 +6596,7 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6644,7 +6628,7 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditDetailGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6930,7 +6911,7 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7018,7 +6999,7 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7161,10 +7142,7 @@ impl<'a, C, A> EditListingDeleteallCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7184,7 +7162,7 @@ impl<'a, C, A> EditListingDeleteallCall<'a, C, A> where C: BorrowMut EditListingDeleteallCall<'a, C, A> where C: BorrowMut EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7448,7 +7423,7 @@ impl<'a, C, A> EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut EditDetailUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7734,7 +7706,7 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7834,7 +7806,7 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7980,10 +7952,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8003,7 +7972,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8101,7 +8070,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8256,10 +8225,7 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8291,7 +8257,7 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditImageListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8581,7 +8544,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8688,7 +8651,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8841,10 +8804,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8876,7 +8836,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8986,7 +8946,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9139,10 +9099,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9174,7 +9131,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9284,7 +9241,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9428,10 +9385,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9451,7 +9405,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9539,7 +9493,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9688,10 +9642,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9711,7 +9662,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9818,7 +9769,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9970,10 +9921,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -10006,7 +9954,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -10180,7 +10128,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10322,10 +10270,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10345,7 +10290,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10433,7 +10378,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10579,10 +10524,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10602,7 +10544,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10700,7 +10642,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10842,10 +10784,7 @@ impl<'a, C, A> EditBundleListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10865,7 +10804,7 @@ impl<'a, C, A> EditBundleListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10953,7 +10892,7 @@ impl<'a, C, A> EditBundleListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11096,10 +11035,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11119,7 +11055,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11197,7 +11133,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11355,10 +11291,7 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -11391,7 +11324,7 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11768,7 +11698,7 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11858,7 +11788,7 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12002,10 +11932,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12025,7 +11952,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12113,7 +12040,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12264,10 +12191,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12299,7 +12223,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12409,7 +12333,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12553,10 +12477,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12576,7 +12497,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12664,7 +12585,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12808,10 +12729,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12831,7 +12749,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12919,7 +12837,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13063,10 +12981,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13086,7 +13001,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13184,7 +13099,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13328,10 +13243,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13351,7 +13263,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13439,7 +13351,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13598,10 +13510,7 @@ impl<'a, C, A> EditBundleUploadCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -13634,7 +13543,7 @@ impl<'a, C, A> EditBundleUploadCall<'a, C, A> where C: BorrowMut, }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -13815,7 +13724,7 @@ impl<'a, C, A> EditBundleUploadCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13968,10 +13877,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14003,7 +13909,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14113,7 +14019,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14261,10 +14167,7 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14284,7 +14187,7 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut EditExpansionfileGetCall<'a, C, A> where C: BorrowMut EditImageDeleteallCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14562,7 +14462,7 @@ impl<'a, C, A> EditImageDeleteallCall<'a, C, A> where C: BorrowMut EditImageDeleteallCall<'a, C, A> where C: BorrowMut EditDetailPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14855,7 +14752,7 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14955,7 +14852,7 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15108,10 +15005,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15143,7 +15037,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15253,7 +15147,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15398,10 +15292,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15421,7 +15312,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15509,7 +15400,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15660,10 +15551,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15695,7 +15583,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15805,7 +15693,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15953,10 +15841,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15976,7 +15861,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16061,7 +15946,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16217,10 +16102,7 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16252,7 +16134,7 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut InappproductUpdateCall<'a, C, A> where C: BorrowMut InappproductListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16539,7 +16418,7 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16635,7 +16514,7 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16789,10 +16668,7 @@ impl<'a, C, A> InappproductInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16824,7 +16700,7 @@ impl<'a, C, A> InappproductInsertCall<'a, C, A> where C: BorrowMut InappproductInsertCall<'a, C, A> where C: BorrowMut InappproductDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17087,7 +16960,7 @@ impl<'a, C, A> InappproductDeleteCall<'a, C, A> where C: BorrowMut InappproductDeleteCall<'a, C, A> where C: BorrowMut InappproductGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17332,7 +17202,7 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17419,7 +17289,7 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17575,10 +17445,7 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17610,7 +17477,7 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17717,7 +17584,7 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/appengine1-cli/Cargo.toml b/gen/appengine1-cli/Cargo.toml index 26776aa250..af83ea6925 100644 --- a/gen/appengine1-cli/Cargo.toml +++ b/gen/appengine1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appengine1-cli" -version = "1.0.8+20181005" +version = "1.0.8+20190321" authors = ["Sebastian Thiel "] description = "A complete library to interact with appengine (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-appengine1] path = "../appengine1" -version = "1.0.8+20181005" +version = "1.0.8+20190321" diff --git a/gen/appengine1-cli/README.md b/gen/appengine1-cli/README.md index ec7f2a50d6..498b6c8ea0 100644 --- a/gen/appengine1-cli/README.md +++ b/gen/appengine1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *appengine* API at revision *20181005*. The CLI is at version *1.0.8*. +This documentation was generated from the *appengine* API at revision *20190321*. The CLI is at version *1.0.8*. ```bash appengine1 [options] diff --git a/gen/appengine1-cli/mkdocs.yml b/gen/appengine1-cli/mkdocs.yml index a86460acba..c6a16afeb3 100644 --- a/gen/appengine1-cli/mkdocs.yml +++ b/gen/appengine1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appengine v1.0.8+20181005 +site_name: appengine v1.0.8+20190321 site_url: http://byron.github.io/google-apis-rs/google-appengine1-cli site_description: A complete library to interact with appengine (protocol v1) diff --git a/gen/appengine1-cli/src/main.rs b/gen/appengine1-cli/src/main.rs index 097a538ca6..969ee73dbc 100644 --- a/gen/appengine1-cli/src/main.rs +++ b/gen/appengine1-cli/src/main.rs @@ -494,21 +494,22 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "default-hostname" => Some(("defaultHostname", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "gcr-domain" => Some(("gcrDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "code-bucket" => Some(("codeBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-bucket" => Some(("defaultBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-cookie-expiration" => Some(("defaultCookieExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "location-id" => Some(("locationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "feature-settings.split-health-checks" => Some(("featureSettings.splitHealthChecks", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location-id" => Some(("locationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "feature-settings.use-container-optimized-os" => Some(("featureSettings.useContainerOptimizedOs", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "feature-settings.split-health-checks" => Some(("featureSettings.splitHealthChecks", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gcr-domain" => Some(("gcrDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "enabled", "feature-settings", "gcr-domain", "iap", "id", "location-id", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "serving-status", "split-health-checks"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "enabled", "feature-settings", "gcr-domain", "iap", "id", "location-id", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "serving-status", "split-health-checks", "use-container-optimized-os"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1652,21 +1653,22 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "default-hostname" => Some(("defaultHostname", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "gcr-domain" => Some(("gcrDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "code-bucket" => Some(("codeBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-bucket" => Some(("defaultBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-cookie-expiration" => Some(("defaultCookieExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "location-id" => Some(("locationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "feature-settings.split-health-checks" => Some(("featureSettings.splitHealthChecks", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location-id" => Some(("locationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "feature-settings.use-container-optimized-os" => Some(("featureSettings.useContainerOptimizedOs", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "feature-settings.split-health-checks" => Some(("featureSettings.splitHealthChecks", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gcr-domain" => Some(("gcrDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "enabled", "feature-settings", "gcr-domain", "iap", "id", "location-id", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "serving-status", "split-health-checks"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "enabled", "feature-settings", "gcr-domain", "iap", "id", "location-id", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "serving-status", "split-health-checks", "use-container-optimized-os"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2099,7 +2101,8 @@ impl<'n> Engine<'n> { "endpoints-api-service.rollout-strategy" => Some(("endpointsApiService.rolloutStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "endpoints-api-service.disable-trace-sampling" => Some(("endpointsApiService.disableTraceSampling", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "endpoints-api-service.name" => Some(("endpointsApiService.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "default-expiration" => Some(("defaultExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "beta-settings" => Some(("betaSettings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "vm" => Some(("vm", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "zones" => Some(("zones", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2112,15 +2115,17 @@ impl<'n> Engine<'n> { "readiness-check.path" => Some(("readinessCheck.path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "readiness-check.success-threshold" => Some(("readinessCheck.successThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "readiness-check.failure-threshold" => Some(("readinessCheck.failureThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "runtime-main-executable-path" => Some(("runtimeMainExecutablePath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.url" => Some(("apiConfig.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.security-level" => Some(("apiConfig.securityLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "api-config.login" => Some(("apiConfig.login", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.auth-fail-action" => Some(("apiConfig.authFailAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "api-config.login" => Some(("apiConfig.login", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.script" => Some(("apiConfig.script", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network.subnetwork-name" => Some(("network.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.session-affinity" => Some(("network.sessionAffinity", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "health-check.restart-threshold" => Some(("healthCheck.restartThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "health-check.check-interval" => Some(("healthCheck.checkInterval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "health-check.unhealthy-threshold" => Some(("healthCheck.unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2128,6 +2133,7 @@ impl<'n> Engine<'n> { "health-check.host" => Some(("healthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "health-check.timeout" => Some(("healthCheck.timeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "health-check.disable-health-check" => Some(("healthCheck.disableHealthCheck", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-expiration" => Some(("defaultExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version-url" => Some(("versionUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entrypoint.shell" => Some(("entrypoint.shell", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "env" => Some(("env", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2161,8 +2167,7 @@ impl<'n> Engine<'n> { "resources.cpu" => Some(("resources.cpu", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "resources.memory-gb" => Some(("resources.memoryGb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "manual-scaling.instances" => Some(("manualScaling.instances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "vpc-access-connector.name" => Some(("vpcAccessConnector.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inbound-services" => Some(("inboundServices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "runtime-channel" => Some(("runtimeChannel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "created-by" => Some(("createdBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2171,6 +2176,10 @@ impl<'n> Engine<'n> { "deployment.container.image" => Some(("deployment.container.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "deployment.zip.files-count" => Some(("deployment.zip.filesCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "deployment.zip.source-url" => Some(("deployment.zip.sourceUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "threadsafe" => Some(("threadsafe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "runtime-api-version" => Some(("runtimeApiVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "liveness-check.check-interval" => Some(("livenessCheck.checkInterval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "liveness-check.initial-delay" => Some(("livenessCheck.initialDelay", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "liveness-check.host" => Some(("livenessCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2178,15 +2187,11 @@ impl<'n> Engine<'n> { "liveness-check.path" => Some(("livenessCheck.path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "liveness-check.success-threshold" => Some(("livenessCheck.successThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "liveness-check.failure-threshold" => Some(("livenessCheck.failureThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "threadsafe" => Some(("threadsafe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "runtime-api-version" => Some(("runtimeApiVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "runtime" => Some(("runtime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "app-start-timeout", "app-yaml-path", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "cloud-build-options", "cloud-build-timeout", "config-id", "container", "cool-down-period", "cpu", "cpu-utilization", "create-time", "created-by", "default-expiration", "deployment", "disable-health-check", "disable-trace-sampling", "disk-gb", "disk-usage-bytes", "disk-utilization", "endpoints-api-service", "entrypoint", "env", "env-variables", "failure-threshold", "files-count", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "initial-delay", "instance-class", "instance-tag", "instances", "liveness-check", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "path", "readiness-check", "request-utilization", "resources", "restart-threshold", "rollout-strategy", "runtime", "runtime-api-version", "runtime-channel", "script", "security-level", "serving-status", "shell", "source-url", "standard-scheduler-settings", "subnetwork-name", "success-threshold", "target-concurrent-requests", "target-cpu-utilization", "target-read-bytes-per-second", "target-read-ops-per-second", "target-received-bytes-per-second", "target-received-packets-per-second", "target-request-count-per-second", "target-sent-bytes-per-second", "target-sent-packets-per-second", "target-throughput-utilization", "target-utilization", "target-write-bytes-per-second", "target-write-ops-per-second", "threadsafe", "timeout", "unhealthy-threshold", "url", "version-url", "vm", "zip", "zones"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "app-start-timeout", "app-yaml-path", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "cloud-build-options", "cloud-build-timeout", "config-id", "container", "cool-down-period", "cpu", "cpu-utilization", "create-time", "created-by", "default-expiration", "deployment", "disable-health-check", "disable-trace-sampling", "disk-gb", "disk-usage-bytes", "disk-utilization", "endpoints-api-service", "entrypoint", "env", "env-variables", "failure-threshold", "files-count", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "initial-delay", "instance-class", "instance-tag", "instances", "liveness-check", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "path", "readiness-check", "request-utilization", "resources", "restart-threshold", "rollout-strategy", "runtime", "runtime-api-version", "runtime-channel", "runtime-main-executable-path", "script", "security-level", "serving-status", "session-affinity", "shell", "source-url", "standard-scheduler-settings", "subnetwork-name", "success-threshold", "target-concurrent-requests", "target-cpu-utilization", "target-read-bytes-per-second", "target-read-ops-per-second", "target-received-bytes-per-second", "target-received-packets-per-second", "target-request-count-per-second", "target-sent-bytes-per-second", "target-sent-packets-per-second", "target-throughput-utilization", "target-utilization", "target-write-bytes-per-second", "target-write-ops-per-second", "threadsafe", "timeout", "unhealthy-threshold", "url", "version-url", "vm", "vpc-access-connector", "zip", "zones"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2691,7 +2696,8 @@ impl<'n> Engine<'n> { "endpoints-api-service.rollout-strategy" => Some(("endpointsApiService.rolloutStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "endpoints-api-service.disable-trace-sampling" => Some(("endpointsApiService.disableTraceSampling", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "endpoints-api-service.name" => Some(("endpointsApiService.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "default-expiration" => Some(("defaultExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "beta-settings" => Some(("betaSettings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "vm" => Some(("vm", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "zones" => Some(("zones", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2704,15 +2710,17 @@ impl<'n> Engine<'n> { "readiness-check.path" => Some(("readinessCheck.path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "readiness-check.success-threshold" => Some(("readinessCheck.successThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "readiness-check.failure-threshold" => Some(("readinessCheck.failureThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "runtime-main-executable-path" => Some(("runtimeMainExecutablePath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.url" => Some(("apiConfig.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.security-level" => Some(("apiConfig.securityLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "api-config.login" => Some(("apiConfig.login", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.auth-fail-action" => Some(("apiConfig.authFailAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "api-config.login" => Some(("apiConfig.login", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.script" => Some(("apiConfig.script", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network.subnetwork-name" => Some(("network.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.session-affinity" => Some(("network.sessionAffinity", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "health-check.restart-threshold" => Some(("healthCheck.restartThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "health-check.check-interval" => Some(("healthCheck.checkInterval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "health-check.unhealthy-threshold" => Some(("healthCheck.unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2720,6 +2728,7 @@ impl<'n> Engine<'n> { "health-check.host" => Some(("healthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "health-check.timeout" => Some(("healthCheck.timeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "health-check.disable-health-check" => Some(("healthCheck.disableHealthCheck", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-expiration" => Some(("defaultExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version-url" => Some(("versionUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entrypoint.shell" => Some(("entrypoint.shell", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "env" => Some(("env", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2753,8 +2762,7 @@ impl<'n> Engine<'n> { "resources.cpu" => Some(("resources.cpu", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "resources.memory-gb" => Some(("resources.memoryGb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "manual-scaling.instances" => Some(("manualScaling.instances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "vpc-access-connector.name" => Some(("vpcAccessConnector.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inbound-services" => Some(("inboundServices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "runtime-channel" => Some(("runtimeChannel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "created-by" => Some(("createdBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2763,6 +2771,10 @@ impl<'n> Engine<'n> { "deployment.container.image" => Some(("deployment.container.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "deployment.zip.files-count" => Some(("deployment.zip.filesCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "deployment.zip.source-url" => Some(("deployment.zip.sourceUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "threadsafe" => Some(("threadsafe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "runtime-api-version" => Some(("runtimeApiVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "liveness-check.check-interval" => Some(("livenessCheck.checkInterval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "liveness-check.initial-delay" => Some(("livenessCheck.initialDelay", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "liveness-check.host" => Some(("livenessCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2770,15 +2782,11 @@ impl<'n> Engine<'n> { "liveness-check.path" => Some(("livenessCheck.path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "liveness-check.success-threshold" => Some(("livenessCheck.successThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "liveness-check.failure-threshold" => Some(("livenessCheck.failureThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "threadsafe" => Some(("threadsafe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "runtime-api-version" => Some(("runtimeApiVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "runtime" => Some(("runtime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "app-start-timeout", "app-yaml-path", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "cloud-build-options", "cloud-build-timeout", "config-id", "container", "cool-down-period", "cpu", "cpu-utilization", "create-time", "created-by", "default-expiration", "deployment", "disable-health-check", "disable-trace-sampling", "disk-gb", "disk-usage-bytes", "disk-utilization", "endpoints-api-service", "entrypoint", "env", "env-variables", "failure-threshold", "files-count", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "initial-delay", "instance-class", "instance-tag", "instances", "liveness-check", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "path", "readiness-check", "request-utilization", "resources", "restart-threshold", "rollout-strategy", "runtime", "runtime-api-version", "runtime-channel", "script", "security-level", "serving-status", "shell", "source-url", "standard-scheduler-settings", "subnetwork-name", "success-threshold", "target-concurrent-requests", "target-cpu-utilization", "target-read-bytes-per-second", "target-read-ops-per-second", "target-received-bytes-per-second", "target-received-packets-per-second", "target-request-count-per-second", "target-sent-bytes-per-second", "target-sent-packets-per-second", "target-throughput-utilization", "target-utilization", "target-write-bytes-per-second", "target-write-ops-per-second", "threadsafe", "timeout", "unhealthy-threshold", "url", "version-url", "vm", "zip", "zones"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "app-start-timeout", "app-yaml-path", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "cloud-build-options", "cloud-build-timeout", "config-id", "container", "cool-down-period", "cpu", "cpu-utilization", "create-time", "created-by", "default-expiration", "deployment", "disable-health-check", "disable-trace-sampling", "disk-gb", "disk-usage-bytes", "disk-utilization", "endpoints-api-service", "entrypoint", "env", "env-variables", "failure-threshold", "files-count", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "initial-delay", "instance-class", "instance-tag", "instances", "liveness-check", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "path", "readiness-check", "request-utilization", "resources", "restart-threshold", "rollout-strategy", "runtime", "runtime-api-version", "runtime-channel", "runtime-main-executable-path", "script", "security-level", "serving-status", "session-affinity", "shell", "source-url", "standard-scheduler-settings", "subnetwork-name", "success-threshold", "target-concurrent-requests", "target-cpu-utilization", "target-read-bytes-per-second", "target-read-ops-per-second", "target-received-bytes-per-second", "target-received-packets-per-second", "target-request-count-per-second", "target-sent-bytes-per-second", "target-sent-packets-per-second", "target-throughput-utilization", "target-utilization", "target-write-bytes-per-second", "target-write-ops-per-second", "threadsafe", "timeout", "unhealthy-threshold", "url", "version-url", "vm", "vpc-access-connector", "zip", "zones"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4190,8 +4198,8 @@ fn main() { let mut app = App::new("appengine1") .author("Sebastian Thiel ") - .version("1.0.8+20181005") - .about("The App Engine Admin API enables developers to provision and manage their App Engine applications.") + .version("1.0.8+20190321") + .about("Provisions and manages developers' App Engine applications.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appengine1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/appengine1/Cargo.toml b/gen/appengine1/Cargo.toml index d9a629e626..274dd2056d 100644 --- a/gen/appengine1/Cargo.toml +++ b/gen/appengine1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-appengine1" -version = "1.0.8+20181005" +version = "1.0.8+20190321" authors = ["Sebastian Thiel "] description = "A complete library to interact with appengine (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1" homepage = "https://cloud.google.com/appengine/docs/admin-api/" -documentation = "https://docs.rs/google-appengine1/1.0.8+20181005" +documentation = "https://docs.rs/google-appengine1/1.0.8+20190321" license = "MIT" keywords = ["appengine", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/appengine1/README.md b/gen/appengine1/README.md index c8e9d324b9..ea34e448c1 100644 --- a/gen/appengine1/README.md +++ b/gen/appengine1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-appengine1` library allows access to all features of the *Google appengine* service. -This documentation was generated from *appengine* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *appengine* crate version *1.0.8+20190321*, where *20190321* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *appengine* *v1* API can be found at the [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.Appengine.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.Appengine.html) ... * apps - * [*authorized certificates create*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppAuthorizedCertificateCreateCall.html), [*authorized certificates delete*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppAuthorizedCertificateDeleteCall.html), [*authorized certificates get*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppAuthorizedCertificateGetCall.html), [*authorized certificates list*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppAuthorizedCertificateListCall.html), [*authorized certificates patch*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppAuthorizedCertificatePatchCall.html), [*authorized domains list*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppAuthorizedDomainListCall.html), [*create*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppCreateCall.html), [*domain mappings create*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppDomainMappingCreateCall.html), [*domain mappings delete*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppDomainMappingDeleteCall.html), [*domain mappings get*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppDomainMappingGetCall.html), [*domain mappings list*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppDomainMappingListCall.html), [*domain mappings patch*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppDomainMappingPatchCall.html), [*firewall ingress rules batch update*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppFirewallIngressRuleBatchUpdateCall.html), [*firewall ingress rules create*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppFirewallIngressRuleCreateCall.html), [*firewall ingress rules delete*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppFirewallIngressRuleDeleteCall.html), [*firewall ingress rules get*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppFirewallIngressRuleGetCall.html), [*firewall ingress rules list*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppFirewallIngressRuleListCall.html), [*firewall ingress rules patch*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppFirewallIngressRulePatchCall.html), [*get*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppGetCall.html), [*locations get*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppLocationGetCall.html), [*locations list*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppLocationListCall.html), [*operations get*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppOperationGetCall.html), [*operations list*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppOperationListCall.html), [*patch*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppPatchCall.html), [*repair*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppRepairCall.html), [*services delete*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceDeleteCall.html), [*services get*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceGetCall.html), [*services list*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceListCall.html), [*services patch*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServicePatchCall.html), [*services versions create*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceVersionCreateCall.html), [*services versions delete*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceVersionDeleteCall.html), [*services versions get*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceVersionGetCall.html), [*services versions instances debug*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceVersionInstanceListCall.html), [*services versions list*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceVersionListCall.html) and [*services versions patch*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.AppServiceVersionPatchCall.html) + * [*authorized certificates create*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppAuthorizedCertificateCreateCall.html), [*authorized certificates delete*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppAuthorizedCertificateDeleteCall.html), [*authorized certificates get*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppAuthorizedCertificateGetCall.html), [*authorized certificates list*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppAuthorizedCertificateListCall.html), [*authorized certificates patch*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppAuthorizedCertificatePatchCall.html), [*authorized domains list*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppAuthorizedDomainListCall.html), [*create*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppCreateCall.html), [*domain mappings create*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppDomainMappingCreateCall.html), [*domain mappings delete*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppDomainMappingDeleteCall.html), [*domain mappings get*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppDomainMappingGetCall.html), [*domain mappings list*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppDomainMappingListCall.html), [*domain mappings patch*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppDomainMappingPatchCall.html), [*firewall ingress rules batch update*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppFirewallIngressRuleBatchUpdateCall.html), [*firewall ingress rules create*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppFirewallIngressRuleCreateCall.html), [*firewall ingress rules delete*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppFirewallIngressRuleDeleteCall.html), [*firewall ingress rules get*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppFirewallIngressRuleGetCall.html), [*firewall ingress rules list*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppFirewallIngressRuleListCall.html), [*firewall ingress rules patch*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppFirewallIngressRulePatchCall.html), [*get*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppGetCall.html), [*locations get*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppLocationGetCall.html), [*locations list*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppLocationListCall.html), [*operations get*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppOperationGetCall.html), [*operations list*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppOperationListCall.html), [*patch*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppPatchCall.html), [*repair*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppRepairCall.html), [*services delete*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceDeleteCall.html), [*services get*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceGetCall.html), [*services list*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceListCall.html), [*services patch*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServicePatchCall.html), [*services versions create*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceVersionCreateCall.html), [*services versions delete*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceVersionDeleteCall.html), [*services versions get*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceVersionGetCall.html), [*services versions instances debug*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceVersionInstanceListCall.html), [*services versions list*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceVersionListCall.html) and [*services versions patch*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.AppServiceVersionPatchCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/struct.Appengine.html)** +* **[Hub](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/struct.Appengine.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.Part.html)** + * **[Parts](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -143,17 +143,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -163,29 +163,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-appengine1/1.0.8+20181005/google_appengine1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-appengine1/1.0.8+20190321/google_appengine1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/appengine1/src/lib.rs b/gen/appengine1/src/lib.rs index 469ddb63a1..d6282892de 100644 --- a/gen/appengine1/src/lib.rs +++ b/gen/appengine1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *appengine* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *appengine* crate version *1.0.8+20190321*, where *20190321* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *appengine* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). @@ -475,8 +475,8 @@ pub struct Instance { pub vm_ip: Option, /// Average queries per second (QPS) over the last minute.@OutputOnly pub qps: Option, - /// Relative name of the instance within the version. Example: instance-1.@OutputOnly - pub id: Option, + /// Availability of the instance.@OutputOnly + pub availability: Option, /// Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1.@OutputOnly pub name: Option, /// Number of errors since this instance was started.@OutputOnly @@ -484,8 +484,8 @@ pub struct Instance { /// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly #[serde(rename="vmStatus")] pub vm_status: Option, - /// Availability of the instance.@OutputOnly - pub availability: Option, + /// Relative name of the instance within the version. Example: instance-1.@OutputOnly + pub id: Option, /// Average latency (ms) over the last minute.@OutputOnly #[serde(rename="averageLatency")] pub average_latency: Option, @@ -594,36 +594,6 @@ pub struct Status { impl Part for Status {} -/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StaticFilesHandler { - /// MIME type used to serve all files served by this handler.Defaults to file-specific MIME types, which are derived from each file's filename extension. - #[serde(rename="mimeType")] - pub mime_type: Option, - /// Time a static file served by this handler should be cached by web proxies and browsers. - pub expiration: Option, - /// Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern. - pub path: Option, - /// Regular expression that matches the file paths for all files that should be referenced by this handler. - #[serde(rename="uploadPathRegex")] - pub upload_path_regex: Option, - /// Whether this handler should match the request if the file referenced by the handler does not exist. - #[serde(rename="requireMatchingFile")] - pub require_matching_file: Option, - /// HTTP headers to use for all responses from these URLs. - #[serde(rename="httpHeaders")] - pub http_headers: Option>, - /// Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas. - #[serde(rename="applicationReadable")] - pub application_readable: Option, -} - -impl Part for StaticFilesHandler {} - - /// Target scaling by network usage. Only applicable in the App Engine flexible environment. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -653,6 +623,9 @@ impl Part for NetworkUtilization {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FeatureSettings { + /// If true, use Container-Optimized OS (https://cloud.google.com/container-optimized-os/) base image for VMs, rather than a base Debian image. + #[serde(rename="useContainerOptimizedOs")] + pub use_container_optimized_os: Option, /// Boolean value indicating if split health checks should be used instead of the legacy health checks. At an app.yaml level, this means defaulting to 'readiness_check' and 'liveness_check' values instead of 'health_check' ones. Once the legacy 'health_check' behavior is deprecated, and this value is always true, this setting can be removed. #[serde(rename="splitHealthChecks")] pub split_health_checks: Option, @@ -708,11 +681,11 @@ impl ResponseResult for BatchUpdateIngressRulesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListServicesResponse { - /// The services belonging to the requested application. - pub services: Option>, /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, + /// The services belonging to the requested application. + pub services: Option>, } impl ResponseResult for ListServicesResponse {} @@ -762,25 +735,19 @@ pub struct IdentityAwareProxy { impl Part for IdentityAwareProxy {} -/// Response message for AuthorizedDomains.ListAuthorizedDomains. +/// Request message for 'Applications.RepairApplication'. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [authorized domains list apps](struct.AppAuthorizedDomainListCall.html) (response) +/// * [repair apps](struct.AppRepairCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListAuthorizedDomainsResponse { - /// Continuation token for fetching the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The authorized domains belonging to the user. - pub domains: Option>, -} +pub struct RepairApplicationRequest { _never_set: Option } -impl ResponseResult for ListAuthorizedDomainsResponse {} +impl RequestValue for RepairApplicationRequest {} /// Automatic scaling is based on request rate, response latencies, and other application metrics. @@ -914,17 +881,21 @@ pub struct ZipInfo { impl Part for ZipInfo {} -/// Docker image that is used to create a container and start a VM instance for the version that you deploy. Only applicable for instances running in the App Engine flexible environment. +/// Rules to match an HTTP request and dispatch that request to a service. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ContainerInfo { - /// URI to the hosted container image in Google Container Registry. The URI must be fully qualified and include a tag or digest. Examples: "gcr.io/my-project/image:tag" or "gcr.io/my-project/image@digest" - pub image: Option, +pub struct UrlDispatchRule { + /// Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path.The sum of the lengths of the domain and path may not exceed 100 characters. + pub path: Option, + /// Domain name to match against. The wildcard "*" is supported if specified before a period: "*.".Defaults to matching all domains: "*". + pub domain: Option, + /// Resource ID of a service in this application that should serve the matched request. The service must already exist. Example: default. + pub service: Option, } -impl Part for ContainerInfo {} +impl Part for UrlDispatchRule {} /// Third-party Python runtime library that is required by the application. @@ -965,117 +936,19 @@ pub struct DiskUtilization { impl Part for DiskUtilization {} -/// A Version resource is a specific set of source code and configuration files that are deployed into a service. +/// A domain that a user has been authorized to administer. To authorize use of a domain, verify ownership via Webmaster Central (https://www.google.com/webmasters/verification/home). /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [services versions get apps](struct.AppServiceVersionGetCall.html) (response) -/// * [services versions create apps](struct.AppServiceVersionCreateCall.html) (request) -/// * [services versions patch apps](struct.AppServiceVersionPatchCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Version { - /// Cloud Endpoints configuration.If endpoints_api_service is set, the Cloud Endpoints Extensible Service Proxy will be provided to serve the API implemented by the app. - #[serde(rename="endpointsApiService")] - pub endpoints_api_service: Option, - /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StaticFilesHandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set. - #[serde(rename="defaultExpiration")] - pub default_expiration: Option, - /// A service with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. - #[serde(rename="basicScaling")] - pub basic_scaling: Option, - /// Whether to deploy this version in a container on a virtual machine. - pub vm: Option, - /// The Google Compute Engine zones that are supported by this version in the App Engine flexible environment. - pub zones: Option>, - /// Instance class that is used to run this version. Valid values are: - /// AutomaticScaling: F1, F2, F4, F4_1G - /// ManualScaling or BasicScaling: B1, B2, B4, B8, B4_1GDefaults to F1 for AutomaticScaling and B1 for ManualScaling or BasicScaling. - #[serde(rename="instanceClass")] - pub instance_class: Option, - /// Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set. - #[serde(rename="errorHandlers")] - pub error_handlers: Option>, - /// Serving URL for this version. Example: "https://myversion-dot-myservice-dot-myapp.appspot.com"@OutputOnly - #[serde(rename="versionUrl")] - pub version_url: Option, - /// Configures readiness health checking for instances. Unhealthy instances are not put into the backend traffic rotation.Only returned in GET requests if view=FULL is set. - #[serde(rename="readinessCheck")] - pub readiness_check: Option, - /// Serving configuration for Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/).Only returned in GET requests if view=FULL is set. - #[serde(rename="apiConfig")] - pub api_config: Option, - /// Extra network settings. Only applicable in the App Engine flexible environment. - pub network: Option, - /// Configures health checking for instances. Unhealthy instances are stopped and replaced with new instances. Only applicable in the App Engine flexible environment.Only returned in GET requests if view=FULL is set. - #[serde(rename="healthCheck")] - pub health_check: Option, - /// Relative name of the version within the service. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-". +pub struct AuthorizedDomain { + /// Fully qualified domain name of the domain authorized for use. Example: example.com. pub id: Option, - /// Configuration for third-party Python runtime libraries that are required by the application.Only returned in GET requests if view=FULL is set. - pub libraries: Option>, - /// The entrypoint for the application. - pub entrypoint: Option, - /// App Engine execution environment for this version.Defaults to standard. - pub env: Option, - /// Total size in bytes of all the files that are included in this version and currently hosted on the App Engine disk.@OutputOnly - #[serde(rename="diskUsageBytes")] - pub disk_usage_bytes: Option, - /// Automatic scaling is based on request rate, response latencies, and other application metrics. - #[serde(rename="automaticScaling")] - pub automatic_scaling: Option, - /// Environment variables available to the application.Only returned in GET requests if view=FULL is set. - #[serde(rename="envVariables")] - pub env_variables: Option>, - /// Machine resources for this version. Only applicable in the App Engine flexible environment. - pub resources: Option, - /// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. - #[serde(rename="manualScaling")] - pub manual_scaling: Option, - /// Before an application can receive email or XMPP messages, the application must be configured to enable the service. - #[serde(rename="inboundServices")] - pub inbound_services: Option>, - /// The channel of the runtime to use. Only available for some runtimes. Defaults to the default channel. - #[serde(rename="runtimeChannel")] - pub runtime_channel: Option, - /// Metadata settings that are supplied to this version to enable beta runtime features. - #[serde(rename="betaSettings")] - pub beta_settings: Option>, - /// Email address of the user who created this version.@OutputOnly - #[serde(rename="createdBy")] - pub created_by: Option, - /// Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set. - pub deployment: Option, - /// Files that match this pattern will not be built into this version. Only applicable for Go runtimes.Only returned in GET requests if view=FULL is set. - #[serde(rename="nobuildFilesRegex")] - pub nobuild_files_regex: Option, - /// Time that this version was created.@OutputOnly - #[serde(rename="createTime")] - pub create_time: Option, - /// Whether multiple requests can be dispatched to this version at once. - pub threadsafe: Option, - /// The version of the API in the given runtime environment. Please see the app.yaml reference for valid values at https://cloud.google.com/appengine/docs/standard//config/appref - #[serde(rename="runtimeApiVersion")] - pub runtime_api_version: Option, - /// Configures liveness health checking for instances. Unhealthy instances are stopped and replaced with new instancesOnly returned in GET requests if view=FULL is set. - #[serde(rename="livenessCheck")] - pub liveness_check: Option, - /// Full path to the Version resource in the API. Example: apps/myapp/services/default/versions/v1.@OutputOnly + /// Full path to the AuthorizedDomain resource in the API. Example: apps/myapp/authorizedDomains/example.com.@OutputOnly pub name: Option, - /// An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.Only returned in GET requests if view=FULL is set. - pub handlers: Option>, - /// Current serving status of this version. Only the versions with a SERVING status create instances and can be billed.SERVING_STATUS_UNSPECIFIED is an invalid value. Defaults to SERVING. - #[serde(rename="servingStatus")] - pub serving_status: Option, - /// Desired runtime. Example: python27. - pub runtime: Option, } -impl RequestValue for Version {} -impl ResponseResult for Version {} +impl Part for AuthorizedDomain {} /// This resource represents a long-running operation that is the result of a network API call. @@ -1140,27 +1013,23 @@ pub struct StandardSchedulerSettings { impl Part for StandardSchedulerSettings {} -/// Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers. +/// Request message for Firewall.BatchUpdateIngressRules. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [firewall ingress rules batch update apps](struct.AppFirewallIngressRuleBatchUpdateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ApiConfigHandler { - /// URL to serve the endpoint at. - pub url: Option, - /// Security (HTTPS) enforcement for this URL. - #[serde(rename="securityLevel")] - pub security_level: Option, - /// Level of login required to access this resource. Defaults to optional. - pub login: Option, - /// Action to take when users access resources that require authentication. Defaults to redirect. - #[serde(rename="authFailAction")] - pub auth_fail_action: Option, - /// Path to the script from the application root directory. - pub script: Option, +pub struct BatchUpdateIngressRulesRequest { + /// A list of FirewallRules to replace the existing set. + #[serde(rename="ingressRules")] + pub ingress_rules: Option>, } -impl Part for ApiConfigHandler {} +impl RequestValue for BatchUpdateIngressRulesRequest {} /// Response message for Instances.ListInstances. @@ -1196,6 +1065,9 @@ pub struct Network { /// List of ports, or port pairs, to forward from the virtual machine to the application container. Only applicable in the App Engine flexible environment. #[serde(rename="forwardedPorts")] pub forwarded_ports: Option>, + /// Enable session affinity. Only applicable in the App Engine flexible environment. + #[serde(rename="sessionAffinity")] + pub session_affinity: Option, /// Google Compute Engine network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default. pub name: Option, /// Google Cloud Platform sub-network where the virtual machines are created. Specify the short name, not the resource path.If a subnetwork name is specified, a network name will also be required unless it is for the default network. @@ -1209,19 +1081,25 @@ pub struct Network { impl Part for Network {} -/// Request message for 'Applications.RepairApplication'. +/// Response message for AuthorizedDomains.ListAuthorizedDomains. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [repair apps](struct.AppRepairCall.html) (request) +/// * [authorized domains list apps](struct.AppAuthorizedDomainListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RepairApplicationRequest { _never_set: Option } +pub struct ListAuthorizedDomainsResponse { + /// The authorized domains belonging to the user. + pub domains: Option>, + /// Continuation token for fetching the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} -impl RequestValue for RepairApplicationRequest {} +impl ResponseResult for ListAuthorizedDomainsResponse {} /// An Application resource contains the top-level configuration of an App Engine application. @@ -1242,6 +1120,9 @@ pub struct Application { pub default_hostname: Option, /// Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly pub name: Option, + /// The Google Container Registry domain used for storing managed build docker images for this application. + #[serde(rename="gcrDomain")] + pub gcr_domain: Option, /// Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands.@OutputOnly #[serde(rename="codeBucket")] pub code_bucket: Option, @@ -1254,44 +1135,145 @@ pub struct Application { /// Cookie expiration policy for this application. #[serde(rename="defaultCookieExpiration")] pub default_cookie_expiration: Option, - /// Serving status of this application. - #[serde(rename="servingStatus")] - pub serving_status: Option, + /// no description provided + pub iap: Option, /// Location from which this application runs. Application instances run out of the data centers in the specified location, which is also where all of the application's end user content is stored.Defaults to us-central.View the list of supported locations (https://cloud.google.com/appengine/docs/locations). #[serde(rename="locationId")] pub location_id: Option, /// The feature specific settings to be used in the application. #[serde(rename="featureSettings")] pub feature_settings: Option, - /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp. - pub id: Option, - /// no description provided - pub iap: Option, + /// Serving status of this application. + #[serde(rename="servingStatus")] + pub serving_status: Option, /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account. #[serde(rename="authDomain")] pub auth_domain: Option, - /// The Google Container Registry domain used for storing managed build docker images for this application. - #[serde(rename="gcrDomain")] - pub gcr_domain: Option, + /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp. + pub id: Option, } impl RequestValue for Application {} impl ResponseResult for Application {} -/// A domain that a user has been authorized to administer. To authorize use of a domain, verify ownership via Webmaster Central (https://www.google.com/webmasters/verification/home). +/// A Version resource is a specific set of source code and configuration files that are deployed into a service. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [services versions create apps](struct.AppServiceVersionCreateCall.html) (request) +/// * [services versions get apps](struct.AppServiceVersionGetCall.html) (response) +/// * [services versions patch apps](struct.AppServiceVersionPatchCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AuthorizedDomain { - /// Full path to the AuthorizedDomain resource in the API. Example: apps/myapp/authorizedDomains/example.com.@OutputOnly - pub name: Option, - /// Fully qualified domain name of the domain authorized for use. Example: example.com. +pub struct Version { + /// Cloud Endpoints configuration.If endpoints_api_service is set, the Cloud Endpoints Extensible Service Proxy will be provided to serve the API implemented by the app. + #[serde(rename="endpointsApiService")] + pub endpoints_api_service: Option, + /// A service with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. + #[serde(rename="basicScaling")] + pub basic_scaling: Option, + /// Metadata settings that are supplied to this version to enable beta runtime features. + #[serde(rename="betaSettings")] + pub beta_settings: Option>, + /// Whether to deploy this version in a container on a virtual machine. + pub vm: Option, + /// The Google Compute Engine zones that are supported by this version in the App Engine flexible environment. Deprecated. + pub zones: Option>, + /// Instance class that is used to run this version. Valid values are: + /// AutomaticScaling: F1, F2, F4, F4_1G + /// ManualScaling or BasicScaling: B1, B2, B4, B8, B4_1GDefaults to F1 for AutomaticScaling and B1 for ManualScaling or BasicScaling. + #[serde(rename="instanceClass")] + pub instance_class: Option, + /// Custom static error pages. Limited to 10KB per page.Only returned in GET requests if view=FULL is set. + #[serde(rename="errorHandlers")] + pub error_handlers: Option>, + /// Serving URL for this version. Example: "https://myversion-dot-myservice-dot-myapp.appspot.com"@OutputOnly + #[serde(rename="versionUrl")] + pub version_url: Option, + /// Configures readiness health checking for instances. Unhealthy instances are not put into the backend traffic rotation.Only returned in GET requests if view=FULL is set. + #[serde(rename="readinessCheck")] + pub readiness_check: Option, + /// The path or name of the app's main executable. + #[serde(rename="runtimeMainExecutablePath")] + pub runtime_main_executable_path: Option, + /// Serving configuration for Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/).Only returned in GET requests if view=FULL is set. + #[serde(rename="apiConfig")] + pub api_config: Option, + /// Extra network settings. Only applicable in the App Engine flexible environment. + pub network: Option, + /// Configures health checking for instances. Unhealthy instances are stopped and replaced with new instances. Only applicable in the App Engine flexible environment.Only returned in GET requests if view=FULL is set. + #[serde(rename="healthCheck")] + pub health_check: Option, + /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StaticFilesHandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set. + #[serde(rename="defaultExpiration")] + pub default_expiration: Option, + /// Relative name of the version within the service. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-". pub id: Option, + /// Configuration for third-party Python runtime libraries that are required by the application.Only returned in GET requests if view=FULL is set. + pub libraries: Option>, + /// The entrypoint for the application. + pub entrypoint: Option, + /// App Engine execution environment for this version.Defaults to standard. + pub env: Option, + /// Total size in bytes of all the files that are included in this version and currently hosted on the App Engine disk.@OutputOnly + #[serde(rename="diskUsageBytes")] + pub disk_usage_bytes: Option, + /// Automatic scaling is based on request rate, response latencies, and other application metrics. + #[serde(rename="automaticScaling")] + pub automatic_scaling: Option, + /// Environment variables available to the application.Only returned in GET requests if view=FULL is set. + #[serde(rename="envVariables")] + pub env_variables: Option>, + /// Machine resources for this version. Only applicable in the App Engine flexible environment. + pub resources: Option, + /// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. + #[serde(rename="manualScaling")] + pub manual_scaling: Option, + /// Enables VPC connectivity for standard apps. + #[serde(rename="vpcAccessConnector")] + pub vpc_access_connector: Option, + /// Before an application can receive email or XMPP messages, the application must be configured to enable the service. + #[serde(rename="inboundServices")] + pub inbound_services: Option>, + /// The channel of the runtime to use. Only available for some runtimes. Defaults to the default channel. + #[serde(rename="runtimeChannel")] + pub runtime_channel: Option, + /// Email address of the user who created this version.@OutputOnly + #[serde(rename="createdBy")] + pub created_by: Option, + /// Code and application artifacts that make up this version.Only returned in GET requests if view=FULL is set. + pub deployment: Option, + /// Configures liveness health checking for instances. Unhealthy instances are stopped and replaced with new instancesOnly returned in GET requests if view=FULL is set. + #[serde(rename="livenessCheck")] + pub liveness_check: Option, + /// Time that this version was created.@OutputOnly + #[serde(rename="createTime")] + pub create_time: Option, + /// Whether multiple requests can be dispatched to this version at once. + pub threadsafe: Option, + /// The version of the API in the given runtime environment. Please see the app.yaml reference for valid values at https://cloud.google.com/appengine/docs/standard//config/appref + #[serde(rename="runtimeApiVersion")] + pub runtime_api_version: Option, + /// Files that match this pattern will not be built into this version. Only applicable for Go runtimes.Only returned in GET requests if view=FULL is set. + #[serde(rename="nobuildFilesRegex")] + pub nobuild_files_regex: Option, + /// Full path to the Version resource in the API. Example: apps/myapp/services/default/versions/v1.@OutputOnly + pub name: Option, + /// An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.Only returned in GET requests if view=FULL is set. + pub handlers: Option>, + /// Current serving status of this version. Only the versions with a SERVING status create instances and can be billed.SERVING_STATUS_UNSPECIFIED is an invalid value. Defaults to SERVING. + #[serde(rename="servingStatus")] + pub serving_status: Option, + /// Desired runtime. Example: python27. + pub runtime: Option, } -impl Part for AuthorizedDomain {} +impl RequestValue for Version {} +impl ResponseResult for Version {} /// The response message for Locations.ListLocations. @@ -1326,16 +1308,16 @@ impl ResponseResult for ListLocationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { - /// The canonical id for this location. For example: "us-east1". - #[serde(rename="locationId")] - pub location_id: Option, + /// The friendly name for this location, typically a nearby city name. For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, /// Cross-service attributes for the location. For example /// {"cloud.googleapis.com/region": "us-east1"} /// pub labels: Option>, - /// The friendly name for this location, typically a nearby city name. For example, "Tokyo". - #[serde(rename="displayName")] - pub display_name: Option, + /// The canonical id for this location. For example: "us-east1". + #[serde(rename="locationId")] + pub location_id: Option, /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1" pub name: Option, /// Service-specific metadata. For example the available capacity at the given location. @@ -1400,6 +1382,19 @@ pub struct CloudBuildOptions { impl Part for CloudBuildOptions {} +/// VPC access connector specification. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VpcAccessConnector { + /// Full Serverless VPC Access Connector name e.g. /projects/my-project/locations/us-central1/connectors/c1. + pub name: Option, +} + +impl Part for VpcAccessConnector {} + + /// Response message for Versions.ListVersions. /// /// # Activities @@ -1458,11 +1453,11 @@ pub struct DomainMapping { pub ssl_settings: Option, /// Relative name of the domain serving the application. Example: example.com. pub id: Option, + /// Full path to the DomainMapping resource in the API. Example: apps/myapp/domainMapping/example.com.@OutputOnly + pub name: Option, /// The resource records required to configure this domain mapping. These records must be added to the domain's DNS configuration in order to serve the application via this domain mapping.@OutputOnly #[serde(rename="resourceRecords")] pub resource_records: Option>, - /// Full path to the DomainMapping resource in the API. Example: apps/myapp/domainMapping/example.com.@OutputOnly - pub name: Option, } impl RequestValue for DomainMapping {} @@ -1480,11 +1475,11 @@ impl ResponseResult for DomainMapping {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListAuthorizedCertificatesResponse { + /// The SSL certificates the user is authorized to administer. + pub certificates: Option>, /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The SSL certificates the user is authorized to administer. - pub certificates: Option>, } impl ResponseResult for ListAuthorizedCertificatesResponse {} @@ -1496,16 +1491,16 @@ impl ResponseResult for ListAuthorizedCertificatesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Resources { - /// User specified volumes. - pub volumes: Option>, + /// Memory (GB) needed. + #[serde(rename="memoryGb")] + pub memory_gb: Option, /// Disk size (GB) needed. #[serde(rename="diskGb")] pub disk_gb: Option, /// Number of CPU cores needed. pub cpu: Option, - /// Memory (GB) needed. - #[serde(rename="memoryGb")] - pub memory_gb: Option, + /// User specified volumes. + pub volumes: Option>, } impl Part for Resources {} @@ -1517,11 +1512,11 @@ impl Part for Resources {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Deployment { - /// Manifest of the files stored in Google Cloud Storage that are included as part of this version. All files must be readable using the credentials supplied with this call. - pub files: Option>, - /// Options for any Google Cloud Build builds created as a part of this deployment.Note that this is orthogonal to the build parameter, where the deployment depends on an already existing cloud build. These options will only be used if a new build is created, such as when deploying to the App Engine flexible environment using files or zip. + /// Options for any Google Cloud Build builds created as a part of this deployment.These options will only be used if a new build is created, such as when deploying to the App Engine flexible environment using files or zip. #[serde(rename="cloudBuildOptions")] pub cloud_build_options: Option, + /// Manifest of the files stored in Google Cloud Storage that are included as part of this version. All files must be readable using the credentials supplied with this call. + pub files: Option>, /// The Docker image for the container that runs the version. Only applicable for instances running in the App Engine flexible environment. pub container: Option, /// The zip file for this deployment, if this is a zip deployment. @@ -1545,21 +1540,17 @@ pub struct ScriptHandler { impl Part for ScriptHandler {} -/// Rules to match an HTTP request and dispatch that request to a service. +/// Docker image that is used to create a container and start a VM instance for the version that you deploy. Only applicable for instances running in the App Engine flexible environment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UrlDispatchRule { - /// Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path.The sum of the lengths of the domain and path may not exceed 100 characters. - pub path: Option, - /// Domain name to match against. The wildcard "*" is supported if specified before a period: "*.".Defaults to matching all domains: "*". - pub domain: Option, - /// Resource ID of a service in this application that should serve the matched request. The service must already exist. Example: default. - pub service: Option, +pub struct ContainerInfo { + /// URI to the hosted container image in Google Container Registry. The URI must be fully qualified and include a tag or digest. Examples: "gcr.io/my-project/image:tag" or "gcr.io/my-project/image@digest" + pub image: Option, } -impl Part for UrlDispatchRule {} +impl Part for ContainerInfo {} /// Readiness checking configuration for VM instances. Unhealthy instances are removed from traffic rotation. @@ -1779,11 +1770,11 @@ impl Part for EndpointsApiService {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListOperationsResponse { - /// A list of operations that matches the specified filter in the request. - pub operations: Option>, /// The standard List next-page token. #[serde(rename="nextPageToken")] pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, } impl ResponseResult for ListOperationsResponse {} @@ -1846,23 +1837,57 @@ pub struct TrafficSplit { impl Part for TrafficSplit {} -/// Request message for Firewall.BatchUpdateIngressRules. +/// Google Cloud Endpoints (https://cloud.google.com/appengine/docs/python/endpoints/) configuration for API handlers. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [firewall ingress rules batch update apps](struct.AppFirewallIngressRuleBatchUpdateCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchUpdateIngressRulesRequest { - /// A list of FirewallRules to replace the existing set. - #[serde(rename="ingressRules")] - pub ingress_rules: Option>, +pub struct ApiConfigHandler { + /// URL to serve the endpoint at. + pub url: Option, + /// Security (HTTPS) enforcement for this URL. + #[serde(rename="securityLevel")] + pub security_level: Option, + /// Action to take when users access resources that require authentication. Defaults to redirect. + #[serde(rename="authFailAction")] + pub auth_fail_action: Option, + /// Level of login required to access this resource. Defaults to optional. + pub login: Option, + /// Path to the script from the application root directory. + pub script: Option, } -impl RequestValue for BatchUpdateIngressRulesRequest {} +impl Part for ApiConfigHandler {} + + +/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StaticFilesHandler { + /// MIME type used to serve all files served by this handler.Defaults to file-specific MIME types, which are derived from each file's filename extension. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// Time a static file served by this handler should be cached by web proxies and browsers. + pub expiration: Option, + /// Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern. + pub path: Option, + /// Regular expression that matches the file paths for all files that should be referenced by this handler. + #[serde(rename="uploadPathRegex")] + pub upload_path_regex: Option, + /// Whether this handler should match the request if the file referenced by the handler does not exist. + #[serde(rename="requireMatchingFile")] + pub require_matching_file: Option, + /// HTTP headers to use for all responses from these URLs. + #[serde(rename="httpHeaders")] + pub http_headers: Option>, + /// Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas. + #[serde(rename="applicationReadable")] + pub application_readable: Option, +} + +impl Part for StaticFilesHandler {} /// Target scaling by request utilization. Only applicable in the App Engine flexible environment. @@ -2835,10 +2860,7 @@ impl<'a, C, A> AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2858,7 +2880,7 @@ impl<'a, C, A> AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppServiceVersionInstanceListCall<'a, C, A> @@ -3126,10 +3148,7 @@ impl<'a, C, A> AppAuthorizedDomainListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3149,7 +3168,7 @@ impl<'a, C, A> AppAuthorizedDomainListCall<'a, C, A> where C: BorrowMut AppAuthorizedDomainListCall<'a, C, A> where C: BorrowMut AppAuthorizedDomainListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppAuthorizedDomainListCall<'a, C, A> @@ -3401,10 +3420,7 @@ impl<'a, C, A> AppAuthorizedCertificatePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3436,7 +3452,7 @@ impl<'a, C, A> AppAuthorizedCertificatePatchCall<'a, C, A> where C: BorrowMut AppAuthorizedCertificatePatchCall<'a, C, A> where C: BorrowMut AppAuthorizedCertificatePatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppAuthorizedCertificatePatchCall<'a, C, A> @@ -3699,10 +3715,7 @@ impl<'a, C, A> AppDomainMappingListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3722,7 +3735,7 @@ impl<'a, C, A> AppDomainMappingListCall<'a, C, A> where C: BorrowMut AppDomainMappingListCall<'a, C, A> where C: BorrowMut AppDomainMappingListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppDomainMappingListCall<'a, C, A> @@ -3962,10 +3975,7 @@ impl<'a, C, A> AppFirewallIngressRuleDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3985,7 +3995,7 @@ impl<'a, C, A> AppFirewallIngressRuleDeleteCall<'a, C, A> where C: BorrowMut AppFirewallIngressRuleDeleteCall<'a, C, A> where C: BorrowMut AppFirewallIngressRuleDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppFirewallIngressRuleDeleteCall<'a, C, A> @@ -4225,10 +4235,7 @@ impl<'a, C, A> AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4248,7 +4255,7 @@ impl<'a, C, A> AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppServiceVersionInstanceGetCall<'a, C, A> @@ -4517,10 +4524,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4540,7 +4544,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4639,7 +4643,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4647,12 +4651,12 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppOperationListCall<'a, C, A> @@ -4800,10 +4804,7 @@ impl<'a, C, A> AppFirewallIngressRuleListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4823,7 +4824,7 @@ impl<'a, C, A> AppFirewallIngressRuleListCall<'a, C, A> where C: BorrowMut AppFirewallIngressRuleListCall<'a, C, A> where C: BorrowMut AppFirewallIngressRuleListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppFirewallIngressRuleListCall<'a, C, A> @@ -5068,10 +5069,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5091,7 +5089,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5169,7 +5167,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5177,12 +5175,12 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppGetCall<'a, C, A> @@ -5317,10 +5315,7 @@ impl<'a, C, A> AppDomainMappingGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5340,7 +5335,7 @@ impl<'a, C, A> AppDomainMappingGetCall<'a, C, A> where C: BorrowMut AppDomainMappingGetCall<'a, C, A> where C: BorrowMut AppDomainMappingGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppDomainMappingGetCall<'a, C, A> @@ -5583,10 +5578,7 @@ impl<'a, C, A> AppServiceVersionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5606,7 +5598,7 @@ impl<'a, C, A> AppServiceVersionGetCall<'a, C, A> where C: BorrowMut AppServiceVersionGetCall<'a, C, A> where C: BorrowMut AppServiceVersionGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppServiceVersionGetCall<'a, C, A> @@ -5871,10 +5863,7 @@ impl<'a, C, A> AppFirewallIngressRulePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5906,7 +5895,7 @@ impl<'a, C, A> AppFirewallIngressRulePatchCall<'a, C, A> where C: BorrowMut AppFirewallIngressRulePatchCall<'a, C, A> where C: BorrowMut AppFirewallIngressRulePatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppFirewallIngressRulePatchCall<'a, C, A> @@ -6169,10 +6158,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6192,7 +6178,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6284,7 +6270,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6292,12 +6278,12 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppServiceListCall<'a, C, A> @@ -6439,10 +6425,7 @@ impl<'a, C, A> AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6474,7 +6457,7 @@ impl<'a, C, A> AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppServiceVersionCreateCall<'a, C, A> @@ -6734,10 +6717,7 @@ impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6769,7 +6749,7 @@ impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6866,7 +6846,7 @@ impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6874,12 +6854,12 @@ impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppPatchCall<'a, C, A> @@ -7027,10 +7007,7 @@ impl<'a, C, A> AppAuthorizedCertificateListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7050,7 +7027,7 @@ impl<'a, C, A> AppAuthorizedCertificateListCall<'a, C, A> where C: BorrowMut AppAuthorizedCertificateListCall<'a, C, A> where C: BorrowMut AppAuthorizedCertificateListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppAuthorizedCertificateListCall<'a, C, A> @@ -7301,10 +7278,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7324,7 +7298,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7432,7 +7406,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7440,12 +7414,12 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppServiceVersionInstanceDeleteCall<'a, C, A> @@ -7607,10 +7581,7 @@ impl<'a, C, A> AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7642,7 +7613,7 @@ impl<'a, C, A> AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppServiceVersionPatchCall<'a, C, A> @@ -7922,10 +7893,7 @@ impl<'a, C, A> AppServiceVersionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7945,7 +7913,7 @@ impl<'a, C, A> AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppServiceVersionListCall<'a, C, A> @@ -8207,10 +8175,7 @@ impl<'a, C, A> AppFirewallIngressRuleCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8242,7 +8207,7 @@ impl<'a, C, A> AppFirewallIngressRuleCreateCall<'a, C, A> where C: BorrowMut AppFirewallIngressRuleCreateCall<'a, C, A> where C: BorrowMut AppFirewallIngressRuleCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppFirewallIngressRuleCreateCall<'a, C, A> @@ -8485,10 +8450,7 @@ impl<'a, C, A> AppFirewallIngressRuleBatchUpdateCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8520,7 +8482,7 @@ impl<'a, C, A> AppFirewallIngressRuleBatchUpdateCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8610,7 +8572,7 @@ impl<'a, C, A> AppFirewallIngressRuleBatchUpdateCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8618,12 +8580,12 @@ impl<'a, C, A> AppFirewallIngressRuleBatchUpdateCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppFirewallIngressRuleBatchUpdateCall<'a, C, A> @@ -8763,10 +8725,7 @@ impl<'a, C, A> AppRepairCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8798,7 +8757,7 @@ impl<'a, C, A> AppRepairCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8888,7 +8847,7 @@ impl<'a, C, A> AppRepairCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8896,12 +8855,12 @@ impl<'a, C, A> AppRepairCall<'a, C, A> where C: BorrowMut, A: oau /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppRepairCall<'a, C, A> @@ -9038,10 +8997,7 @@ impl<'a, C, A> AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9061,7 +9017,7 @@ impl<'a, C, A> AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppServiceVersionDeleteCall<'a, C, A> @@ -9312,10 +9268,7 @@ impl<'a, C, A> AppAuthorizedCertificateCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9347,7 +9300,7 @@ impl<'a, C, A> AppAuthorizedCertificateCreateCall<'a, C, A> where C: BorrowMut AppAuthorizedCertificateCreateCall<'a, C, A> where C: BorrowMut AppAuthorizedCertificateCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppAuthorizedCertificateCreateCall<'a, C, A> @@ -9596,10 +9549,7 @@ impl<'a, C, A> AppServiceVersionInstanceDebugCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9631,7 +9581,7 @@ impl<'a, C, A> AppServiceVersionInstanceDebugCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceDebugCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceDebugCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppServiceVersionInstanceDebugCall<'a, C, A> @@ -9899,10 +9849,7 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9922,7 +9869,7 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10010,7 +9957,7 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10018,12 +9965,12 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppServiceGetCall<'a, C, A> @@ -10158,10 +10105,7 @@ impl<'a, C, A> AppAuthorizedCertificateDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10181,7 +10125,7 @@ impl<'a, C, A> AppAuthorizedCertificateDeleteCall<'a, C, A> where C: BorrowMut AppAuthorizedCertificateDeleteCall<'a, C, A> where C: BorrowMut AppAuthorizedCertificateDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppAuthorizedCertificateDeleteCall<'a, C, A> @@ -10427,10 +10371,7 @@ impl<'a, C, A> AppDomainMappingCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10462,7 +10403,7 @@ impl<'a, C, A> AppDomainMappingCreateCall<'a, C, A> where C: BorrowMut AppDomainMappingCreateCall<'a, C, A> where C: BorrowMut AppDomainMappingCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppDomainMappingCreateCall<'a, C, A> @@ -10719,10 +10660,7 @@ impl<'a, C, A> AppDomainMappingPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10754,7 +10692,7 @@ impl<'a, C, A> AppDomainMappingPatchCall<'a, C, A> where C: BorrowMut AppDomainMappingPatchCall<'a, C, A> where C: BorrowMut AppDomainMappingPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppDomainMappingPatchCall<'a, C, A> @@ -11009,10 +10947,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11032,7 +10967,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11120,7 +11055,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11128,12 +11063,12 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppOperationGetCall<'a, C, A> @@ -11281,10 +11216,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11304,7 +11236,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11403,7 +11335,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11411,12 +11343,12 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppLocationListCall<'a, C, A> @@ -11551,10 +11483,7 @@ impl<'a, C, A> AppDomainMappingDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11574,7 +11503,7 @@ impl<'a, C, A> AppDomainMappingDeleteCall<'a, C, A> where C: BorrowMut AppDomainMappingDeleteCall<'a, C, A> where C: BorrowMut AppDomainMappingDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppDomainMappingDeleteCall<'a, C, A> @@ -11827,10 +11756,7 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11862,7 +11788,7 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11976,7 +11902,7 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11984,12 +11910,12 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppServicePatchCall<'a, C, A> @@ -12124,10 +12050,7 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12147,7 +12070,7 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12235,7 +12158,7 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12243,12 +12166,12 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppServiceDeleteCall<'a, C, A> @@ -12367,10 +12290,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12402,7 +12322,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12482,7 +12402,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12490,12 +12410,12 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppCreateCall<'a, C, A> @@ -12635,10 +12555,7 @@ impl<'a, C, A> AppAuthorizedCertificateGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12658,7 +12575,7 @@ impl<'a, C, A> AppAuthorizedCertificateGetCall<'a, C, A> where C: BorrowMut AppAuthorizedCertificateGetCall<'a, C, A> where C: BorrowMut AppAuthorizedCertificateGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppAuthorizedCertificateGetCall<'a, C, A> @@ -12901,10 +12818,7 @@ impl<'a, C, A> AppFirewallIngressRuleGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12924,7 +12838,7 @@ impl<'a, C, A> AppFirewallIngressRuleGetCall<'a, C, A> where C: BorrowMut AppFirewallIngressRuleGetCall<'a, C, A> where C: BorrowMut AppFirewallIngressRuleGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppFirewallIngressRuleGetCall<'a, C, A> @@ -13160,10 +13074,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13183,7 +13094,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13271,7 +13182,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13279,12 +13190,12 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppLocationGetCall<'a, C, A> diff --git a/gen/appengine1_beta4-cli/src/main.rs b/gen/appengine1_beta4-cli/src/main.rs index 05b740f345..07c9de1bd8 100644 --- a/gen/appengine1_beta4-cli/src/main.rs +++ b/gen/appengine1_beta4-cli/src/main.rs @@ -74,13 +74,13 @@ impl<'n> Engine<'n> { "code-bucket" => Some(("codeBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-bucket" => Some(("defaultBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-cookie-expiration" => Some(("defaultCookieExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "enabled", "iap", "id", "location", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -500,8 +500,8 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "split.shard-by" => Some(("split.shardBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "split.allocations" => Some(("split.allocations", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Map })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["allocations", "id", "name", "shard-by", "split"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -597,9 +597,9 @@ impl<'n> Engine<'n> { "endpoints-api-service.rollout-strategy" => Some(("endpointsApiService.rolloutStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "endpoints-api-service.disable-trace-sampling" => Some(("endpointsApiService.disableTraceSampling", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "endpoints-api-service.name" => Some(("endpointsApiService.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "default-expiration" => Some(("defaultExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "default-expiration" => Some(("defaultExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "vm" => Some(("vm", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "instance-class" => Some(("instanceClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -622,9 +622,9 @@ impl<'n> Engine<'n> { "env" => Some(("env", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.min-pending-latency" => Some(("automaticScaling.minPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-received-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-sent-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetSentBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-sent-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetSentPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-received-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "automatic-scaling.network-utilization.target-sent-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetSentBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.min-idle-instances" => Some(("automaticScaling.minIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.max-pending-latency" => Some(("automaticScaling.maxPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.max-idle-instances" => Some(("automaticScaling.maxIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -1161,9 +1161,9 @@ impl<'n> Engine<'n> { "endpoints-api-service.rollout-strategy" => Some(("endpointsApiService.rolloutStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "endpoints-api-service.disable-trace-sampling" => Some(("endpointsApiService.disableTraceSampling", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "endpoints-api-service.name" => Some(("endpointsApiService.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "default-expiration" => Some(("defaultExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "default-expiration" => Some(("defaultExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "vm" => Some(("vm", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "instance-class" => Some(("instanceClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1186,9 +1186,9 @@ impl<'n> Engine<'n> { "env" => Some(("env", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.min-pending-latency" => Some(("automaticScaling.minPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-received-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-sent-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetSentBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-sent-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetSentPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-received-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "automatic-scaling.network-utilization.target-sent-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetSentBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.min-idle-instances" => Some(("automaticScaling.minIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.max-pending-latency" => Some(("automaticScaling.maxPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.max-idle-instances" => Some(("automaticScaling.maxIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -1426,13 +1426,13 @@ impl<'n> Engine<'n> { "code-bucket" => Some(("codeBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-bucket" => Some(("defaultBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-cookie-expiration" => Some(("defaultCookieExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "enabled", "iap", "id", "location", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); diff --git a/gen/appengine1_beta4/Cargo.toml b/gen/appengine1_beta4/Cargo.toml index 53313edb53..edc01398dd 100644 --- a/gen/appengine1_beta4/Cargo.toml +++ b/gen/appengine1_beta4/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/appengine1_beta4/src/lib.rs b/gen/appengine1_beta4/src/lib.rs index e3022fa41c..5b0d39d9fa 100644 --- a/gen/appengine1_beta4/src/lib.rs +++ b/gen/appengine1_beta4/src/lib.rs @@ -412,23 +412,25 @@ pub struct ListInstancesResponse { impl ResponseResult for ListInstancesResponse {} -/// Extra network settings. Only applicable for VM runtimes. +/// Response message for Modules.ListModules. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [modules list apps](struct.AppModuleListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Network { - /// Tag to apply to the VM instance during creation. - #[serde(rename="instanceTag")] - pub instance_tag: Option, - /// List of ports, or port pairs, to forward from the virtual machine to the application container. - #[serde(rename="forwardedPorts")] - pub forwarded_ports: Option>, - /// Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default. - pub name: Option, +pub struct ListModulesResponse { + /// Continuation token for fetching the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The modules belonging to the requested application. + pub modules: Option>, } -impl Part for Network {} +impl ResponseResult for ListModulesResponse {} /// An Instance resource is the computing unit that App Engine uses to automatically scale an application. @@ -456,8 +458,8 @@ pub struct Instance { pub vm_ip: Option, /// Average queries per second (QPS) over the last minute.@OutputOnly pub qps: Option, - /// Relative name of the instance within the version. Example: instance-1.@OutputOnly - pub id: Option, + /// Availability of the instance.@OutputOnly + pub availability: Option, /// Full path to the Instance resource in the API. Example: apps/myapp/modules/default/versions/v1/instances/instance-1.@OutputOnly pub name: Option, /// Number of errors since this instance was started.@OutputOnly @@ -468,8 +470,8 @@ pub struct Instance { /// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly #[serde(rename="vmUnlocked")] pub vm_unlocked: Option, - /// Availability of the instance.@OutputOnly - pub availability: Option, + /// Relative name of the instance within the version. Example: instance-1.@OutputOnly + pub id: Option, /// Average latency (ms) over the last minute.@OutputOnly #[serde(rename="averageLatency")] pub average_latency: Option, @@ -505,12 +507,12 @@ pub struct Version { /// Cloud Endpoints configuration.If endpoints_api_service is set, the Cloud Endpoints Extensible Service Proxy will be provided to serve the API implemented by the app. #[serde(rename="endpointsApiService")] pub endpoints_api_service: Option, - /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set. - #[serde(rename="defaultExpiration")] - pub default_expiration: Option, /// A module with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. #[serde(rename="basicScaling")] pub basic_scaling: Option, + /// Duration that static files should be cached by web proxies and browsers. Only applicable if the corresponding StaticFilesHandler (https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#staticfileshandler) does not specify its own expiration time.Only returned in GET requests if view=FULL is set. + #[serde(rename="defaultExpiration")] + pub default_expiration: Option, /// A module with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. #[serde(rename="manualScaling")] pub manual_scaling: Option, @@ -614,16 +616,16 @@ impl ResponseResult for ListLocationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { - /// The canonical id for this location. For example: "us-east1". - #[serde(rename="locationId")] - pub location_id: Option, + /// The friendly name for this location, typically a nearby city name. For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, /// Cross-service attributes for the location. For example /// {"cloud.googleapis.com/region": "us-east1"} /// pub labels: Option>, - /// The friendly name for this location, typically a nearby city name. For example, "Tokyo". - #[serde(rename="displayName")] - pub display_name: Option, + /// The canonical id for this location. For example: "us-east1". + #[serde(rename="locationId")] + pub location_id: Option, /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1" pub name: Option, /// Service-specific metadata. For example the available capacity at the given location. @@ -692,25 +694,23 @@ pub struct Resources { impl Part for Resources {} -/// Response message for Modules.ListModules. +/// Extra network settings. Only applicable for VM runtimes. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [modules list apps](struct.AppModuleListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListModulesResponse { - /// Continuation token for fetching the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The modules belonging to the requested application. - pub modules: Option>, +pub struct Network { + /// Tag to apply to the VM instance during creation. + #[serde(rename="instanceTag")] + pub instance_tag: Option, + /// List of ports, or port pairs, to forward from the virtual machine to the application container. + #[serde(rename="forwardedPorts")] + pub forwarded_ports: Option>, + /// Google Cloud Platform network where the virtual machines are created. Specify the short name, not the resource path.Defaults to default. + pub name: Option, } -impl ResponseResult for ListModulesResponse {} +impl Part for Network {} /// The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). The error model is designed to be: @@ -754,36 +754,6 @@ pub struct BasicScaling { impl Part for BasicScaling {} -/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StaticFilesHandler { - /// MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension. - #[serde(rename="mimeType")] - pub mime_type: Option, - /// Time a static file served by this handler should be cached. - pub expiration: Option, - /// Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern. - pub path: Option, - /// Regular expression that matches the file paths for all files that should be referenced by this handler. - #[serde(rename="uploadPathRegex")] - pub upload_path_regex: Option, - /// Whether this handler should match the request if the file referenced by the handler does not exist. - #[serde(rename="requireMatchingFile")] - pub require_matching_file: Option, - /// HTTP headers to use for all responses from these URLs. - #[serde(rename="httpHeaders")] - pub http_headers: Option>, - /// Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas. - #[serde(rename="applicationReadable")] - pub application_readable: Option, -} - -impl Part for StaticFilesHandler {} - - /// Target scaling by network usage. Only applicable for VM runtimes. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -793,15 +763,15 @@ pub struct NetworkUtilization { /// Target bytes received per second. #[serde(rename="targetReceivedBytesPerSec")] pub target_received_bytes_per_sec: Option, - /// Target packets sent per second. - #[serde(rename="targetSentPacketsPerSec")] - pub target_sent_packets_per_sec: Option, /// Target bytes sent per second. #[serde(rename="targetSentBytesPerSec")] pub target_sent_bytes_per_sec: Option, /// Target packets received per second. #[serde(rename="targetReceivedPacketsPerSec")] pub target_received_packets_per_sec: Option, + /// Target packets sent per second. + #[serde(rename="targetSentPacketsPerSec")] + pub target_sent_packets_per_sec: Option, } impl Part for NetworkUtilization {} @@ -940,26 +910,24 @@ pub struct HealthCheck { impl Part for HealthCheck {} -/// Identity-Aware Proxy +/// Custom static error page to be served when an error occurs. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct IdentityAwareProxy { - /// OAuth2 client ID to use for the authentication flow. - #[serde(rename="oauth2ClientId")] - pub oauth2_client_id: Option, - /// Whether the serving infrastructure will authenticate and authorize all incoming requests.If true, the oauth2_client_id and oauth2_client_secret fields must be non-empty. - pub enabled: Option, - /// For security reasons, this value cannot be retrieved via the API. Instead, the SHA-256 hash of the value is returned in the oauth2_client_secret_sha256 field.@InputOnly - #[serde(rename="oauth2ClientSecret")] - pub oauth2_client_secret: Option, - /// Hex-encoded SHA-256 hash of the client secret.@OutputOnly - #[serde(rename="oauth2ClientSecretSha256")] - pub oauth2_client_secret_sha256: Option, +pub struct ErrorHandler { + /// Error condition this handler applies to. + #[serde(rename="errorCode")] + pub error_code: Option, + /// MIME type of file. Defaults to text/html. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// Static file content to be served for this error. + #[serde(rename="staticFile")] + pub static_file: Option, } -impl Part for IdentityAwareProxy {} +impl Part for ErrorHandler {} /// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static directory handlers make it easy to serve the entire contents of a directory as static files. @@ -989,24 +957,26 @@ pub struct StaticDirectoryHandler { impl Part for StaticDirectoryHandler {} -/// Custom static error page to be served when an error occurs. +/// Identity-Aware Proxy /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ErrorHandler { - /// Error condition this handler applies to. - #[serde(rename="errorCode")] - pub error_code: Option, - /// MIME type of file. Defaults to text/html. - #[serde(rename="mimeType")] - pub mime_type: Option, - /// Static file content to be served for this error. - #[serde(rename="staticFile")] - pub static_file: Option, +pub struct IdentityAwareProxy { + /// OAuth2 client ID to use for the authentication flow. + #[serde(rename="oauth2ClientId")] + pub oauth2_client_id: Option, + /// Whether the serving infrastructure will authenticate and authorize all incoming requests.If true, the oauth2_client_id and oauth2_client_secret fields must be non-empty. + pub enabled: Option, + /// For security reasons, this value cannot be retrieved via the API. Instead, the SHA-256 hash of the value is returned in the oauth2_client_secret_sha256 field.@InputOnly + #[serde(rename="oauth2ClientSecret")] + pub oauth2_client_secret: Option, + /// Hex-encoded SHA-256 hash of the client secret.@OutputOnly + #[serde(rename="oauth2ClientSecretSha256")] + pub oauth2_client_secret_sha256: Option, } -impl Part for ErrorHandler {} +impl Part for IdentityAwareProxy {} /// Automatic scaling is based on request rate, response latencies, and other application metrics. @@ -1082,11 +1052,11 @@ pub struct UrlMap { /// Uses API Endpoints to handle requests. #[serde(rename="apiEndpoint")] pub api_endpoint: Option, - /// Level of login required to access this resource. - pub login: Option, /// 30x code to use when performing redirects for the secure field. Defaults to 302. #[serde(rename="redirectHttpResponseCode")] pub redirect_http_response_code: Option, + /// Level of login required to access this resource. + pub login: Option, } impl Part for UrlMap {} @@ -1185,15 +1155,15 @@ pub struct Application { /// Cookie expiration policy for this application. #[serde(rename="defaultCookieExpiration")] pub default_cookie_expiration: Option, - /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp. - pub id: Option, + /// no description provided + pub iap: Option, /// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US pub location: Option, /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account. #[serde(rename="authDomain")] pub auth_domain: Option, - /// no description provided - pub iap: Option, + /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp. + pub id: Option, } impl RequestValue for Application {} @@ -1249,6 +1219,36 @@ pub struct ApiConfigHandler { impl Part for ApiConfigHandler {} +/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StaticFilesHandler { + /// MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// Time a static file served by this handler should be cached. + pub expiration: Option, + /// Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern. + pub path: Option, + /// Regular expression that matches the file paths for all files that should be referenced by this handler. + #[serde(rename="uploadPathRegex")] + pub upload_path_regex: Option, + /// Whether this handler should match the request if the file referenced by the handler does not exist. + #[serde(rename="requireMatchingFile")] + pub require_matching_file: Option, + /// HTTP headers to use for all responses from these URLs. + #[serde(rename="httpHeaders")] + pub http_headers: Option>, + /// Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas. + #[serde(rename="applicationReadable")] + pub application_readable: Option, +} + +impl Part for StaticFilesHandler {} + + /// Third-party Python runtime library that is required by the application. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1348,12 +1348,12 @@ impl Part for TrafficSplit {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Module { - /// Mapping that defines fractional HTTP traffic diversion to different versions within the module. - pub split: Option, /// Relative name of the module within the application. Example: default.@OutputOnly pub id: Option, /// Full path to the Module resource in the API. Example: apps/myapp/modules/default.@OutputOnly pub name: Option, + /// Mapping that defines fractional HTTP traffic diversion to different versions within the module. + pub split: Option, } impl RequestValue for Module {} @@ -1990,10 +1990,7 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2025,7 +2022,7 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2139,7 +2136,7 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2147,12 +2144,12 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppModulePatchCall<'a, C, A> @@ -2287,10 +2284,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2310,7 +2304,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2398,7 +2392,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2406,12 +2400,12 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppModuleGetCall<'a, C, A> @@ -2550,10 +2544,7 @@ impl<'a, C, A> AppModuleVersionInstanceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2573,7 +2564,7 @@ impl<'a, C, A> AppModuleVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppModuleVersionInstanceGetCall<'a, C, A> @@ -2837,10 +2828,7 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2860,7 +2848,7 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2952,7 +2940,7 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2960,12 +2948,12 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppModuleListCall<'a, C, A> @@ -3084,10 +3072,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3119,7 +3104,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3199,7 +3184,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3207,12 +3192,12 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppCreateCall<'a, C, A> @@ -3359,10 +3344,7 @@ impl<'a, C, A> AppModuleVersionInstanceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3382,7 +3364,7 @@ impl<'a, C, A> AppModuleVersionInstanceListCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceListCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppModuleVersionInstanceListCall<'a, C, A> @@ -3646,10 +3628,7 @@ impl<'a, C, A> AppModuleVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3669,7 +3648,7 @@ impl<'a, C, A> AppModuleVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppModuleVersionInstanceDeleteCall<'a, C, A> @@ -3936,10 +3915,7 @@ impl<'a, C, A> AppModuleVersionInstanceDebugCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3971,7 +3947,7 @@ impl<'a, C, A> AppModuleVersionInstanceDebugCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceDebugCall<'a, C, A> where C: BorrowMut AppModuleVersionInstanceDebugCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppModuleVersionInstanceDebugCall<'a, C, A> @@ -4242,10 +4218,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4265,7 +4238,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4350,7 +4323,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4358,12 +4331,12 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppGetCall<'a, C, A> @@ -4498,10 +4471,7 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4521,7 +4491,7 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4609,7 +4579,7 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4617,12 +4587,12 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppModuleDeleteCall<'a, C, A> @@ -4769,10 +4739,7 @@ impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4804,7 +4771,7 @@ impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4901,7 +4868,7 @@ impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4909,12 +4876,12 @@ impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppPatchCall<'a, C, A> @@ -5049,10 +5016,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5072,7 +5036,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5160,7 +5124,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5168,12 +5132,12 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppOperationGetCall<'a, C, A> @@ -5308,10 +5272,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5331,7 +5292,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5419,7 +5380,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5427,12 +5388,12 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppLocationGetCall<'a, C, A> @@ -5580,10 +5541,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5603,7 +5561,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5702,7 +5660,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5710,12 +5668,12 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppLocationListCall<'a, C, A> @@ -5868,10 +5826,7 @@ impl<'a, C, A> AppModuleVersionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5903,7 +5858,7 @@ impl<'a, C, A> AppModuleVersionPatchCall<'a, C, A> where C: BorrowMut AppModuleVersionPatchCall<'a, C, A> where C: BorrowMut AppModuleVersionPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppModuleVersionPatchCall<'a, C, A> @@ -6181,10 +6136,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6204,7 +6156,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6303,7 +6255,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6311,12 +6263,12 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AppOperationListCall<'a, C, A> @@ -6453,10 +6405,7 @@ impl<'a, C, A> AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6476,7 +6425,7 @@ impl<'a, C, A> AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppModuleVersionDeleteCall<'a, C, A> @@ -6729,10 +6678,7 @@ impl<'a, C, A> AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6764,7 +6710,7 @@ impl<'a, C, A> AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppModuleVersionCreateCall<'a, C, A> @@ -7019,10 +6965,7 @@ impl<'a, C, A> AppModuleVersionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7042,7 +6985,7 @@ impl<'a, C, A> AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppModuleVersionGetCall<'a, C, A> @@ -7310,10 +7253,7 @@ impl<'a, C, A> AppModuleVersionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7333,7 +7273,7 @@ impl<'a, C, A> AppModuleVersionListCall<'a, C, A> where C: BorrowMut AppModuleVersionListCall<'a, C, A> where C: BorrowMut AppModuleVersionListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AppModuleVersionListCall<'a, C, A> diff --git a/gen/appengine1_beta5-cli/src/main.rs b/gen/appengine1_beta5-cli/src/main.rs index f227bb5d90..24ef5840d3 100644 --- a/gen/appengine1_beta5-cli/src/main.rs +++ b/gen/appengine1_beta5-cli/src/main.rs @@ -74,13 +74,13 @@ impl<'n> Engine<'n> { "code-bucket" => Some(("codeBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-bucket" => Some(("defaultBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-cookie-expiration" => Some(("defaultCookieExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "enabled", "iap", "id", "location", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -454,13 +454,13 @@ impl<'n> Engine<'n> { "code-bucket" => Some(("codeBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-bucket" => Some(("defaultBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-cookie-expiration" => Some(("defaultCookieExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "auth-domain" => Some(("authDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-domain", "code-bucket", "default-bucket", "default-cookie-expiration", "default-hostname", "enabled", "iap", "id", "location", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -712,10 +712,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "split.shard-by" => Some(("split.shardBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "split.allocations" => Some(("split.allocations", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Map })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["allocations", "id", "name", "shard-by", "split"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -822,7 +822,10 @@ impl<'n> Engine<'n> { "api-config.auth-fail-action" => Some(("apiConfig.authFailAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.login" => Some(("apiConfig.login", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.script" => Some(("apiConfig.script", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "threadsafe" => Some(("threadsafe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.subnetwork-name" => Some(("network.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "health-check.restart-threshold" => Some(("healthCheck.restartThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "health-check.check-interval" => Some(("healthCheck.checkInterval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "health-check.unhealthy-threshold" => Some(("healthCheck.unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -835,9 +838,9 @@ impl<'n> Engine<'n> { "disk-usage-bytes" => Some(("diskUsageBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.min-pending-latency" => Some(("automaticScaling.minPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-received-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-sent-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetSentBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-sent-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetSentPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-received-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "automatic-scaling.network-utilization.target-sent-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetSentBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.min-idle-instances" => Some(("automaticScaling.minIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.max-pending-latency" => Some(("automaticScaling.maxPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.max-idle-instances" => Some(("automaticScaling.maxIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -861,10 +864,7 @@ impl<'n> Engine<'n> { "inbound-services" => Some(("inboundServices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "beta-settings" => Some(("betaSettings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "deployment.container.image" => Some(("deployment.container.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "network.subnetwork-name" => Some(("network.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "threadsafe" => Some(("threadsafe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "runtime-api-version" => Some(("runtimeApiVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1388,7 +1388,10 @@ impl<'n> Engine<'n> { "api-config.auth-fail-action" => Some(("apiConfig.authFailAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.login" => Some(("apiConfig.login", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "api-config.script" => Some(("apiConfig.script", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "threadsafe" => Some(("threadsafe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.subnetwork-name" => Some(("network.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "health-check.restart-threshold" => Some(("healthCheck.restartThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "health-check.check-interval" => Some(("healthCheck.checkInterval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "health-check.unhealthy-threshold" => Some(("healthCheck.unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -1401,9 +1404,9 @@ impl<'n> Engine<'n> { "disk-usage-bytes" => Some(("diskUsageBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.min-pending-latency" => Some(("automaticScaling.minPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-received-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-sent-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetSentBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-sent-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetSentPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.network-utilization.target-received-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "automatic-scaling.network-utilization.target-sent-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetSentBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.min-idle-instances" => Some(("automaticScaling.minIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.max-pending-latency" => Some(("automaticScaling.maxPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.max-idle-instances" => Some(("automaticScaling.maxIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -1427,10 +1430,7 @@ impl<'n> Engine<'n> { "inbound-services" => Some(("inboundServices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "beta-settings" => Some(("betaSettings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "deployment.container.image" => Some(("deployment.container.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "network.subnetwork-name" => Some(("network.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "threadsafe" => Some(("threadsafe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "runtime-api-version" => Some(("runtimeApiVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), diff --git a/gen/appengine1_beta5/Cargo.toml b/gen/appengine1_beta5/Cargo.toml index 770c28590b..9cb8f7592d 100644 --- a/gen/appengine1_beta5/Cargo.toml +++ b/gen/appengine1_beta5/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/appengine1_beta5/src/lib.rs b/gen/appengine1_beta5/src/lib.rs index 01c52001d8..f06f2c050f 100644 --- a/gen/appengine1_beta5/src/lib.rs +++ b/gen/appengine1_beta5/src/lib.rs @@ -447,59 +447,72 @@ impl Part for Network {} pub struct Service { /// Relative name of the service within the application. Example: default.@OutputOnly pub id: Option, - /// Mapping that defines fractional HTTP traffic diversion to different versions within the service. - pub split: Option, /// Full path to the Service resource in the API. Example: apps/myapp/services/default.@OutputOnly pub name: Option, + /// Mapping that defines fractional HTTP traffic diversion to different versions within the service. + pub split: Option, } impl RequestValue for Service {} impl ResponseResult for Service {} -/// An Application resource contains the top-level configuration of an App Engine application. +/// An Instance resource is the computing unit that App Engine uses to automatically scale an application. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [create apps](struct.AppCreateCall.html) (request) -/// * [patch apps](struct.AppPatchCall.html) (request) -/// * [get apps](struct.AppGetCall.html) (response) +/// * [services versions instances get apps](struct.AppServiceVersionInstanceGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Application { - /// Hostname used to reach the application, as resolved by App Engine.@OutputOnly - #[serde(rename="defaultHostname")] - pub default_hostname: Option, - /// Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly +pub struct Instance { + /// App Engine release this instance is running on.@OutputOnly + #[serde(rename="appEngineRelease")] + pub app_engine_release: Option, + /// Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmId")] + pub vm_id: Option, + /// Total memory in use (bytes).@OutputOnly + #[serde(rename="memoryUsage")] + pub memory_usage: Option, + /// The IP address of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmIp")] + pub vm_ip: Option, + /// Average queries per second (QPS) over the last minute.@OutputOnly + pub qps: Option, + /// Availability of the instance.@OutputOnly + pub availability: Option, + /// Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1.@OutputOnly pub name: Option, - /// A Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands.@OutputOnly - #[serde(rename="codeBucket")] - pub code_bucket: Option, - /// A Google Cloud Storage bucket that can be used by the application to store content.@OutputOnly - #[serde(rename="defaultBucket")] - pub default_bucket: Option, - /// HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent.@OutputOnly - #[serde(rename="dispatchRules")] - pub dispatch_rules: Option>, - /// Cookie expiration policy for this application. - #[serde(rename="defaultCookieExpiration")] - pub default_cookie_expiration: Option, - /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp. + /// Number of errors since this instance was started.@OutputOnly + pub errors: Option, + /// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmStatus")] + pub vm_status: Option, + /// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmUnlocked")] + pub vm_unlocked: Option, + /// Relative name of the instance within the version. Example: instance-1.@OutputOnly pub id: Option, - /// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US - pub location: Option, - /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account. - #[serde(rename="authDomain")] - pub auth_domain: Option, - /// no description provided - pub iap: Option, + /// Average latency (ms) over the last minute.@OutputOnly + #[serde(rename="averageLatency")] + pub average_latency: Option, + /// Number of requests since this instance was started.@OutputOnly + pub requests: Option, + /// Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmName")] + pub vm_name: Option, + /// Time that this instance was started.@OutputOnly + #[serde(rename="startTimestamp")] + pub start_timestamp: Option, + /// Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.@OutputOnly + #[serde(rename="vmZoneName")] + pub vm_zone_name: Option, } -impl RequestValue for Application {} -impl ResponseResult for Application {} +impl ResponseResult for Instance {} /// A Version resource is a specific set of source code and configuration files that are deployed into a service. @@ -509,8 +522,8 @@ impl ResponseResult for Application {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [services versions get apps](struct.AppServiceVersionGetCall.html) (response) /// * [services versions create apps](struct.AppServiceVersionCreateCall.html) (request) +/// * [services versions get apps](struct.AppServiceVersionGetCall.html) (response) /// * [services versions patch apps](struct.AppServiceVersionPatchCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -550,8 +563,8 @@ pub struct Version { pub serving_status: Option, /// Relative name of the version within the module. Example: v1. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names: "default", "latest", and any name with the prefix "ah-". pub id: Option, - /// Whether multiple requests can be dispatched to this version at once. - pub threadsafe: Option, + /// Extra network settings. Only applicable for VM runtimes. + pub network: Option, /// The version of the API in the given runtime environment. Please see the app.yaml reference for valid values at https://cloud.google.com/appengine/docs/standard//config/appref #[serde(rename="runtimeApiVersion")] pub runtime_api_version: Option, @@ -561,8 +574,8 @@ pub struct Version { /// Files that match this pattern will not be built into this version. Only applicable for Go runtimes.Only returned in GET requests if view=FULL is set. #[serde(rename="nobuildFilesRegex")] pub nobuild_files_regex: Option, - /// Extra network settings. Only applicable for VM runtimes. - pub network: Option, + /// Whether multiple requests can be dispatched to this version at once. + pub threadsafe: Option, /// An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted.Only returned in GET requests if view=FULL is set. pub handlers: Option>, /// Configures health checking for VM instances. Unhealthy instances are be stopped and replaced with new instances. Only applicable for VM runtimes.Only returned in GET requests if view=FULL is set. @@ -630,16 +643,16 @@ impl ResponseResult for ListLocationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { - /// The canonical id for this location. For example: "us-east1". - #[serde(rename="locationId")] - pub location_id: Option, + /// The friendly name for this location, typically a nearby city name. For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, /// Cross-service attributes for the location. For example /// {"cloud.googleapis.com/region": "us-east1"} /// pub labels: Option>, - /// The friendly name for this location, typically a nearby city name. For example, "Tokyo". - #[serde(rename="displayName")] - pub display_name: Option, + /// The canonical id for this location. For example: "us-east1". + #[serde(rename="locationId")] + pub location_id: Option, /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1" pub name: Option, /// Service-specific metadata. For example the available capacity at the given location. @@ -693,16 +706,16 @@ impl Part for CpuUtilization {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Resources { - /// Volumes mounted within the app container. - pub volumes: Option>, + /// Memory (GB) needed. + #[serde(rename="memoryGb")] + pub memory_gb: Option, /// Disk size (GB) needed. #[serde(rename="diskGb")] pub disk_gb: Option, /// Number of CPU cores needed. pub cpu: Option, - /// Memory (GB) needed. - #[serde(rename="memoryGb")] - pub memory_gb: Option, + /// Volumes mounted within the app container. + pub volumes: Option>, } impl Part for Resources {} @@ -749,36 +762,6 @@ pub struct BasicScaling { impl Part for BasicScaling {} -/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StaticFilesHandler { - /// MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension. - #[serde(rename="mimeType")] - pub mime_type: Option, - /// Time a static file served by this handler should be cached. - pub expiration: Option, - /// Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern. - pub path: Option, - /// Regular expression that matches the file paths for all files that should be referenced by this handler. - #[serde(rename="uploadPathRegex")] - pub upload_path_regex: Option, - /// Whether this handler should match the request if the file referenced by the handler does not exist. - #[serde(rename="requireMatchingFile")] - pub require_matching_file: Option, - /// Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas. - #[serde(rename="applicationReadable")] - pub application_readable: Option, - /// HTTP headers to use for all responses from these URLs. - #[serde(rename="httpHeaders")] - pub http_headers: Option>, -} - -impl Part for StaticFilesHandler {} - - /// Target scaling by network usage. Only applicable for VM runtimes. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -788,15 +771,15 @@ pub struct NetworkUtilization { /// Target bytes received per second. #[serde(rename="targetReceivedBytesPerSec")] pub target_received_bytes_per_sec: Option, - /// Target packets sent per second. - #[serde(rename="targetSentPacketsPerSec")] - pub target_sent_packets_per_sec: Option, /// Target bytes sent per second. #[serde(rename="targetSentBytesPerSec")] pub target_sent_bytes_per_sec: Option, /// Target packets received per second. #[serde(rename="targetReceivedPacketsPerSec")] pub target_received_packets_per_sec: Option, + /// Target packets sent per second. + #[serde(rename="targetSentPacketsPerSec")] + pub target_sent_packets_per_sec: Option, } impl Part for NetworkUtilization {} @@ -935,6 +918,26 @@ pub struct HealthCheck { impl Part for HealthCheck {} +/// Custom static error page to be served when an error occurs. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ErrorHandler { + /// Error condition this handler applies to. + #[serde(rename="errorCode")] + pub error_code: Option, + /// MIME type of file. Defaults to text/html. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// Static file content to be served for this error. + #[serde(rename="staticFile")] + pub static_file: Option, +} + +impl Part for ErrorHandler {} + + /// Identity-Aware Proxy /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -957,26 +960,6 @@ pub struct IdentityAwareProxy { impl Part for IdentityAwareProxy {} -/// Custom static error page to be served when an error occurs. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ErrorHandler { - /// Error condition this handler applies to. - #[serde(rename="errorCode")] - pub error_code: Option, - /// MIME type of file. Defaults to text/html. - #[serde(rename="mimeType")] - pub mime_type: Option, - /// Static file content to be served for this error. - #[serde(rename="staticFile")] - pub static_file: Option, -} - -impl Part for ErrorHandler {} - - /// Automatic scaling is based on request rate, response latencies, and other application metrics. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1047,11 +1030,11 @@ pub struct UrlMap { /// Uses API Endpoints to handle requests. #[serde(rename="apiEndpoint")] pub api_endpoint: Option, - /// Level of login required to access this resource. - pub login: Option, /// 30x code to use when performing redirects for the secure field. Defaults to 302. #[serde(rename="redirectHttpResponseCode")] pub redirect_http_response_code: Option, + /// Level of login required to access this resource. + pub login: Option, } impl Part for UrlMap {} @@ -1120,62 +1103,49 @@ pub struct ListOperationsResponse { impl ResponseResult for ListOperationsResponse {} -/// An Instance resource is the computing unit that App Engine uses to automatically scale an application. +/// An Application resource contains the top-level configuration of an App Engine application. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [services versions instances get apps](struct.AppServiceVersionInstanceGetCall.html) (response) +/// * [create apps](struct.AppCreateCall.html) (request) +/// * [patch apps](struct.AppPatchCall.html) (request) +/// * [get apps](struct.AppGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Instance { - /// Time that this instance was started.@OutputOnly - #[serde(rename="startTimestamp")] - pub start_timestamp: Option, - /// Virtual machine ID of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly - #[serde(rename="vmId")] - pub vm_id: Option, - /// Total memory in use (bytes).@OutputOnly - #[serde(rename="memoryUsage")] - pub memory_usage: Option, - /// The IP address of this instance. Only applicable for instances in App Engine flexible environment.@OutputOnly - #[serde(rename="vmIp")] - pub vm_ip: Option, - /// Average queries per second (QPS) over the last minute.@OutputOnly - pub qps: Option, - /// Availability of the instance.@OutputOnly - pub availability: Option, - /// Full path to the Instance resource in the API. Example: apps/myapp/services/default/versions/v1/instances/instance-1.@OutputOnly +pub struct Application { + /// Hostname used to reach the application, as resolved by App Engine.@OutputOnly + #[serde(rename="defaultHostname")] + pub default_hostname: Option, + /// Full path to the Application resource in the API. Example: apps/myapp.@OutputOnly pub name: Option, - /// Number of errors since this instance was started.@OutputOnly - pub errors: Option, - /// Status of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly - #[serde(rename="vmStatus")] - pub vm_status: Option, - /// Whether this instance is in debug mode. Only applicable for instances in App Engine flexible environment.@OutputOnly - #[serde(rename="vmUnlocked")] - pub vm_unlocked: Option, - /// Relative name of the instance within the version. Example: instance-1.@OutputOnly + /// A Google Cloud Storage bucket that can be used for storing files associated with this application. This bucket is associated with the application and can be used by the gcloud deployment commands.@OutputOnly + #[serde(rename="codeBucket")] + pub code_bucket: Option, + /// A Google Cloud Storage bucket that can be used by the application to store content.@OutputOnly + #[serde(rename="defaultBucket")] + pub default_bucket: Option, + /// HTTP path dispatch rules for requests to the application that do not explicitly target a service or version. Rules are order-dependent.@OutputOnly + #[serde(rename="dispatchRules")] + pub dispatch_rules: Option>, + /// Cookie expiration policy for this application. + #[serde(rename="defaultCookieExpiration")] + pub default_cookie_expiration: Option, + /// no description provided + pub iap: Option, + /// Location from which this application will be run. Application instances will run out of data centers in the chosen location, which is also where all of the application's end user content is stored.Defaults to us-central.Options are:us-central - Central USeurope-west - Western Europeus-east1 - Eastern US + pub location: Option, + /// Google Apps authentication domain that controls which users can access this application.Defaults to open access for any Google Account. + #[serde(rename="authDomain")] + pub auth_domain: Option, + /// Identifier of the Application resource. This identifier is equivalent to the project ID of the Google Cloud Platform project where you want to deploy your application. Example: myapp. pub id: Option, - /// Average latency (ms) over the last minute.@OutputOnly - #[serde(rename="averageLatency")] - pub average_latency: Option, - /// Number of requests since this instance was started.@OutputOnly - pub requests: Option, - /// Name of the virtual machine where this instance lives. Only applicable for instances in App Engine flexible environment.@OutputOnly - #[serde(rename="vmName")] - pub vm_name: Option, - /// App Engine release this instance is running on.@OutputOnly - #[serde(rename="appEngineRelease")] - pub app_engine_release: Option, - /// Zone where the virtual machine is located. Only applicable for instances in App Engine flexible environment.@OutputOnly - #[serde(rename="vmZoneName")] - pub vm_zone_name: Option, } -impl ResponseResult for Instance {} +impl RequestValue for Application {} +impl ResponseResult for Application {} /// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. @@ -1227,6 +1197,36 @@ pub struct ApiConfigHandler { impl Part for ApiConfigHandler {} +/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StaticFilesHandler { + /// MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// Time a static file served by this handler should be cached. + pub expiration: Option, + /// Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern. + pub path: Option, + /// Regular expression that matches the file paths for all files that should be referenced by this handler. + #[serde(rename="uploadPathRegex")] + pub upload_path_regex: Option, + /// Whether this handler should match the request if the file referenced by the handler does not exist. + #[serde(rename="requireMatchingFile")] + pub require_matching_file: Option, + /// HTTP headers to use for all responses from these URLs. + #[serde(rename="httpHeaders")] + pub http_headers: Option>, + /// Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas. + #[serde(rename="applicationReadable")] + pub application_readable: Option, +} + +impl Part for StaticFilesHandler {} + + /// Third-party Python runtime library that is required by the application. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1309,11 +1309,11 @@ impl Part for RequestUtilization {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListServicesResponse { - /// The services belonging to the requested application. - pub services: Option>, /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, + /// The services belonging to the requested application. + pub services: Option>, } impl ResponseResult for ListServicesResponse {} @@ -1960,10 +1960,7 @@ impl<'a, C, A> AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1983,7 +1980,7 @@ impl<'a, C, A> AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceListCall<'a, C, A> where C: BorrowMut AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2285,7 +2279,7 @@ impl<'a, C, A> AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2580,7 +2571,7 @@ impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2677,7 +2668,7 @@ impl<'a, C, A> AppPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2836,10 +2827,7 @@ impl<'a, C, A> AppServiceVersionInstanceDebugCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2871,7 +2859,7 @@ impl<'a, C, A> AppServiceVersionInstanceDebugCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceDebugCall<'a, C, A> where C: BorrowMut AppServiceGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3162,7 +3147,7 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3250,7 +3235,7 @@ impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3402,10 +3387,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3425,7 +3407,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3533,7 +3515,7 @@ impl<'a, C, A> AppServiceVersionInstanceDeleteCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3699,10 +3681,7 @@ impl<'a, C, A> AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3734,7 +3713,7 @@ impl<'a, C, A> AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut AppServiceVersionPatchCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4037,7 +4013,7 @@ impl<'a, C, A> AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppServiceVersionListCall<'a, C, A> where C: BorrowMut AppOperationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4317,7 +4290,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4405,7 +4378,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4561,10 +4534,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4584,7 +4554,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4676,7 +4646,7 @@ impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4837,10 +4807,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4860,7 +4827,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4959,7 +4926,7 @@ impl<'a, C, A> AppLocationListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5111,10 +5078,7 @@ impl<'a, C, A> AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5134,7 +5098,7 @@ impl<'a, C, A> AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppServiceVersionInstanceGetCall<'a, C, A> where C: BorrowMut AppOperationListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5426,7 +5387,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5525,7 +5486,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5675,10 +5636,7 @@ impl<'a, C, A> AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5698,7 +5656,7 @@ impl<'a, C, A> AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut AppLocationGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5967,7 +5922,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6055,7 +6010,7 @@ impl<'a, C, A> AppLocationGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6220,10 +6175,7 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6255,7 +6207,7 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6369,7 +6321,7 @@ impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6520,10 +6472,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6543,7 +6492,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6628,7 +6577,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6776,10 +6725,7 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6799,7 +6745,7 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6887,7 +6833,7 @@ impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7019,10 +6965,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7054,7 +6997,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7134,7 +7077,7 @@ impl<'a, C, A> AppCreateCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7289,10 +7232,7 @@ impl<'a, C, A> AppServiceVersionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7312,7 +7252,7 @@ impl<'a, C, A> AppServiceVersionGetCall<'a, C, A> where C: BorrowMut AppServiceVersionGetCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with appsactivity (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appsactivity1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-appsactivity1] path = "../appsactivity1" -version = "1.0.8+20181011" +version = "1.0.8+20190402" diff --git a/gen/appsactivity1-cli/README.md b/gen/appsactivity1-cli/README.md index 37eb27bc20..ffa2294868 100644 --- a/gen/appsactivity1-cli/README.md +++ b/gen/appsactivity1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *appsactivity* API at revision *20181011*. The CLI is at version *1.0.8*. +This documentation was generated from the *appsactivity* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash appsactivity1 [options] diff --git a/gen/appsactivity1-cli/mkdocs.yml b/gen/appsactivity1-cli/mkdocs.yml index c604dab18a..2df35f0af8 100644 --- a/gen/appsactivity1-cli/mkdocs.yml +++ b/gen/appsactivity1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appsactivity v1.0.8+20181011 +site_name: appsactivity v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-appsactivity1-cli site_description: A complete library to interact with appsactivity (protocol v1) diff --git a/gen/appsactivity1-cli/src/main.rs b/gen/appsactivity1-cli/src/main.rs index 6c1b30523d..d67ed11e82 100644 --- a/gen/appsactivity1-cli/src/main.rs +++ b/gen/appsactivity1-cli/src/main.rs @@ -220,7 +220,7 @@ fn main() { let arg_data = [ ("activities", "methods: 'list'", vec![ ("list", - Some(r##"Returns a list of activities visible to the current logged in user. Visible activities are determined by the visiblity settings of the object that was acted on, e.g. Drive files a user can see. An activity is a record of past events. Multiple events may be merged if they are similar. A request is scoped to activities from a given Google service using the source parameter."##), + Some(r##"Returns a list of activities visible to the current logged in user. Visible activities are determined by the visibility settings of the object that was acted on, e.g. Drive files a user can see. An activity is a record of past events. Multiple events may be merged if they are similar. A request is scoped to activities from a given Google service using the source parameter."##), "Details at http://byron.github.io/google-apis-rs/google_appsactivity1_cli/activities_list", vec![ (Some(r##"v"##), @@ -241,7 +241,7 @@ fn main() { let mut app = App::new("appsactivity1") .author("Sebastian Thiel ") - .version("1.0.8+20181011") + .version("1.0.8+20190402") .about("Provides a historical view of activity.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appsactivity1_cli") .arg(Arg::with_name("url") diff --git a/gen/appsactivity1/Cargo.toml b/gen/appsactivity1/Cargo.toml index a395cca0a2..76afeab3a6 100644 --- a/gen/appsactivity1/Cargo.toml +++ b/gen/appsactivity1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-appsactivity1" -version = "1.0.8+20181011" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with appsactivity (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appsactivity1" homepage = "https://developers.google.com/google-apps/activity/" -documentation = "https://docs.rs/google-appsactivity1/1.0.8+20181011" +documentation = "https://docs.rs/google-appsactivity1/1.0.8+20190402" license = "MIT" keywords = ["appsactivity", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/appsactivity1/README.md b/gen/appsactivity1/README.md index 6243c06ba4..b6c200969f 100644 --- a/gen/appsactivity1/README.md +++ b/gen/appsactivity1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-appsactivity1` library allows access to all features of the *Google appsactivity* service. -This documentation was generated from *appsactivity* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *appsactivity* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *appsactivity* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/activity/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/struct.Appsactivity.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/struct.Appsactivity.html) ... -* [activities](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/struct.Activity.html) - * [*list*](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/struct.ActivityListCall.html) +* [activities](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/struct.Activity.html) + * [*list*](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/struct.ActivityListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/struct.Appsactivity.html)** +* **[Hub](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/struct.Appsactivity.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.Part.html)** + * **[Parts](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -131,17 +131,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -151,29 +151,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-appsactivity1/1.0.8+20181011/google_appsactivity1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-appsactivity1/1.0.8+20190402/google_appsactivity1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/appsactivity1/src/lib.rs b/gen/appsactivity1/src/lib.rs index 51f4cdecb2..d05ffd0494 100644 --- a/gen/appsactivity1/src/lib.rs +++ b/gen/appsactivity1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *appsactivity* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *appsactivity* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *appsactivity* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/activity/). @@ -641,7 +641,7 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns a list of activities visible to the current logged in user. Visible activities are determined by the visiblity settings of the object that was acted on, e.g. Drive files a user can see. An activity is a record of past events. Multiple events may be merged if they are similar. A request is scoped to activities from a given Google service using the source parameter. + /// Returns a list of activities visible to the current logged in user. Visible activities are determined by the visibility settings of the object that was acted on, e.g. Drive files a user can see. An activity is a record of past events. Multiple events may be merged if they are similar. A request is scoped to activities from a given Google service using the source parameter. pub fn list(&self) -> ActivityListCall<'a, C, A> { ActivityListCall { hub: self.hub, @@ -667,7 +667,7 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { // CallBuilders ### // ################# -/// Returns a list of activities visible to the current logged in user. Visible activities are determined by the visiblity settings of the object that was acted on, e.g. Drive files a user can see. An activity is a record of past events. Multiple events may be merged if they are similar. A request is scoped to activities from a given Google service using the source parameter. +/// Returns a list of activities visible to the current logged in user. Visible activities are determined by the visibility settings of the object that was acted on, e.g. Drive files a user can see. An activity is a record of past events. Multiple events may be merged if they are similar. A request is scoped to activities from a given Google service using the source parameter. /// /// A builder for the *list* method supported by a *activity* resource. /// It is not used directly, but through a `ActivityMethods` instance. @@ -777,10 +777,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -800,7 +797,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -853,7 +850,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } - /// Indicates the user to return activity for. Use the special value me to indicate the currently authenticated user. + /// The ID used for ACL checks (does not filter the resulting event list by the assigned value). Use the special value me to indicate the currently authenticated user. /// /// Sets the *user id* query property to the given value. pub fn user_id(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { @@ -918,7 +915,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/appstate1-cli/Cargo.toml b/gen/appstate1-cli/Cargo.toml index 5614d08bc7..f4c4403f8a 100644 --- a/gen/appstate1-cli/Cargo.toml +++ b/gen/appstate1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appstate1-cli" -version = "1.0.8+20181004" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with App State (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appstate1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-appstate1] path = "../appstate1" -version = "1.0.8+20181004" +version = "1.0.8+20190328" diff --git a/gen/appstate1-cli/README.md b/gen/appstate1-cli/README.md index fd26213f80..12220a76a8 100644 --- a/gen/appstate1-cli/README.md +++ b/gen/appstate1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *App State* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *App State* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash appstate1 [options] diff --git a/gen/appstate1-cli/mkdocs.yml b/gen/appstate1-cli/mkdocs.yml index 949a574eec..565319ce25 100644 --- a/gen/appstate1-cli/mkdocs.yml +++ b/gen/appstate1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: App State v1.0.8+20181004 +site_name: App State v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-appstate1-cli site_description: A complete library to interact with App State (protocol v1) diff --git a/gen/appstate1-cli/src/main.rs b/gen/appstate1-cli/src/main.rs index a1e32bdfda..8ac2e11cfa 100644 --- a/gen/appstate1-cli/src/main.rs +++ b/gen/appstate1-cli/src/main.rs @@ -569,7 +569,7 @@ fn main() { let mut app = App::new("appstate1") .author("Sebastian Thiel ") - .version("1.0.8+20181004") + .version("1.0.8+20190328") .about("The Google App State API.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appstate1_cli") .arg(Arg::with_name("url") diff --git a/gen/appstate1/Cargo.toml b/gen/appstate1/Cargo.toml index ac2f13c8bf..155b483156 100644 --- a/gen/appstate1/Cargo.toml +++ b/gen/appstate1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-appstate1" -version = "1.0.8+20181004" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with App State (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appstate1" homepage = "https://developers.google.com/games/services/web/api/states" -documentation = "https://docs.rs/google-appstate1/1.0.8+20181004" +documentation = "https://docs.rs/google-appstate1/1.0.8+20190328" license = "MIT" keywords = ["appstate", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/appstate1/README.md b/gen/appstate1/README.md index 60317328d2..84d6def907 100644 --- a/gen/appstate1/README.md +++ b/gen/appstate1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-appstate1` library allows access to all features of the *Google App State* service. -This documentation was generated from *App State* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *App State* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *App State* *v1* API can be found at the [official documentation site](https://developers.google.com/games/services/web/api/states). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/struct.AppState.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/struct.AppState.html) ... * states - * [*clear*](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/struct.StateClearCall.html), [*delete*](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/struct.StateDeleteCall.html), [*get*](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/struct.StateGetCall.html), [*list*](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/struct.StateListCall.html) and [*update*](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/struct.StateUpdateCall.html) + * [*clear*](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/struct.StateClearCall.html), [*delete*](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/struct.StateDeleteCall.html), [*get*](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/struct.StateGetCall.html), [*list*](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/struct.StateListCall.html) and [*update*](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/struct.StateUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/struct.AppState.html)** +* **[Hub](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/struct.AppState.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.Part.html)** + * **[Parts](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-appstate1/1.0.8+20181004/google_appstate1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-appstate1/1.0.8+20190328/google_appstate1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/appstate1/src/lib.rs b/gen/appstate1/src/lib.rs index c63e8b0d92..926bceb6cc 100644 --- a/gen/appstate1/src/lib.rs +++ b/gen/appstate1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *App State* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *App State* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *App State* *v1* API can be found at the //! [official documentation site](https://developers.google.com/games/services/web/api/states). @@ -702,10 +702,7 @@ impl<'a, C, A> StateDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -725,7 +722,7 @@ impl<'a, C, A> StateDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -793,7 +790,7 @@ impl<'a, C, A> StateDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -935,10 +932,7 @@ impl<'a, C, A> StateGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -958,7 +952,7 @@ impl<'a, C, A> StateGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1036,7 +1030,7 @@ impl<'a, C, A> StateGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1183,10 +1177,7 @@ impl<'a, C, A> StateClearCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1206,7 +1197,7 @@ impl<'a, C, A> StateClearCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1291,7 +1282,7 @@ impl<'a, C, A> StateClearCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1415,10 +1406,7 @@ impl<'a, C, A> StateListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1438,7 +1426,7 @@ impl<'a, C, A> StateListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1513,7 +1501,7 @@ impl<'a, C, A> StateListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1667,10 +1655,7 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1702,7 +1687,7 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1799,7 +1784,7 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/autoscaler1_beta2/Cargo.toml b/gen/autoscaler1_beta2/Cargo.toml index 7bc1b01d25..757c9af096 100644 --- a/gen/autoscaler1_beta2/Cargo.toml +++ b/gen/autoscaler1_beta2/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/autoscaler1_beta2/src/lib.rs b/gen/autoscaler1_beta2/src/lib.rs index af74787990..fa5bed95fa 100644 --- a/gen/autoscaler1_beta2/src/lib.rs +++ b/gen/autoscaler1_beta2/src/lib.rs @@ -1269,10 +1269,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1292,7 +1289,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1387,7 +1384,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1546,10 +1543,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1569,7 +1563,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1673,7 +1667,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1818,10 +1812,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1841,7 +1832,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2095,7 +2083,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2190,7 +2178,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2349,10 +2337,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2372,7 +2357,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2478,7 +2463,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2631,10 +2616,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2666,7 +2648,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2776,7 +2758,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2929,10 +2911,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2964,7 +2943,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3074,7 +3053,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3220,10 +3199,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3243,7 +3219,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3341,7 +3317,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3492,10 +3468,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3527,7 +3500,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3627,7 +3600,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3773,10 +3746,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3796,7 +3766,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3894,7 +3864,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/bigquery2-cli/Cargo.toml b/gen/bigquery2-cli/Cargo.toml index 5a16d91477..22e40dff32 100644 --- a/gen/bigquery2-cli/Cargo.toml +++ b/gen/bigquery2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-bigquery2-cli" -version = "1.0.8+20181005" +version = "1.0.8+20190314" authors = ["Sebastian Thiel "] description = "A complete library to interact with bigquery (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/bigquery2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-bigquery2] path = "../bigquery2" -version = "1.0.8+20181005" +version = "1.0.8+20190314" diff --git a/gen/bigquery2-cli/README.md b/gen/bigquery2-cli/README.md index e433ba4d82..d53a040d0f 100644 --- a/gen/bigquery2-cli/README.md +++ b/gen/bigquery2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *bigquery* API at revision *20181005*. The CLI is at version *1.0.8*. +This documentation was generated from the *bigquery* API at revision *20190314*. The CLI is at version *1.0.8*. ```bash bigquery2 [options] @@ -43,6 +43,11 @@ bigquery2 [options] insert (-r )... (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] list [-p ]... [-o ] query (-r )... [-p ]... [-o ] + models + delete [-p ]... + get [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] projects get-service-account [-p ]... [-o ] list [-p ]... [-o ] diff --git a/gen/bigquery2-cli/mkdocs.yml b/gen/bigquery2-cli/mkdocs.yml index b3067484b7..abe89a8ec4 100644 --- a/gen/bigquery2-cli/mkdocs.yml +++ b/gen/bigquery2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: bigquery v1.0.8+20181005 +site_name: bigquery v1.0.8+20190314 site_url: http://byron.github.io/google-apis-rs/google-bigquery2-cli site_description: A complete library to interact with bigquery (protocol v2) @@ -21,6 +21,10 @@ pages: - ['jobs_insert.md', 'Jobs', 'Insert'] - ['jobs_list.md', 'Jobs', 'List'] - ['jobs_query.md', 'Jobs', 'Query'] +- ['models_delete.md', 'Models', 'Delete'] +- ['models_get.md', 'Models', 'Get'] +- ['models_list.md', 'Models', 'List'] +- ['models_patch.md', 'Models', 'Patch'] - ['projects_get-service-account.md', 'Projects', 'Get Service Account'] - ['projects_list.md', 'Projects', 'List'] - ['tabledata_insert-all.md', 'Tabledata', 'Insert All'] diff --git a/gen/bigquery2-cli/src/main.rs b/gen/bigquery2-cli/src/main.rs index cb4a524b7c..3f1864f53b 100644 --- a/gen/bigquery2-cli/src/main.rs +++ b/gen/bigquery2-cli/src/main.rs @@ -719,21 +719,28 @@ impl<'n> Engine<'n> { "statistics.load.input-files" => Some(("statistics.load.inputFiles", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.load.input-file-bytes" => Some(("statistics.load.inputFileBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.load.output-bytes" => Some(("statistics.load.outputBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.parent-job-id" => Some(("statistics.parentJobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.start-time" => Some(("statistics.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.total-slot-ms" => Some(("statistics.totalSlotMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.completion-ratio" => Some(("statistics.completionRatio", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "statistics.creation-time" => Some(("statistics.creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.total-bytes-processed" => Some(("statistics.totalBytesProcessed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.quota-deferments" => Some(("statistics.quotaDeferments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "statistics.start-time" => Some(("statistics.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "statistics.query.model-training-expected-total-iteration" => Some(("statistics.query.modelTrainingExpectedTotalIteration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "statistics.query.estimated-bytes-processed" => Some(("statistics.query.estimatedBytesProcessed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.num-child-jobs" => Some(("statistics.numChildJobs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.query.total-slot-ms" => Some(("statistics.query.totalSlotMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.query.estimated-bytes-processed" => Some(("statistics.query.estimatedBytesProcessed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.query.model-training-expected-total-iteration" => Some(("statistics.query.modelTrainingExpectedTotalIteration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.query.statement-type" => Some(("statistics.query.statementType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.query.total-bytes-billed" => Some(("statistics.query.totalBytesBilled", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.query.total-partitions-processed" => Some(("statistics.query.totalPartitionsProcessed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.query.total-bytes-processed" => Some(("statistics.query.totalBytesProcessed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "statistics.query.model-training-current-iteration" => Some(("statistics.query.modelTrainingCurrentIteration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "statistics.query.total-bytes-processed-accuracy" => Some(("statistics.query.totalBytesProcessedAccuracy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.query.cache-hit" => Some(("statistics.query.cacheHit", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "statistics.query.ddl-operation-performed" => Some(("statistics.query.ddlOperationPerformed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.query.ddl-target-routine.project-id" => Some(("statistics.query.ddlTargetRoutine.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.query.ddl-target-routine.routine-id" => Some(("statistics.query.ddlTargetRoutine.routineId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.query.ddl-target-routine.dataset-id" => Some(("statistics.query.ddlTargetRoutine.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "statistics.query.model-training-current-iteration" => Some(("statistics.query.modelTrainingCurrentIteration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "statistics.query.model-training.current-iteration" => Some(("statistics.query.modelTraining.currentIteration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "statistics.query.model-training.expected-total-iterations" => Some(("statistics.query.modelTraining.expectedTotalIterations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.query.billing-tier" => Some(("statistics.query.billingTier", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -743,6 +750,7 @@ impl<'n> Engine<'n> { "statistics.query.num-dml-affected-rows" => Some(("statistics.query.numDmlAffectedRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.end-time" => Some(("statistics.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "statistics.extract.destination-uri-file-counts" => Some(("statistics.extract.destinationUriFileCounts", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "statistics.extract.input-bytes" => Some(("statistics.extract.inputBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-reference.project-id" => Some(("jobReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-reference.location" => Some(("jobReference.location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-reference.job-id" => Some(("jobReference.jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -758,7 +766,12 @@ impl<'n> Engine<'n> { "configuration.load.allow-quoted-newlines" => Some(("configuration.load.allowQuotedNewlines", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.load.clustering.fields" => Some(("configuration.load.clustering.fields", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "configuration.load.destination-table-properties.friendly-name" => Some(("configuration.load.destinationTableProperties.friendlyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.load.destination-table-properties.labels" => Some(("configuration.load.destinationTableProperties.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "configuration.load.destination-table-properties.description" => Some(("configuration.load.destinationTableProperties.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.load.range-partitioning.field" => Some(("configuration.load.rangePartitioning.field", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.load.range-partitioning.range.start" => Some(("configuration.load.rangePartitioning.range.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.load.range-partitioning.range.interval" => Some(("configuration.load.rangePartitioning.range.interval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.load.range-partitioning.range.end" => Some(("configuration.load.rangePartitioning.range.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.max-bad-records" => Some(("configuration.load.maxBadRecords", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "configuration.load.schema-update-options" => Some(("configuration.load.schemaUpdateOptions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "configuration.load.ignore-unknown-values" => Some(("configuration.load.ignoreUnknownValues", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -776,6 +789,7 @@ impl<'n> Engine<'n> { "configuration.load.null-marker" => Some(("configuration.load.nullMarker", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.allow-jagged-rows" => Some(("configuration.load.allowJaggedRows", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.load.write-disposition" => Some(("configuration.load.writeDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.load.hive-partitioning-mode" => Some(("configuration.load.hivePartitioningMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.field-delimiter" => Some(("configuration.load.fieldDelimiter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.load.schema-inline-format" => Some(("configuration.load.schemaInlineFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.dry-run" => Some(("configuration.dryRun", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -787,13 +801,13 @@ impl<'n> Engine<'n> { "configuration.query.use-query-cache" => Some(("configuration.query.useQueryCache", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.query.default-dataset.project-id" => Some(("configuration.query.defaultDataset.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.default-dataset.dataset-id" => Some(("configuration.query.defaultDataset.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.query.parameter-mode" => Some(("configuration.query.parameterMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.destination-table.project-id" => Some(("configuration.query.destinationTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.destination-table.table-id" => Some(("configuration.query.destinationTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.destination-table.dataset-id" => Some(("configuration.query.destinationTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.query.use-legacy-sql" => Some(("configuration.query.useLegacySql", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.query.schema-update-options" => Some(("configuration.query.schemaUpdateOptions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "configuration.query.priority" => Some(("configuration.query.priority", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.query.use-legacy-sql" => Some(("configuration.query.useLegacySql", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "configuration.query.maximum-billing-tier" => Some(("configuration.query.maximumBillingTier", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "configuration.query.write-disposition" => Some(("configuration.query.writeDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.allow-large-results" => Some(("configuration.query.allowLargeResults", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.query.time-partitioning.field" => Some(("configuration.query.timePartitioning.field", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -803,8 +817,12 @@ impl<'n> Engine<'n> { "configuration.query.create-disposition" => Some(("configuration.query.createDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.query" => Some(("configuration.query.query", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.preserve-nulls" => Some(("configuration.query.preserveNulls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "configuration.query.range-partitioning.field" => Some(("configuration.query.rangePartitioning.field", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.query.range-partitioning.range.start" => Some(("configuration.query.rangePartitioning.range.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.query.range-partitioning.range.interval" => Some(("configuration.query.rangePartitioning.range.interval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.query.range-partitioning.range.end" => Some(("configuration.query.rangePartitioning.range.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.maximum-bytes-billed" => Some(("configuration.query.maximumBytesBilled", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.query.maximum-billing-tier" => Some(("configuration.query.maximumBillingTier", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "configuration.query.parameter-mode" => Some(("configuration.query.parameterMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.copy.create-disposition" => Some(("configuration.copy.createDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.copy.write-disposition" => Some(("configuration.copy.writeDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.copy.destination-table.project-id" => Some(("configuration.copy.destinationTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -827,7 +845,7 @@ impl<'n> Engine<'n> { "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-large-results", "allow-quoted-newlines", "autodetect", "bad-records", "billing-tier", "cache-hit", "clustering", "completion-ratio", "compression", "configuration", "copy", "create-disposition", "creation-time", "current-iteration", "dataset-id", "ddl-operation-performed", "ddl-target-table", "debug-info", "default-dataset", "description", "destination-encryption-configuration", "destination-format", "destination-table", "destination-table-properties", "destination-uri", "destination-uri-file-counts", "destination-uris", "dry-run", "encoding", "end-time", "error-result", "estimated-bytes-processed", "etag", "expected-total-iterations", "expiration-ms", "extract", "field", "field-delimiter", "fields", "flatten-results", "friendly-name", "id", "ignore-unknown-values", "input-file-bytes", "input-files", "job-id", "job-reference", "job-timeout-ms", "job-type", "kind", "kms-key-name", "labels", "load", "location", "max-bad-records", "maximum-billing-tier", "maximum-bytes-billed", "message", "model-training", "model-training-current-iteration", "model-training-expected-total-iteration", "null-marker", "num-dml-affected-rows", "output-bytes", "output-rows", "parameter-mode", "preserve-nulls", "print-header", "priority", "project-id", "projection-fields", "query", "quota-deferments", "quote", "reason", "require-partition-filter", "schema-inline", "schema-inline-format", "schema-update-options", "self-link", "skip-leading-rows", "source-format", "source-table", "source-uris", "start-time", "state", "statement-type", "statistics", "status", "table-id", "time-partitioning", "total-bytes-billed", "total-bytes-processed", "total-partitions-processed", "total-slot-ms", "type", "use-avro-logical-types", "use-legacy-sql", "use-query-cache", "user-email", "write-disposition"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-large-results", "allow-quoted-newlines", "autodetect", "bad-records", "billing-tier", "cache-hit", "clustering", "completion-ratio", "compression", "configuration", "copy", "create-disposition", "creation-time", "current-iteration", "dataset-id", "ddl-operation-performed", "ddl-target-routine", "ddl-target-table", "debug-info", "default-dataset", "description", "destination-encryption-configuration", "destination-format", "destination-table", "destination-table-properties", "destination-uri", "destination-uri-file-counts", "destination-uris", "dry-run", "encoding", "end", "end-time", "error-result", "estimated-bytes-processed", "etag", "expected-total-iterations", "expiration-ms", "extract", "field", "field-delimiter", "fields", "flatten-results", "friendly-name", "hive-partitioning-mode", "id", "ignore-unknown-values", "input-bytes", "input-file-bytes", "input-files", "interval", "job-id", "job-reference", "job-timeout-ms", "job-type", "kind", "kms-key-name", "labels", "load", "location", "max-bad-records", "maximum-billing-tier", "maximum-bytes-billed", "message", "model-training", "model-training-current-iteration", "model-training-expected-total-iteration", "null-marker", "num-child-jobs", "num-dml-affected-rows", "output-bytes", "output-rows", "parameter-mode", "parent-job-id", "preserve-nulls", "print-header", "priority", "project-id", "projection-fields", "query", "quota-deferments", "quote", "range", "range-partitioning", "reason", "require-partition-filter", "routine-id", "schema-inline", "schema-inline-format", "schema-update-options", "self-link", "skip-leading-rows", "source-format", "source-table", "source-uris", "start", "start-time", "state", "statement-type", "statistics", "status", "table-id", "time-partitioning", "total-bytes-billed", "total-bytes-processed", "total-bytes-processed-accuracy", "total-partitions-processed", "total-slot-ms", "type", "use-avro-logical-types", "use-legacy-sql", "use-query-cache", "user-email", "write-disposition"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1061,6 +1079,257 @@ impl<'n> Engine<'n> { } } + fn _models_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.models().delete(opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or(""), opt.value_of("model-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _models_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.models().get(opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or(""), opt.value_of("model-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _models_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.models().list(opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _models_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "model-reference.project-id" => Some(("modelReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "model-reference.dataset-id" => Some(("modelReference.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "model-reference.model-id" => Some(("modelReference.modelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "model-type" => Some(("modelType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "friendly-name" => Some(("friendlyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "expiration-time" => Some(("expirationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-time", "dataset-id", "description", "etag", "expiration-time", "friendly-name", "labels", "last-modified-time", "location", "model-id", "model-reference", "model-type", "project-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Model = json::value::from_value(object).unwrap(); + let mut call = self.hub.models().patch(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or(""), opt.value_of("model-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_get_service_account(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().get_service_account(opt.value_of("project-id").unwrap_or("")); @@ -1450,10 +1719,13 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "materialized-view.last-refresh-time" => Some(("materializedView.lastRefreshTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "materialized-view.query" => Some(("materializedView.query", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "time-partitioning.field" => Some(("timePartitioning.field", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "time-partitioning.type" => Some(("timePartitioning.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "time-partitioning.require-partition-filter" => Some(("timePartitioning.requirePartitionFilter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "time-partitioning.expiration-ms" => Some(("timePartitioning.expirationMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "require-partition-filter" => Some(("requirePartitionFilter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "table-reference.project-id" => Some(("tableReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.table-id" => Some(("tableReference.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.dataset-id" => Some(("tableReference.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1461,6 +1733,10 @@ impl<'n> Engine<'n> { "streaming-buffer.estimated-bytes" => Some(("streamingBuffer.estimatedBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.estimated-rows" => Some(("streamingBuffer.estimatedRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.oldest-entry-time" => Some(("streamingBuffer.oldestEntryTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.field" => Some(("rangePartitioning.field", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.range.start" => Some(("rangePartitioning.range.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.range.interval" => Some(("rangePartitioning.range.interval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.range.end" => Some(("rangePartitioning.range.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "num-rows" => Some(("numRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1472,6 +1748,12 @@ impl<'n> Engine<'n> { "num-bytes" => Some(("numBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "num-physical-bytes" => Some(("numPhysicalBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-configuration.kms-key-name" => Some(("encryptionConfiguration.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "num-long-term-bytes" => Some(("numLongTermBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "model.model-options.labels" => Some(("model.modelOptions.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "model.model-options.loss-type" => Some(("model.modelOptions.lossType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "model.model-options.model-type" => Some(("model.modelOptions.modelType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.compression" => Some(("externalDataConfiguration.compression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.encoding" => Some(("externalDataConfiguration.csvOptions.encoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.quote" => Some(("externalDataConfiguration.csvOptions.quote", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1479,6 +1761,7 @@ impl<'n> Engine<'n> { "external-data-configuration.csv-options.skip-leading-rows" => Some(("externalDataConfiguration.csvOptions.skipLeadingRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.field-delimiter" => Some(("externalDataConfiguration.csvOptions.fieldDelimiter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.allow-quoted-newlines" => Some(("externalDataConfiguration.csvOptions.allowQuotedNewlines", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-data-configuration.hive-partitioning-mode" => Some(("externalDataConfiguration.hivePartitioningMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.autodetect" => Some(("externalDataConfiguration.autodetect", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "external-data-configuration.max-bad-records" => Some(("externalDataConfiguration.maxBadRecords", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "external-data-configuration.ignore-unknown-values" => Some(("externalDataConfiguration.ignoreUnknownValues", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1488,16 +1771,11 @@ impl<'n> Engine<'n> { "external-data-configuration.source-format" => Some(("externalDataConfiguration.sourceFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.google-sheets-options.skip-leading-rows" => Some(("externalDataConfiguration.googleSheetsOptions.skipLeadingRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.google-sheets-options.range" => Some(("externalDataConfiguration.googleSheetsOptions.range", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "encryption-configuration.kms-key-name" => Some(("encryptionConfiguration.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "num-long-term-bytes" => Some(("numLongTermBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "model.model-options.labels" => Some(("model.modelOptions.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "model.model-options.loss-type" => Some(("model.modelOptions.lossType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "model.model-options.model-type" => Some(("model.modelOptions.modelType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "view.query" => Some(("view.query", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "view.use-legacy-sql" => Some(("view.useLegacySql", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "clustering", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "encryption-configuration", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field", "field-delimiter", "fields", "friendly-name", "google-sheets-options", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "kind", "kms-key-name", "labels", "last-modified-time", "location", "loss-type", "max-bad-records", "model", "model-options", "model-type", "num-bytes", "num-long-term-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "range", "read-rowkey-as-string", "require-partition-filter", "self-link", "skip-leading-rows", "source-format", "source-uris", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "clustering", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "encryption-configuration", "end", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field", "field-delimiter", "fields", "friendly-name", "google-sheets-options", "hive-partitioning-mode", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "interval", "kind", "kms-key-name", "labels", "last-modified-time", "last-refresh-time", "location", "loss-type", "materialized-view", "max-bad-records", "model", "model-options", "model-type", "num-bytes", "num-long-term-bytes", "num-physical-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "range", "range-partitioning", "read-rowkey-as-string", "require-partition-filter", "self-link", "skip-leading-rows", "source-format", "source-uris", "start", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1641,10 +1919,13 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "materialized-view.last-refresh-time" => Some(("materializedView.lastRefreshTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "materialized-view.query" => Some(("materializedView.query", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "time-partitioning.field" => Some(("timePartitioning.field", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "time-partitioning.type" => Some(("timePartitioning.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "time-partitioning.require-partition-filter" => Some(("timePartitioning.requirePartitionFilter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "time-partitioning.expiration-ms" => Some(("timePartitioning.expirationMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "require-partition-filter" => Some(("requirePartitionFilter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "table-reference.project-id" => Some(("tableReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.table-id" => Some(("tableReference.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.dataset-id" => Some(("tableReference.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1652,6 +1933,10 @@ impl<'n> Engine<'n> { "streaming-buffer.estimated-bytes" => Some(("streamingBuffer.estimatedBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.estimated-rows" => Some(("streamingBuffer.estimatedRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.oldest-entry-time" => Some(("streamingBuffer.oldestEntryTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.field" => Some(("rangePartitioning.field", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.range.start" => Some(("rangePartitioning.range.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.range.interval" => Some(("rangePartitioning.range.interval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.range.end" => Some(("rangePartitioning.range.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "num-rows" => Some(("numRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1663,6 +1948,12 @@ impl<'n> Engine<'n> { "num-bytes" => Some(("numBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "num-physical-bytes" => Some(("numPhysicalBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-configuration.kms-key-name" => Some(("encryptionConfiguration.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "num-long-term-bytes" => Some(("numLongTermBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "model.model-options.labels" => Some(("model.modelOptions.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "model.model-options.loss-type" => Some(("model.modelOptions.lossType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "model.model-options.model-type" => Some(("model.modelOptions.modelType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.compression" => Some(("externalDataConfiguration.compression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.encoding" => Some(("externalDataConfiguration.csvOptions.encoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.quote" => Some(("externalDataConfiguration.csvOptions.quote", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1670,6 +1961,7 @@ impl<'n> Engine<'n> { "external-data-configuration.csv-options.skip-leading-rows" => Some(("externalDataConfiguration.csvOptions.skipLeadingRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.field-delimiter" => Some(("externalDataConfiguration.csvOptions.fieldDelimiter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.allow-quoted-newlines" => Some(("externalDataConfiguration.csvOptions.allowQuotedNewlines", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-data-configuration.hive-partitioning-mode" => Some(("externalDataConfiguration.hivePartitioningMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.autodetect" => Some(("externalDataConfiguration.autodetect", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "external-data-configuration.max-bad-records" => Some(("externalDataConfiguration.maxBadRecords", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "external-data-configuration.ignore-unknown-values" => Some(("externalDataConfiguration.ignoreUnknownValues", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1679,16 +1971,11 @@ impl<'n> Engine<'n> { "external-data-configuration.source-format" => Some(("externalDataConfiguration.sourceFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.google-sheets-options.skip-leading-rows" => Some(("externalDataConfiguration.googleSheetsOptions.skipLeadingRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.google-sheets-options.range" => Some(("externalDataConfiguration.googleSheetsOptions.range", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "encryption-configuration.kms-key-name" => Some(("encryptionConfiguration.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "num-long-term-bytes" => Some(("numLongTermBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "model.model-options.labels" => Some(("model.modelOptions.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "model.model-options.loss-type" => Some(("model.modelOptions.lossType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "model.model-options.model-type" => Some(("model.modelOptions.modelType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "view.query" => Some(("view.query", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "view.use-legacy-sql" => Some(("view.useLegacySql", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "clustering", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "encryption-configuration", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field", "field-delimiter", "fields", "friendly-name", "google-sheets-options", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "kind", "kms-key-name", "labels", "last-modified-time", "location", "loss-type", "max-bad-records", "model", "model-options", "model-type", "num-bytes", "num-long-term-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "range", "read-rowkey-as-string", "require-partition-filter", "self-link", "skip-leading-rows", "source-format", "source-uris", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "clustering", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "encryption-configuration", "end", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field", "field-delimiter", "fields", "friendly-name", "google-sheets-options", "hive-partitioning-mode", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "interval", "kind", "kms-key-name", "labels", "last-modified-time", "last-refresh-time", "location", "loss-type", "materialized-view", "max-bad-records", "model", "model-options", "model-type", "num-bytes", "num-long-term-bytes", "num-physical-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "range", "range-partitioning", "read-rowkey-as-string", "require-partition-filter", "self-link", "skip-leading-rows", "source-format", "source-uris", "start", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1773,10 +2060,13 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "materialized-view.last-refresh-time" => Some(("materializedView.lastRefreshTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "materialized-view.query" => Some(("materializedView.query", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "time-partitioning.field" => Some(("timePartitioning.field", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "time-partitioning.type" => Some(("timePartitioning.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "time-partitioning.require-partition-filter" => Some(("timePartitioning.requirePartitionFilter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "time-partitioning.expiration-ms" => Some(("timePartitioning.expirationMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "require-partition-filter" => Some(("requirePartitionFilter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "table-reference.project-id" => Some(("tableReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.table-id" => Some(("tableReference.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "table-reference.dataset-id" => Some(("tableReference.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1784,6 +2074,10 @@ impl<'n> Engine<'n> { "streaming-buffer.estimated-bytes" => Some(("streamingBuffer.estimatedBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.estimated-rows" => Some(("streamingBuffer.estimatedRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "streaming-buffer.oldest-entry-time" => Some(("streamingBuffer.oldestEntryTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.field" => Some(("rangePartitioning.field", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.range.start" => Some(("rangePartitioning.range.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.range.interval" => Some(("rangePartitioning.range.interval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "range-partitioning.range.end" => Some(("rangePartitioning.range.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "num-rows" => Some(("numRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1795,6 +2089,12 @@ impl<'n> Engine<'n> { "num-bytes" => Some(("numBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "num-physical-bytes" => Some(("numPhysicalBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-configuration.kms-key-name" => Some(("encryptionConfiguration.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "num-long-term-bytes" => Some(("numLongTermBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "model.model-options.labels" => Some(("model.modelOptions.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "model.model-options.loss-type" => Some(("model.modelOptions.lossType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "model.model-options.model-type" => Some(("model.modelOptions.modelType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.compression" => Some(("externalDataConfiguration.compression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.encoding" => Some(("externalDataConfiguration.csvOptions.encoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.quote" => Some(("externalDataConfiguration.csvOptions.quote", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1802,6 +2102,7 @@ impl<'n> Engine<'n> { "external-data-configuration.csv-options.skip-leading-rows" => Some(("externalDataConfiguration.csvOptions.skipLeadingRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.field-delimiter" => Some(("externalDataConfiguration.csvOptions.fieldDelimiter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.csv-options.allow-quoted-newlines" => Some(("externalDataConfiguration.csvOptions.allowQuotedNewlines", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-data-configuration.hive-partitioning-mode" => Some(("externalDataConfiguration.hivePartitioningMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.autodetect" => Some(("externalDataConfiguration.autodetect", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "external-data-configuration.max-bad-records" => Some(("externalDataConfiguration.maxBadRecords", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "external-data-configuration.ignore-unknown-values" => Some(("externalDataConfiguration.ignoreUnknownValues", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1811,16 +2112,11 @@ impl<'n> Engine<'n> { "external-data-configuration.source-format" => Some(("externalDataConfiguration.sourceFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.google-sheets-options.skip-leading-rows" => Some(("externalDataConfiguration.googleSheetsOptions.skipLeadingRows", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "external-data-configuration.google-sheets-options.range" => Some(("externalDataConfiguration.googleSheetsOptions.range", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "encryption-configuration.kms-key-name" => Some(("encryptionConfiguration.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "num-long-term-bytes" => Some(("numLongTermBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "model.model-options.labels" => Some(("model.modelOptions.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "model.model-options.loss-type" => Some(("model.modelOptions.lossType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "model.model-options.model-type" => Some(("model.modelOptions.modelType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "view.query" => Some(("view.query", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "view.use-legacy-sql" => Some(("view.useLegacySql", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "clustering", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "encryption-configuration", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field", "field-delimiter", "fields", "friendly-name", "google-sheets-options", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "kind", "kms-key-name", "labels", "last-modified-time", "location", "loss-type", "max-bad-records", "model", "model-options", "model-type", "num-bytes", "num-long-term-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "range", "read-rowkey-as-string", "require-partition-filter", "self-link", "skip-leading-rows", "source-format", "source-uris", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-quoted-newlines", "autodetect", "bigtable-options", "clustering", "compression", "creation-time", "csv-options", "dataset-id", "description", "encoding", "encryption-configuration", "end", "estimated-bytes", "estimated-rows", "etag", "expiration-ms", "expiration-time", "external-data-configuration", "field", "field-delimiter", "fields", "friendly-name", "google-sheets-options", "hive-partitioning-mode", "id", "ignore-unknown-values", "ignore-unspecified-column-families", "interval", "kind", "kms-key-name", "labels", "last-modified-time", "last-refresh-time", "location", "loss-type", "materialized-view", "max-bad-records", "model", "model-options", "model-type", "num-bytes", "num-long-term-bytes", "num-physical-bytes", "num-rows", "oldest-entry-time", "project-id", "query", "quote", "range", "range-partitioning", "read-rowkey-as-string", "require-partition-filter", "self-link", "skip-leading-rows", "source-format", "source-uris", "start", "streaming-buffer", "table-id", "table-reference", "time-partitioning", "type", "use-legacy-sql", "view"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1937,6 +2233,26 @@ impl<'n> Engine<'n> { } } }, + ("models", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._models_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._models_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._models_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._models_patch(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("models".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("projects", Some(opt)) => { match opt.subcommand() { ("get-service-account", Some(opt)) => { @@ -2416,6 +2732,140 @@ fn main() { ]), ]), + ("models", "methods: 'delete', 'get', 'list' and 'patch'", vec![ + ("delete", + Some(r##"Deletes the model specified by modelId from the dataset."##), + "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/models_delete", + vec![ + (Some(r##"project-id"##), + None, + Some(r##"Project ID of the model to delete."##), + Some(true), + Some(false)), + + (Some(r##"dataset-id"##), + None, + Some(r##"Dataset ID of the model to delete."##), + Some(true), + Some(false)), + + (Some(r##"model-id"##), + None, + Some(r##"Model ID of the model to delete."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets the specified model resource by model ID."##), + "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/models_get", + vec![ + (Some(r##"project-id"##), + None, + Some(r##"Project ID of the requested model."##), + Some(true), + Some(false)), + + (Some(r##"dataset-id"##), + None, + Some(r##"Dataset ID of the requested model."##), + Some(true), + Some(false)), + + (Some(r##"model-id"##), + None, + Some(r##"Model ID of the requested model."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists all models in the specified dataset. Requires the READER dataset + role."##), + "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/models_list", + vec![ + (Some(r##"project-id"##), + None, + Some(r##"Project ID of the models to list."##), + Some(true), + Some(false)), + + (Some(r##"dataset-id"##), + None, + Some(r##"Dataset ID of the models to list."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Patch specific fields in the specified model."##), + "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/models_patch", + vec![ + (Some(r##"project-id"##), + None, + Some(r##"Project ID of the model to patch."##), + Some(true), + Some(false)), + + (Some(r##"dataset-id"##), + None, + Some(r##"Dataset ID of the model to patch."##), + Some(true), + Some(false)), + + (Some(r##"model-id"##), + None, + Some(r##"Model ID of the model to patch."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("projects", "methods: 'get-service-account' and 'list'", vec![ ("get-service-account", Some(r##"Returns the email address of the service account for your project used for interactions with Google Cloud KMS."##), @@ -2745,7 +3195,7 @@ fn main() { let mut app = App::new("bigquery2") .author("Sebastian Thiel ") - .version("1.0.8+20181005") + .version("1.0.8+20190314") .about("A data platform for customers to create, manage, share and query data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_bigquery2_cli") .arg(Arg::with_name("url") diff --git a/gen/bigquery2/Cargo.toml b/gen/bigquery2/Cargo.toml index 6ad22de7b6..8bb7a2fcae 100644 --- a/gen/bigquery2/Cargo.toml +++ b/gen/bigquery2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-bigquery2" -version = "1.0.8+20181005" +version = "1.0.8+20190314" authors = ["Sebastian Thiel "] description = "A complete library to interact with bigquery (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/bigquery2" homepage = "https://cloud.google.com/bigquery/" -documentation = "https://docs.rs/google-bigquery2/1.0.8+20181005" +documentation = "https://docs.rs/google-bigquery2/1.0.8+20190314" license = "MIT" keywords = ["bigquery", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/bigquery2/README.md b/gen/bigquery2/README.md index a42d44e3cb..01c035a57f 100644 --- a/gen/bigquery2/README.md +++ b/gen/bigquery2/README.md @@ -5,29 +5,31 @@ DO NOT EDIT ! --> The `google-bigquery2` library allows access to all features of the *Google bigquery* service. -This documentation was generated from *bigquery* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *bigquery* crate version *1.0.8+20190314*, where *20190314* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *bigquery* *v2* API can be found at the [official documentation site](https://cloud.google.com/bigquery/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.Bigquery.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.Bigquery.html) ... -* [datasets](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.Dataset.html) - * [*delete*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.DatasetDeleteCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.DatasetGetCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.DatasetInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.DatasetListCall.html), [*patch*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.DatasetPatchCall.html) and [*update*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.DatasetUpdateCall.html) -* [jobs](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.Job.html) - * [*cancel*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.JobCancelCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.JobGetCall.html), [*get query results*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.JobGetQueryResultCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.JobInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.JobListCall.html) and [*query*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.JobQueryCall.html) +* [datasets](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.Dataset.html) + * [*delete*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.DatasetDeleteCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.DatasetGetCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.DatasetInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.DatasetListCall.html), [*patch*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.DatasetPatchCall.html) and [*update*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.DatasetUpdateCall.html) +* [jobs](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.Job.html) + * [*cancel*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.JobCancelCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.JobGetCall.html), [*get query results*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.JobGetQueryResultCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.JobInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.JobListCall.html) and [*query*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.JobQueryCall.html) +* [models](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.Model.html) + * [*delete*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.ModelDeleteCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.ModelGetCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.ModelListCall.html) and [*patch*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.ModelPatchCall.html) * projects - * [*get service account*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.ProjectGetServiceAccountCall.html) and [*list*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.ProjectListCall.html) + * [*get service account*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.ProjectGetServiceAccountCall.html) and [*list*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.ProjectListCall.html) * tabledata - * [*insert all*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.TabledataInsertAllCall.html) and [*list*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.TabledataListCall.html) -* [tables](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.Table.html) - * [*delete*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.TableDeleteCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.TableGetCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.TableInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.TableListCall.html), [*patch*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.TablePatchCall.html) and [*update*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.TableUpdateCall.html) + * [*insert all*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.TabledataInsertAllCall.html) and [*list*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.TabledataListCall.html) +* [tables](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.Table.html) + * [*delete*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.TableDeleteCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.TableGetCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.TableInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.TableListCall.html), [*patch*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.TablePatchCall.html) and [*update*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.TableUpdateCall.html) Upload supported by ... -* [*insert jobs*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.JobInsertCall.html) +* [*insert jobs*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.JobInsertCall.html) @@ -35,17 +37,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/struct.Bigquery.html)** +* **[Hub](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/struct.Bigquery.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.Part.html)** + * **[Parts](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -147,17 +149,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -167,29 +169,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-bigquery2/1.0.8+20181005/google_bigquery2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-bigquery2/1.0.8+20190314/google_bigquery2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/bigquery2/src/lib.rs b/gen/bigquery2/src/lib.rs index 83589ad4ae..acc285d3de 100644 --- a/gen/bigquery2/src/lib.rs +++ b/gen/bigquery2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *bigquery* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *bigquery* crate version *1.0.8+20190314*, where *20190314* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *bigquery* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/bigquery/). @@ -15,6 +15,8 @@ //! * [*delete*](struct.DatasetDeleteCall.html), [*get*](struct.DatasetGetCall.html), [*insert*](struct.DatasetInsertCall.html), [*list*](struct.DatasetListCall.html), [*patch*](struct.DatasetPatchCall.html) and [*update*](struct.DatasetUpdateCall.html) //! * [jobs](struct.Job.html) //! * [*cancel*](struct.JobCancelCall.html), [*get*](struct.JobGetCall.html), [*get query results*](struct.JobGetQueryResultCall.html), [*insert*](struct.JobInsertCall.html), [*list*](struct.JobListCall.html) and [*query*](struct.JobQueryCall.html) +//! * [models](struct.Model.html) +//! * [*delete*](struct.ModelDeleteCall.html), [*get*](struct.ModelGetCall.html), [*list*](struct.ModelListCall.html) and [*patch*](struct.ModelPatchCall.html) //! * projects //! * [*get service account*](struct.ProjectGetServiceAccountCall.html) and [*list*](struct.ProjectListCall.html) //! * tabledata @@ -384,6 +386,9 @@ impl<'a, C, A> Bigquery pub fn jobs(&'a self) -> JobMethods<'a, C, A> { JobMethods { hub: &self } } + pub fn models(&'a self) -> ModelMethods<'a, C, A> { + ModelMethods { hub: &self } + } pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { ProjectMethods { hub: &self } } @@ -423,19 +428,6 @@ impl<'a, C, A> Bigquery // ############ // SCHEMAS ### // ########## -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Clustering { - /// [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data. - pub fields: Option>, -} - -impl Part for Clustering {} - - /// The rows to insert. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -462,6 +454,9 @@ pub struct JobStatistics4 { /// [Output-only] Number of files per destination URI or URI pattern specified in the extract configuration. These values will be in the same order as the URIs specified in the 'destinationUris' field. #[serde(rename="destinationUriFileCounts")] pub destination_uri_file_counts: Option>, + /// [Output-only] Number of user bytes extracted into the result. This is the byte count as computed by BigQuery for billing purposes. + #[serde(rename="inputBytes")] + pub input_bytes: Option, } impl Part for JobStatistics4 {} @@ -469,51 +464,18 @@ impl Part for JobStatistics4 {} /// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [query jobs](struct.JobQueryCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct QueryRequest { - /// [Optional] How long to wait for the query to complete, in milliseconds, before the request times out and returns. Note that this is only a timeout for the request, not the query. If the query takes longer to run than the timeout value, the call returns without any results and with the 'jobComplete' flag set to false. You can call GetQueryResults() to wait for the query to complete and read the results. The default value is 10000 milliseconds (10 seconds). - #[serde(rename="timeoutMs")] - pub timeout_ms: Option, - /// The resource type of the request. - pub kind: Option, - /// [Optional] If set to true, BigQuery doesn't run the job. Instead, if the query is valid, BigQuery returns statistics about the job such as how many bytes would be processed. If the query is invalid, an error returns. The default value is false. - #[serde(rename="dryRun")] - pub dry_run: Option, - /// Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query. - #[serde(rename="parameterMode")] - pub parameter_mode: Option, - /// [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. The default value is true. - #[serde(rename="useQueryCache")] - pub use_query_cache: Option, - /// [Optional] Specifies the default datasetId and projectId to assume for any unqualified table names in the query. If not set, all table names in the query string must be qualified in the format 'datasetId.tableId'. - #[serde(rename="defaultDataset")] - pub default_dataset: Option, - /// Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false. - #[serde(rename="useLegacySql")] - pub use_legacy_sql: Option, - /// [Optional] The maximum number of rows of data to return per page of results. Setting this flag to a small value such as 1000 and then paging through results might improve reliability when the query result set is large. In addition to this limit, responses are also limited to 10 MB. By default, there is no maximum row count, and only the byte limit applies. - #[serde(rename="maxResults")] - pub max_results: Option, - /// The geographic location where the job should run. Required except for US and EU. - pub location: Option, - /// Query parameters for Standard SQL queries. - #[serde(rename="queryParameters")] - pub query_parameters: Option>, - /// [Required] A query string, following the BigQuery query syntax, of the query to execute. Example: "SELECT count(f1) FROM [myProjectId:myDatasetId.myTableId]". +pub struct MaterializedViewDefinition { + /// [Output-only] [TrustedTester] The time when this materialized view was last modified, in milliseconds since the epoch. + #[serde(rename="lastRefreshTime")] + pub last_refresh_time: Option, + /// [Required] A query whose result is persisted. pub query: Option, - /// [Deprecated] This property is deprecated. - #[serde(rename="preserveNulls")] - pub preserve_nulls: Option, } -impl RequestValue for QueryRequest {} +impl Part for MaterializedViewDefinition {} /// There is no detailed description. @@ -522,12 +484,15 @@ impl RequestValue for QueryRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct JobStatistics2 { - /// [Output-only, Beta] Deprecated; do not use. - #[serde(rename="modelTrainingExpectedTotalIteration")] - pub model_training_expected_total_iteration: Option, + /// [Output-only, Beta] Information about create model query job progress. + #[serde(rename="modelTraining")] + pub model_training: Option, + /// [Output-only] Slot-milliseconds for the job. + #[serde(rename="totalSlotMs")] + pub total_slot_ms: Option, /// [Output-only] [Beta] Describes a timeline of job execution. pub timeline: Option>, - /// The type of query statement, if valid. Possible values (new values might be added in the future): "SELECT": SELECT query. "INSERT": INSERT query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language "UPDATE": UPDATE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language "DELETE": DELETE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language "MERGE": MERGE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language "CREATE_TABLE": CREATE [OR REPLACE] TABLE without AS SELECT. "CREATE_TABLE_AS_SELECT": CREATE [OR REPLACE] TABLE ... AS SELECT ... "DROP_TABLE": DROP TABLE query. "CREATE_VIEW": CREATE [OR REPLACE] VIEW ... AS SELECT ... "DROP_VIEW": DROP VIEW query. + /// The type of query statement, if valid. Possible values (new values might be added in the future): "SELECT": SELECT query. "INSERT": INSERT query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "UPDATE": UPDATE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "DELETE": DELETE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "MERGE": MERGE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "CREATE_TABLE": CREATE [OR REPLACE] TABLE without AS SELECT. "CREATE_TABLE_AS_SELECT": CREATE [OR REPLACE] TABLE ... AS SELECT ... . "DROP_TABLE": DROP TABLE query. "CREATE_VIEW": CREATE [OR REPLACE] VIEW ... AS SELECT ... . "DROP_VIEW": DROP VIEW query. "CREATE_FUNCTION": CREATE FUNCTION query. "DROP_FUNCTION" : DROP FUNCTION query. "ALTER_TABLE": ALTER TABLE query. "ALTER_VIEW": ALTER VIEW query. #[serde(rename="statementType")] pub statement_type: Option, /// [Output-only] Job resource usage breakdown by reservation. @@ -539,9 +504,9 @@ pub struct JobStatistics2 { /// [Output-only] Total bytes processed for the job. #[serde(rename="totalBytesProcessed")] pub total_bytes_processed: Option, - /// [Output-only, Beta] Information about create model query job progress. - #[serde(rename="modelTraining")] - pub model_training: Option, + /// [Output-only] For dry-run jobs, totalBytesProcessed is an estimate and this field specifies the accuracy of the estimate. Possible values can be: UNKNOWN: accuracy of the estimate is unknown. PRECISE: estimate is precise. LOWER_BOUND: estimate is lower bound of what the query would cost. UPPER_BOUND: estimate is upper bound of what the query would cost. + #[serde(rename="totalBytesProcessedAccuracy")] + pub total_bytes_processed_accuracy: Option, /// Standard SQL only: list of undeclared query parameters detected during a dry run validation. #[serde(rename="undeclaredQueryParameters")] pub undeclared_query_parameters: Option>, @@ -551,21 +516,24 @@ pub struct JobStatistics2 { /// The DDL target table. Present only for CREATE/DROP TABLE/VIEW queries. #[serde(rename="ddlTargetTable")] pub ddl_target_table: Option, - /// [Output-only] Slot-milliseconds for the job. - #[serde(rename="totalSlotMs")] - pub total_slot_ms: Option, + /// [Output-only, Beta] Deprecated; do not use. + #[serde(rename="modelTrainingExpectedTotalIteration")] + pub model_training_expected_total_iteration: Option, /// [Output-only] Describes execution plan for the query. #[serde(rename="queryPlan")] pub query_plan: Option>, /// [Output-only] The original estimate of bytes processed for the job. #[serde(rename="estimatedBytesProcessed")] pub estimated_bytes_processed: Option, - /// [Output-only] Total bytes billed for the job. - #[serde(rename="totalBytesBilled")] - pub total_bytes_billed: Option, /// [Output-only] Whether the query result was fetched from the query cache. #[serde(rename="cacheHit")] pub cache_hit: Option, + /// [Output-only] Total bytes billed for the job. + #[serde(rename="totalBytesBilled")] + pub total_bytes_billed: Option, + /// The DDL target routine. Present only for CREATE/DROP FUNCTION/PROCEDURE queries. + #[serde(rename="ddlTargetRoutine")] + pub ddl_target_routine: Option, /// The DDL operation performed, possibly dependent on the pre-existence of the DDL target. Possible values (new values might be added in the future): "CREATE": The query created the DDL target. "SKIP": No-op. Example cases: the query is CREATE TABLE IF NOT EXISTS while the table already exists, or the query is DROP TABLE IF EXISTS while the table does not exist. "REPLACE": The query replaced the DDL target. Example case: the query is CREATE OR REPLACE TABLE, and the table already exists. "DROP": The query deleted the DDL target. #[serde(rename="ddlOperationPerformed")] pub ddl_operation_performed: Option, @@ -619,7 +587,7 @@ impl Part for JobStatistics3 {} pub struct ModelDefinition { /// [Output-only, Beta] Information about ml training runs, each training run comprises of multiple iterations and there may be multiple training runs for the model if warm start is used or if a user decides to continue a previously cancelled query. #[serde(rename="trainingRuns")] - pub training_runs: Option>, + pub training_runs: Option>, /// [Output-only, Beta] Model options used for the first training run. These options are immutable for subsequent training runs. Default values are used for any options not specified in the input query. #[serde(rename="modelOptions")] pub model_options: Option, @@ -637,6 +605,8 @@ pub struct DestinationTableProperties { /// [Optional] The friendly name for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current friendly name is provided, the job will fail. #[serde(rename="friendlyName")] pub friendly_name: Option, + /// [Optional] The labels associated with this table. You can use these to organize and group your tables. This will only be used if the destination table is newly created. If the table already exists and labels are different than the current labels are provided, the job will fail. + pub labels: Option>, /// [Optional] The description for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current description is provided, the job will fail. pub description: Option, } @@ -644,40 +614,63 @@ pub struct DestinationTableProperties { impl Part for DestinationTableProperties {} -/// There is no detailed description. +/// Aggregate metrics for classification models. For multi-class models, +/// the metrics are either macro-averaged: metrics are calculated for each +/// label and then an unweighted average is taken of those values or +/// micro-averaged: the metric is calculated globally by counting the total +/// number of correctly predicted rows. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EncryptionConfiguration { - /// [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key. - #[serde(rename="kmsKeyName")] - pub kms_key_name: Option, +pub struct AggregateClassificationMetrics { + /// Logarithmic Loss. For multiclass this is a macro-averaged metric. + #[serde(rename="logLoss")] + pub log_loss: Option, + /// Threshold at which the metrics are computed. For binary + /// classification models this is the positive class threshold. + /// For multi-class classfication models this is the confidence + /// threshold. + pub threshold: Option, + /// Recall is the fraction of actual positive labels that were given a + /// positive prediction. For multiclass this is a macro-averaged metric. + pub recall: Option, + /// Area Under a ROC Curve. For multiclass this is a macro-averaged + /// metric. + #[serde(rename="rocAuc")] + pub roc_auc: Option, + /// The F1 score is an average of recall and precision. For multiclass + /// this is a macro-averaged metric. + #[serde(rename="f1Score")] + pub f1_score: Option, + /// Precision is the fraction of actual positive predictions that had + /// positive actual labels. For multiclass this is a macro-averaged + /// metric treating each class as a binary classifier. + pub precision: Option, + /// Accuracy is the fraction of predictions given the correct label. For + /// multiclass this is a micro-averaged metric. + pub accuracy: Option, } -impl Part for EncryptionConfiguration {} +impl Part for AggregateClassificationMetrics {} -/// There is no detailed description. +/// A field or a column. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableFieldSchema { - /// [Optional] Describes the nested schema fields if the type property is set to RECORD. - pub fields: Option>, - /// [Optional] The field description. The maximum length is 1,024 characters. - pub description: Option, - /// [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD). +pub struct StandardSqlField { + /// Optional. The type of this parameter. Absent if not explicitly + /// specified (e.g., CREATE FUNCTION statement can omit the return type; + /// in this case the output parameter does not have this "type" field). #[serde(rename="type")] - pub type_: Option, - /// [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE. - pub mode: Option, - /// [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters. + pub type_: Option, + /// Optional. The name of this field. Can be absent for struct fields. pub name: Option, } -impl Part for TableFieldSchema {} +impl Part for StandardSqlField {} /// There is no detailed description. @@ -685,42 +678,85 @@ impl Part for TableFieldSchema {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct QueryParameter { - /// [Required] The type of this parameter. - #[serde(rename="parameterType")] - pub parameter_type: Option, - /// [Required] The value of this parameter. - #[serde(rename="parameterValue")] - pub parameter_value: Option, - /// [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query. - pub name: Option, +pub struct RoutineReference { + /// [Required] The ID of the project containing this routine. + #[serde(rename="projectId")] + pub project_id: Option, + /// [Required] The ID of the dataset containing this routine. + #[serde(rename="datasetId")] + pub dataset_id: Option, + /// [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters. + #[serde(rename="routineId")] + pub routine_id: Option, } -impl Part for QueryParameter {} +impl Part for RoutineReference {} /// There is no detailed description. /// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query jobs](struct.JobQueryCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryRequest { + /// [Optional] How long to wait for the query to complete, in milliseconds, before the request times out and returns. Note that this is only a timeout for the request, not the query. If the query takes longer to run than the timeout value, the call returns without any results and with the 'jobComplete' flag set to false. You can call GetQueryResults() to wait for the query to complete and read the results. The default value is 10000 milliseconds (10 seconds). + #[serde(rename="timeoutMs")] + pub timeout_ms: Option, + /// The resource type of the request. + pub kind: Option, + /// [Optional] If set to true, BigQuery doesn't run the job. Instead, if the query is valid, BigQuery returns statistics about the job such as how many bytes would be processed. If the query is invalid, an error returns. The default value is false. + #[serde(rename="dryRun")] + pub dry_run: Option, + /// Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query. + #[serde(rename="parameterMode")] + pub parameter_mode: Option, + /// [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. The default value is true. + #[serde(rename="useQueryCache")] + pub use_query_cache: Option, + /// [Optional] Specifies the default datasetId and projectId to assume for any unqualified table names in the query. If not set, all table names in the query string must be qualified in the format 'datasetId.tableId'. + #[serde(rename="defaultDataset")] + pub default_dataset: Option, + /// Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false. + #[serde(rename="useLegacySql")] + pub use_legacy_sql: Option, + /// [Optional] The maximum number of rows of data to return per page of results. Setting this flag to a small value such as 1000 and then paging through results might improve reliability when the query result set is large. In addition to this limit, responses are also limited to 10 MB. By default, there is no maximum row count, and only the byte limit applies. + #[serde(rename="maxResults")] + pub max_results: Option, + /// The geographic location where the job should run. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location. + pub location: Option, + /// Query parameters for Standard SQL queries. + #[serde(rename="queryParameters")] + pub query_parameters: Option>, + /// [Required] A query string, following the BigQuery query syntax, of the query to execute. Example: "SELECT count(f1) FROM [myProjectId:myDatasetId.myTableId]". + pub query: Option, + /// [Deprecated] This property is deprecated. + #[serde(rename="preserveNulls")] + pub preserve_nulls: Option, +} + +impl RequestValue for QueryRequest {} + + +/// Evaluation metrics for clustering models. +/// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BigtableColumnFamily { - /// [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it. - pub encoding: Option, - /// [Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it. - #[serde(rename="type")] - pub type_: Option, - /// [Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column. - #[serde(rename="onlyReadLatest")] - pub only_read_latest: Option, - /// [Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field. - pub columns: Option>, - /// Identifier of the column family. - #[serde(rename="familyId")] - pub family_id: Option, +pub struct ClusteringMetrics { + /// Mean of squared distances between each sample to its cluster centroid. + #[serde(rename="meanSquaredDistance")] + pub mean_squared_distance: Option, + /// Davies-Bouldin index. + #[serde(rename="daviesBouldinIndex")] + pub davies_bouldin_index: Option, } -impl Part for BigtableColumnFamily {} +impl Part for ClusteringMetrics {} /// There is no detailed description. @@ -743,126 +779,62 @@ pub struct BigtableOptions { impl Part for BigtableOptions {} -/// [Output-only, Beta] Model options used for the first training run. These options are immutable for subsequent training runs. Default values are used for any options not specified in the input query. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ModelDefinitionModelOptions { - /// no description provided - pub labels: Option>, - /// no description provided - #[serde(rename="lossType")] - pub loss_type: Option, - /// no description provided - #[serde(rename="modelType")] - pub model_type: Option, -} - -impl NestedType for ModelDefinitionModelOptions {} -impl Part for ModelDefinitionModelOptions {} - - -/// There is no detailed description. +/// Information about a single iteration of the training run. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IterationResult { - /// [Output-only, Beta] Index of the ML training iteration, starting from zero for each training run. + /// Index of the iteration, 0 based. pub index: Option, - /// [Output-only, Beta] Eval loss computed on the eval data at the end of the iteration. The eval loss is used for early stopping to avoid overfitting. No eval loss if eval_split_method option is specified as no_split or auto_split with input data size less than 500 rows. - #[serde(rename="evalLoss")] - pub eval_loss: Option, - /// [Output-only, Beta] Learning rate used for this iteration, it varies for different training iterations if learn_rate_strategy option is not constant. + /// Learn rate used for this iteration. #[serde(rename="learnRate")] pub learn_rate: Option, - /// [Output-only, Beta] Time taken to run the training iteration in milliseconds. - #[serde(rename="durationMs")] - pub duration_ms: Option, - /// [Output-only, Beta] Training loss computed on the training data at the end of the iteration. The training loss function is defined by model type. + /// Loss computed on the training data at the end of iteration. #[serde(rename="trainingLoss")] pub training_loss: Option, + /// Loss computed on the eval data at the end of iteration. + #[serde(rename="evalLoss")] + pub eval_loss: Option, + /// Time taken to run the iteration in milliseconds. + #[serde(rename="durationMs")] + pub duration_ms: Option, + /// [Beta] Information about top clusters for clustering models. + #[serde(rename="clusterInfos")] + pub cluster_infos: Option>, } impl Part for IterationResult {} -/// There is no detailed description. +/// Confusion matrix for binary classification models. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BigtableColumn { - /// [Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name. - #[serde(rename="qualifierEncoded")] - pub qualifier_encoded: Option, - /// [Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries. - #[serde(rename="fieldName")] - pub field_name: Option, - /// [Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels. - #[serde(rename="onlyReadLatest")] - pub only_read_latest: Option, - /// [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels. - pub encoding: Option, - /// no description provided - #[serde(rename="qualifierString")] - pub qualifier_string: Option, - /// [Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels. - #[serde(rename="type")] - pub type_: Option, +pub struct BinaryConfusionMatrix { + /// Number of false samples predicted as false. + #[serde(rename="falseNegatives")] + pub false_negatives: Option, + /// Number of false samples predicted as true. + #[serde(rename="falsePositives")] + pub false_positives: Option, + /// Number of true samples predicted as true. + #[serde(rename="truePositives")] + pub true_positives: Option, + /// Number of true samples predicted as false. + #[serde(rename="trueNegatives")] + pub true_negatives: Option, + /// Aggregate recall. + pub recall: Option, + /// Aggregate precision. + pub precision: Option, + /// Threshold value used when computing each of the following metric. + #[serde(rename="positiveClassThreshold")] + pub positive_class_threshold: Option, } -impl Part for BigtableColumn {} - - -/// An array of errors for rows that were not inserted. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableDataInsertAllResponseInsertErrors { - /// The index of the row that error applies to. - pub index: Option, - /// Error information for the row indicated by the index property. - pub errors: Option>, -} - -impl NestedType for TableDataInsertAllResponseInsertErrors {} -impl Part for TableDataInsertAllResponseInsertErrors {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableCell { - /// no description provided - pub v: Option, -} - -impl Part for TableCell {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct QueryParameterType { - /// [Optional] The types of the fields of this struct, in order, if this is a struct. - #[serde(rename="structTypes")] - pub struct_types: Option>, - /// [Required] The top level type of this field. - #[serde(rename="type")] - pub type_: Option, - /// [Optional] The type of the array's elements, if this is an array. - #[serde(rename="arrayType")] - pub array_type: Option>>, -} - -impl Part for QueryParameterType {} +impl Part for BinaryConfusionMatrix {} /// There is no detailed description. @@ -874,7 +846,7 @@ pub struct JobReference { /// [Required] The ID of the project containing this job. #[serde(rename="projectId")] pub project_id: Option, - /// The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location. + /// The geographic location of the job. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location. pub location: Option, /// [Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters. #[serde(rename="jobId")] @@ -986,7 +958,7 @@ impl Part for ExplainQueryStage {} pub struct DatasetListDatasets { /// The resource type. This property always returns the value "bigquery#dataset". pub kind: Option, - /// [Experimental] The geographic location where the data resides. + /// The geographic location where the data resides. pub location: Option, /// The dataset reference. Use this property to access specific parts of the dataset's ID, such as project ID or dataset ID. #[serde(rename="datasetReference")] @@ -1004,6 +976,1102 @@ impl NestedType for DatasetListDatasets {} impl Part for DatasetListDatasets {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserDefinedFunctionResource { + /// [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path). + #[serde(rename="resourceUri")] + pub resource_uri: Option, + /// [Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code. + #[serde(rename="inlineCode")] + pub inline_code: Option, +} + +impl Part for UserDefinedFunctionResource {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list tables](struct.TableListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableList { + /// A token to request the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Tables in the requested dataset. + pub tables: Option>, + /// The type of list. + pub kind: Option, + /// A hash of this page of results. + pub etag: Option, + /// The total number of tables in the dataset. + #[serde(rename="totalItems")] + pub total_items: Option, +} + +impl ResponseResult for TableList {} + + +/// Represents a single JSON object. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct JsonObject(Option>); + +impl Part for JsonObject {} + + +/// [Optional] The categories attached to this field, used for field-level access control. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableFieldSchemaCategories { + /// A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed. + pub names: Option>, +} + +impl NestedType for TableFieldSchemaCategories {} +impl Part for TableFieldSchemaCategories {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct JobConfigurationLoad { + /// [Optional] If sourceFormat is set to "AVRO", indicates whether to enable interpreting logical types into their corresponding types (ie. TIMESTAMP), instead of only using their raw types (ie. INTEGER). + #[serde(rename="useAvroLogicalTypes")] + pub use_avro_logical_types: Option, + /// Custom encryption configuration (e.g., Cloud KMS keys). + #[serde(rename="destinationEncryptionConfiguration")] + pub destination_encryption_configuration: Option, + /// [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties. + pub encoding: Option, + /// [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped. + #[serde(rename="skipLeadingRows")] + pub skip_leading_rows: Option, + /// [Optional] Indicates if we should automatically infer the options and schema for CSV and JSON sources. + pub autodetect: Option, + /// [Required] The destination table to load the data into. + #[serde(rename="destinationTable")] + pub destination_table: Option, + /// [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups: Exactly one URI can be specified. Also, the '*' wildcard character is not allowed. + #[serde(rename="sourceUris")] + pub source_uris: Option>, + /// [Optional] Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when loading a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as an empty value. + #[serde(rename="nullMarker")] + pub null_marker: Option, + /// Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified. + #[serde(rename="timePartitioning")] + pub time_partitioning: Option, + /// Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false. + #[serde(rename="allowQuotedNewlines")] + pub allow_quoted_newlines: Option, + /// If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result. + #[serde(rename="projectionFields")] + pub projection_fields: Option>, + /// [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered. + pub clustering: Option, + /// [Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (','). + #[serde(rename="fieldDelimiter")] + pub field_delimiter: Option, + /// [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats. + #[serde(rename="allowJaggedRows")] + pub allow_jagged_rows: Option, + /// [Beta] [Optional] Properties with which to create the destination table if it is new. + #[serde(rename="destinationTableProperties")] + pub destination_table_properties: Option, + /// [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro, specify "AVRO". For parquet, specify "PARQUET". For orc, specify "ORC". The default value is CSV. + #[serde(rename="sourceFormat")] + pub source_format: Option, + /// [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified. + #[serde(rename="rangePartitioning")] + pub range_partitioning: Option, + /// [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_APPEND. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion. + #[serde(rename="writeDisposition")] + pub write_disposition: Option, + /// [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. This is only valid for CSV and JSON. The default value is 0, which requires that all records are valid. + #[serde(rename="maxBadRecords")] + pub max_bad_records: Option, + /// Allows the schema of the destination table to be updated as a side effect of the load job if a schema is autodetected or supplied in the job configuration. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable. + #[serde(rename="schemaUpdateOptions")] + pub schema_update_options: Option>, + /// [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names + #[serde(rename="ignoreUnknownValues")] + pub ignore_unknown_values: Option, + /// [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true. + pub quote: Option, + /// [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error. + #[serde(rename="hivePartitioningMode")] + pub hive_partitioning_mode: Option, + /// [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion. + #[serde(rename="createDisposition")] + pub create_disposition: Option, + /// [Deprecated] The format of the schemaInline property. + #[serde(rename="schemaInlineFormat")] + pub schema_inline_format: Option, + /// [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT". + #[serde(rename="schemaInline")] + pub schema_inline: Option, + /// [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore. + pub schema: Option, +} + +impl Part for JobConfigurationLoad {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BigQueryModelTraining { + /// [Output-only, Beta] Index of current ML training iteration. Updated during create model query job to show job progress. + #[serde(rename="currentIteration")] + pub current_iteration: Option, + /// [Output-only, Beta] Expected number of iterations for the create model query job specified as num_iterations in the input query. The actual total number of iterations may be less than this number due to early stop. + #[serde(rename="expectedTotalIterations")] + pub expected_total_iterations: Option, +} + +impl Part for BigQueryModelTraining {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert all tabledata](struct.TabledataInsertAllCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableDataInsertAllResponse { + /// The resource type of the response. + pub kind: Option, + /// An array of errors for rows that were not inserted. + #[serde(rename="insertErrors")] + pub insert_errors: Option>, +} + +impl ResponseResult for TableDataInsertAllResponse {} + + +/// Evaluation metrics for regression models. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RegressionMetrics { + /// Mean squared log error. + #[serde(rename="meanSquaredLogError")] + pub mean_squared_log_error: Option, + /// Mean absolute error. + #[serde(rename="meanAbsoluteError")] + pub mean_absolute_error: Option, + /// Mean squared error. + #[serde(rename="meanSquaredError")] + pub mean_squared_error: Option, + /// Median absolute error. + #[serde(rename="medianAbsoluteError")] + pub median_absolute_error: Option, + /// R^2 score. + #[serde(rename="rSquared")] + pub r_squared: Option, +} + +impl Part for RegressionMetrics {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get query results jobs](struct.JobGetQueryResultCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetQueryResultsResponse { + /// The resource type of the response. + pub kind: Option, + /// [Output-only] The first errors or warnings encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful. + pub errors: Option>, + /// Reference to the BigQuery Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults). + #[serde(rename="jobReference")] + pub job_reference: Option, + /// Whether the query result was fetched from the query cache. + #[serde(rename="cacheHit")] + pub cache_hit: Option, + /// Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available. + #[serde(rename="jobComplete")] + pub job_complete: Option, + /// The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results. Present only when the query completes successfully. + #[serde(rename="totalRows")] + pub total_rows: Option, + /// The total number of bytes processed for this query. + #[serde(rename="totalBytesProcessed")] + pub total_bytes_processed: Option, + /// A token used for paging results. + #[serde(rename="pageToken")] + pub page_token: Option, + /// A hash of this response. + pub etag: Option, + /// An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above. Present only when the query completes successfully. + pub rows: Option>, + /// [Output-only] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE. + #[serde(rename="numDmlAffectedRows")] + pub num_dml_affected_rows: Option, + /// The schema of the results. Present only when the query completes successfully. + pub schema: Option, +} + +impl ResponseResult for GetQueryResultsResponse {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BqmlIterationResult { + /// [Output-only, Beta] Index of the ML training iteration, starting from zero for each training run. + pub index: Option, + /// [Output-only, Beta] Eval loss computed on the eval data at the end of the iteration. The eval loss is used for early stopping to avoid overfitting. No eval loss if eval_split_method option is specified as no_split or auto_split with input data size less than 500 rows. + #[serde(rename="evalLoss")] + pub eval_loss: Option, + /// [Output-only, Beta] Learning rate used for this iteration, it varies for different training iterations if learn_rate_strategy option is not constant. + #[serde(rename="learnRate")] + pub learn_rate: Option, + /// [Output-only, Beta] Time taken to run the training iteration in milliseconds. + #[serde(rename="durationMs")] + pub duration_ms: Option, + /// [Output-only, Beta] Training loss computed on the training data at the end of the iteration. The training loss function is defined by model type. + #[serde(rename="trainingLoss")] + pub training_loss: Option, +} + +impl Part for BqmlIterationResult {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CsvOptions { + /// [Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. + #[serde(rename="allowJaggedRows")] + pub allow_jagged_rows: Option, + /// [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped. + #[serde(rename="skipLeadingRows")] + pub skip_leading_rows: Option, + /// [Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (','). + #[serde(rename="fieldDelimiter")] + pub field_delimiter: Option, + /// [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties. + pub encoding: Option, + /// [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true. + pub quote: Option, + /// [Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false. + #[serde(rename="allowQuotedNewlines")] + pub allow_quoted_newlines: Option, +} + +impl Part for CsvOptions {} + + +/// [Output-only] Job resource usage breakdown by reservation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct JobStatistics2ReservationUsage { + /// [Output-only] Reservation name or "unreserved" for on-demand resources usage. + pub name: Option, + /// [Output-only] Slot-milliseconds the job spent in the given reservation. + #[serde(rename="slotMs")] + pub slot_ms: Option, +} + +impl NestedType for JobStatistics2ReservationUsage {} +impl Part for JobStatistics2ReservationUsage {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExplainQueryStep { + /// Machine-readable operation type. + pub kind: Option, + /// Human-readable stage descriptions. + pub substeps: Option>, +} + +impl Part for ExplainQueryStep {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ErrorProto { + /// Debugging information. This property is internal to Google and should not be used. + #[serde(rename="debugInfo")] + pub debug_info: Option, + /// A human-readable description of the error. + pub message: Option, + /// A short error code that summarizes the error. + pub reason: Option, + /// Specifies where the error occurred, if present. + pub location: Option, +} + +impl Part for ErrorProto {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ViewDefinition { + /// [Required] A query that BigQuery executes when the view is referenced. + pub query: Option, + /// Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ Queries and views that reference this view must use the same flag value. + #[serde(rename="useLegacySql")] + pub use_legacy_sql: Option, + /// Describes user-defined function resources used in the query. + #[serde(rename="userDefinedFunctionResources")] + pub user_defined_function_resources: Option>, +} + +impl Part for ViewDefinition {} + + +/// Evaluation metrics for binary classification models. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BinaryClassificationMetrics { + /// Aggregate classification metrics. + #[serde(rename="aggregateClassificationMetrics")] + pub aggregate_classification_metrics: Option, + /// Binary confusion matrix at multiple thresholds. + #[serde(rename="binaryConfusionMatrixList")] + pub binary_confusion_matrix_list: Option>, +} + +impl Part for BinaryClassificationMetrics {} + + +/// The type of a variable, e.g., a function argument. +/// Examples: +/// INT64: {type_kind="INT64"} +/// ARRAY: {type_kind="ARRAY", array_element_type="STRING"} +/// STRUCT>: +/// {type_kind="STRUCT", +/// struct_type={fields=[ +/// {name="x", type={type_kind="STRING"}}, +/// {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} +/// ]}} +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StandardSqlDataType { + /// The fields of this struct, in order, if type_kind = "STRUCT". + #[serde(rename="structType")] + pub struct_type: Option, + /// The type of the array's elements, if type_kind = "ARRAY". + #[serde(rename="arrayElementType")] + pub array_element_type: Option>>, + /// Required. The top level type of this field. + /// Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). + #[serde(rename="typeKind")] + pub type_kind: Option, +} + +impl Part for StandardSqlDataType {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +/// The contained type is `Option`. +/// +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct JsonValue(json::Value); + +impl Default for JsonValue { + fn default() -> JsonValue { + JsonValue(json::Value::Null) + } +} + +impl Part for JsonValue {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EncryptionConfiguration { + /// [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key. + #[serde(rename="kmsKeyName")] + pub kms_key_name: Option, +} + +impl Part for EncryptionConfiguration {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert all tabledata](struct.TabledataInsertAllCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableDataInsertAllRequest { + /// [Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false, which treats unknown values as errors. + #[serde(rename="ignoreUnknownValues")] + pub ignore_unknown_values: Option, + /// The resource type of the response. + pub kind: Option, + /// The rows to insert. + pub rows: Option>, + /// [Optional] Insert all valid rows of a request, even if invalid rows exist. The default value is false, which causes the entire request to fail if any invalid rows exist. + #[serde(rename="skipInvalidRows")] + pub skip_invalid_rows: Option, + /// If specified, treats the destination table as a base template, and inserts the rows into an instance table named "{destination}{templateSuffix}". BigQuery will manage creation of the instance table, using the schema of the base template table. See https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates tables. + #[serde(rename="templateSuffix")] + pub template_suffix: Option, +} + +impl RequestValue for TableDataInsertAllRequest {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct JobStatistics { + /// [Output-only] Statistics for a load job. + pub load: Option, + /// [Output-only] If this is a child job, the id of the parent. + #[serde(rename="parentJobId")] + pub parent_job_id: Option, + /// [Output-only] Number of child jobs executed. + #[serde(rename="numChildJobs")] + pub num_child_jobs: Option, + /// [Output-only] Slot-milliseconds for the job. + #[serde(rename="totalSlotMs")] + pub total_slot_ms: Option, + /// [TrustedTester] [Output-only] Job progress (0.0 -> 1.0) for LOAD and EXTRACT jobs. + #[serde(rename="completionRatio")] + pub completion_ratio: Option, + /// [Output-only] Job resource usage breakdown by reservation. + #[serde(rename="reservationUsage")] + pub reservation_usage: Option>, + /// [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs. + #[serde(rename="creationTime")] + pub creation_time: Option, + /// [Output-only] [Deprecated] Use the bytes processed in the query statistics instead. + #[serde(rename="totalBytesProcessed")] + pub total_bytes_processed: Option, + /// [Output-only] Quotas which delayed this job's start time. + #[serde(rename="quotaDeferments")] + pub quota_deferments: Option>, + /// [Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE. + #[serde(rename="startTime")] + pub start_time: Option, + /// [Output-only] Statistics for a query job. + pub query: Option, + /// [Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state. + #[serde(rename="endTime")] + pub end_time: Option, + /// [Output-only] Statistics for an extract job. + pub extract: Option, +} + +impl Part for JobStatistics {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryTimelineSample { + /// Cumulative slot-ms consumed by the query. + #[serde(rename="totalSlotMs")] + pub total_slot_ms: Option, + /// Total number of units currently being processed by workers. This does not correspond directly to slot usage. This is the largest value observed since the last sample. + #[serde(rename="activeUnits")] + pub active_units: Option, + /// Milliseconds elapsed since the start of query execution. + #[serde(rename="elapsedMs")] + pub elapsed_ms: Option, + /// Total parallel units of work remaining for the active stages. + #[serde(rename="pendingUnits")] + pub pending_units: Option, + /// Total parallel units of work completed by this query. + #[serde(rename="completedUnits")] + pub completed_units: Option, +} + +impl Part for QueryTimelineSample {} + + +/// List of jobs that were requested. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct JobListJobs { + /// [Full-projection-only] Describes the state of the job. + pub status: Option, + /// The resource type. + pub kind: Option, + /// [Output-only] Information about the job, including starting time and ending time of the job. + pub statistics: Option, + /// Job reference uniquely identifying the job. + #[serde(rename="jobReference")] + pub job_reference: Option, + /// Running state of the job. When the state is DONE, errorResult can be checked to determine whether the job succeeded or failed. + pub state: Option, + /// A result object that will be present only if the job has failed. + #[serde(rename="errorResult")] + pub error_result: Option, + /// [Full-projection-only] Specifies the job configuration. + pub configuration: Option, + /// Unique opaque ID of the job. + pub id: Option, + /// [Full-projection-only] Email address of the user who ran the job. + pub user_email: Option, +} + +impl NestedType for JobListJobs {} +impl Part for JobListJobs {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [cancel jobs](struct.JobCancelCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct JobCancelResponse { + /// The final state of the job. + pub job: Option, + /// The resource type of the response. + pub kind: Option, +} + +impl ResponseResult for JobCancelResponse {} + + +/// Confusion matrix for multi-class classification models. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConfusionMatrix { + /// Confidence threshold used when computing the entries of the + /// confusion matrix. + #[serde(rename="confidenceThreshold")] + pub confidence_threshold: Option, + /// One row per actual label. + pub rows: Option>, +} + +impl Part for ConfusionMatrix {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableReference { + /// [Required] The ID of the project containing this table. + #[serde(rename="projectId")] + pub project_id: Option, + /// [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters. + #[serde(rename="tableId")] + pub table_id: Option, + /// [Required] The ID of the dataset containing this table. + #[serde(rename="datasetId")] + pub dataset_id: Option, +} + +impl Part for TableReference {} + + +/// [Output-only, Beta] Training options used by this training run. These options are mutable for subsequent training runs. Default values are explicitly stored for options not specified in the input query of the first training run. For subsequent training runs, any option not explicitly specified in the input query will be copied from the previous training run. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BqmlTrainingRunTrainingOptions { + /// no description provided + #[serde(rename="learnRateStrategy")] + pub learn_rate_strategy: Option, + /// no description provided + #[serde(rename="l1Reg")] + pub l1_reg: Option, + /// no description provided + #[serde(rename="lineSearchInitLearnRate")] + pub line_search_init_learn_rate: Option, + /// no description provided + #[serde(rename="warmStart")] + pub warm_start: Option, + /// no description provided + #[serde(rename="maxIteration")] + pub max_iteration: Option, + /// no description provided + #[serde(rename="learnRate")] + pub learn_rate: Option, + /// no description provided + #[serde(rename="earlyStop")] + pub early_stop: Option, + /// no description provided + #[serde(rename="minRelProgress")] + pub min_rel_progress: Option, + /// no description provided + #[serde(rename="l2Reg")] + pub l2_reg: Option, +} + +impl NestedType for BqmlTrainingRunTrainingOptions {} +impl Part for BqmlTrainingRunTrainingOptions {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list jobs](struct.JobListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct JobList { + /// A token to request the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The resource type of the response. + pub kind: Option, + /// A hash of this page of results. + pub etag: Option, + /// List of jobs that were requested. + pub jobs: Option>, +} + +impl ResponseResult for JobList {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get service account projects](struct.ProjectGetServiceAccountCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetServiceAccountResponse { + /// The resource type of the response. + pub kind: Option, + /// The service account email address. + pub email: Option, +} + +impl ResponseResult for GetServiceAccountResponse {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct JobConfigurationExtract { + /// [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written. + #[serde(rename="destinationUri")] + pub destination_uri: Option, + /// [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV. + #[serde(rename="destinationFormat")] + pub destination_format: Option, + /// [Optional] The compression type to use for exported files. Possible values include GZIP, DEFLATE, SNAPPY, and NONE. The default value is NONE. DEFLATE and SNAPPY are only supported for Avro. + pub compression: Option, + /// [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written. + #[serde(rename="destinationUris")] + pub destination_uris: Option>, + /// [Optional] Whether to print out a header row in the results. Default is true. + #[serde(rename="printHeader")] + pub print_header: Option, + /// [Optional] Delimiter to use between fields in the exported data. Default is ',' + #[serde(rename="fieldDelimiter")] + pub field_delimiter: Option, + /// [Required] A reference to the table being exported. + #[serde(rename="sourceTable")] + pub source_table: Option, +} + +impl Part for JobConfigurationExtract {} + + +/// Projects to which you have at least READ access. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ProjectListProjects { + /// A descriptive name for this project. + #[serde(rename="friendlyName")] + pub friendly_name: Option, + /// The resource type. + pub kind: Option, + /// The numeric ID of this project. + #[serde(rename="numericId")] + pub numeric_id: Option, + /// An opaque ID of this project. + pub id: Option, + /// A unique reference to this project. + #[serde(rename="projectReference")] + pub project_reference: Option, +} + +impl NestedType for ProjectListProjects {} +impl Part for ProjectListProjects {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Clustering { + /// [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data. + pub fields: Option>, +} + +impl Part for Clustering {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryParameterValue { + /// [Optional] The struct field values, in order of the struct type's declaration. + #[serde(rename="structValues")] + pub struct_values: Option>, + /// [Optional] The array values, if this is an array type. + #[serde(rename="arrayValues")] + pub array_values: Option>, + /// [Optional] The value of this value, if a simple scalar type. + pub value: Option, +} + +impl Part for QueryParameterValue {} + + +/// An array of errors for rows that were not inserted. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableDataInsertAllResponseInsertErrors { + /// The index of the row that error applies to. + pub index: Option, + /// Error information for the row indicated by the index property. + pub errors: Option>, +} + +impl NestedType for TableDataInsertAllResponseInsertErrors {} +impl Part for TableDataInsertAllResponseInsertErrors {} + + +/// Id path of a model. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ModelReference { + /// [Required] The ID of the project containing this model. + #[serde(rename="projectId")] + pub project_id: Option, + /// [Required] The ID of the dataset containing this model. + #[serde(rename="datasetId")] + pub dataset_id: Option, + /// [Required] The ID of the model. The ID must contain only + /// letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum + /// length is 1,024 characters. + #[serde(rename="modelId")] + pub model_id: Option, +} + +impl Part for ModelReference {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list projects](struct.ProjectListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ProjectList { + /// A token to request the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The total number of projects in the list. + #[serde(rename="totalItems")] + pub total_items: Option, + /// The type of list. + pub kind: Option, + /// A hash of the page of results + pub etag: Option, + /// Projects to which you have at least READ access. + pub projects: Option>, +} + +impl ResponseResult for ProjectList {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableFieldSchema { + /// [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters. + pub name: Option, + /// [Optional] Describes the nested schema fields if the type property is set to RECORD. + pub fields: Option>, + /// [Optional] The field description. The maximum length is 1,024 characters. + pub description: Option, + /// [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD). + #[serde(rename="type")] + pub type_: Option, + /// [Optional] The categories attached to this field, used for field-level access control. + pub categories: Option, + /// [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE. + pub mode: Option, +} + +impl Part for TableFieldSchema {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryParameter { + /// [Required] The type of this parameter. + #[serde(rename="parameterType")] + pub parameter_type: Option, + /// [Required] The value of this parameter. + #[serde(rename="parameterValue")] + pub parameter_value: Option, + /// [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query. + pub name: Option, +} + +impl Part for QueryParameter {} + + +/// Additional details for a view. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableListTablesView { + /// True if view is defined in legacy SQL dialect, false if in standard SQL. + #[serde(rename="useLegacySql")] + pub use_legacy_sql: Option, +} + +impl NestedType for TableListTablesView {} +impl Part for TableListTablesView {} + + +/// [Output-only, Beta] Model options used for the first training run. These options are immutable for subsequent training runs. Default values are used for any options not specified in the input query. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ModelDefinitionModelOptions { + /// no description provided + pub labels: Option>, + /// no description provided + #[serde(rename="lossType")] + pub loss_type: Option, + /// no description provided + #[serde(rename="modelType")] + pub model_type: Option, +} + +impl NestedType for ModelDefinitionModelOptions {} +impl Part for ModelDefinitionModelOptions {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BigtableColumn { + /// [Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name. + #[serde(rename="qualifierEncoded")] + pub qualifier_encoded: Option, + /// [Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries. + #[serde(rename="fieldName")] + pub field_name: Option, + /// [Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels. + #[serde(rename="onlyReadLatest")] + pub only_read_latest: Option, + /// [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels. + pub encoding: Option, + /// no description provided + #[serde(rename="qualifierString")] + pub qualifier_string: Option, + /// [Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for BigtableColumn {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StandardSqlStructType { + /// no description provided + pub fields: Option>, +} + +impl Part for StandardSqlStructType {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableCell { + /// no description provided + pub v: Option, +} + +impl Part for TableCell {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryParameterType { + /// [Optional] The types of the fields of this struct, in order, if this is a struct. + #[serde(rename="structTypes")] + pub struct_types: Option>, + /// [Required] The top level type of this field. + #[serde(rename="type")] + pub type_: Option, + /// [Optional] The type of the array's elements, if this is an array. + #[serde(rename="arrayType")] + pub array_type: Option>>, +} + +impl Part for QueryParameterType {} + + +/// Evaluation metrics of a model. These are either computed on all +/// training data or just the eval data based on whether eval data was used +/// during training. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EvaluationMetrics { + /// [Beta] Populated for clustering models. + #[serde(rename="clusteringMetrics")] + pub clustering_metrics: Option, + /// Populated for regression models. + #[serde(rename="regressionMetrics")] + pub regression_metrics: Option, + /// Populated for binary classification models. + #[serde(rename="binaryClassificationMetrics")] + pub binary_classification_metrics: Option, + /// Populated for multi-class classification models. + #[serde(rename="multiClassClassificationMetrics")] + pub multi_class_classification_metrics: Option, +} + +impl Part for EvaluationMetrics {} + + +/// Information about a single cluster for clustering model. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClusterInfo { + /// Centroid id. + #[serde(rename="centroidId")] + pub centroid_id: Option, + /// Cluster size, the total number of points assigned to the cluster. + #[serde(rename="clusterSize")] + pub cluster_size: Option, + /// Cluster radius, the average distance from centroid + /// to each point assigned to the cluster. + #[serde(rename="clusterRadius")] + pub cluster_radius: Option, +} + +impl Part for ClusterInfo {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1024,23 +2092,6 @@ pub struct Streamingbuffer { impl Part for Streamingbuffer {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UserDefinedFunctionResource { - /// [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path). - #[serde(rename="resourceUri")] - pub resource_uri: Option, - /// [Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code. - #[serde(rename="inlineCode")] - pub inline_code: Option, -} - -impl Part for UserDefinedFunctionResource {} - - /// Tables in the requested dataset. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1081,34 +2132,6 @@ impl NestedType for TableListTables {} impl Part for TableListTables {} -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list tables](struct.TableListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableList { - /// A token to request the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Tables in the requested dataset. - pub tables: Option>, - /// The type of list. - pub kind: Option, - /// A hash of this page of results. - pub etag: Option, - /// The total number of tables in the dataset. - #[serde(rename="totalItems")] - pub total_items: Option, -} - -impl ResponseResult for TableList {} - - /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1123,6 +2146,83 @@ pub struct ProjectReference { impl Part for ProjectReference {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TrainingOptions { + /// The maximum number of iterations in training. + #[serde(rename="maxIterations")] + pub max_iterations: Option, + /// Whether to stop early when the loss doesn't improve significantly + /// any more (compared to min_relative_progress). + #[serde(rename="earlyStop")] + pub early_stop: Option, + /// Specifies the initial learning rate for line search to start at. + #[serde(rename="initialLearnRate")] + pub initial_learn_rate: Option, + /// The column to split data with. This column won't be used as a + /// feature. + /// 1. When data_split_method is CUSTOM, the corresponding column should + /// be boolean. The rows with true value tag are eval data, and the false + /// are training data. + /// 2. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION + /// rows (from smallest to largest) in the corresponding column are used + /// as training data, and the rest are eval data. It respects the order + /// in Orderable data types: + /// https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data-type-properties + #[serde(rename="dataSplitColumn")] + pub data_split_column: Option, + /// [Beta] Number of clusters for clustering models. + #[serde(rename="numClusters")] + pub num_clusters: Option, + /// Whether to train a model from the last checkpoint. + #[serde(rename="warmStart")] + pub warm_start: Option, + /// Name of input label columns in training data. + #[serde(rename="inputLabelColumns")] + pub input_label_columns: Option>, + /// Type of loss function used during training run. + #[serde(rename="lossType")] + pub loss_type: Option, + /// The strategy to determine learning rate. + #[serde(rename="learnRateStrategy")] + pub learn_rate_strategy: Option, + /// The fraction of evaluation data over the whole input data. The rest + /// of data will be used as training data. The format should be double. + /// Accurate to two decimal places. + /// Default value is 0.2. + #[serde(rename="dataSplitEvalFraction")] + pub data_split_eval_fraction: Option, + /// The data split type for training and evaluation, e.g. RANDOM. + #[serde(rename="dataSplitMethod")] + pub data_split_method: Option, + /// [Beta] Distance type for clustering models. + #[serde(rename="distanceType")] + pub distance_type: Option, + /// Weights associated with each label class, for rebalancing the + /// training data. + #[serde(rename="labelClassWeights")] + pub label_class_weights: Option>, + /// Learning rate in training. + #[serde(rename="learnRate")] + pub learn_rate: Option, + /// L2 regularization coefficient. + #[serde(rename="l2Regularization")] + pub l2_regularization: Option, + /// When early_stop is true, stops training when accuracy improvement is + /// less than 'min_relative_progress'. + #[serde(rename="minRelativeProgress")] + pub min_relative_progress: Option, + /// L1 regularization coefficient. + #[serde(rename="l1Regularization")] + pub l1_regularization: Option, +} + +impl Part for TrainingOptions {} + + /// There is no detailed description. /// /// # Activities @@ -1194,48 +2294,6 @@ impl Resource for Job {} impl ResponseResult for Job {} -/// List of jobs that were requested. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JobListJobs { - /// [Full-projection-only] Describes the state of the job. - pub status: Option, - /// The resource type. - pub kind: Option, - /// [Output-only] Information about the job, including starting time and ending time of the job. - pub statistics: Option, - /// Job reference uniquely identifying the job. - #[serde(rename="jobReference")] - pub job_reference: Option, - /// Running state of the job. When the state is DONE, errorResult can be checked to determine whether the job succeeded or failed. - pub state: Option, - /// A result object that will be present only if the job has failed. - #[serde(rename="errorResult")] - pub error_result: Option, - /// [Full-projection-only] Specifies the job configuration. - pub configuration: Option, - /// Unique opaque ID of the job. - pub id: Option, - /// [Full-projection-only] Email address of the user who ran the job. - pub user_email: Option, -} - -impl NestedType for JobListJobs {} -impl Part for JobListJobs {} - - -/// Represents a single JSON object. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JsonObject(Option>); - -impl Part for JsonObject {} - - /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1250,7 +2308,7 @@ pub struct TimePartitioning { /// [Required] The only type supported is DAY, which will generate one partition per day. #[serde(rename="type")] pub type_: Option, - /// [Beta] [Optional] If set to true, queries over this table require a partition filter that can be used for partition elimination to be specified. + /// no description provided #[serde(rename="requirePartitionFilter")] pub require_partition_filter: Option, } @@ -1263,219 +2321,23 @@ impl Part for TimePartitioning {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JobConfigurationLoad { - /// If sourceFormat is set to "AVRO", indicates whether to enable interpreting logical types into their corresponding types (ie. TIMESTAMP), instead of only using their raw types (ie. INTEGER). The default value will be true once this feature launches, but can be set now in preparation. - #[serde(rename="useAvroLogicalTypes")] - pub use_avro_logical_types: Option, - /// Custom encryption configuration (e.g., Cloud KMS keys). - #[serde(rename="destinationEncryptionConfiguration")] - pub destination_encryption_configuration: Option, - /// [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties. +pub struct BigtableColumnFamily { + /// [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it. pub encoding: Option, - /// [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true. - pub quote: Option, - /// [Optional] Indicates if we should automatically infer the options and schema for CSV and JSON sources. - pub autodetect: Option, - /// [Required] The destination table to load the data into. - #[serde(rename="destinationTable")] - pub destination_table: Option, - /// [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups: Exactly one URI can be specified. Also, the '*' wildcard character is not allowed. - #[serde(rename="sourceUris")] - pub source_uris: Option>, - /// [Optional] Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when loading a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as an empty value. - #[serde(rename="nullMarker")] - pub null_marker: Option, - /// Time-based partitioning specification for the destination table. - #[serde(rename="timePartitioning")] - pub time_partitioning: Option, - /// Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false. - #[serde(rename="allowQuotedNewlines")] - pub allow_quoted_newlines: Option, - /// If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result. - #[serde(rename="projectionFields")] - pub projection_fields: Option>, - /// [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered. - pub clustering: Option, - /// [Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (','). - #[serde(rename="fieldDelimiter")] - pub field_delimiter: Option, - /// [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats. - #[serde(rename="allowJaggedRows")] - pub allow_jagged_rows: Option, - /// [Beta] [Optional] Properties with which to create the destination table if it is new. - #[serde(rename="destinationTableProperties")] - pub destination_table_properties: Option, - /// [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro, specify "AVRO". For parquet, specify "PARQUET". For orc, specify "ORC". The default value is CSV. - #[serde(rename="sourceFormat")] - pub source_format: Option, - /// [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. This is only valid for CSV and JSON. The default value is 0, which requires that all records are valid. - #[serde(rename="maxBadRecords")] - pub max_bad_records: Option, - /// Allows the schema of the destination table to be updated as a side effect of the load job if a schema is autodetected or supplied in the job configuration. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable. - #[serde(rename="schemaUpdateOptions")] - pub schema_update_options: Option>, - /// [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names - #[serde(rename="ignoreUnknownValues")] - pub ignore_unknown_values: Option, - /// [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_APPEND. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion. - #[serde(rename="writeDisposition")] - pub write_disposition: Option, - /// [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped. - #[serde(rename="skipLeadingRows")] - pub skip_leading_rows: Option, - /// [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion. - #[serde(rename="createDisposition")] - pub create_disposition: Option, - /// [Deprecated] The format of the schemaInline property. - #[serde(rename="schemaInlineFormat")] - pub schema_inline_format: Option, - /// [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT". - #[serde(rename="schemaInline")] - pub schema_inline: Option, - /// [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore. - pub schema: Option, + /// [Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it. + #[serde(rename="type")] + pub type_: Option, + /// [Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column. + #[serde(rename="onlyReadLatest")] + pub only_read_latest: Option, + /// [Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field. + pub columns: Option>, + /// Identifier of the column family. + #[serde(rename="familyId")] + pub family_id: Option, } -impl Part for JobConfigurationLoad {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BigQueryModelTraining { - /// [Output-only, Beta] Index of current ML training iteration. Updated during create model query job to show job progress. - #[serde(rename="currentIteration")] - pub current_iteration: Option, - /// [Output-only, Beta] Expected number of iterations for the create model query job specified as num_iterations in the input query. The actual total number of iterations may be less than this number due to early stop. - #[serde(rename="expectedTotalIterations")] - pub expected_total_iterations: Option, -} - -impl Part for BigQueryModelTraining {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JobConfigurationExtract { - /// [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written. - #[serde(rename="destinationUri")] - pub destination_uri: Option, - /// [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV. - #[serde(rename="destinationFormat")] - pub destination_format: Option, - /// [Optional] The compression type to use for exported files. Possible values include GZIP, DEFLATE, SNAPPY, and NONE. The default value is NONE. DEFLATE and SNAPPY are only supported for Avro. - pub compression: Option, - /// [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written. - #[serde(rename="destinationUris")] - pub destination_uris: Option>, - /// [Optional] Whether to print out a header row in the results. Default is true. - #[serde(rename="printHeader")] - pub print_header: Option, - /// [Optional] Delimiter to use between fields in the exported data. Default is ',' - #[serde(rename="fieldDelimiter")] - pub field_delimiter: Option, - /// [Required] A reference to the table being exported. - #[serde(rename="sourceTable")] - pub source_table: Option, -} - -impl Part for JobConfigurationExtract {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get query results jobs](struct.JobGetQueryResultCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetQueryResultsResponse { - /// The resource type of the response. - pub kind: Option, - /// [Output-only] The first errors or warnings encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful. - pub errors: Option>, - /// Reference to the BigQuery Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults). - #[serde(rename="jobReference")] - pub job_reference: Option, - /// Whether the query result was fetched from the query cache. - #[serde(rename="cacheHit")] - pub cache_hit: Option, - /// Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available. - #[serde(rename="jobComplete")] - pub job_complete: Option, - /// The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results. Present only when the query completes successfully. - #[serde(rename="totalRows")] - pub total_rows: Option, - /// The total number of bytes processed for this query. - #[serde(rename="totalBytesProcessed")] - pub total_bytes_processed: Option, - /// A token used for paging results. - #[serde(rename="pageToken")] - pub page_token: Option, - /// A hash of this response. - pub etag: Option, - /// An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above. Present only when the query completes successfully. - pub rows: Option>, - /// [Output-only] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE. - #[serde(rename="numDmlAffectedRows")] - pub num_dml_affected_rows: Option, - /// The schema of the results. Present only when the query completes successfully. - pub schema: Option, -} - -impl ResponseResult for GetQueryResultsResponse {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CsvOptions { - /// [Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. - #[serde(rename="allowJaggedRows")] - pub allow_jagged_rows: Option, - /// [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped. - #[serde(rename="skipLeadingRows")] - pub skip_leading_rows: Option, - /// [Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (','). - #[serde(rename="fieldDelimiter")] - pub field_delimiter: Option, - /// [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties. - pub encoding: Option, - /// [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true. - pub quote: Option, - /// [Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false. - #[serde(rename="allowQuotedNewlines")] - pub allow_quoted_newlines: Option, -} - -impl Part for CsvOptions {} - - -/// [Output-only] Job resource usage breakdown by reservation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JobStatistics2ReservationUsage { - /// [Output-only] Reservation name or "unreserved" for on-demand resources usage. - pub name: Option, - /// [Output-only] Slot-milliseconds the job spent in the given reservation. - #[serde(rename="slotMs")] - pub slot_ms: Option, -} - -impl NestedType for JobStatistics2ReservationUsage {} -impl Part for JobStatistics2ReservationUsage {} +impl Part for BigtableColumnFamily {} /// There is no detailed description. @@ -1489,6 +2351,9 @@ pub struct ExternalDataConfiguration { /// Additional properties to set if sourceFormat is set to CSV. #[serde(rename="csvOptions")] pub csv_options: Option, + /// [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error. + #[serde(rename="hivePartitioningMode")] + pub hive_partitioning_mode: Option, /// Try to detect schema and format options automatically. Any option specified explicitly will be honored. pub autodetect: Option, /// [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. This is only valid for CSV, JSON, and Google Sheets. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats. @@ -1521,80 +2386,14 @@ impl Part for ExternalDataConfiguration {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExplainQueryStep { - /// Machine-readable operation type. - pub kind: Option, - /// Human-readable stage descriptions. - pub substeps: Option>, +pub struct RangePartitioning { + /// [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64. + pub field: Option, + /// [TrustedTester] [Required] Defines the ranges for range partitioning. + pub range: Option, } -impl Part for ExplainQueryStep {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ErrorProto { - /// Debugging information. This property is internal to Google and should not be used. - #[serde(rename="debugInfo")] - pub debug_info: Option, - /// A human-readable description of the error. - pub message: Option, - /// A short error code that summarizes the error. - pub reason: Option, - /// Specifies where the error occurred, if present. - pub location: Option, -} - -impl Part for ErrorProto {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ViewDefinition { - /// [Required] A query that BigQuery executes when the view is referenced. - pub query: Option, - /// Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ Queries and views that reference this view must use the same flag value. - #[serde(rename="useLegacySql")] - pub use_legacy_sql: Option, - /// Describes user-defined function resources used in the query. - #[serde(rename="userDefinedFunctionResources")] - pub user_defined_function_resources: Option>, -} - -impl Part for ViewDefinition {} - - -/// [Optional] An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER; -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DatasetAccess { - /// [Pick one] A domain to grant access to. Any users signed in with the domain specified will be granted the specified access. Example: "example.com". - pub domain: Option, - /// [Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER, WRITER, OWNER. - pub role: Option, - /// [Pick one] An email address of a user to grant access to. For example: fred@example.com. - #[serde(rename="userByEmail")] - pub user_by_email: Option, - /// [Pick one] A special group to grant access to. Possible values include: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users. - #[serde(rename="specialGroup")] - pub special_group: Option, - /// [Pick one] An email address of a Google Group to grant access to. - #[serde(rename="groupByEmail")] - pub group_by_email: Option, - /// [Pick one] A view from a different dataset to grant access to. Queries executed against that view will have read access to tables in this dataset. The role field is not required when this field is set. If that view is updated by any user, access to the view needs to be granted again via an update operation. - pub view: Option, -} - -impl NestedType for DatasetAccess {} -impl Part for DatasetAccess {} +impl Part for RangePartitioning {} /// There is no detailed description. @@ -1620,23 +2419,83 @@ impl Part for JobStatus {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TrainingRun { +pub struct BqmlTrainingRun { /// [Output-only, Beta] Different state applicable for a training run. IN PROGRESS: Training run is in progress. FAILED: Training run ended due to a non-retryable failure. SUCCEEDED: Training run successfully completed. CANCELLED: Training run cancelled by the user. pub state: Option, /// [Output-only, Beta] List of each iteration results. #[serde(rename="iterationResults")] - pub iteration_results: Option>, + pub iteration_results: Option>, /// [Output-only, Beta] Training run start time in milliseconds since the epoch. #[serde(rename="startTime")] pub start_time: Option, /// [Output-only, Beta] Training options used by this training run. These options are mutable for subsequent training runs. Default values are explicitly stored for options not specified in the input query of the first training run. For subsequent training runs, any option not explicitly specified in the input query will be copied from the previous training run. #[serde(rename="trainingOptions")] - pub training_options: Option, + pub training_options: Option, +} + +impl Part for BqmlTrainingRun {} + + +/// Information about a single training query run for the model. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TrainingRun { + /// The evaluation metrics over training/eval data that were computed at the + /// end of training. + #[serde(rename="evaluationMetrics")] + pub evaluation_metrics: Option, + /// Output of each iteration run, results.size() <= max_iterations. + pub results: Option>, + /// The start time of this training run. + #[serde(rename="startTime")] + pub start_time: Option, + /// Options that were used for this training run, includes + /// user specified and default options that were used. + #[serde(rename="trainingOptions")] + pub training_options: Option, } impl Part for TrainingRun {} +/// [Output-only] Job resource usage breakdown by reservation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct JobStatisticsReservationUsage { + /// [Output-only] Reservation name or "unreserved" for on-demand resources usage. + pub name: Option, + /// [Output-only] Slot-milliseconds the job spent in the given reservation. + #[serde(rename="slotMs")] + pub slot_ms: Option, +} + +impl NestedType for JobStatisticsReservationUsage {} +impl Part for JobStatisticsReservationUsage {} + + +/// A single entry in the confusion matrix. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Entry { + /// The predicted label. For confidence_threshold > 0, we will + /// also add an entry indicating the number of items under the + /// confidence threshold. + #[serde(rename="predictedLabel")] + pub predicted_label: Option, + /// Number of items being predicted as this label. + #[serde(rename="itemCount")] + pub item_count: Option, +} + +impl Part for Entry {} + + /// There is no detailed description. /// /// # Activities @@ -1644,81 +2503,71 @@ impl Part for TrainingRun {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get datasets](struct.DatasetGetCall.html) (response) -/// * [list datasets](struct.DatasetListCall.html) (none) -/// * [patch datasets](struct.DatasetPatchCall.html) (request|response) -/// * [update datasets](struct.DatasetUpdateCall.html) (request|response) -/// * [delete datasets](struct.DatasetDeleteCall.html) (none) -/// * [insert datasets](struct.DatasetInsertCall.html) (request|response) +/// * [patch models](struct.ModelPatchCall.html) (request|response) +/// * [get models](struct.ModelGetCall.html) (response) +/// * [list models](struct.ModelListCall.html) (none) +/// * [delete models](struct.ModelDeleteCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Dataset { - /// [Output-only] The resource type. - pub kind: Option, - /// [Optional] A user-friendly description of the dataset. - pub description: Option, - /// [Required] A reference that identifies the dataset. - #[serde(rename="datasetReference")] - pub dataset_reference: Option, - /// The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. See Creating and Updating Dataset Labels for more information. +pub struct Model { + /// [Optional] The labels associated with this model. You can use these to + /// organize and group your models. Label keys and values can be no longer + /// than 63 characters, can only contain lowercase letters, numeric + /// characters, underscores and dashes. International characters are allowed. + /// Label values are optional. Label keys must start with a letter and each + /// label in the list must have a different key. + /// @mutable bigquery.models.patch pub labels: Option>, - /// [Output-only] The time when this dataset was created, in milliseconds since the epoch. + /// [Optional] A user-friendly description of this model. + /// @mutable bigquery.models.patch + pub description: Option, + /// Required. Unique identifier for this model. + #[serde(rename="modelReference")] + pub model_reference: Option, + /// Output only. Input feature columns that were used to train this model. + #[serde(rename="featureColumns")] + pub feature_columns: Option>, + /// Output only. Label columns that were used to train this model. + /// The output of the model will have a “predicted_” prefix to these columns. + #[serde(rename="labelColumns")] + pub label_columns: Option>, + /// Output only. The time when this model was created, in millisecs since the + /// epoch. #[serde(rename="creationTime")] pub creation_time: Option, - /// [Optional] An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER; - pub access: Option>, - /// [Optional] The default lifetime of all tables in the dataset, in milliseconds. The minimum value is 3600000 milliseconds (one hour). Once this property is set, all newly-created tables in the dataset will have an expirationTime property set to the creation time plus the value in this property, and changing the value will only affect new tables, not existing ones. When the expirationTime for a given table is reached, that table will be deleted automatically. If a table's expirationTime is modified or removed before the table expires, or if you provide an explicit expirationTime when creating a table, that value takes precedence over the default expiration time indicated by this property. - #[serde(rename="defaultTableExpirationMs")] - pub default_table_expiration_ms: Option, - /// [Output-only] A hash of the resource. + /// Output only. Type of the model resource. + #[serde(rename="modelType")] + pub model_type: Option, + /// Output only. Information for all training runs in increasing order of + /// start_time. + #[serde(rename="trainingRuns")] + pub training_runs: Option>, + /// Output only. A hash of this resource. pub etag: Option, - /// [Optional] The default partition expiration for all partitioned tables in the dataset, in milliseconds. Once this property is set, all newly-created partitioned tables in the dataset will have an expirationMs property in the timePartitioning settings set to this value, and changing the value will only affect new tables, not existing ones. The storage in a partition will have an expiration time of its partition time plus this value. Setting this property overrides the use of defaultTableExpirationMs for partitioned tables: only one of defaultTableExpirationMs and defaultPartitionExpirationMs will be used for any new partitioned table. If you provide an explicit timePartitioning.expirationMs when creating or updating a partitioned table, that value takes precedence over the default partition expiration time indicated by this property. - #[serde(rename="defaultPartitionExpirationMs")] - pub default_partition_expiration_ms: Option, - /// The geographic location where the dataset should reside. The default value is US. See details at https://cloud.google.com/bigquery/docs/dataset-locations. + /// Output only. The geographic location where the model resides. This value + /// is inherited from the dataset. pub location: Option, - /// [Optional] A descriptive name for the dataset. + /// [Optional] A descriptive name for this model. + /// @mutable bigquery.models.patch #[serde(rename="friendlyName")] pub friendly_name: Option, - /// [Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch. + /// [Optional] The time when this model expires, in milliseconds since the + /// epoch. If not present, the model will persist indefinitely. Expired models + /// will be deleted and their storage reclaimed. The defaultTableExpirationMs + /// property of the encapsulating dataset can be used to set a default + /// expirationTime on newly created models. + /// @mutable bigquery.models.patch + #[serde(rename="expirationTime")] + pub expiration_time: Option, + /// Output only. The time when this model was last modified, in millisecs + /// since the epoch. #[serde(rename="lastModifiedTime")] pub last_modified_time: Option, - /// [Output-only] The fully-qualified unique name of the dataset in the format projectId:datasetId. The dataset name without the project name is given in the datasetId field. When creating a new dataset, leave this field blank, and instead specify the datasetId field. - pub id: Option, - /// [Output-only] A URL that can be used to access the resource again. You can use this URL in Get or Update requests to the resource. - #[serde(rename="selfLink")] - pub self_link: Option, } -impl RequestValue for Dataset {} -impl Resource for Dataset {} -impl ResponseResult for Dataset {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct QueryTimelineSample { - /// Cumulative slot-ms consumed by the query. - #[serde(rename="totalSlotMs")] - pub total_slot_ms: Option, - /// Total number of units currently being processed by workers. This does not correspond directly to slot usage. This is the largest value observed since the last sample. - #[serde(rename="activeUnits")] - pub active_units: Option, - /// Milliseconds elapsed since the start of query execution. - #[serde(rename="elapsedMs")] - pub elapsed_ms: Option, - /// Total parallel units of work remaining for the active stages. - #[serde(rename="pendingUnits")] - pub pending_units: Option, - /// Total parallel units of work completed by this query. - #[serde(rename="completedUnits")] - pub completed_units: Option, -} - -impl Part for QueryTimelineSample {} +impl RequestValue for Model {} +impl Resource for Model {} +impl ResponseResult for Model {} /// There is no detailed description. @@ -1734,119 +2583,21 @@ pub struct TableSchema { impl Part for TableSchema {} -/// Additional details for a view. +/// Evaluation metrics for multi-class classification models. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableListTablesView { - /// True if view is defined in legacy SQL dialect, false if in standard SQL. - #[serde(rename="useLegacySql")] - pub use_legacy_sql: Option, +pub struct MultiClassClassificationMetrics { + /// Aggregate classification metrics. + #[serde(rename="aggregateClassificationMetrics")] + pub aggregate_classification_metrics: Option, + /// Confusion matrix at different thresholds. + #[serde(rename="confusionMatrixList")] + pub confusion_matrix_list: Option>, } -impl NestedType for TableListTablesView {} -impl Part for TableListTablesView {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -/// The contained type is `Option`. -/// -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct JsonValue(json::Value); - -impl Default for JsonValue { - fn default() -> JsonValue { - JsonValue(json::Value::Null) - } -} - -impl Part for JsonValue {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list projects](struct.ProjectListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ProjectList { - /// A token to request the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The total number of projects in the list. - #[serde(rename="totalItems")] - pub total_items: Option, - /// The type of list. - pub kind: Option, - /// A hash of the page of results - pub etag: Option, - /// Projects to which you have at least READ access. - pub projects: Option>, -} - -impl ResponseResult for ProjectList {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [insert all tabledata](struct.TabledataInsertAllCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableDataInsertAllRequest { - /// [Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false, which treats unknown values as errors. - #[serde(rename="ignoreUnknownValues")] - pub ignore_unknown_values: Option, - /// The resource type of the response. - pub kind: Option, - /// The rows to insert. - pub rows: Option>, - /// [Optional] Insert all valid rows of a request, even if invalid rows exist. The default value is false, which causes the entire request to fail if any invalid rows exist. - #[serde(rename="skipInvalidRows")] - pub skip_invalid_rows: Option, - /// [Experimental] If specified, treats the destination table as a base template, and inserts the rows into an instance table named "{destination}{templateSuffix}". BigQuery will manage creation of the instance table, using the schema of the base template table. See https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates tables. - #[serde(rename="templateSuffix")] - pub template_suffix: Option, -} - -impl RequestValue for TableDataInsertAllRequest {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list datasets](struct.DatasetListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DatasetList { - /// A token that can be used to request the next results page. This property is omitted on the final results page. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list type. This property always returns the value "bigquery#datasetList". - pub kind: Option, - /// An array of the dataset resources in the project. Each resource contains basic information. For full information about a particular dataset resource, use the Datasets: get method. This property is omitted when there are no datasets in the project. - pub datasets: Option>, - /// A hash value of the results page. You can use this property to determine if the page has changed since the last request. - pub etag: Option, -} - -impl ResponseResult for DatasetList {} +impl Part for MultiClassClassificationMetrics {} /// [Optional] The types of the fields of this struct, in order, if this is a struct. @@ -1870,37 +2621,25 @@ impl Part for QueryParameterTypeStructTypes {} /// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list models](struct.ModelListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JobStatistics { - /// [Output-only] Statistics for a load job. - pub load: Option, - /// [TrustedTester] [Output-only] Job progress (0.0 -> 1.0) for LOAD and EXTRACT jobs. - #[serde(rename="completionRatio")] - pub completion_ratio: Option, - /// [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs. - #[serde(rename="creationTime")] - pub creation_time: Option, - /// [Output-only] [Deprecated] Use the bytes processed in the query statistics instead. - #[serde(rename="totalBytesProcessed")] - pub total_bytes_processed: Option, - /// [Output-only] Quotas which delayed this job's start time. - #[serde(rename="quotaDeferments")] - pub quota_deferments: Option>, - /// [Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE. - #[serde(rename="startTime")] - pub start_time: Option, - /// [Output-only] Statistics for a query job. - pub query: Option, - /// [Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state. - #[serde(rename="endTime")] - pub end_time: Option, - /// [Output-only] Statistics for an extract job. - pub extract: Option, +pub struct ListModelsResponse { + /// Models in the requested dataset. Only the following fields are populated: + /// model_reference, model_type, creation_time, last_modified_time and + /// labels. + pub models: Option>, + /// A token to request the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, } -impl Part for JobStatistics {} +impl ResponseResult for ListModelsResponse {} /// There is no detailed description. @@ -1918,34 +2657,43 @@ pub struct JobConfigurationQuery { /// [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true. #[serde(rename="useQueryCache")] pub use_query_cache: Option, - /// [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results. This property must be set for large results that exceed the maximum response size. - #[serde(rename="destinationTable")] - pub destination_table: Option, + /// Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query. + #[serde(rename="parameterMode")] + pub parameter_mode: Option, /// Query parameters for standard SQL queries. #[serde(rename="queryParameters")] pub query_parameters: Option>, + /// [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results. This property must be set for large results that exceed the maximum response size. + #[serde(rename="destinationTable")] + pub destination_table: Option, + /// Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false. + #[serde(rename="useLegacySql")] + pub use_legacy_sql: Option, /// [Required] SQL query text to execute. The useLegacySql field can be used to indicate whether the query uses legacy SQL or standard SQL. pub query: Option, + /// Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified. + #[serde(rename="timePartitioning")] + pub time_partitioning: Option, /// [Deprecated] This property is deprecated. #[serde(rename="preserveNulls")] pub preserve_nulls: Option, /// [Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default. #[serde(rename="maximumBytesBilled")] pub maximum_bytes_billed: Option, + /// Describes user-defined function resources used in the query. + #[serde(rename="userDefinedFunctionResources")] + pub user_defined_function_resources: Option>, + /// [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered. + pub clustering: Option, /// [Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default. #[serde(rename="maximumBillingTier")] pub maximum_billing_tier: Option, - /// [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered. - pub clustering: Option, - /// Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query. - #[serde(rename="parameterMode")] - pub parameter_mode: Option, /// [Optional] Specifies the default dataset to use for unqualified table names in the query. Note that this does not alter behavior of unqualified dataset names. #[serde(rename="defaultDataset")] pub default_dataset: Option, - /// Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false. - #[serde(rename="useLegacySql")] - pub use_legacy_sql: Option, + /// [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified. + #[serde(rename="rangePartitioning")] + pub range_partitioning: Option, /// Allows the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable. #[serde(rename="schemaUpdateOptions")] pub schema_update_options: Option>, @@ -1957,15 +2705,9 @@ pub struct JobConfigurationQuery { /// [Optional] If true and query uses legacy SQL dialect, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set. For standard SQL queries, this flag is ignored and large results are always allowed. However, you must still set destinationTable when result size exceeds the allowed maximum response size. #[serde(rename="allowLargeResults")] pub allow_large_results: Option, - /// Time-based partitioning specification for the destination table. - #[serde(rename="timePartitioning")] - pub time_partitioning: Option, /// [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion. #[serde(rename="createDisposition")] pub create_disposition: Option, - /// Describes user-defined function resources used in the query. - #[serde(rename="userDefinedFunctionResources")] - pub user_defined_function_resources: Option>, /// [Optional] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. #[serde(rename="tableDefinitions")] pub table_definitions: Option>, @@ -2034,172 +2776,110 @@ pub struct JobConfiguration { impl Part for JobConfiguration {} -/// Projects to which you have at least READ access. +/// [TrustedTester] [Required] Defines the ranges for range partitioning. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ProjectListProjects { - /// A descriptive name for this project. +pub struct RangePartitioningRange { + /// [TrustedTester] [Required] The start of range partitioning, inclusive. + pub start: Option, + /// [TrustedTester] [Required] The width of each interval. + pub interval: Option, + /// [TrustedTester] [Required] The end of range partitioning, exclusive. + pub end: Option, +} + +impl NestedType for RangePartitioningRange {} +impl Part for RangePartitioningRange {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get datasets](struct.DatasetGetCall.html) (response) +/// * [list datasets](struct.DatasetListCall.html) (none) +/// * [patch datasets](struct.DatasetPatchCall.html) (request|response) +/// * [update datasets](struct.DatasetUpdateCall.html) (request|response) +/// * [delete datasets](struct.DatasetDeleteCall.html) (none) +/// * [insert datasets](struct.DatasetInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Dataset { + /// [Output-only] The resource type. + pub kind: Option, + /// [Optional] A user-friendly description of the dataset. + pub description: Option, + /// [Required] A reference that identifies the dataset. + #[serde(rename="datasetReference")] + pub dataset_reference: Option, + /// The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. See Creating and Updating Dataset Labels for more information. + pub labels: Option>, + /// [Output-only] The time when this dataset was created, in milliseconds since the epoch. + #[serde(rename="creationTime")] + pub creation_time: Option, + /// [Optional] An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER; + pub access: Option>, + /// [Optional] The default lifetime of all tables in the dataset, in milliseconds. The minimum value is 3600000 milliseconds (one hour). Once this property is set, all newly-created tables in the dataset will have an expirationTime property set to the creation time plus the value in this property, and changing the value will only affect new tables, not existing ones. When the expirationTime for a given table is reached, that table will be deleted automatically. If a table's expirationTime is modified or removed before the table expires, or if you provide an explicit expirationTime when creating a table, that value takes precedence over the default expiration time indicated by this property. + #[serde(rename="defaultTableExpirationMs")] + pub default_table_expiration_ms: Option, + /// [Output-only] A hash of the resource. + pub etag: Option, + /// [Optional] The default partition expiration for all partitioned tables in the dataset, in milliseconds. Once this property is set, all newly-created partitioned tables in the dataset will have an expirationMs property in the timePartitioning settings set to this value, and changing the value will only affect new tables, not existing ones. The storage in a partition will have an expiration time of its partition time plus this value. Setting this property overrides the use of defaultTableExpirationMs for partitioned tables: only one of defaultTableExpirationMs and defaultPartitionExpirationMs will be used for any new partitioned table. If you provide an explicit timePartitioning.expirationMs when creating or updating a partitioned table, that value takes precedence over the default partition expiration time indicated by this property. + #[serde(rename="defaultPartitionExpirationMs")] + pub default_partition_expiration_ms: Option, + /// The geographic location where the dataset should reside. The default value is US. See details at https://cloud.google.com/bigquery/docs/locations. + pub location: Option, + /// [Optional] A descriptive name for the dataset. #[serde(rename="friendlyName")] pub friendly_name: Option, - /// The resource type. - pub kind: Option, - /// The numeric ID of this project. - #[serde(rename="numericId")] - pub numeric_id: Option, - /// An opaque ID of this project. + /// [Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch. + #[serde(rename="lastModifiedTime")] + pub last_modified_time: Option, + /// [Output-only] The fully-qualified unique name of the dataset in the format projectId:datasetId. The dataset name without the project name is given in the datasetId field. When creating a new dataset, leave this field blank, and instead specify the datasetId field. pub id: Option, - /// A unique reference to this project. - #[serde(rename="projectReference")] - pub project_reference: Option, + /// [Output-only] A URL that can be used to access the resource again. You can use this URL in Get or Update requests to the resource. + #[serde(rename="selfLink")] + pub self_link: Option, } -impl NestedType for ProjectListProjects {} -impl Part for ProjectListProjects {} +impl RequestValue for Dataset {} +impl Resource for Dataset {} +impl ResponseResult for Dataset {} -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [cancel jobs](struct.JobCancelCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JobCancelResponse { - /// The final state of the job. - pub job: Option, - /// The resource type of the response. - pub kind: Option, -} - -impl ResponseResult for JobCancelResponse {} - - -/// There is no detailed description. +/// [Optional] An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER; /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableReference { - /// [Required] The ID of the project containing this table. - #[serde(rename="projectId")] - pub project_id: Option, - /// [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters. - #[serde(rename="tableId")] - pub table_id: Option, - /// [Required] The ID of the dataset containing this table. - #[serde(rename="datasetId")] - pub dataset_id: Option, +pub struct DatasetAccess { + /// [Pick one] A domain to grant access to. Any users signed in with the domain specified will be granted the specified access. Example: "example.com". Maps to IAM policy member "domain:DOMAIN". + pub domain: Option, + /// [Required] An IAM role ID that should be granted to the user, group, or domain specified in this access entry. The following legacy mappings will be applied: OWNER roles/bigquery.dataOwner WRITER roles/bigquery.dataEditor READER roles/bigquery.dataViewer This field will accept any of the above formats, but will return only the legacy format. For example, if you set this field to "roles/bigquery.dataOwner", it will be returned back as "OWNER". + pub role: Option, + /// [Pick one] An email address of a user to grant access to. For example: fred@example.com. Maps to IAM policy member "user:EMAIL" or "serviceAccount:EMAIL". + #[serde(rename="userByEmail")] + pub user_by_email: Option, + /// [Pick one] Some other type of member that appears in the IAM Policy but isn't a user, group, domain, or special group. + #[serde(rename="iamMember")] + pub iam_member: Option, + /// [Pick one] A special group to grant access to. Possible values include: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users. Maps to similarly-named IAM members. + #[serde(rename="specialGroup")] + pub special_group: Option, + /// [Pick one] An email address of a Google Group to grant access to. Maps to IAM policy member "group:GROUP". + #[serde(rename="groupByEmail")] + pub group_by_email: Option, + /// [Pick one] A view from a different dataset to grant access to. Queries executed against that view will have read access to tables in this dataset. The role field is not required when this field is set. If that view is updated by any user, access to the view needs to be granted again via an update operation. + pub view: Option, } -impl Part for TableReference {} - - -/// [Output-only, Beta] Training options used by this training run. These options are mutable for subsequent training runs. Default values are explicitly stored for options not specified in the input query of the first training run. For subsequent training runs, any option not explicitly specified in the input query will be copied from the previous training run. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TrainingRunTrainingOptions { - /// no description provided - #[serde(rename="learnRateStrategy")] - pub learn_rate_strategy: Option, - /// no description provided - #[serde(rename="l1Reg")] - pub l1_reg: Option, - /// no description provided - #[serde(rename="lineSearchInitLearnRate")] - pub line_search_init_learn_rate: Option, - /// no description provided - #[serde(rename="warmStart")] - pub warm_start: Option, - /// no description provided - #[serde(rename="maxIteration")] - pub max_iteration: Option, - /// no description provided - #[serde(rename="learnRate")] - pub learn_rate: Option, - /// no description provided - #[serde(rename="earlyStop")] - pub early_stop: Option, - /// no description provided - #[serde(rename="minRelProgress")] - pub min_rel_progress: Option, - /// no description provided - #[serde(rename="l2Reg")] - pub l2_reg: Option, -} - -impl NestedType for TrainingRunTrainingOptions {} -impl Part for TrainingRunTrainingOptions {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct QueryParameterValue { - /// [Optional] The struct field values, in order of the struct type's declaration. - #[serde(rename="structValues")] - pub struct_values: Option>, - /// [Optional] The array values, if this is an array type. - #[serde(rename="arrayValues")] - pub array_values: Option>, - /// [Optional] The value of this value, if a simple scalar type. - pub value: Option, -} - -impl Part for QueryParameterValue {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list jobs](struct.JobListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JobList { - /// A token to request the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The resource type of the response. - pub kind: Option, - /// A hash of this page of results. - pub etag: Option, - /// List of jobs that were requested. - pub jobs: Option>, -} - -impl ResponseResult for JobList {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get service account projects](struct.ProjectGetServiceAccountCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetServiceAccountResponse { - /// The resource type of the response. - pub kind: Option, - /// The service account email address. - pub email: Option, -} - -impl ResponseResult for GetServiceAccountResponse {} +impl NestedType for DatasetAccess {} +impl Part for DatasetAccess {} /// There is no detailed description. @@ -2218,31 +2898,40 @@ impl ResponseResult for GetServiceAccountResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Table { - /// [Output-only, Beta] Present iff this table represents a ML model. Describes the training information for the model, and it is required to run 'PREDICT' queries. - pub model: Option, - /// [Optional] A user-friendly description of this table. - pub description: Option, - /// [Optional] Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. - #[serde(rename="externalDataConfiguration")] - pub external_data_configuration: Option, - /// The labels associated with this table. You can use these to organize and group your tables. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key. - pub labels: Option>, - /// [Output-only] The size of this table in bytes, excluding any data in the streaming buffer. - #[serde(rename="numBytes")] - pub num_bytes: Option, - /// Time-based partitioning specification for this table. - #[serde(rename="timePartitioning")] - pub time_partitioning: Option, - /// [Output-only] The time when this table was last modified, in milliseconds since the epoch. - #[serde(rename="lastModifiedTime")] - pub last_modified_time: Option, /// [Output-only] The number of bytes in the table that are considered "long-term storage". #[serde(rename="numLongTermBytes")] pub num_long_term_bytes: Option, + /// [Optional] A user-friendly description of this table. + pub description: Option, + /// [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified. + #[serde(rename="rangePartitioning")] + pub range_partitioning: Option, + /// The labels associated with this table. You can use these to organize and group your tables. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key. + pub labels: Option>, + /// [Optional] Materialized view definition. + #[serde(rename="materializedView")] + pub materialized_view: Option, + /// [Output-only] The size of this table in bytes, excluding any data in the streaming buffer. + #[serde(rename="numBytes")] + pub num_bytes: Option, + /// [Output-only, Beta] Present iff this table represents a ML model. Describes the training information for the model, and it is required to run 'PREDICT' queries. + pub model: Option, + /// Time-based partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified. + #[serde(rename="timePartitioning")] + pub time_partitioning: Option, + /// [Beta] [Optional] If set to true, queries over this table require a partition filter that can be used for partition elimination to be specified. + #[serde(rename="requirePartitionFilter")] + pub require_partition_filter: Option, + /// [Output-only] The time when this table was last modified, in milliseconds since the epoch. + #[serde(rename="lastModifiedTime")] + pub last_modified_time: Option, + /// [Output-only] [TrustedTester] The physical size of this table in bytes, excluding any data in the streaming buffer. This includes compression and storage used for time travel. + #[serde(rename="numPhysicalBytes")] + pub num_physical_bytes: Option, /// [Required] Reference describing the ID of this table. #[serde(rename="tableReference")] pub table_reference: Option, - /// [Beta] Clustering specification for the table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered. + /// [Beta] Clustering specification for the table. Must be specified with partitioning, data in the table will be first partitioned and subsequently clustered. pub clustering: Option, /// Custom encryption configuration (e.g., Cloud KMS keys). #[serde(rename="encryptionConfiguration")] @@ -2272,9 +2961,12 @@ pub struct Table { pub expiration_time: Option, /// [Optional] The view definition. pub view: Option, - /// [Output-only] Describes the table type. The following values are supported: TABLE: A normal BigQuery table. VIEW: A virtual table defined by a SQL query. EXTERNAL: A table that references data stored in an external storage system, such as Google Cloud Storage. The default value is TABLE. + /// [Output-only] Describes the table type. The following values are supported: TABLE: A normal BigQuery table. VIEW: A virtual table defined by a SQL query. [TrustedTester] MATERIALIZED_VIEW: SQL query whose result is persisted. EXTERNAL: A table that references data stored in an external storage system, such as Google Cloud Storage. The default value is TABLE. #[serde(rename="type")] pub type_: Option, + /// [Optional] Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. + #[serde(rename="externalDataConfiguration")] + pub external_data_configuration: Option, /// [Output-only] A URL that can be used to access this resource again. #[serde(rename="selfLink")] pub self_link: Option, @@ -2294,18 +2986,22 @@ impl ResponseResult for Table {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [insert all tabledata](struct.TabledataInsertAllCall.html) (response) +/// * [list datasets](struct.DatasetListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableDataInsertAllResponse { - /// The resource type of the response. +pub struct DatasetList { + /// A token that can be used to request the next results page. This property is omitted on the final results page. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list type. This property always returns the value "bigquery#datasetList". pub kind: Option, - /// An array of errors for rows that were not inserted. - #[serde(rename="insertErrors")] - pub insert_errors: Option>, + /// An array of the dataset resources in the project. Each resource contains basic information. For full information about a particular dataset resource, use the Datasets: get method. This property is omitted when there are no datasets in the project. + pub datasets: Option>, + /// A hash value of the results page. You can use this property to determine if the page has changed since the last request. + pub etag: Option, } -impl ResponseResult for TableDataInsertAllResponse {} +impl ResponseResult for DatasetList {} /// There is no detailed description. @@ -2391,13 +3087,29 @@ pub struct GoogleSheetsOptions { /// [Optional] The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema. #[serde(rename="skipLeadingRows")] pub skip_leading_rows: Option, - /// [Beta] [Optional] Range of a sheet to query from. Only used when non-empty. Typical format: !: + /// [Beta] [Optional] Range of a sheet to query from. Only used when non-empty. Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id For example: sheet1!A1:B20 pub range: Option, } impl Part for GoogleSheetsOptions {} +/// A single row in the confusion matrix. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Row { + /// The original label of this row. + #[serde(rename="actualLabel")] + pub actual_label: Option, + /// Info describing predicted label distribution. + pub entries: Option>, +} + +impl Part for Row {} + + // ################### // MethodBuilders ### @@ -2907,6 +3619,135 @@ impl<'a, C, A> JobMethods<'a, C, A> { +/// A builder providing access to all methods supported on *model* resources. +/// It is not used directly, but through the `Bigquery` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_bigquery2 as bigquery2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use bigquery2::Bigquery; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Bigquery::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `list(...)` and `patch(...)` +/// // to build up your call. +/// let rb = hub.models(); +/// # } +/// ``` +pub struct ModelMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Bigquery, +} + +impl<'a, C, A> MethodsBuilder for ModelMethods<'a, C, A> {} + +impl<'a, C, A> ModelMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes the model specified by modelId from the dataset. + /// + /// # Arguments + /// + /// * `projectId` - Project ID of the model to delete. + /// * `datasetId` - Dataset ID of the model to delete. + /// * `modelId` - Model ID of the model to delete. + pub fn delete(&self, project_id: &str, dataset_id: &str, model_id: &str) -> ModelDeleteCall<'a, C, A> { + ModelDeleteCall { + hub: self.hub, + _project_id: project_id.to_string(), + _dataset_id: dataset_id.to_string(), + _model_id: model_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all models in the specified dataset. Requires the READER dataset + /// role. + /// + /// # Arguments + /// + /// * `projectId` - Project ID of the models to list. + /// * `datasetId` - Dataset ID of the models to list. + pub fn list(&self, project_id: &str, dataset_id: &str) -> ModelListCall<'a, C, A> { + ModelListCall { + hub: self.hub, + _project_id: project_id.to_string(), + _dataset_id: dataset_id.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Patch specific fields in the specified model. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `projectId` - Project ID of the model to patch. + /// * `datasetId` - Dataset ID of the model to patch. + /// * `modelId` - Model ID of the model to patch. + pub fn patch(&self, request: Model, project_id: &str, dataset_id: &str, model_id: &str) -> ModelPatchCall<'a, C, A> { + ModelPatchCall { + hub: self.hub, + _request: request, + _project_id: project_id.to_string(), + _dataset_id: dataset_id.to_string(), + _model_id: model_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the specified model resource by model ID. + /// + /// # Arguments + /// + /// * `projectId` - Project ID of the requested model. + /// * `datasetId` - Dataset ID of the requested model. + /// * `modelId` - Model ID of the requested model. + pub fn get(&self, project_id: &str, dataset_id: &str, model_id: &str) -> ModelGetCall<'a, C, A> { + ModelGetCall { + hub: self.hub, + _project_id: project_id.to_string(), + _dataset_id: dataset_id.to_string(), + _model_id: model_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *tabledata* resources. /// It is not used directly, but through the `Bigquery` hub. /// @@ -3183,10 +4024,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3206,7 +4044,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3311,7 +4149,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3464,10 +4302,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3499,7 +4334,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3609,7 +4444,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3762,10 +4597,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3797,7 +4629,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3907,7 +4739,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4061,10 +4893,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4084,7 +4913,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4186,7 +5015,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4337,10 +5166,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4372,7 +5198,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4472,7 +5298,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4617,10 +5443,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4640,7 +5463,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4728,7 +5551,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4890,10 +5713,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4913,7 +5733,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5019,7 +5839,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5163,10 +5983,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5186,7 +6003,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5274,7 +6091,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5425,10 +6242,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5460,7 +6274,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5560,7 +6374,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5708,10 +6522,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5731,7 +6542,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5816,7 +6627,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5967,10 +6778,7 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6002,7 +6810,7 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6102,7 +6910,7 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6251,10 +7059,7 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6286,7 +7091,7 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6376,7 +7181,7 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6525,10 +7330,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6548,7 +7350,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6621,7 +7423,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 self._job_id = new_value.to_string(); self } - /// [Experimental] The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location. + /// The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location. /// /// Sets the *location* query property to the given value. pub fn location(mut self, new_value: &str) -> JobGetCall<'a, C, A> { @@ -6643,7 +7445,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6792,10 +7594,7 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6815,7 +7614,7 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6888,7 +7687,7 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau self._job_id = new_value.to_string(); self } - /// [Experimental] The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location. + /// The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location. /// /// Sets the *location* query property to the given value. pub fn location(mut self, new_value: &str) -> JobCancelCall<'a, C, A> { @@ -6910,7 +7709,7 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7059,10 +7858,7 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7094,7 +7890,7 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7184,7 +7980,7 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7343,10 +8139,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7405,7 +8198,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -7568,7 +8361,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7747,10 +8540,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7770,7 +8560,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7898,7 +8688,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8067,10 +8857,7 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8090,7 +8877,7 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8191,7 +8978,7 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut self._max_results = Some(new_value); self } - /// [Experimental] The geographic location where the job should run. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location. + /// The geographic location where the job should run. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location. /// /// Sets the *location* query property to the given value. pub fn location(mut self, new_value: &str) -> JobGetQueryResultCall<'a, C, A> { @@ -8213,7 +9000,7 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8257,6 +9044,1112 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut } +/// Deletes the model specified by modelId from the dataset. +/// +/// A builder for the *delete* method supported by a *model* resource. +/// It is not used directly, but through a `ModelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigquery2 as bigquery2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigquery2::Bigquery; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Bigquery::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.models().delete("projectId", "datasetId", "modelId") +/// .doit(); +/// # } +/// ``` +pub struct ModelDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Bigquery, + _project_id: String, + _dataset_id: String, + _model_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ModelDeleteCall<'a, C, A> {} + +impl<'a, C, A> ModelDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigquery.models.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("projectId", self._project_id.to_string())); + params.push(("datasetId", self._dataset_id.to_string())); + params.push(("modelId", self._model_id.to_string())); + for &field in ["projectId", "datasetId", "modelId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/models/{+modelId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId"), ("{+modelId}", "modelId")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["modelId", "datasetId", "projectId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID of the model to delete. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> ModelDeleteCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Dataset ID of the model to delete. + /// + /// Sets the *dataset id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dataset_id(mut self, new_value: &str) -> ModelDeleteCall<'a, C, A> { + self._dataset_id = new_value.to_string(); + self + } + /// Model ID of the model to delete. + /// + /// Sets the *model id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn model_id(mut self, new_value: &str) -> ModelDeleteCall<'a, C, A> { + self._model_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ModelDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ModelDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ModelDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all models in the specified dataset. Requires the READER dataset +/// role. +/// +/// A builder for the *list* method supported by a *model* resource. +/// It is not used directly, but through a `ModelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigquery2 as bigquery2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigquery2::Bigquery; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Bigquery::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.models().list("projectId", "datasetId") +/// .page_token("sit") +/// .max_results(75) +/// .doit(); +/// # } +/// ``` +pub struct ModelListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Bigquery, + _project_id: String, + _dataset_id: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ModelListCall<'a, C, A> {} + +impl<'a, C, A> ModelListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListModelsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigquery.models.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("projectId", self._project_id.to_string())); + params.push(("datasetId", self._dataset_id.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "projectId", "datasetId", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/models"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["datasetId", "projectId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID of the models to list. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> ModelListCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Dataset ID of the models to list. + /// + /// Sets the *dataset id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dataset_id(mut self, new_value: &str) -> ModelListCall<'a, C, A> { + self._dataset_id = new_value.to_string(); + self + } + /// Page token, returned by a previous call to request the next page of + /// results + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ModelListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of results per page. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> ModelListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ModelListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ModelListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ModelListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Patch specific fields in the specified model. +/// +/// A builder for the *patch* method supported by a *model* resource. +/// It is not used directly, but through a `ModelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigquery2 as bigquery2; +/// use bigquery2::Model; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigquery2::Bigquery; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Bigquery::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Model::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.models().patch(req, "projectId", "datasetId", "modelId") +/// .doit(); +/// # } +/// ``` +pub struct ModelPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Bigquery, + _request: Model, + _project_id: String, + _dataset_id: String, + _model_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ModelPatchCall<'a, C, A> {} + +impl<'a, C, A> ModelPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Model)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigquery.models.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("projectId", self._project_id.to_string())); + params.push(("datasetId", self._dataset_id.to_string())); + params.push(("modelId", self._model_id.to_string())); + for &field in ["alt", "projectId", "datasetId", "modelId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/models/{+modelId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId"), ("{+modelId}", "modelId")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["modelId", "datasetId", "projectId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Model) -> ModelPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID of the model to patch. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> ModelPatchCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Dataset ID of the model to patch. + /// + /// Sets the *dataset id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dataset_id(mut self, new_value: &str) -> ModelPatchCall<'a, C, A> { + self._dataset_id = new_value.to_string(); + self + } + /// Model ID of the model to patch. + /// + /// Sets the *model id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn model_id(mut self, new_value: &str) -> ModelPatchCall<'a, C, A> { + self._model_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ModelPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ModelPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ModelPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the specified model resource by model ID. +/// +/// A builder for the *get* method supported by a *model* resource. +/// It is not used directly, but through a `ModelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigquery2 as bigquery2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigquery2::Bigquery; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Bigquery::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.models().get("projectId", "datasetId", "modelId") +/// .doit(); +/// # } +/// ``` +pub struct ModelGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Bigquery, + _project_id: String, + _dataset_id: String, + _model_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ModelGetCall<'a, C, A> {} + +impl<'a, C, A> ModelGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Model)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigquery.models.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("projectId", self._project_id.to_string())); + params.push(("datasetId", self._dataset_id.to_string())); + params.push(("modelId", self._model_id.to_string())); + for &field in ["alt", "projectId", "datasetId", "modelId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "projects/{+projectId}/datasets/{+datasetId}/models/{+modelId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+projectId}", "projectId"), ("{+datasetId}", "datasetId"), ("{+modelId}", "modelId")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["modelId", "datasetId", "projectId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID of the requested model. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> ModelGetCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Dataset ID of the requested model. + /// + /// Sets the *dataset id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dataset_id(mut self, new_value: &str) -> ModelGetCall<'a, C, A> { + self._dataset_id = new_value.to_string(); + self + } + /// Model ID of the requested model. + /// + /// Sets the *model id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn model_id(mut self, new_value: &str) -> ModelGetCall<'a, C, A> { + self._model_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ModelGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ModelGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ModelGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves table data from a specified set of rows. Requires the READER dataset role. /// /// A builder for the *list* method supported by a *tabledata* resource. @@ -8285,10 +10178,10 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.tabledata().list("projectId", "datasetId", "tableId") -/// .start_index("gubergren") -/// .selected_fields("justo") -/// .page_token("sit") -/// .max_results(75) +/// .start_index("duo") +/// .selected_fields("aliquyam") +/// .page_token("Lorem") +/// .max_results(84) /// .doit(); /// # } /// ``` @@ -8379,10 +10272,7 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8402,7 +10292,7 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8528,7 +10418,7 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8681,10 +10571,7 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8716,7 +10603,7 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut TabledataInsertAllCall<'a, C, A> where C: BorrowMut ProjectGetServiceAccountCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8991,7 +10875,7 @@ impl<'a, C, A> ProjectGetServiceAccountCall<'a, C, A> where C: BorrowMut ProjectGetServiceAccountCall<'a, C, A> where C: BorrowMut ProjectGetServiceAccountCall<'a, C, A> where C: BorrowMut ProjectListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9221,7 +11102,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9303,7 +11184,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/bigquerydatatransfer1-cli/Cargo.toml b/gen/bigquerydatatransfer1-cli/Cargo.toml index ca80e4688f..c2ddfdb847 100644 --- a/gen/bigquerydatatransfer1-cli/Cargo.toml +++ b/gen/bigquerydatatransfer1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-bigquerydatatransfer1-cli" -version = "1.0.8+20181008" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with BigQuery Data Transfer (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/bigquerydatatransfer1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-bigquerydatatransfer1] path = "../bigquerydatatransfer1" -version = "1.0.8+20181008" +version = "1.0.8+20190323" diff --git a/gen/bigquerydatatransfer1-cli/README.md b/gen/bigquerydatatransfer1-cli/README.md index d129eda624..1dd2d682c8 100644 --- a/gen/bigquerydatatransfer1-cli/README.md +++ b/gen/bigquerydatatransfer1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *BigQuery Data Transfer* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *BigQuery Data Transfer* API at revision *20190323*. The CLI is at version *1.0.8*. ```bash bigquerydatatransfer1 [options] @@ -48,6 +48,7 @@ bigquerydatatransfer1 [options] locations-transfer-configs-runs-list [-p ]... [-o ] locations-transfer-configs-runs-transfer-logs-list [-p ]... [-o ] locations-transfer-configs-schedule-runs (-r )... [-p ]... [-o ] + locations-transfer-configs-start-manual-runs (-r )... [-p ]... [-o ] transfer-configs-create (-r )... [-p ]... [-o ] transfer-configs-delete [-p ]... [-o ] transfer-configs-get [-p ]... [-o ] @@ -58,6 +59,7 @@ bigquerydatatransfer1 [options] transfer-configs-runs-list [-p ]... [-o ] transfer-configs-runs-transfer-logs-list [-p ]... [-o ] transfer-configs-schedule-runs (-r )... [-p ]... [-o ] + transfer-configs-start-manual-runs (-r )... [-p ]... [-o ] bigquerydatatransfer1 --help Configuration: diff --git a/gen/bigquerydatatransfer1-cli/mkdocs.yml b/gen/bigquerydatatransfer1-cli/mkdocs.yml index e42ad8abce..a89177758a 100644 --- a/gen/bigquerydatatransfer1-cli/mkdocs.yml +++ b/gen/bigquerydatatransfer1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: BigQuery Data Transfer v1.0.8+20181008 +site_name: BigQuery Data Transfer v1.0.8+20190323 site_url: http://byron.github.io/google-apis-rs/google-bigquerydatatransfer1-cli site_description: A complete library to interact with BigQuery Data Transfer (protocol v1) @@ -27,6 +27,7 @@ pages: - ['projects_locations-transfer-configs-runs-list.md', 'Projects', 'Locations Transfer Configs Runs List'] - ['projects_locations-transfer-configs-runs-transfer-logs-list.md', 'Projects', 'Locations Transfer Configs Runs Transfer Logs List'] - ['projects_locations-transfer-configs-schedule-runs.md', 'Projects', 'Locations Transfer Configs Schedule Runs'] +- ['projects_locations-transfer-configs-start-manual-runs.md', 'Projects', 'Locations Transfer Configs Start Manual Runs'] - ['projects_transfer-configs-create.md', 'Projects', 'Transfer Configs Create'] - ['projects_transfer-configs-delete.md', 'Projects', 'Transfer Configs Delete'] - ['projects_transfer-configs-get.md', 'Projects', 'Transfer Configs Get'] @@ -37,6 +38,7 @@ pages: - ['projects_transfer-configs-runs-list.md', 'Projects', 'Transfer Configs Runs List'] - ['projects_transfer-configs-runs-transfer-logs-list.md', 'Projects', 'Transfer Configs Runs Transfer Logs List'] - ['projects_transfer-configs-schedule-runs.md', 'Projects', 'Transfer Configs Schedule Runs'] +- ['projects_transfer-configs-start-manual-runs.md', 'Projects', 'Transfer Configs Start Manual Runs'] theme: readthedocs diff --git a/gen/bigquerydatatransfer1-cli/src/main.rs b/gen/bigquerydatatransfer1-cli/src/main.rs index d6eb2a6526..bf8e5e4c45 100644 --- a/gen/bigquerydatatransfer1-cli/src/main.rs +++ b/gen/bigquerydatatransfer1-cli/src/main.rs @@ -581,12 +581,15 @@ impl<'n> Engine<'n> { "schedule" => Some(("schedule", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dataset-region" => Some(("datasetRegion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-id" => Some(("userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule-options.disable-auto-scheduling" => Some(("scheduleOptions.disableAutoScheduling", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule-options.end-time" => Some(("scheduleOptions.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule-options.start-time" => Some(("scheduleOptions.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data-source-id" => Some(("dataSourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "next-run-time" => Some(("nextRunTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["data-refresh-window-days", "data-source-id", "dataset-region", "destination-dataset-id", "disabled", "display-name", "name", "next-run-time", "schedule", "state", "update-time", "user-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["data-refresh-window-days", "data-source-id", "dataset-region", "destination-dataset-id", "disable-auto-scheduling", "disabled", "display-name", "end-time", "name", "next-run-time", "schedule", "schedule-options", "start-time", "state", "update-time", "user-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -600,6 +603,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "version-info" => { + call = call.version_info(value.unwrap_or("")); + }, "authorization-code" => { call = call.authorization_code(value.unwrap_or("")); }, @@ -616,7 +622,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["authorization-code"].iter().map(|v|*v)); + v.extend(["authorization-code", "version-info"].iter().map(|v|*v)); v } )); } } @@ -847,12 +853,15 @@ impl<'n> Engine<'n> { "schedule" => Some(("schedule", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dataset-region" => Some(("datasetRegion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-id" => Some(("userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule-options.disable-auto-scheduling" => Some(("scheduleOptions.disableAutoScheduling", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule-options.end-time" => Some(("scheduleOptions.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule-options.start-time" => Some(("scheduleOptions.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data-source-id" => Some(("dataSourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "next-run-time" => Some(("nextRunTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["data-refresh-window-days", "data-source-id", "dataset-region", "destination-dataset-id", "disabled", "display-name", "name", "next-run-time", "schedule", "state", "update-time", "user-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["data-refresh-window-days", "data-source-id", "dataset-region", "destination-dataset-id", "disable-auto-scheduling", "disabled", "display-name", "end-time", "name", "next-run-time", "schedule", "schedule-options", "start-time", "state", "update-time", "user-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -866,6 +875,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "version-info" => { + call = call.version_info(value.unwrap_or("")); + }, "update-mask" => { call = call.update_mask(value.unwrap_or("")); }, @@ -885,7 +897,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["authorization-code", "update-mask"].iter().map(|v|*v)); + v.extend(["authorization-code", "version-info", "update-mask"].iter().map(|v|*v)); v } )); } } @@ -1236,6 +1248,93 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_transfer_configs_start_manual_runs(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "requested-time-range.end-time" => Some(("requestedTimeRange.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "requested-time-range.start-time" => Some(("requestedTimeRange.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "requested-run-time" => Some(("requestedRunTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["end-time", "requested-run-time", "requested-time-range", "start-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StartManualTransferRunsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_transfer_configs_start_manual_runs(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_transfer_configs_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -1267,12 +1366,15 @@ impl<'n> Engine<'n> { "schedule" => Some(("schedule", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dataset-region" => Some(("datasetRegion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-id" => Some(("userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule-options.disable-auto-scheduling" => Some(("scheduleOptions.disableAutoScheduling", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule-options.end-time" => Some(("scheduleOptions.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule-options.start-time" => Some(("scheduleOptions.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data-source-id" => Some(("dataSourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "next-run-time" => Some(("nextRunTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["data-refresh-window-days", "data-source-id", "dataset-region", "destination-dataset-id", "disabled", "display-name", "name", "next-run-time", "schedule", "state", "update-time", "user-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["data-refresh-window-days", "data-source-id", "dataset-region", "destination-dataset-id", "disable-auto-scheduling", "disabled", "display-name", "end-time", "name", "next-run-time", "schedule", "schedule-options", "start-time", "state", "update-time", "user-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1286,6 +1388,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "version-info" => { + call = call.version_info(value.unwrap_or("")); + }, "authorization-code" => { call = call.authorization_code(value.unwrap_or("")); }, @@ -1302,7 +1407,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["authorization-code"].iter().map(|v|*v)); + v.extend(["authorization-code", "version-info"].iter().map(|v|*v)); v } )); } } @@ -1533,12 +1638,15 @@ impl<'n> Engine<'n> { "schedule" => Some(("schedule", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dataset-region" => Some(("datasetRegion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-id" => Some(("userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule-options.disable-auto-scheduling" => Some(("scheduleOptions.disableAutoScheduling", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule-options.end-time" => Some(("scheduleOptions.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule-options.start-time" => Some(("scheduleOptions.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data-source-id" => Some(("dataSourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "next-run-time" => Some(("nextRunTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["data-refresh-window-days", "data-source-id", "dataset-region", "destination-dataset-id", "disabled", "display-name", "name", "next-run-time", "schedule", "state", "update-time", "user-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["data-refresh-window-days", "data-source-id", "dataset-region", "destination-dataset-id", "disable-auto-scheduling", "disabled", "display-name", "end-time", "name", "next-run-time", "schedule", "schedule-options", "start-time", "state", "update-time", "user-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1552,6 +1660,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "version-info" => { + call = call.version_info(value.unwrap_or("")); + }, "update-mask" => { call = call.update_mask(value.unwrap_or("")); }, @@ -1571,7 +1682,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["authorization-code", "update-mask"].iter().map(|v|*v)); + v.extend(["authorization-code", "version-info", "update-mask"].iter().map(|v|*v)); v } )); } } @@ -1922,6 +2033,93 @@ impl<'n> Engine<'n> { } } + fn _projects_transfer_configs_start_manual_runs(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "requested-time-range.end-time" => Some(("requestedTimeRange.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "requested-time-range.start-time" => Some(("requestedTimeRange.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "requested-run-time" => Some(("requestedRunTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["end-time", "requested-run-time", "requested-time-range", "start-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StartManualTransferRunsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().transfer_configs_start_manual_runs(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); @@ -1983,6 +2181,9 @@ impl<'n> Engine<'n> { ("locations-transfer-configs-schedule-runs", Some(opt)) => { call_result = self._projects_locations_transfer_configs_schedule_runs(opt, dry_run, &mut err); }, + ("locations-transfer-configs-start-manual-runs", Some(opt)) => { + call_result = self._projects_locations_transfer_configs_start_manual_runs(opt, dry_run, &mut err); + }, ("transfer-configs-create", Some(opt)) => { call_result = self._projects_transfer_configs_create(opt, dry_run, &mut err); }, @@ -2013,6 +2214,9 @@ impl<'n> Engine<'n> { ("transfer-configs-schedule-runs", Some(opt)) => { call_result = self._projects_transfer_configs_schedule_runs(opt, dry_run, &mut err); }, + ("transfer-configs-start-manual-runs", Some(opt)) => { + call_result = self._projects_transfer_configs_start_manual_runs(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("projects".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -2104,7 +2308,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'data-sources-check-valid-creds', 'data-sources-get', 'data-sources-list', 'locations-data-sources-check-valid-creds', 'locations-data-sources-get', 'locations-data-sources-list', 'locations-get', 'locations-list', 'locations-transfer-configs-create', 'locations-transfer-configs-delete', 'locations-transfer-configs-get', 'locations-transfer-configs-list', 'locations-transfer-configs-patch', 'locations-transfer-configs-runs-delete', 'locations-transfer-configs-runs-get', 'locations-transfer-configs-runs-list', 'locations-transfer-configs-runs-transfer-logs-list', 'locations-transfer-configs-schedule-runs', 'transfer-configs-create', 'transfer-configs-delete', 'transfer-configs-get', 'transfer-configs-list', 'transfer-configs-patch', 'transfer-configs-runs-delete', 'transfer-configs-runs-get', 'transfer-configs-runs-list', 'transfer-configs-runs-transfer-logs-list' and 'transfer-configs-schedule-runs'", vec![ + ("projects", "methods: 'data-sources-check-valid-creds', 'data-sources-get', 'data-sources-list', 'locations-data-sources-check-valid-creds', 'locations-data-sources-get', 'locations-data-sources-list', 'locations-get', 'locations-list', 'locations-transfer-configs-create', 'locations-transfer-configs-delete', 'locations-transfer-configs-get', 'locations-transfer-configs-list', 'locations-transfer-configs-patch', 'locations-transfer-configs-runs-delete', 'locations-transfer-configs-runs-get', 'locations-transfer-configs-runs-list', 'locations-transfer-configs-runs-transfer-logs-list', 'locations-transfer-configs-schedule-runs', 'locations-transfer-configs-start-manual-runs', 'transfer-configs-create', 'transfer-configs-delete', 'transfer-configs-get', 'transfer-configs-list', 'transfer-configs-patch', 'transfer-configs-runs-delete', 'transfer-configs-runs-get', 'transfer-configs-runs-list', 'transfer-configs-runs-transfer-logs-list', 'transfer-configs-schedule-runs' and 'transfer-configs-start-manual-runs'", vec![ ("data-sources-check-valid-creds", Some(r##"Returns true if valid credentials exist for the given data source and requesting user. @@ -2423,7 +2627,7 @@ fn main() { None, Some(r##"The resource name of the transfer config. Transfer config names have the form of - `projects/{project_id}/location/{region}/transferConfigs/{config_id}`. + `projects/{project_id}/locations/{region}/transferConfigs/{config_id}`. The name is automatically generated based on the config_id specified in CreateTransferConfigRequest along with project_id and region. If config_id is not provided, usually a uuid, even though it is not guaranteed or @@ -2546,7 +2750,8 @@ fn main() { Some(r##"Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. - Note that runs are created per UTC time in the time range."##), + Note that runs are created per UTC time in the time range. + DEPRECATED: use StartManualTransferRuns instead."##), "Details at http://byron.github.io/google-apis-rs/google_bigquerydatatransfer1_cli/projects_locations-transfer-configs-schedule-runs", vec![ (Some(r##"parent"##), @@ -2568,6 +2773,38 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-transfer-configs-start-manual-runs", + Some(r##"Start manual transfer runs to be executed now with schedule_time equal to + current time. The transfer runs can be created for a time range where the + run_time is between start_time (inclusive) and end_time (exclusive), or for + a specific run_time."##), + "Details at http://byron.github.io/google-apis-rs/google_bigquerydatatransfer1_cli/projects_locations-transfer-configs-start-manual-runs", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Transfer configuration name in the form: + `projects/{project_id}/transferConfigs/{config_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -2684,7 +2921,7 @@ fn main() { None, Some(r##"The resource name of the transfer config. Transfer config names have the form of - `projects/{project_id}/location/{region}/transferConfigs/{config_id}`. + `projects/{project_id}/locations/{region}/transferConfigs/{config_id}`. The name is automatically generated based on the config_id specified in CreateTransferConfigRequest along with project_id and region. If config_id is not provided, usually a uuid, even though it is not guaranteed or @@ -2807,7 +3044,8 @@ fn main() { Some(r##"Creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. - Note that runs are created per UTC time in the time range."##), + Note that runs are created per UTC time in the time range. + DEPRECATED: use StartManualTransferRuns instead."##), "Details at http://byron.github.io/google-apis-rs/google_bigquerydatatransfer1_cli/projects_transfer-configs-schedule-runs", vec![ (Some(r##"parent"##), @@ -2829,6 +3067,38 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("transfer-configs-start-manual-runs", + Some(r##"Start manual transfer runs to be executed now with schedule_time equal to + current time. The transfer runs can be created for a time range where the + run_time is between start_time (inclusive) and end_time (exclusive), or for + a specific run_time."##), + "Details at http://byron.github.io/google-apis-rs/google_bigquerydatatransfer1_cli/projects_transfer-configs-start-manual-runs", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Transfer configuration name in the form: + `projects/{project_id}/transferConfigs/{config_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -2841,8 +3111,8 @@ fn main() { let mut app = App::new("bigquerydatatransfer1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") - .about("Transfers data from partner SaaS applications to Google BigQuery on a scheduled, managed basis.") + .version("1.0.8+20190323") + .about("Schedule queries or transfer external data from SaaS applications to Google BigQuery on a regular basis.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_bigquerydatatransfer1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/bigquerydatatransfer1/Cargo.toml b/gen/bigquerydatatransfer1/Cargo.toml index d663e443cb..3b8655f864 100644 --- a/gen/bigquerydatatransfer1/Cargo.toml +++ b/gen/bigquerydatatransfer1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-bigquerydatatransfer1" -version = "1.0.8+20181008" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with BigQuery Data Transfer (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/bigquerydatatransfer1" homepage = "https://cloud.google.com/bigquery/" -documentation = "https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008" +documentation = "https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323" license = "MIT" keywords = ["bigquerydatatransfer", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/bigquerydatatransfer1/README.md b/gen/bigquerydatatransfer1/README.md index d6bcff135c..0afc804361 100644 --- a/gen/bigquerydatatransfer1/README.md +++ b/gen/bigquerydatatransfer1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-bigquerydatatransfer1` library allows access to all features of the *Google BigQuery Data Transfer* service. -This documentation was generated from *BigQuery Data Transfer* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *bigquerydatatransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *BigQuery Data Transfer* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *bigquerydatatransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *BigQuery Data Transfer* *v1* API can be found at the [official documentation site](https://cloud.google.com/bigquery/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.BigQueryDataTransfer.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.BigQueryDataTransfer.html) ... * projects - * [*data sources check valid creds*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectDataSourceCheckValidCredCall.html), [*data sources get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectDataSourceGetCall.html), [*data sources list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectDataSourceListCall.html), [*locations data sources check valid creds*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationDataSourceCheckValidCredCall.html), [*locations data sources get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationDataSourceGetCall.html), [*locations data sources list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationDataSourceListCall.html), [*locations get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationListCall.html), [*locations transfer configs create*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigCreateCall.html), [*locations transfer configs delete*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigDeleteCall.html), [*locations transfer configs get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigGetCall.html), [*locations transfer configs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigListCall.html), [*locations transfer configs patch*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigPatchCall.html), [*locations transfer configs runs delete*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigRunDeleteCall.html), [*locations transfer configs runs get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigRunGetCall.html), [*locations transfer configs runs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigRunListCall.html), [*locations transfer configs runs transfer logs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigRunTransferLogListCall.html), [*locations transfer configs schedule runs*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigScheduleRunCall.html), [*transfer configs create*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectTransferConfigCreateCall.html), [*transfer configs delete*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectTransferConfigDeleteCall.html), [*transfer configs get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectTransferConfigGetCall.html), [*transfer configs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectTransferConfigListCall.html), [*transfer configs patch*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectTransferConfigPatchCall.html), [*transfer configs runs delete*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectTransferConfigRunDeleteCall.html), [*transfer configs runs get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectTransferConfigRunGetCall.html), [*transfer configs runs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectTransferConfigRunListCall.html), [*transfer configs runs transfer logs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectTransferConfigRunTransferLogListCall.html) and [*transfer configs schedule runs*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.ProjectTransferConfigScheduleRunCall.html) + * [*data sources check valid creds*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectDataSourceCheckValidCredCall.html), [*data sources get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectDataSourceGetCall.html), [*data sources list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectDataSourceListCall.html), [*locations data sources check valid creds*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationDataSourceCheckValidCredCall.html), [*locations data sources get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationDataSourceGetCall.html), [*locations data sources list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationDataSourceListCall.html), [*locations get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationListCall.html), [*locations transfer configs create*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigCreateCall.html), [*locations transfer configs delete*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigDeleteCall.html), [*locations transfer configs get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigGetCall.html), [*locations transfer configs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigListCall.html), [*locations transfer configs patch*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigPatchCall.html), [*locations transfer configs runs delete*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigRunDeleteCall.html), [*locations transfer configs runs get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigRunGetCall.html), [*locations transfer configs runs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigRunListCall.html), [*locations transfer configs runs transfer logs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigRunTransferLogListCall.html), [*locations transfer configs schedule runs*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigScheduleRunCall.html), [*locations transfer configs start manual runs*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectLocationTransferConfigStartManualRunCall.html), [*transfer configs create*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigCreateCall.html), [*transfer configs delete*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigDeleteCall.html), [*transfer configs get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigGetCall.html), [*transfer configs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigListCall.html), [*transfer configs patch*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigPatchCall.html), [*transfer configs runs delete*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigRunDeleteCall.html), [*transfer configs runs get*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigRunGetCall.html), [*transfer configs runs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigRunListCall.html), [*transfer configs runs transfer logs list*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigRunTransferLogListCall.html), [*transfer configs schedule runs*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigScheduleRunCall.html) and [*transfer configs start manual runs*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.ProjectTransferConfigStartManualRunCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/struct.BigQueryDataTransfer.html)** +* **[Hub](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/struct.BigQueryDataTransfer.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.Part.html)** + * **[Parts](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -113,8 +113,9 @@ let mut req = TransferConfig::default(); // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.projects().transfer_configs_patch(req, "name") - .update_mask("sit") - .authorization_code("Stet") + .version_info("sit") + .update_mask("Stet") + .authorization_code("sed") .doit(); match result { @@ -137,17 +138,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -157,29 +158,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20181008/google_bigquerydatatransfer1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-bigquerydatatransfer1/1.0.8+20190323/google_bigquerydatatransfer1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/bigquerydatatransfer1/src/lib.rs b/gen/bigquerydatatransfer1/src/lib.rs index d14eb5a2ad..049d544515 100644 --- a/gen/bigquerydatatransfer1/src/lib.rs +++ b/gen/bigquerydatatransfer1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *BigQuery Data Transfer* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *bigquerydatatransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *BigQuery Data Transfer* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *bigquerydatatransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *BigQuery Data Transfer* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/bigquery/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.BigQueryDataTransfer.html) ... //! //! * projects -//! * [*data sources check valid creds*](struct.ProjectDataSourceCheckValidCredCall.html), [*data sources get*](struct.ProjectDataSourceGetCall.html), [*data sources list*](struct.ProjectDataSourceListCall.html), [*locations data sources check valid creds*](struct.ProjectLocationDataSourceCheckValidCredCall.html), [*locations data sources get*](struct.ProjectLocationDataSourceGetCall.html), [*locations data sources list*](struct.ProjectLocationDataSourceListCall.html), [*locations get*](struct.ProjectLocationGetCall.html), [*locations list*](struct.ProjectLocationListCall.html), [*locations transfer configs create*](struct.ProjectLocationTransferConfigCreateCall.html), [*locations transfer configs delete*](struct.ProjectLocationTransferConfigDeleteCall.html), [*locations transfer configs get*](struct.ProjectLocationTransferConfigGetCall.html), [*locations transfer configs list*](struct.ProjectLocationTransferConfigListCall.html), [*locations transfer configs patch*](struct.ProjectLocationTransferConfigPatchCall.html), [*locations transfer configs runs delete*](struct.ProjectLocationTransferConfigRunDeleteCall.html), [*locations transfer configs runs get*](struct.ProjectLocationTransferConfigRunGetCall.html), [*locations transfer configs runs list*](struct.ProjectLocationTransferConfigRunListCall.html), [*locations transfer configs runs transfer logs list*](struct.ProjectLocationTransferConfigRunTransferLogListCall.html), [*locations transfer configs schedule runs*](struct.ProjectLocationTransferConfigScheduleRunCall.html), [*transfer configs create*](struct.ProjectTransferConfigCreateCall.html), [*transfer configs delete*](struct.ProjectTransferConfigDeleteCall.html), [*transfer configs get*](struct.ProjectTransferConfigGetCall.html), [*transfer configs list*](struct.ProjectTransferConfigListCall.html), [*transfer configs patch*](struct.ProjectTransferConfigPatchCall.html), [*transfer configs runs delete*](struct.ProjectTransferConfigRunDeleteCall.html), [*transfer configs runs get*](struct.ProjectTransferConfigRunGetCall.html), [*transfer configs runs list*](struct.ProjectTransferConfigRunListCall.html), [*transfer configs runs transfer logs list*](struct.ProjectTransferConfigRunTransferLogListCall.html) and [*transfer configs schedule runs*](struct.ProjectTransferConfigScheduleRunCall.html) +//! * [*data sources check valid creds*](struct.ProjectDataSourceCheckValidCredCall.html), [*data sources get*](struct.ProjectDataSourceGetCall.html), [*data sources list*](struct.ProjectDataSourceListCall.html), [*locations data sources check valid creds*](struct.ProjectLocationDataSourceCheckValidCredCall.html), [*locations data sources get*](struct.ProjectLocationDataSourceGetCall.html), [*locations data sources list*](struct.ProjectLocationDataSourceListCall.html), [*locations get*](struct.ProjectLocationGetCall.html), [*locations list*](struct.ProjectLocationListCall.html), [*locations transfer configs create*](struct.ProjectLocationTransferConfigCreateCall.html), [*locations transfer configs delete*](struct.ProjectLocationTransferConfigDeleteCall.html), [*locations transfer configs get*](struct.ProjectLocationTransferConfigGetCall.html), [*locations transfer configs list*](struct.ProjectLocationTransferConfigListCall.html), [*locations transfer configs patch*](struct.ProjectLocationTransferConfigPatchCall.html), [*locations transfer configs runs delete*](struct.ProjectLocationTransferConfigRunDeleteCall.html), [*locations transfer configs runs get*](struct.ProjectLocationTransferConfigRunGetCall.html), [*locations transfer configs runs list*](struct.ProjectLocationTransferConfigRunListCall.html), [*locations transfer configs runs transfer logs list*](struct.ProjectLocationTransferConfigRunTransferLogListCall.html), [*locations transfer configs schedule runs*](struct.ProjectLocationTransferConfigScheduleRunCall.html), [*locations transfer configs start manual runs*](struct.ProjectLocationTransferConfigStartManualRunCall.html), [*transfer configs create*](struct.ProjectTransferConfigCreateCall.html), [*transfer configs delete*](struct.ProjectTransferConfigDeleteCall.html), [*transfer configs get*](struct.ProjectTransferConfigGetCall.html), [*transfer configs list*](struct.ProjectTransferConfigListCall.html), [*transfer configs patch*](struct.ProjectTransferConfigPatchCall.html), [*transfer configs runs delete*](struct.ProjectTransferConfigRunDeleteCall.html), [*transfer configs runs get*](struct.ProjectTransferConfigRunGetCall.html), [*transfer configs runs list*](struct.ProjectTransferConfigRunListCall.html), [*transfer configs runs transfer logs list*](struct.ProjectTransferConfigRunTransferLogListCall.html), [*transfer configs schedule runs*](struct.ProjectTransferConfigScheduleRunCall.html) and [*transfer configs start manual runs*](struct.ProjectTransferConfigStartManualRunCall.html) //! //! //! @@ -114,8 +114,9 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.projects().transfer_configs_patch(req, "name") -//! .update_mask("et") -//! .authorization_code("dolores") +//! .version_info("dolores") +//! .update_mask("kasd") +//! .authorization_code("accusam") //! .doit(); //! //! match result { @@ -309,8 +310,9 @@ impl Default for Scope { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().transfer_configs_patch(req, "name") -/// .update_mask("accusam") -/// .authorization_code("takimata") +/// .version_info("justo") +/// .update_mask("amet.") +/// .authorization_code("erat") /// .doit(); /// /// match result { @@ -387,23 +389,97 @@ impl<'a, C, A> BigQueryDataTransfer // ############ // SCHEMAS ### // ########## -/// A response to schedule transfer runs for a time range. +/// A response to start manual transfer runs. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations transfer configs schedule runs projects](struct.ProjectLocationTransferConfigScheduleRunCall.html) (response) -/// * [transfer configs schedule runs projects](struct.ProjectTransferConfigScheduleRunCall.html) (response) +/// * [transfer configs start manual runs projects](struct.ProjectTransferConfigStartManualRunCall.html) (response) +/// * [locations transfer configs start manual runs projects](struct.ProjectLocationTransferConfigStartManualRunCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ScheduleTransferRunsResponse { - /// The transfer runs that were scheduled. +pub struct StartManualTransferRunsResponse { + /// The transfer runs that were created. pub runs: Option>, } -impl ResponseResult for ScheduleTransferRunsResponse {} +impl ResponseResult for StartManualTransferRunsResponse {} + + +/// The returned list transfer run messages. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations transfer configs runs transfer logs list projects](struct.ProjectLocationTransferConfigRunTransferLogListCall.html) (response) +/// * [transfer configs runs transfer logs list projects](struct.ProjectTransferConfigRunTransferLogListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListTransferLogsResponse { + /// Output only. The next-pagination token. For multiple-page list results, + /// this token can be used as the + /// `GetTransferRunLogRequest.page_token` + /// to request the next page of list results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Output only. The stored pipeline transfer messages. + #[serde(rename="transferMessages")] + pub transfer_messages: Option>, +} + +impl ResponseResult for ListTransferLogsResponse {} + + +/// A request to start manual transfer runs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [transfer configs start manual runs projects](struct.ProjectTransferConfigStartManualRunCall.html) (request) +/// * [locations transfer configs start manual runs projects](struct.ProjectLocationTransferConfigStartManualRunCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StartManualTransferRunsRequest { + /// Time range for the transfer runs that should be started. + #[serde(rename="requestedTimeRange")] + pub requested_time_range: Option, + /// Specific run_time for a transfer run to be started. The + /// requested_run_time must not be in the future. + #[serde(rename="requestedRunTime")] + pub requested_run_time: Option, +} + +impl RequestValue for StartManualTransferRunsRequest {} + + +/// A specification for a time range, this will request transfer runs with +/// run_time between start_time (inclusive) and end_time (exclusive). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TimeRange { + /// End time of the range of transfer runs. For example, + /// `"2017-05-30T00:00:00+00:00"`. The end_time must not be in the future. + /// Creates transfer runs where run_time is in the range betwen start_time + /// (inclusive) and end_time (exlusive). + #[serde(rename="endTime")] + pub end_time: Option, + /// Start time of the range of transfer runs. For example, + /// `"2017-05-25T00:00:00+00:00"`. The start_time must be strictly less than + /// the end_time. Creates transfer runs where run_time is in the range betwen + /// start_time (inclusive) and end_time (exlusive). + #[serde(rename="startTime")] + pub start_time: Option, +} + +impl Part for TimeRange {} /// Returns list of supported data sources and their metadata. @@ -413,8 +489,8 @@ impl ResponseResult for ScheduleTransferRunsResponse {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations data sources list projects](struct.ProjectLocationDataSourceListCall.html) (response) /// * [data sources list projects](struct.ProjectDataSourceListCall.html) (response) +/// * [locations data sources list projects](struct.ProjectLocationDataSourceListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListDataSourcesResponse { @@ -483,17 +559,17 @@ impl ResponseResult for ListLocationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { - /// The canonical id for this location. For example: `"us-east1"`. - #[serde(rename="locationId")] - pub location_id: Option, - /// Cross-service attributes for the location. For example - /// - /// {"cloud.googleapis.com/region": "us-east1"} - pub labels: Option>, /// The friendly name for this location, typically a nearby city name. /// For example, "Tokyo". #[serde(rename="displayName")] pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, /// Resource name for the location, which may vary between implementations. /// For example: `"projects/example-project/locations/us-east1"` pub name: Option, @@ -552,43 +628,36 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The returned list transfer run messages. +/// A response to schedule transfer runs for a time range. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations transfer configs runs transfer logs list projects](struct.ProjectLocationTransferConfigRunTransferLogListCall.html) (response) -/// * [transfer configs runs transfer logs list projects](struct.ProjectTransferConfigRunTransferLogListCall.html) (response) +/// * [locations transfer configs schedule runs projects](struct.ProjectLocationTransferConfigScheduleRunCall.html) (response) +/// * [transfer configs schedule runs projects](struct.ProjectTransferConfigScheduleRunCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListTransferLogsResponse { - /// Output only. The next-pagination token. For multiple-page list results, - /// this token can be used as the - /// `GetTransferRunLogRequest.page_token` - /// to request the next page of list results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Output only. The stored pipeline transfer messages. - #[serde(rename="transferMessages")] - pub transfer_messages: Option>, +pub struct ScheduleTransferRunsResponse { + /// The transfer runs that were scheduled. + pub runs: Option>, } -impl ResponseResult for ListTransferLogsResponse {} +impl ResponseResult for ScheduleTransferRunsResponse {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -649,6 +718,36 @@ pub struct Status { impl Part for Status {} +/// Options customizing the data transfer schedule. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ScheduleOptions { + /// If true, automatic scheduling of data transfer runs for this configuration + /// will be disabled. The runs can be started on ad-hoc basis using + /// StartManualTransferRuns API. When automatic scheduling is disabled, the + /// TransferConfig.schedule field will be ignored. + #[serde(rename="disableAutoScheduling")] + pub disable_auto_scheduling: Option, + /// Defines time to stop scheduling transfer runs. A transfer run cannot be + /// scheduled at or after the end time. The end time can be changed at any + /// moment. The time when a data transfer can be trigerred manually is not + /// limited by this option. + #[serde(rename="endTime")] + pub end_time: Option, + /// Specifies time to start scheduling transfer runs. The first run will be + /// scheduled at or after the start time according to a recurrence pattern + /// defined in the schedule string. The start time can be changed at any + /// moment. The time when a data transfer can be trigerred manually is not + /// limited by this option. + #[serde(rename="startTime")] + pub start_time: Option, +} + +impl Part for ScheduleOptions {} + + /// Represents a data transfer configuration. A transfer configuration /// contains all metadata needed to perform a data transfer. For example, /// `destination_dataset_id` specifies where data should be stored. @@ -689,7 +788,7 @@ pub struct TransferConfig { pub display_name: Option, /// The resource name of the transfer config. /// Transfer config names have the form of - /// `projects/{project_id}/location/{region}/transferConfigs/{config_id}`. + /// `projects/{project_id}/locations/{region}/transferConfigs/{config_id}`. /// The name is automatically generated based on the config_id specified in /// CreateTransferConfigRequest along with project_id and region. If config_id /// is not provided, usually a uuid, even though it is not guaranteed or @@ -711,21 +810,20 @@ pub struct TransferConfig { /// Output only. Region in which BigQuery dataset is located. #[serde(rename="datasetRegion")] pub dataset_region: Option, - /// Output only. Unique ID of the user on whose behalf transfer is done. - /// Applicable only to data sources that do not support service accounts. - /// When set to 0, the data source service account credentials are used. - /// May be negative. Note, that this identifier is not stable. - /// It may change over time even for the same user. + /// Deprecated. Unique ID of the user on whose behalf transfer is done. #[serde(rename="userId")] pub user_id: Option, - /// Is this config disabled. When set to true, no runs are scheduled - /// for a given transfer. - pub disabled: Option, + /// Options customizing the data transfer schedule. + #[serde(rename="scheduleOptions")] + pub schedule_options: Option, /// Output only. State of the most recently updated transfer run. pub state: Option, /// Data source id. Cannot be changed once data transfer is created. #[serde(rename="dataSourceId")] pub data_source_id: Option, + /// Is this config disabled. When set to true, no runs are scheduled + /// for a given transfer. + pub disabled: Option, /// Output only. Next time when data transfer will run. #[serde(rename="nextRunTime")] pub next_run_time: Option, @@ -748,6 +846,9 @@ impl ResponseResult for TransferConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DataSourceParameter { + /// Parameter identifier. + #[serde(rename="paramId")] + pub param_id: Option, /// Parameter display name in the user interface. #[serde(rename="displayName")] pub display_name: Option, @@ -777,17 +878,14 @@ pub struct DataSourceParameter { /// URL to a help document to further explain the naming requirements. #[serde(rename="validationHelpUrl")] pub validation_help_url: Option, - /// Parameter identifier. - #[serde(rename="paramId")] - pub param_id: Option, + /// All possible values for the parameter. + #[serde(rename="allowedValues")] + pub allowed_values: Option>, /// Parameter type. #[serde(rename="type")] pub type_: Option, /// Cannot be changed after initial creation. pub immutable: Option, - /// All possible values for the parameter. - #[serde(rename="allowedValues")] - pub allowed_values: Option>, } impl Part for DataSourceParameter {} @@ -863,39 +961,39 @@ pub struct DataSource { /// Data source id. #[serde(rename="dataSourceId")] pub data_source_id: Option, - /// Data source client id which should be used to receive refresh token. - #[serde(rename="clientId")] - pub client_id: Option, + /// Default data refresh window on days. + /// Only meaningful when `data_refresh_type` = `SLIDING_WINDOW`. + #[serde(rename="defaultDataRefreshWindowDays")] + pub default_data_refresh_window_days: Option, /// Deprecated. This field has no effect. #[serde(rename="transferType")] pub transfer_type: Option, /// User friendly data source name. #[serde(rename="displayName")] pub display_name: Option, + /// Output only. Data source resource name. + pub name: Option, /// Data source parameters. pub parameters: Option>, + /// Data source client id which should be used to receive refresh token. + #[serde(rename="clientId")] + pub client_id: Option, + /// Disables backfilling and manual run scheduling + /// for the data source. + #[serde(rename="manualRunsDisabled")] + pub manual_runs_disabled: Option, /// Specifies whether the data source supports automatic data refresh for the /// past few days, and how it's supported. /// For some data sources, data might not be complete until a few days later, /// so it's useful to refresh data automatically. #[serde(rename="dataRefreshType")] pub data_refresh_type: Option, - /// Disables backfilling and manual run scheduling - /// for the data source. - #[serde(rename="manualRunsDisabled")] - pub manual_runs_disabled: Option, - /// Output only. Data source resource name. - pub name: Option, /// Deprecated. This field has no effect. #[serde(rename="supportsMultipleTransfers")] pub supports_multiple_transfers: Option, /// Url for the help document for this data source. #[serde(rename="helpUrl")] pub help_url: Option, - /// Default data refresh window on days. - /// Only meaningful when `data_refresh_type` = `SLIDING_WINDOW`. - #[serde(rename="defaultDataRefreshWindowDays")] - pub default_data_refresh_window_days: Option, } impl ResponseResult for DataSource {} @@ -933,11 +1031,7 @@ pub struct TransferRun { /// Minimum time after which a transfer run can be started. #[serde(rename="scheduleTime")] pub schedule_time: Option, - /// Output only. Unique ID of the user on whose behalf transfer is done. - /// Applicable only to data sources that do not support service accounts. - /// When set to 0, the data source service account credentials are used. - /// May be negative. Note, that this identifier is not stable. - /// It may change over time even for the same user. + /// Deprecated. Unique ID of the user on whose behalf transfer is done. #[serde(rename="userId")] pub user_id: Option, /// Data transfer run state. Ignored for input requests. @@ -945,15 +1039,15 @@ pub struct TransferRun { /// Status of the transfer run. #[serde(rename="errorStatus")] pub error_status: Option, - /// Output only. Data source id. - #[serde(rename="dataSourceId")] - pub data_source_id: Option, + /// Output only. Data transfer specific parameters. + pub params: Option>, /// Output only. Time when transfer run was started. /// Parameter ignored by server for input requests. #[serde(rename="startTime")] pub start_time: Option, - /// Output only. Data transfer specific parameters. - pub params: Option>, + /// Output only. Data source id. + #[serde(rename="dataSourceId")] + pub data_source_id: Option, /// For batch transfer runs, specifies the date and time that /// data should be ingested. #[serde(rename="runTime")] @@ -1067,7 +1161,7 @@ impl ResponseResult for CheckValidCredsResponse {} /// ::default(), None); /// let mut hub = BigQueryDataTransfer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `data_sources_check_valid_creds(...)`, `data_sources_get(...)`, `data_sources_list(...)`, `locations_data_sources_check_valid_creds(...)`, `locations_data_sources_get(...)`, `locations_data_sources_list(...)`, `locations_get(...)`, `locations_list(...)`, `locations_transfer_configs_create(...)`, `locations_transfer_configs_delete(...)`, `locations_transfer_configs_get(...)`, `locations_transfer_configs_list(...)`, `locations_transfer_configs_patch(...)`, `locations_transfer_configs_runs_delete(...)`, `locations_transfer_configs_runs_get(...)`, `locations_transfer_configs_runs_list(...)`, `locations_transfer_configs_runs_transfer_logs_list(...)`, `locations_transfer_configs_schedule_runs(...)`, `transfer_configs_create(...)`, `transfer_configs_delete(...)`, `transfer_configs_get(...)`, `transfer_configs_list(...)`, `transfer_configs_patch(...)`, `transfer_configs_runs_delete(...)`, `transfer_configs_runs_get(...)`, `transfer_configs_runs_list(...)`, `transfer_configs_runs_transfer_logs_list(...)` and `transfer_configs_schedule_runs(...)` +/// // like `data_sources_check_valid_creds(...)`, `data_sources_get(...)`, `data_sources_list(...)`, `locations_data_sources_check_valid_creds(...)`, `locations_data_sources_get(...)`, `locations_data_sources_list(...)`, `locations_get(...)`, `locations_list(...)`, `locations_transfer_configs_create(...)`, `locations_transfer_configs_delete(...)`, `locations_transfer_configs_get(...)`, `locations_transfer_configs_list(...)`, `locations_transfer_configs_patch(...)`, `locations_transfer_configs_runs_delete(...)`, `locations_transfer_configs_runs_get(...)`, `locations_transfer_configs_runs_list(...)`, `locations_transfer_configs_runs_transfer_logs_list(...)`, `locations_transfer_configs_schedule_runs(...)`, `locations_transfer_configs_start_manual_runs(...)`, `transfer_configs_create(...)`, `transfer_configs_delete(...)`, `transfer_configs_get(...)`, `transfer_configs_list(...)`, `transfer_configs_patch(...)`, `transfer_configs_runs_delete(...)`, `transfer_configs_runs_get(...)`, `transfer_configs_runs_list(...)`, `transfer_configs_runs_transfer_logs_list(...)`, `transfer_configs_schedule_runs(...)` and `transfer_configs_start_manual_runs(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -1084,15 +1178,31 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a supported data source and returns its settings, - /// which can be used for UI rendering. + /// Returns information about the particular transfer run. /// /// # Arguments /// /// * `name` - The field will contain name of the resource requested, for example: - /// `projects/{project_id}/dataSources/{data_source_id}` - pub fn data_sources_get(&self, name: &str) -> ProjectDataSourceGetCall<'a, C, A> { - ProjectDataSourceGetCall { + /// `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` + pub fn transfer_configs_runs_get(&self, name: &str) -> ProjectTransferConfigRunGetCall<'a, C, A> { + ProjectTransferConfigRunGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a location. + /// + /// # Arguments + /// + /// * `name` - Resource name for the location. + pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C, A> { + ProjectLocationGetCall { hub: self.hub, _name: name.to_string(), _delegate: Default::default(), @@ -1122,13 +1232,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets information about a location. + /// Retrieves a supported data source and returns its settings, + /// which can be used for UI rendering. /// /// # Arguments /// - /// * `name` - Resource name for the location. - pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C, A> { - ProjectLocationGetCall { + /// * `name` - The field will contain name of the resource requested, for example: + /// `projects/{project_id}/dataSources/{data_source_id}` + pub fn data_sources_get(&self, name: &str) -> ProjectDataSourceGetCall<'a, C, A> { + ProjectDataSourceGetCall { hub: self.hub, _name: name.to_string(), _delegate: Default::default(), @@ -1153,6 +1265,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { hub: self.hub, _request: request, _parent: parent.to_string(), + _version_info: Default::default(), _authorization_code: Default::default(), _delegate: Default::default(), _scopes: Default::default(), @@ -1162,16 +1275,19 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns information about the particular transfer run. + /// Returns user facing log messages for the data transfer run. /// /// # Arguments /// - /// * `name` - The field will contain name of the resource requested, for example: - /// `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` - pub fn transfer_configs_runs_get(&self, name: &str) -> ProjectTransferConfigRunGetCall<'a, C, A> { - ProjectTransferConfigRunGetCall { + /// * `parent` - Transfer run name in the form: + /// `projects/{project_id}/transferConfigs/{config_Id}/runs/{run_id}`. + pub fn transfer_configs_runs_transfer_logs_list(&self, parent: &str) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { + ProjectTransferConfigRunTransferLogListCall { hub: self.hub, - _name: name.to_string(), + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _message_types: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1201,6 +1317,29 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Start manual transfer runs to be executed now with schedule_time equal to + /// current time. The transfer runs can be created for a time range where the + /// run_time is between start_time (inclusive) and end_time (exclusive), or for + /// a specific run_time. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Transfer configuration name in the form: + /// `projects/{project_id}/transferConfigs/{config_id}`. + pub fn transfer_configs_start_manual_runs(&self, request: StartManualTransferRunsRequest, parent: &str) -> ProjectTransferConfigStartManualRunCall<'a, C, A> { + ProjectTransferConfigStartManualRunCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Retrieves a supported data source and returns its settings, @@ -1262,6 +1401,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// For each date - or whatever granularity the data source supports - in the /// range, one transfer run is created. /// Note that runs are created per UTC time in the time range. + /// DEPRECATED: use StartManualTransferRuns instead. /// /// # Arguments /// @@ -1328,7 +1468,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `request` - No description provided. /// * `name` - The resource name of the transfer config. /// Transfer config names have the form of - /// `projects/{project_id}/location/{region}/transferConfigs/{config_id}`. + /// `projects/{project_id}/locations/{region}/transferConfigs/{config_id}`. /// The name is automatically generated based on the config_id specified in /// CreateTransferConfigRequest along with project_id and region. If config_id /// is not provided, usually a uuid, even though it is not guaranteed or @@ -1338,6 +1478,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { hub: self.hub, _request: request, _name: name.to_string(), + _version_info: Default::default(), _update_mask: Default::default(), _authorization_code: Default::default(), _delegate: Default::default(), @@ -1362,6 +1503,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { hub: self.hub, _request: request, _parent: parent.to_string(), + _version_info: Default::default(), _authorization_code: Default::default(), _delegate: Default::default(), _scopes: Default::default(), @@ -1453,19 +1595,21 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns user facing log messages for the data transfer run. + /// Start manual transfer runs to be executed now with schedule_time equal to + /// current time. The transfer runs can be created for a time range where the + /// run_time is between start_time (inclusive) and end_time (exclusive), or for + /// a specific run_time. /// /// # Arguments /// - /// * `parent` - Transfer run name in the form: - /// `projects/{project_id}/transferConfigs/{config_Id}/runs/{run_id}`. - pub fn transfer_configs_runs_transfer_logs_list(&self, parent: &str) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { - ProjectTransferConfigRunTransferLogListCall { + /// * `request` - No description provided. + /// * `parent` - Transfer configuration name in the form: + /// `projects/{project_id}/transferConfigs/{config_id}`. + pub fn locations_transfer_configs_start_manual_runs(&self, request: StartManualTransferRunsRequest, parent: &str) -> ProjectLocationTransferConfigStartManualRunCall<'a, C, A> { + ProjectLocationTransferConfigStartManualRunCall { hub: self.hub, + _request: request, _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _message_types: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1503,7 +1647,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `request` - No description provided. /// * `name` - The resource name of the transfer config. /// Transfer config names have the form of - /// `projects/{project_id}/location/{region}/transferConfigs/{config_id}`. + /// `projects/{project_id}/locations/{region}/transferConfigs/{config_id}`. /// The name is automatically generated based on the config_id specified in /// CreateTransferConfigRequest along with project_id and region. If config_id /// is not provided, usually a uuid, even though it is not guaranteed or @@ -1513,6 +1657,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { hub: self.hub, _request: request, _name: name.to_string(), + _version_info: Default::default(), _update_mask: Default::default(), _authorization_code: Default::default(), _delegate: Default::default(), @@ -1552,6 +1697,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// For each date - or whatever granularity the data source supports - in the /// range, one transfer run is created. /// Note that runs are created per UTC time in the time range. + /// DEPRECATED: use StartManualTransferRuns instead. /// /// # Arguments /// @@ -1682,10 +1828,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Retrieves a supported data source and returns its settings, -/// which can be used for UI rendering. +/// Returns information about the particular transfer run. /// -/// A builder for the *dataSources.get* method supported by a *project* resource. +/// A builder for the *transferConfigs.runs.get* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -1710,11 +1855,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().data_sources_get("name") +/// let result = hub.projects().transfer_configs_runs_get("name") /// .doit(); /// # } /// ``` -pub struct ProjectDataSourceGetCall<'a, C, A> +pub struct ProjectTransferConfigRunGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a BigQueryDataTransfer, @@ -1724,13 +1869,13 @@ pub struct ProjectDataSourceGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectDataSourceGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectTransferConfigRunGetCall<'a, C, A> {} -impl<'a, C, A> ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, DataSource)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, TransferRun)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -1739,7 +1884,7 @@ impl<'a, C, A> ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.dataSources.get", + dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.transferConfigs.runs.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); @@ -1769,7 +1914,7 @@ impl<'a, C, A> ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1808,7 +1950,7 @@ impl<'a, C, A> ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut ProjectDataSourceGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectTransferConfigRunGetCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -1878,7 +2020,7 @@ impl<'a, C, A> ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut ProjectDataSourceGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectTransferConfigRunGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -1887,7 +2029,7 @@ impl<'a, C, A> ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDataSourceGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectTransferConfigRunGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -1923,7 +2065,255 @@ impl<'a, C, A> ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectDataSourceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTransferConfigRunGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information about a location. +/// +/// A builder for the *locations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigquerydatatransfer1::BigQueryDataTransfer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigQueryDataTransfer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigQueryDataTransfer, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.locations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Bigquery.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name for the location. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Bigquery`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -2022,7 +2412,7 @@ impl<'a, C, A> ProjectLocationTransferConfigDeleteCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2038,10 +2428,7 @@ impl<'a, C, A> ProjectLocationTransferConfigDeleteCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2061,7 +2448,7 @@ impl<'a, C, A> ProjectLocationTransferConfigDeleteCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2140,7 +2527,7 @@ impl<'a, C, A> ProjectLocationTransferConfigDeleteCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2148,12 +2535,12 @@ impl<'a, C, A> ProjectLocationTransferConfigDeleteCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigDeleteCall<'a, C, A> @@ -2188,9 +2575,10 @@ impl<'a, C, A> ProjectLocationTransferConfigDeleteCall<'a, C, A> where C: Borrow } -/// Gets information about a location. +/// Retrieves a supported data source and returns its settings, +/// which can be used for UI rendering. /// -/// A builder for the *locations.get* method supported by a *project* resource. +/// A builder for the *dataSources.get* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -2215,11 +2603,11 @@ impl<'a, C, A> ProjectLocationTransferConfigDeleteCall<'a, C, A> where C: Borrow /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().locations_get("name") +/// let result = hub.projects().data_sources_get("name") /// .doit(); /// # } /// ``` -pub struct ProjectLocationGetCall<'a, C, A> +pub struct ProjectDataSourceGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a BigQueryDataTransfer, @@ -2229,13 +2617,13 @@ pub struct ProjectLocationGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectLocationGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectDataSourceGetCall<'a, C, A> {} -impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectDataSourceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, DataSource)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -2244,7 +2632,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.locations.get", + dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.dataSources.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); @@ -2274,7 +2662,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2313,7 +2698,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectDataSourceGetCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -2382,7 +2768,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDataSourceGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -2391,7 +2777,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectDataSourceGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -2427,7 +2813,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLocationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectDataSourceGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -2473,7 +2859,8 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut hub: &'a BigQueryDataTransfer, _request: TransferConfig, _parent: String, + _version_info: Option, _authorization_code: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, @@ -2506,12 +2894,15 @@ impl<'a, C, A> ProjectLocationTransferConfigCreateCall<'a, C, A> where C: Borrow }; dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.locations.transferConfigs.create", http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); + if let Some(value) = self._version_info { + params.push(("versionInfo", value.to_string())); + } if let Some(value) = self._authorization_code { params.push(("authorizationCode", value.to_string())); } - for &field in ["alt", "parent", "authorizationCode"].iter() { + for &field in ["alt", "parent", "versionInfo", "authorizationCode"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2537,7 +2928,7 @@ impl<'a, C, A> ProjectLocationTransferConfigCreateCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2553,10 +2944,7 @@ impl<'a, C, A> ProjectLocationTransferConfigCreateCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2588,7 +2976,7 @@ impl<'a, C, A> ProjectLocationTransferConfigCreateCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2666,6 +3054,18 @@ impl<'a, C, A> ProjectLocationTransferConfigCreateCall<'a, C, A> where C: Borrow self._parent = new_value.to_string(); self } + /// Optional version info. If users want to find a very recent access token, + /// that is, immediately after approving access, users have to set the + /// version_info claim in the token request. To obtain the version_info, users + /// must use the “none+gsession” response type. which be return a + /// version_info back in the authorization response which be be put in a JWT + /// claim in the token request. + /// + /// Sets the *version info* query property to the given value. + pub fn version_info(mut self, new_value: &str) -> ProjectLocationTransferConfigCreateCall<'a, C, A> { + self._version_info = Some(new_value.to_string()); + self + } /// Optional OAuth2 authorization code to use with this transfer configuration. /// This is required if new credentials are needed, as indicated by /// `CheckValidCreds`. @@ -2703,7 +3103,7 @@ impl<'a, C, A> ProjectLocationTransferConfigCreateCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2711,12 +3111,12 @@ impl<'a, C, A> ProjectLocationTransferConfigCreateCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigCreateCall<'a, C, A> @@ -2751,9 +3151,9 @@ impl<'a, C, A> ProjectLocationTransferConfigCreateCall<'a, C, A> where C: Borrow } -/// Returns information about the particular transfer run. +/// Returns user facing log messages for the data transfer run. /// -/// A builder for the *transferConfigs.runs.get* method supported by a *project* resource. +/// A builder for the *transferConfigs.runs.transferLogs.list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -2778,27 +3178,33 @@ impl<'a, C, A> ProjectLocationTransferConfigCreateCall<'a, C, A> where C: Borrow /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().transfer_configs_runs_get("name") +/// let result = hub.projects().transfer_configs_runs_transfer_logs_list("parent") +/// .page_token("no") +/// .page_size(-21) +/// .add_message_types("justo") /// .doit(); /// # } /// ``` -pub struct ProjectTransferConfigRunGetCall<'a, C, A> +pub struct ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a BigQueryDataTransfer, - _name: String, + _parent: String, + _page_token: Option, + _page_size: Option, + _message_types: Vec, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectTransferConfigRunGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectTransferConfigRunTransferLogListCall<'a, C, A> {} -impl<'a, C, A> ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, TransferRun)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListTransferLogsResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -2807,11 +3213,22 @@ impl<'a, C, A> ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.transferConfigs.runs.get", + dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.transferConfigs.runs.transferLogs.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if self._message_types.len() > 0 { + for f in self._message_types.iter() { + params.push(("messageTypes", f.to_string())); + } + } + for &field in ["alt", "parent", "pageToken", "pageSize", "messageTypes"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2823,12 +3240,12 @@ impl<'a, C, A> ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["name"].iter() { + for param_name in ["parent"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -2853,10 +3270,7 @@ impl<'a, C, A> ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2876,7 +3290,7 @@ impl<'a, C, A> ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunGetCall<'a, C, A> { - self._name = new_value.to_string(); + pub fn parent(mut self, new_value: &str) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Pagination token, which can be used to request a specific page + /// of `ListTransferLogsRequest` list results. For multiple-page + /// results, `ListTransferLogsResponse` outputs + /// a `next_page` token, which can be used as the + /// `page_token` value to request the next page of list results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Page size. The default page size is the maximum value of 1000 results. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Message types to return. If not populated - INFO, WARNING and ERROR + /// messages are returned. + /// + /// Append the given value to the *message types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_message_types(mut self, new_value: &str) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { + self._message_types.push(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -2946,7 +3387,7 @@ impl<'a, C, A> ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -2955,7 +3396,7 @@ impl<'a, C, A> ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectTransferConfigRunGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -2991,7 +3432,7 @@ impl<'a, C, A> ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTransferConfigRunGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -3031,10 +3472,10 @@ impl<'a, C, A> ProjectTransferConfigRunGetCall<'a, C, A> where C: BorrowMut ProjectLocationTransferConfigRunListCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3127,10 +3568,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunListCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3150,7 +3588,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunListCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3263,7 +3701,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunListCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3271,12 +3709,12 @@ impl<'a, C, A> ProjectLocationTransferConfigRunListCall<'a, C, A> where C: Borro /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigRunListCall<'a, C, A> @@ -3311,6 +3749,289 @@ impl<'a, C, A> ProjectLocationTransferConfigRunListCall<'a, C, A> where C: Borro } +/// Start manual transfer runs to be executed now with schedule_time equal to +/// current time. The transfer runs can be created for a time range where the +/// run_time is between start_time (inclusive) and end_time (exclusive), or for +/// a specific run_time. +/// +/// A builder for the *transferConfigs.startManualRuns* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1; +/// use bigquerydatatransfer1::StartManualTransferRunsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigquerydatatransfer1::BigQueryDataTransfer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigQueryDataTransfer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = StartManualTransferRunsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().transfer_configs_start_manual_runs(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectTransferConfigStartManualRunCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigQueryDataTransfer, + _request: StartManualTransferRunsRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectTransferConfigStartManualRunCall<'a, C, A> {} + +impl<'a, C, A> ProjectTransferConfigStartManualRunCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StartManualTransferRunsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.transferConfigs.startManualRuns", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}:startManualRuns"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Bigquery.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: StartManualTransferRunsRequest) -> ProjectTransferConfigStartManualRunCall<'a, C, A> { + self._request = new_value; + self + } + /// Transfer configuration name in the form: + /// `projects/{project_id}/transferConfigs/{config_id}`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectTransferConfigStartManualRunCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectTransferConfigStartManualRunCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectTransferConfigStartManualRunCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Bigquery`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectTransferConfigStartManualRunCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves a supported data source and returns its settings, /// which can be used for UI rendering. /// @@ -3398,7 +4119,7 @@ impl<'a, C, A> ProjectLocationDataSourceGetCall<'a, C, A> where C: BorrowMut ProjectLocationDataSourceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3437,7 +4155,7 @@ impl<'a, C, A> ProjectLocationDataSourceGetCall<'a, C, A> where C: BorrowMut ProjectLocationDataSourceGetCall<'a, C, A> where C: BorrowMut ProjectLocationDataSourceGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationDataSourceGetCall<'a, C, A> @@ -3650,7 +4368,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunGetCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3666,10 +4384,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunGetCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3689,7 +4404,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunGetCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3768,7 +4483,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunGetCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3776,12 +4491,12 @@ impl<'a, C, A> ProjectLocationTransferConfigRunGetCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigRunGetCall<'a, C, A> @@ -3902,7 +4617,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunDeleteCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3918,10 +4633,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunDeleteCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3941,7 +4653,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunDeleteCall<'a, C, A> where C: Bor let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4020,7 +4732,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunDeleteCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4028,12 +4740,12 @@ impl<'a, C, A> ProjectLocationTransferConfigRunDeleteCall<'a, C, A> where C: Bor /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigRunDeleteCall<'a, C, A> @@ -4072,6 +4784,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunDeleteCall<'a, C, A> where C: Bor /// For each date - or whatever granularity the data source supports - in the /// range, one transfer run is created. /// Note that runs are created per UTC time in the time range. +/// DEPRECATED: use StartManualTransferRuns instead. /// /// A builder for the *locations.transferConfigs.scheduleRuns* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -4164,7 +4877,7 @@ impl<'a, C, A> ProjectLocationTransferConfigScheduleRunCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4180,10 +4893,7 @@ impl<'a, C, A> ProjectLocationTransferConfigScheduleRunCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4215,7 +4925,7 @@ impl<'a, C, A> ProjectLocationTransferConfigScheduleRunCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4306,7 +5016,7 @@ impl<'a, C, A> ProjectLocationTransferConfigScheduleRunCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4314,12 +5024,12 @@ impl<'a, C, A> ProjectLocationTransferConfigScheduleRunCall<'a, C, A> where C: B /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigScheduleRunCall<'a, C, A> @@ -4440,7 +5150,7 @@ impl<'a, C, A> ProjectTransferConfigRunDeleteCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4479,7 +5186,7 @@ impl<'a, C, A> ProjectTransferConfigRunDeleteCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunDeleteCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectTransferConfigRunDeleteCall<'a, C, A> @@ -4635,8 +5342,8 @@ impl<'a, C, A> ProjectTransferConfigRunDeleteCall<'a, C, A> where C: BorrowMut ProjectDataSourceListCall<'a, C, A> where C: BorrowMut ProjectDataSourceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4742,7 +5446,7 @@ impl<'a, C, A> ProjectDataSourceListCall<'a, C, A> where C: BorrowMut ProjectDataSourceListCall<'a, C, A> where C: BorrowMut ProjectDataSourceListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDataSourceListCall<'a, C, A> @@ -4922,8 +5626,9 @@ impl<'a, C, A> ProjectDataSourceListCall<'a, C, A> where C: BorrowMut hub: &'a BigQueryDataTransfer, _request: TransferConfig, _name: String, + _version_info: Option, _update_mask: Option, _authorization_code: Option, _delegate: Option<&'a mut Delegate>, @@ -4957,15 +5663,18 @@ impl<'a, C, A> ProjectLocationTransferConfigPatchCall<'a, C, A> where C: BorrowM }; dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.locations.transferConfigs.patch", http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); params.push(("name", self._name.to_string())); + if let Some(value) = self._version_info { + params.push(("versionInfo", value.to_string())); + } if let Some(value) = self._update_mask { params.push(("updateMask", value.to_string())); } if let Some(value) = self._authorization_code { params.push(("authorizationCode", value.to_string())); } - for &field in ["alt", "name", "updateMask", "authorizationCode"].iter() { + for &field in ["alt", "name", "versionInfo", "updateMask", "authorizationCode"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -4991,7 +5700,7 @@ impl<'a, C, A> ProjectLocationTransferConfigPatchCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5007,10 +5716,7 @@ impl<'a, C, A> ProjectLocationTransferConfigPatchCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5042,7 +5748,7 @@ impl<'a, C, A> ProjectLocationTransferConfigPatchCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5109,7 +5815,7 @@ impl<'a, C, A> ProjectLocationTransferConfigPatchCall<'a, C, A> where C: BorrowM } /// The resource name of the transfer config. /// Transfer config names have the form of - /// `projects/{project_id}/location/{region}/transferConfigs/{config_id}`. + /// `projects/{project_id}/locations/{region}/transferConfigs/{config_id}`. /// The name is automatically generated based on the config_id specified in /// CreateTransferConfigRequest along with project_id and region. If config_id /// is not provided, usually a uuid, even though it is not guaranteed or @@ -5123,6 +5829,18 @@ impl<'a, C, A> ProjectLocationTransferConfigPatchCall<'a, C, A> where C: BorrowM self._name = new_value.to_string(); self } + /// Optional version info. If users want to find a very recent access token, + /// that is, immediately after approving access, users have to set the + /// version_info claim in the token request. To obtain the version_info, users + /// must use the “none+gsession” response type. which be return a + /// version_info back in the authorization response which be be put in a JWT + /// claim in the token request. + /// + /// Sets the *version info* query property to the given value. + pub fn version_info(mut self, new_value: &str) -> ProjectLocationTransferConfigPatchCall<'a, C, A> { + self._version_info = Some(new_value.to_string()); + self + } /// Required list of fields to be updated in this request. /// /// Sets the *update mask* query property to the given value. @@ -5167,7 +5885,7 @@ impl<'a, C, A> ProjectLocationTransferConfigPatchCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5175,12 +5893,12 @@ impl<'a, C, A> ProjectLocationTransferConfigPatchCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigPatchCall<'a, C, A> @@ -5249,7 +5967,8 @@ impl<'a, C, A> ProjectLocationTransferConfigPatchCall<'a, C, A> where C: BorrowM /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().transfer_configs_create(req, "parent") -/// .authorization_code("Lorem") +/// .version_info("eirmod") +/// .authorization_code("dolore") /// .doit(); /// # } /// ``` @@ -5259,6 +5978,7 @@ pub struct ProjectTransferConfigCreateCall<'a, C, A> hub: &'a BigQueryDataTransfer, _request: TransferConfig, _parent: String, + _version_info: Option, _authorization_code: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, @@ -5282,12 +6002,15 @@ impl<'a, C, A> ProjectTransferConfigCreateCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(5 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); + if let Some(value) = self._version_info { + params.push(("versionInfo", value.to_string())); + } if let Some(value) = self._authorization_code { params.push(("authorizationCode", value.to_string())); } - for &field in ["alt", "parent", "authorizationCode"].iter() { + for &field in ["alt", "parent", "versionInfo", "authorizationCode"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5313,7 +6036,7 @@ impl<'a, C, A> ProjectTransferConfigCreateCall<'a, C, A> where C: BorrowMut ProjectTransferConfigCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5364,7 +6084,7 @@ impl<'a, C, A> ProjectTransferConfigCreateCall<'a, C, A> where C: BorrowMut ProjectTransferConfigCreateCall<'a, C, A> where C: BorrowMut ProjectTransferConfigCreateCall<'a, C, A> { + self._version_info = Some(new_value.to_string()); + self + } /// Optional OAuth2 authorization code to use with this transfer configuration. /// This is required if new credentials are needed, as indicated by /// `CheckValidCreds`. @@ -5479,7 +6211,7 @@ impl<'a, C, A> ProjectTransferConfigCreateCall<'a, C, A> where C: BorrowMut ProjectTransferConfigCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectTransferConfigCreateCall<'a, C, A> @@ -5625,7 +6357,7 @@ impl<'a, C, A> ProjectLocationDataSourceCheckValidCredCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5641,10 +6373,7 @@ impl<'a, C, A> ProjectLocationDataSourceCheckValidCredCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5676,7 +6405,7 @@ impl<'a, C, A> ProjectLocationDataSourceCheckValidCredCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5767,7 +6496,7 @@ impl<'a, C, A> ProjectLocationDataSourceCheckValidCredCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5775,12 +6504,12 @@ impl<'a, C, A> ProjectLocationDataSourceCheckValidCredCall<'a, C, A> where C: Bo /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationDataSourceCheckValidCredCall<'a, C, A> @@ -5901,7 +6630,7 @@ impl<'a, C, A> ProjectTransferConfigGetCall<'a, C, A> where C: BorrowMut ProjectTransferConfigGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5940,7 +6666,7 @@ impl<'a, C, A> ProjectTransferConfigGetCall<'a, C, A> where C: BorrowMut ProjectTransferConfigGetCall<'a, C, A> where C: BorrowMut ProjectTransferConfigGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectTransferConfigGetCall<'a, C, A> @@ -6096,8 +6822,8 @@ impl<'a, C, A> ProjectTransferConfigGetCall<'a, C, A> where C: BorrowMut ProjectLocationDataSourceListCall<'a, C, A> where C: BorrowMut ProjectLocationDataSourceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6203,7 +6926,7 @@ impl<'a, C, A> ProjectLocationDataSourceListCall<'a, C, A> where C: BorrowMut ProjectLocationDataSourceListCall<'a, C, A> where C: BorrowMut ProjectLocationDataSourceListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationDataSourceListCall<'a, C, A> @@ -6434,7 +7157,7 @@ impl<'a, C, A> ProjectLocationTransferConfigGetCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6450,10 +7173,7 @@ impl<'a, C, A> ProjectLocationTransferConfigGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6473,7 +7193,7 @@ impl<'a, C, A> ProjectLocationTransferConfigGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6552,7 +7272,7 @@ impl<'a, C, A> ProjectLocationTransferConfigGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6560,12 +7280,12 @@ impl<'a, C, A> ProjectLocationTransferConfigGetCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigGetCall<'a, C, A> @@ -6600,9 +7320,12 @@ impl<'a, C, A> ProjectLocationTransferConfigGetCall<'a, C, A> where C: BorrowMut } -/// Returns user facing log messages for the data transfer run. +/// Start manual transfer runs to be executed now with schedule_time equal to +/// current time. The transfer runs can be created for a time range where the +/// run_time is between start_time (inclusive) and end_time (exclusive), or for +/// a specific run_time. /// -/// A builder for the *transferConfigs.runs.transferLogs.list* method supported by a *project* resource. +/// A builder for the *locations.transferConfigs.startManualRuns* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -6614,6 +7337,7 @@ impl<'a, C, A> ProjectLocationTransferConfigGetCall<'a, C, A> where C: BorrowMut /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_bigquerydatatransfer1 as bigquerydatatransfer1; +/// use bigquerydatatransfer1::StartManualTransferRunsRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -6624,36 +7348,36 @@ impl<'a, C, A> ProjectLocationTransferConfigGetCall<'a, C, A> where C: BorrowMut /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = BigQueryDataTransfer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = StartManualTransferRunsRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().transfer_configs_runs_transfer_logs_list("parent") -/// .page_token("no") -/// .page_size(-36) -/// .add_message_types("eirmod") +/// let result = hub.projects().locations_transfer_configs_start_manual_runs(req, "parent") /// .doit(); /// # } /// ``` -pub struct ProjectTransferConfigRunTransferLogListCall<'a, C, A> +pub struct ProjectLocationTransferConfigStartManualRunCall<'a, C, A> where C: 'a, A: 'a { hub: &'a BigQueryDataTransfer, + _request: StartManualTransferRunsRequest, _parent: String, - _page_token: Option, - _page_size: Option, - _message_types: Vec, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectTransferConfigRunTransferLogListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectLocationTransferConfigStartManualRunCall<'a, C, A> {} -impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectLocationTransferConfigStartManualRunCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListTransferLogsResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, StartManualTransferRunsResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -6662,22 +7386,11 @@ impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: Bo Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.transferConfigs.runs.transferLogs.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "bigquerydatatransfer.projects.locations.transferConfigs.startManualRuns", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if self._message_types.len() > 0 { - for f in self._message_types.iter() { - params.push(("messageTypes", f.to_string())); - } - } - for &field in ["alt", "parent", "pageToken", "pageSize", "messageTypes"].iter() { + for &field in ["alt", "parent"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -6689,7 +7402,7 @@ impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: Bo params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/{+parent}/transferLogs"; + let mut url = self.hub._base_url.clone() + "v1/{+parent}:startManualRuns"; if self._scopes.len() == 0 { self._scopes.insert(Scope::Bigquery.as_ref().to_string(), ()); } @@ -6703,7 +7416,7 @@ impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6719,11 +7432,19 @@ impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -6740,11 +7461,15 @@ impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: Bo } }; let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -6795,51 +7520,33 @@ impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: Bo } - /// Transfer run name in the form: - /// `projects/{project_id}/transferConfigs/{config_Id}/runs/{run_id}`. + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: StartManualTransferRunsRequest) -> ProjectLocationTransferConfigStartManualRunCall<'a, C, A> { + self._request = new_value; + self + } + /// Transfer configuration name in the form: + /// `projects/{project_id}/transferConfigs/{config_id}`. /// /// Sets the *parent* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> ProjectLocationTransferConfigStartManualRunCall<'a, C, A> { self._parent = new_value.to_string(); self } - /// Pagination token, which can be used to request a specific page - /// of `ListTransferLogsRequest` list results. For multiple-page - /// results, `ListTransferLogsResponse` outputs - /// a `next_page` token, which can be used as the - /// `page_token` value to request the next page of list results. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Page size. The default page size is the maximum value of 1000 results. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// Message types to return. If not populated - INFO, WARNING and ERROR - /// messages are returned. - /// - /// Append the given value to the *message types* query property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - pub fn add_message_types(mut self, new_value: &str) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { - self._message_types.push(new_value.to_string()); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationTransferConfigStartManualRunCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -6848,7 +7555,7 @@ impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6856,15 +7563,15 @@ impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: Bo /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigStartManualRunCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -6884,7 +7591,7 @@ impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: Bo /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectTransferConfigRunTransferLogListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLocationTransferConfigStartManualRunCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -6924,9 +7631,9 @@ impl<'a, C, A> ProjectTransferConfigRunTransferLogListCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().transfer_configs_list("parent") -/// .page_token("invidunt") -/// .page_size(-82) -/// .add_data_source_ids("accusam") +/// .page_token("eirmod") +/// .page_size(-58) +/// .add_data_source_ids("et") /// .doit(); /// # } /// ``` @@ -6999,7 +7706,7 @@ impl<'a, C, A> ProjectTransferConfigListCall<'a, C, A> where C: BorrowMut ProjectTransferConfigListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7038,7 +7742,7 @@ impl<'a, C, A> ProjectTransferConfigListCall<'a, C, A> where C: BorrowMut ProjectTransferConfigListCall<'a, C, A> where C: BorrowMut ProjectTransferConfigListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectTransferConfigListCall<'a, C, A> @@ -7226,8 +7930,9 @@ impl<'a, C, A> ProjectTransferConfigListCall<'a, C, A> where C: BorrowMut hub: &'a BigQueryDataTransfer, _request: TransferConfig, _name: String, + _version_info: Option, _update_mask: Option, _authorization_code: Option, _delegate: Option<&'a mut Delegate>, @@ -7261,15 +7967,18 @@ impl<'a, C, A> ProjectTransferConfigPatchCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(6 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); params.push(("name", self._name.to_string())); + if let Some(value) = self._version_info { + params.push(("versionInfo", value.to_string())); + } if let Some(value) = self._update_mask { params.push(("updateMask", value.to_string())); } if let Some(value) = self._authorization_code { params.push(("authorizationCode", value.to_string())); } - for &field in ["alt", "name", "updateMask", "authorizationCode"].iter() { + for &field in ["alt", "name", "versionInfo", "updateMask", "authorizationCode"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -7295,7 +8004,7 @@ impl<'a, C, A> ProjectTransferConfigPatchCall<'a, C, A> where C: BorrowMut ProjectTransferConfigPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7346,7 +8052,7 @@ impl<'a, C, A> ProjectTransferConfigPatchCall<'a, C, A> where C: BorrowMut ProjectTransferConfigPatchCall<'a, C, A> where C: BorrowMut ProjectTransferConfigPatchCall<'a, C, A> where C: BorrowMut ProjectTransferConfigPatchCall<'a, C, A> { + self._version_info = Some(new_value.to_string()); + self + } /// Required list of fields to be updated in this request. /// /// Sets the *update mask* query property to the given value. @@ -7471,7 +8189,7 @@ impl<'a, C, A> ProjectTransferConfigPatchCall<'a, C, A> where C: BorrowMut ProjectTransferConfigPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectTransferConfigPatchCall<'a, C, A> @@ -7617,7 +8335,7 @@ impl<'a, C, A> ProjectDataSourceCheckValidCredCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7633,10 +8351,7 @@ impl<'a, C, A> ProjectDataSourceCheckValidCredCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7668,7 +8383,7 @@ impl<'a, C, A> ProjectDataSourceCheckValidCredCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7759,7 +8474,7 @@ impl<'a, C, A> ProjectDataSourceCheckValidCredCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7767,12 +8482,12 @@ impl<'a, C, A> ProjectDataSourceCheckValidCredCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectDataSourceCheckValidCredCall<'a, C, A> @@ -7811,6 +8526,7 @@ impl<'a, C, A> ProjectDataSourceCheckValidCredCall<'a, C, A> where C: BorrowMut< /// For each date - or whatever granularity the data source supports - in the /// range, one transfer run is created. /// Note that runs are created per UTC time in the time range. +/// DEPRECATED: use StartManualTransferRuns instead. /// /// A builder for the *transferConfigs.scheduleRuns* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -7903,7 +8619,7 @@ impl<'a, C, A> ProjectTransferConfigScheduleRunCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7919,10 +8635,7 @@ impl<'a, C, A> ProjectTransferConfigScheduleRunCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7954,7 +8667,7 @@ impl<'a, C, A> ProjectTransferConfigScheduleRunCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8045,7 +8758,7 @@ impl<'a, C, A> ProjectTransferConfigScheduleRunCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8053,12 +8766,12 @@ impl<'a, C, A> ProjectTransferConfigScheduleRunCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectTransferConfigScheduleRunCall<'a, C, A> @@ -8121,9 +8834,9 @@ impl<'a, C, A> ProjectTransferConfigScheduleRunCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_list("name") -/// .page_token("sanctus") -/// .page_size(-22) -/// .filter("amet") +/// .page_token("dolor") +/// .page_size(-48) +/// .filter("et") /// .doit(); /// # } /// ``` @@ -8194,7 +8907,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8233,7 +8943,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C, A> @@ -8408,10 +9118,10 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunListCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8527,7 +9234,7 @@ impl<'a, C, A> ProjectTransferConfigRunListCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunListCall<'a, C, A> where C: BorrowMut ProjectTransferConfigRunListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectTransferConfigRunListCall<'a, C, A> @@ -8716,9 +9423,9 @@ impl<'a, C, A> ProjectTransferConfigRunListCall<'a, C, A> where C: BorrowMut ProjectLocationTransferConfigListCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8807,10 +9514,7 @@ impl<'a, C, A> ProjectLocationTransferConfigListCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8830,7 +9534,7 @@ impl<'a, C, A> ProjectLocationTransferConfigListCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8935,7 +9639,7 @@ impl<'a, C, A> ProjectLocationTransferConfigListCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8943,12 +9647,12 @@ impl<'a, C, A> ProjectLocationTransferConfigListCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigListCall<'a, C, A> @@ -9011,9 +9715,9 @@ impl<'a, C, A> ProjectLocationTransferConfigListCall<'a, C, A> where C: BorrowMu /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_transfer_configs_runs_transfer_logs_list("parent") -/// .page_token("amet.") -/// .page_size(-27) -/// .add_message_types("Lorem") +/// .page_token("consetetur") +/// .page_size(-44) +/// .add_message_types("vero") /// .doit(); /// # } /// ``` @@ -9086,7 +9790,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunTransferLogListCall<'a, C, A> whe } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9102,10 +9806,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunTransferLogListCall<'a, C, A> whe } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9125,7 +9826,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunTransferLogListCall<'a, C, A> whe let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9231,7 +9932,7 @@ impl<'a, C, A> ProjectLocationTransferConfigRunTransferLogListCall<'a, C, A> whe /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9239,12 +9940,12 @@ impl<'a, C, A> ProjectLocationTransferConfigRunTransferLogListCall<'a, C, A> whe /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationTransferConfigRunTransferLogListCall<'a, C, A> @@ -9366,7 +10067,7 @@ impl<'a, C, A> ProjectTransferConfigDeleteCall<'a, C, A> where C: BorrowMut ProjectTransferConfigDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9405,7 +10103,7 @@ impl<'a, C, A> ProjectTransferConfigDeleteCall<'a, C, A> where C: BorrowMut ProjectTransferConfigDeleteCall<'a, C, A> where C: BorrowMut ProjectTransferConfigDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectTransferConfigDeleteCall<'a, C, A> diff --git a/gen/bigtableadmin2-cli/Cargo.toml b/gen/bigtableadmin2-cli/Cargo.toml new file mode 100644 index 0000000000..32d98147d8 --- /dev/null +++ b/gen/bigtableadmin2-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-bigtableadmin2-cli" +version = "1.0.8+20190328" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Bigtable Admin (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/bigtableadmin2-cli" +homepage = "https://cloud.google.com/bigtable/" +documentation = "http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli" +license = "MIT" +keywords = ["bigtableadmin", "google", "cli"] +autobins = false + +[[bin]] +name = "bigtableadmin2" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-bigtableadmin2] +path = "../bigtableadmin2" +version = "1.0.8+20190328" diff --git a/gen/bigtableadmin2-cli/LICENSE.md b/gen/bigtableadmin2-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/bigtableadmin2-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/bigtableadmin2-cli/README.md b/gen/bigtableadmin2-cli/README.md new file mode 100644 index 0000000000..87597145c1 --- /dev/null +++ b/gen/bigtableadmin2-cli/README.md @@ -0,0 +1,148 @@ + +The `bigtableadmin2` command-line interface *(CLI)* allows to use most features of the *Google Bigtable Admin* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Bigtable Admin* API can be found at the +[official documentation site](https://cloud.google.com/bigtable/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-bigtableadmin2-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/bigtableadmin2-cli). + +# Usage + +This documentation was generated from the *Bigtable Admin* API at revision *20190328*. The CLI is at version *1.0.8*. + +```bash +bigtableadmin2 [options] + operations + cancel [-p ]... [-o ] + delete [-p ]... [-o ] + get [-p ]... [-o ] + projects-operations-list [-p ]... [-o ] + projects + instances-app-profiles-create (-r )... [-p ]... [-o ] + instances-app-profiles-delete [-p ]... [-o ] + instances-app-profiles-get [-p ]... [-o ] + instances-app-profiles-list [-p ]... [-o ] + instances-app-profiles-patch (-r )... [-p ]... [-o ] + instances-clusters-create (-r )... [-p ]... [-o ] + instances-clusters-delete [-p ]... [-o ] + instances-clusters-get [-p ]... [-o ] + instances-clusters-list [-p ]... [-o ] + instances-clusters-update (-r )... [-p ]... [-o ] + instances-create (-r )... [-p ]... [-o ] + instances-delete [-p ]... [-o ] + instances-get [-p ]... [-o ] + instances-get-iam-policy (-r )... [-p ]... [-o ] + instances-list [-p ]... [-o ] + instances-partial-update-instance (-r )... [-p ]... [-o ] + instances-set-iam-policy (-r )... [-p ]... [-o ] + instances-tables-check-consistency (-r )... [-p ]... [-o ] + instances-tables-create (-r )... [-p ]... [-o ] + instances-tables-delete [-p ]... [-o ] + instances-tables-drop-row-range (-r )... [-p ]... [-o ] + instances-tables-generate-consistency-token (-r )... [-p ]... [-o ] + instances-tables-get [-p ]... [-o ] + instances-tables-get-iam-policy (-r )... [-p ]... [-o ] + instances-tables-list [-p ]... [-o ] + instances-tables-modify-column-families (-r )... [-p ]... [-o ] + instances-tables-set-iam-policy (-r )... [-p ]... [-o ] + instances-tables-test-iam-permissions (-r )... [-p ]... [-o ] + instances-test-iam-permissions (-r )... [-p ]... [-o ] + instances-update (-r )... [-p ]... [-o ] + bigtableadmin2 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `bigtableadmin2-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/bigtableadmin2-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/bigtableadmin2-secret.json`, assuming that the required *bigtableadmin* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `bigtableadmin2 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/bigtableadmin2-cli/mkdocs.yml b/gen/bigtableadmin2-cli/mkdocs.yml new file mode 100644 index 0000000000..74c2d002bd --- /dev/null +++ b/gen/bigtableadmin2-cli/mkdocs.yml @@ -0,0 +1,50 @@ +site_name: Bigtable Admin v1.0.8+20190328 +site_url: http://byron.github.io/google-apis-rs/google-bigtableadmin2-cli +site_description: A complete library to interact with Bigtable Admin (protocol v2) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/bigtableadmin2-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['operations_cancel.md', 'Operations', 'Cancel'] +- ['operations_delete.md', 'Operations', 'Delete'] +- ['operations_get.md', 'Operations', 'Get'] +- ['operations_projects-operations-list.md', 'Operations', 'Projects Operations List'] +- ['projects_instances-app-profiles-create.md', 'Projects', 'Instances App Profiles Create'] +- ['projects_instances-app-profiles-delete.md', 'Projects', 'Instances App Profiles Delete'] +- ['projects_instances-app-profiles-get.md', 'Projects', 'Instances App Profiles Get'] +- ['projects_instances-app-profiles-list.md', 'Projects', 'Instances App Profiles List'] +- ['projects_instances-app-profiles-patch.md', 'Projects', 'Instances App Profiles Patch'] +- ['projects_instances-clusters-create.md', 'Projects', 'Instances Clusters Create'] +- ['projects_instances-clusters-delete.md', 'Projects', 'Instances Clusters Delete'] +- ['projects_instances-clusters-get.md', 'Projects', 'Instances Clusters Get'] +- ['projects_instances-clusters-list.md', 'Projects', 'Instances Clusters List'] +- ['projects_instances-clusters-update.md', 'Projects', 'Instances Clusters Update'] +- ['projects_instances-create.md', 'Projects', 'Instances Create'] +- ['projects_instances-delete.md', 'Projects', 'Instances Delete'] +- ['projects_instances-get.md', 'Projects', 'Instances Get'] +- ['projects_instances-get-iam-policy.md', 'Projects', 'Instances Get Iam Policy'] +- ['projects_instances-list.md', 'Projects', 'Instances List'] +- ['projects_instances-partial-update-instance.md', 'Projects', 'Instances Partial Update Instance'] +- ['projects_instances-set-iam-policy.md', 'Projects', 'Instances Set Iam Policy'] +- ['projects_instances-tables-check-consistency.md', 'Projects', 'Instances Tables Check Consistency'] +- ['projects_instances-tables-create.md', 'Projects', 'Instances Tables Create'] +- ['projects_instances-tables-delete.md', 'Projects', 'Instances Tables Delete'] +- ['projects_instances-tables-drop-row-range.md', 'Projects', 'Instances Tables Drop Row Range'] +- ['projects_instances-tables-generate-consistency-token.md', 'Projects', 'Instances Tables Generate Consistency Token'] +- ['projects_instances-tables-get.md', 'Projects', 'Instances Tables Get'] +- ['projects_instances-tables-get-iam-policy.md', 'Projects', 'Instances Tables Get Iam Policy'] +- ['projects_instances-tables-list.md', 'Projects', 'Instances Tables List'] +- ['projects_instances-tables-modify-column-families.md', 'Projects', 'Instances Tables Modify Column Families'] +- ['projects_instances-tables-set-iam-policy.md', 'Projects', 'Instances Tables Set Iam Policy'] +- ['projects_instances-tables-test-iam-permissions.md', 'Projects', 'Instances Tables Test Iam Permissions'] +- ['projects_instances-test-iam-permissions.md', 'Projects', 'Instances Test Iam Permissions'] +- ['projects_instances-update.md', 'Projects', 'Instances Update'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/bigtableadmin2-cli/src/cmn.rs b/gen/bigtableadmin2-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/bigtableadmin2-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/bigtableadmin2-cli/src/main.rs b/gen/bigtableadmin2-cli/src/main.rs new file mode 100644 index 0000000000..df296347a1 --- /dev/null +++ b/gen/bigtableadmin2-cli/src/main.rs @@ -0,0 +1,3765 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_bigtableadmin2 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::BigtableAdmin>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().cancel(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_projects_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().projects_operations_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_app_profiles_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "single-cluster-routing.cluster-id" => Some(("singleClusterRouting.clusterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "single-cluster-routing.allow-transactional-writes" => Some(("singleClusterRouting.allowTransactionalWrites", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-transactional-writes", "cluster-id", "description", "etag", "name", "single-cluster-routing"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AppProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_app_profiles_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "ignore-warnings" => { + call = call.ignore_warnings(arg_from_str(value.unwrap_or("false"), err, "ignore-warnings", "boolean")); + }, + "app-profile-id" => { + call = call.app_profile_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["ignore-warnings", "app-profile-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_app_profiles_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_app_profiles_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "ignore-warnings" => { + call = call.ignore_warnings(arg_from_str(value.unwrap_or("false"), err, "ignore-warnings", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["ignore-warnings"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_app_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_app_profiles_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_app_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_app_profiles_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_app_profiles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "single-cluster-routing.cluster-id" => Some(("singleClusterRouting.clusterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "single-cluster-routing.allow-transactional-writes" => Some(("singleClusterRouting.allowTransactionalWrites", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-transactional-writes", "cluster-id", "description", "etag", "name", "single-cluster-routing"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AppProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_app_profiles_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + "ignore-warnings" => { + call = call.ignore_warnings(arg_from_str(value.unwrap_or("false"), err, "ignore-warnings", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["ignore-warnings", "update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_clusters_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-storage-type" => Some(("defaultStorageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "serve-nodes" => Some(("serveNodes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["default-storage-type", "location", "name", "serve-nodes", "state"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Cluster = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_clusters_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "cluster-id" => { + call = call.cluster_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["cluster-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_clusters_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_clusters_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_clusters_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_clusters_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_clusters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_clusters_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_clusters_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-storage-type" => Some(("defaultStorageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "serve-nodes" => Some(("serveNodes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["default-storage-type", "location", "name", "serve-nodes", "state"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Cluster = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_clusters_update(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "instance-id" => Some(("instanceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instance.type" => Some(("instance.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instance.state" => Some(("instance.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instance.labels" => Some(("instance.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "instance.display-name" => Some(("instance.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instance.name" => Some(("instance.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-name", "instance", "instance-id", "labels", "name", "parent", "state", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreateInstanceRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_partial_update_instance(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-name", "labels", "name", "state", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Instance = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_partial_update_instance(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_check_consistency(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "consistency-token" => Some(("consistencyToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["consistency-token"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CheckConsistencyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_tables_check_consistency(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "table.name" => Some(("table.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "table.granularity" => Some(("table.granularity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "table-id" => Some(("tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["granularity", "name", "table", "table-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreateTableRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_tables_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_tables_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_drop_row_range(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "row-key-prefix" => Some(("rowKeyPrefix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delete-all-data-from-table" => Some(("deleteAllDataFromTable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["delete-all-data-from-table", "row-key-prefix"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DropRowRangeRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_tables_drop_row_range(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_generate_consistency_token(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GenerateConsistencyTokenRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_tables_generate_consistency_token(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_tables_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "view" => { + call = call.view(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["view"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_tables_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().instances_tables_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "view" => { + call = call.view(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size", "view"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_modify_column_families(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ModifyColumnFamiliesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_tables_modify_column_families(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_tables_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_tables_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_tables_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_instances_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-name", "labels", "name", "state", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Instance = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_update(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("operations", Some(opt)) => { + match opt.subcommand() { + ("cancel", Some(opt)) => { + call_result = self._operations_cancel(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._operations_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._operations_get(opt, dry_run, &mut err); + }, + ("projects-operations-list", Some(opt)) => { + call_result = self._operations_projects_operations_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("projects", Some(opt)) => { + match opt.subcommand() { + ("instances-app-profiles-create", Some(opt)) => { + call_result = self._projects_instances_app_profiles_create(opt, dry_run, &mut err); + }, + ("instances-app-profiles-delete", Some(opt)) => { + call_result = self._projects_instances_app_profiles_delete(opt, dry_run, &mut err); + }, + ("instances-app-profiles-get", Some(opt)) => { + call_result = self._projects_instances_app_profiles_get(opt, dry_run, &mut err); + }, + ("instances-app-profiles-list", Some(opt)) => { + call_result = self._projects_instances_app_profiles_list(opt, dry_run, &mut err); + }, + ("instances-app-profiles-patch", Some(opt)) => { + call_result = self._projects_instances_app_profiles_patch(opt, dry_run, &mut err); + }, + ("instances-clusters-create", Some(opt)) => { + call_result = self._projects_instances_clusters_create(opt, dry_run, &mut err); + }, + ("instances-clusters-delete", Some(opt)) => { + call_result = self._projects_instances_clusters_delete(opt, dry_run, &mut err); + }, + ("instances-clusters-get", Some(opt)) => { + call_result = self._projects_instances_clusters_get(opt, dry_run, &mut err); + }, + ("instances-clusters-list", Some(opt)) => { + call_result = self._projects_instances_clusters_list(opt, dry_run, &mut err); + }, + ("instances-clusters-update", Some(opt)) => { + call_result = self._projects_instances_clusters_update(opt, dry_run, &mut err); + }, + ("instances-create", Some(opt)) => { + call_result = self._projects_instances_create(opt, dry_run, &mut err); + }, + ("instances-delete", Some(opt)) => { + call_result = self._projects_instances_delete(opt, dry_run, &mut err); + }, + ("instances-get", Some(opt)) => { + call_result = self._projects_instances_get(opt, dry_run, &mut err); + }, + ("instances-get-iam-policy", Some(opt)) => { + call_result = self._projects_instances_get_iam_policy(opt, dry_run, &mut err); + }, + ("instances-list", Some(opt)) => { + call_result = self._projects_instances_list(opt, dry_run, &mut err); + }, + ("instances-partial-update-instance", Some(opt)) => { + call_result = self._projects_instances_partial_update_instance(opt, dry_run, &mut err); + }, + ("instances-set-iam-policy", Some(opt)) => { + call_result = self._projects_instances_set_iam_policy(opt, dry_run, &mut err); + }, + ("instances-tables-check-consistency", Some(opt)) => { + call_result = self._projects_instances_tables_check_consistency(opt, dry_run, &mut err); + }, + ("instances-tables-create", Some(opt)) => { + call_result = self._projects_instances_tables_create(opt, dry_run, &mut err); + }, + ("instances-tables-delete", Some(opt)) => { + call_result = self._projects_instances_tables_delete(opt, dry_run, &mut err); + }, + ("instances-tables-drop-row-range", Some(opt)) => { + call_result = self._projects_instances_tables_drop_row_range(opt, dry_run, &mut err); + }, + ("instances-tables-generate-consistency-token", Some(opt)) => { + call_result = self._projects_instances_tables_generate_consistency_token(opt, dry_run, &mut err); + }, + ("instances-tables-get", Some(opt)) => { + call_result = self._projects_instances_tables_get(opt, dry_run, &mut err); + }, + ("instances-tables-get-iam-policy", Some(opt)) => { + call_result = self._projects_instances_tables_get_iam_policy(opt, dry_run, &mut err); + }, + ("instances-tables-list", Some(opt)) => { + call_result = self._projects_instances_tables_list(opt, dry_run, &mut err); + }, + ("instances-tables-modify-column-families", Some(opt)) => { + call_result = self._projects_instances_tables_modify_column_families(opt, dry_run, &mut err); + }, + ("instances-tables-set-iam-policy", Some(opt)) => { + call_result = self._projects_instances_tables_set_iam_policy(opt, dry_run, &mut err); + }, + ("instances-tables-test-iam-permissions", Some(opt)) => { + call_result = self._projects_instances_tables_test_iam_permissions(opt, dry_run, &mut err); + }, + ("instances-test-iam-permissions", Some(opt)) => { + call_result = self._projects_instances_test_iam_permissions(opt, dry_run, &mut err); + }, + ("instances-update", Some(opt)) => { + call_result = self._projects_instances_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "bigtableadmin2-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "bigtableadmin2", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::BigtableAdmin::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("operations", "methods: 'cancel', 'delete', 'get' and 'projects-operations-list'", vec![ + ("cancel", + Some(r##"Starts asynchronous cancellation on a long-running operation. The server + makes a best effort to cancel the operation, but success is not + guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. Clients can use + Operations.GetOperation or + other methods to check whether the cancellation succeeded or whether the + operation completed despite cancellation. On successful cancellation, + the operation is not deleted; instead, it becomes an operation with + an Operation.error value with a google.rpc.Status.code of 1, + corresponding to `Code.CANCELLED`."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/operations_cancel", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be cancelled."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes a long-running operation. This method indicates that the client is + no longer interested in the operation result. It does not cancel the + operation. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/operations_delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be deleted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/operations_get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("projects-operations-list", + Some(r##"Lists operations that match the specified filter in the request. If the + server doesn't support this method, it returns `UNIMPLEMENTED`. + + NOTE: the `name` binding allows API services to override the binding + to use different resource name schemes, such as `users/*/operations`. To + override the binding, API services can add a binding such as + `"/v1/{name=users/*}/operations"` to their service configuration. + For backwards compatibility, the default name includes the operations + collection id, however overriding users must ensure the name binding + is the parent resource, without the operations collection id."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/operations_projects-operations-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation's parent resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("projects", "methods: 'instances-app-profiles-create', 'instances-app-profiles-delete', 'instances-app-profiles-get', 'instances-app-profiles-list', 'instances-app-profiles-patch', 'instances-clusters-create', 'instances-clusters-delete', 'instances-clusters-get', 'instances-clusters-list', 'instances-clusters-update', 'instances-create', 'instances-delete', 'instances-get', 'instances-get-iam-policy', 'instances-list', 'instances-partial-update-instance', 'instances-set-iam-policy', 'instances-tables-check-consistency', 'instances-tables-create', 'instances-tables-delete', 'instances-tables-drop-row-range', 'instances-tables-generate-consistency-token', 'instances-tables-get', 'instances-tables-get-iam-policy', 'instances-tables-list', 'instances-tables-modify-column-families', 'instances-tables-set-iam-policy', 'instances-tables-test-iam-permissions', 'instances-test-iam-permissions' and 'instances-update'", vec![ + ("instances-app-profiles-create", + Some(r##"Creates an app profile within an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-app-profiles-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The unique name of the instance in which to create the new app profile. + Values are of the form + `projects//instances/`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-app-profiles-delete", + Some(r##"Deletes an app profile from an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-app-profiles-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the app profile to be deleted. Values are of the form + `projects//instances//appProfiles/`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-app-profiles-get", + Some(r##"Gets information about an app profile."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-app-profiles-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the requested app profile. Values are of the form + `projects//instances//appProfiles/`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-app-profiles-list", + Some(r##"Lists information about app profiles in an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-app-profiles-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The unique name of the instance for which a list of app profiles is + requested. Values are of the form + `projects//instances/`. + Use ` = '-'` to list AppProfiles for all Instances in a project, + e.g., `projects/myproject/instances/-`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-app-profiles-patch", + Some(r##"Updates an app profile within an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-app-profiles-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"(`OutputOnly`) + The unique name of the app profile. Values are of the form + `projects//instances//appProfiles/_a-zA-Z0-9*`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-clusters-create", + Some(r##"Creates a cluster within an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-clusters-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The unique name of the instance in which to create the new cluster. + Values are of the form + `projects//instances/`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-clusters-delete", + Some(r##"Deletes a cluster from an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-clusters-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the cluster to be deleted. Values are of the form + `projects//instances//clusters/`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-clusters-get", + Some(r##"Gets information about a cluster."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-clusters-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the requested cluster. Values are of the form + `projects//instances//clusters/`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-clusters-list", + Some(r##"Lists information about clusters in an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-clusters-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The unique name of the instance for which a list of clusters is requested. + Values are of the form `projects//instances/`. + Use ` = '-'` to list Clusters for all Instances in a project, + e.g., `projects/myproject/instances/-`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-clusters-update", + Some(r##"Updates a cluster within an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-clusters-update", + vec![ + (Some(r##"name"##), + None, + Some(r##"(`OutputOnly`) + The unique name of the cluster. Values are of the form + `projects//instances//clusters/a-z*`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-create", + Some(r##"Create an instance within a project."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The unique name of the project in which to create the new instance. + Values are of the form `projects/`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-delete", + Some(r##"Delete an instance from a project."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the instance to be deleted. + Values are of the form `projects//instances/`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-get", + Some(r##"Gets information about an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the requested instance. Values are of the form + `projects//instances/`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-get-iam-policy", + Some(r##"Gets the access control policy for an instance resource. Returns an empty + policy if an instance exists but does not have a policy set."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-list", + Some(r##"Lists information about instances in a project."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The unique name of the project for which a list of instances is requested. + Values are of the form `projects/`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-partial-update-instance", + Some(r##"Partially updates an instance within a project. This method can modify all + fields of an Instance and is the preferred way to update an Instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-partial-update-instance", + vec![ + (Some(r##"name"##), + None, + Some(r##"(`OutputOnly`) + The unique name of the instance. Values are of the form + `projects//instances/a-z+[a-z0-9]`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-set-iam-policy", + Some(r##"Sets the access control policy on an instance resource. Replaces any + existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-check-consistency", + Some(r##"Checks replication consistency based on a consistency token, that is, if + replication has caught up based on the conditions specified in the token + and the check request."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-check-consistency", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the Table for which to check replication consistency. + Values are of the form + `projects//instances//tables/`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-create", + Some(r##"Creates a new table in the specified instance. + The table can be created with a full set of initial column families, + specified in the request."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The unique name of the instance in which to create the table. + Values are of the form `projects//instances/`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-delete", + Some(r##"Permanently deletes a specified table and all of its data."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the table to be deleted. + Values are of the form + `projects//instances//tables/
`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-drop-row-range", + Some(r##"Permanently drop/delete a row range from a specified table. The request can + specify whether to delete all rows in a table, or only those that match a + particular prefix."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-drop-row-range", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the table on which to drop a range of rows. + Values are of the form + `projects//instances//tables/
`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-generate-consistency-token", + Some(r##"Generates a consistency token for a Table, which can be used in + CheckConsistency to check whether mutations to the table that finished + before this call started have been replicated. The tokens will be available + for 90 days."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-generate-consistency-token", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the Table for which to create a consistency token. + Values are of the form + `projects//instances//tables/
`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-get", + Some(r##"Gets metadata information about the specified table."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the requested table. + Values are of the form + `projects//instances//tables/
`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-get-iam-policy", + Some(r##"Gets the access control policy for an instance resource. Returns an empty + policy if an table exists but does not have a policy set."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-list", + Some(r##"Lists all tables served from a specified instance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The unique name of the instance for which tables should be listed. + Values are of the form `projects//instances/`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-modify-column-families", + Some(r##"Performs a series of column family modifications on the specified table. + Either all or none of the modifications will occur before this method + returns, but data requests received prior to that point may see a table + where only some modifications have taken effect."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-modify-column-families", + vec![ + (Some(r##"name"##), + None, + Some(r##"The unique name of the table whose families should be modified. + Values are of the form + `projects//instances//tables/
`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-set-iam-policy", + Some(r##"Sets the access control policy on a table resource. Replaces any existing + policy."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-tables-test-iam-permissions", + Some(r##"Returns permissions that the caller has on the specified table resource."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-tables-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-test-iam-permissions", + Some(r##"Returns permissions that the caller has on the specified instance resource."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-update", + Some(r##"Updates an instance within a project. This method updates only the display + name and type for an Instance. To update other Instance properties, such as + labels, use PartialUpdateInstance."##), + "Details at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli/projects_instances-update", + vec![ + (Some(r##"name"##), + None, + Some(r##"(`OutputOnly`) + The unique name of the instance. Values are of the form + `projects//instances/a-z+[a-z0-9]`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("bigtableadmin2") + .author("Sebastian Thiel ") + .version("1.0.8+20190328") + .about("Administer your Cloud Bigtable tables and instances.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_bigtableadmin2_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/bigtableadmin2/Cargo.toml b/gen/bigtableadmin2/Cargo.toml new file mode 100644 index 0000000000..a07b0789be --- /dev/null +++ b/gen/bigtableadmin2/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-bigtableadmin2" +version = "1.0.8+20190328" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Bigtable Admin (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/bigtableadmin2" +homepage = "https://cloud.google.com/bigtable/" +documentation = "https://docs.rs/google-bigtableadmin2/1.0.8+20190328" +license = "MIT" +keywords = ["bigtableadmin", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/bigtableadmin2/LICENSE.md b/gen/bigtableadmin2/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/bigtableadmin2/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/bigtableadmin2/README.md b/gen/bigtableadmin2/README.md new file mode 100644 index 0000000000..03658dc132 --- /dev/null +++ b/gen/bigtableadmin2/README.md @@ -0,0 +1,195 @@ + +The `google-bigtableadmin2` library allows access to all features of the *Google Bigtable Admin* service. + +This documentation was generated from *Bigtable Admin* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *bigtableadmin:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Bigtable Admin* *v2* API can be found at the +[official documentation site](https://cloud.google.com/bigtable/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.BigtableAdmin.html) ... + +* [operations](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.Operation.html) + * [*cancel*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.OperationDeleteCall.html), [*get*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.OperationGetCall.html) and [*projects operations list*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.OperationProjectOperationListCall.html) +* projects + * [*instances app profiles create*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceAppProfileCreateCall.html), [*instances app profiles delete*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceAppProfileDeleteCall.html), [*instances app profiles get*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceAppProfileGetCall.html), [*instances app profiles list*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceAppProfileListCall.html), [*instances app profiles patch*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceAppProfilePatchCall.html), [*instances clusters create*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceClusterCreateCall.html), [*instances clusters delete*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceClusterDeleteCall.html), [*instances clusters get*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceClusterGetCall.html), [*instances clusters list*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceClusterListCall.html), [*instances clusters update*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceClusterUpdateCall.html), [*instances create*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceCreateCall.html), [*instances delete*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceDeleteCall.html), [*instances get*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceGetCall.html), [*instances get iam policy*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceGetIamPolicyCall.html), [*instances list*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceListCall.html), [*instances partial update instance*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstancePartialUpdateInstanceCall.html), [*instances set iam policy*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceSetIamPolicyCall.html), [*instances tables check consistency*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableCheckConsistencyCall.html), [*instances tables create*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableCreateCall.html), [*instances tables delete*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableDeleteCall.html), [*instances tables drop row range*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableDropRowRangeCall.html), [*instances tables generate consistency token*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableGenerateConsistencyTokenCall.html), [*instances tables get*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableGetCall.html), [*instances tables get iam policy*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableGetIamPolicyCall.html), [*instances tables list*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableListCall.html), [*instances tables modify column families*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableModifyColumnFamilyCall.html), [*instances tables set iam policy*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableSetIamPolicyCall.html), [*instances tables test iam permissions*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTableTestIamPermissionCall.html), [*instances test iam permissions*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceTestIamPermissionCall.html) and [*instances update*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.ProjectInstanceUpdateCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/struct.BigtableAdmin.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.operations().projects_operations_list(...).doit() +let r = hub.operations().delete(...).doit() +let r = hub.operations().get(...).doit() +let r = hub.projects().instances_create(...).doit() +let r = hub.operations().cancel(...).doit() +let r = hub.projects().instances_app_profiles_patch(...).doit() +let r = hub.projects().instances_partial_update_instance(...).doit() +let r = hub.projects().instances_clusters_create(...).doit() +let r = hub.projects().instances_clusters_update(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-bigtableadmin2 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_bigtableadmin2 as bigtableadmin2; +use bigtableadmin2::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use bigtableadmin2::BigtableAdmin; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.operations().projects_operations_list("name") + .page_token("sit") + .page_size(-65) + .filter("sed") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-bigtableadmin2/1.0.8+20190328/google_bigtableadmin2/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **bigtableadmin2** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/bigtableadmin2/src/cmn.rs b/gen/bigtableadmin2/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/bigtableadmin2/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/bigtableadmin2/src/lib.rs b/gen/bigtableadmin2/src/lib.rs new file mode 100644 index 0000000000..1ff3e41d76 --- /dev/null +++ b/gen/bigtableadmin2/src/lib.rs @@ -0,0 +1,11687 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Bigtable Admin* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *bigtableadmin:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Bigtable Admin* *v2* API can be found at the +//! [official documentation site](https://cloud.google.com/bigtable/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/bigtableadmin2). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.BigtableAdmin.html) ... +//! +//! * [operations](struct.Operation.html) +//! * [*cancel*](struct.OperationCancelCall.html), [*delete*](struct.OperationDeleteCall.html), [*get*](struct.OperationGetCall.html) and [*projects operations list*](struct.OperationProjectOperationListCall.html) +//! * projects +//! * [*instances app profiles create*](struct.ProjectInstanceAppProfileCreateCall.html), [*instances app profiles delete*](struct.ProjectInstanceAppProfileDeleteCall.html), [*instances app profiles get*](struct.ProjectInstanceAppProfileGetCall.html), [*instances app profiles list*](struct.ProjectInstanceAppProfileListCall.html), [*instances app profiles patch*](struct.ProjectInstanceAppProfilePatchCall.html), [*instances clusters create*](struct.ProjectInstanceClusterCreateCall.html), [*instances clusters delete*](struct.ProjectInstanceClusterDeleteCall.html), [*instances clusters get*](struct.ProjectInstanceClusterGetCall.html), [*instances clusters list*](struct.ProjectInstanceClusterListCall.html), [*instances clusters update*](struct.ProjectInstanceClusterUpdateCall.html), [*instances create*](struct.ProjectInstanceCreateCall.html), [*instances delete*](struct.ProjectInstanceDeleteCall.html), [*instances get*](struct.ProjectInstanceGetCall.html), [*instances get iam policy*](struct.ProjectInstanceGetIamPolicyCall.html), [*instances list*](struct.ProjectInstanceListCall.html), [*instances partial update instance*](struct.ProjectInstancePartialUpdateInstanceCall.html), [*instances set iam policy*](struct.ProjectInstanceSetIamPolicyCall.html), [*instances tables check consistency*](struct.ProjectInstanceTableCheckConsistencyCall.html), [*instances tables create*](struct.ProjectInstanceTableCreateCall.html), [*instances tables delete*](struct.ProjectInstanceTableDeleteCall.html), [*instances tables drop row range*](struct.ProjectInstanceTableDropRowRangeCall.html), [*instances tables generate consistency token*](struct.ProjectInstanceTableGenerateConsistencyTokenCall.html), [*instances tables get*](struct.ProjectInstanceTableGetCall.html), [*instances tables get iam policy*](struct.ProjectInstanceTableGetIamPolicyCall.html), [*instances tables list*](struct.ProjectInstanceTableListCall.html), [*instances tables modify column families*](struct.ProjectInstanceTableModifyColumnFamilyCall.html), [*instances tables set iam policy*](struct.ProjectInstanceTableSetIamPolicyCall.html), [*instances tables test iam permissions*](struct.ProjectInstanceTableTestIamPermissionCall.html), [*instances test iam permissions*](struct.ProjectInstanceTestIamPermissionCall.html) and [*instances update*](struct.ProjectInstanceUpdateCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.BigtableAdmin.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.operations().projects_operations_list(...).doit() +//! let r = hub.operations().delete(...).doit() +//! let r = hub.operations().get(...).doit() +//! let r = hub.projects().instances_create(...).doit() +//! let r = hub.operations().cancel(...).doit() +//! let r = hub.projects().instances_app_profiles_patch(...).doit() +//! let r = hub.projects().instances_partial_update_instance(...).doit() +//! let r = hub.projects().instances_clusters_create(...).doit() +//! let r = hub.projects().instances_clusters_update(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-bigtableadmin2 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_bigtableadmin2 as bigtableadmin2; +//! use bigtableadmin2::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use bigtableadmin2::BigtableAdmin; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.operations().projects_operations_list("name") +//! .page_token("dolores") +//! .page_size(-63) +//! .filter("accusam") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// Administer your Cloud Bigtable tables and clusters + CloudBigtableAdmin, + + /// Administer your Cloud Bigtable tables and clusters + BigtableAdmin, + + /// View your data across Google Cloud Platform services + CloudPlatformReadOnly, + + /// View and manage your data across Google Cloud Platform services + CloudPlatform, + + /// Administer your Cloud Bigtable tables + CloudBigtableAdminTable, + + /// Administer your Cloud Bigtable clusters + BigtableAdminCluster, + + /// Administer your Cloud Bigtable clusters + CloudBigtableAdminCluster, + + /// Administer your Cloud Bigtable tables + BigtableAdminTable, + + /// Administer your Cloud Bigtable clusters + BigtableAdminInstance, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudBigtableAdmin => "https://www.googleapis.com/auth/cloud-bigtable.admin", + Scope::BigtableAdmin => "https://www.googleapis.com/auth/bigtable.admin", + Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::CloudBigtableAdminTable => "https://www.googleapis.com/auth/cloud-bigtable.admin.table", + Scope::BigtableAdminCluster => "https://www.googleapis.com/auth/bigtable.admin.cluster", + Scope::CloudBigtableAdminCluster => "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster", + Scope::BigtableAdminTable => "https://www.googleapis.com/auth/bigtable.admin.table", + Scope::BigtableAdminInstance => "https://www.googleapis.com/auth/bigtable.admin.instance", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::BigtableAdmin + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all BigtableAdmin related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use bigtableadmin2::BigtableAdmin; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().projects_operations_list("name") +/// .page_token("justo") +/// .page_size(-1) +/// .filter("erat") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct BigtableAdmin { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for BigtableAdmin {} + +impl<'a, C, A> BigtableAdmin + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> BigtableAdmin { + BigtableAdmin { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://bigtableadmin.googleapis.com/".to_string(), + _root_url: "https://bigtableadmin.googleapis.com/".to_string(), + } + } + + pub fn operations(&'a self) -> OperationMethods<'a, C, A> { + OperationMethods { hub: &self } + } + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://bigtableadmin.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://bigtableadmin.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Request message for +/// google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables check consistency projects](struct.ProjectInstanceTableCheckConsistencyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CheckConsistencyRequest { + /// The token created using GenerateConsistencyToken for the Table. + #[serde(rename="consistencyToken")] + pub consistency_token: Option, +} + +impl RequestValue for CheckConsistencyRequest {} + + +/// Response message for BigtableInstanceAdmin.ListInstances. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances list projects](struct.ProjectInstanceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListInstancesResponse { + /// DEPRECATED: This field is unused and ignored. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of requested instances. + pub instances: Option>, + /// Locations from which Instance information could not be retrieved, + /// due to an outage or some other transient condition. + /// Instances whose Clusters are all in one of the failed locations + /// may be missing from `instances`, and Instances with at least one + /// Cluster in a failed location may only have partial information returned. + /// Values are of the form `projects//locations/` + #[serde(rename="failedLocations")] + pub failed_locations: Option>, +} + +impl ResponseResult for ListInstancesResponse {} + + +/// Request message for `SetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables set iam policy projects](struct.ProjectInstanceTableSetIamPolicyCall.html) (request) +/// * [instances set iam policy projects](struct.ProjectInstanceSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetIamPolicyRequest { + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. + pub policy: Option, + /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + /// the fields in the mask will be modified. If no mask is provided, the + /// following default mask is used: + /// paths: "bindings, etag" + /// This field is only used by Cloud IAM. + #[serde(rename="updateMask")] + pub update_mask: Option, +} + +impl RequestValue for SetIamPolicyRequest {} + + +/// A GcRule which deletes cells matching any of the given rules. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Union { + /// Delete cells which would be deleted by any element of `rules`. + pub rules: Option>, +} + +impl Part for Union {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// Unimplemented. The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + +/// Request message for +/// google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables drop row range projects](struct.ProjectInstanceTableDropRowRangeCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DropRowRangeRequest { + /// Delete all rows that start with this row key prefix. Prefix cannot be + /// zero length. + #[serde(rename="rowKeyPrefix")] + pub row_key_prefix: Option, + /// Delete all rows in the table. Setting this to false is a no-op. + #[serde(rename="deleteAllDataFromTable")] + pub delete_all_data_from_table: Option, +} + +impl RequestValue for DropRowRangeRequest {} + + +/// A collection of Bigtable Tables and +/// the resources that serve them. +/// All tables in an instance are served from all +/// Clusters in the instance. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances get projects](struct.ProjectInstanceGetCall.html) (response) +/// * [instances update projects](struct.ProjectInstanceUpdateCall.html) (request|response) +/// * [instances partial update instance projects](struct.ProjectInstancePartialUpdateInstanceCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Instance { + /// The descriptive name for this instance as it appears in UIs. + /// Can be changed at any time, but should be kept globally unique + /// to avoid confusion. + #[serde(rename="displayName")] + pub display_name: Option, + /// (`OutputOnly`) + /// The current state of the instance. + pub state: Option, + /// Labels are a flexible and lightweight mechanism for organizing cloud + /// resources into groups that reflect a customer's organizational needs and + /// deployment strategies. They can be used to filter resources and aggregate + /// metrics. + /// + /// * Label keys must be between 1 and 63 characters long and must conform to + /// the regular expression: `\p{Ll}\p{Lo}{0,62}`. + /// * Label values must be between 0 and 63 characters long and must conform to + /// the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`. + /// * No more than 64 labels can be associated with a given resource. + /// * Keys and values must both be under 128 bytes. + pub labels: Option>, + /// The type of the instance. Defaults to `PRODUCTION`. + #[serde(rename="type")] + pub type_: Option, + /// (`OutputOnly`) + /// The unique name of the instance. Values are of the form + /// `projects//instances/a-z+[a-z0-9]`. + pub name: Option, +} + +impl RequestValue for Instance {} +impl ResponseResult for Instance {} + + +/// An initial split point for a newly created table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Split { + /// Row key to use as an initial tablet boundary. + pub key: Option, +} + +impl Part for Split {} + + +/// A set of columns within a table which share a common configuration. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ColumnFamily { + /// Garbage collection rule specified as a protobuf. + /// Must serialize to at most 500 bytes. + /// + /// NOTE: Garbage collection executes opportunistically in the background, and + /// so it's possible for reads to return a cell even if it matches the active + /// GC expression for its family. + #[serde(rename="gcRule")] + pub gc_rule: Option, +} + +impl Part for ColumnFamily {} + + +/// A create, update, or delete of a particular column family. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Modification { + /// Create a new column family with the specified schema, or fail if + /// one already exists with the given ID. + pub create: Option, + /// Drop (delete) the column family with the given ID, or fail if no such + /// family exists. + pub drop: Option, + /// The ID of the column family to be modified. + pub id: Option, + /// Update an existing column family to the specified schema, or fail + /// if no column family exists with the given ID. + pub update: Option, +} + +impl Part for Modification {} + + +/// Response message for +/// google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables generate consistency token projects](struct.ProjectInstanceTableGenerateConsistencyTokenCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GenerateConsistencyTokenResponse { + /// The generated consistency token. + #[serde(rename="consistencyToken")] + pub consistency_token: Option, +} + +impl ResponseResult for GenerateConsistencyTokenResponse {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables drop row range projects](struct.ProjectInstanceTableDropRowRangeCall.html) (response) +/// * [delete operations](struct.OperationDeleteCall.html) (response) +/// * [instances app profiles delete projects](struct.ProjectInstanceAppProfileDeleteCall.html) (response) +/// * [instances clusters delete projects](struct.ProjectInstanceClusterDeleteCall.html) (response) +/// * [cancel operations](struct.OperationCancelCall.html) (response) +/// * [instances delete projects](struct.ProjectInstanceDeleteCall.html) (response) +/// * [instances tables delete projects](struct.ProjectInstanceTableDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// Read/write requests may be routed to any cluster in the instance, and will +/// fail over to another cluster in the event of transient errors or delays. +/// Choosing this option sacrifices read-your-writes consistency to improve +/// availability. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MultiClusterRoutingUseAny { _never_set: Option } + +impl Part for MultiClusterRoutingUseAny {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **JSON Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// **YAML Example** +/// +/// bindings: +/// - members: +/// - user:mike@example.com +/// - group:admins@example.com +/// - domain:google.com +/// - serviceAccount:my-other-app@appspot.gserviceaccount.com +/// role: roles/owner +/// - members: +/// - user:sean@example.com +/// role: roles/viewer +/// +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam/docs). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables set iam policy projects](struct.ProjectInstanceTableSetIamPolicyCall.html) (response) +/// * [instances get iam policy projects](struct.ProjectInstanceGetIamPolicyCall.html) (response) +/// * [instances set iam policy projects](struct.ProjectInstanceSetIamPolicyCall.html) (response) +/// * [instances tables get iam policy projects](struct.ProjectInstanceTableGetIamPolicyCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, + /// Deprecated. + pub version: Option, +} + +impl ResponseResult for Policy {} + + +/// A resizable group of nodes in a particular cloud location, capable +/// of serving all Tables in the parent +/// Instance. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances clusters create projects](struct.ProjectInstanceClusterCreateCall.html) (request) +/// * [instances clusters get projects](struct.ProjectInstanceClusterGetCall.html) (response) +/// * [instances clusters update projects](struct.ProjectInstanceClusterUpdateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Cluster { + /// (`CreationOnly`) + /// The type of storage used by this cluster to serve its + /// parent instance's tables, unless explicitly overridden. + #[serde(rename="defaultStorageType")] + pub default_storage_type: Option, + /// The number of nodes allocated to this cluster. More nodes enable higher + /// throughput and more consistent performance. + #[serde(rename="serveNodes")] + pub serve_nodes: Option, + /// (`CreationOnly`) + /// The location where this cluster's nodes and storage reside. For best + /// performance, clients should be located as close as possible to this + /// cluster. Currently only zones are supported, so values should be of the + /// form `projects//locations/`. + pub location: Option, + /// (`OutputOnly`) + /// The unique name of the cluster. Values are of the form + /// `projects//instances//clusters/a-z*`. + pub name: Option, + /// (`OutputOnly`) + /// The current state of the cluster. + pub state: Option, +} + +impl RequestValue for Cluster {} +impl ResponseResult for Cluster {} + + +/// Request message for +/// google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables modify column families projects](struct.ProjectInstanceTableModifyColumnFamilyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ModifyColumnFamiliesRequest { + /// Modifications to be atomically applied to the specified table's families. + /// Entries are applied in order, meaning that earlier modifications can be + /// masked by later ones (in the case of repeated updates to the same family, + /// for example). + pub modifications: Option>, +} + +impl RequestValue for ModifyColumnFamiliesRequest {} + + +/// Rule for determining which cells to delete during garbage collection. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GcRule { + /// Delete cells that would be deleted by any nested rule. + pub union: Option, + /// Delete cells that would be deleted by every nested rule. + pub intersection: Option, + /// Delete cells in a column older than the given age. + /// Values must be at least one millisecond, and will be truncated to + /// microsecond granularity. + #[serde(rename="maxAge")] + pub max_age: Option, + /// Delete all cells in a column except the most recent N. + #[serde(rename="maxNumVersions")] + pub max_num_versions: Option, +} + +impl Part for GcRule {} + + +/// Request message for BigtableInstanceAdmin.CreateInstance. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances create projects](struct.ProjectInstanceCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateInstanceRequest { + /// The ID to be used when referring to the new instance within its project, + /// e.g., just `myinstance` rather than + /// `projects/myproject/instances/myinstance`. + #[serde(rename="instanceId")] + pub instance_id: Option, + /// The clusters to be created within the instance, mapped by desired + /// cluster ID, e.g., just `mycluster` rather than + /// `projects/myproject/instances/myinstance/clusters/mycluster`. + /// Fields marked `OutputOnly` must be left blank. + /// Currently, at most two clusters can be specified. + pub clusters: Option>, + /// The unique name of the project in which to create the new instance. + /// Values are of the form `projects/`. + pub parent: Option, + /// The instance to create. + /// Fields marked `OutputOnly` must be left blank. + pub instance: Option, +} + +impl RequestValue for CreateInstanceRequest {} + + +/// A GcRule which deletes cells matching all of the given rules. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Intersection { + /// Only delete cells which would be deleted by every element of `rules`. + pub rules: Option>, +} + +impl Part for Intersection {} + + +/// Provides the configuration for logging a type of permissions. +/// Example: +/// +/// { +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// } +/// ] +/// } +/// +/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting +/// foo@gmail.com from DATA_READ logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditLogConfig { + /// Specifies the identities that do not cause logging for this type of + /// permission. + /// Follows the same format of Binding.members. + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The log type that this config enables. + #[serde(rename="logType")] + pub log_type: Option, +} + +impl Part for AuditLogConfig {} + + +/// Request message for `GetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances get iam policy projects](struct.ProjectInstanceGetIamPolicyCall.html) (request) +/// * [instances tables get iam policy projects](struct.ProjectInstanceTableGetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetIamPolicyRequest { _never_set: Option } + +impl RequestValue for GetIamPolicyRequest {} + + +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances test iam permissions projects](struct.ProjectInstanceTestIamPermissionCall.html) (request) +/// * [instances tables test iam permissions projects](struct.ProjectInstanceTableTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, +} + +impl RequestValue for TestIamPermissionsRequest {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// Response message for BigtableInstanceAdmin.ListClusters. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances clusters list projects](struct.ProjectInstanceClusterListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListClustersResponse { + /// DEPRECATED: This field is unused and ignored. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of requested clusters. + pub clusters: Option>, + /// Locations from which Cluster information could not be retrieved, + /// due to an outage or some other transient condition. + /// Clusters from these locations may be missing from `clusters`, + /// or may only have partial information returned. + /// Values are of the form `projects//locations/` + #[serde(rename="failedLocations")] + pub failed_locations: Option>, +} + +impl ResponseResult for ListClustersResponse {} + + +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances test iam permissions projects](struct.ProjectInstanceTestIamPermissionCall.html) (response) +/// * [instances tables test iam permissions projects](struct.ProjectInstanceTableTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestIamPermissionsResponse {} + + +/// Response message for BigtableInstanceAdmin.ListAppProfiles. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances app profiles list projects](struct.ProjectInstanceAppProfileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListAppProfilesResponse { + /// Set if not all app profiles could be returned in a single response. + /// Pass this value to `page_token` in another request to get the next + /// page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Locations from which AppProfile information could not be retrieved, + /// due to an outage or some other transient condition. + /// AppProfiles from these locations may be missing from `app_profiles`. + /// Values are of the form `projects//locations/` + #[serde(rename="failedLocations")] + pub failed_locations: Option>, + /// The list of requested app profiles. + #[serde(rename="appProfiles")] + pub app_profiles: Option>, +} + +impl ResponseResult for ListAppProfilesResponse {} + + +/// Request message for +/// google.bigtable.admin.v2.BigtableTableAdmin.CreateTable +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables create projects](struct.ProjectInstanceTableCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateTableRequest { + /// The Table to create. + pub table: Option
, + /// The optional list of row keys that will be used to initially split the + /// table into several tablets (tablets are similar to HBase regions). + /// Given two split keys, `s1` and `s2`, three tablets will be created, + /// spanning the key ranges: `[, s1), [s1, s2), [s2, )`. + /// + /// Example: + /// + /// * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` + /// `"other", "zz"]` + /// * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` + /// * Key assignment: + /// - Tablet 1 `[, apple) => {"a"}.` + /// - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` + /// - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` + /// - Tablet 4 `[customer_2, other) => {"customer_2"}.` + /// - Tablet 5 `[other, ) => {"other", "zz"}.` + #[serde(rename="initialSplits")] + pub initial_splits: Option>, + /// The name by which the new table should be referred to within the parent + /// instance, e.g., `foobar` rather than `/tables/foobar`. + #[serde(rename="tableId")] + pub table_id: Option, +} + +impl RequestValue for CreateTableRequest {} + + +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [projects operations list operations](struct.OperationProjectOperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for ListOperationsResponse {} + + +/// A configuration object describing how Cloud Bigtable should treat traffic +/// from a particular end user application. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances app profiles patch projects](struct.ProjectInstanceAppProfilePatchCall.html) (request) +/// * [instances app profiles get projects](struct.ProjectInstanceAppProfileGetCall.html) (response) +/// * [instances app profiles create projects](struct.ProjectInstanceAppProfileCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AppProfile { + /// Use a multi-cluster routing policy that may pick any cluster. + #[serde(rename="multiClusterRoutingUseAny")] + pub multi_cluster_routing_use_any: Option, + /// Strongly validated etag for optimistic concurrency control. Preserve the + /// value returned from `GetAppProfile` when calling `UpdateAppProfile` to + /// fail the request if there has been a modification in the mean time. The + /// `update_mask` of the request need not include `etag` for this protection + /// to apply. + /// See [Wikipedia](https://en.wikipedia.org/wiki/HTTP_ETag) and + /// [RFC 7232](https://tools.ietf.org/html/rfc7232#section-2.3) for more + /// details. + pub etag: Option, + /// Use a single-cluster routing policy. + #[serde(rename="singleClusterRouting")] + pub single_cluster_routing: Option, + /// Optional long form description of the use case for this AppProfile. + pub description: Option, + /// (`OutputOnly`) + /// The unique name of the app profile. Values are of the form + /// `projects//instances//appProfiles/_a-zA-Z0-9*`. + pub name: Option, +} + +impl RequestValue for AppProfile {} +impl ResponseResult for AppProfile {} + + +/// Response message for +/// google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables check consistency projects](struct.ProjectInstanceTableCheckConsistencyCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CheckConsistencyResponse { + /// True only if the token is consistent. A token is consistent if replication + /// has caught up with the restrictions specified in the request. + pub consistent: Option, +} + +impl ResponseResult for CheckConsistencyResponse {} + + +/// Unconditionally routes all read/write requests to a specific cluster. +/// This option preserves read-your-writes consistency, but does not improve +/// availability. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SingleClusterRouting { + /// The cluster to which read/write requests should be routed. + #[serde(rename="clusterId")] + pub cluster_id: Option, + /// Whether or not `CheckAndMutateRow` and `ReadModifyWriteRow` requests are + /// allowed by this app profile. It is unsafe to send these requests to + /// the same table/row/column in multiple clusters. + #[serde(rename="allowTransactionalWrites")] + pub allow_transactional_writes: Option, +} + +impl Part for SingleClusterRouting {} + + +/// The state of a table's data in a particular cluster. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClusterState { + /// Output only. + /// The state of replication for the table in this cluster. + #[serde(rename="replicationState")] + pub replication_state: Option, +} + +impl Part for ClusterState {} + + +/// Specifies the audit configuration for a service. +/// The configuration determines which permission types are logged, and what +/// identities, if any, are exempted from logging. +/// An AuditConfig must have one or more AuditLogConfigs. +/// +/// If there are AuditConfigs for both `allServices` and a specific service, +/// the union of the two AuditConfigs is used for that service: the log_types +/// specified in each AuditConfig are enabled, and the exempted_members in each +/// AuditLogConfig are exempted. +/// +/// Example Policy with multiple AuditConfigs: +/// +/// { +/// "audit_configs": [ +/// { +/// "service": "allServices" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// }, +/// { +/// "log_type": "ADMIN_READ", +/// } +/// ] +/// }, +/// { +/// "service": "fooservice.googleapis.com" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// "exempted_members": [ +/// "user:bar@gmail.com" +/// ] +/// } +/// ] +/// } +/// ] +/// } +/// +/// For fooservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ +/// logging. It also exempts foo@gmail.com from DATA_READ logging, and +/// bar@gmail.com from DATA_WRITE logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditConfig { + /// The configuration for logging of each type of permission. + #[serde(rename="auditLogConfigs")] + pub audit_log_configs: Option>, + /// Specifies a service that will be enabled for audit logging. + /// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + /// `allServices` is a special value that covers all services. + pub service: Option, +} + +impl Part for AuditConfig {} + + +/// Request message for +/// google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables generate consistency token projects](struct.ProjectInstanceTableGenerateConsistencyTokenCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GenerateConsistencyTokenRequest { _never_set: Option } + +impl RequestValue for GenerateConsistencyTokenRequest {} + + +/// A collection of user data indexed by row, column, and timestamp. +/// Each table is served using the resources of its parent cluster. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables create projects](struct.ProjectInstanceTableCreateCall.html) (response) +/// * [instances tables modify column families projects](struct.ProjectInstanceTableModifyColumnFamilyCall.html) (response) +/// * [instances tables get projects](struct.ProjectInstanceTableGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Table { + /// Output only. + /// Map from cluster ID to per-cluster table state. + /// If it could not be determined whether or not the table has data in a + /// particular cluster (for example, if its zone is unavailable), then + /// there will be an entry for the cluster with UNKNOWN `replication_status`. + /// Views: `REPLICATION_VIEW`, `FULL` + #[serde(rename="clusterStates")] + pub cluster_states: Option>, + /// (`CreationOnly`) + /// The column families configured for this table, mapped by column family ID. + /// Views: `SCHEMA_VIEW`, `FULL` + #[serde(rename="columnFamilies")] + pub column_families: Option>, + /// Output only. + /// The unique name of the table. Values are of the form + /// `projects//instances//tables/_a-zA-Z0-9*`. + /// Views: `NAME_ONLY`, `SCHEMA_VIEW`, `REPLICATION_VIEW`, `FULL` + pub name: Option, + /// (`CreationOnly`) + /// The granularity (i.e. `MILLIS`) at which timestamps are stored in + /// this table. Timestamps not matching the granularity will be rejected. + /// If unspecified at creation time, the value will be set to `MILLIS`. + /// Views: `SCHEMA_VIEW`, `FULL`. + pub granularity: Option, +} + +impl ResponseResult for Table {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [projects operations list operations](struct.OperationProjectOperationListCall.html) (none) +/// * [delete operations](struct.OperationDeleteCall.html) (none) +/// * [get operations](struct.OperationGetCall.html) (response) +/// * [instances create projects](struct.ProjectInstanceCreateCall.html) (response) +/// * [cancel operations](struct.OperationCancelCall.html) (none) +/// * [instances app profiles patch projects](struct.ProjectInstanceAppProfilePatchCall.html) (response) +/// * [instances partial update instance projects](struct.ProjectInstancePartialUpdateInstanceCall.html) (response) +/// * [instances clusters create projects](struct.ProjectInstanceClusterCreateCall.html) (response) +/// * [instances clusters update projects](struct.ProjectInstanceClusterUpdateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl Resource for Operation {} +impl ResponseResult for Operation {} + + +/// Response message for +/// google.bigtable.admin.v2.BigtableTableAdmin.ListTables +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances tables list projects](struct.ProjectInstanceTableListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListTablesResponse { + /// Set if not all tables could be returned in a single response. + /// Pass this value to `page_token` in another request to get the next + /// page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The tables present in the requested instance. + pub tables: Option>, +} + +impl ResponseResult for ListTablesResponse {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *operation* resources. +/// It is not used directly, but through the `BigtableAdmin` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_bigtableadmin2 as bigtableadmin2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use bigtableadmin2::BigtableAdmin; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `cancel(...)`, `delete(...)`, `get(...)` and `projects_operations_list(...)` +/// // to build up your call. +/// let rb = hub.operations(); +/// # } +/// ``` +pub struct OperationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, +} + +impl<'a, C, A> MethodsBuilder for OperationMethods<'a, C, A> {} + +impl<'a, C, A> OperationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists operations that match the specified filter in the request. If the + /// server doesn't support this method, it returns `UNIMPLEMENTED`. + /// + /// NOTE: the `name` binding allows API services to override the binding + /// to use different resource name schemes, such as `users/*/operations`. To + /// override the binding, API services can add a binding such as + /// `"/v1/{name=users/*}/operations"` to their service configuration. + /// For backwards compatibility, the default name includes the operations + /// collection id, however overriding users must ensure the name binding + /// is the parent resource, without the operations collection id. + /// + /// # Arguments + /// + /// * `name` - The name of the operation's parent resource. + pub fn projects_operations_list(&self, name: &str) -> OperationProjectOperationListCall<'a, C, A> { + OperationProjectOperationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a long-running operation. This method indicates that the client is + /// no longer interested in the operation result. It does not cancel the + /// operation. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource to be deleted. + pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, C, A> { + OperationDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn get(&self, name: &str) -> OperationGetCall<'a, C, A> { + OperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Starts asynchronous cancellation on a long-running operation. The server + /// makes a best effort to cancel the operation, but success is not + /// guaranteed. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use + /// Operations.GetOperation or + /// other methods to check whether the cancellation succeeded or whether the + /// operation completed despite cancellation. On successful cancellation, + /// the operation is not deleted; instead, it becomes an operation with + /// an Operation.error value with a google.rpc.Status.code of 1, + /// corresponding to `Code.CANCELLED`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource to be cancelled. + pub fn cancel(&self, name: &str) -> OperationCancelCall<'a, C, A> { + OperationCancelCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `BigtableAdmin` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_bigtableadmin2 as bigtableadmin2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use bigtableadmin2::BigtableAdmin; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `instances_app_profiles_create(...)`, `instances_app_profiles_delete(...)`, `instances_app_profiles_get(...)`, `instances_app_profiles_list(...)`, `instances_app_profiles_patch(...)`, `instances_clusters_create(...)`, `instances_clusters_delete(...)`, `instances_clusters_get(...)`, `instances_clusters_list(...)`, `instances_clusters_update(...)`, `instances_create(...)`, `instances_delete(...)`, `instances_get(...)`, `instances_get_iam_policy(...)`, `instances_list(...)`, `instances_partial_update_instance(...)`, `instances_set_iam_policy(...)`, `instances_tables_check_consistency(...)`, `instances_tables_create(...)`, `instances_tables_delete(...)`, `instances_tables_drop_row_range(...)`, `instances_tables_generate_consistency_token(...)`, `instances_tables_get(...)`, `instances_tables_get_iam_policy(...)`, `instances_tables_list(...)`, `instances_tables_modify_column_families(...)`, `instances_tables_set_iam_policy(...)`, `instances_tables_test_iam_permissions(...)`, `instances_test_iam_permissions(...)` and `instances_update(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Generates a consistency token for a Table, which can be used in + /// CheckConsistency to check whether mutations to the table that finished + /// before this call started have been replicated. The tokens will be available + /// for 90 days. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The unique name of the Table for which to create a consistency token. + /// Values are of the form + /// `projects//instances//tables/
`. + pub fn instances_tables_generate_consistency_token(&self, request: GenerateConsistencyTokenRequest, name: &str) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> { + ProjectInstanceTableGenerateConsistencyTokenCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Permanently drop/delete a row range from a specified table. The request can + /// specify whether to delete all rows in a table, or only those that match a + /// particular prefix. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The unique name of the table on which to drop a range of rows. + /// Values are of the form + /// `projects//instances//tables/
`. + pub fn instances_tables_drop_row_range(&self, request: DropRowRangeRequest, name: &str) -> ProjectInstanceTableDropRowRangeCall<'a, C, A> { + ProjectInstanceTableDropRowRangeCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an app profile from an instance. + /// + /// # Arguments + /// + /// * `name` - The unique name of the app profile to be deleted. Values are of the form + /// `projects//instances//appProfiles/`. + pub fn instances_app_profiles_delete(&self, name: &str) -> ProjectInstanceAppProfileDeleteCall<'a, C, A> { + ProjectInstanceAppProfileDeleteCall { + hub: self.hub, + _name: name.to_string(), + _ignore_warnings: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Create an instance within a project. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The unique name of the project in which to create the new instance. + /// Values are of the form `projects/`. + pub fn instances_create(&self, request: CreateInstanceRequest, parent: &str) -> ProjectInstanceCreateCall<'a, C, A> { + ProjectInstanceCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a cluster within an instance. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The unique name of the instance in which to create the new cluster. + /// Values are of the form + /// `projects//instances/`. + pub fn instances_clusters_create(&self, request: Cluster, parent: &str) -> ProjectInstanceClusterCreateCall<'a, C, A> { + ProjectInstanceClusterCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _cluster_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets metadata information about the specified table. + /// + /// # Arguments + /// + /// * `name` - The unique name of the requested table. + /// Values are of the form + /// `projects//instances//tables/
`. + pub fn instances_tables_get(&self, name: &str) -> ProjectInstanceTableGetCall<'a, C, A> { + ProjectInstanceTableGetCall { + hub: self.hub, + _name: name.to_string(), + _view: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an app profile within an instance. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - (`OutputOnly`) + /// The unique name of the app profile. Values are of the form + /// `projects//instances//appProfiles/_a-zA-Z0-9*`. + pub fn instances_app_profiles_patch(&self, request: AppProfile, name: &str) -> ProjectInstanceAppProfilePatchCall<'a, C, A> { + ProjectInstanceAppProfilePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _ignore_warnings: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists information about app profiles in an instance. + /// + /// # Arguments + /// + /// * `parent` - The unique name of the instance for which a list of app profiles is + /// requested. Values are of the form + /// `projects//instances/`. + /// Use ` = '-'` to list AppProfiles for all Instances in a project, + /// e.g., `projects/myproject/instances/-`. + pub fn instances_app_profiles_list(&self, parent: &str) -> ProjectInstanceAppProfileListCall<'a, C, A> { + ProjectInstanceAppProfileListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a cluster within an instance. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - (`OutputOnly`) + /// The unique name of the cluster. Values are of the form + /// `projects//instances//clusters/a-z*`. + pub fn instances_clusters_update(&self, request: Cluster, name: &str) -> ProjectInstanceClusterUpdateCall<'a, C, A> { + ProjectInstanceClusterUpdateCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on an instance resource. Replaces any + /// existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn instances_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectInstanceSetIamPolicyCall<'a, C, A> { + ProjectInstanceSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Checks replication consistency based on a consistency token, that is, if + /// replication has caught up based on the conditions specified in the token + /// and the check request. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The unique name of the Table for which to check replication consistency. + /// Values are of the form + /// `projects//instances//tables/
`. + pub fn instances_tables_check_consistency(&self, request: CheckConsistencyRequest, name: &str) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A> { + ProjectInstanceTableCheckConsistencyCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for an instance resource. Returns an empty + /// policy if an instance exists but does not have a policy set. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn instances_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectInstanceGetIamPolicyCall<'a, C, A> { + ProjectInstanceGetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for an instance resource. Returns an empty + /// policy if an table exists but does not have a policy set. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn instances_tables_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A> { + ProjectInstanceTableGetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about an app profile. + /// + /// # Arguments + /// + /// * `name` - The unique name of the requested app profile. Values are of the form + /// `projects//instances//appProfiles/`. + pub fn instances_app_profiles_get(&self, name: &str) -> ProjectInstanceAppProfileGetCall<'a, C, A> { + ProjectInstanceAppProfileGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Delete an instance from a project. + /// + /// # Arguments + /// + /// * `name` - The unique name of the instance to be deleted. + /// Values are of the form `projects//instances/`. + pub fn instances_delete(&self, name: &str) -> ProjectInstanceDeleteCall<'a, C, A> { + ProjectInstanceDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists information about clusters in an instance. + /// + /// # Arguments + /// + /// * `parent` - The unique name of the instance for which a list of clusters is requested. + /// Values are of the form `projects//instances/`. + /// Use ` = '-'` to list Clusters for all Instances in a project, + /// e.g., `projects/myproject/instances/-`. + pub fn instances_clusters_list(&self, parent: &str) -> ProjectInstanceClusterListCall<'a, C, A> { + ProjectInstanceClusterListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new table in the specified instance. + /// The table can be created with a full set of initial column families, + /// specified in the request. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The unique name of the instance in which to create the table. + /// Values are of the form `projects//instances/`. + pub fn instances_tables_create(&self, request: CreateTableRequest, parent: &str) -> ProjectInstanceTableCreateCall<'a, C, A> { + ProjectInstanceTableCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all tables served from a specified instance. + /// + /// # Arguments + /// + /// * `parent` - The unique name of the instance for which tables should be listed. + /// Values are of the form `projects//instances/`. + pub fn instances_tables_list(&self, parent: &str) -> ProjectInstanceTableListCall<'a, C, A> { + ProjectInstanceTableListCall { + hub: self.hub, + _parent: parent.to_string(), + _view: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a cluster. + /// + /// # Arguments + /// + /// * `name` - The unique name of the requested cluster. Values are of the form + /// `projects//instances//clusters/`. + pub fn instances_clusters_get(&self, name: &str) -> ProjectInstanceClusterGetCall<'a, C, A> { + ProjectInstanceClusterGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Partially updates an instance within a project. This method can modify all + /// fields of an Instance and is the preferred way to update an Instance. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - (`OutputOnly`) + /// The unique name of the instance. Values are of the form + /// `projects//instances/a-z+[a-z0-9]`. + pub fn instances_partial_update_instance(&self, request: Instance, name: &str) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> { + ProjectInstancePartialUpdateInstanceCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about an instance. + /// + /// # Arguments + /// + /// * `name` - The unique name of the requested instance. Values are of the form + /// `projects//instances/`. + pub fn instances_get(&self, name: &str) -> ProjectInstanceGetCall<'a, C, A> { + ProjectInstanceGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an instance within a project. This method updates only the display + /// name and type for an Instance. To update other Instance properties, such as + /// labels, use PartialUpdateInstance. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - (`OutputOnly`) + /// The unique name of the instance. Values are of the form + /// `projects//instances/a-z+[a-z0-9]`. + pub fn instances_update(&self, request: Instance, name: &str) -> ProjectInstanceUpdateCall<'a, C, A> { + ProjectInstanceUpdateCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists information about instances in a project. + /// + /// # Arguments + /// + /// * `parent` - The unique name of the project for which a list of instances is requested. + /// Values are of the form `projects/`. + pub fn instances_list(&self, parent: &str) -> ProjectInstanceListCall<'a, C, A> { + ProjectInstanceListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates an app profile within an instance. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The unique name of the instance in which to create the new app profile. + /// Values are of the form + /// `projects//instances/`. + pub fn instances_app_profiles_create(&self, request: AppProfile, parent: &str) -> ProjectInstanceAppProfileCreateCall<'a, C, A> { + ProjectInstanceAppProfileCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _ignore_warnings: Default::default(), + _app_profile_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Performs a series of column family modifications on the specified table. + /// Either all or none of the modifications will occur before this method + /// returns, but data requests received prior to that point may see a table + /// where only some modifications have taken effect. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The unique name of the table whose families should be modified. + /// Values are of the form + /// `projects//instances//tables/
`. + pub fn instances_tables_modify_column_families(&self, request: ModifyColumnFamiliesRequest, name: &str) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> { + ProjectInstanceTableModifyColumnFamilyCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on a table resource. Replaces any existing + /// policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn instances_tables_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A> { + ProjectInstanceTableSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a cluster from an instance. + /// + /// # Arguments + /// + /// * `name` - The unique name of the cluster to be deleted. Values are of the form + /// `projects//instances//clusters/`. + pub fn instances_clusters_delete(&self, name: &str) -> ProjectInstanceClusterDeleteCall<'a, C, A> { + ProjectInstanceClusterDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that the caller has on the specified instance resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn instances_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectInstanceTestIamPermissionCall<'a, C, A> { + ProjectInstanceTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Permanently deletes a specified table and all of its data. + /// + /// # Arguments + /// + /// * `name` - The unique name of the table to be deleted. + /// Values are of the form + /// `projects//instances//tables/
`. + pub fn instances_tables_delete(&self, name: &str) -> ProjectInstanceTableDeleteCall<'a, C, A> { + ProjectInstanceTableDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that the caller has on the specified table resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn instances_tables_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A> { + ProjectInstanceTableTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Lists operations that match the specified filter in the request. If the +/// server doesn't support this method, it returns `UNIMPLEMENTED`. +/// +/// NOTE: the `name` binding allows API services to override the binding +/// to use different resource name schemes, such as `users/*/operations`. To +/// override the binding, API services can add a binding such as +/// `"/v1/{name=users/*}/operations"` to their service configuration. +/// For backwards compatibility, the default name includes the operations +/// collection id, however overriding users must ensure the name binding +/// is the parent resource, without the operations collection id. +/// +/// A builder for the *projects.operations.list* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().projects_operations_list("name") +/// .page_token("sea") +/// .page_size(-90) +/// .filter("dolores") +/// .doit(); +/// # } +/// ``` +pub struct OperationProjectOperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationProjectOperationListCall<'a, C, A> {} + +impl<'a, C, A> OperationProjectOperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.operations.projects.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}/operations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation's parent resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationProjectOperationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OperationProjectOperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OperationProjectOperationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> OperationProjectOperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationProjectOperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationProjectOperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationProjectOperationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a long-running operation. This method indicates that the client is +/// no longer interested in the operation result. It does not cancel the +/// operation. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. +/// +/// A builder for the *delete* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().delete("name") +/// .doit(); +/// # } +/// ``` +pub struct OperationDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationDeleteCall<'a, C, A> {} + +impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.operations.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource to be deleted. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *get* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().get("name") +/// .doit(); +/// # } +/// ``` +pub struct OperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {} + +impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Starts asynchronous cancellation on a long-running operation. The server +/// makes a best effort to cancel the operation, but success is not +/// guaranteed. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. Clients can use +/// Operations.GetOperation or +/// other methods to check whether the cancellation succeeded or whether the +/// operation completed despite cancellation. On successful cancellation, +/// the operation is not deleted; instead, it becomes an operation with +/// an Operation.error value with a google.rpc.Status.code of 1, +/// corresponding to `Code.CANCELLED`. +/// +/// A builder for the *cancel* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().cancel("name") +/// .doit(); +/// # } +/// ``` +pub struct OperationCancelCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationCancelCall<'a, C, A> {} + +impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.operations.cancel", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:cancel"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource to be cancelled. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationCancelCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationCancelCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationCancelCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Generates a consistency token for a Table, which can be used in +/// CheckConsistency to check whether mutations to the table that finished +/// before this call started have been replicated. The tokens will be available +/// for 90 days. +/// +/// A builder for the *instances.tables.generateConsistencyToken* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::GenerateConsistencyTokenRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GenerateConsistencyTokenRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_generate_consistency_token(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: GenerateConsistencyTokenRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GenerateConsistencyTokenResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.generateConsistencyToken", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:generateConsistencyToken"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GenerateConsistencyTokenRequest) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique name of the Table for which to create a consistency token. + /// Values are of the form + /// `projects//instances//tables/
`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableGenerateConsistencyTokenCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Permanently drop/delete a row range from a specified table. The request can +/// specify whether to delete all rows in a table, or only those that match a +/// particular prefix. +/// +/// A builder for the *instances.tables.dropRowRange* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::DropRowRangeRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DropRowRangeRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_drop_row_range(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableDropRowRangeCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: DropRowRangeRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableDropRowRangeCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableDropRowRangeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.dropRowRange", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:dropRowRange"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DropRowRangeRequest) -> ProjectInstanceTableDropRowRangeCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique name of the table on which to drop a range of rows. + /// Values are of the form + /// `projects//instances//tables/
`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceTableDropRowRangeCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableDropRowRangeCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableDropRowRangeCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableDropRowRangeCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an app profile from an instance. +/// +/// A builder for the *instances.appProfiles.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_app_profiles_delete("name") +/// .ignore_warnings(true) +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceAppProfileDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _ignore_warnings: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceAppProfileDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceAppProfileDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.appProfiles.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._ignore_warnings { + params.push(("ignoreWarnings", value.to_string())); + } + for &field in ["alt", "name", "ignoreWarnings"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the app profile to be deleted. Values are of the form + /// `projects//instances//appProfiles/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceAppProfileDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// If true, ignore safety checks when deleting the app profile. + /// + /// Sets the *ignore warnings* query property to the given value. + pub fn ignore_warnings(mut self, new_value: bool) -> ProjectInstanceAppProfileDeleteCall<'a, C, A> { + self._ignore_warnings = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceAppProfileDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceAppProfileDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceAppProfileDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Create an instance within a project. +/// +/// A builder for the *instances.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::CreateInstanceRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreateInstanceRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: CreateInstanceRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/instances"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreateInstanceRequest) -> ProjectInstanceCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique name of the project in which to create the new instance. + /// Values are of the form `projects/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectInstanceCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a cluster within an instance. +/// +/// A builder for the *instances.clusters.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::Cluster; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Cluster::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_clusters_create(req, "parent") +/// .cluster_id("diam") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceClusterCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: Cluster, + _parent: String, + _cluster_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceClusterCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceClusterCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.clusters.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._cluster_id { + params.push(("clusterId", value.to_string())); + } + for &field in ["alt", "parent", "clusterId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/clusters"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Cluster) -> ProjectInstanceClusterCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique name of the instance in which to create the new cluster. + /// Values are of the form + /// `projects//instances/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectInstanceClusterCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The ID to be used when referring to the new cluster within its instance, + /// e.g., just `mycluster` rather than + /// `projects/myproject/instances/myinstance/clusters/mycluster`. + /// + /// Sets the *cluster id* query property to the given value. + pub fn cluster_id(mut self, new_value: &str) -> ProjectInstanceClusterCreateCall<'a, C, A> { + self._cluster_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceClusterCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceClusterCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceClusterCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets metadata information about the specified table. +/// +/// A builder for the *instances.tables.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_get("name") +/// .view("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _view: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Table)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._view { + params.push(("view", value.to_string())); + } + for &field in ["alt", "name", "view"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the requested table. + /// Values are of the form + /// `projects//instances//tables/
`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceTableGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The view to be applied to the returned table's fields. + /// Defaults to `SCHEMA_VIEW` if unspecified. + /// + /// Sets the *view* query property to the given value. + pub fn view(mut self, new_value: &str) -> ProjectInstanceTableGetCall<'a, C, A> { + self._view = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an app profile within an instance. +/// +/// A builder for the *instances.appProfiles.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::AppProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AppProfile::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_app_profiles_patch(req, "name") +/// .update_mask("duo") +/// .ignore_warnings(true) +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceAppProfilePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: AppProfile, + _name: String, + _update_mask: Option, + _ignore_warnings: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceAppProfilePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceAppProfilePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.appProfiles.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + if let Some(value) = self._ignore_warnings { + params.push(("ignoreWarnings", value.to_string())); + } + for &field in ["alt", "name", "updateMask", "ignoreWarnings"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AppProfile) -> ProjectInstanceAppProfilePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// (`OutputOnly`) + /// The unique name of the app profile. Values are of the form + /// `projects//instances//appProfiles/_a-zA-Z0-9*`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceAppProfilePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The subset of app profile fields which should be replaced. + /// If unset, all fields will be replaced. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectInstanceAppProfilePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// If true, ignore safety checks when updating the app profile. + /// + /// Sets the *ignore warnings* query property to the given value. + pub fn ignore_warnings(mut self, new_value: bool) -> ProjectInstanceAppProfilePatchCall<'a, C, A> { + self._ignore_warnings = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceAppProfilePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceAppProfilePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceAppProfilePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists information about app profiles in an instance. +/// +/// A builder for the *instances.appProfiles.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_app_profiles_list("parent") +/// .page_token("Lorem") +/// .page_size(-75) +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceAppProfileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceAppProfileListCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceAppProfileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListAppProfilesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.appProfiles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/appProfiles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the instance for which a list of app profiles is + /// requested. Values are of the form + /// `projects//instances/`. + /// Use ` = '-'` to list AppProfiles for all Instances in a project, + /// e.g., `projects/myproject/instances/-`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectInstanceAppProfileListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The value of `next_page_token` returned by a previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectInstanceAppProfileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results per page. + /// CURRENTLY UNIMPLEMENTED AND IGNORED. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectInstanceAppProfileListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceAppProfileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceAppProfileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceAppProfileListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a cluster within an instance. +/// +/// A builder for the *instances.clusters.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::Cluster; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Cluster::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_clusters_update(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceClusterUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: Cluster, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceClusterUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceClusterUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.clusters.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Cluster) -> ProjectInstanceClusterUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// (`OutputOnly`) + /// The unique name of the cluster. Values are of the form + /// `projects//instances//clusters/a-z*`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceClusterUpdateCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceClusterUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceClusterUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceClusterUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on an instance resource. Replaces any +/// existing policy. +/// +/// A builder for the *instances.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectInstanceSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectInstanceSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Checks replication consistency based on a consistency token, that is, if +/// replication has caught up based on the conditions specified in the token +/// and the check request. +/// +/// A builder for the *instances.tables.checkConsistency* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::CheckConsistencyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CheckConsistencyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_check_consistency(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableCheckConsistencyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: CheckConsistencyRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableCheckConsistencyCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableCheckConsistencyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CheckConsistencyResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.checkConsistency", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:checkConsistency"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CheckConsistencyRequest) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique name of the Table for which to check replication consistency. + /// Values are of the form + /// `projects//instances//tables/
`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableCheckConsistencyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy for an instance resource. Returns an empty +/// policy if an instance exists but does not have a policy set. +/// +/// A builder for the *instances.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::GetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_get_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: GetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.getIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectInstanceGetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectInstanceGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy for an instance resource. Returns an empty +/// policy if an table exists but does not have a policy set. +/// +/// A builder for the *instances.tables.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::GetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_get_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: GetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.getIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information about an app profile. +/// +/// A builder for the *instances.appProfiles.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_app_profiles_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceAppProfileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceAppProfileGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceAppProfileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AppProfile)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.appProfiles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the requested app profile. Values are of the form + /// `projects//instances//appProfiles/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceAppProfileGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceAppProfileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceAppProfileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceAppProfileGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Delete an instance from a project. +/// +/// A builder for the *instances.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the instance to be deleted. + /// Values are of the form `projects//instances/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists information about clusters in an instance. +/// +/// A builder for the *instances.clusters.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_clusters_list("parent") +/// .page_token("eirmod") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceClusterListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _parent: String, + _page_token: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceClusterListCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceClusterListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListClustersResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.clusters.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + for &field in ["alt", "parent", "pageToken"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/clusters"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the instance for which a list of clusters is requested. + /// Values are of the form `projects//instances/`. + /// Use ` = '-'` to list Clusters for all Instances in a project, + /// e.g., `projects/myproject/instances/-`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectInstanceClusterListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// DEPRECATED: This field is unused and ignored. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectInstanceClusterListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceClusterListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceClusterListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceClusterListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new table in the specified instance. +/// The table can be created with a full set of initial column families, +/// specified in the request. +/// +/// A builder for the *instances.tables.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::CreateTableRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreateTableRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: CreateTableRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Table)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/tables"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreateTableRequest) -> ProjectInstanceTableCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique name of the instance in which to create the table. + /// Values are of the form `projects//instances/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectInstanceTableCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all tables served from a specified instance. +/// +/// A builder for the *instances.tables.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_list("parent") +/// .view("aliquyam") +/// .page_token("accusam") +/// .page_size(-56) +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _parent: String, + _view: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableListCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListTablesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._view { + params.push(("view", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "view", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/tables"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the instance for which tables should be listed. + /// Values are of the form `projects//instances/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectInstanceTableListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The view to be applied to the returned tables' fields. + /// Defaults to `NAME_ONLY` if unspecified; no others are currently supported. + /// + /// Sets the *view* query property to the given value. + pub fn view(mut self, new_value: &str) -> ProjectInstanceTableListCall<'a, C, A> { + self._view = Some(new_value.to_string()); + self + } + /// The value of `next_page_token` returned by a previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectInstanceTableListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results per page. + /// CURRENTLY UNIMPLEMENTED AND IGNORED. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectInstanceTableListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information about a cluster. +/// +/// A builder for the *instances.clusters.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_clusters_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceClusterGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceClusterGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceClusterGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Cluster)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.clusters.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the requested cluster. Values are of the form + /// `projects//instances//clusters/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceClusterGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceClusterGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceClusterGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceClusterGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Partially updates an instance within a project. This method can modify all +/// fields of an Instance and is the preferred way to update an Instance. +/// +/// A builder for the *instances.partialUpdateInstance* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::Instance; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Instance::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_partial_update_instance(req, "name") +/// .update_mask("duo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstancePartialUpdateInstanceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: Instance, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstancePartialUpdateInstanceCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstancePartialUpdateInstanceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.partialUpdateInstance", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Instance) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> { + self._request = new_value; + self + } + /// (`OutputOnly`) + /// The unique name of the instance. Values are of the form + /// `projects//instances/a-z+[a-z0-9]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The subset of Instance fields which should be replaced. + /// Must be explicitly set. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstancePartialUpdateInstanceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information about an instance. +/// +/// A builder for the *instances.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Instance)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the requested instance. Values are of the form + /// `projects//instances/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an instance within a project. This method updates only the display +/// name and type for an Instance. To update other Instance properties, such as +/// labels, use PartialUpdateInstance. +/// +/// A builder for the *instances.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::Instance; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Instance::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_update(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: Instance, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Instance)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Instance) -> ProjectInstanceUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// (`OutputOnly`) + /// The unique name of the instance. Values are of the form + /// `projects//instances/a-z+[a-z0-9]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceUpdateCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists information about instances in a project. +/// +/// A builder for the *instances.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_list("parent") +/// .page_token("et") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _parent: String, + _page_token: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceListCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListInstancesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + for &field in ["alt", "parent", "pageToken"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/instances"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the project for which a list of instances is requested. + /// Values are of the form `projects/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectInstanceListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// DEPRECATED: This field is unused and ignored. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectInstanceListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates an app profile within an instance. +/// +/// A builder for the *instances.appProfiles.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::AppProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AppProfile::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_app_profiles_create(req, "parent") +/// .ignore_warnings(true) +/// .app_profile_id("consetetur") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceAppProfileCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: AppProfile, + _parent: String, + _ignore_warnings: Option, + _app_profile_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceAppProfileCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceAppProfileCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AppProfile)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.appProfiles.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._ignore_warnings { + params.push(("ignoreWarnings", value.to_string())); + } + if let Some(value) = self._app_profile_id { + params.push(("appProfileId", value.to_string())); + } + for &field in ["alt", "parent", "ignoreWarnings", "appProfileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/appProfiles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AppProfile) -> ProjectInstanceAppProfileCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique name of the instance in which to create the new app profile. + /// Values are of the form + /// `projects//instances/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectInstanceAppProfileCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// If true, ignore safety checks when creating the app profile. + /// + /// Sets the *ignore warnings* query property to the given value. + pub fn ignore_warnings(mut self, new_value: bool) -> ProjectInstanceAppProfileCreateCall<'a, C, A> { + self._ignore_warnings = Some(new_value); + self + } + /// The ID to be used when referring to the new app profile within its + /// instance, e.g., just `myprofile` rather than + /// `projects/myproject/instances/myinstance/appProfiles/myprofile`. + /// + /// Sets the *app profile id* query property to the given value. + pub fn app_profile_id(mut self, new_value: &str) -> ProjectInstanceAppProfileCreateCall<'a, C, A> { + self._app_profile_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceAppProfileCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceAppProfileCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceAppProfileCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Performs a series of column family modifications on the specified table. +/// Either all or none of the modifications will occur before this method +/// returns, but data requests received prior to that point may see a table +/// where only some modifications have taken effect. +/// +/// A builder for the *instances.tables.modifyColumnFamilies* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::ModifyColumnFamiliesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ModifyColumnFamiliesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_modify_column_families(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: ModifyColumnFamiliesRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Table)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.modifyColumnFamilies", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:modifyColumnFamilies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ModifyColumnFamiliesRequest) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique name of the table whose families should be modified. + /// Values are of the form + /// `projects//instances//tables/
`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableModifyColumnFamilyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on a table resource. Replaces any existing +/// policy. +/// +/// A builder for the *instances.tables.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a cluster from an instance. +/// +/// A builder for the *instances.clusters.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_clusters_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceClusterDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceClusterDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceClusterDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.clusters.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the cluster to be deleted. Values are of the form + /// `projects//instances//clusters/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceClusterDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceClusterDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceClusterDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceClusterDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that the caller has on the specified instance resource. +/// +/// A builder for the *instances.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectInstanceTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectInstanceTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Permanently deletes a specified table and all of its data. +/// +/// A builder for the *instances.tables.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique name of the table to be deleted. + /// Values are of the form + /// `projects//instances//tables/
`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectInstanceTableDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that the caller has on the specified table resource. +/// +/// A builder for the *instances.tables.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_bigtableadmin2 as bigtableadmin2; +/// use bigtableadmin2::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use bigtableadmin2::BigtableAdmin; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = BigtableAdmin::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_tables_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceTableTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a BigtableAdmin, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceTableTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceTableTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "bigtableadmin.projects.instances.tables.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::BigtableAdmin.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::BigtableAdmin`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceTableTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/binaryauthorization1_beta1-cli/Cargo.toml b/gen/binaryauthorization1_beta1-cli/Cargo.toml index 09c6da1f70..12b8c8982f 100644 --- a/gen/binaryauthorization1_beta1-cli/Cargo.toml +++ b/gen/binaryauthorization1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-binaryauthorization1_beta1-cli" -version = "1.0.8+20181005" +version = "1.0.8+20190322" authors = ["Sebastian Thiel "] description = "A complete library to interact with Binary Authorization (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/binaryauthorization1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-binaryauthorization1_beta1] path = "../binaryauthorization1_beta1" -version = "1.0.8+20181005" +version = "1.0.8+20190322" diff --git a/gen/binaryauthorization1_beta1-cli/README.md b/gen/binaryauthorization1_beta1-cli/README.md index 637ab7d80d..e6b83ceb04 100644 --- a/gen/binaryauthorization1_beta1-cli/README.md +++ b/gen/binaryauthorization1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Binary Authorization* API at revision *20181005*. The CLI is at version *1.0.8*. +This documentation was generated from the *Binary Authorization* API at revision *20190322*. The CLI is at version *1.0.8*. ```bash binaryauthorization1-beta1 [options] diff --git a/gen/binaryauthorization1_beta1-cli/mkdocs.yml b/gen/binaryauthorization1_beta1-cli/mkdocs.yml index e24ea14f68..b004a51cbd 100644 --- a/gen/binaryauthorization1_beta1-cli/mkdocs.yml +++ b/gen/binaryauthorization1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Binary Authorization v1.0.8+20181005 +site_name: Binary Authorization v1.0.8+20190322 site_url: http://byron.github.io/google-apis-rs/google-binaryauthorization1_beta1-cli site_description: A complete library to interact with Binary Authorization (protocol v1beta1) diff --git a/gen/binaryauthorization1_beta1-cli/src/main.rs b/gen/binaryauthorization1_beta1-cli/src/main.rs index 3acbc7bf24..d71758ae64 100644 --- a/gen/binaryauthorization1_beta1-cli/src/main.rs +++ b/gen/binaryauthorization1_beta1-cli/src/main.rs @@ -70,10 +70,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-owned-drydock-note.delegation-service-account-email" => Some(("userOwnedDrydockNote.delegationServiceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-owned-drydock-note.note-reference" => Some(("userOwnedDrydockNote.noteReference", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["delegation-service-account-email", "description", "name", "note-reference", "update-time", "user-owned-drydock-note"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -549,10 +549,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-owned-drydock-note.delegation-service-account-email" => Some(("userOwnedDrydockNote.delegationServiceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-owned-drydock-note.note-reference" => Some(("userOwnedDrydockNote.noteReference", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["delegation-service-account-email", "description", "name", "note-reference", "update-time", "user-owned-drydock-note"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -917,9 +917,10 @@ impl<'n> Engine<'n> { "default-admission-rule.require-attestations-by" => Some(("defaultAdmissionRule.requireAttestationsBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "default-admission-rule.evaluation-mode" => Some(("defaultAdmissionRule.evaluationMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "global-policy-evaluation-mode" => Some(("globalPolicyEvaluationMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["default-admission-rule", "description", "enforcement-mode", "evaluation-mode", "name", "require-attestations-by", "update-time"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["default-admission-rule", "description", "enforcement-mode", "evaluation-mode", "global-policy-evaluation-mode", "name", "require-attestations-by", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1493,7 +1494,7 @@ fn main() { let mut app = App::new("binaryauthorization1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181005") + .version("1.0.8+20190322") .about("The management interface for Binary Authorization, a system providing policy control for images deployed to Kubernetes Engine clusters. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_binaryauthorization1_beta1_cli") diff --git a/gen/binaryauthorization1_beta1/Cargo.toml b/gen/binaryauthorization1_beta1/Cargo.toml index a88a680e99..20a6cec459 100644 --- a/gen/binaryauthorization1_beta1/Cargo.toml +++ b/gen/binaryauthorization1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-binaryauthorization1_beta1" -version = "1.0.8+20181005" +version = "1.0.8+20190322" authors = ["Sebastian Thiel "] description = "A complete library to interact with Binary Authorization (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/binaryauthorization1_beta1" homepage = "https://cloud.google.com/binary-authorization/" -documentation = "https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005" +documentation = "https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322" license = "MIT" keywords = ["binaryauthorization", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/binaryauthorization1_beta1/README.md b/gen/binaryauthorization1_beta1/README.md index 174b0d59ec..73ea092eba 100644 --- a/gen/binaryauthorization1_beta1/README.md +++ b/gen/binaryauthorization1_beta1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-binaryauthorization1_beta1` library allows access to all features of the *Google Binary Authorization* service. -This documentation was generated from *Binary Authorization* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *binaryauthorization:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Binary Authorization* crate version *1.0.8+20190322*, where *20190322* is the exact revision of the *binaryauthorization:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Binary Authorization* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/binary-authorization/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.BinaryAuthorization.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.BinaryAuthorization.html) ... * projects - * [*attestors create*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectAttestorCreateCall.html), [*attestors delete*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectAttestorDeleteCall.html), [*attestors get*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectAttestorGetCall.html), [*attestors get iam policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectAttestorGetIamPolicyCall.html), [*attestors list*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectAttestorListCall.html), [*attestors set iam policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectAttestorSetIamPolicyCall.html), [*attestors test iam permissions*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectAttestorTestIamPermissionCall.html), [*attestors update*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectAttestorUpdateCall.html), [*get policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectGetPolicyCall.html), [*policy get iam policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectPolicyGetIamPolicyCall.html), [*policy set iam policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectPolicySetIamPolicyCall.html), [*policy test iam permissions*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectPolicyTestIamPermissionCall.html) and [*update policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.ProjectUpdatePolicyCall.html) + * [*attestors create*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectAttestorCreateCall.html), [*attestors delete*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectAttestorDeleteCall.html), [*attestors get*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectAttestorGetCall.html), [*attestors get iam policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectAttestorGetIamPolicyCall.html), [*attestors list*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectAttestorListCall.html), [*attestors set iam policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectAttestorSetIamPolicyCall.html), [*attestors test iam permissions*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectAttestorTestIamPermissionCall.html), [*attestors update*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectAttestorUpdateCall.html), [*get policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectGetPolicyCall.html), [*policy get iam policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectPolicyGetIamPolicyCall.html), [*policy set iam policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectPolicySetIamPolicyCall.html), [*policy test iam permissions*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectPolicyTestIamPermissionCall.html) and [*update policy*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.ProjectUpdatePolicyCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/struct.BinaryAuthorization.html)** +* **[Hub](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/struct.BinaryAuthorization.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20181005/google_binaryauthorization1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-binaryauthorization1_beta1/1.0.8+20190322/google_binaryauthorization1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/binaryauthorization1_beta1/src/lib.rs b/gen/binaryauthorization1_beta1/src/lib.rs index 9f44ff4cef..b5ba72f1c9 100644 --- a/gen/binaryauthorization1_beta1/src/lib.rs +++ b/gen/binaryauthorization1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Binary Authorization* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *binaryauthorization:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Binary Authorization* crate version *1.0.8+20190322*, where *20190322* is the exact revision of the *binaryauthorization:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Binary Authorization* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/binary-authorization/). @@ -393,26 +393,29 @@ pub struct TestIamPermissionsResponse { impl ResponseResult for TestIamPermissionsResponse {} -/// Request message for `TestIamPermissions` method. +/// A public key in the PkixPublicKey format (see +/// https://tools.ietf.org/html/rfc5280#section-4.1.2.7 for details). +/// Public keys of this type are typically textually encoded using the PEM +/// format. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [attestors test iam permissions projects](struct.ProjectAttestorTestIamPermissionCall.html) (request) -/// * [policy test iam permissions projects](struct.ProjectPolicyTestIamPermissionCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TestIamPermissionsRequest { - /// The set of permissions to check for the `resource`. Permissions with - /// wildcards (such as '*' or 'storage.*') are not allowed. For more - /// information see - /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - pub permissions: Option>, +pub struct PkixPublicKey { + /// A PEM-encoded public key, as described in + /// https://tools.ietf.org/html/rfc7468#section-13 + #[serde(rename="publicKeyPem")] + pub public_key_pem: Option, + /// The signature algorithm used to verify a message against a signature using + /// this key. + /// These signature algorithm must match the structure and any object + /// identifiers encoded in `public_key_pem` (i.e. this algorithm must match + /// that of the public key). + #[serde(rename="signatureAlgorithm")] + pub signature_algorithm: Option, } -impl RequestValue for TestIamPermissionsRequest {} +impl Part for PkixPublicKey {} /// Request message for `SetIamPolicy` method. @@ -480,22 +483,22 @@ impl Part for AdmissionRule {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// /// The application context of the containing message determines which /// well-known feature set of CEL is supported. pub expression: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} @@ -510,6 +513,11 @@ pub struct Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, /// Specifies the identities requesting access for a Cloud Platform resource. /// `members` can have the following values: /// @@ -530,181 +538,16 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// pub members: Option>, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, } impl Part for Binding {} -/// A policy for container image binary authorization. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get policy projects](struct.ProjectGetPolicyCall.html) (response) -/// * [update policy projects](struct.ProjectUpdatePolicyCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Policy { - /// Output only. Time when the policy was last updated. - #[serde(rename="updateTime")] - pub update_time: Option, - /// Output only. The resource name, in the format `projects/*/policy`. There is - /// at most one policy per project. - pub name: Option, - /// Optional. A descriptive comment. - pub description: Option, - /// Required. Default admission rule for a cluster without a per-cluster - /// admission rule. - #[serde(rename="defaultAdmissionRule")] - pub default_admission_rule: Option, - /// Optional. Admission policy whitelisting. A matching admission request will - /// always be permitted. This feature is typically used to exclude Google or - /// third-party infrastructure images from Binary Authorization policies. - #[serde(rename="admissionWhitelistPatterns")] - pub admission_whitelist_patterns: Option>, - /// Optional. Per-cluster admission rules. Cluster spec format: - /// `location.clusterId`. There can be at most one admission rule per cluster - /// spec. - /// A `location` is either a compute zone (e.g. us-central1-a) or a region - /// (e.g. us-central1). - /// For `clusterId` syntax restrictions see - /// https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters. - #[serde(rename="clusterAdmissionRules")] - pub cluster_admission_rules: Option>, -} - -impl RequestValue for Policy {} -impl ResponseResult for Policy {} - - -/// An attestor that attests to container image -/// artifacts. An existing attestor cannot be modified except where -/// indicated. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [attestors update projects](struct.ProjectAttestorUpdateCall.html) (request|response) -/// * [attestors create projects](struct.ProjectAttestorCreateCall.html) (request|response) -/// * [attestors get projects](struct.ProjectAttestorGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Attestor { - /// Output only. Time when the attestor was last updated. - #[serde(rename="updateTime")] - pub update_time: Option, - /// Required. The resource name, in the format: - /// `projects/*/attestors/*`. This field may not be updated. - pub name: Option, - /// A Drydock ATTESTATION_AUTHORITY Note, created by the user. - #[serde(rename="userOwnedDrydockNote")] - pub user_owned_drydock_note: Option, - /// Optional. A descriptive comment. This field may be updated. - /// The field may be displayed in chooser dialogs. - pub description: Option, -} - -impl RequestValue for Attestor {} -impl ResponseResult for Attestor {} - - -/// An admission whitelist pattern exempts images -/// from checks by admission rules. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AdmissionWhitelistPattern { - /// An image name pattern to whitelist, in the form `registry/path/to/image`. - /// This supports a trailing `*` as a wildcard, but this is allowed only in - /// text after the `registry/` part. - #[serde(rename="namePattern")] - pub name_pattern: Option, -} - -impl Part for AdmissionWhitelistPattern {} - - -/// An user owned drydock note references a Drydock -/// ATTESTATION_AUTHORITY Note created by the user. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UserOwnedDrydockNote { - /// Optional. Public keys that verify attestations signed by this - /// attestor. This field may be updated. - /// - /// If this field is non-empty, one of the specified public keys must - /// verify that an attestation was signed by this attestor for the - /// image specified in the admission request. - /// - /// If this field is empty, this attestor always returns that no - /// valid attestations exist. - #[serde(rename="publicKeys")] - pub public_keys: Option>, - /// Required. The Drydock resource name of a ATTESTATION_AUTHORITY Note, - /// created by the user, in the format: `projects/*/notes/*` (or the legacy - /// `providers/*/notes/*`). This field may not be updated. - /// - /// An attestation by this attestor is stored as a Drydock - /// ATTESTATION_AUTHORITY Occurrence that names a container image and that - /// links to this Note. Drydock is an external dependency. - #[serde(rename="noteReference")] - pub note_reference: Option, - /// Output only. This field will contain the service account email address - /// that this Attestor will use as the principal when querying Container - /// Analysis. Attestor administrators must grant this service account the - /// IAM role needed to read attestations from the note_reference in - /// Container Analysis (`containeranalysis.notes.occurrences.viewer`). - /// - /// This email address is fixed for the lifetime of the Attestor, but callers - /// should not make any other assumptions about the service account email; - /// future versions may use an email based on a different naming pattern. - #[serde(rename="delegationServiceAccountEmail")] - pub delegation_service_account_email: Option, -} - -impl Part for UserOwnedDrydockNote {} - - -/// Response message for BinauthzManagementService.ListAttestors. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [attestors list projects](struct.ProjectAttestorListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListAttestorsResponse { - /// A token to retrieve the next page of results. Pass this value in the - /// ListAttestorsRequest.page_token field in the subsequent call to the - /// `ListAttestors` method to retrieve the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of attestors. - pub attestors: Option>, -} - -impl ResponseResult for ListAttestorsResponse {} - - /// Defines an Identity and Access Management (IAM) policy. It is used to /// specify access control policies for Cloud Platform resources. /// @@ -784,6 +627,212 @@ pub struct IamPolicy { impl ResponseResult for IamPolicy {} +/// An attestor that attests to container image +/// artifacts. An existing attestor cannot be modified except where +/// indicated. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [attestors update projects](struct.ProjectAttestorUpdateCall.html) (request|response) +/// * [attestors create projects](struct.ProjectAttestorCreateCall.html) (request|response) +/// * [attestors get projects](struct.ProjectAttestorGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Attestor { + /// Output only. Time when the attestor was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Optional. A descriptive comment. This field may be updated. + /// The field may be displayed in chooser dialogs. + pub description: Option, + /// A Drydock ATTESTATION_AUTHORITY Note, created by the user. + #[serde(rename="userOwnedDrydockNote")] + pub user_owned_drydock_note: Option, + /// Required. The resource name, in the format: + /// `projects/*/attestors/*`. This field may not be updated. + pub name: Option, +} + +impl RequestValue for Attestor {} +impl ResponseResult for Attestor {} + + +/// An admission whitelist pattern exempts images +/// from checks by admission rules. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdmissionWhitelistPattern { + /// An image name pattern to whitelist, in the form `registry/path/to/image`. + /// This supports a trailing `*` as a wildcard, but this is allowed only in + /// text after the `registry/` part. + #[serde(rename="namePattern")] + pub name_pattern: Option, +} + +impl Part for AdmissionWhitelistPattern {} + + +/// An user owned drydock note references a Drydock +/// ATTESTATION_AUTHORITY Note created by the user. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserOwnedDrydockNote { + /// Output only. This field will contain the service account email address + /// that this Attestor will use as the principal when querying Container + /// Analysis. Attestor administrators must grant this service account the + /// IAM role needed to read attestations from the note_reference in + /// Container Analysis (`containeranalysis.notes.occurrences.viewer`). + /// + /// This email address is fixed for the lifetime of the Attestor, but callers + /// should not make any other assumptions about the service account email; + /// future versions may use an email based on a different naming pattern. + #[serde(rename="delegationServiceAccountEmail")] + pub delegation_service_account_email: Option, + /// Required. The Drydock resource name of a ATTESTATION_AUTHORITY Note, + /// created by the user, in the format: `projects/*/notes/*` (or the legacy + /// `providers/*/notes/*`). This field may not be updated. + /// + /// An attestation by this attestor is stored as a Drydock + /// ATTESTATION_AUTHORITY Occurrence that names a container image and that + /// links to this Note. Drydock is an external dependency. + #[serde(rename="noteReference")] + pub note_reference: Option, + /// Optional. Public keys that verify attestations signed by this + /// attestor. This field may be updated. + /// + /// If this field is non-empty, one of the specified public keys must + /// verify that an attestation was signed by this attestor for the + /// image specified in the admission request. + /// + /// If this field is empty, this attestor always returns that no + /// valid attestations exist. + #[serde(rename="publicKeys")] + pub public_keys: Option>, +} + +impl Part for UserOwnedDrydockNote {} + + +/// Response message for BinauthzManagementService.ListAttestors. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [attestors list projects](struct.ProjectAttestorListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListAttestorsResponse { + /// A token to retrieve the next page of results. Pass this value in the + /// ListAttestorsRequest.page_token field in the subsequent call to the + /// `ListAttestors` method to retrieve the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of attestors. + pub attestors: Option>, +} + +impl ResponseResult for ListAttestorsResponse {} + + +/// A policy for container image binary authorization. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get policy projects](struct.ProjectGetPolicyCall.html) (response) +/// * [update policy projects](struct.ProjectUpdatePolicyCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Output only. Time when the policy was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Output only. The resource name, in the format `projects/*/policy`. There is + /// at most one policy per project. + pub name: Option, + /// Optional. Controls the evaluation of a Google-maintained global admission + /// policy for common system-level images. Images not covered by the global + /// policy will be subject to the project admission policy. This setting + /// has no effect when specified inside a global admission policy. + #[serde(rename="globalPolicyEvaluationMode")] + pub global_policy_evaluation_mode: Option, + /// Optional. A descriptive comment. + pub description: Option, + /// Required. Default admission rule for a cluster without a per-cluster, per- + /// kubernetes-service-account, or per-istio-service-identity admission rule. + #[serde(rename="defaultAdmissionRule")] + pub default_admission_rule: Option, + /// Optional. Admission policy whitelisting. A matching admission request will + /// always be permitted. This feature is typically used to exclude Google or + /// third-party infrastructure images from Binary Authorization policies. + #[serde(rename="admissionWhitelistPatterns")] + pub admission_whitelist_patterns: Option>, + /// Optional. Per-cluster admission rules. Cluster spec format: + /// `location.clusterId`. There can be at most one admission rule per cluster + /// spec. + /// A `location` is either a compute zone (e.g. us-central1-a) or a region + /// (e.g. us-central1). + /// For `clusterId` syntax restrictions see + /// https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters. + #[serde(rename="clusterAdmissionRules")] + pub cluster_admission_rules: Option>, +} + +impl RequestValue for Policy {} +impl ResponseResult for Policy {} + + +/// An attestor public key that will be used to verify +/// attestations signed by this attestor. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AttestorPublicKey { + /// Optional. A descriptive comment. This field may be updated. + pub comment: Option, + /// ASCII-armored representation of a PGP public key, as the entire output by + /// the command `gpg --export --armor foo@example.com` (either LF or CRLF + /// line endings). + /// When using this field, `id` should be left blank. The BinAuthz API + /// handlers will calculate the ID and fill it in automatically. BinAuthz + /// computes this ID as the OpenPGP RFC4880 V4 fingerprint, represented as + /// upper-case hex. If `id` is provided by the caller, it will be + /// overwritten by the API-calculated ID. + #[serde(rename="asciiArmoredPgpPublicKey")] + pub ascii_armored_pgp_public_key: Option, + /// The ID of this public key. + /// Signatures verified by BinAuthz must include the ID of the public key that + /// can be used to verify them, and that ID must match the contents of this + /// field exactly. + /// Additional restrictions on this field can be imposed based on which public + /// key type is encapsulated. See the documentation on `public_key` cases below + /// for details. + pub id: Option, + /// A raw PKIX SubjectPublicKeyInfo format public key. + /// + /// NOTE: `id` may be explicitly provided by the caller when using this + /// type of public key, but it MUST be a valid RFC3986 URI. If `id` is left + /// blank, a default one will be computed based on the digest of the DER + /// encoding of the public key. + #[serde(rename="pkixPublicKey")] + pub pkix_public_key: Option, +} + +impl Part for AttestorPublicKey {} + + /// A generic empty message that you can re-use to avoid defining duplicated /// empty messages in your APIs. A typical example is to use it as the request /// or the response type of an API method. For instance: @@ -807,27 +856,26 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// An attestator public key that will be used to -/// verify attestations signed by this attestor. +/// Request message for `TestIamPermissions` method. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [attestors test iam permissions projects](struct.ProjectAttestorTestIamPermissionCall.html) (request) +/// * [policy test iam permissions projects](struct.ProjectPolicyTestIamPermissionCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AttestorPublicKey { - /// Optional. A descriptive comment. This field may be updated. - pub comment: Option, - /// ASCII-armored representation of a PGP public key, as the entire output by - /// the command `gpg --export --armor foo@example.com` (either LF or CRLF - /// line endings). - #[serde(rename="asciiArmoredPgpPublicKey")] - pub ascii_armored_pgp_public_key: Option, - /// Output only. This field will be overwritten with key ID information, for - /// example, an identifier extracted from a PGP public key. This field may not - /// be updated. - pub id: Option, +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, } -impl Part for AttestorPublicKey {} +impl RequestValue for TestIamPermissionsRequest {} @@ -1260,7 +1308,7 @@ impl<'a, C, A> ProjectAttestorListCall<'a, C, A> where C: BorrowMut ProjectAttestorListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1299,7 +1344,7 @@ impl<'a, C, A> ProjectAttestorListCall<'a, C, A> where C: BorrowMut ProjectAttestorListCall<'a, C, A> where C: BorrowMut ProjectAttestorListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAttestorListCall<'a, C, A> @@ -1537,7 +1582,7 @@ impl<'a, C, A> ProjectPolicySetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectPolicySetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1588,7 +1630,7 @@ impl<'a, C, A> ProjectPolicySetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectPolicySetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectPolicySetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectPolicySetIamPolicyCall<'a, C, A> @@ -1828,7 +1870,7 @@ impl<'a, C, A> ProjectAttestorCreateCall<'a, C, A> where C: BorrowMut ProjectAttestorCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1879,7 +1918,7 @@ impl<'a, C, A> ProjectAttestorCreateCall<'a, C, A> where C: BorrowMut ProjectAttestorCreateCall<'a, C, A> where C: BorrowMut ProjectAttestorCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAttestorCreateCall<'a, C, A> @@ -2123,7 +2162,7 @@ impl<'a, C, A> ProjectAttestorTestIamPermissionCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2139,10 +2178,7 @@ impl<'a, C, A> ProjectAttestorTestIamPermissionCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2174,7 +2210,7 @@ impl<'a, C, A> ProjectAttestorTestIamPermissionCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2265,7 +2301,7 @@ impl<'a, C, A> ProjectAttestorTestIamPermissionCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2273,12 +2309,12 @@ impl<'a, C, A> ProjectAttestorTestIamPermissionCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAttestorTestIamPermissionCall<'a, C, A> @@ -2401,7 +2437,7 @@ impl<'a, C, A> ProjectPolicyGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectPolicyGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2440,7 +2473,7 @@ impl<'a, C, A> ProjectPolicyGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectPolicyGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectPolicyGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectPolicyGetIamPolicyCall<'a, C, A> @@ -2654,7 +2687,7 @@ impl<'a, C, A> ProjectAttestorGetCall<'a, C, A> where C: BorrowMut ProjectAttestorGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2693,7 +2723,7 @@ impl<'a, C, A> ProjectAttestorGetCall<'a, C, A> where C: BorrowMut ProjectAttestorGetCall<'a, C, A> where C: BorrowMut ProjectAttestorGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAttestorGetCall<'a, C, A> @@ -2907,7 +2937,7 @@ impl<'a, C, A> ProjectGetPolicyCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2923,10 +2953,7 @@ impl<'a, C, A> ProjectGetPolicyCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2946,7 +2973,7 @@ impl<'a, C, A> ProjectGetPolicyCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3025,7 +3052,7 @@ impl<'a, C, A> ProjectGetPolicyCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3033,12 +3060,12 @@ impl<'a, C, A> ProjectGetPolicyCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectGetPolicyCall<'a, C, A> @@ -3161,7 +3188,7 @@ impl<'a, C, A> ProjectAttestorGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectAttestorGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3200,7 +3224,7 @@ impl<'a, C, A> ProjectAttestorGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectAttestorGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectAttestorGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAttestorGetIamPolicyCall<'a, C, A> @@ -3424,7 +3448,7 @@ impl<'a, C, A> ProjectUpdatePolicyCall<'a, C, A> where C: BorrowMut ProjectUpdatePolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3475,7 +3496,7 @@ impl<'a, C, A> ProjectUpdatePolicyCall<'a, C, A> where C: BorrowMut ProjectUpdatePolicyCall<'a, C, A> where C: BorrowMut ProjectUpdatePolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectUpdatePolicyCall<'a, C, A> @@ -3708,7 +3729,7 @@ impl<'a, C, A> ProjectAttestorSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectAttestorSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3759,7 +3777,7 @@ impl<'a, C, A> ProjectAttestorSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectAttestorSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectAttestorSetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAttestorSetIamPolicyCall<'a, C, A> @@ -3992,7 +4010,7 @@ impl<'a, C, A> ProjectAttestorUpdateCall<'a, C, A> where C: BorrowMut ProjectAttestorUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4043,7 +4058,7 @@ impl<'a, C, A> ProjectAttestorUpdateCall<'a, C, A> where C: BorrowMut ProjectAttestorUpdateCall<'a, C, A> where C: BorrowMut ProjectAttestorUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAttestorUpdateCall<'a, C, A> @@ -4269,7 +4284,7 @@ impl<'a, C, A> ProjectAttestorDeleteCall<'a, C, A> where C: BorrowMut ProjectAttestorDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4308,7 +4320,7 @@ impl<'a, C, A> ProjectAttestorDeleteCall<'a, C, A> where C: BorrowMut ProjectAttestorDeleteCall<'a, C, A> where C: BorrowMut ProjectAttestorDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAttestorDeleteCall<'a, C, A> @@ -4534,7 +4546,7 @@ impl<'a, C, A> ProjectPolicyTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectPolicyTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4585,7 +4594,7 @@ impl<'a, C, A> ProjectPolicyTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectPolicyTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectPolicyTestIamPermissionCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectPolicyTestIamPermissionCall<'a, C, A> diff --git a/gen/blogger3/Cargo.toml b/gen/blogger3/Cargo.toml index b67872e4f5..060e266e56 100644 --- a/gen/blogger3/Cargo.toml +++ b/gen/blogger3/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/blogger3/src/lib.rs b/gen/blogger3/src/lib.rs index e51770118c..35a47784be 100644 --- a/gen/blogger3/src/lib.rs +++ b/gen/blogger3/src/lib.rs @@ -2418,10 +2418,7 @@ impl<'a, C, A> PageViewGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2441,7 +2438,7 @@ impl<'a, C, A> PageViewGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2526,7 +2523,7 @@ impl<'a, C, A> PageViewGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2668,10 +2665,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2691,7 +2685,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2769,7 +2763,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2935,10 +2929,7 @@ impl<'a, C, A> BlogListByUserCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2958,7 +2949,7 @@ impl<'a, C, A> BlogListByUserCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3066,7 +3057,7 @@ impl<'a, C, A> BlogListByUserCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3218,10 +3209,7 @@ impl<'a, C, A> BlogGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3241,7 +3229,7 @@ impl<'a, C, A> BlogGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3333,7 +3321,7 @@ impl<'a, C, A> BlogGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3459,10 +3447,7 @@ impl<'a, C, A> BlogGetByUrlCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3482,7 +3467,7 @@ impl<'a, C, A> BlogGetByUrlCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3567,7 +3552,7 @@ impl<'a, C, A> BlogGetByUrlCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3743,10 +3728,7 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3778,7 +3760,7 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3913,7 +3895,7 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4067,10 +4049,7 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4090,7 +4069,7 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4192,7 +4171,7 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4356,10 +4335,7 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4379,7 +4355,7 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4495,7 +4471,7 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4659,10 +4635,7 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4694,7 +4667,7 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4805,7 +4778,7 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4954,10 +4927,7 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4977,7 +4947,7 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5072,7 +5042,7 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5215,10 +5185,7 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5238,7 +5205,7 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5316,7 +5283,7 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5460,10 +5427,7 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5483,7 +5447,7 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5571,7 +5535,7 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5725,10 +5689,7 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5748,7 +5709,7 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5850,7 +5811,7 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6026,10 +5987,7 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6061,7 +6019,7 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6196,7 +6154,7 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6390,10 +6348,7 @@ impl<'a, C, A> PostListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6413,7 +6368,7 @@ impl<'a, C, A> PostListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6562,7 +6517,7 @@ impl<'a, C, A> PostListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6713,10 +6668,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6736,7 +6688,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6841,7 +6793,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6987,10 +6939,7 @@ impl<'a, C, A> CommentRemoveContentCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7010,7 +6959,7 @@ impl<'a, C, A> CommentRemoveContentCall<'a, C, A> where C: BorrowMut CommentRemoveContentCall<'a, C, A> where C: BorrowMut CommentListByBlogCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7305,7 +7251,7 @@ impl<'a, C, A> CommentListByBlogCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7425,7 +7371,7 @@ impl<'a, C, A> CommentListByBlogCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7571,10 +7517,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7594,7 +7537,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7692,7 +7635,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7873,10 +7816,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7896,7 +7836,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8033,7 +7973,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8179,10 +8119,7 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8202,7 +8139,7 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8300,7 +8237,7 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8445,10 +8382,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8468,7 +8402,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8556,7 +8490,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8707,10 +8641,7 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8730,7 +8661,7 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8835,7 +8766,7 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9026,10 +8957,7 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9049,7 +8977,7 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9200,7 +9128,7 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9349,10 +9277,7 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9372,7 +9297,7 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9467,7 +9392,7 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9616,10 +9541,7 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9639,7 +9561,7 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9733,7 +9655,7 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9902,10 +9824,7 @@ impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9925,7 +9844,7 @@ impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10038,7 +9957,7 @@ impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10182,10 +10101,7 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10205,7 +10121,7 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10293,7 +10209,7 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10447,10 +10363,7 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10482,7 +10395,7 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10579,7 +10492,7 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10740,10 +10653,7 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10775,7 +10685,7 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10889,7 +10799,7 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11033,10 +10943,7 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11056,7 +10963,7 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11144,7 +11051,7 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11305,10 +11212,7 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11340,7 +11244,7 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11454,7 +11358,7 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11597,10 +11501,7 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11620,7 +11521,7 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11698,7 +11599,7 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/books1-cli/Cargo.toml b/gen/books1-cli/Cargo.toml index 4c096f117b..7a15e62b67 100644 --- a/gen/books1-cli/Cargo.toml +++ b/gen/books1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-books1-cli" -version = "1.0.8+20180824" +version = "1.0.8+20181212" authors = ["Sebastian Thiel "] description = "A complete library to interact with books (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/books1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-books1] path = "../books1" -version = "1.0.8+20180824" +version = "1.0.8+20181212" diff --git a/gen/books1-cli/README.md b/gen/books1-cli/README.md index 882b510ebf..24f25380b2 100644 --- a/gen/books1-cli/README.md +++ b/gen/books1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *books* API at revision *20180824*. The CLI is at version *1.0.8*. +This documentation was generated from the *books* API at revision *20181212*. The CLI is at version *1.0.8*. ```bash books1 [options] diff --git a/gen/books1-cli/mkdocs.yml b/gen/books1-cli/mkdocs.yml index 3ade7ecce4..df830fde92 100644 --- a/gen/books1-cli/mkdocs.yml +++ b/gen/books1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: books v1.0.8+20180824 +site_name: books v1.0.8+20181212 site_url: http://byron.github.io/google-apis-rs/google-books1-cli site_description: A complete library to interact with books (protocol v1) diff --git a/gen/books1-cli/src/main.rs b/gen/books1-cli/src/main.rs index cfac91e7ca..25737d6c83 100644 --- a/gen/books1-cli/src/main.rs +++ b/gen/books1-cli/src/main.rs @@ -4928,7 +4928,7 @@ fn main() { let mut app = App::new("books1") .author("Sebastian Thiel ") - .version("1.0.8+20180824") + .version("1.0.8+20181212") .about("Searches for books and manages your Google Books library.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_books1_cli") .arg(Arg::with_name("url") diff --git a/gen/books1/Cargo.toml b/gen/books1/Cargo.toml index d7d6a87610..2f9898ee00 100644 --- a/gen/books1/Cargo.toml +++ b/gen/books1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-books1" -version = "1.0.8+20180824" +version = "1.0.8+20181212" authors = ["Sebastian Thiel "] description = "A complete library to interact with books (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/books1" homepage = "https://developers.google.com/books/docs/v1/getting_started" -documentation = "https://docs.rs/google-books1/1.0.8+20180824" +documentation = "https://docs.rs/google-books1/1.0.8+20181212" license = "MIT" keywords = ["books", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/books1/README.md b/gen/books1/README.md index a918fc1619..5b8ce2d929 100644 --- a/gen/books1/README.md +++ b/gen/books1/README.md @@ -5,40 +5,40 @@ DO NOT EDIT ! --> The `google-books1` library allows access to all features of the *Google books* service. -This documentation was generated from *books* crate version *1.0.8+20180824*, where *20180824* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *books* crate version *1.0.8+20181212*, where *20181212* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *books* *v1* API can be found at the [official documentation site](https://developers.google.com/books/docs/v1/getting_started). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.Books.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.Books.html) ... * bookshelves - * [*get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.BookshelveGetCall.html), [*list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.BookshelveListCall.html) and [*volumes list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.BookshelveVolumeListCall.html) + * [*get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.BookshelveGetCall.html), [*list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.BookshelveListCall.html) and [*volumes list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.BookshelveVolumeListCall.html) * cloudloading - * [*add book*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.CloudloadingAddBookCall.html), [*delete book*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.CloudloadingDeleteBookCall.html) and [*update book*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.CloudloadingUpdateBookCall.html) + * [*add book*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.CloudloadingAddBookCall.html), [*delete book*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.CloudloadingDeleteBookCall.html) and [*update book*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.CloudloadingUpdateBookCall.html) * dictionary - * [*list offline metadata*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.DictionaryListOfflineMetadataCall.html) + * [*list offline metadata*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.DictionaryListOfflineMetadataCall.html) * familysharing - * [*get family info*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.FamilysharingGetFamilyInfoCall.html), [*share*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.FamilysharingShareCall.html) and [*unshare*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.FamilysharingUnshareCall.html) + * [*get family info*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.FamilysharingGetFamilyInfoCall.html), [*share*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.FamilysharingShareCall.html) and [*unshare*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.FamilysharingUnshareCall.html) * layers - * [*annotation data get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.LayerAnnotationDataGetCall.html), [*annotation data list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.LayerAnnotationDataListCall.html), [*get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.LayerGetCall.html), [*list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.LayerListCall.html), [*volume annotations get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.LayerVolumeAnnotationGetCall.html) and [*volume annotations list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.LayerVolumeAnnotationListCall.html) + * [*annotation data get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.LayerAnnotationDataGetCall.html), [*annotation data list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.LayerAnnotationDataListCall.html), [*get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.LayerGetCall.html), [*list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.LayerListCall.html), [*volume annotations get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.LayerVolumeAnnotationGetCall.html) and [*volume annotations list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.LayerVolumeAnnotationListCall.html) * myconfig - * [*get user settings*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MyconfigGetUserSettingCall.html), [*release download access*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MyconfigReleaseDownloadAccesCall.html), [*request access*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MyconfigRequestAccesCall.html), [*sync volume licenses*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MyconfigSyncVolumeLicenseCall.html) and [*update user settings*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MyconfigUpdateUserSettingCall.html) + * [*get user settings*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MyconfigGetUserSettingCall.html), [*release download access*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MyconfigReleaseDownloadAccesCall.html), [*request access*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MyconfigRequestAccesCall.html), [*sync volume licenses*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MyconfigSyncVolumeLicenseCall.html) and [*update user settings*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MyconfigUpdateUserSettingCall.html) * mylibrary - * [*annotations delete*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryAnnotationDeleteCall.html), [*annotations insert*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryAnnotationInsertCall.html), [*annotations list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryAnnotationListCall.html), [*annotations summary*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryAnnotationSummaryCall.html), [*annotations update*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryAnnotationUpdateCall.html), [*bookshelves add volume*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryBookshelveAddVolumeCall.html), [*bookshelves clear volumes*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryBookshelveClearVolumeCall.html), [*bookshelves get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryBookshelveGetCall.html), [*bookshelves list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryBookshelveListCall.html), [*bookshelves move volume*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryBookshelveMoveVolumeCall.html), [*bookshelves remove volume*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryBookshelveRemoveVolumeCall.html), [*bookshelves volumes list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryBookshelveVolumeListCall.html), [*readingpositions get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryReadingpositionGetCall.html) and [*readingpositions set position*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.MylibraryReadingpositionSetPositionCall.html) -* [notification](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.Notification.html) - * [*get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.NotificationGetCall.html) + * [*annotations delete*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryAnnotationDeleteCall.html), [*annotations insert*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryAnnotationInsertCall.html), [*annotations list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryAnnotationListCall.html), [*annotations summary*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryAnnotationSummaryCall.html), [*annotations update*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryAnnotationUpdateCall.html), [*bookshelves add volume*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryBookshelveAddVolumeCall.html), [*bookshelves clear volumes*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryBookshelveClearVolumeCall.html), [*bookshelves get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryBookshelveGetCall.html), [*bookshelves list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryBookshelveListCall.html), [*bookshelves move volume*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryBookshelveMoveVolumeCall.html), [*bookshelves remove volume*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryBookshelveRemoveVolumeCall.html), [*bookshelves volumes list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryBookshelveVolumeListCall.html), [*readingpositions get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryReadingpositionGetCall.html) and [*readingpositions set position*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.MylibraryReadingpositionSetPositionCall.html) +* [notification](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.Notification.html) + * [*get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.NotificationGetCall.html) * onboarding - * [*list categories*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.OnboardingListCategoryCall.html) and [*list category volumes*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.OnboardingListCategoryVolumeCall.html) + * [*list categories*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.OnboardingListCategoryCall.html) and [*list category volumes*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.OnboardingListCategoryVolumeCall.html) * personalizedstream - * [*get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.PersonalizedstreamGetCall.html) + * [*get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.PersonalizedstreamGetCall.html) * promooffer - * [*accept*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.PromoofferAcceptCall.html), [*dismiss*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.PromoofferDismisCall.html) and [*get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.PromoofferGetCall.html) + * [*accept*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.PromoofferAcceptCall.html), [*dismiss*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.PromoofferDismisCall.html) and [*get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.PromoofferGetCall.html) * series - * [*get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.SeryGetCall.html) and [*membership get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.SeryMembershipGetCall.html) -* [volumes](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.Volume.html) - * [*associated list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.VolumeAssociatedListCall.html), [*get*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.VolumeGetCall.html), [*list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.VolumeListCall.html), [*mybooks list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.VolumeMybookListCall.html), [*recommended list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.VolumeRecommendedListCall.html), [*recommended rate*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.VolumeRecommendedRateCall.html) and [*useruploaded list*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.VolumeUseruploadedListCall.html) + * [*get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.SeryGetCall.html) and [*membership get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.SeryMembershipGetCall.html) +* [volumes](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.Volume.html) + * [*associated list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.VolumeAssociatedListCall.html), [*get*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.VolumeGetCall.html), [*list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.VolumeListCall.html), [*mybooks list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.VolumeMybookListCall.html), [*recommended list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.VolumeRecommendedListCall.html), [*recommended rate*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.VolumeRecommendedRateCall.html) and [*useruploaded list*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.VolumeUseruploadedListCall.html) @@ -47,17 +47,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-books1/1.0.8+20180824/google_books1/struct.Books.html)** +* **[Hub](https://docs.rs/google-books1/1.0.8+20181212/google_books1/struct.Books.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.Part.html)** + * **[Parts](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -168,17 +168,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-books1/1.0.8+20180824/google_books1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-books1/1.0.8+20181212/google_books1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-books1/1.0.8+20180824/google_books1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-books1/1.0.8+20181212/google_books1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -188,29 +188,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-books1/1.0.8+20180824/google_books1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-books1/1.0.8+20181212/google_books1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/books1/src/lib.rs b/gen/books1/src/lib.rs index e13eb267a5..332b9b906b 100644 --- a/gen/books1/src/lib.rs +++ b/gen/books1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *books* crate version *1.0.8+20180824*, where *20180824* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *books* crate version *1.0.8+20181212*, where *20181212* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *books* *v1* API can be found at the //! [official documentation site](https://developers.google.com/books/docs/v1/getting_started). @@ -757,20 +757,12 @@ impl Part for VolumeseriesinfoVolumeSeries {} pub struct Notification { /// no description provided pub body: Option, - /// no description provided - pub doc_type: Option, - /// Resource type. - pub kind: Option, - /// no description provided - pub title: Option, /// The list of crm experiment ids. #[serde(rename="crmExperimentIds")] pub crm_experiment_ids: Option>, /// no description provided pub dont_show_notification: Option, /// no description provided - pub is_document_mature: Option, - /// no description provided pub show_notification_settings_action: Option, /// no description provided #[serde(rename="iconUrl")] @@ -781,13 +773,24 @@ pub struct Notification { #[serde(rename="notificationGroup")] pub notification_group: Option, /// no description provided - #[serde(rename="targetUrl")] - pub target_url: Option, - /// no description provided pub notification_type: Option, /// no description provided pub pcampaign_id: Option, /// no description provided + pub doc_type: Option, + /// Resource type. + pub kind: Option, + /// no description provided + pub title: Option, + /// no description provided + pub is_document_mature: Option, + /// no description provided + #[serde(rename="timeToExpireMs")] + pub time_to_expire_ms: Option, + /// no description provided + #[serde(rename="targetUrl")] + pub target_url: Option, + /// no description provided pub doc_id: Option, } @@ -4285,10 +4288,7 @@ impl<'a, C, A> LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4308,7 +4308,7 @@ impl<'a, C, A> LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4637,7 +4634,7 @@ impl<'a, C, A> LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut LayerListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4934,7 +4928,7 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5040,7 +5034,7 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5194,10 +5188,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5217,7 +5208,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5319,7 +5310,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5525,10 +5516,7 @@ impl<'a, C, A> LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5548,7 +5536,7 @@ impl<'a, C, A> LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5951,7 +5936,7 @@ impl<'a, C, A> LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6276,7 +6258,7 @@ impl<'a, C, A> VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut VolumeUseruploadedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6554,7 +6533,7 @@ impl<'a, C, A> VolumeUseruploadedListCall<'a, C, A> where C: BorrowMut VolumeUseruploadedListCall<'a, C, A> where C: BorrowMut VolumeMybookListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6847,7 +6823,7 @@ impl<'a, C, A> VolumeMybookListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6966,7 +6942,7 @@ impl<'a, C, A> VolumeMybookListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7152,10 +7128,7 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7175,7 +7148,7 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7344,7 +7317,7 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7506,10 +7479,7 @@ impl<'a, C, A> VolumeAssociatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7529,7 +7499,7 @@ impl<'a, C, A> VolumeAssociatedListCall<'a, C, A> where C: BorrowMut VolumeAssociatedListCall<'a, C, A> where C: BorrowMut VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7830,7 +7797,7 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7949,7 +7916,7 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8083,10 +8050,7 @@ impl<'a, C, A> VolumeRecommendedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8106,7 +8070,7 @@ impl<'a, C, A> VolumeRecommendedListCall<'a, C, A> where C: BorrowMut VolumeRecommendedListCall<'a, C, A> where C: BorrowMut DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8339,7 +8300,7 @@ impl<'a, C, A> DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut FamilysharingUnshareCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8573,7 +8531,7 @@ impl<'a, C, A> FamilysharingUnshareCall<'a, C, A> where C: BorrowMut FamilysharingUnshareCall<'a, C, A> where C: BorrowMut FamilysharingGetFamilyInfoCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8799,7 +8754,7 @@ impl<'a, C, A> FamilysharingGetFamilyInfoCall<'a, C, A> where C: BorrowMut FamilysharingGetFamilyInfoCall<'a, C, A> where C: BorrowMut FamilysharingShareCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9030,7 +8982,7 @@ impl<'a, C, A> FamilysharingShareCall<'a, C, A> where C: BorrowMut FamilysharingShareCall<'a, C, A> where C: BorrowMut BookshelveVolumeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9296,7 +9245,7 @@ impl<'a, C, A> BookshelveVolumeListCall<'a, C, A> where C: BorrowMut BookshelveVolumeListCall<'a, C, A> where C: BorrowMut BookshelveListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9582,7 +9528,7 @@ impl<'a, C, A> BookshelveListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9667,7 +9613,7 @@ impl<'a, C, A> BookshelveListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9816,10 +9762,7 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9839,7 +9782,7 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9934,7 +9877,7 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10092,10 +10035,7 @@ impl<'a, C, A> PromoofferAcceptCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10115,7 +10055,7 @@ impl<'a, C, A> PromoofferAcceptCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10228,7 +10168,7 @@ impl<'a, C, A> PromoofferAcceptCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10381,10 +10321,7 @@ impl<'a, C, A> PromoofferDismisCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10404,7 +10341,7 @@ impl<'a, C, A> PromoofferDismisCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10511,7 +10448,7 @@ impl<'a, C, A> PromoofferDismisCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10660,10 +10597,7 @@ impl<'a, C, A> PromoofferGetCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10683,7 +10617,7 @@ impl<'a, C, A> PromoofferGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10793,7 +10727,7 @@ impl<'a, C, A> PromoofferGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10927,10 +10861,7 @@ impl<'a, C, A> PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10950,7 +10881,7 @@ impl<'a, C, A> PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut OnboardingListCategoryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11186,7 +11114,7 @@ impl<'a, C, A> OnboardingListCategoryCall<'a, C, A> where C: BorrowMut OnboardingListCategoryCall<'a, C, A> where C: BorrowMut OnboardingListCategoryVolumeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11430,7 +11355,7 @@ impl<'a, C, A> OnboardingListCategoryVolumeCall<'a, C, A> where C: BorrowMut OnboardingListCategoryVolumeCall<'a, C, A> where C: BorrowMut MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11694,7 +11616,7 @@ impl<'a, C, A> MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11976,7 +11895,7 @@ impl<'a, C, A> MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12256,7 +12172,7 @@ impl<'a, C, A> MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut MyconfigGetUserSettingCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12533,7 +12446,7 @@ impl<'a, C, A> MyconfigGetUserSettingCall<'a, C, A> where C: BorrowMut MyconfigGetUserSettingCall<'a, C, A> where C: BorrowMut MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12762,7 +12672,7 @@ impl<'a, C, A> MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13011,7 +12918,7 @@ impl<'a, C, A> MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13259,7 +13163,7 @@ impl<'a, C, A> MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveVolumeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13554,7 +13455,7 @@ impl<'a, C, A> MylibraryBookshelveVolumeListCall<'a, C, A> where C: BorrowMut MylibraryBookshelveVolumeListCall<'a, C, A> where C: BorrowMut MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13831,7 +13729,7 @@ impl<'a, C, A> MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14089,7 +13984,7 @@ impl<'a, C, A> MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14340,7 +14232,7 @@ impl<'a, C, A> MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14613,7 +14502,7 @@ impl<'a, C, A> MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14897,7 +14783,7 @@ impl<'a, C, A> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14989,7 +14875,7 @@ impl<'a, C, A> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15160,10 +15046,7 @@ impl<'a, C, A> MylibraryAnnotationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15183,7 +15066,7 @@ impl<'a, C, A> MylibraryAnnotationListCall<'a, C, A> where C: BorrowMut MylibraryAnnotationListCall<'a, C, A> where C: BorrowMut MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15511,7 +15391,7 @@ impl<'a, C, A> MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15796,7 +15673,7 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15912,7 +15789,7 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16059,10 +15936,7 @@ impl<'a, C, A> MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16082,7 +15956,7 @@ impl<'a, C, A> MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut MylibraryBookshelveListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16314,7 +16185,7 @@ impl<'a, C, A> MylibraryBookshelveListCall<'a, C, A> where C: BorrowMut MylibraryBookshelveListCall<'a, C, A> where C: BorrowMut MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16564,7 +16432,7 @@ impl<'a, C, A> MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut SeryGetCall<'a, C, A> where C: BorrowMut, A: oauth } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16804,7 +16669,7 @@ impl<'a, C, A> SeryGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16883,7 +16748,7 @@ impl<'a, C, A> SeryGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17014,10 +16879,7 @@ impl<'a, C, A> SeryMembershipGetCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17037,7 +16899,7 @@ impl<'a, C, A> SeryMembershipGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17129,7 +16991,7 @@ impl<'a, C, A> SeryMembershipGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17268,10 +17130,7 @@ impl<'a, C, A> CloudloadingAddBookCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17291,7 +17150,7 @@ impl<'a, C, A> CloudloadingAddBookCall<'a, C, A> where C: BorrowMut CloudloadingAddBookCall<'a, C, A> where C: BorrowMut CloudloadingUpdateBookCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17547,7 +17403,7 @@ impl<'a, C, A> CloudloadingUpdateBookCall<'a, C, A> where C: BorrowMut CloudloadingUpdateBookCall<'a, C, A> where C: BorrowMut CloudloadingDeleteBookCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17770,7 +17623,7 @@ impl<'a, C, A> CloudloadingDeleteBookCall<'a, C, A> where C: BorrowMut CloudloadingDeleteBookCall<'a, C, A> where C: BorrowMut NotificationGetCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17992,7 +17842,7 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18084,7 +17934,7 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/calendar3-cli/Cargo.toml b/gen/calendar3-cli/Cargo.toml index 287978f872..de277cad7c 100644 --- a/gen/calendar3-cli/Cargo.toml +++ b/gen/calendar3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-calendar3-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190331" authors = ["Sebastian Thiel "] description = "A complete library to interact with calendar (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/calendar3-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-calendar3] path = "../calendar3" -version = "1.0.8+20181009" +version = "1.0.8+20190331" diff --git a/gen/calendar3-cli/README.md b/gen/calendar3-cli/README.md index d8e6284f6f..3fd70a2621 100644 --- a/gen/calendar3-cli/README.md +++ b/gen/calendar3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *calendar* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *calendar* API at revision *20190331*. The CLI is at version *1.0.8*. ```bash calendar3 [options] diff --git a/gen/calendar3-cli/mkdocs.yml b/gen/calendar3-cli/mkdocs.yml index 647504ab9a..1dc6a72802 100644 --- a/gen/calendar3-cli/mkdocs.yml +++ b/gen/calendar3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: calendar v1.0.8+20181009 +site_name: calendar v1.0.8+20190331 site_url: http://byron.github.io/google-apis-rs/google-calendar3-cli site_description: A complete library to interact with calendar (protocol v3) diff --git a/gen/calendar3-cli/src/main.rs b/gen/calendar3-cli/src/main.rs index 5febff2c06..2562b12086 100644 --- a/gen/calendar3-cli/src/main.rs +++ b/gen/calendar3-cli/src/main.rs @@ -4474,7 +4474,7 @@ fn main() { let mut app = App::new("calendar3") .author("Sebastian Thiel ") - .version("1.0.8+20181009") + .version("1.0.8+20190331") .about("Manipulates events and other calendar data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_calendar3_cli") .arg(Arg::with_name("url") diff --git a/gen/calendar3/Cargo.toml b/gen/calendar3/Cargo.toml index 67a6d22063..b99a8361dc 100644 --- a/gen/calendar3/Cargo.toml +++ b/gen/calendar3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-calendar3" -version = "1.0.8+20181009" +version = "1.0.8+20190331" authors = ["Sebastian Thiel "] description = "A complete library to interact with calendar (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/calendar3" homepage = "https://developers.google.com/google-apps/calendar/firstapp" -documentation = "https://docs.rs/google-calendar3/1.0.8+20181009" +documentation = "https://docs.rs/google-calendar3/1.0.8+20190331" license = "MIT" keywords = ["calendar", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/calendar3/README.md b/gen/calendar3/README.md index e53b903b18..516640c39e 100644 --- a/gen/calendar3/README.md +++ b/gen/calendar3/README.md @@ -5,43 +5,43 @@ DO NOT EDIT ! --> The `google-calendar3` library allows access to all features of the *Google calendar* service. -This documentation was generated from *calendar* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *calendar* crate version *1.0.8+20190331*, where *20190331* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *calendar* *v3* API can be found at the [official documentation site](https://developers.google.com/google-apps/calendar/firstapp). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarHub.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarHub.html) ... -* [acl](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.Acl.html) - * [*delete*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.AclDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.AclGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.AclInsertCall.html), [*list*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.AclListCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.AclPatchCall.html), [*update*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.AclUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.AclWatchCall.html) -* [calendar list](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarList.html) - * [*delete*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarListDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarListGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarListInsertCall.html), [*list*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarListListCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarListPatchCall.html), [*update*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarListUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarListWatchCall.html) -* [calendars](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.Calendar.html) - * [*clear*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarClearCall.html), [*delete*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarInsertCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarPatchCall.html) and [*update*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarUpdateCall.html) -* [channels](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.Channel.html) - * [*stop*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.ChannelStopCall.html) +* [acl](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.Acl.html) + * [*delete*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.AclDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.AclGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.AclInsertCall.html), [*list*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.AclListCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.AclPatchCall.html), [*update*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.AclUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.AclWatchCall.html) +* [calendar list](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarList.html) + * [*delete*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarListDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarListGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarListInsertCall.html), [*list*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarListListCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarListPatchCall.html), [*update*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarListUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarListWatchCall.html) +* [calendars](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.Calendar.html) + * [*clear*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarClearCall.html), [*delete*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarInsertCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarPatchCall.html) and [*update*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarUpdateCall.html) +* [channels](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.Channel.html) + * [*stop*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.ChannelStopCall.html) * colors - * [*get*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.ColorGetCall.html) -* [events](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.Event.html) - * [*delete*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventGetCall.html), [*import*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventImportCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventInsertCall.html), [*instances*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventInstanceCall.html), [*list*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventListCall.html), [*move*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventMoveCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventPatchCall.html), [*quick add*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventQuickAddCall.html), [*update*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventWatchCall.html) + * [*get*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.ColorGetCall.html) +* [events](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.Event.html) + * [*delete*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventGetCall.html), [*import*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventImportCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventInsertCall.html), [*instances*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventInstanceCall.html), [*list*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventListCall.html), [*move*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventMoveCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventPatchCall.html), [*quick add*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventQuickAddCall.html), [*update*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventWatchCall.html) * freebusy - * [*query*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.FreebusyQueryCall.html) -* [settings](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.Setting.html) - * [*get*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.SettingGetCall.html), [*list*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.SettingListCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.SettingWatchCall.html) + * [*query*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.FreebusyQueryCall.html) +* [settings](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.Setting.html) + * [*get*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.SettingGetCall.html), [*list*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.SettingListCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.SettingWatchCall.html) Subscription supported by ... -* [*list settings*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.SettingListCall.html) -* [*list events*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventListCall.html) -* [*list calendar list*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarListListCall.html) -* [*watch events*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventWatchCall.html) -* [*instances events*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.EventInstanceCall.html) -* [*watch settings*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.SettingWatchCall.html) -* [*watch acl*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.AclWatchCall.html) -* [*list acl*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.AclListCall.html) -* [*watch calendar list*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarListWatchCall.html) +* [*list settings*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.SettingListCall.html) +* [*list events*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventListCall.html) +* [*list calendar list*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarListListCall.html) +* [*watch events*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventWatchCall.html) +* [*instances events*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.EventInstanceCall.html) +* [*watch settings*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.SettingWatchCall.html) +* [*watch acl*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.AclWatchCall.html) +* [*list acl*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.AclListCall.html) +* [*watch calendar list*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarListWatchCall.html) @@ -49,17 +49,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/struct.CalendarHub.html)** +* **[Hub](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/struct.CalendarHub.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.Part.html)** + * **[Parts](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -183,17 +183,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -203,29 +203,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-calendar3/1.0.8+20181009/google_calendar3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-calendar3/1.0.8+20190331/google_calendar3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/calendar3/src/lib.rs b/gen/calendar3/src/lib.rs index d578a789a9..cf7372d876 100644 --- a/gen/calendar3/src/lib.rs +++ b/gen/calendar3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *calendar* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *calendar* crate version *1.0.8+20190331*, where *20190331* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *calendar* *v3* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/calendar/firstapp). @@ -293,7 +293,7 @@ pub enum Scope { /// View and edit events on all your calendars Event, - /// Manage your calendars + /// See, edit, share, and permanently delete all the calendars you can access using Google Calendar Full, /// View your calendars @@ -946,7 +946,8 @@ pub struct EventReminder { pub minutes: Option, /// The method used by this reminder. Possible values are: /// - "email" - Reminders are sent via email. - /// - "sms" - Reminders are sent via SMS. These are only available for G Suite customers. Requests to set SMS reminders for other account types are ignored. + /// - "sms" - Deprecated. Once this feature is shutdown, the API will no longer return reminders using this method. Any newly added SMS reminders will be ignored. See Google Calendar SMS notifications to be removed for more information. + /// Reminders are sent via SMS. These are only available for G Suite customers. Requests to set SMS reminders for other account types are ignored. /// - "popup" - Reminders are sent via a UI popup. /// Required when adding a reminder. pub method: Option, @@ -986,8 +987,9 @@ pub struct CalendarNotification { #[serde(rename="type")] pub type_: Option, /// The method used to deliver the notification. Possible values are: - /// - "email" - Reminders are sent via email. - /// - "sms" - Reminders are sent via SMS. This value is read-only and is ignored on inserts and updates. SMS reminders are only available for G Suite customers. + /// - "email" - Notifications are sent via email. + /// - "sms" - Deprecated. Once this feature is shutdown, the API will no longer return notifications using this method. Any newly added SMS notifications will be ignored. See Google Calendar SMS notifications to be removed for more information. + /// Notifications are sent via SMS. This value is read-only and is ignored on inserts and updates. SMS notifications are only available for G Suite customers. /// Required when adding a notification. pub method: Option, } @@ -2860,10 +2862,7 @@ impl<'a, C, A> FreebusyQueryCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2895,7 +2894,7 @@ impl<'a, C, A> FreebusyQueryCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2975,7 +2974,7 @@ impl<'a, C, A> FreebusyQueryCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3109,10 +3108,7 @@ impl<'a, C, A> SettingListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3132,7 +3128,7 @@ impl<'a, C, A> SettingListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3224,7 +3220,7 @@ impl<'a, C, A> SettingListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3365,10 +3361,7 @@ impl<'a, C, A> SettingWatchCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3400,7 +3393,7 @@ impl<'a, C, A> SettingWatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3504,7 +3497,7 @@ impl<'a, C, A> SettingWatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3646,10 +3639,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3669,7 +3659,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3747,7 +3737,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3901,10 +3891,7 @@ impl<'a, C, A> CalendarListUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3936,7 +3923,7 @@ impl<'a, C, A> CalendarListUpdateCall<'a, C, A> where C: BorrowMut CalendarListUpdateCall<'a, C, A> where C: BorrowMut CalendarListDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4197,7 +4181,7 @@ impl<'a, C, A> CalendarListDeleteCall<'a, C, A> where C: BorrowMut CalendarListDeleteCall<'a, C, A> where C: BorrowMut CalendarListGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4430,7 +4411,7 @@ impl<'a, C, A> CalendarListGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4508,7 +4489,7 @@ impl<'a, C, A> CalendarListGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4657,10 +4638,7 @@ impl<'a, C, A> CalendarListListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4680,7 +4658,7 @@ impl<'a, C, A> CalendarListListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4794,7 +4772,7 @@ impl<'a, C, A> CalendarListListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4925,10 +4903,7 @@ impl<'a, C, A> CalendarListInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4960,7 +4935,7 @@ impl<'a, C, A> CalendarListInsertCall<'a, C, A> where C: BorrowMut CalendarListInsertCall<'a, C, A> where C: BorrowMut CalendarListPatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5236,7 +5208,7 @@ impl<'a, C, A> CalendarListPatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5333,7 +5305,7 @@ impl<'a, C, A> CalendarListPatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5489,10 +5461,7 @@ impl<'a, C, A> CalendarListWatchCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5524,7 +5493,7 @@ impl<'a, C, A> CalendarListWatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5650,7 +5619,7 @@ impl<'a, C, A> CalendarListWatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5799,10 +5768,7 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5834,7 +5800,7 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5924,7 +5890,7 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6065,10 +6031,7 @@ impl<'a, C, A> CalendarDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6088,7 +6051,7 @@ impl<'a, C, A> CalendarDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6156,7 +6119,7 @@ impl<'a, C, A> CalendarDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6298,10 +6261,7 @@ impl<'a, C, A> CalendarGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6321,7 +6281,7 @@ impl<'a, C, A> CalendarGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6399,7 +6359,7 @@ impl<'a, C, A> CalendarGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6540,10 +6500,7 @@ impl<'a, C, A> CalendarClearCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6563,7 +6520,7 @@ impl<'a, C, A> CalendarClearCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6631,7 +6588,7 @@ impl<'a, C, A> CalendarClearCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6757,10 +6714,7 @@ impl<'a, C, A> CalendarInsertCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6792,7 +6746,7 @@ impl<'a, C, A> CalendarInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6872,7 +6826,7 @@ impl<'a, C, A> CalendarInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7021,10 +6975,7 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7056,7 +7007,7 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7146,7 +7097,7 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7315,10 +7266,7 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7350,7 +7298,7 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7471,7 +7419,7 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7625,10 +7573,7 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7660,7 +7605,7 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7757,7 +7702,7 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7913,10 +7858,7 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7948,7 +7890,7 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8055,7 +7997,7 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8211,10 +8153,7 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8246,7 +8185,7 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8353,7 +8292,7 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8515,10 +8454,7 @@ impl<'a, C, A> AclListCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8538,7 +8474,7 @@ impl<'a, C, A> AclListCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8647,7 +8583,7 @@ impl<'a, C, A> AclListCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8790,10 +8726,7 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8813,7 +8746,7 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8891,7 +8824,7 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9035,10 +8968,7 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9058,7 +8988,7 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9146,7 +9076,7 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9271,10 +9201,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9306,7 +9233,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9376,7 +9303,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9495,10 +9422,7 @@ impl<'a, C, A> ColorGetCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9518,7 +9442,7 @@ impl<'a, C, A> ColorGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9586,7 +9510,7 @@ impl<'a, C, A> ColorGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9739,10 +9663,7 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9762,7 +9683,7 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9856,7 +9777,7 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10030,10 +9951,7 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10065,7 +9983,7 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10192,7 +10110,7 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10351,10 +10269,7 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10386,7 +10301,7 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10490,7 +10405,7 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10679,10 +10594,7 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10702,7 +10614,7 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10853,7 +10765,7 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11012,10 +10924,7 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11035,7 +10944,7 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11144,7 +11053,7 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11375,10 +11284,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11398,7 +11304,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11475,14 +11381,14 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau self._time_zone = Some(new_value.to_string()); self } - /// Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, e.g., 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but will be ignored. If timeMax is set, timeMin must be smaller than timeMax. + /// Lower bound (inclusive) for an event's start time to filter by. Optional. The default is not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If timeMax is set, timeMin must be smaller than timeMax. /// /// Sets the *time min* query property to the given value. pub fn time_min(mut self, new_value: &str) -> EventListCall<'a, C, A> { self._time_min = Some(new_value.to_string()); self } - /// Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, e.g., 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but will be ignored. If timeMin is set, timeMax must be greater than timeMin. + /// Upper bound (exclusive) for an event's end time to filter by. Optional. The default is not to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If timeMin is set, timeMax must be greater than timeMin. /// /// Sets the *time max* query property to the given value. pub fn time_max(mut self, new_value: &str) -> EventListCall<'a, C, A> { @@ -11610,7 +11516,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11791,10 +11697,7 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11826,7 +11729,7 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11970,7 +11873,7 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12126,10 +12029,7 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12149,7 +12049,7 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12263,7 +12163,7 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12444,10 +12344,7 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12479,7 +12376,7 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12623,7 +12520,7 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12861,10 +12758,7 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12896,7 +12790,7 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12985,14 +12879,14 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa self._time_zone = Some(new_value.to_string()); self } - /// Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, e.g., 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but will be ignored. If timeMax is set, timeMin must be smaller than timeMax. + /// Lower bound (inclusive) for an event's start time to filter by. Optional. The default is not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If timeMax is set, timeMin must be smaller than timeMax. /// /// Sets the *time min* query property to the given value. pub fn time_min(mut self, new_value: &str) -> EventWatchCall<'a, C, A> { self._time_min = Some(new_value.to_string()); self } - /// Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to filter by start time. Must be an RFC3339 timestamp with mandatory time zone offset, e.g., 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but will be ignored. If timeMin is set, timeMax must be greater than timeMin. + /// Upper bound (exclusive) for an event's end time to filter by. Optional. The default is not to filter by end time. Must be an RFC3339 timestamp with mandatory time zone offset, for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If timeMin is set, timeMax must be greater than timeMin. /// /// Sets the *time max* query property to the given value. pub fn time_max(mut self, new_value: &str) -> EventWatchCall<'a, C, A> { @@ -13120,7 +13014,7 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13274,10 +13168,7 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13297,7 +13188,7 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13401,7 +13292,7 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/chat1-cli/Cargo.toml b/gen/chat1-cli/Cargo.toml index e5e240d515..c4452b4f9b 100644 --- a/gen/chat1-cli/Cargo.toml +++ b/gen/chat1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-chat1-cli" -version = "1.0.8+20181008" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Hangouts Chat (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/chat1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-chat1] path = "../chat1" -version = "1.0.8+20181008" +version = "1.0.8+20190330" diff --git a/gen/chat1-cli/README.md b/gen/chat1-cli/README.md index 7ca410ada6..f1daf825d6 100644 --- a/gen/chat1-cli/README.md +++ b/gen/chat1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Hangouts Chat* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Hangouts Chat* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash chat1 [options] diff --git a/gen/chat1-cli/mkdocs.yml b/gen/chat1-cli/mkdocs.yml index dfa8de6a14..2ee069c17b 100644 --- a/gen/chat1-cli/mkdocs.yml +++ b/gen/chat1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Hangouts Chat v1.0.8+20181008 +site_name: Hangouts Chat v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-chat1-cli site_description: A complete library to interact with Hangouts Chat (protocol v1) diff --git a/gen/chat1-cli/src/main.rs b/gen/chat1-cli/src/main.rs index 618124a2ad..f395466a14 100644 --- a/gen/chat1-cli/src/main.rs +++ b/gen/chat1-cli/src/main.rs @@ -882,7 +882,7 @@ fn main() { let mut app = App::new("chat1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190330") .about("Enables bots to fetch information and perform actions in Hangouts Chat.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_chat1_cli") .arg(Arg::with_name("folder") diff --git a/gen/chat1/Cargo.toml b/gen/chat1/Cargo.toml index d285ff5e6d..133bdc8772 100644 --- a/gen/chat1/Cargo.toml +++ b/gen/chat1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-chat1" -version = "1.0.8+20181008" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Hangouts Chat (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/chat1" homepage = "https://developers.google.com/hangouts/chat" -documentation = "https://docs.rs/google-chat1/1.0.8+20181008" +documentation = "https://docs.rs/google-chat1/1.0.8+20190330" license = "MIT" keywords = ["chat", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/chat1/README.md b/gen/chat1/README.md index 7ef7efa966..eaec589df8 100644 --- a/gen/chat1/README.md +++ b/gen/chat1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-chat1` library allows access to all features of the *Google Hangouts Chat* service. -This documentation was generated from *Hangouts Chat* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *chat:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Hangouts Chat* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *chat:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Hangouts Chat* *v1* API can be found at the [official documentation site](https://developers.google.com/hangouts/chat). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.HangoutsChat.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.HangoutsChat.html) ... -* [spaces](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.Space.html) - * [*get*](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.SpaceGetCall.html), [*list*](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.SpaceListCall.html), [*members get*](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.SpaceMemberGetCall.html), [*members list*](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.SpaceMemberListCall.html), [*messages create*](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.SpaceMessageCreateCall.html), [*messages delete*](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.SpaceMessageDeleteCall.html), [*messages get*](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.SpaceMessageGetCall.html) and [*messages update*](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.SpaceMessageUpdateCall.html) +* [spaces](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.Space.html) + * [*get*](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.SpaceGetCall.html), [*list*](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.SpaceListCall.html), [*members get*](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.SpaceMemberGetCall.html), [*members list*](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.SpaceMemberListCall.html), [*messages create*](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.SpaceMessageCreateCall.html), [*messages delete*](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.SpaceMessageDeleteCall.html), [*messages get*](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.SpaceMessageGetCall.html) and [*messages update*](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.SpaceMessageUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/struct.HangoutsChat.html)** +* **[Hub](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/struct.HangoutsChat.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.Part.html)** + * **[Parts](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -138,17 +138,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -158,29 +158,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-chat1/1.0.8+20181008/google_chat1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-chat1/1.0.8+20190330/google_chat1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/chat1/src/lib.rs b/gen/chat1/src/lib.rs index 0278af2597..9f4ac02496 100644 --- a/gen/chat1/src/lib.rs +++ b/gen/chat1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Hangouts Chat* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *chat:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Hangouts Chat* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *chat:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Hangouts Chat* *v1* API can be found at the //! [official documentation site](https://developers.google.com/hangouts/chat). @@ -444,14 +444,14 @@ pub struct WidgetMarkup { /// A list of buttons. Buttons is also oneof data and only one of these /// fields should be set. pub buttons: Option>, - /// Display a text paragraph in this widget. - #[serde(rename="textParagraph")] - pub text_paragraph: Option, - /// Display an image in this widget. - pub image: Option, /// Display a key value item in this widget. #[serde(rename="keyValue")] pub key_value: Option, + /// Display an image in this widget. + pub image: Option, + /// Display a text paragraph in this widget. + #[serde(rename="textParagraph")] + pub text_paragraph: Option, } impl Part for WidgetMarkup {} @@ -578,10 +578,10 @@ impl ResponseResult for ListSpacesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ActionParameter { - /// The value of the parameter. - pub value: Option, /// The name of the parameter for the action script. pub key: Option, + /// The value of the parameter. + pub value: Option, } impl Part for ActionParameter {} @@ -694,26 +694,6 @@ pub struct Membership { impl ResponseResult for Membership {} -/// A card is a UI element that can contain UI widgets such as texts, images. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Card { - /// The header of the card. A header usually contains a title and an image. - pub header: Option, - /// The actions of this card. - #[serde(rename="cardActions")] - pub card_actions: Option>, - /// Name of the card. - pub name: Option, - /// Sections are separated by a line divider. - pub sections: Option>, -} - -impl Part for Card {} - - /// A UI element contains a key (label) and a value (content). And this /// element may also contain some actions such as onclick button. /// @@ -778,11 +758,11 @@ impl ResponseResult for Empty {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OnClick { + /// A form action will be trigger by this onclick if specified. + pub action: Option, /// This onclick triggers an open link action if specified. #[serde(rename="openLink")] pub open_link: Option, - /// A form action will be trigger by this onclick if specified. - pub action: Option, } impl Part for OnClick {} @@ -835,10 +815,8 @@ pub struct Message { /// cannot be displayed (e.g. mobile notifications). #[serde(rename="fallbackText")] pub fallback_text: Option, - /// Output only. The time at which the message was created in Hangouts Chat - /// server. - #[serde(rename="createTime")] - pub create_time: Option, + /// Output only. Annotations associated with the text in this message. + pub annotations: Option>, /// Plain-text body of the message with all bot mentions stripped out. #[serde(rename="argumentText")] pub argument_text: Option, @@ -851,8 +829,10 @@ pub struct Message { /// generate preview chips. #[serde(rename="previewText")] pub preview_text: Option, - /// Output only. Annotations associated with the text in this message. - pub annotations: Option>, + /// Output only. The time at which the message was created in Hangouts Chat + /// server. + #[serde(rename="createTime")] + pub create_time: Option, /// The user who created the message. pub sender: Option, } @@ -930,6 +910,26 @@ pub struct Annotation { impl Part for Annotation {} +/// A card is a UI element that can contain UI widgets such as texts, images. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Card { + /// The header of the card. A header usually contains a title and an image. + pub header: Option, + /// The actions of this card. + #[serde(rename="cardActions")] + pub card_actions: Option>, + /// Name of the card. + pub name: Option, + /// Sections are separated by a line divider. + pub sections: Option>, +} + +impl Part for Card {} + + /// A user in Hangouts Chat. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1239,17 +1239,14 @@ impl<'a, C, A> SpaceListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1332,7 +1329,7 @@ impl<'a, C, A> SpaceListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1451,7 +1448,7 @@ impl<'a, C, A> SpaceMessageGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1467,17 +1464,14 @@ impl<'a, C, A> SpaceMessageGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1557,7 +1551,7 @@ impl<'a, C, A> SpaceMessageGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1676,7 +1670,7 @@ impl<'a, C, A> SpaceGetCall<'a, C, A> where C: BorrowMut, A: oaut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1692,17 +1686,14 @@ impl<'a, C, A> SpaceGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1781,7 +1772,7 @@ impl<'a, C, A> SpaceGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1912,7 +1903,7 @@ impl<'a, C, A> SpaceMessageUpdateCall<'a, C, A> where C: BorrowMut SpaceMessageUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1950,7 +1938,7 @@ impl<'a, C, A> SpaceMessageUpdateCall<'a, C, A> where C: BorrowMut SpaceMessageUpdateCall<'a, C, A> where C: BorrowMut SpaceMemberListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2195,17 +2183,14 @@ impl<'a, C, A> SpaceMemberListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -2301,7 +2286,7 @@ impl<'a, C, A> SpaceMemberListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2420,7 +2405,7 @@ impl<'a, C, A> SpaceMemberGetCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2436,17 +2421,14 @@ impl<'a, C, A> SpaceMemberGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -2526,7 +2508,7 @@ impl<'a, C, A> SpaceMemberGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2645,7 +2627,7 @@ impl<'a, C, A> SpaceMessageDeleteCall<'a, C, A> where C: BorrowMut SpaceMessageDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -2751,7 +2730,7 @@ impl<'a, C, A> SpaceMessageDeleteCall<'a, C, A> where C: BorrowMut SpaceMessageCreateCall<'a, C, A> where C: BorrowMut SpaceMessageCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2920,7 +2896,7 @@ impl<'a, C, A> SpaceMessageCreateCall<'a, C, A> where C: BorrowMut SpaceMessageCreateCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with classroom (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/classroom1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-classroom1] path = "../classroom1" -version = "1.0.8+20181009" +version = "1.0.8+20190401" diff --git a/gen/classroom1-cli/README.md b/gen/classroom1-cli/README.md index 1a23cff32c..521bebcd5a 100644 --- a/gen/classroom1-cli/README.md +++ b/gen/classroom1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *classroom* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *classroom* API at revision *20190401*. The CLI is at version *1.0.8*. ```bash classroom1 [options] @@ -65,6 +65,11 @@ classroom1 [options] teachers-delete [-p ]... [-o ] teachers-get [-p ]... [-o ] teachers-list [-p ]... [-o ] + topics-create (-r )... [-p ]... [-o ] + topics-delete [-p ]... [-o ] + topics-get [-p ]... [-o ] + topics-list [-p ]... [-o ] + topics-patch (-r )... [-p ]... [-o ] update (-r )... [-p ]... [-o ] invitations accept [-p ]... [-o ] diff --git a/gen/classroom1-cli/mkdocs.yml b/gen/classroom1-cli/mkdocs.yml index 485f80d134..42b85a30f5 100644 --- a/gen/classroom1-cli/mkdocs.yml +++ b/gen/classroom1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: classroom v1.0.8+20181009 +site_name: classroom v1.0.8+20190401 site_url: http://byron.github.io/google-apis-rs/google-classroom1-cli site_description: A complete library to interact with classroom (protocol v1) @@ -44,6 +44,11 @@ pages: - ['courses_teachers-delete.md', 'Courses', 'Teachers Delete'] - ['courses_teachers-get.md', 'Courses', 'Teachers Get'] - ['courses_teachers-list.md', 'Courses', 'Teachers List'] +- ['courses_topics-create.md', 'Courses', 'Topics Create'] +- ['courses_topics-delete.md', 'Courses', 'Topics Delete'] +- ['courses_topics-get.md', 'Courses', 'Topics Get'] +- ['courses_topics-list.md', 'Courses', 'Topics List'] +- ['courses_topics-patch.md', 'Courses', 'Topics Patch'] - ['courses_update.md', 'Courses', 'Update'] - ['invitations_accept.md', 'Invitations', 'Accept'] - ['invitations_create.md', 'Invitations', 'Create'] diff --git a/gen/classroom1-cli/src/main.rs b/gen/classroom1-cli/src/main.rs index 5d59fd0f69..eda0703538 100644 --- a/gen/classroom1-cli/src/main.rs +++ b/gen/classroom1-cli/src/main.rs @@ -715,35 +715,36 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "topic-id" => Some(("topicId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "submission-modification-mode" => Some(("submissionModificationMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "alternate-link" => Some(("alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creator-user-id" => Some(("creatorUserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "course-id" => Some(("courseId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "assignment.student-work-folder.alternate-link" => Some(("assignment.studentWorkFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "assignment.student-work-folder.id" => Some(("assignment.studentWorkFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "assignment.student-work-folder.title" => Some(("assignment.studentWorkFolder.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "assignment.student-work-folder.id" => Some(("assignment.studentWorkFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "assignment.student-work-folder.alternate-link" => Some(("assignment.studentWorkFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "scheduled-time" => Some(("scheduledTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "associated-with-developer" => Some(("associatedWithDeveloper", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "assignee-mode" => Some(("assigneeMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "creator-user-id" => Some(("creatorUserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "multiple-choice-question.choices" => Some(("multipleChoiceQuestion.choices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "max-points" => Some(("maxPoints", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "multiple-choice-question.choices" => Some(("multipleChoiceQuestion.choices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "alternate-link" => Some(("alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "individual-students-options.student-ids" => Some(("individualStudentsOptions.studentIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "due-date.month" => Some(("dueDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "due-date.day" => Some(("dueDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "due-date.year" => Some(("dueDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "due-date.day" => Some(("dueDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "due-date.month" => Some(("dueDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "due-time.hours" => Some(("dueTime.hours", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "due-time.nanos" => Some(("dueTime.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "due-time.seconds" => Some(("dueTime.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "due-time.minutes" => Some(("dueTime.minutes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "due-time.seconds" => Some(("dueTime.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "work-type" => Some(("workType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "assignee-mode", "assignment", "associated-with-developer", "choices", "course-id", "creation-time", "creator-user-id", "day", "description", "due-date", "due-time", "hours", "id", "individual-students-options", "max-points", "minutes", "month", "multiple-choice-question", "nanos", "scheduled-time", "seconds", "state", "student-ids", "student-work-folder", "submission-modification-mode", "title", "update-time", "work-type", "year"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "assignee-mode", "assignment", "associated-with-developer", "choices", "course-id", "creation-time", "creator-user-id", "day", "description", "due-date", "due-time", "hours", "id", "individual-students-options", "max-points", "minutes", "month", "multiple-choice-question", "nanos", "scheduled-time", "seconds", "state", "student-ids", "student-work-folder", "submission-modification-mode", "title", "topic-id", "update-time", "work-type", "year"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1082,35 +1083,36 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "topic-id" => Some(("topicId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "submission-modification-mode" => Some(("submissionModificationMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "alternate-link" => Some(("alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creator-user-id" => Some(("creatorUserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "course-id" => Some(("courseId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "assignment.student-work-folder.alternate-link" => Some(("assignment.studentWorkFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "assignment.student-work-folder.id" => Some(("assignment.studentWorkFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "assignment.student-work-folder.title" => Some(("assignment.studentWorkFolder.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "assignment.student-work-folder.id" => Some(("assignment.studentWorkFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "assignment.student-work-folder.alternate-link" => Some(("assignment.studentWorkFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "scheduled-time" => Some(("scheduledTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "associated-with-developer" => Some(("associatedWithDeveloper", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "assignee-mode" => Some(("assigneeMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "creator-user-id" => Some(("creatorUserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "multiple-choice-question.choices" => Some(("multipleChoiceQuestion.choices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "max-points" => Some(("maxPoints", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "multiple-choice-question.choices" => Some(("multipleChoiceQuestion.choices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "alternate-link" => Some(("alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "individual-students-options.student-ids" => Some(("individualStudentsOptions.studentIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "due-date.month" => Some(("dueDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "due-date.day" => Some(("dueDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "due-date.year" => Some(("dueDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "due-date.day" => Some(("dueDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "due-date.month" => Some(("dueDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "due-time.hours" => Some(("dueTime.hours", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "due-time.nanos" => Some(("dueTime.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "due-time.seconds" => Some(("dueTime.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "due-time.minutes" => Some(("dueTime.minutes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "due-time.seconds" => Some(("dueTime.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "work-type" => Some(("workType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "assignee-mode", "assignment", "associated-with-developer", "choices", "course-id", "creation-time", "creator-user-id", "day", "description", "due-date", "due-time", "hours", "id", "individual-students-options", "max-points", "minutes", "month", "multiple-choice-question", "nanos", "scheduled-time", "seconds", "state", "student-ids", "student-work-folder", "submission-modification-mode", "title", "update-time", "work-type", "year"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "assignee-mode", "assignment", "associated-with-developer", "choices", "course-id", "creation-time", "creator-user-id", "day", "description", "due-date", "due-time", "hours", "id", "individual-students-options", "max-points", "minutes", "month", "multiple-choice-question", "nanos", "scheduled-time", "seconds", "state", "student-ids", "student-work-folder", "submission-modification-mode", "title", "topic-id", "update-time", "work-type", "year"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1767,9 +1769,9 @@ impl<'n> Engine<'n> { "teacher-group-email" => Some(("teacherGroupEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "owner-id" => Some(("ownerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "calendar-id" => Some(("calendarId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "teacher-folder.alternate-link" => Some(("teacherFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "teacher-folder.id" => Some(("teacherFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "teacher-folder.title" => Some(("teacherFolder.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teacher-folder.id" => Some(("teacherFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teacher-folder.alternate-link" => Some(("teacherFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "course-state" => Some(("courseState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "alternate-link" => Some(("alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2042,9 +2044,9 @@ impl<'n> Engine<'n> { "teacher-group-email" => Some(("teacherGroupEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "owner-id" => Some(("ownerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "calendar-id" => Some(("calendarId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "teacher-folder.alternate-link" => Some(("teacherFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "teacher-folder.id" => Some(("teacherFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "teacher-folder.title" => Some(("teacherFolder.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teacher-folder.id" => Some(("teacherFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teacher-folder.alternate-link" => Some(("teacherFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "course-state" => Some(("courseState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "alternate-link" => Some(("alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2146,9 +2148,9 @@ impl<'n> Engine<'n> { "profile.name.given-name" => Some(("profile.name.givenName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.name.family-name" => Some(("profile.name.familyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.photo-url" => Some(("profile.photoUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "student-work-folder.alternate-link" => Some(("studentWorkFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "student-work-folder.id" => Some(("studentWorkFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "student-work-folder.title" => Some(("studentWorkFolder.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "student-work-folder.id" => Some(("studentWorkFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "student-work-folder.alternate-link" => Some(("studentWorkFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-id" => Some(("userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-link", "course-id", "email-address", "family-name", "full-name", "given-name", "id", "name", "photo-url", "profile", "student-work-folder", "title", "user-id", "verified-teacher"]); @@ -2401,6 +2403,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "course-id" => Some(("courseId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.id" => Some(("profile.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.verified-teacher" => Some(("profile.verifiedTeacher", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "profile.email-address" => Some(("profile.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2408,7 +2411,6 @@ impl<'n> Engine<'n> { "profile.name.given-name" => Some(("profile.name.givenName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.name.family-name" => Some(("profile.name.familyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.photo-url" => Some(("profile.photoUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "course-id" => Some(("courseId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-id" => Some(("userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["course-id", "email-address", "family-name", "full-name", "given-name", "id", "name", "photo-url", "profile", "user-id", "verified-teacher"]); @@ -2634,6 +2636,349 @@ impl<'n> Engine<'n> { } } + fn _courses_topics_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "course-id" => Some(("courseId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "topic-id" => Some(("topicId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["course-id", "name", "topic-id", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Topic = json::value::from_value(object).unwrap(); + let mut call = self.hub.courses().topics_create(request, opt.value_of("course-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _courses_topics_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.courses().topics_delete(opt.value_of("course-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _courses_topics_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.courses().topics_get(opt.value_of("course-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _courses_topics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.courses().topics_list(opt.value_of("course-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _courses_topics_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "course-id" => Some(("courseId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "topic-id" => Some(("topicId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["course-id", "name", "topic-id", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Topic = json::value::from_value(object).unwrap(); + let mut call = self.hub.courses().topics_patch(request, opt.value_of("course-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _courses_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -2668,9 +3013,9 @@ impl<'n> Engine<'n> { "teacher-group-email" => Some(("teacherGroupEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "owner-id" => Some(("ownerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "calendar-id" => Some(("calendarId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "teacher-folder.alternate-link" => Some(("teacherFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "teacher-folder.id" => Some(("teacherFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "teacher-folder.title" => Some(("teacherFolder.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teacher-folder.id" => Some(("teacherFolder.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teacher-folder.alternate-link" => Some(("teacherFolder.alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "course-state" => Some(("courseState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "alternate-link" => Some(("alternateLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3266,8 +3611,8 @@ impl<'n> Engine<'n> { "invitation-id" => Some(("invitationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "student-id" => Some(("studentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "invited-email-address" => Some(("invitedEmailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-time", "invitation-id", "invited-email-address", "state", "student-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -3472,8 +3817,8 @@ impl<'n> Engine<'n> { "invitation-id" => Some(("invitationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "student-id" => Some(("studentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "invited-email-address" => Some(("invitedEmailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-time", "invitation-id", "invited-email-address", "state", "student-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -3817,6 +4162,21 @@ impl<'n> Engine<'n> { ("teachers-list", Some(opt)) => { call_result = self._courses_teachers_list(opt, dry_run, &mut err); }, + ("topics-create", Some(opt)) => { + call_result = self._courses_topics_create(opt, dry_run, &mut err); + }, + ("topics-delete", Some(opt)) => { + call_result = self._courses_topics_delete(opt, dry_run, &mut err); + }, + ("topics-get", Some(opt)) => { + call_result = self._courses_topics_get(opt, dry_run, &mut err); + }, + ("topics-list", Some(opt)) => { + call_result = self._courses_topics_list(opt, dry_run, &mut err); + }, + ("topics-patch", Some(opt)) => { + call_result = self._courses_topics_patch(opt, dry_run, &mut err); + }, ("update", Some(opt)) => { call_result = self._courses_update(opt, dry_run, &mut err); }, @@ -3980,7 +4340,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("courses", "methods: 'aliases-create', 'aliases-delete', 'aliases-list', 'announcements-create', 'announcements-delete', 'announcements-get', 'announcements-list', 'announcements-modify-assignees', 'announcements-patch', 'course-work-create', 'course-work-delete', 'course-work-get', 'course-work-list', 'course-work-modify-assignees', 'course-work-patch', 'course-work-student-submissions-get', 'course-work-student-submissions-list', 'course-work-student-submissions-modify-attachments', 'course-work-student-submissions-patch', 'course-work-student-submissions-reclaim', 'course-work-student-submissions-return', 'course-work-student-submissions-turn-in', 'create', 'delete', 'get', 'list', 'patch', 'students-create', 'students-delete', 'students-get', 'students-list', 'teachers-create', 'teachers-delete', 'teachers-get', 'teachers-list' and 'update'", vec![ + ("courses", "methods: 'aliases-create', 'aliases-delete', 'aliases-list', 'announcements-create', 'announcements-delete', 'announcements-get', 'announcements-list', 'announcements-modify-assignees', 'announcements-patch', 'course-work-create', 'course-work-delete', 'course-work-get', 'course-work-list', 'course-work-modify-assignees', 'course-work-patch', 'course-work-student-submissions-get', 'course-work-student-submissions-list', 'course-work-student-submissions-modify-attachments', 'course-work-student-submissions-patch', 'course-work-student-submissions-reclaim', 'course-work-student-submissions-return', 'course-work-student-submissions-turn-in', 'create', 'delete', 'get', 'list', 'patch', 'students-create', 'students-delete', 'students-get', 'students-list', 'teachers-create', 'teachers-delete', 'teachers-get', 'teachers-list', 'topics-create', 'topics-delete', 'topics-get', 'topics-list', 'topics-patch' and 'update'", vec![ ("aliases-create", Some(r##"Creates an alias for a course. @@ -4810,7 +5170,7 @@ fn main() { Some(r##"Reclaims a student submission on behalf of the student that owns it. Reclaiming a student submission transfers ownership of attached Drive - files to the student and update the submission state. + files to the student and updates the submission state. Only the student that owns the requested student submission may call this method, and only for a student submission that has been turned in. @@ -5463,6 +5823,191 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("topics-create", + Some(r##"Creates a topic. + + This method returns the following error codes: + + * `PERMISSION_DENIED` if the requesting user is not permitted to access the + requested course, create a topic in the requested course, + or for access errors. + * `INVALID_ARGUMENT` if the request is malformed. + * `NOT_FOUND` if the requested course does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_topics-create", + vec![ + (Some(r##"course-id"##), + None, + Some(r##"Identifier of the course. + This identifier can be either the Classroom-assigned identifier or an + alias."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("topics-delete", + Some(r##"Deletes a topic. + + This method returns the following error codes: + + * `PERMISSION_DENIED` if the requesting user is not allowed to delete the + requested topic or for access errors. + * `FAILED_PRECONDITION` if the requested topic has already been + deleted. + * `NOT_FOUND` if no course or topic exists with the requested ID."##), + "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_topics-delete", + vec![ + (Some(r##"course-id"##), + None, + Some(r##"Identifier of the course. + This identifier can be either the Classroom-assigned identifier or an + alias."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Identifier of the topic to delete."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("topics-get", + Some(r##"Returns a topic. + + This method returns the following error codes: + + * `PERMISSION_DENIED` if the requesting user is not permitted to access the + requested course or topic, or for access errors. + * `INVALID_ARGUMENT` if the request is malformed. + * `NOT_FOUND` if the requested course or topic does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_topics-get", + vec![ + (Some(r##"course-id"##), + None, + Some(r##"Identifier of the course."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Identifier of the topic."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("topics-list", + Some(r##"Returns the list of topics that the requester is permitted to view. + + This method returns the following error codes: + + * `PERMISSION_DENIED` if the requesting user is not permitted to access + the requested course or for access errors. + * `INVALID_ARGUMENT` if the request is malformed. + * `NOT_FOUND` if the requested course does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_topics-list", + vec![ + (Some(r##"course-id"##), + None, + Some(r##"Identifier of the course. + This identifier can be either the Classroom-assigned identifier or an + alias."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("topics-patch", + Some(r##"Updates one or more fields of a topic. + + This method returns the following error codes: + + * `PERMISSION_DENIED` if the requesting developer project did not create + the corresponding topic or for access errors. + * `INVALID_ARGUMENT` if the request is malformed. + * `NOT_FOUND` if the requested course or topic does not exist"##), + "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_topics-patch", + vec![ + (Some(r##"course-id"##), + None, + Some(r##"Identifier of the course. + This identifier can be either the Classroom-assigned identifier or an + alias."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Identifier of the topic."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -6115,7 +6660,7 @@ fn main() { let mut app = App::new("classroom1") .author("Sebastian Thiel ") - .version("1.0.8+20181009") + .version("1.0.8+20190401") .about("Manages classes, rosters, and invitations in Google Classroom.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_classroom1_cli") .arg(Arg::with_name("url") diff --git a/gen/classroom1/Cargo.toml b/gen/classroom1/Cargo.toml index aeb61b9ad8..a5da27655a 100644 --- a/gen/classroom1/Cargo.toml +++ b/gen/classroom1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-classroom1" -version = "1.0.8+20181009" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with classroom (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/classroom1" homepage = "https://developers.google.com/classroom/" -documentation = "https://docs.rs/google-classroom1/1.0.8+20181009" +documentation = "https://docs.rs/google-classroom1/1.0.8+20190401" license = "MIT" keywords = ["classroom", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/classroom1/README.md b/gen/classroom1/README.md index c6e335f24c..f5ccf5ccf1 100644 --- a/gen/classroom1/README.md +++ b/gen/classroom1/README.md @@ -5,22 +5,22 @@ DO NOT EDIT ! --> The `google-classroom1` library allows access to all features of the *Google classroom* service. -This documentation was generated from *classroom* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *classroom* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *classroom* *v1* API can be found at the [official documentation site](https://developers.google.com/classroom/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.Classroom.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.Classroom.html) ... -* [courses](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.Course.html) - * [*aliases create*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseAliaseCreateCall.html), [*aliases delete*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseAliaseDeleteCall.html), [*aliases list*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseAliaseListCall.html), [*announcements create*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseAnnouncementCreateCall.html), [*announcements delete*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseAnnouncementDeleteCall.html), [*announcements get*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseAnnouncementGetCall.html), [*announcements list*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseAnnouncementListCall.html), [*announcements modify assignees*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseAnnouncementModifyAssigneeCall.html), [*announcements patch*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseAnnouncementPatchCall.html), [*course work create*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkCreateCall.html), [*course work delete*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkDeleteCall.html), [*course work get*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkGetCall.html), [*course work list*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkListCall.html), [*course work modify assignees*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkModifyAssigneeCall.html), [*course work patch*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkPatchCall.html), [*course work student submissions get*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkStudentSubmissionGetCall.html), [*course work student submissions list*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkStudentSubmissionListCall.html), [*course work student submissions modify attachments*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkStudentSubmissionModifyAttachmentCall.html), [*course work student submissions patch*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkStudentSubmissionPatchCall.html), [*course work student submissions reclaim*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkStudentSubmissionReclaimCall.html), [*course work student submissions return*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkStudentSubmissionReturnCall.html), [*course work student submissions turn in*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCourseWorkStudentSubmissionTurnInCall.html), [*create*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseCreateCall.html), [*delete*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseDeleteCall.html), [*get*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseGetCall.html), [*list*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseListCall.html), [*patch*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CoursePatchCall.html), [*students create*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseStudentCreateCall.html), [*students delete*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseStudentDeleteCall.html), [*students get*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseStudentGetCall.html), [*students list*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseStudentListCall.html), [*teachers create*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseTeacherCreateCall.html), [*teachers delete*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseTeacherDeleteCall.html), [*teachers get*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseTeacherGetCall.html), [*teachers list*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseTeacherListCall.html) and [*update*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.CourseUpdateCall.html) -* [invitations](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.Invitation.html) - * [*accept*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.InvitationAcceptCall.html), [*create*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.InvitationCreateCall.html), [*delete*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.InvitationDeleteCall.html), [*get*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.InvitationGetCall.html) and [*list*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.InvitationListCall.html) -* [registrations](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.Registration.html) - * [*create*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.RegistrationCreateCall.html) and [*delete*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.RegistrationDeleteCall.html) -* [user profiles](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.UserProfile.html) - * [*get*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.UserProfileGetCall.html), [*guardian invitations create*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.UserProfileGuardianInvitationCreateCall.html), [*guardian invitations get*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.UserProfileGuardianInvitationGetCall.html), [*guardian invitations list*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.UserProfileGuardianInvitationListCall.html), [*guardian invitations patch*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.UserProfileGuardianInvitationPatchCall.html), [*guardians delete*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.UserProfileGuardianDeleteCall.html), [*guardians get*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.UserProfileGuardianGetCall.html) and [*guardians list*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.UserProfileGuardianListCall.html) +* [courses](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.Course.html) + * [*aliases create*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseAliaseCreateCall.html), [*aliases delete*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseAliaseDeleteCall.html), [*aliases list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseAliaseListCall.html), [*announcements create*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseAnnouncementCreateCall.html), [*announcements delete*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseAnnouncementDeleteCall.html), [*announcements get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseAnnouncementGetCall.html), [*announcements list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseAnnouncementListCall.html), [*announcements modify assignees*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseAnnouncementModifyAssigneeCall.html), [*announcements patch*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseAnnouncementPatchCall.html), [*course work create*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkCreateCall.html), [*course work delete*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkDeleteCall.html), [*course work get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkGetCall.html), [*course work list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkListCall.html), [*course work modify assignees*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkModifyAssigneeCall.html), [*course work patch*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkPatchCall.html), [*course work student submissions get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkStudentSubmissionGetCall.html), [*course work student submissions list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkStudentSubmissionListCall.html), [*course work student submissions modify attachments*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkStudentSubmissionModifyAttachmentCall.html), [*course work student submissions patch*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkStudentSubmissionPatchCall.html), [*course work student submissions reclaim*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkStudentSubmissionReclaimCall.html), [*course work student submissions return*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkStudentSubmissionReturnCall.html), [*course work student submissions turn in*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCourseWorkStudentSubmissionTurnInCall.html), [*create*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseCreateCall.html), [*delete*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseDeleteCall.html), [*get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseGetCall.html), [*list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseListCall.html), [*patch*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CoursePatchCall.html), [*students create*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseStudentCreateCall.html), [*students delete*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseStudentDeleteCall.html), [*students get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseStudentGetCall.html), [*students list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseStudentListCall.html), [*teachers create*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseTeacherCreateCall.html), [*teachers delete*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseTeacherDeleteCall.html), [*teachers get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseTeacherGetCall.html), [*teachers list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseTeacherListCall.html), [*topics create*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseTopicCreateCall.html), [*topics delete*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseTopicDeleteCall.html), [*topics get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseTopicGetCall.html), [*topics list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseTopicListCall.html), [*topics patch*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseTopicPatchCall.html) and [*update*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.CourseUpdateCall.html) +* [invitations](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.Invitation.html) + * [*accept*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.InvitationAcceptCall.html), [*create*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.InvitationCreateCall.html), [*delete*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.InvitationDeleteCall.html), [*get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.InvitationGetCall.html) and [*list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.InvitationListCall.html) +* [registrations](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.Registration.html) + * [*create*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.RegistrationCreateCall.html) and [*delete*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.RegistrationDeleteCall.html) +* [user profiles](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.UserProfile.html) + * [*get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.UserProfileGetCall.html), [*guardian invitations create*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.UserProfileGuardianInvitationCreateCall.html), [*guardian invitations get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.UserProfileGuardianInvitationGetCall.html), [*guardian invitations list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.UserProfileGuardianInvitationListCall.html), [*guardian invitations patch*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.UserProfileGuardianInvitationPatchCall.html), [*guardians delete*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.UserProfileGuardianDeleteCall.html), [*guardians get*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.UserProfileGuardianGetCall.html) and [*guardians list*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.UserProfileGuardianListCall.html) @@ -29,17 +29,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/struct.Classroom.html)** +* **[Hub](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/struct.Classroom.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.Part.html)** + * **[Parts](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -56,23 +56,25 @@ Or specifically ... let r = hub.courses().announcements_modify_assignees(...).doit() let r = hub.courses().course_work_student_submissions_patch(...).doit() let r = hub.courses().announcements_list(...).doit() -let r = hub.courses().course_work_student_submissions_reclaim(...).doit() +let r = hub.courses().teachers_list(...).doit() let r = hub.courses().get(...).doit() let r = hub.courses().update(...).doit() -let r = hub.courses().students_delete(...).doit() +let r = hub.courses().students_get(...).doit() let r = hub.courses().teachers_get(...).doit() let r = hub.courses().course_work_list(...).doit() -let r = hub.courses().course_work_get(...).doit() +let r = hub.courses().topics_list(...).doit() +let r = hub.courses().course_work_student_submissions_reclaim(...).doit() let r = hub.courses().course_work_student_submissions_list(...).doit() let r = hub.courses().course_work_student_submissions_turn_in(...).doit() let r = hub.courses().course_work_student_submissions_modify_attachments(...).doit() let r = hub.courses().announcements_get(...).doit() -let r = hub.courses().teachers_list(...).doit() let r = hub.courses().course_work_student_submissions_return(...).doit() let r = hub.courses().aliases_list(...).doit() +let r = hub.courses().course_work_get(...).doit() let r = hub.courses().course_work_create(...).doit() let r = hub.courses().list(...).doit() let r = hub.courses().announcements_create(...).doit() +let r = hub.courses().topics_patch(...).doit() let r = hub.courses().announcements_patch(...).doit() let r = hub.courses().aliases_create(...).doit() let r = hub.courses().students_create(...).doit() @@ -83,12 +85,15 @@ let r = hub.courses().create(...).doit() let r = hub.courses().students_list(...).doit() let r = hub.courses().delete(...).doit() let r = hub.courses().course_work_patch(...).doit() +let r = hub.courses().topics_delete(...).doit() let r = hub.courses().patch(...).doit() -let r = hub.courses().students_get(...).doit() +let r = hub.courses().students_delete(...).doit() let r = hub.courses().teachers_delete(...).doit() let r = hub.courses().teachers_create(...).doit() let r = hub.courses().course_work_student_submissions_get(...).doit() +let r = hub.courses().topics_get(...).doit() let r = hub.courses().announcements_delete(...).doit() +let r = hub.courses().topics_create(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -170,17 +175,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -190,29 +195,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-classroom1/1.0.8+20181009/google_classroom1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-classroom1/1.0.8+20190401/google_classroom1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/classroom1/src/lib.rs b/gen/classroom1/src/lib.rs index 1cca291f6c..af8352461b 100644 --- a/gen/classroom1/src/lib.rs +++ b/gen/classroom1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *classroom* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *classroom* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *classroom* *v1* API can be found at the //! [official documentation site](https://developers.google.com/classroom/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Classroom.html) ... //! //! * [courses](struct.Course.html) -//! * [*aliases create*](struct.CourseAliaseCreateCall.html), [*aliases delete*](struct.CourseAliaseDeleteCall.html), [*aliases list*](struct.CourseAliaseListCall.html), [*announcements create*](struct.CourseAnnouncementCreateCall.html), [*announcements delete*](struct.CourseAnnouncementDeleteCall.html), [*announcements get*](struct.CourseAnnouncementGetCall.html), [*announcements list*](struct.CourseAnnouncementListCall.html), [*announcements modify assignees*](struct.CourseAnnouncementModifyAssigneeCall.html), [*announcements patch*](struct.CourseAnnouncementPatchCall.html), [*course work create*](struct.CourseCourseWorkCreateCall.html), [*course work delete*](struct.CourseCourseWorkDeleteCall.html), [*course work get*](struct.CourseCourseWorkGetCall.html), [*course work list*](struct.CourseCourseWorkListCall.html), [*course work modify assignees*](struct.CourseCourseWorkModifyAssigneeCall.html), [*course work patch*](struct.CourseCourseWorkPatchCall.html), [*course work student submissions get*](struct.CourseCourseWorkStudentSubmissionGetCall.html), [*course work student submissions list*](struct.CourseCourseWorkStudentSubmissionListCall.html), [*course work student submissions modify attachments*](struct.CourseCourseWorkStudentSubmissionModifyAttachmentCall.html), [*course work student submissions patch*](struct.CourseCourseWorkStudentSubmissionPatchCall.html), [*course work student submissions reclaim*](struct.CourseCourseWorkStudentSubmissionReclaimCall.html), [*course work student submissions return*](struct.CourseCourseWorkStudentSubmissionReturnCall.html), [*course work student submissions turn in*](struct.CourseCourseWorkStudentSubmissionTurnInCall.html), [*create*](struct.CourseCreateCall.html), [*delete*](struct.CourseDeleteCall.html), [*get*](struct.CourseGetCall.html), [*list*](struct.CourseListCall.html), [*patch*](struct.CoursePatchCall.html), [*students create*](struct.CourseStudentCreateCall.html), [*students delete*](struct.CourseStudentDeleteCall.html), [*students get*](struct.CourseStudentGetCall.html), [*students list*](struct.CourseStudentListCall.html), [*teachers create*](struct.CourseTeacherCreateCall.html), [*teachers delete*](struct.CourseTeacherDeleteCall.html), [*teachers get*](struct.CourseTeacherGetCall.html), [*teachers list*](struct.CourseTeacherListCall.html) and [*update*](struct.CourseUpdateCall.html) +//! * [*aliases create*](struct.CourseAliaseCreateCall.html), [*aliases delete*](struct.CourseAliaseDeleteCall.html), [*aliases list*](struct.CourseAliaseListCall.html), [*announcements create*](struct.CourseAnnouncementCreateCall.html), [*announcements delete*](struct.CourseAnnouncementDeleteCall.html), [*announcements get*](struct.CourseAnnouncementGetCall.html), [*announcements list*](struct.CourseAnnouncementListCall.html), [*announcements modify assignees*](struct.CourseAnnouncementModifyAssigneeCall.html), [*announcements patch*](struct.CourseAnnouncementPatchCall.html), [*course work create*](struct.CourseCourseWorkCreateCall.html), [*course work delete*](struct.CourseCourseWorkDeleteCall.html), [*course work get*](struct.CourseCourseWorkGetCall.html), [*course work list*](struct.CourseCourseWorkListCall.html), [*course work modify assignees*](struct.CourseCourseWorkModifyAssigneeCall.html), [*course work patch*](struct.CourseCourseWorkPatchCall.html), [*course work student submissions get*](struct.CourseCourseWorkStudentSubmissionGetCall.html), [*course work student submissions list*](struct.CourseCourseWorkStudentSubmissionListCall.html), [*course work student submissions modify attachments*](struct.CourseCourseWorkStudentSubmissionModifyAttachmentCall.html), [*course work student submissions patch*](struct.CourseCourseWorkStudentSubmissionPatchCall.html), [*course work student submissions reclaim*](struct.CourseCourseWorkStudentSubmissionReclaimCall.html), [*course work student submissions return*](struct.CourseCourseWorkStudentSubmissionReturnCall.html), [*course work student submissions turn in*](struct.CourseCourseWorkStudentSubmissionTurnInCall.html), [*create*](struct.CourseCreateCall.html), [*delete*](struct.CourseDeleteCall.html), [*get*](struct.CourseGetCall.html), [*list*](struct.CourseListCall.html), [*patch*](struct.CoursePatchCall.html), [*students create*](struct.CourseStudentCreateCall.html), [*students delete*](struct.CourseStudentDeleteCall.html), [*students get*](struct.CourseStudentGetCall.html), [*students list*](struct.CourseStudentListCall.html), [*teachers create*](struct.CourseTeacherCreateCall.html), [*teachers delete*](struct.CourseTeacherDeleteCall.html), [*teachers get*](struct.CourseTeacherGetCall.html), [*teachers list*](struct.CourseTeacherListCall.html), [*topics create*](struct.CourseTopicCreateCall.html), [*topics delete*](struct.CourseTopicDeleteCall.html), [*topics get*](struct.CourseTopicGetCall.html), [*topics list*](struct.CourseTopicListCall.html), [*topics patch*](struct.CourseTopicPatchCall.html) and [*update*](struct.CourseUpdateCall.html) //! * [invitations](struct.Invitation.html) //! * [*accept*](struct.InvitationAcceptCall.html), [*create*](struct.InvitationCreateCall.html), [*delete*](struct.InvitationDeleteCall.html), [*get*](struct.InvitationGetCall.html) and [*list*](struct.InvitationListCall.html) //! * [registrations](struct.Registration.html) @@ -56,23 +56,25 @@ //! let r = hub.courses().announcements_modify_assignees(...).doit() //! let r = hub.courses().course_work_student_submissions_patch(...).doit() //! let r = hub.courses().announcements_list(...).doit() -//! let r = hub.courses().course_work_student_submissions_reclaim(...).doit() +//! let r = hub.courses().teachers_list(...).doit() //! let r = hub.courses().get(...).doit() //! let r = hub.courses().update(...).doit() -//! let r = hub.courses().students_delete(...).doit() +//! let r = hub.courses().students_get(...).doit() //! let r = hub.courses().teachers_get(...).doit() //! let r = hub.courses().course_work_list(...).doit() -//! let r = hub.courses().course_work_get(...).doit() +//! let r = hub.courses().topics_list(...).doit() +//! let r = hub.courses().course_work_student_submissions_reclaim(...).doit() //! let r = hub.courses().course_work_student_submissions_list(...).doit() //! let r = hub.courses().course_work_student_submissions_turn_in(...).doit() //! let r = hub.courses().course_work_student_submissions_modify_attachments(...).doit() //! let r = hub.courses().announcements_get(...).doit() -//! let r = hub.courses().teachers_list(...).doit() //! let r = hub.courses().course_work_student_submissions_return(...).doit() //! let r = hub.courses().aliases_list(...).doit() +//! let r = hub.courses().course_work_get(...).doit() //! let r = hub.courses().course_work_create(...).doit() //! let r = hub.courses().list(...).doit() //! let r = hub.courses().announcements_create(...).doit() +//! let r = hub.courses().topics_patch(...).doit() //! let r = hub.courses().announcements_patch(...).doit() //! let r = hub.courses().aliases_create(...).doit() //! let r = hub.courses().students_create(...).doit() @@ -83,12 +85,15 @@ //! let r = hub.courses().students_list(...).doit() //! let r = hub.courses().delete(...).doit() //! let r = hub.courses().course_work_patch(...).doit() +//! let r = hub.courses().topics_delete(...).doit() //! let r = hub.courses().patch(...).doit() -//! let r = hub.courses().students_get(...).doit() +//! let r = hub.courses().students_delete(...).doit() //! let r = hub.courses().teachers_delete(...).doit() //! let r = hub.courses().teachers_create(...).doit() //! let r = hub.courses().course_work_student_submissions_get(...).doit() +//! let r = hub.courses().topics_get(...).doit() //! let r = hub.courses().announcements_delete(...).doit() +//! let r = hub.courses().topics_create(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -280,12 +285,12 @@ pub enum Scope { /// View and manage announcements in Google Classroom Announcement, + /// Manage your Google Classroom classes + Course, + /// View the profile photos of people in your classes ProfilePhoto, - /// View your course work and grades in Google Classroom - CourseworkMeReadonly, - /// View guardians for students in your Google Classroom classes GuardianlinkStudentReadonly, @@ -307,12 +312,12 @@ pub enum Scope { /// View your Google Classroom class rosters RosterReadonly, - /// Manage your Google Classroom classes - Course, - /// View course work and grades for students in the Google Classroom classes you teach or administer CourseworkStudentReadonly, + /// View your course work and grades in Google Classroom + CourseworkMeReadonly, + /// View announcements in Google Classroom AnnouncementReadonly, @@ -324,6 +329,12 @@ pub enum Scope { /// Receive notifications about your Google Classroom data PushNotification, + + /// View topics in Google Classroom + TopicReadonly, + + /// See, create, and edit topics in Google Classroom + Topic, } impl AsRef for Scope { @@ -332,8 +343,8 @@ impl AsRef for Scope { Scope::ProfileEmail => "https://www.googleapis.com/auth/classroom.profile.emails", Scope::GuardianlinkStudent => "https://www.googleapis.com/auth/classroom.guardianlinks.students", Scope::Announcement => "https://www.googleapis.com/auth/classroom.announcements", + Scope::Course => "https://www.googleapis.com/auth/classroom.courses", Scope::ProfilePhoto => "https://www.googleapis.com/auth/classroom.profile.photos", - Scope::CourseworkMeReadonly => "https://www.googleapis.com/auth/classroom.coursework.me.readonly", Scope::GuardianlinkStudentReadonly => "https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly", Scope::StudentSubmissionStudentReadonly => "https://www.googleapis.com/auth/classroom.student-submissions.students.readonly", Scope::Roster => "https://www.googleapis.com/auth/classroom.rosters", @@ -341,19 +352,21 @@ impl AsRef for Scope { Scope::CourseworkMe => "https://www.googleapis.com/auth/classroom.coursework.me", Scope::StudentSubmissionMeReadonly => "https://www.googleapis.com/auth/classroom.student-submissions.me.readonly", Scope::RosterReadonly => "https://www.googleapis.com/auth/classroom.rosters.readonly", - Scope::Course => "https://www.googleapis.com/auth/classroom.courses", Scope::CourseworkStudentReadonly => "https://www.googleapis.com/auth/classroom.coursework.students.readonly", + Scope::CourseworkMeReadonly => "https://www.googleapis.com/auth/classroom.coursework.me.readonly", Scope::AnnouncementReadonly => "https://www.googleapis.com/auth/classroom.announcements.readonly", Scope::CourseworkStudent => "https://www.googleapis.com/auth/classroom.coursework.students", Scope::CourseReadonly => "https://www.googleapis.com/auth/classroom.courses.readonly", Scope::PushNotification => "https://www.googleapis.com/auth/classroom.push-notifications", + Scope::TopicReadonly => "https://www.googleapis.com/auth/classroom.topics.readonly", + Scope::Topic => "https://www.googleapis.com/auth/classroom.topics", } } } impl Default for Scope { fn default() -> Scope { - Scope::CourseworkMeReadonly + Scope::GuardianlinkStudentReadonly } } @@ -670,24 +683,27 @@ pub struct Attachment { impl Part for Attachment {} -/// Student work for an assignment. +/// Represents a time of day. The date and time zone are either not significant +/// or are specified elsewhere. An API may choose to allow leap seconds. Related +/// types are google.type.Date and `google.protobuf.Timestamp`. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AssignmentSubmission { - /// Attachments added by the student. - /// Drive files that correspond to materials with a share mode of - /// STUDENT_COPY may not exist yet if the student has not accessed the - /// assignment in Classroom. - /// - /// Some attachment metadata is only populated if the requesting user has - /// permission to access it. Identifier and alternate_link fields are always - /// available, but others (e.g. title) may not be. - pub attachments: Option>, +pub struct TimeOfDay { + /// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose + /// to allow the value "24:00:00" for scenarios like business closing time. + pub hours: Option, + /// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + pub nanos: Option, + /// Minutes of hour of day. Must be from 0 to 59. + pub minutes: Option, + /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may + /// allow the value 60 if it allows leap-seconds. + pub seconds: Option, } -impl Part for AssignmentSubmission {} +impl Part for TimeOfDay {} /// Request to return a student submission. @@ -721,15 +737,16 @@ impl RequestValue for ReturnStudentSubmissionRequest {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [delete invitations](struct.InvitationDeleteCall.html) (response) -/// * [course work delete courses](struct.CourseCourseWorkDeleteCall.html) (response) +/// * [course work student submissions turn in courses](struct.CourseCourseWorkStudentSubmissionTurnInCall.html) (response) /// * [course work student submissions reclaim courses](struct.CourseCourseWorkStudentSubmissionReclaimCall.html) (response) /// * [delete courses](struct.CourseDeleteCall.html) (response) /// * [teachers delete courses](struct.CourseTeacherDeleteCall.html) (response) /// * [guardians delete user profiles](struct.UserProfileGuardianDeleteCall.html) (response) /// * [students delete courses](struct.CourseStudentDeleteCall.html) (response) /// * [aliases delete courses](struct.CourseAliaseDeleteCall.html) (response) -/// * [course work student submissions turn in courses](struct.CourseCourseWorkStudentSubmissionTurnInCall.html) (response) +/// * [course work delete courses](struct.CourseCourseWorkDeleteCall.html) (response) /// * [course work student submissions return courses](struct.CourseCourseWorkStudentSubmissionReturnCall.html) (response) +/// * [topics delete courses](struct.CourseTopicDeleteCall.html) (response) /// * [delete registrations](struct.RegistrationDeleteCall.html) (response) /// * [announcements delete courses](struct.CourseAnnouncementDeleteCall.html) (response) /// * [accept invitations](struct.InvitationAcceptCall.html) (response) @@ -810,27 +827,24 @@ pub struct CourseMaterialSet { impl Part for CourseMaterialSet {} -/// Represents a time of day. The date and time zone are either not significant -/// or are specified elsewhere. An API may choose to allow leap seconds. Related -/// types are google.type.Date and `google.protobuf.Timestamp`. +/// Student work for an assignment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TimeOfDay { - /// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose - /// to allow the value "24:00:00" for scenarios like business closing time. - pub hours: Option, - /// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. - pub nanos: Option, - /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may - /// allow the value 60 if it allows leap-seconds. - pub seconds: Option, - /// Minutes of hour of day. Must be from 0 to 59. - pub minutes: Option, +pub struct AssignmentSubmission { + /// Attachments added by the student. + /// Drive files that correspond to materials with a share mode of + /// STUDENT_COPY may not exist yet if the student has not accessed the + /// assignment in Classroom. + /// + /// Some attachment metadata is only populated if the requesting user has + /// permission to access it. Identifier and alternate_link fields are always + /// available, but others (e.g. title) may not be. + pub attachments: Option>, } -impl Part for TimeOfDay {} +impl Part for AssignmentSubmission {} /// Google Forms item. @@ -873,23 +887,25 @@ impl Part for Form {} /// * [announcements modify assignees courses](struct.CourseAnnouncementModifyAssigneeCall.html) (none) /// * [course work student submissions patch courses](struct.CourseCourseWorkStudentSubmissionPatchCall.html) (none) /// * [announcements list courses](struct.CourseAnnouncementListCall.html) (none) -/// * [course work student submissions reclaim courses](struct.CourseCourseWorkStudentSubmissionReclaimCall.html) (none) +/// * [teachers list courses](struct.CourseTeacherListCall.html) (none) /// * [get courses](struct.CourseGetCall.html) (response) /// * [update courses](struct.CourseUpdateCall.html) (request|response) -/// * [students delete courses](struct.CourseStudentDeleteCall.html) (none) +/// * [students get courses](struct.CourseStudentGetCall.html) (none) /// * [teachers get courses](struct.CourseTeacherGetCall.html) (none) /// * [course work list courses](struct.CourseCourseWorkListCall.html) (none) -/// * [course work get courses](struct.CourseCourseWorkGetCall.html) (none) +/// * [topics list courses](struct.CourseTopicListCall.html) (none) +/// * [course work student submissions reclaim courses](struct.CourseCourseWorkStudentSubmissionReclaimCall.html) (none) /// * [course work student submissions list courses](struct.CourseCourseWorkStudentSubmissionListCall.html) (none) /// * [course work student submissions turn in courses](struct.CourseCourseWorkStudentSubmissionTurnInCall.html) (none) /// * [course work student submissions modify attachments courses](struct.CourseCourseWorkStudentSubmissionModifyAttachmentCall.html) (none) /// * [announcements get courses](struct.CourseAnnouncementGetCall.html) (none) -/// * [teachers list courses](struct.CourseTeacherListCall.html) (none) /// * [course work student submissions return courses](struct.CourseCourseWorkStudentSubmissionReturnCall.html) (none) /// * [aliases list courses](struct.CourseAliaseListCall.html) (none) +/// * [course work get courses](struct.CourseCourseWorkGetCall.html) (none) /// * [course work create courses](struct.CourseCourseWorkCreateCall.html) (none) /// * [list courses](struct.CourseListCall.html) (none) /// * [announcements create courses](struct.CourseAnnouncementCreateCall.html) (none) +/// * [topics patch courses](struct.CourseTopicPatchCall.html) (none) /// * [announcements patch courses](struct.CourseAnnouncementPatchCall.html) (none) /// * [aliases create courses](struct.CourseAliaseCreateCall.html) (none) /// * [students create courses](struct.CourseStudentCreateCall.html) (none) @@ -900,12 +916,15 @@ impl Part for Form {} /// * [students list courses](struct.CourseStudentListCall.html) (none) /// * [delete courses](struct.CourseDeleteCall.html) (none) /// * [course work patch courses](struct.CourseCourseWorkPatchCall.html) (none) +/// * [topics delete courses](struct.CourseTopicDeleteCall.html) (none) /// * [patch courses](struct.CoursePatchCall.html) (request|response) -/// * [students get courses](struct.CourseStudentGetCall.html) (none) +/// * [students delete courses](struct.CourseStudentDeleteCall.html) (none) /// * [teachers delete courses](struct.CourseTeacherDeleteCall.html) (none) /// * [teachers create courses](struct.CourseTeacherCreateCall.html) (none) /// * [course work student submissions get courses](struct.CourseCourseWorkStudentSubmissionGetCall.html) (none) +/// * [topics get courses](struct.CourseTopicGetCall.html) (none) /// * [announcements delete courses](struct.CourseAnnouncementDeleteCall.html) (none) +/// * [topics create courses](struct.CourseTopicCreateCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Course { @@ -1094,10 +1113,11 @@ impl Part for Material {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct YouTubeVideo { - /// Title of the YouTube video. + /// URL that can be used to view the YouTube video. /// /// Read-only. - pub title: Option, + #[serde(rename="alternateLink")] + pub alternate_link: Option, /// URL of a thumbnail image of the YouTube video. /// /// Read-only. @@ -1105,11 +1125,10 @@ pub struct YouTubeVideo { pub thumbnail_url: Option, /// YouTube API resource ID. pub id: Option, - /// URL that can be used to view the YouTube video. + /// Title of the YouTube video. /// /// Read-only. - #[serde(rename="alternateLink")] - pub alternate_link: Option, + pub title: Option, } impl Part for YouTubeVideo {} @@ -1166,10 +1185,11 @@ impl ResponseResult for ListGuardiansResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DriveFile { - /// Title of the Drive item. + /// URL that can be used to access the Drive item. /// /// Read-only. - pub title: Option, + #[serde(rename="alternateLink")] + pub alternate_link: Option, /// URL of a thumbnail image of the Drive item. /// /// Read-only. @@ -1177,11 +1197,10 @@ pub struct DriveFile { pub thumbnail_url: Option, /// Drive API resource ID. pub id: Option, - /// URL that can be used to access the Drive item. + /// Title of the Drive item. /// /// Read-only. - #[serde(rename="alternateLink")] - pub alternate_link: Option, + pub title: Option, } impl Part for DriveFile {} @@ -1253,26 +1272,34 @@ impl RequestValue for Student {} impl ResponseResult for Student {} -/// Response when listing course work. +/// Represents a whole or partial calendar date, e.g. a birthday. The time of day +/// and time zone are either specified elsewhere or are not significant. The date +/// is relative to the Proleptic Gregorian Calendar. This can represent: /// -/// # Activities +/// * A full date, with non-zero year, month and day values +/// * A month and day value, with a zero year, e.g. an anniversary +/// * A year on its own, with zero month and day values +/// * A year and month value, with a zero day, e.g. a credit card expiration date /// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// Related types are google.type.TimeOfDay and `google.protobuf.Timestamp`. /// -/// * [announcements list courses](struct.CourseAnnouncementListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListAnnouncementsResponse { - /// Token identifying the next page of results to return. If empty, no further - /// results are available. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Announcement items that match the request. - pub announcements: Option>, +pub struct Date { + /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a + /// month and day. + pub month: Option, + /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0 + /// if specifying a year by itself or a year and month where the day is not + /// significant. + pub day: Option, + /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without + /// a year. + pub year: Option, } -impl ResponseResult for ListAnnouncementsResponse {} +impl Part for Date {} /// Drive file that is used as material for course work. @@ -1292,17 +1319,27 @@ pub struct SharedDriveFile { impl Part for SharedDriveFile {} -/// Additional details for multiple-choice questions. +/// Response when listing student submissions. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [course work student submissions list courses](struct.CourseCourseWorkStudentSubmissionListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MultipleChoiceQuestion { - /// Possible choices. - pub choices: Option>, +pub struct ListStudentSubmissionsResponse { + /// Token identifying the next page of results to return. If empty, no further + /// results are available. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Student work that matches the request. + #[serde(rename="studentSubmissions")] + pub student_submissions: Option>, } -impl Part for MultipleChoiceQuestion {} +impl ResponseResult for ListStudentSubmissionsResponse {} /// Response when listing courses. @@ -1356,14 +1393,14 @@ impl ResponseResult for ListGuardianInvitationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CourseMaterial { - /// Youtube video attachment. - #[serde(rename="youTubeVideo")] - pub you_tube_video: Option, + /// Link atatchment. + pub link: Option, /// Google Drive file attachment. #[serde(rename="driveFile")] pub drive_file: Option, - /// Link atatchment. - pub link: Option, + /// Youtube video attachment. + #[serde(rename="youTubeVideo")] + pub you_tube_video: Option, /// Google Forms attachment. pub form: Option
, } @@ -1380,16 +1417,16 @@ pub struct GradeHistory { /// When the grade of the submission was changed. #[serde(rename="gradeTimestamp")] pub grade_timestamp: Option, + /// The teacher who made the grade change. + #[serde(rename="actorUserId")] + pub actor_user_id: Option, + /// The numerator of the grade at this time in the submission grade history. + #[serde(rename="pointsEarned")] + pub points_earned: Option, /// The denominator of the grade at this time in the submission grade /// history. #[serde(rename="maxPoints")] pub max_points: Option, - /// The numerator of the grade at this time in the submission grade history. - #[serde(rename="pointsEarned")] - pub points_earned: Option, - /// The teacher who made the grade change. - #[serde(rename="actorUserId")] - pub actor_user_id: Option, /// The type of grade change at this time in the submission grade history. #[serde(rename="gradeChangeType")] pub grade_change_type: Option, @@ -1447,40 +1484,34 @@ pub struct ListInvitationsResponse { impl ResponseResult for ListInvitationsResponse {} -/// An instruction to Classroom to send notifications from the `feed` to the -/// provided destination. +/// Association between a student and a guardian of that student. The guardian +/// may receive information about the student's course work. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [delete registrations](struct.RegistrationDeleteCall.html) (none) -/// * [create registrations](struct.RegistrationCreateCall.html) (request|response) +/// * [guardians get user profiles](struct.UserProfileGuardianGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Registration { - /// Specification for the class of notifications that Classroom should deliver - /// to the destination. - pub feed: Option, - /// A server-generated unique identifier for this `Registration`. - /// - /// Read-only. - #[serde(rename="registrationId")] - pub registration_id: Option, - /// The time until which the `Registration` is effective. - /// - /// This is a read-only field assigned by the server. - #[serde(rename="expiryTime")] - pub expiry_time: Option, - /// The Cloud Pub/Sub topic that notifications are to be sent to. - #[serde(rename="cloudPubsubTopic")] - pub cloud_pubsub_topic: Option, +pub struct Guardian { + /// Identifier for the guardian. + #[serde(rename="guardianId")] + pub guardian_id: Option, + /// The email address to which the initial guardian invitation was sent. + /// This field is only visible to domain administrators. + #[serde(rename="invitedEmailAddress")] + pub invited_email_address: Option, + /// Identifier for the student to whom the guardian relationship applies. + #[serde(rename="studentId")] + pub student_id: Option, + /// User profile for the guardian. + #[serde(rename="guardianProfile")] + pub guardian_profile: Option, } -impl RequestValue for Registration {} -impl Resource for Registration {} -impl ResponseResult for Registration {} +impl ResponseResult for Guardian {} /// The history of the submission. This currently includes state and grade @@ -1507,50 +1538,42 @@ impl Part for SubmissionHistory {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DriveFolder { - /// Title of the Drive folder. - /// - /// Read-only. - pub title: Option, - /// Drive API resource ID. - pub id: Option, /// URL that can be used to access the Drive folder. /// /// Read-only. #[serde(rename="alternateLink")] pub alternate_link: Option, + /// Drive API resource ID. + pub id: Option, + /// Title of the Drive folder. + /// + /// Read-only. + pub title: Option, } impl Part for DriveFolder {} -/// Represents a whole or partial calendar date, e.g. a birthday. The time of day -/// and time zone are either specified elsewhere or are not significant. The date -/// is relative to the Proleptic Gregorian Calendar. This can represent: +/// Response when listing course work. /// -/// * A full date, with non-zero year, month and day values -/// * A month and day value, with a zero year, e.g. an anniversary -/// * A year on its own, with zero month and day values -/// * A year and month value, with a zero day, e.g. a credit card expiration date +/// # Activities /// -/// Related types are google.type.TimeOfDay and `google.protobuf.Timestamp`. +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// * [announcements list courses](struct.CourseAnnouncementListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Date { - /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without - /// a year. - pub year: Option, - /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0 - /// if specifying a year by itself or a year and month where the day is not - /// significant. - pub day: Option, - /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a - /// month and day. - pub month: Option, +pub struct ListAnnouncementsResponse { + /// Token identifying the next page of results to return. If empty, no further + /// results are available. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Announcement items that match the request. + pub announcements: Option>, } -impl Part for Date {} +impl ResponseResult for ListAnnouncementsResponse {} /// An invitation to join a course. @@ -1606,12 +1629,12 @@ impl ResponseResult for Invitation {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListStudentsResponse { - /// Students who match the list request. - pub students: Option>, /// Token identifying the next page of results to return. If empty, no further /// results are available. #[serde(rename="nextPageToken")] pub next_page_token: Option, + /// Students who match the list request. + pub students: Option>, } impl ResponseResult for ListStudentsResponse {} @@ -1657,27 +1680,17 @@ pub struct ModifyAnnouncementAssigneesRequest { impl RequestValue for ModifyAnnouncementAssigneesRequest {} -/// Response when listing student submissions. +/// Additional details for multiple-choice questions. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [course work student submissions list courses](struct.CourseCourseWorkStudentSubmissionListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListStudentSubmissionsResponse { - /// Token identifying the next page of results to return. If empty, no further - /// results are available. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Student work that matches the request. - #[serde(rename="studentSubmissions")] - pub student_submissions: Option>, +pub struct MultipleChoiceQuestion { + /// Possible choices. + pub choices: Option>, } -impl ResponseResult for ListStudentSubmissionsResponse {} +impl Part for MultipleChoiceQuestion {} /// A class of notifications that an application can register to receive. @@ -1754,6 +1767,10 @@ impl RequestValue for ReclaimStudentSubmissionRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CourseWork { + /// Identifier for the topic that this coursework is associated with. + /// Must match an existing topic in the course. + #[serde(rename="topicId")] + pub topic_id: Option, /// Timestamp of the most recent change to this course work. /// /// Read-only. @@ -1794,7 +1811,7 @@ pub struct CourseWork { /// This must be a non-negative integer value. #[serde(rename="maxPoints")] pub max_points: Option, - /// Optional date, in UTC, that submissions for this this course work are due. + /// Optional date, in UTC, that submissions for this course work are due. /// This must be specified if `due_time` is specified. #[serde(rename="dueDate")] pub due_date: Option, @@ -1807,17 +1824,17 @@ pub struct CourseWork { /// If unspecified, the default value is `MODIFIABLE_UNTIL_TURNED_IN`. #[serde(rename="submissionModificationMode")] pub submission_modification_mode: Option, + /// Identifier for the user that created the coursework. + /// + /// Read-only. + #[serde(rename="creatorUserId")] + pub creator_user_id: Option, /// Absolute link to this course work in the Classroom web UI. /// This is only populated if `state` is `PUBLISHED`. /// /// Read-only. #[serde(rename="alternateLink")] pub alternate_link: Option, - /// Identifier for the user that created the coursework. - /// - /// Read-only. - #[serde(rename="creatorUserId")] - pub creator_user_id: Option, /// Timestamp when this course work was created. /// /// Read-only. @@ -1844,7 +1861,7 @@ pub struct CourseWork { /// specified in this field will be assigned the coursework. #[serde(rename="individualStudentsOptions")] pub individual_students_options: Option, - /// Optional time of day, in UTC, that submissions for this this course work + /// Optional time of day, in UTC, that submissions for this course work /// are due. /// This must be specified if `due_date` is specified. #[serde(rename="dueTime")] @@ -1977,6 +1994,28 @@ impl RequestValue for StudentSubmission {} impl ResponseResult for StudentSubmission {} +/// Response when listing topics. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [topics list courses](struct.CourseTopicListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListTopicResponse { + /// Token identifying the next page of results to return. If empty, no further + /// results are available. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Topic items that match the request. + pub topic: Option>, +} + +impl ResponseResult for ListTopicResponse {} + + /// Information about a `Feed` with a `feed_type` of `COURSE_ROSTER_CHANGES`. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -2003,15 +2042,15 @@ impl Part for CourseRosterChangesInfo {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Teacher { - /// Global user information for the teacher. - /// - /// Read-only. - pub profile: Option, /// Identifier of the course. /// /// Read-only. #[serde(rename="courseId")] pub course_id: Option, + /// Global user information for the teacher. + /// + /// Read-only. + pub profile: Option, /// Identifier of the user. /// /// When specified as a parameter of a request, this identifier can be one of @@ -2028,6 +2067,46 @@ impl RequestValue for Teacher {} impl ResponseResult for Teacher {} +/// Topic created by a teacher for the course +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [topics create courses](struct.CourseTopicCreateCall.html) (request|response) +/// * [topics patch courses](struct.CourseTopicPatchCall.html) (request|response) +/// * [topics get courses](struct.CourseTopicGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Topic { + /// Identifier of the course. + /// + /// Read-only. + #[serde(rename="courseId")] + pub course_id: Option, + /// Unique identifier for the topic. + /// + /// Read-only. + #[serde(rename="topicId")] + pub topic_id: Option, + /// The time the topic was last updated by the system. + /// + /// Read-only. + #[serde(rename="updateTime")] + pub update_time: Option, + /// The name of the topic, generated by the user. + /// Leading and trailing whitespaces, if any, will be trimmed. Also, multiple + /// consecutive whitespaces will be collapsed into one inside the name. The + /// result must be a non-empty string. Topic names are case sensitive, and must + /// be no longer than 100 characters. + pub name: Option, +} + +impl RequestValue for Topic {} +impl ResponseResult for Topic {} + + /// Request to modify assignee mode and options of a coursework. /// /// # Activities @@ -2106,34 +2185,40 @@ impl RequestValue for CourseAlias {} impl ResponseResult for CourseAlias {} -/// Association between a student and a guardian of that student. The guardian -/// may receive information about the student's course work. +/// An instruction to Classroom to send notifications from the `feed` to the +/// provided destination. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [guardians get user profiles](struct.UserProfileGuardianGetCall.html) (response) +/// * [delete registrations](struct.RegistrationDeleteCall.html) (none) +/// * [create registrations](struct.RegistrationCreateCall.html) (request|response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Guardian { - /// Identifier for the guardian. - #[serde(rename="guardianId")] - pub guardian_id: Option, - /// The email address to which the initial guardian invitation was sent. - /// This field is only visible to domain administrators. - #[serde(rename="invitedEmailAddress")] - pub invited_email_address: Option, - /// Identifier for the student to whom the guardian relationship applies. - #[serde(rename="studentId")] - pub student_id: Option, - /// User profile for the guardian. - #[serde(rename="guardianProfile")] - pub guardian_profile: Option, +pub struct Registration { + /// Specification for the class of notifications that Classroom should deliver + /// to the destination. + pub feed: Option, + /// A server-generated unique identifier for this `Registration`. + /// + /// Read-only. + #[serde(rename="registrationId")] + pub registration_id: Option, + /// The time until which the `Registration` is effective. + /// + /// This is a read-only field assigned by the server. + #[serde(rename="expiryTime")] + pub expiry_time: Option, + /// The Cloud Pub/Sub topic that notifications are to be sent to. + #[serde(rename="cloudPubsubTopic")] + pub cloud_pubsub_topic: Option, } -impl ResponseResult for Guardian {} +impl RequestValue for Registration {} +impl Resource for Registration {} +impl ResponseResult for Registration {} /// Global user permission description. @@ -2218,12 +2303,12 @@ pub struct GuardianInvitation { /// Read-only. #[serde(rename="creationTime")] pub creation_time: Option, - /// The state that this invitation is in. - pub state: Option, /// Email address that the invitation was sent to. /// This field is only visible to domain administrators. #[serde(rename="invitedEmailAddress")] pub invited_email_address: Option, + /// The state that this invitation is in. + pub state: Option, } impl RequestValue for GuardianInvitation {} @@ -2259,7 +2344,7 @@ impl ResponseResult for GuardianInvitation {} /// ::default(), None); /// let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `aliases_create(...)`, `aliases_delete(...)`, `aliases_list(...)`, `announcements_create(...)`, `announcements_delete(...)`, `announcements_get(...)`, `announcements_list(...)`, `announcements_modify_assignees(...)`, `announcements_patch(...)`, `course_work_create(...)`, `course_work_delete(...)`, `course_work_get(...)`, `course_work_list(...)`, `course_work_modify_assignees(...)`, `course_work_patch(...)`, `course_work_student_submissions_get(...)`, `course_work_student_submissions_list(...)`, `course_work_student_submissions_modify_attachments(...)`, `course_work_student_submissions_patch(...)`, `course_work_student_submissions_reclaim(...)`, `course_work_student_submissions_return(...)`, `course_work_student_submissions_turn_in(...)`, `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `patch(...)`, `students_create(...)`, `students_delete(...)`, `students_get(...)`, `students_list(...)`, `teachers_create(...)`, `teachers_delete(...)`, `teachers_get(...)`, `teachers_list(...)` and `update(...)` +/// // like `aliases_create(...)`, `aliases_delete(...)`, `aliases_list(...)`, `announcements_create(...)`, `announcements_delete(...)`, `announcements_get(...)`, `announcements_list(...)`, `announcements_modify_assignees(...)`, `announcements_patch(...)`, `course_work_create(...)`, `course_work_delete(...)`, `course_work_get(...)`, `course_work_list(...)`, `course_work_modify_assignees(...)`, `course_work_patch(...)`, `course_work_student_submissions_get(...)`, `course_work_student_submissions_list(...)`, `course_work_student_submissions_modify_attachments(...)`, `course_work_student_submissions_patch(...)`, `course_work_student_submissions_reclaim(...)`, `course_work_student_submissions_return(...)`, `course_work_student_submissions_turn_in(...)`, `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `patch(...)`, `students_create(...)`, `students_delete(...)`, `students_get(...)`, `students_list(...)`, `teachers_create(...)`, `teachers_delete(...)`, `teachers_get(...)`, `teachers_list(...)`, `topics_create(...)`, `topics_delete(...)`, `topics_get(...)`, `topics_list(...)`, `topics_patch(...)` and `update(...)` /// // to build up your call. /// let rb = hub.courses(); /// # } @@ -2385,43 +2470,25 @@ impl<'a, C, A> CourseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Reclaims a student submission on behalf of the student that owns it. - /// - /// Reclaiming a student submission transfers ownership of attached Drive - /// files to the student and update the submission state. - /// - /// Only the student that owns the requested student submission may call this - /// method, and only for a student submission that has been turned in. - /// - /// This request must be made by the Developer Console project of the - /// [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to - /// create the corresponding course work item. + /// Returns a list of teachers of this course that the requester + /// is permitted to view. /// /// This method returns the following error codes: /// - /// * `PERMISSION_DENIED` if the requesting user is not permitted to access the - /// requested course or course work, unsubmit the requested student submission, - /// or for access errors. - /// * `FAILED_PRECONDITION` if the student submission has not been turned in. - /// * `INVALID_ARGUMENT` if the request is malformed. - /// * `NOT_FOUND` if the requested course, course work, or student submission - /// does not exist. + /// * `NOT_FOUND` if the course does not exist. + /// * `PERMISSION_DENIED` for access errors. /// /// # Arguments /// - /// * `request` - No description provided. /// * `courseId` - Identifier of the course. /// This identifier can be either the Classroom-assigned identifier or an /// alias. - /// * `courseWorkId` - Identifier of the course work. - /// * `id` - Identifier of the student submission. - pub fn course_work_student_submissions_reclaim(&self, request: ReclaimStudentSubmissionRequest, course_id: &str, course_work_id: &str, id: &str) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { - CourseCourseWorkStudentSubmissionReclaimCall { + pub fn teachers_list(&self, course_id: &str) -> CourseTeacherListCall<'a, C, A> { + CourseTeacherListCall { hub: self.hub, - _request: request, _course_id: course_id.to_string(), - _course_work_id: course_work_id.to_string(), - _id: id.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2484,11 +2551,11 @@ impl<'a, C, A> CourseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a student of a course. + /// Returns a student of a course. /// /// This method returns the following error codes: /// - /// * `PERMISSION_DENIED` if the requesting user is not permitted to delete + /// * `PERMISSION_DENIED` if the requesting user is not permitted to view /// students of this course or for access errors. /// * `NOT_FOUND` if no student of this course has the requested ID or if the /// course does not exist. @@ -2498,13 +2565,13 @@ impl<'a, C, A> CourseMethods<'a, C, A> { /// * `courseId` - Identifier of the course. /// This identifier can be either the Classroom-assigned identifier or an /// alias. - /// * `userId` - Identifier of the student to delete. The identifier can be one of the + /// * `userId` - Identifier of the student to return. The identifier can be one of the /// following: /// * the numeric identifier for the user /// * the email address of the user /// * the string literal `"me"`, indicating the requesting user - pub fn students_delete(&self, course_id: &str, user_id: &str) -> CourseStudentDeleteCall<'a, C, A> { - CourseStudentDeleteCall { + pub fn students_get(&self, course_id: &str, user_id: &str) -> CourseStudentGetCall<'a, C, A> { + CourseStudentGetCall { hub: self.hub, _course_id: course_id.to_string(), _user_id: user_id.to_string(), @@ -2581,25 +2648,70 @@ impl<'a, C, A> CourseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns course work. + /// Returns the list of topics that the requester is permitted to view. /// /// This method returns the following error codes: /// - /// * `PERMISSION_DENIED` if the requesting user is not permitted to access the - /// requested course or course work, or for access errors. + /// * `PERMISSION_DENIED` if the requesting user is not permitted to access + /// the requested course or for access errors. /// * `INVALID_ARGUMENT` if the request is malformed. - /// * `NOT_FOUND` if the requested course or course work does not exist. + /// * `NOT_FOUND` if the requested course does not exist. /// /// # Arguments /// /// * `courseId` - Identifier of the course. /// This identifier can be either the Classroom-assigned identifier or an /// alias. - /// * `id` - Identifier of the course work. - pub fn course_work_get(&self, course_id: &str, id: &str) -> CourseCourseWorkGetCall<'a, C, A> { - CourseCourseWorkGetCall { + pub fn topics_list(&self, course_id: &str) -> CourseTopicListCall<'a, C, A> { + CourseTopicListCall { hub: self.hub, _course_id: course_id.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Reclaims a student submission on behalf of the student that owns it. + /// + /// Reclaiming a student submission transfers ownership of attached Drive + /// files to the student and updates the submission state. + /// + /// Only the student that owns the requested student submission may call this + /// method, and only for a student submission that has been turned in. + /// + /// This request must be made by the Developer Console project of the + /// [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to + /// create the corresponding course work item. + /// + /// This method returns the following error codes: + /// + /// * `PERMISSION_DENIED` if the requesting user is not permitted to access the + /// requested course or course work, unsubmit the requested student submission, + /// or for access errors. + /// * `FAILED_PRECONDITION` if the student submission has not been turned in. + /// * `INVALID_ARGUMENT` if the request is malformed. + /// * `NOT_FOUND` if the requested course, course work, or student submission + /// does not exist. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `courseId` - Identifier of the course. + /// This identifier can be either the Classroom-assigned identifier or an + /// alias. + /// * `courseWorkId` - Identifier of the course work. + /// * `id` - Identifier of the student submission. + pub fn course_work_student_submissions_reclaim(&self, request: ReclaimStudentSubmissionRequest, course_id: &str, course_work_id: &str, id: &str) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { + CourseCourseWorkStudentSubmissionReclaimCall { + hub: self.hub, + _request: request, + _course_id: course_id.to_string(), + _course_work_id: course_work_id.to_string(), _id: id.to_string(), _delegate: Default::default(), _scopes: Default::default(), @@ -2762,33 +2874,6 @@ impl<'a, C, A> CourseMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Returns a list of teachers of this course that the requester - /// is permitted to view. - /// - /// This method returns the following error codes: - /// - /// * `NOT_FOUND` if the course does not exist. - /// * `PERMISSION_DENIED` for access errors. - /// - /// # Arguments - /// - /// * `courseId` - Identifier of the course. - /// This identifier can be either the Classroom-assigned identifier or an - /// alias. - pub fn teachers_list(&self, course_id: &str) -> CourseTeacherListCall<'a, C, A> { - CourseTeacherListCall { - hub: self.hub, - _course_id: course_id.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Returns a student submission. @@ -2862,6 +2947,34 @@ impl<'a, C, A> CourseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Returns course work. + /// + /// This method returns the following error codes: + /// + /// * `PERMISSION_DENIED` if the requesting user is not permitted to access the + /// requested course or course work, or for access errors. + /// * `INVALID_ARGUMENT` if the request is malformed. + /// * `NOT_FOUND` if the requested course or course work does not exist. + /// + /// # Arguments + /// + /// * `courseId` - Identifier of the course. + /// This identifier can be either the Classroom-assigned identifier or an + /// alias. + /// * `id` - Identifier of the course work. + pub fn course_work_get(&self, course_id: &str, id: &str) -> CourseCourseWorkGetCall<'a, C, A> { + CourseCourseWorkGetCall { + hub: self.hub, + _course_id: course_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates course work. @@ -2956,6 +3069,37 @@ impl<'a, C, A> CourseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Updates one or more fields of a topic. + /// + /// This method returns the following error codes: + /// + /// * `PERMISSION_DENIED` if the requesting developer project did not create + /// the corresponding topic or for access errors. + /// * `INVALID_ARGUMENT` if the request is malformed. + /// * `NOT_FOUND` if the requested course or topic does not exist + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `courseId` - Identifier of the course. + /// This identifier can be either the Classroom-assigned identifier or an + /// alias. + /// * `id` - Identifier of the topic. + pub fn topics_patch(&self, request: Topic, course_id: &str, id: &str) -> CourseTopicPatchCall<'a, C, A> { + CourseTopicPatchCall { + hub: self.hub, + _request: request, + _course_id: course_id.to_string(), + _id: id.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates one or more fields of an announcement. @@ -3280,6 +3424,35 @@ impl<'a, C, A> CourseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes a topic. + /// + /// This method returns the following error codes: + /// + /// * `PERMISSION_DENIED` if the requesting user is not allowed to delete the + /// requested topic or for access errors. + /// * `FAILED_PRECONDITION` if the requested topic has already been + /// deleted. + /// * `NOT_FOUND` if no course or topic exists with the requested ID. + /// + /// # Arguments + /// + /// * `courseId` - Identifier of the course. + /// This identifier can be either the Classroom-assigned identifier or an + /// alias. + /// * `id` - Identifier of the topic to delete. + pub fn topics_delete(&self, course_id: &str, id: &str) -> CourseTopicDeleteCall<'a, C, A> { + CourseTopicDeleteCall { + hub: self.hub, + _course_id: course_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates one or more fields in a course. @@ -3314,11 +3487,11 @@ impl<'a, C, A> CourseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns a student of a course. + /// Deletes a student of a course. /// /// This method returns the following error codes: /// - /// * `PERMISSION_DENIED` if the requesting user is not permitted to view + /// * `PERMISSION_DENIED` if the requesting user is not permitted to delete /// students of this course or for access errors. /// * `NOT_FOUND` if no student of this course has the requested ID or if the /// course does not exist. @@ -3328,13 +3501,13 @@ impl<'a, C, A> CourseMethods<'a, C, A> { /// * `courseId` - Identifier of the course. /// This identifier can be either the Classroom-assigned identifier or an /// alias. - /// * `userId` - Identifier of the student to return. The identifier can be one of the + /// * `userId` - Identifier of the student to delete. The identifier can be one of the /// following: /// * the numeric identifier for the user /// * the email address of the user /// * the string literal `"me"`, indicating the requesting user - pub fn students_get(&self, course_id: &str, user_id: &str) -> CourseStudentGetCall<'a, C, A> { - CourseStudentGetCall { + pub fn students_delete(&self, course_id: &str, user_id: &str) -> CourseStudentDeleteCall<'a, C, A> { + CourseStudentDeleteCall { hub: self.hub, _course_id: course_id.to_string(), _user_id: user_id.to_string(), @@ -3443,6 +3616,32 @@ impl<'a, C, A> CourseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Returns a topic. + /// + /// This method returns the following error codes: + /// + /// * `PERMISSION_DENIED` if the requesting user is not permitted to access the + /// requested course or topic, or for access errors. + /// * `INVALID_ARGUMENT` if the request is malformed. + /// * `NOT_FOUND` if the requested course or topic does not exist. + /// + /// # Arguments + /// + /// * `courseId` - Identifier of the course. + /// * `id` - Identifier of the topic. + pub fn topics_get(&self, course_id: &str, id: &str) -> CourseTopicGetCall<'a, C, A> { + CourseTopicGetCall { + hub: self.hub, + _course_id: course_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Deletes an announcement. @@ -3477,6 +3676,35 @@ impl<'a, C, A> CourseMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Creates a topic. + /// + /// This method returns the following error codes: + /// + /// * `PERMISSION_DENIED` if the requesting user is not permitted to access the + /// requested course, create a topic in the requested course, + /// or for access errors. + /// * `INVALID_ARGUMENT` if the request is malformed. + /// * `NOT_FOUND` if the requested course does not exist. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `courseId` - Identifier of the course. + /// This identifier can be either the Classroom-assigned identifier or an + /// alias. + pub fn topics_create(&self, request: Topic, course_id: &str) -> CourseTopicCreateCall<'a, C, A> { + CourseTopicCreateCall { + hub: self.hub, + _request: request, + _course_id: course_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -3604,6 +3832,45 @@ impl<'a, C, A> UserProfileMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Modifies a guardian invitation. + /// + /// Currently, the only valid modification is to change the `state` from + /// `PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation. + /// + /// This method returns the following error codes: + /// + /// * `PERMISSION_DENIED` if the current user does not have permission to + /// manage guardians, if guardians are not enabled for the domain in question + /// or for other access errors. + /// * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state. + /// * `INVALID_ARGUMENT` if the format of the student ID provided + /// cannot be recognized (it is not an email address, nor a `user_id` from + /// this API), or if the passed `GuardianInvitation` has a `state` other than + /// `COMPLETE`, or if it modifies fields other than `state`. + /// * `NOT_FOUND` if the student ID provided is a valid student ID, but + /// Classroom has no record of that student, or if the `id` field does not + /// refer to a guardian invitation known to Classroom. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `studentId` - The ID of the student whose guardian invitation is to be modified. + /// * `invitationId` - The `id` field of the `GuardianInvitation` to be modified. + pub fn guardian_invitations_patch(&self, request: GuardianInvitation, student_id: &str, invitation_id: &str) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { + UserProfileGuardianInvitationPatchCall { + hub: self.hub, + _request: request, + _student_id: student_id.to_string(), + _invitation_id: invitation_id.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Deletes a guardian. @@ -3670,45 +3937,6 @@ impl<'a, C, A> UserProfileMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Modifies a guardian invitation. - /// - /// Currently, the only valid modification is to change the `state` from - /// `PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation. - /// - /// This method returns the following error codes: - /// - /// * `PERMISSION_DENIED` if the current user does not have permission to - /// manage guardians, if guardians are not enabled for the domain in question - /// or for other access errors. - /// * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state. - /// * `INVALID_ARGUMENT` if the format of the student ID provided - /// cannot be recognized (it is not an email address, nor a `user_id` from - /// this API), or if the passed `GuardianInvitation` has a `state` other than - /// `COMPLETE`, or if it modifies fields other than `state`. - /// * `NOT_FOUND` if the student ID provided is a valid student ID, but - /// Classroom has no record of that student, or if the `id` field does not - /// refer to a guardian invitation known to Classroom. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `studentId` - The ID of the student whose guardian invitation is to be modified. - /// * `invitationId` - The `id` field of the `GuardianInvitation` to be modified. - pub fn guardian_invitations_patch(&self, request: GuardianInvitation, student_id: &str, invitation_id: &str) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { - UserProfileGuardianInvitationPatchCall { - hub: self.hub, - _request: request, - _student_id: student_id.to_string(), - _invitation_id: invitation_id.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Returns a specific guardian invitation. @@ -4232,10 +4460,7 @@ impl<'a, C, A> CourseAnnouncementModifyAssigneeCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4267,7 +4492,7 @@ impl<'a, C, A> CourseAnnouncementModifyAssigneeCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4369,7 +4594,7 @@ impl<'a, C, A> CourseAnnouncementModifyAssigneeCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4548,10 +4773,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionPatchCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4583,7 +4805,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionPatchCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4709,7 +4931,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionPatchCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4887,10 +5109,7 @@ impl<'a, C, A> CourseAnnouncementListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4910,7 +5129,7 @@ impl<'a, C, A> CourseAnnouncementListCall<'a, C, A> where C: BorrowMut CourseAnnouncementListCall<'a, C, A> where C: BorrowMut CourseAnnouncementListCall<'a, C, A> where C: BorrowMut CourseAnnouncementListCall<'a, C, A> where C: BorrowMut CourseAnnouncementListCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ReclaimStudentSubmissionRequest::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.courses().course_work_student_submissions_reclaim(req, "courseId", "courseWorkId", "id") +/// let result = hub.courses().teachers_list("courseId") +/// .page_token("eos") +/// .page_size(-81) /// .doit(); /// # } /// ``` -pub struct CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> +pub struct CourseTeacherListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Classroom, - _request: ReclaimStudentSubmissionRequest, _course_id: String, - _course_work_id: String, - _id: String, + _page_token: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for CourseTeacherListCall<'a, C, A> {} -impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> CourseTeacherListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListTeachersResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -5165,13 +5365,17 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.courseWork.studentSubmissions.reclaim", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "classroom.courses.teachers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("courseId", self._course_id.to_string())); - params.push(("courseWorkId", self._course_work_id.to_string())); - params.push(("id", self._id.to_string())); - for &field in ["alt", "courseId", "courseWorkId", "id"].iter() { + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "courseId", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5183,12 +5387,12 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim"; + let mut url = self.hub._base_url.clone() + "v1/courses/{courseId}/teachers"; if self._scopes.len() == 0 { - self._scopes.insert(Scope::CourseworkMe.as_ref().to_string(), ()); + self._scopes.insert(Scope::RosterReadonly.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{courseId}", "courseId"), ("{courseWorkId}", "courseWorkId"), ("{id}", "id")].iter() { + for &(find_this, param_name) in [("{courseId}", "courseId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -5199,8 +5403,8 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["id", "courseWorkId", "courseId"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["courseId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -5210,22 +5414,8 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -5242,15 +5432,11 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B } }; let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -5301,15 +5487,6 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B } - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ReclaimStudentSubmissionRequest) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { - self._request = new_value; - self - } /// Identifier of the course. /// This identifier can be either the Classroom-assigned identifier or an /// alias. @@ -5318,28 +5495,30 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn course_id(mut self, new_value: &str) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { + pub fn course_id(mut self, new_value: &str) -> CourseTeacherListCall<'a, C, A> { self._course_id = new_value.to_string(); self } - /// Identifier of the course work. + /// nextPageToken + /// value returned from a previous + /// list call, indicating that + /// the subsequent page of results should be returned. + /// + /// The list request must be + /// otherwise identical to the one that resulted in this token. /// - /// Sets the *course work id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn course_work_id(mut self, new_value: &str) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { - self._course_work_id = new_value.to_string(); + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CourseTeacherListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); self } - /// Identifier of the student submission. + /// Maximum number of items to return. Zero means no maximum. + /// + /// The server may return fewer than the specified number of results. /// - /// Sets the *id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { - self._id = new_value.to_string(); + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> CourseTeacherListCall<'a, C, A> { + self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -5348,7 +5527,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseTeacherListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -5357,7 +5536,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5373,7 +5552,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> CourseTeacherListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -5382,7 +5561,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CourseworkMe`. + /// `Scope::RosterReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -5393,7 +5572,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: B /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseTeacherListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -5509,10 +5688,7 @@ impl<'a, C, A> CourseGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5532,7 +5708,7 @@ impl<'a, C, A> CourseGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5612,7 +5788,7 @@ impl<'a, C, A> CourseGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5773,10 +5949,7 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5808,7 +5981,7 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5900,7 +6073,7 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5948,16 +6121,16 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: } -/// Deletes a student of a course. +/// Returns a student of a course. /// /// This method returns the following error codes: /// -/// * `PERMISSION_DENIED` if the requesting user is not permitted to delete +/// * `PERMISSION_DENIED` if the requesting user is not permitted to view /// students of this course or for access errors. /// * `NOT_FOUND` if no student of this course has the requested ID or if the /// course does not exist. /// -/// A builder for the *students.delete* method supported by a *course* resource. +/// A builder for the *students.get* method supported by a *course* resource. /// It is not used directly, but through a `CourseMethods` instance. /// /// # Example @@ -5982,11 +6155,11 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.courses().students_delete("courseId", "userId") +/// let result = hub.courses().students_get("courseId", "userId") /// .doit(); /// # } /// ``` -pub struct CourseStudentDeleteCall<'a, C, A> +pub struct CourseStudentGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Classroom, @@ -5997,13 +6170,13 @@ pub struct CourseStudentDeleteCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for CourseStudentDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for CourseStudentGetCall<'a, C, A> {} -impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Student)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -6011,8 +6184,8 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.students.delete", - http_method: hyper::method::Method::Delete }); + dlg.begin(MethodInfo { id: "classroom.courses.students.get", + http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("courseId", self._course_id.to_string())); params.push(("userId", self._user_id.to_string())); @@ -6030,7 +6203,7 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6078,7 +6248,7 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> { + pub fn course_id(mut self, new_value: &str) -> CourseStudentGetCall<'a, C, A> { self._course_id = new_value.to_string(); self } - /// Identifier of the student to delete. The identifier can be one of the + /// Identifier of the student to return. The identifier can be one of the /// following: /// /// * the numeric identifier for the user @@ -6154,7 +6324,7 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> { + pub fn user_id(mut self, new_value: &str) -> CourseStudentGetCall<'a, C, A> { self._user_id = new_value.to_string(); self } @@ -6164,7 +6334,7 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseStudentGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -6173,7 +6343,7 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> CourseStudentDeleteCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> CourseStudentGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -6198,7 +6368,7 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CourseStudentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseStudentGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -6328,10 +6498,7 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6351,7 +6518,7 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6446,7 +6613,7 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6624,10 +6791,7 @@ impl<'a, C, A> CourseCourseWorkListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6647,7 +6811,7 @@ impl<'a, C, A> CourseCourseWorkListCall<'a, C, A> where C: BorrowMut CourseCourseWorkListCall<'a, C, A> where C: BorrowMut CourseCourseWorkListCall<'a, C, A> where C: BorrowMut CourseCourseWorkListCall<'a, C, A> where C: BorrowMut +pub struct CourseTopicListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Classroom, _course_id: String, - _id: String, + _page_token: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for CourseCourseWorkGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for CourseTopicListCall<'a, C, A> {} -impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> CourseTopicListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CourseWork)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListTopicResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -6882,12 +7049,17 @@ impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.courseWork.get", + dlg.begin(MethodInfo { id: "classroom.courses.topics.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("courseId", self._course_id.to_string())); - params.push(("id", self._id.to_string())); - for &field in ["alt", "courseId", "id"].iter() { + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "courseId", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -6899,12 +7071,12 @@ impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -6915,8 +7087,8 @@ impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(2); - for param_name in ["id", "courseId"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["courseId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -6926,10 +7098,7 @@ impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6949,7 +7118,7 @@ impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut CourseCourseWorkGetCall<'a, C, A> { + pub fn course_id(mut self, new_value: &str) -> CourseTopicListCall<'a, C, A> { self._course_id = new_value.to_string(); self } - /// Identifier of the course work. + /// nextPageToken + /// value returned from a previous + /// list call, + /// indicating that the subsequent page of results should be returned. + /// + /// The list request + /// must be otherwise identical to the one that resulted in this token. /// - /// Sets the *id* path property to the given value. + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CourseTopicListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of items to return. Zero or unspecified indicates that the + /// server may assign a maximum. + /// + /// The server may return fewer than the specified number of results. /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> CourseCourseWorkGetCall<'a, C, A> { - self._id = new_value.to_string(); + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> CourseTopicListCall<'a, C, A> { + self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -7030,7 +7212,7 @@ impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut CourseCourseWorkGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseTopicListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -7039,7 +7221,7 @@ impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> CourseCourseWorkGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> CourseTopicListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -7064,7 +7246,7 @@ impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CourseCourseWorkGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseTopicListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Reclaims a student submission on behalf of the student that owns it. +/// +/// Reclaiming a student submission transfers ownership of attached Drive +/// files to the student and updates the submission state. +/// +/// Only the student that owns the requested student submission may call this +/// method, and only for a student submission that has been turned in. +/// +/// This request must be made by the Developer Console project of the +/// [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to +/// create the corresponding course work item. +/// +/// This method returns the following error codes: +/// +/// * `PERMISSION_DENIED` if the requesting user is not permitted to access the +/// requested course or course work, unsubmit the requested student submission, +/// or for access errors. +/// * `FAILED_PRECONDITION` if the student submission has not been turned in. +/// * `INVALID_ARGUMENT` if the request is malformed. +/// * `NOT_FOUND` if the requested course, course work, or student submission +/// does not exist. +/// +/// A builder for the *courseWork.studentSubmissions.reclaim* method supported by a *course* resource. +/// It is not used directly, but through a `CourseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_classroom1 as classroom1; +/// use classroom1::ReclaimStudentSubmissionRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use classroom1::Classroom; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ReclaimStudentSubmissionRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.courses().course_work_student_submissions_reclaim(req, "courseId", "courseWorkId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Classroom, + _request: ReclaimStudentSubmissionRequest, + _course_id: String, + _course_work_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> {} + +impl<'a, C, A> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "classroom.courses.courseWork.studentSubmissions.reclaim", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("courseId", self._course_id.to_string())); + params.push(("courseWorkId", self._course_work_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "courseId", "courseWorkId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/courses/{courseId}/courseWork/{courseWorkId}/studentSubmissions/{id}:reclaim"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CourseworkMe.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{courseId}", "courseId"), ("{courseWorkId}", "courseWorkId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "courseWorkId", "courseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ReclaimStudentSubmissionRequest) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { + self._request = new_value; + self + } + /// Identifier of the course. + /// This identifier can be either the Classroom-assigned identifier or an + /// alias. + /// + /// Sets the *course id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn course_id(mut self, new_value: &str) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { + self._course_id = new_value.to_string(); + self + } + /// Identifier of the course work. + /// + /// Sets the *course work id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn course_work_id(mut self, new_value: &str) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { + self._course_work_id = new_value.to_string(); + self + } + /// Identifier of the student submission. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CourseworkMe`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CourseCourseWorkStudentSubmissionReclaimCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -7128,11 +7631,11 @@ impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut CourseCourseWorkStudentSubmissionListCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7250,7 +7750,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionListCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7396,7 +7896,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionListCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7572,10 +8072,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionTurnInCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7607,7 +8104,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionTurnInCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7719,7 +8216,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionTurnInCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7893,10 +8390,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionModifyAttachmentCall<'a, C, A> w } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7928,7 +8422,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionModifyAttachmentCall<'a, C, A> w request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8040,7 +8534,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionModifyAttachmentCall<'a, C, A> w /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8195,10 +8689,7 @@ impl<'a, C, A> CourseAnnouncementGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8218,7 +8709,7 @@ impl<'a, C, A> CourseAnnouncementGetCall<'a, C, A> where C: BorrowMut CourseAnnouncementGetCall<'a, C, A> where C: BorrowMut CourseAnnouncementGetCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.courses().teachers_list("courseId") -/// .page_token("et") -/// .page_size(-96) -/// .doit(); -/// # } -/// ``` -pub struct CourseTeacherListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Classroom, - _course_id: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CourseTeacherListCall<'a, C, A> {} - -impl<'a, C, A> CourseTeacherListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListTeachersResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "classroom.courses.teachers.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("courseId", self._course_id.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "courseId", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/courses/{courseId}/teachers"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::RosterReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{courseId}", "courseId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["courseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Identifier of the course. - /// This identifier can be either the Classroom-assigned identifier or an - /// alias. - /// - /// Sets the *course id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn course_id(mut self, new_value: &str) -> CourseTeacherListCall<'a, C, A> { - self._course_id = new_value.to_string(); - self - } - /// nextPageToken - /// value returned from a previous - /// list call, indicating that - /// the subsequent page of results should be returned. - /// - /// The list request must be - /// otherwise identical to the one that resulted in this token. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> CourseTeacherListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Maximum number of items to return. Zero means no maximum. - /// - /// The server may return fewer than the specified number of results. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> CourseTeacherListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseTeacherListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> CourseTeacherListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::RosterReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CourseTeacherListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Returns a student submission. /// /// Returning a student submission transfers ownership of attached Drive @@ -8773,10 +8977,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReturnCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8808,7 +9009,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReturnCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8920,7 +9121,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReturnCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9002,8 +9203,8 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionReturnCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.courses().aliases_list("courseId") -/// .page_token("justo") -/// .page_size(-52) +/// .page_token("sit") +/// .page_size(-26) /// .doit(); /// # } /// ``` @@ -9082,10 +9283,7 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9105,7 +9303,7 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9208,7 +9406,7 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9256,6 +9454,271 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, } +/// Returns course work. +/// +/// This method returns the following error codes: +/// +/// * `PERMISSION_DENIED` if the requesting user is not permitted to access the +/// requested course or course work, or for access errors. +/// * `INVALID_ARGUMENT` if the request is malformed. +/// * `NOT_FOUND` if the requested course or course work does not exist. +/// +/// A builder for the *courseWork.get* method supported by a *course* resource. +/// It is not used directly, but through a `CourseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_classroom1 as classroom1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use classroom1::Classroom; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.courses().course_work_get("courseId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CourseCourseWorkGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Classroom, + _course_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CourseCourseWorkGetCall<'a, C, A> {} + +impl<'a, C, A> CourseCourseWorkGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CourseWork)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "classroom.courses.courseWork.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("courseId", self._course_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "courseId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/courses/{courseId}/courseWork/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CourseworkMeReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{courseId}", "courseId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "courseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifier of the course. + /// This identifier can be either the Classroom-assigned identifier or an + /// alias. + /// + /// Sets the *course id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn course_id(mut self, new_value: &str) -> CourseCourseWorkGetCall<'a, C, A> { + self._course_id = new_value.to_string(); + self + } + /// Identifier of the course work. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CourseCourseWorkGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseCourseWorkGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CourseCourseWorkGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CourseworkMeReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CourseCourseWorkGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates course work. /// /// The resulting course work (and corresponding student submissions) are @@ -9378,10 +9841,7 @@ impl<'a, C, A> CourseCourseWorkCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9413,7 +9873,7 @@ impl<'a, C, A> CourseCourseWorkCreateCall<'a, C, A> where C: BorrowMut CourseCourseWorkCreateCall<'a, C, A> where C: BorrowMut CourseCourseWorkCreateCall<'a, C, A> where C: BorrowMut CourseListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9686,7 +10143,7 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9810,7 +10267,7 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9973,10 +10430,7 @@ impl<'a, C, A> CourseAnnouncementCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10008,7 +10462,7 @@ impl<'a, C, A> CourseAnnouncementCreateCall<'a, C, A> where C: BorrowMut CourseAnnouncementCreateCall<'a, C, A> where C: BorrowMut CourseAnnouncementCreateCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Topic::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.courses().topics_patch(req, "courseId", "id") +/// .update_mask("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct CourseTopicPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Classroom, + _request: Topic, + _course_id: String, + _id: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CourseTopicPatchCall<'a, C, A> {} + +impl<'a, C, A> CourseTopicPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Topic)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "classroom.courses.topics.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("courseId", self._course_id.to_string())); + params.push(("id", self._id.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "courseId", "id", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/courses/{courseId}/topics/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Topic.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{courseId}", "courseId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "courseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Topic) -> CourseTopicPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Identifier of the course. + /// This identifier can be either the Classroom-assigned identifier or an + /// alias. + /// + /// Sets the *course id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn course_id(mut self, new_value: &str) -> CourseTopicPatchCall<'a, C, A> { + self._course_id = new_value.to_string(); + self + } + /// Identifier of the topic. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CourseTopicPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// Mask that identifies which fields on the topic to update. + /// This field is required to do an update. The update fails if invalid + /// fields are specified. If a field supports empty values, it can be cleared + /// by specifying it in the update mask and not in the Topic object. If a + /// field that does not support empty values is included in the update mask and + /// not set in the Topic object, an `INVALID_ARGUMENT` error will be + /// returned. + /// + /// The following fields may be specified: + /// + /// * `name` + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> CourseTopicPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseTopicPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CourseTopicPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Topic`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CourseTopicPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates one or more fields of an announcement. /// /// This method returns the following error codes: @@ -10191,7 +10963,7 @@ impl<'a, C, A> CourseAnnouncementCreateCall<'a, C, A> where C: BorrowMut CourseAnnouncementPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10304,7 +11073,7 @@ impl<'a, C, A> CourseAnnouncementPatchCall<'a, C, A> where C: BorrowMut CourseAnnouncementPatchCall<'a, C, A> where C: BorrowMut CourseAliaseCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10623,7 +11389,7 @@ impl<'a, C, A> CourseAliaseCreateCall<'a, C, A> where C: BorrowMut CourseAliaseCreateCall<'a, C, A> where C: BorrowMut CourseAliaseCreateCall<'a, C, A> where C: BorrowMut CourseStudentCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10921,7 +11684,7 @@ impl<'a, C, A> CourseStudentCreateCall<'a, C, A> where C: BorrowMut CourseStudentCreateCall<'a, C, A> where C: BorrowMut CourseCourseWorkModifyAssigneeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11223,7 +11983,7 @@ impl<'a, C, A> CourseCourseWorkModifyAssigneeCall<'a, C, A> where C: BorrowMut CourseCourseWorkModifyAssigneeCall<'a, C, A> where C: BorrowMut CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11505,7 +12262,7 @@ impl<'a, C, A> CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut CourseCourseWorkDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11780,7 +12534,7 @@ impl<'a, C, A> CourseCourseWorkDeleteCall<'a, C, A> where C: BorrowMut CourseCourseWorkDeleteCall<'a, C, A> where C: BorrowMut CourseCreateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12050,7 +12801,7 @@ impl<'a, C, A> CourseCreateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12130,7 +12881,7 @@ impl<'a, C, A> CourseCreateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12212,8 +12963,8 @@ impl<'a, C, A> CourseCreateCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.courses().students_list("courseId") -/// .page_token("takimata") -/// .page_size(-27) +/// .page_token("rebum.") +/// .page_size(-33) /// .doit(); /// # } /// ``` @@ -12292,10 +13043,7 @@ impl<'a, C, A> CourseStudentListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12315,7 +13063,7 @@ impl<'a, C, A> CourseStudentListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12417,7 +13165,7 @@ impl<'a, C, A> CourseStudentListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12569,10 +13317,7 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12592,7 +13337,7 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12672,7 +13417,7 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12773,7 +13518,7 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.courses().course_work_patch(req, "courseId", "id") -/// .update_mask("sadipscing") +/// .update_mask("sit") /// .doit(); /// # } /// ``` @@ -12851,10 +13596,7 @@ impl<'a, C, A> CourseCourseWorkPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12886,7 +13628,7 @@ impl<'a, C, A> CourseCourseWorkPatchCall<'a, C, A> where C: BorrowMut CourseCourseWorkPatchCall<'a, C, A> where C: BorrowMut CourseCourseWorkPatchCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.courses().topics_delete("courseId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CourseTopicDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Classroom, + _course_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CourseTopicDeleteCall<'a, C, A> {} + +impl<'a, C, A> CourseTopicDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "classroom.courses.topics.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("courseId", self._course_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "courseId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/courses/{courseId}/topics/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Topic.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{courseId}", "courseId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "courseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifier of the course. + /// This identifier can be either the Classroom-assigned identifier or an + /// alias. + /// + /// Sets the *course id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn course_id(mut self, new_value: &str) -> CourseTopicDeleteCall<'a, C, A> { + self._course_id = new_value.to_string(); + self + } + /// Identifier of the topic to delete. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CourseTopicDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseTopicDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CourseTopicDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Topic`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CourseTopicDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates one or more fields in a course. /// /// This method returns the following error codes: @@ -13104,7 +14112,7 @@ impl<'a, C, A> CourseCourseWorkPatchCall<'a, C, A> where C: BorrowMut CoursePatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13215,7 +14220,7 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13332,7 +14337,7 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13380,16 +14385,16 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o } -/// Returns a student of a course. +/// Deletes a student of a course. /// /// This method returns the following error codes: /// -/// * `PERMISSION_DENIED` if the requesting user is not permitted to view +/// * `PERMISSION_DENIED` if the requesting user is not permitted to delete /// students of this course or for access errors. /// * `NOT_FOUND` if no student of this course has the requested ID or if the /// course does not exist. /// -/// A builder for the *students.get* method supported by a *course* resource. +/// A builder for the *students.delete* method supported by a *course* resource. /// It is not used directly, but through a `CourseMethods` instance. /// /// # Example @@ -13414,11 +14419,11 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.courses().students_get("courseId", "userId") +/// let result = hub.courses().students_delete("courseId", "userId") /// .doit(); /// # } /// ``` -pub struct CourseStudentGetCall<'a, C, A> +pub struct CourseStudentDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Classroom, @@ -13429,13 +14434,13 @@ pub struct CourseStudentGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for CourseStudentGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for CourseStudentDeleteCall<'a, C, A> {} -impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Student)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -13443,8 +14448,8 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.students.get", - http_method: hyper::method::Method::Get }); + dlg.begin(MethodInfo { id: "classroom.courses.students.delete", + http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("courseId", self._course_id.to_string())); params.push(("userId", self._user_id.to_string())); @@ -13462,7 +14467,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, let mut url = self.hub._base_url.clone() + "v1/courses/{courseId}/students/{userId}"; if self._scopes.len() == 0 { - self._scopes.insert(Scope::RosterReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::Roster.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{courseId}", "courseId"), ("{userId}", "userId")].iter() { @@ -13487,10 +14492,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13510,7 +14512,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13571,11 +14573,11 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn course_id(mut self, new_value: &str) -> CourseStudentGetCall<'a, C, A> { + pub fn course_id(mut self, new_value: &str) -> CourseStudentDeleteCall<'a, C, A> { self._course_id = new_value.to_string(); self } - /// Identifier of the student to return. The identifier can be one of the + /// Identifier of the student to delete. The identifier can be one of the /// following: /// /// * the numeric identifier for the user @@ -13586,7 +14588,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn user_id(mut self, new_value: &str) -> CourseStudentGetCall<'a, C, A> { + pub fn user_id(mut self, new_value: &str) -> CourseStudentDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); self } @@ -13596,7 +14598,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseStudentGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseStudentDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -13605,7 +14607,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13621,7 +14623,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> CourseStudentGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> CourseStudentDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -13630,7 +14632,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::RosterReadonly`. + /// `Scope::Roster`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -13641,7 +14643,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CourseStudentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseStudentDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -13762,10 +14764,7 @@ impl<'a, C, A> CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13785,7 +14784,7 @@ impl<'a, C, A> CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut CourseTeacherCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14082,7 +15078,7 @@ impl<'a, C, A> CourseTeacherCreateCall<'a, C, A> where C: BorrowMut CourseTeacherCreateCall<'a, C, A> where C: BorrowMut CourseCourseWorkStudentSubmissionGetCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14354,7 +15347,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionGetCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14454,7 +15447,7 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionGetCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14502,6 +15495,269 @@ impl<'a, C, A> CourseCourseWorkStudentSubmissionGetCall<'a, C, A> where C: Borro } +/// Returns a topic. +/// +/// This method returns the following error codes: +/// +/// * `PERMISSION_DENIED` if the requesting user is not permitted to access the +/// requested course or topic, or for access errors. +/// * `INVALID_ARGUMENT` if the request is malformed. +/// * `NOT_FOUND` if the requested course or topic does not exist. +/// +/// A builder for the *topics.get* method supported by a *course* resource. +/// It is not used directly, but through a `CourseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_classroom1 as classroom1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use classroom1::Classroom; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.courses().topics_get("courseId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CourseTopicGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Classroom, + _course_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CourseTopicGetCall<'a, C, A> {} + +impl<'a, C, A> CourseTopicGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Topic)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "classroom.courses.topics.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("courseId", self._course_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "courseId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/courses/{courseId}/topics/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::TopicReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{courseId}", "courseId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "courseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifier of the course. + /// + /// Sets the *course id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn course_id(mut self, new_value: &str) -> CourseTopicGetCall<'a, C, A> { + self._course_id = new_value.to_string(); + self + } + /// Identifier of the topic. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CourseTopicGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseTopicGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CourseTopicGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::TopicReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CourseTopicGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Deletes an announcement. /// /// This request must be made by the Developer Console project of the @@ -14615,10 +15871,7 @@ impl<'a, C, A> CourseAnnouncementDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14638,7 +15891,7 @@ impl<'a, C, A> CourseAnnouncementDeleteCall<'a, C, A> where C: BorrowMut CourseAnnouncementDeleteCall<'a, C, A> where C: BorrowMut CourseAnnouncementDeleteCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Topic::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.courses().topics_create(req, "courseId") +/// .doit(); +/// # } +/// ``` +pub struct CourseTopicCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Classroom, + _request: Topic, + _course_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CourseTopicCreateCall<'a, C, A> {} + +impl<'a, C, A> CourseTopicCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Topic)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "classroom.courses.topics.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("courseId", self._course_id.to_string())); + for &field in ["alt", "courseId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/courses/{courseId}/topics"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Topic.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{courseId}", "courseId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["courseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Topic) -> CourseTopicCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Identifier of the course. + /// This identifier can be either the Classroom-assigned identifier or an + /// alias. + /// + /// Sets the *course id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn course_id(mut self, new_value: &str) -> CourseTopicCreateCall<'a, C, A> { + self._course_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CourseTopicCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CourseTopicCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Topic`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CourseTopicCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Returns a specific guardian. /// /// This method returns the following error codes: @@ -14891,10 +16429,7 @@ impl<'a, C, A> UserProfileGuardianGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14914,7 +16449,7 @@ impl<'a, C, A> UserProfileGuardianGetCall<'a, C, A> where C: BorrowMut UserProfileGuardianGetCall<'a, C, A> where C: BorrowMut UserProfileGuardianInvitationCreateCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15223,7 +16755,7 @@ impl<'a, C, A> UserProfileGuardianInvitationCreateCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15313,7 +16845,7 @@ impl<'a, C, A> UserProfileGuardianInvitationCreateCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15361,6 +16893,330 @@ impl<'a, C, A> UserProfileGuardianInvitationCreateCall<'a, C, A> where C: Borrow } +/// Modifies a guardian invitation. +/// +/// Currently, the only valid modification is to change the `state` from +/// `PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation. +/// +/// This method returns the following error codes: +/// +/// * `PERMISSION_DENIED` if the current user does not have permission to +/// manage guardians, if guardians are not enabled for the domain in question +/// or for other access errors. +/// * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state. +/// * `INVALID_ARGUMENT` if the format of the student ID provided +/// cannot be recognized (it is not an email address, nor a `user_id` from +/// this API), or if the passed `GuardianInvitation` has a `state` other than +/// `COMPLETE`, or if it modifies fields other than `state`. +/// * `NOT_FOUND` if the student ID provided is a valid student ID, but +/// Classroom has no record of that student, or if the `id` field does not +/// refer to a guardian invitation known to Classroom. +/// +/// A builder for the *guardianInvitations.patch* method supported by a *userProfile* resource. +/// It is not used directly, but through a `UserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_classroom1 as classroom1; +/// use classroom1::GuardianInvitation; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use classroom1::Classroom; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GuardianInvitation::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_profiles().guardian_invitations_patch(req, "studentId", "invitationId") +/// .update_mask("diam") +/// .doit(); +/// # } +/// ``` +pub struct UserProfileGuardianInvitationPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Classroom, + _request: GuardianInvitation, + _student_id: String, + _invitation_id: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserProfileGuardianInvitationPatchCall<'a, C, A> {} + +impl<'a, C, A> UserProfileGuardianInvitationPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GuardianInvitation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "classroom.userProfiles.guardianInvitations.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("studentId", self._student_id.to_string())); + params.push(("invitationId", self._invitation_id.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "studentId", "invitationId", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::GuardianlinkStudent.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{studentId}", "studentId"), ("{invitationId}", "invitationId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["invitationId", "studentId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GuardianInvitation) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the student whose guardian invitation is to be modified. + /// + /// Sets the *student id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn student_id(mut self, new_value: &str) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { + self._student_id = new_value.to_string(); + self + } + /// The `id` field of the `GuardianInvitation` to be modified. + /// + /// Sets the *invitation id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn invitation_id(mut self, new_value: &str) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { + self._invitation_id = new_value.to_string(); + self + } + /// Mask that identifies which fields on the course to update. + /// This field is required to do an update. The update will fail if invalid + /// fields are specified. The following fields are valid: + /// + /// * `state` + /// + /// When set in a query parameter, this field should be specified as + /// + /// `updateMask=,,...` + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> UserProfileGuardianInvitationPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::GuardianlinkStudent`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserProfileGuardianInvitationPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Deletes a guardian. /// /// The guardian will no longer receive guardian notifications and the guardian @@ -15478,10 +17334,7 @@ impl<'a, C, A> UserProfileGuardianDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15501,7 +17354,7 @@ impl<'a, C, A> UserProfileGuardianDeleteCall<'a, C, A> where C: BorrowMut UserProfileGuardianDeleteCall<'a, C, A> where C: BorrowMut UserProfileGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15768,7 +17618,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15851,7 +17701,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15899,333 +17749,6 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A } -/// Modifies a guardian invitation. -/// -/// Currently, the only valid modification is to change the `state` from -/// `PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation. -/// -/// This method returns the following error codes: -/// -/// * `PERMISSION_DENIED` if the current user does not have permission to -/// manage guardians, if guardians are not enabled for the domain in question -/// or for other access errors. -/// * `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state. -/// * `INVALID_ARGUMENT` if the format of the student ID provided -/// cannot be recognized (it is not an email address, nor a `user_id` from -/// this API), or if the passed `GuardianInvitation` has a `state` other than -/// `COMPLETE`, or if it modifies fields other than `state`. -/// * `NOT_FOUND` if the student ID provided is a valid student ID, but -/// Classroom has no record of that student, or if the `id` field does not -/// refer to a guardian invitation known to Classroom. -/// -/// A builder for the *guardianInvitations.patch* method supported by a *userProfile* resource. -/// It is not used directly, but through a `UserProfileMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_classroom1 as classroom1; -/// use classroom1::GuardianInvitation; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use classroom1::Classroom; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Classroom::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GuardianInvitation::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.user_profiles().guardian_invitations_patch(req, "studentId", "invitationId") -/// .update_mask("sit") -/// .doit(); -/// # } -/// ``` -pub struct UserProfileGuardianInvitationPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Classroom, - _request: GuardianInvitation, - _student_id: String, - _invitation_id: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for UserProfileGuardianInvitationPatchCall<'a, C, A> {} - -impl<'a, C, A> UserProfileGuardianInvitationPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GuardianInvitation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "classroom.userProfiles.guardianInvitations.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("studentId", self._student_id.to_string())); - params.push(("invitationId", self._invitation_id.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "studentId", "invitationId", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/userProfiles/{studentId}/guardianInvitations/{invitationId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::GuardianlinkStudent.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{studentId}", "studentId"), ("{invitationId}", "invitationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["invitationId", "studentId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GuardianInvitation) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the student whose guardian invitation is to be modified. - /// - /// Sets the *student id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn student_id(mut self, new_value: &str) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { - self._student_id = new_value.to_string(); - self - } - /// The `id` field of the `GuardianInvitation` to be modified. - /// - /// Sets the *invitation id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn invitation_id(mut self, new_value: &str) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { - self._invitation_id = new_value.to_string(); - self - } - /// Mask that identifies which fields on the course to update. - /// This field is required to do an update. The update will fail if invalid - /// fields are specified. The following fields are valid: - /// - /// * `state` - /// - /// When set in a query parameter, this field should be specified as - /// - /// `updateMask=,,...` - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserProfileGuardianInvitationPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> UserProfileGuardianInvitationPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::GuardianlinkStudent`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> UserProfileGuardianInvitationPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Returns a specific guardian invitation. /// /// This method returns the following error codes: @@ -16339,10 +17862,7 @@ impl<'a, C, A> UserProfileGuardianInvitationGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16362,7 +17882,7 @@ impl<'a, C, A> UserProfileGuardianInvitationGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16450,7 +17970,7 @@ impl<'a, C, A> UserProfileGuardianInvitationGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16545,9 +18065,9 @@ impl<'a, C, A> UserProfileGuardianInvitationGetCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.user_profiles().guardians_list("studentId") -/// .page_token("est") -/// .page_size(-46) -/// .invited_email_address("accusam") +/// .page_token("eos") +/// .page_size(-78) +/// .invited_email_address("duo") /// .doit(); /// # } /// ``` @@ -16630,10 +18150,7 @@ impl<'a, C, A> UserProfileGuardianListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16653,7 +18170,7 @@ impl<'a, C, A> UserProfileGuardianListCall<'a, C, A> where C: BorrowMut UserProfileGuardianListCall<'a, C, A> where C: BorrowMut UserProfileGuardianListCall<'a, C, A> where C: BorrowMut UserProfileGuardianInvitationListCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16976,7 +18490,7 @@ impl<'a, C, A> UserProfileGuardianInvitationListCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17102,7 +18616,7 @@ impl<'a, C, A> UserProfileGuardianInvitationListCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17262,10 +18776,7 @@ impl<'a, C, A> RegistrationCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17297,7 +18808,7 @@ impl<'a, C, A> RegistrationCreateCall<'a, C, A> where C: BorrowMut RegistrationCreateCall<'a, C, A> where C: BorrowMut RegistrationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17547,7 +19055,7 @@ impl<'a, C, A> RegistrationDeleteCall<'a, C, A> where C: BorrowMut RegistrationDeleteCall<'a, C, A> where C: BorrowMut InvitationDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17800,7 +19305,7 @@ impl<'a, C, A> InvitationDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17878,7 +19383,7 @@ impl<'a, C, A> InvitationDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18019,10 +19524,7 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18054,7 +19556,7 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18134,7 +19636,7 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18218,10 +19720,10 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.invitations().list() -/// .user_id("dolores") -/// .page_token("eos") -/// .page_size(-78) -/// .course_id("duo") +/// .user_id("kasd") +/// .page_token("invidunt") +/// .page_size(-15) +/// .course_id("Lorem") /// .doit(); /// # } /// ``` @@ -18285,10 +19787,7 @@ impl<'a, C, A> InvitationListCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18308,7 +19807,7 @@ impl<'a, C, A> InvitationListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18418,7 +19917,7 @@ impl<'a, C, A> InvitationListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18570,10 +20069,7 @@ impl<'a, C, A> InvitationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18593,7 +20089,7 @@ impl<'a, C, A> InvitationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18671,7 +20167,7 @@ impl<'a, C, A> InvitationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18830,10 +20326,7 @@ impl<'a, C, A> InvitationAcceptCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18853,7 +20346,7 @@ impl<'a, C, A> InvitationAcceptCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18931,7 +20424,7 @@ impl<'a, C, A> InvitationAcceptCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/cloudasset1-cli/Cargo.toml b/gen/cloudasset1-cli/Cargo.toml new file mode 100644 index 0000000000..76c6d44cee --- /dev/null +++ b/gen/cloudasset1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-cloudasset1-cli" +version = "1.0.8+20190327" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Asset (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudasset1-cli" +homepage = "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/quickstart-cloud-asset-inventory" +documentation = "http://byron.github.io/google-apis-rs/google_cloudasset1_cli" +license = "MIT" +keywords = ["cloudasset", "google", "cli"] +autobins = false + +[[bin]] +name = "cloudasset1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-cloudasset1] +path = "../cloudasset1" +version = "1.0.8+20190327" diff --git a/gen/cloudasset1-cli/LICENSE.md b/gen/cloudasset1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudasset1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudasset1-cli/README.md b/gen/cloudasset1-cli/README.md new file mode 100644 index 0000000000..6a44b5d4d0 --- /dev/null +++ b/gen/cloudasset1-cli/README.md @@ -0,0 +1,117 @@ + +The `cloudasset1` command-line interface *(CLI)* allows to use most features of the *Google Cloud Asset* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud Asset* API can be found at the +[official documentation site](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/quickstart-cloud-asset-inventory). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-cloudasset1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudasset1-cli). + +# Usage + +This documentation was generated from the *Cloud Asset* API at revision *20190327*. The CLI is at version *1.0.8*. + +```bash +cloudasset1 [options] + methods + batch-get-assets-history [-p ]... [-o ] + export-assets (-r )... [-p ]... [-o ] + operations + get [-p ]... [-o ] + cloudasset1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `cloudasset1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/cloudasset1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/cloudasset1-secret.json`, assuming that the required *cloudasset* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `cloudasset1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/cloudasset1-cli/mkdocs.yml b/gen/cloudasset1-cli/mkdocs.yml new file mode 100644 index 0000000000..cbb44aa5d9 --- /dev/null +++ b/gen/cloudasset1-cli/mkdocs.yml @@ -0,0 +1,19 @@ +site_name: Cloud Asset v1.0.8+20190327 +site_url: http://byron.github.io/google-apis-rs/google-cloudasset1-cli +site_description: A complete library to interact with Cloud Asset (protocol v1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/cloudasset1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['methods_batch-get-assets-history.md', 'Methods', 'Batch Get Assets History'] +- ['methods_export-assets.md', 'Methods', 'Export Assets'] +- ['operations_get.md', 'Operations', 'Get'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/cloudasset1-cli/src/cmn.rs b/gen/cloudasset1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/cloudasset1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/cloudasset1-cli/src/main.rs b/gen/cloudasset1-cli/src/main.rs new file mode 100644 index 0000000000..e14644da4f --- /dev/null +++ b/gen/cloudasset1-cli/src/main.rs @@ -0,0 +1,560 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_cloudasset1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudAsset>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _methods_batch_get_assets_history(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.methods().batch_get_assets_history(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "read-time-window-start-time" => { + call = call.read_time_window_start_time(value.unwrap_or("")); + }, + "read-time-window-end-time" => { + call = call.read_time_window_end_time(value.unwrap_or("")); + }, + "content-type" => { + call = call.content_type(value.unwrap_or("")); + }, + "asset-names" => { + call = call.add_asset_names(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["asset-names", "read-time-window-end-time", "content-type", "read-time-window-start-time"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _methods_export_assets(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "asset-types" => Some(("assetTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "read-time" => Some(("readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-config.gcs-destination.uri" => Some(("outputConfig.gcsDestination.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["asset-types", "content-type", "gcs-destination", "output-config", "read-time", "uri"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ExportAssetsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.methods().export_assets(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("methods", Some(opt)) => { + match opt.subcommand() { + ("batch-get-assets-history", Some(opt)) => { + call_result = self._methods_batch_get_assets_history(opt, dry_run, &mut err); + }, + ("export-assets", Some(opt)) => { + call_result = self._methods_export_assets(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("methods".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("operations", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._operations_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "cloudasset1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "cloudasset1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::CloudAsset::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("methods", "methods: 'batch-get-assets-history' and 'export-assets'", vec![ + ("batch-get-assets-history", + Some(r##"Batch gets the update history of assets that overlap a time window. + For RESOURCE content, this API outputs history with asset in both + non-delete or deleted status. + For IAM_POLICY content, this API outputs history when the asset and its + attached IAM POLICY both exist. This can create gaps in the output history. + If a specified asset does not exist, this API returns an INVALID_ARGUMENT + error."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudasset1_cli/methods_batch-get-assets-history", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The relative name of the root asset. It can only be an + organization number (such as "organizations/123"), a project ID (such as + "projects/my-project-id")", or a project number (such as "projects/12345")."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("export-assets", + Some(r##"Exports assets with time and resource types to a given Cloud Storage + location. The output format is newline-delimited JSON. + This API implements the google.longrunning.Operation API allowing you + to keep track of the export."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudasset1_cli/methods_export-assets", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The relative name of the root asset. This can only be an + organization number (such as "organizations/123"), a project ID (such as + "projects/my-project-id"), or a project number (such as "projects/12345"), + or a folder number (such as "folders/123")."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("operations", "methods: 'get'", vec![ + ("get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudasset1_cli/operations_get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("cloudasset1") + .author("Sebastian Thiel ") + .version("1.0.8+20190327") + .about("The cloud asset API manages the history and inventory of cloud resources.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudasset1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/cloudasset1/Cargo.toml b/gen/cloudasset1/Cargo.toml new file mode 100644 index 0000000000..d8ca5e4f23 --- /dev/null +++ b/gen/cloudasset1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-cloudasset1" +version = "1.0.8+20190327" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Asset (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudasset1" +homepage = "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/quickstart-cloud-asset-inventory" +documentation = "https://docs.rs/google-cloudasset1/1.0.8+20190327" +license = "MIT" +keywords = ["cloudasset", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/cloudasset1/LICENSE.md b/gen/cloudasset1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudasset1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudasset1/README.md b/gen/cloudasset1/README.md new file mode 100644 index 0000000000..e651d7ae32 --- /dev/null +++ b/gen/cloudasset1/README.md @@ -0,0 +1,193 @@ + +The `google-cloudasset1` library allows access to all features of the *Google Cloud Asset* service. + +This documentation was generated from *Cloud Asset* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *cloudasset:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Cloud Asset* *v1* API can be found at the +[official documentation site](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/quickstart-cloud-asset-inventory). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/struct.CloudAsset.html) ... + +* [operations](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/struct.Operation.html) + * [*get*](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/struct.OperationGetCall.html) + +Other activities are ... + +* [batch get assets history](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/struct.MethodBatchGetAssetsHistoryCall.html) +* [export assets](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/struct.MethodExportAssetCall.html) + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/struct.CloudAsset.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.methods().export_assets(...).doit() +let r = hub.operations().get(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-cloudasset1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_cloudasset1 as cloudasset1; +use cloudasset1::ExportAssetsRequest; +use cloudasset1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use cloudasset1::CloudAsset; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = ExportAssetsRequest::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.methods().export_assets(req, "parent") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-cloudasset1/1.0.8+20190327/google_cloudasset1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **cloudasset1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/cloudasset1/src/cmn.rs b/gen/cloudasset1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/cloudasset1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/cloudasset1/src/lib.rs b/gen/cloudasset1/src/lib.rs new file mode 100644 index 0000000000..9614e2a2f5 --- /dev/null +++ b/gen/cloudasset1/src/lib.rs @@ -0,0 +1,1964 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud Asset* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *cloudasset:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Cloud Asset* *v1* API can be found at the +//! [official documentation site](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/quickstart-cloud-asset-inventory). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudasset1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.CloudAsset.html) ... +//! +//! * [operations](struct.Operation.html) +//! * [*get*](struct.OperationGetCall.html) +//! +//! Other activities are ... +//! +//! * [batch get assets history](struct.MethodBatchGetAssetsHistoryCall.html) +//! * [export assets](struct.MethodExportAssetCall.html) +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudAsset.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.methods().export_assets(...).doit() +//! let r = hub.operations().get(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-cloudasset1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_cloudasset1 as cloudasset1; +//! use cloudasset1::ExportAssetsRequest; +//! use cloudasset1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use cloudasset1::CloudAsset; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = ExportAssetsRequest::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.methods().export_assets(req, "parent") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudAsset related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudasset1 as cloudasset1; +/// use cloudasset1::ExportAssetsRequest; +/// use cloudasset1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudasset1::CloudAsset; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ExportAssetsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.methods().export_assets(req, "parent") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudAsset { + client: RefCell, + auth: RefCell
, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for CloudAsset {} + +impl<'a, C, A> CloudAsset + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudAsset { + CloudAsset { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://cloudasset.googleapis.com/".to_string(), + _root_url: "https://cloudasset.googleapis.com/".to_string(), + } + } + + pub fn methods(&'a self) -> MethodMethods<'a, C, A> { + MethodMethods { hub: &self } + } + pub fn operations(&'a self) -> OperationMethods<'a, C, A> { + OperationMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://cloudasset.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://cloudasset.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// Provides the configuration for logging a type of permissions. +/// Example: +/// +/// { +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// } +/// ] +/// } +/// +/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting +/// foo@gmail.com from DATA_READ logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditLogConfig { + /// Specifies the identities that do not cause logging for this type of + /// permission. + /// Follows the same format of Binding.members. + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The log type that this config enables. + #[serde(rename="logType")] + pub log_type: Option, +} + +impl Part for AuditLogConfig {} + + +/// Representation of a cloud resource. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceType { + /// The API version. Example: "v1". + pub version: Option, + /// The REST URL for accessing the resource. An HTTP GET operation using this + /// URL returns the resource itself. + /// Example: + /// `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`. + /// It will be left unspecified for resources without a REST API. + #[serde(rename="resourceUrl")] + pub resource_url: Option, + /// The full name of the immediate parent of this resource. See + /// [Resource + /// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + /// for more information. + /// + /// For GCP assets, it is the parent resource defined in the [Cloud IAM policy + /// hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). + /// For example: + /// `"//cloudresourcemanager.googleapis.com/projects/my_project_123"`. + /// + /// For third-party assets, it is up to the users to define. + pub parent: Option, + /// The URL of the discovery document containing the resource's JSON schema. + /// For example: + /// `"https://www.googleapis.com/discovery/v1/apis/compute/v1/rest"`. + /// It will be left unspecified for resources without a discovery-based API, + /// such as Cloud Bigtable. + #[serde(rename="discoveryDocumentUri")] + pub discovery_document_uri: Option, + /// The content of the resource, in which some sensitive fields are scrubbed + /// away and may not be present. + pub data: Option>, + /// The JSON schema name listed in the discovery document. + /// Example: "Project". It will be left unspecified for resources (such as + /// Cloud Bigtable) without a discovery-based API. + #[serde(rename="discoveryName")] + pub discovery_name: Option, +} + +impl Part for ResourceType {} + + +/// Export asset request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [export assets](struct.MethodExportAssetCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExportAssetsRequest { + /// A list of asset types of which to take a snapshot for. For example: + /// "compute.googleapis.com/Disk". If specified, only matching assets will be returned. + /// See [Introduction to Cloud Asset + /// Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + /// for all supported asset types. + #[serde(rename="assetTypes")] + pub asset_types: Option>, + /// Asset content type. If not specified, no content but the asset name will be + /// returned. + #[serde(rename="contentType")] + pub content_type: Option, + /// Required. Output configuration indicating where the results will be output + /// to. All results will be in newline delimited JSON format. + #[serde(rename="outputConfig")] + pub output_config: Option, + /// Timestamp to take an asset snapshot. This can only be set to a timestamp + /// between 2018-10-02 UTC (inclusive) and the current time. If not specified, + /// the current time will be used. Due to delays in resource data collection + /// and indexing, there is a volatile window during which running the same + /// query may get different results. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl RequestValue for ExportAssetsRequest {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// Temporal asset. In addition to the asset, the temporal asset includes the +/// status of the asset and valid from and to time of it. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TemporalAsset { + /// If the asset is deleted or not. + pub deleted: Option, + /// The time window when the asset data and state was observed. + pub window: Option, + /// Asset. + pub asset: Option, +} + +impl Part for TemporalAsset {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + +/// Batch get assets history response. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batch get assets history](struct.MethodBatchGetAssetsHistoryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchGetAssetsHistoryResponse { + /// A list of assets with valid time windows. + pub assets: Option>, +} + +impl ResponseResult for BatchGetAssetsHistoryResponse {} + + +/// Specifies the audit configuration for a service. +/// The configuration determines which permission types are logged, and what +/// identities, if any, are exempted from logging. +/// An AuditConfig must have one or more AuditLogConfigs. +/// +/// If there are AuditConfigs for both `allServices` and a specific service, +/// the union of the two AuditConfigs is used for that service: the log_types +/// specified in each AuditConfig are enabled, and the exempted_members in each +/// AuditLogConfig are exempted. +/// +/// Example Policy with multiple AuditConfigs: +/// +/// { +/// "audit_configs": [ +/// { +/// "service": "allServices" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// }, +/// { +/// "log_type": "ADMIN_READ", +/// } +/// ] +/// }, +/// { +/// "service": "fooservice.googleapis.com" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// "exempted_members": [ +/// "user:bar@gmail.com" +/// ] +/// } +/// ] +/// } +/// ] +/// } +/// +/// For fooservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ +/// logging. It also exempts foo@gmail.com from DATA_READ logging, and +/// bar@gmail.com from DATA_WRITE logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditConfig { + /// The configuration for logging of each type of permission. + #[serde(rename="auditLogConfigs")] + pub audit_log_configs: Option>, + /// Specifies a service that will be enabled for audit logging. + /// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + /// `allServices` is a special value that covers all services. + pub service: Option, +} + +impl Part for AuditConfig {} + + +/// Cloud asset. This includes all Google Cloud Platform resources, +/// Cloud IAM policies, and other non-GCP assets. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Asset { + /// Representation of the actual Cloud IAM policy set on a cloud resource. For + /// each resource, there must be at most one Cloud IAM policy set on it. + #[serde(rename="iamPolicy")] + pub iam_policy: Option, + /// Type of the asset. Example: "compute.googleapis.com/Disk". + #[serde(rename="assetType")] + pub asset_type: Option, + /// Representation of the resource. + pub resource: Option, + /// The full name of the asset. For example: + /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + /// See [Resource + /// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + /// for more information. + pub name: Option, +} + +impl Part for Asset {} + + +/// Output configuration for export assets destination. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OutputConfig { + /// Destination on Cloud Storage. + #[serde(rename="gcsDestination")] + pub gcs_destination: Option, +} + +impl Part for OutputConfig {} + + +/// A time window of (start_time, end_time]. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TimeWindow { + /// End time of the time window (inclusive). + /// Current timestamp if not specified. + #[serde(rename="endTime")] + pub end_time: Option, + /// Start time of the time window (exclusive). + #[serde(rename="startTime")] + pub start_time: Option, +} + +impl Part for TimeWindow {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **JSON Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// **YAML Example** +/// +/// bindings: +/// - members: +/// - user:mike@example.com +/// - group:admins@example.com +/// - domain:google.com +/// - serviceAccount:my-other-app@appspot.gserviceaccount.com +/// role: roles/owner +/// - members: +/// - user:sean@example.com +/// role: roles/viewer +/// +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam/docs). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, + /// Deprecated. + pub version: Option, +} + +impl Part for Policy {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [export assets](struct.MethodExportAssetCall.html) (response) +/// * [get operations](struct.OperationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl Resource for Operation {} +impl ResponseResult for Operation {} + + +/// A Cloud Storage location. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GcsDestination { + /// The uri of the Cloud Storage object. It's the same uri that is used by + /// gsutil. For example: "gs://bucket_name/object_name". See [Viewing and + /// Editing Object + /// Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) + /// for more information. + pub uri: Option, +} + +impl Part for GcsDestination {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *operation* resources. +/// It is not used directly, but through the `CloudAsset` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudasset1 as cloudasset1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudasset1::CloudAsset; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` +/// // to build up your call. +/// let rb = hub.operations(); +/// # } +/// ``` +pub struct OperationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudAsset, +} + +impl<'a, C, A> MethodsBuilder for OperationMethods<'a, C, A> {} + +impl<'a, C, A> OperationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn get(&self, name: &str) -> OperationGetCall<'a, C, A> { + OperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all free methods, which are not associated with a particular resource. +/// It is not used directly, but through the `CloudAsset` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudasset1 as cloudasset1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudasset1::CloudAsset; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `batch_get_assets_history(...)` and `export_assets(...)` +/// // to build up your call. +/// let rb = hub.methods(); +/// # } +/// ``` +pub struct MethodMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudAsset, +} + +impl<'a, C, A> MethodsBuilder for MethodMethods<'a, C, A> {} + +impl<'a, C, A> MethodMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Batch gets the update history of assets that overlap a time window. + /// For RESOURCE content, this API outputs history with asset in both + /// non-delete or deleted status. + /// For IAM_POLICY content, this API outputs history when the asset and its + /// attached IAM POLICY both exist. This can create gaps in the output history. + /// If a specified asset does not exist, this API returns an INVALID_ARGUMENT + /// error. + /// + /// # Arguments + /// + /// * `parent` - Required. The relative name of the root asset. It can only be an + /// organization number (such as "organizations/123"), a project ID (such as + /// "projects/my-project-id")", or a project number (such as "projects/12345"). + pub fn batch_get_assets_history(&self, parent: &str) -> MethodBatchGetAssetsHistoryCall<'a, C, A> { + MethodBatchGetAssetsHistoryCall { + hub: self.hub, + _parent: parent.to_string(), + _read_time_window_start_time: Default::default(), + _read_time_window_end_time: Default::default(), + _content_type: Default::default(), + _asset_names: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Exports assets with time and resource types to a given Cloud Storage + /// location. The output format is newline-delimited JSON. + /// This API implements the google.longrunning.Operation API allowing you + /// to keep track of the export. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The relative name of the root asset. This can only be an + /// organization number (such as "organizations/123"), a project ID (such as + /// "projects/my-project-id"), or a project number (such as "projects/12345"), + /// or a folder number (such as "folders/123"). + pub fn export_assets(&self, request: ExportAssetsRequest, parent: &str) -> MethodExportAssetCall<'a, C, A> { + MethodExportAssetCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *get* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudasset1 as cloudasset1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudasset1::CloudAsset; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().get("name") +/// .doit(); +/// # } +/// ``` +pub struct OperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudAsset, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {} + +impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudasset.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Batch gets the update history of assets that overlap a time window. +/// For RESOURCE content, this API outputs history with asset in both +/// non-delete or deleted status. +/// For IAM_POLICY content, this API outputs history when the asset and its +/// attached IAM POLICY both exist. This can create gaps in the output history. +/// If a specified asset does not exist, this API returns an INVALID_ARGUMENT +/// error. +/// +/// A builder for the *batchGetAssetsHistory* method. +/// It is not used directly, but through a `MethodMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudasset1 as cloudasset1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudasset1::CloudAsset; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.methods().batch_get_assets_history("parent") +/// .read_time_window_start_time("dolores") +/// .read_time_window_end_time("kasd") +/// .content_type("accusam") +/// .add_asset_names("takimata") +/// .doit(); +/// # } +/// ``` +pub struct MethodBatchGetAssetsHistoryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudAsset, + _parent: String, + _read_time_window_start_time: Option, + _read_time_window_end_time: Option, + _content_type: Option, + _asset_names: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MethodBatchGetAssetsHistoryCall<'a, C, A> {} + +impl<'a, C, A> MethodBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BatchGetAssetsHistoryResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudasset.batchGetAssetsHistory", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._read_time_window_start_time { + params.push(("readTimeWindow.startTime", value.to_string())); + } + if let Some(value) = self._read_time_window_end_time { + params.push(("readTimeWindow.endTime", value.to_string())); + } + if let Some(value) = self._content_type { + params.push(("contentType", value.to_string())); + } + if self._asset_names.len() > 0 { + for f in self._asset_names.iter() { + params.push(("assetNames", f.to_string())); + } + } + for &field in ["alt", "parent", "readTimeWindow.startTime", "readTimeWindow.endTime", "contentType", "assetNames"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}:batchGetAssetsHistory"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The relative name of the root asset. It can only be an + /// organization number (such as "organizations/123"), a project ID (such as + /// "projects/my-project-id")", or a project number (such as "projects/12345"). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> MethodBatchGetAssetsHistoryCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Start time of the time window (exclusive). + /// + /// Sets the *read time window.start time* query property to the given value. + pub fn read_time_window_start_time(mut self, new_value: &str) -> MethodBatchGetAssetsHistoryCall<'a, C, A> { + self._read_time_window_start_time = Some(new_value.to_string()); + self + } + /// End time of the time window (inclusive). + /// Current timestamp if not specified. + /// + /// Sets the *read time window.end time* query property to the given value. + pub fn read_time_window_end_time(mut self, new_value: &str) -> MethodBatchGetAssetsHistoryCall<'a, C, A> { + self._read_time_window_end_time = Some(new_value.to_string()); + self + } + /// Required. The content type. + /// + /// Sets the *content type* query property to the given value. + pub fn content_type(mut self, new_value: &str) -> MethodBatchGetAssetsHistoryCall<'a, C, A> { + self._content_type = Some(new_value.to_string()); + self + } + /// A list of the full names of the assets. For example: + /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + /// See [Resource + /// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + /// and [Resource Name Format](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/resource-name-format) + /// for more info. + /// + /// The request becomes a no-op if the asset name list is empty, and the max + /// size of the asset name list is 100 in one request. + /// + /// Append the given value to the *asset names* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_asset_names(mut self, new_value: &str) -> MethodBatchGetAssetsHistoryCall<'a, C, A> { + self._asset_names.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodBatchGetAssetsHistoryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MethodBatchGetAssetsHistoryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MethodBatchGetAssetsHistoryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Exports assets with time and resource types to a given Cloud Storage +/// location. The output format is newline-delimited JSON. +/// This API implements the google.longrunning.Operation API allowing you +/// to keep track of the export. +/// +/// A builder for the *exportAssets* method. +/// It is not used directly, but through a `MethodMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudasset1 as cloudasset1; +/// use cloudasset1::ExportAssetsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudasset1::CloudAsset; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ExportAssetsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.methods().export_assets(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct MethodExportAssetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudAsset, + _request: ExportAssetsRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MethodExportAssetCall<'a, C, A> {} + +impl<'a, C, A> MethodExportAssetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudasset.exportAssets", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}:exportAssets"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ExportAssetsRequest) -> MethodExportAssetCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The relative name of the root asset. This can only be an + /// organization number (such as "organizations/123"), a project ID (such as + /// "projects/my-project-id"), or a project number (such as "projects/12345"), + /// or a folder number (such as "folders/123"). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> MethodExportAssetCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodExportAssetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MethodExportAssetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MethodExportAssetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/cloudasset1_beta1-cli/Cargo.toml b/gen/cloudasset1_beta1-cli/Cargo.toml index 574e1df0f4..c512919180 100644 --- a/gen/cloudasset1_beta1-cli/Cargo.toml +++ b/gen/cloudasset1_beta1-cli/Cargo.toml @@ -4,11 +4,11 @@ [package] name = "google-cloudasset1_beta1-cli" -version = "1.0.8+20181008" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Asset (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudasset1_beta1-cli" -homepage = "https://console.cloud.google.com/apis/api/cloudasset.googleapis.com/overview" +homepage = "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/quickstart-cloud-asset-inventory" documentation = "http://byron.github.io/google-apis-rs/google_cloudasset1_beta1_cli" license = "MIT" keywords = ["cloudasset", "google", "cli"] @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudasset1_beta1] path = "../cloudasset1_beta1" -version = "1.0.8+20181008" +version = "1.0.8+20190327" diff --git a/gen/cloudasset1_beta1-cli/README.md b/gen/cloudasset1_beta1-cli/README.md index 28c4f6de81..d2c17c65dd 100644 --- a/gen/cloudasset1_beta1-cli/README.md +++ b/gen/cloudasset1_beta1-cli/README.md @@ -11,7 +11,7 @@ capabilities. Errors will be printed to standard error, and cause the program's If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. Everything else about the *Cloud Asset* API can be found at the -[official documentation site](https://console.cloud.google.com/apis/api/cloudasset.googleapis.com/overview). +[official documentation site](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/quickstart-cloud-asset-inventory). # Installation and Source Code @@ -25,10 +25,13 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Asset* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Asset* API at revision *20190327*. The CLI is at version *1.0.8*. ```bash cloudasset1-beta1 [options] + folders + export-assets (-r )... [-p ]... [-o ] + operations-get [-p ]... [-o ] organizations batch-get-assets-history [-p ]... [-o ] export-assets (-r )... [-p ]... [-o ] diff --git a/gen/cloudasset1_beta1-cli/mkdocs.yml b/gen/cloudasset1_beta1-cli/mkdocs.yml index 8fbb6d8ead..ea93cf2af7 100644 --- a/gen/cloudasset1_beta1-cli/mkdocs.yml +++ b/gen/cloudasset1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Asset v1.0.8+20181008 +site_name: Cloud Asset v1.0.8+20190327 site_url: http://byron.github.io/google-apis-rs/google-cloudasset1_beta1-cli site_description: A complete library to interact with Cloud Asset (protocol v1beta1) @@ -9,6 +9,8 @@ site_dir: build_html pages: - ['index.md', 'Home'] +- ['folders_export-assets.md', 'Folders', 'Export Assets'] +- ['folders_operations-get.md', 'Folders', 'Operations Get'] - ['organizations_batch-get-assets-history.md', 'Organizations', 'Batch Get Assets History'] - ['organizations_export-assets.md', 'Organizations', 'Export Assets'] - ['organizations_operations-get.md', 'Organizations', 'Operations Get'] diff --git a/gen/cloudasset1_beta1-cli/src/main.rs b/gen/cloudasset1_beta1-cli/src/main.rs index dacb3c4752..2615a0d6de 100644 --- a/gen/cloudasset1_beta1-cli/src/main.rs +++ b/gen/cloudasset1_beta1-cli/src/main.rs @@ -46,6 +46,146 @@ struct Engine<'n> { impl<'n> Engine<'n> { + fn _folders_export_assets(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "asset-types" => Some(("assetTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "read-time" => Some(("readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-config.gcs-destination.uri" => Some(("outputConfig.gcsDestination.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["asset-types", "content-type", "gcs-destination", "output-config", "read-time", "uri"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ExportAssetsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.folders().export_assets(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _folders_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.folders().operations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _organizations_batch_get_assets_history(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.organizations().batch_get_assets_history(opt.value_of("parent").unwrap_or("")); @@ -135,9 +275,9 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "asset-types" => Some(("assetTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "read-time" => Some(("readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "output-config.gcs-destination.uri" => Some(("outputConfig.gcsDestination.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "read-time" => Some(("readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["asset-types", "content-type", "gcs-destination", "output-config", "read-time", "uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -340,9 +480,9 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "asset-types" => Some(("assetTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "read-time" => Some(("readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "output-config.gcs-destination.uri" => Some(("outputConfig.gcsDestination.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "read-time" => Some(("readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["asset-types", "content-type", "gcs-destination", "output-config", "read-time", "uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -461,6 +601,20 @@ impl<'n> Engine<'n> { let mut call_result: Result<(), DoitError> = Ok(()); let mut err_opt: Option = None; match self.opt.subcommand() { + ("folders", Some(opt)) => { + match opt.subcommand() { + ("export-assets", Some(opt)) => { + call_result = self._folders_export_assets(opt, dry_run, &mut err); + }, + ("operations-get", Some(opt)) => { + call_result = self._folders_operations_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("folders".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("organizations", Some(opt)) => { match opt.subcommand() { ("batch-get-assets-history", Some(opt)) => { @@ -580,13 +734,76 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ + ("folders", "methods: 'export-assets' and 'operations-get'", vec![ + ("export-assets", + Some(r##"Exports assets with time and resource types to a given Cloud Storage + location. The output format is newline-delimited JSON. + This API implements the google.longrunning.Operation API allowing you + to keep track of the export."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudasset1_beta1_cli/folders_export-assets", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. The relative name of the root asset. This can only be an + organization number (such as "organizations/123"), a project ID (such as + "projects/my-project-id"), a project number (such as "projects/12345"), or + a folder number (such as "folders/123")."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudasset1_beta1_cli/folders_operations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("organizations", "methods: 'batch-get-assets-history', 'export-assets' and 'operations-get'", vec![ ("batch-get-assets-history", Some(r##"Batch gets the update history of assets that overlap a time window. For RESOURCE content, this API outputs history with asset in both non-delete or deleted status. For IAM_POLICY content, this API outputs history when the asset and its - attached IAM POLICY both exist. This can create gaps in the output history."##), + attached IAM POLICY both exist. This can create gaps in the output history. + If a specified asset does not exist, this API returns an INVALID_ARGUMENT + error."##), "Details at http://byron.github.io/google-apis-rs/google_cloudasset1_beta1_cli/organizations_batch-get-assets-history", vec![ (Some(r##"parent"##), @@ -618,9 +835,10 @@ fn main() { vec![ (Some(r##"parent"##), None, - Some(r##"Required. The relative name of the root asset. This can only be an organization - number (such as "organizations/123"), a project ID (such as - "projects/my-project-id"), or a project number (such as "projects/12345")."##), + Some(r##"Required. The relative name of the root asset. This can only be an + organization number (such as "organizations/123"), a project ID (such as + "projects/my-project-id"), a project number (such as "projects/12345"), or + a folder number (such as "folders/123")."##), Some(true), Some(false)), @@ -674,7 +892,9 @@ fn main() { For RESOURCE content, this API outputs history with asset in both non-delete or deleted status. For IAM_POLICY content, this API outputs history when the asset and its - attached IAM POLICY both exist. This can create gaps in the output history."##), + attached IAM POLICY both exist. This can create gaps in the output history. + If a specified asset does not exist, this API returns an INVALID_ARGUMENT + error."##), "Details at http://byron.github.io/google-apis-rs/google_cloudasset1_beta1_cli/projects_batch-get-assets-history", vec![ (Some(r##"parent"##), @@ -706,9 +926,10 @@ fn main() { vec![ (Some(r##"parent"##), None, - Some(r##"Required. The relative name of the root asset. This can only be an organization - number (such as "organizations/123"), a project ID (such as - "projects/my-project-id"), or a project number (such as "projects/12345")."##), + Some(r##"Required. The relative name of the root asset. This can only be an + organization number (such as "organizations/123"), a project ID (such as + "projects/my-project-id"), a project number (such as "projects/12345"), or + a folder number (such as "folders/123")."##), Some(true), Some(false)), @@ -760,7 +981,7 @@ fn main() { let mut app = App::new("cloudasset1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190327") .about("The cloud asset API manages the history and inventory of cloud resources.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudasset1_beta1_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudasset1_beta1/Cargo.toml b/gen/cloudasset1_beta1/Cargo.toml index 75ceacf411..4e6d4f60da 100644 --- a/gen/cloudasset1_beta1/Cargo.toml +++ b/gen/cloudasset1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudasset1_beta1" -version = "1.0.8+20181008" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Asset (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudasset1_beta1" -homepage = "https://console.cloud.google.com/apis/api/cloudasset.googleapis.com/overview" -documentation = "https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008" +homepage = "https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/quickstart-cloud-asset-inventory" +documentation = "https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327" license = "MIT" keywords = ["cloudasset", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudasset1_beta1/README.md b/gen/cloudasset1_beta1/README.md index 552e1a0040..4f74995225 100644 --- a/gen/cloudasset1_beta1/README.md +++ b/gen/cloudasset1_beta1/README.md @@ -5,18 +5,20 @@ DO NOT EDIT ! --> The `google-cloudasset1_beta1` library allows access to all features of the *Google Cloud Asset* service. -This documentation was generated from *Cloud Asset* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *cloudasset:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Asset* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *cloudasset:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Asset* *v1_beta1* API can be found at the -[official documentation site](https://console.cloud.google.com/apis/api/cloudasset.googleapis.com/overview). +[official documentation site](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/quickstart-cloud-asset-inventory). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/struct.CloudAsset.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/struct.CloudAsset.html) ... +* folders + * [*export assets*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/struct.FolderExportAssetCall.html) and [*operations get*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/struct.FolderOperationGetCall.html) * organizations - * [*batch get assets history*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/struct.OrganizationBatchGetAssetsHistoryCall.html), [*export assets*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/struct.OrganizationExportAssetCall.html) and [*operations get*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/struct.OrganizationOperationGetCall.html) + * [*batch get assets history*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/struct.OrganizationBatchGetAssetsHistoryCall.html), [*export assets*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/struct.OrganizationExportAssetCall.html) and [*operations get*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/struct.OrganizationOperationGetCall.html) * projects - * [*batch get assets history*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/struct.ProjectBatchGetAssetsHistoryCall.html), [*export assets*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/struct.ProjectExportAssetCall.html) and [*operations get*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/struct.ProjectOperationGetCall.html) + * [*batch get assets history*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/struct.ProjectBatchGetAssetsHistoryCall.html), [*export assets*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/struct.ProjectExportAssetCall.html) and [*operations get*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/struct.ProjectOperationGetCall.html) @@ -25,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/struct.CloudAsset.html)** +* **[Hub](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/struct.CloudAsset.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -49,10 +51,12 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.organizations().operations_get(...).doit() +let r = hub.folders().export_assets(...).doit() +let r = hub.folders().operations_get(...).doit() let r = hub.projects().operations_get(...).doit() let r = hub.projects().export_assets(...).doit() let r = hub.organizations().export_assets(...).doit() +let r = hub.organizations().operations_get(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -112,7 +116,7 @@ let mut req = ExportAssetsRequest::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.projects().export_assets(req, "parent") +let result = hub.folders().export_assets(req, "parent") .doit(); match result { @@ -135,17 +139,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -155,29 +159,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudasset1_beta1/1.0.8+20181008/google_cloudasset1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudasset1_beta1/1.0.8+20190327/google_cloudasset1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudasset1_beta1/src/lib.rs b/gen/cloudasset1_beta1/src/lib.rs index 5b7f69c98f..15c8d98c61 100644 --- a/gen/cloudasset1_beta1/src/lib.rs +++ b/gen/cloudasset1_beta1/src/lib.rs @@ -2,15 +2,17 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Asset* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *cloudasset:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Asset* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *cloudasset:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Asset* *v1_beta1* API can be found at the -//! [official documentation site](https://console.cloud.google.com/apis/api/cloudasset.googleapis.com/overview). +//! [official documentation site](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/quickstart-cloud-asset-inventory). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudasset1_beta1). //! # Features //! //! Handle the following *Resources* with ease from the central [hub](struct.CloudAsset.html) ... //! +//! * folders +//! * [*export assets*](struct.FolderExportAssetCall.html) and [*operations get*](struct.FolderOperationGetCall.html) //! * organizations //! * [*batch get assets history*](struct.OrganizationBatchGetAssetsHistoryCall.html), [*export assets*](struct.OrganizationExportAssetCall.html) and [*operations get*](struct.OrganizationOperationGetCall.html) //! * projects @@ -49,10 +51,12 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.organizations().operations_get(...).doit() +//! let r = hub.folders().export_assets(...).doit() +//! let r = hub.folders().operations_get(...).doit() //! let r = hub.projects().operations_get(...).doit() //! let r = hub.projects().export_assets(...).doit() //! let r = hub.organizations().export_assets(...).doit() +//! let r = hub.organizations().operations_get(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -113,7 +117,7 @@ //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.projects().export_assets(req, "parent") +//! let result = hub.folders().export_assets(req, "parent") //! .doit(); //! //! match result { @@ -298,7 +302,7 @@ impl Default for Scope { /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().export_assets(req, "parent") +/// let result = hub.folders().export_assets(req, "parent") /// .doit(); /// /// match result { @@ -342,6 +346,9 @@ impl<'a, C, A> CloudAsset } } + pub fn folders(&'a self) -> FolderMethods<'a, C, A> { + FolderMethods { hub: &self } + } pub fn organizations(&'a self) -> OrganizationMethods<'a, C, A> { OrganizationMethods { hub: &self } } @@ -378,17 +385,17 @@ impl<'a, C, A> CloudAsset // ############ // SCHEMAS ### // ########## -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -502,12 +509,14 @@ pub struct ResourceType { #[serde(rename="resourceUrl")] pub resource_url: Option, /// The full name of the immediate parent of this resource. See - /// [Resource Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + /// [Resource + /// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) /// for more information. /// /// For GCP assets, it is the parent resource defined in the [Cloud IAM policy /// hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). - /// For example: `"//cloudresourcemanager.googleapis.com/projects/my_project_123"`. + /// For example: + /// `"//cloudresourcemanager.googleapis.com/projects/my_project_123"`. /// /// For third-party assets, it is up to the users to define. pub parent: Option, @@ -538,22 +547,19 @@ impl Part for ResourceType {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// +/// * [export assets folders](struct.FolderExportAssetCall.html) (request) /// * [export assets projects](struct.ProjectExportAssetCall.html) (request) /// * [export assets organizations](struct.OrganizationExportAssetCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ExportAssetsRequest { /// A list of asset types of which to take a snapshot for. For example: - /// "google.compute.disk". If specified, only matching assets will be returned. + /// "google.compute.Disk". If specified, only matching assets will be returned. + /// See [Introduction to Cloud Asset + /// Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + /// for all supported asset types. #[serde(rename="assetTypes")] pub asset_types: Option>, - /// Timestamp to take an asset snapshot. This can only be set to a timestamp - /// between 2018-10-02 UTC (inclusive) and the current time. If not specified, - /// the current time will be used. Due to delays in resource data collection - /// and indexing, there is a volatile window during which running the same - /// query may get different results. - #[serde(rename="readTime")] - pub read_time: Option, /// Asset content type. If not specified, no content but the asset name will be /// returned. #[serde(rename="contentType")] @@ -562,6 +568,13 @@ pub struct ExportAssetsRequest { /// to. All results will be in newline delimited JSON format. #[serde(rename="outputConfig")] pub output_config: Option, + /// Timestamp to take an asset snapshot. This can only be set to a timestamp + /// between 2018-10-02 UTC (inclusive) and the current time. If not specified, + /// the current time will be used. Due to delays in resource data collection + /// and indexing, there is a volatile window during which running the same + /// query may get different results. + #[serde(rename="readTime")] + pub read_time: Option, } impl RequestValue for ExportAssetsRequest {} @@ -577,10 +590,9 @@ impl RequestValue for ExportAssetsRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// @@ -590,9 +602,10 @@ pub struct Expr { /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} @@ -625,6 +638,11 @@ pub struct Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, /// Specifies the identities requesting access for a Cloud Platform resource. /// `members` can have the following values: /// @@ -645,16 +663,11 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// pub members: Option>, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, } impl Part for Binding {} @@ -679,24 +692,6 @@ pub struct BatchGetAssetsHistoryResponse { impl ResponseResult for BatchGetAssetsHistoryResponse {} -/// A time window of [start_time, end_time). -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TimeWindow { - /// End time of the time window (exclusive). - /// Current timestamp if not specified. - #[serde(rename="endTime")] - pub end_time: Option, - /// Start time of the time window (inclusive). - #[serde(rename="startTime")] - pub start_time: Option, -} - -impl Part for TimeWindow {} - - /// Specifies the audit configuration for a service. /// The configuration determines which permission types are logged, and what /// identities, if any, are exempted from logging. @@ -772,17 +767,19 @@ impl Part for AuditConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Asset { - /// Representation of the actual Cloud IAM policy set on a cloud resource. For each - /// resource, there must be at most one Cloud IAM policy set on it. + /// Representation of the actual Cloud IAM policy set on a cloud resource. For + /// each resource, there must be at most one Cloud IAM policy set on it. #[serde(rename="iamPolicy")] pub iam_policy: Option, - /// Type of the asset. Example: "google.compute.disk". + /// Type of the asset. Example: "google.compute.Disk". #[serde(rename="assetType")] pub asset_type: Option, /// Representation of the resource. pub resource: Option, - /// The full name of the asset. For example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - /// See [Resource Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + /// The full name of the asset. For example: + /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + /// See [Resource + /// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) /// for more information. pub name: Option, } @@ -804,6 +801,24 @@ pub struct OutputConfig { impl Part for OutputConfig {} +/// A time window of (start_time, end_time]. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TimeWindow { + /// End time of the time window (inclusive). + /// Current timestamp if not specified. + #[serde(rename="endTime")] + pub end_time: Option, + /// Start time of the time window (exclusive). + #[serde(rename="startTime")] + pub start_time: Option, +} + +impl Part for TimeWindow {} + + /// Defines an Identity and Access Management (IAM) policy. It is used to /// specify access control policies for Cloud Platform resources. /// @@ -854,9 +869,9 @@ impl Part for OutputConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// Associates a list of `members` to a `role`. - /// `bindings` with no members will result in an error. - pub bindings: Option>, + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, /// `etag` is used for optimistic concurrency control as a way to help /// prevent simultaneous updates of a policy from overwriting each other. /// It is strongly suggested that systems make use of the `etag` in the @@ -868,9 +883,9 @@ pub struct Policy { /// If no `etag` is provided in the call to `setIamPolicy`, then the existing /// policy is overwritten blindly. pub etag: Option, - /// Specifies cloud audit logging configuration for this policy. - #[serde(rename="auditConfigs")] - pub audit_configs: Option>, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, /// Deprecated. pub version: Option, } @@ -886,10 +901,12 @@ impl Part for Policy {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [operations get organizations](struct.OrganizationOperationGetCall.html) (response) +/// * [export assets folders](struct.FolderExportAssetCall.html) (response) +/// * [operations get folders](struct.FolderOperationGetCall.html) (response) /// * [operations get projects](struct.ProjectOperationGetCall.html) (response) /// * [export assets projects](struct.ProjectExportAssetCall.html) (response) /// * [export assets organizations](struct.OrganizationExportAssetCall.html) (response) +/// * [operations get organizations](struct.OrganizationOperationGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Operation { @@ -928,8 +945,10 @@ impl ResponseResult for Operation {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GcsDestination { - /// The path of the Cloud Storage objects. It's the same path that is used by - /// gsutil. For example: "gs://bucket_name/object_path". See [Viewing and Editing Object Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) + /// The uri of the Cloud Storage object. It's the same uri that is used by + /// gsutil. For example: "gs://bucket_name/object_name". See [Viewing and + /// Editing Object + /// Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) /// for more information. pub uri: Option, } @@ -942,6 +961,92 @@ impl Part for GcsDestination {} // MethodBuilders ### // ################# +/// A builder providing access to all methods supported on *folder* resources. +/// It is not used directly, but through the `CloudAsset` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudasset1_beta1 as cloudasset1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudasset1_beta1::CloudAsset; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `export_assets(...)` and `operations_get(...)` +/// // to build up your call. +/// let rb = hub.folders(); +/// # } +/// ``` +pub struct FolderMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudAsset, +} + +impl<'a, C, A> MethodsBuilder for FolderMethods<'a, C, A> {} + +impl<'a, C, A> FolderMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Exports assets with time and resource types to a given Cloud Storage + /// location. The output format is newline-delimited JSON. + /// This API implements the google.longrunning.Operation API allowing you + /// to keep track of the export. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The relative name of the root asset. This can only be an + /// organization number (such as "organizations/123"), a project ID (such as + /// "projects/my-project-id"), a project number (such as "projects/12345"), or + /// a folder number (such as "folders/123"). + pub fn export_assets(&self, request: ExportAssetsRequest, parent: &str) -> FolderExportAssetCall<'a, C, A> { + FolderExportAssetCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn operations_get(&self, name: &str) -> FolderOperationGetCall<'a, C, A> { + FolderOperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *organization* resources. /// It is not used directly, but through the `CloudAsset` hub. /// @@ -988,6 +1093,8 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// non-delete or deleted status. /// For IAM_POLICY content, this API outputs history when the asset and its /// attached IAM POLICY both exist. This can create gaps in the output history. + /// If a specified asset does not exist, this API returns an INVALID_ARGUMENT + /// error. /// /// # Arguments /// @@ -1018,9 +1125,10 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `parent` - Required. The relative name of the root asset. This can only be an organization - /// number (such as "organizations/123"), a project ID (such as - /// "projects/my-project-id"), or a project number (such as "projects/12345"). + /// * `parent` - Required. The relative name of the root asset. This can only be an + /// organization number (such as "organizations/123"), a project ID (such as + /// "projects/my-project-id"), a project number (such as "projects/12345"), or + /// a folder number (such as "folders/123"). pub fn export_assets(&self, request: ExportAssetsRequest, parent: &str) -> OrganizationExportAssetCall<'a, C, A> { OrganizationExportAssetCall { hub: self.hub, @@ -1100,6 +1208,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// non-delete or deleted status. /// For IAM_POLICY content, this API outputs history when the asset and its /// attached IAM POLICY both exist. This can create gaps in the output history. + /// If a specified asset does not exist, this API returns an INVALID_ARGUMENT + /// error. /// /// # Arguments /// @@ -1149,9 +1259,10 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `parent` - Required. The relative name of the root asset. This can only be an organization - /// number (such as "organizations/123"), a project ID (such as - /// "projects/my-project-id"), or a project number (such as "projects/12345"). + /// * `parent` - Required. The relative name of the root asset. This can only be an + /// organization number (such as "organizations/123"), a project ID (such as + /// "projects/my-project-id"), a project number (such as "projects/12345"), or + /// a folder number (such as "folders/123"). pub fn export_assets(&self, request: ExportAssetsRequest, parent: &str) -> ProjectExportAssetCall<'a, C, A> { ProjectExportAssetCall { hub: self.hub, @@ -1172,11 +1283,548 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# +/// Exports assets with time and resource types to a given Cloud Storage +/// location. The output format is newline-delimited JSON. +/// This API implements the google.longrunning.Operation API allowing you +/// to keep track of the export. +/// +/// A builder for the *exportAssets* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudasset1_beta1 as cloudasset1_beta1; +/// use cloudasset1_beta1::ExportAssetsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudasset1_beta1::CloudAsset; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ExportAssetsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().export_assets(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct FolderExportAssetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudAsset, + _request: ExportAssetsRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderExportAssetCall<'a, C, A> {} + +impl<'a, C, A> FolderExportAssetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudasset.folders.exportAssets", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:exportAssets"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ExportAssetsRequest) -> FolderExportAssetCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The relative name of the root asset. This can only be an + /// organization number (such as "organizations/123"), a project ID (such as + /// "projects/my-project-id"), a project number (such as "projects/12345"), or + /// a folder number (such as "folders/123"). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> FolderExportAssetCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderExportAssetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderExportAssetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderExportAssetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *operations.get* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudasset1_beta1 as cloudasset1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudasset1_beta1::CloudAsset; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudAsset::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().operations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct FolderOperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudAsset, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderOperationGetCall<'a, C, A> {} + +impl<'a, C, A> FolderOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudasset.folders.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> FolderOperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderOperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderOperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderOperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Batch gets the update history of assets that overlap a time window. /// For RESOURCE content, this API outputs history with asset in both /// non-delete or deleted status. /// For IAM_POLICY content, this API outputs history when the asset and its /// attached IAM POLICY both exist. This can create gaps in the output history. +/// If a specified asset does not exist, this API returns an INVALID_ARGUMENT +/// error. /// /// A builder for the *batchGetAssetsHistory* method supported by a *organization* resource. /// It is not used directly, but through a `OrganizationMethods` instance. @@ -1204,10 +1852,10 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.organizations().batch_get_assets_history("parent") -/// .read_time_window_start_time("et") -/// .read_time_window_end_time("dolores") -/// .content_type("kasd") -/// .add_asset_names("accusam") +/// .read_time_window_start_time("kasd") +/// .read_time_window_end_time("accusam") +/// .content_type("takimata") +/// .add_asset_names("justo") /// .doit(); /// # } /// ``` @@ -1284,7 +1932,7 @@ impl<'a, C, A> OrganizationBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1300,10 +1948,7 @@ impl<'a, C, A> OrganizationBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1323,7 +1968,7 @@ impl<'a, C, A> OrganizationBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1388,14 +2033,14 @@ impl<'a, C, A> OrganizationBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMu self._parent = new_value.to_string(); self } - /// Start time of the time window (inclusive). + /// Start time of the time window (exclusive). /// /// Sets the *read time window.start time* query property to the given value. pub fn read_time_window_start_time(mut self, new_value: &str) -> OrganizationBatchGetAssetsHistoryCall<'a, C, A> { self._read_time_window_start_time = Some(new_value.to_string()); self } - /// End time of the time window (exclusive). + /// End time of the time window (inclusive). /// Current timestamp if not specified. /// /// Sets the *read time window.end time* query property to the given value. @@ -1412,7 +2057,8 @@ impl<'a, C, A> OrganizationBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMu } /// A list of the full names of the assets. For example: /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - /// See [Resource Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + /// See [Resource + /// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) /// for more info. /// /// The request becomes a no-op if the asset name list is empty, and the max @@ -1439,7 +2085,7 @@ impl<'a, C, A> OrganizationBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1447,12 +2093,12 @@ impl<'a, C, A> OrganizationBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationBatchGetAssetsHistoryCall<'a, C, A> @@ -1583,7 +2229,7 @@ impl<'a, C, A> OrganizationExportAssetCall<'a, C, A> where C: BorrowMut OrganizationExportAssetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1634,7 +2277,7 @@ impl<'a, C, A> OrganizationExportAssetCall<'a, C, A> where C: BorrowMut OrganizationExportAssetCall<'a, C, A> where C: BorrowMut OrganizationExportAssetCall<'a, C, A> where C: BorrowMut OrganizationExportAssetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationExportAssetCall<'a, C, A> @@ -1862,7 +2506,7 @@ impl<'a, C, A> OrganizationOperationGetCall<'a, C, A> where C: BorrowMut OrganizationOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1901,7 +2542,7 @@ impl<'a, C, A> OrganizationOperationGetCall<'a, C, A> where C: BorrowMut OrganizationOperationGetCall<'a, C, A> where C: BorrowMut OrganizationOperationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationOperationGetCall<'a, C, A> @@ -2032,6 +2673,8 @@ impl<'a, C, A> OrganizationOperationGetCall<'a, C, A> where C: BorrowMut OrganizationOperationGetCall<'a, C, A> where C: BorrowMut ProjectBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMut ProjectBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2178,7 +2818,7 @@ impl<'a, C, A> ProjectBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMut ProjectBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMut ProjectBatchGetAssetsHistoryCall<'a, C, A> { self._read_time_window_start_time = Some(new_value.to_string()); self } - /// End time of the time window (exclusive). + /// End time of the time window (inclusive). /// Current timestamp if not specified. /// /// Sets the *read time window.end time* query property to the given value. @@ -2267,7 +2907,8 @@ impl<'a, C, A> ProjectBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMut ProjectBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMut ProjectBatchGetAssetsHistoryCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectBatchGetAssetsHistoryCall<'a, C, A> @@ -2430,7 +3071,7 @@ impl<'a, C, A> ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2469,7 +3107,7 @@ impl<'a, C, A> ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectOperationGetCall<'a, C, A> @@ -2691,7 +3329,7 @@ impl<'a, C, A> ProjectExportAssetCall<'a, C, A> where C: BorrowMut ProjectExportAssetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2742,7 +3377,7 @@ impl<'a, C, A> ProjectExportAssetCall<'a, C, A> where C: BorrowMut ProjectExportAssetCall<'a, C, A> where C: BorrowMut ProjectExportAssetCall<'a, C, A> where C: BorrowMut ProjectExportAssetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectExportAssetCall<'a, C, A> diff --git a/gen/cloudbilling1-cli/Cargo.toml b/gen/cloudbilling1-cli/Cargo.toml index bd901d9e69..dee093edeb 100644 --- a/gen/cloudbilling1-cli/Cargo.toml +++ b/gen/cloudbilling1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudbilling1-cli" -version = "1.0.8+20180919" +version = "1.0.8+20190314" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloudbilling (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudbilling1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudbilling1] path = "../cloudbilling1" -version = "1.0.8+20180919" +version = "1.0.8+20190314" diff --git a/gen/cloudbilling1-cli/README.md b/gen/cloudbilling1-cli/README.md index b85cf401d6..3b8ebdf09d 100644 --- a/gen/cloudbilling1-cli/README.md +++ b/gen/cloudbilling1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloudbilling* API at revision *20180919*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloudbilling* API at revision *20190314*. The CLI is at version *1.0.8*. ```bash cloudbilling1 [options] diff --git a/gen/cloudbilling1-cli/mkdocs.yml b/gen/cloudbilling1-cli/mkdocs.yml index bec0b9ca66..8f4a991ee3 100644 --- a/gen/cloudbilling1-cli/mkdocs.yml +++ b/gen/cloudbilling1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloudbilling v1.0.8+20180919 +site_name: Cloudbilling v1.0.8+20190314 site_url: http://byron.github.io/google-apis-rs/google-cloudbilling1-cli site_description: A complete library to interact with Cloudbilling (protocol v1) diff --git a/gen/cloudbilling1-cli/src/main.rs b/gen/cloudbilling1-cli/src/main.rs index 61e4432e72..e93515b56f 100644 --- a/gen/cloudbilling1-cli/src/main.rs +++ b/gen/cloudbilling1-cli/src/main.rs @@ -69,8 +69,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "master-billing-account" => Some(("masterBillingAccount", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "open" => Some(("open", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { @@ -323,8 +323,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "master-billing-account" => Some(("masterBillingAccount", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "open" => Some(("open", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { @@ -699,9 +699,9 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billing-enabled" => Some(("billingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "billing-account-name" => Some(("billingAccountName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billing-enabled" => Some(("billingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["billing-account-name", "billing-enabled", "name", "project-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1399,7 +1399,7 @@ fn main() { let mut app = App::new("cloudbilling1") .author("Sebastian Thiel ") - .version("1.0.8+20180919") + .version("1.0.8+20190314") .about("Allows developers to manage billing for their Google Cloud Platform projects programmatically.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudbilling1_cli") diff --git a/gen/cloudbilling1/Cargo.toml b/gen/cloudbilling1/Cargo.toml index 3786cfd684..26e248bd20 100644 --- a/gen/cloudbilling1/Cargo.toml +++ b/gen/cloudbilling1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudbilling1" -version = "1.0.8+20180919" +version = "1.0.8+20190314" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloudbilling (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudbilling1" homepage = "https://cloud.google.com/billing/" -documentation = "https://docs.rs/google-cloudbilling1/1.0.8+20180919" +documentation = "https://docs.rs/google-cloudbilling1/1.0.8+20190314" license = "MIT" keywords = ["cloudbilling", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudbilling1/README.md b/gen/cloudbilling1/README.md index 05bd5b7ce0..098cbc2527 100644 --- a/gen/cloudbilling1/README.md +++ b/gen/cloudbilling1/README.md @@ -5,20 +5,20 @@ DO NOT EDIT ! --> The `google-cloudbilling1` library allows access to all features of the *Google Cloudbilling* service. -This documentation was generated from *Cloudbilling* crate version *1.0.8+20180919*, where *20180919* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloudbilling* crate version *1.0.8+20190314*, where *20190314* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloudbilling* *v1* API can be found at the [official documentation site](https://cloud.google.com/billing/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.Cloudbilling.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.Cloudbilling.html) ... -* [billing accounts](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.BillingAccount.html) - * [*create*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.BillingAccountCreateCall.html), [*get*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.BillingAccountGetCall.html), [*get iam policy*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.BillingAccountGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.BillingAccountListCall.html), [*patch*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.BillingAccountPatchCall.html), [*projects list*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.BillingAccountProjectListCall.html), [*set iam policy*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.BillingAccountSetIamPolicyCall.html) and [*test iam permissions*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.BillingAccountTestIamPermissionCall.html) +* [billing accounts](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.BillingAccount.html) + * [*create*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.BillingAccountCreateCall.html), [*get*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.BillingAccountGetCall.html), [*get iam policy*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.BillingAccountGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.BillingAccountListCall.html), [*patch*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.BillingAccountPatchCall.html), [*projects list*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.BillingAccountProjectListCall.html), [*set iam policy*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.BillingAccountSetIamPolicyCall.html) and [*test iam permissions*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.BillingAccountTestIamPermissionCall.html) * projects - * [*get billing info*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.ProjectGetBillingInfoCall.html) and [*update billing info*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.ProjectUpdateBillingInfoCall.html) -* [services](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.Service.html) - * [*list*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.ServiceListCall.html) and [*skus list*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.ServiceSkuListCall.html) + * [*get billing info*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.ProjectGetBillingInfoCall.html) and [*update billing info*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.ProjectUpdateBillingInfoCall.html) +* [services](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.Service.html) + * [*list*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.ServiceListCall.html) and [*skus list*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.ServiceSkuListCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/struct.Cloudbilling.html)** +* **[Hub](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/struct.Cloudbilling.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -138,17 +138,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -158,29 +158,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudbilling1/1.0.8+20180919/google_cloudbilling1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudbilling1/1.0.8+20190314/google_cloudbilling1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudbilling1/src/lib.rs b/gen/cloudbilling1/src/lib.rs index 436d70fe7a..0fa25070b2 100644 --- a/gen/cloudbilling1/src/lib.rs +++ b/gen/cloudbilling1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloudbilling* crate version *1.0.8+20180919*, where *20180919* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloudbilling* crate version *1.0.8+20190314*, where *20190314* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloudbilling* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/billing/). @@ -381,41 +381,6 @@ impl<'a, C, A> Cloudbilling // ############ // SCHEMAS ### // ########## -/// Encapsulates a single SKU in Google Cloud Platform -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Sku { - /// The category hierarchy of this SKU, purely for organizational purpose. - pub category: Option, - /// The identifier for the SKU. - /// Example: "AA95-CD31-42FE" - #[serde(rename="skuId")] - pub sku_id: Option, - /// A human readable description of the SKU, has a maximum length of 256 - /// characters. - pub description: Option, - /// List of service regions this SKU is offered at. - /// Example: "asia-east1" - /// Service regions can be found at https://cloud.google.com/about/locations/ - #[serde(rename="serviceRegions")] - pub service_regions: Option>, - /// A timeline of pricing info for this SKU in chronological order. - #[serde(rename="pricingInfo")] - pub pricing_info: Option>, - /// Identifies the service provider. - /// This is 'Google' for first party services in Google Cloud Platform. - #[serde(rename="serviceProviderName")] - pub service_provider_name: Option, - /// The resource name for the SKU. - /// Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE" - pub name: Option, -} - -impl Part for Sku {} - - /// Represents the category hierarchy of a SKU. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -442,6 +407,41 @@ pub struct Category { impl Part for Category {} +/// Encapsulates a single SKU in Google Cloud Platform +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Sku { + /// The category hierarchy of this SKU, purely for organizational purpose. + pub category: Option, + /// Identifies the service provider. + /// This is 'Google' for first party services in Google Cloud Platform. + #[serde(rename="serviceProviderName")] + pub service_provider_name: Option, + /// A human readable description of the SKU, has a maximum length of 256 + /// characters. + pub description: Option, + /// List of service regions this SKU is offered at. + /// Example: "asia-east1" + /// Service regions can be found at https://cloud.google.com/about/locations/ + #[serde(rename="serviceRegions")] + pub service_regions: Option>, + /// The identifier for the SKU. + /// Example: "AA95-CD31-42FE" + #[serde(rename="skuId")] + pub sku_id: Option, + /// A timeline of pricing info for this SKU in chronological order. + #[serde(rename="pricingInfo")] + pub pricing_info: Option>, + /// The resource name for the SKU. + /// Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE" + pub name: Option, +} + +impl Part for Sku {} + + /// Request message for `ListProjectBillingInfoResponse`. /// /// # Activities @@ -500,6 +500,10 @@ impl RequestValue for TestIamPermissionsRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Service { + /// The business under which the service is offered. + /// Ex. "businessEntities/GCP", "businessEntities/Maps" + #[serde(rename="businessEntityName")] + pub business_entity_name: Option, /// The identifier for the service. /// Example: "DA34-426B-A397" #[serde(rename="serviceId")] @@ -543,35 +547,27 @@ pub struct SetIamPolicyRequest { impl RequestValue for SetIamPolicyRequest {} -/// Represents an expression text. Example: +/// Response message for `ListServices`. /// -/// title: "User account presence" -/// description: "Determines whether the request has a user account" -/// expression: "size(request.user) > 0" +/// # Activities /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list services](struct.ServiceListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, - /// Textual representation of an expression in - /// Common Expression Language syntax. - /// - /// The application context of the containing message determines which - /// well-known feature set of CEL is supported. - pub expression: Option, - /// An optional string indicating the location of the expression for error - /// reporting, e.g. a file name and a position in the file. - pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, +pub struct ListServicesResponse { + /// A token to retrieve the next page of results. To retrieve the next page, + /// call `ListServices` again with the `page_token` field set to this + /// value. This field is empty if there are no more results to retrieve. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of services. + pub services: Option>, } -impl Part for Expr {} +impl ResponseResult for ListServicesResponse {} /// Provides the configuration for logging a type of permissions. @@ -654,6 +650,10 @@ impl ResponseResult for ListBillingAccountsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct BillingAccount { + /// The display name given to the billing account, such as `My Billing + /// Account`. This name is displayed in the GCP Console. + #[serde(rename="displayName")] + pub display_name: Option, /// If this account is a /// [subaccount](https://cloud.google.com/billing/docs/concepts), then this /// will be the resource name of the master billing account that it is being @@ -661,10 +661,6 @@ pub struct BillingAccount { /// Otherwise this will be empty. #[serde(rename="masterBillingAccount")] pub master_billing_account: Option, - /// The display name given to the billing account, such as `My Billing - /// Account`. This name is displayed in the GCP Console. - #[serde(rename="displayName")] - pub display_name: Option, /// The resource name of the billing account. The resource name has the form /// `billingAccounts/{billing_account_id}`. For example, /// `billingAccounts/012345-567890-ABCDEF` would be the resource name for @@ -759,9 +755,9 @@ impl Part for AggregationInfo {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// Associates a list of `members` to a `role`. - /// `bindings` with no members will result in an error. - pub bindings: Option>, + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, /// `etag` is used for optimistic concurrency control as a way to help /// prevent simultaneous updates of a policy from overwriting each other. /// It is strongly suggested that systems make use of the `etag` in the @@ -773,9 +769,9 @@ pub struct Policy { /// If no `etag` is provided in the call to `setIamPolicy`, then the existing /// policy is overwritten blindly. pub etag: Option, - /// Specifies cloud audit logging configuration for this policy. - #[serde(rename="auditConfigs")] - pub audit_configs: Option>, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, /// Deprecated. pub version: Option, } @@ -789,20 +785,6 @@ impl ResponseResult for Policy {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PricingInfo { - /// The timestamp from which this pricing was effective within the requested - /// time range. This is guaranteed to be greater than or equal to the - /// start_time field in the request and less than the end_time field in the - /// request. If a time range was not specified in the request this field will - /// be equivalent to a time within the last 12 hours, indicating the latest - /// pricing info. - #[serde(rename="effectiveTime")] - pub effective_time: Option, - /// An optional human readable summary of the pricing information, has a - /// maximum length of 256 characters. - pub summary: Option, - /// Expresses the pricing formula. See `PricingExpression` for an example. - #[serde(rename="pricingExpression")] - pub pricing_expression: Option, /// Conversion rate used for currency conversion, from USD to the currency /// specified in the request. This includes any surcharge collected for billing /// in non USD currency. If a currency is not specified in the request this @@ -814,6 +796,20 @@ pub struct PricingInfo { /// doesn't require aggregation. #[serde(rename="aggregationInfo")] pub aggregation_info: Option, + /// The timestamp from which this pricing was effective within the requested + /// time range. This is guaranteed to be greater than or equal to the + /// start_time field in the request and less than the end_time field in the + /// request. If a time range was not specified in the request this field will + /// be equivalent to a time within the last 12 hours, indicating the latest + /// pricing info. + #[serde(rename="effectiveTime")] + pub effective_time: Option, + /// Expresses the pricing formula. See `PricingExpression` for an example. + #[serde(rename="pricingExpression")] + pub pricing_expression: Option, + /// An optional human readable summary of the pricing information, has a + /// maximum length of 256 characters. + pub summary: Option, } impl Part for PricingInfo {} @@ -919,7 +915,7 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// @@ -1006,21 +1002,21 @@ pub struct ProjectBillingInfo { /// parse the `name` field to obtain a project ID. This field is read-only. #[serde(rename="projectId")] pub project_id: Option, - /// The resource name for the `ProjectBillingInfo`; has the form - /// `projects/{project_id}/billingInfo`. For example, the resource name for the - /// billing information for project `tokyo-rain-123` would be - /// `projects/tokyo-rain-123/billingInfo`. This field is read-only. - pub name: Option, + /// The resource name of the billing account associated with the project, if + /// any. For example, `billingAccounts/012345-567890-ABCDEF`. + #[serde(rename="billingAccountName")] + pub billing_account_name: Option, /// True if the project is associated with an open billing account, to which /// usage on the project is charged. False if the project is associated with a /// closed billing account, or no billing account at all, and therefore cannot /// use paid services. This field is read-only. #[serde(rename="billingEnabled")] pub billing_enabled: Option, - /// The resource name of the billing account associated with the project, if - /// any. For example, `billingAccounts/012345-567890-ABCDEF`. - #[serde(rename="billingAccountName")] - pub billing_account_name: Option, + /// The resource name for the `ProjectBillingInfo`; has the form + /// `projects/{project_id}/billingInfo`. For example, the resource name for the + /// billing information for project `tokyo-rain-123` would be + /// `projects/tokyo-rain-123/billingInfo`. This field is read-only. + pub name: Option, } impl RequestValue for ProjectBillingInfo {} @@ -1095,27 +1091,35 @@ pub struct AuditConfig { impl Part for AuditConfig {} -/// Response message for `ListServices`. +/// Represents an expression text. Example: /// -/// # Activities +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" /// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list services](struct.ServiceListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListServicesResponse { - /// A list of services. - pub services: Option>, - /// A token to retrieve the next page of results. To retrieve the next page, - /// call `ListServices` again with the `page_token` field set to this - /// value. This field is empty if there are no more results to retrieve. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } -impl ResponseResult for ListServicesResponse {} +impl Part for Expr {} /// The price rate indicating starting usage and its corresponding price. @@ -1671,7 +1675,7 @@ impl<'a, C, A> ServiceSkuListCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1687,10 +1691,7 @@ impl<'a, C, A> ServiceSkuListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1710,7 +1711,7 @@ impl<'a, C, A> ServiceSkuListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1838,7 +1839,7 @@ impl<'a, C, A> ServiceSkuListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1846,12 +1847,12 @@ impl<'a, C, A> ServiceSkuListCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ServiceSkuListCall<'a, C, A> @@ -1971,10 +1972,7 @@ impl<'a, C, A> ServiceListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1994,7 +1992,7 @@ impl<'a, C, A> ServiceListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2078,7 +2076,7 @@ impl<'a, C, A> ServiceListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2086,12 +2084,12 @@ impl<'a, C, A> ServiceListCall<'a, C, A> where C: BorrowMut, A: o /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ServiceListCall<'a, C, A> @@ -2217,10 +2215,7 @@ impl<'a, C, A> BillingAccountCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2252,7 +2247,7 @@ impl<'a, C, A> BillingAccountCreateCall<'a, C, A> where C: BorrowMut BillingAccountCreateCall<'a, C, A> where C: BorrowMut BillingAccountCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountCreateCall<'a, C, A> @@ -2471,10 +2466,7 @@ impl<'a, C, A> BillingAccountListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2494,7 +2486,7 @@ impl<'a, C, A> BillingAccountListCall<'a, C, A> where C: BorrowMut BillingAccountListCall<'a, C, A> where C: BorrowMut BillingAccountListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountListCall<'a, C, A> @@ -2727,7 +2719,7 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2743,10 +2735,7 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2766,7 +2755,7 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2845,7 +2834,7 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2853,12 +2842,12 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> BillingAccountGetCall<'a, C, A> @@ -2990,7 +2979,7 @@ impl<'a, C, A> BillingAccountSetIamPolicyCall<'a, C, A> where C: BorrowMut BillingAccountSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3041,7 +3027,7 @@ impl<'a, C, A> BillingAccountSetIamPolicyCall<'a, C, A> where C: BorrowMut BillingAccountSetIamPolicyCall<'a, C, A> where C: BorrowMut BillingAccountSetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountSetIamPolicyCall<'a, C, A> @@ -3283,7 +3269,7 @@ impl<'a, C, A> BillingAccountPatchCall<'a, C, A> where C: BorrowMut BillingAccountPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3334,7 +3317,7 @@ impl<'a, C, A> BillingAccountPatchCall<'a, C, A> where C: BorrowMut BillingAccountPatchCall<'a, C, A> where C: BorrowMut BillingAccountPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountPatchCall<'a, C, A> @@ -3579,7 +3562,7 @@ impl<'a, C, A> BillingAccountProjectListCall<'a, C, A> where C: BorrowMut BillingAccountProjectListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3618,7 +3598,7 @@ impl<'a, C, A> BillingAccountProjectListCall<'a, C, A> where C: BorrowMut BillingAccountProjectListCall<'a, C, A> where C: BorrowMut BillingAccountProjectListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountProjectListCall<'a, C, A> @@ -3857,7 +3837,7 @@ impl<'a, C, A> BillingAccountTestIamPermissionCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3873,10 +3853,7 @@ impl<'a, C, A> BillingAccountTestIamPermissionCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3908,7 +3885,7 @@ impl<'a, C, A> BillingAccountTestIamPermissionCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3999,7 +3976,7 @@ impl<'a, C, A> BillingAccountTestIamPermissionCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4007,12 +3984,12 @@ impl<'a, C, A> BillingAccountTestIamPermissionCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> BillingAccountTestIamPermissionCall<'a, C, A> @@ -4136,7 +4113,7 @@ impl<'a, C, A> BillingAccountGetIamPolicyCall<'a, C, A> where C: BorrowMut BillingAccountGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4175,7 +4149,7 @@ impl<'a, C, A> BillingAccountGetIamPolicyCall<'a, C, A> where C: BorrowMut BillingAccountGetIamPolicyCall<'a, C, A> where C: BorrowMut BillingAccountGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountGetIamPolicyCall<'a, C, A> @@ -4425,7 +4399,7 @@ impl<'a, C, A> ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4476,7 +4447,7 @@ impl<'a, C, A> ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectUpdateBillingInfoCall<'a, C, A> @@ -4704,7 +4675,7 @@ impl<'a, C, A> ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4743,7 +4711,7 @@ impl<'a, C, A> ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectGetBillingInfoCall<'a, C, A> diff --git a/gen/cloudbuild1-cli/Cargo.toml b/gen/cloudbuild1-cli/Cargo.toml index 495c2c5ade..cae878f45e 100644 --- a/gen/cloudbuild1-cli/Cargo.toml +++ b/gen/cloudbuild1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudbuild1-cli" -version = "1.0.8+20181011" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Build (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudbuild1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudbuild1] path = "../cloudbuild1" -version = "1.0.8+20181011" +version = "1.0.8+20190323" diff --git a/gen/cloudbuild1-cli/README.md b/gen/cloudbuild1-cli/README.md index 4578f0e3a0..4b05ae6d48 100644 --- a/gen/cloudbuild1-cli/README.md +++ b/gen/cloudbuild1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Build* API at revision *20181011*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Build* API at revision *20190323*. The CLI is at version *1.0.8*. ```bash cloudbuild1 [options] diff --git a/gen/cloudbuild1-cli/mkdocs.yml b/gen/cloudbuild1-cli/mkdocs.yml index b59f3f3213..afa2775cfb 100644 --- a/gen/cloudbuild1-cli/mkdocs.yml +++ b/gen/cloudbuild1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Build v1.0.8+20181011 +site_name: Cloud Build v1.0.8+20190323 site_url: http://byron.github.io/google-apis-rs/google-cloudbuild1-cli site_description: A complete library to interact with Cloud Build (protocol v1) diff --git a/gen/cloudbuild1-cli/src/main.rs b/gen/cloudbuild1-cli/src/main.rs index e3bf41f3bf..02e612b11e 100644 --- a/gen/cloudbuild1-cli/src/main.rs +++ b/gen/cloudbuild1-cli/src/main.rs @@ -370,11 +370,13 @@ impl<'n> Engine<'n> { "artifacts.objects.timing.start-time" => Some(("artifacts.objects.timing.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "artifacts.objects.paths" => Some(("artifacts.objects.paths", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "artifacts.objects.location" => Some(("artifacts.objects.location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "logs-bucket" => Some(("logsBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status-detail" => Some(("statusDetail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "results.build-step-outputs" => Some(("results.buildStepOutputs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "results.artifact-manifest" => Some(("results.artifactManifest", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "results.artifact-timing.end-time" => Some(("results.artifactTiming.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "results.artifact-timing.start-time" => Some(("results.artifactTiming.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "results.build-step-images" => Some(("results.buildStepImages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "results.num-artifacts" => Some(("results.numArtifacts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "source.repo-source.project-id" => Some(("source.repoSource.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -388,21 +390,22 @@ impl<'n> Engine<'n> { "source.storage-source.bucket" => Some(("source.storageSource.bucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "options.substitution-option" => Some(("options.substitutionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "options.machine-type" => Some(("options.machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "options.worker-pool" => Some(("options.workerPool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "options.source-provenance-hash" => Some(("options.sourceProvenanceHash", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "options.log-streaming-option" => Some(("options.logStreamingOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "options.secret-env" => Some(("options.secretEnv", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "options.disk-size-gb" => Some(("options.diskSizeGb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "options.logging" => Some(("options.logging", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "options.env" => Some(("options.env", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "options.requested-verify-option" => Some(("options.requestedVerifyOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "options.logging" => Some(("options.logging", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "logs-bucket" => Some(("logsBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "images" => Some(("images", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "substitutions" => Some(("substitutions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build-trigger-id" => Some(("buildTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["artifact-manifest", "artifacts", "branch-name", "bucket", "build-step-images", "build-step-outputs", "build-trigger-id", "commit-sha", "create-time", "dir", "disk-size-gb", "end-time", "env", "finish-time", "generation", "id", "images", "location", "log-streaming-option", "log-url", "logging", "logs-bucket", "machine-type", "num-artifacts", "object", "objects", "options", "paths", "project-id", "repo-name", "repo-source", "requested-verify-option", "resolved-repo-source", "resolved-storage-source", "results", "secret-env", "source", "source-provenance", "source-provenance-hash", "start-time", "status", "status-detail", "storage-source", "substitution-option", "substitutions", "tag-name", "tags", "timeout", "timing"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["artifact-manifest", "artifact-timing", "artifacts", "branch-name", "bucket", "build-step-images", "build-step-outputs", "build-trigger-id", "commit-sha", "create-time", "dir", "disk-size-gb", "end-time", "env", "finish-time", "generation", "id", "images", "location", "log-streaming-option", "log-url", "logging", "logs-bucket", "machine-type", "num-artifacts", "object", "objects", "options", "paths", "project-id", "repo-name", "repo-source", "requested-verify-option", "resolved-repo-source", "resolved-storage-source", "results", "secret-env", "source", "source-provenance", "source-provenance-hash", "start-time", "status", "status-detail", "storage-source", "substitution-option", "substitutions", "tag-name", "tags", "timeout", "timing", "worker-pool"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -683,12 +686,24 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "github.owner" => Some(("github.owner", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.push.tag" => Some(("github.push.tag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.push.branch" => Some(("github.push.branch", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.pull-request.comment-control" => Some(("github.pullRequest.commentControl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.pull-request.branch" => Some(("github.pullRequest.branch", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.name" => Some(("github.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.installation-id" => Some(("github.installationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ignored-files" => Some(("ignoredFiles", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "trigger-template.project-id" => Some(("triggerTemplate.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trigger-template.commit-sha" => Some(("triggerTemplate.commitSha", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trigger-template.repo-name" => Some(("triggerTemplate.repoName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trigger-template.tag-name" => Some(("triggerTemplate.tagName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trigger-template.branch-name" => Some(("triggerTemplate.branchName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trigger-template.dir" => Some(("triggerTemplate.dir", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "filename" => Some(("filename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "substitutions" => Some(("substitutions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "included-files" => Some(("includedFiles", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.status" => Some(("build.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.finish-time" => Some(("build.finishTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.timeout" => Some(("build.timeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -708,11 +723,13 @@ impl<'n> Engine<'n> { "build.artifacts.objects.timing.start-time" => Some(("build.artifacts.objects.timing.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.artifacts.objects.paths" => Some(("build.artifacts.objects.paths", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.artifacts.objects.location" => Some(("build.artifacts.objects.location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "build.project-id" => Some(("build.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.logs-bucket" => Some(("build.logsBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.id" => Some(("build.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.status-detail" => Some(("build.statusDetail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.results.build-step-outputs" => Some(("build.results.buildStepOutputs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.results.artifact-manifest" => Some(("build.results.artifactManifest", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.results.artifact-timing.end-time" => Some(("build.results.artifactTiming.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.results.artifact-timing.start-time" => Some(("build.results.artifactTiming.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.results.build-step-images" => Some(("build.results.buildStepImages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.results.num-artifacts" => Some(("build.results.numArtifacts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.source.repo-source.project-id" => Some(("build.source.repoSource.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -726,29 +743,25 @@ impl<'n> Engine<'n> { "build.source.storage-source.bucket" => Some(("build.source.storageSource.bucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.options.substitution-option" => Some(("build.options.substitutionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.options.machine-type" => Some(("build.options.machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.options.worker-pool" => Some(("build.options.workerPool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.options.source-provenance-hash" => Some(("build.options.sourceProvenanceHash", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.options.log-streaming-option" => Some(("build.options.logStreamingOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.options.secret-env" => Some(("build.options.secretEnv", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.options.disk-size-gb" => Some(("build.options.diskSizeGb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "build.options.logging" => Some(("build.options.logging", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.options.env" => Some(("build.options.env", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.options.requested-verify-option" => Some(("build.options.requestedVerifyOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.options.logging" => Some(("build.options.logging", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.start-time" => Some(("build.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "build.logs-bucket" => Some(("build.logsBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.project-id" => Some(("build.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.images" => Some(("build.images", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.substitutions" => Some(("build.substitutions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "build.create-time" => Some(("build.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.build-trigger-id" => Some(("build.buildTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "included-files" => Some(("includedFiles", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "trigger-template.project-id" => Some(("triggerTemplate.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "trigger-template.commit-sha" => Some(("triggerTemplate.commitSha", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "trigger-template.repo-name" => Some(("triggerTemplate.repoName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "trigger-template.tag-name" => Some(("triggerTemplate.tagName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "trigger-template.branch-name" => Some(("triggerTemplate.branchName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "trigger-template.dir" => Some(("triggerTemplate.dir", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "substitutions" => Some(("substitutions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["artifact-manifest", "artifacts", "branch-name", "bucket", "build", "build-step-images", "build-step-outputs", "build-trigger-id", "commit-sha", "create-time", "description", "dir", "disabled", "disk-size-gb", "end-time", "env", "filename", "finish-time", "generation", "id", "ignored-files", "images", "included-files", "location", "log-streaming-option", "log-url", "logging", "logs-bucket", "machine-type", "num-artifacts", "object", "objects", "options", "paths", "project-id", "repo-name", "repo-source", "requested-verify-option", "resolved-repo-source", "resolved-storage-source", "results", "secret-env", "source", "source-provenance", "source-provenance-hash", "start-time", "status", "status-detail", "storage-source", "substitution-option", "substitutions", "tag-name", "tags", "timeout", "timing", "trigger-template"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["artifact-manifest", "artifact-timing", "artifacts", "branch", "branch-name", "bucket", "build", "build-step-images", "build-step-outputs", "build-trigger-id", "comment-control", "commit-sha", "create-time", "description", "dir", "disabled", "disk-size-gb", "end-time", "env", "filename", "finish-time", "generation", "github", "id", "ignored-files", "images", "included-files", "installation-id", "location", "log-streaming-option", "log-url", "logging", "logs-bucket", "machine-type", "name", "num-artifacts", "object", "objects", "options", "owner", "paths", "project-id", "pull-request", "push", "repo-name", "repo-source", "requested-verify-option", "resolved-repo-source", "resolved-storage-source", "results", "secret-env", "source", "source-provenance", "source-provenance-hash", "start-time", "status", "status-detail", "storage-source", "substitution-option", "substitutions", "tag", "tag-name", "tags", "timeout", "timing", "trigger-template", "worker-pool"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -918,6 +931,12 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, _ => { let mut found = false; for param in &self.gp { @@ -931,6 +950,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); v } )); } } @@ -987,12 +1007,24 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "github.owner" => Some(("github.owner", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.push.tag" => Some(("github.push.tag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.push.branch" => Some(("github.push.branch", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.pull-request.comment-control" => Some(("github.pullRequest.commentControl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.pull-request.branch" => Some(("github.pullRequest.branch", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.name" => Some(("github.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "github.installation-id" => Some(("github.installationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ignored-files" => Some(("ignoredFiles", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "trigger-template.project-id" => Some(("triggerTemplate.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trigger-template.commit-sha" => Some(("triggerTemplate.commitSha", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trigger-template.repo-name" => Some(("triggerTemplate.repoName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trigger-template.tag-name" => Some(("triggerTemplate.tagName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trigger-template.branch-name" => Some(("triggerTemplate.branchName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trigger-template.dir" => Some(("triggerTemplate.dir", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "filename" => Some(("filename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "substitutions" => Some(("substitutions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "included-files" => Some(("includedFiles", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.status" => Some(("build.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.finish-time" => Some(("build.finishTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.timeout" => Some(("build.timeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1012,11 +1044,13 @@ impl<'n> Engine<'n> { "build.artifacts.objects.timing.start-time" => Some(("build.artifacts.objects.timing.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.artifacts.objects.paths" => Some(("build.artifacts.objects.paths", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.artifacts.objects.location" => Some(("build.artifacts.objects.location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "build.project-id" => Some(("build.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.logs-bucket" => Some(("build.logsBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.id" => Some(("build.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.status-detail" => Some(("build.statusDetail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.results.build-step-outputs" => Some(("build.results.buildStepOutputs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.results.artifact-manifest" => Some(("build.results.artifactManifest", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.results.artifact-timing.end-time" => Some(("build.results.artifactTiming.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.results.artifact-timing.start-time" => Some(("build.results.artifactTiming.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.results.build-step-images" => Some(("build.results.buildStepImages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.results.num-artifacts" => Some(("build.results.numArtifacts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.source.repo-source.project-id" => Some(("build.source.repoSource.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1030,29 +1064,25 @@ impl<'n> Engine<'n> { "build.source.storage-source.bucket" => Some(("build.source.storageSource.bucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.options.substitution-option" => Some(("build.options.substitutionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.options.machine-type" => Some(("build.options.machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.options.worker-pool" => Some(("build.options.workerPool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.options.source-provenance-hash" => Some(("build.options.sourceProvenanceHash", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.options.log-streaming-option" => Some(("build.options.logStreamingOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.options.secret-env" => Some(("build.options.secretEnv", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.options.disk-size-gb" => Some(("build.options.diskSizeGb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "build.options.logging" => Some(("build.options.logging", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.options.env" => Some(("build.options.env", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.options.requested-verify-option" => Some(("build.options.requestedVerifyOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.options.logging" => Some(("build.options.logging", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.start-time" => Some(("build.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "build.logs-bucket" => Some(("build.logsBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.project-id" => Some(("build.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.images" => Some(("build.images", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "build.substitutions" => Some(("build.substitutions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "build.create-time" => Some(("build.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "build.build-trigger-id" => Some(("build.buildTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "included-files" => Some(("includedFiles", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "trigger-template.project-id" => Some(("triggerTemplate.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "trigger-template.commit-sha" => Some(("triggerTemplate.commitSha", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "trigger-template.repo-name" => Some(("triggerTemplate.repoName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "trigger-template.tag-name" => Some(("triggerTemplate.tagName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "trigger-template.branch-name" => Some(("triggerTemplate.branchName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "trigger-template.dir" => Some(("triggerTemplate.dir", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "substitutions" => Some(("substitutions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["artifact-manifest", "artifacts", "branch-name", "bucket", "build", "build-step-images", "build-step-outputs", "build-trigger-id", "commit-sha", "create-time", "description", "dir", "disabled", "disk-size-gb", "end-time", "env", "filename", "finish-time", "generation", "id", "ignored-files", "images", "included-files", "location", "log-streaming-option", "log-url", "logging", "logs-bucket", "machine-type", "num-artifacts", "object", "objects", "options", "paths", "project-id", "repo-name", "repo-source", "requested-verify-option", "resolved-repo-source", "resolved-storage-source", "results", "secret-env", "source", "source-provenance", "source-provenance-hash", "start-time", "status", "status-detail", "storage-source", "substitution-option", "substitutions", "tag-name", "tags", "timeout", "timing", "trigger-template"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["artifact-manifest", "artifact-timing", "artifacts", "branch", "branch-name", "bucket", "build", "build-step-images", "build-step-outputs", "build-trigger-id", "comment-control", "commit-sha", "create-time", "description", "dir", "disabled", "disk-size-gb", "end-time", "env", "filename", "finish-time", "generation", "github", "id", "ignored-files", "images", "included-files", "installation-id", "location", "log-streaming-option", "log-url", "logging", "logs-bucket", "machine-type", "name", "num-artifacts", "object", "objects", "options", "owner", "paths", "project-id", "pull-request", "push", "repo-name", "repo-source", "requested-verify-option", "resolved-repo-source", "resolved-storage-source", "results", "secret-env", "source", "source-provenance", "source-provenance-hash", "start-time", "status", "status-detail", "storage-source", "substitution-option", "substitutions", "tag", "tag-name", "tags", "timeout", "timing", "trigger-template", "worker-pool"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1818,7 +1848,7 @@ fn main() { let mut app = App::new("cloudbuild1") .author("Sebastian Thiel ") - .version("1.0.8+20181011") + .version("1.0.8+20190323") .about("Creates and manages builds on Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudbuild1_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudbuild1/Cargo.toml b/gen/cloudbuild1/Cargo.toml index ff70d60dd2..c15605f9de 100644 --- a/gen/cloudbuild1/Cargo.toml +++ b/gen/cloudbuild1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudbuild1" -version = "1.0.8+20181011" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Build (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudbuild1" homepage = "https://cloud.google.com/cloud-build/docs/" -documentation = "https://docs.rs/google-cloudbuild1/1.0.8+20181011" +documentation = "https://docs.rs/google-cloudbuild1/1.0.8+20190323" license = "MIT" keywords = ["cloudbuild", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudbuild1/README.md b/gen/cloudbuild1/README.md index f428bf9ee5..ccc24c91f3 100644 --- a/gen/cloudbuild1/README.md +++ b/gen/cloudbuild1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-cloudbuild1` library allows access to all features of the *Google Cloud Build* service. -This documentation was generated from *Cloud Build* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *cloudbuild:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Build* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *cloudbuild:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Build* *v1* API can be found at the [official documentation site](https://cloud.google.com/cloud-build/docs/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.CloudBuild.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.CloudBuild.html) ... -* [operations](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.Operation.html) - * [*cancel*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.OperationCancelCall.html), [*get*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.OperationListCall.html) +* [operations](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.Operation.html) + * [*cancel*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.OperationCancelCall.html), [*get*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.OperationListCall.html) * projects - * [*builds cancel*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectBuildCancelCall.html), [*builds create*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectBuildCreateCall.html), [*builds get*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectBuildGetCall.html), [*builds list*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectBuildListCall.html), [*builds retry*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectBuildRetryCall.html), [*triggers create*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectTriggerCreateCall.html), [*triggers delete*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectTriggerDeleteCall.html), [*triggers get*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectTriggerGetCall.html), [*triggers list*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectTriggerListCall.html), [*triggers patch*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectTriggerPatchCall.html) and [*triggers run*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.ProjectTriggerRunCall.html) + * [*builds cancel*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectBuildCancelCall.html), [*builds create*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectBuildCreateCall.html), [*builds get*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectBuildGetCall.html), [*builds list*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectBuildListCall.html), [*builds retry*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectBuildRetryCall.html), [*triggers create*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectTriggerCreateCall.html), [*triggers delete*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectTriggerDeleteCall.html), [*triggers get*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectTriggerGetCall.html), [*triggers list*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectTriggerListCall.html), [*triggers patch*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectTriggerPatchCall.html) and [*triggers run*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.ProjectTriggerRunCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/struct.CloudBuild.html)** +* **[Hub](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/struct.CloudBuild.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -134,17 +134,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -154,29 +154,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudbuild1/1.0.8+20181011/google_cloudbuild1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudbuild1/1.0.8+20190323/google_cloudbuild1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudbuild1/src/lib.rs b/gen/cloudbuild1/src/lib.rs index 82a117f271..29f58b5c17 100644 --- a/gen/cloudbuild1/src/lib.rs +++ b/gen/cloudbuild1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Build* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *cloudbuild:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Build* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *cloudbuild:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Build* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/cloud-build/docs/). @@ -374,21 +374,6 @@ impl<'a, C, A> CloudBuild // ############ // SCHEMAS ### // ########## -/// The request message for Operations.CancelOperation. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [cancel operations](struct.OperationCancelCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CancelOperationRequest { _never_set: Option } - -impl RequestValue for CancelOperationRequest {} - - /// Start and end times for a build execution phase. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -493,25 +478,6 @@ pub struct RetryBuildRequest { _never_set: Option } impl RequestValue for RetryBuildRequest {} -/// An image built by the pipeline. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BuiltImage { - /// Output only. Stores timing information for pushing the specified image. - #[serde(rename="pushTiming")] - pub push_timing: Option, - /// Name used to push the container image to Google Container Registry, as - /// presented to `docker push`. - pub name: Option, - /// Docker Registry 2.0 digest. - pub digest: Option, -} - -impl Part for BuiltImage {} - - /// Location of the source in a supported storage service. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -638,9 +604,12 @@ pub struct Build { /// Artifacts produced by the build that should be uploaded upon /// successful completion of all build steps. pub artifacts: Option, - /// Output only. ID of the project. - #[serde(rename="projectId")] - pub project_id: Option, + /// Google Cloud Storage bucket where logs should be written (see + /// [Bucket Name + /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + /// Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`. + #[serde(rename="logsBucket")] + pub logs_bucket: Option, /// Substitutions data for `Build` resource. pub substitutions: Option>, /// The location of the source files to build. @@ -653,12 +622,9 @@ pub struct Build { /// /// Default time is ten minutes. pub timeout: Option, - /// Google Cloud Storage bucket where logs should be written (see - /// [Bucket Name - /// Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). - /// Logs file names will be of the format `${logs_bucket}/log-${build_id}.txt`. - #[serde(rename="logsBucket")] - pub logs_bucket: Option, + /// Output only. ID of the project. + #[serde(rename="projectId")] + pub project_id: Option, /// Special options for this build. pub options: Option, /// Output only. URL to logs for this build in Google Cloud Console. @@ -694,38 +660,17 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The response message for Operations.ListOperations. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list operations](struct.OperationListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListOperationsResponse { - /// The standard List next-page token. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// A list of operations that matches the specified filter in the request. - pub operations: Option>, -} - -impl ResponseResult for ListOperationsResponse {} - - -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -786,24 +731,6 @@ pub struct Status { impl Part for Status {} -/// Response containing existing `BuildTriggers`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [triggers list projects](struct.ProjectTriggerListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListBuildTriggersResponse { - /// `BuildTriggers` for the project, sorted by `create_time` descending. - pub triggers: Option>, -} - -impl ResponseResult for ListBuildTriggersResponse {} - - /// Container message for hash values. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -843,81 +770,25 @@ pub struct ArtifactObjects { impl Part for ArtifactObjects {} -/// Optional arguments to enable specific features of builds. +/// PullRequestFilter contains filter properties for matching GitHub Pull +/// Requests. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BuildOptions { - /// Option to specify behavior when there is an error in the substitution - /// checks. - #[serde(rename="substitutionOption")] - pub substitution_option: Option, - /// Compute Engine machine type on which to run the build. - #[serde(rename="machineType")] - pub machine_type: Option, - /// Global list of volumes to mount for ALL build steps +pub struct PullRequestFilter { + /// Whether to block builds on a "/gcbrun" comment from a repository owner or + /// collaborator. + #[serde(rename="commentControl")] + pub comment_control: Option, + /// Regex of branches to match. /// - /// Each volume is created as an empty volume prior to starting the build - /// process. Upon completion of the build, volumes and their contents are - /// discarded. Global volume names and paths cannot conflict with the volumes - /// defined a build step. - /// - /// Using a global volume in a build with only one step is not valid as - /// it is indicative of a build request with an incorrect configuration. - pub volumes: Option>, - /// Requested hash for SourceProvenance. - #[serde(rename="sourceProvenanceHash")] - pub source_provenance_hash: Option>, - /// Option to define build log streaming behavior to Google Cloud - /// Storage. - #[serde(rename="logStreamingOption")] - pub log_streaming_option: Option, - /// A list of global environment variables, which are encrypted using a Cloud - /// Key Management Service crypto key. These values must be specified in the - /// build's `Secret`. These variables will be available to all build steps - /// in this build. - #[serde(rename="secretEnv")] - pub secret_env: Option>, - /// Requested disk size for the VM that runs the build. Note that this is *NOT* - /// "disk free"; some of the space will be used by the operating system and - /// build utilities. Also note that this is the minimum disk size that will be - /// allocated for the build -- the build may run with a larger disk than - /// requested. At present, the maximum disk size is 1000GB; builds that request - /// more than the maximum are rejected with an error. - #[serde(rename="diskSizeGb")] - pub disk_size_gb: Option, - /// A list of global environment variable definitions that will exist for all - /// build steps in this build. If a variable is defined in both globally and in - /// a build step, the variable will use the build step value. - /// - /// The elements are of the form "KEY=VALUE" for the environment variable "KEY" - /// being given the value "VALUE". - pub env: Option>, - /// Requested verifiability options. - #[serde(rename="requestedVerifyOption")] - pub requested_verify_option: Option, - /// Option to specify the logging mode, which determines where the logs are - /// stored. - pub logging: Option, + /// The syntax of the regular expressions accepted is the syntax accepted by + /// RE2 and described at https://github.com/google/re2/wiki/Syntax + pub branch: Option, } -impl Part for BuildOptions {} - - -/// Request to cancel an ongoing build. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [builds cancel projects](struct.ProjectBuildCancelCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CancelBuildRequest { _never_set: Option } - -impl RequestValue for CancelBuildRequest {} +impl Part for PullRequestFilter {} /// Configuration for an automated build in response to source repository @@ -934,8 +805,13 @@ impl RequestValue for CancelBuildRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct BuildTrigger { + /// GitHubEventsConfig describes the configuration of a trigger that creates + /// a build whenever a GitHub event is received. + pub github: Option, /// Human-readable description of this trigger. pub description: Option, + /// Output only. Unique identifier of the trigger. + pub id: Option, /// ignored_files and included_files are file glob matches using /// http://godoc/pkg/path/filepath#Match extended with support for "**". /// @@ -947,19 +823,12 @@ pub struct BuildTrigger { /// outside of the ignored_files globs, then we do not trigger a build. #[serde(rename="ignoredFiles")] pub ignored_files: Option>, - /// Template describing the types of source changes to trigger a build. - /// - /// Branch and tag names in trigger templates are interpreted as regular - /// expressions. Any branch or tag change that matches that regular expression - /// will trigger a build. - #[serde(rename="triggerTemplate")] - pub trigger_template: Option, - /// Path, from the source root, to a file whose contents is used for the - /// template. - pub filename: Option, /// Output only. Time when the trigger was created. #[serde(rename="createTime")] pub create_time: Option, + /// Path, from the source root, to a file whose contents is used for the + /// template. + pub filename: Option, /// If true, the trigger will never result in a build. pub disabled: Option, /// Contents of the build template. @@ -976,43 +845,28 @@ pub struct BuildTrigger { pub included_files: Option>, /// Substitutions data for Build resource. pub substitutions: Option>, - /// Output only. Unique identifier of the trigger. - pub id: Option, + /// Template describing the types of source changes to trigger a build. + /// + /// Branch and tag names in trigger templates are interpreted as regular + /// expressions. Any branch or tag change that matches that regular expression + /// will trigger a build. + #[serde(rename="triggerTemplate")] + pub trigger_template: Option, } impl RequestValue for BuildTrigger {} impl ResponseResult for BuildTrigger {} -/// Artifacts created by the build pipeline. +/// A CheckSuiteFilter is a filter that indicates that we should build on all +/// check suite events. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Results { - /// List of build step outputs, produced by builder images, in the order - /// corresponding to build step indices. - /// - /// [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders) - /// can produce this output by writing to `$BUILDER_OUTPUT/output`. - /// Only the first 4KB of data is stored. - #[serde(rename="buildStepOutputs")] - pub build_step_outputs: Option>, - /// Path to the artifact manifest. Only populated when artifacts are uploaded. - #[serde(rename="artifactManifest")] - pub artifact_manifest: Option, - /// Container images that were built as a part of the build. - pub images: Option>, - /// List of build step digests, in the order corresponding to build step - /// indices. - #[serde(rename="buildStepImages")] - pub build_step_images: Option>, - /// Number of artifacts uploaded. Only populated when artifacts are uploaded. - #[serde(rename="numArtifacts")] - pub num_artifacts: Option, -} +pub struct CheckSuiteFilter { _never_set: Option } -impl Part for Results {} +impl Part for CheckSuiteFilter {} /// A step in the build pipeline. @@ -1025,6 +879,31 @@ pub struct BuildStep { /// only updated on build completion; step status is not updated in real-time /// as the build progresses. pub status: Option, + /// The ID(s) of the step(s) that this build step depends on. + /// This build step will not start until all the build steps in `wait_for` + /// have completed successfully. If `wait_for` is empty, this build step will + /// start when all previous build steps in the `Build.Steps` list have + /// completed successfully. + #[serde(rename="waitFor")] + pub wait_for: Option>, + /// Required. The name of the container image that will run this particular + /// build step. + /// + /// If the image is available in the host's Docker daemon's cache, it + /// will be run directly. If not, the host will attempt to pull the image + /// first, using the builder service account's credentials if necessary. + /// + /// The Docker daemon's cache will already have the latest versions of all of + /// the officially supported build steps + /// ([https://github.com/GoogleCloudPlatform/cloud-builders](https://github.com/GoogleCloudPlatform/cloud-builders)). + /// The Docker daemon will also have cached many of the layers for some popular + /// images, like "ubuntu", "debian", but they will be refreshed at the time you + /// attempt to use them. + /// + /// If you built an image in a previous build step, it will be stored in the + /// host's Docker daemon's cache and is available to use as the name for a + /// later build step. + pub name: Option, /// A list of arguments that will be presented to the step when it is started. /// /// If the image used to run the step's container has an entrypoint, the `args` @@ -1036,22 +915,9 @@ pub struct BuildStep { /// time limit and will be allowed to continue to run until either it completes /// or the build itself times out. pub timeout: Option, - /// List of volumes to mount into the build step. - /// - /// Each volume is created as an empty volume prior to execution of the - /// build step. Upon completion of the build, volumes and their contents are - /// discarded. - /// - /// Using a named volume in only one step is not valid as it is indicative - /// of a build request with an incorrect configuration. - pub volumes: Option>, - /// The ID(s) of the step(s) that this build step depends on. - /// This build step will not start until all the build steps in `wait_for` - /// have completed successfully. If `wait_for` is empty, this build step will - /// start when all previous build steps in the `Build.Steps` list have - /// completed successfully. - #[serde(rename="waitFor")] - pub wait_for: Option>, + /// Unique identifier for this build step, used in `wait_for` to + /// reference this build step as a dependency. + pub id: Option, /// A list of environment variables which are encrypted using a Cloud Key /// Management Service crypto key. These values must be specified in the /// build's `Secret`. @@ -1071,9 +937,15 @@ pub struct BuildStep { /// builder image only. #[serde(rename="pullTiming")] pub pull_timing: Option, - /// Unique identifier for this build step, used in `wait_for` to - /// reference this build step as a dependency. - pub id: Option, + /// List of volumes to mount into the build step. + /// + /// Each volume is created as an empty volume prior to execution of the + /// build step. Upon completion of the build, volumes and their contents are + /// discarded. + /// + /// Using a named volume in only one step is not valid as it is indicative + /// of a build request with an incorrect configuration. + pub volumes: Option>, /// Working directory to use when running this step's container. /// /// If this value is a relative path, it is relative to the build's working @@ -1085,24 +957,6 @@ pub struct BuildStep { /// which specifies an absolute path, the `RepoSource` `dir` is ignored for /// the step's execution. pub dir: Option, - /// Required. The name of the container image that will run this particular - /// build step. - /// - /// If the image is available in the host's Docker daemon's cache, it - /// will be run directly. If not, the host will attempt to pull the image - /// first, using the builder service account's credentials if necessary. - /// - /// The Docker daemon's cache will already have the latest versions of all of - /// the officially supported build steps - /// ([https://github.com/GoogleCloudPlatform/cloud-builders](https://github.com/GoogleCloudPlatform/cloud-builders)). - /// The Docker daemon will also have cached many of the layers for some popular - /// images, like "ubuntu", "debian", but they will be refreshed at the time you - /// attempt to use them. - /// - /// If you built an image in a previous build step, it will be stored in the - /// host's Docker daemon's cache and is available to use as the name for a - /// later build step. - pub name: Option, } impl Part for BuildStep {} @@ -1157,8 +1011,8 @@ pub struct SourceProvenance { #[serde(rename="resolvedRepoSource")] pub resolved_repo_source: Option, /// Output only. Hash(es) of the build source, which can be used to verify that - /// the originalsource integrity was maintained in the build. Note that - /// `FileHashes` willonly be populated if `BuildOptions` has requested a + /// the original source integrity was maintained in the build. Note that + /// `FileHashes` will only be populated if `BuildOptions` has requested a /// `SourceProvenanceHash`. /// /// The keys to this map are file paths used as build source and the values @@ -1200,6 +1054,240 @@ pub struct StorageSource { impl Part for StorageSource {} +/// Response including listed builds. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [builds list projects](struct.ProjectBuildListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListBuildsResponse { + /// Token to receive the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Builds will be sorted by `create_time`, descending. + pub builds: Option>, +} + +impl ResponseResult for ListBuildsResponse {} + + +/// Push contains filter properties for matching GitHub git pushes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PushFilter { + /// Regexes of tags to match. + /// + /// The syntax of the regular expressions accepted is the syntax accepted by + /// RE2 and described at https://github.com/google/re2/wiki/Syntax + pub tag: Option, + /// Regexes of branches to match. + /// + /// The syntax of the regular expressions accepted is the syntax accepted by + /// RE2 and described at https://github.com/google/re2/wiki/Syntax + pub branch: Option, +} + +impl Part for PushFilter {} + + +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operations](struct.OperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for ListOperationsResponse {} + + +/// Response containing existing `BuildTriggers`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [triggers list projects](struct.ProjectTriggerListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListBuildTriggersResponse { + /// Token to receive the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// `BuildTriggers` for the project, sorted by `create_time` descending. + pub triggers: Option>, +} + +impl ResponseResult for ListBuildTriggersResponse {} + + +/// An image built by the pipeline. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuiltImage { + /// Output only. Stores timing information for pushing the specified image. + #[serde(rename="pushTiming")] + pub push_timing: Option, + /// Name used to push the container image to Google Container Registry, as + /// presented to `docker push`. + pub name: Option, + /// Docker Registry 2.0 digest. + pub digest: Option, +} + +impl Part for BuiltImage {} + + +/// Optional arguments to enable specific features of builds. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildOptions { + /// Option to specify behavior when there is an error in the substitution + /// checks. + #[serde(rename="substitutionOption")] + pub substitution_option: Option, + /// Compute Engine machine type on which to run the build. + #[serde(rename="machineType")] + pub machine_type: Option, + /// A list of global environment variable definitions that will exist for all + /// build steps in this build. If a variable is defined in both globally and in + /// a build step, the variable will use the build step value. + /// + /// The elements are of the form "KEY=VALUE" for the environment variable "KEY" + /// being given the value "VALUE". + pub env: Option>, + /// Requested hash for SourceProvenance. + #[serde(rename="sourceProvenanceHash")] + pub source_provenance_hash: Option>, + /// Option to define build log streaming behavior to Google Cloud + /// Storage. + #[serde(rename="logStreamingOption")] + pub log_streaming_option: Option, + /// A list of global environment variables, which are encrypted using a Cloud + /// Key Management Service crypto key. These values must be specified in the + /// build's `Secret`. These variables will be available to all build steps + /// in this build. + #[serde(rename="secretEnv")] + pub secret_env: Option>, + /// Requested disk size for the VM that runs the build. Note that this is *NOT* + /// "disk free"; some of the space will be used by the operating system and + /// build utilities. Also note that this is the minimum disk size that will be + /// allocated for the build -- the build may run with a larger disk than + /// requested. At present, the maximum disk size is 1000GB; builds that request + /// more than the maximum are rejected with an error. + #[serde(rename="diskSizeGb")] + pub disk_size_gb: Option, + /// Option to specify the logging mode, which determines where the logs are + /// stored. + pub logging: Option, + /// Global list of volumes to mount for ALL build steps + /// + /// Each volume is created as an empty volume prior to starting the build + /// process. Upon completion of the build, volumes and their contents are + /// discarded. Global volume names and paths cannot conflict with the volumes + /// defined a build step. + /// + /// Using a global volume in a build with only one step is not valid as + /// it is indicative of a build request with an incorrect configuration. + pub volumes: Option>, + /// Requested verifiability options. + #[serde(rename="requestedVerifyOption")] + pub requested_verify_option: Option, + /// Option to specify a `WorkerPool` for the build. User specifies the pool + /// with the format "[WORKERPOOL_PROJECT_ID]/[WORKERPOOL_NAME]". + /// This is an experimental field. + #[serde(rename="workerPool")] + pub worker_pool: Option, +} + +impl Part for BuildOptions {} + + +/// Request to cancel an ongoing build. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [builds cancel projects](struct.ProjectBuildCancelCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CancelBuildRequest { _never_set: Option } + +impl RequestValue for CancelBuildRequest {} + + +/// Artifacts created by the build pipeline. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Results { + /// List of build step outputs, produced by builder images, in the order + /// corresponding to build step indices. + /// + /// [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders) + /// can produce this output by writing to `$BUILDER_OUTPUT/output`. + /// Only the first 4KB of data is stored. + #[serde(rename="buildStepOutputs")] + pub build_step_outputs: Option>, + /// Path to the artifact manifest. Only populated when artifacts are uploaded. + #[serde(rename="artifactManifest")] + pub artifact_manifest: Option, + /// Time to push all non-container artifacts. + #[serde(rename="artifactTiming")] + pub artifact_timing: Option, + /// Container images that were built as a part of the build. + pub images: Option>, + /// List of build step digests, in the order corresponding to build step + /// indices. + #[serde(rename="buildStepImages")] + pub build_step_images: Option>, + /// Number of artifacts uploaded. Only populated when artifacts are uploaded. + #[serde(rename="numArtifacts")] + pub num_artifacts: Option, +} + +impl Part for Results {} + + +/// The request message for Operations.CancelOperation. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [cancel operations](struct.OperationCancelCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CancelOperationRequest { _never_set: Option } + +impl RequestValue for CancelOperationRequest {} + + /// This resource represents a long-running operation that is the result of a /// network API call. /// @@ -1247,25 +1335,34 @@ impl Resource for Operation {} impl ResponseResult for Operation {} -/// Response including listed builds. +/// GitHubEventsConfig describes the configuration of a trigger that creates a +/// build whenever a GitHub event is received. /// -/// # Activities +/// This message is experimental. /// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [builds list projects](struct.ProjectBuildListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListBuildsResponse { - /// Token to receive the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Builds will be sorted by `create_time`, descending. - pub builds: Option>, +pub struct GitHubEventsConfig { + /// Owner of the repository. + pub owner: Option, + /// Name of the repository. + pub name: Option, + /// filter to match changes in refs like branches, tags. + pub push: Option, + /// The installationID that emmits the GitHub event. + #[serde(rename="installationId")] + pub installation_id: Option, + /// filter to match changes in pull requests. + #[serde(rename="pullRequest")] + pub pull_request: Option, + /// Output only. Indicates that a build was generated from a check suite + /// event. + #[serde(rename="checkSuite")] + pub check_suite: Option, } -impl ResponseResult for ListBuildsResponse {} +impl Part for GitHubEventsConfig {} @@ -1464,6 +1561,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { ProjectTriggerListCall { hub: self.hub, _project_id: project_id.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1803,7 +1902,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1819,10 +1918,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1854,7 +1950,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1944,7 +2040,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2102,7 +2198,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2118,10 +2214,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2141,7 +2234,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2240,7 +2333,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2376,7 +2469,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2392,10 +2485,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2415,7 +2505,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2493,7 +2583,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2643,10 +2733,7 @@ impl<'a, C, A> ProjectTriggerGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2666,7 +2753,7 @@ impl<'a, C, A> ProjectTriggerGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2754,7 +2841,7 @@ impl<'a, C, A> ProjectTriggerGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2832,6 +2919,8 @@ impl<'a, C, A> ProjectTriggerGetCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().triggers_list("projectId") +/// .page_token("justo") +/// .page_size(-21) /// .doit(); /// # } /// ``` @@ -2840,6 +2929,8 @@ pub struct ProjectTriggerListCall<'a, C, A> hub: &'a CloudBuild, _project_id: String, + _page_token: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -2861,9 +2952,15 @@ impl<'a, C, A> ProjectTriggerListCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(3 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("projectId", self._project_id.to_string())); - for &field in ["alt", "projectId"].iter() { + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "projectId", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2902,10 +2999,7 @@ impl<'a, C, A> ProjectTriggerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2925,7 +3019,7 @@ impl<'a, C, A> ProjectTriggerListCall<'a, C, A> where C: BorrowMut ProjectTriggerListCall<'a, C, A> where C: BorrowMut ProjectTriggerListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Number of results to return in the list. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectTriggerListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -3003,7 +3111,7 @@ impl<'a, C, A> ProjectTriggerListCall<'a, C, A> where C: BorrowMut ProjectTriggerDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3176,7 +3281,7 @@ impl<'a, C, A> ProjectTriggerDeleteCall<'a, C, A> where C: BorrowMut ProjectTriggerDeleteCall<'a, C, A> where C: BorrowMut ProjectBuildCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3454,7 +3556,7 @@ impl<'a, C, A> ProjectBuildCancelCall<'a, C, A> where C: BorrowMut ProjectBuildCancelCall<'a, C, A> where C: BorrowMut ProjectBuildCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3746,7 +3845,7 @@ impl<'a, C, A> ProjectBuildCreateCall<'a, C, A> where C: BorrowMut ProjectBuildCreateCall<'a, C, A> where C: BorrowMut ProjectBuildGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4010,7 +4106,7 @@ impl<'a, C, A> ProjectBuildGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4098,7 +4194,7 @@ impl<'a, C, A> ProjectBuildGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4177,9 +4273,9 @@ impl<'a, C, A> ProjectBuildGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().builds_list("projectId") -/// .page_token("duo") -/// .page_size(-32) -/// .filter("sea") +/// .page_token("sea") +/// .page_size(-55) +/// .filter("eos") /// .doit(); /// # } /// ``` @@ -4262,10 +4358,7 @@ impl<'a, C, A> ProjectBuildListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4285,7 +4378,7 @@ impl<'a, C, A> ProjectBuildListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4384,7 +4477,7 @@ impl<'a, C, A> ProjectBuildListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4539,10 +4632,7 @@ impl<'a, C, A> ProjectTriggerRunCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4574,7 +4664,7 @@ impl<'a, C, A> ProjectTriggerRunCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4674,7 +4764,7 @@ impl<'a, C, A> ProjectTriggerRunCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4855,10 +4945,7 @@ impl<'a, C, A> ProjectBuildRetryCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4890,7 +4977,7 @@ impl<'a, C, A> ProjectBuildRetryCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4990,7 +5077,7 @@ impl<'a, C, A> ProjectBuildRetryCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5145,10 +5232,7 @@ impl<'a, C, A> ProjectTriggerCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5180,7 +5264,7 @@ impl<'a, C, A> ProjectTriggerCreateCall<'a, C, A> where C: BorrowMut ProjectTriggerCreateCall<'a, C, A> where C: BorrowMut ProjectTriggerPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5462,7 +5543,7 @@ impl<'a, C, A> ProjectTriggerPatchCall<'a, C, A> where C: BorrowMut ProjectTriggerPatchCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Cloud Debugger (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/clouddebugger2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-clouddebugger2] path = "../clouddebugger2" -version = "1.0.8+20180925" +version = "1.0.8+20190313" diff --git a/gen/clouddebugger2-cli/README.md b/gen/clouddebugger2-cli/README.md index 782acaea90..9f63f78842 100644 --- a/gen/clouddebugger2-cli/README.md +++ b/gen/clouddebugger2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Debugger* API at revision *20180925*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Debugger* API at revision *20190313*. The CLI is at version *1.0.8*. ```bash clouddebugger2 [options] diff --git a/gen/clouddebugger2-cli/mkdocs.yml b/gen/clouddebugger2-cli/mkdocs.yml index 4b4b5856fb..7cdfcbb611 100644 --- a/gen/clouddebugger2-cli/mkdocs.yml +++ b/gen/clouddebugger2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Debugger v1.0.8+20180925 +site_name: Cloud Debugger v1.0.8+20190313 site_url: http://byron.github.io/google-apis-rs/google-clouddebugger2-cli site_description: A complete library to interact with Cloud Debugger (protocol v2) diff --git a/gen/clouddebugger2-cli/src/main.rs b/gen/clouddebugger2-cli/src/main.rs index 5f37afaac9..80252fc232 100644 --- a/gen/clouddebugger2-cli/src/main.rs +++ b/gen/clouddebugger2-cli/src/main.rs @@ -128,10 +128,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "breakpoint.status.is-error" => Some(("breakpoint.status.isError", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "breakpoint.status.refers-to" => Some(("breakpoint.status.refersTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "breakpoint.status.description.parameters" => Some(("breakpoint.status.description.parameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "breakpoint.status.description.format" => Some(("breakpoint.status.description.format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "breakpoint.status.refers-to" => Some(("breakpoint.status.refersTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "breakpoint.status.is-error" => Some(("breakpoint.status.isError", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "breakpoint.final-time" => Some(("breakpoint.finalTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "breakpoint.log-message-format" => Some(("breakpoint.logMessageFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "breakpoint.log-level" => Some(("breakpoint.logLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -230,10 +230,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "debuggee.status.is-error" => Some(("debuggee.status.isError", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "debuggee.status.refers-to" => Some(("debuggee.status.refersTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "debuggee.status.description.parameters" => Some(("debuggee.status.description.parameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "debuggee.status.description.format" => Some(("debuggee.status.description.format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "debuggee.status.refers-to" => Some(("debuggee.status.refersTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "debuggee.status.is-error" => Some(("debuggee.status.isError", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "debuggee.description" => Some(("debuggee.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "debuggee.is-disabled" => Some(("debuggee.isDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "debuggee.labels" => Some(("debuggee.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -509,10 +509,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "status.is-error" => Some(("status.isError", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "status.refers-to" => Some(("status.refersTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.description.parameters" => Some(("status.description.parameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "status.description.format" => Some(("status.description.format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status.refers-to" => Some(("status.refersTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status.is-error" => Some(("status.isError", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "final-time" => Some(("finalTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "log-message-format" => Some(("logMessageFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "log-level" => Some(("logLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1022,7 +1022,7 @@ fn main() { let mut app = App::new("clouddebugger2") .author("Sebastian Thiel ") - .version("1.0.8+20180925") + .version("1.0.8+20190313") .about("Examines the call stack and variables of a running application without stopping or slowing it down. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_clouddebugger2_cli") diff --git a/gen/clouddebugger2/Cargo.toml b/gen/clouddebugger2/Cargo.toml index 3c96361879..8c255c1d3c 100644 --- a/gen/clouddebugger2/Cargo.toml +++ b/gen/clouddebugger2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-clouddebugger2" -version = "1.0.8+20180925" +version = "1.0.8+20190313" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Debugger (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/clouddebugger2" homepage = "https://cloud.google.com/debugger" -documentation = "https://docs.rs/google-clouddebugger2/1.0.8+20180925" +documentation = "https://docs.rs/google-clouddebugger2/1.0.8+20190313" license = "MIT" keywords = ["clouddebugger", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/clouddebugger2/README.md b/gen/clouddebugger2/README.md index ad3570835e..82c14b1012 100644 --- a/gen/clouddebugger2/README.md +++ b/gen/clouddebugger2/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-clouddebugger2` library allows access to all features of the *Google Cloud Debugger* service. -This documentation was generated from *Cloud Debugger* crate version *1.0.8+20180925*, where *20180925* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Debugger* crate version *1.0.8+20190313*, where *20190313* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Debugger* *v2* API can be found at the [official documentation site](https://cloud.google.com/debugger). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/struct.CloudDebugger.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/struct.CloudDebugger.html) ... * controller - * [*debuggees breakpoints list*](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/struct.ControllerDebuggeeBreakpointListCall.html), [*debuggees breakpoints update*](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/struct.ControllerDebuggeeBreakpointUpdateCall.html) and [*debuggees register*](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/struct.ControllerDebuggeeRegisterCall.html) + * [*debuggees breakpoints list*](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/struct.ControllerDebuggeeBreakpointListCall.html), [*debuggees breakpoints update*](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/struct.ControllerDebuggeeBreakpointUpdateCall.html) and [*debuggees register*](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/struct.ControllerDebuggeeRegisterCall.html) * debugger - * [*debuggees breakpoints delete*](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointDeleteCall.html), [*debuggees breakpoints get*](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointGetCall.html), [*debuggees breakpoints list*](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointListCall.html), [*debuggees breakpoints set*](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointSetCall.html) and [*debuggees list*](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/struct.DebuggerDebuggeeListCall.html) + * [*debuggees breakpoints delete*](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointDeleteCall.html), [*debuggees breakpoints get*](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointGetCall.html), [*debuggees breakpoints list*](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointListCall.html), [*debuggees breakpoints set*](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointSetCall.html) and [*debuggees list*](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/struct.DebuggerDebuggeeListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/struct.CloudDebugger.html)** +* **[Hub](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/struct.CloudDebugger.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.Part.html)** + * **[Parts](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-clouddebugger2/1.0.8+20180925/google_clouddebugger2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-clouddebugger2/1.0.8+20190313/google_clouddebugger2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/clouddebugger2/src/lib.rs b/gen/clouddebugger2/src/lib.rs index 75c98ce67c..8f794c0dab 100644 --- a/gen/clouddebugger2/src/lib.rs +++ b/gen/clouddebugger2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Debugger* crate version *1.0.8+20180925*, where *20180925* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Debugger* crate version *1.0.8+20190313*, where *20190313* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Debugger* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/debugger). @@ -448,14 +448,14 @@ impl Part for CloudWorkspaceSourceContext {} pub struct StackFrame { /// Demangled function name at the call site. pub function: Option, - /// Source location of the call site. - pub location: Option, - /// Set of local variables at the stack frame location. - /// Note that this might not be populated for all stack frames. - pub locals: Option>, /// Set of arguments passed to this function. /// Note that this might not be populated for all stack frames. pub arguments: Option>, + /// Set of local variables at the stack frame location. + /// Note that this might not be populated for all stack frames. + pub locals: Option>, + /// Source location of the call site. + pub location: Option, } impl Part for StackFrame {} @@ -682,7 +682,7 @@ impl Part for GerritSourceContext {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RegisterDebuggeeResponse { /// Debuggee resource. - /// The field `id` is guranteed to be set (in addition to the echoed fields). + /// The field `id` is guaranteed to be set (in addition to the echoed fields). /// If the field `is_disabled` is set to `true`, the agent should disable /// itself by removing all breakpoints and detaching from the application. /// It should however continue to poll `RegisterDebuggee` until reenabled. @@ -778,10 +778,10 @@ pub struct Debuggee { /// A set of custom debuggee properties, populated by the agent, to be /// displayed to the user. pub labels: Option>, - /// Uniquifier to further distiguish the application. + /// Uniquifier to further distinguish the application. /// It is possible that different applications might have identical values in /// the debuggee message, thus, incorrectly identified as a single application - /// by the Controller service. This field adds salt to further distiguish the + /// by the Controller service. This field adds salt to further distinguish the /// application. Agents should consider seeding this field with value that /// identifies the code, binary, configuration and environment. pub uniquifier: Option, @@ -861,12 +861,12 @@ impl Part for GitSourceContext {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CloudWorkspaceId { - /// The ID of the repo containing the workspace. - #[serde(rename="repoId")] - pub repo_id: Option, /// The unique name of the workspace within the repo. This is the name /// chosen by the client in the Source API's CreateWorkspace method. pub name: Option, + /// The ID of the repo containing the workspace. + #[serde(rename="repoId")] + pub repo_id: Option, } impl Part for CloudWorkspaceId {} @@ -1162,14 +1162,14 @@ impl ResponseResult for SetBreakpointResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct StatusMessage { - /// Distinguishes errors from informational messages. - #[serde(rename="isError")] - pub is_error: Option, + /// Status message text. + pub description: Option, /// Reference to which the message applies. #[serde(rename="refersTo")] pub refers_to: Option, - /// Status message text. - pub description: Option, + /// Distinguishes errors from informational messages. + #[serde(rename="isError")] + pub is_error: Option, } impl Part for StatusMessage {} @@ -1586,10 +1586,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1621,7 +1618,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1721,7 +1718,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1860,10 +1857,7 @@ impl<'a, C, A> ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1895,7 +1889,7 @@ impl<'a, C, A> ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut ControllerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2166,7 +2157,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2266,7 +2257,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2419,10 +2410,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2442,7 +2430,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointGetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointGetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2714,7 +2699,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2810,7 +2795,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2948,10 +2933,7 @@ impl<'a, C, A> DebuggerDebuggeeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2971,7 +2953,7 @@ impl<'a, C, A> DebuggerDebuggeeListCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeListCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3255,7 +3234,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3552,7 +3528,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Clouderrorreporting (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/clouderrorreporting1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-clouderrorreporting1_beta1] path = "../clouderrorreporting1_beta1" -version = "1.0.8+20181005" +version = "1.0.8+20190321" diff --git a/gen/clouderrorreporting1_beta1-cli/README.md b/gen/clouderrorreporting1_beta1-cli/README.md index f9ce8a4300..7e6cf4b0c2 100644 --- a/gen/clouderrorreporting1_beta1-cli/README.md +++ b/gen/clouderrorreporting1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Clouderrorreporting* API at revision *20181005*. The CLI is at version *1.0.8*. +This documentation was generated from the *Clouderrorreporting* API at revision *20190321*. The CLI is at version *1.0.8*. ```bash clouderrorreporting1-beta1 [options] diff --git a/gen/clouderrorreporting1_beta1-cli/mkdocs.yml b/gen/clouderrorreporting1_beta1-cli/mkdocs.yml index db7291868b..9d4dc4ec64 100644 --- a/gen/clouderrorreporting1_beta1-cli/mkdocs.yml +++ b/gen/clouderrorreporting1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Clouderrorreporting v1.0.8+20181005 +site_name: Clouderrorreporting v1.0.8+20190321 site_url: http://byron.github.io/google-apis-rs/google-clouderrorreporting1_beta1-cli site_description: A complete library to interact with Clouderrorreporting (protocol v1beta1) diff --git a/gen/clouderrorreporting1_beta1-cli/src/main.rs b/gen/clouderrorreporting1_beta1-cli/src/main.rs index 95b45242ad..d691990e30 100644 --- a/gen/clouderrorreporting1_beta1-cli/src/main.rs +++ b/gen/clouderrorreporting1_beta1-cli/src/main.rs @@ -432,8 +432,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "group-id" => Some(("groupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["group-id", "name"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -794,7 +794,7 @@ fn main() { let mut app = App::new("clouderrorreporting1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181005") + .version("1.0.8+20190321") .about("Groups and counts similar errors from cloud services and applications, reports new errors, and provides access to error groups and their associated errors. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_clouderrorreporting1_beta1_cli") diff --git a/gen/clouderrorreporting1_beta1/Cargo.toml b/gen/clouderrorreporting1_beta1/Cargo.toml index bbc5d2b9cc..3619c7e444 100644 --- a/gen/clouderrorreporting1_beta1/Cargo.toml +++ b/gen/clouderrorreporting1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-clouderrorreporting1_beta1" -version = "1.0.8+20181005" +version = "1.0.8+20190321" authors = ["Sebastian Thiel "] description = "A complete library to interact with Clouderrorreporting (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/clouderrorreporting1_beta1" homepage = "https://cloud.google.com/error-reporting/" -documentation = "https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005" +documentation = "https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321" license = "MIT" keywords = ["clouderrorreporting", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/clouderrorreporting1_beta1/README.md b/gen/clouderrorreporting1_beta1/README.md index 21afd5a040..0f0db3b0e6 100644 --- a/gen/clouderrorreporting1_beta1/README.md +++ b/gen/clouderrorreporting1_beta1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-clouderrorreporting1_beta1` library allows access to all features of the *Google Clouderrorreporting* service. -This documentation was generated from *Clouderrorreporting* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *clouderrorreporting:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Clouderrorreporting* crate version *1.0.8+20190321*, where *20190321* is the exact revision of the *clouderrorreporting:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Clouderrorreporting* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/error-reporting/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/struct.Clouderrorreporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/struct.Clouderrorreporting.html) ... * projects - * [*delete events*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/struct.ProjectDeleteEventCall.html), [*events list*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/struct.ProjectEventListCall.html), [*events report*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/struct.ProjectEventReportCall.html), [*group stats list*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/struct.ProjectGroupStatListCall.html), [*groups get*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/struct.ProjectGroupGetCall.html) and [*groups update*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/struct.ProjectGroupUpdateCall.html) + * [*delete events*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/struct.ProjectDeleteEventCall.html), [*events list*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/struct.ProjectEventListCall.html), [*events report*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/struct.ProjectEventReportCall.html), [*group stats list*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/struct.ProjectGroupStatListCall.html), [*groups get*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/struct.ProjectGroupGetCall.html) and [*groups update*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/struct.ProjectGroupUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/struct.Clouderrorreporting.html)** +* **[Hub](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/struct.Clouderrorreporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -131,17 +131,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -151,29 +151,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20181005/google_clouderrorreporting1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-clouderrorreporting1_beta1/1.0.8+20190321/google_clouderrorreporting1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/clouderrorreporting1_beta1/src/lib.rs b/gen/clouderrorreporting1_beta1/src/lib.rs index c0872f97ec..b353e86188 100644 --- a/gen/clouderrorreporting1_beta1/src/lib.rs +++ b/gen/clouderrorreporting1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Clouderrorreporting* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *clouderrorreporting:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Clouderrorreporting* crate version *1.0.8+20190321*, where *20190321* is the exact revision of the *clouderrorreporting:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Clouderrorreporting* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/error-reporting/). @@ -471,48 +471,96 @@ pub struct ErrorContext { impl Part for ErrorContext {} -/// An error event which is reported to the Error Reporting system. +/// Description of a group of similar error events. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [events report projects](struct.ProjectEventReportCall.html) (request) +/// * [groups get projects](struct.ProjectGroupGetCall.html) (response) +/// * [groups update projects](struct.ProjectGroupUpdateCall.html) (request|response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReportedErrorEvent { - /// [Required] The service context in which this error has occurred. - #[serde(rename="serviceContext")] - pub service_context: Option, - /// [Optional] Time when the event occurred. - /// If not provided, the time when the event was received by the - /// Error Reporting system will be used. - #[serde(rename="eventTime")] - pub event_time: Option, - /// [Required] The error message. - /// If no `context.reportLocation` is provided, the message must contain a - /// header (typically consisting of the exception type name and an error - /// message) and an exception stack trace in one of the supported programming - /// languages and formats. - /// Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and Go. - /// Supported stack trace formats are: - /// - /// * **Java**: Must be the return value of [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29). - /// * **Python**: Must be the return value of [`traceback.format_exc()`](https://docs.python.org/2/library/traceback.html#traceback.format_exc). - /// * **JavaScript**: Must be the value of [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API) - /// as returned by V8. - /// * **Ruby**: Must contain frames returned by [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace). - /// * **C#**: Must be the return value of [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx). - /// * **PHP**: Must start with `PHP (Notice|Parse error|Fatal error|Warning)` - /// and contain the result of [`(string)$exception`](http://php.net/manual/en/exception.tostring.php). - /// * **Go**: Must be the return value of [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack). - pub message: Option, - /// [Optional] A description of the context in which the error occurred. - pub context: Option, +pub struct ErrorGroup { + /// Associated tracking issues. + #[serde(rename="trackingIssues")] + pub tracking_issues: Option>, + /// Group IDs are unique for a given project. If the same kind of error + /// occurs in different service contexts, it will receive the same group ID. + #[serde(rename="groupId")] + pub group_id: Option, + /// The group resource name. + /// Example: projects/my-project-123/groups/my-groupid + pub name: Option, } -impl RequestValue for ReportedErrorEvent {} +impl RequestValue for ErrorGroup {} +impl ResponseResult for ErrorGroup {} + + +/// Data extracted for a specific group based on certain filter criteria, +/// such as a given time period and/or service filter. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ErrorGroupStats { + /// Approximate total number of events in the given group that match + /// the filter criteria. + pub count: Option, + /// Approximate first occurrence that was ever seen for this group + /// and which matches the given filter criteria, ignoring the + /// time_range that was specified in the request. + #[serde(rename="firstSeenTime")] + pub first_seen_time: Option, + /// Approximate number of affected users in the given group that + /// match the filter criteria. + /// Users are distinguished by data in the `ErrorContext` of the + /// individual error events, such as their login name or their remote + /// IP address in case of HTTP requests. + /// The number of affected users can be zero even if the number of + /// errors is non-zero if no data was provided from which the + /// affected user could be deduced. + /// Users are counted based on data in the request + /// context that was provided in the error report. If more users are + /// implicitly affected, such as due to a crash of the whole service, + /// this is not reflected here. + #[serde(rename="affectedUsersCount")] + pub affected_users_count: Option, + /// Service contexts with a non-zero error count for the given filter + /// criteria. This list can be truncated if multiple services are affected. + /// Refer to `num_affected_services` for the total count. + #[serde(rename="affectedServices")] + pub affected_services: Option>, + /// Approximate number of occurrences over time. + /// Timed counts returned by ListGroups are guaranteed to be: + /// + /// - Inside the requested time interval + /// - Non-overlapping, and + /// - Ordered by ascending time. + #[serde(rename="timedCounts")] + pub timed_counts: Option>, + /// Approximate last occurrence that was ever seen for this group and + /// which matches the given filter criteria, ignoring the time_range + /// that was specified in the request. + #[serde(rename="lastSeenTime")] + pub last_seen_time: Option, + /// An arbitrary event that is chosen as representative for the whole group. + /// The representative event is intended to be used as a quick preview for + /// the whole group. Events in the group are usually sufficiently similar + /// to each other such that showing an arbitrary representative provides + /// insight into the characteristics of the group as a whole. + pub representative: Option, + /// The total number of services with a non-zero error count for the given + /// filter criteria. + #[serde(rename="numAffectedServices")] + pub num_affected_services: Option, + /// Group data that is independent of the filter criteria. + pub group: Option, +} + +impl Part for ErrorGroupStats {} /// Response message for deleting error events. @@ -620,110 +668,62 @@ pub struct ListGroupStatsResponse { /// request, to view the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, + /// The error group stats which match the given request. + #[serde(rename="errorGroupStats")] + pub error_group_stats: Option>, /// The timestamp specifies the start time to which the request was restricted. /// The start time is set based on the requested time range. It may be adjusted /// to a later time if a project has exceeded the storage quota and older data /// has been deleted. #[serde(rename="timeRangeBegin")] pub time_range_begin: Option, - /// The error group stats which match the given request. - #[serde(rename="errorGroupStats")] - pub error_group_stats: Option>, } impl ResponseResult for ListGroupStatsResponse {} -/// Data extracted for a specific group based on certain filter criteria, -/// such as a given time period and/or service filter. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ErrorGroupStats { - /// Approximate total number of events in the given group that match - /// the filter criteria. - pub count: Option, - /// Approximate first occurrence that was ever seen for this group - /// and which matches the given filter criteria, ignoring the - /// time_range that was specified in the request. - #[serde(rename="firstSeenTime")] - pub first_seen_time: Option, - /// Approximate number of affected users in the given group that - /// match the filter criteria. - /// Users are distinguished by data in the `ErrorContext` of the - /// individual error events, such as their login name or their remote - /// IP address in case of HTTP requests. - /// The number of affected users can be zero even if the number of - /// errors is non-zero if no data was provided from which the - /// affected user could be deduced. - /// Users are counted based on data in the request - /// context that was provided in the error report. If more users are - /// implicitly affected, such as due to a crash of the whole service, - /// this is not reflected here. - #[serde(rename="affectedUsersCount")] - pub affected_users_count: Option, - /// Group data that is independent of the filter criteria. - pub group: Option, - /// Approximate number of occurrences over time. - /// Timed counts returned by ListGroups are guaranteed to be: - /// - /// - Inside the requested time interval - /// - Non-overlapping, and - /// - Ordered by ascending time. - #[serde(rename="timedCounts")] - pub timed_counts: Option>, - /// Approximate last occurrence that was ever seen for this group and - /// which matches the given filter criteria, ignoring the time_range - /// that was specified in the request. - #[serde(rename="lastSeenTime")] - pub last_seen_time: Option, - /// An arbitrary event that is chosen as representative for the whole group. - /// The representative event is intended to be used as a quick preview for - /// the whole group. Events in the group are usually sufficiently similar - /// to each other such that showing an arbitrary representative provides - /// insight into the characteristics of the group as a whole. - pub representative: Option, - /// The total number of services with a non-zero error count for the given - /// filter criteria. - #[serde(rename="numAffectedServices")] - pub num_affected_services: Option, - /// Service contexts with a non-zero error count for the given filter - /// criteria. This list can be truncated if multiple services are affected. - /// Refer to `num_affected_services` for the total count. - #[serde(rename="affectedServices")] - pub affected_services: Option>, -} - -impl Part for ErrorGroupStats {} - - -/// Description of a group of similar error events. +/// An error event which is reported to the Error Reporting system. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [groups get projects](struct.ProjectGroupGetCall.html) (response) -/// * [groups update projects](struct.ProjectGroupUpdateCall.html) (request|response) +/// * [events report projects](struct.ProjectEventReportCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ErrorGroup { - /// Associated tracking issues. - #[serde(rename="trackingIssues")] - pub tracking_issues: Option>, - /// The group resource name. - /// Example: projects/my-project-123/groups/my-groupid - pub name: Option, - /// Group IDs are unique for a given project. If the same kind of error - /// occurs in different service contexts, it will receive the same group ID. - #[serde(rename="groupId")] - pub group_id: Option, +pub struct ReportedErrorEvent { + /// [Required] The service context in which this error has occurred. + #[serde(rename="serviceContext")] + pub service_context: Option, + /// [Optional] Time when the event occurred. + /// If not provided, the time when the event was received by the + /// Error Reporting system will be used. + #[serde(rename="eventTime")] + pub event_time: Option, + /// [Required] The error message. + /// If no `context.reportLocation` is provided, the message must contain a + /// header (typically consisting of the exception type name and an error + /// message) and an exception stack trace in one of the supported programming + /// languages and formats. + /// Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and Go. + /// Supported stack trace formats are: + /// + /// * **Java**: Must be the return value of [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29). + /// * **Python**: Must be the return value of [`traceback.format_exc()`](https://docs.python.org/2/library/traceback.html#traceback.format_exc). + /// * **JavaScript**: Must be the value of [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API) + /// as returned by V8. + /// * **Ruby**: Must contain frames returned by [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace). + /// * **C#**: Must be the return value of [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx). + /// * **PHP**: Must start with `PHP (Notice|Parse error|Fatal error|Warning)` + /// and contain the result of [`(string)$exception`](http://php.net/manual/en/exception.tostring.php). + /// * **Go**: Must be the return value of [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack). + pub message: Option, + /// [Optional] A description of the context in which the error occurred. + pub context: Option, } -impl RequestValue for ErrorGroup {} -impl ResponseResult for ErrorGroup {} +impl RequestValue for ReportedErrorEvent {} /// Response for reporting an individual error event. @@ -1093,7 +1093,7 @@ impl<'a, C, A> ProjectGroupGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1109,10 +1109,7 @@ impl<'a, C, A> ProjectGroupGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1132,7 +1129,7 @@ impl<'a, C, A> ProjectGroupGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1217,7 +1214,7 @@ impl<'a, C, A> ProjectGroupGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1225,12 +1222,12 @@ impl<'a, C, A> ProjectGroupGetCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectGroupGetCall<'a, C, A> @@ -1408,7 +1405,7 @@ impl<'a, C, A> ProjectGroupStatListCall<'a, C, A> where C: BorrowMut ProjectGroupStatListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1447,7 +1441,7 @@ impl<'a, C, A> ProjectGroupStatListCall<'a, C, A> where C: BorrowMut ProjectGroupStatListCall<'a, C, A> where C: BorrowMut ProjectGroupStatListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectGroupStatListCall<'a, C, A> @@ -1752,7 +1746,7 @@ impl<'a, C, A> ProjectDeleteEventCall<'a, C, A> where C: BorrowMut ProjectDeleteEventCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1791,7 +1782,7 @@ impl<'a, C, A> ProjectDeleteEventCall<'a, C, A> where C: BorrowMut ProjectDeleteEventCall<'a, C, A> where C: BorrowMut ProjectDeleteEventCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDeleteEventCall<'a, C, A> @@ -2042,7 +2033,7 @@ impl<'a, C, A> ProjectEventListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2058,10 +2049,7 @@ impl<'a, C, A> ProjectEventListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2081,7 +2069,7 @@ impl<'a, C, A> ProjectEventListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2215,7 +2203,7 @@ impl<'a, C, A> ProjectEventListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2223,12 +2211,12 @@ impl<'a, C, A> ProjectEventListCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectEventListCall<'a, C, A> @@ -2357,7 +2345,7 @@ impl<'a, C, A> ProjectGroupUpdateCall<'a, C, A> where C: BorrowMut ProjectGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2408,7 +2393,7 @@ impl<'a, C, A> ProjectGroupUpdateCall<'a, C, A> where C: BorrowMut ProjectGroupUpdateCall<'a, C, A> where C: BorrowMut ProjectGroupUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectGroupUpdateCall<'a, C, A> @@ -2647,7 +2632,7 @@ impl<'a, C, A> ProjectEventReportCall<'a, C, A> where C: BorrowMut ProjectEventReportCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2698,7 +2680,7 @@ impl<'a, C, A> ProjectEventReportCall<'a, C, A> where C: BorrowMut ProjectEventReportCall<'a, C, A> where C: BorrowMut ProjectEventReportCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectEventReportCall<'a, C, A> diff --git a/gen/cloudfunctions1-cli/Cargo.toml b/gen/cloudfunctions1-cli/Cargo.toml index 7ed9c676a5..d0d7eba885 100644 --- a/gen/cloudfunctions1-cli/Cargo.toml +++ b/gen/cloudfunctions1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudfunctions1-cli" -version = "1.0.8+20181002" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Functions (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudfunctions1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudfunctions1] path = "../cloudfunctions1" -version = "1.0.8+20181002" +version = "1.0.8+20190328" diff --git a/gen/cloudfunctions1-cli/README.md b/gen/cloudfunctions1-cli/README.md index 980e892613..c878cb66a5 100644 --- a/gen/cloudfunctions1-cli/README.md +++ b/gen/cloudfunctions1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Functions* API at revision *20181002*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Functions* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash cloudfunctions1 [options] @@ -39,8 +39,11 @@ cloudfunctions1 [options] locations-functions-generate-download-url (-r )... [-p ]... [-o ] locations-functions-generate-upload-url (-r )... [-p ]... [-o ] locations-functions-get [-p ]... [-o ] + locations-functions-get-iam-policy [-p ]... [-o ] locations-functions-list [-p ]... [-o ] locations-functions-patch (-r )... [-p ]... [-o ] + locations-functions-set-iam-policy (-r )... [-p ]... [-o ] + locations-functions-test-iam-permissions (-r )... [-p ]... [-o ] locations-list [-p ]... [-o ] cloudfunctions1 --help diff --git a/gen/cloudfunctions1-cli/mkdocs.yml b/gen/cloudfunctions1-cli/mkdocs.yml index 85b84b26c5..119fd83df8 100644 --- a/gen/cloudfunctions1-cli/mkdocs.yml +++ b/gen/cloudfunctions1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Functions v1.0.8+20181002 +site_name: Cloud Functions v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-cloudfunctions1-cli site_description: A complete library to interact with Cloud Functions (protocol v1) @@ -17,8 +17,11 @@ pages: - ['projects_locations-functions-generate-download-url.md', 'Projects', 'Locations Functions Generate Download Url'] - ['projects_locations-functions-generate-upload-url.md', 'Projects', 'Locations Functions Generate Upload Url'] - ['projects_locations-functions-get.md', 'Projects', 'Locations Functions Get'] +- ['projects_locations-functions-get-iam-policy.md', 'Projects', 'Locations Functions Get Iam Policy'] - ['projects_locations-functions-list.md', 'Projects', 'Locations Functions List'] - ['projects_locations-functions-patch.md', 'Projects', 'Locations Functions Patch'] +- ['projects_locations-functions-set-iam-policy.md', 'Projects', 'Locations Functions Set Iam Policy'] +- ['projects_locations-functions-test-iam-permissions.md', 'Projects', 'Locations Functions Test Iam Permissions'] - ['projects_locations-list.md', 'Projects', 'Locations List'] theme: readthedocs diff --git a/gen/cloudfunctions1-cli/src/main.rs b/gen/cloudfunctions1-cli/src/main.rs index 7940b7b5d2..911da54d96 100644 --- a/gen/cloudfunctions1-cli/src/main.rs +++ b/gen/cloudfunctions1-cli/src/main.rs @@ -271,10 +271,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "event-trigger.event-type" => Some(("eventTrigger.eventType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "event-trigger.resource" => Some(("eventTrigger.resource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "event-trigger.service" => Some(("eventTrigger.service", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "max-instances" => Some(("maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -285,16 +285,17 @@ impl<'n> Engine<'n> { "source-archive-url" => Some(("sourceArchiveUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "environment-variables" => Some(("environmentVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "source-upload-url" => Some(("sourceUploadUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version-id" => Some(("versionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entry-point" => Some(("entryPoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "service-account-email" => Some(("serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "timeout" => Some(("timeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "runtime" => Some(("runtime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vpc-connector" => Some(("vpcConnector", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["available-memory-mb", "deployed-url", "description", "entry-point", "environment-variables", "event-trigger", "event-type", "https-trigger", "labels", "max-instances", "name", "network", "resource", "runtime", "service", "service-account-email", "source-archive-url", "source-repository", "source-upload-url", "status", "timeout", "update-time", "url", "version-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["available-memory-mb", "deployed-url", "description", "entry-point", "environment-variables", "event-trigger", "event-type", "https-trigger", "labels", "max-instances", "name", "network", "resource", "runtime", "service", "service-account-email", "source-archive-url", "source-repository", "source-upload-url", "status", "timeout", "update-time", "url", "version-id", "vpc-connector"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -627,6 +628,58 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_functions_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_functions_get_iam_policy(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_locations_functions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().locations_functions_list(opt.value_of("parent").unwrap_or("")); @@ -709,10 +762,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "event-trigger.event-type" => Some(("eventTrigger.eventType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "event-trigger.resource" => Some(("eventTrigger.resource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "event-trigger.service" => Some(("eventTrigger.service", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "max-instances" => Some(("maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -723,16 +776,17 @@ impl<'n> Engine<'n> { "source-archive-url" => Some(("sourceArchiveUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "environment-variables" => Some(("environmentVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "source-upload-url" => Some(("sourceUploadUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version-id" => Some(("versionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entry-point" => Some(("entryPoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "service-account-email" => Some(("serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "timeout" => Some(("timeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "runtime" => Some(("runtime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vpc-connector" => Some(("vpcConnector", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["available-memory-mb", "deployed-url", "description", "entry-point", "environment-variables", "event-trigger", "event-type", "https-trigger", "labels", "max-instances", "name", "network", "resource", "runtime", "service", "service-account-email", "source-archive-url", "source-repository", "source-upload-url", "status", "timeout", "update-time", "url", "version-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["available-memory-mb", "deployed-url", "description", "entry-point", "environment-variables", "event-trigger", "event-type", "https-trigger", "labels", "max-instances", "name", "network", "resource", "runtime", "service", "service-account-email", "source-archive-url", "source-repository", "source-upload-url", "status", "timeout", "update-time", "url", "version-id", "vpc-connector"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -796,6 +850,178 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_functions_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_functions_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_functions_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_functions_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_locations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().locations_list(opt.value_of("name").unwrap_or("")); @@ -897,12 +1123,21 @@ impl<'n> Engine<'n> { ("locations-functions-get", Some(opt)) => { call_result = self._projects_locations_functions_get(opt, dry_run, &mut err); }, + ("locations-functions-get-iam-policy", Some(opt)) => { + call_result = self._projects_locations_functions_get_iam_policy(opt, dry_run, &mut err); + }, ("locations-functions-list", Some(opt)) => { call_result = self._projects_locations_functions_list(opt, dry_run, &mut err); }, ("locations-functions-patch", Some(opt)) => { call_result = self._projects_locations_functions_patch(opt, dry_run, &mut err); }, + ("locations-functions-set-iam-policy", Some(opt)) => { + call_result = self._projects_locations_functions_set_iam_policy(opt, dry_run, &mut err); + }, + ("locations-functions-test-iam-permissions", Some(opt)) => { + call_result = self._projects_locations_functions_test_iam_permissions(opt, dry_run, &mut err); + }, ("locations-list", Some(opt)) => { call_result = self._projects_locations_list(opt, dry_run, &mut err); }, @@ -1049,10 +1284,12 @@ fn main() { ]), ]), - ("projects", "methods: 'locations-functions-call', 'locations-functions-create', 'locations-functions-delete', 'locations-functions-generate-download-url', 'locations-functions-generate-upload-url', 'locations-functions-get', 'locations-functions-list', 'locations-functions-patch' and 'locations-list'", vec![ + ("projects", "methods: 'locations-functions-call', 'locations-functions-create', 'locations-functions-delete', 'locations-functions-generate-download-url', 'locations-functions-generate-upload-url', 'locations-functions-get', 'locations-functions-get-iam-policy', 'locations-functions-list', 'locations-functions-patch', 'locations-functions-set-iam-policy', 'locations-functions-test-iam-permissions' and 'locations-list'", vec![ ("locations-functions-call", - Some(r##"Invokes synchronously deployed function. To be used for testing, very - limited traffic allowed."##), + Some(r##"Synchronously invokes a deployed Cloud Function. To be used for testing + purposes as very limited traffic is allowed. For more information on + the actual limits, refer to + [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits)."##), "Details at http://byron.github.io/google-apis-rs/google_cloudfunctions1_cli/projects_locations-functions-call", vec![ (Some(r##"name"##), @@ -1180,11 +1417,19 @@ fn main() { * Source file type should be a zip file. * Source file size should not exceed 100MB limit. + * No credentials should be attached - the signed URLs provide access to the + target bucket using internal service identity; if credentials were + attached, the identity from the credentials would be used, but that + identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` - * `x-goog-content-length-range: 0,104857600`"##), + * `x-goog-content-length-range: 0,104857600` + + And this header SHOULD NOT be specified: + + * `Authorization: Bearer YOUR_TOKEN`"##), "Details at http://byron.github.io/google-apis-rs/google_cloudfunctions1_cli/projects_locations-functions-generate-upload-url", vec![ (Some(r##"parent"##), @@ -1228,6 +1473,31 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-functions-get-iam-policy", + Some(r##"Gets the IAM access control policy for a function. + Returns an empty policy if the function exists and does not have a policy + set."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudfunctions1_cli/projects_locations-functions-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1282,6 +1552,68 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-functions-set-iam-policy", + Some(r##"Sets the IAM access control policy on the specified function. + Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudfunctions1_cli/projects_locations-functions-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-functions-test-iam-permissions", + Some(r##"Tests the specified permissions against the IAM access control policy + for a function. + If the function does not exist, this will return an empty set of + permissions, not a NOT_FOUND error."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudfunctions1_cli/projects_locations-functions-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1316,7 +1648,7 @@ fn main() { let mut app = App::new("cloudfunctions1") .author("Sebastian Thiel ") - .version("1.0.8+20181002") + .version("1.0.8+20190328") .about("Manages lightweight user-provided functions executed in response to events.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudfunctions1_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudfunctions1/Cargo.toml b/gen/cloudfunctions1/Cargo.toml index aaa13289c6..444c6ca1b9 100644 --- a/gen/cloudfunctions1/Cargo.toml +++ b/gen/cloudfunctions1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudfunctions1" -version = "1.0.8+20181002" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Functions (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudfunctions1" homepage = "https://cloud.google.com/functions" -documentation = "https://docs.rs/google-cloudfunctions1/1.0.8+20181002" +documentation = "https://docs.rs/google-cloudfunctions1/1.0.8+20190328" license = "MIT" keywords = ["cloudfunctions", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudfunctions1/README.md b/gen/cloudfunctions1/README.md index dd120182d0..7b27719ec7 100644 --- a/gen/cloudfunctions1/README.md +++ b/gen/cloudfunctions1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-cloudfunctions1` library allows access to all features of the *Google Cloud Functions* service. -This documentation was generated from *Cloud Functions* crate version *1.0.8+20181002*, where *20181002* is the exact revision of the *cloudfunctions:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Functions* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *cloudfunctions:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Functions* *v1* API can be found at the [official documentation site](https://cloud.google.com/functions). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.CloudFunctions.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.CloudFunctions.html) ... -* [operations](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.Operation.html) - * [*get*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.OperationListCall.html) +* [operations](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.Operation.html) + * [*get*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.OperationListCall.html) * projects - * [*locations functions call*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.ProjectLocationFunctionCallCall.html), [*locations functions create*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.ProjectLocationFunctionCreateCall.html), [*locations functions delete*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.ProjectLocationFunctionDeleteCall.html), [*locations functions generate download url*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.ProjectLocationFunctionGenerateDownloadUrlCall.html), [*locations functions generate upload url*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.ProjectLocationFunctionGenerateUploadUrlCall.html), [*locations functions get*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.ProjectLocationFunctionGetCall.html), [*locations functions list*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.ProjectLocationFunctionListCall.html), [*locations functions patch*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.ProjectLocationFunctionPatchCall.html) and [*locations list*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.ProjectLocationListCall.html) + * [*locations functions call*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionCallCall.html), [*locations functions create*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionCreateCall.html), [*locations functions delete*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionDeleteCall.html), [*locations functions generate download url*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionGenerateDownloadUrlCall.html), [*locations functions generate upload url*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionGenerateUploadUrlCall.html), [*locations functions get*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionGetCall.html), [*locations functions get iam policy*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionGetIamPolicyCall.html), [*locations functions list*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionListCall.html), [*locations functions patch*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionPatchCall.html), [*locations functions set iam policy*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionSetIamPolicyCall.html), [*locations functions test iam permissions*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationFunctionTestIamPermissionCall.html) and [*locations list*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.ProjectLocationListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/struct.CloudFunctions.html)** +* **[Hub](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/struct.CloudFunctions.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -134,17 +134,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -154,29 +154,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudfunctions1/1.0.8+20181002/google_cloudfunctions1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudfunctions1/1.0.8+20190328/google_cloudfunctions1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudfunctions1/src/lib.rs b/gen/cloudfunctions1/src/lib.rs index 56e068ba0f..8392f94e65 100644 --- a/gen/cloudfunctions1/src/lib.rs +++ b/gen/cloudfunctions1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Functions* crate version *1.0.8+20181002*, where *20181002* is the exact revision of the *cloudfunctions:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Functions* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *cloudfunctions:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Functions* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/functions). @@ -14,7 +14,7 @@ //! * [operations](struct.Operation.html) //! * [*get*](struct.OperationGetCall.html) and [*list*](struct.OperationListCall.html) //! * projects -//! * [*locations functions call*](struct.ProjectLocationFunctionCallCall.html), [*locations functions create*](struct.ProjectLocationFunctionCreateCall.html), [*locations functions delete*](struct.ProjectLocationFunctionDeleteCall.html), [*locations functions generate download url*](struct.ProjectLocationFunctionGenerateDownloadUrlCall.html), [*locations functions generate upload url*](struct.ProjectLocationFunctionGenerateUploadUrlCall.html), [*locations functions get*](struct.ProjectLocationFunctionGetCall.html), [*locations functions list*](struct.ProjectLocationFunctionListCall.html), [*locations functions patch*](struct.ProjectLocationFunctionPatchCall.html) and [*locations list*](struct.ProjectLocationListCall.html) +//! * [*locations functions call*](struct.ProjectLocationFunctionCallCall.html), [*locations functions create*](struct.ProjectLocationFunctionCreateCall.html), [*locations functions delete*](struct.ProjectLocationFunctionDeleteCall.html), [*locations functions generate download url*](struct.ProjectLocationFunctionGenerateDownloadUrlCall.html), [*locations functions generate upload url*](struct.ProjectLocationFunctionGenerateUploadUrlCall.html), [*locations functions get*](struct.ProjectLocationFunctionGetCall.html), [*locations functions get iam policy*](struct.ProjectLocationFunctionGetIamPolicyCall.html), [*locations functions list*](struct.ProjectLocationFunctionListCall.html), [*locations functions patch*](struct.ProjectLocationFunctionPatchCall.html), [*locations functions set iam policy*](struct.ProjectLocationFunctionSetIamPolicyCall.html), [*locations functions test iam permissions*](struct.ProjectLocationFunctionTestIamPermissionCall.html) and [*locations list*](struct.ProjectLocationListCall.html) //! //! //! @@ -464,6 +464,123 @@ pub struct Retry { _never_set: Option } impl Part for Retry {} +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations functions test iam permissions projects](struct.ProjectLocationFunctionTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, +} + +impl RequestValue for TestIamPermissionsRequest {} + + +/// Request message for `SetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations functions set iam policy projects](struct.ProjectLocationFunctionSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetIamPolicyRequest { + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. + pub policy: Option, + /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + /// the fields in the mask will be modified. If no mask is provided, the + /// following default mask is used: + /// paths: "bindings, etag" + /// This field is only used by Cloud IAM. + #[serde(rename="updateMask")] + pub update_mask: Option, +} + +impl RequestValue for SetIamPolicyRequest {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// Provides the configuration for logging a type of permissions. +/// Example: +/// +/// { +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// } +/// ] +/// } +/// +/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting +/// foo@gmail.com from DATA_READ logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditLogConfig { + /// Specifies the identities that do not cause logging for this type of + /// permission. + /// Follows the same format of Binding.members. + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The log type that this config enables. + #[serde(rename="logType")] + pub log_type: Option, +} + +impl Part for AuditLogConfig {} + + /// Response of `GenerateSourceUploadUrl` method. /// /// # Activities @@ -512,17 +629,17 @@ impl ResponseResult for ListLocationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { - /// The canonical id for this location. For example: `"us-east1"`. - #[serde(rename="locationId")] - pub location_id: Option, - /// Cross-service attributes for the location. For example - /// - /// {"cloud.googleapis.com/region": "us-east1"} - pub labels: Option>, /// The friendly name for this location, typically a nearby city name. /// For example, "Tokyo". #[serde(rename="displayName")] pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, /// Resource name for the location, which may vary between implementations. /// For example: `"projects/example-project/locations/us-east1"` pub name: Option, @@ -534,6 +651,86 @@ pub struct Location { impl Part for Location {} +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **JSON Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// **YAML Example** +/// +/// bindings: +/// - members: +/// - user:mike@example.com +/// - group:admins@example.com +/// - domain:google.com +/// - serviceAccount:my-other-app@appspot.gserviceaccount.com +/// role: roles/owner +/// - members: +/// - user:sean@example.com +/// role: roles/viewer +/// +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam/docs). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations functions set iam policy projects](struct.ProjectLocationFunctionSetIamPolicyCall.html) (response) +/// * [locations functions get iam policy projects](struct.ProjectLocationFunctionGetIamPolicyCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, + /// Deprecated. + pub version: Option, +} + +impl ResponseResult for Policy {} + + /// Response of `CallFunction` method. /// /// # Activities @@ -605,17 +802,17 @@ impl Resource for Operation {} impl ResponseResult for Operation {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -676,6 +873,25 @@ pub struct Status { impl Part for Status {} +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations functions test iam permissions projects](struct.ProjectLocationFunctionTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestIamPermissionsResponse {} + + /// The response message for Operations.ListOperations. /// /// # Activities @@ -741,6 +957,50 @@ pub struct HttpsTrigger { impl Part for HttpsTrigger {} +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + /// Request of `GenerateDownloadUrl` method. /// /// # Activities @@ -834,8 +1094,77 @@ pub struct GenerateUploadUrlRequest { _never_set: Option } impl RequestValue for GenerateUploadUrlRequest {} +/// Specifies the audit configuration for a service. +/// The configuration determines which permission types are logged, and what +/// identities, if any, are exempted from logging. +/// An AuditConfig must have one or more AuditLogConfigs. +/// +/// If there are AuditConfigs for both `allServices` and a specific service, +/// the union of the two AuditConfigs is used for that service: the log_types +/// specified in each AuditConfig are enabled, and the exempted_members in each +/// AuditLogConfig are exempted. +/// +/// Example Policy with multiple AuditConfigs: +/// +/// { +/// "audit_configs": [ +/// { +/// "service": "allServices" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// }, +/// { +/// "log_type": "ADMIN_READ", +/// } +/// ] +/// }, +/// { +/// "service": "fooservice.googleapis.com" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// "exempted_members": [ +/// "user:bar@gmail.com" +/// ] +/// } +/// ] +/// } +/// ] +/// } +/// +/// For fooservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ +/// logging. It also exempts foo@gmail.com from DATA_READ logging, and +/// bar@gmail.com from DATA_WRITE logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditConfig { + /// The configuration for logging of each type of permission. + #[serde(rename="auditLogConfigs")] + pub audit_log_configs: Option>, + /// Specifies a service that will be enabled for audit logging. + /// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + /// `allServices` is a special value that covers all services. + pub service: Option, +} + +impl Part for AuditConfig {} + + /// Describes a Cloud Function that contains user computation executed in /// response to an event. It encapsulate function and triggers configurations. +/// LINT.IfChange /// /// # Activities /// @@ -848,11 +1177,11 @@ impl RequestValue for GenerateUploadUrlRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CloudFunction { - /// Output only. Status of the function deployment. - pub status: Option, /// A source that fires events in response to a condition in another service. #[serde(rename="eventTrigger")] pub event_trigger: Option, + /// Output only. Status of the function deployment. + pub status: Option, /// Output only. The last update timestamp of a Cloud Function. #[serde(rename="updateTime")] pub update_time: Option, @@ -890,6 +1219,9 @@ pub struct CloudFunction { /// in `source_location`. #[serde(rename="entryPoint")] pub entry_point: Option, + /// A user-defined name of the function. Function names must be unique + /// globally and match pattern `projects/*/locations/*/functions/*` + pub name: Option, /// The VPC Network that this cloud function can connect to. It can be /// either the fully-qualified URI, or the short name of the network resource. /// If the short network name is used, the network must belong to the same @@ -899,20 +1231,32 @@ pub struct CloudFunction { /// {project} is a project id where the network is defined, and {network} is /// the short name of the network. /// + /// This field is mutually exclusive with `vpc_connector` and will be replaced + /// by it. + /// /// See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for /// more information on connecting Cloud projects. /// /// This feature is currently in alpha, available only for whitelisted users. pub network: Option, - /// A user-defined name of the function. Function names must be unique - /// globally and match pattern `projects/*/locations/*/functions/*` - pub name: Option, /// The amount of memory in MB available for a function. /// Defaults to 256MB. #[serde(rename="availableMemoryMb")] pub available_memory_mb: Option, - /// **Beta Feature** + /// The VPC Network Connector that this cloud function can connect to. It can + /// be either the fully-qualified URI, or the short name of the network + /// connector resource. The format of this field is + /// `projects/*/locations/*/connectors/*` /// + /// This field is mutually exclusive with `network` field and will eventually + /// replace it. + /// + /// See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for + /// more information on connecting Cloud projects. + /// + /// This feature is currently in alpha, available only for whitelisted users. + #[serde(rename="vpcConnector")] + pub vpc_connector: Option, /// Environment variables that shall be available during function execution. #[serde(rename="environmentVariables")] pub environment_variables: Option>, @@ -920,15 +1264,23 @@ pub struct CloudFunction { /// by google.cloud.functions.v1.GenerateUploadUrl #[serde(rename="sourceUploadUrl")] pub source_upload_url: Option, - /// Output only. The email of the function's service account. + /// The email of the function's service account. If empty, defaults to + /// {project_id}@appspot.gserviceaccount.com. #[serde(rename="serviceAccountEmail")] pub service_account_email: Option, /// The function execution timeout. Execution is considered failed and /// can be terminated if the function is not completed at the end of the /// timeout period. Defaults to 60 seconds. pub timeout: Option, - /// The runtime in which the function is going to run. If empty, defaults to - /// Node.js 6. + /// The runtime in which the function is going to run. Example values include: + /// `go111`: for Go 1.11 + /// `nodejs6`: for Node.js 6 + /// `nodejs8`: for Node.js 8 + /// `nodejs10`: for Node.js 10 + /// `python37`: for Python 3.7 + /// `ruby25`: for Ruby 2.5 + /// + /// If empty, defaults to `nodejs6`. pub runtime: Option, } @@ -1051,7 +1403,7 @@ impl<'a, C, A> OperationMethods<'a, C, A> { /// ::default(), None); /// let mut hub = CloudFunctions::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `locations_functions_call(...)`, `locations_functions_create(...)`, `locations_functions_delete(...)`, `locations_functions_generate_download_url(...)`, `locations_functions_generate_upload_url(...)`, `locations_functions_get(...)`, `locations_functions_list(...)`, `locations_functions_patch(...)` and `locations_list(...)` +/// // like `locations_functions_call(...)`, `locations_functions_create(...)`, `locations_functions_delete(...)`, `locations_functions_generate_download_url(...)`, `locations_functions_generate_upload_url(...)`, `locations_functions_get(...)`, `locations_functions_get_iam_policy(...)`, `locations_functions_list(...)`, `locations_functions_patch(...)`, `locations_functions_set_iam_policy(...)`, `locations_functions_test_iam_permissions(...)` and `locations_list(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -1066,6 +1418,27 @@ impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} impl<'a, C, A> ProjectMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Sets the IAM access control policy on the specified function. + /// Replaces any existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_functions_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectLocationFunctionSetIamPolicyCall<'a, C, A> { + ProjectLocationFunctionSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Lists information about the supported locations for this service. @@ -1105,6 +1478,26 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets the IAM access control policy for a function. + /// Returns an empty policy if the function exists and does not have a policy + /// set. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_functions_get_iam_policy(&self, resource: &str) -> ProjectLocationFunctionGetIamPolicyCall<'a, C, A> { + ProjectLocationFunctionGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Returns a function with the given name from the requested project. @@ -1122,6 +1515,29 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Tests the specified permissions against the IAM access control policy + /// for a function. + /// If the function does not exist, this will return an empty set of + /// permissions, not a NOT_FOUND error. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_functions_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectLocationFunctionTestIamPermissionCall<'a, C, A> { + ProjectLocationFunctionTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates a new function. If a function with the given name already exists in @@ -1179,12 +1595,20 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// * Source file type should be a zip file. /// * Source file size should not exceed 100MB limit. + /// * No credentials should be attached - the signed URLs provide access to the + /// target bucket using internal service identity; if credentials were + /// attached, the identity from the credentials would be used, but that + /// identity does not have permissions to upload files to the URL. /// /// When making a HTTP PUT request, these two headers need to be specified: /// /// * `content-type: application/zip` /// * `x-goog-content-length-range: 0,104857600` /// + /// And this header SHOULD NOT be specified: + /// + /// * `Authorization: Bearer YOUR_TOKEN` + /// /// # Arguments /// /// * `request` - No description provided. @@ -1203,8 +1627,10 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Invokes synchronously deployed function. To be used for testing, very - /// limited traffic allowed. + /// Synchronously invokes a deployed Cloud Function. To be used for testing + /// purposes as very limited traffic is allowed. For more information on + /// the actual limits, refer to + /// [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). /// /// # Arguments /// @@ -1364,7 +1790,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1380,10 +1806,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1403,7 +1826,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1481,7 +1904,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1633,10 +2056,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1656,7 +2076,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1723,14 +2143,14 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: self._page_size = Some(new_value); self } - /// The name of the operation's parent resource. + /// Must not be set. /// /// Sets the *name* query property to the given value. pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C, A> { self._name = Some(new_value.to_string()); self } - /// The standard list filter. + /// Required. A filter for matching the requested operations.

The supported formats of filter are:
To query for specific function: project:*,location:*,function:*
To query for all of the latest operations for a project: project:*,latest:true /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C, A> { @@ -1752,7 +2172,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1800,6 +2220,287 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } +/// Sets the IAM access control policy on the specified function. +/// Replaces any existing policy. +/// +/// A builder for the *locations.functions.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudfunctions1 as cloudfunctions1; +/// use cloudfunctions1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudfunctions1::CloudFunctions; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFunctions::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_functions_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationFunctionSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFunctions, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationFunctionSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationFunctionSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudfunctions.projects.locations.functions.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectLocationFunctionSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationFunctionSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationFunctionSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationFunctionSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationFunctionSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Lists information about the supported locations for this service. /// /// A builder for the *locations.list* method supported by a *project* resource. @@ -1828,9 +2529,9 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_list("name") -/// .page_token("aliquyam") -/// .page_size(-66) -/// .filter("no") +/// .page_token("ea") +/// .page_size(-61) +/// .filter("justo") /// .doit(); /// # } /// ``` @@ -1901,7 +2602,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1940,7 +2638,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2214,7 +2909,7 @@ impl<'a, C, A> ProjectLocationFunctionDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionDeleteCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = CloudFunctions::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_functions_get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationFunctionGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFunctions, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationFunctionGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationFunctionGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudfunctions.projects.locations.functions.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationFunctionGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationFunctionGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationFunctionGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationFunctionGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Returns a function with the given name from the requested project. /// /// A builder for the *locations.functions.get* method supported by a *project* resource. @@ -2426,7 +3372,7 @@ impl<'a, C, A> ProjectLocationFunctionGetCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2465,7 +3408,7 @@ impl<'a, C, A> ProjectLocationFunctionGetCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionGetCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionGetCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = CloudFunctions::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_functions_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationFunctionTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFunctions, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationFunctionTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationFunctionTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudfunctions.projects.locations.functions.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectLocationFunctionTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationFunctionTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationFunctionTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationFunctionTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationFunctionTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates a new function. If a function with the given name already exists in /// the specified project, the long running operation will return /// `ALREADY_EXISTS` error. @@ -2686,7 +3912,7 @@ impl<'a, C, A> ProjectLocationFunctionCreateCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2737,7 +3960,7 @@ impl<'a, C, A> ProjectLocationFunctionCreateCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionCreateCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionCreateCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionPatchCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3025,7 +4245,7 @@ impl<'a, C, A> ProjectLocationFunctionPatchCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionPatchCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionPatchCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionGenerateUploadUrlCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3296,10 +4524,7 @@ impl<'a, C, A> ProjectLocationFunctionGenerateUploadUrlCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3331,7 +4556,7 @@ impl<'a, C, A> ProjectLocationFunctionGenerateUploadUrlCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3422,7 +4647,7 @@ impl<'a, C, A> ProjectLocationFunctionGenerateUploadUrlCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3470,8 +4695,10 @@ impl<'a, C, A> ProjectLocationFunctionGenerateUploadUrlCall<'a, C, A> where C: B } -/// Invokes synchronously deployed function. To be used for testing, very -/// limited traffic allowed. +/// Synchronously invokes a deployed Cloud Function. To be used for testing +/// purposes as very limited traffic is allowed. For more information on +/// the actual limits, refer to +/// [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). /// /// A builder for the *locations.functions.call* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3564,7 +4791,7 @@ impl<'a, C, A> ProjectLocationFunctionCallCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionCallCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3615,7 +4839,7 @@ impl<'a, C, A> ProjectLocationFunctionCallCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionCallCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionGenerateDownloadUrlCall<'a, C, A> where C: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3866,10 +5090,7 @@ impl<'a, C, A> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3901,7 +5122,7 @@ impl<'a, C, A> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C, A> where C: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3992,7 +5213,7 @@ impl<'a, C, A> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4068,8 +5289,8 @@ impl<'a, C, A> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C, A> where C: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_functions_list("parent") -/// .page_token("aliquyam") -/// .page_size(-9) +/// .page_token("eos") +/// .page_size(-81) /// .doit(); /// # } /// ``` @@ -4136,7 +5357,7 @@ impl<'a, C, A> ProjectLocationFunctionListCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4175,7 +5393,7 @@ impl<'a, C, A> ProjectLocationFunctionListCall<'a, C, A> where C: BorrowMut ProjectLocationFunctionListCall<'a, C, A> where C: BorrowMut"] +description = "A complete library to interact with Cloud Identity (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudidentity1-cli" +homepage = "https://cloud.google.com/identity/" +documentation = "http://byron.github.io/google-apis-rs/google_cloudidentity1_cli" +license = "MIT" +keywords = ["cloudidentity", "google", "cli"] +autobins = false + +[[bin]] +name = "cloudidentity1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-cloudidentity1] +path = "../cloudidentity1" +version = "1.0.8+20190330" diff --git a/gen/cloudidentity1-cli/LICENSE.md b/gen/cloudidentity1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudidentity1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudidentity1-cli/README.md b/gen/cloudidentity1-cli/README.md new file mode 100644 index 0000000000..7b0a3f6fb6 --- /dev/null +++ b/gen/cloudidentity1-cli/README.md @@ -0,0 +1,125 @@ + +The `cloudidentity1` command-line interface *(CLI)* allows to use most features of the *Google Cloud Identity* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud Identity* API can be found at the +[official documentation site](https://cloud.google.com/identity/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-cloudidentity1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudidentity1-cli). + +# Usage + +This documentation was generated from the *Cloud Identity* API at revision *20190330*. The CLI is at version *1.0.8*. + +```bash +cloudidentity1 [options] + groups + create (-r )... [-p ]... [-o ] + delete [-p ]... [-o ] + get [-p ]... [-o ] + list [-p ]... [-o ] + lookup [-p ]... [-o ] + memberships-create (-r )... [-p ]... [-o ] + memberships-delete [-p ]... [-o ] + memberships-get [-p ]... [-o ] + memberships-list [-p ]... [-o ] + memberships-lookup [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + search [-p ]... [-o ] + cloudidentity1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `cloudidentity1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/cloudidentity1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/cloudidentity1-secret.json`, assuming that the required *cloudidentity* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `cloudidentity1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/cloudidentity1-cli/mkdocs.yml b/gen/cloudidentity1-cli/mkdocs.yml new file mode 100644 index 0000000000..4dc07fc52f --- /dev/null +++ b/gen/cloudidentity1-cli/mkdocs.yml @@ -0,0 +1,28 @@ +site_name: Cloud Identity v1.0.8+20190330 +site_url: http://byron.github.io/google-apis-rs/google-cloudidentity1-cli +site_description: A complete library to interact with Cloud Identity (protocol v1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/cloudidentity1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['groups_create.md', 'Groups', 'Create'] +- ['groups_delete.md', 'Groups', 'Delete'] +- ['groups_get.md', 'Groups', 'Get'] +- ['groups_list.md', 'Groups', 'List'] +- ['groups_lookup.md', 'Groups', 'Lookup'] +- ['groups_memberships-create.md', 'Groups', 'Memberships Create'] +- ['groups_memberships-delete.md', 'Groups', 'Memberships Delete'] +- ['groups_memberships-get.md', 'Groups', 'Memberships Get'] +- ['groups_memberships-list.md', 'Groups', 'Memberships List'] +- ['groups_memberships-lookup.md', 'Groups', 'Memberships Lookup'] +- ['groups_patch.md', 'Groups', 'Patch'] +- ['groups_search.md', 'Groups', 'Search'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/cloudidentity1-cli/src/cmn.rs b/gen/cloudidentity1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/cloudidentity1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/cloudidentity1-cli/src/main.rs b/gen/cloudidentity1-cli/src/main.rs new file mode 100644 index 0000000000..dcc3bd8a32 --- /dev/null +++ b/gen/cloudidentity1-cli/src/main.rs @@ -0,0 +1,1370 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_cloudidentity1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudIdentity>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _groups_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "group-key.namespace" => Some(("groupKey.namespace", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-key.id" => Some(("groupKey.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "display-name", "group-key", "id", "labels", "name", "namespace", "parent", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Group = json::value::from_value(object).unwrap(); + let mut call = self.hub.groups().create(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.groups().delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.groups().get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.groups().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "view" => { + call = call.view(value.unwrap_or("")); + }, + "parent" => { + call = call.parent(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size", "parent", "view"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_lookup(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.groups().lookup(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "group-key-namespace" => { + call = call.group_key_namespace(value.unwrap_or("")); + }, + "group-key-id" => { + call = call.group_key_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["group-key-id", "group-key-namespace"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_memberships_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "preferred-member-key.namespace" => Some(("preferredMemberKey.namespace", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "preferred-member-key.id" => Some(("preferredMemberKey.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "name", "namespace", "preferred-member-key", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Membership = json::value::from_value(object).unwrap(); + let mut call = self.hub.groups().memberships_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_memberships_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.groups().memberships_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_memberships_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.groups().memberships_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_memberships_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.groups().memberships_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "view" => { + call = call.view(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size", "view"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_memberships_lookup(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.groups().memberships_lookup(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "member-key-namespace" => { + call = call.member_key_namespace(value.unwrap_or("")); + }, + "member-key-id" => { + call = call.member_key_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["member-key-namespace", "member-key-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "group-key.namespace" => Some(("groupKey.namespace", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-key.id" => Some(("groupKey.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "display-name", "group-key", "id", "labels", "name", "namespace", "parent", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Group = json::value::from_value(object).unwrap(); + let mut call = self.hub.groups().patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _groups_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.groups().search(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "view" => { + call = call.view(value.unwrap_or("")); + }, + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["query", "page-size", "page-token", "view"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("groups", Some(opt)) => { + match opt.subcommand() { + ("create", Some(opt)) => { + call_result = self._groups_create(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._groups_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._groups_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._groups_list(opt, dry_run, &mut err); + }, + ("lookup", Some(opt)) => { + call_result = self._groups_lookup(opt, dry_run, &mut err); + }, + ("memberships-create", Some(opt)) => { + call_result = self._groups_memberships_create(opt, dry_run, &mut err); + }, + ("memberships-delete", Some(opt)) => { + call_result = self._groups_memberships_delete(opt, dry_run, &mut err); + }, + ("memberships-get", Some(opt)) => { + call_result = self._groups_memberships_get(opt, dry_run, &mut err); + }, + ("memberships-list", Some(opt)) => { + call_result = self._groups_memberships_list(opt, dry_run, &mut err); + }, + ("memberships-lookup", Some(opt)) => { + call_result = self._groups_memberships_lookup(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._groups_patch(opt, dry_run, &mut err); + }, + ("search", Some(opt)) => { + call_result = self._groups_search(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "cloudidentity1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "cloudidentity1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::CloudIdentity::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("groups", "methods: 'create', 'delete', 'get', 'list', 'lookup', 'memberships-create', 'memberships-delete', 'memberships-get', 'memberships-list', 'memberships-lookup', 'patch' and 'search'", vec![ + ("create", + Some(r##"Creates a Group."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_create", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes a Group."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"[Resource name](https://cloud.google.com/apis/design/resource_names) of the + Group in the format: `groups/{group_id}`, where `group_id` is the unique ID + assigned to the Group."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Retrieves a Group."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_get", + vec![ + (Some(r##"name"##), + None, + Some(r##"[Resource name](https://cloud.google.com/apis/design/resource_names) of the + Group in the format: `groups/{group_id}`, where `group_id` is the unique ID + assigned to the Group."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"List groups within a customer or a domain."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("lookup", + Some(r##"Looks up [resource + name](https://cloud.google.com/apis/design/resource_names) of a Group by + its EntityKey."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_lookup", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("memberships-create", + Some(r##"Creates a Membership."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_memberships-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"[Resource name](https://cloud.google.com/apis/design/resource_names) of the + Group to create Membership within. Format: `groups/{group_id}`, where + `group_id` is the unique ID assigned to the Group."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("memberships-delete", + Some(r##"Deletes a Membership."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_memberships-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"[Resource name](https://cloud.google.com/apis/design/resource_names) of the + Membership to be deleted. + + Format: `groups/{group_id}/memberships/{member_id}`, where `group_id` is + the unique ID assigned to the Group to which Membership belongs to, and + member_id is the unique ID assigned to the member."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("memberships-get", + Some(r##"Retrieves a Membership."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_memberships-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"[Resource name](https://cloud.google.com/apis/design/resource_names) of the + Membership to be retrieved. + + Format: `groups/{group_id}/memberships/{member_id}`, where `group_id` is + the unique id assigned to the Group to which Membership belongs to, and + `member_id` is the unique ID assigned to the member."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("memberships-list", + Some(r##"List Memberships within a Group."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_memberships-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"[Resource name](https://cloud.google.com/apis/design/resource_names) of the + Group to list Memberships within. + + Format: `groups/{group_id}`, where `group_id` is the unique ID assigned to + the Group."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("memberships-lookup", + Some(r##"Looks up [resource + name](https://cloud.google.com/apis/design/resource_names) of a Membership + within a Group by member's EntityKey."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_memberships-lookup", + vec![ + (Some(r##"parent"##), + None, + Some(r##"[Resource name](https://cloud.google.com/apis/design/resource_names) of the + Group to lookup Membership within. + + Format: `groups/{group_id}`, where `group_id` is the unique ID assigned to + the Group."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates a Group."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"[Resource name](https://cloud.google.com/apis/design/resource_names) of the + Group in the format: `groups/{group_id}`, where group_id is the unique ID + assigned to the Group. + + Must be left blank while creating a Group."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("search", + Some(r##"Searches for Groups."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli/groups_search", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("cloudidentity1") + .author("Sebastian Thiel ") + .version("1.0.8+20190330") + .about("API for provisioning and managing identity resources.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudidentity1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/cloudidentity1/Cargo.toml b/gen/cloudidentity1/Cargo.toml new file mode 100644 index 0000000000..bacbb64492 --- /dev/null +++ b/gen/cloudidentity1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-cloudidentity1" +version = "1.0.8+20190330" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Identity (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudidentity1" +homepage = "https://cloud.google.com/identity/" +documentation = "https://docs.rs/google-cloudidentity1/1.0.8+20190330" +license = "MIT" +keywords = ["cloudidentity", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/cloudidentity1/LICENSE.md b/gen/cloudidentity1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudidentity1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudidentity1/README.md b/gen/cloudidentity1/README.md new file mode 100644 index 0000000000..5a3f59e649 --- /dev/null +++ b/gen/cloudidentity1/README.md @@ -0,0 +1,196 @@ + +The `google-cloudidentity1` library allows access to all features of the *Google Cloud Identity* service. + +This documentation was generated from *Cloud Identity* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *cloudidentity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Cloud Identity* *v1* API can be found at the +[official documentation site](https://cloud.google.com/identity/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.CloudIdentity.html) ... + +* [groups](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.Group.html) + * [*create*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupCreateCall.html), [*delete*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupDeleteCall.html), [*get*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupGetCall.html), [*list*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupListCall.html), [*lookup*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupLookupCall.html), [*memberships create*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupMembershipCreateCall.html), [*memberships delete*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupMembershipDeleteCall.html), [*memberships get*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupMembershipGetCall.html), [*memberships list*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupMembershipListCall.html), [*memberships lookup*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupMembershipLookupCall.html), [*patch*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupPatchCall.html) and [*search*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.GroupSearchCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/struct.CloudIdentity.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.groups().memberships_create(...).doit() +let r = hub.groups().memberships_list(...).doit() +let r = hub.groups().list(...).doit() +let r = hub.groups().get(...).doit() +let r = hub.groups().memberships_delete(...).doit() +let r = hub.groups().search(...).doit() +let r = hub.groups().memberships_get(...).doit() +let r = hub.groups().create(...).doit() +let r = hub.groups().lookup(...).doit() +let r = hub.groups().delete(...).doit() +let r = hub.groups().patch(...).doit() +let r = hub.groups().memberships_lookup(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-cloudidentity1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_cloudidentity1 as cloudidentity1; +use cloudidentity1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use cloudidentity1::CloudIdentity; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.groups().memberships_list("parent") + .view("sit") + .page_token("Stet") + .page_size(-42) + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-cloudidentity1/1.0.8+20190330/google_cloudidentity1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **cloudidentity1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/cloudidentity1/src/cmn.rs b/gen/cloudidentity1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/cloudidentity1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/cloudidentity1/src/lib.rs b/gen/cloudidentity1/src/lib.rs new file mode 100644 index 0000000000..fe050b2203 --- /dev/null +++ b/gen/cloudidentity1/src/lib.rs @@ -0,0 +1,4204 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud Identity* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *cloudidentity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Cloud Identity* *v1* API can be found at the +//! [official documentation site](https://cloud.google.com/identity/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudidentity1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.CloudIdentity.html) ... +//! +//! * [groups](struct.Group.html) +//! * [*create*](struct.GroupCreateCall.html), [*delete*](struct.GroupDeleteCall.html), [*get*](struct.GroupGetCall.html), [*list*](struct.GroupListCall.html), [*lookup*](struct.GroupLookupCall.html), [*memberships create*](struct.GroupMembershipCreateCall.html), [*memberships delete*](struct.GroupMembershipDeleteCall.html), [*memberships get*](struct.GroupMembershipGetCall.html), [*memberships list*](struct.GroupMembershipListCall.html), [*memberships lookup*](struct.GroupMembershipLookupCall.html), [*patch*](struct.GroupPatchCall.html) and [*search*](struct.GroupSearchCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudIdentity.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.groups().memberships_create(...).doit() +//! let r = hub.groups().memberships_list(...).doit() +//! let r = hub.groups().list(...).doit() +//! let r = hub.groups().get(...).doit() +//! let r = hub.groups().memberships_delete(...).doit() +//! let r = hub.groups().search(...).doit() +//! let r = hub.groups().memberships_get(...).doit() +//! let r = hub.groups().create(...).doit() +//! let r = hub.groups().lookup(...).doit() +//! let r = hub.groups().delete(...).doit() +//! let r = hub.groups().patch(...).doit() +//! let r = hub.groups().memberships_lookup(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-cloudidentity1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_cloudidentity1 as cloudidentity1; +//! use cloudidentity1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use cloudidentity1::CloudIdentity; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.groups().memberships_list("parent") +//! .view("dolores") +//! .page_token("kasd") +//! .page_size(-22) +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// See any Cloud Identity Groups that you can access, including group members and their emails + CloudIdentityGroupReadonly, + + /// See, change, create, and delete any of the Cloud Identity Groups that you can access, including the members of each group + CloudIdentityGroup, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudIdentityGroupReadonly => "https://www.googleapis.com/auth/cloud-identity.groups.readonly", + Scope::CloudIdentityGroup => "https://www.googleapis.com/auth/cloud-identity.groups", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudIdentityGroupReadonly + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudIdentity related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudidentity1 as cloudidentity1; +/// use cloudidentity1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudidentity1::CloudIdentity; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().memberships_list("parent") +/// .view("justo") +/// .page_token("amet.") +/// .page_size(-81) +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudIdentity { + client: RefCell, + auth: RefCell
, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for CloudIdentity {} + +impl<'a, C, A> CloudIdentity + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudIdentity { + CloudIdentity { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://cloudidentity.googleapis.com/".to_string(), + _root_url: "https://cloudidentity.googleapis.com/".to_string(), + } + } + + pub fn groups(&'a self) -> GroupMethods<'a, C, A> { + GroupMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://cloudidentity.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://cloudidentity.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [memberships list groups](struct.GroupMembershipListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListMembershipsResponse { + /// List of Memberships. + pub memberships: Option>, + /// Token to retrieve the next page of results, or empty if there are no + /// more results available for listing. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} + +impl ResponseResult for ListMembershipsResponse {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [memberships lookup groups](struct.GroupMembershipLookupCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LookupMembershipNameResponse { + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Membership being looked up. + /// + /// Format: `groups/{group_id}/memberships/{member_id}`, where `group_id` is + /// the unique ID assigned to the Group to which Membership belongs to, and + /// `member_id` is the unique ID assigned to the member. + pub name: Option, +} + +impl ResponseResult for LookupMembershipNameResponse {} + + +/// Resource representing a Group. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [memberships create groups](struct.GroupMembershipCreateCall.html) (none) +/// * [memberships list groups](struct.GroupMembershipListCall.html) (none) +/// * [list groups](struct.GroupListCall.html) (none) +/// * [get groups](struct.GroupGetCall.html) (response) +/// * [memberships delete groups](struct.GroupMembershipDeleteCall.html) (none) +/// * [search groups](struct.GroupSearchCall.html) (none) +/// * [memberships get groups](struct.GroupMembershipGetCall.html) (none) +/// * [create groups](struct.GroupCreateCall.html) (request) +/// * [lookup groups](struct.GroupLookupCall.html) (none) +/// * [delete groups](struct.GroupDeleteCall.html) (none) +/// * [patch groups](struct.GroupPatchCall.html) (request) +/// * [memberships lookup groups](struct.GroupMembershipLookupCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Group { + /// The time when the Group was last updated. + /// Output only. + #[serde(rename="updateTime")] + pub update_time: Option, + /// The Group's display name. + #[serde(rename="displayName")] + pub display_name: Option, + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group in the format: `groups/{group_id}`, where group_id is the unique ID + /// assigned to the Group. + /// + /// Must be left blank while creating a Group. + pub name: Option, + /// The entity under which this Group resides in Cloud Identity resource + /// hierarchy. Must be set when creating a Group, read-only afterwards. + /// + /// Currently allowed types: `identitysources`. + pub parent: Option, + /// `Required`. Labels for Group resource. + /// For creating Groups under a namespace, set label key to + /// 'labels/system/groups/external' and label value as empty. + pub labels: Option>, + /// EntityKey of the Group. + /// + /// Must be set when creating a Group, read-only afterwards. + #[serde(rename="groupKey")] + pub group_key: Option, + /// The time when the Group was created. + /// Output only. + #[serde(rename="createTime")] + pub create_time: Option, + /// An extended description to help users determine the purpose of a Group. For + /// example, you can include information about who should join the Group, the + /// types of messages to send to the Group, links to FAQs about the Group, or + /// related Groups. Maximum length is 4,096 characters. + pub description: Option, +} + +impl RequestValue for Group {} +impl Resource for Group {} +impl ResponseResult for Group {} + + +/// Resource representing a role within a Membership. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MembershipRole { + /// MembershipRole in string format. + /// + /// Currently supported MembershipRoles: `"MEMBER"`. + pub name: Option, +} + +impl Part for MembershipRole {} + + +/// Response message for ListGroups operation. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list groups](struct.GroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListGroupsResponse { + /// Token to retrieve the next page of results, or empty if there are no + /// more results available for listing. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Groups returned in response to list request. + /// The results are not sorted. + pub groups: Option>, +} + +impl ResponseResult for ListGroupsResponse {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [lookup groups](struct.GroupLookupCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LookupGroupNameResponse { + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group in the format: `groups/{group_id}`, where `group_id` is the unique ID + /// assigned to the Group. + pub name: Option, +} + +impl ResponseResult for LookupGroupNameResponse {} + + +/// Resource representing a Membership within a Group +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [memberships create groups](struct.GroupMembershipCreateCall.html) (request) +/// * [memberships get groups](struct.GroupMembershipGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Membership { + /// Last updated timestamp of the Membership. Output only. + #[serde(rename="updateTime")] + pub update_time: Option, + /// EntityKey of the entity to be added as the member. Must be set while + /// creating a Membership, read-only afterwards. + /// + /// Currently allowed entity types: `Users`, `Groups`. + #[serde(rename="preferredMemberKey")] + pub preferred_member_key: Option, + /// Creation timestamp of the Membership. Output only. + #[serde(rename="createTime")] + pub create_time: Option, + /// Roles for a member within the Group. + /// + /// Currently supported MembershipRoles: `"MEMBER"`. + pub roles: Option>, + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Membership in the format: `groups/{group_id}/memberships/{member_id}`, + /// where group_id is the unique ID assigned to the Group to which Membership + /// belongs to, and member_id is the unique ID assigned to the member + /// + /// Must be left blank while creating a Membership. + pub name: Option, +} + +impl RequestValue for Membership {} +impl ResponseResult for Membership {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search groups](struct.GroupSearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SearchGroupsResponse { + /// Token to retrieve the next page of results, or empty if there are no + /// more results available for specified query. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of Groups satisfying the search query. + pub groups: Option>, +} + +impl ResponseResult for SearchGroupsResponse {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [memberships create groups](struct.GroupMembershipCreateCall.html) (response) +/// * [patch groups](struct.GroupPatchCall.html) (response) +/// * [memberships delete groups](struct.GroupMembershipDeleteCall.html) (response) +/// * [create groups](struct.GroupCreateCall.html) (response) +/// * [delete groups](struct.GroupDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl ResponseResult for Operation {} + + +/// An EntityKey uniquely identifies an Entity. Namespaces are used to provide +/// isolation for IDs. A single ID can be reused across namespaces but the +/// combination of a namespace and an ID must be unique. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EntityKey { + /// Namespaces provide isolation for IDs, so an ID only needs to be unique + /// within its namespace. + /// + /// Namespaces are currently only created as part of IdentitySource creation + /// from Admin Console. A namespace `"identitysources/{identity_source_id}"` is + /// created corresponding to every Identity Source `identity_source_id`. + pub namespace: Option, + /// The ID of the entity within the given namespace. The ID must be unique + /// within its namespace. + pub id: Option, +} + +impl Part for EntityKey {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *group* resources. +/// It is not used directly, but through the `CloudIdentity` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudidentity1 as cloudidentity1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudidentity1::CloudIdentity; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `lookup(...)`, `memberships_create(...)`, `memberships_delete(...)`, `memberships_get(...)`, `memberships_list(...)`, `memberships_lookup(...)`, `patch(...)` and `search(...)` +/// // to build up your call. +/// let rb = hub.groups(); +/// # } +/// ``` +pub struct GroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, +} + +impl<'a, C, A> MethodsBuilder for GroupMethods<'a, C, A> {} + +impl<'a, C, A> GroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a Membership. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group to create Membership within. Format: `groups/{group_id}`, where + /// `group_id` is the unique ID assigned to the Group. + pub fn memberships_create(&self, request: Membership, parent: &str) -> GroupMembershipCreateCall<'a, C, A> { + GroupMembershipCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// List Memberships within a Group. + /// + /// # Arguments + /// + /// * `parent` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group to list Memberships within. + /// Format: `groups/{group_id}`, where `group_id` is the unique ID assigned to + /// the Group. + pub fn memberships_list(&self, parent: &str) -> GroupMembershipListCall<'a, C, A> { + GroupMembershipListCall { + hub: self.hub, + _parent: parent.to_string(), + _view: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// List groups within a customer or a domain. + pub fn list(&self) -> GroupListCall<'a, C, A> { + GroupListCall { + hub: self.hub, + _view: Default::default(), + _parent: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a Group. + /// + /// # Arguments + /// + /// * `name` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group in the format: `groups/{group_id}`, where `group_id` is the unique ID + /// assigned to the Group. + pub fn get(&self, name: &str) -> GroupGetCall<'a, C, A> { + GroupGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a Membership. + /// + /// # Arguments + /// + /// * `name` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Membership to be deleted. + /// Format: `groups/{group_id}/memberships/{member_id}`, where `group_id` is + /// the unique ID assigned to the Group to which Membership belongs to, and + /// member_id is the unique ID assigned to the member. + pub fn memberships_delete(&self, name: &str) -> GroupMembershipDeleteCall<'a, C, A> { + GroupMembershipDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Searches for Groups. + pub fn search(&self) -> GroupSearchCall<'a, C, A> { + GroupSearchCall { + hub: self.hub, + _view: Default::default(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a Membership. + /// + /// # Arguments + /// + /// * `name` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Membership to be retrieved. + /// Format: `groups/{group_id}/memberships/{member_id}`, where `group_id` is + /// the unique id assigned to the Group to which Membership belongs to, and + /// `member_id` is the unique ID assigned to the member. + pub fn memberships_get(&self, name: &str) -> GroupMembershipGetCall<'a, C, A> { + GroupMembershipGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a Group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn create(&self, request: Group) -> GroupCreateCall<'a, C, A> { + GroupCreateCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Looks up [resource + /// name](https://cloud.google.com/apis/design/resource_names) of a Group by + /// its EntityKey. + pub fn lookup(&self) -> GroupLookupCall<'a, C, A> { + GroupLookupCall { + hub: self.hub, + _group_key_namespace: Default::default(), + _group_key_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a Group. + /// + /// # Arguments + /// + /// * `name` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group in the format: `groups/{group_id}`, where `group_id` is the unique ID + /// assigned to the Group. + pub fn delete(&self, name: &str) -> GroupDeleteCall<'a, C, A> { + GroupDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a Group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group in the format: `groups/{group_id}`, where group_id is the unique ID + /// assigned to the Group. + /// Must be left blank while creating a Group. + pub fn patch(&self, request: Group, name: &str) -> GroupPatchCall<'a, C, A> { + GroupPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Looks up [resource + /// name](https://cloud.google.com/apis/design/resource_names) of a Membership + /// within a Group by member's EntityKey. + /// + /// # Arguments + /// + /// * `parent` - [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group to lookup Membership within. + /// Format: `groups/{group_id}`, where `group_id` is the unique ID assigned to + /// the Group. + pub fn memberships_lookup(&self, parent: &str) -> GroupMembershipLookupCall<'a, C, A> { + GroupMembershipLookupCall { + hub: self.hub, + _parent: parent.to_string(), + _member_key_namespace: Default::default(), + _member_key_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Creates a Membership. +/// +/// A builder for the *memberships.create* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// use cloudidentity1::Membership; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Membership::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().memberships_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct GroupMembershipCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _request: Membership, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupMembershipCreateCall<'a, C, A> {} + +impl<'a, C, A> GroupMembershipCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.memberships.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/memberships"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroup.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Membership) -> GroupMembershipCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group to create Membership within. Format: `groups/{group_id}`, where + /// `group_id` is the unique ID assigned to the Group. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> GroupMembershipCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupMembershipCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupMembershipCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroup`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupMembershipCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// List Memberships within a Group. +/// +/// A builder for the *memberships.list* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().memberships_list("parent") +/// .view("nonumy") +/// .page_token("dolores") +/// .page_size(-61) +/// .doit(); +/// # } +/// ``` +pub struct GroupMembershipListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _parent: String, + _view: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupMembershipListCall<'a, C, A> {} + +impl<'a, C, A> GroupMembershipListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListMembershipsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.memberships.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._view { + params.push(("view", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "view", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/memberships"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group to list Memberships within. + /// + /// Format: `groups/{group_id}`, where `group_id` is the unique ID assigned to + /// the Group. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> GroupMembershipListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Membership resource view to be returned. Defaults to View.BASIC. + /// + /// Sets the *view* query property to the given value. + pub fn view(mut self, new_value: &str) -> GroupMembershipListCall<'a, C, A> { + self._view = Some(new_value.to_string()); + self + } + /// The next_page_token value returned from a previous list request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> GroupMembershipListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The default page size is 200 (max 1000) for the BASIC view, and 50 + /// (max 500) for the FULL view. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> GroupMembershipListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupMembershipListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupMembershipListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroupReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupMembershipListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// List groups within a customer or a domain. +/// +/// A builder for the *list* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().list() +/// .view("sadipscing") +/// .parent("aliquyam") +/// .page_token("ea") +/// .page_size(-61) +/// .doit(); +/// # } +/// ``` +pub struct GroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _view: Option, + _parent: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupListCall<'a, C, A> {} + +impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListGroupsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + if let Some(value) = self._view { + params.push(("view", value.to_string())); + } + if let Some(value) = self._parent { + params.push(("parent", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "view", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/groups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Group resource view to be returned. Defaults to [View.BASIC](). + /// + /// Sets the *view* query property to the given value. + pub fn view(mut self, new_value: &str) -> GroupListCall<'a, C, A> { + self._view = Some(new_value.to_string()); + self + } + /// `Required`. May be made Optional in the future. + /// Customer ID to list all groups from. + /// + /// Sets the *parent* query property to the given value. + pub fn parent(mut self, new_value: &str) -> GroupListCall<'a, C, A> { + self._parent = Some(new_value.to_string()); + self + } + /// The next_page_token value returned from a previous list request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> GroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The default page size is 200 (max 1000) for the BASIC view, and 50 + /// (max 500) for the FULL view. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> GroupListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroupReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a Group. +/// +/// A builder for the *get* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().get("name") +/// .doit(); +/// # } +/// ``` +pub struct GroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupGetCall<'a, C, A> {} + +impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Group)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group in the format: `groups/{group_id}`, where `group_id` is the unique ID + /// assigned to the Group. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> GroupGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroupReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a Membership. +/// +/// A builder for the *memberships.delete* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().memberships_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct GroupMembershipDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupMembershipDeleteCall<'a, C, A> {} + +impl<'a, C, A> GroupMembershipDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.memberships.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroup.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Membership to be deleted. + /// + /// Format: `groups/{group_id}/memberships/{member_id}`, where `group_id` is + /// the unique ID assigned to the Group to which Membership belongs to, and + /// member_id is the unique ID assigned to the member. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> GroupMembershipDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupMembershipDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupMembershipDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroup`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupMembershipDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Searches for Groups. +/// +/// A builder for the *search* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().search() +/// .view("et") +/// .query("et") +/// .page_token("diam") +/// .page_size(-55) +/// .doit(); +/// # } +/// ``` +pub struct GroupSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _view: Option, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupSearchCall<'a, C, A> {} + +impl<'a, C, A> GroupSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SearchGroupsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + if let Some(value) = self._view { + params.push(("view", value.to_string())); + } + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "view", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/groups:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Group resource view to be returned. Defaults to [View.BASIC](). + /// + /// Sets the *view* query property to the given value. + pub fn view(mut self, new_value: &str) -> GroupSearchCall<'a, C, A> { + self._view = Some(new_value.to_string()); + self + } + /// `Required`. Query string for performing search on groups. Users can search + /// on parent and label attributes of groups. + /// EXACT match ('==') is supported on parent, and CONTAINS match ('in') is + /// supported on labels. + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> GroupSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// The next_page_token value returned from a previous search request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> GroupSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The default page size is 200 (max 1000) for the BASIC view, and 50 + /// (max 500) for the FULL view. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> GroupSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroupReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a Membership. +/// +/// A builder for the *memberships.get* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().memberships_get("name") +/// .doit(); +/// # } +/// ``` +pub struct GroupMembershipGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupMembershipGetCall<'a, C, A> {} + +impl<'a, C, A> GroupMembershipGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Membership)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.memberships.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Membership to be retrieved. + /// + /// Format: `groups/{group_id}/memberships/{member_id}`, where `group_id` is + /// the unique id assigned to the Group to which Membership belongs to, and + /// `member_id` is the unique ID assigned to the member. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> GroupMembershipGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupMembershipGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupMembershipGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroupReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupMembershipGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a Group. +/// +/// A builder for the *create* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// use cloudidentity1::Group; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Group::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().create(req) +/// .doit(); +/// # } +/// ``` +pub struct GroupCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _request: Group, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupCreateCall<'a, C, A> {} + +impl<'a, C, A> GroupCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/groups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroup.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Group) -> GroupCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroup`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Looks up [resource +/// name](https://cloud.google.com/apis/design/resource_names) of a Group by +/// its EntityKey. +/// +/// A builder for the *lookup* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().lookup() +/// .group_key_namespace("et") +/// .group_key_id("duo") +/// .doit(); +/// # } +/// ``` +pub struct GroupLookupCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _group_key_namespace: Option, + _group_key_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupLookupCall<'a, C, A> {} + +impl<'a, C, A> GroupLookupCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LookupGroupNameResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.lookup", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + if let Some(value) = self._group_key_namespace { + params.push(("groupKey.namespace", value.to_string())); + } + if let Some(value) = self._group_key_id { + params.push(("groupKey.id", value.to_string())); + } + for &field in ["alt", "groupKey.namespace", "groupKey.id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/groups:lookup"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Namespaces provide isolation for IDs, so an ID only needs to be unique + /// within its namespace. + /// + /// Namespaces are currently only created as part of IdentitySource creation + /// from Admin Console. A namespace `"identitysources/{identity_source_id}"` is + /// created corresponding to every Identity Source `identity_source_id`. + /// + /// Sets the *group key.namespace* query property to the given value. + pub fn group_key_namespace(mut self, new_value: &str) -> GroupLookupCall<'a, C, A> { + self._group_key_namespace = Some(new_value.to_string()); + self + } + /// The ID of the entity within the given namespace. The ID must be unique + /// within its namespace. + /// + /// Sets the *group key.id* query property to the given value. + pub fn group_key_id(mut self, new_value: &str) -> GroupLookupCall<'a, C, A> { + self._group_key_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupLookupCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupLookupCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroupReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupLookupCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a Group. +/// +/// A builder for the *delete* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().delete("name") +/// .doit(); +/// # } +/// ``` +pub struct GroupDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupDeleteCall<'a, C, A> {} + +impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroup.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group in the format: `groups/{group_id}`, where `group_id` is the unique ID + /// assigned to the Group. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> GroupDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroup`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a Group. +/// +/// A builder for the *patch* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// use cloudidentity1::Group; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Group::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().patch(req, "name") +/// .update_mask("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct GroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _request: Group, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupPatchCall<'a, C, A> {} + +impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroup.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Group) -> GroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group in the format: `groups/{group_id}`, where group_id is the unique ID + /// assigned to the Group. + /// + /// Must be left blank while creating a Group. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> GroupPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Editable fields: `display_name`, `description` + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> GroupPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroup`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Looks up [resource +/// name](https://cloud.google.com/apis/design/resource_names) of a Membership +/// within a Group by member's EntityKey. +/// +/// A builder for the *memberships.lookup* method supported by a *group* resource. +/// It is not used directly, but through a `GroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudidentity1 as cloudidentity1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudidentity1::CloudIdentity; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIdentity::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.groups().memberships_lookup("parent") +/// .member_key_namespace("erat") +/// .member_key_id("sadipscing") +/// .doit(); +/// # } +/// ``` +pub struct GroupMembershipLookupCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIdentity, + _parent: String, + _member_key_namespace: Option, + _member_key_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GroupMembershipLookupCall<'a, C, A> {} + +impl<'a, C, A> GroupMembershipLookupCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LookupMembershipNameResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudidentity.groups.memberships.lookup", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._member_key_namespace { + params.push(("memberKey.namespace", value.to_string())); + } + if let Some(value) = self._member_key_id { + params.push(("memberKey.id", value.to_string())); + } + for &field in ["alt", "parent", "memberKey.namespace", "memberKey.id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/memberships:lookup"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudIdentityGroupReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// [Resource name](https://cloud.google.com/apis/design/resource_names) of the + /// Group to lookup Membership within. + /// + /// Format: `groups/{group_id}`, where `group_id` is the unique ID assigned to + /// the Group. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> GroupMembershipLookupCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Namespaces provide isolation for IDs, so an ID only needs to be unique + /// within its namespace. + /// + /// Namespaces are currently only created as part of IdentitySource creation + /// from Admin Console. A namespace `"identitysources/{identity_source_id}"` is + /// created corresponding to every Identity Source `identity_source_id`. + /// + /// Sets the *member key.namespace* query property to the given value. + pub fn member_key_namespace(mut self, new_value: &str) -> GroupMembershipLookupCall<'a, C, A> { + self._member_key_namespace = Some(new_value.to_string()); + self + } + /// The ID of the entity within the given namespace. The ID must be unique + /// within its namespace. + /// + /// Sets the *member key.id* query property to the given value. + pub fn member_key_id(mut self, new_value: &str) -> GroupMembershipLookupCall<'a, C, A> { + self._member_key_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> GroupMembershipLookupCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> GroupMembershipLookupCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudIdentityGroupReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> GroupMembershipLookupCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/cloudiot1-cli/Cargo.toml b/gen/cloudiot1-cli/Cargo.toml index 859ac6017f..0d59537e43 100644 --- a/gen/cloudiot1-cli/Cargo.toml +++ b/gen/cloudiot1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudiot1-cli" -version = "1.0.8+20181002" +version = "1.0.8+20190321" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Iot (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudiot1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudiot1] path = "../cloudiot1" -version = "1.0.8+20181002" +version = "1.0.8+20190321" diff --git a/gen/cloudiot1-cli/README.md b/gen/cloudiot1-cli/README.md index 0697e00e15..d77fa873a4 100644 --- a/gen/cloudiot1-cli/README.md +++ b/gen/cloudiot1-cli/README.md @@ -25,11 +25,12 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Iot* API at revision *20181002*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Iot* API at revision *20190321*. The CLI is at version *1.0.8*. ```bash cloudiot1 [options] projects + locations-registries-bind-device-to-gateway (-r )... [-p ]... [-o ] locations-registries-create (-r )... [-p ]... [-o ] locations-registries-delete [-p ]... [-o ] locations-registries-devices-config-versions-list [-p ]... [-o ] @@ -43,6 +44,7 @@ cloudiot1 [options] locations-registries-devices-states-list [-p ]... [-o ] locations-registries-get [-p ]... [-o ] locations-registries-get-iam-policy (-r )... [-p ]... [-o ] + locations-registries-groups-bind-device-to-gateway (-r )... [-p ]... [-o ] locations-registries-groups-devices-config-versions-list [-p ]... [-o ] locations-registries-groups-devices-get [-p ]... [-o ] locations-registries-groups-devices-list [-p ]... [-o ] @@ -53,10 +55,12 @@ cloudiot1 [options] locations-registries-groups-get-iam-policy (-r )... [-p ]... [-o ] locations-registries-groups-set-iam-policy (-r )... [-p ]... [-o ] locations-registries-groups-test-iam-permissions (-r )... [-p ]... [-o ] + locations-registries-groups-unbind-device-from-gateway (-r )... [-p ]... [-o ] locations-registries-list [-p ]... [-o ] locations-registries-patch (-r )... [-p ]... [-o ] locations-registries-set-iam-policy (-r )... [-p ]... [-o ] locations-registries-test-iam-permissions (-r )... [-p ]... [-o ] + locations-registries-unbind-device-from-gateway (-r )... [-p ]... [-o ] cloudiot1 --help Configuration: diff --git a/gen/cloudiot1-cli/mkdocs.yml b/gen/cloudiot1-cli/mkdocs.yml index 2aa641cef7..a694b2a312 100644 --- a/gen/cloudiot1-cli/mkdocs.yml +++ b/gen/cloudiot1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Iot v1.0.8+20181002 +site_name: Cloud Iot v1.0.8+20190321 site_url: http://byron.github.io/google-apis-rs/google-cloudiot1-cli site_description: A complete library to interact with Cloud Iot (protocol v1) @@ -9,6 +9,7 @@ site_dir: build_html pages: - ['index.md', 'Home'] +- ['projects_locations-registries-bind-device-to-gateway.md', 'Projects', 'Locations Registries Bind Device To Gateway'] - ['projects_locations-registries-create.md', 'Projects', 'Locations Registries Create'] - ['projects_locations-registries-delete.md', 'Projects', 'Locations Registries Delete'] - ['projects_locations-registries-devices-config-versions-list.md', 'Projects', 'Locations Registries Devices Config Versions List'] @@ -22,6 +23,7 @@ pages: - ['projects_locations-registries-devices-states-list.md', 'Projects', 'Locations Registries Devices States List'] - ['projects_locations-registries-get.md', 'Projects', 'Locations Registries Get'] - ['projects_locations-registries-get-iam-policy.md', 'Projects', 'Locations Registries Get Iam Policy'] +- ['projects_locations-registries-groups-bind-device-to-gateway.md', 'Projects', 'Locations Registries Groups Bind Device To Gateway'] - ['projects_locations-registries-groups-devices-config-versions-list.md', 'Projects', 'Locations Registries Groups Devices Config Versions List'] - ['projects_locations-registries-groups-devices-get.md', 'Projects', 'Locations Registries Groups Devices Get'] - ['projects_locations-registries-groups-devices-list.md', 'Projects', 'Locations Registries Groups Devices List'] @@ -32,10 +34,12 @@ pages: - ['projects_locations-registries-groups-get-iam-policy.md', 'Projects', 'Locations Registries Groups Get Iam Policy'] - ['projects_locations-registries-groups-set-iam-policy.md', 'Projects', 'Locations Registries Groups Set Iam Policy'] - ['projects_locations-registries-groups-test-iam-permissions.md', 'Projects', 'Locations Registries Groups Test Iam Permissions'] +- ['projects_locations-registries-groups-unbind-device-from-gateway.md', 'Projects', 'Locations Registries Groups Unbind Device From Gateway'] - ['projects_locations-registries-list.md', 'Projects', 'Locations Registries List'] - ['projects_locations-registries-patch.md', 'Projects', 'Locations Registries Patch'] - ['projects_locations-registries-set-iam-policy.md', 'Projects', 'Locations Registries Set Iam Policy'] - ['projects_locations-registries-test-iam-permissions.md', 'Projects', 'Locations Registries Test Iam Permissions'] +- ['projects_locations-registries-unbind-device-from-gateway.md', 'Projects', 'Locations Registries Unbind Device From Gateway'] theme: readthedocs diff --git a/gen/cloudiot1-cli/src/main.rs b/gen/cloudiot1-cli/src/main.rs index fa31974d9a..60466829e6 100644 --- a/gen/cloudiot1-cli/src/main.rs +++ b/gen/cloudiot1-cli/src/main.rs @@ -46,6 +46,92 @@ struct Engine<'n> { impl<'n> Engine<'n> { + fn _projects_locations_registries_bind_device_to_gateway(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "gateway-id" => Some(("gatewayId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "device-id" => Some(("deviceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["device-id", "gateway-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BindDeviceToGatewayRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_registries_bind_device_to_gateway(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_locations_registries_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -268,7 +354,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "last-state-time" => Some(("lastStateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-config-send-time" => Some(("lastConfigSendTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.gateway-type" => Some(("gatewayConfig.gatewayType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.last-accessed-gateway-time" => Some(("gatewayConfig.lastAccessedGatewayTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.gateway-auth-method" => Some(("gatewayConfig.gatewayAuthMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.last-accessed-gateway-id" => Some(("gatewayConfig.lastAccessedGatewayId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-event-time" => Some(("lastEventTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-error-time" => Some(("lastErrorTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "num-id" => Some(("numId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -281,14 +370,15 @@ impl<'n> Engine<'n> { "last-error-status.message" => Some(("lastErrorStatus.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-error-status.code" => Some(("lastErrorStatus.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "last-config-ack-time" => Some(("lastConfigAckTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "blocked" => Some(("blocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.version" => Some(("config.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.cloud-update-time" => Some(("config.cloudUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.binary-data" => Some(("config.binaryData", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.device-ack-time" => Some(("config.deviceAckTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "blocked" => Some(("blocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-config-send-time" => Some(("lastConfigSendTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["binary-data", "blocked", "cloud-update-time", "code", "config", "device-ack-time", "id", "last-config-ack-time", "last-config-send-time", "last-error-status", "last-error-time", "last-event-time", "last-heartbeat-time", "last-state-time", "log-level", "message", "metadata", "name", "num-id", "state", "update-time", "version"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["binary-data", "blocked", "cloud-update-time", "code", "config", "device-ack-time", "gateway-auth-method", "gateway-config", "gateway-type", "id", "last-accessed-gateway-id", "last-accessed-gateway-time", "last-config-ack-time", "last-config-send-time", "last-error-status", "last-error-time", "last-event-time", "last-heartbeat-time", "last-state-time", "log-level", "message", "metadata", "name", "num-id", "state", "update-time", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -468,6 +558,15 @@ impl<'n> Engine<'n> { "page-size" => { call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); }, + "gateway-list-options-gateway-type" => { + call = call.gateway_list_options_gateway_type(value.unwrap_or("")); + }, + "gateway-list-options-associations-gateway-id" => { + call = call.gateway_list_options_associations_gateway_id(value.unwrap_or("")); + }, + "gateway-list-options-associations-device-id" => { + call = call.gateway_list_options_associations_device_id(value.unwrap_or("")); + }, "field-mask" => { call = call.field_mask(value.unwrap_or("")); }, @@ -490,7 +589,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["device-num-ids", "page-token", "field-mask", "page-size", "device-ids"].iter().map(|v|*v)); + v.extend(["page-size", "gateway-list-options-associations-gateway-id", "field-mask", "device-ids", "device-num-ids", "page-token", "gateway-list-options-gateway-type", "gateway-list-options-associations-device-id"].iter().map(|v|*v)); v } )); } } @@ -634,7 +733,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "last-state-time" => Some(("lastStateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-config-send-time" => Some(("lastConfigSendTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.gateway-type" => Some(("gatewayConfig.gatewayType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.last-accessed-gateway-time" => Some(("gatewayConfig.lastAccessedGatewayTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.gateway-auth-method" => Some(("gatewayConfig.gatewayAuthMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.last-accessed-gateway-id" => Some(("gatewayConfig.lastAccessedGatewayId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-event-time" => Some(("lastEventTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-error-time" => Some(("lastErrorTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "num-id" => Some(("numId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -647,14 +749,15 @@ impl<'n> Engine<'n> { "last-error-status.message" => Some(("lastErrorStatus.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-error-status.code" => Some(("lastErrorStatus.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "last-config-ack-time" => Some(("lastConfigAckTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "blocked" => Some(("blocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.version" => Some(("config.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.cloud-update-time" => Some(("config.cloudUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.binary-data" => Some(("config.binaryData", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.device-ack-time" => Some(("config.deviceAckTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "blocked" => Some(("blocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-config-send-time" => Some(("lastConfigSendTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["binary-data", "blocked", "cloud-update-time", "code", "config", "device-ack-time", "id", "last-config-ack-time", "last-config-send-time", "last-error-status", "last-error-time", "last-event-time", "last-heartbeat-time", "last-state-time", "log-level", "message", "metadata", "name", "num-id", "state", "update-time", "version"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["binary-data", "blocked", "cloud-update-time", "code", "config", "device-ack-time", "gateway-auth-method", "gateway-config", "gateway-type", "id", "last-accessed-gateway-id", "last-accessed-gateway-time", "last-config-ack-time", "last-config-send-time", "last-error-status", "last-error-time", "last-event-time", "last-heartbeat-time", "last-state-time", "log-level", "message", "metadata", "name", "num-id", "state", "update-time", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -996,6 +1099,92 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_registries_groups_bind_device_to_gateway(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "gateway-id" => Some(("gatewayId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "device-id" => Some(("deviceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["device-id", "gateway-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BindDeviceToGatewayRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_registries_groups_bind_device_to_gateway(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_locations_registries_groups_devices_config_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().locations_registries_groups_devices_config_versions_list(opt.value_of("name").unwrap_or("")); @@ -1120,6 +1309,15 @@ impl<'n> Engine<'n> { "page-size" => { call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); }, + "gateway-list-options-gateway-type" => { + call = call.gateway_list_options_gateway_type(value.unwrap_or("")); + }, + "gateway-list-options-associations-gateway-id" => { + call = call.gateway_list_options_associations_gateway_id(value.unwrap_or("")); + }, + "gateway-list-options-associations-device-id" => { + call = call.gateway_list_options_associations_device_id(value.unwrap_or("")); + }, "field-mask" => { call = call.field_mask(value.unwrap_or("")); }, @@ -1142,7 +1340,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["device-num-ids", "page-token", "field-mask", "page-size", "device-ids"].iter().map(|v|*v)); + v.extend(["page-size", "gateway-list-options-associations-gateway-id", "field-mask", "device-ids", "device-num-ids", "page-token", "gateway-list-options-gateway-type", "gateway-list-options-associations-device-id"].iter().map(|v|*v)); v } )); } } @@ -1286,7 +1484,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "last-state-time" => Some(("lastStateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-config-send-time" => Some(("lastConfigSendTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.gateway-type" => Some(("gatewayConfig.gatewayType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.last-accessed-gateway-time" => Some(("gatewayConfig.lastAccessedGatewayTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.gateway-auth-method" => Some(("gatewayConfig.gatewayAuthMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-config.last-accessed-gateway-id" => Some(("gatewayConfig.lastAccessedGatewayId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-event-time" => Some(("lastEventTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-error-time" => Some(("lastErrorTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "num-id" => Some(("numId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1299,14 +1500,15 @@ impl<'n> Engine<'n> { "last-error-status.message" => Some(("lastErrorStatus.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-error-status.code" => Some(("lastErrorStatus.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "last-config-ack-time" => Some(("lastConfigAckTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "blocked" => Some(("blocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.version" => Some(("config.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.cloud-update-time" => Some(("config.cloudUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.binary-data" => Some(("config.binaryData", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.device-ack-time" => Some(("config.deviceAckTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "blocked" => Some(("blocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-config-send-time" => Some(("lastConfigSendTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["binary-data", "blocked", "cloud-update-time", "code", "config", "device-ack-time", "id", "last-config-ack-time", "last-config-send-time", "last-error-status", "last-error-time", "last-event-time", "last-heartbeat-time", "last-state-time", "log-level", "message", "metadata", "name", "num-id", "state", "update-time", "version"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["binary-data", "blocked", "cloud-update-time", "code", "config", "device-ack-time", "gateway-auth-method", "gateway-config", "gateway-type", "id", "last-accessed-gateway-id", "last-accessed-gateway-time", "last-config-ack-time", "last-config-send-time", "last-error-status", "last-error-time", "last-event-time", "last-heartbeat-time", "last-state-time", "log-level", "message", "metadata", "name", "num-id", "state", "update-time", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1767,6 +1969,92 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_registries_groups_unbind_device_from_gateway(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "gateway-id" => Some(("gatewayId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "device-id" => Some(("deviceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["device-id", "gateway-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UnbindDeviceFromGatewayRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_registries_groups_unbind_device_from_gateway(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_locations_registries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().locations_registries_list(opt.value_of("parent").unwrap_or("")); @@ -2091,6 +2379,92 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_registries_unbind_device_from_gateway(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "gateway-id" => Some(("gatewayId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "device-id" => Some(("deviceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["device-id", "gateway-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UnbindDeviceFromGatewayRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_registries_unbind_device_from_gateway(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); @@ -2098,6 +2472,9 @@ impl<'n> Engine<'n> { match self.opt.subcommand() { ("projects", Some(opt)) => { match opt.subcommand() { + ("locations-registries-bind-device-to-gateway", Some(opt)) => { + call_result = self._projects_locations_registries_bind_device_to_gateway(opt, dry_run, &mut err); + }, ("locations-registries-create", Some(opt)) => { call_result = self._projects_locations_registries_create(opt, dry_run, &mut err); }, @@ -2137,6 +2514,9 @@ impl<'n> Engine<'n> { ("locations-registries-get-iam-policy", Some(opt)) => { call_result = self._projects_locations_registries_get_iam_policy(opt, dry_run, &mut err); }, + ("locations-registries-groups-bind-device-to-gateway", Some(opt)) => { + call_result = self._projects_locations_registries_groups_bind_device_to_gateway(opt, dry_run, &mut err); + }, ("locations-registries-groups-devices-config-versions-list", Some(opt)) => { call_result = self._projects_locations_registries_groups_devices_config_versions_list(opt, dry_run, &mut err); }, @@ -2167,6 +2547,9 @@ impl<'n> Engine<'n> { ("locations-registries-groups-test-iam-permissions", Some(opt)) => { call_result = self._projects_locations_registries_groups_test_iam_permissions(opt, dry_run, &mut err); }, + ("locations-registries-groups-unbind-device-from-gateway", Some(opt)) => { + call_result = self._projects_locations_registries_groups_unbind_device_from_gateway(opt, dry_run, &mut err); + }, ("locations-registries-list", Some(opt)) => { call_result = self._projects_locations_registries_list(opt, dry_run, &mut err); }, @@ -2179,6 +2562,9 @@ impl<'n> Engine<'n> { ("locations-registries-test-iam-permissions", Some(opt)) => { call_result = self._projects_locations_registries_test_iam_permissions(opt, dry_run, &mut err); }, + ("locations-registries-unbind-device-from-gateway", Some(opt)) => { + call_result = self._projects_locations_registries_unbind_device_from_gateway(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("projects".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -2270,7 +2656,36 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'locations-registries-create', 'locations-registries-delete', 'locations-registries-devices-config-versions-list', 'locations-registries-devices-create', 'locations-registries-devices-delete', 'locations-registries-devices-get', 'locations-registries-devices-list', 'locations-registries-devices-modify-cloud-to-device-config', 'locations-registries-devices-patch', 'locations-registries-devices-send-command-to-device', 'locations-registries-devices-states-list', 'locations-registries-get', 'locations-registries-get-iam-policy', 'locations-registries-groups-devices-config-versions-list', 'locations-registries-groups-devices-get', 'locations-registries-groups-devices-list', 'locations-registries-groups-devices-modify-cloud-to-device-config', 'locations-registries-groups-devices-patch', 'locations-registries-groups-devices-send-command-to-device', 'locations-registries-groups-devices-states-list', 'locations-registries-groups-get-iam-policy', 'locations-registries-groups-set-iam-policy', 'locations-registries-groups-test-iam-permissions', 'locations-registries-list', 'locations-registries-patch', 'locations-registries-set-iam-policy' and 'locations-registries-test-iam-permissions'", vec![ + ("projects", "methods: 'locations-registries-bind-device-to-gateway', 'locations-registries-create', 'locations-registries-delete', 'locations-registries-devices-config-versions-list', 'locations-registries-devices-create', 'locations-registries-devices-delete', 'locations-registries-devices-get', 'locations-registries-devices-list', 'locations-registries-devices-modify-cloud-to-device-config', 'locations-registries-devices-patch', 'locations-registries-devices-send-command-to-device', 'locations-registries-devices-states-list', 'locations-registries-get', 'locations-registries-get-iam-policy', 'locations-registries-groups-bind-device-to-gateway', 'locations-registries-groups-devices-config-versions-list', 'locations-registries-groups-devices-get', 'locations-registries-groups-devices-list', 'locations-registries-groups-devices-modify-cloud-to-device-config', 'locations-registries-groups-devices-patch', 'locations-registries-groups-devices-send-command-to-device', 'locations-registries-groups-devices-states-list', 'locations-registries-groups-get-iam-policy', 'locations-registries-groups-set-iam-policy', 'locations-registries-groups-test-iam-permissions', 'locations-registries-groups-unbind-device-from-gateway', 'locations-registries-list', 'locations-registries-patch', 'locations-registries-set-iam-policy', 'locations-registries-test-iam-permissions' and 'locations-registries-unbind-device-from-gateway'", vec![ + ("locations-registries-bind-device-to-gateway", + Some(r##"Associates the device with the gateway."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudiot1_cli/projects_locations-registries-bind-device-to-gateway", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the registry. For example, + `projects/example-project/locations/us-central1/registries/my-registry`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), ("locations-registries-create", Some(r##"Creates a device registry that contains devices."##), "Details at http://byron.github.io/google-apis-rs/google_cloudiot1_cli/projects_locations-registries-create", @@ -2628,6 +3043,35 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-registries-groups-bind-device-to-gateway", + Some(r##"Associates the device with the gateway."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudiot1_cli/projects_locations-registries-groups-bind-device-to-gateway", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the registry. For example, + `projects/example-project/locations/us-central1/registries/my-registry`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -2923,6 +3367,35 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-registries-groups-unbind-device-from-gateway", + Some(r##"Deletes the association between the device and the gateway."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudiot1_cli/projects_locations-registries-groups-unbind-device-from-gateway", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the registry. For example, + `projects/example-project/locations/us-central1/registries/my-registry`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -3036,6 +3509,35 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-registries-unbind-device-from-gateway", + Some(r##"Deletes the association between the device and the gateway."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudiot1_cli/projects_locations-registries-unbind-device-from-gateway", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the registry. For example, + `projects/example-project/locations/us-central1/registries/my-registry`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -3048,7 +3550,7 @@ fn main() { let mut app = App::new("cloudiot1") .author("Sebastian Thiel ") - .version("1.0.8+20181002") + .version("1.0.8+20190321") .about("Registers and manages IoT (Internet of Things) devices that connect to the Google Cloud Platform. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudiot1_cli") diff --git a/gen/cloudiot1/Cargo.toml b/gen/cloudiot1/Cargo.toml index 8f4f92f7d4..102c444ac4 100644 --- a/gen/cloudiot1/Cargo.toml +++ b/gen/cloudiot1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudiot1" -version = "1.0.8+20181002" +version = "1.0.8+20190321" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Iot (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudiot1" homepage = "https://cloud.google.com/iot" -documentation = "https://docs.rs/google-cloudiot1/1.0.8+20181002" +documentation = "https://docs.rs/google-cloudiot1/1.0.8+20190321" license = "MIT" keywords = ["cloudiot", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudiot1/README.md b/gen/cloudiot1/README.md index 258ae74dbb..5bccf22371 100644 --- a/gen/cloudiot1/README.md +++ b/gen/cloudiot1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-cloudiot1` library allows access to all features of the *Google Cloud Iot* service. -This documentation was generated from *Cloud Iot* crate version *1.0.8+20181002*, where *20181002* is the exact revision of the *cloudiot:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Iot* crate version *1.0.8+20190321*, where *20190321* is the exact revision of the *cloudiot:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Iot* *v1* API can be found at the [official documentation site](https://cloud.google.com/iot). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.CloudIot.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.CloudIot.html) ... * projects - * [*locations registries create*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryCreateCall.html), [*locations registries delete*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryDeleteCall.html), [*locations registries devices config versions list*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryDeviceConfigVersionListCall.html), [*locations registries devices create*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryDeviceCreateCall.html), [*locations registries devices delete*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryDeviceDeleteCall.html), [*locations registries devices get*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryDeviceGetCall.html), [*locations registries devices list*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryDeviceListCall.html), [*locations registries devices modify cloud to device config*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryDeviceModifyCloudToDeviceConfigCall.html), [*locations registries devices patch*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryDevicePatchCall.html), [*locations registries devices send command to device*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryDeviceSendCommandToDeviceCall.html), [*locations registries devices states list*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryDeviceStateListCall.html), [*locations registries get*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGetCall.html), [*locations registries get iam policy*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGetIamPolicyCall.html), [*locations registries groups devices config versions list*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceConfigVersionListCall.html), [*locations registries groups devices get*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceGetCall.html), [*locations registries groups devices list*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceListCall.html), [*locations registries groups devices modify cloud to device config*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall.html), [*locations registries groups devices patch*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGroupDevicePatchCall.html), [*locations registries groups devices send command to device*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall.html), [*locations registries groups devices states list*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceStateListCall.html), [*locations registries groups get iam policy*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGroupGetIamPolicyCall.html), [*locations registries groups set iam policy*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGroupSetIamPolicyCall.html), [*locations registries groups test iam permissions*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryGroupTestIamPermissionCall.html), [*locations registries list*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryListCall.html), [*locations registries patch*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryPatchCall.html), [*locations registries set iam policy*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistrySetIamPolicyCall.html) and [*locations registries test iam permissions*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.ProjectLocationRegistryTestIamPermissionCall.html) + * [*locations registries bind device to gateway*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryBindDeviceToGatewayCall.html), [*locations registries create*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryCreateCall.html), [*locations registries delete*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryDeleteCall.html), [*locations registries devices config versions list*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryDeviceConfigVersionListCall.html), [*locations registries devices create*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryDeviceCreateCall.html), [*locations registries devices delete*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryDeviceDeleteCall.html), [*locations registries devices get*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryDeviceGetCall.html), [*locations registries devices list*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryDeviceListCall.html), [*locations registries devices modify cloud to device config*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryDeviceModifyCloudToDeviceConfigCall.html), [*locations registries devices patch*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryDevicePatchCall.html), [*locations registries devices send command to device*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryDeviceSendCommandToDeviceCall.html), [*locations registries devices states list*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryDeviceStateListCall.html), [*locations registries get*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGetCall.html), [*locations registries get iam policy*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGetIamPolicyCall.html), [*locations registries groups bind device to gateway*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupBindDeviceToGatewayCall.html), [*locations registries groups devices config versions list*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceConfigVersionListCall.html), [*locations registries groups devices get*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceGetCall.html), [*locations registries groups devices list*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceListCall.html), [*locations registries groups devices modify cloud to device config*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall.html), [*locations registries groups devices patch*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupDevicePatchCall.html), [*locations registries groups devices send command to device*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall.html), [*locations registries groups devices states list*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupDeviceStateListCall.html), [*locations registries groups get iam policy*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupGetIamPolicyCall.html), [*locations registries groups set iam policy*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupSetIamPolicyCall.html), [*locations registries groups test iam permissions*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupTestIamPermissionCall.html), [*locations registries groups unbind device from gateway*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall.html), [*locations registries list*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryListCall.html), [*locations registries patch*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryPatchCall.html), [*locations registries set iam policy*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistrySetIamPolicyCall.html), [*locations registries test iam permissions*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryTestIamPermissionCall.html) and [*locations registries unbind device from gateway*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.ProjectLocationRegistryUnbindDeviceFromGatewayCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/struct.CloudIot.html)** +* **[Hub](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/struct.CloudIot.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -47,10 +47,10 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore +let r = hub.projects().locations_registries_groups_devices_get(...).doit() let r = hub.projects().locations_registries_devices_create(...).doit() let r = hub.projects().locations_registries_devices_patch(...).doit() let r = hub.projects().locations_registries_groups_devices_patch(...).doit() -let r = hub.projects().locations_registries_groups_devices_get(...).doit() let r = hub.projects().locations_registries_devices_get(...).doit() ``` @@ -135,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -155,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudiot1/1.0.8+20181002/google_cloudiot1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudiot1/1.0.8+20190321/google_cloudiot1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudiot1/src/lib.rs b/gen/cloudiot1/src/lib.rs index d7f61d7580..768d599c33 100644 --- a/gen/cloudiot1/src/lib.rs +++ b/gen/cloudiot1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Iot* crate version *1.0.8+20181002*, where *20181002* is the exact revision of the *cloudiot:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Iot* crate version *1.0.8+20190321*, where *20190321* is the exact revision of the *cloudiot:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Iot* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/iot). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.CloudIot.html) ... //! //! * projects -//! * [*locations registries create*](struct.ProjectLocationRegistryCreateCall.html), [*locations registries delete*](struct.ProjectLocationRegistryDeleteCall.html), [*locations registries devices config versions list*](struct.ProjectLocationRegistryDeviceConfigVersionListCall.html), [*locations registries devices create*](struct.ProjectLocationRegistryDeviceCreateCall.html), [*locations registries devices delete*](struct.ProjectLocationRegistryDeviceDeleteCall.html), [*locations registries devices get*](struct.ProjectLocationRegistryDeviceGetCall.html), [*locations registries devices list*](struct.ProjectLocationRegistryDeviceListCall.html), [*locations registries devices modify cloud to device config*](struct.ProjectLocationRegistryDeviceModifyCloudToDeviceConfigCall.html), [*locations registries devices patch*](struct.ProjectLocationRegistryDevicePatchCall.html), [*locations registries devices send command to device*](struct.ProjectLocationRegistryDeviceSendCommandToDeviceCall.html), [*locations registries devices states list*](struct.ProjectLocationRegistryDeviceStateListCall.html), [*locations registries get*](struct.ProjectLocationRegistryGetCall.html), [*locations registries get iam policy*](struct.ProjectLocationRegistryGetIamPolicyCall.html), [*locations registries groups devices config versions list*](struct.ProjectLocationRegistryGroupDeviceConfigVersionListCall.html), [*locations registries groups devices get*](struct.ProjectLocationRegistryGroupDeviceGetCall.html), [*locations registries groups devices list*](struct.ProjectLocationRegistryGroupDeviceListCall.html), [*locations registries groups devices modify cloud to device config*](struct.ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall.html), [*locations registries groups devices patch*](struct.ProjectLocationRegistryGroupDevicePatchCall.html), [*locations registries groups devices send command to device*](struct.ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall.html), [*locations registries groups devices states list*](struct.ProjectLocationRegistryGroupDeviceStateListCall.html), [*locations registries groups get iam policy*](struct.ProjectLocationRegistryGroupGetIamPolicyCall.html), [*locations registries groups set iam policy*](struct.ProjectLocationRegistryGroupSetIamPolicyCall.html), [*locations registries groups test iam permissions*](struct.ProjectLocationRegistryGroupTestIamPermissionCall.html), [*locations registries list*](struct.ProjectLocationRegistryListCall.html), [*locations registries patch*](struct.ProjectLocationRegistryPatchCall.html), [*locations registries set iam policy*](struct.ProjectLocationRegistrySetIamPolicyCall.html) and [*locations registries test iam permissions*](struct.ProjectLocationRegistryTestIamPermissionCall.html) +//! * [*locations registries bind device to gateway*](struct.ProjectLocationRegistryBindDeviceToGatewayCall.html), [*locations registries create*](struct.ProjectLocationRegistryCreateCall.html), [*locations registries delete*](struct.ProjectLocationRegistryDeleteCall.html), [*locations registries devices config versions list*](struct.ProjectLocationRegistryDeviceConfigVersionListCall.html), [*locations registries devices create*](struct.ProjectLocationRegistryDeviceCreateCall.html), [*locations registries devices delete*](struct.ProjectLocationRegistryDeviceDeleteCall.html), [*locations registries devices get*](struct.ProjectLocationRegistryDeviceGetCall.html), [*locations registries devices list*](struct.ProjectLocationRegistryDeviceListCall.html), [*locations registries devices modify cloud to device config*](struct.ProjectLocationRegistryDeviceModifyCloudToDeviceConfigCall.html), [*locations registries devices patch*](struct.ProjectLocationRegistryDevicePatchCall.html), [*locations registries devices send command to device*](struct.ProjectLocationRegistryDeviceSendCommandToDeviceCall.html), [*locations registries devices states list*](struct.ProjectLocationRegistryDeviceStateListCall.html), [*locations registries get*](struct.ProjectLocationRegistryGetCall.html), [*locations registries get iam policy*](struct.ProjectLocationRegistryGetIamPolicyCall.html), [*locations registries groups bind device to gateway*](struct.ProjectLocationRegistryGroupBindDeviceToGatewayCall.html), [*locations registries groups devices config versions list*](struct.ProjectLocationRegistryGroupDeviceConfigVersionListCall.html), [*locations registries groups devices get*](struct.ProjectLocationRegistryGroupDeviceGetCall.html), [*locations registries groups devices list*](struct.ProjectLocationRegistryGroupDeviceListCall.html), [*locations registries groups devices modify cloud to device config*](struct.ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall.html), [*locations registries groups devices patch*](struct.ProjectLocationRegistryGroupDevicePatchCall.html), [*locations registries groups devices send command to device*](struct.ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall.html), [*locations registries groups devices states list*](struct.ProjectLocationRegistryGroupDeviceStateListCall.html), [*locations registries groups get iam policy*](struct.ProjectLocationRegistryGroupGetIamPolicyCall.html), [*locations registries groups set iam policy*](struct.ProjectLocationRegistryGroupSetIamPolicyCall.html), [*locations registries groups test iam permissions*](struct.ProjectLocationRegistryGroupTestIamPermissionCall.html), [*locations registries groups unbind device from gateway*](struct.ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall.html), [*locations registries list*](struct.ProjectLocationRegistryListCall.html), [*locations registries patch*](struct.ProjectLocationRegistryPatchCall.html), [*locations registries set iam policy*](struct.ProjectLocationRegistrySetIamPolicyCall.html), [*locations registries test iam permissions*](struct.ProjectLocationRegistryTestIamPermissionCall.html) and [*locations registries unbind device from gateway*](struct.ProjectLocationRegistryUnbindDeviceFromGatewayCall.html) //! //! //! @@ -47,10 +47,10 @@ //! Or specifically ... //! //! ```ignore +//! let r = hub.projects().locations_registries_groups_devices_get(...).doit() //! let r = hub.projects().locations_registries_devices_create(...).doit() //! let r = hub.projects().locations_registries_devices_patch(...).doit() //! let r = hub.projects().locations_registries_groups_devices_patch(...).doit() -//! let r = hub.projects().locations_registries_groups_devices_get(...).doit() //! let r = hub.projects().locations_registries_devices_get(...).doit() //! ``` //! @@ -422,60 +422,6 @@ pub struct ListDeviceStatesResponse { impl ResponseResult for ListDeviceStatesResponse {} -/// Response for `SendCommandToDevice`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations registries groups devices send command to device projects](struct.ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall.html) (response) -/// * [locations registries devices send command to device projects](struct.ProjectLocationRegistryDeviceSendCommandToDeviceCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SendCommandToDeviceResponse { _never_set: Option } - -impl ResponseResult for SendCommandToDeviceResponse {} - - -/// Request message for `GetIamPolicy` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations registries get iam policy projects](struct.ProjectLocationRegistryGetIamPolicyCall.html) (request) -/// * [locations registries groups get iam policy projects](struct.ProjectLocationRegistryGroupGetIamPolicyCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetIamPolicyRequest { _never_set: Option } - -impl RequestValue for GetIamPolicyRequest {} - - -/// Request message for `TestIamPermissions` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations registries groups test iam permissions projects](struct.ProjectLocationRegistryGroupTestIamPermissionCall.html) (request) -/// * [locations registries test iam permissions projects](struct.ProjectLocationRegistryTestIamPermissionCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TestIamPermissionsRequest { - /// The set of permissions to check for the `resource`. Permissions with - /// wildcards (such as '*' or 'storage.*') are not allowed. For more - /// information see - /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - pub permissions: Option>, -} - -impl RequestValue for TestIamPermissionsRequest {} - - /// Request message for `SetIamPolicy` method. /// /// # Activities @@ -498,51 +444,6 @@ pub struct SetIamPolicyRequest { impl RequestValue for SetIamPolicyRequest {} -/// A server-stored registry credential used to validate device credentials. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RegistryCredential { - /// A public key certificate used to verify the device credentials. - #[serde(rename="publicKeyCertificate")] - pub public_key_certificate: Option, -} - -impl Part for RegistryCredential {} - - -/// Represents an expression text. Example: -/// -/// title: "User account presence" -/// description: "Determines whether the request has a user account" -/// expression: "size(request.user) > 0" -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, - /// Textual representation of an expression in - /// Common Expression Language syntax. - /// - /// The application context of the containing message determines which - /// well-known feature set of CEL is supported. - pub expression: Option, - /// An optional string indicating the location of the expression for error - /// reporting, e.g. a file name and a position in the file. - pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, -} - -impl Part for Expr {} - - /// The configuration of MQTT for a device registry. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -598,53 +499,6 @@ pub struct DeviceConfig { impl ResponseResult for DeviceConfig {} -/// Response for `ListDeviceRegistries`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations registries list projects](struct.ProjectLocationRegistryListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListDeviceRegistriesResponse { - /// If not empty, indicates that there may be more registries that match the - /// request; this value should be passed in a new - /// `ListDeviceRegistriesRequest`. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The registries that matched the query. - #[serde(rename="deviceRegistries")] - pub device_registries: Option>, -} - -impl ResponseResult for ListDeviceRegistriesResponse {} - - -/// Response for `ListDevices`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations registries devices list projects](struct.ProjectLocationRegistryDeviceListCall.html) (response) -/// * [locations registries groups devices list projects](struct.ProjectLocationRegistryGroupDeviceListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListDevicesResponse { - /// If not empty, indicates that there may be more devices that match the - /// request; this value should be passed in a new `ListDevicesRequest`. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The devices that match the request. - pub devices: Option>, -} - -impl ResponseResult for ListDevicesResponse {} - - /// Defines an Identity and Access Management (IAM) policy. It is used to /// specify access control policies for Cloud Platform resources. /// @@ -724,6 +578,32 @@ pub struct Policy { impl ResponseResult for Policy {} +/// Request for `UnbindDeviceFromGateway`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations registries groups unbind device from gateway projects](struct.ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall.html) (request) +/// * [locations registries unbind device from gateway projects](struct.ProjectLocationRegistryUnbindDeviceFromGatewayCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UnbindDeviceFromGatewayRequest { + /// The value of `gateway_id` can be either the device numeric ID or the + /// user-defined device identifier. + #[serde(rename="gatewayId")] + pub gateway_id: Option, + /// The device to disassociate from the specified gateway. The value of + /// `device_id` can be either the device numeric ID or the user-defined device + /// identifier. + #[serde(rename="deviceId")] + pub device_id: Option, +} + +impl RequestValue for UnbindDeviceFromGatewayRequest {} + + /// The device state, as reported by the device. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -742,44 +622,17 @@ pub struct DeviceState { impl Part for DeviceState {} -/// Details of an X.509 certificate. For informational purposes only. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct X509CertificateDetails { - /// The time the certificate becomes valid. - #[serde(rename="startTime")] - pub start_time: Option, - /// The algorithm used to sign the certificate. - #[serde(rename="signatureAlgorithm")] - pub signature_algorithm: Option, - /// The entity the certificate and public key belong to. - pub subject: Option, - /// The time the certificate becomes invalid. - #[serde(rename="expiryTime")] - pub expiry_time: Option, - /// The type of public key in the certificate. - #[serde(rename="publicKeyType")] - pub public_key_type: Option, - /// The entity that signed the certificate. - pub issuer: Option, -} - -impl Part for X509CertificateDetails {} - - -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -840,22 +693,25 @@ pub struct Status { impl Part for Status {} -/// A public key certificate format and data. +/// Response for `ListDeviceConfigVersions`. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations registries devices config versions list projects](struct.ProjectLocationRegistryDeviceConfigVersionListCall.html) (response) +/// * [locations registries groups devices config versions list projects](struct.ProjectLocationRegistryGroupDeviceConfigVersionListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PublicKeyCertificate { - /// [Output only] The certificate details. Used only for X.509 certificates. - #[serde(rename="x509Details")] - pub x509_details: Option, - /// The certificate data. - pub certificate: Option, - /// The certificate format. - pub format: Option, +pub struct ListDeviceConfigVersionsResponse { + /// The device configuration for the last few versions. Versions are listed + /// in decreasing order, starting from the most recent one. + #[serde(rename="deviceConfigs")] + pub device_configs: Option>, } -impl Part for PublicKeyCertificate {} +impl ResponseResult for ListDeviceConfigVersionsResponse {} /// Response message for `TestIamPermissions` method. @@ -878,122 +734,45 @@ pub struct TestIamPermissionsResponse { impl ResponseResult for TestIamPermissionsResponse {} -/// A container for a group of devices. +/// Gateway-related configuration and state. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GatewayConfig { + /// Indicates whether the device is a gateway. + #[serde(rename="gatewayType")] + pub gateway_type: Option, + /// [Output only] The ID of the gateway the device accessed most recently. + #[serde(rename="lastAccessedGatewayId")] + pub last_accessed_gateway_id: Option, + /// Indicates how to authorize and/or authenticate devices to access the + /// gateway. + #[serde(rename="gatewayAuthMethod")] + pub gateway_auth_method: Option, + /// [Output only] The most recent time at which the device accessed the gateway + /// specified in `last_accessed_gateway`. + #[serde(rename="lastAccessedGatewayTime")] + pub last_accessed_gateway_time: Option, +} + +impl Part for GatewayConfig {} + + +/// Response for `UnbindDeviceFromGateway`. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations registries patch projects](struct.ProjectLocationRegistryPatchCall.html) (request|response) -/// * [locations registries create projects](struct.ProjectLocationRegistryCreateCall.html) (request|response) -/// * [locations registries get projects](struct.ProjectLocationRegistryGetCall.html) (response) +/// * [locations registries groups unbind device from gateway projects](struct.ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall.html) (response) +/// * [locations registries unbind device from gateway projects](struct.ProjectLocationRegistryUnbindDeviceFromGatewayCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeviceRegistry { - /// The resource path name. For example, - /// `projects/example-project/locations/us-central1/registries/my-registry`. - pub name: Option, - /// The configuration for notification of new states received from the device. - /// State updates are guaranteed to be stored in the state history, but - /// notifications to Cloud Pub/Sub are not guaranteed. For example, if - /// permissions are misconfigured or the specified topic doesn't exist, no - /// notification will be published but the state will still be stored in Cloud - /// IoT Core. - #[serde(rename="stateNotificationConfig")] - pub state_notification_config: Option, - /// **Beta Feature** - /// - /// The default logging verbosity for activity from devices in this registry. - /// The verbosity level can be overridden by Device.log_level. - #[serde(rename="logLevel")] - pub log_level: Option, - /// The MQTT configuration for this device registry. - #[serde(rename="mqttConfig")] - pub mqtt_config: Option, - /// The DeviceService (HTTP) configuration for this device registry. - #[serde(rename="httpConfig")] - pub http_config: Option, - /// The configuration for notification of telemetry events received from the - /// device. All telemetry events that were successfully published by the - /// device and acknowledged by Cloud IoT Core are guaranteed to be - /// delivered to Cloud Pub/Sub. If multiple configurations match a message, - /// only the first matching configuration is used. If you try to publish a - /// device telemetry event using MQTT without specifying a Cloud Pub/Sub topic - /// for the device's registry, the connection closes automatically. If you try - /// to do so using an HTTP connection, an error is returned. Up to 10 - /// configurations may be provided. - #[serde(rename="eventNotificationConfigs")] - pub event_notification_configs: Option>, - /// The credentials used to verify the device credentials. No more than 10 - /// credentials can be bound to a single registry at a time. The verification - /// process occurs at the time of device creation or update. If this field is - /// empty, no verification is performed. Otherwise, the credentials of a newly - /// created device or added credentials of an updated device should be signed - /// with one of these registry credentials. - /// - /// Note, however, that existing devices will never be affected by - /// modifications to this list of credentials: after a device has been - /// successfully created in a registry, it should be able to connect even if - /// its registry credentials are revoked, deleted, or modified. - pub credentials: Option>, - /// The identifier of this device registry. For example, `myRegistry`. - pub id: Option, -} +pub struct UnbindDeviceFromGatewayResponse { _never_set: Option } -impl RequestValue for DeviceRegistry {} -impl ResponseResult for DeviceRegistry {} - - -/// Response for `ListDeviceConfigVersions`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations registries devices config versions list projects](struct.ProjectLocationRegistryDeviceConfigVersionListCall.html) (response) -/// * [locations registries groups devices config versions list projects](struct.ProjectLocationRegistryGroupDeviceConfigVersionListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListDeviceConfigVersionsResponse { - /// The device configuration for the last few versions. Versions are listed - /// in decreasing order, starting from the most recent one. - #[serde(rename="deviceConfigs")] - pub device_configs: Option>, -} - -impl ResponseResult for ListDeviceConfigVersionsResponse {} - - -/// The configuration for notification of new states received from the device. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StateNotificationConfig { - /// A Cloud Pub/Sub topic name. For example, - /// `projects/myProject/topics/deviceEvents`. - #[serde(rename="pubsubTopicName")] - pub pubsub_topic_name: Option, -} - -impl Part for StateNotificationConfig {} - - -/// A public key format and data. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PublicKeyCredential { - /// The key data. - pub key: Option, - /// The format of the key. - pub format: Option, -} - -impl Part for PublicKeyCredential {} +impl ResponseResult for UnbindDeviceFromGatewayResponse {} /// A server-stored device credential used for authentication. @@ -1025,65 +804,6 @@ pub struct DeviceCredential { impl Part for DeviceCredential {} -/// The configuration of the HTTP bridge for a device registry. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct HttpConfig { - /// If enabled, allows devices to use DeviceService via the HTTP protocol. - /// Otherwise, any requests to DeviceService will fail for this registry. - #[serde(rename="httpEnabledState")] - pub http_enabled_state: Option, -} - -impl Part for HttpConfig {} - - -/// Associates `members` with a `role`. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Binding { - /// Role that is assigned to `members`. - /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. - pub role: Option, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. - /// `members` can have the following values: - /// - /// * `allUsers`: A special identifier that represents anyone who is - /// on the internet; with or without a Google account. - /// - /// * `allAuthenticatedUsers`: A special identifier that represents anyone - /// who is authenticated with a Google account or a service account. - /// - /// * `user:{emailid}`: An email address that represents a specific Google - /// account. For example, `alice@gmail.com` . - /// - /// - /// * `serviceAccount:{emailid}`: An email address that represents a service - /// account. For example, `my-other-app@appspot.gserviceaccount.com`. - /// - /// * `group:{emailid}`: An email address that represents a Google group. - /// For example, `admins@example.com`. - /// - /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the - /// users of that domain. For example, `google.com` or `example.com`. - /// - /// - pub members: Option>, -} - -impl Part for Binding {} - - /// A generic empty message that you can re-use to avoid defining duplicated /// empty messages in your APIs. A typical example is to use it as the request /// or the response type of an API method. For instance: @@ -1115,18 +835,17 @@ impl ResponseResult for Empty {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// +/// * [locations registries groups devices get projects](struct.ProjectLocationRegistryGroupDeviceGetCall.html) (response) /// * [locations registries devices create projects](struct.ProjectLocationRegistryDeviceCreateCall.html) (request|response) /// * [locations registries devices patch projects](struct.ProjectLocationRegistryDevicePatchCall.html) (request|response) /// * [locations registries groups devices patch projects](struct.ProjectLocationRegistryGroupDevicePatchCall.html) (request|response) -/// * [locations registries groups devices get projects](struct.ProjectLocationRegistryGroupDeviceGetCall.html) (response) /// * [locations registries devices get projects](struct.ProjectLocationRegistryDeviceGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Device { - /// [Output only] The last time a cloud-to-device config version was sent to - /// the device. - #[serde(rename="lastConfigSendTime")] - pub last_config_send_time: Option, + /// Gateway-related configuration and state. + #[serde(rename="gatewayConfig")] + pub gateway_config: Option, /// [Output only] The time the most recent error occurred, such as a failure to /// publish to Cloud Pub/Sub. This field is the timestamp of /// 'last_error_status'. @@ -1136,6 +855,10 @@ pub struct Device { /// more compact way to identify devices, and it is globally unique. #[serde(rename="numId")] pub num_id: Option, + /// [Output only] The last time a cloud-to-device config version was sent to + /// the device. + #[serde(rename="lastConfigSendTime")] + pub last_config_send_time: Option, /// [Output only] The error message of the most recent error, such as a failure /// to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this /// field. If no errors have occurred, this field has an empty message @@ -1246,6 +969,369 @@ pub struct ModifyCloudToDeviceConfigRequest { impl RequestValue for ModifyCloudToDeviceConfigRequest {} +/// A public key format and data. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PublicKeyCredential { + /// The key data. + pub key: Option, + /// The format of the key. + pub format: Option, +} + +impl Part for PublicKeyCredential {} + + +/// Response for `SendCommandToDevice`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations registries groups devices send command to device projects](struct.ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall.html) (response) +/// * [locations registries devices send command to device projects](struct.ProjectLocationRegistryDeviceSendCommandToDeviceCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SendCommandToDeviceResponse { _never_set: Option } + +impl ResponseResult for SendCommandToDeviceResponse {} + + +/// Request message for `GetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations registries get iam policy projects](struct.ProjectLocationRegistryGetIamPolicyCall.html) (request) +/// * [locations registries groups get iam policy projects](struct.ProjectLocationRegistryGroupGetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetIamPolicyRequest { _never_set: Option } + +impl RequestValue for GetIamPolicyRequest {} + + +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations registries groups test iam permissions projects](struct.ProjectLocationRegistryGroupTestIamPermissionCall.html) (request) +/// * [locations registries test iam permissions projects](struct.ProjectLocationRegistryTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, +} + +impl RequestValue for TestIamPermissionsRequest {} + + +/// The configuration for notification of new states received from the device. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StateNotificationConfig { + /// A Cloud Pub/Sub topic name. For example, + /// `projects/myProject/topics/deviceEvents`. + #[serde(rename="pubsubTopicName")] + pub pubsub_topic_name: Option, +} + +impl Part for StateNotificationConfig {} + + +/// A server-stored registry credential used to validate device credentials. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RegistryCredential { + /// A public key certificate used to verify the device credentials. + #[serde(rename="publicKeyCertificate")] + pub public_key_certificate: Option, +} + +impl Part for RegistryCredential {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// Response for `ListDevices`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations registries devices list projects](struct.ProjectLocationRegistryDeviceListCall.html) (response) +/// * [locations registries groups devices list projects](struct.ProjectLocationRegistryGroupDeviceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListDevicesResponse { + /// If not empty, indicates that there may be more devices that match the + /// request; this value should be passed in a new `ListDevicesRequest`. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The devices that match the request. + pub devices: Option>, +} + +impl ResponseResult for ListDevicesResponse {} + + +/// Response for `BindDeviceToGateway`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations registries bind device to gateway projects](struct.ProjectLocationRegistryBindDeviceToGatewayCall.html) (response) +/// * [locations registries groups bind device to gateway projects](struct.ProjectLocationRegistryGroupBindDeviceToGatewayCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BindDeviceToGatewayResponse { _never_set: Option } + +impl ResponseResult for BindDeviceToGatewayResponse {} + + +/// Details of an X.509 certificate. For informational purposes only. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct X509CertificateDetails { + /// The time the certificate becomes valid. + #[serde(rename="startTime")] + pub start_time: Option, + /// The entity that signed the certificate. + pub issuer: Option, + /// The entity the certificate and public key belong to. + pub subject: Option, + /// The time the certificate becomes invalid. + #[serde(rename="expiryTime")] + pub expiry_time: Option, + /// The type of public key in the certificate. + #[serde(rename="publicKeyType")] + pub public_key_type: Option, + /// The algorithm used to sign the certificate. + #[serde(rename="signatureAlgorithm")] + pub signature_algorithm: Option, +} + +impl Part for X509CertificateDetails {} + + +/// A public key certificate format and data. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PublicKeyCertificate { + /// [Output only] The certificate details. Used only for X.509 certificates. + #[serde(rename="x509Details")] + pub x509_details: Option, + /// The certificate data. + pub certificate: Option, + /// The certificate format. + pub format: Option, +} + +impl Part for PublicKeyCertificate {} + + +/// A container for a group of devices. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations registries patch projects](struct.ProjectLocationRegistryPatchCall.html) (request|response) +/// * [locations registries create projects](struct.ProjectLocationRegistryCreateCall.html) (request|response) +/// * [locations registries get projects](struct.ProjectLocationRegistryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeviceRegistry { + /// The resource path name. For example, + /// `projects/example-project/locations/us-central1/registries/my-registry`. + pub name: Option, + /// The configuration for notification of new states received from the device. + /// State updates are guaranteed to be stored in the state history, but + /// notifications to Cloud Pub/Sub are not guaranteed. For example, if + /// permissions are misconfigured or the specified topic doesn't exist, no + /// notification will be published but the state will still be stored in Cloud + /// IoT Core. + #[serde(rename="stateNotificationConfig")] + pub state_notification_config: Option, + /// **Beta Feature** + /// + /// The default logging verbosity for activity from devices in this registry. + /// The verbosity level can be overridden by Device.log_level. + #[serde(rename="logLevel")] + pub log_level: Option, + /// The MQTT configuration for this device registry. + #[serde(rename="mqttConfig")] + pub mqtt_config: Option, + /// The DeviceService (HTTP) configuration for this device registry. + #[serde(rename="httpConfig")] + pub http_config: Option, + /// The configuration for notification of telemetry events received from the + /// device. All telemetry events that were successfully published by the + /// device and acknowledged by Cloud IoT Core are guaranteed to be + /// delivered to Cloud Pub/Sub. If multiple configurations match a message, + /// only the first matching configuration is used. If you try to publish a + /// device telemetry event using MQTT without specifying a Cloud Pub/Sub topic + /// for the device's registry, the connection closes automatically. If you try + /// to do so using an HTTP connection, an error is returned. Up to 10 + /// configurations may be provided. + #[serde(rename="eventNotificationConfigs")] + pub event_notification_configs: Option>, + /// The credentials used to verify the device credentials. No more than 10 + /// credentials can be bound to a single registry at a time. The verification + /// process occurs at the time of device creation or update. If this field is + /// empty, no verification is performed. Otherwise, the credentials of a newly + /// created device or added credentials of an updated device should be signed + /// with one of these registry credentials. + /// + /// Note, however, that existing devices will never be affected by + /// modifications to this list of credentials: after a device has been + /// successfully created in a registry, it should be able to connect even if + /// its registry credentials are revoked, deleted, or modified. + pub credentials: Option>, + /// The identifier of this device registry. For example, `myRegistry`. + pub id: Option, +} + +impl RequestValue for DeviceRegistry {} +impl ResponseResult for DeviceRegistry {} + + +/// Response for `ListDeviceRegistries`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations registries list projects](struct.ProjectLocationRegistryListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListDeviceRegistriesResponse { + /// If not empty, indicates that there may be more registries that match the + /// request; this value should be passed in a new + /// `ListDeviceRegistriesRequest`. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The registries that matched the query. + #[serde(rename="deviceRegistries")] + pub device_registries: Option>, +} + +impl ResponseResult for ListDeviceRegistriesResponse {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + +/// The configuration of the HTTP bridge for a device registry. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HttpConfig { + /// If enabled, allows devices to use DeviceService via the HTTP protocol. + /// Otherwise, any requests to DeviceService will fail for this registry. + #[serde(rename="httpEnabledState")] + pub http_enabled_state: Option, +} + +impl Part for HttpConfig {} + + /// Request for `SendCommandToDevice`. /// /// # Activities @@ -1272,6 +1358,32 @@ pub struct SendCommandToDeviceRequest { impl RequestValue for SendCommandToDeviceRequest {} +/// Request for `BindDeviceToGateway`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations registries bind device to gateway projects](struct.ProjectLocationRegistryBindDeviceToGatewayCall.html) (request) +/// * [locations registries groups bind device to gateway projects](struct.ProjectLocationRegistryGroupBindDeviceToGatewayCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BindDeviceToGatewayRequest { + /// The value of `gateway_id` can be either the device numeric ID or the + /// user-defined device identifier. + #[serde(rename="gatewayId")] + pub gateway_id: Option, + /// The device to associate with the specified gateway. The value of + /// `device_id` can be either the device numeric ID or the user-defined device + /// identifier. + #[serde(rename="deviceId")] + pub device_id: Option, +} + +impl RequestValue for BindDeviceToGatewayRequest {} + + // ################### // MethodBuilders ### @@ -1301,7 +1413,7 @@ impl RequestValue for SendCommandToDeviceRequest {} /// ::default(), None); /// let mut hub = CloudIot::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `locations_registries_create(...)`, `locations_registries_delete(...)`, `locations_registries_devices_config_versions_list(...)`, `locations_registries_devices_create(...)`, `locations_registries_devices_delete(...)`, `locations_registries_devices_get(...)`, `locations_registries_devices_list(...)`, `locations_registries_devices_modify_cloud_to_device_config(...)`, `locations_registries_devices_patch(...)`, `locations_registries_devices_send_command_to_device(...)`, `locations_registries_devices_states_list(...)`, `locations_registries_get(...)`, `locations_registries_get_iam_policy(...)`, `locations_registries_groups_devices_config_versions_list(...)`, `locations_registries_groups_devices_get(...)`, `locations_registries_groups_devices_list(...)`, `locations_registries_groups_devices_modify_cloud_to_device_config(...)`, `locations_registries_groups_devices_patch(...)`, `locations_registries_groups_devices_send_command_to_device(...)`, `locations_registries_groups_devices_states_list(...)`, `locations_registries_groups_get_iam_policy(...)`, `locations_registries_groups_set_iam_policy(...)`, `locations_registries_groups_test_iam_permissions(...)`, `locations_registries_list(...)`, `locations_registries_patch(...)`, `locations_registries_set_iam_policy(...)` and `locations_registries_test_iam_permissions(...)` +/// // like `locations_registries_bind_device_to_gateway(...)`, `locations_registries_create(...)`, `locations_registries_delete(...)`, `locations_registries_devices_config_versions_list(...)`, `locations_registries_devices_create(...)`, `locations_registries_devices_delete(...)`, `locations_registries_devices_get(...)`, `locations_registries_devices_list(...)`, `locations_registries_devices_modify_cloud_to_device_config(...)`, `locations_registries_devices_patch(...)`, `locations_registries_devices_send_command_to_device(...)`, `locations_registries_devices_states_list(...)`, `locations_registries_get(...)`, `locations_registries_get_iam_policy(...)`, `locations_registries_groups_bind_device_to_gateway(...)`, `locations_registries_groups_devices_config_versions_list(...)`, `locations_registries_groups_devices_get(...)`, `locations_registries_groups_devices_list(...)`, `locations_registries_groups_devices_modify_cloud_to_device_config(...)`, `locations_registries_groups_devices_patch(...)`, `locations_registries_groups_devices_send_command_to_device(...)`, `locations_registries_groups_devices_states_list(...)`, `locations_registries_groups_get_iam_policy(...)`, `locations_registries_groups_set_iam_policy(...)`, `locations_registries_groups_test_iam_permissions(...)`, `locations_registries_groups_unbind_device_from_gateway(...)`, `locations_registries_list(...)`, `locations_registries_patch(...)`, `locations_registries_set_iam_policy(...)`, `locations_registries_test_iam_permissions(...)` and `locations_registries_unbind_device_from_gateway(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -1330,6 +1442,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { _parent: parent.to_string(), _page_token: Default::default(), _page_size: Default::default(), + _gateway_list_options_gateway_type: Default::default(), + _gateway_list_options_associations_gateway_id: Default::default(), + _gateway_list_options_associations_device_id: Default::default(), _field_mask: Default::default(), _device_num_ids: Default::default(), _device_ids: Default::default(), @@ -1339,6 +1454,46 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes the association between the device and the gateway. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the registry. For example, + /// `projects/example-project/locations/us-central1/registries/my-registry`. + pub fn locations_registries_groups_unbind_device_from_gateway(&self, request: UnbindDeviceFromGatewayRequest, parent: &str) -> ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall<'a, C, A> { + ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the association between the device and the gateway. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the registry. For example, + /// `projects/example-project/locations/us-central1/registries/my-registry`. + pub fn locations_registries_unbind_device_from_gateway(&self, request: UnbindDeviceFromGatewayRequest, parent: &str) -> ProjectLocationRegistryUnbindDeviceFromGatewayCall<'a, C, A> { + ProjectLocationRegistryUnbindDeviceFromGatewayCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates a device registry configuration. @@ -1422,6 +1577,26 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Associates the device with the gateway. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the registry. For example, + /// `projects/example-project/locations/us-central1/registries/my-registry`. + pub fn locations_registries_bind_device_to_gateway(&self, request: BindDeviceToGatewayRequest, parent: &str) -> ProjectLocationRegistryBindDeviceToGatewayCall<'a, C, A> { + ProjectLocationRegistryBindDeviceToGatewayCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Modifies the configuration for the device, which is eventually sent from @@ -1602,6 +1777,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { _parent: parent.to_string(), _page_token: Default::default(), _page_size: Default::default(), + _gateway_list_options_gateway_type: Default::default(), + _gateway_list_options_associations_gateway_id: Default::default(), + _gateway_list_options_associations_device_id: Default::default(), _field_mask: Default::default(), _device_num_ids: Default::default(), _device_ids: Default::default(), @@ -1912,6 +2090,26 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Associates the device with the gateway. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the registry. For example, + /// `projects/example-project/locations/us-central1/registries/my-registry`. + pub fn locations_registries_groups_bind_device_to_gateway(&self, request: BindDeviceToGatewayRequest, parent: &str) -> ProjectLocationRegistryGroupBindDeviceToGatewayCall<'a, C, A> { + ProjectLocationRegistryGroupBindDeviceToGatewayCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -1952,9 +2150,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// let result = hub.projects().locations_registries_devices_list("parent") /// .page_token("accusam") /// .page_size(-8) -/// .field_mask("justo") -/// .add_device_num_ids("amet.") -/// .add_device_ids("erat") +/// .gateway_list_options_gateway_type("justo") +/// .gateway_list_options_associations_gateway_id("amet.") +/// .gateway_list_options_associations_device_id("erat") +/// .field_mask("labore") +/// .add_device_num_ids("sea") +/// .add_device_ids("nonumy") /// .doit(); /// # } /// ``` @@ -1965,6 +2166,9 @@ pub struct ProjectLocationRegistryDeviceListCall<'a, C, A> _parent: String, _page_token: Option, _page_size: Option, + _gateway_list_options_gateway_type: Option, + _gateway_list_options_associations_gateway_id: Option, + _gateway_list_options_associations_device_id: Option, _field_mask: Option, _device_num_ids: Vec, _device_ids: Vec, @@ -1990,7 +2194,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu }; dlg.begin(MethodInfo { id: "cloudiot.projects.locations.registries.devices.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(11 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -1998,6 +2202,15 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu if let Some(value) = self._page_size { params.push(("pageSize", value.to_string())); } + if let Some(value) = self._gateway_list_options_gateway_type { + params.push(("gatewayListOptions.gatewayType", value.to_string())); + } + if let Some(value) = self._gateway_list_options_associations_gateway_id { + params.push(("gatewayListOptions.associationsGatewayId", value.to_string())); + } + if let Some(value) = self._gateway_list_options_associations_device_id { + params.push(("gatewayListOptions.associationsDeviceId", value.to_string())); + } if let Some(value) = self._field_mask { params.push(("fieldMask", value.to_string())); } @@ -2011,7 +2224,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu params.push(("deviceIds", f.to_string())); } } - for &field in ["alt", "parent", "pageToken", "pageSize", "fieldMask", "deviceNumIds", "deviceIds"].iter() { + for &field in ["alt", "parent", "pageToken", "pageSize", "gatewayListOptions.gatewayType", "gatewayListOptions.associationsGatewayId", "gatewayListOptions.associationsDeviceId", "fieldMask", "deviceNumIds", "deviceIds"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2037,7 +2250,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2053,10 +2266,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2076,7 +2286,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2159,6 +2369,35 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu self._page_size = Some(new_value); self } + /// If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY` + /// is specified, only non-gateway devices are returned. If + /// `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned. + /// + /// Sets the *gateway list options.gateway type* query property to the given value. + pub fn gateway_list_options_gateway_type(mut self, new_value: &str) -> ProjectLocationRegistryDeviceListCall<'a, C, A> { + self._gateway_list_options_gateway_type = Some(new_value.to_string()); + self + } + /// If set, only devices associated with the specified gateway are returned. + /// The gateway ID can be numeric (`num_id`) or the user-defined string + /// (`id`). For example, if `123` is specified, only devices bound to the + /// gateway with `num_id` 123 are returned. + /// + /// Sets the *gateway list options.associations gateway id* query property to the given value. + pub fn gateway_list_options_associations_gateway_id(mut self, new_value: &str) -> ProjectLocationRegistryDeviceListCall<'a, C, A> { + self._gateway_list_options_associations_gateway_id = Some(new_value.to_string()); + self + } + /// If set, returns only the gateways with which the specified device is + /// associated. The device ID can be numeric (`num_id`) or the user-defined + /// string (`id`). For example, if `456` is specified, returns only the + /// gateways to which the device with `num_id` 456 is bound. + /// + /// Sets the *gateway list options.associations device id* query property to the given value. + pub fn gateway_list_options_associations_device_id(mut self, new_value: &str) -> ProjectLocationRegistryDeviceListCall<'a, C, A> { + self._gateway_list_options_associations_device_id = Some(new_value.to_string()); + self + } /// The fields of the `Device` resource to be returned in the response. The /// fields `id` and `num_id` are always returned, along with any /// other fields specified. @@ -2201,7 +2440,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2209,12 +2448,12 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryDeviceListCall<'a, C, A> @@ -2249,6 +2488,566 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu } +/// Deletes the association between the device and the gateway. +/// +/// A builder for the *locations.registries.groups.unbindDeviceFromGateway* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudiot1 as cloudiot1; +/// use cloudiot1::UnbindDeviceFromGatewayRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudiot1::CloudIot; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIot::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UnbindDeviceFromGatewayRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_registries_groups_unbind_device_from_gateway(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIot, + _request: UnbindDeviceFromGatewayRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UnbindDeviceFromGatewayResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudiot.projects.locations.registries.groups.unbindDeviceFromGateway", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}:unbindDeviceFromGateway"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UnbindDeviceFromGatewayRequest) -> ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the registry. For example, + /// `projects/example-project/locations/us-central1/registries/my-registry`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationRegistryGroupUnbindDeviceFromGatewayCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the association between the device and the gateway. +/// +/// A builder for the *locations.registries.unbindDeviceFromGateway* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudiot1 as cloudiot1; +/// use cloudiot1::UnbindDeviceFromGatewayRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudiot1::CloudIot; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIot::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UnbindDeviceFromGatewayRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_registries_unbind_device_from_gateway(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationRegistryUnbindDeviceFromGatewayCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIot, + _request: UnbindDeviceFromGatewayRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationRegistryUnbindDeviceFromGatewayCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationRegistryUnbindDeviceFromGatewayCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UnbindDeviceFromGatewayResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudiot.projects.locations.registries.unbindDeviceFromGateway", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}:unbindDeviceFromGateway"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UnbindDeviceFromGatewayRequest) -> ProjectLocationRegistryUnbindDeviceFromGatewayCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the registry. For example, + /// `projects/example-project/locations/us-central1/registries/my-registry`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationRegistryUnbindDeviceFromGatewayCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationRegistryUnbindDeviceFromGatewayCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryUnbindDeviceFromGatewayCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationRegistryUnbindDeviceFromGatewayCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates a device registry configuration. /// /// A builder for the *locations.registries.patch* method supported by a *project* resource. @@ -2283,7 +3082,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceListCall<'a, C, A> where C: BorrowMu /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_registries_patch(req, "name") -/// .update_mask("sea") +/// .update_mask("aliquyam") /// .doit(); /// # } /// ``` @@ -2347,7 +3146,7 @@ impl<'a, C, A> ProjectLocationRegistryPatchCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2398,7 +3194,7 @@ impl<'a, C, A> ProjectLocationRegistryPatchCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryPatchCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationRegistryPatchCall<'a, C, A> @@ -2576,7 +3372,7 @@ impl<'a, C, A> ProjectLocationRegistryPatchCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryGroupDeviceGetCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2655,10 +3451,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceGetCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2678,7 +3471,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceGetCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2766,7 +3559,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceGetCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2774,12 +3567,12 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceGetCall<'a, C, A> where C: Borr /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupDeviceGetCall<'a, C, A> @@ -2908,7 +3701,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupSetIamPolicyCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2924,10 +3717,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupSetIamPolicyCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2959,7 +3749,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupSetIamPolicyCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3050,7 +3840,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupSetIamPolicyCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3058,12 +3848,12 @@ impl<'a, C, A> ProjectLocationRegistryGroupSetIamPolicyCall<'a, C, A> where C: B /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupSetIamPolicyCall<'a, C, A> @@ -3127,7 +3917,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupSetIamPolicyCall<'a, C, A> where C: B /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_registries_groups_devices_config_versions_list("name") -/// .num_versions(-31) +/// .num_versions(-34) /// .doit(); /// # } /// ``` @@ -3190,7 +3980,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceConfigVersionListCall<'a, C, A> } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3206,10 +3996,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceConfigVersionListCall<'a, C, A> } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3229,7 +4016,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceConfigVersionListCall<'a, C, A> let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3318,7 +4105,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceConfigVersionListCall<'a, C, A> /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3326,12 +4113,12 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceConfigVersionListCall<'a, C, A> /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupDeviceConfigVersionListCall<'a, C, A> @@ -3366,6 +4153,286 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceConfigVersionListCall<'a, C, A> } +/// Associates the device with the gateway. +/// +/// A builder for the *locations.registries.bindDeviceToGateway* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudiot1 as cloudiot1; +/// use cloudiot1::BindDeviceToGatewayRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudiot1::CloudIot; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIot::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BindDeviceToGatewayRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_registries_bind_device_to_gateway(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationRegistryBindDeviceToGatewayCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIot, + _request: BindDeviceToGatewayRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationRegistryBindDeviceToGatewayCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationRegistryBindDeviceToGatewayCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BindDeviceToGatewayResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudiot.projects.locations.registries.bindDeviceToGateway", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}:bindDeviceToGateway"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BindDeviceToGatewayRequest) -> ProjectLocationRegistryBindDeviceToGatewayCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the registry. For example, + /// `projects/example-project/locations/us-central1/registries/my-registry`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationRegistryBindDeviceToGatewayCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationRegistryBindDeviceToGatewayCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryBindDeviceToGatewayCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationRegistryBindDeviceToGatewayCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Modifies the configuration for the device, which is eventually sent from /// the Cloud IoT Core servers. Returns the modified configuration version and /// its metadata. @@ -3461,7 +4528,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall<' } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3477,10 +4544,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall<' } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3512,7 +4576,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall<' request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3604,7 +4668,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall<' /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3612,12 +4676,12 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall<' /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall<'a, C, A> @@ -3686,7 +4750,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceModifyCloudToDeviceConfigCall<' /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_registries_groups_devices_patch(req, "name") -/// .update_mask("justo") +/// .update_mask("Lorem") /// .doit(); /// # } /// ``` @@ -3750,7 +4814,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDevicePatchCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3766,10 +4830,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDevicePatchCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3801,7 +4862,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDevicePatchCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3905,7 +4966,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDevicePatchCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3913,12 +4974,12 @@ impl<'a, C, A> ProjectLocationRegistryGroupDevicePatchCall<'a, C, A> where C: Bo /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupDevicePatchCall<'a, C, A> @@ -4046,7 +5107,7 @@ impl<'a, C, A> ProjectLocationRegistryCreateCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4097,7 +5155,7 @@ impl<'a, C, A> ProjectLocationRegistryCreateCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryCreateCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationRegistryCreateCall<'a, C, A> @@ -4264,8 +5322,8 @@ impl<'a, C, A> ProjectLocationRegistryCreateCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryListCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4371,7 +5426,7 @@ impl<'a, C, A> ProjectLocationRegistryListCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryListCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationRegistryListCall<'a, C, A> @@ -4612,7 +5667,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupGetIamPolicyCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4628,10 +5683,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupGetIamPolicyCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4663,7 +5715,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupGetIamPolicyCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4754,7 +5806,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupGetIamPolicyCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4762,12 +5814,12 @@ impl<'a, C, A> ProjectLocationRegistryGroupGetIamPolicyCall<'a, C, A> where C: B /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupGetIamPolicyCall<'a, C, A> @@ -4831,7 +5883,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupGetIamPolicyCall<'a, C, A> where C: B /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_registries_devices_states_list("name") -/// .num_states(-21) +/// .num_states(-81) /// .doit(); /// # } /// ``` @@ -4894,7 +5946,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceStateListCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4910,10 +5962,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceStateListCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4933,7 +5982,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceStateListCall<'a, C, A> where C: Bor let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5022,7 +6071,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceStateListCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5030,12 +6079,12 @@ impl<'a, C, A> ProjectLocationRegistryDeviceStateListCall<'a, C, A> where C: Bor /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryDeviceStateListCall<'a, C, A> @@ -5156,7 +6205,7 @@ impl<'a, C, A> ProjectLocationRegistryGetCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5195,7 +6241,7 @@ impl<'a, C, A> ProjectLocationRegistryGetCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryGetCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationRegistryGetCall<'a, C, A> @@ -5408,7 +6454,7 @@ impl<'a, C, A> ProjectLocationRegistryDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5447,7 +6490,7 @@ impl<'a, C, A> ProjectLocationRegistryDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationRegistryDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationRegistryDeleteCall<'a, C, A> @@ -5602,11 +6645,14 @@ impl<'a, C, A> ProjectLocationRegistryDeleteCall<'a, C, A> where C: BorrowMut _parent: String, _page_token: Option, _page_size: Option, + _gateway_list_options_gateway_type: Option, + _gateway_list_options_associations_gateway_id: Option, + _gateway_list_options_associations_device_id: Option, _field_mask: Option, _device_num_ids: Vec, _device_ids: Vec, @@ -5642,7 +6691,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> where C: Bor }; dlg.begin(MethodInfo { id: "cloudiot.projects.locations.registries.groups.devices.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(11 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -5650,6 +6699,15 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> where C: Bor if let Some(value) = self._page_size { params.push(("pageSize", value.to_string())); } + if let Some(value) = self._gateway_list_options_gateway_type { + params.push(("gatewayListOptions.gatewayType", value.to_string())); + } + if let Some(value) = self._gateway_list_options_associations_gateway_id { + params.push(("gatewayListOptions.associationsGatewayId", value.to_string())); + } + if let Some(value) = self._gateway_list_options_associations_device_id { + params.push(("gatewayListOptions.associationsDeviceId", value.to_string())); + } if let Some(value) = self._field_mask { params.push(("fieldMask", value.to_string())); } @@ -5663,7 +6721,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> where C: Bor params.push(("deviceIds", f.to_string())); } } - for &field in ["alt", "parent", "pageToken", "pageSize", "fieldMask", "deviceNumIds", "deviceIds"].iter() { + for &field in ["alt", "parent", "pageToken", "pageSize", "gatewayListOptions.gatewayType", "gatewayListOptions.associationsGatewayId", "gatewayListOptions.associationsDeviceId", "fieldMask", "deviceNumIds", "deviceIds"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5689,7 +6747,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5705,10 +6763,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5728,7 +6783,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> where C: Bor let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5811,6 +6866,35 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> where C: Bor self._page_size = Some(new_value); self } + /// If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY` + /// is specified, only non-gateway devices are returned. If + /// `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned. + /// + /// Sets the *gateway list options.gateway type* query property to the given value. + pub fn gateway_list_options_gateway_type(mut self, new_value: &str) -> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> { + self._gateway_list_options_gateway_type = Some(new_value.to_string()); + self + } + /// If set, only devices associated with the specified gateway are returned. + /// The gateway ID can be numeric (`num_id`) or the user-defined string + /// (`id`). For example, if `123` is specified, only devices bound to the + /// gateway with `num_id` 123 are returned. + /// + /// Sets the *gateway list options.associations gateway id* query property to the given value. + pub fn gateway_list_options_associations_gateway_id(mut self, new_value: &str) -> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> { + self._gateway_list_options_associations_gateway_id = Some(new_value.to_string()); + self + } + /// If set, returns only the gateways with which the specified device is + /// associated. The device ID can be numeric (`num_id`) or the user-defined + /// string (`id`). For example, if `456` is specified, returns only the + /// gateways to which the device with `num_id` 456 is bound. + /// + /// Sets the *gateway list options.associations device id* query property to the given value. + pub fn gateway_list_options_associations_device_id(mut self, new_value: &str) -> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> { + self._gateway_list_options_associations_device_id = Some(new_value.to_string()); + self + } /// The fields of the `Device` resource to be returned in the response. The /// fields `id` and `num_id` are always returned, along with any /// other fields specified. @@ -5853,7 +6937,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5861,12 +6945,12 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> where C: Bor /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupDeviceListCall<'a, C, A> @@ -5994,7 +7078,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceCreateCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6010,10 +7094,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceCreateCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6045,7 +7126,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceCreateCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6137,7 +7218,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceCreateCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6145,12 +7226,12 @@ impl<'a, C, A> ProjectLocationRegistryDeviceCreateCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryDeviceCreateCall<'a, C, A> @@ -6213,7 +7294,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceCreateCall<'a, C, A> where C: Borrow /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_registries_devices_get("name") -/// .field_mask("amet") +/// .field_mask("sea") /// .doit(); /// # } /// ``` @@ -6276,7 +7357,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceGetCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6292,10 +7373,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6315,7 +7393,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6403,7 +7481,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6411,12 +7489,12 @@ impl<'a, C, A> ProjectLocationRegistryDeviceGetCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryDeviceGetCall<'a, C, A> @@ -6556,7 +7634,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceSendCommandToDeviceCall<'a, C, A> wh } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6572,10 +7650,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceSendCommandToDeviceCall<'a, C, A> wh } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6607,7 +7682,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceSendCommandToDeviceCall<'a, C, A> wh request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6699,7 +7774,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceSendCommandToDeviceCall<'a, C, A> wh /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6707,12 +7782,12 @@ impl<'a, C, A> ProjectLocationRegistryDeviceSendCommandToDeviceCall<'a, C, A> wh /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryDeviceSendCommandToDeviceCall<'a, C, A> @@ -6842,7 +7917,7 @@ impl<'a, C, A> ProjectLocationRegistryTestIamPermissionCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6858,10 +7933,7 @@ impl<'a, C, A> ProjectLocationRegistryTestIamPermissionCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6893,7 +7965,7 @@ impl<'a, C, A> ProjectLocationRegistryTestIamPermissionCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6984,7 +8056,7 @@ impl<'a, C, A> ProjectLocationRegistryTestIamPermissionCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6992,12 +8064,12 @@ impl<'a, C, A> ProjectLocationRegistryTestIamPermissionCall<'a, C, A> where C: B /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryTestIamPermissionCall<'a, C, A> @@ -7066,7 +8138,7 @@ impl<'a, C, A> ProjectLocationRegistryTestIamPermissionCall<'a, C, A> where C: B /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_registries_devices_patch(req, "name") -/// .update_mask("dolore") +/// .update_mask("eirmod") /// .doit(); /// # } /// ``` @@ -7130,7 +8202,7 @@ impl<'a, C, A> ProjectLocationRegistryDevicePatchCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7146,10 +8218,7 @@ impl<'a, C, A> ProjectLocationRegistryDevicePatchCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7181,7 +8250,7 @@ impl<'a, C, A> ProjectLocationRegistryDevicePatchCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7285,7 +8354,7 @@ impl<'a, C, A> ProjectLocationRegistryDevicePatchCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7293,12 +8362,12 @@ impl<'a, C, A> ProjectLocationRegistryDevicePatchCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryDevicePatchCall<'a, C, A> @@ -7362,7 +8431,7 @@ impl<'a, C, A> ProjectLocationRegistryDevicePatchCall<'a, C, A> where C: BorrowM /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_registries_devices_config_versions_list("name") -/// .num_versions(-82) +/// .num_versions(-22) /// .doit(); /// # } /// ``` @@ -7425,7 +8494,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceConfigVersionListCall<'a, C, A> wher } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7441,10 +8510,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceConfigVersionListCall<'a, C, A> wher } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7464,7 +8530,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceConfigVersionListCall<'a, C, A> wher let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7553,7 +8619,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceConfigVersionListCall<'a, C, A> wher /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7561,12 +8627,12 @@ impl<'a, C, A> ProjectLocationRegistryDeviceConfigVersionListCall<'a, C, A> wher /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryDeviceConfigVersionListCall<'a, C, A> @@ -7696,7 +8762,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupTestIamPermissionCall<'a, C, A> where } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7712,10 +8778,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupTestIamPermissionCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7747,7 +8810,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupTestIamPermissionCall<'a, C, A> where request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7838,7 +8901,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupTestIamPermissionCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7846,12 +8909,12 @@ impl<'a, C, A> ProjectLocationRegistryGroupTestIamPermissionCall<'a, C, A> where /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupTestIamPermissionCall<'a, C, A> @@ -7915,7 +8978,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupTestIamPermissionCall<'a, C, A> where /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_registries_groups_devices_states_list("name") -/// .num_states(-9) +/// .num_states(-45) /// .doit(); /// # } /// ``` @@ -7978,7 +9041,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceStateListCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7994,10 +9057,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceStateListCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8017,7 +9077,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceStateListCall<'a, C, A> where C let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8106,7 +9166,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceStateListCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8114,12 +9174,12 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceStateListCall<'a, C, A> where C /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupDeviceStateListCall<'a, C, A> @@ -8249,7 +9309,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceModifyCloudToDeviceConfigCall<'a, C, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8265,10 +9325,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceModifyCloudToDeviceConfigCall<'a, C, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8300,7 +9357,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceModifyCloudToDeviceConfigCall<'a, C, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8392,7 +9449,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceModifyCloudToDeviceConfigCall<'a, C, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8400,12 +9457,12 @@ impl<'a, C, A> ProjectLocationRegistryDeviceModifyCloudToDeviceConfigCall<'a, C, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryDeviceModifyCloudToDeviceConfigCall<'a, C, A> @@ -8535,7 +9592,7 @@ impl<'a, C, A> ProjectLocationRegistryGetIamPolicyCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8551,10 +9608,7 @@ impl<'a, C, A> ProjectLocationRegistryGetIamPolicyCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8586,7 +9640,7 @@ impl<'a, C, A> ProjectLocationRegistryGetIamPolicyCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8677,7 +9731,7 @@ impl<'a, C, A> ProjectLocationRegistryGetIamPolicyCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8685,12 +9739,12 @@ impl<'a, C, A> ProjectLocationRegistryGetIamPolicyCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGetIamPolicyCall<'a, C, A> @@ -8830,7 +9884,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall<'a, C, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8846,10 +9900,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall<'a, C, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8881,7 +9932,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall<'a, C, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8973,7 +10024,7 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall<'a, C, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8981,12 +10032,12 @@ impl<'a, C, A> ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall<'a, C, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupDeviceSendCommandToDeviceCall<'a, C, A> @@ -9107,7 +10158,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceDeleteCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9123,10 +10174,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceDeleteCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9146,7 +10194,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceDeleteCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9226,7 +10274,7 @@ impl<'a, C, A> ProjectLocationRegistryDeviceDeleteCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9234,12 +10282,12 @@ impl<'a, C, A> ProjectLocationRegistryDeviceDeleteCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryDeviceDeleteCall<'a, C, A> @@ -9368,7 +10416,7 @@ impl<'a, C, A> ProjectLocationRegistrySetIamPolicyCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9384,10 +10432,7 @@ impl<'a, C, A> ProjectLocationRegistrySetIamPolicyCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9419,7 +10464,7 @@ impl<'a, C, A> ProjectLocationRegistrySetIamPolicyCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9510,7 +10555,7 @@ impl<'a, C, A> ProjectLocationRegistrySetIamPolicyCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9518,12 +10563,12 @@ impl<'a, C, A> ProjectLocationRegistrySetIamPolicyCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistrySetIamPolicyCall<'a, C, A> @@ -9558,3 +10603,283 @@ impl<'a, C, A> ProjectLocationRegistrySetIamPolicyCall<'a, C, A> where C: Borrow } +/// Associates the device with the gateway. +/// +/// A builder for the *locations.registries.groups.bindDeviceToGateway* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudiot1 as cloudiot1; +/// use cloudiot1::BindDeviceToGatewayRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudiot1::CloudIot; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIot::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BindDeviceToGatewayRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_registries_groups_bind_device_to_gateway(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationRegistryGroupBindDeviceToGatewayCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIot, + _request: BindDeviceToGatewayRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationRegistryGroupBindDeviceToGatewayCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationRegistryGroupBindDeviceToGatewayCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BindDeviceToGatewayResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudiot.projects.locations.registries.groups.bindDeviceToGateway", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}:bindDeviceToGateway"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BindDeviceToGatewayRequest) -> ProjectLocationRegistryGroupBindDeviceToGatewayCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the registry. For example, + /// `projects/example-project/locations/us-central1/registries/my-registry`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationRegistryGroupBindDeviceToGatewayCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationRegistryGroupBindDeviceToGatewayCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationRegistryGroupBindDeviceToGatewayCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationRegistryGroupBindDeviceToGatewayCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/cloudkms1-cli/Cargo.toml b/gen/cloudkms1-cli/Cargo.toml index a9fe8af4ca..f51db2b21f 100644 --- a/gen/cloudkms1-cli/Cargo.toml +++ b/gen/cloudkms1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudkms1-cli" -version = "1.0.8+20181005" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud KMS (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudkms1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudkms1] path = "../cloudkms1" -version = "1.0.8+20181005" +version = "1.0.8+20190328" diff --git a/gen/cloudkms1-cli/README.md b/gen/cloudkms1-cli/README.md index ceccd893a6..abbb768666 100644 --- a/gen/cloudkms1-cli/README.md +++ b/gen/cloudkms1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud KMS* API at revision *20181005*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud KMS* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash cloudkms1 [options] @@ -53,6 +53,9 @@ cloudkms1 [options] locations-key-rings-crypto-keys-update-primary-version (-r )... [-p ]... [-o ] locations-key-rings-get [-p ]... [-o ] locations-key-rings-get-iam-policy [-p ]... [-o ] + locations-key-rings-import-jobs-get-iam-policy [-p ]... [-o ] + locations-key-rings-import-jobs-set-iam-policy (-r )... [-p ]... [-o ] + locations-key-rings-import-jobs-test-iam-permissions (-r )... [-p ]... [-o ] locations-key-rings-list [-p ]... [-o ] locations-key-rings-set-iam-policy (-r )... [-p ]... [-o ] locations-key-rings-test-iam-permissions (-r )... [-p ]... [-o ] diff --git a/gen/cloudkms1-cli/mkdocs.yml b/gen/cloudkms1-cli/mkdocs.yml index d71812fb9e..20976b6830 100644 --- a/gen/cloudkms1-cli/mkdocs.yml +++ b/gen/cloudkms1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud KMS v1.0.8+20181005 +site_name: Cloud KMS v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-cloudkms1-cli site_description: A complete library to interact with Cloud KMS (protocol v1) @@ -32,6 +32,9 @@ pages: - ['projects_locations-key-rings-crypto-keys-update-primary-version.md', 'Projects', 'Locations Key Rings Crypto Keys Update Primary Version'] - ['projects_locations-key-rings-get.md', 'Projects', 'Locations Key Rings Get'] - ['projects_locations-key-rings-get-iam-policy.md', 'Projects', 'Locations Key Rings Get Iam Policy'] +- ['projects_locations-key-rings-import-jobs-get-iam-policy.md', 'Projects', 'Locations Key Rings Import Jobs Get Iam Policy'] +- ['projects_locations-key-rings-import-jobs-set-iam-policy.md', 'Projects', 'Locations Key Rings Import Jobs Set Iam Policy'] +- ['projects_locations-key-rings-import-jobs-test-iam-permissions.md', 'Projects', 'Locations Key Rings Import Jobs Test Iam Permissions'] - ['projects_locations-key-rings-list.md', 'Projects', 'Locations Key Rings List'] - ['projects_locations-key-rings-set-iam-policy.md', 'Projects', 'Locations Key Rings Set Iam Policy'] - ['projects_locations-key-rings-test-iam-permissions.md', 'Projects', 'Locations Key Rings Test Iam Permissions'] diff --git a/gen/cloudkms1-cli/src/main.rs b/gen/cloudkms1-cli/src/main.rs index 53598b1a9c..f8d59f3bf6 100644 --- a/gen/cloudkms1-cli/src/main.rs +++ b/gen/cloudkms1-cli/src/main.rs @@ -1797,6 +1797,230 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_key_rings_import_jobs_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_key_rings_import_jobs_get_iam_policy(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_key_rings_import_jobs_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_key_rings_import_jobs_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_key_rings_import_jobs_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_key_rings_import_jobs_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_locations_key_rings_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().locations_key_rings_list(opt.value_of("parent").unwrap_or("")); @@ -2166,6 +2390,15 @@ impl<'n> Engine<'n> { ("locations-key-rings-get-iam-policy", Some(opt)) => { call_result = self._projects_locations_key_rings_get_iam_policy(opt, dry_run, &mut err); }, + ("locations-key-rings-import-jobs-get-iam-policy", Some(opt)) => { + call_result = self._projects_locations_key_rings_import_jobs_get_iam_policy(opt, dry_run, &mut err); + }, + ("locations-key-rings-import-jobs-set-iam-policy", Some(opt)) => { + call_result = self._projects_locations_key_rings_import_jobs_set_iam_policy(opt, dry_run, &mut err); + }, + ("locations-key-rings-import-jobs-test-iam-permissions", Some(opt)) => { + call_result = self._projects_locations_key_rings_import_jobs_test_iam_permissions(opt, dry_run, &mut err); + }, ("locations-key-rings-list", Some(opt)) => { call_result = self._projects_locations_key_rings_list(opt, dry_run, &mut err); }, @@ -2269,7 +2502,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'locations-get', 'locations-key-rings-create', 'locations-key-rings-crypto-keys-create', 'locations-key-rings-crypto-keys-crypto-key-versions-asymmetric-decrypt', 'locations-key-rings-crypto-keys-crypto-key-versions-asymmetric-sign', 'locations-key-rings-crypto-keys-crypto-key-versions-create', 'locations-key-rings-crypto-keys-crypto-key-versions-destroy', 'locations-key-rings-crypto-keys-crypto-key-versions-get', 'locations-key-rings-crypto-keys-crypto-key-versions-get-public-key', 'locations-key-rings-crypto-keys-crypto-key-versions-list', 'locations-key-rings-crypto-keys-crypto-key-versions-patch', 'locations-key-rings-crypto-keys-crypto-key-versions-restore', 'locations-key-rings-crypto-keys-decrypt', 'locations-key-rings-crypto-keys-encrypt', 'locations-key-rings-crypto-keys-get', 'locations-key-rings-crypto-keys-get-iam-policy', 'locations-key-rings-crypto-keys-list', 'locations-key-rings-crypto-keys-patch', 'locations-key-rings-crypto-keys-set-iam-policy', 'locations-key-rings-crypto-keys-test-iam-permissions', 'locations-key-rings-crypto-keys-update-primary-version', 'locations-key-rings-get', 'locations-key-rings-get-iam-policy', 'locations-key-rings-list', 'locations-key-rings-set-iam-policy', 'locations-key-rings-test-iam-permissions' and 'locations-list'", vec![ + ("projects", "methods: 'locations-get', 'locations-key-rings-create', 'locations-key-rings-crypto-keys-create', 'locations-key-rings-crypto-keys-crypto-key-versions-asymmetric-decrypt', 'locations-key-rings-crypto-keys-crypto-key-versions-asymmetric-sign', 'locations-key-rings-crypto-keys-crypto-key-versions-create', 'locations-key-rings-crypto-keys-crypto-key-versions-destroy', 'locations-key-rings-crypto-keys-crypto-key-versions-get', 'locations-key-rings-crypto-keys-crypto-key-versions-get-public-key', 'locations-key-rings-crypto-keys-crypto-key-versions-list', 'locations-key-rings-crypto-keys-crypto-key-versions-patch', 'locations-key-rings-crypto-keys-crypto-key-versions-restore', 'locations-key-rings-crypto-keys-decrypt', 'locations-key-rings-crypto-keys-encrypt', 'locations-key-rings-crypto-keys-get', 'locations-key-rings-crypto-keys-get-iam-policy', 'locations-key-rings-crypto-keys-list', 'locations-key-rings-crypto-keys-patch', 'locations-key-rings-crypto-keys-set-iam-policy', 'locations-key-rings-crypto-keys-test-iam-permissions', 'locations-key-rings-crypto-keys-update-primary-version', 'locations-key-rings-get', 'locations-key-rings-get-iam-policy', 'locations-key-rings-import-jobs-get-iam-policy', 'locations-key-rings-import-jobs-set-iam-policy', 'locations-key-rings-import-jobs-test-iam-permissions', 'locations-key-rings-list', 'locations-key-rings-set-iam-policy', 'locations-key-rings-test-iam-permissions' and 'locations-list'", vec![ ("locations-get", Some(r##"Gets information about a location."##), "Details at http://byron.github.io/google-apis-rs/google_cloudkms1_cli/projects_locations-get", @@ -2927,6 +3160,96 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-key-rings-import-jobs-get-iam-policy", + Some(r##"Gets the access control policy for a resource. + Returns an empty policy if the resource exists and does not have a policy + set."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudkms1_cli/projects_locations-key-rings-import-jobs-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-key-rings-import-jobs-set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any + existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudkms1_cli/projects_locations-key-rings-import-jobs-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-key-rings-import-jobs-test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource. + If the resource does not exist, this will return an empty set of + permissions, not a NOT_FOUND error. + + Note: This operation is designed to be used for building permission-aware + UIs and command-line tools, not for authorization checking. This operation + may "fail open" without warning."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudkms1_cli/projects_locations-key-rings-import-jobs-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -3049,7 +3372,7 @@ fn main() { let mut app = App::new("cloudkms1") .author("Sebastian Thiel ") - .version("1.0.8+20181005") + .version("1.0.8+20190328") .about("Manages keys and performs cryptographic operations in a central cloud service, for direct use by other cloud resources and applications. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudkms1_cli") diff --git a/gen/cloudkms1/Cargo.toml b/gen/cloudkms1/Cargo.toml index 739d83c3d6..fffd7d9fdb 100644 --- a/gen/cloudkms1/Cargo.toml +++ b/gen/cloudkms1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudkms1" -version = "1.0.8+20181005" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud KMS (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudkms1" homepage = "https://cloud.google.com/kms/" -documentation = "https://docs.rs/google-cloudkms1/1.0.8+20181005" +documentation = "https://docs.rs/google-cloudkms1/1.0.8+20190328" license = "MIT" keywords = ["cloudkms", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudkms1/README.md b/gen/cloudkms1/README.md index b881292838..028e3bc672 100644 --- a/gen/cloudkms1/README.md +++ b/gen/cloudkms1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-cloudkms1` library allows access to all features of the *Google Cloud KMS* service. -This documentation was generated from *Cloud KMS* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *cloudkms:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud KMS* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *cloudkms:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud KMS* *v1* API can be found at the [official documentation site](https://cloud.google.com/kms/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.CloudKMS.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.CloudKMS.html) ... * projects - * [*locations get*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationGetCall.html), [*locations key rings create*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCreateCall.html), [*locations key rings crypto keys create*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCreateCall.html), [*locations key rings crypto keys crypto key versions asymmetric decrypt*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricDecryptCall.html), [*locations key rings crypto keys crypto key versions asymmetric sign*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricSignCall.html), [*locations key rings crypto keys crypto key versions create*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall.html), [*locations key rings crypto keys crypto key versions destroy*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall.html), [*locations key rings crypto keys crypto key versions get*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall.html), [*locations key rings crypto keys crypto key versions get public key*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall.html), [*locations key rings crypto keys crypto key versions list*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall.html), [*locations key rings crypto keys crypto key versions patch*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall.html), [*locations key rings crypto keys crypto key versions restore*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall.html), [*locations key rings crypto keys decrypt*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyDecryptCall.html), [*locations key rings crypto keys encrypt*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyEncryptCall.html), [*locations key rings crypto keys get*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyGetCall.html), [*locations key rings crypto keys get iam policy*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyGetIamPolicyCall.html), [*locations key rings crypto keys list*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyListCall.html), [*locations key rings crypto keys patch*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyPatchCall.html), [*locations key rings crypto keys set iam policy*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeySetIamPolicyCall.html), [*locations key rings crypto keys test iam permissions*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyTestIamPermissionCall.html), [*locations key rings crypto keys update primary version*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall.html), [*locations key rings get*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingGetCall.html), [*locations key rings get iam policy*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingGetIamPolicyCall.html), [*locations key rings list*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingListCall.html), [*locations key rings set iam policy*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingSetIamPolicyCall.html), [*locations key rings test iam permissions*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationKeyRingTestIamPermissionCall.html) and [*locations list*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.ProjectLocationListCall.html) + * [*locations get*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationGetCall.html), [*locations key rings create*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCreateCall.html), [*locations key rings crypto keys create*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCreateCall.html), [*locations key rings crypto keys crypto key versions asymmetric decrypt*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricDecryptCall.html), [*locations key rings crypto keys crypto key versions asymmetric sign*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricSignCall.html), [*locations key rings crypto keys crypto key versions create*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall.html), [*locations key rings crypto keys crypto key versions destroy*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall.html), [*locations key rings crypto keys crypto key versions get*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall.html), [*locations key rings crypto keys crypto key versions get public key*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall.html), [*locations key rings crypto keys crypto key versions list*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall.html), [*locations key rings crypto keys crypto key versions patch*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall.html), [*locations key rings crypto keys crypto key versions restore*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall.html), [*locations key rings crypto keys decrypt*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyDecryptCall.html), [*locations key rings crypto keys encrypt*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyEncryptCall.html), [*locations key rings crypto keys get*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyGetCall.html), [*locations key rings crypto keys get iam policy*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyGetIamPolicyCall.html), [*locations key rings crypto keys list*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyListCall.html), [*locations key rings crypto keys patch*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyPatchCall.html), [*locations key rings crypto keys set iam policy*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeySetIamPolicyCall.html), [*locations key rings crypto keys test iam permissions*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyTestIamPermissionCall.html), [*locations key rings crypto keys update primary version*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall.html), [*locations key rings get*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingGetCall.html), [*locations key rings get iam policy*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingGetIamPolicyCall.html), [*locations key rings import jobs get iam policy*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingImportJobGetIamPolicyCall.html), [*locations key rings import jobs set iam policy*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingImportJobSetIamPolicyCall.html), [*locations key rings import jobs test iam permissions*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingImportJobTestIamPermissionCall.html), [*locations key rings list*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingListCall.html), [*locations key rings set iam policy*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingSetIamPolicyCall.html), [*locations key rings test iam permissions*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationKeyRingTestIamPermissionCall.html) and [*locations list*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.ProjectLocationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/struct.CloudKMS.html)** +* **[Hub](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/struct.CloudKMS.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -47,11 +47,12 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_destroy(...).doit() -let r = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_get(...).doit() -let r = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_patch(...).doit() -let r = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_restore(...).doit() -let r = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_create(...).doit() +let r = hub.projects().locations_key_rings_import_jobs_set_iam_policy(...).doit() +let r = hub.projects().locations_key_rings_import_jobs_get_iam_policy(...).doit() +let r = hub.projects().locations_key_rings_get_iam_policy(...).doit() +let r = hub.projects().locations_key_rings_crypto_keys_set_iam_policy(...).doit() +let r = hub.projects().locations_key_rings_set_iam_policy(...).doit() +let r = hub.projects().locations_key_rings_crypto_keys_get_iam_policy(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -85,7 +86,7 @@ extern crate hyper; extern crate hyper_rustls; extern crate yup_oauth2 as oauth2; extern crate google_cloudkms1 as cloudkms1; -use cloudkms1::CryptoKeyVersion; +use cloudkms1::SetIamPolicyRequest; use cloudkms1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -106,13 +107,12 @@ let mut hub = CloudKMS::new(hyper::Client::with_connector(hyper::net::HttpsConne // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! -let mut req = CryptoKeyVersion::default(); +let mut req = SetIamPolicyRequest::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_patch(req, "name") - .update_mask("sit") +let result = hub.projects().locations_key_rings_import_jobs_set_iam_policy(req, "resource") .doit(); match result { @@ -135,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -155,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudkms1/1.0.8+20181005/google_cloudkms1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudkms1/1.0.8+20190328/google_cloudkms1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudkms1/src/lib.rs b/gen/cloudkms1/src/lib.rs index 47244cc7a2..de3dd0e9c1 100644 --- a/gen/cloudkms1/src/lib.rs +++ b/gen/cloudkms1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud KMS* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *cloudkms:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud KMS* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *cloudkms:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud KMS* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/kms/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.CloudKMS.html) ... //! //! * projects -//! * [*locations get*](struct.ProjectLocationGetCall.html), [*locations key rings create*](struct.ProjectLocationKeyRingCreateCall.html), [*locations key rings crypto keys create*](struct.ProjectLocationKeyRingCryptoKeyCreateCall.html), [*locations key rings crypto keys crypto key versions asymmetric decrypt*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricDecryptCall.html), [*locations key rings crypto keys crypto key versions asymmetric sign*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricSignCall.html), [*locations key rings crypto keys crypto key versions create*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall.html), [*locations key rings crypto keys crypto key versions destroy*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall.html), [*locations key rings crypto keys crypto key versions get*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall.html), [*locations key rings crypto keys crypto key versions get public key*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall.html), [*locations key rings crypto keys crypto key versions list*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall.html), [*locations key rings crypto keys crypto key versions patch*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall.html), [*locations key rings crypto keys crypto key versions restore*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall.html), [*locations key rings crypto keys decrypt*](struct.ProjectLocationKeyRingCryptoKeyDecryptCall.html), [*locations key rings crypto keys encrypt*](struct.ProjectLocationKeyRingCryptoKeyEncryptCall.html), [*locations key rings crypto keys get*](struct.ProjectLocationKeyRingCryptoKeyGetCall.html), [*locations key rings crypto keys get iam policy*](struct.ProjectLocationKeyRingCryptoKeyGetIamPolicyCall.html), [*locations key rings crypto keys list*](struct.ProjectLocationKeyRingCryptoKeyListCall.html), [*locations key rings crypto keys patch*](struct.ProjectLocationKeyRingCryptoKeyPatchCall.html), [*locations key rings crypto keys set iam policy*](struct.ProjectLocationKeyRingCryptoKeySetIamPolicyCall.html), [*locations key rings crypto keys test iam permissions*](struct.ProjectLocationKeyRingCryptoKeyTestIamPermissionCall.html), [*locations key rings crypto keys update primary version*](struct.ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall.html), [*locations key rings get*](struct.ProjectLocationKeyRingGetCall.html), [*locations key rings get iam policy*](struct.ProjectLocationKeyRingGetIamPolicyCall.html), [*locations key rings list*](struct.ProjectLocationKeyRingListCall.html), [*locations key rings set iam policy*](struct.ProjectLocationKeyRingSetIamPolicyCall.html), [*locations key rings test iam permissions*](struct.ProjectLocationKeyRingTestIamPermissionCall.html) and [*locations list*](struct.ProjectLocationListCall.html) +//! * [*locations get*](struct.ProjectLocationGetCall.html), [*locations key rings create*](struct.ProjectLocationKeyRingCreateCall.html), [*locations key rings crypto keys create*](struct.ProjectLocationKeyRingCryptoKeyCreateCall.html), [*locations key rings crypto keys crypto key versions asymmetric decrypt*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricDecryptCall.html), [*locations key rings crypto keys crypto key versions asymmetric sign*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricSignCall.html), [*locations key rings crypto keys crypto key versions create*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall.html), [*locations key rings crypto keys crypto key versions destroy*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall.html), [*locations key rings crypto keys crypto key versions get*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall.html), [*locations key rings crypto keys crypto key versions get public key*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall.html), [*locations key rings crypto keys crypto key versions list*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall.html), [*locations key rings crypto keys crypto key versions patch*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall.html), [*locations key rings crypto keys crypto key versions restore*](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall.html), [*locations key rings crypto keys decrypt*](struct.ProjectLocationKeyRingCryptoKeyDecryptCall.html), [*locations key rings crypto keys encrypt*](struct.ProjectLocationKeyRingCryptoKeyEncryptCall.html), [*locations key rings crypto keys get*](struct.ProjectLocationKeyRingCryptoKeyGetCall.html), [*locations key rings crypto keys get iam policy*](struct.ProjectLocationKeyRingCryptoKeyGetIamPolicyCall.html), [*locations key rings crypto keys list*](struct.ProjectLocationKeyRingCryptoKeyListCall.html), [*locations key rings crypto keys patch*](struct.ProjectLocationKeyRingCryptoKeyPatchCall.html), [*locations key rings crypto keys set iam policy*](struct.ProjectLocationKeyRingCryptoKeySetIamPolicyCall.html), [*locations key rings crypto keys test iam permissions*](struct.ProjectLocationKeyRingCryptoKeyTestIamPermissionCall.html), [*locations key rings crypto keys update primary version*](struct.ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall.html), [*locations key rings get*](struct.ProjectLocationKeyRingGetCall.html), [*locations key rings get iam policy*](struct.ProjectLocationKeyRingGetIamPolicyCall.html), [*locations key rings import jobs get iam policy*](struct.ProjectLocationKeyRingImportJobGetIamPolicyCall.html), [*locations key rings import jobs set iam policy*](struct.ProjectLocationKeyRingImportJobSetIamPolicyCall.html), [*locations key rings import jobs test iam permissions*](struct.ProjectLocationKeyRingImportJobTestIamPermissionCall.html), [*locations key rings list*](struct.ProjectLocationKeyRingListCall.html), [*locations key rings set iam policy*](struct.ProjectLocationKeyRingSetIamPolicyCall.html), [*locations key rings test iam permissions*](struct.ProjectLocationKeyRingTestIamPermissionCall.html) and [*locations list*](struct.ProjectLocationListCall.html) //! //! //! @@ -47,11 +47,12 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_destroy(...).doit() -//! let r = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_get(...).doit() -//! let r = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_patch(...).doit() -//! let r = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_restore(...).doit() -//! let r = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_create(...).doit() +//! let r = hub.projects().locations_key_rings_import_jobs_set_iam_policy(...).doit() +//! let r = hub.projects().locations_key_rings_import_jobs_get_iam_policy(...).doit() +//! let r = hub.projects().locations_key_rings_get_iam_policy(...).doit() +//! let r = hub.projects().locations_key_rings_crypto_keys_set_iam_policy(...).doit() +//! let r = hub.projects().locations_key_rings_set_iam_policy(...).doit() +//! let r = hub.projects().locations_key_rings_crypto_keys_get_iam_policy(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -85,7 +86,7 @@ //! extern crate hyper_rustls; //! extern crate yup_oauth2 as oauth2; //! extern crate google_cloudkms1 as cloudkms1; -//! use cloudkms1::CryptoKeyVersion; +//! use cloudkms1::SetIamPolicyRequest; //! use cloudkms1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -107,13 +108,12 @@ //! // As the method needs a request, you would usually fill it with the desired information //! // into the respective structure. Some of the parts shown here might not be applicable ! //! // Values shown here are possibly random and not representative ! -//! let mut req = CryptoKeyVersion::default(); +//! let mut req = SetIamPolicyRequest::default(); //! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_patch(req, "name") -//! .update_mask("sed") +//! let result = hub.projects().locations_key_rings_import_jobs_set_iam_policy(req, "resource") //! .doit(); //! //! match result { @@ -238,19 +238,23 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, pub enum Scope { /// View and manage your data across Google Cloud Platform services CloudPlatform, + + /// View and manage your keys and secrets stored in Cloud Key Management Service + Full, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::Full => "https://www.googleapis.com/auth/cloudkms", } } } impl Default for Scope { fn default() -> Scope { - Scope::CloudPlatform + Scope::Full } } @@ -271,7 +275,7 @@ impl Default for Scope { /// extern crate hyper_rustls; /// extern crate yup_oauth2 as oauth2; /// extern crate google_cloudkms1 as cloudkms1; -/// use cloudkms1::CryptoKeyVersion; +/// use cloudkms1::SetIamPolicyRequest; /// use cloudkms1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -293,13 +297,12 @@ impl Default for Scope { /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = CryptoKeyVersion::default(); +/// let mut req = SetIamPolicyRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_patch(req, "name") -/// .update_mask("dolores") +/// let result = hub.projects().locations_key_rings_import_jobs_set_iam_policy(req, "resource") /// .doit(); /// /// match result { @@ -427,6 +430,7 @@ impl ResponseResult for AsymmetricSignResponse {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// +/// * [locations key rings import jobs set iam policy projects](struct.ProjectLocationKeyRingImportJobSetIamPolicyCall.html) (request) /// * [locations key rings crypto keys set iam policy projects](struct.ProjectLocationKeyRingCryptoKeySetIamPolicyCall.html) (request) /// * [locations key rings set iam policy projects](struct.ProjectLocationKeyRingSetIamPolicyCall.html) (request) /// @@ -594,17 +598,17 @@ impl ResponseResult for ListLocationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { - /// The canonical id for this location. For example: `"us-east1"`. - #[serde(rename="locationId")] - pub location_id: Option, - /// Cross-service attributes for the location. For example - /// - /// {"cloud.googleapis.com/region": "us-east1"} - pub labels: Option>, /// The friendly name for this location, typically a nearby city name. /// For example, "Tokyo". #[serde(rename="displayName")] pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, /// Resource name for the location, which may vary between implementations. /// For example: `"projects/example-project/locations/us-east1"` pub name: Option, @@ -667,16 +671,18 @@ impl ResponseResult for Location {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations key rings crypto keys get iam policy projects](struct.ProjectLocationKeyRingCryptoKeyGetIamPolicyCall.html) (response) +/// * [locations key rings import jobs set iam policy projects](struct.ProjectLocationKeyRingImportJobSetIamPolicyCall.html) (response) +/// * [locations key rings import jobs get iam policy projects](struct.ProjectLocationKeyRingImportJobGetIamPolicyCall.html) (response) /// * [locations key rings get iam policy projects](struct.ProjectLocationKeyRingGetIamPolicyCall.html) (response) /// * [locations key rings crypto keys set iam policy projects](struct.ProjectLocationKeyRingCryptoKeySetIamPolicyCall.html) (response) /// * [locations key rings set iam policy projects](struct.ProjectLocationKeyRingSetIamPolicyCall.html) (response) +/// * [locations key rings crypto keys get iam policy projects](struct.ProjectLocationKeyRingCryptoKeyGetIamPolicyCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// Associates a list of `members` to a `role`. - /// `bindings` with no members will result in an error. - pub bindings: Option>, + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, /// `etag` is used for optimistic concurrency control as a way to help /// prevent simultaneous updates of a policy from overwriting each other. /// It is strongly suggested that systems make use of the `etag` in the @@ -688,9 +694,9 @@ pub struct Policy { /// If no `etag` is provided in the call to `setIamPolicy`, then the existing /// policy is overwritten blindly. pub etag: Option, - /// Specifies cloud audit logging configuration for this policy. - #[serde(rename="auditConfigs")] - pub audit_configs: Option>, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, /// Deprecated. pub version: Option, } @@ -830,6 +836,7 @@ impl ResponseResult for CryptoKey {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [locations key rings test iam permissions projects](struct.ProjectLocationKeyRingTestIamPermissionCall.html) (response) +/// * [locations key rings import jobs test iam permissions projects](struct.ProjectLocationKeyRingImportJobTestIamPermissionCall.html) (response) /// * [locations key rings crypto keys test iam permissions projects](struct.ProjectLocationKeyRingCryptoKeyTestIamPermissionCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -857,30 +864,24 @@ pub struct RestoreCryptoKeyVersionRequest { _never_set: Option } impl RequestValue for RestoreCryptoKeyVersionRequest {} -/// The public key for a given CryptoKeyVersion. Obtained via -/// GetPublicKey. +/// Request message for KeyManagementService.AsymmetricSign. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations key rings crypto keys crypto key versions get public key projects](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall.html) (response) +/// * [locations key rings crypto keys crypto key versions asymmetric sign projects](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricSignCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PublicKey { - /// The public key, encoded in PEM format. For more information, see the - /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for - /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and - /// [Textual Encoding of Subject Public Key Info] - /// (https://tools.ietf.org/html/rfc7468#section-13). - pub pem: Option, - /// The Algorithm associated - /// with this key. - pub algorithm: Option, +pub struct AsymmetricSignRequest { + /// Required. The digest of the data to sign. The digest must be produced with + /// the same digest algorithm as specified by the key version's + /// algorithm. + pub digest: Option, } -impl ResponseResult for PublicKey {} +impl RequestValue for AsymmetricSignRequest {} /// Response message for KeyManagementService.AsymmetricDecrypt. @@ -1065,6 +1066,7 @@ impl RequestValue for EncryptRequest {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [locations key rings test iam permissions projects](struct.ProjectLocationKeyRingTestIamPermissionCall.html) (request) +/// * [locations key rings import jobs test iam permissions projects](struct.ProjectLocationKeyRingImportJobTestIamPermissionCall.html) (request) /// * [locations key rings crypto keys test iam permissions projects](struct.ProjectLocationKeyRingCryptoKeyTestIamPermissionCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -1107,28 +1109,30 @@ impl ResponseResult for DecryptResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// /// The application context of the containing message determines which /// well-known feature set of CEL is supported. pub expression: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} -/// Contains an HSM-generated attestation about a key operation. +/// Contains an HSM-generated attestation about a key operation. For more +/// information, see [Verifying attestations] +/// (https://cloud.google.com/kms/docs/attest-key). /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -1153,7 +1157,7 @@ pub struct Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, - /// Unimplemented. The condition that is associated with this binding. + /// The condition that is associated with this binding. /// NOTE: an unsatisfied condition will not allow user access via current /// binding. Different bindings, including their conditions, are examined /// independently. @@ -1178,7 +1182,7 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// @@ -1188,24 +1192,30 @@ pub struct Binding { impl Part for Binding {} -/// Request message for KeyManagementService.AsymmetricSign. +/// The public key for a given CryptoKeyVersion. Obtained via +/// GetPublicKey. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations key rings crypto keys crypto key versions asymmetric sign projects](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricSignCall.html) (request) +/// * [locations key rings crypto keys crypto key versions get public key projects](struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AsymmetricSignRequest { - /// Required. The digest of the data to sign. The digest must be produced with - /// the same digest algorithm as specified by the key version's - /// algorithm. - pub digest: Option, +pub struct PublicKey { + /// The public key, encoded in PEM format. For more information, see the + /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for + /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and + /// [Textual Encoding of Subject Public Key Info] + /// (https://tools.ietf.org/html/rfc7468#section-13). + pub pem: Option, + /// The Algorithm associated + /// with this key. + pub algorithm: Option, } -impl RequestValue for AsymmetricSignRequest {} +impl ResponseResult for PublicKey {} /// Specifies the audit configuration for a service. @@ -1342,7 +1352,7 @@ impl Part for Digest {} /// ::default(), None); /// let mut hub = CloudKMS::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `locations_get(...)`, `locations_key_rings_create(...)`, `locations_key_rings_crypto_keys_create(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_asymmetric_decrypt(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_asymmetric_sign(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_create(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_destroy(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_get(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_get_public_key(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_list(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_patch(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_restore(...)`, `locations_key_rings_crypto_keys_decrypt(...)`, `locations_key_rings_crypto_keys_encrypt(...)`, `locations_key_rings_crypto_keys_get(...)`, `locations_key_rings_crypto_keys_get_iam_policy(...)`, `locations_key_rings_crypto_keys_list(...)`, `locations_key_rings_crypto_keys_patch(...)`, `locations_key_rings_crypto_keys_set_iam_policy(...)`, `locations_key_rings_crypto_keys_test_iam_permissions(...)`, `locations_key_rings_crypto_keys_update_primary_version(...)`, `locations_key_rings_get(...)`, `locations_key_rings_get_iam_policy(...)`, `locations_key_rings_list(...)`, `locations_key_rings_set_iam_policy(...)`, `locations_key_rings_test_iam_permissions(...)` and `locations_list(...)` +/// // like `locations_get(...)`, `locations_key_rings_create(...)`, `locations_key_rings_crypto_keys_create(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_asymmetric_decrypt(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_asymmetric_sign(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_create(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_destroy(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_get(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_get_public_key(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_list(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_patch(...)`, `locations_key_rings_crypto_keys_crypto_key_versions_restore(...)`, `locations_key_rings_crypto_keys_decrypt(...)`, `locations_key_rings_crypto_keys_encrypt(...)`, `locations_key_rings_crypto_keys_get(...)`, `locations_key_rings_crypto_keys_get_iam_policy(...)`, `locations_key_rings_crypto_keys_list(...)`, `locations_key_rings_crypto_keys_patch(...)`, `locations_key_rings_crypto_keys_set_iam_policy(...)`, `locations_key_rings_crypto_keys_test_iam_permissions(...)`, `locations_key_rings_crypto_keys_update_primary_version(...)`, `locations_key_rings_get(...)`, `locations_key_rings_get_iam_policy(...)`, `locations_key_rings_import_jobs_get_iam_policy(...)`, `locations_key_rings_import_jobs_set_iam_policy(...)`, `locations_key_rings_import_jobs_test_iam_permissions(...)`, `locations_key_rings_list(...)`, `locations_key_rings_set_iam_policy(...)`, `locations_key_rings_test_iam_permissions(...)` and `locations_list(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -1707,6 +1717,26 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_key_rings_import_jobs_get_iam_policy(&self, resource: &str) -> ProjectLocationKeyRingImportJobGetIamPolicyCall<'a, C, A> { + ProjectLocationKeyRingImportJobGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Gets the access control policy for a resource. @@ -1833,6 +1863,27 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_key_rings_import_jobs_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectLocationKeyRingImportJobSetIamPolicyCall<'a, C, A> { + ProjectLocationKeyRingImportJobSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Create a new CryptoKeyVersion in a CryptoKey. @@ -1920,6 +1971,32 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// If the resource does not exist, this will return an empty set of + /// permissions, not a NOT_FOUND error. + /// + /// Note: This operation is designed to be used for building permission-aware + /// UIs and command-line tools, not for authorization checking. This operation + /// may "fail open" without warning. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_key_rings_import_jobs_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectLocationKeyRingImportJobTestIamPermissionCall<'a, C, A> { + ProjectLocationKeyRingImportJobTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Create a new CryptoKey within a KeyRing. @@ -1994,7 +2071,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_patch(req, "name") -/// .update_mask("accusam") +/// .update_mask("et") /// .doit(); /// # } /// ``` @@ -2058,7 +2135,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall<'a, C, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2074,10 +2151,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall<'a, C, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2109,7 +2183,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall<'a, C, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2207,7 +2281,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall<'a, C, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2344,7 +2418,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall<' } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2360,10 +2434,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall<' } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2383,7 +2454,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall<' let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2462,7 +2533,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall<' /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2544,7 +2615,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetPublicKeyCall<' /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_key_rings_create(req, "parent") -/// .key_ring_id("amet.") +/// .key_ring_id("accusam") /// .doit(); /// # } /// ``` @@ -2608,7 +2679,7 @@ impl<'a, C, A> ProjectLocationKeyRingCreateCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2659,7 +2727,7 @@ impl<'a, C, A> ProjectLocationKeyRingCreateCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCreateCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCreateCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingListCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2941,7 +3006,7 @@ impl<'a, C, A> ProjectLocationKeyRingListCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingListCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall<'a, C, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3206,10 +3271,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall<'a, C, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3241,7 +3303,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall<'a, C, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3331,7 +3393,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall<'a, C, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3474,7 +3536,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyEncryptCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3490,10 +3552,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyEncryptCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3525,7 +3584,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyEncryptCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3619,7 +3678,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyEncryptCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3753,7 +3812,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3792,7 +3848,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingGetCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCryptoKeyGetCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4021,10 +4077,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4044,7 +4097,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4122,7 +4175,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4198,9 +4251,9 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetCall<'a, C, A> where C: BorrowM /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_list("name") -/// .page_token("ea") -/// .page_size(-61) -/// .filter("justo") +/// .page_token("gubergren") +/// .page_size(-95) +/// .filter("aliquyam") /// .doit(); /// # } /// ``` @@ -4271,7 +4324,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4310,7 +4360,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricDecryptC } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4568,10 +4618,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricDecryptC } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4603,7 +4650,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricDecryptC request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4694,7 +4741,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricDecryptC /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4837,7 +4884,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricSignCall } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4853,10 +4900,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricSignCall } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4888,7 +4932,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricSignCall request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4978,7 +5022,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionAsymmetricSignCall /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5125,7 +5169,7 @@ impl<'a, C, A> ProjectLocationKeyRingTestIamPermissionCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5141,10 +5185,7 @@ impl<'a, C, A> ProjectLocationKeyRingTestIamPermissionCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5176,7 +5217,7 @@ impl<'a, C, A> ProjectLocationKeyRingTestIamPermissionCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5267,7 +5308,7 @@ impl<'a, C, A> ProjectLocationKeyRingTestIamPermissionCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5403,7 +5444,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetIamPolicyCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5419,10 +5460,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetIamPolicyCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5442,7 +5480,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetIamPolicyCall<'a, C, A> where C let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5521,7 +5559,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetIamPolicyCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5664,7 +5702,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall<'a, C, A> } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5680,10 +5718,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall<'a, C, A> } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5715,7 +5750,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall<'a, C, A> request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5805,7 +5840,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall<'a, C, A> /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5887,7 +5922,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall<'a, C, A> /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_key_rings_crypto_keys_patch(req, "name") -/// .update_mask("et") +/// .update_mask("diam") /// .doit(); /// # } /// ``` @@ -5951,7 +5986,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyPatchCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5967,10 +6002,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyPatchCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6002,7 +6034,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyPatchCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6100,7 +6132,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyPatchCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6242,7 +6274,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyDecryptCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6258,10 +6290,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyDecryptCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6293,7 +6322,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyDecryptCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6384,7 +6413,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyDecryptCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6432,6 +6461,257 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyDecryptCall<'a, C, A> where C: Bor } +/// Gets the access control policy for a resource. +/// Returns an empty policy if the resource exists and does not have a policy +/// set. +/// +/// A builder for the *locations.keyRings.importJobs.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudkms1 as cloudkms1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudkms1::CloudKMS; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudKMS::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_key_rings_import_jobs_get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationKeyRingImportJobGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudKMS, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationKeyRingImportJobGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationKeyRingImportJobGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudkms.projects.locations.keyRings.importJobs.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationKeyRingImportJobGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationKeyRingImportJobGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationKeyRingImportJobGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationKeyRingImportJobGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Gets the access control policy for a resource. /// Returns an empty policy if the resource exists and does not have a policy /// set. @@ -6520,7 +6800,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetIamPolicyCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6536,10 +6816,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetIamPolicyCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6559,7 +6836,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetIamPolicyCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6638,7 +6915,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetIamPolicyCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6780,7 +7057,7 @@ impl<'a, C, A> ProjectLocationKeyRingSetIamPolicyCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6796,10 +7073,7 @@ impl<'a, C, A> ProjectLocationKeyRingSetIamPolicyCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6831,7 +7105,7 @@ impl<'a, C, A> ProjectLocationKeyRingSetIamPolicyCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6922,7 +7196,7 @@ impl<'a, C, A> ProjectLocationKeyRingSetIamPolicyCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7056,7 +7330,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7095,7 +7366,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCryptoKeyTestIamPermissionCall<'a, C, A> wh } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7336,10 +7607,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyTestIamPermissionCall<'a, C, A> wh } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7371,7 +7639,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyTestIamPermissionCall<'a, C, A> wh request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7462,7 +7730,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyTestIamPermissionCall<'a, C, A> wh /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7538,9 +7806,9 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyTestIamPermissionCall<'a, C, A> wh /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_key_rings_crypto_keys_crypto_key_versions_list("parent") -/// .view("sadipscing") -/// .page_token("dolor") -/// .page_size(-39) +/// .view("eos") +/// .page_token("erat") +/// .page_size(-95) /// .doit(); /// # } /// ``` @@ -7611,7 +7879,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall<'a, C, A> } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7627,10 +7895,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall<'a, C, A> } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7650,7 +7915,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall<'a, C, A> let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7755,7 +8020,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall<'a, C, A> /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7831,9 +8096,9 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall<'a, C, A> /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_key_rings_crypto_keys_list("parent") -/// .version_view("amet") -/// .page_token("no") -/// .page_size(-36) +/// .version_view("eirmod") +/// .page_token("elitr") +/// .page_size(-97) /// .doit(); /// # } /// ``` @@ -7904,7 +8169,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyListCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7920,10 +8185,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyListCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7943,7 +8205,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyListCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8047,7 +8309,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyListCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8095,6 +8357,287 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyListCall<'a, C, A> where C: Borrow } +/// Sets the access control policy on the specified resource. Replaces any +/// existing policy. +/// +/// A builder for the *locations.keyRings.importJobs.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudkms1 as cloudkms1; +/// use cloudkms1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudkms1::CloudKMS; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudKMS::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_key_rings_import_jobs_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationKeyRingImportJobSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudKMS, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationKeyRingImportJobSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationKeyRingImportJobSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudkms.projects.locations.keyRings.importJobs.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectLocationKeyRingImportJobSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationKeyRingImportJobSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationKeyRingImportJobSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationKeyRingImportJobSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationKeyRingImportJobSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Create a new CryptoKeyVersion in a CryptoKey. /// /// The server will assign the next sequential id. If unset, @@ -8192,7 +8735,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall<'a, C, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8208,10 +8751,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall<'a, C, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8243,7 +8783,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall<'a, C, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8334,7 +8874,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall<'a, C, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8468,7 +9008,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall<'a, C, A> } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8484,10 +9024,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall<'a, C, A> } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8507,7 +9044,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall<'a, C, A> let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8585,7 +9122,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall<'a, C, A> /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8727,7 +9264,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeySetIamPolicyCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8743,10 +9280,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeySetIamPolicyCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8778,7 +9312,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeySetIamPolicyCall<'a, C, A> where C request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8869,7 +9403,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeySetIamPolicyCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9016,7 +9550,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall<'a, C, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9032,10 +9566,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall<'a, C, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9067,7 +9598,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall<'a, C, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9157,7 +9688,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall<'a, C, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9205,6 +9736,292 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall<'a, C, } +/// Returns permissions that a caller has on the specified resource. +/// If the resource does not exist, this will return an empty set of +/// permissions, not a NOT_FOUND error. +/// +/// Note: This operation is designed to be used for building permission-aware +/// UIs and command-line tools, not for authorization checking. This operation +/// may "fail open" without warning. +/// +/// A builder for the *locations.keyRings.importJobs.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudkms1 as cloudkms1; +/// use cloudkms1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudkms1::CloudKMS; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudKMS::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_key_rings_import_jobs_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationKeyRingImportJobTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudKMS, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationKeyRingImportJobTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationKeyRingImportJobTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudkms.projects.locations.keyRings.importJobs.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectLocationKeyRingImportJobTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationKeyRingImportJobTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationKeyRingImportJobTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationKeyRingImportJobTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationKeyRingImportJobTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Create a new CryptoKey within a KeyRing. /// /// CryptoKey.purpose and @@ -9307,7 +10124,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCreateCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9323,10 +10140,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCreateCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9358,7 +10172,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCreateCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9457,7 +10271,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCreateCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/cloudkms1_beta1/Cargo.toml b/gen/cloudkms1_beta1/Cargo.toml index 731713f3a4..87aa28abed 100644 --- a/gen/cloudkms1_beta1/Cargo.toml +++ b/gen/cloudkms1_beta1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudkms1_beta1/src/lib.rs b/gen/cloudkms1_beta1/src/lib.rs index 6404648a42..268b35b9d9 100644 --- a/gen/cloudkms1_beta1/src/lib.rs +++ b/gen/cloudkms1_beta1/src/lib.rs @@ -1855,7 +1855,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall<'a, C, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1871,10 +1871,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall<'a, C, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1906,7 +1903,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall<'a, C, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2004,7 +2001,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall<'a, C, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2152,7 +2149,7 @@ impl<'a, C, A> ProjectLocationKeyRingCreateCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2203,7 +2197,7 @@ impl<'a, C, A> ProjectLocationKeyRingCreateCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCreateCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingListCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2487,7 +2478,7 @@ impl<'a, C, A> ProjectLocationKeyRingListCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingListCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall<'a, C, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2754,10 +2745,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall<'a, C, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2789,7 +2777,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall<'a, C, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2879,7 +2867,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall<'a, C, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3022,7 +3010,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyEncryptCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3038,10 +3026,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyEncryptCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3073,7 +3058,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyEncryptCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3167,7 +3152,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyEncryptCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3303,7 +3288,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3342,7 +3324,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingGetCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCryptoKeyGetCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3573,10 +3555,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3596,7 +3575,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3674,7 +3653,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3825,7 +3804,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3864,7 +3840,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingTestIamPermissionCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4128,10 +4104,7 @@ impl<'a, C, A> ProjectLocationKeyRingTestIamPermissionCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4163,7 +4136,7 @@ impl<'a, C, A> ProjectLocationKeyRingTestIamPermissionCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4254,7 +4227,7 @@ impl<'a, C, A> ProjectLocationKeyRingTestIamPermissionCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4392,7 +4365,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetIamPolicyCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4408,10 +4381,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetIamPolicyCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4431,7 +4401,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetIamPolicyCall<'a, C, A> where C let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4510,7 +4480,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyGetIamPolicyCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4653,7 +4623,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall<'a, C, A> } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4669,10 +4639,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall<'a, C, A> } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4704,7 +4671,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall<'a, C, A> request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4794,7 +4761,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall<'a, C, A> /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4942,7 +4909,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyPatchCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4958,10 +4925,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyPatchCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4993,7 +4957,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyPatchCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5091,7 +5055,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyPatchCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5234,7 +5198,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyDecryptCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5250,10 +5214,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyDecryptCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5285,7 +5246,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyDecryptCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5376,7 +5337,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyDecryptCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5514,7 +5475,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetIamPolicyCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5530,10 +5491,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetIamPolicyCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5553,7 +5511,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetIamPolicyCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5632,7 +5590,7 @@ impl<'a, C, A> ProjectLocationKeyRingGetIamPolicyCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5776,7 +5734,7 @@ impl<'a, C, A> ProjectLocationKeyRingSetIamPolicyCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5792,10 +5750,7 @@ impl<'a, C, A> ProjectLocationKeyRingSetIamPolicyCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5827,7 +5782,7 @@ impl<'a, C, A> ProjectLocationKeyRingSetIamPolicyCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5918,7 +5873,7 @@ impl<'a, C, A> ProjectLocationKeyRingSetIamPolicyCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6054,7 +6009,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6093,7 +6045,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationKeyRingCryptoKeyTestIamPermissionCall<'a, C, A> wh } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6336,10 +6288,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyTestIamPermissionCall<'a, C, A> wh } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6371,7 +6320,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyTestIamPermissionCall<'a, C, A> wh request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6462,7 +6411,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyTestIamPermissionCall<'a, C, A> wh /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6608,7 +6557,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall<'a, C, A> } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6624,10 +6573,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall<'a, C, A> } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6647,7 +6593,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall<'a, C, A> let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6745,7 +6691,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall<'a, C, A> /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6891,7 +6837,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyListCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6907,10 +6853,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyListCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6930,7 +6873,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyListCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7027,7 +6970,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyListCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7174,7 +7117,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall<'a, C, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7190,10 +7133,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall<'a, C, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7225,7 +7165,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall<'a, C, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7316,7 +7256,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall<'a, C, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7452,7 +7392,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall<'a, C, A> } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7468,10 +7408,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall<'a, C, A> } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7491,7 +7428,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall<'a, C, A> let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7569,7 +7506,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall<'a, C, A> /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7713,7 +7650,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeySetIamPolicyCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7729,10 +7666,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeySetIamPolicyCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7764,7 +7698,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeySetIamPolicyCall<'a, C, A> where C request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7855,7 +7789,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeySetIamPolicyCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8004,7 +7938,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall<'a, C, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8020,10 +7954,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall<'a, C, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8055,7 +7986,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall<'a, C, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8145,7 +8076,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall<'a, C, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8295,7 +8226,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCreateCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8311,10 +8242,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCreateCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8346,7 +8274,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCreateCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8445,7 +8373,7 @@ impl<'a, C, A> ProjectLocationKeyRingCryptoKeyCreateCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/cloudlatencytest2/Cargo.toml b/gen/cloudlatencytest2/Cargo.toml index 33b189c171..8b4c4e2ad5 100644 --- a/gen/cloudlatencytest2/Cargo.toml +++ b/gen/cloudlatencytest2/Cargo.toml @@ -24,7 +24,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudlatencytest2/src/lib.rs b/gen/cloudlatencytest2/src/lib.rs index e99c3a8440..cee0ab71f1 100644 --- a/gen/cloudlatencytest2/src/lib.rs +++ b/gen/cloudlatencytest2/src/lib.rs @@ -664,10 +664,7 @@ impl<'a, C, A> StatscollectionUpdateaggregatedstatCall<'a, C, A> where C: Borrow } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -699,7 +696,7 @@ impl<'a, C, A> StatscollectionUpdateaggregatedstatCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -779,7 +776,7 @@ impl<'a, C, A> StatscollectionUpdateaggregatedstatCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -905,10 +902,7 @@ impl<'a, C, A> StatscollectionUpdatestatCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -940,7 +934,7 @@ impl<'a, C, A> StatscollectionUpdatestatCall<'a, C, A> where C: BorrowMut StatscollectionUpdatestatCall<'a, C, A> where C: BorrowMut TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1254,7 +1251,7 @@ impl<'a, C, A> TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1614,7 +1608,7 @@ impl<'a, C, A> TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1704,7 +1698,7 @@ impl<'a, C, A> TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1894,10 +1888,7 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1929,7 +1920,7 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2105,7 +2096,7 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2269,10 +2260,7 @@ impl<'a, C, A> MetricDescriptorListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2304,7 +2292,7 @@ impl<'a, C, A> MetricDescriptorListCall<'a, C, A> where C: BorrowMut MetricDescriptorListCall<'a, C, A> where C: BorrowMut MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2582,7 +2567,7 @@ impl<'a, C, A> MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2854,7 +2836,7 @@ impl<'a, C, A> MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut"] +description = "A complete library to interact with Cloud Private Catalog (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprivatecatalog1_beta1-cli" +homepage = "https://sites.google.com/corp/google.com/cloudprivatecatalog" +documentation = "http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli" +license = "MIT" +keywords = ["cloudprivatecatalog", "google", "cli"] +autobins = false + +[[bin]] +name = "cloudprivatecatalog1-beta1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-cloudprivatecatalog1_beta1] +path = "../cloudprivatecatalog1_beta1" +version = "1.0.8+20190330" diff --git a/gen/cloudprivatecatalog1_beta1-cli/LICENSE.md b/gen/cloudprivatecatalog1_beta1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudprivatecatalog1_beta1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudprivatecatalog1_beta1-cli/README.md b/gen/cloudprivatecatalog1_beta1-cli/README.md new file mode 100644 index 0000000000..9a6347321b --- /dev/null +++ b/gen/cloudprivatecatalog1_beta1-cli/README.md @@ -0,0 +1,124 @@ + +The `cloudprivatecatalog1-beta1` command-line interface *(CLI)* allows to use most features of the *Google Cloud Private Catalog* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud Private Catalog* API can be found at the +[official documentation site](https://sites.google.com/corp/google.com/cloudprivatecatalog). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-cloudprivatecatalog1_beta1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprivatecatalog1_beta1-cli). + +# Usage + +This documentation was generated from the *Cloud Private Catalog* API at revision *20190330*. The CLI is at version *1.0.8*. + +```bash +cloudprivatecatalog1-beta1 [options] + folders + catalogs-search [-p ]... [-o ] + products-search [-p ]... [-o ] + versions-search [-p ]... [-o ] + organizations + catalogs-search [-p ]... [-o ] + products-search [-p ]... [-o ] + versions-search [-p ]... [-o ] + projects + catalogs-search [-p ]... [-o ] + products-search [-p ]... [-o ] + versions-search [-p ]... [-o ] + cloudprivatecatalog1-beta1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `cloudprivatecatalog1-beta1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/cloudprivatecatalog1-beta1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/cloudprivatecatalog1-beta1-secret.json`, assuming that the required *cloudprivatecatalog* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `cloudprivatecatalog1-beta1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/cloudprivatecatalog1_beta1-cli/mkdocs.yml b/gen/cloudprivatecatalog1_beta1-cli/mkdocs.yml new file mode 100644 index 0000000000..bddd357fcd --- /dev/null +++ b/gen/cloudprivatecatalog1_beta1-cli/mkdocs.yml @@ -0,0 +1,25 @@ +site_name: Cloud Private Catalog v1.0.8+20190330 +site_url: http://byron.github.io/google-apis-rs/google-cloudprivatecatalog1_beta1-cli +site_description: A complete library to interact with Cloud Private Catalog (protocol v1beta1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprivatecatalog1_beta1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['folders_catalogs-search.md', 'Folders', 'Catalogs Search'] +- ['folders_products-search.md', 'Folders', 'Products Search'] +- ['folders_versions-search.md', 'Folders', 'Versions Search'] +- ['organizations_catalogs-search.md', 'Organizations', 'Catalogs Search'] +- ['organizations_products-search.md', 'Organizations', 'Products Search'] +- ['organizations_versions-search.md', 'Organizations', 'Versions Search'] +- ['projects_catalogs-search.md', 'Projects', 'Catalogs Search'] +- ['projects_products-search.md', 'Projects', 'Products Search'] +- ['projects_versions-search.md', 'Projects', 'Versions Search'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/cloudprivatecatalog1_beta1-cli/src/cmn.rs b/gen/cloudprivatecatalog1_beta1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/cloudprivatecatalog1_beta1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/cloudprivatecatalog1_beta1-cli/src/main.rs b/gen/cloudprivatecatalog1_beta1-cli/src/main.rs new file mode 100644 index 0000000000..f8bebc8717 --- /dev/null +++ b/gen/cloudprivatecatalog1_beta1-cli/src/main.rs @@ -0,0 +1,1079 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_cloudprivatecatalog1_beta1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudPrivateCatalog>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _folders_catalogs_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.folders().catalogs_search(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["query", "page-size", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _folders_products_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.folders().products_search(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["query", "page-size", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _folders_versions_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.folders().versions_search(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["query", "page-size", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_catalogs_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().catalogs_search(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["query", "page-size", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_products_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().products_search(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["query", "page-size", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_versions_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().versions_search(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["query", "page-size", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_catalogs_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().catalogs_search(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["query", "page-size", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_products_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().products_search(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["query", "page-size", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_versions_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().versions_search(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["query", "page-size", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("folders", Some(opt)) => { + match opt.subcommand() { + ("catalogs-search", Some(opt)) => { + call_result = self._folders_catalogs_search(opt, dry_run, &mut err); + }, + ("products-search", Some(opt)) => { + call_result = self._folders_products_search(opt, dry_run, &mut err); + }, + ("versions-search", Some(opt)) => { + call_result = self._folders_versions_search(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("folders".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("organizations", Some(opt)) => { + match opt.subcommand() { + ("catalogs-search", Some(opt)) => { + call_result = self._organizations_catalogs_search(opt, dry_run, &mut err); + }, + ("products-search", Some(opt)) => { + call_result = self._organizations_products_search(opt, dry_run, &mut err); + }, + ("versions-search", Some(opt)) => { + call_result = self._organizations_versions_search(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("organizations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("projects", Some(opt)) => { + match opt.subcommand() { + ("catalogs-search", Some(opt)) => { + call_result = self._projects_catalogs_search(opt, dry_run, &mut err); + }, + ("products-search", Some(opt)) => { + call_result = self._projects_products_search(opt, dry_run, &mut err); + }, + ("versions-search", Some(opt)) => { + call_result = self._projects_versions_search(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "cloudprivatecatalog1-beta1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "cloudprivatecatalog1-beta1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::CloudPrivateCatalog::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("folders", "methods: 'catalogs-search', 'products-search' and 'versions-search'", vec![ + ("catalogs-search", + Some(r##"Search Catalog resources that consumers have access to, within the + scope of the consumer cloud resource hierarchy context."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli/folders_catalogs-search", + vec![ + (Some(r##"resource"##), + None, + Some(r##"Required. The name of the resource context. It can be in following formats: + + * `projects/{project_id}` + * `folders/{folder_id}` + * `organizations/{organization_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-search", + Some(r##"Search Product resources that consumers have access to, within the + scope of the consumer cloud resource hierarchy context."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli/folders_products-search", + vec![ + (Some(r##"resource"##), + None, + Some(r##"Required. The name of the resource context. See + SearchCatalogsRequest.resource for details."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("versions-search", + Some(r##"Search Version resources that consumers have access to, within the + scope of the consumer cloud resource hierarchy context."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli/folders_versions-search", + vec![ + (Some(r##"resource"##), + None, + Some(r##"Required. The name of the resource context. See + SearchCatalogsRequest.resource for details."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("organizations", "methods: 'catalogs-search', 'products-search' and 'versions-search'", vec![ + ("catalogs-search", + Some(r##"Search Catalog resources that consumers have access to, within the + scope of the consumer cloud resource hierarchy context."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli/organizations_catalogs-search", + vec![ + (Some(r##"resource"##), + None, + Some(r##"Required. The name of the resource context. It can be in following formats: + + * `projects/{project_id}` + * `folders/{folder_id}` + * `organizations/{organization_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-search", + Some(r##"Search Product resources that consumers have access to, within the + scope of the consumer cloud resource hierarchy context."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli/organizations_products-search", + vec![ + (Some(r##"resource"##), + None, + Some(r##"Required. The name of the resource context. See + SearchCatalogsRequest.resource for details."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("versions-search", + Some(r##"Search Version resources that consumers have access to, within the + scope of the consumer cloud resource hierarchy context."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli/organizations_versions-search", + vec![ + (Some(r##"resource"##), + None, + Some(r##"Required. The name of the resource context. See + SearchCatalogsRequest.resource for details."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("projects", "methods: 'catalogs-search', 'products-search' and 'versions-search'", vec![ + ("catalogs-search", + Some(r##"Search Catalog resources that consumers have access to, within the + scope of the consumer cloud resource hierarchy context."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli/projects_catalogs-search", + vec![ + (Some(r##"resource"##), + None, + Some(r##"Required. The name of the resource context. It can be in following formats: + + * `projects/{project_id}` + * `folders/{folder_id}` + * `organizations/{organization_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-search", + Some(r##"Search Product resources that consumers have access to, within the + scope of the consumer cloud resource hierarchy context."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli/projects_products-search", + vec![ + (Some(r##"resource"##), + None, + Some(r##"Required. The name of the resource context. See + SearchCatalogsRequest.resource for details."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("versions-search", + Some(r##"Search Version resources that consumers have access to, within the + scope of the consumer cloud resource hierarchy context."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli/projects_versions-search", + vec![ + (Some(r##"resource"##), + None, + Some(r##"Required. The name of the resource context. See + SearchCatalogsRequest.resource for details."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("cloudprivatecatalog1-beta1") + .author("Sebastian Thiel ") + .version("1.0.8+20190330") + .about("Enable cloud users to discover enterprise catalogs and products in their organizations.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudprivatecatalog1_beta1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/cloudprivatecatalog1_beta1/Cargo.toml b/gen/cloudprivatecatalog1_beta1/Cargo.toml new file mode 100644 index 0000000000..919bef7cff --- /dev/null +++ b/gen/cloudprivatecatalog1_beta1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-cloudprivatecatalog1_beta1" +version = "1.0.8+20190330" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Private Catalog (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprivatecatalog1_beta1" +homepage = "https://sites.google.com/corp/google.com/cloudprivatecatalog" +documentation = "https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330" +license = "MIT" +keywords = ["cloudprivatecatalog", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/cloudprivatecatalog1_beta1/LICENSE.md b/gen/cloudprivatecatalog1_beta1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudprivatecatalog1_beta1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudprivatecatalog1_beta1/README.md b/gen/cloudprivatecatalog1_beta1/README.md new file mode 100644 index 0000000000..e3f19481bf --- /dev/null +++ b/gen/cloudprivatecatalog1_beta1/README.md @@ -0,0 +1,191 @@ + +The `google-cloudprivatecatalog1_beta1` library allows access to all features of the *Google Cloud Private Catalog* service. + +This documentation was generated from *Cloud Private Catalog* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *cloudprivatecatalog:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Cloud Private Catalog* *v1_beta1* API can be found at the +[official documentation site](https://sites.google.com/corp/google.com/cloudprivatecatalog). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.CloudPrivateCatalog.html) ... + +* folders + * [*catalogs search*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.FolderCatalogSearchCall.html), [*products search*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.FolderProductSearchCall.html) and [*versions search*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.FolderVersionSearchCall.html) +* organizations + * [*catalogs search*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.OrganizationCatalogSearchCall.html), [*products search*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.OrganizationProductSearchCall.html) and [*versions search*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.OrganizationVersionSearchCall.html) +* projects + * [*catalogs search*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.ProjectCatalogSearchCall.html), [*products search*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.ProjectProductSearchCall.html) and [*versions search*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.ProjectVersionSearchCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/struct.CloudPrivateCatalog.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.projects().versions_search(...).doit() +let r = hub.folders().versions_search(...).doit() +let r = hub.organizations().versions_search(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-cloudprivatecatalog1_beta1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +use cloudprivatecatalog1_beta1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use cloudprivatecatalog1_beta1::CloudPrivateCatalog; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.projects().versions_search("resource") + .query("sit") + .page_token("Stet") + .page_size(-42) + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-cloudprivatecatalog1_beta1/1.0.8+20190330/google_cloudprivatecatalog1_beta1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **cloudprivatecatalog1_beta1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/cloudprivatecatalog1_beta1/src/cmn.rs b/gen/cloudprivatecatalog1_beta1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/cloudprivatecatalog1_beta1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/cloudprivatecatalog1_beta1/src/lib.rs b/gen/cloudprivatecatalog1_beta1/src/lib.rs new file mode 100644 index 0000000000..7dc9e763f5 --- /dev/null +++ b/gen/cloudprivatecatalog1_beta1/src/lib.rs @@ -0,0 +1,3635 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud Private Catalog* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *cloudprivatecatalog:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Cloud Private Catalog* *v1_beta1* API can be found at the +//! [official documentation site](https://sites.google.com/corp/google.com/cloudprivatecatalog). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprivatecatalog1_beta1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.CloudPrivateCatalog.html) ... +//! +//! * folders +//! * [*catalogs search*](struct.FolderCatalogSearchCall.html), [*products search*](struct.FolderProductSearchCall.html) and [*versions search*](struct.FolderVersionSearchCall.html) +//! * organizations +//! * [*catalogs search*](struct.OrganizationCatalogSearchCall.html), [*products search*](struct.OrganizationProductSearchCall.html) and [*versions search*](struct.OrganizationVersionSearchCall.html) +//! * projects +//! * [*catalogs search*](struct.ProjectCatalogSearchCall.html), [*products search*](struct.ProjectProductSearchCall.html) and [*versions search*](struct.ProjectVersionSearchCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudPrivateCatalog.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().versions_search(...).doit() +//! let r = hub.folders().versions_search(...).doit() +//! let r = hub.organizations().versions_search(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-cloudprivatecatalog1_beta1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +//! use cloudprivatecatalog1_beta1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.projects().versions_search("resource") +//! .query("dolores") +//! .page_token("kasd") +//! .page_size(-22) +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudPrivateCatalog related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// use cloudprivatecatalog1_beta1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().versions_search("resource") +/// .query("justo") +/// .page_token("amet.") +/// .page_size(-81) +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudPrivateCatalog { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for CloudPrivateCatalog {} + +impl<'a, C, A> CloudPrivateCatalog + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudPrivateCatalog { + CloudPrivateCatalog { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://cloudprivatecatalog.googleapis.com/".to_string(), + _root_url: "https://cloudprivatecatalog.googleapis.com/".to_string(), + } + } + + pub fn folders(&'a self) -> FolderMethods<'a, C, A> { + FolderMethods { hub: &self } + } + pub fn organizations(&'a self) -> OrganizationMethods<'a, C, A> { + OrganizationMethods { hub: &self } + } + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://cloudprivatecatalog.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://cloudprivatecatalog.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Response message for PrivateCatalog.SearchVersions. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [versions search projects](struct.ProjectVersionSearchCall.html) (response) +/// * [versions search folders](struct.FolderVersionSearchCall.html) (response) +/// * [versions search organizations](struct.OrganizationVersionSearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse { + /// A pagination token returned from a previous call to SearchVersions that + /// indicates from where the listing should continue. + /// This field is optional. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The `Version` resources computed from the resource context. + pub versions: Option>, +} + +impl ResponseResult for GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse {} + + +/// The readonly representation of a product computed with a given resource +/// context. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogV1beta1Product { + /// Output only. The type of the product asset. It can be one of the + /// following values: + /// + /// * `google.deploymentmanager.Template` + /// * `google.cloudprivatecatalog.ListingOnly` + #[serde(rename="assetType")] + pub asset_type: Option, + /// Output only. The time when the product was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Output only. The icon URI of the product. + #[serde(rename="iconUri")] + pub icon_uri: Option, + /// Output only. The resource name of the target product, in the format of + /// `products/a-z*[a-z0-9]'. + /// + /// A unique identifier for the product under a catalog. + pub name: Option, + /// Output only. The display metadata to describe the product. + /// The JSON schema of the metadata differs by Product.asset_type. + /// When the type is `google.deploymentmanager.Template`, the schema is as + /// follows: + /// + /// ``` + /// "$schema": http://json-schema.org/draft-04/schema# + /// type: object + /// properties: + /// name: + /// type: string + /// minLength: 1 + /// maxLength: 64 + /// description: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// tagline: + /// type: string + /// minLength: 1 + /// maxLength: 100 + /// support_info: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// creator: + /// type: string + /// minLength: 1 + /// maxLength: 100 + /// documentation: + /// type: array + /// items: + /// type: object + /// properties: + /// url: + /// type: string + /// pattern: + /// "^(https?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]" + /// title: + /// type: string + /// minLength: 1 + /// maxLength: 64 + /// description: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// required: + /// - name + /// - description + /// additionalProperties: false + /// + /// ``` + /// + /// When the asset type is `google.cloudprivatecatalog.ListingOnly`, the schema + /// is as follows: + /// + /// ``` + /// "$schema": http://json-schema.org/draft-04/schema# + /// type: object + /// properties: + /// name: + /// type: string + /// minLength: 1 + /// maxLength: 64 + /// description: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// tagline: + /// type: string + /// minLength: 1 + /// maxLength: 100 + /// support_info: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// creator: + /// type: string + /// minLength: 1 + /// maxLength: 100 + /// documentation: + /// type: array + /// items: + /// type: object + /// properties: + /// url: + /// type: string + /// pattern: + /// "^(https?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]" + /// title: + /// type: string + /// minLength: 1 + /// maxLength: 64 + /// description: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// signup_url: + /// type: string + /// pattern: + /// "^(https?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]" + /// required: + /// - name + /// - description + /// - signup_url + /// additionalProperties: false + /// ``` + #[serde(rename="displayMetadata")] + pub display_metadata: Option>, + /// Output only. The time when the product was created. + #[serde(rename="createTime")] + pub create_time: Option, +} + +impl Part for GoogleCloudPrivatecatalogV1beta1Product {} + + +/// The readonly representation of a catalog computed with a given resource +/// context. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogV1beta1Catalog { + /// Output only. The time when the catalog was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Output only. The descriptive name of the catalog as it appears in UIs. + #[serde(rename="displayName")] + pub display_name: Option, + /// Output only. The description of the catalog. + pub description: Option, + /// Output only. The time when the catalog was created. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. The resource name of the target catalog, in the format of + /// `catalogs/{catalog_id}'. + pub name: Option, +} + +impl Part for GoogleCloudPrivatecatalogV1beta1Catalog {} + + +/// Response message for PrivateCatalog.SearchCatalogs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [catalogs search folders](struct.FolderCatalogSearchCall.html) (response) +/// * [catalogs search organizations](struct.OrganizationCatalogSearchCall.html) (response) +/// * [catalogs search projects](struct.ProjectCatalogSearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogV1beta1SearchCatalogsResponse { + /// A pagination token returned from a previous call to SearchCatalogs that + /// indicates from where listing should continue. + /// This field is optional. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The `Catalog`s computed from the resource context. + pub catalogs: Option>, +} + +impl ResponseResult for GoogleCloudPrivatecatalogV1beta1SearchCatalogsResponse {} + + +/// The consumer representation of a version which is a child resource under a +/// `Product` with asset data. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogV1beta1Version { + /// Output only. The time when the version was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Output only. The user-supplied description of the version. Maximum of 256 + /// characters. + pub description: Option, + /// Output only. The asset which has been validated and is ready to be + /// provisioned. See + /// google.cloud.privatecatalogproducer.v1beta.Version.asset for details. + pub asset: Option>, + /// Output only. The resource name of the version, in the format + /// `catalogs/{catalog_id}/products/{product_id}/versions/a-z*[a-z0-9]'. + /// + /// A unique identifier for the version under a product. + pub name: Option, + /// Output only. The time when the version was created. + #[serde(rename="createTime")] + pub create_time: Option, +} + +impl Part for GoogleCloudPrivatecatalogV1beta1Version {} + + +/// Response message for PrivateCatalog.SearchProducts. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [products search projects](struct.ProjectProductSearchCall.html) (response) +/// * [products search organizations](struct.OrganizationProductSearchCall.html) (response) +/// * [products search folders](struct.FolderProductSearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogV1beta1SearchProductsResponse { + /// A pagination token returned from a previous call to SearchProducts that + /// indicates from where listing should continue. + /// This field is optional. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The `Product` resources computed from the resource context. + pub products: Option>, +} + +impl ResponseResult for GoogleCloudPrivatecatalogV1beta1SearchProductsResponse {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *folder* resources. +/// It is not used directly, but through the `CloudPrivateCatalog` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `catalogs_search(...)`, `products_search(...)` and `versions_search(...)` +/// // to build up your call. +/// let rb = hub.folders(); +/// # } +/// ``` +pub struct FolderMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, +} + +impl<'a, C, A> MethodsBuilder for FolderMethods<'a, C, A> {} + +impl<'a, C, A> FolderMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Search Version resources that consumers have access to, within the + /// scope of the consumer cloud resource hierarchy context. + /// + /// # Arguments + /// + /// * `resource` - Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + pub fn versions_search(&self, resource: &str) -> FolderVersionSearchCall<'a, C, A> { + FolderVersionSearchCall { + hub: self.hub, + _resource: resource.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Search Catalog resources that consumers have access to, within the + /// scope of the consumer cloud resource hierarchy context. + /// + /// # Arguments + /// + /// * `resource` - Required. The name of the resource context. It can be in following formats: + /// * `projects/{project_id}` + /// * `folders/{folder_id}` + /// * `organizations/{organization_id}` + pub fn catalogs_search(&self, resource: &str) -> FolderCatalogSearchCall<'a, C, A> { + FolderCatalogSearchCall { + hub: self.hub, + _resource: resource.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Search Product resources that consumers have access to, within the + /// scope of the consumer cloud resource hierarchy context. + /// + /// # Arguments + /// + /// * `resource` - Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + pub fn products_search(&self, resource: &str) -> FolderProductSearchCall<'a, C, A> { + FolderProductSearchCall { + hub: self.hub, + _resource: resource.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *organization* resources. +/// It is not used directly, but through the `CloudPrivateCatalog` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `catalogs_search(...)`, `products_search(...)` and `versions_search(...)` +/// // to build up your call. +/// let rb = hub.organizations(); +/// # } +/// ``` +pub struct OrganizationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, +} + +impl<'a, C, A> MethodsBuilder for OrganizationMethods<'a, C, A> {} + +impl<'a, C, A> OrganizationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Search Catalog resources that consumers have access to, within the + /// scope of the consumer cloud resource hierarchy context. + /// + /// # Arguments + /// + /// * `resource` - Required. The name of the resource context. It can be in following formats: + /// * `projects/{project_id}` + /// * `folders/{folder_id}` + /// * `organizations/{organization_id}` + pub fn catalogs_search(&self, resource: &str) -> OrganizationCatalogSearchCall<'a, C, A> { + OrganizationCatalogSearchCall { + hub: self.hub, + _resource: resource.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Search Version resources that consumers have access to, within the + /// scope of the consumer cloud resource hierarchy context. + /// + /// # Arguments + /// + /// * `resource` - Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + pub fn versions_search(&self, resource: &str) -> OrganizationVersionSearchCall<'a, C, A> { + OrganizationVersionSearchCall { + hub: self.hub, + _resource: resource.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Search Product resources that consumers have access to, within the + /// scope of the consumer cloud resource hierarchy context. + /// + /// # Arguments + /// + /// * `resource` - Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + pub fn products_search(&self, resource: &str) -> OrganizationProductSearchCall<'a, C, A> { + OrganizationProductSearchCall { + hub: self.hub, + _resource: resource.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `CloudPrivateCatalog` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `catalogs_search(...)`, `products_search(...)` and `versions_search(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Search Product resources that consumers have access to, within the + /// scope of the consumer cloud resource hierarchy context. + /// + /// # Arguments + /// + /// * `resource` - Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + pub fn products_search(&self, resource: &str) -> ProjectProductSearchCall<'a, C, A> { + ProjectProductSearchCall { + hub: self.hub, + _resource: resource.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Search Version resources that consumers have access to, within the + /// scope of the consumer cloud resource hierarchy context. + /// + /// # Arguments + /// + /// * `resource` - Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + pub fn versions_search(&self, resource: &str) -> ProjectVersionSearchCall<'a, C, A> { + ProjectVersionSearchCall { + hub: self.hub, + _resource: resource.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Search Catalog resources that consumers have access to, within the + /// scope of the consumer cloud resource hierarchy context. + /// + /// # Arguments + /// + /// * `resource` - Required. The name of the resource context. It can be in following formats: + /// * `projects/{project_id}` + /// * `folders/{folder_id}` + /// * `organizations/{organization_id}` + pub fn catalogs_search(&self, resource: &str) -> ProjectCatalogSearchCall<'a, C, A> { + ProjectCatalogSearchCall { + hub: self.hub, + _resource: resource.to_string(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Search Version resources that consumers have access to, within the +/// scope of the consumer cloud resource hierarchy context. +/// +/// A builder for the *versions.search* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().versions_search("resource") +/// .query("sea") +/// .page_token("nonumy") +/// .page_size(-19) +/// .doit(); +/// # } +/// ``` +pub struct FolderVersionSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, + _resource: String, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderVersionSearchCall<'a, C, A> {} + +impl<'a, C, A> FolderVersionSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalog.folders.versions.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "resource", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}/versions:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> FolderVersionSearchCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The query to filter the versions. Required. + /// + /// The supported queries are: + /// * List versions under a product: + /// `parent=catalogs/{catalog_id}/products/{product_id}` + /// * Get a version by name: + /// `name=catalogs/{catalog_id}/products/{product_id}/versions/{version_id}` + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> FolderVersionSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A pagination token returned from a previous call to SearchVersions + /// that indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FolderVersionSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of entries that are requested. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> FolderVersionSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderVersionSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderVersionSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderVersionSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Search Catalog resources that consumers have access to, within the +/// scope of the consumer cloud resource hierarchy context. +/// +/// A builder for the *catalogs.search* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().catalogs_search("resource") +/// .query("sadipscing") +/// .page_token("aliquyam") +/// .page_size(-66) +/// .doit(); +/// # } +/// ``` +pub struct FolderCatalogSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, + _resource: String, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderCatalogSearchCall<'a, C, A> {} + +impl<'a, C, A> FolderCatalogSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogV1beta1SearchCatalogsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalog.folders.catalogs.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "resource", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}/catalogs:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the resource context. It can be in following formats: + /// + /// * `projects/{project_id}` + /// * `folders/{folder_id}` + /// * `organizations/{organization_id}` + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> FolderCatalogSearchCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The query to filter the catalogs. The supported queries are: + /// + /// * Get a single catalog: `name=catalogs/{catalog_id}` + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> FolderCatalogSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A pagination token returned from a previous call to SearchCatalogs that + /// indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FolderCatalogSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of entries that are requested. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> FolderCatalogSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderCatalogSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderCatalogSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderCatalogSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Search Product resources that consumers have access to, within the +/// scope of the consumer cloud resource hierarchy context. +/// +/// A builder for the *products.search* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().products_search("resource") +/// .query("justo") +/// .page_token("justo") +/// .page_size(-34) +/// .doit(); +/// # } +/// ``` +pub struct FolderProductSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, + _resource: String, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderProductSearchCall<'a, C, A> {} + +impl<'a, C, A> FolderProductSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogV1beta1SearchProductsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalog.folders.products.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "resource", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}/products:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> FolderProductSearchCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The query to filter the products. + /// + /// The supported queries are: + /// * List products of all catalogs: empty + /// * List products under a catalog: `parent=catalogs/{catalog_id}` + /// * Get a product by name: + /// `name=catalogs/{catalog_id}/products/{product_id}` + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> FolderProductSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A pagination token returned from a previous call to SearchProducts that + /// indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FolderProductSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of entries that are requested. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> FolderProductSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderProductSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderProductSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderProductSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Search Catalog resources that consumers have access to, within the +/// scope of the consumer cloud resource hierarchy context. +/// +/// A builder for the *catalogs.search* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().catalogs_search("resource") +/// .query("diam") +/// .page_token("ipsum") +/// .page_size(-5) +/// .doit(); +/// # } +/// ``` +pub struct OrganizationCatalogSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, + _resource: String, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationCatalogSearchCall<'a, C, A> {} + +impl<'a, C, A> OrganizationCatalogSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogV1beta1SearchCatalogsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalog.organizations.catalogs.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "resource", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}/catalogs:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the resource context. It can be in following formats: + /// + /// * `projects/{project_id}` + /// * `folders/{folder_id}` + /// * `organizations/{organization_id}` + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> OrganizationCatalogSearchCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The query to filter the catalogs. The supported queries are: + /// + /// * Get a single catalog: `name=catalogs/{catalog_id}` + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> OrganizationCatalogSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A pagination token returned from a previous call to SearchCatalogs that + /// indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrganizationCatalogSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of entries that are requested. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OrganizationCatalogSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationCatalogSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationCatalogSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationCatalogSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Search Version resources that consumers have access to, within the +/// scope of the consumer cloud resource hierarchy context. +/// +/// A builder for the *versions.search* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().versions_search("resource") +/// .query("duo") +/// .page_token("aliquyam") +/// .page_size(-9) +/// .doit(); +/// # } +/// ``` +pub struct OrganizationVersionSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, + _resource: String, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationVersionSearchCall<'a, C, A> {} + +impl<'a, C, A> OrganizationVersionSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalog.organizations.versions.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "resource", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}/versions:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> OrganizationVersionSearchCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The query to filter the versions. Required. + /// + /// The supported queries are: + /// * List versions under a product: + /// `parent=catalogs/{catalog_id}/products/{product_id}` + /// * Get a version by name: + /// `name=catalogs/{catalog_id}/products/{product_id}/versions/{version_id}` + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> OrganizationVersionSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A pagination token returned from a previous call to SearchVersions + /// that indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrganizationVersionSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of entries that are requested. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OrganizationVersionSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationVersionSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationVersionSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationVersionSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Search Product resources that consumers have access to, within the +/// scope of the consumer cloud resource hierarchy context. +/// +/// A builder for the *products.search* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().products_search("resource") +/// .query("eos") +/// .page_token("erat") +/// .page_size(-95) +/// .doit(); +/// # } +/// ``` +pub struct OrganizationProductSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, + _resource: String, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationProductSearchCall<'a, C, A> {} + +impl<'a, C, A> OrganizationProductSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogV1beta1SearchProductsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalog.organizations.products.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "resource", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}/products:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> OrganizationProductSearchCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The query to filter the products. + /// + /// The supported queries are: + /// * List products of all catalogs: empty + /// * List products under a catalog: `parent=catalogs/{catalog_id}` + /// * Get a product by name: + /// `name=catalogs/{catalog_id}/products/{product_id}` + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> OrganizationProductSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A pagination token returned from a previous call to SearchProducts that + /// indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrganizationProductSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of entries that are requested. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OrganizationProductSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationProductSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationProductSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationProductSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Search Product resources that consumers have access to, within the +/// scope of the consumer cloud resource hierarchy context. +/// +/// A builder for the *products.search* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().products_search("resource") +/// .query("eirmod") +/// .page_token("elitr") +/// .page_size(-97) +/// .doit(); +/// # } +/// ``` +pub struct ProjectProductSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, + _resource: String, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectProductSearchCall<'a, C, A> {} + +impl<'a, C, A> ProjectProductSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogV1beta1SearchProductsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalog.projects.products.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "resource", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}/products:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectProductSearchCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The query to filter the products. + /// + /// The supported queries are: + /// * List products of all catalogs: empty + /// * List products under a catalog: `parent=catalogs/{catalog_id}` + /// * Get a product by name: + /// `name=catalogs/{catalog_id}/products/{product_id}` + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> ProjectProductSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A pagination token returned from a previous call to SearchProducts that + /// indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectProductSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of entries that are requested. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectProductSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectProductSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectProductSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectProductSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Search Version resources that consumers have access to, within the +/// scope of the consumer cloud resource hierarchy context. +/// +/// A builder for the *versions.search* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().versions_search("resource") +/// .query("labore") +/// .page_token("eirmod") +/// .page_size(-33) +/// .doit(); +/// # } +/// ``` +pub struct ProjectVersionSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, + _resource: String, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectVersionSearchCall<'a, C, A> {} + +impl<'a, C, A> ProjectVersionSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalog.projects.versions.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "resource", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}/versions:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the resource context. See + /// SearchCatalogsRequest.resource for details. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectVersionSearchCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The query to filter the versions. Required. + /// + /// The supported queries are: + /// * List versions under a product: + /// `parent=catalogs/{catalog_id}/products/{product_id}` + /// * Get a version by name: + /// `name=catalogs/{catalog_id}/products/{product_id}/versions/{version_id}` + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> ProjectVersionSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A pagination token returned from a previous call to SearchVersions + /// that indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectVersionSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of entries that are requested. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectVersionSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectVersionSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectVersionSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectVersionSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Search Catalog resources that consumers have access to, within the +/// scope of the consumer cloud resource hierarchy context. +/// +/// A builder for the *catalogs.search* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalog1_beta1 as cloudprivatecatalog1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalog1_beta1::CloudPrivateCatalog; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalog::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().catalogs_search("resource") +/// .query("aliquyam") +/// .page_token("accusam") +/// .page_size(-56) +/// .doit(); +/// # } +/// ``` +pub struct ProjectCatalogSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalog, + _resource: String, + _query: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectCatalogSearchCall<'a, C, A> {} + +impl<'a, C, A> ProjectCatalogSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogV1beta1SearchCatalogsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalog.projects.catalogs.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "resource", "query", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}/catalogs:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the resource context. It can be in following formats: + /// + /// * `projects/{project_id}` + /// * `folders/{folder_id}` + /// * `organizations/{organization_id}` + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectCatalogSearchCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The query to filter the catalogs. The supported queries are: + /// + /// * Get a single catalog: `name=catalogs/{catalog_id}` + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> ProjectCatalogSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// A pagination token returned from a previous call to SearchCatalogs that + /// indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectCatalogSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of entries that are requested. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectCatalogSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectCatalogSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectCatalogSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectCatalogSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/cloudprivatecatalogproducer1_beta1-cli/Cargo.toml b/gen/cloudprivatecatalogproducer1_beta1-cli/Cargo.toml new file mode 100644 index 0000000000..7ba90fd98c --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-cloudprivatecatalogproducer1_beta1-cli" +version = "1.0.8+20190330" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud PrivateCatalog Producer (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprivatecatalogproducer1_beta1-cli" +homepage = "https://sites.google.com/corp/google.com/cloudprivatecatalog" +documentation = "http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli" +license = "MIT" +keywords = ["cloudprivatecatalogp", "google", "cli"] +autobins = false + +[[bin]] +name = "cloudprivatecatalogproducer1-beta1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-cloudprivatecatalogproducer1_beta1] +path = "../cloudprivatecatalogproducer1_beta1" +version = "1.0.8+20190330" diff --git a/gen/cloudprivatecatalogproducer1_beta1-cli/LICENSE.md b/gen/cloudprivatecatalogproducer1_beta1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudprivatecatalogproducer1_beta1-cli/README.md b/gen/cloudprivatecatalogproducer1_beta1-cli/README.md new file mode 100644 index 0000000000..8876416802 --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1-cli/README.md @@ -0,0 +1,143 @@ + +The `cloudprivatecatalogproducer1-beta1` command-line interface *(CLI)* allows to use most features of the *Google Cloud PrivateCatalog Producer* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud PrivateCatalog Producer* API can be found at the +[official documentation site](https://sites.google.com/corp/google.com/cloudprivatecatalog). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-cloudprivatecatalogproducer1_beta1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprivatecatalogproducer1_beta1-cli). + +# Usage + +This documentation was generated from the *Cloud PrivateCatalog Producer* API at revision *20190330*. The CLI is at version *1.0.8*. + +```bash +cloudprivatecatalogproducer1-beta1 [options] + catalogs + associations-create (-r )... [-p ]... [-o ] + associations-delete [-p ]... [-o ] + associations-get [-p ]... [-o ] + associations-list [-p ]... [-o ] + create (-r )... [-p ]... [-o ] + delete [-p ]... [-o ] + get [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + products-copy (-r )... [-p ]... [-o ] + products-create (-r )... [-p ]... [-o ] + products-delete [-p ]... [-o ] + products-get [-p ]... [-o ] + products-icons-upload (-r )... [-p ]... [-o ] + products-list [-p ]... [-o ] + products-patch (-r )... [-p ]... [-o ] + products-versions-create (-r )... [-p ]... [-o ] + products-versions-delete [-p ]... [-o ] + products-versions-get [-p ]... [-o ] + products-versions-list [-p ]... [-o ] + products-versions-patch (-r )... [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] + undelete (-r )... [-p ]... [-o ] + operations + cancel (-r )... [-p ]... [-o ] + delete [-p ]... [-o ] + get [-p ]... [-o ] + list [-p ]... [-o ] + cloudprivatecatalogproducer1-beta1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `cloudprivatecatalogproducer1-beta1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/cloudprivatecatalogproducer1-beta1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/cloudprivatecatalogproducer1-beta1-secret.json`, assuming that the required *cloudprivatecatalogproducer* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `cloudprivatecatalogproducer1-beta1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/cloudprivatecatalogproducer1_beta1-cli/mkdocs.yml b/gen/cloudprivatecatalogproducer1_beta1-cli/mkdocs.yml new file mode 100644 index 0000000000..f39cb7b8cc --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1-cli/mkdocs.yml @@ -0,0 +1,45 @@ +site_name: Cloud PrivateCatalog Producer v1.0.8+20190330 +site_url: http://byron.github.io/google-apis-rs/google-cloudprivatecatalogproducer1_beta1-cli +site_description: A complete library to interact with Cloud PrivateCatalog Producer (protocol v1beta1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprivatecatalogproducer1_beta1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['catalogs_associations-create.md', 'Catalogs', 'Associations Create'] +- ['catalogs_associations-delete.md', 'Catalogs', 'Associations Delete'] +- ['catalogs_associations-get.md', 'Catalogs', 'Associations Get'] +- ['catalogs_associations-list.md', 'Catalogs', 'Associations List'] +- ['catalogs_create.md', 'Catalogs', 'Create'] +- ['catalogs_delete.md', 'Catalogs', 'Delete'] +- ['catalogs_get.md', 'Catalogs', 'Get'] +- ['catalogs_get-iam-policy.md', 'Catalogs', 'Get Iam Policy'] +- ['catalogs_list.md', 'Catalogs', 'List'] +- ['catalogs_patch.md', 'Catalogs', 'Patch'] +- ['catalogs_products-copy.md', 'Catalogs', 'Products Copy'] +- ['catalogs_products-create.md', 'Catalogs', 'Products Create'] +- ['catalogs_products-delete.md', 'Catalogs', 'Products Delete'] +- ['catalogs_products-get.md', 'Catalogs', 'Products Get'] +- ['catalogs_products-icons-upload.md', 'Catalogs', 'Products Icons Upload'] +- ['catalogs_products-list.md', 'Catalogs', 'Products List'] +- ['catalogs_products-patch.md', 'Catalogs', 'Products Patch'] +- ['catalogs_products-versions-create.md', 'Catalogs', 'Products Versions Create'] +- ['catalogs_products-versions-delete.md', 'Catalogs', 'Products Versions Delete'] +- ['catalogs_products-versions-get.md', 'Catalogs', 'Products Versions Get'] +- ['catalogs_products-versions-list.md', 'Catalogs', 'Products Versions List'] +- ['catalogs_products-versions-patch.md', 'Catalogs', 'Products Versions Patch'] +- ['catalogs_set-iam-policy.md', 'Catalogs', 'Set Iam Policy'] +- ['catalogs_test-iam-permissions.md', 'Catalogs', 'Test Iam Permissions'] +- ['catalogs_undelete.md', 'Catalogs', 'Undelete'] +- ['operations_cancel.md', 'Operations', 'Cancel'] +- ['operations_delete.md', 'Operations', 'Delete'] +- ['operations_get.md', 'Operations', 'Get'] +- ['operations_list.md', 'Operations', 'List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/cloudprivatecatalogproducer1_beta1-cli/src/cmn.rs b/gen/cloudprivatecatalogproducer1_beta1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/cloudprivatecatalogproducer1_beta1-cli/src/main.rs b/gen/cloudprivatecatalogproducer1_beta1-cli/src/main.rs new file mode 100644 index 0000000000..5bc3ad92d5 --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1-cli/src/main.rs @@ -0,0 +1,3122 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_cloudprivatecatalogproducer1_beta1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudPrivateCatalogProducer>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _catalogs_associations_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "association.resource" => Some(("association.resource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "association.create-time" => Some(("association.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "association.name" => Some(("association.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["association", "create-time", "name", "resource"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudPrivatecatalogproducerV1beta1CreateAssociationRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().associations_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_associations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().associations_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_associations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().associations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_associations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().associations_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "display-name", "name", "parent", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudPrivatecatalogproducerV1beta1Catalog = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().create(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "force" => { + call = call.force(arg_from_str(value.unwrap_or("false"), err, "force", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["force"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().get_iam_policy(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "parent" => { + call = call.parent(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size", "parent"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "display-name", "name", "parent", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudPrivatecatalogproducerV1beta1Catalog = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_copy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "destination-product-name" => Some(("destinationProductName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination-product-name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().products_copy(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "asset-type" => Some(("assetType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "icon-uri" => Some(("iconUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["asset-type", "create-time", "icon-uri", "name", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudPrivatecatalogproducerV1beta1Product = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().products_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().products_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().products_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_icons_upload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "icon" => Some(("icon", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["icon"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudPrivatecatalogproducerV1beta1UploadIconRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().products_icons_upload(request, opt.value_of("product").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().products_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "asset-type" => Some(("assetType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "icon-uri" => Some(("iconUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["asset-type", "create-time", "icon-uri", "name", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudPrivatecatalogproducerV1beta1Product = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().products_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_versions_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "name", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudPrivatecatalogproducerV1beta1Version = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().products_versions_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_versions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().products_versions_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_versions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().products_versions_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.catalogs().products_versions_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_products_versions_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "name", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudPrivatecatalogproducerV1beta1Version = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().products_versions_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleIamV1SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleIamV1TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _catalogs_undelete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudPrivatecatalogproducerV1beta1UndeleteCatalogRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.catalogs().undelete(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleLongrunningCancelOperationRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.operations().cancel(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "name" => { + call = call.name(value.unwrap_or("")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "name", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("catalogs", Some(opt)) => { + match opt.subcommand() { + ("associations-create", Some(opt)) => { + call_result = self._catalogs_associations_create(opt, dry_run, &mut err); + }, + ("associations-delete", Some(opt)) => { + call_result = self._catalogs_associations_delete(opt, dry_run, &mut err); + }, + ("associations-get", Some(opt)) => { + call_result = self._catalogs_associations_get(opt, dry_run, &mut err); + }, + ("associations-list", Some(opt)) => { + call_result = self._catalogs_associations_list(opt, dry_run, &mut err); + }, + ("create", Some(opt)) => { + call_result = self._catalogs_create(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._catalogs_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._catalogs_get(opt, dry_run, &mut err); + }, + ("get-iam-policy", Some(opt)) => { + call_result = self._catalogs_get_iam_policy(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._catalogs_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._catalogs_patch(opt, dry_run, &mut err); + }, + ("products-copy", Some(opt)) => { + call_result = self._catalogs_products_copy(opt, dry_run, &mut err); + }, + ("products-create", Some(opt)) => { + call_result = self._catalogs_products_create(opt, dry_run, &mut err); + }, + ("products-delete", Some(opt)) => { + call_result = self._catalogs_products_delete(opt, dry_run, &mut err); + }, + ("products-get", Some(opt)) => { + call_result = self._catalogs_products_get(opt, dry_run, &mut err); + }, + ("products-icons-upload", Some(opt)) => { + call_result = self._catalogs_products_icons_upload(opt, dry_run, &mut err); + }, + ("products-list", Some(opt)) => { + call_result = self._catalogs_products_list(opt, dry_run, &mut err); + }, + ("products-patch", Some(opt)) => { + call_result = self._catalogs_products_patch(opt, dry_run, &mut err); + }, + ("products-versions-create", Some(opt)) => { + call_result = self._catalogs_products_versions_create(opt, dry_run, &mut err); + }, + ("products-versions-delete", Some(opt)) => { + call_result = self._catalogs_products_versions_delete(opt, dry_run, &mut err); + }, + ("products-versions-get", Some(opt)) => { + call_result = self._catalogs_products_versions_get(opt, dry_run, &mut err); + }, + ("products-versions-list", Some(opt)) => { + call_result = self._catalogs_products_versions_list(opt, dry_run, &mut err); + }, + ("products-versions-patch", Some(opt)) => { + call_result = self._catalogs_products_versions_patch(opt, dry_run, &mut err); + }, + ("set-iam-policy", Some(opt)) => { + call_result = self._catalogs_set_iam_policy(opt, dry_run, &mut err); + }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._catalogs_test_iam_permissions(opt, dry_run, &mut err); + }, + ("undelete", Some(opt)) => { + call_result = self._catalogs_undelete(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("catalogs".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("operations", Some(opt)) => { + match opt.subcommand() { + ("cancel", Some(opt)) => { + call_result = self._operations_cancel(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._operations_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._operations_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._operations_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "cloudprivatecatalogproducer1-beta1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "cloudprivatecatalogproducer1-beta1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::CloudPrivateCatalogProducer::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("catalogs", "methods: 'associations-create', 'associations-delete', 'associations-get', 'associations-list', 'create', 'delete', 'get', 'get-iam-policy', 'list', 'patch', 'products-copy', 'products-create', 'products-delete', 'products-get', 'products-icons-upload', 'products-list', 'products-patch', 'products-versions-create', 'products-versions-delete', 'products-versions-get', 'products-versions-list', 'products-versions-patch', 'set-iam-policy', 'test-iam-permissions' and 'undelete'", vec![ + ("associations-create", + Some(r##"Creates an Association instance under a given Catalog."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_associations-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The `Catalog` resource's name."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("associations-delete", + Some(r##"Deletes the given Association."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_associations-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the `Association` to delete."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("associations-get", + Some(r##"Returns the requested Association resource."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_associations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the `Association` to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("associations-list", + Some(r##"Lists all Association resources under a catalog."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_associations-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The resource name of the `Catalog` whose `Associations` are + being retrieved. In the format `catalogs/`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("create", + Some(r##"Creates a new Catalog resource."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_create", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Soft deletes an existing Catalog and all resources under it. + The catalog can only be deleted if there is no associations under it or + DeleteCatalogRequest.force is true. The delete operation + can be recovered by the PrivateCatalogProducer.UndeleteCatalog + method."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the catalog."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Returns the requested Catalog resource."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the catalog."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets IAM policy for the specified Catalog."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists Catalog resources that the producer has access to, within the + scope of the parent resource."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates a specific Catalog resource."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Output only. The resource name of the catalog, in the format + `catalogs/{catalog_id}'. + + A unique identifier for the catalog, which is generated + by catalog service."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-copy", + Some(r##"Copies a Product under another Catalog."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-copy", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the current product that is copied from."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-create", + Some(r##"Creates a Product instance under a given Catalog."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The catalog name of the new product's parent."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-delete", + Some(r##"Hard deletes a Product."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the product."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-get", + Some(r##"Returns the requested Product resource."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the product."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-icons-upload", + Some(r##"Creates an Icon instance under a given Product. + If Product only has a default icon, a new Icon + instance is created and associated with the given Product. + If Product already has a non-default icon, the action creates + a new Icon instance, associates the newly created + Icon with the given Product and deletes the old icon."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-icons-upload", + vec![ + (Some(r##"product"##), + None, + Some(r##"The resource name of the product."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-list", + Some(r##"Lists Product resources that the producer has access to, within the + scope of the parent catalog."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The resource name of the parent resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-patch", + Some(r##"Updates a specific Product resource."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The resource name of the product in the format + `catalogs/{catalog_id}/products/a-z*[a-z0-9]'. + + A unique identifier for the product under a catalog, which cannot + be changed after the product is created. The final + segment of the name must between 1 and 256 characters in length."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-versions-create", + Some(r##"Creates a Version instance under a given Product."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-versions-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The product name of the new version's parent."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-versions-delete", + Some(r##"Hard deletes a Version."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-versions-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the version."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-versions-get", + Some(r##"Returns the requested Version resource."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-versions-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the version."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-versions-list", + Some(r##"Lists Version resources that the producer has access to, within the + scope of the parent Product."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-versions-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The resource name of the parent resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("products-versions-patch", + Some(r##"Updates a specific Version resource."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_products-versions-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The resource name of the version, in the format + `catalogs/{catalog_id}/products/{product_id}/versions/a-z*[a-z0-9]'. + + A unique identifier for the version under a product, which can't + be changed after the version is created. The final segment of the name must + between 1 and 63 characters in length."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the IAM policy for the specified Catalog."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Tests the IAM permissions for the specified Catalog."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("undelete", + Some(r##"Undeletes a deleted Catalog and all resources under it."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/catalogs_undelete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the catalog."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("operations", "methods: 'cancel', 'delete', 'get' and 'list'", vec![ + ("cancel", + Some(r##"Starts asynchronous cancellation on a long-running operation. The server + makes a best effort to cancel the operation, but success is not + guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. Clients can use + Operations.GetOperation or + other methods to check whether the cancellation succeeded or whether the + operation completed despite cancellation. On successful cancellation, + the operation is not deleted; instead, it becomes an operation with + an Operation.error value with a google.rpc.Status.code of 1, + corresponding to `Code.CANCELLED`."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/operations_cancel", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be cancelled."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes a long-running operation. This method indicates that the client is + no longer interested in the operation result. It does not cancel the + operation. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/operations_delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be deleted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/operations_get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists operations that match the specified filter in the request. If the + server doesn't support this method, it returns `UNIMPLEMENTED`. + + NOTE: the `name` binding allows API services to override the binding + to use different resource name schemes, such as `users/*/operations`. To + override the binding, API services can add a binding such as + `"/v1/{name=users/*}/operations"` to their service configuration. + For backwards compatibility, the default name includes the operations + collection id, however overriding users must ensure the name binding + is the parent resource, without the operations collection id."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli/operations_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("cloudprivatecatalogproducer1-beta1") + .author("Sebastian Thiel ") + .version("1.0.8+20190330") + .about("Enables cloud users to manage and share enterprise catalogs intheir organizations.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudprivatecatalogproducer1_beta1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/cloudprivatecatalogproducer1_beta1/Cargo.toml b/gen/cloudprivatecatalogproducer1_beta1/Cargo.toml new file mode 100644 index 0000000000..beb10bbea5 --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-cloudprivatecatalogproducer1_beta1" +version = "1.0.8+20190330" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud PrivateCatalog Producer (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprivatecatalogproducer1_beta1" +homepage = "https://sites.google.com/corp/google.com/cloudprivatecatalog" +documentation = "https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330" +license = "MIT" +keywords = ["cloudprivatecatalogp", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/cloudprivatecatalogproducer1_beta1/LICENSE.md b/gen/cloudprivatecatalogproducer1_beta1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudprivatecatalogproducer1_beta1/README.md b/gen/cloudprivatecatalogproducer1_beta1/README.md new file mode 100644 index 0000000000..f6128b80a4 --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1/README.md @@ -0,0 +1,195 @@ + +The `google-cloudprivatecatalogproducer1_beta1` library allows access to all features of the *Google Cloud PrivateCatalog Producer* service. + +This documentation was generated from *Cloud PrivateCatalog Producer* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *cloudprivatecatalogproducer:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Cloud PrivateCatalog Producer* *v1_beta1* API can be found at the +[official documentation site](https://sites.google.com/corp/google.com/cloudprivatecatalog). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CloudPrivateCatalogProducer.html) ... + +* catalogs + * [*associations create*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogAssociationCreateCall.html), [*associations delete*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogAssociationDeleteCall.html), [*associations get*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogAssociationGetCall.html), [*associations list*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogAssociationListCall.html), [*create*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogCreateCall.html), [*delete*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogDeleteCall.html), [*get*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogGetCall.html), [*get iam policy*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogListCall.html), [*patch*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogPatchCall.html), [*products copy*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductCopyCall.html), [*products create*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductCreateCall.html), [*products delete*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductDeleteCall.html), [*products get*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductGetCall.html), [*products icons upload*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductIconUploadCall.html), [*products list*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductListCall.html), [*products patch*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductPatchCall.html), [*products versions create*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductVersionCreateCall.html), [*products versions delete*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductVersionDeleteCall.html), [*products versions get*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductVersionGetCall.html), [*products versions list*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductVersionListCall.html), [*products versions patch*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogProductVersionPatchCall.html), [*set iam policy*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogTestIamPermissionCall.html) and [*undelete*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CatalogUndeleteCall.html) +* operations + * [*cancel*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.OperationDeleteCall.html), [*get*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.OperationListCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/struct.CloudPrivateCatalogProducer.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.operations().cancel(...).doit() +let r = hub.catalogs().products_versions_delete(...).doit() +let r = hub.catalogs().products_icons_upload(...).doit() +let r = hub.catalogs().associations_delete(...).doit() +let r = hub.operations().delete(...).doit() +let r = hub.catalogs().products_delete(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-cloudprivatecatalogproducer1_beta1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +use cloudprivatecatalogproducer1_beta1::GoogleLongrunningCancelOperationRequest; +use cloudprivatecatalogproducer1_beta1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = GoogleLongrunningCancelOperationRequest::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.operations().cancel(req, "name") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-cloudprivatecatalogproducer1_beta1/1.0.8+20190330/google_cloudprivatecatalogproducer1_beta1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **cloudprivatecatalogproducer1_beta1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/cloudprivatecatalogproducer1_beta1/src/cmn.rs b/gen/cloudprivatecatalogproducer1_beta1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/cloudprivatecatalogproducer1_beta1/src/lib.rs b/gen/cloudprivatecatalogproducer1_beta1/src/lib.rs new file mode 100644 index 0000000000..4c370bed9a --- /dev/null +++ b/gen/cloudprivatecatalogproducer1_beta1/src/lib.rs @@ -0,0 +1,9821 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud PrivateCatalog Producer* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *cloudprivatecatalogproducer:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Cloud PrivateCatalog Producer* *v1_beta1* API can be found at the +//! [official documentation site](https://sites.google.com/corp/google.com/cloudprivatecatalog). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprivatecatalogproducer1_beta1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.CloudPrivateCatalogProducer.html) ... +//! +//! * catalogs +//! * [*associations create*](struct.CatalogAssociationCreateCall.html), [*associations delete*](struct.CatalogAssociationDeleteCall.html), [*associations get*](struct.CatalogAssociationGetCall.html), [*associations list*](struct.CatalogAssociationListCall.html), [*create*](struct.CatalogCreateCall.html), [*delete*](struct.CatalogDeleteCall.html), [*get*](struct.CatalogGetCall.html), [*get iam policy*](struct.CatalogGetIamPolicyCall.html), [*list*](struct.CatalogListCall.html), [*patch*](struct.CatalogPatchCall.html), [*products copy*](struct.CatalogProductCopyCall.html), [*products create*](struct.CatalogProductCreateCall.html), [*products delete*](struct.CatalogProductDeleteCall.html), [*products get*](struct.CatalogProductGetCall.html), [*products icons upload*](struct.CatalogProductIconUploadCall.html), [*products list*](struct.CatalogProductListCall.html), [*products patch*](struct.CatalogProductPatchCall.html), [*products versions create*](struct.CatalogProductVersionCreateCall.html), [*products versions delete*](struct.CatalogProductVersionDeleteCall.html), [*products versions get*](struct.CatalogProductVersionGetCall.html), [*products versions list*](struct.CatalogProductVersionListCall.html), [*products versions patch*](struct.CatalogProductVersionPatchCall.html), [*set iam policy*](struct.CatalogSetIamPolicyCall.html), [*test iam permissions*](struct.CatalogTestIamPermissionCall.html) and [*undelete*](struct.CatalogUndeleteCall.html) +//! * operations +//! * [*cancel*](struct.OperationCancelCall.html), [*delete*](struct.OperationDeleteCall.html), [*get*](struct.OperationGetCall.html) and [*list*](struct.OperationListCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudPrivateCatalogProducer.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.operations().cancel(...).doit() +//! let r = hub.catalogs().products_versions_delete(...).doit() +//! let r = hub.catalogs().products_icons_upload(...).doit() +//! let r = hub.catalogs().associations_delete(...).doit() +//! let r = hub.operations().delete(...).doit() +//! let r = hub.catalogs().products_delete(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-cloudprivatecatalogproducer1_beta1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +//! use cloudprivatecatalogproducer1_beta1::GoogleLongrunningCancelOperationRequest; +//! use cloudprivatecatalogproducer1_beta1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = GoogleLongrunningCancelOperationRequest::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.operations().cancel(req, "name") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudPrivateCatalogProducer related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleLongrunningCancelOperationRequest; +/// use cloudprivatecatalogproducer1_beta1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleLongrunningCancelOperationRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().cancel(req, "name") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudPrivateCatalogProducer { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for CloudPrivateCatalogProducer {} + +impl<'a, C, A> CloudPrivateCatalogProducer + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudPrivateCatalogProducer { + CloudPrivateCatalogProducer { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://cloudprivatecatalogproducer.googleapis.com/".to_string(), + _root_url: "https://cloudprivatecatalogproducer.googleapis.com/".to_string(), + } + } + + pub fn catalogs(&'a self) -> CatalogMethods<'a, C, A> { + CatalogMethods { hub: &self } + } + pub fn operations(&'a self) -> OperationMethods<'a, C, A> { + OperationMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://cloudprivatecatalogproducer.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://cloudprivatecatalogproducer.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list catalogs](struct.CatalogListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1ListCatalogsResponse { + /// A pagination token returned from a previous call to ListCatalogs + /// that indicates where the listing should continue from. + /// This field is optional. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The `Catalogs` returned from the list call. + pub catalogs: Option>, +} + +impl ResponseResult for GoogleCloudPrivatecatalogproducerV1beta1ListCatalogsResponse {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleIamV1Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for GoogleIamV1Binding {} + + +/// The request message for Operations.CancelOperation. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [cancel operations](struct.OperationCancelCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleLongrunningCancelOperationRequest { _never_set: Option } + +impl RequestValue for GoogleLongrunningCancelOperationRequest {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [undelete catalogs](struct.CatalogUndeleteCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1UndeleteCatalogRequest { _never_set: Option } + +impl RequestValue for GoogleCloudPrivatecatalogproducerV1beta1UndeleteCatalogRequest {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **JSON Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// **YAML Example** +/// +/// bindings: +/// - members: +/// - user:mike@example.com +/// - group:admins@example.com +/// - domain:google.com +/// - serviceAccount:my-other-app@appspot.gserviceaccount.com +/// role: roles/owner +/// - members: +/// - user:sean@example.com +/// role: roles/viewer +/// +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam/docs). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get iam policy catalogs](struct.CatalogGetIamPolicyCall.html) (response) +/// * [set iam policy catalogs](struct.CatalogSetIamPolicyCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleIamV1Policy { + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, + /// Deprecated. + pub version: Option, +} + +impl ResponseResult for GoogleIamV1Policy {} + + +/// The producer representation of a catalog which is a curated collection of +/// solutions that can be managed, controlled, and shared by cloud admins. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch catalogs](struct.CatalogPatchCall.html) (request|response) +/// * [undelete catalogs](struct.CatalogUndeleteCall.html) (response) +/// * [create catalogs](struct.CatalogCreateCall.html) (request) +/// * [get catalogs](struct.CatalogGetCall.html) (response) +/// * [delete catalogs](struct.CatalogDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1Catalog { + /// Output only. The time when the catalog was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Required. The user-supplied descriptive name of the catalog as it appears + /// in UIs. Maximum 256 characters in length. + #[serde(rename="displayName")] + pub display_name: Option, + /// Required. The user-supplied description of the catalog. Maximum of 512 + /// characters. + pub description: Option, + /// Required. The parent resource name of the catalog, which can't be changed + /// after a catalog is created. It can only be an organization. Values are of + /// the form `//cloudresourcemanager.googleapis.com/organizations/`. + /// Maximum 256 characters in length. + pub parent: Option, + /// Output only. The time when the catalog was created. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. The resource name of the catalog, in the format + /// `catalogs/{catalog_id}'. + /// + /// A unique identifier for the catalog, which is generated + /// by catalog service. + pub name: Option, +} + +impl RequestValue for GoogleCloudPrivatecatalogproducerV1beta1Catalog {} +impl ResponseResult for GoogleCloudPrivatecatalogproducerV1beta1Catalog {} + + +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [test iam permissions catalogs](struct.CatalogTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleIamV1TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, +} + +impl RequestValue for GoogleIamV1TestIamPermissionsRequest {} + + +/// The producer representation of a version, which is a child resource under a +/// `Product` with asset data. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [products versions get catalogs](struct.CatalogProductVersionGetCall.html) (response) +/// * [products versions patch catalogs](struct.CatalogProductVersionPatchCall.html) (request|response) +/// * [products versions create catalogs](struct.CatalogProductVersionCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1Version { + /// Output only. The time when the version was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// The user-supplied description of the version. Maximum of 256 characters. + pub description: Option, + /// Required. The resource name of the version, in the format + /// `catalogs/{catalog_id}/products/{product_id}/versions/a-z*[a-z0-9]'. + /// + /// A unique identifier for the version under a product, which can't + /// be changed after the version is created. The final segment of the name must + /// between 1 and 63 characters in length. + pub name: Option, + /// Output only. The time when the version was created. + #[serde(rename="createTime")] + pub create_time: Option, + /// The user-supplied asset payload. The maximum size of the payload is 2MB. + /// The JSON schema of the payload is defined as: + /// + /// ``` + /// type: object + /// properties: + /// mainTemplate: + /// type: string + /// description: The file name of the main template and name prefix of + /// schema file. The content of the main template should be set in the + /// imports list. The schema file name is expected to be + /// .schema in the imports list. required: true + /// imports: + /// type: array + /// description: Import template and schema file contents. Required to have + /// both and .schema files. required: true + /// minItems: 2 + /// items: + /// type: object + /// properties: + /// name: + /// type: string + /// content: + /// type: string + /// ``` + #[serde(rename="originalAsset")] + pub original_asset: Option>, + /// Output only. The asset which has been validated and is ready to be + /// provisioned. See Version.original_asset for the schema. + pub asset: Option>, +} + +impl RequestValue for GoogleCloudPrivatecatalogproducerV1beta1Version {} +impl ResponseResult for GoogleCloudPrivatecatalogproducerV1beta1Version {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [associations list catalogs](struct.CatalogAssociationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1ListAssociationsResponse { + /// The returned `Association` resources from the list call. + pub associations: Option>, + /// A pagination token returned from a previous call to + /// `ListAssociations` that indicates where the listing should continue from. + /// This field is optional. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} + +impl ResponseResult for GoogleCloudPrivatecatalogproducerV1beta1ListAssociationsResponse {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [products versions list catalogs](struct.CatalogProductVersionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1ListVersionsResponse { + /// A pagination token returned from a previous call to ListProducts + /// that indicates where the listing should continue from. + /// This field is optional. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The `VersiVersionon` returned from the list call. + pub versions: Option>, +} + +impl ResponseResult for GoogleCloudPrivatecatalogproducerV1beta1ListVersionsResponse {} + + +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [test iam permissions catalogs](struct.CatalogTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleIamV1TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. + pub permissions: Option>, +} + +impl ResponseResult for GoogleIamV1TestIamPermissionsResponse {} + + +/// An association tuple that pairs a `Catalog` to a resource +/// that can use the `Catalog`. After association, a +/// google.cloud.privatecatalog.v1beta1.Catalog becomes available to +/// consumers under specified Association.resource and all of its child +/// nodes. +/// Users who have the `cloudprivatecatalog.targets.get` permission on any of +/// the resource nodes can access the catalog and child products under the node. +/// +/// For example, suppose the cloud resource hierarchy is as follows: +/// +/// * organizations/example.com +/// * folders/team +/// * projects/test +/// +/// After creating an association with `organizations/example.com`, the catalog +/// `catalogs/1` is accessible from the following paths: +/// +/// * organizations/example.com +/// * folders/team +/// * projects/test +/// +/// Users can access them by +/// google.cloud.v1beta1.PrivateCatalog.SearchCatalogs action. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [associations create catalogs](struct.CatalogAssociationCreateCall.html) (response) +/// * [associations get catalogs](struct.CatalogAssociationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1Association { + /// Required. The user-supplied fully qualified name of the `Resource` + /// associated to the `Catalog`. It supports `Organization`, `Folder`, + /// and `Project`. Values are of the form + /// + /// * `//cloudresourcemanager.googleapis.com/projects/{product_number}` + /// * `//cloudresourcemanager.googleapis.com/folders/{folder_id}` + /// * `//cloudresourcemanager.googleapis.com/organizations/{organization_id}` + pub resource: Option, + /// The creation time of the association. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. The resource name of the catalog association, in the format + /// `catalogs/{catalog_id}/associations/{association_id}'. + /// + /// A unique identifier for the catalog association, which is + /// generated by catalog service. + pub name: Option, +} + +impl ResponseResult for GoogleCloudPrivatecatalogproducerV1beta1Association {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [products list catalogs](struct.CatalogProductListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1ListProductsResponse { + /// A pagination token returned from a previous call to ListProducts + /// that indicates where the listing should continue from. + /// This field is optional. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The `Product` returned from the list call. + pub products: Option>, +} + +impl ResponseResult for GoogleCloudPrivatecatalogproducerV1beta1ListProductsResponse {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [cancel operations](struct.OperationCancelCall.html) (response) +/// * [products versions delete catalogs](struct.CatalogProductVersionDeleteCall.html) (response) +/// * [products icons upload catalogs](struct.CatalogProductIconUploadCall.html) (response) +/// * [associations delete catalogs](struct.CatalogAssociationDeleteCall.html) (response) +/// * [delete operations](struct.OperationDeleteCall.html) (response) +/// * [products delete catalogs](struct.CatalogProductDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleProtobufEmpty { _never_set: Option } + +impl ResponseResult for GoogleProtobufEmpty {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [products copy catalogs](struct.CatalogProductCopyCall.html) (response) +/// * [create catalogs](struct.CatalogCreateCall.html) (response) +/// * [get operations](struct.OperationGetCall.html) (response) +/// * [products versions create catalogs](struct.CatalogProductVersionCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleLongrunningOperation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl ResponseResult for GoogleLongrunningOperation {} + + +/// Request message for `SetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set iam policy catalogs](struct.CatalogSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleIamV1SetIamPolicyRequest { + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. + pub policy: Option, + /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + /// the fields in the mask will be modified. If no mask is provided, the + /// following default mask is used: + /// paths: "bindings, etag" + /// This field is only used by Cloud IAM. + #[serde(rename="updateMask")] + pub update_mask: Option, +} + +impl RequestValue for GoogleIamV1SetIamPolicyRequest {} + + +/// The producer representation of a product which is a child resource of +/// `Catalog` with display metadata and a list of `Version` resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [products get catalogs](struct.CatalogProductGetCall.html) (response) +/// * [products patch catalogs](struct.CatalogProductPatchCall.html) (request|response) +/// * [products create catalogs](struct.CatalogProductCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1Product { + /// Required. The type of the product asset, which cannot be changed after the + /// product is created. It supports the values + /// `google.deploymentmanager.Template` and + /// `google.cloudprivatecatalog.ListingOnly`. Other values will be + /// rejected by the server. Read only after creation. + /// + /// The following fields or resource types have different validation rules + /// under each `asset_type` values: + /// + /// * Product.display_metadata has different validation schema for each + /// asset type value. See its comment for details. + /// * Version resource isn't allowed to be added under the + /// `google.cloudprivatecatalog.ListingOnly` type. + #[serde(rename="assetType")] + pub asset_type: Option, + /// Output only. The time when the product was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Output only. The public accessible URI of the icon uploaded by + /// PrivateCatalogProducer.UploadIcon. + /// + /// If no icon is uploaded, it will be the default icon's URI. + #[serde(rename="iconUri")] + pub icon_uri: Option, + /// Required. The resource name of the product in the format + /// `catalogs/{catalog_id}/products/a-z*[a-z0-9]'. + /// + /// A unique identifier for the product under a catalog, which cannot + /// be changed after the product is created. The final + /// segment of the name must between 1 and 256 characters in length. + pub name: Option, + /// The user-supplied display metadata to describe the product. + /// The JSON schema of the metadata differs by Product.asset_type. + /// When the type is `google.deploymentmanager.Template`, the schema is as + /// follows: + /// + /// ``` + /// "$schema": http://json-schema.org/draft-04/schema# + /// type: object + /// properties: + /// name: + /// type: string + /// minLength: 1 + /// maxLength: 64 + /// description: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// tagline: + /// type: string + /// minLength: 1 + /// maxLength: 100 + /// support_info: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// creator: + /// type: string + /// minLength: 1 + /// maxLength: 100 + /// documentation: + /// type: array + /// items: + /// type: object + /// properties: + /// url: + /// type: string + /// pattern: + /// "^(https?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]" + /// title: + /// type: string + /// minLength: 1 + /// maxLength: 64 + /// description: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// required: + /// - name + /// - description + /// additionalProperties: false + /// + /// ``` + /// + /// When the asset type is `google.cloudprivatecatalog.ListingOnly`, the schema + /// is as follows: + /// + /// ``` + /// "$schema": http://json-schema.org/draft-04/schema# + /// type: object + /// properties: + /// name: + /// type: string + /// minLength: 1 + /// maxLength: 64 + /// description: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// tagline: + /// type: string + /// minLength: 1 + /// maxLength: 100 + /// support_info: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// creator: + /// type: string + /// minLength: 1 + /// maxLength: 100 + /// documentation: + /// type: array + /// items: + /// type: object + /// properties: + /// url: + /// type: string + /// pattern: + /// "^(https?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]" + /// title: + /// type: string + /// minLength: 1 + /// maxLength: 64 + /// description: + /// type: string + /// minLength: 1 + /// maxLength: 2048 + /// signup_url: + /// type: string + /// pattern: + /// "^(https?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]" + /// required: + /// - name + /// - description + /// - signup_url + /// additionalProperties: false + /// ``` + #[serde(rename="displayMetadata")] + pub display_metadata: Option>, + /// Output only. The time when the product was created. + #[serde(rename="createTime")] + pub create_time: Option, +} + +impl RequestValue for GoogleCloudPrivatecatalogproducerV1beta1Product {} +impl ResponseResult for GoogleCloudPrivatecatalogproducerV1beta1Product {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleTypeExpr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for GoogleTypeExpr {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [products copy catalogs](struct.CatalogProductCopyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest { + /// The resource name of the destination product that is copied to. + #[serde(rename="destinationProductName")] + pub destination_product_name: Option, +} + +impl RequestValue for GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [products icons upload catalogs](struct.CatalogProductIconUploadCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1UploadIconRequest { + /// The raw icon bytes user-supplied to be uploaded to the product. The format + /// of the icon can only be PNG or JPEG. The minimum allowed dimensions are + /// 130x130 pixels and the maximum dimensions are 10000x10000 pixels. + /// Required. + pub icon: Option, +} + +impl RequestValue for GoogleCloudPrivatecatalogproducerV1beta1UploadIconRequest {} + + +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operations](struct.OperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleLongrunningListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for GoogleLongrunningListOperationsResponse {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [associations create catalogs](struct.CatalogAssociationCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudPrivatecatalogproducerV1beta1CreateAssociationRequest { + /// The user-supplied `Association` that is going to be created. + /// + /// If the `resource` field is set, the + /// `privatecatalogproducer.catalogTargets.associate` permission is checked on + /// the target resource. + pub association: Option, +} + +impl RequestValue for GoogleCloudPrivatecatalogproducerV1beta1CreateAssociationRequest {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleRpcStatus { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for GoogleRpcStatus {} + + +/// Specifies the audit configuration for a service. +/// The configuration determines which permission types are logged, and what +/// identities, if any, are exempted from logging. +/// An AuditConfig must have one or more AuditLogConfigs. +/// +/// If there are AuditConfigs for both `allServices` and a specific service, +/// the union of the two AuditConfigs is used for that service: the log_types +/// specified in each AuditConfig are enabled, and the exempted_members in each +/// AuditLogConfig are exempted. +/// +/// Example Policy with multiple AuditConfigs: +/// +/// { +/// "audit_configs": [ +/// { +/// "service": "allServices" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// }, +/// { +/// "log_type": "ADMIN_READ", +/// } +/// ] +/// }, +/// { +/// "service": "fooservice.googleapis.com" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// "exempted_members": [ +/// "user:bar@gmail.com" +/// ] +/// } +/// ] +/// } +/// ] +/// } +/// +/// For fooservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ +/// logging. It also exempts foo@gmail.com from DATA_READ logging, and +/// bar@gmail.com from DATA_WRITE logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleIamV1AuditConfig { + /// The configuration for logging of each type of permission. + #[serde(rename="auditLogConfigs")] + pub audit_log_configs: Option>, + /// Specifies a service that will be enabled for audit logging. + /// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + /// `allServices` is a special value that covers all services. + pub service: Option, +} + +impl Part for GoogleIamV1AuditConfig {} + + +/// Provides the configuration for logging a type of permissions. +/// Example: +/// +/// { +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// } +/// ] +/// } +/// +/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting +/// foo@gmail.com from DATA_READ logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleIamV1AuditLogConfig { + /// Specifies the identities that do not cause logging for this type of + /// permission. + /// Follows the same format of Binding.members. + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The log type that this config enables. + #[serde(rename="logType")] + pub log_type: Option, +} + +impl Part for GoogleIamV1AuditLogConfig {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *operation* resources. +/// It is not used directly, but through the `CloudPrivateCatalogProducer` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `cancel(...)`, `delete(...)`, `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.operations(); +/// # } +/// ``` +pub struct OperationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, +} + +impl<'a, C, A> MethodsBuilder for OperationMethods<'a, C, A> {} + +impl<'a, C, A> OperationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists operations that match the specified filter in the request. If the + /// server doesn't support this method, it returns `UNIMPLEMENTED`. + /// + /// NOTE: the `name` binding allows API services to override the binding + /// to use different resource name schemes, such as `users/*/operations`. To + /// override the binding, API services can add a binding such as + /// `"/v1/{name=users/*}/operations"` to their service configuration. + /// For backwards compatibility, the default name includes the operations + /// collection id, however overriding users must ensure the name binding + /// is the parent resource, without the operations collection id. + pub fn list(&self) -> OperationListCall<'a, C, A> { + OperationListCall { + hub: self.hub, + _page_token: Default::default(), + _page_size: Default::default(), + _name: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a long-running operation. This method indicates that the client is + /// no longer interested in the operation result. It does not cancel the + /// operation. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource to be deleted. + pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, C, A> { + OperationDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn get(&self, name: &str) -> OperationGetCall<'a, C, A> { + OperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Starts asynchronous cancellation on a long-running operation. The server + /// makes a best effort to cancel the operation, but success is not + /// guaranteed. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use + /// Operations.GetOperation or + /// other methods to check whether the cancellation succeeded or whether the + /// operation completed despite cancellation. On successful cancellation, + /// the operation is not deleted; instead, it becomes an operation with + /// an Operation.error value with a google.rpc.Status.code of 1, + /// corresponding to `Code.CANCELLED`. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the operation resource to be cancelled. + pub fn cancel(&self, request: GoogleLongrunningCancelOperationRequest, name: &str) -> OperationCancelCall<'a, C, A> { + OperationCancelCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *catalog* resources. +/// It is not used directly, but through the `CloudPrivateCatalogProducer` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `associations_create(...)`, `associations_delete(...)`, `associations_get(...)`, `associations_list(...)`, `create(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `list(...)`, `patch(...)`, `products_copy(...)`, `products_create(...)`, `products_delete(...)`, `products_get(...)`, `products_icons_upload(...)`, `products_list(...)`, `products_patch(...)`, `products_versions_create(...)`, `products_versions_delete(...)`, `products_versions_get(...)`, `products_versions_list(...)`, `products_versions_patch(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)` and `undelete(...)` +/// // to build up your call. +/// let rb = hub.catalogs(); +/// # } +/// ``` +pub struct CatalogMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, +} + +impl<'a, C, A> MethodsBuilder for CatalogMethods<'a, C, A> {} + +impl<'a, C, A> CatalogMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a Product instance under a given Catalog. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The catalog name of the new product's parent. + pub fn products_create(&self, request: GoogleCloudPrivatecatalogproducerV1beta1Product, parent: &str) -> CatalogProductCreateCall<'a, C, A> { + CatalogProductCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the requested Version resource. + /// + /// # Arguments + /// + /// * `name` - The resource name of the version. + pub fn products_versions_get(&self, name: &str) -> CatalogProductVersionGetCall<'a, C, A> { + CatalogProductVersionGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the requested Association resource. + /// + /// # Arguments + /// + /// * `name` - The resource name of the `Association` to retrieve. + pub fn associations_get(&self, name: &str) -> CatalogAssociationGetCall<'a, C, A> { + CatalogAssociationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the given Association. + /// + /// # Arguments + /// + /// * `name` - The resource name of the `Association` to delete. + pub fn associations_delete(&self, name: &str) -> CatalogAssociationDeleteCall<'a, C, A> { + CatalogAssociationDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a specific Version resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The resource name of the version, in the format + /// `catalogs/{catalog_id}/products/{product_id}/versions/a-z*[a-z0-9]'. + /// A unique identifier for the version under a product, which can't + /// be changed after the version is created. The final segment of the name must + /// between 1 and 63 characters in length. + pub fn products_versions_patch(&self, request: GoogleCloudPrivatecatalogproducerV1beta1Version, name: &str) -> CatalogProductVersionPatchCall<'a, C, A> { + CatalogProductVersionPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a Version instance under a given Product. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The product name of the new version's parent. + pub fn products_versions_create(&self, request: GoogleCloudPrivatecatalogproducerV1beta1Version, parent: &str) -> CatalogProductVersionCreateCall<'a, C, A> { + CatalogProductVersionCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a specific Catalog resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Output only. The resource name of the catalog, in the format + /// `catalogs/{catalog_id}'. + /// A unique identifier for the catalog, which is generated + /// by catalog service. + pub fn patch(&self, request: GoogleCloudPrivatecatalogproducerV1beta1Catalog, name: &str) -> CatalogPatchCall<'a, C, A> { + CatalogPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all Association resources under a catalog. + /// + /// # Arguments + /// + /// * `parent` - The resource name of the `Catalog` whose `Associations` are + /// being retrieved. In the format `catalogs/`. + pub fn associations_list(&self, parent: &str) -> CatalogAssociationListCall<'a, C, A> { + CatalogAssociationListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the requested Product resource. + /// + /// # Arguments + /// + /// * `name` - The resource name of the product. + pub fn products_get(&self, name: &str) -> CatalogProductGetCall<'a, C, A> { + CatalogProductGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Tests the IAM permissions for the specified Catalog. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn test_iam_permissions(&self, request: GoogleIamV1TestIamPermissionsRequest, resource: &str) -> CatalogTestIamPermissionCall<'a, C, A> { + CatalogTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Hard deletes a Product. + /// + /// # Arguments + /// + /// * `name` - The resource name of the product. + pub fn products_delete(&self, name: &str) -> CatalogProductDeleteCall<'a, C, A> { + CatalogProductDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists Product resources that the producer has access to, within the + /// scope of the parent catalog. + /// + /// # Arguments + /// + /// * `parent` - The resource name of the parent resource. + pub fn products_list(&self, parent: &str) -> CatalogProductListCall<'a, C, A> { + CatalogProductListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists Version resources that the producer has access to, within the + /// scope of the parent Product. + /// + /// # Arguments + /// + /// * `parent` - The resource name of the parent resource. + pub fn products_versions_list(&self, parent: &str) -> CatalogProductVersionListCall<'a, C, A> { + CatalogProductVersionListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Hard deletes a Version. + /// + /// # Arguments + /// + /// * `name` - The resource name of the version. + pub fn products_versions_delete(&self, name: &str) -> CatalogProductVersionDeleteCall<'a, C, A> { + CatalogProductVersionDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates an Icon instance under a given Product. + /// If Product only has a default icon, a new Icon + /// instance is created and associated with the given Product. + /// If Product already has a non-default icon, the action creates + /// a new Icon instance, associates the newly created + /// Icon with the given Product and deletes the old icon. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `product` - The resource name of the product. + pub fn products_icons_upload(&self, request: GoogleCloudPrivatecatalogproducerV1beta1UploadIconRequest, product: &str) -> CatalogProductIconUploadCall<'a, C, A> { + CatalogProductIconUploadCall { + hub: self.hub, + _request: request, + _product: product.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new Catalog resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn create(&self, request: GoogleCloudPrivatecatalogproducerV1beta1Catalog) -> CatalogCreateCall<'a, C, A> { + CatalogCreateCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets IAM policy for the specified Catalog. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn get_iam_policy(&self, resource: &str) -> CatalogGetIamPolicyCall<'a, C, A> { + CatalogGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Copies a Product under another Catalog. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the current product that is copied from. + pub fn products_copy(&self, request: GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest, name: &str) -> CatalogProductCopyCall<'a, C, A> { + CatalogProductCopyCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Undeletes a deleted Catalog and all resources under it. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the catalog. + pub fn undelete(&self, request: GoogleCloudPrivatecatalogproducerV1beta1UndeleteCatalogRequest, name: &str) -> CatalogUndeleteCall<'a, C, A> { + CatalogUndeleteCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates an Association instance under a given Catalog. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The `Catalog` resource's name. + pub fn associations_create(&self, request: GoogleCloudPrivatecatalogproducerV1beta1CreateAssociationRequest, parent: &str) -> CatalogAssociationCreateCall<'a, C, A> { + CatalogAssociationCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a specific Product resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The resource name of the product in the format + /// `catalogs/{catalog_id}/products/a-z*[a-z0-9]'. + /// A unique identifier for the product under a catalog, which cannot + /// be changed after the product is created. The final + /// segment of the name must between 1 and 256 characters in length. + pub fn products_patch(&self, request: GoogleCloudPrivatecatalogproducerV1beta1Product, name: &str) -> CatalogProductPatchCall<'a, C, A> { + CatalogProductPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists Catalog resources that the producer has access to, within the + /// scope of the parent resource. + pub fn list(&self) -> CatalogListCall<'a, C, A> { + CatalogListCall { + hub: self.hub, + _parent: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Soft deletes an existing Catalog and all resources under it. + /// The catalog can only be deleted if there is no associations under it or + /// DeleteCatalogRequest.force is true. The delete operation + /// can be recovered by the PrivateCatalogProducer.UndeleteCatalog + /// method. + /// + /// # Arguments + /// + /// * `name` - The resource name of the catalog. + pub fn delete(&self, name: &str) -> CatalogDeleteCall<'a, C, A> { + CatalogDeleteCall { + hub: self.hub, + _name: name.to_string(), + _force: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the IAM policy for the specified Catalog. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn set_iam_policy(&self, request: GoogleIamV1SetIamPolicyRequest, resource: &str) -> CatalogSetIamPolicyCall<'a, C, A> { + CatalogSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the requested Catalog resource. + /// + /// # Arguments + /// + /// * `name` - The resource name of the catalog. + pub fn get(&self, name: &str) -> CatalogGetCall<'a, C, A> { + CatalogGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Lists operations that match the specified filter in the request. If the +/// server doesn't support this method, it returns `UNIMPLEMENTED`. +/// +/// NOTE: the `name` binding allows API services to override the binding +/// to use different resource name schemes, such as `users/*/operations`. To +/// override the binding, API services can add a binding such as +/// `"/v1/{name=users/*}/operations"` to their service configuration. +/// For backwards compatibility, the default name includes the operations +/// collection id, however overriding users must ensure the name binding +/// is the parent resource, without the operations collection id. +/// +/// A builder for the *list* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().list() +/// .page_token("sed") +/// .page_size(-85) +/// .name("dolores") +/// .filter("kasd") +/// .doit(); +/// # } +/// ``` +pub struct OperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _page_token: Option, + _page_size: Option, + _name: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationListCall<'a, C, A> {} + +impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningListOperationsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._name { + params.push(("name", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "pageToken", "pageSize", "name", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/operations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The name of the operation's parent resource. + /// + /// Sets the *name* query property to the given value. + pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._name = Some(new_value.to_string()); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a long-running operation. This method indicates that the client is +/// no longer interested in the operation result. It does not cancel the +/// operation. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. +/// +/// A builder for the *delete* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().delete("name") +/// .doit(); +/// # } +/// ``` +pub struct OperationDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationDeleteCall<'a, C, A> {} + +impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.operations.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource to be deleted. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *get* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().get("name") +/// .doit(); +/// # } +/// ``` +pub struct OperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {} + +impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Starts asynchronous cancellation on a long-running operation. The server +/// makes a best effort to cancel the operation, but success is not +/// guaranteed. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. Clients can use +/// Operations.GetOperation or +/// other methods to check whether the cancellation succeeded or whether the +/// operation completed despite cancellation. On successful cancellation, +/// the operation is not deleted; instead, it becomes an operation with +/// an Operation.error value with a google.rpc.Status.code of 1, +/// corresponding to `Code.CANCELLED`. +/// +/// A builder for the *cancel* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleLongrunningCancelOperationRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleLongrunningCancelOperationRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().cancel(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct OperationCancelCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleLongrunningCancelOperationRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationCancelCall<'a, C, A> {} + +impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.operations.cancel", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:cancel"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleLongrunningCancelOperationRequest) -> OperationCancelCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the operation resource to be cancelled. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationCancelCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationCancelCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationCancelCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a Product instance under a given Catalog. +/// +/// A builder for the *products.create* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleCloudPrivatecatalogproducerV1beta1Product; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudPrivatecatalogproducerV1beta1Product::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleCloudPrivatecatalogproducerV1beta1Product, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductCreateCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Product)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/products"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudPrivatecatalogproducerV1beta1Product) -> CatalogProductCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The catalog name of the new product's parent. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> CatalogProductCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the requested Version resource. +/// +/// A builder for the *products.versions.get* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_versions_get("name") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductVersionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductVersionGetCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductVersionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Version)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.versions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the version. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogProductVersionGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductVersionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductVersionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductVersionGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the requested Association resource. +/// +/// A builder for the *associations.get* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().associations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct CatalogAssociationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogAssociationGetCall<'a, C, A> {} + +impl<'a, C, A> CatalogAssociationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Association)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.associations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the `Association` to retrieve. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogAssociationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogAssociationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogAssociationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogAssociationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the given Association. +/// +/// A builder for the *associations.delete* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().associations_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct CatalogAssociationDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogAssociationDeleteCall<'a, C, A> {} + +impl<'a, C, A> CatalogAssociationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.associations.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the `Association` to delete. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogAssociationDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogAssociationDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogAssociationDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogAssociationDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a specific Version resource. +/// +/// A builder for the *products.versions.patch* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleCloudPrivatecatalogproducerV1beta1Version; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudPrivatecatalogproducerV1beta1Version::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_versions_patch(req, "name") +/// .update_mask("dolores") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductVersionPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleCloudPrivatecatalogproducerV1beta1Version, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductVersionPatchCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductVersionPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Version)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.versions.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudPrivatecatalogproducerV1beta1Version) -> CatalogProductVersionPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The resource name of the version, in the format + /// `catalogs/{catalog_id}/products/{product_id}/versions/a-z*[a-z0-9]'. + /// + /// A unique identifier for the version under a product, which can't + /// be changed after the version is created. The final segment of the name must + /// between 1 and 63 characters in length. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogProductVersionPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Field mask that controls which fields of the version should be updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> CatalogProductVersionPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductVersionPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductVersionPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductVersionPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a Version instance under a given Product. +/// +/// A builder for the *products.versions.create* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleCloudPrivatecatalogproducerV1beta1Version; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudPrivatecatalogproducerV1beta1Version::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_versions_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductVersionCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleCloudPrivatecatalogproducerV1beta1Version, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductVersionCreateCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductVersionCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.versions.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudPrivatecatalogproducerV1beta1Version) -> CatalogProductVersionCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The product name of the new version's parent. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> CatalogProductVersionCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductVersionCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductVersionCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductVersionCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a specific Catalog resource. +/// +/// A builder for the *patch* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleCloudPrivatecatalogproducerV1beta1Catalog; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudPrivatecatalogproducerV1beta1Catalog::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().patch(req, "name") +/// .update_mask("aliquyam") +/// .doit(); +/// # } +/// ``` +pub struct CatalogPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleCloudPrivatecatalogproducerV1beta1Catalog, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogPatchCall<'a, C, A> {} + +impl<'a, C, A> CatalogPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Catalog)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudPrivatecatalogproducerV1beta1Catalog) -> CatalogPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Output only. The resource name of the catalog, in the format + /// `catalogs/{catalog_id}'. + /// + /// A unique identifier for the catalog, which is generated + /// by catalog service. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Field mask that controls which fields of the catalog should be updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> CatalogPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all Association resources under a catalog. +/// +/// A builder for the *associations.list* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().associations_list("parent") +/// .page_token("no") +/// .page_size(-21) +/// .doit(); +/// # } +/// ``` +pub struct CatalogAssociationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogAssociationListCall<'a, C, A> {} + +impl<'a, C, A> CatalogAssociationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1ListAssociationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.associations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/associations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the `Catalog` whose `Associations` are + /// being retrieved. In the format `catalogs/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> CatalogAssociationListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A pagination token returned from the previous call to + /// `ListAssociations`. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CatalogAssociationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of catalog associations to return. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> CatalogAssociationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogAssociationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogAssociationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogAssociationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the requested Product resource. +/// +/// A builder for the *products.get* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_get("name") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductGetCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Product)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the product. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogProductGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Tests the IAM permissions for the specified Catalog. +/// +/// A builder for the *testIamPermissions* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleIamV1TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleIamV1TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct CatalogTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleIamV1TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> CatalogTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleIamV1TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleIamV1TestIamPermissionsRequest) -> CatalogTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> CatalogTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Hard deletes a Product. +/// +/// A builder for the *products.delete* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductDeleteCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the product. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogProductDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists Product resources that the producer has access to, within the +/// scope of the parent catalog. +/// +/// A builder for the *products.list* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_list("parent") +/// .page_token("ipsum") +/// .page_size(-5) +/// .filter("et") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductListCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1ListProductsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/products"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the parent resource. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> CatalogProductListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A pagination token returned from a previous call to ListProducts + /// that indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CatalogProductListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of products to return. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> CatalogProductListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// A filter expression used to restrict the returned results based + /// upon properties of the product. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> CatalogProductListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists Version resources that the producer has access to, within the +/// scope of the parent Product. +/// +/// A builder for the *products.versions.list* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_versions_list("parent") +/// .page_token("aliquyam") +/// .page_size(-9) +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductVersionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductVersionListCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1ListVersionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.versions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the parent resource. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> CatalogProductVersionListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A pagination token returned from a previous call to ListVersions + /// that indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CatalogProductVersionListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of versions to return. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> CatalogProductVersionListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductVersionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductVersionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductVersionListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Hard deletes a Version. +/// +/// A builder for the *products.versions.delete* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_versions_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductVersionDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductVersionDeleteCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductVersionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.versions.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the version. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogProductVersionDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductVersionDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductVersionDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductVersionDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates an Icon instance under a given Product. +/// If Product only has a default icon, a new Icon +/// instance is created and associated with the given Product. +/// If Product already has a non-default icon, the action creates +/// a new Icon instance, associates the newly created +/// Icon with the given Product and deletes the old icon. +/// +/// A builder for the *products.icons.upload* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleCloudPrivatecatalogproducerV1beta1UploadIconRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudPrivatecatalogproducerV1beta1UploadIconRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_icons_upload(req, "product") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductIconUploadCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleCloudPrivatecatalogproducerV1beta1UploadIconRequest, + _product: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductIconUploadCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductIconUploadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.icons.upload", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("product", self._product.to_string())); + for &field in ["alt", "product"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+product}/icons:upload"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+product}", "product")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["product"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudPrivatecatalogproducerV1beta1UploadIconRequest) -> CatalogProductIconUploadCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the product. + /// + /// Sets the *product* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn product(mut self, new_value: &str) -> CatalogProductIconUploadCall<'a, C, A> { + self._product = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductIconUploadCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductIconUploadCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductIconUploadCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new Catalog resource. +/// +/// A builder for the *create* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleCloudPrivatecatalogproducerV1beta1Catalog; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudPrivatecatalogproducerV1beta1Catalog::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().create(req) +/// .doit(); +/// # } +/// ``` +pub struct CatalogCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleCloudPrivatecatalogproducerV1beta1Catalog, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogCreateCall<'a, C, A> {} + +impl<'a, C, A> CatalogCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/catalogs"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudPrivatecatalogproducerV1beta1Catalog) -> CatalogCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets IAM policy for the specified Catalog. +/// +/// A builder for the *getIamPolicy* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct CatalogGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> CatalogGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleIamV1Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> CatalogGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Copies a Product under another Catalog. +/// +/// A builder for the *products.copy* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_copy(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductCopyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductCopyCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductCopyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.copy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:copy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudPrivatecatalogproducerV1beta1CopyProductRequest) -> CatalogProductCopyCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the current product that is copied from. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogProductCopyCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductCopyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductCopyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductCopyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Undeletes a deleted Catalog and all resources under it. +/// +/// A builder for the *undelete* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleCloudPrivatecatalogproducerV1beta1UndeleteCatalogRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudPrivatecatalogproducerV1beta1UndeleteCatalogRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().undelete(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct CatalogUndeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleCloudPrivatecatalogproducerV1beta1UndeleteCatalogRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogUndeleteCall<'a, C, A> {} + +impl<'a, C, A> CatalogUndeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Catalog)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.undelete", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:undelete"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudPrivatecatalogproducerV1beta1UndeleteCatalogRequest) -> CatalogUndeleteCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the catalog. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogUndeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogUndeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogUndeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogUndeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates an Association instance under a given Catalog. +/// +/// A builder for the *associations.create* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleCloudPrivatecatalogproducerV1beta1CreateAssociationRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudPrivatecatalogproducerV1beta1CreateAssociationRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().associations_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct CatalogAssociationCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleCloudPrivatecatalogproducerV1beta1CreateAssociationRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogAssociationCreateCall<'a, C, A> {} + +impl<'a, C, A> CatalogAssociationCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Association)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.associations.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/associations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudPrivatecatalogproducerV1beta1CreateAssociationRequest) -> CatalogAssociationCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The `Catalog` resource's name. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> CatalogAssociationCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogAssociationCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogAssociationCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogAssociationCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a specific Product resource. +/// +/// A builder for the *products.patch* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleCloudPrivatecatalogproducerV1beta1Product; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudPrivatecatalogproducerV1beta1Product::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().products_patch(req, "name") +/// .update_mask("amet") +/// .doit(); +/// # } +/// ``` +pub struct CatalogProductPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleCloudPrivatecatalogproducerV1beta1Product, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogProductPatchCall<'a, C, A> {} + +impl<'a, C, A> CatalogProductPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Product)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.products.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudPrivatecatalogproducerV1beta1Product) -> CatalogProductPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The resource name of the product in the format + /// `catalogs/{catalog_id}/products/a-z*[a-z0-9]'. + /// + /// A unique identifier for the product under a catalog, which cannot + /// be changed after the product is created. The final + /// segment of the name must between 1 and 256 characters in length. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogProductPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Field mask that controls which fields of the product should be updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> CatalogProductPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogProductPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogProductPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogProductPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists Catalog resources that the producer has access to, within the +/// scope of the parent resource. +/// +/// A builder for the *list* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().list() +/// .parent("no") +/// .page_token("labore") +/// .page_size(-39) +/// .doit(); +/// # } +/// ``` +pub struct CatalogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _parent: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogListCall<'a, C, A> {} + +impl<'a, C, A> CatalogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1ListCatalogsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + if let Some(value) = self._parent { + params.push(("parent", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/catalogs"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the parent resource. + /// + /// Sets the *parent* query property to the given value. + pub fn parent(mut self, new_value: &str) -> CatalogListCall<'a, C, A> { + self._parent = Some(new_value.to_string()); + self + } + /// A pagination token returned from a previous call to ListCatalogs + /// that indicates where this listing should continue from. + /// This field is optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CatalogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of catalogs to return. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> CatalogListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Soft deletes an existing Catalog and all resources under it. +/// The catalog can only be deleted if there is no associations under it or +/// DeleteCatalogRequest.force is true. The delete operation +/// can be recovered by the PrivateCatalogProducer.UndeleteCatalog +/// method. +/// +/// A builder for the *delete* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().delete("name") +/// .force(true) +/// .doit(); +/// # } +/// ``` +pub struct CatalogDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _name: String, + _force: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogDeleteCall<'a, C, A> {} + +impl<'a, C, A> CatalogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Catalog)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._force { + params.push(("force", value.to_string())); + } + for &field in ["alt", "name", "force"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the catalog. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Forces deletion of the `Catalog` and its `Association` resources. + /// If the `Catalog` is still associated with other resources and + /// force is not set to true, then the operation fails. + /// + /// Sets the *force* query property to the given value. + pub fn force(mut self, new_value: bool) -> CatalogDeleteCall<'a, C, A> { + self._force = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the IAM policy for the specified Catalog. +/// +/// A builder for the *setIamPolicy* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// use cloudprivatecatalogproducer1_beta1::GoogleIamV1SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleIamV1SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct CatalogSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _request: GoogleIamV1SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> CatalogSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleIamV1Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleIamV1SetIamPolicyRequest) -> CatalogSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> CatalogSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the requested Catalog resource. +/// +/// A builder for the *get* method supported by a *catalog* resource. +/// It is not used directly, but through a `CatalogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudprivatecatalogproducer1_beta1 as cloudprivatecatalogproducer1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudprivatecatalogproducer1_beta1::CloudPrivateCatalogProducer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudPrivateCatalogProducer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.catalogs().get("name") +/// .doit(); +/// # } +/// ``` +pub struct CatalogGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudPrivateCatalogProducer, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CatalogGetCall<'a, C, A> {} + +impl<'a, C, A> CatalogGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudPrivatecatalogproducerV1beta1Catalog)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudprivatecatalogproducer.catalogs.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the catalog. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> CatalogGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CatalogGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> CatalogGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CatalogGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/cloudprofiler2-cli/Cargo.toml b/gen/cloudprofiler2-cli/Cargo.toml index aa2ef446f7..260422ce76 100644 --- a/gen/cloudprofiler2-cli/Cargo.toml +++ b/gen/cloudprofiler2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudprofiler2-cli" -version = "1.0.8+20181008" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Profiler (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprofiler2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudprofiler2] path = "../cloudprofiler2" -version = "1.0.8+20181008" +version = "1.0.8+20190330" diff --git a/gen/cloudprofiler2-cli/README.md b/gen/cloudprofiler2-cli/README.md index bc745cbab7..14e9ef58c6 100644 --- a/gen/cloudprofiler2-cli/README.md +++ b/gen/cloudprofiler2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Profiler* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Profiler* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash cloudprofiler2 [options] diff --git a/gen/cloudprofiler2-cli/mkdocs.yml b/gen/cloudprofiler2-cli/mkdocs.yml index 0f28c14d76..fb258cc66c 100644 --- a/gen/cloudprofiler2-cli/mkdocs.yml +++ b/gen/cloudprofiler2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Profiler v1.0.8+20181008 +site_name: Cloud Profiler v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-cloudprofiler2-cli site_description: A complete library to interact with Cloud Profiler (protocol v2) diff --git a/gen/cloudprofiler2-cli/src/main.rs b/gen/cloudprofiler2-cli/src/main.rs index 29188c1c6c..44ba2a7e62 100644 --- a/gen/cloudprofiler2-cli/src/main.rs +++ b/gen/cloudprofiler2-cli/src/main.rs @@ -537,7 +537,7 @@ fn main() { let mut app = App::new("cloudprofiler2") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190330") .about("Manages continuous profiling information.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudprofiler2_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudprofiler2/Cargo.toml b/gen/cloudprofiler2/Cargo.toml index 5cb6bd465c..b226716fa0 100644 --- a/gen/cloudprofiler2/Cargo.toml +++ b/gen/cloudprofiler2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudprofiler2" -version = "1.0.8+20181008" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Profiler (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudprofiler2" homepage = "https://cloud.google.com/profiler/" -documentation = "https://docs.rs/google-cloudprofiler2/1.0.8+20181008" +documentation = "https://docs.rs/google-cloudprofiler2/1.0.8+20190330" license = "MIT" keywords = ["cloudprofiler", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudprofiler2/README.md b/gen/cloudprofiler2/README.md index af69f3ed4a..e02f826b67 100644 --- a/gen/cloudprofiler2/README.md +++ b/gen/cloudprofiler2/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-cloudprofiler2` library allows access to all features of the *Google Cloud Profiler* service. -This documentation was generated from *Cloud Profiler* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *cloudprofiler:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Profiler* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *cloudprofiler:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Profiler* *v2* API can be found at the [official documentation site](https://cloud.google.com/profiler/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/struct.CloudProfiler.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/struct.CloudProfiler.html) ... * projects - * [*profiles create*](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/struct.ProjectProfileCreateCall.html), [*profiles create offline*](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/struct.ProjectProfileCreateOfflineCall.html) and [*profiles patch*](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/struct.ProjectProfilePatchCall.html) + * [*profiles create*](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/struct.ProjectProfileCreateCall.html), [*profiles create offline*](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/struct.ProjectProfileCreateOfflineCall.html) and [*profiles patch*](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/struct.ProjectProfilePatchCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/struct.CloudProfiler.html)** +* **[Hub](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/struct.CloudProfiler.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudprofiler2/1.0.8+20181008/google_cloudprofiler2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudprofiler2/1.0.8+20190330/google_cloudprofiler2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudprofiler2/src/lib.rs b/gen/cloudprofiler2/src/lib.rs index 87d31369ff..d9f3ab6ce8 100644 --- a/gen/cloudprofiler2/src/lib.rs +++ b/gen/cloudprofiler2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Profiler* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *cloudprofiler:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Profiler* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *cloudprofiler:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Profiler* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/profiler/). @@ -718,7 +718,7 @@ impl<'a, C, A> ProjectProfileCreateCall<'a, C, A> where C: BorrowMut ProjectProfileCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -769,7 +766,7 @@ impl<'a, C, A> ProjectProfileCreateCall<'a, C, A> where C: BorrowMut ProjectProfileCreateCall<'a, C, A> where C: BorrowMut ProjectProfilePatchCall<'a, C, A> where C: BorrowMut ProjectProfilePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1059,7 +1053,7 @@ impl<'a, C, A> ProjectProfilePatchCall<'a, C, A> where C: BorrowMut ProjectProfilePatchCall<'a, C, A> where C: BorrowMut ProjectProfileCreateOfflineCall<'a, C, A> where C: BorrowMut ProjectProfileCreateOfflineCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1353,7 +1344,7 @@ impl<'a, C, A> ProjectProfileCreateOfflineCall<'a, C, A> where C: BorrowMut ProjectProfileCreateOfflineCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Cloud Resource Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudresourcemanager1] path = "../cloudresourcemanager1" -version = "1.0.8+20181008" +version = "1.0.8+20190401" diff --git a/gen/cloudresourcemanager1-cli/README.md b/gen/cloudresourcemanager1-cli/README.md index 8204c91792..12e4c19597 100644 --- a/gen/cloudresourcemanager1-cli/README.md +++ b/gen/cloudresourcemanager1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Resource Manager* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Resource Manager* API at revision *20190401*. The CLI is at version *1.0.8*. ```bash cloudresourcemanager1 [options] diff --git a/gen/cloudresourcemanager1-cli/mkdocs.yml b/gen/cloudresourcemanager1-cli/mkdocs.yml index 7158943b1d..fb9a6c3985 100644 --- a/gen/cloudresourcemanager1-cli/mkdocs.yml +++ b/gen/cloudresourcemanager1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Resource Manager v1.0.8+20181008 +site_name: Cloud Resource Manager v1.0.8+20190401 site_url: http://byron.github.io/google-apis-rs/google-cloudresourcemanager1-cli site_description: A complete library to interact with Cloud Resource Manager (protocol v1) diff --git a/gen/cloudresourcemanager1-cli/src/main.rs b/gen/cloudresourcemanager1-cli/src/main.rs index ce45429d97..39b0668467 100644 --- a/gen/cloudresourcemanager1-cli/src/main.rs +++ b/gen/cloudresourcemanager1-cli/src/main.rs @@ -500,10 +500,10 @@ impl<'n> Engine<'n> { "policy.update-time" => Some(("policy.updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "policy.constraint" => Some(("policy.constraint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "policy.list-policy.all-values" => Some(("policy.listPolicy.allValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.list-policy.allowed-values" => Some(("policy.listPolicy.allowedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "policy.list-policy.denied-values" => Some(("policy.listPolicy.deniedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "policy.list-policy.inherit-from-parent" => Some(("policy.listPolicy.inheritFromParent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "policy.list-policy.suggested-value" => Some(("policy.listPolicy.suggestedValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.list-policy.denied-values" => Some(("policy.listPolicy.deniedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "policy.list-policy.allowed-values" => Some(("policy.listPolicy.allowedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "policy.boolean-policy.enforced" => Some(("policy.booleanPolicy.enforced", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1640,10 +1640,10 @@ impl<'n> Engine<'n> { "policy.update-time" => Some(("policy.updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "policy.constraint" => Some(("policy.constraint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "policy.list-policy.all-values" => Some(("policy.listPolicy.allValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.list-policy.allowed-values" => Some(("policy.listPolicy.allowedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "policy.list-policy.denied-values" => Some(("policy.listPolicy.deniedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "policy.list-policy.inherit-from-parent" => Some(("policy.listPolicy.inheritFromParent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "policy.list-policy.suggested-value" => Some(("policy.listPolicy.suggestedValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.list-policy.denied-values" => Some(("policy.listPolicy.deniedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "policy.list-policy.allowed-values" => Some(("policy.listPolicy.allowedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "policy.boolean-policy.enforced" => Some(("policy.booleanPolicy.enforced", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1907,9 +1907,9 @@ impl<'n> Engine<'n> { "parent.id" => Some(("parent.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "labels", "lifecycle-state", "name", "parent", "project-id", "project-number", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -2760,10 +2760,10 @@ impl<'n> Engine<'n> { "policy.update-time" => Some(("policy.updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "policy.constraint" => Some(("policy.constraint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "policy.list-policy.all-values" => Some(("policy.listPolicy.allValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.list-policy.allowed-values" => Some(("policy.listPolicy.allowedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "policy.list-policy.denied-values" => Some(("policy.listPolicy.deniedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "policy.list-policy.inherit-from-parent" => Some(("policy.listPolicy.inheritFromParent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "policy.list-policy.suggested-value" => Some(("policy.listPolicy.suggestedValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.list-policy.denied-values" => Some(("policy.listPolicy.deniedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "policy.list-policy.allowed-values" => Some(("policy.listPolicy.allowedValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "policy.boolean-policy.enforced" => Some(("policy.booleanPolicy.enforced", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3025,9 +3025,9 @@ impl<'n> Engine<'n> { "parent.id" => Some(("parent.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "labels", "lifecycle-state", "name", "parent", "project-id", "project-number", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -3683,7 +3683,9 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the Organization to fetch, e.g. "organizations/1234"."##), + Some(r##"The resource name of the Organization to fetch. This is the organization's + relative path in the API, formatted as "organizations/[organizationId]". + For example, "organizations/1234"."##), Some(true), Some(false)), @@ -4545,8 +4547,8 @@ fn main() { let mut app = App::new("cloudresourcemanager1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") - .about("The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.") + .version("1.0.8+20190401") + .about("Creates, reads, and updates metadata for Google Cloud Platform resource containers.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/cloudresourcemanager1/Cargo.toml b/gen/cloudresourcemanager1/Cargo.toml index 4055612e74..ca3c0411f6 100644 --- a/gen/cloudresourcemanager1/Cargo.toml +++ b/gen/cloudresourcemanager1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudresourcemanager1" -version = "1.0.8+20181008" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1" homepage = "https://cloud.google.com/resource-manager" -documentation = "https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008" +documentation = "https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401" license = "MIT" keywords = ["cloudresourcemanager", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudresourcemanager1/README.md b/gen/cloudresourcemanager1/README.md index 9726822748..c722fc84cf 100644 --- a/gen/cloudresourcemanager1/README.md +++ b/gen/cloudresourcemanager1/README.md @@ -5,24 +5,24 @@ DO NOT EDIT ! --> The `google-cloudresourcemanager1` library allows access to all features of the *Google Cloud Resource Manager* service. -This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Resource Manager* *v1* API can be found at the [official documentation site](https://cloud.google.com/resource-manager). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.CloudResourceManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.CloudResourceManager.html) ... * folders - * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.FolderClearOrgPolicyCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.FolderGetEffectiveOrgPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.FolderGetOrgPolicyCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.FolderListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.FolderListOrgPolicyCall.html) and [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.FolderSetOrgPolicyCall.html) -* [liens](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.Lien.html) - * [*create*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.LienCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.LienDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.LienGetCall.html) and [*list*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.LienListCall.html) -* [operations](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.Operation.html) - * [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OperationGetCall.html) -* [organizations](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.Organization.html) - * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationClearOrgPolicyCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationGetCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationGetEffectiveOrgPolicyCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationGetIamPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationGetOrgPolicyCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationListOrgPolicyCall.html), [*search*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationSearchCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationSetIamPolicyCall.html), [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationSetOrgPolicyCall.html) and [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.OrganizationTestIamPermissionCall.html) -* [projects](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.Project.html) - * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectClearOrgPolicyCall.html), [*create*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectGetCall.html), [*get ancestry*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectGetAncestryCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectGetEffectiveOrgPolicyCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectGetIamPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectGetOrgPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectListCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectListOrgPolicyCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectSetIamPolicyCall.html), [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectSetOrgPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectTestIamPermissionCall.html), [*undelete*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectUndeleteCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.ProjectUpdateCall.html) + * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.FolderClearOrgPolicyCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.FolderGetEffectiveOrgPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.FolderGetOrgPolicyCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.FolderListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.FolderListOrgPolicyCall.html) and [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.FolderSetOrgPolicyCall.html) +* [liens](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.Lien.html) + * [*create*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.LienCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.LienDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.LienGetCall.html) and [*list*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.LienListCall.html) +* [operations](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.Operation.html) + * [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OperationGetCall.html) +* [organizations](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.Organization.html) + * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationClearOrgPolicyCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationGetCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationGetEffectiveOrgPolicyCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationGetIamPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationGetOrgPolicyCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationListOrgPolicyCall.html), [*search*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationSearchCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationSetIamPolicyCall.html), [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationSetOrgPolicyCall.html) and [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.OrganizationTestIamPermissionCall.html) +* [projects](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.Project.html) + * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectClearOrgPolicyCall.html), [*create*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectGetCall.html), [*get ancestry*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectGetAncestryCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectGetEffectiveOrgPolicyCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectGetIamPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectGetOrgPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectListCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectListOrgPolicyCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectSetIamPolicyCall.html), [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectSetOrgPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectTestIamPermissionCall.html), [*undelete*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectUndeleteCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.ProjectUpdateCall.html) @@ -31,17 +31,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/struct.CloudResourceManager.html)** +* **[Hub](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/struct.CloudResourceManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -150,17 +150,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -170,29 +170,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudresourcemanager1/1.0.8+20181008/google_cloudresourcemanager1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudresourcemanager1/1.0.8+20190401/google_cloudresourcemanager1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudresourcemanager1/src/lib.rs b/gen/cloudresourcemanager1/src/lib.rs index 804edab481..bfdd8a00a4 100644 --- a/gen/cloudresourcemanager1/src/lib.rs +++ b/gen/cloudresourcemanager1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Resource Manager* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/resource-manager). @@ -403,37 +403,6 @@ impl<'a, C, A> CloudResourceManager // ############ // SCHEMAS ### // ########## -/// Represents an expression text. Example: -/// -/// title: "User account presence" -/// description: "Determines whether the request has a user account" -/// expression: "size(request.user) > 0" -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, - /// Textual representation of an expression in - /// Common Expression Language syntax. - /// - /// The application context of the containing message determines which - /// well-known feature set of CEL is supported. - pub expression: Option, - /// An optional string indicating the location of the expression for error - /// reporting, e.g. a file name and a position in the file. - pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, -} - -impl Part for Expr {} - - /// The response returned from the `SearchOrganizations` method. /// /// # Activities @@ -489,48 +458,57 @@ pub struct SetIamPolicyRequest { impl RequestValue for SetIamPolicyRequest {} -/// Associates `members` with a `role`. +/// A Lien represents an encumbrance on the actions that can be performed on a +/// resource. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [create liens](struct.LienCreateCall.html) (request|response) +/// * [delete liens](struct.LienDeleteCall.html) (none) +/// * [list liens](struct.LienListCall.html) (none) +/// * [get liens](struct.LienGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Binding { - /// Role that is assigned to `members`. - /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. - pub role: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. - /// `members` can have the following values: +pub struct Lien { + /// A stable, user-visible/meaningful string identifying the origin of the + /// Lien, intended to be inspected programmatically. Maximum length of 200 + /// characters. /// - /// * `allUsers`: A special identifier that represents anyone who is - /// on the internet; with or without a Google account. + /// Example: 'compute.googleapis.com' + pub origin: Option, + /// The types of operations which should be blocked as a result of this Lien. + /// Each value should correspond to an IAM permission. The server will + /// validate the permissions against those for which Liens are supported. /// - /// * `allAuthenticatedUsers`: A special identifier that represents anyone - /// who is authenticated with a Google account or a service account. + /// An empty list is meaningless and will be rejected. /// - /// * `user:{emailid}`: An email address that represents a specific Google - /// account. For example, `alice@gmail.com` . + /// Example: ['resourcemanager.projects.delete'] + pub restrictions: Option>, + /// Concise user-visible strings indicating why an action cannot be performed + /// on a resource. Maximum length of 200 characters. /// + /// Example: 'Holds production API key' + pub reason: Option, + /// A system-generated unique identifier for this Lien. /// - /// * `serviceAccount:{emailid}`: An email address that represents a service - /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// Example: `liens/1234abcd` + pub name: Option, + /// A reference to the resource this Lien is attached to. The server will + /// validate the parent against those for which Liens are supported. /// - /// * `group:{emailid}`: An email address that represents a Google group. - /// For example, `admins@example.com`. - /// - /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the - /// users of that domain. For example, `google.com` or `example.com`. - /// - /// - pub members: Option>, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, + /// Example: `projects/1234` + pub parent: Option, + /// The creation time of this Lien. + #[serde(rename="createTime")] + pub create_time: Option, } -impl Part for Binding {} +impl RequestValue for Lien {} +impl Resource for Lien {} +impl ResponseResult for Lien {} /// Ignores policies set above this resource and restores the @@ -678,17 +656,17 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -769,42 +747,26 @@ pub struct TestIamPermissionsResponse { impl ResponseResult for TestIamPermissionsResponse {} -/// A page of the response received from the -/// ListProjects -/// method. +/// A `Constraint` that allows or disallows a list of string values, which are +/// configured by an Organization's policy administrator with a `Policy`. /// -/// A paginated response where more pages are available has -/// `next_page_token` set. This token can be used in a subsequent request to -/// retrieve the next request page. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list projects](struct.ProjectListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListProjectsResponse { - /// Pagination token. - /// - /// If the result set is too large to fit in a single response, this token - /// is returned. It encodes the position of the current result cursor. - /// Feeding this value into a new list request with the `page_token` parameter - /// gives the next page of the results. - /// - /// When `next_page_token` is not filled in, there is no next page and - /// the list returned is the last page in the result set. - /// - /// Pagination tokens have a limited lifetime. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of Projects that matched the list filter. This list can - /// be paginated. - pub projects: Option>, +pub struct ListConstraint { + /// Indicates whether subtrees of Cloud Resource Manager resource hierarchy + /// can be used in `Policy.allowed_values` and `Policy.denied_values`. For + /// example, `"under:folders/123"` would match any resource under the + /// 'folders/123' folder. + #[serde(rename="supportsUnder")] + pub supports_under: Option, + /// Optional. The Google Cloud Console will try to default to a configuration + /// that matches the value specified in this `Constraint`. + #[serde(rename="suggestedValue")] + pub suggested_value: Option, } -impl ResponseResult for ListProjectsResponse {} +impl Part for ListConstraint {} /// The response returned from the ListAvailableOrgPolicyConstraints method. @@ -883,10 +845,10 @@ pub struct ListPolicy { /// The policy all_values state. #[serde(rename="allValues")] pub all_values: Option, - /// List of values denied at this resource. Can only be set if `all_values` + /// List of values allowed at this resource. Can only be set if `all_values` /// is set to `ALL_VALUES_UNSPECIFIED`. - #[serde(rename="deniedValues")] - pub denied_values: Option>, + #[serde(rename="allowedValues")] + pub allowed_values: Option>, /// Determines the inheritance behavior for this `Policy`. /// /// By default, a `ListPolicy` set at a resource supercedes any `Policy` set @@ -992,10 +954,10 @@ pub struct ListPolicy { /// unless `inherit_from_parent` is `false`. #[serde(rename="suggestedValue")] pub suggested_value: Option, - /// List of values allowed at this resource. Can only be set if `all_values` + /// List of values denied at this resource. Can only be set if `all_values` /// is set to `ALL_VALUES_UNSPECIFIED`. - #[serde(rename="allowedValues")] - pub allowed_values: Option>, + #[serde(rename="deniedValues")] + pub denied_values: Option>, } impl Part for ListPolicy {} @@ -1011,9 +973,10 @@ pub struct BooleanPolicy { /// If `true`, then the `Policy` is enforced. If `false`, then any /// configuration is acceptable. /// - /// Suppose you have a `Constraint` `constraints/compute.disableSerialPortAccess` - /// with `constraint_default` set to `ALLOW`. A `Policy` for that - /// `Constraint` exhibits the following behavior: + /// Suppose you have a `Constraint` + /// `constraints/compute.disableSerialPortAccess` with `constraint_default` + /// set to `ALLOW`. A `Policy` for that `Constraint` exhibits the following + /// behavior: /// - If the `Policy` at this resource has enforced set to `false`, serial /// port connection attempts will be allowed. /// - If the `Policy` at this resource has enforced set to `true`, serial @@ -1057,27 +1020,35 @@ pub struct BooleanPolicy { impl Part for BooleanPolicy {} -/// The request sent to the ClearOrgPolicy method. +/// Represents an expression text. Example: /// -/// # Activities +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" /// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [clear org policy folders](struct.FolderClearOrgPolicyCall.html) (request) -/// * [clear org policy organizations](struct.OrganizationClearOrgPolicyCall.html) (request) -/// * [clear org policy projects](struct.ProjectClearOrgPolicyCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ClearOrgPolicyRequest { - /// The current version, for concurrency control. Not sending an `etag` - /// will cause the `Policy` to be cleared blindly. - pub etag: Option, - /// Name of the `Constraint` of the `Policy` to clear. - pub constraint: Option, +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } -impl RequestValue for ClearOrgPolicyRequest {} +impl Part for Expr {} /// The request sent to the SetOrgPolicyRequest method. @@ -1285,8 +1256,8 @@ impl ResponseResult for GetAncestryResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Project { - /// The user-assigned display name of the Project. - /// It must be 4 to 30 characters. + /// The optional user-assigned display name of the Project. + /// When present it must be between 4 to 30 characters. /// Allowed characters are: lowercase and uppercase letters, numbers, /// hyphen, single-quote, double-quote, space, and exclamation point. /// @@ -1317,7 +1288,8 @@ pub struct Project { /// to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. /// /// Label values must be between 0 and 63 characters long and must conform - /// to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + /// to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. A label + /// value can be empty. /// /// No more than 256 labels can be associated with a given resource. /// @@ -1327,17 +1299,17 @@ pub struct Project { /// Example: "environment" : "dev" /// Read-write. pub labels: Option>, - /// Creation time. - /// - /// Read-only. - #[serde(rename="createTime")] - pub create_time: Option, /// The number uniquely identifying the project. /// /// Example: 415104041262 /// Read-only. #[serde(rename="projectNumber")] pub project_number: Option, + /// Creation time. + /// + /// Read-only. + #[serde(rename="createTime")] + pub create_time: Option, /// The Project lifecycle state. /// /// Read-only. @@ -1350,22 +1322,6 @@ impl Resource for Project {} impl ResponseResult for Project {} -/// The request sent to the UndeleteProject -/// method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [undelete projects](struct.ProjectUndeleteCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UndeleteProjectRequest { _never_set: Option } - -impl RequestValue for UndeleteProjectRequest {} - - /// The request sent to the /// GetAncestry /// method. @@ -1383,6 +1339,29 @@ pub struct GetAncestryRequest { _never_set: Option } impl RequestValue for GetAncestryRequest {} +/// The request sent to the ClearOrgPolicy method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [clear org policy folders](struct.FolderClearOrgPolicyCall.html) (request) +/// * [clear org policy organizations](struct.OrganizationClearOrgPolicyCall.html) (request) +/// * [clear org policy projects](struct.ProjectClearOrgPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClearOrgPolicyRequest { + /// The current version, for concurrency control. Not sending an `etag` + /// will cause the `Policy` to be cleared blindly. + pub etag: Option, + /// Name of the `Constraint` of the `Policy` to clear. + pub constraint: Option, +} + +impl RequestValue for ClearOrgPolicyRequest {} + + /// The root node in the resource hierarchy to which a particular entity's /// (e.g., company) resources belong. /// @@ -1409,6 +1388,10 @@ pub struct Organization { /// creation. Once set, it cannot be changed. /// This field is required. pub owner: Option, + /// Timestamp when the Organization was created. Assigned by the server. + /// @OutputOnly + #[serde(rename="creationTime")] + pub creation_time: Option, /// A human-readable string that refers to the Organization in the /// GCP Console UI. This string is set by the server and cannot be /// changed. The string will be set to the primary domain (for example, @@ -1416,10 +1399,6 @@ pub struct Organization { /// @OutputOnly #[serde(rename="displayName")] pub display_name: Option, - /// Timestamp when the Organization was created. Assigned by the server. - /// @OutputOnly - #[serde(rename="creationTime")] - pub creation_time: Option, /// The organization's current lifecycle state. Assigned by the server. /// @OutputOnly #[serde(rename="lifecycleState")] @@ -1434,26 +1413,42 @@ impl Resource for Organization {} impl ResponseResult for Organization {} -/// A `Constraint` that allows or disallows a list of string values, which are -/// configured by an Organization's policy administrator with a `Policy`. +/// A page of the response received from the +/// ListProjects +/// method. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// A paginated response where more pages are available has +/// `next_page_token` set. This token can be used in a subsequent request to +/// retrieve the next request page. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list projects](struct.ProjectListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListConstraint { - /// Indicates whether subtrees of Cloud Resource Manager resource hierarchy - /// can be used in `Policy.allowed_values` and `Policy.denied_values`. For - /// example, `"under:folders/123"` would match any resource under the - /// 'folders/123' folder. - #[serde(rename="supportsUnder")] - pub supports_under: Option, - /// Optional. The Google Cloud Console will try to default to a configuration - /// that matches the value specified in this `Constraint`. - #[serde(rename="suggestedValue")] - pub suggested_value: Option, +pub struct ListProjectsResponse { + /// Pagination token. + /// + /// If the result set is too large to fit in a single response, this token + /// is returned. It encodes the position of the current result cursor. + /// Feeding this value into a new list request with the `page_token` parameter + /// gives the next page of the results. + /// + /// When `next_page_token` is not filled in, there is no next page and + /// the list returned is the last page in the result set. + /// + /// Pagination tokens have a limited lifetime. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of Projects that matched the list filter. This list can + /// be paginated. + pub projects: Option>, } -impl Part for ListConstraint {} +impl ResponseResult for ListProjectsResponse {} /// The request sent to the GetOrgPolicy method. @@ -1504,6 +1499,22 @@ pub struct ListAvailableOrgPolicyConstraintsRequest { impl RequestValue for ListAvailableOrgPolicyConstraintsRequest {} +/// The request sent to the UndeleteProject +/// method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [undelete projects](struct.ProjectUndeleteCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UndeleteProjectRequest { _never_set: Option } + +impl RequestValue for UndeleteProjectRequest {} + + /// The request sent to the ListOrgPolicies method. /// /// # Activities @@ -1553,57 +1564,48 @@ pub struct ListLiensResponse { impl ResponseResult for ListLiensResponse {} -/// A Lien represents an encumbrance on the actions that can be performed on a -/// resource. +/// Associates `members` with a `role`. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [create liens](struct.LienCreateCall.html) (request|response) -/// * [get liens](struct.LienGetCall.html) (response) -/// * [list liens](struct.LienListCall.html) (none) -/// * [delete liens](struct.LienDeleteCall.html) (none) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Lien { - /// A stable, user-visible/meaningful string identifying the origin of the - /// Lien, intended to be inspected programmatically. Maximum length of 200 - /// characters. +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: /// - /// Example: 'compute.googleapis.com' - pub origin: Option, - /// The types of operations which should be blocked as a result of this Lien. - /// Each value should correspond to an IAM permission. The server will - /// validate the permissions against those for which Liens are supported. + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. /// - /// An empty list is meaningless and will be rejected. + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. /// - /// Example: ['resourcemanager.projects.delete'] - pub restrictions: Option>, - /// Concise user-visible strings indicating why an action cannot be performed - /// on a resource. Maximum length of 200 characters. + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . /// - /// Example: 'Holds production API key' - pub reason: Option, - /// A system-generated unique identifier for this Lien. /// - /// Example: `liens/1234abcd` - pub name: Option, - /// A reference to the resource this Lien is attached to. The server will - /// validate the parent against those for which Liens are supported. + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. /// - /// Example: `projects/1234` - pub parent: Option, - /// The creation time of this Lien. - #[serde(rename="createTime")] - pub create_time: Option, + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, } -impl RequestValue for Lien {} -impl Resource for Lien {} -impl ResponseResult for Lien {} +impl Part for Binding {} /// Specifies the audit configuration for a service. @@ -1813,12 +1815,12 @@ impl RequestValue for GetEffectiveOrgPolicyRequest {} /// /// * [set org policy folders](struct.FolderSetOrgPolicyCall.html) (response) /// * [get org policy organizations](struct.OrganizationGetOrgPolicyCall.html) (response) -/// * [get effective org policy organizations](struct.OrganizationGetEffectiveOrgPolicyCall.html) (response) +/// * [get effective org policy projects](struct.ProjectGetEffectiveOrgPolicyCall.html) (response) /// * [set org policy organizations](struct.OrganizationSetOrgPolicyCall.html) (response) /// * [get effective org policy folders](struct.FolderGetEffectiveOrgPolicyCall.html) (response) /// * [get org policy folders](struct.FolderGetOrgPolicyCall.html) (response) +/// * [get effective org policy organizations](struct.OrganizationGetEffectiveOrgPolicyCall.html) (response) /// * [get org policy projects](struct.ProjectGetOrgPolicyCall.html) (response) -/// * [get effective org policy projects](struct.ProjectGetEffectiveOrgPolicyCall.html) (response) /// * [set org policy projects](struct.ProjectSetOrgPolicyCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -1928,25 +1930,6 @@ impl<'a, C, A> MethodsBuilder for FolderMethods<'a, C, A> {} impl<'a, C, A> FolderMethods<'a, C, A> { - /// Create a builder to help you perform the following task: - /// - /// Clears a `Policy` from a resource. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - Name of the resource for the `Policy` to clear. - pub fn clear_org_policy(&self, request: ClearOrgPolicyRequest, resource: &str) -> FolderClearOrgPolicyCall<'a, C, A> { - FolderClearOrgPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Gets the effective `Policy` on a resource. This is the result of merging @@ -1970,6 +1953,25 @@ impl<'a, C, A> FolderMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Clears a `Policy` from a resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - Name of the resource for the `Policy` to clear. + pub fn clear_org_policy(&self, request: ClearOrgPolicyRequest, resource: &str) -> FolderClearOrgPolicyCall<'a, C, A> { + FolderClearOrgPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Lists `Constraints` that could be applied on the specified resource. @@ -2097,6 +2099,25 @@ impl<'a, C, A> MethodsBuilder for OrganizationMethods<'a, C, A> {} impl<'a, C, A> OrganizationMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Clears a `Policy` from a resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - Name of the resource for the `Policy` to clear. + pub fn clear_org_policy(&self, request: ClearOrgPolicyRequest, resource: &str) -> OrganizationClearOrgPolicyCall<'a, C, A> { + OrganizationClearOrgPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Gets a `Policy` on a resource. @@ -2190,7 +2211,9 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The resource name of the Organization to fetch, e.g. "organizations/1234". + /// * `name` - The resource name of the Organization to fetch. This is the organization's + /// relative path in the API, formatted as "organizations/[organizationId]". + /// For example, "organizations/1234". pub fn get(&self, name: &str) -> OrganizationGetCall<'a, C, A> { OrganizationGetCall { hub: self.hub, @@ -2318,25 +2341,6 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { _additional_params: Default::default(), } } - - /// Create a builder to help you perform the following task: - /// - /// Clears a `Policy` from a resource. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - Name of the resource for the `Policy` to clear. - pub fn clear_org_policy(&self, request: ClearOrgPolicyRequest, resource: &str) -> OrganizationClearOrgPolicyCall<'a, C, A> { - OrganizationClearOrgPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } } @@ -2802,18 +2806,59 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the effective `Policy` on a resource. This is the result of merging - /// `Policies` in the resource hierarchy. The returned `Policy` will not have - /// an `etag`set because it is a computed `Policy` across multiple resources. - /// Subtrees of Resource Manager resource hierarchy with 'under:' prefix will - /// not be expanded. + /// Sets the IAM access control policy for the specified Project. Overwrites + /// any existing policy. + /// + /// The following constraints apply when using `setIamPolicy()`: + /// + /// + Project does not support `allUsers` and `allAuthenticatedUsers` as + /// `members` in a `Binding` of a `Policy`. + /// + /// + The owner role can be granted only to `user` and `serviceAccount`. + /// + /// + Service accounts can be made owners of a project directly + /// without any restrictions. However, to be added as an owner, a user must be + /// invited via Cloud Platform console and must accept the invitation. + /// + /// + A user cannot be granted the owner role using `setIamPolicy()`. The user + /// must be granted the owner role using the Cloud Platform Console and must + /// explicitly accept the invitation. + /// + /// + You can only grant ownership of a project to a member by using the + /// GCP Console. Inviting a member will deliver an invitation email that + /// they must accept. An invitation email is not generated if you are + /// granting a role other than owner, or if both the member you are inviting + /// and the project are part of your organization. + /// + /// + Membership changes that leave the project without any owners that have + /// accepted the Terms of Service (ToS) will be rejected. + /// + /// + If the project is not part of an organization, there must be at least + /// one owner who has accepted the Terms of Service (ToS) agreement in the + /// policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner + /// from the policy will fail. This restriction also applies to legacy + /// projects that no longer have owners who have accepted the ToS. Edits to + /// IAM policies will be rejected until the lack of a ToS-accepting owner is + /// rectified. + /// + /// + This method will replace the existing policy, and cannot be used to + /// append additional IAM settings. + /// + /// Note: Removing service accounts from policies or changing their roles + /// can render services completely inoperable. It is important to understand + /// how the service account is being used before removing or updating its + /// roles. + /// + /// Authorization requires the Google IAM permission + /// `resourcemanager.projects.setIamPolicy` on the project /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - The name of the resource to start computing the effective `Policy`. - pub fn get_effective_org_policy(&self, request: GetEffectiveOrgPolicyRequest, resource: &str) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> { - ProjectGetEffectiveOrgPolicyCall { + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectSetIamPolicyCall<'a, C, A> { + ProjectSetIamPolicyCall { hub: self.hub, _request: request, _resource: resource.to_string(), @@ -2871,59 +2916,18 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the IAM access control policy for the specified Project. Overwrites - /// any existing policy. - /// - /// The following constraints apply when using `setIamPolicy()`: - /// - /// + Project does not support `allUsers` and `allAuthenticatedUsers` as - /// `members` in a `Binding` of a `Policy`. - /// - /// + The owner role can be granted only to `user` and `serviceAccount`. - /// - /// + Service accounts can be made owners of a project directly - /// without any restrictions. However, to be added as an owner, a user must be - /// invited via Cloud Platform console and must accept the invitation. - /// - /// + A user cannot be granted the owner role using `setIamPolicy()`. The user - /// must be granted the owner role using the Cloud Platform Console and must - /// explicitly accept the invitation. - /// - /// + You can only grant ownership of a project to a member by using the - /// GCP Console. Inviting a member will deliver an invitation email that - /// they must accept. An invitation email is not generated if you are - /// granting a role other than owner, or if both the member you are inviting - /// and the project are part of your organization. - /// - /// + Membership changes that leave the project without any owners that have - /// accepted the Terms of Service (ToS) will be rejected. - /// - /// + If the project is not part of an organization, there must be at least - /// one owner who has accepted the Terms of Service (ToS) agreement in the - /// policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner - /// from the policy will fail. This restriction also applies to legacy - /// projects that no longer have owners who have accepted the ToS. Edits to - /// IAM policies will be rejected until the lack of a ToS-accepting owner is - /// rectified. - /// - /// + This method will replace the existing policy, and cannot be used to - /// append additional IAM settings. - /// - /// Note: Removing service accounts from policies or changing their roles - /// can render services completely inoperable. It is important to understand - /// how the service account is being used before removing or updating its - /// roles. - /// - /// Authorization requires the Google IAM permission - /// `resourcemanager.projects.setIamPolicy` on the project + /// Gets the effective `Policy` on a resource. This is the result of merging + /// `Policies` in the resource hierarchy. The returned `Policy` will not have + /// an `etag`set because it is a computed `Policy` across multiple resources. + /// Subtrees of Resource Manager resource hierarchy with 'under:' prefix will + /// not be expanded. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectSetIamPolicyCall<'a, C, A> { - ProjectSetIamPolicyCall { + /// * `resource` - The name of the resource to start computing the effective `Policy`. + pub fn get_effective_org_policy(&self, request: GetEffectiveOrgPolicyRequest, resource: &str) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> { + ProjectGetEffectiveOrgPolicyCall { hub: self.hub, _request: request, _resource: resource.to_string(), @@ -3003,288 +3007,6 @@ impl<'a, C, A> OperationMethods<'a, C, A> { // CallBuilders ### // ################# -/// Clears a `Policy` from a resource. -/// -/// A builder for the *clearOrgPolicy* method supported by a *folder* resource. -/// It is not used directly, but through a `FolderMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; -/// use cloudresourcemanager1::ClearOrgPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use cloudresourcemanager1::CloudResourceManager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudResourceManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ClearOrgPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.folders().clear_org_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct FolderClearOrgPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudResourceManager, - _request: ClearOrgPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for FolderClearOrgPolicyCall<'a, C, A> {} - -impl<'a, C, A> FolderClearOrgPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.folders.clearOrgPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+resource}:clearOrgPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ClearOrgPolicyRequest) -> FolderClearOrgPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// Name of the resource for the `Policy` to clear. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> FolderClearOrgPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderClearOrgPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> FolderClearOrgPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> FolderClearOrgPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Gets the effective `Policy` on a resource. This is the result of merging /// `Policies` in the resource hierarchy. The returned `Policy` will not have /// an `etag`set because it is a computed `Policy` across multiple resources. @@ -3382,7 +3104,7 @@ impl<'a, C, A> FolderGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMut FolderGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3433,7 +3152,7 @@ impl<'a, C, A> FolderGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMut FolderGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMut FolderGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ClearOrgPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().clear_org_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct FolderClearOrgPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: ClearOrgPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderClearOrgPolicyCall<'a, C, A> {} + +impl<'a, C, A> FolderClearOrgPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.folders.clearOrgPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:clearOrgPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ClearOrgPolicyRequest) -> FolderClearOrgPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Name of the resource for the `Policy` to clear. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> FolderClearOrgPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderClearOrgPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderClearOrgPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderClearOrgPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Lists `Constraints` that could be applied on the specified resource. /// /// A builder for the *listAvailableOrgPolicyConstraints* method supported by a *folder* resource. @@ -3664,7 +3662,7 @@ impl<'a, C, A> FolderListAvailableOrgPolicyConstraintCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3680,10 +3678,7 @@ impl<'a, C, A> FolderListAvailableOrgPolicyConstraintCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3715,7 +3710,7 @@ impl<'a, C, A> FolderListAvailableOrgPolicyConstraintCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3805,7 +3800,7 @@ impl<'a, C, A> FolderListAvailableOrgPolicyConstraintCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3951,7 +3946,7 @@ impl<'a, C, A> FolderGetOrgPolicyCall<'a, C, A> where C: BorrowMut FolderGetOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4002,7 +3994,7 @@ impl<'a, C, A> FolderGetOrgPolicyCall<'a, C, A> where C: BorrowMut FolderGetOrgPolicyCall<'a, C, A> where C: BorrowMut FolderSetOrgPolicyCall<'a, C, A> where C: BorrowMut FolderSetOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4288,7 +4277,7 @@ impl<'a, C, A> FolderSetOrgPolicyCall<'a, C, A> where C: BorrowMut FolderSetOrgPolicyCall<'a, C, A> where C: BorrowMut FolderListOrgPolicyCall<'a, C, A> where C: BorrowMut FolderListOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4570,7 +4556,7 @@ impl<'a, C, A> FolderListOrgPolicyCall<'a, C, A> where C: BorrowMut FolderListOrgPolicyCall<'a, C, A> where C: BorrowMut FolderListOrgPolicyCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ClearOrgPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().clear_org_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationClearOrgPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: ClearOrgPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationClearOrgPolicyCall<'a, C, A> {} + +impl<'a, C, A> OrganizationClearOrgPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.clearOrgPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:clearOrgPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ClearOrgPolicyRequest) -> OrganizationClearOrgPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Name of the resource for the `Policy` to clear. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> OrganizationClearOrgPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationClearOrgPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationClearOrgPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationClearOrgPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Gets a `Policy` on a resource. /// /// If no `Policy` is set on the resource, a `Policy` is returned with default @@ -4806,7 +5071,7 @@ impl<'a, C, A> OrganizationGetOrgPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4857,7 +5119,7 @@ impl<'a, C, A> OrganizationGetOrgPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetOrgPolicyCall<'a, C, A> where C: BorrowMut OrganizationListAvailableOrgPolicyConstraintCall<'a, C, A> where } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5104,10 +5366,7 @@ impl<'a, C, A> OrganizationListAvailableOrgPolicyConstraintCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5139,7 +5398,7 @@ impl<'a, C, A> OrganizationListAvailableOrgPolicyConstraintCall<'a, C, A> where request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5229,7 +5488,7 @@ impl<'a, C, A> OrganizationListAvailableOrgPolicyConstraintCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5370,7 +5629,7 @@ impl<'a, C, A> OrganizationListOrgPolicyCall<'a, C, A> where C: BorrowMut OrganizationListOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5421,7 +5677,7 @@ impl<'a, C, A> OrganizationListOrgPolicyCall<'a, C, A> where C: BorrowMut OrganizationListOrgPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5708,7 +5961,7 @@ impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5949,10 +6202,7 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5972,7 +6222,7 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6025,7 +6275,9 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, } - /// The resource name of the Organization to fetch, e.g. "organizations/1234". + /// The resource name of the Organization to fetch. This is the organization's + /// relative path in the API, formatted as "organizations/[organizationId]". + /// For example, "organizations/1234". /// /// Sets the *name* path property to the given value. /// @@ -6050,7 +6302,7 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6195,7 +6447,7 @@ impl<'a, C, A> OrganizationGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6211,10 +6463,7 @@ impl<'a, C, A> OrganizationGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6246,7 +6495,7 @@ impl<'a, C, A> OrganizationGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6336,7 +6585,7 @@ impl<'a, C, A> OrganizationGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6472,10 +6721,7 @@ impl<'a, C, A> OrganizationSearchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6507,7 +6753,7 @@ impl<'a, C, A> OrganizationSearchCall<'a, C, A> where C: BorrowMut OrganizationSearchCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6784,7 +7027,7 @@ impl<'a, C, A> OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7071,7 +7311,7 @@ impl<'a, C, A> OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationSetOrgPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7358,7 +7595,7 @@ impl<'a, C, A> OrganizationSetOrgPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetOrgPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetOrgPolicyCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = CloudResourceManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ClearOrgPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.organizations().clear_org_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct OrganizationClearOrgPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudResourceManager, - _request: ClearOrgPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OrganizationClearOrgPolicyCall<'a, C, A> {} - -impl<'a, C, A> OrganizationClearOrgPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.clearOrgPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+resource}:clearOrgPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ClearOrgPolicyRequest) -> OrganizationClearOrgPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// Name of the resource for the `Policy` to clear. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> OrganizationClearOrgPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationClearOrgPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> OrganizationClearOrgPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> OrganizationClearOrgPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Create a Lien which applies to the resource denoted by the `parent` field. /// /// Callers of this method will require permission on the `parent` resource. @@ -7866,10 +7821,7 @@ impl<'a, C, A> LienCreateCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7901,7 +7853,7 @@ impl<'a, C, A> LienCreateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7981,7 +7933,7 @@ impl<'a, C, A> LienCreateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8120,7 +8072,7 @@ impl<'a, C, A> LienGetCall<'a, C, A> where C: BorrowMut, A: oauth } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8136,10 +8088,7 @@ impl<'a, C, A> LienGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8159,7 +8108,7 @@ impl<'a, C, A> LienGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8237,7 +8186,7 @@ impl<'a, C, A> LienGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8375,7 +8324,7 @@ impl<'a, C, A> LienDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8391,10 +8340,7 @@ impl<'a, C, A> LienDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8414,7 +8360,7 @@ impl<'a, C, A> LienDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8492,7 +8438,7 @@ impl<'a, C, A> LienDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8634,10 +8580,7 @@ impl<'a, C, A> LienListCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8657,7 +8600,7 @@ impl<'a, C, A> LienListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8747,7 +8690,7 @@ impl<'a, C, A> LienListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8913,10 +8856,7 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8936,7 +8876,7 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9016,7 +8956,7 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9176,10 +9116,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9211,7 +9148,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectCreateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9484,7 +9418,7 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9564,7 +9498,7 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9710,7 +9644,7 @@ impl<'a, C, A> ProjectGetOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectGetOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9761,7 +9692,7 @@ impl<'a, C, A> ProjectGetOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectGetOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectSetOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectSetOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10047,7 +9975,7 @@ impl<'a, C, A> ProjectSetOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectSetOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectClearOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectClearOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10329,7 +10254,7 @@ impl<'a, C, A> ProjectClearOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectClearOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectUndeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10613,7 +10535,7 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10705,7 +10627,7 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10846,7 +10768,7 @@ impl<'a, C, A> ProjectListOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectListOrgPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10897,7 +10816,7 @@ impl<'a, C, A> ProjectListOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectListOrgPolicyCall<'a, C, A> where C: BorrowMut ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11177,7 +11093,7 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectListAvailableOrgPolicyConstraintCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11425,10 +11341,7 @@ impl<'a, C, A> ProjectListAvailableOrgPolicyConstraintCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11460,7 +11373,7 @@ impl<'a, C, A> ProjectListAvailableOrgPolicyConstraintCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11550,7 +11463,7 @@ impl<'a, C, A> ProjectListAvailableOrgPolicyConstraintCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11699,10 +11612,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11722,7 +11632,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11802,7 +11712,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11946,10 +11856,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11969,7 +11876,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12093,7 +12000,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12141,858 +12048,6 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } -/// Gets the effective `Policy` on a resource. This is the result of merging -/// `Policies` in the resource hierarchy. The returned `Policy` will not have -/// an `etag`set because it is a computed `Policy` across multiple resources. -/// Subtrees of Resource Manager resource hierarchy with 'under:' prefix will -/// not be expanded. -/// -/// A builder for the *getEffectiveOrgPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; -/// use cloudresourcemanager1::GetEffectiveOrgPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use cloudresourcemanager1::CloudResourceManager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudResourceManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GetEffectiveOrgPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().get_effective_org_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectGetEffectiveOrgPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudResourceManager, - _request: GetEffectiveOrgPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectGetEffectiveOrgPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, OrgPolicy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.getEffectiveOrgPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+resource}:getEffectiveOrgPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GetEffectiveOrgPolicyRequest) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// The name of the resource to start computing the effective `Policy`. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a list of ancestors in the resource hierarchy for the Project -/// identified by the specified `project_id` (for example, `my-project-123`). -/// -/// The caller must have read permissions for this Project. -/// -/// A builder for the *getAncestry* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; -/// use cloudresourcemanager1::GetAncestryRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use cloudresourcemanager1::CloudResourceManager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudResourceManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GetAncestryRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().get_ancestry(req, "projectId") -/// .doit(); -/// # } -/// ``` -pub struct ProjectGetAncestryCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudResourceManager, - _request: GetAncestryRequest, - _project_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectGetAncestryCall<'a, C, A> {} - -impl<'a, C, A> ProjectGetAncestryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GetAncestryResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.getAncestry", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("projectId", self._project_id.to_string())); - for &field in ["alt", "projectId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}:getAncestry"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{projectId}", "projectId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["projectId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GetAncestryRequest) -> ProjectGetAncestryCall<'a, C, A> { - self._request = new_value; - self - } - /// The Project ID (for example, `my-project-123`). - /// - /// Required. - /// - /// Sets the *project id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project_id(mut self, new_value: &str) -> ProjectGetAncestryCall<'a, C, A> { - self._project_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetAncestryCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectGetAncestryCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectGetAncestryCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates the attributes of the Project identified by the specified -/// `project_id` (for example, `my-project-123`). -/// -/// The caller must have modify permissions for this Project. -/// -/// A builder for the *update* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; -/// use cloudresourcemanager1::Project; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use cloudresourcemanager1::CloudResourceManager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudResourceManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Project::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().update(req, "projectId") -/// .doit(); -/// # } -/// ``` -pub struct ProjectUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudResourceManager, - _request: Project, - _project_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectUpdateCall<'a, C, A> {} - -impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Project)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("projectId", self._project_id.to_string())); - for &field in ["alt", "projectId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{projectId}", "projectId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["projectId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Project) -> ProjectUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The project ID (for example, `my-project-123`). - /// - /// Required. - /// - /// Sets the *project id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project_id(mut self, new_value: &str) -> ProjectUpdateCall<'a, C, A> { - self._project_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectUpdateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Sets the IAM access control policy for the specified Project. Overwrites /// any existing policy. /// @@ -13142,10 +12197,7 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13177,7 +12229,7 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetAncestryRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().get_ancestry(req, "projectId") +/// .doit(); +/// # } +/// ``` +pub struct ProjectGetAncestryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: GetAncestryRequest, + _project_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectGetAncestryCall<'a, C, A> {} + +impl<'a, C, A> ProjectGetAncestryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GetAncestryResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.getAncestry", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("projectId", self._project_id.to_string())); + for &field in ["alt", "projectId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}:getAncestry"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["projectId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetAncestryRequest) -> ProjectGetAncestryCall<'a, C, A> { + self._request = new_value; + self + } + /// The Project ID (for example, `my-project-123`). + /// + /// Required. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> ProjectGetAncestryCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetAncestryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectGetAncestryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectGetAncestryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the attributes of the Project identified by the specified +/// `project_id` (for example, `my-project-123`). +/// +/// The caller must have modify permissions for this Project. +/// +/// A builder for the *update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; +/// use cloudresourcemanager1::Project; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudresourcemanager1::CloudResourceManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Project::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().update(req, "projectId") +/// .doit(); +/// # } +/// ``` +pub struct ProjectUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: Project, + _project_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Project)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("projectId", self._project_id.to_string())); + for &field in ["alt", "projectId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["projectId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Project) -> ProjectUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The project ID (for example, `my-project-123`). + /// + /// Required. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> ProjectUpdateCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the effective `Policy` on a resource. This is the result of merging +/// `Policies` in the resource hierarchy. The returned `Policy` will not have +/// an `etag`set because it is a computed `Policy` across multiple resources. +/// Subtrees of Resource Manager resource hierarchy with 'under:' prefix will +/// not be expanded. +/// +/// A builder for the *getEffectiveOrgPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudresourcemanager1 as cloudresourcemanager1; +/// use cloudresourcemanager1::GetEffectiveOrgPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudresourcemanager1::CloudResourceManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudResourceManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetEffectiveOrgPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().get_effective_org_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectGetEffectiveOrgPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudResourceManager, + _request: GetEffectiveOrgPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectGetEffectiveOrgPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectGetEffectiveOrgPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrgPolicy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.getEffectiveOrgPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:getEffectiveOrgPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetEffectiveOrgPolicyRequest) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the resource to start computing the effective `Policy`. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectGetEffectiveOrgPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Gets the latest state of a long-running operation. Clients can use this /// method to poll the operation result at intervals as recommended by the API /// service. @@ -13404,7 +13299,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -13420,10 +13315,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13443,7 +13335,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13521,7 +13413,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/cloudresourcemanager1_beta1-cli/Cargo.toml b/gen/cloudresourcemanager1_beta1-cli/Cargo.toml index 28caf89523..172ebea37b 100644 --- a/gen/cloudresourcemanager1_beta1-cli/Cargo.toml +++ b/gen/cloudresourcemanager1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudresourcemanager1_beta1-cli" -version = "1.0.8+20181008" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudresourcemanager1_beta1] path = "../cloudresourcemanager1_beta1" -version = "1.0.8+20181008" +version = "1.0.8+20190401" diff --git a/gen/cloudresourcemanager1_beta1-cli/README.md b/gen/cloudresourcemanager1_beta1-cli/README.md index feaba6d9d0..ce38f7cc9b 100644 --- a/gen/cloudresourcemanager1_beta1-cli/README.md +++ b/gen/cloudresourcemanager1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Resource Manager* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Resource Manager* API at revision *20190401*. The CLI is at version *1.0.8*. ```bash cloudresourcemanager1-beta1 [options] diff --git a/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml b/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml index c26464f444..785b9e9ca8 100644 --- a/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml +++ b/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Resource Manager v1.0.8+20181008 +site_name: Cloud Resource Manager v1.0.8+20190401 site_url: http://byron.github.io/google-apis-rs/google-cloudresourcemanager1_beta1-cli site_description: A complete library to interact with Cloud Resource Manager (protocol v1beta1) diff --git a/gen/cloudresourcemanager1_beta1-cli/src/main.rs b/gen/cloudresourcemanager1_beta1-cli/src/main.rs index f6925ae83b..3f19d56dd7 100644 --- a/gen/cloudresourcemanager1_beta1-cli/src/main.rs +++ b/gen/cloudresourcemanager1_beta1-cli/src/main.rs @@ -538,9 +538,9 @@ impl<'n> Engine<'n> { "parent.id" => Some(("parent.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "labels", "lifecycle-state", "name", "parent", "project-id", "project-number", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1224,9 +1224,9 @@ impl<'n> Engine<'n> { "parent.id" => Some(("parent.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "labels", "lifecycle-state", "name", "parent", "project-id", "project-number", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1449,7 +1449,9 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The resource name of the Organization to fetch, e.g. "organizations/1234"."##), + Some(r##"The resource name of the Organization to fetch. This is the organization's + relative path in the API, formatted as "organizations/[organizationId]". + For example, "organizations/1234"."##), Some(true), Some(false)), @@ -1974,8 +1976,8 @@ fn main() { let mut app = App::new("cloudresourcemanager1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") - .about("The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.") + .version("1.0.8+20190401") + .about("Creates, reads, and updates metadata for Google Cloud Platform resource containers.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/cloudresourcemanager1_beta1/Cargo.toml b/gen/cloudresourcemanager1_beta1/Cargo.toml index cce3541a71..0d50edac0b 100644 --- a/gen/cloudresourcemanager1_beta1/Cargo.toml +++ b/gen/cloudresourcemanager1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudresourcemanager1_beta1" -version = "1.0.8+20181008" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1_beta1" homepage = "https://cloud.google.com/resource-manager" -documentation = "https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008" +documentation = "https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401" license = "MIT" keywords = ["cloudresourcemanager", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudresourcemanager1_beta1/README.md b/gen/cloudresourcemanager1_beta1/README.md index 9949f41c69..7b006871fa 100644 --- a/gen/cloudresourcemanager1_beta1/README.md +++ b/gen/cloudresourcemanager1_beta1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-cloudresourcemanager1_beta1` library allows access to all features of the *Google Cloud Resource Manager* service. -This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Resource Manager* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/resource-manager). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.CloudResourceManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.CloudResourceManager.html) ... -* [organizations](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.Organization.html) - * [*get*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.OrganizationGetCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.OrganizationGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.OrganizationListCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.OrganizationSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.OrganizationTestIamPermissionCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.OrganizationUpdateCall.html) -* [projects](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.Project.html) - * [*create*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.ProjectCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.ProjectDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.ProjectGetCall.html), [*get ancestry*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.ProjectGetAncestryCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.ProjectGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.ProjectListCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.ProjectSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.ProjectTestIamPermissionCall.html), [*undelete*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.ProjectUndeleteCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.ProjectUpdateCall.html) +* [organizations](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.Organization.html) + * [*get*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.OrganizationGetCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.OrganizationGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.OrganizationListCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.OrganizationSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.OrganizationTestIamPermissionCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.OrganizationUpdateCall.html) +* [projects](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.Project.html) + * [*create*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.ProjectCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.ProjectDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.ProjectGetCall.html), [*get ancestry*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.ProjectGetAncestryCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.ProjectGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.ProjectListCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.ProjectSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.ProjectTestIamPermissionCall.html), [*undelete*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.ProjectUndeleteCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.ProjectUpdateCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/struct.CloudResourceManager.html)** +* **[Hub](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/struct.CloudResourceManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -138,17 +138,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -158,29 +158,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20181008/google_cloudresourcemanager1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.8+20190401/google_cloudresourcemanager1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudresourcemanager1_beta1/src/lib.rs b/gen/cloudresourcemanager1_beta1/src/lib.rs index 8fae2f6d5c..9c20bc18d7 100644 --- a/gen/cloudresourcemanager1_beta1/src/lib.rs +++ b/gen/cloudresourcemanager1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Resource Manager* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/resource-manager). @@ -496,10 +496,9 @@ impl RequestValue for SetIamPolicyRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// @@ -509,99 +508,38 @@ pub struct Expr { /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} -/// A Project is a high-level Google Cloud Platform entity. It is a -/// container for ACLs, APIs, App Engine Apps, VMs, and other -/// Google Cloud Platform resources. +/// The response returned from the `ListOrganizations` method. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [test iam permissions projects](struct.ProjectTestIamPermissionCall.html) (none) -/// * [undelete projects](struct.ProjectUndeleteCall.html) (none) -/// * [set iam policy projects](struct.ProjectSetIamPolicyCall.html) (none) -/// * [get projects](struct.ProjectGetCall.html) (response) -/// * [get ancestry projects](struct.ProjectGetAncestryCall.html) (none) -/// * [update projects](struct.ProjectUpdateCall.html) (request|response) -/// * [get iam policy projects](struct.ProjectGetIamPolicyCall.html) (none) -/// * [delete projects](struct.ProjectDeleteCall.html) (none) -/// * [create projects](struct.ProjectCreateCall.html) (request|response) -/// * [list projects](struct.ProjectListCall.html) (none) +/// * [list organizations](struct.OrganizationListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Project { - /// The user-assigned display name of the Project. - /// It must be 4 to 30 characters. - /// Allowed characters are: lowercase and uppercase letters, numbers, - /// hyphen, single-quote, double-quote, space, and exclamation point. - /// - /// Example: My Project - /// Read-write. - pub name: Option, - /// An optional reference to a parent Resource. - /// - /// Supported parent types include "organization" and "folder". Once set, the - /// parent cannot be cleared. The `parent` can be set on creation or using the - /// `UpdateProject` method; the end user must have the - /// `resourcemanager.projects.create` permission on the parent. - /// - /// Read-write. - pub parent: Option, - /// The unique, user-assigned ID of the Project. - /// It must be 6 to 30 lowercase letters, digits, or hyphens. - /// It must start with a letter. - /// Trailing hyphens are prohibited. - /// - /// Example: tokyo-rain-123 - /// Read-only after creation. - #[serde(rename="projectId")] - pub project_id: Option, - /// The labels associated with this Project. - /// - /// Label keys must be between 1 and 63 characters long and must conform - /// to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. - /// - /// Label values must be between 0 and 63 characters long and must conform - /// to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. - /// - /// No more than 256 labels can be associated with a given resource. - /// - /// Clients should store labels in a representation such as JSON that does not - /// depend on specific characters being disallowed. - /// - /// Example: "environment" : "dev" - /// Read-write. - pub labels: Option>, - /// Creation time. - /// - /// Read-only. - #[serde(rename="createTime")] - pub create_time: Option, - /// The number uniquely identifying the project. - /// - /// Example: 415104041262 - /// Read-only. - #[serde(rename="projectNumber")] - pub project_number: Option, - /// The Project lifecycle state. - /// - /// Read-only. - #[serde(rename="lifecycleState")] - pub lifecycle_state: Option, +pub struct ListOrganizationsResponse { + /// A pagination token to be used to retrieve the next page of results. If the + /// result is too large to fit within the page size specified in the request, + /// this field will be set with a token that can be used to fetch the next page + /// of results. If this field is empty, it indicates that this response + /// contains the last page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of Organizations that matched the list query, possibly paginated. + pub organizations: Option>, } -impl RequestValue for Project {} -impl Resource for Project {} -impl ResponseResult for Project {} +impl ResponseResult for ListOrganizationsResponse {} /// The request sent to the @@ -679,9 +617,9 @@ impl RequestValue for GetAncestryRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// Associates a list of `members` to a `role`. - /// `bindings` with no members will result in an error. - pub bindings: Option>, + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, /// `etag` is used for optimistic concurrency control as a way to help /// prevent simultaneous updates of a policy from overwriting each other. /// It is strongly suggested that systems make use of the `etag` in the @@ -693,9 +631,9 @@ pub struct Policy { /// If no `etag` is provided in the call to `setIamPolicy`, then the existing /// policy is overwritten blindly. pub etag: Option, - /// Specifies cloud audit logging configuration for this policy. - #[serde(rename="auditConfigs")] - pub audit_configs: Option>, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, /// Deprecated. pub version: Option, } @@ -809,29 +747,92 @@ pub struct UndeleteProjectRequest { _never_set: Option } impl RequestValue for UndeleteProjectRequest {} -/// The response returned from the `ListOrganizations` method. +/// A Project is a high-level Google Cloud Platform entity. It is a +/// container for ACLs, APIs, App Engine Apps, VMs, and other +/// Google Cloud Platform resources. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list organizations](struct.OrganizationListCall.html) (response) +/// * [test iam permissions projects](struct.ProjectTestIamPermissionCall.html) (none) +/// * [undelete projects](struct.ProjectUndeleteCall.html) (none) +/// * [set iam policy projects](struct.ProjectSetIamPolicyCall.html) (none) +/// * [get projects](struct.ProjectGetCall.html) (response) +/// * [get ancestry projects](struct.ProjectGetAncestryCall.html) (none) +/// * [update projects](struct.ProjectUpdateCall.html) (request|response) +/// * [get iam policy projects](struct.ProjectGetIamPolicyCall.html) (none) +/// * [delete projects](struct.ProjectDeleteCall.html) (none) +/// * [create projects](struct.ProjectCreateCall.html) (request|response) +/// * [list projects](struct.ProjectListCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListOrganizationsResponse { - /// A pagination token to be used to retrieve the next page of results. If the - /// result is too large to fit within the page size specified in the request, - /// this field will be set with a token that can be used to fetch the next page - /// of results. If this field is empty, it indicates that this response - /// contains the last page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of Organizations that matched the list query, possibly paginated. - pub organizations: Option>, +pub struct Project { + /// The optional user-assigned display name of the Project. + /// When present it must be between 4 to 30 characters. + /// Allowed characters are: lowercase and uppercase letters, numbers, + /// hyphen, single-quote, double-quote, space, and exclamation point. + /// + /// Example: My Project + /// Read-write. + pub name: Option, + /// An optional reference to a parent Resource. + /// + /// Supported parent types include "organization" and "folder". Once set, the + /// parent cannot be cleared. The `parent` can be set on creation or using the + /// `UpdateProject` method; the end user must have the + /// `resourcemanager.projects.create` permission on the parent. + /// + /// Read-write. + pub parent: Option, + /// The unique, user-assigned ID of the Project. + /// It must be 6 to 30 lowercase letters, digits, or hyphens. + /// It must start with a letter. + /// Trailing hyphens are prohibited. + /// + /// Example: tokyo-rain-123 + /// Read-only after creation. + #[serde(rename="projectId")] + pub project_id: Option, + /// The labels associated with this Project. + /// + /// Label keys must be between 1 and 63 characters long and must conform + /// to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + /// + /// Label values must be between 0 and 63 characters long and must conform + /// to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. A label + /// value can be empty. + /// + /// No more than 256 labels can be associated with a given resource. + /// + /// Clients should store labels in a representation such as JSON that does not + /// depend on specific characters being disallowed. + /// + /// Example: "environment" : "dev" + /// Read-write. + pub labels: Option>, + /// The number uniquely identifying the project. + /// + /// Example: 415104041262 + /// Read-only. + #[serde(rename="projectNumber")] + pub project_number: Option, + /// Creation time. + /// + /// Read-only. + #[serde(rename="createTime")] + pub create_time: Option, + /// The Project lifecycle state. + /// + /// Read-only. + #[serde(rename="lifecycleState")] + pub lifecycle_state: Option, } -impl ResponseResult for ListOrganizationsResponse {} +impl RequestValue for Project {} +impl Resource for Project {} +impl ResponseResult for Project {} /// Response message for `TestIamPermissions` method. @@ -922,7 +923,7 @@ pub struct Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, - /// Unimplemented. The condition that is associated with this binding. + /// The condition that is associated with this binding. /// NOTE: an unsatisfied condition will not allow user access via current /// binding. Different bindings, including their conditions, are examined /// independently. @@ -947,7 +948,7 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// @@ -1178,7 +1179,9 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The resource name of the Organization to fetch, e.g. "organizations/1234". + /// * `name` - The resource name of the Organization to fetch. This is the organization's + /// relative path in the API, formatted as "organizations/[organizationId]". + /// For example, "organizations/1234". pub fn get(&self, name: &str) -> OrganizationGetCall<'a, C, A> { OrganizationGetCall { hub: self.hub, @@ -1659,7 +1662,7 @@ impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1710,7 +1710,7 @@ impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1995,7 +1992,7 @@ impl<'a, C, A> OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2280,7 +2274,7 @@ impl<'a, C, A> OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2526,10 +2520,7 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2549,7 +2540,7 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2602,7 +2593,9 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, } - /// The resource name of the Organization to fetch, e.g. "organizations/1234". + /// The resource name of the Organization to fetch. This is the organization's + /// relative path in the API, formatted as "organizations/[organizationId]". + /// For example, "organizations/1234". /// /// Sets the *name* path property to the given value. /// @@ -2635,7 +2628,7 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2776,7 +2769,7 @@ impl<'a, C, A> OrganizationUpdateCall<'a, C, A> where C: BorrowMut OrganizationUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2827,7 +2817,7 @@ impl<'a, C, A> OrganizationUpdateCall<'a, C, A> where C: BorrowMut OrganizationUpdateCall<'a, C, A> where C: BorrowMut OrganizationListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3082,7 +3069,7 @@ impl<'a, C, A> OrganizationListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3186,7 +3173,7 @@ impl<'a, C, A> OrganizationListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3339,10 +3326,7 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3374,7 +3358,7 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectUndeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3659,7 +3640,7 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3751,7 +3732,7 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3900,10 +3881,7 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3935,7 +3913,7 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4022,7 +4000,7 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4213,10 +4191,7 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4248,7 +4223,7 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4511,7 +4483,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4591,7 +4563,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4747,10 +4719,7 @@ impl<'a, C, A> ProjectGetAncestryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4782,7 +4751,7 @@ impl<'a, C, A> ProjectGetAncestryCall<'a, C, A> where C: BorrowMut ProjectGetAncestryCall<'a, C, A> where C: BorrowMut ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5065,7 +5031,7 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5157,7 +5123,7 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5314,10 +5280,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5349,7 +5312,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5629,7 +5589,7 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5709,7 +5669,7 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5852,10 +5812,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5875,7 +5832,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5999,7 +5956,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/cloudresourcemanager2-cli/Cargo.toml b/gen/cloudresourcemanager2-cli/Cargo.toml index cebc9edbec..61a81326c8 100644 --- a/gen/cloudresourcemanager2-cli/Cargo.toml +++ b/gen/cloudresourcemanager2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudresourcemanager2-cli" -version = "1.0.8+20181008" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudresourcemanager2] path = "../cloudresourcemanager2" -version = "1.0.8+20181008" +version = "1.0.8+20190401" diff --git a/gen/cloudresourcemanager2-cli/README.md b/gen/cloudresourcemanager2-cli/README.md index 586bbd9def..e0c8c1e253 100644 --- a/gen/cloudresourcemanager2-cli/README.md +++ b/gen/cloudresourcemanager2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Resource Manager* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Resource Manager* API at revision *20190401*. The CLI is at version *1.0.8*. ```bash cloudresourcemanager2 [options] diff --git a/gen/cloudresourcemanager2-cli/mkdocs.yml b/gen/cloudresourcemanager2-cli/mkdocs.yml index c574404469..85017eee15 100644 --- a/gen/cloudresourcemanager2-cli/mkdocs.yml +++ b/gen/cloudresourcemanager2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Resource Manager v1.0.8+20181008 +site_name: Cloud Resource Manager v1.0.8+20190401 site_url: http://byron.github.io/google-apis-rs/google-cloudresourcemanager2-cli site_description: A complete library to interact with Cloud Resource Manager (protocol v2) diff --git a/gen/cloudresourcemanager2-cli/src/main.rs b/gen/cloudresourcemanager2-cli/src/main.rs index f7ad0f4120..62b912db77 100644 --- a/gen/cloudresourcemanager2-cli/src/main.rs +++ b/gen/cloudresourcemanager2-cli/src/main.rs @@ -71,9 +71,9 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "display-name", "lifecycle-state", "name", "parent"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -502,9 +502,9 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "display-name", "lifecycle-state", "name", "parent"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1279,7 +1279,7 @@ fn main() { be returned - if the failure occurs synchronously then the FolderOperationError will be returned via the Status.details field and if it occurs asynchronously then the FolderOperation will be returned - via the the Operation.error field. + via the Operation.error field. In addition, the Operation.metadata field will be populated with a FolderOperation message as an aid to stateless clients. Folder moves will be rejected if they violate either the naming, height @@ -1521,8 +1521,8 @@ fn main() { let mut app = App::new("cloudresourcemanager2") .author("Sebastian Thiel ") - .version("1.0.8+20181008") - .about("The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.") + .version("1.0.8+20190401") + .about("Creates, reads, and updates metadata for Google Cloud Platform resource containers.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudresourcemanager2_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/cloudresourcemanager2/Cargo.toml b/gen/cloudresourcemanager2/Cargo.toml index 6c4a603974..6c744e0761 100644 --- a/gen/cloudresourcemanager2/Cargo.toml +++ b/gen/cloudresourcemanager2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudresourcemanager2" -version = "1.0.8+20181008" +version = "1.0.8+20190401" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager2" homepage = "https://cloud.google.com/resource-manager" -documentation = "https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008" +documentation = "https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401" license = "MIT" keywords = ["cloudresourcemanager", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudresourcemanager2/README.md b/gen/cloudresourcemanager2/README.md index e1f8e22b11..874064d92c 100644 --- a/gen/cloudresourcemanager2/README.md +++ b/gen/cloudresourcemanager2/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-cloudresourcemanager2` library allows access to all features of the *Google Cloud Resource Manager* service. -This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *cloudresourcemanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *cloudresourcemanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Resource Manager* *v2* API can be found at the [official documentation site](https://cloud.google.com/resource-manager). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.CloudResourceManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.CloudResourceManager.html) ... -* [folders](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.Folder.html) - * [*create*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderGetCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderListCall.html), [*move*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderMoveCall.html), [*patch*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderPatchCall.html), [*search*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderSearchCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderTestIamPermissionCall.html) and [*undelete*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.FolderUndeleteCall.html) -* [operations](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.Operation.html) - * [*get*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.OperationGetCall.html) +* [folders](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.Folder.html) + * [*create*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderGetCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderListCall.html), [*move*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderMoveCall.html), [*patch*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderPatchCall.html), [*search*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderSearchCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderTestIamPermissionCall.html) and [*undelete*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.FolderUndeleteCall.html) +* [operations](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.Operation.html) + * [*get*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.OperationGetCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/struct.CloudResourceManager.html)** +* **[Hub](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/struct.CloudResourceManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -140,17 +140,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -160,29 +160,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudresourcemanager2/1.0.8+20181008/google_cloudresourcemanager2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudresourcemanager2/1.0.8+20190401/google_cloudresourcemanager2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudresourcemanager2/src/lib.rs b/gen/cloudresourcemanager2/src/lib.rs index c7e8b4ab50..d748470e20 100644 --- a/gen/cloudresourcemanager2/src/lib.rs +++ b/gen/cloudresourcemanager2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *cloudresourcemanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *cloudresourcemanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Resource Manager* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/resource-manager). @@ -496,8 +496,9 @@ pub struct SearchFoldersRequest { /// |displayName=Test* | Folders whose display name starts with "Test".| /// |lifecycleState=ACTIVE | Folders whose lifecycleState is ACTIVE.| /// |parent=folders/123 | Folders whose parent is "folders/123".| - /// |parent=folders/123 AND lifecycleState=ACTIVE | Active folders whose parent is "folders/123".| - /// |displayName=\\"Test String\\"|Folders whose display name includes both "Test" and "String".| + /// |parent=folders/123 AND lifecycleState=ACTIVE | Active folders whose parent + /// is "folders/123".| |displayName=\\"Test String\\"|Folders whose display + /// name includes both "Test" and "String".| pub query: Option, } @@ -542,10 +543,9 @@ impl RequestValue for SetIamPolicyRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// @@ -555,9 +555,10 @@ pub struct Expr { /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} @@ -574,14 +575,14 @@ impl Part for Expr {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SearchFoldersResponse { + /// A possibly paginated folder search results. + /// the specified parent resource. + pub folders: Option>, /// A pagination token returned from a previous call to `SearchFolders` /// that indicates from where searching should continue. /// This field is optional. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// A possibly paginated folder search results. - /// the specified parent resource. - pub folders: Option>, } impl ResponseResult for SearchFoldersResponse {} @@ -664,9 +665,9 @@ impl RequestValue for MoveFolderRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// Associates a list of `members` to a `role`. - /// `bindings` with no members will result in an error. - pub bindings: Option>, + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, /// `etag` is used for optimistic concurrency control as a way to help /// prevent simultaneous updates of a policy from overwriting each other. /// It is strongly suggested that systems make use of the `etag` in the @@ -678,9 +679,9 @@ pub struct Policy { /// If no `etag` is provided in the call to `setIamPolicy`, then the existing /// policy is overwritten blindly. pub etag: Option, - /// Specifies cloud audit logging configuration for this policy. - #[serde(rename="auditConfigs")] - pub audit_configs: Option>, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, /// Deprecated. pub version: Option, } @@ -710,9 +711,9 @@ impl ResponseResult for Policy {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Folder { - /// Output only. The resource name of the Folder. - /// Its format is `folders/{folder_id}`, for example: "folders/1234". - pub name: Option, + /// Output only. Timestamp when the Folder was created. Assigned by the server. + #[serde(rename="createTime")] + pub create_time: Option, /// The folder’s display name. /// A folder’s display name must be unique amongst its siblings, e.g. /// no two folders with the same parent can share the same display name. @@ -722,9 +723,9 @@ pub struct Folder { /// [\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?. #[serde(rename="displayName")] pub display_name: Option, - /// Output only. Timestamp when the Folder was created. Assigned by the server. - #[serde(rename="createTime")] - pub create_time: Option, + /// Output only. The resource name of the Folder. + /// Its format is `folders/{folder_id}`, for example: "folders/1234". + pub name: Option, /// The Folder’s parent's resource name. /// Updates to the folder's parent must be performed via /// MoveFolder. @@ -742,32 +743,61 @@ impl Resource for Folder {} impl ResponseResult for Folder {} -/// The UndeleteFolder request message. +/// This resource represents a long-running operation that is the result of a +/// network API call. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [undelete folders](struct.FolderUndeleteCall.html) (request) +/// * [move folders](struct.FolderMoveCall.html) (response) +/// * [get operations](struct.OperationGetCall.html) (response) +/// * [create folders](struct.FolderCreateCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UndeleteFolderRequest { _never_set: Option } +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} -impl RequestValue for UndeleteFolderRequest {} +impl Resource for Operation {} +impl ResponseResult for Operation {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -839,14 +869,14 @@ impl Part for Status {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListFoldersResponse { + /// A possibly paginated list of Folders that are direct descendants of + /// the specified parent resource. + pub folders: Option>, /// A pagination token returned from a previous call to `ListFolders` /// that indicates from where listing should continue. /// This field is optional. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// A possibly paginated list of Folders that are direct descendants of - /// the specified parent resource. - pub folders: Option>, } impl ResponseResult for ListFoldersResponse {} @@ -880,6 +910,11 @@ pub struct Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, /// Specifies the identities requesting access for a Cloud Platform resource. /// `members` can have the following values: /// @@ -900,16 +935,11 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// pub members: Option>, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, } impl Part for Binding {} @@ -983,48 +1013,19 @@ pub struct AuditConfig { impl Part for AuditConfig {} -/// This resource represents a long-running operation that is the result of a -/// network API call. +/// The UndeleteFolder request message. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [move folders](struct.FolderMoveCall.html) (response) -/// * [get operations](struct.OperationGetCall.html) (response) -/// * [create folders](struct.FolderCreateCall.html) (response) +/// * [undelete folders](struct.FolderUndeleteCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// The error result of the operation in case of failure or cancellation. - pub error: Option, - /// If the value is `false`, it means the operation is still in progress. - /// If `true`, the operation is completed, and either `error` or `response` is - /// available. - pub done: Option, - /// The normal response of the operation in case of success. If the original - /// method returns no data on success, such as `Delete`, the response is - /// `google.protobuf.Empty`. If the original method is standard - /// `Get`/`Create`/`Update`, the response should be the resource. For other - /// methods, the response should have the type `XxxResponse`, where `Xxx` - /// is the original method name. For example, if the original method name - /// is `TakeSnapshot()`, the inferred response type is - /// `TakeSnapshotResponse`. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that - /// originally returns it. If you use the default HTTP mapping, the - /// `name` should have the format of `operations/some/unique/name`. - pub name: Option, - /// Service-specific metadata associated with the operation. It typically - /// contains progress information and common metadata such as create time. - /// Some services might not provide such metadata. Any method that returns a - /// long-running operation should document the metadata type, if any. - pub metadata: Option>, -} +pub struct UndeleteFolderRequest { _never_set: Option } -impl Resource for Operation {} -impl ResponseResult for Operation {} +impl RequestValue for UndeleteFolderRequest {} @@ -1328,7 +1329,7 @@ impl<'a, C, A> FolderMethods<'a, C, A> { /// be returned - if the failure occurs synchronously then the /// FolderOperationError will be returned via the Status.details field /// and if it occurs asynchronously then the FolderOperation will be returned - /// via the the Operation.error field. + /// via the Operation.error field. /// In addition, the Operation.metadata field will be populated with a /// FolderOperation message as an aid to stateless clients. /// Folder moves will be rejected if they violate either the naming, height @@ -1561,7 +1562,7 @@ impl<'a, C, A> FolderPatchCall<'a, C, A> where C: BorrowMut, A: o } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1577,10 +1578,7 @@ impl<'a, C, A> FolderPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1612,7 +1610,7 @@ impl<'a, C, A> FolderPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1711,7 +1709,7 @@ impl<'a, C, A> FolderPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1860,10 +1858,7 @@ impl<'a, C, A> FolderListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1883,7 +1878,7 @@ impl<'a, C, A> FolderListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1988,7 +1983,7 @@ impl<'a, C, A> FolderListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2133,7 +2128,7 @@ impl<'a, C, A> FolderGetIamPolicyCall<'a, C, A> where C: BorrowMut FolderGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2184,7 +2176,7 @@ impl<'a, C, A> FolderGetIamPolicyCall<'a, C, A> where C: BorrowMut FolderGetIamPolicyCall<'a, C, A> where C: BorrowMut FolderGetCall<'a, C, A> where C: BorrowMut, A: oau } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2429,10 +2421,7 @@ impl<'a, C, A> FolderGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2452,7 +2441,7 @@ impl<'a, C, A> FolderGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2531,7 +2520,7 @@ impl<'a, C, A> FolderGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2666,10 +2655,7 @@ impl<'a, C, A> FolderSearchCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2701,7 +2687,7 @@ impl<'a, C, A> FolderSearchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2781,7 +2767,7 @@ impl<'a, C, A> FolderSearchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2926,7 +2912,7 @@ impl<'a, C, A> FolderTestIamPermissionCall<'a, C, A> where C: BorrowMut FolderTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2977,7 +2960,7 @@ impl<'a, C, A> FolderTestIamPermissionCall<'a, C, A> where C: BorrowMut FolderTestIamPermissionCall<'a, C, A> where C: BorrowMut FolderUndeleteCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3234,10 +3217,7 @@ impl<'a, C, A> FolderUndeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3269,7 +3249,7 @@ impl<'a, C, A> FolderUndeleteCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3360,7 +3340,7 @@ impl<'a, C, A> FolderUndeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3521,10 +3501,7 @@ impl<'a, C, A> FolderCreateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3556,7 +3533,7 @@ impl<'a, C, A> FolderCreateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3644,7 +3621,7 @@ impl<'a, C, A> FolderCreateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3789,7 +3766,7 @@ impl<'a, C, A> FolderSetIamPolicyCall<'a, C, A> where C: BorrowMut FolderSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3840,7 +3814,7 @@ impl<'a, C, A> FolderSetIamPolicyCall<'a, C, A> where C: BorrowMut FolderSetIamPolicyCall<'a, C, A> where C: BorrowMut FolderSetIamPolicyCall<'a, C, A> where C: BorrowMut FolderMoveCall<'a, C, A> where C: BorrowMut, A: oa } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4104,10 +4078,7 @@ impl<'a, C, A> FolderMoveCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4139,7 +4110,7 @@ impl<'a, C, A> FolderMoveCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4230,7 +4201,7 @@ impl<'a, C, A> FolderMoveCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4372,7 +4343,7 @@ impl<'a, C, A> FolderDeleteCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4388,10 +4359,7 @@ impl<'a, C, A> FolderDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4411,7 +4379,7 @@ impl<'a, C, A> FolderDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4490,7 +4458,7 @@ impl<'a, C, A> FolderDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4626,7 +4594,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4642,10 +4610,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4665,7 +4630,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4743,7 +4708,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/cloudscheduler1_beta1-cli/Cargo.toml b/gen/cloudscheduler1_beta1-cli/Cargo.toml new file mode 100644 index 0000000000..2e645c94e9 --- /dev/null +++ b/gen/cloudscheduler1_beta1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-cloudscheduler1_beta1-cli" +version = "1.0.8+20190326" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Scheduler (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudscheduler1_beta1-cli" +homepage = "https://cloud.google.com/scheduler/" +documentation = "http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli" +license = "MIT" +keywords = ["cloudscheduler", "google", "cli"] +autobins = false + +[[bin]] +name = "cloudscheduler1-beta1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-cloudscheduler1_beta1] +path = "../cloudscheduler1_beta1" +version = "1.0.8+20190326" diff --git a/gen/cloudscheduler1_beta1-cli/LICENSE.md b/gen/cloudscheduler1_beta1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudscheduler1_beta1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudscheduler1_beta1-cli/README.md b/gen/cloudscheduler1_beta1-cli/README.md new file mode 100644 index 0000000000..2a20464806 --- /dev/null +++ b/gen/cloudscheduler1_beta1-cli/README.md @@ -0,0 +1,123 @@ + +The `cloudscheduler1-beta1` command-line interface *(CLI)* allows to use most features of the *Google Cloud Scheduler* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud Scheduler* API can be found at the +[official documentation site](https://cloud.google.com/scheduler/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-cloudscheduler1_beta1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudscheduler1_beta1-cli). + +# Usage + +This documentation was generated from the *Cloud Scheduler* API at revision *20190326*. The CLI is at version *1.0.8*. + +```bash +cloudscheduler1-beta1 [options] + projects + locations-get [-p ]... [-o ] + locations-jobs-create (-r )... [-p ]... [-o ] + locations-jobs-delete [-p ]... [-o ] + locations-jobs-get [-p ]... [-o ] + locations-jobs-list [-p ]... [-o ] + locations-jobs-patch (-r )... [-p ]... [-o ] + locations-jobs-pause (-r )... [-p ]... [-o ] + locations-jobs-resume (-r )... [-p ]... [-o ] + locations-jobs-run (-r )... [-p ]... [-o ] + locations-list [-p ]... [-o ] + cloudscheduler1-beta1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `cloudscheduler1-beta1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/cloudscheduler1-beta1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/cloudscheduler1-beta1-secret.json`, assuming that the required *cloudscheduler* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `cloudscheduler1-beta1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/cloudscheduler1_beta1-cli/mkdocs.yml b/gen/cloudscheduler1_beta1-cli/mkdocs.yml new file mode 100644 index 0000000000..8119dc0fda --- /dev/null +++ b/gen/cloudscheduler1_beta1-cli/mkdocs.yml @@ -0,0 +1,26 @@ +site_name: Cloud Scheduler v1.0.8+20190326 +site_url: http://byron.github.io/google-apis-rs/google-cloudscheduler1_beta1-cli +site_description: A complete library to interact with Cloud Scheduler (protocol v1beta1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/cloudscheduler1_beta1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['projects_locations-get.md', 'Projects', 'Locations Get'] +- ['projects_locations-jobs-create.md', 'Projects', 'Locations Jobs Create'] +- ['projects_locations-jobs-delete.md', 'Projects', 'Locations Jobs Delete'] +- ['projects_locations-jobs-get.md', 'Projects', 'Locations Jobs Get'] +- ['projects_locations-jobs-list.md', 'Projects', 'Locations Jobs List'] +- ['projects_locations-jobs-patch.md', 'Projects', 'Locations Jobs Patch'] +- ['projects_locations-jobs-pause.md', 'Projects', 'Locations Jobs Pause'] +- ['projects_locations-jobs-resume.md', 'Projects', 'Locations Jobs Resume'] +- ['projects_locations-jobs-run.md', 'Projects', 'Locations Jobs Run'] +- ['projects_locations-list.md', 'Projects', 'Locations List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/cloudscheduler1_beta1-cli/src/cmn.rs b/gen/cloudscheduler1_beta1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/cloudscheduler1_beta1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/cloudscheduler1_beta1-cli/src/main.rs b/gen/cloudscheduler1_beta1-cli/src/main.rs new file mode 100644 index 0000000000..745e833d21 --- /dev/null +++ b/gen/cloudscheduler1_beta1-cli/src/main.rs @@ -0,0 +1,1357 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_cloudscheduler1_beta1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudScheduler>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _projects_locations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_jobs_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status.message" => Some(("status.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status.code" => Some(("status.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "user-update-time" => Some(("userUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule" => Some(("schedule", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule-time" => Some(("scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.body" => Some(("httpTarget.body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.http-method" => Some(("httpTarget.httpMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.oidc-token.audience" => Some(("httpTarget.oidcToken.audience", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.oidc-token.service-account-email" => Some(("httpTarget.oidcToken.serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.uri" => Some(("httpTarget.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.oauth-token.scope" => Some(("httpTarget.oauthToken.scope", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.oauth-token.service-account-email" => Some(("httpTarget.oauthToken.serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.headers" => Some(("httpTarget.headers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "app-engine-http-target.body" => Some(("appEngineHttpTarget.body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.headers" => Some(("appEngineHttpTarget.headers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "app-engine-http-target.app-engine-routing.instance" => Some(("appEngineHttpTarget.appEngineRouting.instance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.app-engine-routing.host" => Some(("appEngineHttpTarget.appEngineRouting.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.app-engine-routing.version" => Some(("appEngineHttpTarget.appEngineRouting.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.app-engine-routing.service" => Some(("appEngineHttpTarget.appEngineRouting.service", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.relative-uri" => Some(("appEngineHttpTarget.relativeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.http-method" => Some(("appEngineHttpTarget.httpMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-attempt-time" => Some(("lastAttemptTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pubsub-target.attributes" => Some(("pubsubTarget.attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "pubsub-target.data" => Some(("pubsubTarget.data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pubsub-target.topic-name" => Some(("pubsubTarget.topicName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "time-zone" => Some(("timeZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.max-backoff-duration" => Some(("retryConfig.maxBackoffDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.retry-count" => Some(("retryConfig.retryCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "retry-config.max-doublings" => Some(("retryConfig.maxDoublings", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "retry-config.max-retry-duration" => Some(("retryConfig.maxRetryDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.min-backoff-duration" => Some(("retryConfig.minBackoffDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attempt-deadline" => Some(("attemptDeadline", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["app-engine-http-target", "app-engine-routing", "attempt-deadline", "attributes", "audience", "body", "code", "data", "description", "headers", "host", "http-method", "http-target", "instance", "last-attempt-time", "max-backoff-duration", "max-doublings", "max-retry-duration", "message", "min-backoff-duration", "name", "oauth-token", "oidc-token", "pubsub-target", "relative-uri", "retry-config", "retry-count", "schedule", "schedule-time", "scope", "service", "service-account-email", "state", "status", "time-zone", "topic-name", "uri", "user-update-time", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Job = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_jobs_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_jobs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_jobs_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_jobs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_jobs_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_jobs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_jobs_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_jobs_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status.message" => Some(("status.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status.code" => Some(("status.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "user-update-time" => Some(("userUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule" => Some(("schedule", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule-time" => Some(("scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.body" => Some(("httpTarget.body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.http-method" => Some(("httpTarget.httpMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.oidc-token.audience" => Some(("httpTarget.oidcToken.audience", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.oidc-token.service-account-email" => Some(("httpTarget.oidcToken.serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.uri" => Some(("httpTarget.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.oauth-token.scope" => Some(("httpTarget.oauthToken.scope", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.oauth-token.service-account-email" => Some(("httpTarget.oauthToken.serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-target.headers" => Some(("httpTarget.headers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "app-engine-http-target.body" => Some(("appEngineHttpTarget.body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.headers" => Some(("appEngineHttpTarget.headers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "app-engine-http-target.app-engine-routing.instance" => Some(("appEngineHttpTarget.appEngineRouting.instance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.app-engine-routing.host" => Some(("appEngineHttpTarget.appEngineRouting.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.app-engine-routing.version" => Some(("appEngineHttpTarget.appEngineRouting.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.app-engine-routing.service" => Some(("appEngineHttpTarget.appEngineRouting.service", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.relative-uri" => Some(("appEngineHttpTarget.relativeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-http-target.http-method" => Some(("appEngineHttpTarget.httpMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-attempt-time" => Some(("lastAttemptTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pubsub-target.attributes" => Some(("pubsubTarget.attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "pubsub-target.data" => Some(("pubsubTarget.data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pubsub-target.topic-name" => Some(("pubsubTarget.topicName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "time-zone" => Some(("timeZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.max-backoff-duration" => Some(("retryConfig.maxBackoffDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.retry-count" => Some(("retryConfig.retryCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "retry-config.max-doublings" => Some(("retryConfig.maxDoublings", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "retry-config.max-retry-duration" => Some(("retryConfig.maxRetryDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.min-backoff-duration" => Some(("retryConfig.minBackoffDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attempt-deadline" => Some(("attemptDeadline", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["app-engine-http-target", "app-engine-routing", "attempt-deadline", "attributes", "audience", "body", "code", "data", "description", "headers", "host", "http-method", "http-target", "instance", "last-attempt-time", "max-backoff-duration", "max-doublings", "max-retry-duration", "message", "min-backoff-duration", "name", "oauth-token", "oidc-token", "pubsub-target", "relative-uri", "retry-config", "retry-count", "schedule", "schedule-time", "scope", "service", "service-account-email", "state", "status", "time-zone", "topic-name", "uri", "user-update-time", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Job = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_jobs_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_jobs_pause(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PauseJobRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_jobs_pause(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_jobs_resume(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ResumeJobRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_jobs_resume(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_jobs_run(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RunJobRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_jobs_run(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("projects", Some(opt)) => { + match opt.subcommand() { + ("locations-get", Some(opt)) => { + call_result = self._projects_locations_get(opt, dry_run, &mut err); + }, + ("locations-jobs-create", Some(opt)) => { + call_result = self._projects_locations_jobs_create(opt, dry_run, &mut err); + }, + ("locations-jobs-delete", Some(opt)) => { + call_result = self._projects_locations_jobs_delete(opt, dry_run, &mut err); + }, + ("locations-jobs-get", Some(opt)) => { + call_result = self._projects_locations_jobs_get(opt, dry_run, &mut err); + }, + ("locations-jobs-list", Some(opt)) => { + call_result = self._projects_locations_jobs_list(opt, dry_run, &mut err); + }, + ("locations-jobs-patch", Some(opt)) => { + call_result = self._projects_locations_jobs_patch(opt, dry_run, &mut err); + }, + ("locations-jobs-pause", Some(opt)) => { + call_result = self._projects_locations_jobs_pause(opt, dry_run, &mut err); + }, + ("locations-jobs-resume", Some(opt)) => { + call_result = self._projects_locations_jobs_resume(opt, dry_run, &mut err); + }, + ("locations-jobs-run", Some(opt)) => { + call_result = self._projects_locations_jobs_run(opt, dry_run, &mut err); + }, + ("locations-list", Some(opt)) => { + call_result = self._projects_locations_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "cloudscheduler1-beta1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "cloudscheduler1-beta1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::CloudScheduler::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("projects", "methods: 'locations-get', 'locations-jobs-create', 'locations-jobs-delete', 'locations-jobs-get', 'locations-jobs-list', 'locations-jobs-patch', 'locations-jobs-pause', 'locations-jobs-resume', 'locations-jobs-run' and 'locations-list'", vec![ + ("locations-get", + Some(r##"Gets information about a location."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli/projects_locations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name for the location."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-jobs-create", + Some(r##"Creates a job."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli/projects_locations-jobs-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. + + The location name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-jobs-delete", + Some(r##"Deletes a job."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli/projects_locations-jobs-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The job name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-jobs-get", + Some(r##"Gets a job."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli/projects_locations-jobs-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The job name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-jobs-list", + Some(r##"Lists jobs."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli/projects_locations-jobs-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. + + The location name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-jobs-patch", + Some(r##"Updates a job. + + If successful, the updated Job is returned. If the job does + not exist, `NOT_FOUND` is returned. + + If UpdateJob does not successfully return, it is possible for the + job to be in an Job.State.UPDATE_FAILED state. A job in this state may + not be executed. If this happens, retry the UpdateJob request + until a successful response is received."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli/projects_locations-jobs-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Optionally caller-specified in CreateJob, after + which it becomes output only. + + The job name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + + * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + hyphens (-), colons (:), or periods (.). + For more information, see + [Identifying + projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + * `LOCATION_ID` is the canonical ID for the job's location. + The list of available locations can be obtained by calling + ListLocations. + For more information, see https://cloud.google.com/about/locations/. + * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), + hyphens (-), or underscores (_). The maximum length is 500 characters."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-jobs-pause", + Some(r##"Pauses a job. + + If a job is paused then the system will stop executing the job + until it is re-enabled via ResumeJob. The + state of the job is stored in state; if paused it + will be set to Job.State.PAUSED. A job must be in Job.State.ENABLED + to be paused."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli/projects_locations-jobs-pause", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The job name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-jobs-resume", + Some(r##"Resume a job. + + This method reenables a job after it has been Job.State.PAUSED. The + state of a job is stored in Job.state; after calling this method it + will be set to Job.State.ENABLED. A job must be in + Job.State.PAUSED to be resumed."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli/projects_locations-jobs-resume", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The job name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-jobs-run", + Some(r##"Forces a job to run now. + + When this method is called, Cloud Scheduler will dispatch the job, even + if the job is already running."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli/projects_locations-jobs-run", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The job name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-list", + Some(r##"Lists information about the supported locations for this service."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli/projects_locations-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource that owns the locations collection, if applicable."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("cloudscheduler1-beta1") + .author("Sebastian Thiel ") + .version("1.0.8+20190326") + .about("Creates and manages jobs run on a regular recurring schedule.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudscheduler1_beta1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/cloudscheduler1_beta1/Cargo.toml b/gen/cloudscheduler1_beta1/Cargo.toml new file mode 100644 index 0000000000..4fc92f6a0c --- /dev/null +++ b/gen/cloudscheduler1_beta1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-cloudscheduler1_beta1" +version = "1.0.8+20190326" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Scheduler (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudscheduler1_beta1" +homepage = "https://cloud.google.com/scheduler/" +documentation = "https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326" +license = "MIT" +keywords = ["cloudscheduler", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/cloudscheduler1_beta1/LICENSE.md b/gen/cloudscheduler1_beta1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudscheduler1_beta1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudscheduler1_beta1/README.md b/gen/cloudscheduler1_beta1/README.md new file mode 100644 index 0000000000..1cad120eaf --- /dev/null +++ b/gen/cloudscheduler1_beta1/README.md @@ -0,0 +1,194 @@ + +The `google-cloudscheduler1_beta1` library allows access to all features of the *Google Cloud Scheduler* service. + +This documentation was generated from *Cloud Scheduler* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudscheduler:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Cloud Scheduler* *v1_beta1* API can be found at the +[official documentation site](https://cloud.google.com/scheduler/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.CloudScheduler.html) ... + +* projects + * [*locations get*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.ProjectLocationGetCall.html), [*locations jobs create*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.ProjectLocationJobCreateCall.html), [*locations jobs delete*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.ProjectLocationJobDeleteCall.html), [*locations jobs get*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.ProjectLocationJobGetCall.html), [*locations jobs list*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.ProjectLocationJobListCall.html), [*locations jobs patch*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.ProjectLocationJobPatchCall.html), [*locations jobs pause*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.ProjectLocationJobPauseCall.html), [*locations jobs resume*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.ProjectLocationJobResumeCall.html), [*locations jobs run*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.ProjectLocationJobRunCall.html) and [*locations list*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.ProjectLocationListCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/struct.CloudScheduler.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.projects().locations_jobs_pause(...).doit() +let r = hub.projects().locations_jobs_get(...).doit() +let r = hub.projects().locations_jobs_create(...).doit() +let r = hub.projects().locations_jobs_resume(...).doit() +let r = hub.projects().locations_jobs_run(...).doit() +let r = hub.projects().locations_jobs_patch(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-cloudscheduler1_beta1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +use cloudscheduler1_beta1::Job; +use cloudscheduler1_beta1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use cloudscheduler1_beta1::CloudScheduler; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = Job::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.projects().locations_jobs_patch(req, "name") + .update_mask("sit") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-cloudscheduler1_beta1/1.0.8+20190326/google_cloudscheduler1_beta1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **cloudscheduler1_beta1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/cloudscheduler1_beta1/src/cmn.rs b/gen/cloudscheduler1_beta1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/cloudscheduler1_beta1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/cloudscheduler1_beta1/src/lib.rs b/gen/cloudscheduler1_beta1/src/lib.rs new file mode 100644 index 0000000000..59842936b6 --- /dev/null +++ b/gen/cloudscheduler1_beta1/src/lib.rs @@ -0,0 +1,4188 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud Scheduler* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudscheduler:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Cloud Scheduler* *v1_beta1* API can be found at the +//! [official documentation site](https://cloud.google.com/scheduler/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudscheduler1_beta1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.CloudScheduler.html) ... +//! +//! * projects +//! * [*locations get*](struct.ProjectLocationGetCall.html), [*locations jobs create*](struct.ProjectLocationJobCreateCall.html), [*locations jobs delete*](struct.ProjectLocationJobDeleteCall.html), [*locations jobs get*](struct.ProjectLocationJobGetCall.html), [*locations jobs list*](struct.ProjectLocationJobListCall.html), [*locations jobs patch*](struct.ProjectLocationJobPatchCall.html), [*locations jobs pause*](struct.ProjectLocationJobPauseCall.html), [*locations jobs resume*](struct.ProjectLocationJobResumeCall.html), [*locations jobs run*](struct.ProjectLocationJobRunCall.html) and [*locations list*](struct.ProjectLocationListCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudScheduler.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().locations_jobs_pause(...).doit() +//! let r = hub.projects().locations_jobs_get(...).doit() +//! let r = hub.projects().locations_jobs_create(...).doit() +//! let r = hub.projects().locations_jobs_resume(...).doit() +//! let r = hub.projects().locations_jobs_run(...).doit() +//! let r = hub.projects().locations_jobs_patch(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-cloudscheduler1_beta1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +//! use cloudscheduler1_beta1::Job; +//! use cloudscheduler1_beta1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use cloudscheduler1_beta1::CloudScheduler; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = Job::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.projects().locations_jobs_patch(req, "name") +//! .update_mask("sed") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudScheduler related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// use cloudscheduler1_beta1::Job; +/// use cloudscheduler1_beta1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudscheduler1_beta1::CloudScheduler; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Job::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_jobs_patch(req, "name") +/// .update_mask("dolores") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudScheduler { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for CloudScheduler {} + +impl<'a, C, A> CloudScheduler + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudScheduler { + CloudScheduler { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://cloudscheduler.googleapis.com/".to_string(), + _root_url: "https://cloudscheduler.googleapis.com/".to_string(), + } + } + + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://cloudscheduler.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://cloudscheduler.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// App Engine target. The job will be pushed to a job handler by means +/// of an HTTP request via an http_method such +/// as HTTP POST, HTTP GET, etc. The job is acknowledged by means of an +/// HTTP response code in the range [200 - 299]. Error 503 is +/// considered an App Engine system error instead of an application +/// error. Requests returning error 503 will be retried regardless of +/// retry configuration and not counted against retry counts. Any other +/// response code, or a failure to receive a response before the +/// deadline, constitutes a failed attempt. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AppEngineHttpTarget { + /// Body. + /// + /// HTTP request body. A request body is allowed only if the HTTP method is + /// POST or PUT. It will result in invalid argument error to set a body on a + /// job with an incompatible HttpMethod. + pub body: Option, + /// HTTP request headers. + /// + /// This map contains the header field names and values. Headers can be set + /// when the job is created. + /// + /// Cloud Scheduler sets some headers to default values: + /// + /// * `User-Agent`: By default, this header is + /// `"AppEngine-Google; (+http://code.google.com/appengine)"`. + /// This header can be modified, but Cloud Scheduler will append + /// `"AppEngine-Google; (+http://code.google.com/appengine)"` to the + /// modified `User-Agent`. + /// * `X-CloudScheduler`: This header will be set to true. + /// + /// If the job has an body, Cloud Scheduler sets + /// the following headers: + /// + /// * `Content-Type`: By default, the `Content-Type` header is set to + /// `"application/octet-stream"`. The default can be overridden by explictly + /// setting `Content-Type` to a particular media type when the job is + /// created. + /// For example, `Content-Type` can be set to `"application/json"`. + /// * `Content-Length`: This is computed by Cloud Scheduler. This value is + /// output only. It cannot be changed. + /// + /// The headers below are output only. They cannot be set or overridden: + /// + /// * `X-Google-*`: For Google internal use only. + /// * `X-AppEngine-*`: For Google internal use only. + /// + /// In addition, some App Engine headers, which contain + /// job-specific information, are also be sent to the job handler. + pub headers: Option>, + /// App Engine Routing setting for the job. + #[serde(rename="appEngineRouting")] + pub app_engine_routing: Option, + /// The relative URI. + /// + /// The relative URL must begin with "/" and must be a valid HTTP relative URL. + /// It can contain a path, query string arguments, and `#` fragments. + /// If the relative URL is empty, then the root path "/" will be used. + /// No spaces are allowed, and the maximum length allowed is 2083 characters. + #[serde(rename="relativeUri")] + pub relative_uri: Option, + /// The HTTP method to use for the request. PATCH and OPTIONS are not + /// permitted. + #[serde(rename="httpMethod")] + pub http_method: Option, +} + +impl Part for AppEngineHttpTarget {} + + +/// Response message for listing jobs using ListJobs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations jobs list projects](struct.ProjectLocationJobListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListJobsResponse { + /// A token to retrieve next page of results. Pass this value in the + /// page_token field in the subsequent call to + /// ListJobs to retrieve the next page of results. + /// If this is empty it indicates that there are no more results + /// through which to paginate. + /// + /// The page token is valid for only 2 hours. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of jobs. + pub jobs: Option>, +} + +impl ResponseResult for ListJobsResponse {} + + +/// App Engine Routing. +/// +/// For more information about services, versions, and instances see +/// [An Overview of App +/// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), +/// [Microservices Architecture on Google App +/// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), +/// [App Engine Standard request +/// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), +/// and [App Engine Flex request +/// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AppEngineRouting { + /// App instance. + /// + /// By default, the job is sent to an instance which is available when + /// the job is attempted. + /// + /// Requests can only be sent to a specific instance if + /// [manual scaling is used in App Engine + /// Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). + /// App Engine Flex does not support instances. For more information, see + /// [App Engine Standard request + /// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) + /// and [App Engine Flex request + /// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). + pub instance: Option, + /// Output only. The host that the job is sent to. + /// + /// For more information about how App Engine requests are routed, see + /// [here](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). + /// + /// The host is constructed as: + /// + /// + /// * `host = [application_domain_name]`
+ /// `| [service] + '.' + [application_domain_name]`
+ /// `| [version] + '.' + [application_domain_name]`
+ /// `| [version_dot_service]+ '.' + [application_domain_name]`
+ /// `| [instance] + '.' + [application_domain_name]`
+ /// `| [instance_dot_service] + '.' + [application_domain_name]`
+ /// `| [instance_dot_version] + '.' + [application_domain_name]`
+ /// `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` + /// + /// * `application_domain_name` = The domain name of the app, for + /// example .appspot.com, which is associated with the + /// job's project ID. + /// + /// * `service =` service + /// + /// * `version =` version + /// + /// * `version_dot_service =` + /// version `+ '.' +` + /// service + /// + /// * `instance =` instance + /// + /// * `instance_dot_service =` + /// instance `+ '.' +` + /// service + /// + /// * `instance_dot_version =` + /// instance `+ '.' +` + /// version + /// + /// * `instance_dot_version_dot_service =` + /// instance `+ '.' +` + /// version `+ '.' +` + /// service + /// + /// + /// If service is empty, then the job will be sent + /// to the service which is the default service when the job is attempted. + /// + /// If version is empty, then the job will be sent + /// to the version which is the default version when the job is attempted. + /// + /// If instance is empty, then the job will be + /// sent to an instance which is available when the job is attempted. + /// + /// If service, + /// version, or + /// instance is invalid, then the job will be sent + /// to the default version of the default service when the job is attempted. + pub host: Option, + /// App version. + /// + /// By default, the job is sent to the version which is the default + /// version when the job is attempted. + pub version: Option, + /// App service. + /// + /// By default, the job is sent to the service which is the default + /// service when the job is attempted. + pub service: Option, +} + +impl Part for AppEngineRouting {} + + +/// The response message for Locations.ListLocations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations list projects](struct.ProjectLocationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLocationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of locations that matches the specified filter in the request. + pub locations: Option>, +} + +impl ResponseResult for ListLocationsResponse {} + + +/// A resource that represents Google Cloud Platform location. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Location { + /// The friendly name for this location, typically a nearby city name. + /// For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, + /// Resource name for the location, which may vary between implementations. + /// For example: `"projects/example-project/locations/us-east1"` + pub name: Option, + /// Service-specific metadata. For example the available capacity at the given + /// location. + pub metadata: Option>, +} + +impl ResponseResult for Location {} + + +/// Pub/Sub target. The job will be delivered by publishing a message to +/// the given Pub/Sub topic. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PubsubTarget { + /// Attributes for PubsubMessage. + /// + /// Pubsub message must contain either non-empty data, or at least one + /// attribute. + pub attributes: Option>, + /// The message payload for PubsubMessage. + /// + /// Pubsub message must contain either non-empty data, or at least one + /// attribute. + pub data: Option, + /// Required. + /// + /// The name of the Cloud Pub/Sub topic to which messages will + /// be published when a job is delivered. The topic name must be in the + /// same format as required by PubSub's + /// [PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest), + /// for example `projects/PROJECT_ID/topics/TOPIC_ID`. + /// + /// The topic must be in the same project as the Cloud Scheduler job. + #[serde(rename="topicName")] + pub topic_name: Option, +} + +impl Part for PubsubTarget {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations jobs delete projects](struct.ProjectLocationJobDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// Http target. The job will be pushed to the job handler by means of +/// an HTTP request via an http_method such as HTTP +/// POST, HTTP GET, etc. The job is acknowledged by means of an HTTP +/// response code in the range [200 - 299]. A failure to receive a response +/// constitutes a failed execution. For a redirected request, the response +/// returned by the redirected request is considered. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HttpTarget { + /// HTTP request body. A request body is allowed only if the HTTP + /// method is POST, PUT, or PATCH. It is an error to set body on a job with an + /// incompatible HttpMethod. + pub body: Option, + /// The user can specify HTTP request headers to send with the job's + /// HTTP request. This map contains the header field names and + /// values. Repeated headers are not supported, but a header value can + /// contain commas. These headers represent a subset of the headers + /// that will accompany the job's HTTP request. Some HTTP request + /// headers will be ignored or replaced. A partial list of headers that + /// will be ignored or replaced is below: + /// - Host: This will be computed by Cloud Scheduler and derived from + /// uri. + /// * `Content-Length`: This will be computed by Cloud Scheduler. + /// * `User-Agent`: This will be set to `"Google-Cloud-Scheduler"`. + /// * `X-Google-*`: Google internal use only. + /// * `X-AppEngine-*`: Google internal use only. + /// + /// The total size of headers must be less than 80KB. + pub headers: Option>, + /// Which HTTP method to use for the request. + #[serde(rename="httpMethod")] + pub http_method: Option, + /// If specified, an + /// [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect) + /// token will be generated and attached as an `Authorization` header in the + /// HTTP request. + /// + /// This type of authorization should be used when sending requests to third + /// party endpoints. + #[serde(rename="oidcToken")] + pub oidc_token: Option, + /// Required. + /// + /// The full URI path that the request will be sent to. This string + /// must begin with either "http://" or "https://". Some examples of + /// valid values for uri are: + /// `http://acme.com` and `https://acme.com/sales:8080`. Cloud Scheduler will + /// encode some characters for safety and compatibility. The maximum allowed + /// URL length is 2083 characters after encoding. + pub uri: Option, + /// If specified, an + /// [OAuth token](https://developers.google.com/identity/protocols/OAuth2) + /// will be generated and attached as an `Authorization` header in the HTTP + /// request. + /// + /// This type of authorization should be used when sending requests to a GCP + /// endpoint. + #[serde(rename="oauthToken")] + pub oauth_token: Option, +} + +impl Part for HttpTarget {} + + +/// Contains information needed for generating an +/// [OpenID Connect +/// token](https://developers.google.com/identity/protocols/OpenIDConnect). This +/// type of authorization should be used when sending requests to third party +/// endpoints. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OidcToken { + /// Audience to be used when generating OIDC token. If not specified, the URI + /// specified in target will be used. + pub audience: Option, + /// [Service account email](https://cloud.google.com/iam/docs/service-accounts) + /// to be used for generating OIDC token. + /// The service account must be within the same project as the job. The caller + /// must have iam.serviceAccounts.actAs permission for the service account. + #[serde(rename="serviceAccountEmail")] + pub service_account_email: Option, +} + +impl Part for OidcToken {} + + +/// Request message for ResumeJob. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations jobs resume projects](struct.ProjectLocationJobResumeCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResumeJobRequest { _never_set: Option } + +impl RequestValue for ResumeJobRequest {} + + +/// Contains information needed for generating an +/// [OAuth token](https://developers.google.com/identity/protocols/OAuth2). +/// This type of authorization should be used when sending requests to a GCP +/// endpoint. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OAuthToken { + /// OAuth scope to be used for generating OAuth access token. + /// If not specified, "https://www.googleapis.com/auth/cloud-platform" + /// will be used. + pub scope: Option, + /// [Service account email](https://cloud.google.com/iam/docs/service-accounts) + /// to be used for generating OAuth token. + /// The service account must be within the same project as the job. The caller + /// must have iam.serviceAccounts.actAs permission for the service account. + #[serde(rename="serviceAccountEmail")] + pub service_account_email: Option, +} + +impl Part for OAuthToken {} + + +/// Configuration for a job. +/// The maximum allowed size for a job is 100KB. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations jobs pause projects](struct.ProjectLocationJobPauseCall.html) (response) +/// * [locations jobs get projects](struct.ProjectLocationJobGetCall.html) (response) +/// * [locations jobs create projects](struct.ProjectLocationJobCreateCall.html) (request|response) +/// * [locations jobs resume projects](struct.ProjectLocationJobResumeCall.html) (response) +/// * [locations jobs run projects](struct.ProjectLocationJobRunCall.html) (response) +/// * [locations jobs patch projects](struct.ProjectLocationJobPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Job { + /// Output only. The response from the target for the last attempted execution. + pub status: Option, + /// Optionally caller-specified in CreateJob or + /// UpdateJob. + /// + /// A human-readable description for the job. This string must not contain + /// more than 500 characters. + pub description: Option, + /// Optionally caller-specified in CreateJob, after + /// which it becomes output only. + /// + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + /// + /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), colons (:), or periods (.). + /// For more information, see + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// * `LOCATION_ID` is the canonical ID for the job's location. + /// The list of available locations can be obtained by calling + /// ListLocations. + /// For more information, see https://cloud.google.com/about/locations/. + /// * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), or underscores (_). The maximum length is 500 characters. + pub name: Option, + /// Required, except when used with UpdateJob. + /// + /// Describes the schedule on which the job will be executed. + /// + /// The schedule can be either of the following types: + /// + /// * [Crontab](http://en.wikipedia.org/wiki/Cron#Overview) + /// * English-like + /// [schedule](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules) + /// + /// As a general rule, execution `n + 1` of a job will not begin + /// until execution `n` has finished. Cloud Scheduler will never + /// allow two simultaneously outstanding executions. For example, + /// this implies that if the `n+1`th execution is scheduled to run at + /// 16:00 but the `n`th execution takes until 16:15, the `n+1`th + /// execution will not start until `16:15`. + /// A scheduled start time will be delayed if the previous + /// execution has not ended when its scheduled time occurs. + /// + /// If retry_count > 0 and a job attempt fails, + /// the job will be tried a total of retry_count + /// times, with exponential backoff, until the next scheduled start + /// time. + pub schedule: Option, + /// Output only. The next time the job is scheduled. Note that this may be a + /// retry of a previously failed attempt or the next execution time + /// according to the schedule. + #[serde(rename="scheduleTime")] + pub schedule_time: Option, + /// HTTP target. + #[serde(rename="httpTarget")] + pub http_target: Option, + /// App Engine HTTP target. + #[serde(rename="appEngineHttpTarget")] + pub app_engine_http_target: Option, + /// Output only. The time the last job attempt started. + #[serde(rename="lastAttemptTime")] + pub last_attempt_time: Option, + /// Output only. State of the job. + pub state: Option, + /// Pub/Sub target. + #[serde(rename="pubsubTarget")] + pub pubsub_target: Option, + /// Specifies the time zone to be used in interpreting + /// schedule. The value of this field must be a time + /// zone name from the [tz database](http://en.wikipedia.org/wiki/Tz_database). + /// + /// Note that some time zones include a provision for + /// daylight savings time. The rules for daylight saving time are + /// determined by the chosen tz. For UTC use the string "utc". If a + /// time zone is not specified, the default will be in UTC (also known + /// as GMT). + #[serde(rename="timeZone")] + pub time_zone: Option, + /// Settings that determine the retry behavior. + #[serde(rename="retryConfig")] + pub retry_config: Option, + /// The deadline for job attempts. If the request handler does not respond by + /// this deadline then the request is cancelled and the attempt is marked as a + /// `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed in + /// execution logs. Cloud Scheduler will retry the job according + /// to the RetryConfig. + /// + /// The allowed duration for this deadline is: + /// + /// * For HTTP targets, between 15 seconds and 30 minutes. + /// * For App Engine HTTP targets, between 15 + /// seconds and 24 hours. + /// * For PubSub targets, this field is ignored. + #[serde(rename="attemptDeadline")] + pub attempt_deadline: Option, + /// Output only. The creation time of the job. + #[serde(rename="userUpdateTime")] + pub user_update_time: Option, +} + +impl RequestValue for Job {} +impl ResponseResult for Job {} + + +/// Request message for PauseJob. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations jobs pause projects](struct.ProjectLocationJobPauseCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PauseJobRequest { _never_set: Option } + +impl RequestValue for PauseJobRequest {} + + +/// Request message for forcing a job to run now using +/// RunJob. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations jobs run projects](struct.ProjectLocationJobRunCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RunJobRequest { _never_set: Option } + +impl RequestValue for RunJobRequest {} + + +/// Settings that determine the retry behavior. +/// +/// By default, if a job does not complete successfully (meaning that +/// an acknowledgement is not received from the handler, then it will be retried +/// with exponential backoff according to the settings in RetryConfig. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RetryConfig { + /// The maximum amount of time to wait before retrying a job after + /// it fails. + /// + /// The default value of this field is 1 hour. + #[serde(rename="maxBackoffDuration")] + pub max_backoff_duration: Option, + /// The number of attempts that the system will make to run a job using the + /// exponential backoff procedure described by + /// max_doublings. + /// + /// The default value of retry_count is zero. + /// + /// If retry_count is zero, a job attempt will *not* be retried if + /// it fails. Instead the Cloud Scheduler system will wait for the + /// next scheduled execution time. + /// + /// If retry_count is set to a non-zero number then Cloud Scheduler + /// will retry failed attempts, using exponential backoff, + /// retry_count times, or until the next scheduled execution time, + /// whichever comes first. + /// + /// Values greater than 5 and negative values are not allowed. + #[serde(rename="retryCount")] + pub retry_count: Option, + /// The time between retries will double `max_doublings` times. + /// + /// A job's retry interval starts at + /// min_backoff_duration, then doubles + /// `max_doublings` times, then increases linearly, and finally + /// retries retries at intervals of + /// max_backoff_duration up to + /// retry_count times. + /// + /// For example, if min_backoff_duration is + /// 10s, max_backoff_duration is 300s, and + /// `max_doublings` is 3, then the a job will first be retried in 10s. The + /// retry interval will double three times, and then increase linearly by + /// 2^3 * 10s. Finally, the job will retry at intervals of + /// max_backoff_duration until the job has + /// been attempted retry_count times. Thus, the + /// requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, .... + /// + /// The default value of this field is 5. + #[serde(rename="maxDoublings")] + pub max_doublings: Option, + /// The time limit for retrying a failed job, measured from time when an + /// execution was first attempted. If specified with + /// retry_count, the job will be retried until both + /// limits are reached. + /// + /// The default value for max_retry_duration is zero, which means retry + /// duration is unlimited. + #[serde(rename="maxRetryDuration")] + pub max_retry_duration: Option, + /// The minimum amount of time to wait before retrying a job after + /// it fails. + /// + /// The default value of this field is 5 seconds. + #[serde(rename="minBackoffDuration")] + pub min_backoff_duration: Option, +} + +impl Part for RetryConfig {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `CloudScheduler` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudscheduler1_beta1::CloudScheduler; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `locations_get(...)`, `locations_jobs_create(...)`, `locations_jobs_delete(...)`, `locations_jobs_get(...)`, `locations_jobs_list(...)`, `locations_jobs_patch(...)`, `locations_jobs_pause(...)`, `locations_jobs_resume(...)`, `locations_jobs_run(...)` and `locations_list(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Pauses a job. + /// + /// If a job is paused then the system will stop executing the job + /// until it is re-enabled via ResumeJob. The + /// state of the job is stored in state; if paused it + /// will be set to Job.State.PAUSED. A job must be in Job.State.ENABLED + /// to be paused. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + pub fn locations_jobs_pause(&self, request: PauseJobRequest, name: &str) -> ProjectLocationJobPauseCall<'a, C, A> { + ProjectLocationJobPauseCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a job. + /// + /// # Arguments + /// + /// * `name` - Required. + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + pub fn locations_jobs_delete(&self, name: &str) -> ProjectLocationJobDeleteCall<'a, C, A> { + ProjectLocationJobDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a job. + /// + /// # Arguments + /// + /// * `name` - Required. + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + pub fn locations_jobs_get(&self, name: &str) -> ProjectLocationJobGetCall<'a, C, A> { + ProjectLocationJobGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a job. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. + /// The location name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID`. + pub fn locations_jobs_create(&self, request: Job, parent: &str) -> ProjectLocationJobCreateCall<'a, C, A> { + ProjectLocationJobCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists jobs. + /// + /// # Arguments + /// + /// * `parent` - Required. + /// The location name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID`. + pub fn locations_jobs_list(&self, parent: &str) -> ProjectLocationJobListCall<'a, C, A> { + ProjectLocationJobListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Resume a job. + /// + /// This method reenables a job after it has been Job.State.PAUSED. The + /// state of a job is stored in Job.state; after calling this method it + /// will be set to Job.State.ENABLED. A job must be in + /// Job.State.PAUSED to be resumed. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + pub fn locations_jobs_resume(&self, request: ResumeJobRequest, name: &str) -> ProjectLocationJobResumeCall<'a, C, A> { + ProjectLocationJobResumeCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Forces a job to run now. + /// + /// When this method is called, Cloud Scheduler will dispatch the job, even + /// if the job is already running. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + pub fn locations_jobs_run(&self, request: RunJobRequest, name: &str) -> ProjectLocationJobRunCall<'a, C, A> { + ProjectLocationJobRunCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a location. + /// + /// # Arguments + /// + /// * `name` - Resource name for the location. + pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C, A> { + ProjectLocationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists information about the supported locations for this service. + /// + /// # Arguments + /// + /// * `name` - The resource that owns the locations collection, if applicable. + pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C, A> { + ProjectLocationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a job. + /// + /// If successful, the updated Job is returned. If the job does + /// not exist, `NOT_FOUND` is returned. + /// + /// If UpdateJob does not successfully return, it is possible for the + /// job to be in an Job.State.UPDATE_FAILED state. A job in this state may + /// not be executed. If this happens, retry the UpdateJob request + /// until a successful response is received. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Optionally caller-specified in CreateJob, after + /// which it becomes output only. + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), colons (:), or periods (.). + /// For more information, see + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// * `LOCATION_ID` is the canonical ID for the job's location. + /// The list of available locations can be obtained by calling + /// ListLocations. + /// For more information, see https://cloud.google.com/about/locations/. + /// * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), or underscores (_). The maximum length is 500 characters. + pub fn locations_jobs_patch(&self, request: Job, name: &str) -> ProjectLocationJobPatchCall<'a, C, A> { + ProjectLocationJobPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Pauses a job. +/// +/// If a job is paused then the system will stop executing the job +/// until it is re-enabled via ResumeJob. The +/// state of the job is stored in state; if paused it +/// will be set to Job.State.PAUSED. A job must be in Job.State.ENABLED +/// to be paused. +/// +/// A builder for the *locations.jobs.pause* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// use cloudscheduler1_beta1::PauseJobRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudscheduler1_beta1::CloudScheduler; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PauseJobRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_jobs_pause(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationJobPauseCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, + _request: PauseJobRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationJobPauseCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationJobPauseCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Job)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudscheduler.projects.locations.jobs.pause", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:pause"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PauseJobRequest) -> ProjectLocationJobPauseCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationJobPauseCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationJobPauseCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationJobPauseCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationJobPauseCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a job. +/// +/// A builder for the *locations.jobs.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudscheduler1_beta1::CloudScheduler; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_jobs_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationJobDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationJobDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationJobDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudscheduler.projects.locations.jobs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationJobDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationJobDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationJobDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationJobDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a job. +/// +/// A builder for the *locations.jobs.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudscheduler1_beta1::CloudScheduler; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_jobs_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationJobGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationJobGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationJobGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Job)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudscheduler.projects.locations.jobs.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationJobGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationJobGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationJobGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationJobGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a job. +/// +/// A builder for the *locations.jobs.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// use cloudscheduler1_beta1::Job; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudscheduler1_beta1::CloudScheduler; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Job::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_jobs_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationJobCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, + _request: Job, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationJobCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationJobCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Job)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudscheduler.projects.locations.jobs.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/jobs"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Job) -> ProjectLocationJobCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The location name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationJobCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationJobCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationJobCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationJobCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists jobs. +/// +/// A builder for the *locations.jobs.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudscheduler1_beta1::CloudScheduler; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_jobs_list("parent") +/// .page_token("erat") +/// .page_size(-35) +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationJobListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationJobListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationJobListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListJobsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudscheduler.projects.locations.jobs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/jobs"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The location name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A token identifying a page of results the server will return. To + /// request the first page results, page_token must be empty. To + /// request the next page of results, page_token must be the value of + /// next_page_token returned from + /// the previous call to ListJobs. It is an error to + /// switch the value of filter or + /// order_by while iterating through pages. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Requested page size. + /// + /// The maximum page size is 500. If unspecified, the page size will + /// be the maximum. Fewer jobs than requested might be returned, + /// even if more jobs exist; use next_page_token to determine if more + /// jobs exist. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationJobListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationJobListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationJobListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationJobListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Resume a job. +/// +/// This method reenables a job after it has been Job.State.PAUSED. The +/// state of a job is stored in Job.state; after calling this method it +/// will be set to Job.State.ENABLED. A job must be in +/// Job.State.PAUSED to be resumed. +/// +/// A builder for the *locations.jobs.resume* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// use cloudscheduler1_beta1::ResumeJobRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudscheduler1_beta1::CloudScheduler; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ResumeJobRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_jobs_resume(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationJobResumeCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, + _request: ResumeJobRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationJobResumeCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationJobResumeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Job)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudscheduler.projects.locations.jobs.resume", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:resume"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ResumeJobRequest) -> ProjectLocationJobResumeCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationJobResumeCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationJobResumeCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationJobResumeCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationJobResumeCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Forces a job to run now. +/// +/// When this method is called, Cloud Scheduler will dispatch the job, even +/// if the job is already running. +/// +/// A builder for the *locations.jobs.run* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// use cloudscheduler1_beta1::RunJobRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudscheduler1_beta1::CloudScheduler; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RunJobRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_jobs_run(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationJobRunCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, + _request: RunJobRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationJobRunCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationJobRunCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Job)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudscheduler.projects.locations.jobs.run", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:run"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RunJobRequest) -> ProjectLocationJobRunCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationJobRunCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationJobRunCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationJobRunCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationJobRunCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information about a location. +/// +/// A builder for the *locations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudscheduler1_beta1::CloudScheduler; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudscheduler.projects.locations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name for the location. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists information about the supported locations for this service. +/// +/// A builder for the *locations.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudscheduler1_beta1::CloudScheduler; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_list("name") +/// .page_token("sadipscing") +/// .page_size(-31) +/// .filter("ea") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLocationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudscheduler.projects.locations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/locations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource that owns the locations collection, if applicable. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a job. +/// +/// If successful, the updated Job is returned. If the job does +/// not exist, `NOT_FOUND` is returned. +/// +/// If UpdateJob does not successfully return, it is possible for the +/// job to be in an Job.State.UPDATE_FAILED state. A job in this state may +/// not be executed. If this happens, retry the UpdateJob request +/// until a successful response is received. +/// +/// A builder for the *locations.jobs.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudscheduler1_beta1 as cloudscheduler1_beta1; +/// use cloudscheduler1_beta1::Job; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudscheduler1_beta1::CloudScheduler; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudScheduler::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Job::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_jobs_patch(req, "name") +/// .update_mask("justo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationJobPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudScheduler, + _request: Job, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationJobPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationJobPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Job)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudscheduler.projects.locations.jobs.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Job) -> ProjectLocationJobPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Optionally caller-specified in CreateJob, after + /// which it becomes output only. + /// + /// The job name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. + /// + /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), colons (:), or periods (.). + /// For more information, see + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// * `LOCATION_ID` is the canonical ID for the job's location. + /// The list of available locations can be obtained by calling + /// ListLocations. + /// For more information, see https://cloud.google.com/about/locations/. + /// * `JOB_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), or underscores (_). The maximum length is 500 characters. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationJobPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// A mask used to specify which fields of the job are being updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectLocationJobPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationJobPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationJobPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationJobPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/cloudshell1-cli/Cargo.toml b/gen/cloudshell1-cli/Cargo.toml index c9b6827946..4d21b54392 100644 --- a/gen/cloudshell1-cli/Cargo.toml +++ b/gen/cloudshell1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudshell1-cli" -version = "1.0.8+20181011" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Shell (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudshell1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudshell1] path = "../cloudshell1" -version = "1.0.8+20181011" +version = "1.0.8+20190330" diff --git a/gen/cloudshell1-cli/README.md b/gen/cloudshell1-cli/README.md index 66e0ea1a79..f8c9791fb7 100644 --- a/gen/cloudshell1-cli/README.md +++ b/gen/cloudshell1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Shell* API at revision *20181011*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Shell* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash cloudshell1 [options] diff --git a/gen/cloudshell1-cli/mkdocs.yml b/gen/cloudshell1-cli/mkdocs.yml index 5156102296..039967475c 100644 --- a/gen/cloudshell1-cli/mkdocs.yml +++ b/gen/cloudshell1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Shell v1.0.8+20181011 +site_name: Cloud Shell v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-cloudshell1-cli site_description: A complete library to interact with Cloud Shell (protocol v1) diff --git a/gen/cloudshell1-cli/src/main.rs b/gen/cloudshell1-cli/src/main.rs index 23fc1ad2ff..6c2cf70763 100644 --- a/gen/cloudshell1-cli/src/main.rs +++ b/gen/cloudshell1-cli/src/main.rs @@ -530,7 +530,7 @@ fn main() { let mut app = App::new("cloudshell1") .author("Sebastian Thiel ") - .version("1.0.8+20181011") + .version("1.0.8+20190330") .about("Allows users to start, configure, and connect to interactive shell sessions running in the cloud. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudshell1_cli") diff --git a/gen/cloudshell1/Cargo.toml b/gen/cloudshell1/Cargo.toml index 6c80e4b47d..816ae0af1c 100644 --- a/gen/cloudshell1/Cargo.toml +++ b/gen/cloudshell1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudshell1" -version = "1.0.8+20181011" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Shell (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudshell1" homepage = "https://cloud.google.com/shell/docs/" -documentation = "https://docs.rs/google-cloudshell1/1.0.8+20181011" +documentation = "https://docs.rs/google-cloudshell1/1.0.8+20190330" license = "MIT" keywords = ["cloudshell", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudshell1/README.md b/gen/cloudshell1/README.md index 1368a78fe0..d2030732a1 100644 --- a/gen/cloudshell1/README.md +++ b/gen/cloudshell1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-cloudshell1` library allows access to all features of the *Google Cloud Shell* service. -This documentation was generated from *Cloud Shell* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *cloudshell:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Shell* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *cloudshell:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Shell* *v1* API can be found at the [official documentation site](https://cloud.google.com/shell/docs/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/struct.CloudShell.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/struct.CloudShell.html) ... -* [operations](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/struct.Operation.html) - * [*cancel*](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/struct.OperationDeleteCall.html), [*get*](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/struct.OperationListCall.html) +* [operations](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/struct.Operation.html) + * [*cancel*](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/struct.OperationDeleteCall.html), [*get*](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/struct.OperationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/struct.CloudShell.html)** +* **[Hub](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/struct.CloudShell.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -130,17 +130,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -150,29 +150,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudshell1/1.0.8+20181011/google_cloudshell1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudshell1/1.0.8+20190330/google_cloudshell1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudshell1/src/lib.rs b/gen/cloudshell1/src/lib.rs index 8778971a82..7bff21722a 100644 --- a/gen/cloudshell1/src/lib.rs +++ b/gen/cloudshell1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Shell* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *cloudshell:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Shell* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *cloudshell:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Shell* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/shell/docs/). @@ -367,17 +367,17 @@ impl<'a, C, A> CloudShell // ############ // SCHEMAS ### // ########## -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -781,7 +781,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -797,10 +797,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -820,7 +817,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -898,7 +895,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1034,7 +1031,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1050,10 +1047,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1073,7 +1067,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1151,7 +1145,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1309,7 +1303,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1325,10 +1319,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1348,7 +1339,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1447,7 +1438,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1597,7 +1588,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1613,10 +1604,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1648,7 +1636,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1738,7 +1726,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/cloudtasks2-cli/Cargo.toml b/gen/cloudtasks2-cli/Cargo.toml new file mode 100644 index 0000000000..b500d2025b --- /dev/null +++ b/gen/cloudtasks2-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-cloudtasks2-cli" +version = "1.0.8+20190326" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Tasks (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtasks2-cli" +homepage = "https://cloud.google.com/tasks/" +documentation = "http://byron.github.io/google-apis-rs/google_cloudtasks2_cli" +license = "MIT" +keywords = ["cloudtasks", "google", "cli"] +autobins = false + +[[bin]] +name = "cloudtasks2" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-cloudtasks2] +path = "../cloudtasks2" +version = "1.0.8+20190326" diff --git a/gen/cloudtasks2-cli/LICENSE.md b/gen/cloudtasks2-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudtasks2-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudtasks2-cli/README.md b/gen/cloudtasks2-cli/README.md new file mode 100644 index 0000000000..d84f3d003b --- /dev/null +++ b/gen/cloudtasks2-cli/README.md @@ -0,0 +1,131 @@ + +The `cloudtasks2` command-line interface *(CLI)* allows to use most features of the *Google Cloud Tasks* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud Tasks* API can be found at the +[official documentation site](https://cloud.google.com/tasks/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-cloudtasks2-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtasks2-cli). + +# Usage + +This documentation was generated from the *Cloud Tasks* API at revision *20190326*. The CLI is at version *1.0.8*. + +```bash +cloudtasks2 [options] + projects + locations-get [-p ]... [-o ] + locations-list [-p ]... [-o ] + locations-queues-create (-r )... [-p ]... [-o ] + locations-queues-delete [-p ]... [-o ] + locations-queues-get [-p ]... [-o ] + locations-queues-get-iam-policy (-r )... [-p ]... [-o ] + locations-queues-list [-p ]... [-o ] + locations-queues-patch (-r )... [-p ]... [-o ] + locations-queues-pause (-r )... [-p ]... [-o ] + locations-queues-purge (-r )... [-p ]... [-o ] + locations-queues-resume (-r )... [-p ]... [-o ] + locations-queues-set-iam-policy (-r )... [-p ]... [-o ] + locations-queues-tasks-create (-r )... [-p ]... [-o ] + locations-queues-tasks-delete [-p ]... [-o ] + locations-queues-tasks-get [-p ]... [-o ] + locations-queues-tasks-list [-p ]... [-o ] + locations-queues-tasks-run (-r )... [-p ]... [-o ] + locations-queues-test-iam-permissions (-r )... [-p ]... [-o ] + cloudtasks2 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `cloudtasks2-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/cloudtasks2-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/cloudtasks2-secret.json`, assuming that the required *cloudtasks* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `cloudtasks2 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/cloudtasks2-cli/mkdocs.yml b/gen/cloudtasks2-cli/mkdocs.yml new file mode 100644 index 0000000000..9adb955a96 --- /dev/null +++ b/gen/cloudtasks2-cli/mkdocs.yml @@ -0,0 +1,34 @@ +site_name: Cloud Tasks v1.0.8+20190326 +site_url: http://byron.github.io/google-apis-rs/google-cloudtasks2-cli +site_description: A complete library to interact with Cloud Tasks (protocol v2) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtasks2-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['projects_locations-get.md', 'Projects', 'Locations Get'] +- ['projects_locations-list.md', 'Projects', 'Locations List'] +- ['projects_locations-queues-create.md', 'Projects', 'Locations Queues Create'] +- ['projects_locations-queues-delete.md', 'Projects', 'Locations Queues Delete'] +- ['projects_locations-queues-get.md', 'Projects', 'Locations Queues Get'] +- ['projects_locations-queues-get-iam-policy.md', 'Projects', 'Locations Queues Get Iam Policy'] +- ['projects_locations-queues-list.md', 'Projects', 'Locations Queues List'] +- ['projects_locations-queues-patch.md', 'Projects', 'Locations Queues Patch'] +- ['projects_locations-queues-pause.md', 'Projects', 'Locations Queues Pause'] +- ['projects_locations-queues-purge.md', 'Projects', 'Locations Queues Purge'] +- ['projects_locations-queues-resume.md', 'Projects', 'Locations Queues Resume'] +- ['projects_locations-queues-set-iam-policy.md', 'Projects', 'Locations Queues Set Iam Policy'] +- ['projects_locations-queues-tasks-create.md', 'Projects', 'Locations Queues Tasks Create'] +- ['projects_locations-queues-tasks-delete.md', 'Projects', 'Locations Queues Tasks Delete'] +- ['projects_locations-queues-tasks-get.md', 'Projects', 'Locations Queues Tasks Get'] +- ['projects_locations-queues-tasks-list.md', 'Projects', 'Locations Queues Tasks List'] +- ['projects_locations-queues-tasks-run.md', 'Projects', 'Locations Queues Tasks Run'] +- ['projects_locations-queues-test-iam-permissions.md', 'Projects', 'Locations Queues Test Iam Permissions'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/cloudtasks2-cli/src/cmn.rs b/gen/cloudtasks2-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/cloudtasks2-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/cloudtasks2-cli/src/main.rs b/gen/cloudtasks2-cli/src/main.rs new file mode 100644 index 0000000000..1f56527578 --- /dev/null +++ b/gen/cloudtasks2-cli/src/main.rs @@ -0,0 +1,2296 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_cloudtasks2 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudTasks>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _projects_locations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rate-limits.max-concurrent-dispatches" => Some(("rateLimits.maxConcurrentDispatches", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rate-limits.max-burst-size" => Some(("rateLimits.maxBurstSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rate-limits.max-dispatches-per-second" => Some(("rateLimits.maxDispatchesPerSecond", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "app-engine-routing-override.instance" => Some(("appEngineRoutingOverride.instance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-routing-override.host" => Some(("appEngineRoutingOverride.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-routing-override.version" => Some(("appEngineRoutingOverride.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-routing-override.service" => Some(("appEngineRoutingOverride.service", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "purge-time" => Some(("purgeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.max-retry-duration" => Some(("retryConfig.maxRetryDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.max-doublings" => Some(("retryConfig.maxDoublings", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "retry-config.max-attempts" => Some(("retryConfig.maxAttempts", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "retry-config.max-backoff" => Some(("retryConfig.maxBackoff", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.min-backoff" => Some(("retryConfig.minBackoff", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["app-engine-routing-override", "host", "instance", "max-attempts", "max-backoff", "max-burst-size", "max-concurrent-dispatches", "max-dispatches-per-second", "max-doublings", "max-retry-duration", "min-backoff", "name", "purge-time", "rate-limits", "retry-config", "service", "state", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Queue = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_queues_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_queues_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_queues_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_queues_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_queues_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rate-limits.max-concurrent-dispatches" => Some(("rateLimits.maxConcurrentDispatches", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rate-limits.max-burst-size" => Some(("rateLimits.maxBurstSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rate-limits.max-dispatches-per-second" => Some(("rateLimits.maxDispatchesPerSecond", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "app-engine-routing-override.instance" => Some(("appEngineRoutingOverride.instance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-routing-override.host" => Some(("appEngineRoutingOverride.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-routing-override.version" => Some(("appEngineRoutingOverride.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-engine-routing-override.service" => Some(("appEngineRoutingOverride.service", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "purge-time" => Some(("purgeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.max-retry-duration" => Some(("retryConfig.maxRetryDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.max-doublings" => Some(("retryConfig.maxDoublings", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "retry-config.max-attempts" => Some(("retryConfig.maxAttempts", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "retry-config.max-backoff" => Some(("retryConfig.maxBackoff", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retry-config.min-backoff" => Some(("retryConfig.minBackoff", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["app-engine-routing-override", "host", "instance", "max-attempts", "max-backoff", "max-burst-size", "max-concurrent-dispatches", "max-dispatches-per-second", "max-doublings", "max-retry-duration", "min-backoff", "name", "purge-time", "rate-limits", "retry-config", "service", "state", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Queue = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_queues_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_pause(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PauseQueueRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_queues_pause(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_purge(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PurgeQueueRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_queues_purge(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_resume(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ResumeQueueRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_queues_resume(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_queues_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_tasks_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "response-view" => Some(("responseView", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.app-engine-http-request.body" => Some(("task.appEngineHttpRequest.body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.app-engine-http-request.headers" => Some(("task.appEngineHttpRequest.headers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "task.app-engine-http-request.app-engine-routing.instance" => Some(("task.appEngineHttpRequest.appEngineRouting.instance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.app-engine-http-request.app-engine-routing.host" => Some(("task.appEngineHttpRequest.appEngineRouting.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.app-engine-http-request.app-engine-routing.version" => Some(("task.appEngineHttpRequest.appEngineRouting.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.app-engine-http-request.app-engine-routing.service" => Some(("task.appEngineHttpRequest.appEngineRouting.service", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.app-engine-http-request.relative-uri" => Some(("task.appEngineHttpRequest.relativeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.app-engine-http-request.http-method" => Some(("task.appEngineHttpRequest.httpMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.first-attempt.schedule-time" => Some(("task.firstAttempt.scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.first-attempt.dispatch-time" => Some(("task.firstAttempt.dispatchTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.first-attempt.response-time" => Some(("task.firstAttempt.responseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.first-attempt.response-status.message" => Some(("task.firstAttempt.responseStatus.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.first-attempt.response-status.code" => Some(("task.firstAttempt.responseStatus.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "task.last-attempt.schedule-time" => Some(("task.lastAttempt.scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.last-attempt.dispatch-time" => Some(("task.lastAttempt.dispatchTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.last-attempt.response-time" => Some(("task.lastAttempt.responseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.last-attempt.response-status.message" => Some(("task.lastAttempt.responseStatus.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.last-attempt.response-status.code" => Some(("task.lastAttempt.responseStatus.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "task.view" => Some(("task.view", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.schedule-time" => Some(("task.scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.dispatch-deadline" => Some(("task.dispatchDeadline", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.response-count" => Some(("task.responseCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "task.create-time" => Some(("task.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.dispatch-count" => Some(("task.dispatchCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "task.name" => Some(("task.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["app-engine-http-request", "app-engine-routing", "body", "code", "create-time", "dispatch-count", "dispatch-deadline", "dispatch-time", "first-attempt", "headers", "host", "http-method", "instance", "last-attempt", "message", "name", "relative-uri", "response-count", "response-status", "response-time", "response-view", "schedule-time", "service", "task", "version", "view"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreateTaskRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_queues_tasks_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_tasks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_queues_tasks_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_tasks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_queues_tasks_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "response-view" => { + call = call.response_view(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["response-view"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_tasks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_queues_tasks_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "response-view" => { + call = call.response_view(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "response-view", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_tasks_run(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "response-view" => Some(("responseView", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["response-view"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RunTaskRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_queues_tasks_run(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_queues_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_queues_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("projects", Some(opt)) => { + match opt.subcommand() { + ("locations-get", Some(opt)) => { + call_result = self._projects_locations_get(opt, dry_run, &mut err); + }, + ("locations-list", Some(opt)) => { + call_result = self._projects_locations_list(opt, dry_run, &mut err); + }, + ("locations-queues-create", Some(opt)) => { + call_result = self._projects_locations_queues_create(opt, dry_run, &mut err); + }, + ("locations-queues-delete", Some(opt)) => { + call_result = self._projects_locations_queues_delete(opt, dry_run, &mut err); + }, + ("locations-queues-get", Some(opt)) => { + call_result = self._projects_locations_queues_get(opt, dry_run, &mut err); + }, + ("locations-queues-get-iam-policy", Some(opt)) => { + call_result = self._projects_locations_queues_get_iam_policy(opt, dry_run, &mut err); + }, + ("locations-queues-list", Some(opt)) => { + call_result = self._projects_locations_queues_list(opt, dry_run, &mut err); + }, + ("locations-queues-patch", Some(opt)) => { + call_result = self._projects_locations_queues_patch(opt, dry_run, &mut err); + }, + ("locations-queues-pause", Some(opt)) => { + call_result = self._projects_locations_queues_pause(opt, dry_run, &mut err); + }, + ("locations-queues-purge", Some(opt)) => { + call_result = self._projects_locations_queues_purge(opt, dry_run, &mut err); + }, + ("locations-queues-resume", Some(opt)) => { + call_result = self._projects_locations_queues_resume(opt, dry_run, &mut err); + }, + ("locations-queues-set-iam-policy", Some(opt)) => { + call_result = self._projects_locations_queues_set_iam_policy(opt, dry_run, &mut err); + }, + ("locations-queues-tasks-create", Some(opt)) => { + call_result = self._projects_locations_queues_tasks_create(opt, dry_run, &mut err); + }, + ("locations-queues-tasks-delete", Some(opt)) => { + call_result = self._projects_locations_queues_tasks_delete(opt, dry_run, &mut err); + }, + ("locations-queues-tasks-get", Some(opt)) => { + call_result = self._projects_locations_queues_tasks_get(opt, dry_run, &mut err); + }, + ("locations-queues-tasks-list", Some(opt)) => { + call_result = self._projects_locations_queues_tasks_list(opt, dry_run, &mut err); + }, + ("locations-queues-tasks-run", Some(opt)) => { + call_result = self._projects_locations_queues_tasks_run(opt, dry_run, &mut err); + }, + ("locations-queues-test-iam-permissions", Some(opt)) => { + call_result = self._projects_locations_queues_test_iam_permissions(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "cloudtasks2-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "cloudtasks2", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::CloudTasks::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("projects", "methods: 'locations-get', 'locations-list', 'locations-queues-create', 'locations-queues-delete', 'locations-queues-get', 'locations-queues-get-iam-policy', 'locations-queues-list', 'locations-queues-patch', 'locations-queues-pause', 'locations-queues-purge', 'locations-queues-resume', 'locations-queues-set-iam-policy', 'locations-queues-tasks-create', 'locations-queues-tasks-delete', 'locations-queues-tasks-get', 'locations-queues-tasks-list', 'locations-queues-tasks-run' and 'locations-queues-test-iam-permissions'", vec![ + ("locations-get", + Some(r##"Gets information about a location."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name for the location."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-list", + Some(r##"Lists information about the supported locations for this service."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource that owns the locations collection, if applicable."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-create", + Some(r##"Creates a queue. + + Queues created with this method allow tasks to live for a maximum of 31 + days. After a task is 31 days old, the task will be deleted regardless of whether + it was dispatched or not. + + WARNING: Using this method may have unintended side effects if you are + using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + Read + [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + before using this method."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. + + The location name in which the queue will be created. + For example: `projects/PROJECT_ID/locations/LOCATION_ID` + + The list of allowed locations can be obtained by calling Cloud + Tasks' implementation of + ListLocations."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-delete", + Some(r##"Deletes a queue. + + This command will delete the queue even if it has tasks in it. + + Note: If you delete a queue, a queue with the same name can't be created + for 7 days. + + WARNING: Using this method may have unintended side effects if you are + using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + Read + [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + before using this method."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The queue name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-get", + Some(r##"Gets a queue."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The resource name of the queue. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-get-iam-policy", + Some(r##"Gets the access control policy for a Queue. + Returns an empty policy if the resource exists and does not have a policy + set. + + Authorization requires the following + [Google IAM](https://cloud.google.com/iam) permission on the specified + resource parent: + + * `cloudtasks.queues.getIamPolicy`"##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-list", + Some(r##"Lists queues. + + Queues are returned in lexicographical order."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. + + The location name. + For example: `projects/PROJECT_ID/locations/LOCATION_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-patch", + Some(r##"Updates a queue. + + This method creates the queue if it does not exist and updates + the queue if it does exist. + + Queues created with this method allow tasks to live for a maximum of 31 + days. After a task is 31 days old, the task will be deleted regardless of whether + it was dispatched or not. + + WARNING: Using this method may have unintended side effects if you are + using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + Read + [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + before using this method."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Caller-specified and required in CreateQueue, + after which it becomes output only. + + The queue name. + + The queue name must have the following format: + `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + + * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + hyphens (-), colons (:), or periods (.). + For more information, see + [Identifying + projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + * `LOCATION_ID` is the canonical ID for the queue's location. + The list of available locations can be obtained by calling + ListLocations. + For more information, see https://cloud.google.com/about/locations/. + * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or + hyphens (-). The maximum length is 100 characters."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-pause", + Some(r##"Pauses the queue. + + If a queue is paused then the system will stop dispatching tasks + until the queue is resumed via + ResumeQueue. Tasks can still be added + when the queue is paused. A queue is paused if its + state is PAUSED."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-pause", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The queue name. For example: + `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-purge", + Some(r##"Purges a queue by deleting all of its tasks. + + All tasks created before this method is called are permanently deleted. + + Purge operations can take up to one minute to take effect. Tasks + might be dispatched before the purge takes effect. A purge is irreversible."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-purge", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The queue name. For example: + `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-resume", + Some(r##"Resume a queue. + + This method resumes a queue after it has been + PAUSED or + DISABLED. The state of a queue is stored + in the queue's state; after calling this method it + will be set to RUNNING. + + WARNING: Resuming many high-QPS queues at the same time can + lead to target overloading. If you are resuming high-QPS + queues, follow the 500/50/5 pattern described in + [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling)."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-resume", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The queue name. For example: + `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-set-iam-policy", + Some(r##"Sets the access control policy for a Queue. Replaces any existing + policy. + + Note: The Cloud Console does not check queue-level IAM permissions yet. + Project-level permissions are required to use the Cloud Console. + + Authorization requires the following + [Google IAM](https://cloud.google.com/iam) permission on the specified + resource parent: + + * `cloudtasks.queues.setIamPolicy`"##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-tasks-create", + Some(r##"Creates a task and adds it to a queue. + + Tasks cannot be updated after creation; there is no UpdateTask command. + + * For App Engine queues, the maximum task size is + 100KB."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-tasks-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. + + The queue name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + + The queue must already exist."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-tasks-delete", + Some(r##"Deletes a task. + + A task can be deleted if it is scheduled or dispatched. A task + cannot be deleted if it has executed successfully or permanently + failed."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-tasks-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The task name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-tasks-get", + Some(r##"Gets a task."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-tasks-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The task name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-tasks-list", + Some(r##"Lists the tasks in a queue. + + By default, only the BASIC view is retrieved + due to performance considerations; + response_view controls the + subset of information which is returned. + + The tasks may be returned in any order. The ordering may change at any + time."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-tasks-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Required. + + The queue name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-tasks-run", + Some(r##"Forces a task to run now. + + When this method is called, Cloud Tasks will dispatch the task, even if + the task is already running, the queue has reached its RateLimits or + is PAUSED. + + This command is meant to be used for manual debugging. For + example, RunTask can be used to retry a failed + task after a fix has been made or to manually force a task to be + dispatched now. + + The dispatched task is returned. That is, the task that is returned + contains the status after the task is dispatched but + before the task is received by its target. + + If Cloud Tasks receives a successful response from the task's + target, then the task will be deleted; otherwise the task's + schedule_time will be reset to the time that + RunTask was called plus the retry delay specified + in the queue's RetryConfig. + + RunTask returns + NOT_FOUND when it is called on a + task that has already succeeded or permanently failed."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-tasks-run", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. + + The task name. For example: + `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-queues-test-iam-permissions", + Some(r##"Returns permissions that a caller has on a Queue. + If the resource does not exist, this will return an empty set of + permissions, not a NOT_FOUND error. + + Note: This operation is designed to be used for building permission-aware + UIs and command-line tools, not for authorization checking. This operation + may "fail open" without warning."##), + "Details at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli/projects_locations-queues-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("cloudtasks2") + .author("Sebastian Thiel ") + .version("1.0.8+20190326") + .about("Manages the execution of large numbers of distributed requests.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudtasks2_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/cloudtasks2/Cargo.toml b/gen/cloudtasks2/Cargo.toml new file mode 100644 index 0000000000..b6df9ede67 --- /dev/null +++ b/gen/cloudtasks2/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-cloudtasks2" +version = "1.0.8+20190326" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Tasks (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtasks2" +homepage = "https://cloud.google.com/tasks/" +documentation = "https://docs.rs/google-cloudtasks2/1.0.8+20190326" +license = "MIT" +keywords = ["cloudtasks", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/cloudtasks2/LICENSE.md b/gen/cloudtasks2/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/cloudtasks2/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudtasks2/README.md b/gen/cloudtasks2/README.md new file mode 100644 index 0000000000..f1d851d965 --- /dev/null +++ b/gen/cloudtasks2/README.md @@ -0,0 +1,194 @@ + +The `google-cloudtasks2` library allows access to all features of the *Google Cloud Tasks* service. + +This documentation was generated from *Cloud Tasks* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudtasks:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Cloud Tasks* *v2* API can be found at the +[official documentation site](https://cloud.google.com/tasks/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.CloudTasks.html) ... + +* projects + * [*locations get*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationListCall.html), [*locations queues create*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueCreateCall.html), [*locations queues delete*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueDeleteCall.html), [*locations queues get*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueGetCall.html), [*locations queues get iam policy*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueGetIamPolicyCall.html), [*locations queues list*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueListCall.html), [*locations queues patch*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueuePatchCall.html), [*locations queues pause*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueuePauseCall.html), [*locations queues purge*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueuePurgeCall.html), [*locations queues resume*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueResumeCall.html), [*locations queues set iam policy*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueSetIamPolicyCall.html), [*locations queues tasks create*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueTaskCreateCall.html), [*locations queues tasks delete*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueTaskDeleteCall.html), [*locations queues tasks get*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueTaskGetCall.html), [*locations queues tasks list*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueTaskListCall.html), [*locations queues tasks run*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueTaskRunCall.html) and [*locations queues test iam permissions*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.ProjectLocationQueueTestIamPermissionCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/struct.CloudTasks.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.projects().locations_queues_pause(...).doit() +let r = hub.projects().locations_queues_resume(...).doit() +let r = hub.projects().locations_queues_patch(...).doit() +let r = hub.projects().locations_queues_create(...).doit() +let r = hub.projects().locations_queues_get(...).doit() +let r = hub.projects().locations_queues_purge(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-cloudtasks2 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_cloudtasks2 as cloudtasks2; +use cloudtasks2::Queue; +use cloudtasks2::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use cloudtasks2::CloudTasks; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = Queue::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.projects().locations_queues_patch(req, "name") + .update_mask("sit") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-cloudtasks2/1.0.8+20190326/google_cloudtasks2/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **cloudtasks2** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/cloudtasks2/src/cmn.rs b/gen/cloudtasks2/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/cloudtasks2/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/cloudtasks2/src/lib.rs b/gen/cloudtasks2/src/lib.rs new file mode 100644 index 0000000000..9c6b122c68 --- /dev/null +++ b/gen/cloudtasks2/src/lib.rs @@ -0,0 +1,7342 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud Tasks* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudtasks:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Cloud Tasks* *v2* API can be found at the +//! [official documentation site](https://cloud.google.com/tasks/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtasks2). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.CloudTasks.html) ... +//! +//! * projects +//! * [*locations get*](struct.ProjectLocationGetCall.html), [*locations list*](struct.ProjectLocationListCall.html), [*locations queues create*](struct.ProjectLocationQueueCreateCall.html), [*locations queues delete*](struct.ProjectLocationQueueDeleteCall.html), [*locations queues get*](struct.ProjectLocationQueueGetCall.html), [*locations queues get iam policy*](struct.ProjectLocationQueueGetIamPolicyCall.html), [*locations queues list*](struct.ProjectLocationQueueListCall.html), [*locations queues patch*](struct.ProjectLocationQueuePatchCall.html), [*locations queues pause*](struct.ProjectLocationQueuePauseCall.html), [*locations queues purge*](struct.ProjectLocationQueuePurgeCall.html), [*locations queues resume*](struct.ProjectLocationQueueResumeCall.html), [*locations queues set iam policy*](struct.ProjectLocationQueueSetIamPolicyCall.html), [*locations queues tasks create*](struct.ProjectLocationQueueTaskCreateCall.html), [*locations queues tasks delete*](struct.ProjectLocationQueueTaskDeleteCall.html), [*locations queues tasks get*](struct.ProjectLocationQueueTaskGetCall.html), [*locations queues tasks list*](struct.ProjectLocationQueueTaskListCall.html), [*locations queues tasks run*](struct.ProjectLocationQueueTaskRunCall.html) and [*locations queues test iam permissions*](struct.ProjectLocationQueueTestIamPermissionCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudTasks.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().locations_queues_pause(...).doit() +//! let r = hub.projects().locations_queues_resume(...).doit() +//! let r = hub.projects().locations_queues_patch(...).doit() +//! let r = hub.projects().locations_queues_create(...).doit() +//! let r = hub.projects().locations_queues_get(...).doit() +//! let r = hub.projects().locations_queues_purge(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-cloudtasks2 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_cloudtasks2 as cloudtasks2; +//! use cloudtasks2::Queue; +//! use cloudtasks2::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use cloudtasks2::CloudTasks; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = Queue::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.projects().locations_queues_patch(req, "name") +//! .update_mask("sed") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudTasks related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::Queue; +/// use cloudtasks2::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudtasks2::CloudTasks; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Queue::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_patch(req, "name") +/// .update_mask("dolores") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudTasks { + client: RefCell, + auth: RefCell
, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for CloudTasks {} + +impl<'a, C, A> CloudTasks + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudTasks { + CloudTasks { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://cloudtasks.googleapis.com/".to_string(), + _root_url: "https://cloudtasks.googleapis.com/".to_string(), + } + } + + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://cloudtasks.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://cloudtasks.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// App Engine HTTP request. +/// +/// The message defines the HTTP request that is sent to an App Engine app when +/// the task is dispatched. +/// +/// This proto can only be used for tasks in a queue which has +/// app_engine_http_queue set. +/// +/// Using AppEngineHttpRequest requires +/// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) +/// Google IAM permission for the project +/// and the following scope: +/// +/// `https://www.googleapis.com/auth/cloud-platform` +/// +/// The task will be delivered to the App Engine app which belongs to the same +/// project as the queue. For more information, see +/// [How Requests are +/// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) +/// and how routing is affected by +/// [dispatch +/// files](https://cloud.google.com/appengine/docs/python/config/dispatchref). +/// Traffic is encrypted during transport and never leaves Google datacenters. +/// Because this traffic is carried over a communication mechanism internal to +/// Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). +/// The request to the handler, however, will appear to have used the HTTP +/// protocol. +/// +/// The AppEngineRouting used to construct the URL that the task is +/// delivered to can be set at the queue-level or task-level: +/// +/// * If set, +/// app_engine_routing_override +/// is used for all tasks in the queue, no matter what the setting +/// is for the +/// task-level app_engine_routing. +/// +/// +/// The `url` that the task will be sent to is: +/// +/// * `url =` host `+` +/// relative_uri +/// +/// Tasks can be dispatched to secure app handlers, unsecure app handlers, and +/// URIs restricted with +/// [`login: +/// admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). +/// Because tasks are not run as any user, they cannot be dispatched to URIs +/// restricted with +/// [`login: +/// required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) +/// Task dispatches also do not follow redirects. +/// +/// The task attempt has succeeded if the app's request handler returns +/// an HTTP response code in the range [`200` - `299`]. `503` is +/// considered an App Engine system error instead of an application +/// error. Requests returning error `503` will be retried regardless of +/// retry configuration and not counted against retry counts. +/// Any other response code or a failure to receive a response before the +/// deadline is a failed attempt. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AppEngineHttpRequest { + /// HTTP request body. + /// + /// A request body is allowed only if the HTTP method is POST or PUT. It is + /// an error to set a body on a task with an incompatible HttpMethod. + pub body: Option, + /// HTTP request headers. + /// + /// This map contains the header field names and values. + /// Headers can be set when the + /// task is created. + /// Repeated headers are not supported but a header value can contain commas. + /// + /// Cloud Tasks sets some headers to default values: + /// + /// * `User-Agent`: By default, this header is + /// `"AppEngine-Google; (+http://code.google.com/appengine)"`. + /// This header can be modified, but Cloud Tasks will append + /// `"AppEngine-Google; (+http://code.google.com/appengine)"` to the + /// modified `User-Agent`. + /// + /// If the task has a body, Cloud + /// Tasks sets the following headers: + /// + /// * `Content-Type`: By default, the `Content-Type` header is set to + /// `"application/octet-stream"`. The default can be overridden by explicitly + /// setting `Content-Type` to a particular media type when the + /// task is created. + /// For example, `Content-Type` can be set to `"application/json"`. + /// * `Content-Length`: This is computed by Cloud Tasks. This value is + /// output only. It cannot be changed. + /// + /// The headers below cannot be set or overridden: + /// + /// * `Host` + /// * `X-Google-*` + /// * `X-AppEngine-*` + /// + /// In addition, Cloud Tasks sets some headers when the task is dispatched, + /// such as headers containing information about the task; see + /// [request + /// headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). + /// These headers are set only when the task is dispatched, so they are not + /// visible when the task is returned in a Cloud Tasks response. + /// + /// Although there is no specific limit for the maximum number of headers or + /// the size, there is a limit on the maximum size of the Task. For more + /// information, see the CreateTask documentation. + pub headers: Option>, + /// Task-level setting for App Engine routing. + /// + /// If set, + /// app_engine_routing_override + /// is used for all tasks in the queue, no matter what the setting is for the + /// task-level app_engine_routing. + #[serde(rename="appEngineRouting")] + pub app_engine_routing: Option, + /// The relative URI. + /// + /// The relative URI must begin with "/" and must be a valid HTTP relative URI. + /// It can contain a path and query string arguments. + /// If the relative URI is empty, then the root path "/" will be used. + /// No spaces are allowed, and the maximum length allowed is 2083 characters. + #[serde(rename="relativeUri")] + pub relative_uri: Option, + /// The HTTP method to use for the request. The default is POST. + /// + /// The app's request handler for the task's target URL must be able to handle + /// HTTP requests with this http_method, otherwise the task attempt will fail + /// with error code 405 (Method Not Allowed). See + /// [Writing a push task request + /// handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) + /// and the documentation for the request handlers in the language your app is + /// written in e.g. + /// [Python Request + /// Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). + #[serde(rename="httpMethod")] + pub http_method: Option, +} + +impl Part for AppEngineHttpRequest {} + + +/// Request message for `GetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues get iam policy projects](struct.ProjectLocationQueueGetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetIamPolicyRequest { _never_set: Option } + +impl RequestValue for GetIamPolicyRequest {} + + +/// The status of a task attempt. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Attempt { + /// Output only. The time that this attempt was scheduled. + /// + /// `schedule_time` will be truncated to the nearest microsecond. + #[serde(rename="scheduleTime")] + pub schedule_time: Option, + /// Output only. The time that this attempt was dispatched. + /// + /// `dispatch_time` will be truncated to the nearest microsecond. + #[serde(rename="dispatchTime")] + pub dispatch_time: Option, + /// Output only. The time that this attempt response was received. + /// + /// `response_time` will be truncated to the nearest microsecond. + #[serde(rename="responseTime")] + pub response_time: Option, + /// Output only. The response from the worker for this attempt. + /// + /// If `response_time` is unset, then the task has not been attempted or is + /// currently running and the `response_status` field is meaningless. + #[serde(rename="responseStatus")] + pub response_status: Option, +} + +impl Part for Attempt {} + + +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues test iam permissions projects](struct.ProjectLocationQueueTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, +} + +impl RequestValue for TestIamPermissionsRequest {} + + +/// Request message for PauseQueue. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues pause projects](struct.ProjectLocationQueuePauseCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PauseQueueRequest { _never_set: Option } + +impl RequestValue for PauseQueueRequest {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// Response message for listing tasks using ListTasks. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues tasks list projects](struct.ProjectLocationQueueTaskListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListTasksResponse { + /// A token to retrieve next page of results. + /// + /// To return the next page of results, call + /// ListTasks with this value as the + /// page_token. + /// + /// If the next_page_token is empty, there are no more results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of tasks. + pub tasks: Option>, +} + +impl ResponseResult for ListTasksResponse {} + + +/// A queue is a container of related tasks. Queues are configured to manage +/// how those tasks are dispatched. Configurable properties include rate limits, +/// retry options, queue types, and others. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues pause projects](struct.ProjectLocationQueuePauseCall.html) (response) +/// * [locations queues resume projects](struct.ProjectLocationQueueResumeCall.html) (response) +/// * [locations queues patch projects](struct.ProjectLocationQueuePatchCall.html) (request|response) +/// * [locations queues create projects](struct.ProjectLocationQueueCreateCall.html) (request|response) +/// * [locations queues get projects](struct.ProjectLocationQueueGetCall.html) (response) +/// * [locations queues purge projects](struct.ProjectLocationQueuePurgeCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Queue { + /// Output only. The state of the queue. + /// + /// `state` can only be changed by called + /// PauseQueue, + /// ResumeQueue, or uploading + /// [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref). + /// UpdateQueue cannot be used to change `state`. + pub state: Option, + /// Output only. The last time this queue was purged. + /// + /// All tasks that were created before this time + /// were purged. + /// + /// A queue can be purged using PurgeQueue, the + /// [App Engine Task Queue SDK, or the Cloud + /// Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). + /// + /// Purge time will be truncated to the nearest microsecond. Purge + /// time will be unset if the queue has never been purged. + #[serde(rename="purgeTime")] + pub purge_time: Option, + /// Caller-specified and required in CreateQueue, + /// after which it becomes output only. + /// + /// The queue name. + /// + /// The queue name must have the following format: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + /// + /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), colons (:), or periods (.). + /// For more information, see + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// * `LOCATION_ID` is the canonical ID for the queue's location. + /// The list of available locations can be obtained by calling + /// ListLocations. + /// For more information, see https://cloud.google.com/about/locations/. + /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or + /// hyphens (-). The maximum length is 100 characters. + pub name: Option, + /// Rate limits for task dispatches. + /// + /// rate_limits and retry_config are + /// related because they both control task attempts. However they control task + /// attempts in different ways: + /// + /// * rate_limits controls the total rate of + /// dispatches from a queue (i.e. all traffic dispatched from the + /// queue, regardless of whether the dispatch is from a first + /// attempt or a retry). + /// * retry_config controls what happens to + /// particular a task after its first attempt fails. That is, + /// retry_config controls task retries (the + /// second attempt, third attempt, etc). + /// + /// The queue's actual dispatch rate is the result of: + /// + /// * Number of tasks in the queue + /// * User-specified throttling: rate_limits, + /// retry_config, and the + /// queue's state. + /// * System throttling due to `429` (Too Many Requests) or `503` (Service + /// Unavailable) responses from the worker, high error rates, or to smooth + /// sudden large traffic spikes. + #[serde(rename="rateLimits")] + pub rate_limits: Option, + /// Overrides for + /// task-level app_engine_routing. + /// These settings apply only to + /// App Engine tasks in this queue. + /// + /// If set, `app_engine_routing_override` is used for all + /// App Engine tasks in the queue, no matter what the + /// setting is for the + /// task-level app_engine_routing. + #[serde(rename="appEngineRoutingOverride")] + pub app_engine_routing_override: Option, + /// Settings that determine the retry behavior. + /// + /// * For tasks created using Cloud Tasks: the queue-level retry settings + /// apply to all tasks in the queue that were created using Cloud Tasks. + /// Retry settings cannot be set on individual tasks. + /// * For tasks created using the App Engine SDK: the queue-level retry + /// settings apply to all tasks in the queue which do not have retry settings + /// explicitly set on the task and were created by the App Engine SDK. See + /// [App Engine + /// documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). + #[serde(rename="retryConfig")] + pub retry_config: Option, +} + +impl RequestValue for Queue {} +impl ResponseResult for Queue {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **JSON Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// **YAML Example** +/// +/// bindings: +/// - members: +/// - user:mike@example.com +/// - group:admins@example.com +/// - domain:google.com +/// - serviceAccount:my-other-app@appspot.gserviceaccount.com +/// role: roles/owner +/// - members: +/// - user:sean@example.com +/// role: roles/viewer +/// +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam/docs). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues set iam policy projects](struct.ProjectLocationQueueSetIamPolicyCall.html) (response) +/// * [locations queues get iam policy projects](struct.ProjectLocationQueueGetIamPolicyCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, + /// Deprecated. + pub version: Option, +} + +impl ResponseResult for Policy {} + + +/// A unit of scheduled work. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues tasks run projects](struct.ProjectLocationQueueTaskRunCall.html) (response) +/// * [locations queues tasks get projects](struct.ProjectLocationQueueTaskGetCall.html) (response) +/// * [locations queues tasks create projects](struct.ProjectLocationQueueTaskCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Task { + /// HTTP request that is sent to the App Engine app handler. + /// + /// An App Engine task is a task that has AppEngineHttpRequest set. + #[serde(rename="appEngineHttpRequest")] + pub app_engine_http_request: Option, + /// Output only. The status of the task's first attempt. + /// + /// Only dispatch_time will be set. + /// The other Attempt information is not retained by Cloud Tasks. + #[serde(rename="firstAttempt")] + pub first_attempt: Option, + /// Output only. The status of the task's last attempt. + #[serde(rename="lastAttempt")] + pub last_attempt: Option, + /// Optionally caller-specified in CreateTask. + /// + /// The task name. + /// + /// The task name must have the following format: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + /// + /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), colons (:), or periods (.). + /// For more information, see + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// * `LOCATION_ID` is the canonical ID for the task's location. + /// The list of available locations can be obtained by calling + /// ListLocations. + /// For more information, see https://cloud.google.com/about/locations/. + /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or + /// hyphens (-). The maximum length is 100 characters. + /// * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), or underscores (_). The maximum length is 500 characters. + pub name: Option, + /// The time when the task is scheduled to be attempted. + /// + /// For App Engine queues, this is when the task will be attempted or retried. + /// + /// `schedule_time` will be truncated to the nearest microsecond. + #[serde(rename="scheduleTime")] + pub schedule_time: Option, + /// The deadline for requests sent to the worker. If the worker does not + /// respond by this deadline then the request is cancelled and the attempt + /// is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the + /// task according to the RetryConfig. + /// + /// Note that when the request is cancelled, Cloud Tasks will stop listing for + /// the response, but whether the worker stops processing depends on the + /// worker. For example, if the worker is stuck, it may not react to cancelled + /// requests. + /// + /// The default and maximum values depend on the type of request: + /// + /// + /// * For App Engine tasks, 0 indicates that the + /// request has the default deadline. The default deadline depends on the + /// [scaling + /// type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling) + /// of the service: 10 minutes for standard apps with automatic scaling, 24 + /// hours for standard apps with manual and basic scaling, and 60 minutes for + /// flex apps. If the request deadline is set, it must be in the interval [15 + /// seconds, 24 hours 15 seconds]. Regardless of the task's + /// `dispatch_deadline`, the app handler will not run for longer than than + /// the service's timeout. We recommend setting the `dispatch_deadline` to + /// at most a few seconds more than the app handler's timeout. For more + /// information see + /// [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts). + /// + /// `dispatch_deadline` will be truncated to the nearest millisecond. The + /// deadline is an approximate deadline. + #[serde(rename="dispatchDeadline")] + pub dispatch_deadline: Option, + /// Output only. The number of attempts which have received a response. + #[serde(rename="responseCount")] + pub response_count: Option, + /// Output only. The time that the task was created. + /// + /// `create_time` will be truncated to the nearest second. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. The number of attempts dispatched. + /// + /// This count includes attempts which have been dispatched but haven't + /// received a response. + #[serde(rename="dispatchCount")] + pub dispatch_count: Option, + /// Output only. The view specifies which subset of the Task has + /// been returned. + pub view: Option, +} + +impl ResponseResult for Task {} + + +/// The response message for Locations.ListLocations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations list projects](struct.ProjectLocationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLocationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of locations that matches the specified filter in the request. + pub locations: Option>, +} + +impl ResponseResult for ListLocationsResponse {} + + +/// A resource that represents Google Cloud Platform location. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Location { + /// The friendly name for this location, typically a nearby city name. + /// For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, + /// Resource name for the location, which may vary between implementations. + /// For example: `"projects/example-project/locations/us-east1"` + pub name: Option, + /// Service-specific metadata. For example the available capacity at the given + /// location. + pub metadata: Option>, +} + +impl ResponseResult for Location {} + + +/// Request message for PurgeQueue. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues purge projects](struct.ProjectLocationQueuePurgeCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PurgeQueueRequest { _never_set: Option } + +impl RequestValue for PurgeQueueRequest {} + + +/// Request message for forcing a task to run now using +/// RunTask. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues tasks run projects](struct.ProjectLocationQueueTaskRunCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RunTaskRequest { + /// The response_view specifies which subset of the Task will be + /// returned. + /// + /// By default response_view is BASIC; not all + /// information is retrieved by default because some data, such as + /// payloads, might be desirable to return only when needed because + /// of its large size or because of the sensitivity of data that it + /// contains. + /// + /// Authorization for FULL requires + /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + /// permission on the Task resource. + #[serde(rename="responseView")] + pub response_view: Option, +} + +impl RequestValue for RunTaskRequest {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues delete projects](struct.ProjectLocationQueueDeleteCall.html) (response) +/// * [locations queues tasks delete projects](struct.ProjectLocationQueueTaskDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues test iam permissions projects](struct.ProjectLocationQueueTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestIamPermissionsResponse {} + + +/// Rate limits. +/// +/// This message determines the maximum rate that tasks can be dispatched by a +/// queue, regardless of whether the dispatch is a first task attempt or a retry. +/// +/// Note: The debugging command, RunTask, will run a task +/// even if the queue has reached its RateLimits. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RateLimits { + /// The maximum number of concurrent tasks that Cloud Tasks allows + /// to be dispatched for this queue. After this threshold has been + /// reached, Cloud Tasks stops dispatching tasks until the number of + /// concurrent requests decreases. + /// + /// If unspecified when the queue is created, Cloud Tasks will pick the + /// default. + /// + /// + /// The maximum allowed value is 5,000. + /// + /// + /// This field has the same meaning as + /// [max_concurrent_requests in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). + #[serde(rename="maxConcurrentDispatches")] + pub max_concurrent_dispatches: Option, + /// Output only. The max burst size. + /// + /// Max burst size limits how fast tasks in queue are processed when + /// many tasks are in the queue and the rate is high. This field + /// allows the queue to have a high rate so processing starts shortly + /// after a task is enqueued, but still limits resource usage when + /// many tasks are enqueued in a short period of time. + /// + /// The [token bucket](https://wikipedia.org/wiki/Token_Bucket) + /// algorithm is used to control the rate of task dispatches. Each + /// queue has a token bucket that holds tokens, up to the maximum + /// specified by `max_burst_size`. Each time a task is dispatched, a + /// token is removed from the bucket. Tasks will be dispatched until + /// the queue's bucket runs out of tokens. The bucket will be + /// continuously refilled with new tokens based on + /// max_dispatches_per_second. + /// + /// Cloud Tasks will pick the value of `max_burst_size` based on the + /// value of + /// max_dispatches_per_second. + /// + /// For App Engine queues that were created or updated using + /// `queue.yaml/xml`, `max_burst_size` is equal to + /// [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). + /// Since `max_burst_size` is output only, if + /// UpdateQueue is called on a queue + /// created by `queue.yaml/xml`, `max_burst_size` will be reset based + /// on the value of + /// max_dispatches_per_second, + /// regardless of whether + /// max_dispatches_per_second + /// is updated. + /// + #[serde(rename="maxBurstSize")] + pub max_burst_size: Option, + /// The maximum rate at which tasks are dispatched from this queue. + /// + /// If unspecified when the queue is created, Cloud Tasks will pick the + /// default. + /// + /// * For App Engine queues, the maximum allowed value + /// is 500. + /// + /// + /// This field has the same meaning as + /// [rate in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). + #[serde(rename="maxDispatchesPerSecond")] + pub max_dispatches_per_second: Option, +} + +impl Part for RateLimits {} + + +/// Request message for `SetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues set iam policy projects](struct.ProjectLocationQueueSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetIamPolicyRequest { + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. + pub policy: Option, +} + +impl RequestValue for SetIamPolicyRequest {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + +/// Request message for CreateTask. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues tasks create projects](struct.ProjectLocationQueueTaskCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateTaskRequest { + /// The response_view specifies which subset of the Task will be + /// returned. + /// + /// By default response_view is BASIC; not all + /// information is retrieved by default because some data, such as + /// payloads, might be desirable to return only when needed because + /// of its large size or because of the sensitivity of data that it + /// contains. + /// + /// Authorization for FULL requires + /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + /// permission on the Task resource. + #[serde(rename="responseView")] + pub response_view: Option, + /// Required. + /// + /// The task to add. + /// + /// Task names have the following format: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. + /// The user can optionally specify a task name. If a + /// name is not specified then the system will generate a random + /// unique task id, which will be set in the task returned in the + /// response. + /// + /// If schedule_time is not set or is in the + /// past then Cloud Tasks will set it to the current time. + /// + /// Task De-duplication: + /// + /// Explicitly specifying a task ID enables task de-duplication. If + /// a task's ID is identical to that of an existing task or a task + /// that was deleted or executed recently then the call will fail + /// with ALREADY_EXISTS. + /// If the task's queue was created using Cloud Tasks, then another task with + /// the same name can't be created for ~1hour after the original task was + /// deleted or executed. If the task's queue was created using queue.yaml or + /// queue.xml, then another task with the same name can't be created + /// for ~9days after the original task was deleted or executed. + /// + /// Because there is an extra lookup cost to identify duplicate task + /// names, these CreateTask calls have significantly + /// increased latency. Using hashed strings for the task id or for + /// the prefix of the task id is recommended. Choosing task ids that + /// are sequential or have sequential prefixes, for example using a + /// timestamp, causes an increase in latency and error rates in all + /// task commands. The infrastructure relies on an approximately + /// uniform distribution of task ids to store and serve tasks + /// efficiently. + pub task: Option, +} + +impl RequestValue for CreateTaskRequest {} + + +/// Request message for ResumeQueue. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues resume projects](struct.ProjectLocationQueueResumeCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResumeQueueRequest { _never_set: Option } + +impl RequestValue for ResumeQueueRequest {} + + +/// Response message for ListQueues. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues list projects](struct.ProjectLocationQueueListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListQueuesResponse { + /// A token to retrieve next page of results. + /// + /// To return the next page of results, call + /// ListQueues with this value as the + /// page_token. + /// + /// If the next_page_token is empty, there are no more results. + /// + /// The page token is valid for only 2 hours. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of queues. + pub queues: Option>, +} + +impl ResponseResult for ListQueuesResponse {} + + +/// App Engine Routing. +/// +/// Defines routing characteristics specific to App Engine - service, version, +/// and instance. +/// +/// For more information about services, versions, and instances see +/// [An Overview of App +/// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), +/// [Microservices Architecture on Google App +/// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), +/// [App Engine Standard request +/// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), +/// and [App Engine Flex request +/// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AppEngineRouting { + /// App instance. + /// + /// By default, the task is sent to an instance which is available when + /// the task is attempted. + /// + /// Requests can only be sent to a specific instance if + /// [manual scaling is used in App Engine + /// Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). + /// App Engine Flex does not support instances. For more information, see + /// [App Engine Standard request + /// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) + /// and [App Engine Flex request + /// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). + pub instance: Option, + /// Output only. The host that the task is sent to. + /// + /// The host is constructed from the domain name of the app associated with + /// the queue's project ID (for example .appspot.com), and the + /// service, version, + /// and instance. Tasks which were created using + /// the App Engine SDK might have a custom domain name. + /// + /// For more information, see + /// [How Requests are + /// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). + pub host: Option, + /// App version. + /// + /// By default, the task is sent to the version which is the default + /// version when the task is attempted. + /// + /// For some queues or tasks which were created using the App Engine + /// Task Queue API, host is not parsable + /// into service, + /// version, and + /// instance. For example, some tasks + /// which were created using the App Engine SDK use a custom domain + /// name; custom domains are not parsed by Cloud Tasks. If + /// host is not parsable, then + /// service, + /// version, and + /// instance are the empty string. + pub version: Option, + /// App service. + /// + /// By default, the task is sent to the service which is the default + /// service when the task is attempted. + /// + /// For some queues or tasks which were created using the App Engine + /// Task Queue API, host is not parsable + /// into service, + /// version, and + /// instance. For example, some tasks + /// which were created using the App Engine SDK use a custom domain + /// name; custom domains are not parsed by Cloud Tasks. If + /// host is not parsable, then + /// service, + /// version, and + /// instance are the empty string. + pub service: Option, +} + +impl Part for AppEngineRouting {} + + +/// Retry config. +/// +/// These settings determine when a failed task attempt is retried. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RetryConfig { + /// A task will be scheduled for retry between + /// min_backoff and + /// max_backoff duration after it fails, + /// if the queue's RetryConfig specifies that the task should be + /// retried. + /// + /// If unspecified when the queue is created, Cloud Tasks will pick the + /// default. + /// + /// + /// `max_backoff` will be truncated to the nearest second. + /// + /// This field has the same meaning as + /// [max_backoff_seconds in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + #[serde(rename="maxBackoff")] + pub max_backoff: Option, + /// Number of attempts per task. + /// + /// Cloud Tasks will attempt the task `max_attempts` times (that is, if the + /// first attempt fails, then there will be `max_attempts - 1` retries). Must + /// be >= -1. + /// + /// If unspecified when the queue is created, Cloud Tasks will pick the + /// default. + /// + /// -1 indicates unlimited attempts. + /// + /// This field has the same meaning as + /// [task_retry_limit in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + #[serde(rename="maxAttempts")] + pub max_attempts: Option, + /// The time between retries will double `max_doublings` times. + /// + /// A task's retry interval starts at + /// min_backoff, then doubles + /// `max_doublings` times, then increases linearly, and finally + /// retries retries at intervals of + /// max_backoff up to + /// max_attempts times. + /// + /// For example, if min_backoff is 10s, + /// max_backoff is 300s, and + /// `max_doublings` is 3, then the a task will first be retried in + /// 10s. The retry interval will double three times, and then + /// increase linearly by 2^3 * 10s. Finally, the task will retry at + /// intervals of max_backoff until the + /// task has been attempted max_attempts + /// times. Thus, the requests will retry at 10s, 20s, 40s, 80s, 160s, + /// 240s, 300s, 300s, .... + /// + /// If unspecified when the queue is created, Cloud Tasks will pick the + /// default. + /// + /// + /// This field has the same meaning as + /// [max_doublings in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + #[serde(rename="maxDoublings")] + pub max_doublings: Option, + /// If positive, `max_retry_duration` specifies the time limit for + /// retrying a failed task, measured from when the task was first + /// attempted. Once `max_retry_duration` time has passed *and* the + /// task has been attempted max_attempts + /// times, no further attempts will be made and the task will be + /// deleted. + /// + /// If zero, then the task age is unlimited. + /// + /// If unspecified when the queue is created, Cloud Tasks will pick the + /// default. + /// + /// + /// `max_retry_duration` will be truncated to the nearest second. + /// + /// This field has the same meaning as + /// [task_age_limit in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + #[serde(rename="maxRetryDuration")] + pub max_retry_duration: Option, + /// A task will be scheduled for retry between + /// min_backoff and + /// max_backoff duration after it fails, + /// if the queue's RetryConfig specifies that the task should be + /// retried. + /// + /// If unspecified when the queue is created, Cloud Tasks will pick the + /// default. + /// + /// + /// `min_backoff` will be truncated to the nearest second. + /// + /// This field has the same meaning as + /// [min_backoff_seconds in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + #[serde(rename="minBackoff")] + pub min_backoff: Option, +} + +impl Part for RetryConfig {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `CloudTasks` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_cloudtasks2 as cloudtasks2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use cloudtasks2::CloudTasks; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `locations_get(...)`, `locations_list(...)`, `locations_queues_create(...)`, `locations_queues_delete(...)`, `locations_queues_get(...)`, `locations_queues_get_iam_policy(...)`, `locations_queues_list(...)`, `locations_queues_patch(...)`, `locations_queues_pause(...)`, `locations_queues_purge(...)`, `locations_queues_resume(...)`, `locations_queues_set_iam_policy(...)`, `locations_queues_tasks_create(...)`, `locations_queues_tasks_delete(...)`, `locations_queues_tasks_get(...)`, `locations_queues_tasks_list(...)`, `locations_queues_tasks_run(...)` and `locations_queues_test_iam_permissions(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Forces a task to run now. + /// + /// When this method is called, Cloud Tasks will dispatch the task, even if + /// the task is already running, the queue has reached its RateLimits or + /// is PAUSED. + /// + /// This command is meant to be used for manual debugging. For + /// example, RunTask can be used to retry a failed + /// task after a fix has been made or to manually force a task to be + /// dispatched now. + /// + /// The dispatched task is returned. That is, the task that is returned + /// contains the status after the task is dispatched but + /// before the task is received by its target. + /// + /// If Cloud Tasks receives a successful response from the task's + /// target, then the task will be deleted; otherwise the task's + /// schedule_time will be reset to the time that + /// RunTask was called plus the retry delay specified + /// in the queue's RetryConfig. + /// + /// RunTask returns + /// NOT_FOUND when it is called on a + /// task that has already succeeded or permanently failed. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. + /// The task name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + pub fn locations_queues_tasks_run(&self, request: RunTaskRequest, name: &str) -> ProjectLocationQueueTaskRunCall<'a, C, A> { + ProjectLocationQueueTaskRunCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Pauses the queue. + /// + /// If a queue is paused then the system will stop dispatching tasks + /// until the queue is resumed via + /// ResumeQueue. Tasks can still be added + /// when the queue is paused. A queue is paused if its + /// state is PAUSED. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. + /// The queue name. For example: + /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + pub fn locations_queues_pause(&self, request: PauseQueueRequest, name: &str) -> ProjectLocationQueuePauseCall<'a, C, A> { + ProjectLocationQueuePauseCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a task. + /// + /// # Arguments + /// + /// * `name` - Required. + /// The task name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + pub fn locations_queues_tasks_get(&self, name: &str) -> ProjectLocationQueueTaskGetCall<'a, C, A> { + ProjectLocationQueueTaskGetCall { + hub: self.hub, + _name: name.to_string(), + _response_view: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the tasks in a queue. + /// + /// By default, only the BASIC view is retrieved + /// due to performance considerations; + /// response_view controls the + /// subset of information which is returned. + /// + /// The tasks may be returned in any order. The ordering may change at any + /// time. + /// + /// # Arguments + /// + /// * `parent` - Required. + /// The queue name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + pub fn locations_queues_tasks_list(&self, parent: &str) -> ProjectLocationQueueTaskListCall<'a, C, A> { + ProjectLocationQueueTaskListCall { + hub: self.hub, + _parent: parent.to_string(), + _response_view: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Resume a queue. + /// + /// This method resumes a queue after it has been + /// PAUSED or + /// DISABLED. The state of a queue is stored + /// in the queue's state; after calling this method it + /// will be set to RUNNING. + /// + /// WARNING: Resuming many high-QPS queues at the same time can + /// lead to target overloading. If you are resuming high-QPS + /// queues, follow the 500/50/5 pattern described in + /// [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. + /// The queue name. For example: + /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + pub fn locations_queues_resume(&self, request: ResumeQueueRequest, name: &str) -> ProjectLocationQueueResumeCall<'a, C, A> { + ProjectLocationQueueResumeCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy for a Queue. Replaces any existing + /// policy. + /// + /// Note: The Cloud Console does not check queue-level IAM permissions yet. + /// Project-level permissions are required to use the Cloud Console. + /// + /// Authorization requires the following + /// [Google IAM](https://cloud.google.com/iam) permission on the specified + /// resource parent: + /// + /// * `cloudtasks.queues.setIamPolicy` + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_queues_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectLocationQueueSetIamPolicyCall<'a, C, A> { + ProjectLocationQueueSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a queue. + /// + /// This method creates the queue if it does not exist and updates + /// the queue if it does exist. + /// + /// Queues created with this method allow tasks to live for a maximum of 31 + /// days. After a task is 31 days old, the task will be deleted regardless of whether + /// it was dispatched or not. + /// + /// WARNING: Using this method may have unintended side effects if you are + /// using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + /// Read + /// [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + /// before using this method. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Caller-specified and required in CreateQueue, + /// after which it becomes output only. + /// The queue name. + /// The queue name must have the following format: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), colons (:), or periods (.). + /// For more information, see + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// * `LOCATION_ID` is the canonical ID for the queue's location. + /// The list of available locations can be obtained by calling + /// ListLocations. + /// For more information, see https://cloud.google.com/about/locations/. + /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or + /// hyphens (-). The maximum length is 100 characters. + pub fn locations_queues_patch(&self, request: Queue, name: &str) -> ProjectLocationQueuePatchCall<'a, C, A> { + ProjectLocationQueuePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a Queue. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. + /// + /// Authorization requires the following + /// [Google IAM](https://cloud.google.com/iam) permission on the specified + /// resource parent: + /// + /// * `cloudtasks.queues.getIamPolicy` + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_queues_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectLocationQueueGetIamPolicyCall<'a, C, A> { + ProjectLocationQueueGetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a queue. + /// + /// Queues created with this method allow tasks to live for a maximum of 31 + /// days. After a task is 31 days old, the task will be deleted regardless of whether + /// it was dispatched or not. + /// + /// WARNING: Using this method may have unintended side effects if you are + /// using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + /// Read + /// [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + /// before using this method. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. + /// The location name in which the queue will be created. + /// For example: `projects/PROJECT_ID/locations/LOCATION_ID` + /// The list of allowed locations can be obtained by calling Cloud + /// Tasks' implementation of + /// ListLocations. + pub fn locations_queues_create(&self, request: Queue, parent: &str) -> ProjectLocationQueueCreateCall<'a, C, A> { + ProjectLocationQueueCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a queue. + /// + /// This command will delete the queue even if it has tasks in it. + /// + /// Note: If you delete a queue, a queue with the same name can't be created + /// for 7 days. + /// + /// WARNING: Using this method may have unintended side effects if you are + /// using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. + /// Read + /// [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) + /// before using this method. + /// + /// # Arguments + /// + /// * `name` - Required. + /// The queue name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + pub fn locations_queues_delete(&self, name: &str) -> ProjectLocationQueueDeleteCall<'a, C, A> { + ProjectLocationQueueDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists information about the supported locations for this service. + /// + /// # Arguments + /// + /// * `name` - The resource that owns the locations collection, if applicable. + pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C, A> { + ProjectLocationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists queues. + /// + /// Queues are returned in lexicographical order. + /// + /// # Arguments + /// + /// * `parent` - Required. + /// The location name. + /// For example: `projects/PROJECT_ID/locations/LOCATION_ID` + pub fn locations_queues_list(&self, parent: &str) -> ProjectLocationQueueListCall<'a, C, A> { + ProjectLocationQueueListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on a Queue. + /// If the resource does not exist, this will return an empty set of + /// permissions, not a NOT_FOUND error. + /// + /// Note: This operation is designed to be used for building permission-aware + /// UIs and command-line tools, not for authorization checking. This operation + /// may "fail open" without warning. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_queues_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectLocationQueueTestIamPermissionCall<'a, C, A> { + ProjectLocationQueueTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a location. + /// + /// # Arguments + /// + /// * `name` - Resource name for the location. + pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C, A> { + ProjectLocationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a queue. + /// + /// # Arguments + /// + /// * `name` - Required. + /// The resource name of the queue. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + pub fn locations_queues_get(&self, name: &str) -> ProjectLocationQueueGetCall<'a, C, A> { + ProjectLocationQueueGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Purges a queue by deleting all of its tasks. + /// + /// All tasks created before this method is called are permanently deleted. + /// + /// Purge operations can take up to one minute to take effect. Tasks + /// might be dispatched before the purge takes effect. A purge is irreversible. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. + /// The queue name. For example: + /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + pub fn locations_queues_purge(&self, request: PurgeQueueRequest, name: &str) -> ProjectLocationQueuePurgeCall<'a, C, A> { + ProjectLocationQueuePurgeCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a task and adds it to a queue. + /// + /// Tasks cannot be updated after creation; there is no UpdateTask command. + /// + /// * For App Engine queues, the maximum task size is + /// 100KB. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. + /// The queue name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + /// The queue must already exist. + pub fn locations_queues_tasks_create(&self, request: CreateTaskRequest, parent: &str) -> ProjectLocationQueueTaskCreateCall<'a, C, A> { + ProjectLocationQueueTaskCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a task. + /// + /// A task can be deleted if it is scheduled or dispatched. A task + /// cannot be deleted if it has executed successfully or permanently + /// failed. + /// + /// # Arguments + /// + /// * `name` - Required. + /// The task name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + pub fn locations_queues_tasks_delete(&self, name: &str) -> ProjectLocationQueueTaskDeleteCall<'a, C, A> { + ProjectLocationQueueTaskDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Forces a task to run now. +/// +/// When this method is called, Cloud Tasks will dispatch the task, even if +/// the task is already running, the queue has reached its RateLimits or +/// is PAUSED. +/// +/// This command is meant to be used for manual debugging. For +/// example, RunTask can be used to retry a failed +/// task after a fix has been made or to manually force a task to be +/// dispatched now. +/// +/// The dispatched task is returned. That is, the task that is returned +/// contains the status after the task is dispatched but +/// before the task is received by its target. +/// +/// If Cloud Tasks receives a successful response from the task's +/// target, then the task will be deleted; otherwise the task's +/// schedule_time will be reset to the time that +/// RunTask was called plus the retry delay specified +/// in the queue's RetryConfig. +/// +/// RunTask returns +/// NOT_FOUND when it is called on a +/// task that has already succeeded or permanently failed. +/// +/// A builder for the *locations.queues.tasks.run* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::RunTaskRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RunTaskRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_tasks_run(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueTaskRunCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _request: RunTaskRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueTaskRunCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Task)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.tasks.run", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:run"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RunTaskRequest) -> ProjectLocationQueueTaskRunCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The task name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationQueueTaskRunCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueTaskRunCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTaskRunCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueTaskRunCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Pauses the queue. +/// +/// If a queue is paused then the system will stop dispatching tasks +/// until the queue is resumed via +/// ResumeQueue. Tasks can still be added +/// when the queue is paused. A queue is paused if its +/// state is PAUSED. +/// +/// A builder for the *locations.queues.pause* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::PauseQueueRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PauseQueueRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_pause(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueuePauseCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _request: PauseQueueRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueuePauseCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Queue)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.pause", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:pause"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PauseQueueRequest) -> ProjectLocationQueuePauseCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The queue name. For example: + /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationQueuePauseCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueuePauseCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueuePauseCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueuePauseCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a task. +/// +/// A builder for the *locations.queues.tasks.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_tasks_get("name") +/// .response_view("justo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueTaskGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _name: String, + _response_view: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueTaskGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Task)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.tasks.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._response_view { + params.push(("responseView", value.to_string())); + } + for &field in ["alt", "name", "responseView"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The task name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationQueueTaskGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The response_view specifies which subset of the Task will be + /// returned. + /// + /// By default response_view is BASIC; not all + /// information is retrieved by default because some data, such as + /// payloads, might be desirable to return only when needed because + /// of its large size or because of the sensitivity of data that it + /// contains. + /// + /// Authorization for FULL requires + /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + /// permission on the Task resource. + /// + /// Sets the *response view* query property to the given value. + pub fn response_view(mut self, new_value: &str) -> ProjectLocationQueueTaskGetCall<'a, C, A> { + self._response_view = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueTaskGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTaskGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueTaskGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists the tasks in a queue. +/// +/// By default, only the BASIC view is retrieved +/// due to performance considerations; +/// response_view controls the +/// subset of information which is returned. +/// +/// The tasks may be returned in any order. The ordering may change at any +/// time. +/// +/// A builder for the *locations.queues.tasks.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_tasks_list("parent") +/// .response_view("erat") +/// .page_token("labore") +/// .page_size(-9) +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueTaskListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _parent: String, + _response_view: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueTaskListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListTasksResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.tasks.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._response_view { + params.push(("responseView", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "responseView", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/tasks"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The queue name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationQueueTaskListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The response_view specifies which subset of the Task will be + /// returned. + /// + /// By default response_view is BASIC; not all + /// information is retrieved by default because some data, such as + /// payloads, might be desirable to return only when needed because + /// of its large size or because of the sensitivity of data that it + /// contains. + /// + /// Authorization for FULL requires + /// `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + /// permission on the Task resource. + /// + /// Sets the *response view* query property to the given value. + pub fn response_view(mut self, new_value: &str) -> ProjectLocationQueueTaskListCall<'a, C, A> { + self._response_view = Some(new_value.to_string()); + self + } + /// A token identifying the page of results to return. + /// + /// To request the first page results, page_token must be empty. To + /// request the next page of results, page_token must be the value of + /// next_page_token returned + /// from the previous call to ListTasks + /// method. + /// + /// The page token is valid for only 2 hours. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationQueueTaskListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Requested page size. Fewer tasks than requested might be returned. + /// + /// The maximum page size is 1000. If unspecified, the page size will + /// be the maximum. Fewer tasks than requested might be returned, + /// even if more tasks exist; use + /// next_page_token in the + /// response to determine if more tasks exist. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationQueueTaskListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueTaskListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTaskListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueTaskListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Resume a queue. +/// +/// This method resumes a queue after it has been +/// PAUSED or +/// DISABLED. The state of a queue is stored +/// in the queue's state; after calling this method it +/// will be set to RUNNING. +/// +/// WARNING: Resuming many high-QPS queues at the same time can +/// lead to target overloading. If you are resuming high-QPS +/// queues, follow the 500/50/5 pattern described in +/// [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). +/// +/// A builder for the *locations.queues.resume* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::ResumeQueueRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ResumeQueueRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_resume(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueResumeCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _request: ResumeQueueRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueResumeCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Queue)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.resume", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:resume"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ResumeQueueRequest) -> ProjectLocationQueueResumeCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The queue name. For example: + /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationQueueResumeCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueResumeCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueResumeCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueResumeCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy for a Queue. Replaces any existing +/// policy. +/// +/// Note: The Cloud Console does not check queue-level IAM permissions yet. +/// Project-level permissions are required to use the Cloud Console. +/// +/// Authorization requires the following +/// [Google IAM](https://cloud.google.com/iam) permission on the specified +/// resource parent: +/// +/// * `cloudtasks.queues.setIamPolicy` +/// +/// A builder for the *locations.queues.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectLocationQueueSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationQueueSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a queue. +/// +/// This method creates the queue if it does not exist and updates +/// the queue if it does exist. +/// +/// Queues created with this method allow tasks to live for a maximum of 31 +/// days. After a task is 31 days old, the task will be deleted regardless of whether +/// it was dispatched or not. +/// +/// WARNING: Using this method may have unintended side effects if you are +/// using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. +/// Read +/// [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) +/// before using this method. +/// +/// A builder for the *locations.queues.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::Queue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Queue::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_patch(req, "name") +/// .update_mask("sadipscing") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueuePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _request: Queue, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueuePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Queue)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Queue) -> ProjectLocationQueuePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Caller-specified and required in CreateQueue, + /// after which it becomes output only. + /// + /// The queue name. + /// + /// The queue name must have the following format: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + /// + /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), colons (:), or periods (.). + /// For more information, see + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// * `LOCATION_ID` is the canonical ID for the queue's location. + /// The list of available locations can be obtained by calling + /// ListLocations. + /// For more information, see https://cloud.google.com/about/locations/. + /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or + /// hyphens (-). The maximum length is 100 characters. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationQueuePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// A mask used to specify which fields of the queue are being updated. + /// + /// If empty, then all fields will be updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectLocationQueuePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueuePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueuePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueuePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy for a Queue. +/// Returns an empty policy if the resource exists and does not have a policy +/// set. +/// +/// Authorization requires the following +/// [Google IAM](https://cloud.google.com/iam) permission on the specified +/// resource parent: +/// +/// * `cloudtasks.queues.getIamPolicy` +/// +/// A builder for the *locations.queues.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::GetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_get_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _request: GetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.getIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectLocationQueueGetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationQueueGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a queue. +/// +/// Queues created with this method allow tasks to live for a maximum of 31 +/// days. After a task is 31 days old, the task will be deleted regardless of whether +/// it was dispatched or not. +/// +/// WARNING: Using this method may have unintended side effects if you are +/// using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. +/// Read +/// [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) +/// before using this method. +/// +/// A builder for the *locations.queues.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::Queue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Queue::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _request: Queue, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Queue)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/queues"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Queue) -> ProjectLocationQueueCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The location name in which the queue will be created. + /// For example: `projects/PROJECT_ID/locations/LOCATION_ID` + /// + /// The list of allowed locations can be obtained by calling Cloud + /// Tasks' implementation of + /// ListLocations. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationQueueCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a queue. +/// +/// This command will delete the queue even if it has tasks in it. +/// +/// Note: If you delete a queue, a queue with the same name can't be created +/// for 7 days. +/// +/// WARNING: Using this method may have unintended side effects if you are +/// using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. +/// Read +/// [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) +/// before using this method. +/// +/// A builder for the *locations.queues.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The queue name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationQueueDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists information about the supported locations for this service. +/// +/// A builder for the *locations.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_list("name") +/// .page_token("justo") +/// .page_size(-34) +/// .filter("et") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLocationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}/locations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource that owns the locations collection, if applicable. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists queues. +/// +/// Queues are returned in lexicographical order. +/// +/// A builder for the *locations.queues.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_list("parent") +/// .page_token("ipsum") +/// .page_size(-5) +/// .filter("et") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListQueuesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/queues"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The location name. + /// For example: `projects/PROJECT_ID/locations/LOCATION_ID` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationQueueListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A token identifying the page of results to return. + /// + /// To request the first page results, page_token must be empty. To + /// request the next page of results, page_token must be the value of + /// next_page_token returned + /// from the previous call to ListQueues + /// method. It is an error to switch the value of the + /// filter while iterating through pages. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationQueueListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Requested page size. + /// + /// The maximum page size is 9800. If unspecified, the page size will + /// be the maximum. Fewer queues than requested might be returned, + /// even if more queues exist; use the + /// next_page_token in the + /// response to determine if more queues exist. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationQueueListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// `filter` can be used to specify a subset of queues. Any Queue + /// field can be used as a filter and several operators as supported. + /// For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as + /// described in + /// [Stackdriver's Advanced Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). + /// + /// Sample filter "state: PAUSED". + /// + /// Note that using filters might cause fewer queues than the + /// requested page_size to be returned. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationQueueListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on a Queue. +/// If the resource does not exist, this will return an empty set of +/// permissions, not a NOT_FOUND error. +/// +/// Note: This operation is designed to be used for building permission-aware +/// UIs and command-line tools, not for authorization checking. This operation +/// may "fail open" without warning. +/// +/// A builder for the *locations.queues.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectLocationQueueTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationQueueTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information about a location. +/// +/// A builder for the *locations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name for the location. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a queue. +/// +/// A builder for the *locations.queues.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Queue)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The resource name of the queue. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationQueueGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Purges a queue by deleting all of its tasks. +/// +/// All tasks created before this method is called are permanently deleted. +/// +/// Purge operations can take up to one minute to take effect. Tasks +/// might be dispatched before the purge takes effect. A purge is irreversible. +/// +/// A builder for the *locations.queues.purge* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::PurgeQueueRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PurgeQueueRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_purge(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueuePurgeCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _request: PurgeQueueRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueuePurgeCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Queue)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.purge", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:purge"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PurgeQueueRequest) -> ProjectLocationQueuePurgeCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The queue name. For example: + /// `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationQueuePurgeCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueuePurgeCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueuePurgeCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueuePurgeCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a task and adds it to a queue. +/// +/// Tasks cannot be updated after creation; there is no UpdateTask command. +/// +/// * For App Engine queues, the maximum task size is +/// 100KB. +/// +/// A builder for the *locations.queues.tasks.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// use cloudtasks2::CreateTaskRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreateTaskRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_tasks_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueTaskCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _request: CreateTaskRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueTaskCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Task)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.tasks.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/tasks"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreateTaskRequest) -> ProjectLocationQueueTaskCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The queue name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + /// + /// The queue must already exist. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationQueueTaskCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueTaskCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTaskCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueTaskCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a task. +/// +/// A task can be deleted if it is scheduled or dispatched. A task +/// cannot be deleted if it has executed successfully or permanently +/// failed. +/// +/// A builder for the *locations.queues.tasks.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_cloudtasks2 as cloudtasks2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use cloudtasks2::CloudTasks; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTasks::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_queues_tasks_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationQueueTaskDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTasks, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationQueueTaskDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "cloudtasks.projects.locations.queues.tasks.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The task name. For example: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationQueueTaskDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationQueueTaskDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTaskDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationQueueTaskDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/cloudtasks2_beta2-cli/Cargo.toml b/gen/cloudtasks2_beta2-cli/Cargo.toml index 526564a541..02f9c47b60 100644 --- a/gen/cloudtasks2_beta2-cli/Cargo.toml +++ b/gen/cloudtasks2_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudtasks2_beta2-cli" -version = "1.0.8+20180913" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Tasks (protocol v2beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtasks2_beta2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudtasks2_beta2] path = "../cloudtasks2_beta2" -version = "1.0.8+20180913" +version = "1.0.8+20190326" diff --git a/gen/cloudtasks2_beta2-cli/README.md b/gen/cloudtasks2_beta2-cli/README.md index a6f189271b..7487dad08b 100644 --- a/gen/cloudtasks2_beta2-cli/README.md +++ b/gen/cloudtasks2_beta2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Tasks* API at revision *20180913*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Tasks* API at revision *20190326*. The CLI is at version *1.0.8*. ```bash cloudtasks2-beta2 [options] diff --git a/gen/cloudtasks2_beta2-cli/mkdocs.yml b/gen/cloudtasks2_beta2-cli/mkdocs.yml index 4e7ab1863d..92f52bd83b 100644 --- a/gen/cloudtasks2_beta2-cli/mkdocs.yml +++ b/gen/cloudtasks2_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Tasks v1.0.8+20180913 +site_name: Cloud Tasks v1.0.8+20190326 site_url: http://byron.github.io/google-apis-rs/google-cloudtasks2_beta2-cli site_description: A complete library to interact with Cloud Tasks (protocol v2beta2) diff --git a/gen/cloudtasks2_beta2-cli/src/main.rs b/gen/cloudtasks2_beta2-cli/src/main.rs index 486362a454..b97dfc3bce 100644 --- a/gen/cloudtasks2_beta2-cli/src/main.rs +++ b/gen/cloudtasks2_beta2-cli/src/main.rs @@ -1148,27 +1148,27 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "response-view" => Some(("responseView", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.status.last-attempt-status.schedule-time" => Some(("task.status.lastAttemptStatus.scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.status.last-attempt-status.dispatch-time" => Some(("task.status.lastAttemptStatus.dispatchTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.status.last-attempt-status.response-time" => Some(("task.status.lastAttemptStatus.responseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.status.last-attempt-status.response-status.message" => Some(("task.status.lastAttemptStatus.responseStatus.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.status.last-attempt-status.response-status.code" => Some(("task.status.lastAttemptStatus.responseStatus.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "task.status.last-attempt-status.response-time" => Some(("task.status.lastAttemptStatus.responseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "task.status.last-attempt-status.dispatch-time" => Some(("task.status.lastAttemptStatus.dispatchTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.status.first-attempt-status.schedule-time" => Some(("task.status.firstAttemptStatus.scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.status.first-attempt-status.dispatch-time" => Some(("task.status.firstAttemptStatus.dispatchTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.status.first-attempt-status.response-time" => Some(("task.status.firstAttemptStatus.responseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.status.first-attempt-status.response-status.message" => Some(("task.status.firstAttemptStatus.responseStatus.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.status.first-attempt-status.response-status.code" => Some(("task.status.firstAttemptStatus.responseStatus.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "task.status.first-attempt-status.response-time" => Some(("task.status.firstAttemptStatus.responseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "task.status.first-attempt-status.dispatch-time" => Some(("task.status.firstAttemptStatus.dispatchTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.status.attempt-dispatch-count" => Some(("task.status.attemptDispatchCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "task.status.attempt-response-count" => Some(("task.status.attemptResponseCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "task.pull-message.tag" => Some(("task.pullMessage.tag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.pull-message.payload" => Some(("task.pullMessage.payload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.app-engine-http-request.relative-url" => Some(("task.appEngineHttpRequest.relativeUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "task.app-engine-http-request.http-method" => Some(("task.appEngineHttpRequest.httpMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.app-engine-http-request.headers" => Some(("task.appEngineHttpRequest.headers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "task.app-engine-http-request.app-engine-routing.instance" => Some(("task.appEngineHttpRequest.appEngineRouting.instance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.app-engine-http-request.app-engine-routing.host" => Some(("task.appEngineHttpRequest.appEngineRouting.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.app-engine-http-request.app-engine-routing.version" => Some(("task.appEngineHttpRequest.appEngineRouting.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.app-engine-http-request.app-engine-routing.service" => Some(("task.appEngineHttpRequest.appEngineRouting.service", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.app-engine-http-request.payload" => Some(("task.appEngineHttpRequest.payload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "task.app-engine-http-request.headers" => Some(("task.appEngineHttpRequest.headers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "task.app-engine-http-request.http-method" => Some(("task.appEngineHttpRequest.httpMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.name" => Some(("task.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.schedule-time" => Some(("task.scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.create-time" => Some(("task.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2158,7 +2158,8 @@ fn main() { * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see - [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + [Identifying + projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * `LOCATION_ID` is the canonical ID for the queue's location. The list of available locations can be obtained by calling ListLocations. @@ -2730,7 +2731,7 @@ fn main() { let mut app = App::new("cloudtasks2-beta2") .author("Sebastian Thiel ") - .version("1.0.8+20180913") + .version("1.0.8+20190326") .about("Manages the execution of large numbers of distributed requests.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudtasks2_beta2_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudtasks2_beta2/Cargo.toml b/gen/cloudtasks2_beta2/Cargo.toml index 8d4db15197..8f586dee1a 100644 --- a/gen/cloudtasks2_beta2/Cargo.toml +++ b/gen/cloudtasks2_beta2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudtasks2_beta2" -version = "1.0.8+20180913" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Tasks (protocol v2beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtasks2_beta2" homepage = "https://cloud.google.com/tasks/" -documentation = "https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913" +documentation = "https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326" license = "MIT" keywords = ["cloudtasks", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudtasks2_beta2/README.md b/gen/cloudtasks2_beta2/README.md index c9124cc10b..0076e4bdb7 100644 --- a/gen/cloudtasks2_beta2/README.md +++ b/gen/cloudtasks2_beta2/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-cloudtasks2_beta2` library allows access to all features of the *Google Cloud Tasks* service. -This documentation was generated from *Cloud Tasks* crate version *1.0.8+20180913*, where *20180913* is the exact revision of the *cloudtasks:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Tasks* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudtasks:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Tasks* *v2_beta2* API can be found at the [official documentation site](https://cloud.google.com/tasks/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.CloudTasks.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.CloudTasks.html) ... * projects - * [*locations get*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationListCall.html), [*locations queues create*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueCreateCall.html), [*locations queues delete*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueDeleteCall.html), [*locations queues get*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueGetCall.html), [*locations queues get iam policy*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueGetIamPolicyCall.html), [*locations queues list*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueListCall.html), [*locations queues patch*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueuePatchCall.html), [*locations queues pause*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueuePauseCall.html), [*locations queues purge*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueuePurgeCall.html), [*locations queues resume*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueResumeCall.html), [*locations queues set iam policy*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueSetIamPolicyCall.html), [*locations queues tasks acknowledge*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskAcknowledgeCall.html), [*locations queues tasks cancel lease*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskCancelLeaseCall.html), [*locations queues tasks create*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskCreateCall.html), [*locations queues tasks delete*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskDeleteCall.html), [*locations queues tasks get*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskGetCall.html), [*locations queues tasks lease*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskLeaseCall.html), [*locations queues tasks list*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskListCall.html), [*locations queues tasks renew lease*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskRenewLeaseCall.html), [*locations queues tasks run*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskRunCall.html) and [*locations queues test iam permissions*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.ProjectLocationQueueTestIamPermissionCall.html) + * [*locations get*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationListCall.html), [*locations queues create*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueCreateCall.html), [*locations queues delete*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueDeleteCall.html), [*locations queues get*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueGetCall.html), [*locations queues get iam policy*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueGetIamPolicyCall.html), [*locations queues list*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueListCall.html), [*locations queues patch*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueuePatchCall.html), [*locations queues pause*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueuePauseCall.html), [*locations queues purge*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueuePurgeCall.html), [*locations queues resume*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueResumeCall.html), [*locations queues set iam policy*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueSetIamPolicyCall.html), [*locations queues tasks acknowledge*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskAcknowledgeCall.html), [*locations queues tasks cancel lease*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskCancelLeaseCall.html), [*locations queues tasks create*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskCreateCall.html), [*locations queues tasks delete*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskDeleteCall.html), [*locations queues tasks get*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskGetCall.html), [*locations queues tasks lease*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskLeaseCall.html), [*locations queues tasks list*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskListCall.html), [*locations queues tasks renew lease*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskRenewLeaseCall.html), [*locations queues tasks run*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueTaskRunCall.html) and [*locations queues test iam permissions*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.ProjectLocationQueueTestIamPermissionCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/struct.CloudTasks.html)** +* **[Hub](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/struct.CloudTasks.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -136,17 +136,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -156,29 +156,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20180913/google_cloudtasks2_beta2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudtasks2_beta2/1.0.8+20190326/google_cloudtasks2_beta2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudtasks2_beta2/src/lib.rs b/gen/cloudtasks2_beta2/src/lib.rs index 6ac9336956..94e67d7e12 100644 --- a/gen/cloudtasks2_beta2/src/lib.rs +++ b/gen/cloudtasks2_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Tasks* crate version *1.0.8+20180913*, where *20180913* is the exact revision of the *cloudtasks:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Tasks* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudtasks:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Tasks* *v2_beta2* API can be found at the //! [official documentation site](https://cloud.google.com/tasks/). @@ -402,7 +402,8 @@ pub struct PullMessage { /// The tag must be less than 500 characters. /// /// SDK compatibility: Although the SDK allows tags to be either - /// string or [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), + /// string or + /// [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), /// only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 /// encoded, the tag will be empty when the task is returned by Cloud Tasks. pub tag: Option, @@ -430,9 +431,16 @@ impl Part for PullMessage {} /// /// The task will be delivered to the App Engine app which belongs to the same /// project as the queue. For more information, see -/// [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) +/// [How Requests are +/// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) /// and how routing is affected by -/// [dispatch files](https://cloud.google.com/appengine/docs/python/config/dispatchref). +/// [dispatch +/// files](https://cloud.google.com/appengine/docs/python/config/dispatchref). +/// Traffic is encrypted during transport and never leaves Google datacenters. +/// Because this traffic is carried over a communication mechanism internal to +/// Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). +/// The request to the handler, however, will appear to have used the HTTP +/// protocol. /// /// The AppEngineRouting used to construct the URL that the task is /// delivered to can be set at the queue-level or task-level: @@ -449,6 +457,16 @@ impl Part for PullMessage {} /// * `url =` host `+` /// relative_url /// +/// Tasks can be dispatched to secure app handlers, unsecure app handlers, and +/// URIs restricted with +/// [`login: +/// admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). +/// Because tasks are not run as any user, they cannot be dispatched to URIs +/// restricted with +/// [`login: +/// required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) +/// Task dispatches also do not follow redirects. +/// /// The task attempt has succeeded if the app's request handler returns /// an HTTP response code in the range [`200` - `299`]. `503` is /// considered an App Engine system error instead of an application @@ -469,32 +487,6 @@ pub struct AppEngineHttpRequest { /// No spaces are allowed, and the maximum length allowed is 2083 characters. #[serde(rename="relativeUrl")] pub relative_url: Option, - /// The HTTP method to use for the request. The default is POST. - /// - /// The app's request handler for the task's target URL must be able to handle - /// HTTP requests with this http_method, otherwise the task attempt will fail - /// with error code 405 (Method Not Allowed). See - /// [Writing a push task request handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) - /// and the documentation for the request handlers in the language your app is - /// written in e.g. - /// [Python Request Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). - #[serde(rename="httpMethod")] - pub http_method: Option, - /// Task-level setting for App Engine routing. - /// - /// If set, - /// app_engine_routing_override - /// is used for all tasks in the queue, no matter what the setting is for the - /// task-level app_engine_routing. - #[serde(rename="appEngineRouting")] - pub app_engine_routing: Option, - /// Payload. - /// - /// The payload will be sent as the HTTP message body. A message - /// body, and thus a payload, is allowed only if the HTTP method is - /// POST or PUT. It is an error to set a data payload on a task with - /// an incompatible HttpMethod. - pub payload: Option, /// HTTP request headers. /// /// This map contains the header field names and values. @@ -529,7 +521,8 @@ pub struct AppEngineHttpRequest { /// /// In addition, Cloud Tasks sets some headers when the task is dispatched, /// such as headers containing information about the task; see - /// [request headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). + /// [request + /// headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). /// These headers are set only when the task is dispatched, so they are not /// visible when the task is returned in a Cloud Tasks response. /// @@ -537,6 +530,34 @@ pub struct AppEngineHttpRequest { /// the size, there is a limit on the maximum size of the Task. For more /// information, see the CreateTask documentation. pub headers: Option>, + /// Task-level setting for App Engine routing. + /// + /// If set, + /// app_engine_routing_override + /// is used for all tasks in the queue, no matter what the setting is for the + /// task-level app_engine_routing. + #[serde(rename="appEngineRouting")] + pub app_engine_routing: Option, + /// Payload. + /// + /// The payload will be sent as the HTTP message body. A message + /// body, and thus a payload, is allowed only if the HTTP method is + /// POST or PUT. It is an error to set a data payload on a task with + /// an incompatible HttpMethod. + pub payload: Option, + /// The HTTP method to use for the request. The default is POST. + /// + /// The app's request handler for the task's target URL must be able to handle + /// HTTP requests with this http_method, otherwise the task attempt will fail + /// with error code 405 (Method Not Allowed). See + /// [Writing a push task request + /// handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) + /// and the documentation for the request handlers in the language your app is + /// written in e.g. + /// [Python Request + /// Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). + #[serde(rename="httpMethod")] + pub http_method: Option, } impl Part for AppEngineHttpRequest {} @@ -553,22 +574,22 @@ pub struct AttemptStatus { /// `schedule_time` will be truncated to the nearest microsecond. #[serde(rename="scheduleTime")] pub schedule_time: Option, + /// Output only. The time that this attempt was dispatched. + /// + /// `dispatch_time` will be truncated to the nearest microsecond. + #[serde(rename="dispatchTime")] + pub dispatch_time: Option, + /// Output only. The time that this attempt response was received. + /// + /// `response_time` will be truncated to the nearest microsecond. + #[serde(rename="responseTime")] + pub response_time: Option, /// Output only. The response from the target for this attempt. /// /// If the task has not been attempted or the task is currently running /// then the response status is unset. #[serde(rename="responseStatus")] pub response_status: Option, - /// Output only. The time that this attempt response was received. - /// - /// `response_time` will be truncated to the nearest microsecond. - #[serde(rename="responseTime")] - pub response_time: Option, - /// Output only. The time that this attempt was dispatched. - /// - /// `dispatch_time` will be truncated to the nearest microsecond. - #[serde(rename="dispatchTime")] - pub dispatch_time: Option, } impl Part for AttemptStatus {} @@ -666,80 +687,138 @@ pub struct Policy { impl ResponseResult for Policy {} -/// A unit of scheduled work. +/// App Engine Routing. /// -/// # Activities +/// Defines routing characteristics specific to App Engine - service, version, +/// and instance. /// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// For more information about services, versions, and instances see +/// [An Overview of App +/// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), +/// [Microservices Architecture on Google App +/// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), +/// [App Engine Standard request +/// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), +/// and [App Engine Flex request +/// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). /// -/// * [locations queues tasks run projects](struct.ProjectLocationQueueTaskRunCall.html) (response) -/// * [locations queues tasks renew lease projects](struct.ProjectLocationQueueTaskRenewLeaseCall.html) (response) -/// * [locations queues tasks cancel lease projects](struct.ProjectLocationQueueTaskCancelLeaseCall.html) (response) -/// * [locations queues tasks get projects](struct.ProjectLocationQueueTaskGetCall.html) (response) -/// * [locations queues tasks create projects](struct.ProjectLocationQueueTaskCreateCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Task { - /// Output only. The task status. - pub status: Option, - /// LeaseTasks to process the task. Can be - /// set only if pull_target is set on the queue. +pub struct AppEngineRouting { + /// App instance. /// - /// A pull task is a task that has PullMessage set. - #[serde(rename="pullMessage")] - pub pull_message: Option, - /// App Engine HTTP request that is sent to the task's target. Can - /// be set only if - /// app_engine_http_target is set - /// on the queue. + /// By default, the task is sent to an instance which is available when + /// the task is attempted. /// - /// An App Engine task is a task that has AppEngineHttpRequest set. - #[serde(rename="appEngineHttpRequest")] - pub app_engine_http_request: Option, - /// Optionally caller-specified in CreateTask. + /// Requests can only be sent to a specific instance if + /// [manual scaling is used in App Engine + /// Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). + /// App Engine Flex does not support instances. For more information, see + /// [App Engine Standard request + /// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) + /// and [App Engine Flex request + /// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). + pub instance: Option, + /// Output only. The host that the task is sent to. /// - /// The task name. + /// For more information, see + /// [How Requests are + /// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). /// - /// The task name must have the following format: - /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + /// The host is constructed as: /// - /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), - /// hyphens (-), colons (:), or periods (.). - /// For more information, see - /// [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) - /// * `LOCATION_ID` is the canonical ID for the task's location. - /// The list of available locations can be obtained by calling - /// ListLocations. - /// For more information, see https://cloud.google.com/about/locations/. - /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or - /// hyphens (-). The maximum length is 100 characters. - /// * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), - /// hyphens (-), or underscores (_). The maximum length is 500 characters. - pub name: Option, - /// The time when the task is scheduled to be attempted. /// - /// For App Engine queues, this is when the task will be attempted or retried. + /// * `host = [application_domain_name]`
+ /// `| [service] + '.' + [application_domain_name]`
+ /// `| [version] + '.' + [application_domain_name]`
+ /// `| [version_dot_service]+ '.' + [application_domain_name]`
+ /// `| [instance] + '.' + [application_domain_name]`
+ /// `| [instance_dot_service] + '.' + [application_domain_name]`
+ /// `| [instance_dot_version] + '.' + [application_domain_name]`
+ /// `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` /// - /// For pull queues, this is the time when the task is available to - /// be leased; if a task is currently leased, this is the time when - /// the current lease expires, that is, the time that the task was - /// leased plus the lease_duration. + /// * `application_domain_name` = The domain name of the app, for + /// example .appspot.com, which is associated with the + /// queue's project ID. Some tasks which were created using the App Engine + /// SDK use a custom domain name. /// - /// `schedule_time` will be truncated to the nearest microsecond. - #[serde(rename="scheduleTime")] - pub schedule_time: Option, - /// Output only. The time that the task was created. + /// * `service =` service /// - /// `create_time` will be truncated to the nearest second. - #[serde(rename="createTime")] - pub create_time: Option, - /// Output only. The view specifies which subset of the Task has - /// been returned. - pub view: Option, + /// * `version =` version + /// + /// * `version_dot_service =` + /// version `+ '.' +` + /// service + /// + /// * `instance =` instance + /// + /// * `instance_dot_service =` + /// instance `+ '.' +` + /// service + /// + /// * `instance_dot_version =` + /// instance `+ '.' +` + /// version + /// + /// * `instance_dot_version_dot_service =` + /// instance `+ '.' +` + /// version `+ '.' +` + /// service + /// + /// If service is empty, then the task will be sent + /// to the service which is the default service when the task is attempted. + /// + /// If version is empty, then the task will be sent + /// to the version which is the default version when the task is attempted. + /// + /// If instance is empty, then the task + /// will be sent to an instance which is available when the task is + /// attempted. + /// + /// If service, + /// version, or + /// instance is invalid, then the task + /// will be sent to the default version of the default service when + /// the task is attempted. + pub host: Option, + /// App version. + /// + /// By default, the task is sent to the version which is the default + /// version when the task is attempted. + /// + /// For some queues or tasks which were created using the App Engine + /// Task Queue API, host is not parsable + /// into service, + /// version, and + /// instance. For example, some tasks + /// which were created using the App Engine SDK use a custom domain + /// name; custom domains are not parsed by Cloud Tasks. If + /// host is not parsable, then + /// service, + /// version, and + /// instance are the empty string. + pub version: Option, + /// App service. + /// + /// By default, the task is sent to the service which is the default + /// service when the task is attempted. + /// + /// For some queues or tasks which were created using the App Engine + /// Task Queue API, host is not parsable + /// into service, + /// version, and + /// instance. For example, some tasks + /// which were created using the App Engine SDK use a custom domain + /// name; custom domains are not parsed by Cloud Tasks. If + /// host is not parsable, then + /// service, + /// version, and + /// instance are the empty string. + pub service: Option, } -impl ResponseResult for Task {} +impl Part for AppEngineRouting {} /// The response message for Locations.ListLocations. @@ -774,17 +853,17 @@ impl ResponseResult for ListLocationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { - /// The canonical id for this location. For example: `"us-east1"`. - #[serde(rename="locationId")] - pub location_id: Option, - /// Cross-service attributes for the location. For example - /// - /// {"cloud.googleapis.com/region": "us-east1"} - pub labels: Option>, /// The friendly name for this location, typically a nearby city name. /// For example, "Tokyo". #[serde(rename="displayName")] pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, /// Resource name for the location, which may vary between implementations. /// For example: `"projects/example-project/locations/us-east1"` pub name: Option, @@ -951,17 +1030,17 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -1062,19 +1141,81 @@ pub struct SetIamPolicyRequest { impl RequestValue for SetIamPolicyRequest {} -/// Request message for `GetIamPolicy` method. +/// A unit of scheduled work. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations queues get iam policy projects](struct.ProjectLocationQueueGetIamPolicyCall.html) (request) +/// * [locations queues tasks run projects](struct.ProjectLocationQueueTaskRunCall.html) (response) +/// * [locations queues tasks renew lease projects](struct.ProjectLocationQueueTaskRenewLeaseCall.html) (response) +/// * [locations queues tasks cancel lease projects](struct.ProjectLocationQueueTaskCancelLeaseCall.html) (response) +/// * [locations queues tasks get projects](struct.ProjectLocationQueueTaskGetCall.html) (response) +/// * [locations queues tasks create projects](struct.ProjectLocationQueueTaskCreateCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetIamPolicyRequest { _never_set: Option } +pub struct Task { + /// Output only. The task status. + pub status: Option, + /// LeaseTasks to process the task. Can be + /// set only if pull_target is set on the queue. + /// + /// A pull task is a task that has PullMessage set. + #[serde(rename="pullMessage")] + pub pull_message: Option, + /// App Engine HTTP request that is sent to the task's target. Can + /// be set only if + /// app_engine_http_target is set + /// on the queue. + /// + /// An App Engine task is a task that has AppEngineHttpRequest set. + #[serde(rename="appEngineHttpRequest")] + pub app_engine_http_request: Option, + /// Optionally caller-specified in CreateTask. + /// + /// The task name. + /// + /// The task name must have the following format: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + /// + /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), colons (:), or periods (.). + /// For more information, see + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// * `LOCATION_ID` is the canonical ID for the task's location. + /// The list of available locations can be obtained by calling + /// ListLocations. + /// For more information, see https://cloud.google.com/about/locations/. + /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or + /// hyphens (-). The maximum length is 100 characters. + /// * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), or underscores (_). The maximum length is 500 characters. + pub name: Option, + /// The time when the task is scheduled to be attempted. + /// + /// For App Engine queues, this is when the task will be attempted or retried. + /// + /// For pull queues, this is the time when the task is available to + /// be leased; if a task is currently leased, this is the time when + /// the current lease expires, that is, the time that the task was + /// leased plus the lease_duration. + /// + /// `schedule_time` will be truncated to the nearest microsecond. + #[serde(rename="scheduleTime")] + pub schedule_time: Option, + /// Output only. The time that the task was created. + /// + /// `create_time` will be truncated to the nearest second. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. The view specifies which subset of the Task has + /// been returned. + pub view: Option, +} -impl RequestValue for GetIamPolicyRequest {} +impl ResponseResult for Task {} /// Request message for `TestIamPermissions` method. @@ -1108,10 +1249,9 @@ impl RequestValue for TestIamPermissionsRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// @@ -1121,9 +1261,10 @@ pub struct Expr { /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} @@ -1187,7 +1328,7 @@ pub struct TaskStatus { pub first_attempt_status: Option, /// Output only. The number of attempts dispatched. /// - /// This count includes tasks which have been dispatched but haven't + /// This count includes attempts which have been dispatched but haven't /// received a response. #[serde(rename="attemptDispatchCount")] pub attempt_dispatch_count: Option, @@ -1233,7 +1374,8 @@ pub struct Queue { /// were purged. /// /// A queue can be purged using PurgeQueue, the - /// [App Engine Task Queue SDK, or the Cloud Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). + /// [App Engine Task Queue SDK, or the Cloud + /// Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). /// /// Purge time will be truncated to the nearest microsecond. Purge /// time will be unset if the queue has never been purged. @@ -1250,7 +1392,8 @@ pub struct Queue { /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), /// hyphens (-), colons (:), or periods (.). /// For more information, see - /// [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) /// * `LOCATION_ID` is the canonical ID for the queue's location. /// The list of available locations can be obtained by calling /// ListLocations. @@ -1293,7 +1436,8 @@ pub struct Queue { /// * For tasks created using the App Engine SDK: the queue-level retry /// settings apply to all tasks in the queue which do not have retry settings /// explicitly set on the task and were created by the App Engine SDK. See - /// [App Engine documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). + /// [App Engine + /// documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). #[serde(rename="retryConfig")] pub retry_config: Option, } @@ -1342,6 +1486,21 @@ pub struct CancelLeaseRequest { impl RequestValue for CancelLeaseRequest {} +/// Request message for `GetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations queues get iam policy projects](struct.ProjectLocationQueueGetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetIamPolicyRequest { _never_set: Option } + +impl RequestValue for GetIamPolicyRequest {} + + /// Request message for CreateTask. /// /// # Activities @@ -1526,7 +1685,8 @@ pub struct RateLimits { /// /// /// This field has the same meaning as - /// [rate in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). + /// [rate in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). #[serde(rename="maxTasksDispatchedPerSecond")] pub max_tasks_dispatched_per_second: Option, /// Output only. The max burst size. @@ -1581,7 +1741,8 @@ pub struct RateLimits { /// /// /// This field has the same meaning as - /// [max_concurrent_requests in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). + /// [max_concurrent_requests in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). #[serde(rename="maxConcurrentTasks")] pub max_concurrent_tasks: Option, } @@ -1629,7 +1790,7 @@ pub struct Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, - /// Unimplemented. The condition that is associated with this binding. + /// The condition that is associated with this binding. /// NOTE: an unsatisfied condition will not allow user access via current /// binding. Different bindings, including their conditions, are examined /// independently. @@ -1654,7 +1815,7 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// @@ -1664,129 +1825,6 @@ pub struct Binding { impl Part for Binding {} -/// App Engine Routing. -/// -/// For more information about services, versions, and instances see -/// [An Overview of App Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), -/// [Microservices Architecture on Google App Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), -/// [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), -/// and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AppEngineRouting { - /// App instance. - /// - /// By default, the task is sent to an instance which is available when - /// the task is attempted. - /// - /// Requests can only be sent to a specific instance if - /// [manual scaling is used in App Engine Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). - /// App Engine Flex does not support instances. For more information, see - /// [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) - /// and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). - pub instance: Option, - /// Output only. The host that the task is sent to. - /// - /// For more information, see - /// [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). - /// - /// The host is constructed as: - /// - /// - /// * `host = [application_domain_name]`
- /// `| [service] + '.' + [application_domain_name]`
- /// `| [version] + '.' + [application_domain_name]`
- /// `| [version_dot_service]+ '.' + [application_domain_name]`
- /// `| [instance] + '.' + [application_domain_name]`
- /// `| [instance_dot_service] + '.' + [application_domain_name]`
- /// `| [instance_dot_version] + '.' + [application_domain_name]`
- /// `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` - /// - /// * `application_domain_name` = The domain name of the app, for - /// example .appspot.com, which is associated with the - /// queue's project ID. Some tasks which were created using the App Engine - /// SDK use a custom domain name. - /// - /// * `service =` service - /// - /// * `version =` version - /// - /// * `version_dot_service =` - /// version `+ '.' +` - /// service - /// - /// * `instance =` instance - /// - /// * `instance_dot_service =` - /// instance `+ '.' +` - /// service - /// - /// * `instance_dot_version =` - /// instance `+ '.' +` - /// version - /// - /// * `instance_dot_version_dot_service =` - /// instance `+ '.' +` - /// version `+ '.' +` - /// service - /// - /// If service is empty, then the task will be sent - /// to the service which is the default service when the task is attempted. - /// - /// If version is empty, then the task will be sent - /// to the version which is the default version when the task is attempted. - /// - /// If instance is empty, then the task - /// will be sent to an instance which is available when the task is - /// attempted. - /// - /// If service, - /// version, or - /// instance is invalid, then the task - /// will be sent to the default version of the default service when - /// the task is attempted. - pub host: Option, - /// App version. - /// - /// By default, the task is sent to the version which is the default - /// version when the task is attempted. - /// - /// For some queues or tasks which were created using the App Engine - /// Task Queue API, host is not parsable - /// into service, - /// version, and - /// instance. For example, some tasks - /// which were created using the App Engine SDK use a custom domain - /// name; custom domains are not parsed by Cloud Tasks. If - /// host is not parsable, then - /// service, - /// version, and - /// instance are the empty string. - pub version: Option, - /// App service. - /// - /// By default, the task is sent to the service which is the default - /// service when the task is attempted. - /// - /// For some queues or tasks which were created using the App Engine - /// Task Queue API, host is not parsable - /// into service, - /// version, and - /// instance. For example, some tasks - /// which were created using the App Engine SDK use a custom domain - /// name; custom domains are not parsed by Cloud Tasks. If - /// host is not parsable, then - /// service, - /// version, and - /// instance are the empty string. - pub service: Option, -} - -impl Part for AppEngineRouting {} - - /// Request message for ResumeQueue. /// /// # Activities @@ -1864,7 +1902,8 @@ pub struct RetryConfig { /// `max_retry_duration` will be truncated to the nearest second. /// /// This field has the same meaning as - /// [task_age_limit in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + /// [task_age_limit in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). #[serde(rename="maxRetryDuration")] pub max_retry_duration: Option, /// A task will be scheduled for retry between @@ -1882,7 +1921,8 @@ pub struct RetryConfig { /// `min_backoff` will be truncated to the nearest second. /// /// This field has the same meaning as - /// [min_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + /// [min_backoff_seconds in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). #[serde(rename="minBackoff")] pub min_backoff: Option, /// The time between retries will double `max_doublings` times. @@ -1911,7 +1951,8 @@ pub struct RetryConfig { /// /// /// This field has the same meaning as - /// [max_doublings in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + /// [max_doublings in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). #[serde(rename="maxDoublings")] pub max_doublings: Option, /// A task will be scheduled for retry between @@ -1929,7 +1970,8 @@ pub struct RetryConfig { /// `max_backoff` will be truncated to the nearest second. /// /// This field has the same meaning as - /// [max_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + /// [max_backoff_seconds in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). #[serde(rename="maxBackoff")] pub max_backoff: Option, /// If true, then the number of attempts is unlimited. @@ -2122,7 +2164,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), /// hyphens (-), colons (:), or periods (.). /// For more information, see - /// [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) /// * `LOCATION_ID` is the canonical ID for the queue's location. /// The list of available locations can be obtained by calling /// ListLocations. @@ -2718,7 +2761,7 @@ impl<'a, C, A> ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2757,7 +2797,7 @@ impl<'a, C, A> ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskGetCall<'a, C, A> @@ -3013,7 +3053,7 @@ impl<'a, C, A> ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3052,7 +3089,7 @@ impl<'a, C, A> ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskListCall<'a, C, A> @@ -3324,7 +3361,7 @@ impl<'a, C, A> ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3363,7 +3397,7 @@ impl<'a, C, A> ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueDeleteCall<'a, C, A> @@ -3595,7 +3629,7 @@ impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3611,10 +3645,7 @@ impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3646,7 +3677,7 @@ impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3737,7 +3768,7 @@ impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3745,12 +3776,12 @@ impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueSetIamPolicyCall<'a, C, A> @@ -3896,7 +3927,7 @@ impl<'a, C, A> ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3947,7 +3975,7 @@ impl<'a, C, A> ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueuePatchCall<'a, C, A> @@ -4214,7 +4243,7 @@ impl<'a, C, A> ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4265,7 +4291,7 @@ impl<'a, C, A> ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueCreateCall<'a, C, A> @@ -4496,7 +4522,7 @@ impl<'a, C, A> ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4535,7 +4558,7 @@ impl<'a, C, A> ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueGetCall<'a, C, A> @@ -4763,7 +4786,7 @@ impl<'a, C, A> ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4814,7 +4834,7 @@ impl<'a, C, A> ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskCreateCall<'a, C, A> @@ -5047,7 +5067,7 @@ impl<'a, C, A> ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5086,7 +5103,7 @@ impl<'a, C, A> ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskDeleteCall<'a, C, A> @@ -5320,7 +5337,7 @@ impl<'a, C, A> ProjectLocationQueueTaskAcknowledgeCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5336,10 +5353,7 @@ impl<'a, C, A> ProjectLocationQueueTaskAcknowledgeCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5371,7 +5385,7 @@ impl<'a, C, A> ProjectLocationQueueTaskAcknowledgeCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5464,7 +5478,7 @@ impl<'a, C, A> ProjectLocationQueueTaskAcknowledgeCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5472,12 +5486,12 @@ impl<'a, C, A> ProjectLocationQueueTaskAcknowledgeCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTaskAcknowledgeCall<'a, C, A> @@ -5616,7 +5630,7 @@ impl<'a, C, A> ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5667,7 +5678,7 @@ impl<'a, C, A> ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueResumeCall<'a, C, A> @@ -5906,7 +5917,7 @@ impl<'a, C, A> ProjectLocationQueueTaskCancelLeaseCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5922,10 +5933,7 @@ impl<'a, C, A> ProjectLocationQueueTaskCancelLeaseCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5957,7 +5965,7 @@ impl<'a, C, A> ProjectLocationQueueTaskCancelLeaseCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6050,7 +6058,7 @@ impl<'a, C, A> ProjectLocationQueueTaskCancelLeaseCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6058,12 +6066,12 @@ impl<'a, C, A> ProjectLocationQueueTaskCancelLeaseCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTaskCancelLeaseCall<'a, C, A> @@ -6201,7 +6209,7 @@ impl<'a, C, A> ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6240,7 +6245,7 @@ impl<'a, C, A> ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueListCall<'a, C, A> @@ -6531,7 +6536,7 @@ impl<'a, C, A> ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6582,7 +6584,7 @@ impl<'a, C, A> ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskRunCall<'a, C, A> @@ -6822,7 +6824,7 @@ impl<'a, C, A> ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6873,7 +6872,7 @@ impl<'a, C, A> ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueuePauseCall<'a, C, A> @@ -7115,7 +7114,7 @@ impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7131,10 +7130,7 @@ impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7166,7 +7162,7 @@ impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7257,7 +7253,7 @@ impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7265,12 +7261,12 @@ impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueGetIamPolicyCall<'a, C, A> @@ -7391,7 +7387,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7430,7 +7423,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> @@ -7653,7 +7646,7 @@ impl<'a, C, A> ProjectLocationQueueTaskRenewLeaseCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7669,10 +7662,7 @@ impl<'a, C, A> ProjectLocationQueueTaskRenewLeaseCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7704,7 +7694,7 @@ impl<'a, C, A> ProjectLocationQueueTaskRenewLeaseCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7797,7 +7787,7 @@ impl<'a, C, A> ProjectLocationQueueTaskRenewLeaseCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7805,12 +7795,12 @@ impl<'a, C, A> ProjectLocationQueueTaskRenewLeaseCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTaskRenewLeaseCall<'a, C, A> @@ -7959,7 +7949,7 @@ impl<'a, C, A> ProjectLocationQueueTaskLeaseCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskLeaseCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8010,7 +7997,7 @@ impl<'a, C, A> ProjectLocationQueueTaskLeaseCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskLeaseCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskLeaseCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskLeaseCall<'a, C, A> @@ -8252,7 +8239,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8291,7 +8275,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C, A> @@ -8537,7 +8521,7 @@ impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8553,10 +8537,7 @@ impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8588,7 +8569,7 @@ impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8679,7 +8660,7 @@ impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8687,12 +8668,12 @@ impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: Borr /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTestIamPermissionCall<'a, C, A> @@ -8825,7 +8806,7 @@ impl<'a, C, A> ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8876,7 +8854,7 @@ impl<'a, C, A> ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueuePurgeCall<'a, C, A> diff --git a/gen/cloudtasks2_beta3-cli/Cargo.toml b/gen/cloudtasks2_beta3-cli/Cargo.toml index 5e829ac049..d3a615b34d 100644 --- a/gen/cloudtasks2_beta3-cli/Cargo.toml +++ b/gen/cloudtasks2_beta3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudtasks2_beta3-cli" -version = "1.0.8+20180913" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Tasks (protocol v2beta3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtasks2_beta3-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudtasks2_beta3] path = "../cloudtasks2_beta3" -version = "1.0.8+20180913" +version = "1.0.8+20190326" diff --git a/gen/cloudtasks2_beta3-cli/README.md b/gen/cloudtasks2_beta3-cli/README.md index b33e50b316..d3e0252806 100644 --- a/gen/cloudtasks2_beta3-cli/README.md +++ b/gen/cloudtasks2_beta3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Tasks* API at revision *20180913*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Tasks* API at revision *20190326*. The CLI is at version *1.0.8*. ```bash cloudtasks2-beta3 [options] diff --git a/gen/cloudtasks2_beta3-cli/mkdocs.yml b/gen/cloudtasks2_beta3-cli/mkdocs.yml index 05d7ff1b42..3c151ff7a3 100644 --- a/gen/cloudtasks2_beta3-cli/mkdocs.yml +++ b/gen/cloudtasks2_beta3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Tasks v1.0.8+20180913 +site_name: Cloud Tasks v1.0.8+20190326 site_url: http://byron.github.io/google-apis-rs/google-cloudtasks2_beta3-cli site_description: A complete library to interact with Cloud Tasks (protocol v2beta3) diff --git a/gen/cloudtasks2_beta3-cli/src/main.rs b/gen/cloudtasks2_beta3-cli/src/main.rs index ec73891b4d..54e50e5449 100644 --- a/gen/cloudtasks2_beta3-cli/src/main.rs +++ b/gen/cloudtasks2_beta3-cli/src/main.rs @@ -982,24 +982,25 @@ impl<'n> Engine<'n> { "task.app-engine-http-request.app-engine-routing.service" => Some(("task.appEngineHttpRequest.appEngineRouting.service", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.app-engine-http-request.relative-uri" => Some(("task.appEngineHttpRequest.relativeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.app-engine-http-request.http-method" => Some(("task.appEngineHttpRequest.httpMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "task.name" => Some(("task.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.first-attempt.schedule-time" => Some(("task.firstAttempt.scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.first-attempt.dispatch-time" => Some(("task.firstAttempt.dispatchTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.first-attempt.response-time" => Some(("task.firstAttempt.responseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.first-attempt.response-status.message" => Some(("task.firstAttempt.responseStatus.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.first-attempt.response-status.code" => Some(("task.firstAttempt.responseStatus.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "task.first-attempt.response-time" => Some(("task.firstAttempt.responseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "task.first-attempt.dispatch-time" => Some(("task.firstAttempt.dispatchTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.last-attempt.schedule-time" => Some(("task.lastAttempt.scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.last-attempt.dispatch-time" => Some(("task.lastAttempt.dispatchTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.last-attempt.response-time" => Some(("task.lastAttempt.responseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.last-attempt.response-status.message" => Some(("task.lastAttempt.responseStatus.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.last-attempt.response-status.code" => Some(("task.lastAttempt.responseStatus.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "task.last-attempt.response-time" => Some(("task.lastAttempt.responseTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "task.last-attempt.dispatch-time" => Some(("task.lastAttempt.dispatchTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "task.schedule-time" => Some(("task.scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.view" => Some(("task.view", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.schedule-time" => Some(("task.scheduleTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.dispatch-deadline" => Some(("task.dispatchDeadline", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "task.response-count" => Some(("task.responseCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "task.create-time" => Some(("task.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "task.dispatch-count" => Some(("task.dispatchCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "task.response-count" => Some(("task.responseCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "task.name" => Some(("task.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["app-engine-http-request", "app-engine-routing", "body", "code", "create-time", "dispatch-count", "dispatch-time", "first-attempt", "headers", "host", "http-method", "instance", "last-attempt", "message", "name", "relative-uri", "response-count", "response-status", "response-time", "response-view", "schedule-time", "service", "task", "version", "view"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["app-engine-http-request", "app-engine-routing", "body", "code", "create-time", "dispatch-count", "dispatch-deadline", "dispatch-time", "first-attempt", "headers", "host", "http-method", "instance", "last-attempt", "message", "name", "relative-uri", "response-count", "response-status", "response-time", "response-view", "schedule-time", "service", "task", "version", "view"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1796,7 +1797,8 @@ fn main() { * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see - [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + [Identifying + projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * `LOCATION_ID` is the canonical ID for the queue's location. The list of available locations can be obtained by calling ListLocations. @@ -2198,7 +2200,7 @@ fn main() { let mut app = App::new("cloudtasks2-beta3") .author("Sebastian Thiel ") - .version("1.0.8+20180913") + .version("1.0.8+20190326") .about("Manages the execution of large numbers of distributed requests.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudtasks2_beta3_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudtasks2_beta3/Cargo.toml b/gen/cloudtasks2_beta3/Cargo.toml index 21b700ab16..1595dfb2ca 100644 --- a/gen/cloudtasks2_beta3/Cargo.toml +++ b/gen/cloudtasks2_beta3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudtasks2_beta3" -version = "1.0.8+20180913" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Tasks (protocol v2beta3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtasks2_beta3" homepage = "https://cloud.google.com/tasks/" -documentation = "https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913" +documentation = "https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326" license = "MIT" keywords = ["cloudtasks", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudtasks2_beta3/README.md b/gen/cloudtasks2_beta3/README.md index 7a7969477b..d1b049c052 100644 --- a/gen/cloudtasks2_beta3/README.md +++ b/gen/cloudtasks2_beta3/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-cloudtasks2_beta3` library allows access to all features of the *Google Cloud Tasks* service. -This documentation was generated from *Cloud Tasks* crate version *1.0.8+20180913*, where *20180913* is the exact revision of the *cloudtasks:v2beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Tasks* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudtasks:v2beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Tasks* *v2_beta3* API can be found at the [official documentation site](https://cloud.google.com/tasks/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.CloudTasks.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.CloudTasks.html) ... * projects - * [*locations get*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationListCall.html), [*locations queues create*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueCreateCall.html), [*locations queues delete*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueDeleteCall.html), [*locations queues get*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueGetCall.html), [*locations queues get iam policy*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueGetIamPolicyCall.html), [*locations queues list*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueListCall.html), [*locations queues patch*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueuePatchCall.html), [*locations queues pause*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueuePauseCall.html), [*locations queues purge*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueuePurgeCall.html), [*locations queues resume*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueResumeCall.html), [*locations queues set iam policy*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueSetIamPolicyCall.html), [*locations queues tasks create*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueTaskCreateCall.html), [*locations queues tasks delete*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueTaskDeleteCall.html), [*locations queues tasks get*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueTaskGetCall.html), [*locations queues tasks list*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueTaskListCall.html), [*locations queues tasks run*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueTaskRunCall.html) and [*locations queues test iam permissions*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.ProjectLocationQueueTestIamPermissionCall.html) + * [*locations get*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationListCall.html), [*locations queues create*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueCreateCall.html), [*locations queues delete*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueDeleteCall.html), [*locations queues get*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueGetCall.html), [*locations queues get iam policy*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueGetIamPolicyCall.html), [*locations queues list*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueListCall.html), [*locations queues patch*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueuePatchCall.html), [*locations queues pause*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueuePauseCall.html), [*locations queues purge*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueuePurgeCall.html), [*locations queues resume*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueResumeCall.html), [*locations queues set iam policy*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueSetIamPolicyCall.html), [*locations queues tasks create*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueTaskCreateCall.html), [*locations queues tasks delete*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueTaskDeleteCall.html), [*locations queues tasks get*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueTaskGetCall.html), [*locations queues tasks list*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueTaskListCall.html), [*locations queues tasks run*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueTaskRunCall.html) and [*locations queues test iam permissions*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.ProjectLocationQueueTestIamPermissionCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/struct.CloudTasks.html)** +* **[Hub](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/struct.CloudTasks.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -136,17 +136,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -156,29 +156,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20180913/google_cloudtasks2_beta3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudtasks2_beta3/1.0.8+20190326/google_cloudtasks2_beta3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudtasks2_beta3/src/lib.rs b/gen/cloudtasks2_beta3/src/lib.rs index 27ebcc1269..723c84b514 100644 --- a/gen/cloudtasks2_beta3/src/lib.rs +++ b/gen/cloudtasks2_beta3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Tasks* crate version *1.0.8+20180913*, where *20180913* is the exact revision of the *cloudtasks:v2beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Tasks* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudtasks:v2beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Tasks* *v2_beta3* API can be found at the //! [official documentation site](https://cloud.google.com/tasks/). @@ -394,9 +394,16 @@ impl<'a, C, A> CloudTasks /// /// The task will be delivered to the App Engine app which belongs to the same /// project as the queue. For more information, see -/// [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) +/// [How Requests are +/// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) /// and how routing is affected by -/// [dispatch files](https://cloud.google.com/appengine/docs/python/config/dispatchref). +/// [dispatch +/// files](https://cloud.google.com/appengine/docs/python/config/dispatchref). +/// Traffic is encrypted during transport and never leaves Google datacenters. +/// Because this traffic is carried over a communication mechanism internal to +/// Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). +/// The request to the handler, however, will appear to have used the HTTP +/// protocol. /// /// The AppEngineRouting used to construct the URL that the task is /// delivered to can be set at the queue-level or task-level: @@ -413,6 +420,16 @@ impl<'a, C, A> CloudTasks /// * `url =` host `+` /// relative_uri /// +/// Tasks can be dispatched to secure app handlers, unsecure app handlers, and +/// URIs restricted with +/// [`login: +/// admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). +/// Because tasks are not run as any user, they cannot be dispatched to URIs +/// restricted with +/// [`login: +/// required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) +/// Task dispatches also do not follow redirects. +/// /// The task attempt has succeeded if the app's request handler returns /// an HTTP response code in the range [`200` - `299`]. `503` is /// considered an App Engine system error instead of an application @@ -464,7 +481,8 @@ pub struct AppEngineHttpRequest { /// /// In addition, Cloud Tasks sets some headers when the task is dispatched, /// such as headers containing information about the task; see - /// [request headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). + /// [request + /// headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). /// These headers are set only when the task is dispatched, so they are not /// visible when the task is returned in a Cloud Tasks response. /// @@ -493,10 +511,12 @@ pub struct AppEngineHttpRequest { /// The app's request handler for the task's target URL must be able to handle /// HTTP requests with this http_method, otherwise the task attempt will fail /// with error code 405 (Method Not Allowed). See - /// [Writing a push task request handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) + /// [Writing a push task request + /// handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) /// and the documentation for the request handlers in the language your app is /// written in e.g. - /// [Python Request Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). + /// [Python Request + /// Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). #[serde(rename="httpMethod")] pub http_method: Option, } @@ -504,83 +524,19 @@ pub struct AppEngineHttpRequest { impl Part for AppEngineHttpRequest {} -/// A unit of scheduled work. +/// Request message for `GetIamPolicy` method. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations queues tasks run projects](struct.ProjectLocationQueueTaskRunCall.html) (response) -/// * [locations queues tasks get projects](struct.ProjectLocationQueueTaskGetCall.html) (response) -/// * [locations queues tasks create projects](struct.ProjectLocationQueueTaskCreateCall.html) (response) +/// * [locations queues get iam policy projects](struct.ProjectLocationQueueGetIamPolicyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Task { - /// App Engine HTTP request that is sent to the task's target. Can - /// be set only if - /// app_engine_http_queue is set - /// on the queue. - /// - /// An App Engine task is a task that has AppEngineHttpRequest set. - #[serde(rename="appEngineHttpRequest")] - pub app_engine_http_request: Option, - /// Optionally caller-specified in CreateTask. - /// - /// The task name. - /// - /// The task name must have the following format: - /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - /// - /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), - /// hyphens (-), colons (:), or periods (.). - /// For more information, see - /// [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) - /// * `LOCATION_ID` is the canonical ID for the task's location. - /// The list of available locations can be obtained by calling - /// ListLocations. - /// For more information, see https://cloud.google.com/about/locations/. - /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or - /// hyphens (-). The maximum length is 100 characters. - /// * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), - /// hyphens (-), or underscores (_). The maximum length is 500 characters. - pub name: Option, - /// Output only. The status of the task's last attempt. - #[serde(rename="lastAttempt")] - pub last_attempt: Option, - /// Output only. The view specifies which subset of the Task has - /// been returned. - pub view: Option, - /// The time when the task is scheduled to be attempted. - /// - /// For App Engine queues, this is when the task will be attempted or retried. - /// - /// `schedule_time` will be truncated to the nearest microsecond. - #[serde(rename="scheduleTime")] - pub schedule_time: Option, - /// Output only. The number of attempts which have received a response. - #[serde(rename="responseCount")] - pub response_count: Option, - /// Output only. The time that the task was created. - /// - /// `create_time` will be truncated to the nearest second. - #[serde(rename="createTime")] - pub create_time: Option, - /// Output only. The number of attempts dispatched. - /// - /// This count includes tasks which have been dispatched but haven't - /// received a response. - #[serde(rename="dispatchCount")] - pub dispatch_count: Option, - /// Output only. The status of the task's first attempt. - /// - /// Only dispatch_time will be set. - /// The other Attempt information is not retained by Cloud Tasks. - #[serde(rename="firstAttempt")] - pub first_attempt: Option, -} +pub struct GetIamPolicyRequest { _never_set: Option } -impl ResponseResult for Task {} +impl RequestValue for GetIamPolicyRequest {} /// The status of a task attempt. @@ -594,22 +550,22 @@ pub struct Attempt { /// `schedule_time` will be truncated to the nearest microsecond. #[serde(rename="scheduleTime")] pub schedule_time: Option, - /// Output only. The response from the target for this attempt. - /// - /// If `response_time` is unset, then the task has not been attempted or is - /// currently running and the `response_status` field is meaningless. - #[serde(rename="responseStatus")] - pub response_status: Option, - /// Output only. The time that this attempt response was received. - /// - /// `response_time` will be truncated to the nearest microsecond. - #[serde(rename="responseTime")] - pub response_time: Option, /// Output only. The time that this attempt was dispatched. /// /// `dispatch_time` will be truncated to the nearest microsecond. #[serde(rename="dispatchTime")] pub dispatch_time: Option, + /// Output only. The time that this attempt response was received. + /// + /// `response_time` will be truncated to the nearest microsecond. + #[serde(rename="responseTime")] + pub response_time: Option, + /// Output only. The response from the worker for this attempt. + /// + /// If `response_time` is unset, then the task has not been attempted or is + /// currently running and the `response_status` field is meaningless. + #[serde(rename="responseStatus")] + pub response_status: Option, } impl Part for Attempt {} @@ -661,10 +617,9 @@ impl RequestValue for PauseQueueRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// @@ -674,9 +629,10 @@ pub struct Expr { /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} @@ -741,7 +697,8 @@ pub struct Queue { /// were purged. /// /// A queue can be purged using PurgeQueue, the - /// [App Engine Task Queue SDK, or the Cloud Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). + /// [App Engine Task Queue SDK, or the Cloud + /// Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). /// /// Purge time will be truncated to the nearest microsecond. Purge /// time will be unset if the queue has never been purged. @@ -758,7 +715,8 @@ pub struct Queue { /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), /// hyphens (-), colons (:), or periods (.). /// For more information, see - /// [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) /// * `LOCATION_ID` is the canonical ID for the queue's location. /// The list of available locations can be obtained by calling /// ListLocations. @@ -768,10 +726,9 @@ pub struct Queue { pub name: Option, /// Rate limits for task dispatches. /// - /// rate_limits and - /// retry_config are related because they both - /// control task attempts however they control how tasks are - /// attempted in different ways: + /// rate_limits and retry_config are + /// related because they both control task attempts. However they control task + /// attempts in different ways: /// /// * rate_limits controls the total rate of /// dispatches from a queue (i.e. all traffic dispatched from the @@ -781,11 +738,20 @@ pub struct Queue { /// particular a task after its first attempt fails. That is, /// retry_config controls task retries (the /// second attempt, third attempt, etc). + /// + /// The queue's actual dispatch rate is the result of: + /// + /// * Number of tasks in the queue + /// * User-specified throttling: rate_limits, + /// retry_config, and the + /// queue's state. + /// * System throttling due to `429` (Too Many Requests) or `503` (Service + /// Unavailable) responses from the worker, high error rates, or to smooth + /// sudden large traffic spikes. #[serde(rename="rateLimits")] pub rate_limits: Option, - /// App Engine HTTP queue. - /// - /// An App Engine queue is a queue that has an AppEngineHttpQeueue type. + /// AppEngineHttpQueue settings apply only to + /// App Engine tasks in this queue. #[serde(rename="appEngineHttpQueue")] pub app_engine_http_queue: Option, /// Settings that determine the retry behavior. @@ -796,7 +762,8 @@ pub struct Queue { /// * For tasks created using the App Engine SDK: the queue-level retry /// settings apply to all tasks in the queue which do not have retry settings /// explicitly set on the task and were created by the App Engine SDK. See - /// [App Engine documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). + /// [App Engine + /// documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). #[serde(rename="retryConfig")] pub retry_config: Option, } @@ -882,19 +849,112 @@ pub struct Policy { impl ResponseResult for Policy {} -/// Request message for `GetIamPolicy` method. +/// A unit of scheduled work. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations queues get iam policy projects](struct.ProjectLocationQueueGetIamPolicyCall.html) (request) +/// * [locations queues tasks run projects](struct.ProjectLocationQueueTaskRunCall.html) (response) +/// * [locations queues tasks get projects](struct.ProjectLocationQueueTaskGetCall.html) (response) +/// * [locations queues tasks create projects](struct.ProjectLocationQueueTaskCreateCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetIamPolicyRequest { _never_set: Option } +pub struct Task { + /// HTTP request that is sent to the App Engine app handler. + /// + /// An App Engine task is a task that has AppEngineHttpRequest set. + #[serde(rename="appEngineHttpRequest")] + pub app_engine_http_request: Option, + /// Output only. The status of the task's first attempt. + /// + /// Only dispatch_time will be set. + /// The other Attempt information is not retained by Cloud Tasks. + #[serde(rename="firstAttempt")] + pub first_attempt: Option, + /// Output only. The status of the task's last attempt. + #[serde(rename="lastAttempt")] + pub last_attempt: Option, + /// Optionally caller-specified in CreateTask. + /// + /// The task name. + /// + /// The task name must have the following format: + /// `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + /// + /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), colons (:), or periods (.). + /// For more information, see + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// * `LOCATION_ID` is the canonical ID for the task's location. + /// The list of available locations can be obtained by calling + /// ListLocations. + /// For more information, see https://cloud.google.com/about/locations/. + /// * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or + /// hyphens (-). The maximum length is 100 characters. + /// * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), + /// hyphens (-), or underscores (_). The maximum length is 500 characters. + pub name: Option, + /// The time when the task is scheduled to be attempted. + /// + /// For App Engine queues, this is when the task will be attempted or retried. + /// + /// `schedule_time` will be truncated to the nearest microsecond. + #[serde(rename="scheduleTime")] + pub schedule_time: Option, + /// The deadline for requests sent to the worker. If the worker does not + /// respond by this deadline then the request is cancelled and the attempt + /// is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the + /// task according to the RetryConfig. + /// + /// Note that when the request is cancelled, Cloud Tasks will stop listing for + /// the response, but whether the worker stops processing depends on the + /// worker. For example, if the worker is stuck, it may not react to cancelled + /// requests. + /// + /// The default and maximum values depend on the type of request: + /// + /// + /// * For App Engine tasks, 0 indicates that the + /// request has the default deadline. The default deadline depends on the + /// [scaling + /// type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling) + /// of the service: 10 minutes for standard apps with automatic scaling, 24 + /// hours for standard apps with manual and basic scaling, and 60 minutes for + /// flex apps. If the request deadline is set, it must be in the interval [15 + /// seconds, 24 hours 15 seconds]. Regardless of the task's + /// `dispatch_deadline`, the app handler will not run for longer than than + /// the service's timeout. We recommend setting the `dispatch_deadline` to + /// at most a few seconds more than the app handler's timeout. For more + /// information see + /// [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts). + /// + /// `dispatch_deadline` will be truncated to the nearest millisecond. The + /// deadline is an approximate deadline. + #[serde(rename="dispatchDeadline")] + pub dispatch_deadline: Option, + /// Output only. The number of attempts which have received a response. + #[serde(rename="responseCount")] + pub response_count: Option, + /// Output only. The time that the task was created. + /// + /// `create_time` will be truncated to the nearest second. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. The number of attempts dispatched. + /// + /// This count includes attempts which have been dispatched but haven't + /// received a response. + #[serde(rename="dispatchCount")] + pub dispatch_count: Option, + /// Output only. The view specifies which subset of the Task has + /// been returned. + pub view: Option, +} -impl RequestValue for GetIamPolicyRequest {} +impl ResponseResult for Task {} /// The response message for Locations.ListLocations. @@ -929,17 +989,17 @@ impl ResponseResult for ListLocationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { - /// The canonical id for this location. For example: `"us-east1"`. - #[serde(rename="locationId")] - pub location_id: Option, - /// Cross-service attributes for the location. For example - /// - /// {"cloud.googleapis.com/region": "us-east1"} - pub labels: Option>, /// The friendly name for this location, typically a nearby city name. /// For example, "Tokyo". #[serde(rename="displayName")] pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, /// Resource name for the location, which may vary between implementations. /// For example: `"projects/example-project/locations/us-east1"` pub name: Option, @@ -1021,17 +1081,17 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -1136,7 +1196,8 @@ pub struct RateLimits { /// /// /// This field has the same meaning as - /// [max_concurrent_requests in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). + /// [max_concurrent_requests in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). #[serde(rename="maxConcurrentDispatches")] pub max_concurrent_dispatches: Option, /// Output only. The max burst size. @@ -1184,7 +1245,8 @@ pub struct RateLimits { /// /// /// This field has the same meaning as - /// [rate in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). + /// [rate in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). #[serde(rename="maxDispatchesPerSecond")] pub max_dispatches_per_second: Option, } @@ -1222,6 +1284,11 @@ pub struct Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, /// Specifies the identities requesting access for a Cloud Platform resource. /// `members` can have the following values: /// @@ -1242,16 +1309,11 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// pub members: Option>, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, } impl Part for Binding {} @@ -1400,20 +1462,18 @@ impl ResponseResult for ListQueuesResponse {} /// App Engine Routing. /// -/// Specifies the target URI. Since this target type dispatches tasks to secure -/// app handlers, unsecure app handlers, and URIs restricted with -/// [`login: admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref) -/// the protocol (for example, HTTP or HTTPS) cannot be explictly specified. -/// Task dispatches do not follow redirects and cannot target URI paths -/// restricted with -/// [`login: required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) -/// because tasks are not run as any user. +/// Defines routing characteristics specific to App Engine - service, version, +/// and instance. /// /// For more information about services, versions, and instances see -/// [An Overview of App Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), -/// [Microservices Architecture on Google App Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), -/// [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), -/// and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). +/// [An Overview of App +/// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), +/// [Microservices Architecture on Google App +/// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), +/// [App Engine Standard request +/// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), +/// and [App Engine Flex request +/// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -1425,10 +1485,13 @@ pub struct AppEngineRouting { /// the task is attempted. /// /// Requests can only be sent to a specific instance if - /// [manual scaling is used in App Engine Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). + /// [manual scaling is used in App Engine + /// Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). /// App Engine Flex does not support instances. For more information, see - /// [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) - /// and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). + /// [App Engine Standard request + /// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) + /// and [App Engine Flex request + /// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). pub instance: Option, /// Output only. The host that the task is sent to. /// @@ -1439,7 +1502,8 @@ pub struct AppEngineRouting { /// the App Engine SDK might have a custom domain name. /// /// For more information, see - /// [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). + /// [How Requests are + /// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). pub host: Option, /// App version. /// @@ -1501,7 +1565,8 @@ pub struct RetryConfig { /// `max_backoff` will be truncated to the nearest second. /// /// This field has the same meaning as - /// [max_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + /// [max_backoff_seconds in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). #[serde(rename="maxBackoff")] pub max_backoff: Option, /// Number of attempts per task. @@ -1516,7 +1581,8 @@ pub struct RetryConfig { /// -1 indicates unlimited attempts. /// /// This field has the same meaning as - /// [task_retry_limit in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + /// [task_retry_limit in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). #[serde(rename="maxAttempts")] pub max_attempts: Option, /// The time between retries will double `max_doublings` times. @@ -1543,7 +1609,8 @@ pub struct RetryConfig { /// /// /// This field has the same meaning as - /// [max_doublings in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + /// [max_doublings in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). #[serde(rename="maxDoublings")] pub max_doublings: Option, /// If positive, `max_retry_duration` specifies the time limit for @@ -1562,7 +1629,8 @@ pub struct RetryConfig { /// `max_retry_duration` will be truncated to the nearest second. /// /// This field has the same meaning as - /// [task_age_limit in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + /// [task_age_limit in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). #[serde(rename="maxRetryDuration")] pub max_retry_duration: Option, /// A task will be scheduled for retry between @@ -1578,7 +1646,8 @@ pub struct RetryConfig { /// `min_backoff` will be truncated to the nearest second. /// /// This field has the same meaning as - /// [min_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + /// [min_backoff_seconds in + /// queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). #[serde(rename="minBackoff")] pub min_backoff: Option, } @@ -1841,7 +1910,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), /// hyphens (-), colons (:), or periods (.). /// For more information, see - /// [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + /// [Identifying + /// projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) /// * `LOCATION_ID` is the canonical ID for the queue's location. /// The list of available locations can be obtained by calling /// ListLocations. @@ -2259,7 +2329,7 @@ impl<'a, C, A> ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2310,7 +2377,7 @@ impl<'a, C, A> ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskRunCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskRunCall<'a, C, A> @@ -2550,7 +2617,7 @@ impl<'a, C, A> ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2601,7 +2665,7 @@ impl<'a, C, A> ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePauseCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueuePauseCall<'a, C, A> @@ -2833,7 +2897,7 @@ impl<'a, C, A> ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2872,7 +2933,7 @@ impl<'a, C, A> ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskGetCall<'a, C, A> @@ -3128,7 +3189,7 @@ impl<'a, C, A> ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3167,7 +3225,7 @@ impl<'a, C, A> ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskListCall<'a, C, A> @@ -3446,7 +3504,7 @@ impl<'a, C, A> ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3497,7 +3552,7 @@ impl<'a, C, A> ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut ProjectLocationQueueResumeCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueResumeCall<'a, C, A> @@ -3741,7 +3796,7 @@ impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3757,10 +3812,7 @@ impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3792,7 +3844,7 @@ impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3883,7 +3935,7 @@ impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3891,12 +3943,12 @@ impl<'a, C, A> ProjectLocationQueueSetIamPolicyCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueSetIamPolicyCall<'a, C, A> @@ -4042,7 +4094,7 @@ impl<'a, C, A> ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4093,7 +4142,7 @@ impl<'a, C, A> ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueuePatchCall<'a, C, A> @@ -4358,7 +4408,7 @@ impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4374,10 +4424,7 @@ impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4409,7 +4456,7 @@ impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4500,7 +4547,7 @@ impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4508,12 +4555,12 @@ impl<'a, C, A> ProjectLocationQueueGetIamPolicyCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueGetIamPolicyCall<'a, C, A> @@ -4651,7 +4698,7 @@ impl<'a, C, A> ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4702,7 +4746,7 @@ impl<'a, C, A> ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueCreateCall<'a, C, A> @@ -4944,7 +4988,7 @@ impl<'a, C, A> ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4983,7 +5024,7 @@ impl<'a, C, A> ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueDeleteCall<'a, C, A> @@ -5213,7 +5254,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5252,7 +5290,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C, A> @@ -5502,7 +5540,7 @@ impl<'a, C, A> ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5541,7 +5576,7 @@ impl<'a, C, A> ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut ProjectLocationQueueListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueListCall<'a, C, A> @@ -5812,7 +5847,7 @@ impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5828,10 +5863,7 @@ impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5863,7 +5895,7 @@ impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5954,7 +5986,7 @@ impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5962,12 +5994,12 @@ impl<'a, C, A> ProjectLocationQueueTestIamPermissionCall<'a, C, A> where C: Borr /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationQueueTestIamPermissionCall<'a, C, A> @@ -6088,7 +6120,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6127,7 +6156,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> @@ -6339,7 +6368,7 @@ impl<'a, C, A> ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6378,7 +6404,7 @@ impl<'a, C, A> ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut ProjectLocationQueueGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueGetCall<'a, C, A> @@ -6605,7 +6631,7 @@ impl<'a, C, A> ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6656,7 +6679,7 @@ impl<'a, C, A> ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut ProjectLocationQueuePurgeCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueuePurgeCall<'a, C, A> @@ -6895,7 +6918,7 @@ impl<'a, C, A> ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6946,7 +6966,7 @@ impl<'a, C, A> ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskCreateCall<'a, C, A> @@ -7179,7 +7199,7 @@ impl<'a, C, A> ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7218,7 +7235,7 @@ impl<'a, C, A> ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationQueueTaskDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationQueueTaskDeleteCall<'a, C, A> diff --git a/gen/cloudtrace1-cli/Cargo.toml b/gen/cloudtrace1-cli/Cargo.toml index a7cfc75f93..e380234395 100644 --- a/gen/cloudtrace1-cli/Cargo.toml +++ b/gen/cloudtrace1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudtrace1-cli" -version = "1.0.8+20181004" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Trace (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtrace1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudtrace1] path = "../cloudtrace1" -version = "1.0.8+20181004" +version = "1.0.8+20190326" diff --git a/gen/cloudtrace1-cli/README.md b/gen/cloudtrace1-cli/README.md index 9831b59b81..d0af954408 100644 --- a/gen/cloudtrace1-cli/README.md +++ b/gen/cloudtrace1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Trace* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Trace* API at revision *20190326*. The CLI is at version *1.0.8*. ```bash cloudtrace1 [options] diff --git a/gen/cloudtrace1-cli/mkdocs.yml b/gen/cloudtrace1-cli/mkdocs.yml index 22436ade9b..31c858b2e1 100644 --- a/gen/cloudtrace1-cli/mkdocs.yml +++ b/gen/cloudtrace1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Trace v1.0.8+20181004 +site_name: Cloud Trace v1.0.8+20190326 site_url: http://byron.github.io/google-apis-rs/google-cloudtrace1-cli site_description: A complete library to interact with Cloud Trace (protocol v1) diff --git a/gen/cloudtrace1-cli/src/main.rs b/gen/cloudtrace1-cli/src/main.rs index 17af00805b..eb7191076d 100644 --- a/gen/cloudtrace1-cli/src/main.rs +++ b/gen/cloudtrace1-cli/src/main.rs @@ -452,7 +452,7 @@ fn main() { let mut app = App::new("cloudtrace1") .author("Sebastian Thiel ") - .version("1.0.8+20181004") + .version("1.0.8+20190326") .about("Sends application trace data to Stackdriver Trace for viewing. Trace data is collected for all App Engine applications by default. Trace data from other applications can be provided using this API. This library is used to interact with the Trace API directly. If you are looking to instrument your application for Stackdriver Trace, we recommend using OpenCensus. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudtrace1_cli") diff --git a/gen/cloudtrace1/Cargo.toml b/gen/cloudtrace1/Cargo.toml index 2f00e8157e..03c8c69164 100644 --- a/gen/cloudtrace1/Cargo.toml +++ b/gen/cloudtrace1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudtrace1" -version = "1.0.8+20181004" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Trace (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtrace1" homepage = "https://cloud.google.com/trace" -documentation = "https://docs.rs/google-cloudtrace1/1.0.8+20181004" +documentation = "https://docs.rs/google-cloudtrace1/1.0.8+20190326" license = "MIT" keywords = ["cloudtrace", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudtrace1/README.md b/gen/cloudtrace1/README.md index 3e2944ba92..07861bad90 100644 --- a/gen/cloudtrace1/README.md +++ b/gen/cloudtrace1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-cloudtrace1` library allows access to all features of the *Google Cloud Trace* service. -This documentation was generated from *Cloud Trace* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *cloudtrace:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Trace* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudtrace:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Trace* *v1* API can be found at the [official documentation site](https://cloud.google.com/trace). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/struct.CloudTrace.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/struct.CloudTrace.html) ... * projects - * [*patch traces*](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/struct.ProjectPatchTraceCall.html), [*traces get*](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/struct.ProjectTraceGetCall.html) and [*traces list*](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/struct.ProjectTraceListCall.html) + * [*patch traces*](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/struct.ProjectPatchTraceCall.html), [*traces get*](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/struct.ProjectTraceGetCall.html) and [*traces list*](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/struct.ProjectTraceListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/struct.CloudTrace.html)** +* **[Hub](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/struct.CloudTrace.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -124,17 +124,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -144,29 +144,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudtrace1/1.0.8+20181004/google_cloudtrace1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudtrace1/1.0.8+20190326/google_cloudtrace1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudtrace1/src/lib.rs b/gen/cloudtrace1/src/lib.rs index 105d77cba8..9226af9c76 100644 --- a/gen/cloudtrace1/src/lib.rs +++ b/gen/cloudtrace1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Trace* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *cloudtrace:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Trace* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudtrace:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Trace* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/trace). @@ -225,12 +225,12 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// Write Trace data for a project or application - TraceAppend, - /// View and manage your data across Google Cloud Platform services CloudPlatform, + /// Write Trace data for a project or application + TraceAppend, + /// Read Trace data for a project or application TraceReadonly, } @@ -238,8 +238,8 @@ pub enum Scope { impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { - Scope::TraceAppend => "https://www.googleapis.com/auth/trace.append", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::TraceAppend => "https://www.googleapis.com/auth/trace.append", Scope::TraceReadonly => "https://www.googleapis.com/auth/trace.readonly", } } @@ -389,6 +389,29 @@ pub struct ListTracesResponse { impl ResponseResult for ListTracesResponse {} +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch traces projects](struct.ProjectPatchTraceCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + /// List of new or updated traces. /// /// # Activities @@ -407,6 +430,34 @@ pub struct Traces { impl RequestValue for Traces {} +/// A trace describes how long it takes for an application to perform an +/// operation. It consists of a set of spans, each of which represent a single +/// timed event within the operation. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [traces get projects](struct.ProjectTraceGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Trace { + /// Project ID of the Cloud project where the trace data is stored. + #[serde(rename="projectId")] + pub project_id: Option, + /// Globally unique identifier for the trace. This identifier is a 128-bit + /// numeric value formatted as a 32-byte hex string. For example, + /// `382d4f4c6b7bb2f4a972559d9085001d`. + #[serde(rename="traceId")] + pub trace_id: Option, + /// Collection of spans in the trace. + pub spans: Option>, +} + +impl ResponseResult for Trace {} + + /// A span represents a single timed event within a trace. Spans can be nested /// and form a trace tree. Often, a trace contains a root span that describes the /// end-to-end latency of an operation and, optionally, one or more subspans for @@ -483,57 +534,6 @@ pub struct TraceSpan { impl Part for TraceSpan {} -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [patch traces projects](struct.ProjectPatchTraceCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - -/// A trace describes how long it takes for an application to perform an -/// operation. It consists of a set of spans, each of which represent a single -/// timed event within the operation. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [traces get projects](struct.ProjectTraceGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Trace { - /// Project ID of the Cloud project where the trace data is stored. - #[serde(rename="projectId")] - pub project_id: Option, - /// Globally unique identifier for the trace. This identifier is a 128-bit - /// numeric value formatted as a 32-byte hex string. For example, - /// `382d4f4c6b7bb2f4a972559d9085001d`. - #[serde(rename="traceId")] - pub trace_id: Option, - /// Collection of spans in the trace. - pub spans: Option>, -} - -impl ResponseResult for Trace {} - - // ################### // MethodBuilders ### @@ -753,10 +753,7 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -776,7 +773,7 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -864,7 +861,7 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1021,10 +1018,7 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1056,7 +1050,7 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1146,7 +1140,7 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1327,10 +1321,7 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1350,7 +1341,7 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1524,7 +1515,7 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/cloudtrace2-cli/Cargo.toml b/gen/cloudtrace2-cli/Cargo.toml index 6f2c13a8ca..2b13303fbb 100644 --- a/gen/cloudtrace2-cli/Cargo.toml +++ b/gen/cloudtrace2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudtrace2-cli" -version = "1.0.8+20181004" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Trace (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtrace2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-cloudtrace2] path = "../cloudtrace2" -version = "1.0.8+20181004" +version = "1.0.8+20190326" diff --git a/gen/cloudtrace2-cli/README.md b/gen/cloudtrace2-cli/README.md index 25261a3beb..6fb83f17d4 100644 --- a/gen/cloudtrace2-cli/README.md +++ b/gen/cloudtrace2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Trace* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Trace* API at revision *20190326*. The CLI is at version *1.0.8*. ```bash cloudtrace2 [options] diff --git a/gen/cloudtrace2-cli/mkdocs.yml b/gen/cloudtrace2-cli/mkdocs.yml index 60e835a070..c4e90286d3 100644 --- a/gen/cloudtrace2-cli/mkdocs.yml +++ b/gen/cloudtrace2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Trace v1.0.8+20181004 +site_name: Cloud Trace v1.0.8+20190326 site_url: http://byron.github.io/google-apis-rs/google-cloudtrace2-cli site_description: A complete library to interact with Cloud Trace (protocol v2) diff --git a/gen/cloudtrace2-cli/src/main.rs b/gen/cloudtrace2-cli/src/main.rs index 01eec98d19..97b347a6af 100644 --- a/gen/cloudtrace2-cli/src/main.rs +++ b/gen/cloudtrace2-cli/src/main.rs @@ -406,7 +406,7 @@ fn main() { let mut app = App::new("cloudtrace2") .author("Sebastian Thiel ") - .version("1.0.8+20181004") + .version("1.0.8+20190326") .about("Sends application trace data to Stackdriver Trace for viewing. Trace data is collected for all App Engine applications by default. Trace data from other applications can be provided using this API. This library is used to interact with the Trace API directly. If you are looking to instrument your application for Stackdriver Trace, we recommend using OpenCensus. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudtrace2_cli") diff --git a/gen/cloudtrace2/Cargo.toml b/gen/cloudtrace2/Cargo.toml index 0ed5c63c88..63f6db6b37 100644 --- a/gen/cloudtrace2/Cargo.toml +++ b/gen/cloudtrace2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudtrace2" -version = "1.0.8+20181004" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Trace (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtrace2" homepage = "https://cloud.google.com/trace" -documentation = "https://docs.rs/google-cloudtrace2/1.0.8+20181004" +documentation = "https://docs.rs/google-cloudtrace2/1.0.8+20190326" license = "MIT" keywords = ["cloudtrace", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/cloudtrace2/README.md b/gen/cloudtrace2/README.md index 8d636a8457..5d8c7aa9eb 100644 --- a/gen/cloudtrace2/README.md +++ b/gen/cloudtrace2/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-cloudtrace2` library allows access to all features of the *Google Cloud Trace* service. -This documentation was generated from *Cloud Trace* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *cloudtrace:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Trace* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudtrace:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Trace* *v2* API can be found at the [official documentation site](https://cloud.google.com/trace). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/struct.CloudTrace.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/struct.CloudTrace.html) ... * projects - * [*traces batch write*](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/struct.ProjectTraceBatchWriteCall.html) and [*traces spans create span*](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/struct.ProjectTraceSpanCreateSpanCall.html) + * [*traces batch write*](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/struct.ProjectTraceBatchWriteCall.html) and [*traces spans create span*](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/struct.ProjectTraceSpanCreateSpanCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/struct.CloudTrace.html)** +* **[Hub](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/struct.CloudTrace.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -130,17 +130,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -150,29 +150,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-cloudtrace2/1.0.8+20181004/google_cloudtrace2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudtrace2/1.0.8+20190326/google_cloudtrace2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudtrace2/src/lib.rs b/gen/cloudtrace2/src/lib.rs index b841a82557..f05e098b4a 100644 --- a/gen/cloudtrace2/src/lib.rs +++ b/gen/cloudtrace2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Trace* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *cloudtrace:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Trace* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *cloudtrace:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Trace* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/trace). @@ -231,18 +231,18 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// Write Trace data for a project or application - TraceAppend, - /// View and manage your data across Google Cloud Platform services CloudPlatform, + + /// Write Trace data for a project or application + TraceAppend, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { - Scope::TraceAppend => "https://www.googleapis.com/auth/trace.append", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::TraceAppend => "https://www.googleapis.com/auth/trace.append", } } } @@ -551,8 +551,8 @@ pub struct Attributes { #[serde(rename="droppedAttributesCount")] pub dropped_attributes_count: Option, /// The set of attributes. Each attribute's key can be up to 128 bytes - /// long. The value can be a string up to 256 bytes, an integer, or the - /// Boolean values `true` and `false`. For example: + /// long. The value can be a string up to 256 bytes, a signed 64-bit integer, + /// or the Boolean values `true` and `false`. For example: /// /// "/instance_id": "my-instance" /// "/http/user_agent": "" @@ -657,17 +657,17 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -1053,7 +1053,7 @@ impl<'a, C, A> ProjectTraceSpanCreateSpanCall<'a, C, A> where C: BorrowMut ProjectTraceSpanCreateSpanCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1104,7 +1101,7 @@ impl<'a, C, A> ProjectTraceSpanCreateSpanCall<'a, C, A> where C: BorrowMut ProjectTraceSpanCreateSpanCall<'a, C, A> where C: BorrowMut ProjectTraceSpanCreateSpanCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectTraceSpanCreateSpanCall<'a, C, A> @@ -1342,7 +1339,7 @@ impl<'a, C, A> ProjectTraceBatchWriteCall<'a, C, A> where C: BorrowMut ProjectTraceBatchWriteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1393,7 +1387,7 @@ impl<'a, C, A> ProjectTraceBatchWriteCall<'a, C, A> where C: BorrowMut ProjectTraceBatchWriteCall<'a, C, A> where C: BorrowMut ProjectTraceBatchWriteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectTraceBatchWriteCall<'a, C, A> diff --git a/gen/clouduseraccountsvm_beta/Cargo.toml b/gen/clouduseraccountsvm_beta/Cargo.toml index 3f1b5cc330..16c97b2b76 100644 --- a/gen/clouduseraccountsvm_beta/Cargo.toml +++ b/gen/clouduseraccountsvm_beta/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/clouduseraccountsvm_beta/src/lib.rs b/gen/clouduseraccountsvm_beta/src/lib.rs index 6c9b63c638..652fc1ae4c 100644 --- a/gen/clouduseraccountsvm_beta/src/lib.rs +++ b/gen/clouduseraccountsvm_beta/src/lib.rs @@ -1524,10 +1524,7 @@ impl<'a, C, A> GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1547,7 +1544,7 @@ impl<'a, C, A> GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1810,7 +1804,7 @@ impl<'a, C, A> GlobalAccountsOperationListCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationListCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2095,7 +2086,7 @@ impl<'a, C, A> GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2369,7 +2357,7 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2469,7 +2457,7 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2631,10 +2619,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2654,7 +2639,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2772,7 +2757,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2921,10 +2906,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2956,7 +2938,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3046,7 +3028,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3190,10 +3172,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3213,7 +3192,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3301,7 +3280,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3447,10 +3426,7 @@ impl<'a, C, A> UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3470,7 +3446,7 @@ impl<'a, C, A> UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3735,7 +3708,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3823,7 +3796,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3967,10 +3940,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3990,7 +3960,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4078,7 +4048,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4222,10 +4192,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4245,7 +4212,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4333,7 +4300,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4484,10 +4451,7 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4519,7 +4483,7 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4619,7 +4583,7 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4768,10 +4732,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4803,7 +4764,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4893,7 +4854,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5055,10 +5016,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5078,7 +5036,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5196,7 +5154,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5347,10 +5305,7 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5382,7 +5337,7 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5482,7 +5437,7 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5648,10 +5603,7 @@ impl<'a, C, A> LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5671,7 +5623,7 @@ impl<'a, C, A> LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5985,7 +5934,7 @@ impl<'a, C, A> LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Cloud Composer (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/composer1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-composer1] path = "../composer1" -version = "1.0.8+20181001" +version = "1.0.8+20190323" diff --git a/gen/composer1-cli/README.md b/gen/composer1-cli/README.md index 522407767e..cf205317b0 100644 --- a/gen/composer1-cli/README.md +++ b/gen/composer1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Composer* API at revision *20181001*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Composer* API at revision *20190323*. The CLI is at version *1.0.8*. ```bash composer1 [options] @@ -35,6 +35,7 @@ composer1 [options] locations-environments-get [-p ]... [-o ] locations-environments-list [-p ]... [-o ] locations-environments-patch (-r )... [-p ]... [-o ] + locations-image-versions-list [-p ]... [-o ] locations-operations-delete [-p ]... [-o ] locations-operations-get [-p ]... [-o ] locations-operations-list [-p ]... [-o ] diff --git a/gen/composer1-cli/mkdocs.yml b/gen/composer1-cli/mkdocs.yml index 8ac0dbf942..b5b9bb87cc 100644 --- a/gen/composer1-cli/mkdocs.yml +++ b/gen/composer1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Composer v1.0.8+20181001 +site_name: Cloud Composer v1.0.8+20190323 site_url: http://byron.github.io/google-apis-rs/google-composer1-cli site_description: A complete library to interact with Cloud Composer (protocol v1) @@ -14,6 +14,7 @@ pages: - ['projects_locations-environments-get.md', 'Projects', 'Locations Environments Get'] - ['projects_locations-environments-list.md', 'Projects', 'Locations Environments List'] - ['projects_locations-environments-patch.md', 'Projects', 'Locations Environments Patch'] +- ['projects_locations-image-versions-list.md', 'Projects', 'Locations Image Versions List'] - ['projects_locations-operations-delete.md', 'Projects', 'Locations Operations Delete'] - ['projects_locations-operations-get.md', 'Projects', 'Locations Operations Get'] - ['projects_locations-operations-list.md', 'Projects', 'Locations Operations List'] diff --git a/gen/composer1-cli/src/main.rs b/gen/composer1-cli/src/main.rs index e2d8aedbdf..02a677e67d 100644 --- a/gen/composer1-cli/src/main.rs +++ b/gen/composer1-cli/src/main.rs @@ -70,14 +70,15 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "uuid" => Some(("uuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.dag-gcs-prefix" => Some(("config.dagGcsPrefix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.software-config.python-version" => Some(("config.softwareConfig.pythonVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.software-config.image-version" => Some(("config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.software-config.pypi-packages" => Some(("config.softwareConfig.pypiPackages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "config.software-config.env-variables" => Some(("config.softwareConfig.envVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.software-config.airflow-config-overrides" => Some(("config.softwareConfig.airflowConfigOverrides", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "config.software-config.env-variables" => Some(("config.softwareConfig.envVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "config.software-config.pypi-packages" => Some(("config.softwareConfig.pypiPackages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.airflow-uri" => Some(("config.airflowUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.gke-cluster" => Some(("config.gkeCluster", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.node-config.machine-type" => Some(("config.nodeConfig.machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -90,9 +91,9 @@ impl<'n> Engine<'n> { "config.node-config.subnetwork" => Some(("config.nodeConfig.subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.node-count" => Some(("config.nodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "uuid" => Some(("uuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["airflow-config-overrides", "airflow-uri", "config", "create-time", "dag-gcs-prefix", "disk-size-gb", "env-variables", "gke-cluster", "image-version", "labels", "location", "machine-type", "name", "network", "node-config", "node-count", "oauth-scopes", "pypi-packages", "service-account", "software-config", "state", "subnetwork", "tags", "update-time", "uuid"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["airflow-config-overrides", "airflow-uri", "config", "create-time", "dag-gcs-prefix", "disk-size-gb", "env-variables", "gke-cluster", "image-version", "labels", "location", "machine-type", "name", "network", "node-config", "node-count", "oauth-scopes", "pypi-packages", "python-version", "service-account", "software-config", "state", "subnetwork", "tags", "update-time", "uuid"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -339,14 +340,15 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "uuid" => Some(("uuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.dag-gcs-prefix" => Some(("config.dagGcsPrefix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.software-config.python-version" => Some(("config.softwareConfig.pythonVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.software-config.image-version" => Some(("config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.software-config.pypi-packages" => Some(("config.softwareConfig.pypiPackages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "config.software-config.env-variables" => Some(("config.softwareConfig.envVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.software-config.airflow-config-overrides" => Some(("config.softwareConfig.airflowConfigOverrides", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "config.software-config.env-variables" => Some(("config.softwareConfig.envVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "config.software-config.pypi-packages" => Some(("config.softwareConfig.pypiPackages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.airflow-uri" => Some(("config.airflowUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.gke-cluster" => Some(("config.gkeCluster", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.node-config.machine-type" => Some(("config.nodeConfig.machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -359,9 +361,9 @@ impl<'n> Engine<'n> { "config.node-config.subnetwork" => Some(("config.nodeConfig.subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.node-count" => Some(("config.nodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "uuid" => Some(("uuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["airflow-config-overrides", "airflow-uri", "config", "create-time", "dag-gcs-prefix", "disk-size-gb", "env-variables", "gke-cluster", "image-version", "labels", "location", "machine-type", "name", "network", "node-config", "node-count", "oauth-scopes", "pypi-packages", "service-account", "software-config", "state", "subnetwork", "tags", "update-time", "uuid"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["airflow-config-overrides", "airflow-uri", "config", "create-time", "dag-gcs-prefix", "disk-size-gb", "env-variables", "gke-cluster", "image-version", "labels", "location", "machine-type", "name", "network", "node-config", "node-count", "oauth-scopes", "pypi-packages", "python-version", "service-account", "software-config", "state", "subnetwork", "tags", "update-time", "uuid"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -425,6 +427,65 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_image_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_image_versions_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_locations_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().locations_operations_delete(opt.value_of("name").unwrap_or("")); @@ -613,6 +674,9 @@ impl<'n> Engine<'n> { ("locations-environments-patch", Some(opt)) => { call_result = self._projects_locations_environments_patch(opt, dry_run, &mut err); }, + ("locations-image-versions-list", Some(opt)) => { + call_result = self._projects_locations_image_versions_list(opt, dry_run, &mut err); + }, ("locations-operations-delete", Some(opt)) => { call_result = self._projects_locations_operations_delete(opt, dry_run, &mut err); }, @@ -713,7 +777,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'locations-environments-create', 'locations-environments-delete', 'locations-environments-get', 'locations-environments-list', 'locations-environments-patch', 'locations-operations-delete', 'locations-operations-get' and 'locations-operations-list'", vec![ + ("projects", "methods: 'locations-environments-create', 'locations-environments-delete', 'locations-environments-get', 'locations-environments-list', 'locations-environments-patch', 'locations-image-versions-list', 'locations-operations-delete', 'locations-operations-get' and 'locations-operations-list'", vec![ ("locations-environments-create", Some(r##"Create a new environment."##), "Details at http://byron.github.io/google-apis-rs/google_composer1_cli/projects_locations-environments-create", @@ -834,6 +898,29 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-image-versions-list", + Some(r##"List ImageVersions for provided location."##), + "Details at http://byron.github.io/google-apis-rs/google_composer1_cli/projects_locations-image-versions-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"List ImageVersions in the given project and location, in the form: + "projects/{projectId}/locations/{locationId}""##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -926,7 +1013,7 @@ fn main() { let mut app = App::new("composer1") .author("Sebastian Thiel ") - .version("1.0.8+20181001") + .version("1.0.8+20190323") .about("Manages Apache Airflow environments on Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_composer1_cli") .arg(Arg::with_name("url") diff --git a/gen/composer1/Cargo.toml b/gen/composer1/Cargo.toml index a03cae0504..49588ce050 100644 --- a/gen/composer1/Cargo.toml +++ b/gen/composer1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-composer1" -version = "1.0.8+20181001" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Composer (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/composer1" homepage = "https://cloud.google.com/composer/" -documentation = "https://docs.rs/google-composer1/1.0.8+20181001" +documentation = "https://docs.rs/google-composer1/1.0.8+20190323" license = "MIT" keywords = ["composer", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/composer1/README.md b/gen/composer1/README.md index 078e371b4b..9f47dab481 100644 --- a/gen/composer1/README.md +++ b/gen/composer1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-composer1` library allows access to all features of the *Google Cloud Composer* service. -This documentation was generated from *Cloud Composer* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *composer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Composer* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *composer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Composer* *v1* API can be found at the [official documentation site](https://cloud.google.com/composer/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/struct.CloudComposer.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.CloudComposer.html) ... * projects - * [*locations environments create*](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/struct.ProjectLocationEnvironmentCreateCall.html), [*locations environments delete*](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/struct.ProjectLocationEnvironmentDeleteCall.html), [*locations environments get*](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/struct.ProjectLocationEnvironmentGetCall.html), [*locations environments list*](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/struct.ProjectLocationEnvironmentListCall.html), [*locations environments patch*](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/struct.ProjectLocationEnvironmentPatchCall.html), [*locations operations delete*](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/struct.ProjectLocationOperationListCall.html) + * [*locations environments create*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.ProjectLocationEnvironmentCreateCall.html), [*locations environments delete*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.ProjectLocationEnvironmentDeleteCall.html), [*locations environments get*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.ProjectLocationEnvironmentGetCall.html), [*locations environments list*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.ProjectLocationEnvironmentListCall.html), [*locations environments patch*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.ProjectLocationEnvironmentPatchCall.html), [*locations image versions list*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.ProjectLocationImageVersionListCall.html), [*locations operations delete*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.ProjectLocationOperationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/struct.CloudComposer.html)** +* **[Hub](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/struct.CloudComposer.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.Part.html)** + * **[Parts](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -134,17 +134,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -154,29 +154,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-composer1/1.0.8+20181001/google_composer1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-composer1/1.0.8+20190323/google_composer1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/composer1/src/lib.rs b/gen/composer1/src/lib.rs index 5226ed66c8..fffeff72be 100644 --- a/gen/composer1/src/lib.rs +++ b/gen/composer1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Composer* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *composer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Composer* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *composer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Composer* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/composer/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.CloudComposer.html) ... //! //! * projects -//! * [*locations environments create*](struct.ProjectLocationEnvironmentCreateCall.html), [*locations environments delete*](struct.ProjectLocationEnvironmentDeleteCall.html), [*locations environments get*](struct.ProjectLocationEnvironmentGetCall.html), [*locations environments list*](struct.ProjectLocationEnvironmentListCall.html), [*locations environments patch*](struct.ProjectLocationEnvironmentPatchCall.html), [*locations operations delete*](struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](struct.ProjectLocationOperationListCall.html) +//! * [*locations environments create*](struct.ProjectLocationEnvironmentCreateCall.html), [*locations environments delete*](struct.ProjectLocationEnvironmentDeleteCall.html), [*locations environments get*](struct.ProjectLocationEnvironmentGetCall.html), [*locations environments list*](struct.ProjectLocationEnvironmentListCall.html), [*locations environments patch*](struct.ProjectLocationEnvironmentPatchCall.html), [*locations image versions list*](struct.ProjectLocationImageVersionListCall.html), [*locations operations delete*](struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](struct.ProjectLocationOperationListCall.html) //! //! //! @@ -375,17 +375,54 @@ impl<'a, C, A> CloudComposer // ############ // SCHEMAS ### // ########## -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// Configuration information for an environment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EnvironmentConfig { + /// Output only. + /// The Cloud Storage prefix of the DAGs for this environment. Although Cloud + /// Storage objects reside in a flat namespace, a hierarchical file tree + /// can be simulated using "/"-delimited object name prefixes. DAG objects for + /// this environment reside in a simulated directory with the given prefix. + #[serde(rename="dagGcsPrefix")] + pub dag_gcs_prefix: Option, + /// The configuration settings for software inside the environment. + #[serde(rename="softwareConfig")] + pub software_config: Option, + /// The configuration used for the Kubernetes Engine cluster. + #[serde(rename="nodeConfig")] + pub node_config: Option, + /// Output only. + /// The URI of the Apache Airflow Web UI hosted within this environment (see + /// [Airflow web interface](/composer/docs/how-to/accessing/airflow-web-interface)). + #[serde(rename="airflowUri")] + pub airflow_uri: Option, + /// Output only. + /// The Kubernetes Engine cluster used to run this environment. + #[serde(rename="gkeCluster")] + pub gke_cluster: Option, + /// The number of nodes in the Kubernetes Engine cluster that will be + /// used to run this environment. + #[serde(rename="nodeCount")] + pub node_count: Option, +} + +impl Part for EnvironmentConfig {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -446,61 +483,41 @@ pub struct Status { impl Part for Status {} -/// Configuration information for an environment. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EnvironmentConfig { - /// Output only. - /// The Cloud Storage prefix of the DAGs for this environment. Although Cloud - /// Storage objects reside in a flat namespace, a hierarchical file tree - /// can be simulated using "/"-delimited object name prefixes. DAG objects for - /// this environment reside in a simulated directory with the given prefix. - #[serde(rename="dagGcsPrefix")] - pub dag_gcs_prefix: Option, - /// The configuration settings for software inside the environment. - #[serde(rename="softwareConfig")] - pub software_config: Option, - /// The configuration used for the Kubernetes Engine cluster. - #[serde(rename="nodeConfig")] - pub node_config: Option, - /// Output only. - /// The URI of the Apache Airflow Web UI hosted within this environment (see - /// [Airflow web interface](/composer/docs/how-to/accessing/airflow-web-interface)). - #[serde(rename="airflowUri")] - pub airflow_uri: Option, - /// Output only. - /// The Kubernetes Engine cluster used to run this environment. - #[serde(rename="gkeCluster")] - pub gke_cluster: Option, - /// The number of nodes in the Kubernetes Engine cluster that will be - /// used to run this environment. - #[serde(rename="nodeCount")] - pub node_count: Option, -} - -impl Part for EnvironmentConfig {} - - /// Specifies the selection and configuration of software inside the environment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SoftwareConfig { - /// Output only. + /// Optional. Custom Python Package Index (PyPI) packages to be installed in + /// the environment. + /// + /// Keys refer to the lowercase package name such as "numpy" + /// and values are the lowercase extras and version specifier such as + /// "==1.12.0", "[devel,gcp_api]", or "[devel]>=1.8.2, <1.9.2". To specify a + /// package without pinning it to a version specifier, use the empty string as + /// the value. + #[serde(rename="pypiPackages")] + pub pypi_packages: Option>, /// The version of the software running in the environment. /// This encapsulates both the version of Cloud Composer functionality and the /// version of Apache Airflow. It must match the regular expression - /// `composer-[0-9]+\.[0-9]+(\.[0-9]+)?-airflow-[0-9]+\.[0-9]+(\.[0-9]+.*)?`. + /// `composer-([0-9]+\.[0-9]+\.[0-9]+|latest)-airflow-[0-9]+\.[0-9]+(\.[0-9]+.*)?`. + /// When used as input, the server also checks if the provided version is + /// supported and denies the request for an unsupported version. /// /// The Cloud Composer portion of the version is a - /// [semantic version](https://semver.org). The portion of the image version - /// following _airflow-_ is an official Apache Airflow repository + /// [semantic version](https://semver.org) or `latest`. When the patch version + /// is omitted, the current Cloud Composer patch version is selected. + /// When `latest` is provided instead of an explicit version number, + /// the server replaces `latest` with the current Cloud Composer version + /// and stores that version number in the same field. + /// + /// The portion of the image version that follows airflow- is an + /// official Apache Airflow repository /// [release name](https://github.com/apache/incubator-airflow/releases). /// - /// See also [Release Notes](/composer/docs/release-notes). + /// See also [Version List](/composer/docs/concepts/versioning/composer-versions). #[serde(rename="imageVersion")] pub image_version: Option, /// Optional. Apache Airflow configuration properties to override. @@ -544,16 +561,13 @@ pub struct SoftwareConfig { /// * `SQL_USER` #[serde(rename="envVariables")] pub env_variables: Option>, - /// Optional. Custom Python Package Index (PyPI) packages to be installed in - /// the environment. + /// Optional. The major version of Python used to run the Apache Airflow + /// scheduler, worker, and webserver processes. /// - /// Keys refer to the lowercase package name such as "numpy" - /// and values are the lowercase extras and version specifier such as - /// "==1.12.0", "[devel,gcp_api]", or "[devel]>=1.8.2, <1.9.2". To specify a - /// package without pinning it to a version specifier, use the empty string as - /// the value. - #[serde(rename="pypiPackages")] - pub pypi_packages: Option>, + /// Can be set to '2' or '3'. If not specified, the default is '2'. Cannot be + /// updated. + #[serde(rename="pythonVersion")] + pub python_version: Option, } impl Part for SoftwareConfig {} @@ -580,51 +594,26 @@ pub struct ListOperationsResponse { impl ResponseResult for ListOperationsResponse {} -/// An environment for running orchestration tasks. +/// The ImageVersions in a project and location. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations environments patch projects](struct.ProjectLocationEnvironmentPatchCall.html) (request) -/// * [locations environments create projects](struct.ProjectLocationEnvironmentCreateCall.html) (request) -/// * [locations environments get projects](struct.ProjectLocationEnvironmentGetCall.html) (response) +/// * [locations image versions list projects](struct.ProjectLocationImageVersionListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Environment { - /// Output only. - /// The time at which this environment was last modified. - #[serde(rename="updateTime")] - pub update_time: Option, - /// Output only. - /// The UUID (Universally Unique IDentifier) associated with this environment. - /// This value is generated when the environment is created. - pub uuid: Option, - /// The resource name of the environment, in the form: - /// "projects/{projectId}/locations/{locationId}/environments/{environmentId}" - pub name: Option, - /// Optional. User-defined labels for this environment. - /// The labels map can contain no more than 64 entries. Entries of the labels - /// map are UTF8 strings that comply with the following restrictions: - /// - /// * Keys must conform to regexp: \p{Ll}\p{Lo}{0,62} - /// * Values must conform to regexp: [\p{Ll}\p{Lo}\p{N}_-]{0,63} - /// * Both keys and values are additionally constrained to be <= 128 bytes in - /// size. - pub labels: Option>, - /// Configuration parameters for this environment. - pub config: Option, - /// The current state of the environment. - pub state: Option, - /// Output only. - /// The time at which this environment was created. - #[serde(rename="createTime")] - pub create_time: Option, +pub struct ListImageVersionsResponse { + /// The page token used to query for the next page if one exists. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of supported ImageVersions in a location. + #[serde(rename="imageVersions")] + pub image_versions: Option>, } -impl RequestValue for Environment {} -impl ResponseResult for Environment {} +impl ResponseResult for ListImageVersionsResponse {} /// The environments in a project and location. @@ -734,6 +723,51 @@ pub struct NodeConfig { impl Part for NodeConfig {} +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations operations delete projects](struct.ProjectLocationOperationDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// ImageVersion information +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImageVersion { + /// The string identifier of the ImageVersion, in the form: + /// "composer-x.y.z-airflow-a.b(.c)" + #[serde(rename="imageVersionId")] + pub image_version_id: Option, + /// supported python versions + #[serde(rename="supportedPythonVersions")] + pub supported_python_versions: Option>, + /// Whether this is the default ImageVersion used by Composer during + /// environment creation if no input ImageVersion is specified. + #[serde(rename="isDefault")] + pub is_default: Option, +} + +impl Part for ImageVersion {} + + /// This resource represents a long-running operation that is the result of a /// network API call. /// @@ -778,27 +812,51 @@ pub struct Operation { impl ResponseResult for Operation {} -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. +/// An environment for running orchestration tasks. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations operations delete projects](struct.ProjectLocationOperationDeleteCall.html) (response) +/// * [locations environments patch projects](struct.ProjectLocationEnvironmentPatchCall.html) (request) +/// * [locations environments create projects](struct.ProjectLocationEnvironmentCreateCall.html) (request) +/// * [locations environments get projects](struct.ProjectLocationEnvironmentGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } +pub struct Environment { + /// Output only. + /// The time at which this environment was last modified. + #[serde(rename="updateTime")] + pub update_time: Option, + /// The resource name of the environment, in the form: + /// "projects/{projectId}/locations/{locationId}/environments/{environmentId}" + pub name: Option, + /// Output only. + /// The UUID (Universally Unique IDentifier) associated with this environment. + /// This value is generated when the environment is created. + pub uuid: Option, + /// Optional. User-defined labels for this environment. + /// The labels map can contain no more than 64 entries. Entries of the labels + /// map are UTF8 strings that comply with the following restrictions: + /// + /// * Keys must conform to regexp: \p{Ll}\p{Lo}{0,62} + /// * Values must conform to regexp: [\p{Ll}\p{Lo}\p{N}_-]{0,63} + /// * Both keys and values are additionally constrained to be <= 128 bytes in + /// size. + pub labels: Option>, + /// Configuration parameters for this environment. + pub config: Option, + /// The current state of the environment. + pub state: Option, + /// Output only. + /// The time at which this environment was created. + #[serde(rename="createTime")] + pub create_time: Option, +} -impl ResponseResult for Empty {} +impl RequestValue for Environment {} +impl ResponseResult for Environment {} @@ -830,7 +888,7 @@ impl ResponseResult for Empty {} /// ::default(), None); /// let mut hub = CloudComposer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `locations_environments_create(...)`, `locations_environments_delete(...)`, `locations_environments_get(...)`, `locations_environments_list(...)`, `locations_environments_patch(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)` +/// // like `locations_environments_create(...)`, `locations_environments_delete(...)`, `locations_environments_get(...)`, `locations_environments_list(...)`, `locations_environments_patch(...)`, `locations_image_versions_list(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -845,6 +903,26 @@ impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} impl<'a, C, A> ProjectMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// List ImageVersions for provided location. + /// + /// # Arguments + /// + /// * `parent` - List ImageVersions in the given project and location, in the form: + /// "projects/{projectId}/locations/{locationId}" + pub fn locations_image_versions_list(&self, parent: &str) -> ProjectLocationImageVersionListCall<'a, C, A> { + ProjectLocationImageVersionListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Update an environment. @@ -1018,6 +1096,279 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# +/// List ImageVersions for provided location. +/// +/// A builder for the *locations.imageVersions.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_composer1 as composer1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use composer1::CloudComposer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudComposer::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_image_versions_list("parent") +/// .page_token("accusam") +/// .page_size(-8) +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationImageVersionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudComposer, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationImageVersionListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationImageVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListImageVersionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "composer.projects.locations.imageVersions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/imageVersions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// List ImageVersions in the given project and location, in the form: + /// "projects/{projectId}/locations/{locationId}" + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationImageVersionListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The next_page_token value returned from a previous List request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationImageVersionListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of image_versions to return. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationImageVersionListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationImageVersionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationImageVersionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationImageVersionListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Update an environment. /// /// A builder for the *locations.environments.patch* method supported by a *project* resource. @@ -1052,7 +1403,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_environments_patch(req, "name") -/// .update_mask("accusam") +/// .update_mask("amet.") /// .doit(); /// # } /// ``` @@ -1116,7 +1467,7 @@ impl<'a, C, A> ProjectLocationEnvironmentPatchCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1132,10 +1483,7 @@ impl<'a, C, A> ProjectLocationEnvironmentPatchCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1167,7 +1515,7 @@ impl<'a, C, A> ProjectLocationEnvironmentPatchCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1396,7 +1744,7 @@ impl<'a, C, A> ProjectLocationEnvironmentPatchCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1472,8 +1820,8 @@ impl<'a, C, A> ProjectLocationEnvironmentPatchCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_environments_list("parent") -/// .page_token("justo") -/// .page_size(-1) +/// .page_token("labore") +/// .page_size(-9) /// .doit(); /// # } /// ``` @@ -1540,7 +1888,7 @@ impl<'a, C, A> ProjectLocationEnvironmentListCall<'a, C, A> where C: BorrowMut ProjectLocationEnvironmentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1579,7 +1924,7 @@ impl<'a, C, A> ProjectLocationEnvironmentListCall<'a, C, A> where C: BorrowMut ProjectLocationEnvironmentListCall<'a, C, A> where C: BorrowMut ProjectLocationEnvironmentCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1829,10 +2174,7 @@ impl<'a, C, A> ProjectLocationEnvironmentCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1864,7 +2206,7 @@ impl<'a, C, A> ProjectLocationEnvironmentCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1954,7 +2296,7 @@ impl<'a, C, A> ProjectLocationEnvironmentCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2088,7 +2430,7 @@ impl<'a, C, A> ProjectLocationEnvironmentDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2104,10 +2446,7 @@ impl<'a, C, A> ProjectLocationEnvironmentDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2127,7 +2466,7 @@ impl<'a, C, A> ProjectLocationEnvironmentDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2206,7 +2545,7 @@ impl<'a, C, A> ProjectLocationEnvironmentDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2340,7 +2679,7 @@ impl<'a, C, A> ProjectLocationEnvironmentGetCall<'a, C, A> where C: BorrowMut ProjectLocationEnvironmentGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2379,7 +2715,7 @@ impl<'a, C, A> ProjectLocationEnvironmentGetCall<'a, C, A> where C: BorrowMut ProjectLocationEnvironmentGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2633,7 +2966,7 @@ impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2908,7 +3238,7 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3183,7 +3510,7 @@ impl<'a, C, A> ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with compute (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/compute1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-compute1] path = "../compute1" -version = "1.0.8+20180916" +version = "1.0.8+20190320" diff --git a/gen/compute1-cli/README.md b/gen/compute1-cli/README.md index a4200561fd..92cc140e11 100644 --- a/gen/compute1-cli/README.md +++ b/gen/compute1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *compute* API at revision *20180916*. The CLI is at version *1.0.8*. +This documentation was generated from the *compute* API at revision *20190320*. The CLI is at version *1.0.8*. ```bash compute1 [options] @@ -77,10 +77,13 @@ compute1 [options] create-snapshot (-r )... [-p ]... [-o ] delete [-p ]... [-o ] get [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] resize (-r )... [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] set-labels (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] firewalls delete [-p ]... [-o ] get [-p ]... [-o ] @@ -137,9 +140,12 @@ compute1 [options] deprecate (-r )... [-p ]... [-o ] get [-p ]... [-o ] get-from-family [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] set-labels (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] instance-group-managers abandon-instances (-r )... [-p ]... [-o ] aggregated-list [-p ]... [-o ] @@ -149,6 +155,7 @@ compute1 [options] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] list-managed-instances [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] recreate-instances (-r )... [-p ]... [-o ] resize [-p ]... [-o ] set-instance-template (-r )... [-p ]... [-o ] @@ -166,8 +173,11 @@ compute1 [options] instance-templates delete [-p ]... [-o ] get [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] instances add-access-config (-r )... [-p ]... [-o ] aggregated-list [-p ]... [-o ] @@ -176,13 +186,16 @@ compute1 [options] delete-access-config [-p ]... [-o ] detach-disk [-p ]... [-o ] get [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] get-serial-port-output [-p ]... [-o ] + get-shielded-instance-identity [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] list-referrers [-p ]... [-o ] reset [-p ]... [-o ] set-deletion-protection [-p ]... [-o ] set-disk-auto-delete [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] set-labels (-r )... [-p ]... [-o ] set-machine-resources (-r )... [-p ]... [-o ] set-machine-type (-r )... [-p ]... [-o ] @@ -190,13 +203,16 @@ compute1 [options] set-min-cpu-platform (-r )... [-p ]... [-o ] set-scheduling (-r )... [-p ]... [-o ] set-service-account (-r )... [-p ]... [-o ] + set-shielded-instance-integrity-policy (-r )... [-p ]... [-o ] set-tags (-r )... [-p ]... [-o ] simulate-maintenance-event [-p ]... [-o ] start [-p ]... [-o ] start-with-encryption-key (-r )... [-p ]... [-o ] stop [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] update-access-config (-r )... [-p ]... [-o ] update-network-interface (-r )... [-p ]... [-o ] + update-shielded-instance-config (-r )... [-p ]... [-o ] interconnect-attachments aggregated-list [-p ]... [-o ] delete [-p ]... [-o ] @@ -210,6 +226,7 @@ compute1 [options] interconnects delete [-p ]... [-o ] get [-p ]... [-o ] + get-diagnostics [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] patch (-r )... [-p ]... [-o ] @@ -219,13 +236,25 @@ compute1 [options] licenses delete [-p ]... [-o ] get [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] test-iam-permissions (-r )... [-p ]... [-o ] machine-types aggregated-list [-p ]... [-o ] get [-p ]... [-o ] list [-p ]... [-o ] + network-endpoint-groups + aggregated-list [-p ]... [-o ] + attach-network-endpoints (-r )... [-p ]... [-o ] + delete [-p ]... [-o ] + detach-network-endpoints (-r )... [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + list-network-endpoints (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] networks add-peering (-r )... [-p ]... [-o ] delete [-p ]... [-o ] @@ -241,16 +270,22 @@ compute1 [options] delete [-p ]... [-o ] delete-nodes (-r )... [-p ]... [-o ] get [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] list-nodes [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] set-node-template (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] node-templates aggregated-list [-p ]... [-o ] delete [-p ]... [-o ] get [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] node-types aggregated-list [-p ]... [-o ] get [-p ]... [-o ] @@ -309,6 +344,7 @@ compute1 [options] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] list-managed-instances [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] recreate-instances (-r )... [-p ]... [-o ] resize [-p ]... [-o ] set-instance-template (-r )... [-p ]... [-o ] @@ -329,6 +365,7 @@ compute1 [options] aggregated-list [-p ]... [-o ] delete [-p ]... [-o ] get [-p ]... [-o ] + get-nat-mapping-info [-p ]... [-o ] get-router-status [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] @@ -353,8 +390,11 @@ compute1 [options] snapshots delete [-p ]... [-o ] get [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] list [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] set-labels (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] ssl-certificates delete [-p ]... [-o ] get [-p ]... [-o ] @@ -372,11 +412,14 @@ compute1 [options] delete [-p ]... [-o ] expand-ip-cidr-range (-r )... [-p ]... [-o ] get [-p ]... [-o ] + get-iam-policy [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] list-usable [-p ]... [-o ] patch (-r )... [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] set-private-ip-google-access (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] target-http-proxies delete [-p ]... [-o ] get [-p ]... [-o ] diff --git a/gen/compute1-cli/mkdocs.yml b/gen/compute1-cli/mkdocs.yml index 1838d43467..754f3cedad 100644 --- a/gen/compute1-cli/mkdocs.yml +++ b/gen/compute1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: compute v1.0.8+20180916 +site_name: compute v1.0.8+20190320 site_url: http://byron.github.io/google-apis-rs/google-compute1-cli site_description: A complete library to interact with compute (protocol v1) @@ -50,10 +50,13 @@ pages: - ['disks_create-snapshot.md', 'Disks', 'Create Snapshot'] - ['disks_delete.md', 'Disks', 'Delete'] - ['disks_get.md', 'Disks', 'Get'] +- ['disks_get-iam-policy.md', 'Disks', 'Get Iam Policy'] - ['disks_insert.md', 'Disks', 'Insert'] - ['disks_list.md', 'Disks', 'List'] - ['disks_resize.md', 'Disks', 'Resize'] +- ['disks_set-iam-policy.md', 'Disks', 'Set Iam Policy'] - ['disks_set-labels.md', 'Disks', 'Set Labels'] +- ['disks_test-iam-permissions.md', 'Disks', 'Test Iam Permissions'] - ['firewalls_delete.md', 'Firewalls', 'Delete'] - ['firewalls_get.md', 'Firewalls', 'Get'] - ['firewalls_insert.md', 'Firewalls', 'Insert'] @@ -101,9 +104,12 @@ pages: - ['images_deprecate.md', 'Images', 'Deprecate'] - ['images_get.md', 'Images', 'Get'] - ['images_get-from-family.md', 'Images', 'Get From Family'] +- ['images_get-iam-policy.md', 'Images', 'Get Iam Policy'] - ['images_insert.md', 'Images', 'Insert'] - ['images_list.md', 'Images', 'List'] +- ['images_set-iam-policy.md', 'Images', 'Set Iam Policy'] - ['images_set-labels.md', 'Images', 'Set Labels'] +- ['images_test-iam-permissions.md', 'Images', 'Test Iam Permissions'] - ['instance-group-managers_abandon-instances.md', 'Instance Group Managers', 'Abandon Instances'] - ['instance-group-managers_aggregated-list.md', 'Instance Group Managers', 'Aggregated List'] - ['instance-group-managers_delete.md', 'Instance Group Managers', 'Delete'] @@ -112,6 +118,7 @@ pages: - ['instance-group-managers_insert.md', 'Instance Group Managers', 'Insert'] - ['instance-group-managers_list.md', 'Instance Group Managers', 'List'] - ['instance-group-managers_list-managed-instances.md', 'Instance Group Managers', 'List Managed Instances'] +- ['instance-group-managers_patch.md', 'Instance Group Managers', 'Patch'] - ['instance-group-managers_recreate-instances.md', 'Instance Group Managers', 'Recreate Instances'] - ['instance-group-managers_resize.md', 'Instance Group Managers', 'Resize'] - ['instance-group-managers_set-instance-template.md', 'Instance Group Managers', 'Set Instance Template'] @@ -127,8 +134,11 @@ pages: - ['instance-groups_set-named-ports.md', 'Instance Groups', 'Set Named Ports'] - ['instance-templates_delete.md', 'Instance Templates', 'Delete'] - ['instance-templates_get.md', 'Instance Templates', 'Get'] +- ['instance-templates_get-iam-policy.md', 'Instance Templates', 'Get Iam Policy'] - ['instance-templates_insert.md', 'Instance Templates', 'Insert'] - ['instance-templates_list.md', 'Instance Templates', 'List'] +- ['instance-templates_set-iam-policy.md', 'Instance Templates', 'Set Iam Policy'] +- ['instance-templates_test-iam-permissions.md', 'Instance Templates', 'Test Iam Permissions'] - ['instances_add-access-config.md', 'Instances', 'Add Access Config'] - ['instances_aggregated-list.md', 'Instances', 'Aggregated List'] - ['instances_attach-disk.md', 'Instances', 'Attach Disk'] @@ -136,13 +146,16 @@ pages: - ['instances_delete-access-config.md', 'Instances', 'Delete Access Config'] - ['instances_detach-disk.md', 'Instances', 'Detach Disk'] - ['instances_get.md', 'Instances', 'Get'] +- ['instances_get-iam-policy.md', 'Instances', 'Get Iam Policy'] - ['instances_get-serial-port-output.md', 'Instances', 'Get Serial Port Output'] +- ['instances_get-shielded-instance-identity.md', 'Instances', 'Get Shielded Instance Identity'] - ['instances_insert.md', 'Instances', 'Insert'] - ['instances_list.md', 'Instances', 'List'] - ['instances_list-referrers.md', 'Instances', 'List Referrers'] - ['instances_reset.md', 'Instances', 'Reset'] - ['instances_set-deletion-protection.md', 'Instances', 'Set Deletion Protection'] - ['instances_set-disk-auto-delete.md', 'Instances', 'Set Disk Auto Delete'] +- ['instances_set-iam-policy.md', 'Instances', 'Set Iam Policy'] - ['instances_set-labels.md', 'Instances', 'Set Labels'] - ['instances_set-machine-resources.md', 'Instances', 'Set Machine Resources'] - ['instances_set-machine-type.md', 'Instances', 'Set Machine Type'] @@ -150,13 +163,16 @@ pages: - ['instances_set-min-cpu-platform.md', 'Instances', 'Set Min Cpu Platform'] - ['instances_set-scheduling.md', 'Instances', 'Set Scheduling'] - ['instances_set-service-account.md', 'Instances', 'Set Service Account'] +- ['instances_set-shielded-instance-integrity-policy.md', 'Instances', 'Set Shielded Instance Integrity Policy'] - ['instances_set-tags.md', 'Instances', 'Set Tags'] - ['instances_simulate-maintenance-event.md', 'Instances', 'Simulate Maintenance Event'] - ['instances_start.md', 'Instances', 'Start'] - ['instances_start-with-encryption-key.md', 'Instances', 'Start With Encryption Key'] - ['instances_stop.md', 'Instances', 'Stop'] +- ['instances_test-iam-permissions.md', 'Instances', 'Test Iam Permissions'] - ['instances_update-access-config.md', 'Instances', 'Update Access Config'] - ['instances_update-network-interface.md', 'Instances', 'Update Network Interface'] +- ['instances_update-shielded-instance-config.md', 'Instances', 'Update Shielded Instance Config'] - ['interconnect-attachments_aggregated-list.md', 'Interconnect Attachments', 'Aggregated List'] - ['interconnect-attachments_delete.md', 'Interconnect Attachments', 'Delete'] - ['interconnect-attachments_get.md', 'Interconnect Attachments', 'Get'] @@ -167,6 +183,7 @@ pages: - ['interconnect-locations_list.md', 'Interconnect Locations', 'List'] - ['interconnects_delete.md', 'Interconnects', 'Delete'] - ['interconnects_get.md', 'Interconnects', 'Get'] +- ['interconnects_get-diagnostics.md', 'Interconnects', 'Get Diagnostics'] - ['interconnects_insert.md', 'Interconnects', 'Insert'] - ['interconnects_list.md', 'Interconnects', 'List'] - ['interconnects_patch.md', 'Interconnects', 'Patch'] @@ -174,12 +191,23 @@ pages: - ['license-codes_test-iam-permissions.md', 'License Codes', 'Test Iam Permissions'] - ['licenses_delete.md', 'Licenses', 'Delete'] - ['licenses_get.md', 'Licenses', 'Get'] +- ['licenses_get-iam-policy.md', 'Licenses', 'Get Iam Policy'] - ['licenses_insert.md', 'Licenses', 'Insert'] - ['licenses_list.md', 'Licenses', 'List'] +- ['licenses_set-iam-policy.md', 'Licenses', 'Set Iam Policy'] - ['licenses_test-iam-permissions.md', 'Licenses', 'Test Iam Permissions'] - ['machine-types_aggregated-list.md', 'Machine Types', 'Aggregated List'] - ['machine-types_get.md', 'Machine Types', 'Get'] - ['machine-types_list.md', 'Machine Types', 'List'] +- ['network-endpoint-groups_aggregated-list.md', 'Network Endpoint Groups', 'Aggregated List'] +- ['network-endpoint-groups_attach-network-endpoints.md', 'Network Endpoint Groups', 'Attach Network Endpoints'] +- ['network-endpoint-groups_delete.md', 'Network Endpoint Groups', 'Delete'] +- ['network-endpoint-groups_detach-network-endpoints.md', 'Network Endpoint Groups', 'Detach Network Endpoints'] +- ['network-endpoint-groups_get.md', 'Network Endpoint Groups', 'Get'] +- ['network-endpoint-groups_insert.md', 'Network Endpoint Groups', 'Insert'] +- ['network-endpoint-groups_list.md', 'Network Endpoint Groups', 'List'] +- ['network-endpoint-groups_list-network-endpoints.md', 'Network Endpoint Groups', 'List Network Endpoints'] +- ['network-endpoint-groups_test-iam-permissions.md', 'Network Endpoint Groups', 'Test Iam Permissions'] - ['networks_add-peering.md', 'Networks', 'Add Peering'] - ['networks_delete.md', 'Networks', 'Delete'] - ['networks_get.md', 'Networks', 'Get'] @@ -193,15 +221,21 @@ pages: - ['node-groups_delete.md', 'Node Groups', 'Delete'] - ['node-groups_delete-nodes.md', 'Node Groups', 'Delete Nodes'] - ['node-groups_get.md', 'Node Groups', 'Get'] +- ['node-groups_get-iam-policy.md', 'Node Groups', 'Get Iam Policy'] - ['node-groups_insert.md', 'Node Groups', 'Insert'] - ['node-groups_list.md', 'Node Groups', 'List'] - ['node-groups_list-nodes.md', 'Node Groups', 'List Nodes'] +- ['node-groups_set-iam-policy.md', 'Node Groups', 'Set Iam Policy'] - ['node-groups_set-node-template.md', 'Node Groups', 'Set Node Template'] +- ['node-groups_test-iam-permissions.md', 'Node Groups', 'Test Iam Permissions'] - ['node-templates_aggregated-list.md', 'Node Templates', 'Aggregated List'] - ['node-templates_delete.md', 'Node Templates', 'Delete'] - ['node-templates_get.md', 'Node Templates', 'Get'] +- ['node-templates_get-iam-policy.md', 'Node Templates', 'Get Iam Policy'] - ['node-templates_insert.md', 'Node Templates', 'Insert'] - ['node-templates_list.md', 'Node Templates', 'List'] +- ['node-templates_set-iam-policy.md', 'Node Templates', 'Set Iam Policy'] +- ['node-templates_test-iam-permissions.md', 'Node Templates', 'Test Iam Permissions'] - ['node-types_aggregated-list.md', 'Node Types', 'Aggregated List'] - ['node-types_get.md', 'Node Types', 'Get'] - ['node-types_list.md', 'Node Types', 'List'] @@ -252,6 +286,7 @@ pages: - ['region-instance-group-managers_insert.md', 'Region Instance Group Managers', 'Insert'] - ['region-instance-group-managers_list.md', 'Region Instance Group Managers', 'List'] - ['region-instance-group-managers_list-managed-instances.md', 'Region Instance Group Managers', 'List Managed Instances'] +- ['region-instance-group-managers_patch.md', 'Region Instance Group Managers', 'Patch'] - ['region-instance-group-managers_recreate-instances.md', 'Region Instance Group Managers', 'Recreate Instances'] - ['region-instance-group-managers_resize.md', 'Region Instance Group Managers', 'Resize'] - ['region-instance-group-managers_set-instance-template.md', 'Region Instance Group Managers', 'Set Instance Template'] @@ -268,6 +303,7 @@ pages: - ['routers_aggregated-list.md', 'Routers', 'Aggregated List'] - ['routers_delete.md', 'Routers', 'Delete'] - ['routers_get.md', 'Routers', 'Get'] +- ['routers_get-nat-mapping-info.md', 'Routers', 'Get Nat Mapping Info'] - ['routers_get-router-status.md', 'Routers', 'Get Router Status'] - ['routers_insert.md', 'Routers', 'Insert'] - ['routers_list.md', 'Routers', 'List'] @@ -289,8 +325,11 @@ pages: - ['security-policies_remove-rule.md', 'Security Policies', 'Remove Rule'] - ['snapshots_delete.md', 'Snapshots', 'Delete'] - ['snapshots_get.md', 'Snapshots', 'Get'] +- ['snapshots_get-iam-policy.md', 'Snapshots', 'Get Iam Policy'] - ['snapshots_list.md', 'Snapshots', 'List'] +- ['snapshots_set-iam-policy.md', 'Snapshots', 'Set Iam Policy'] - ['snapshots_set-labels.md', 'Snapshots', 'Set Labels'] +- ['snapshots_test-iam-permissions.md', 'Snapshots', 'Test Iam Permissions'] - ['ssl-certificates_delete.md', 'Ssl Certificates', 'Delete'] - ['ssl-certificates_get.md', 'Ssl Certificates', 'Get'] - ['ssl-certificates_insert.md', 'Ssl Certificates', 'Insert'] @@ -305,11 +344,14 @@ pages: - ['subnetworks_delete.md', 'Subnetworks', 'Delete'] - ['subnetworks_expand-ip-cidr-range.md', 'Subnetworks', 'Expand Ip Cidr Range'] - ['subnetworks_get.md', 'Subnetworks', 'Get'] +- ['subnetworks_get-iam-policy.md', 'Subnetworks', 'Get Iam Policy'] - ['subnetworks_insert.md', 'Subnetworks', 'Insert'] - ['subnetworks_list.md', 'Subnetworks', 'List'] - ['subnetworks_list-usable.md', 'Subnetworks', 'List Usable'] - ['subnetworks_patch.md', 'Subnetworks', 'Patch'] +- ['subnetworks_set-iam-policy.md', 'Subnetworks', 'Set Iam Policy'] - ['subnetworks_set-private-ip-google-access.md', 'Subnetworks', 'Set Private Ip Google Access'] +- ['subnetworks_test-iam-permissions.md', 'Subnetworks', 'Test Iam Permissions'] - ['target-http-proxies_delete.md', 'Target Http Proxies', 'Delete'] - ['target-http-proxies_get.md', 'Target Http Proxies', 'Get'] - ['target-http-proxies_insert.md', 'Target Http Proxies', 'Insert'] diff --git a/gen/compute1-cli/src/main.rs b/gen/compute1-cli/src/main.rs index 55b3b83292..d09f679789 100644 --- a/gen/compute1-cli/src/main.rs +++ b/gen/compute1-cli/src/main.rs @@ -427,19 +427,22 @@ impl<'n> Engine<'n> { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "address-type" => Some(("addressType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "users" => Some(("users", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "prefix-length" => Some(("prefixLength", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ip-version" => Some(("ipVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network-tier" => Some(("networkTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "users" => Some(("users", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "purpose" => Some(("purpose", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "address" => Some(("address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subnetwork" => Some(("subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "address-type", "creation-timestamp", "description", "id", "ip-version", "kind", "name", "network-tier", "region", "self-link", "status", "subnetwork", "users"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "address-type", "creation-timestamp", "description", "id", "ip-version", "kind", "name", "network", "network-tier", "prefix-length", "purpose", "region", "self-link", "status", "subnetwork", "users"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2162,9 +2165,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "connection-draining.draining-timeout-sec" => Some(("connectionDraining.drainingTimeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "protocol" => Some(("protocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cdn-policy.signed-url-key-names" => Some(("cdnPolicy.signedUrlKeyNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "cdn-policy.signed-url-cache-max-age-sec" => Some(("cdnPolicy.signedUrlCacheMaxAgeSec", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.query-string-blacklist" => Some(("cdnPolicy.cacheKeyPolicy.queryStringBlacklist", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2173,26 +2179,24 @@ impl<'n> Engine<'n> { "cdn-policy.cache-key-policy.include-host" => Some(("cdnPolicy.cacheKeyPolicy.includeHost", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.include-protocol" => Some(("cdnPolicy.cacheKeyPolicy.includeProtocol", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "enable-cdn" => Some(("enableCDN", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "affinity-cookie-ttl-sec" => Some(("affinityCookieTtlSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "session-affinity" => Some(("sessionAffinity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-request-headers" => Some(("customRequestHeaders", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "security-policy" => Some(("securityPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "port-name" => Some(("portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "custom-request-headers", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2345,9 +2349,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "connection-draining.draining-timeout-sec" => Some(("connectionDraining.drainingTimeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "protocol" => Some(("protocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cdn-policy.signed-url-key-names" => Some(("cdnPolicy.signedUrlKeyNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "cdn-policy.signed-url-cache-max-age-sec" => Some(("cdnPolicy.signedUrlCacheMaxAgeSec", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.query-string-blacklist" => Some(("cdnPolicy.cacheKeyPolicy.queryStringBlacklist", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2356,26 +2363,24 @@ impl<'n> Engine<'n> { "cdn-policy.cache-key-policy.include-host" => Some(("cdnPolicy.cacheKeyPolicy.includeHost", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.include-protocol" => Some(("cdnPolicy.cacheKeyPolicy.includeProtocol", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "enable-cdn" => Some(("enableCDN", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "affinity-cookie-ttl-sec" => Some(("affinityCookieTtlSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "session-affinity" => Some(("sessionAffinity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-request-headers" => Some(("customRequestHeaders", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "security-policy" => Some(("securityPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "port-name" => Some(("portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "custom-request-headers", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2552,9 +2557,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "connection-draining.draining-timeout-sec" => Some(("connectionDraining.drainingTimeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "protocol" => Some(("protocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cdn-policy.signed-url-key-names" => Some(("cdnPolicy.signedUrlKeyNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "cdn-policy.signed-url-cache-max-age-sec" => Some(("cdnPolicy.signedUrlCacheMaxAgeSec", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.query-string-blacklist" => Some(("cdnPolicy.cacheKeyPolicy.queryStringBlacklist", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2563,26 +2571,24 @@ impl<'n> Engine<'n> { "cdn-policy.cache-key-policy.include-host" => Some(("cdnPolicy.cacheKeyPolicy.includeHost", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.include-protocol" => Some(("cdnPolicy.cacheKeyPolicy.includeProtocol", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "enable-cdn" => Some(("enableCDN", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "affinity-cookie-ttl-sec" => Some(("affinityCookieTtlSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "session-affinity" => Some(("sessionAffinity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-request-headers" => Some(("customRequestHeaders", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "security-policy" => Some(("securityPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "port-name" => Some(("portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "custom-request-headers", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2927,19 +2933,20 @@ impl<'n> Engine<'n> { "snapshot-encryption-key.raw-key" => Some(("snapshotEncryptionKey.rawKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snapshot-encryption-key.sha256" => Some(("snapshotEncryptionKey.sha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snapshot-encryption-key.kms-key-name" => Some(("snapshotEncryptionKey.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "storage-bytes-status" => Some(("storageBytesStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "storage-locations" => Some(("storageLocations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "label-fingerprint" => Some(("labelFingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "source-disk-id" => Some(("sourceDiskId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "disk-size-gb" => Some(("diskSizeGb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "source-disk" => Some(("sourceDisk", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "licenses" => Some(("licenses", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "storage-bytes-status" => Some(("storageBytesStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "license-codes" => Some(("licenseCodes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "disk-size-gb", "id", "kind", "kms-key-name", "label-fingerprint", "labels", "license-codes", "licenses", "name", "raw-key", "self-link", "sha256", "snapshot-encryption-key", "source-disk", "source-disk-encryption-key", "source-disk-id", "status", "storage-bytes", "storage-bytes-status"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "disk-size-gb", "id", "kind", "kms-key-name", "label-fingerprint", "labels", "license-codes", "licenses", "name", "raw-key", "self-link", "sha256", "snapshot-encryption-key", "source-disk", "source-disk-encryption-key", "source-disk-id", "status", "storage-bytes", "storage-bytes-status", "storage-locations"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3114,6 +3121,58 @@ impl<'n> Engine<'n> { } } + fn _disks_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.disks().get_iam_policy(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _disks_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -3149,6 +3208,7 @@ impl<'n> Engine<'n> { "disk-encryption-key.sha256" => Some(("diskEncryptionKey.sha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "disk-encryption-key.kms-key-name" => Some(("diskEncryptionKey.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "physical-block-size-bytes" => Some(("physicalBlockSizeBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-attach-timestamp" => Some(("lastAttachTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3171,7 +3231,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "source-image" => Some(("sourceImage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "disk-encryption-key", "id", "kind", "kms-key-name", "label-fingerprint", "labels", "last-attach-timestamp", "last-detach-timestamp", "license-codes", "licenses", "name", "options", "raw-key", "region", "replica-zones", "self-link", "sha256", "size-gb", "source-image", "source-image-encryption-key", "source-image-id", "source-snapshot", "source-snapshot-encryption-key", "source-snapshot-id", "status", "type", "users", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "disk-encryption-key", "id", "kind", "kms-key-name", "label-fingerprint", "labels", "last-attach-timestamp", "last-detach-timestamp", "license-codes", "licenses", "name", "options", "physical-block-size-bytes", "raw-key", "region", "replica-zones", "self-link", "sha256", "size-gb", "source-image", "source-image-encryption-key", "source-image-id", "source-snapshot", "source-snapshot-encryption-key", "source-snapshot-id", "status", "type", "users", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3392,6 +3452,94 @@ impl<'n> Engine<'n> { } } + fn _disks_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.iam-owned" => Some(("policy.iamOwned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "iam-owned", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ZoneSetPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.disks().set_iam_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _disks_set_labels(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -3482,6 +3630,91 @@ impl<'n> Engine<'n> { } } + fn _disks_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.disks().test_iam_permissions(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _firewalls_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.firewalls().delete(opt.value_of("project").unwrap_or(""), opt.value_of("firewall").unwrap_or("")); @@ -3625,12 +3858,13 @@ impl<'n> Engine<'n> { "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "target-service-accounts" => Some(("targetServiceAccounts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "target-tags" => Some(("targetTags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "log-config.enable" => Some(("logConfig.enable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "destination-ranges", "direction", "disabled", "id", "kind", "name", "network", "priority", "self-link", "source-ranges", "source-service-accounts", "source-tags", "target-service-accounts", "target-tags"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "destination-ranges", "direction", "disabled", "enable", "id", "kind", "log-config", "name", "network", "priority", "self-link", "source-ranges", "source-service-accounts", "source-tags", "target-service-accounts", "target-tags"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3794,12 +4028,13 @@ impl<'n> Engine<'n> { "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "target-service-accounts" => Some(("targetServiceAccounts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "target-tags" => Some(("targetTags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "log-config.enable" => Some(("logConfig.enable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "destination-ranges", "direction", "disabled", "id", "kind", "name", "network", "priority", "self-link", "source-ranges", "source-service-accounts", "source-tags", "target-service-accounts", "target-tags"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "destination-ranges", "direction", "disabled", "enable", "id", "kind", "log-config", "name", "network", "priority", "self-link", "source-ranges", "source-service-accounts", "source-tags", "target-service-accounts", "target-tags"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3898,12 +4133,13 @@ impl<'n> Engine<'n> { "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "target-service-accounts" => Some(("targetServiceAccounts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "target-tags" => Some(("targetTags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "log-config.enable" => Some(("logConfig.enable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "destination-ranges", "direction", "disabled", "id", "kind", "name", "network", "priority", "self-link", "source-ranges", "source-service-accounts", "source-tags", "target-service-accounts", "target-tags"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "destination-ranges", "direction", "disabled", "enable", "id", "kind", "log-config", "name", "network", "priority", "self-link", "source-ranges", "source-service-accounts", "source-tags", "target-service-accounts", "target-tags"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4163,26 +4399,29 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "ip-address" => Some(("IPAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "target" => Some(("target", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-label" => Some(("serviceLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network-tier" => Some(("networkTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "port-range" => Some(("portRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ip-address" => Some(("IPAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backend-service" => Some(("backendService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ip-version" => Some(("ipVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "backend-service" => Some(("backendService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "all-ports" => Some(("allPorts", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "ports" => Some(("ports", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "ip-protocol" => Some(("IPProtocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subnetwork" => Some(("subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target" => Some(("target", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-name" => Some(("serviceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["ip-address", "ip-protocol", "backend-service", "creation-timestamp", "description", "id", "ip-version", "kind", "load-balancing-scheme", "name", "network", "network-tier", "port-range", "ports", "region", "self-link", "subnetwork", "target"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["ip-address", "ip-protocol", "all-ports", "backend-service", "creation-timestamp", "description", "id", "ip-version", "kind", "load-balancing-scheme", "name", "network", "network-tier", "port-range", "ports", "region", "self-link", "service-label", "service-name", "subnetwork", "target"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4534,19 +4773,22 @@ impl<'n> Engine<'n> { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "address-type" => Some(("addressType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "users" => Some(("users", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "prefix-length" => Some(("prefixLength", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ip-version" => Some(("ipVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network-tier" => Some(("networkTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "users" => Some(("users", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "purpose" => Some(("purpose", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "address" => Some(("address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subnetwork" => Some(("subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "address-type", "creation-timestamp", "description", "id", "ip-version", "kind", "name", "network-tier", "region", "self-link", "status", "subnetwork", "users"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "address-type", "creation-timestamp", "description", "id", "ip-version", "kind", "name", "network", "network-tier", "prefix-length", "purpose", "region", "self-link", "status", "subnetwork", "users"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4806,26 +5048,29 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "ip-address" => Some(("IPAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "target" => Some(("target", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-label" => Some(("serviceLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network-tier" => Some(("networkTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "port-range" => Some(("portRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ip-address" => Some(("IPAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backend-service" => Some(("backendService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ip-version" => Some(("ipVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "backend-service" => Some(("backendService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "all-ports" => Some(("allPorts", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "ports" => Some(("ports", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "ip-protocol" => Some(("IPProtocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subnetwork" => Some(("subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target" => Some(("target", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-name" => Some(("serviceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["ip-address", "ip-protocol", "backend-service", "creation-timestamp", "description", "id", "ip-version", "kind", "load-balancing-scheme", "name", "network", "network-tier", "port-range", "ports", "region", "self-link", "subnetwork", "target"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["ip-address", "ip-protocol", "all-ports", "backend-service", "creation-timestamp", "description", "id", "ip-version", "kind", "load-balancing-scheme", "name", "network", "network-tier", "port-range", "ports", "region", "self-link", "service-label", "service-name", "subnetwork", "target"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -5405,36 +5650,47 @@ impl<'n> Engine<'n> { "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "check-interval-sec" => Some(("checkIntervalSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "tcp-health-check.proxy-header" => Some(("tcpHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.request" => Some(("tcpHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.port-specification" => Some(("tcpHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.port" => Some(("tcpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "tcp-health-check.port-name" => Some(("tcpHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.response" => Some(("tcpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.request-path" => Some(("httpHealthCheck.requestPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.proxy-header" => Some(("httpHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "http-health-check.port" => Some(("httpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "http-health-check.port-specification" => Some(("httpHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-health-check.response" => Some(("httpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.host" => Some(("httpHealthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.port-name" => Some(("httpHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "http-health-check.response" => Some(("httpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.port-name" => Some(("tcpHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.request" => Some(("tcpHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.proxy-header" => Some(("tcpHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.port" => Some(("tcpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "tcp-health-check.response" => Some(("tcpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "healthy-threshold" => Some(("healthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "ssl-health-check.port-name" => Some(("sslHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ssl-health-check.request" => Some(("sslHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ssl-health-check.proxy-header" => Some(("sslHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ssl-health-check.port" => Some(("sslHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "ssl-health-check.response" => Some(("sslHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "unhealthy-threshold" => Some(("unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "http-health-check.port" => Some(("httpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "https-health-check.request-path" => Some(("httpsHealthCheck.requestPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "https-health-check.proxy-header" => Some(("httpsHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "https-health-check.port" => Some(("httpsHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "https-health-check.port-specification" => Some(("httpsHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "https-health-check.response" => Some(("httpsHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "https-health-check.host" => Some(("httpsHealthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "https-health-check.port-name" => Some(("httpsHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "https-health-check.response" => Some(("httpsHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "https-health-check.port" => Some(("httpsHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "healthy-threshold" => Some(("healthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-health-check.proxy-header" => Some(("sslHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.request" => Some(("sslHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.port-specification" => Some(("sslHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.port" => Some(("sslHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-health-check.port-name" => Some(("sslHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.response" => Some(("sslHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.request-path" => Some(("http2HealthCheck.requestPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.proxy-header" => Some(("http2HealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.port-specification" => Some(("http2HealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.response" => Some(("http2HealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.host" => Some(("http2HealthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.port-name" => Some(("http2HealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.port" => Some(("http2HealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "unhealthy-threshold" => Some(("unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["check-interval-sec", "creation-timestamp", "description", "healthy-threshold", "host", "http-health-check", "https-health-check", "id", "kind", "name", "port", "port-name", "proxy-header", "request", "request-path", "response", "self-link", "ssl-health-check", "tcp-health-check", "timeout-sec", "type", "unhealthy-threshold"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["check-interval-sec", "creation-timestamp", "description", "healthy-threshold", "host", "http2-health-check", "http-health-check", "https-health-check", "id", "kind", "name", "port", "port-name", "port-specification", "proxy-header", "request", "request-path", "response", "self-link", "ssl-health-check", "tcp-health-check", "timeout-sec", "type", "unhealthy-threshold"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -5591,36 +5847,47 @@ impl<'n> Engine<'n> { "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "check-interval-sec" => Some(("checkIntervalSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "tcp-health-check.proxy-header" => Some(("tcpHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.request" => Some(("tcpHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.port-specification" => Some(("tcpHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.port" => Some(("tcpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "tcp-health-check.port-name" => Some(("tcpHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.response" => Some(("tcpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.request-path" => Some(("httpHealthCheck.requestPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.proxy-header" => Some(("httpHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "http-health-check.port" => Some(("httpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "http-health-check.port-specification" => Some(("httpHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-health-check.response" => Some(("httpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.host" => Some(("httpHealthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.port-name" => Some(("httpHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "http-health-check.response" => Some(("httpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.port-name" => Some(("tcpHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.request" => Some(("tcpHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.proxy-header" => Some(("tcpHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.port" => Some(("tcpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "tcp-health-check.response" => Some(("tcpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "healthy-threshold" => Some(("healthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "ssl-health-check.port-name" => Some(("sslHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ssl-health-check.request" => Some(("sslHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ssl-health-check.proxy-header" => Some(("sslHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ssl-health-check.port" => Some(("sslHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "ssl-health-check.response" => Some(("sslHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "unhealthy-threshold" => Some(("unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "http-health-check.port" => Some(("httpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "https-health-check.request-path" => Some(("httpsHealthCheck.requestPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "https-health-check.proxy-header" => Some(("httpsHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "https-health-check.port" => Some(("httpsHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "https-health-check.port-specification" => Some(("httpsHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "https-health-check.response" => Some(("httpsHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "https-health-check.host" => Some(("httpsHealthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "https-health-check.port-name" => Some(("httpsHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "https-health-check.response" => Some(("httpsHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "https-health-check.port" => Some(("httpsHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "healthy-threshold" => Some(("healthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-health-check.proxy-header" => Some(("sslHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.request" => Some(("sslHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.port-specification" => Some(("sslHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.port" => Some(("sslHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-health-check.port-name" => Some(("sslHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.response" => Some(("sslHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.request-path" => Some(("http2HealthCheck.requestPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.proxy-header" => Some(("http2HealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.port-specification" => Some(("http2HealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.response" => Some(("http2HealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.host" => Some(("http2HealthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.port-name" => Some(("http2HealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.port" => Some(("http2HealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "unhealthy-threshold" => Some(("unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["check-interval-sec", "creation-timestamp", "description", "healthy-threshold", "host", "http-health-check", "https-health-check", "id", "kind", "name", "port", "port-name", "proxy-header", "request", "request-path", "response", "self-link", "ssl-health-check", "tcp-health-check", "timeout-sec", "type", "unhealthy-threshold"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["check-interval-sec", "creation-timestamp", "description", "healthy-threshold", "host", "http2-health-check", "http-health-check", "https-health-check", "id", "kind", "name", "port", "port-name", "port-specification", "proxy-header", "request", "request-path", "response", "self-link", "ssl-health-check", "tcp-health-check", "timeout-sec", "type", "unhealthy-threshold"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -5712,36 +5979,47 @@ impl<'n> Engine<'n> { "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "check-interval-sec" => Some(("checkIntervalSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "tcp-health-check.proxy-header" => Some(("tcpHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.request" => Some(("tcpHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.port-specification" => Some(("tcpHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.port" => Some(("tcpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "tcp-health-check.port-name" => Some(("tcpHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tcp-health-check.response" => Some(("tcpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.request-path" => Some(("httpHealthCheck.requestPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.proxy-header" => Some(("httpHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "http-health-check.port" => Some(("httpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "http-health-check.port-specification" => Some(("httpHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-health-check.response" => Some(("httpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.host" => Some(("httpHealthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-health-check.port-name" => Some(("httpHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "http-health-check.response" => Some(("httpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.port-name" => Some(("tcpHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.request" => Some(("tcpHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.proxy-header" => Some(("tcpHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tcp-health-check.port" => Some(("tcpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "tcp-health-check.response" => Some(("tcpHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "healthy-threshold" => Some(("healthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "ssl-health-check.port-name" => Some(("sslHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ssl-health-check.request" => Some(("sslHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ssl-health-check.proxy-header" => Some(("sslHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ssl-health-check.port" => Some(("sslHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "ssl-health-check.response" => Some(("sslHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "unhealthy-threshold" => Some(("unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "http-health-check.port" => Some(("httpHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "https-health-check.request-path" => Some(("httpsHealthCheck.requestPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "https-health-check.proxy-header" => Some(("httpsHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "https-health-check.port" => Some(("httpsHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "https-health-check.port-specification" => Some(("httpsHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "https-health-check.response" => Some(("httpsHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "https-health-check.host" => Some(("httpsHealthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "https-health-check.port-name" => Some(("httpsHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "https-health-check.response" => Some(("httpsHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "https-health-check.port" => Some(("httpsHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "healthy-threshold" => Some(("healthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-health-check.proxy-header" => Some(("sslHealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.request" => Some(("sslHealthCheck.request", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.port-specification" => Some(("sslHealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.port" => Some(("sslHealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-health-check.port-name" => Some(("sslHealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-health-check.response" => Some(("sslHealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.request-path" => Some(("http2HealthCheck.requestPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.proxy-header" => Some(("http2HealthCheck.proxyHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.port-specification" => Some(("http2HealthCheck.portSpecification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.response" => Some(("http2HealthCheck.response", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.host" => Some(("http2HealthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.port-name" => Some(("http2HealthCheck.portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http2-health-check.port" => Some(("http2HealthCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "unhealthy-threshold" => Some(("unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["check-interval-sec", "creation-timestamp", "description", "healthy-threshold", "host", "http-health-check", "https-health-check", "id", "kind", "name", "port", "port-name", "proxy-header", "request", "request-path", "response", "self-link", "ssl-health-check", "tcp-health-check", "timeout-sec", "type", "unhealthy-threshold"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["check-interval-sec", "creation-timestamp", "description", "healthy-threshold", "host", "http2-health-check", "http-health-check", "https-health-check", "id", "kind", "name", "port", "port-name", "port-specification", "proxy-header", "request", "request-path", "response", "self-link", "ssl-health-check", "tcp-health-check", "timeout-sec", "type", "unhealthy-threshold"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -7010,6 +7288,58 @@ impl<'n> Engine<'n> { } } + fn _images_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.images().get_iam_policy(opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _images_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -7207,6 +7537,94 @@ impl<'n> Engine<'n> { } } + fn _images_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.iam-owned" => Some(("policy.iamOwned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "iam-owned", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GlobalSetPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.images().set_iam_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _images_set_labels(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -7293,6 +7711,91 @@ impl<'n> Engine<'n> { } } + fn _images_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.images().test_iam_permissions(request, opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _instance_group_managers_abandon_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -7667,9 +8170,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "status.is-stable" => Some(("status.isStable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "current-actions.none" => Some(("currentActions.none", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.recreating" => Some(("currentActions.recreating", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.creating" => Some(("currentActions.creating", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.verifying" => Some(("currentActions.verifying", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.restarting" => Some(("currentActions.restarting", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.abandoning" => Some(("currentActions.abandoning", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.deleting" => Some(("currentActions.deleting", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -7683,6 +8188,14 @@ impl<'n> Engine<'n> { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "target-pools" => Some(("targetPools", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "instance-template" => Some(("instanceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.type" => Some(("updatePolicy.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.max-surge.calculated" => Some(("updatePolicy.maxSurge.calculated", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-surge.fixed" => Some(("updatePolicy.maxSurge.fixed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-surge.percent" => Some(("updatePolicy.maxSurge.percent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.minimal-action" => Some(("updatePolicy.minimalAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.calculated" => Some(("updatePolicy.maxUnavailable.calculated", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.fixed" => Some(("updatePolicy.maxUnavailable.fixed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.percent" => Some(("updatePolicy.maxUnavailable.percent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "base-instance-name" => Some(("baseInstanceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -7690,7 +8203,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["abandoning", "base-instance-name", "creating", "creating-without-retries", "creation-timestamp", "current-actions", "deleting", "description", "fingerprint", "id", "instance-group", "instance-template", "kind", "name", "none", "recreating", "refreshing", "region", "restarting", "self-link", "target-pools", "target-size", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["abandoning", "base-instance-name", "calculated", "creating", "creating-without-retries", "creation-timestamp", "current-actions", "deleting", "description", "fingerprint", "fixed", "id", "instance-group", "instance-template", "is-stable", "kind", "max-surge", "max-unavailable", "minimal-action", "name", "none", "percent", "recreating", "refreshing", "region", "restarting", "self-link", "status", "target-pools", "target-size", "type", "update-policy", "verifying", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -7884,6 +8397,126 @@ impl<'n> Engine<'n> { } } + fn _instance_group_managers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status.is-stable" => Some(("status.isStable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "current-actions.none" => Some(("currentActions.none", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.recreating" => Some(("currentActions.recreating", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.creating" => Some(("currentActions.creating", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.verifying" => Some(("currentActions.verifying", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.restarting" => Some(("currentActions.restarting", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.abandoning" => Some(("currentActions.abandoning", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.deleting" => Some(("currentActions.deleting", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.creating-without-retries" => Some(("currentActions.creatingWithoutRetries", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.refreshing" => Some(("currentActions.refreshing", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "target-size" => Some(("targetSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instance-group" => Some(("instanceGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "target-pools" => Some(("targetPools", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "instance-template" => Some(("instanceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.type" => Some(("updatePolicy.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.max-surge.calculated" => Some(("updatePolicy.maxSurge.calculated", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-surge.fixed" => Some(("updatePolicy.maxSurge.fixed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-surge.percent" => Some(("updatePolicy.maxSurge.percent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.minimal-action" => Some(("updatePolicy.minimalAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.calculated" => Some(("updatePolicy.maxUnavailable.calculated", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.fixed" => Some(("updatePolicy.maxUnavailable.fixed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.percent" => Some(("updatePolicy.maxUnavailable.percent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "base-instance-name" => Some(("baseInstanceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["abandoning", "base-instance-name", "calculated", "creating", "creating-without-retries", "creation-timestamp", "current-actions", "deleting", "description", "fingerprint", "fixed", "id", "instance-group", "instance-template", "is-stable", "kind", "max-surge", "max-unavailable", "minimal-action", "name", "none", "percent", "recreating", "refreshing", "region", "restarting", "self-link", "status", "target-pools", "target-size", "type", "update-policy", "verifying", "zone"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::InstanceGroupManager = json::value::from_value(object).unwrap(); + let mut call = self.hub.instance_group_managers().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "request-id" => { + call = call.request_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["request-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _instance_group_managers_recreate_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -9018,6 +9651,58 @@ impl<'n> Engine<'n> { } } + fn _instance_templates_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.instance_templates().get_iam_policy(opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _instance_templates_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -9048,6 +9733,9 @@ impl<'n> Engine<'n> { "properties.tags.items" => Some(("properties.tags.items", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "properties.tags.fingerprint" => Some(("properties.tags.fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "properties.labels" => Some(("properties.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "properties.shielded-instance-config.enable-vtpm" => Some(("properties.shieldedInstanceConfig.enableVtpm", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "properties.shielded-instance-config.enable-integrity-monitoring" => Some(("properties.shieldedInstanceConfig.enableIntegrityMonitoring", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "properties.shielded-instance-config.enable-secure-boot" => Some(("properties.shieldedInstanceConfig.enableSecureBoot", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "properties.min-cpu-platform" => Some(("properties.minCpuPlatform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "properties.scheduling.automatic-restart" => Some(("properties.scheduling.automaticRestart", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "properties.scheduling.preemptible" => Some(("properties.scheduling.preemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -9061,7 +9749,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["automatic-restart", "can-ip-forward", "creation-timestamp", "description", "fingerprint", "id", "items", "kind", "labels", "machine-type", "metadata", "min-cpu-platform", "name", "on-host-maintenance", "preemptible", "properties", "scheduling", "self-link", "source-instance", "tags"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["automatic-restart", "can-ip-forward", "creation-timestamp", "description", "enable-integrity-monitoring", "enable-secure-boot", "enable-vtpm", "fingerprint", "id", "items", "kind", "labels", "machine-type", "metadata", "min-cpu-platform", "name", "on-host-maintenance", "preemptible", "properties", "scheduling", "self-link", "shielded-instance-config", "source-instance", "tags"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -9190,6 +9878,179 @@ impl<'n> Engine<'n> { } } + fn _instance_templates_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.iam-owned" => Some(("policy.iamOwned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "iam-owned", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GlobalSetPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.instance_templates().set_iam_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _instance_templates_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.instance_templates().test_iam_permissions(request, opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _instances_add_access_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -9683,6 +10544,58 @@ impl<'n> Engine<'n> { } } + fn _instances_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.instances().get_iam_policy(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _instances_get_serial_port_output(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().get_serial_port_output(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); @@ -9742,6 +10655,58 @@ impl<'n> Engine<'n> { } } + fn _instances_get_shielded_instance_identity(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.instances().get_shielded_instance_identity(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _instances_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -9765,32 +10730,37 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "cpu-platform" => Some(("cpuPlatform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-restricted" => Some(("startRestricted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "status-message" => Some(("statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "can-ip-forward" => Some(("canIpForward", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "deletion-protection" => Some(("deletionProtection", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "label-fingerprint" => Some(("labelFingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "metadata.kind" => Some(("metadata.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "metadata.fingerprint" => Some(("metadata.fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "scheduling.automatic-restart" => Some(("scheduling.automaticRestart", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "scheduling.preemptible" => Some(("scheduling.preemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "scheduling.on-host-maintenance" => Some(("scheduling.onHostMaintenance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "min-cpu-platform" => Some(("minCpuPlatform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "machine-type" => Some(("machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-restricted" => Some(("startRestricted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "shielded-instance-config.enable-vtpm" => Some(("shieldedInstanceConfig.enableVtpm", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "shielded-instance-config.enable-integrity-monitoring" => Some(("shieldedInstanceConfig.enableIntegrityMonitoring", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "shielded-instance-config.enable-secure-boot" => Some(("shieldedInstanceConfig.enableSecureBoot", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hostname" => Some(("hostname", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "shielded-instance-integrity-policy.update-auto-learn-policy" => Some(("shieldedInstanceIntegrityPolicy.updateAutoLearnPolicy", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status-message" => Some(("statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "metadata.kind" => Some(("metadata.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "metadata.fingerprint" => Some(("metadata.fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cpu-platform" => Some(("cpuPlatform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deletion-protection" => Some(("deletionProtection", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "can-ip-forward" => Some(("canIpForward", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "tags.items" => Some(("tags.items", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "tags.fingerprint" => Some(("tags.fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "label-fingerprint" => Some(("labelFingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "machine-type" => Some(("machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["automatic-restart", "can-ip-forward", "cpu-platform", "creation-timestamp", "deletion-protection", "description", "fingerprint", "id", "items", "kind", "label-fingerprint", "labels", "machine-type", "metadata", "min-cpu-platform", "name", "on-host-maintenance", "preemptible", "scheduling", "self-link", "start-restricted", "status", "status-message", "tags", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["automatic-restart", "can-ip-forward", "cpu-platform", "creation-timestamp", "deletion-protection", "description", "enable-integrity-monitoring", "enable-secure-boot", "enable-vtpm", "fingerprint", "hostname", "id", "items", "kind", "label-fingerprint", "labels", "machine-type", "metadata", "min-cpu-platform", "name", "on-host-maintenance", "preemptible", "scheduling", "self-link", "shielded-instance-config", "shielded-instance-integrity-policy", "start-restricted", "status", "status-message", "tags", "update-auto-learn-policy", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -10159,6 +11129,94 @@ impl<'n> Engine<'n> { } } + fn _instances_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.iam-owned" => Some(("policy.iamOwned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "iam-owned", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ZoneSetPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.instances().set_iam_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _instances_set_labels(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -10786,6 +11844,95 @@ impl<'n> Engine<'n> { } } + fn _instances_set_shielded_instance_integrity_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-auto-learn-policy" => Some(("updateAutoLearnPolicy", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["update-auto-learn-policy"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ShieldedInstanceIntegrityPolicy = json::value::from_value(object).unwrap(); + let mut call = self.hub.instances().set_shielded_instance_integrity_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "request-id" => { + call = call.request_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["request-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _instances_set_tags(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -11128,6 +12275,91 @@ impl<'n> Engine<'n> { } } + fn _instances_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.instances().test_iam_permissions(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _instances_update_access_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -11317,6 +12549,97 @@ impl<'n> Engine<'n> { } } + fn _instances_update_shielded_instance_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "enable-vtpm" => Some(("enableVtpm", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "enable-integrity-monitoring" => Some(("enableIntegrityMonitoring", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "enable-secure-boot" => Some(("enableSecureBoot", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["enable-integrity-monitoring", "enable-secure-boot", "enable-vtpm"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ShieldedInstanceConfig = json::value::from_value(object).unwrap(); + let mut call = self.hub.instances().update_shielded_instance_config(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "request-id" => { + call = call.request_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["request-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _interconnect_attachments_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.interconnect_attachments().aggregated_list(opt.value_of("project").unwrap_or("")); @@ -12008,6 +13331,58 @@ impl<'n> Engine<'n> { } } + fn _interconnects_get_diagnostics(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.interconnects().get_diagnostics(opt.value_of("project").unwrap_or(""), opt.value_of("interconnect").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _interconnects_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -12534,6 +13909,58 @@ impl<'n> Engine<'n> { } } + fn _licenses_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.licenses().get_iam_policy(opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _licenses_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -12698,6 +14125,94 @@ impl<'n> Engine<'n> { } } + fn _licenses_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.iam-owned" => Some(("policy.iamOwned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "iam-owned", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GlobalSetPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.licenses().set_iam_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _licenses_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -12965,6 +14480,703 @@ impl<'n> Engine<'n> { } } + fn _network_endpoint_groups_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.network_endpoint_groups().aggregated_list(opt.value_of("project").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _network_endpoint_groups_attach_network_endpoints(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::NetworkEndpointGroupsAttachEndpointsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.network_endpoint_groups().attach_network_endpoints(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("network-endpoint-group").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "request-id" => { + call = call.request_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["request-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _network_endpoint_groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.network_endpoint_groups().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("network-endpoint-group").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "request-id" => { + call = call.request_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["request-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _network_endpoint_groups_detach_network_endpoints(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::NetworkEndpointGroupsDetachEndpointsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.network_endpoint_groups().detach_network_endpoints(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("network-endpoint-group").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "request-id" => { + call = call.request_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["request-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _network_endpoint_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.network_endpoint_groups().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("network-endpoint-group").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _network_endpoint_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-port" => Some(("defaultPort", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "network-endpoint-type" => Some(("networkEndpointType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subnetwork" => Some(("subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size" => Some(("size", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "default-port", "description", "id", "kind", "name", "network", "network-endpoint-type", "self-link", "size", "subnetwork", "zone"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::NetworkEndpointGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.network_endpoint_groups().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "request-id" => { + call = call.request_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["request-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _network_endpoint_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.network_endpoint_groups().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _network_endpoint_groups_list_network_endpoints(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "health-status" => Some(("healthStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["health-status"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::NetworkEndpointGroupsListEndpointsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.network_endpoint_groups().list_network_endpoints(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("network-endpoint-group").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _network_endpoint_groups_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.network_endpoint_groups().test_iam_permissions(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _networks_add_peering(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -12988,11 +15200,17 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "network-peering.network" => Some(("networkPeering.network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network-peering.auto-create-routes" => Some(("networkPeering.autoCreateRoutes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "network-peering.state-details" => Some(("networkPeering.stateDetails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network-peering.state" => Some(("networkPeering.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network-peering.exchange-subnet-routes" => Some(("networkPeering.exchangeSubnetRoutes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "network-peering.name" => Some(("networkPeering.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "peer-network" => Some(("peerNetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "auto-create-routes" => Some(("autoCreateRoutes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["auto-create-routes", "name", "peer-network"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["auto-create-routes", "exchange-subnet-routes", "name", "network", "network-peering", "peer-network", "state", "state-details"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -13923,6 +16141,58 @@ impl<'n> Engine<'n> { } } + fn _node_groups_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.node_groups().get_iam_policy(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _node_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -14152,6 +16422,94 @@ impl<'n> Engine<'n> { } } + fn _node_groups_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.iam-owned" => Some(("policy.iamOwned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "iam-owned", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ZoneSetPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.node_groups().set_iam_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _node_groups_set_node_template(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -14241,6 +16599,91 @@ impl<'n> Engine<'n> { } } + fn _node_groups_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.node_groups().test_iam_permissions(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _node_templates_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.node_templates().aggregated_list(opt.value_of("project").unwrap_or("")); @@ -14414,6 +16857,58 @@ impl<'n> Engine<'n> { } } + fn _node_templates_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.node_templates().get_iam_policy(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _node_templates_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -14581,6 +17076,179 @@ impl<'n> Engine<'n> { } } + fn _node_templates_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.iam-owned" => Some(("policy.iamOwned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "iam-owned", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RegionSetPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.node_templates().set_iam_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _node_templates_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.node_templates().test_iam_permissions(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _node_types_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.node_types().aggregated_list(opt.value_of("project").unwrap_or("")); @@ -16476,9 +19144,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "connection-draining.draining-timeout-sec" => Some(("connectionDraining.drainingTimeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "protocol" => Some(("protocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cdn-policy.signed-url-key-names" => Some(("cdnPolicy.signedUrlKeyNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "cdn-policy.signed-url-cache-max-age-sec" => Some(("cdnPolicy.signedUrlCacheMaxAgeSec", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.query-string-blacklist" => Some(("cdnPolicy.cacheKeyPolicy.queryStringBlacklist", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -16487,26 +19158,24 @@ impl<'n> Engine<'n> { "cdn-policy.cache-key-policy.include-host" => Some(("cdnPolicy.cacheKeyPolicy.includeHost", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.include-protocol" => Some(("cdnPolicy.cacheKeyPolicy.includeProtocol", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "enable-cdn" => Some(("enableCDN", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "affinity-cookie-ttl-sec" => Some(("affinityCookieTtlSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "session-affinity" => Some(("sessionAffinity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-request-headers" => Some(("customRequestHeaders", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "security-policy" => Some(("securityPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "port-name" => Some(("portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "custom-request-headers", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -16659,9 +19328,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "connection-draining.draining-timeout-sec" => Some(("connectionDraining.drainingTimeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "protocol" => Some(("protocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cdn-policy.signed-url-key-names" => Some(("cdnPolicy.signedUrlKeyNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "cdn-policy.signed-url-cache-max-age-sec" => Some(("cdnPolicy.signedUrlCacheMaxAgeSec", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.query-string-blacklist" => Some(("cdnPolicy.cacheKeyPolicy.queryStringBlacklist", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -16670,26 +19342,24 @@ impl<'n> Engine<'n> { "cdn-policy.cache-key-policy.include-host" => Some(("cdnPolicy.cacheKeyPolicy.includeHost", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.include-protocol" => Some(("cdnPolicy.cacheKeyPolicy.includeProtocol", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "enable-cdn" => Some(("enableCDN", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "affinity-cookie-ttl-sec" => Some(("affinityCookieTtlSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "session-affinity" => Some(("sessionAffinity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-request-headers" => Some(("customRequestHeaders", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "security-policy" => Some(("securityPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "port-name" => Some(("portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "custom-request-headers", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -16777,9 +19447,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "connection-draining.draining-timeout-sec" => Some(("connectionDraining.drainingTimeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "protocol" => Some(("protocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cdn-policy.signed-url-key-names" => Some(("cdnPolicy.signedUrlKeyNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "cdn-policy.signed-url-cache-max-age-sec" => Some(("cdnPolicy.signedUrlCacheMaxAgeSec", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.query-string-blacklist" => Some(("cdnPolicy.cacheKeyPolicy.queryStringBlacklist", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -16788,26 +19461,24 @@ impl<'n> Engine<'n> { "cdn-policy.cache-key-policy.include-host" => Some(("cdnPolicy.cacheKeyPolicy.includeHost", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cdn-policy.cache-key-policy.include-protocol" => Some(("cdnPolicy.cacheKeyPolicy.includeProtocol", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "enable-cdn" => Some(("enableCDN", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "affinity-cookie-ttl-sec" => Some(("affinityCookieTtlSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "session-affinity" => Some(("sessionAffinity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "load-balancing-scheme" => Some(("loadBalancingScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-id" => Some(("iap.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.enabled" => Some(("iap.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "iap.oauth2-client-secret" => Some(("iap.oauth2ClientSecret", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "iap.oauth2-client-secret-sha256" => Some(("iap.oauth2ClientSecretSha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-request-headers" => Some(("customRequestHeaders", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "security-policy" => Some(("securityPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "port-name" => Some(("portName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "health-checks" => Some(("healthChecks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "timeout-sec" => Some(("timeoutSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["affinity-cookie-ttl-sec", "cache-key-policy", "cdn-policy", "connection-draining", "creation-timestamp", "custom-request-headers", "description", "draining-timeout-sec", "enable-cdn", "enabled", "fingerprint", "health-checks", "iap", "id", "include-host", "include-protocol", "include-query-string", "kind", "load-balancing-scheme", "name", "oauth2-client-id", "oauth2-client-secret", "oauth2-client-secret-sha256", "port", "port-name", "protocol", "query-string-blacklist", "query-string-whitelist", "region", "security-policy", "self-link", "session-affinity", "signed-url-cache-max-age-sec", "signed-url-key-names", "timeout-sec"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -17304,19 +19975,20 @@ impl<'n> Engine<'n> { "snapshot-encryption-key.raw-key" => Some(("snapshotEncryptionKey.rawKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snapshot-encryption-key.sha256" => Some(("snapshotEncryptionKey.sha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snapshot-encryption-key.kms-key-name" => Some(("snapshotEncryptionKey.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "storage-bytes-status" => Some(("storageBytesStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "storage-locations" => Some(("storageLocations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "label-fingerprint" => Some(("labelFingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "source-disk-id" => Some(("sourceDiskId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "disk-size-gb" => Some(("diskSizeGb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "source-disk" => Some(("sourceDisk", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "licenses" => Some(("licenses", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "storage-bytes-status" => Some(("storageBytesStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "license-codes" => Some(("licenseCodes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "disk-size-gb", "id", "kind", "kms-key-name", "label-fingerprint", "labels", "license-codes", "licenses", "name", "raw-key", "self-link", "sha256", "snapshot-encryption-key", "source-disk", "source-disk-encryption-key", "source-disk-id", "status", "storage-bytes", "storage-bytes-status"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "disk-size-gb", "id", "kind", "kms-key-name", "label-fingerprint", "labels", "license-codes", "licenses", "name", "raw-key", "self-link", "sha256", "snapshot-encryption-key", "source-disk", "source-disk-encryption-key", "source-disk-id", "status", "storage-bytes", "storage-bytes-status", "storage-locations"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -17523,6 +20195,7 @@ impl<'n> Engine<'n> { "disk-encryption-key.sha256" => Some(("diskEncryptionKey.sha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "disk-encryption-key.kms-key-name" => Some(("diskEncryptionKey.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "physical-block-size-bytes" => Some(("physicalBlockSizeBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-attach-timestamp" => Some(("lastAttachTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -17545,7 +20218,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "source-image" => Some(("sourceImage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "disk-encryption-key", "id", "kind", "kms-key-name", "label-fingerprint", "labels", "last-attach-timestamp", "last-detach-timestamp", "license-codes", "licenses", "name", "options", "raw-key", "region", "replica-zones", "self-link", "sha256", "size-gb", "source-image", "source-image-encryption-key", "source-image-id", "source-snapshot", "source-snapshot-encryption-key", "source-snapshot-id", "status", "type", "users", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "disk-encryption-key", "id", "kind", "kms-key-name", "label-fingerprint", "labels", "last-attach-timestamp", "last-detach-timestamp", "license-codes", "licenses", "name", "options", "physical-block-size-bytes", "raw-key", "region", "replica-zones", "self-link", "sha256", "size-gb", "source-image", "source-image-encryption-key", "source-image-id", "source-snapshot", "source-snapshot-encryption-key", "source-snapshot-id", "status", "type", "users", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -18250,9 +20923,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "status.is-stable" => Some(("status.isStable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "current-actions.none" => Some(("currentActions.none", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.recreating" => Some(("currentActions.recreating", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.creating" => Some(("currentActions.creating", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.verifying" => Some(("currentActions.verifying", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.restarting" => Some(("currentActions.restarting", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.abandoning" => Some(("currentActions.abandoning", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.deleting" => Some(("currentActions.deleting", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -18266,6 +20941,14 @@ impl<'n> Engine<'n> { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "target-pools" => Some(("targetPools", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "instance-template" => Some(("instanceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.type" => Some(("updatePolicy.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.max-surge.calculated" => Some(("updatePolicy.maxSurge.calculated", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-surge.fixed" => Some(("updatePolicy.maxSurge.fixed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-surge.percent" => Some(("updatePolicy.maxSurge.percent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.minimal-action" => Some(("updatePolicy.minimalAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.calculated" => Some(("updatePolicy.maxUnavailable.calculated", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.fixed" => Some(("updatePolicy.maxUnavailable.fixed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.percent" => Some(("updatePolicy.maxUnavailable.percent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "base-instance-name" => Some(("baseInstanceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -18273,7 +20956,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["abandoning", "base-instance-name", "creating", "creating-without-retries", "creation-timestamp", "current-actions", "deleting", "description", "fingerprint", "id", "instance-group", "instance-template", "kind", "name", "none", "recreating", "refreshing", "region", "restarting", "self-link", "target-pools", "target-size", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["abandoning", "base-instance-name", "calculated", "creating", "creating-without-retries", "creation-timestamp", "current-actions", "deleting", "description", "fingerprint", "fixed", "id", "instance-group", "instance-template", "is-stable", "kind", "max-surge", "max-unavailable", "minimal-action", "name", "none", "percent", "recreating", "refreshing", "region", "restarting", "self-link", "status", "target-pools", "target-size", "type", "update-policy", "verifying", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -18467,6 +21150,126 @@ impl<'n> Engine<'n> { } } + fn _region_instance_group_managers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status.is-stable" => Some(("status.isStable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "current-actions.none" => Some(("currentActions.none", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.recreating" => Some(("currentActions.recreating", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.creating" => Some(("currentActions.creating", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.verifying" => Some(("currentActions.verifying", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.restarting" => Some(("currentActions.restarting", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.abandoning" => Some(("currentActions.abandoning", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.deleting" => Some(("currentActions.deleting", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.creating-without-retries" => Some(("currentActions.creatingWithoutRetries", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "current-actions.refreshing" => Some(("currentActions.refreshing", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "target-size" => Some(("targetSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instance-group" => Some(("instanceGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "target-pools" => Some(("targetPools", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "instance-template" => Some(("instanceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.type" => Some(("updatePolicy.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.max-surge.calculated" => Some(("updatePolicy.maxSurge.calculated", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-surge.fixed" => Some(("updatePolicy.maxSurge.fixed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-surge.percent" => Some(("updatePolicy.maxSurge.percent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.minimal-action" => Some(("updatePolicy.minimalAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.calculated" => Some(("updatePolicy.maxUnavailable.calculated", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.fixed" => Some(("updatePolicy.maxUnavailable.fixed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-policy.max-unavailable.percent" => Some(("updatePolicy.maxUnavailable.percent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "base-instance-name" => Some(("baseInstanceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["abandoning", "base-instance-name", "calculated", "creating", "creating-without-retries", "creation-timestamp", "current-actions", "deleting", "description", "fingerprint", "fixed", "id", "instance-group", "instance-template", "is-stable", "kind", "max-surge", "max-unavailable", "minimal-action", "name", "none", "percent", "recreating", "refreshing", "region", "restarting", "self-link", "status", "target-pools", "target-size", "type", "update-policy", "verifying", "zone"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::InstanceGroupManager = json::value::from_value(object).unwrap(); + let mut call = self.hub.region_instance_group_managers().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "request-id" => { + call = call.request_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["request-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _region_instance_group_managers_recreate_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -19548,6 +22351,71 @@ impl<'n> Engine<'n> { } } + fn _routers_get_nat_mapping_info(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.routers().get_nat_mapping_info(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("router").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _routers_get_router_status(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.routers().get_router_status(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("router").unwrap_or("")); @@ -21103,6 +23971,58 @@ impl<'n> Engine<'n> { } } + fn _snapshots_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.snapshots().get_iam_policy(opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _snapshots_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.snapshots().list(opt.value_of("project").unwrap_or("")); @@ -21168,6 +24088,94 @@ impl<'n> Engine<'n> { } } + fn _snapshots_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.iam-owned" => Some(("policy.iamOwned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "iam-owned", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GlobalSetPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.snapshots().set_iam_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _snapshots_set_labels(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -21254,6 +24262,91 @@ impl<'n> Engine<'n> { } } + fn _snapshots_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.snapshots().test_iam_permissions(request, opt.value_of("project").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _ssl_certificates_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ssl_certificates().delete(opt.value_of("project").unwrap_or(""), opt.value_of("ssl-certificate").unwrap_or("")); @@ -22221,6 +25314,58 @@ impl<'n> Engine<'n> { } } + fn _subnetworks_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.subnetworks().get_iam_policy(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _subnetworks_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -22553,6 +25698,94 @@ impl<'n> Engine<'n> { } } + fn _subnetworks_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.iam-owned" => Some(("policy.iamOwned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "iam-owned", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RegionSetPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.subnetworks().set_iam_policy(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _subnetworks_set_private_ip_google_access(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -22642,6 +25875,91 @@ impl<'n> Engine<'n> { } } + fn _subnetworks_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.subnetworks().test_iam_permissions(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _target_http_proxies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_http_proxies().delete(opt.value_of("project").unwrap_or(""), opt.value_of("target-http-proxy").unwrap_or("")); @@ -27681,6 +30999,9 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._disks_get(opt, dry_run, &mut err); }, + ("get-iam-policy", Some(opt)) => { + call_result = self._disks_get_iam_policy(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._disks_insert(opt, dry_run, &mut err); }, @@ -27690,9 +31011,15 @@ impl<'n> Engine<'n> { ("resize", Some(opt)) => { call_result = self._disks_resize(opt, dry_run, &mut err); }, + ("set-iam-policy", Some(opt)) => { + call_result = self._disks_set_iam_policy(opt, dry_run, &mut err); + }, ("set-labels", Some(opt)) => { call_result = self._disks_set_labels(opt, dry_run, &mut err); }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._disks_test_iam_permissions(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("disks".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -27906,15 +31233,24 @@ impl<'n> Engine<'n> { ("get-from-family", Some(opt)) => { call_result = self._images_get_from_family(opt, dry_run, &mut err); }, + ("get-iam-policy", Some(opt)) => { + call_result = self._images_get_iam_policy(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._images_insert(opt, dry_run, &mut err); }, ("list", Some(opt)) => { call_result = self._images_list(opt, dry_run, &mut err); }, + ("set-iam-policy", Some(opt)) => { + call_result = self._images_set_iam_policy(opt, dry_run, &mut err); + }, ("set-labels", Some(opt)) => { call_result = self._images_set_labels(opt, dry_run, &mut err); }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._images_test_iam_permissions(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("images".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -27947,6 +31283,9 @@ impl<'n> Engine<'n> { ("list-managed-instances", Some(opt)) => { call_result = self._instance_group_managers_list_managed_instances(opt, dry_run, &mut err); }, + ("patch", Some(opt)) => { + call_result = self._instance_group_managers_patch(opt, dry_run, &mut err); + }, ("recreate-instances", Some(opt)) => { call_result = self._instance_group_managers_recreate_instances(opt, dry_run, &mut err); }, @@ -28008,12 +31347,21 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._instance_templates_get(opt, dry_run, &mut err); }, + ("get-iam-policy", Some(opt)) => { + call_result = self._instance_templates_get_iam_policy(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._instance_templates_insert(opt, dry_run, &mut err); }, ("list", Some(opt)) => { call_result = self._instance_templates_list(opt, dry_run, &mut err); }, + ("set-iam-policy", Some(opt)) => { + call_result = self._instance_templates_set_iam_policy(opt, dry_run, &mut err); + }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._instance_templates_test_iam_permissions(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("instance-templates".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -28043,9 +31391,15 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._instances_get(opt, dry_run, &mut err); }, + ("get-iam-policy", Some(opt)) => { + call_result = self._instances_get_iam_policy(opt, dry_run, &mut err); + }, ("get-serial-port-output", Some(opt)) => { call_result = self._instances_get_serial_port_output(opt, dry_run, &mut err); }, + ("get-shielded-instance-identity", Some(opt)) => { + call_result = self._instances_get_shielded_instance_identity(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._instances_insert(opt, dry_run, &mut err); }, @@ -28064,6 +31418,9 @@ impl<'n> Engine<'n> { ("set-disk-auto-delete", Some(opt)) => { call_result = self._instances_set_disk_auto_delete(opt, dry_run, &mut err); }, + ("set-iam-policy", Some(opt)) => { + call_result = self._instances_set_iam_policy(opt, dry_run, &mut err); + }, ("set-labels", Some(opt)) => { call_result = self._instances_set_labels(opt, dry_run, &mut err); }, @@ -28085,6 +31442,9 @@ impl<'n> Engine<'n> { ("set-service-account", Some(opt)) => { call_result = self._instances_set_service_account(opt, dry_run, &mut err); }, + ("set-shielded-instance-integrity-policy", Some(opt)) => { + call_result = self._instances_set_shielded_instance_integrity_policy(opt, dry_run, &mut err); + }, ("set-tags", Some(opt)) => { call_result = self._instances_set_tags(opt, dry_run, &mut err); }, @@ -28100,12 +31460,18 @@ impl<'n> Engine<'n> { ("stop", Some(opt)) => { call_result = self._instances_stop(opt, dry_run, &mut err); }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._instances_test_iam_permissions(opt, dry_run, &mut err); + }, ("update-access-config", Some(opt)) => { call_result = self._instances_update_access_config(opt, dry_run, &mut err); }, ("update-network-interface", Some(opt)) => { call_result = self._instances_update_network_interface(opt, dry_run, &mut err); }, + ("update-shielded-instance-config", Some(opt)) => { + call_result = self._instances_update_shielded_instance_config(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("instances".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -28160,6 +31526,9 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._interconnects_get(opt, dry_run, &mut err); }, + ("get-diagnostics", Some(opt)) => { + call_result = self._interconnects_get_diagnostics(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._interconnects_insert(opt, dry_run, &mut err); }, @@ -28197,12 +31566,18 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._licenses_get(opt, dry_run, &mut err); }, + ("get-iam-policy", Some(opt)) => { + call_result = self._licenses_get_iam_policy(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._licenses_insert(opt, dry_run, &mut err); }, ("list", Some(opt)) => { call_result = self._licenses_list(opt, dry_run, &mut err); }, + ("set-iam-policy", Some(opt)) => { + call_result = self._licenses_set_iam_policy(opt, dry_run, &mut err); + }, ("test-iam-permissions", Some(opt)) => { call_result = self._licenses_test_iam_permissions(opt, dry_run, &mut err); }, @@ -28229,6 +31604,41 @@ impl<'n> Engine<'n> { } } }, + ("network-endpoint-groups", Some(opt)) => { + match opt.subcommand() { + ("aggregated-list", Some(opt)) => { + call_result = self._network_endpoint_groups_aggregated_list(opt, dry_run, &mut err); + }, + ("attach-network-endpoints", Some(opt)) => { + call_result = self._network_endpoint_groups_attach_network_endpoints(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._network_endpoint_groups_delete(opt, dry_run, &mut err); + }, + ("detach-network-endpoints", Some(opt)) => { + call_result = self._network_endpoint_groups_detach_network_endpoints(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._network_endpoint_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._network_endpoint_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._network_endpoint_groups_list(opt, dry_run, &mut err); + }, + ("list-network-endpoints", Some(opt)) => { + call_result = self._network_endpoint_groups_list_network_endpoints(opt, dry_run, &mut err); + }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._network_endpoint_groups_test_iam_permissions(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("network-endpoint-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("networks", Some(opt)) => { match opt.subcommand() { ("add-peering", Some(opt)) => { @@ -28278,6 +31688,9 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._node_groups_get(opt, dry_run, &mut err); }, + ("get-iam-policy", Some(opt)) => { + call_result = self._node_groups_get_iam_policy(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._node_groups_insert(opt, dry_run, &mut err); }, @@ -28287,9 +31700,15 @@ impl<'n> Engine<'n> { ("list-nodes", Some(opt)) => { call_result = self._node_groups_list_nodes(opt, dry_run, &mut err); }, + ("set-iam-policy", Some(opt)) => { + call_result = self._node_groups_set_iam_policy(opt, dry_run, &mut err); + }, ("set-node-template", Some(opt)) => { call_result = self._node_groups_set_node_template(opt, dry_run, &mut err); }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._node_groups_test_iam_permissions(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("node-groups".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -28307,12 +31726,21 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._node_templates_get(opt, dry_run, &mut err); }, + ("get-iam-policy", Some(opt)) => { + call_result = self._node_templates_get_iam_policy(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._node_templates_insert(opt, dry_run, &mut err); }, ("list", Some(opt)) => { call_result = self._node_templates_list(opt, dry_run, &mut err); }, + ("set-iam-policy", Some(opt)) => { + call_result = self._node_templates_set_iam_policy(opt, dry_run, &mut err); + }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._node_templates_test_iam_permissions(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("node-templates".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -28527,6 +31955,9 @@ impl<'n> Engine<'n> { ("list-managed-instances", Some(opt)) => { call_result = self._region_instance_group_managers_list_managed_instances(opt, dry_run, &mut err); }, + ("patch", Some(opt)) => { + call_result = self._region_instance_group_managers_patch(opt, dry_run, &mut err); + }, ("recreate-instances", Some(opt)) => { call_result = self._region_instance_group_managers_recreate_instances(opt, dry_run, &mut err); }, @@ -28607,6 +32038,9 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._routers_get(opt, dry_run, &mut err); }, + ("get-nat-mapping-info", Some(opt)) => { + call_result = self._routers_get_nat_mapping_info(opt, dry_run, &mut err); + }, ("get-router-status", Some(opt)) => { call_result = self._routers_get_router_status(opt, dry_run, &mut err); }, @@ -28694,12 +32128,21 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._snapshots_get(opt, dry_run, &mut err); }, + ("get-iam-policy", Some(opt)) => { + call_result = self._snapshots_get_iam_policy(opt, dry_run, &mut err); + }, ("list", Some(opt)) => { call_result = self._snapshots_list(opt, dry_run, &mut err); }, + ("set-iam-policy", Some(opt)) => { + call_result = self._snapshots_set_iam_policy(opt, dry_run, &mut err); + }, ("set-labels", Some(opt)) => { call_result = self._snapshots_set_labels(opt, dry_run, &mut err); }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._snapshots_test_iam_permissions(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("snapshots".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -28766,6 +32209,9 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._subnetworks_get(opt, dry_run, &mut err); }, + ("get-iam-policy", Some(opt)) => { + call_result = self._subnetworks_get_iam_policy(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._subnetworks_insert(opt, dry_run, &mut err); }, @@ -28778,9 +32224,15 @@ impl<'n> Engine<'n> { ("patch", Some(opt)) => { call_result = self._subnetworks_patch(opt, dry_run, &mut err); }, + ("set-iam-policy", Some(opt)) => { + call_result = self._subnetworks_set_iam_policy(opt, dry_run, &mut err); + }, ("set-private-ip-google-access", Some(opt)) => { call_result = self._subnetworks_set_private_ip_google_access(opt, dry_run, &mut err); }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._subnetworks_test_iam_permissions(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("subnetworks".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -29985,7 +33437,7 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Returns the specified BackendService resource. Gets a list of available backend services by making a list() request."##), + Some(r##"Returns the specified BackendService resource. Gets a list of available backend services."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/backend-services_get", vec![ (Some(r##"project"##), @@ -30287,7 +33739,7 @@ fn main() { ]), ]), - ("disks", "methods: 'aggregated-list', 'create-snapshot', 'delete', 'get', 'insert', 'list', 'resize' and 'set-labels'", vec![ + ("disks", "methods: 'aggregated-list', 'create-snapshot', 'delete', 'get', 'get-iam-policy', 'insert', 'list', 'resize', 'set-iam-policy', 'set-labels' and 'test-iam-permissions'", vec![ ("aggregated-list", Some(r##"Retrieves an aggregated list of persistent disks."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disks_aggregated-list", @@ -30412,6 +33864,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets the access control policy for a resource. May be empty if no such policy or resource exists."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disks_get-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -30514,6 +34000,46 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disks_set-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -30538,7 +34064,47 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disks_test-iam-permissions", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -31814,7 +35380,7 @@ fn main() { ]), ]), - ("images", "methods: 'delete', 'deprecate', 'get', 'get-from-family', 'insert', 'list' and 'set-labels'", vec![ + ("images", "methods: 'delete', 'deprecate', 'get', 'get-from-family', 'get-iam-policy', 'insert', 'list', 'set-iam-policy', 'set-labels' and 'test-iam-permissions'", vec![ ("delete", Some(r##"Deletes the specified image."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/images_delete", @@ -31929,6 +35495,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets the access control policy for a resource. May be empty if no such policy or resource exists."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/images_get-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -31979,6 +35573,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/images_set-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -31997,7 +35625,41 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/images_test-iam-permissions", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -32021,9 +35683,9 @@ fn main() { ]), ]), - ("instance-group-managers", "methods: 'abandon-instances', 'aggregated-list', 'delete', 'delete-instances', 'get', 'insert', 'list', 'list-managed-instances', 'recreate-instances', 'resize', 'set-instance-template' and 'set-target-pools'", vec![ + ("instance-group-managers", "methods: 'abandon-instances', 'aggregated-list', 'delete', 'delete-instances', 'get', 'insert', 'list', 'list-managed-instances', 'patch', 'recreate-instances', 'resize', 'set-instance-template' and 'set-target-pools'", vec![ ("abandon-instances", - Some(r##"Schedules a group action to remove the specified instances from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. + Some(r##"Flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. @@ -32123,7 +35785,7 @@ fn main() { Some(false)), ]), ("delete-instances", - Some(r##"Schedules a group action to delete the specified instances in the managed instance group. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. + Some(r##"Flags the specified instances in the managed instance group for immediate deletion. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. @@ -32201,7 +35863,7 @@ fn main() { Some(false)), ]), ("insert", - Some(r##"Creates a managed instance group using the information that you specify in the request. After the group is created, it schedules an action to create instances in the group using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. + Some(r##"Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_insert", @@ -32292,6 +35954,46 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_patch", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone where you want to create the managed instance group."##), + Some(true), + Some(false)), + + (Some(r##"instance-group-manager"##), + None, + Some(r##"The name of the instance group manager."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -32299,7 +36001,7 @@ fn main() { Some(false)), ]), ("recreate-instances", - Some(r##"Schedules a group action to recreate the specified instances in the managed instance group. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the action is scheduled even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. + Some(r##"Flags the specified instances in the managed instance group to be immediately recreated. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. @@ -32345,6 +36047,12 @@ fn main() { ("resize", Some(r##"Resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. + When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: + + + The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. + + This list is subject to change. + If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_resize", vec![ @@ -32783,9 +36491,9 @@ fn main() { ]), ]), - ("instance-templates", "methods: 'delete', 'get', 'insert' and 'list'", vec![ + ("instance-templates", "methods: 'delete', 'get', 'get-iam-policy', 'insert', 'list', 'set-iam-policy' and 'test-iam-permissions'", vec![ ("delete", - Some(r##"Deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. It's not possible to delete templates which are in use by an instance group."##), + Some(r##"Deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. It is not possible to delete templates that are already in use by a managed instance group."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-templates_delete", vec![ (Some(r##"project"##), @@ -32834,6 +36542,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets the access control policy for a resource. May be empty if no such policy or resource exists."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-templates_get-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -32869,7 +36605,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Retrieves a list of instance templates that are contained within the specified project and zone."##), + Some(r##"Retrieves a list of instance templates that are contained within the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-templates_list", vec![ (Some(r##"project"##), @@ -32884,6 +36620,74 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-templates_set-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-templates_test-iam-permissions", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -32892,7 +36696,7 @@ fn main() { ]), ]), - ("instances", "methods: 'add-access-config', 'aggregated-list', 'attach-disk', 'delete', 'delete-access-config', 'detach-disk', 'get', 'get-serial-port-output', 'insert', 'list', 'list-referrers', 'reset', 'set-deletion-protection', 'set-disk-auto-delete', 'set-labels', 'set-machine-resources', 'set-machine-type', 'set-metadata', 'set-min-cpu-platform', 'set-scheduling', 'set-service-account', 'set-tags', 'simulate-maintenance-event', 'start', 'start-with-encryption-key', 'stop', 'update-access-config' and 'update-network-interface'", vec![ + ("instances", "methods: 'add-access-config', 'aggregated-list', 'attach-disk', 'delete', 'delete-access-config', 'detach-disk', 'get', 'get-iam-policy', 'get-serial-port-output', 'get-shielded-instance-identity', 'insert', 'list', 'list-referrers', 'reset', 'set-deletion-protection', 'set-disk-auto-delete', 'set-iam-policy', 'set-labels', 'set-machine-resources', 'set-machine-type', 'set-metadata', 'set-min-cpu-platform', 'set-scheduling', 'set-service-account', 'set-shielded-instance-integrity-policy', 'set-tags', 'simulate-maintenance-event', 'start', 'start-with-encryption-key', 'stop', 'test-iam-permissions', 'update-access-config', 'update-network-interface' and 'update-shielded-instance-config'", vec![ ("add-access-config", Some(r##"Adds an access config to an instance's network interface."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_add-access-config", @@ -33099,13 +36903,13 @@ fn main() { (Some(r##"instance"##), None, - Some(r##"Instance name."##), + Some(r##"Instance name for this request."##), Some(true), Some(false)), (Some(r##"device-name"##), None, - Some(r##"Disk device name to detach."##), + Some(r##"The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names."##), Some(true), Some(false)), @@ -33149,6 +36953,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets the access control policy for a resource. May be empty if no such policy or resource exists."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_get-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -33183,6 +37021,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-shielded-instance-identity", + Some(r##"Returns the Shielded Instance Identity of an instance"##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_get-shielded-instance-identity", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"instance"##), + None, + Some(r##"Name or id of the instance scoping this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -33252,7 +37124,7 @@ fn main() { Some(false)), ]), ("list-referrers", - Some(r##"Retrieves the list of referrers to instances contained within the specified zone."##), + Some(r##"Retrieves the list of referrers to instances contained within the specified zone. For more information, read Viewing Referrers to VM Instances."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_list-referrers", vec![ (Some(r##"project"##), @@ -33286,7 +37158,7 @@ fn main() { Some(false)), ]), ("reset", - Some(r##"Performs a reset on the instance. For more information, see Resetting an instance."##), + Some(r##"Performs a reset on the instance. This is a hard reset the VM does not do a graceful shutdown. For more information, see Resetting an instance."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_reset", vec![ (Some(r##"project"##), @@ -33337,7 +37209,7 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -33371,7 +37243,7 @@ fn main() { (Some(r##"instance"##), None, - Some(r##"The instance name."##), + Some(r##"The instance name for this request."##), Some(true), Some(false)), @@ -33383,7 +37255,7 @@ fn main() { (Some(r##"device-name"##), None, - Some(r##"The device name of the disk to modify."##), + Some(r##"The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names."##), Some(true), Some(false)), @@ -33393,6 +37265,46 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_set-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -33617,7 +37529,7 @@ fn main() { (Some(r##"instance"##), None, - Some(r##"Instance name."##), + Some(r##"Instance name for this request."##), Some(true), Some(false)), @@ -33673,6 +37585,46 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-shielded-instance-integrity-policy", + Some(r##"Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_set-shielded-instance-integrity-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"instance"##), + None, + Some(r##"Name or id of the instance scoping this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -33680,7 +37632,7 @@ fn main() { Some(false)), ]), ("set-tags", - Some(r##"Sets tags for the specified instance to the data included in the request."##), + Some(r##"Sets network tags for the specified instance to the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_set-tags", vec![ (Some(r##"project"##), @@ -33855,6 +37807,46 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_test-iam-permissions", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -33947,6 +37939,46 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update-shielded-instance-config", + Some(r##"Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_update-shielded-instance-config", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"instance"##), + None, + Some(r##"Name or id of the instance scoping this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -34203,7 +38235,7 @@ fn main() { ]), ]), - ("interconnects", "methods: 'delete', 'get', 'insert', 'list' and 'patch'", vec![ + ("interconnects", "methods: 'delete', 'get', 'get-diagnostics', 'insert', 'list' and 'patch'", vec![ ("delete", Some(r##"Deletes the specified interconnect."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/interconnects_delete", @@ -34254,6 +38286,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-diagnostics", + Some(r##"Returns the interconnectDiagnostics for the specified interconnect."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/interconnects_get-diagnostics", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"interconnect"##), + None, + Some(r##"Name of the interconnect resource to query."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -34387,7 +38447,7 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -34411,7 +38471,7 @@ fn main() { ]), ]), - ("licenses", "methods: 'delete', 'get', 'insert', 'list' and 'test-iam-permissions'", vec![ + ("licenses", "methods: 'delete', 'get', 'get-iam-policy', 'insert', 'list', 'set-iam-policy' and 'test-iam-permissions'", vec![ ("delete", Some(r##"Deletes the specified license."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/licenses_delete", @@ -34462,6 +38522,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets the access control policy for a resource. May be empty if no such policy or resource exists."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/licenses_get-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -34512,6 +38600,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/licenses_set-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -34530,7 +38652,7 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -34641,6 +38763,321 @@ fn main() { ]), ]), + ("network-endpoint-groups", "methods: 'aggregated-list', 'attach-network-endpoints', 'delete', 'detach-network-endpoints', 'get', 'insert', 'list', 'list-network-endpoints' and 'test-iam-permissions'", vec![ + ("aggregated-list", + Some(r##"Retrieves the list of network endpoint groups and sorts them by zone."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/network-endpoint-groups_aggregated-list", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("attach-network-endpoints", + Some(r##"Attach a list of network endpoints to the specified network endpoint group."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/network-endpoint-groups_attach-network-endpoints", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone where the network endpoint group is located. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"network-endpoint-group"##), + None, + Some(r##"The name of the network endpoint group where you are attaching network endpoints to. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes the specified network endpoint group. The network endpoints in the NEG and the VM instances they belong to are not terminated when the NEG is deleted. Note that the NEG cannot be deleted if there are backend services referencing it."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/network-endpoint-groups_delete", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone where the network endpoint group is located. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"network-endpoint-group"##), + None, + Some(r##"The name of the network endpoint group to delete. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("detach-network-endpoints", + Some(r##"Detach a list of network endpoints from the specified network endpoint group."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/network-endpoint-groups_detach-network-endpoints", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone where the network endpoint group is located. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"network-endpoint-group"##), + None, + Some(r##"The name of the network endpoint group where you are removing network endpoints. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/network-endpoint-groups_get", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone where the network endpoint group is located. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"network-endpoint-group"##), + None, + Some(r##"The name of the network endpoint group. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Creates a network endpoint group in the specified project using the parameters that are included in the request."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/network-endpoint-groups_insert", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone where you want to create the network endpoint group. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of network endpoint groups that are located in the specified project and zone."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/network-endpoint-groups_list", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone where the network endpoint group is located. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list-network-endpoints", + Some(r##"Lists the network endpoints in the specified network endpoint group."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/network-endpoint-groups_list-network-endpoints", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone where the network endpoint group is located. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"network-endpoint-group"##), + None, + Some(r##"The name of the network endpoint group from which you want to generate a list of included network endpoints. It should comply with RFC1035."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/network-endpoint-groups_test-iam-permissions", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("networks", "methods: 'add-peering', 'delete', 'get', 'insert', 'list', 'patch', 'remove-peering' and 'switch-to-custom-mode'", vec![ ("add-peering", Some(r##"Adds a peering to the specified network."##), @@ -34880,7 +39317,7 @@ fn main() { ]), ]), - ("node-groups", "methods: 'add-nodes', 'aggregated-list', 'delete', 'delete-nodes', 'get', 'insert', 'list', 'list-nodes' and 'set-node-template'", vec![ + ("node-groups", "methods: 'add-nodes', 'aggregated-list', 'delete', 'delete-nodes', 'get', 'get-iam-policy', 'insert', 'list', 'list-nodes', 'set-iam-policy', 'set-node-template' and 'test-iam-permissions'", vec![ ("add-nodes", Some(r##"Adds specified number of nodes to the node group."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/node-groups_add-nodes", @@ -34899,7 +39336,7 @@ fn main() { (Some(r##"node-group"##), None, - Some(r##"Name of the NodeGroup resource to delete."##), + Some(r##"Name of the NodeGroup resource."##), Some(true), Some(false)), @@ -35045,6 +39482,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets the access control policy for a resource. May be empty if no such policy or resource exists."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/node-groups_get-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -35147,6 +39618,46 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/node-groups_set-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -35171,7 +39682,47 @@ fn main() { (Some(r##"node-group"##), None, - Some(r##"Name of the NodeGroup resource to delete."##), + Some(r##"Name of the NodeGroup resource to update."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/node-groups_test-iam-permissions", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -35195,7 +39746,7 @@ fn main() { ]), ]), - ("node-templates", "methods: 'aggregated-list', 'delete', 'get', 'insert' and 'list'", vec![ + ("node-templates", "methods: 'aggregated-list', 'delete', 'get', 'get-iam-policy', 'insert', 'list', 'set-iam-policy' and 'test-iam-permissions'", vec![ ("aggregated-list", Some(r##"Retrieves an aggregated list of node templates."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/node-templates_aggregated-list", @@ -35280,6 +39831,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets the access control policy for a resource. May be empty if no such policy or resource exists."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/node-templates_get-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"The name of the region for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -35342,6 +39927,86 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/node-templates_set-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"The name of the region for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/node-templates_test-iam-permissions", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"The name of the region for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -36643,7 +41308,7 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -36683,7 +41348,7 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -36707,9 +41372,9 @@ fn main() { ]), ]), - ("region-instance-group-managers", "methods: 'abandon-instances', 'delete', 'delete-instances', 'get', 'insert', 'list', 'list-managed-instances', 'recreate-instances', 'resize', 'set-instance-template' and 'set-target-pools'", vec![ + ("region-instance-group-managers", "methods: 'abandon-instances', 'delete', 'delete-instances', 'get', 'insert', 'list', 'list-managed-instances', 'patch', 'recreate-instances', 'resize', 'set-instance-template' and 'set-target-pools'", vec![ ("abandon-instances", - Some(r##"Schedules a group action to remove the specified instances from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. + Some(r##"Flags the specified instances to be immediately removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. @@ -36787,7 +41452,7 @@ fn main() { Some(false)), ]), ("delete-instances", - Some(r##"Schedules a group action to delete the specified instances in the managed instance group. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. + Some(r##"Flags the specified instances in the managed instance group to be immediately deleted. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. The deleteInstances operation is marked DONE if the deleteInstances request is successful. The underlying actions take additional time. You must separately verify the status of the deleting action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. @@ -36865,7 +41530,7 @@ fn main() { Some(false)), ]), ("insert", - Some(r##"Creates a managed instance group using the information that you specify in the request. After the group is created, it schedules an action to create instances in the group using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. + Some(r##"Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A regional managed instance group can contain up to 2000 instances."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/region-instance-group-managers_insert", @@ -36956,6 +41621,46 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listmanagedinstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/region-instance-group-managers_patch", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"Name of the region scoping this request."##), + Some(true), + Some(false)), + + (Some(r##"instance-group-manager"##), + None, + Some(r##"The name of the instance group manager."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -36963,7 +41668,7 @@ fn main() { Some(false)), ]), ("recreate-instances", - Some(r##"Schedules a group action to recreate the specified instances in the managed instance group. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the action is scheduled even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. + Some(r##"Flags the specified instances in the managed instance group to be immediately recreated. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. @@ -37007,7 +41712,9 @@ fn main() { Some(false)), ]), ("resize", - Some(r##"Changes the intended size for the managed instance group. If you increase the size, the group schedules actions to create new instances using the current instance template. If you decrease the size, the group schedules delete actions on one or more instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. + Some(r##"Changes the intended size of the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes one or more instances. + + The resize operation is marked DONE if the resize request is successful. The underlying actions take additional time. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/region-instance-group-managers_resize", @@ -37421,7 +42128,7 @@ fn main() { ]), ]), - ("routers", "methods: 'aggregated-list', 'delete', 'get', 'get-router-status', 'insert', 'list', 'patch', 'preview' and 'update'", vec![ + ("routers", "methods: 'aggregated-list', 'delete', 'get', 'get-nat-mapping-info', 'get-router-status', 'insert', 'list', 'patch', 'preview' and 'update'", vec![ ("aggregated-list", Some(r##"Retrieves an aggregated list of routers."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/routers_aggregated-list", @@ -37506,6 +42213,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-nat-mapping-info", + Some(r##"Retrieves runtime Nat mapping information of VM endpoints."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/routers_get-nat-mapping-info", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"Name of the region for this request."##), + Some(true), + Some(false)), + + (Some(r##"router"##), + None, + Some(r##"Name of the Router resource to query for Nat Mapping information of VM endpoints."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -38106,11 +42847,11 @@ fn main() { ]), ]), - ("snapshots", "methods: 'delete', 'get', 'list' and 'set-labels'", vec![ + ("snapshots", "methods: 'delete', 'get', 'get-iam-policy', 'list', 'set-iam-policy', 'set-labels' and 'test-iam-permissions'", vec![ ("delete", Some(r##"Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. - For more information, see Deleting snaphots."##), + For more information, see Deleting snapshots."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/snapshots_delete", vec![ (Some(r##"project"##), @@ -38159,6 +42900,34 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets the access control policy for a resource. May be empty if no such policy or resource exists."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/snapshots_get-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -38181,6 +42950,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/snapshots_set-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -38199,7 +43002,41 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/snapshots_test-iam-permissions", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -38497,7 +43334,7 @@ fn main() { ]), ]), - ("subnetworks", "methods: 'aggregated-list', 'delete', 'expand-ip-cidr-range', 'get', 'insert', 'list', 'list-usable', 'patch' and 'set-private-ip-google-access'", vec![ + ("subnetworks", "methods: 'aggregated-list', 'delete', 'expand-ip-cidr-range', 'get', 'get-iam-policy', 'insert', 'list', 'list-usable', 'patch', 'set-iam-policy', 'set-private-ip-google-access' and 'test-iam-permissions'", vec![ ("aggregated-list", Some(r##"Retrieves an aggregated list of subnetworks."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/subnetworks_aggregated-list", @@ -38622,6 +43459,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-iam-policy", + Some(r##"Gets the access control policy for a resource. May be empty if no such policy or resource exists."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/subnetworks_get-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"The name of the region for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -38713,7 +43584,7 @@ fn main() { Some(false)), ]), ("patch", - Some(r##"Patches the specified subnetwork with the data included in the request. Only the following fields within the subnetwork resource can be specified in the request: secondary_ip_range, allow_subnet_cidr_routes_overlap and role. It is also mandatory to specify the current fingeprint of the subnetwork resource being patched."##), + Some(r##"Patches the specified subnetwork with the data included in the request. Only certain fields can up updated with a patch request as indicated in the field descriptions. You must specify the current fingeprint of the subnetwork resource being patched."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/subnetworks_patch", vec![ (Some(r##"project"##), @@ -38746,6 +43617,46 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/subnetworks_set-iam-policy", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"The name of the region for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -38786,6 +43697,46 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/subnetworks_test-iam-permissions", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"The name of the region for this request."##), + Some(true), + Some(false)), + + (Some(r##"resource"##), + None, + Some(r##"Name or id of the resource for this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -40859,7 +45810,7 @@ fn main() { let mut app = App::new("compute1") .author("Sebastian Thiel ") - .version("1.0.8+20180916") + .version("1.0.8+20190320") .about("Creates and runs virtual machines on Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_compute1_cli") .arg(Arg::with_name("url") diff --git a/gen/compute1/Cargo.toml b/gen/compute1/Cargo.toml index 49dab1077f..4938e4a9c9 100644 --- a/gen/compute1/Cargo.toml +++ b/gen/compute1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-compute1" -version = "1.0.8+20180916" +version = "1.0.8+20190320" authors = ["Sebastian Thiel "] description = "A complete library to interact with compute (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/compute1" homepage = "https://developers.google.com/compute/docs/reference/latest/" -documentation = "https://docs.rs/google-compute1/1.0.8+20180916" +documentation = "https://docs.rs/google-compute1/1.0.8+20190320" license = "MIT" keywords = ["compute", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/compute1/README.md b/gen/compute1/README.md index 3b885d217b..bfb9bc5f86 100644 --- a/gen/compute1/README.md +++ b/gen/compute1/README.md @@ -5,130 +5,132 @@ DO NOT EDIT ! --> The `google-compute1` library allows access to all features of the *Google compute* service. -This documentation was generated from *compute* crate version *1.0.8+20180916*, where *20180916* is the exact revision of the *compute:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *compute* crate version *1.0.8+20190320*, where *20190320* is the exact revision of the *compute:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *compute* *v1* API can be found at the [official documentation site](https://developers.google.com/compute/docs/reference/latest/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Compute.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Compute.html) ... -* [accelerator types](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AcceleratorType.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AcceleratorTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AcceleratorTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AcceleratorTypeListCall.html) +* [accelerator types](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AcceleratorType.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AcceleratorTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AcceleratorTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AcceleratorTypeListCall.html) * addresses - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AddresseAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AddresseDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AddresseGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AddresseInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AddresseListCall.html) -* [autoscalers](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Autoscaler.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AutoscalerAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AutoscalerDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AutoscalerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AutoscalerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AutoscalerListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AutoscalerPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.AutoscalerUpdateCall.html) -* [backend buckets](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendBucket.html) - * [*add signed url key*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendBucketAddSignedUrlKeyCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendBucketDeleteCall.html), [*delete signed url key*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendBucketDeleteSignedUrlKeyCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendBucketGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendBucketInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendBucketListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendBucketPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendBucketUpdateCall.html) -* [backend services](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendService.html) - * [*add signed url key*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServiceAddSignedUrlKeyCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServiceAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServiceDeleteCall.html), [*delete signed url key*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServiceDeleteSignedUrlKeyCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServiceGetCall.html), [*get health*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServiceGetHealthCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServiceInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServiceListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServicePatchCall.html), [*set security policy*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServiceSetSecurityPolicyCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.BackendServiceUpdateCall.html) -* [disk types](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskType.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskTypeListCall.html) -* [disks](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Disk.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskAggregatedListCall.html), [*create snapshot*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskCreateSnapshotCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskListCall.html), [*resize*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskResizeCall.html) and [*set labels*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.DiskSetLabelCall.html) -* [firewalls](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Firewall.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.FirewallDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.FirewallGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.FirewallInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.FirewallListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.FirewallPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.FirewallUpdateCall.html) -* [forwarding rules](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ForwardingRule.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ForwardingRuleAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ForwardingRuleDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ForwardingRuleGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ForwardingRuleInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ForwardingRuleListCall.html) and [*set target*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ForwardingRuleSetTargetCall.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AddresseAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AddresseDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AddresseGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AddresseInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AddresseListCall.html) +* [autoscalers](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Autoscaler.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AutoscalerAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AutoscalerDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AutoscalerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AutoscalerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AutoscalerListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AutoscalerPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.AutoscalerUpdateCall.html) +* [backend buckets](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendBucket.html) + * [*add signed url key*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendBucketAddSignedUrlKeyCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendBucketDeleteCall.html), [*delete signed url key*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendBucketDeleteSignedUrlKeyCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendBucketGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendBucketInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendBucketListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendBucketPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendBucketUpdateCall.html) +* [backend services](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendService.html) + * [*add signed url key*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServiceAddSignedUrlKeyCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServiceAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServiceDeleteCall.html), [*delete signed url key*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServiceDeleteSignedUrlKeyCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServiceGetCall.html), [*get health*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServiceGetHealthCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServiceInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServiceListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServicePatchCall.html), [*set security policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServiceSetSecurityPolicyCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.BackendServiceUpdateCall.html) +* [disk types](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskType.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskTypeListCall.html) +* [disks](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Disk.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskAggregatedListCall.html), [*create snapshot*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskCreateSnapshotCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskGetCall.html), [*get iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskGetIamPolicyCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskListCall.html), [*resize*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskResizeCall.html), [*set iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskSetIamPolicyCall.html), [*set labels*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskSetLabelCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.DiskTestIamPermissionCall.html) +* [firewalls](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Firewall.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.FirewallDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.FirewallGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.FirewallInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.FirewallListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.FirewallPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.FirewallUpdateCall.html) +* [forwarding rules](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ForwardingRule.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ForwardingRuleAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ForwardingRuleDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ForwardingRuleGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ForwardingRuleInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ForwardingRuleListCall.html) and [*set target*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ForwardingRuleSetTargetCall.html) * global addresses - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalAddresseDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalAddresseGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalAddresseInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalAddresseListCall.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalAddresseDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalAddresseGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalAddresseInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalAddresseListCall.html) * global forwarding rules - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalForwardingRuleDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalForwardingRuleGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalForwardingRuleInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalForwardingRuleListCall.html) and [*set target*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalForwardingRuleSetTargetCall.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalForwardingRuleDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalForwardingRuleGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalForwardingRuleInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalForwardingRuleListCall.html) and [*set target*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalForwardingRuleSetTargetCall.html) * global operations - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalOperationAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalOperationDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalOperationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.GlobalOperationListCall.html) -* [health checks](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HealthCheck.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HealthCheckDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HealthCheckGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HealthCheckInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HealthCheckListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HealthCheckPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HealthCheckUpdateCall.html) -* [http health checks](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpHealthCheck.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpHealthCheckDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpHealthCheckGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpHealthCheckInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpHealthCheckListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpHealthCheckPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpHealthCheckUpdateCall.html) -* [https health checks](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpsHealthCheck.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpsHealthCheckDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpsHealthCheckGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpsHealthCheckInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpsHealthCheckListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpsHealthCheckPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.HttpsHealthCheckUpdateCall.html) -* [images](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Image.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ImageDeleteCall.html), [*deprecate*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ImageDeprecateCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ImageGetCall.html), [*get from family*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ImageGetFromFamilyCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ImageInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ImageListCall.html) and [*set labels*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ImageSetLabelCall.html) -* [instance group managers](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManager.html) - * [*abandon instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerAbandonInstanceCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerDeleteCall.html), [*delete instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerDeleteInstanceCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerListCall.html), [*list managed instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerListManagedInstanceCall.html), [*recreate instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerRecreateInstanceCall.html), [*resize*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerResizeCall.html), [*set instance template*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupManagerSetTargetPoolCall.html) -* [instance groups](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroup.html) - * [*add instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupAddInstanceCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupListCall.html), [*list instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupListInstanceCall.html), [*remove instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupRemoveInstanceCall.html) and [*set named ports*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGroupSetNamedPortCall.html) -* [instance templates](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceTemplate.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceTemplateDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceTemplateGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceTemplateInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceTemplateListCall.html) -* [instances](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Instance.html) - * [*add access config*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceAddAccessConfigCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceAggregatedListCall.html), [*attach disk*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceAttachDiskCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceDeleteCall.html), [*delete access config*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceDeleteAccessConfigCall.html), [*detach disk*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceDetachDiskCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGetCall.html), [*get serial port output*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceGetSerialPortOutputCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceListCall.html), [*list referrers*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceListReferrerCall.html), [*reset*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceResetCall.html), [*set deletion protection*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSetDeletionProtectionCall.html), [*set disk auto delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSetDiskAutoDeleteCall.html), [*set labels*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSetLabelCall.html), [*set machine resources*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSetMachineResourceCall.html), [*set machine type*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSetMachineTypeCall.html), [*set metadata*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSetMetadataCall.html), [*set min cpu platform*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSetMinCpuPlatformCall.html), [*set scheduling*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSetSchedulingCall.html), [*set service account*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSetServiceAccountCall.html), [*set tags*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSetTagCall.html), [*simulate maintenance event*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceSimulateMaintenanceEventCall.html), [*start*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceStartCall.html), [*start with encryption key*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceStartWithEncryptionKeyCall.html), [*stop*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceStopCall.html), [*update access config*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceUpdateAccessConfigCall.html) and [*update network interface*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InstanceUpdateNetworkInterfaceCall.html) -* [interconnect attachments](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectAttachment.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectAttachmentAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectAttachmentDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectAttachmentGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectAttachmentInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectAttachmentListCall.html) and [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectAttachmentPatchCall.html) -* [interconnect locations](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectLocation.html) - * [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectLocationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectLocationListCall.html) -* [interconnects](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Interconnect.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectListCall.html) and [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.InterconnectPatchCall.html) -* [license codes](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.LicenseCode.html) - * [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.LicenseCodeGetCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.LicenseCodeTestIamPermissionCall.html) -* [licenses](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.License.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.LicenseDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.LicenseGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.LicenseInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.LicenseListCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.LicenseTestIamPermissionCall.html) -* [machine types](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.MachineType.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.MachineTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.MachineTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.MachineTypeListCall.html) -* [networks](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Network.html) - * [*add peering*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NetworkAddPeeringCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NetworkDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NetworkGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NetworkInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NetworkListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NetworkPatchCall.html), [*remove peering*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NetworkRemovePeeringCall.html) and [*switch to custom mode*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NetworkSwitchToCustomModeCall.html) -* [node groups](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeGroup.html) - * [*add nodes*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeGroupAddNodeCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeGroupAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeGroupDeleteCall.html), [*delete nodes*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeGroupDeleteNodeCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeGroupGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeGroupInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeGroupListCall.html), [*list nodes*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeGroupListNodeCall.html) and [*set node template*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeGroupSetNodeTemplateCall.html) -* [node templates](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeTemplate.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeTemplateAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeTemplateDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeTemplateGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeTemplateInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeTemplateListCall.html) -* [node types](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeType.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.NodeTypeListCall.html) -* [projects](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Project.html) - * [*disable xpn host*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectDisableXpnHostCall.html), [*disable xpn resource*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectDisableXpnResourceCall.html), [*enable xpn host*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectEnableXpnHostCall.html), [*enable xpn resource*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectEnableXpnResourceCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectGetCall.html), [*get xpn host*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectGetXpnHostCall.html), [*get xpn resources*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectGetXpnResourceCall.html), [*list xpn hosts*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectListXpnHostCall.html), [*move disk*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectMoveDiskCall.html), [*move instance*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectMoveInstanceCall.html), [*set common instance metadata*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectSetCommonInstanceMetadataCall.html), [*set default network tier*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectSetDefaultNetworkTierCall.html) and [*set usage export bucket*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ProjectSetUsageExportBucketCall.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalOperationAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalOperationDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalOperationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.GlobalOperationListCall.html) +* [health checks](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HealthCheck.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HealthCheckDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HealthCheckGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HealthCheckInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HealthCheckListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HealthCheckPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HealthCheckUpdateCall.html) +* [http health checks](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpHealthCheck.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpHealthCheckDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpHealthCheckGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpHealthCheckInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpHealthCheckListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpHealthCheckPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpHealthCheckUpdateCall.html) +* [https health checks](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpsHealthCheck.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpsHealthCheckDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpsHealthCheckGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpsHealthCheckInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpsHealthCheckListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpsHealthCheckPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.HttpsHealthCheckUpdateCall.html) +* [images](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Image.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ImageDeleteCall.html), [*deprecate*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ImageDeprecateCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ImageGetCall.html), [*get from family*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ImageGetFromFamilyCall.html), [*get iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ImageGetIamPolicyCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ImageInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ImageListCall.html), [*set iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ImageSetIamPolicyCall.html), [*set labels*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ImageSetLabelCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ImageTestIamPermissionCall.html) +* [instance group managers](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManager.html) + * [*abandon instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerAbandonInstanceCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerDeleteCall.html), [*delete instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerDeleteInstanceCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerListCall.html), [*list managed instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerListManagedInstanceCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerPatchCall.html), [*recreate instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerRecreateInstanceCall.html), [*resize*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerResizeCall.html), [*set instance template*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupManagerSetTargetPoolCall.html) +* [instance groups](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroup.html) + * [*add instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupAddInstanceCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupListCall.html), [*list instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupListInstanceCall.html), [*remove instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupRemoveInstanceCall.html) and [*set named ports*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGroupSetNamedPortCall.html) +* [instance templates](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceTemplate.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceTemplateDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceTemplateGetCall.html), [*get iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceTemplateGetIamPolicyCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceTemplateInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceTemplateListCall.html), [*set iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceTemplateSetIamPolicyCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceTemplateTestIamPermissionCall.html) +* [instances](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Instance.html) + * [*add access config*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceAddAccessConfigCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceAggregatedListCall.html), [*attach disk*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceAttachDiskCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceDeleteCall.html), [*delete access config*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceDeleteAccessConfigCall.html), [*detach disk*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceDetachDiskCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGetCall.html), [*get iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGetIamPolicyCall.html), [*get serial port output*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGetSerialPortOutputCall.html), [*get shielded instance identity*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceGetShieldedInstanceIdentityCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceListCall.html), [*list referrers*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceListReferrerCall.html), [*reset*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceResetCall.html), [*set deletion protection*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetDeletionProtectionCall.html), [*set disk auto delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetDiskAutoDeleteCall.html), [*set iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetIamPolicyCall.html), [*set labels*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetLabelCall.html), [*set machine resources*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetMachineResourceCall.html), [*set machine type*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetMachineTypeCall.html), [*set metadata*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetMetadataCall.html), [*set min cpu platform*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetMinCpuPlatformCall.html), [*set scheduling*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetSchedulingCall.html), [*set service account*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetServiceAccountCall.html), [*set shielded instance integrity policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetShieldedInstanceIntegrityPolicyCall.html), [*set tags*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSetTagCall.html), [*simulate maintenance event*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceSimulateMaintenanceEventCall.html), [*start*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceStartCall.html), [*start with encryption key*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceStartWithEncryptionKeyCall.html), [*stop*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceStopCall.html), [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceTestIamPermissionCall.html), [*update access config*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceUpdateAccessConfigCall.html), [*update network interface*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceUpdateNetworkInterfaceCall.html) and [*update shielded instance config*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InstanceUpdateShieldedInstanceConfigCall.html) +* [interconnect attachments](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectAttachment.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectAttachmentAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectAttachmentDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectAttachmentGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectAttachmentInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectAttachmentListCall.html) and [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectAttachmentPatchCall.html) +* [interconnect locations](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectLocation.html) + * [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectLocationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectLocationListCall.html) +* [interconnects](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Interconnect.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectGetCall.html), [*get diagnostics*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectGetDiagnosticCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectListCall.html) and [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.InterconnectPatchCall.html) +* [license codes](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.LicenseCode.html) + * [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.LicenseCodeGetCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.LicenseCodeTestIamPermissionCall.html) +* [licenses](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.License.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.LicenseDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.LicenseGetCall.html), [*get iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.LicenseGetIamPolicyCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.LicenseInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.LicenseListCall.html), [*set iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.LicenseSetIamPolicyCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.LicenseTestIamPermissionCall.html) +* [machine types](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.MachineType.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.MachineTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.MachineTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.MachineTypeListCall.html) +* [network endpoint groups](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkEndpointGroup.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkEndpointGroupAggregatedListCall.html), [*attach network endpoints*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkEndpointGroupAttachNetworkEndpointCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkEndpointGroupDeleteCall.html), [*detach network endpoints*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkEndpointGroupDetachNetworkEndpointCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkEndpointGroupGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkEndpointGroupInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkEndpointGroupListCall.html), [*list network endpoints*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkEndpointGroupListNetworkEndpointCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkEndpointGroupTestIamPermissionCall.html) +* [networks](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Network.html) + * [*add peering*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkAddPeeringCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkPatchCall.html), [*remove peering*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkRemovePeeringCall.html) and [*switch to custom mode*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NetworkSwitchToCustomModeCall.html) +* [node groups](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroup.html) + * [*add nodes*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupAddNodeCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupDeleteCall.html), [*delete nodes*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupDeleteNodeCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupGetCall.html), [*get iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupGetIamPolicyCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupListCall.html), [*list nodes*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupListNodeCall.html), [*set iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupSetIamPolicyCall.html), [*set node template*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupSetNodeTemplateCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeGroupTestIamPermissionCall.html) +* [node templates](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTemplate.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTemplateAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTemplateDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTemplateGetCall.html), [*get iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTemplateGetIamPolicyCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTemplateInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTemplateListCall.html), [*set iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTemplateSetIamPolicyCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTemplateTestIamPermissionCall.html) +* [node types](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeType.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTypeAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.NodeTypeListCall.html) +* [projects](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Project.html) + * [*disable xpn host*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectDisableXpnHostCall.html), [*disable xpn resource*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectDisableXpnResourceCall.html), [*enable xpn host*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectEnableXpnHostCall.html), [*enable xpn resource*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectEnableXpnResourceCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectGetCall.html), [*get xpn host*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectGetXpnHostCall.html), [*get xpn resources*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectGetXpnResourceCall.html), [*list xpn hosts*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectListXpnHostCall.html), [*move disk*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectMoveDiskCall.html), [*move instance*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectMoveInstanceCall.html), [*set common instance metadata*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectSetCommonInstanceMetadataCall.html), [*set default network tier*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectSetDefaultNetworkTierCall.html) and [*set usage export bucket*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ProjectSetUsageExportBucketCall.html) * region autoscalers - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionAutoscalerDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionAutoscalerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionAutoscalerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionAutoscalerListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionAutoscalerPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionAutoscalerUpdateCall.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionAutoscalerDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionAutoscalerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionAutoscalerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionAutoscalerListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionAutoscalerPatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionAutoscalerUpdateCall.html) * region backend services - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionBackendServiceDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionBackendServiceGetCall.html), [*get health*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionBackendServiceGetHealthCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionBackendServiceInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionBackendServiceListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionBackendServicePatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionBackendServiceUpdateCall.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionBackendServiceDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionBackendServiceGetCall.html), [*get health*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionBackendServiceGetHealthCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionBackendServiceInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionBackendServiceListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionBackendServicePatchCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionBackendServiceUpdateCall.html) * region commitments - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionCommitmentAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionCommitmentGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionCommitmentInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionCommitmentListCall.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionCommitmentAggregatedListCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionCommitmentGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionCommitmentInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionCommitmentListCall.html) * region disk types - * [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionDiskTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionDiskTypeListCall.html) + * [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionDiskTypeGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionDiskTypeListCall.html) * region disks - * [*create snapshot*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionDiskCreateSnapshotCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionDiskDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionDiskGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionDiskInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionDiskListCall.html), [*resize*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionDiskResizeCall.html), [*set labels*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionDiskSetLabelCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionDiskTestIamPermissionCall.html) + * [*create snapshot*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionDiskCreateSnapshotCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionDiskDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionDiskGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionDiskInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionDiskListCall.html), [*resize*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionDiskResizeCall.html), [*set labels*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionDiskSetLabelCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionDiskTestIamPermissionCall.html) * region instance group managers - * [*abandon instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerAbandonInstanceCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerDeleteCall.html), [*delete instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerDeleteInstanceCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerListCall.html), [*list managed instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerListManagedInstanceCall.html), [*recreate instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerRecreateInstanceCall.html), [*resize*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerResizeCall.html), [*set instance template*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupManagerSetTargetPoolCall.html) + * [*abandon instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerAbandonInstanceCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerDeleteCall.html), [*delete instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerDeleteInstanceCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerListCall.html), [*list managed instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerListManagedInstanceCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerPatchCall.html), [*recreate instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerRecreateInstanceCall.html), [*resize*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerResizeCall.html), [*set instance template*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupManagerSetTargetPoolCall.html) * region instance groups - * [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupGetCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupListCall.html), [*list instances*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupListInstanceCall.html) and [*set named ports*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionInstanceGroupSetNamedPortCall.html) + * [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupGetCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupListCall.html), [*list instances*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupListInstanceCall.html) and [*set named ports*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionInstanceGroupSetNamedPortCall.html) * region operations - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionOperationDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionOperationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionOperationListCall.html) -* [regions](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Region.html) - * [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RegionListCall.html) -* [routers](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Router.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouterAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouterDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouterGetCall.html), [*get router status*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouterGetRouterStatuCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouterInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouterListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouterPatchCall.html), [*preview*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouterPreviewCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouterUpdateCall.html) -* [routes](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Route.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouteDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouteGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouteInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.RouteListCall.html) -* [security policies](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SecurityPolicy.html) - * [*add rule*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SecurityPolicyAddRuleCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SecurityPolicyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SecurityPolicyGetCall.html), [*get rule*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SecurityPolicyGetRuleCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SecurityPolicyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SecurityPolicyListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SecurityPolicyPatchCall.html), [*patch rule*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SecurityPolicyPatchRuleCall.html) and [*remove rule*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SecurityPolicyRemoveRuleCall.html) -* [snapshots](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Snapshot.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SnapshotDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SnapshotGetCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SnapshotListCall.html) and [*set labels*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SnapshotSetLabelCall.html) -* [ssl certificates](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslCertificate.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslCertificateDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslCertificateGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslCertificateInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslCertificateListCall.html) -* [ssl policies](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslPolicy.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslPolicyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslPolicyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslPolicyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslPolicyListCall.html), [*list available features*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslPolicyListAvailableFeatureCall.html) and [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SslPolicyPatchCall.html) -* [subnetworks](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Subnetwork.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SubnetworkAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SubnetworkDeleteCall.html), [*expand ip cidr range*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SubnetworkExpandIpCidrRangeCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SubnetworkGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SubnetworkInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SubnetworkListCall.html), [*list usable*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SubnetworkListUsableCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SubnetworkPatchCall.html) and [*set private ip google access*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.SubnetworkSetPrivateIpGoogleAccesCall.html) -* [target http proxies](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpProxy.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpProxyListCall.html) and [*set url map*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpProxySetUrlMapCall.html) -* [target https proxies](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpsProxy.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpsProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpsProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpsProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpsProxyListCall.html), [*set quic override*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpsProxySetQuicOverrideCall.html), [*set ssl certificates*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpsProxySetSslCertificateCall.html), [*set ssl policy*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpsProxySetSslPolicyCall.html) and [*set url map*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetHttpsProxySetUrlMapCall.html) -* [target instances](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetInstance.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetInstanceAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetInstanceDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetInstanceGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetInstanceInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetInstanceListCall.html) -* [target pools](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPool.html) - * [*add health check*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolAddHealthCheckCall.html), [*add instance*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolAddInstanceCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolGetCall.html), [*get health*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolGetHealthCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolListCall.html), [*remove health check*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolRemoveHealthCheckCall.html), [*remove instance*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolRemoveInstanceCall.html) and [*set backup*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetPoolSetBackupCall.html) -* [target ssl proxies](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetSslProxy.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetSslProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetSslProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetSslProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetSslProxyListCall.html), [*set backend service*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetSslProxySetBackendServiceCall.html), [*set proxy header*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetSslProxySetProxyHeaderCall.html), [*set ssl certificates*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetSslProxySetSslCertificateCall.html) and [*set ssl policy*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetSslProxySetSslPolicyCall.html) -* [target tcp proxies](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetTcpProxy.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetTcpProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetTcpProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetTcpProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetTcpProxyListCall.html), [*set backend service*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetTcpProxySetBackendServiceCall.html) and [*set proxy header*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetTcpProxySetProxyHeaderCall.html) -* [target vpn gateways](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetVpnGateway.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetVpnGatewayAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetVpnGatewayDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetVpnGatewayGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetVpnGatewayInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.TargetVpnGatewayListCall.html) -* [url maps](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.UrlMap.html) - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.UrlMapDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.UrlMapGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.UrlMapInsertCall.html), [*invalidate cache*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.UrlMapInvalidateCacheCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.UrlMapListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.UrlMapPatchCall.html), [*update*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.UrlMapUpdateCall.html) and [*validate*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.UrlMapValidateCall.html) -* [vpn tunnels](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.VpnTunnel.html) - * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.VpnTunnelAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.VpnTunnelDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.VpnTunnelGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.VpnTunnelInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.VpnTunnelListCall.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionOperationDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionOperationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionOperationListCall.html) +* [regions](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Region.html) + * [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RegionListCall.html) +* [routers](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Router.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouterAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouterDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouterGetCall.html), [*get nat mapping info*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouterGetNatMappingInfoCall.html), [*get router status*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouterGetRouterStatuCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouterInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouterListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouterPatchCall.html), [*preview*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouterPreviewCall.html) and [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouterUpdateCall.html) +* [routes](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Route.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouteDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouteGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouteInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.RouteListCall.html) +* [security policies](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SecurityPolicy.html) + * [*add rule*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SecurityPolicyAddRuleCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SecurityPolicyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SecurityPolicyGetCall.html), [*get rule*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SecurityPolicyGetRuleCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SecurityPolicyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SecurityPolicyListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SecurityPolicyPatchCall.html), [*patch rule*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SecurityPolicyPatchRuleCall.html) and [*remove rule*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SecurityPolicyRemoveRuleCall.html) +* [snapshots](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Snapshot.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SnapshotDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SnapshotGetCall.html), [*get iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SnapshotGetIamPolicyCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SnapshotListCall.html), [*set iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SnapshotSetIamPolicyCall.html), [*set labels*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SnapshotSetLabelCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SnapshotTestIamPermissionCall.html) +* [ssl certificates](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslCertificate.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslCertificateDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslCertificateGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslCertificateInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslCertificateListCall.html) +* [ssl policies](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslPolicy.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslPolicyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslPolicyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslPolicyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslPolicyListCall.html), [*list available features*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslPolicyListAvailableFeatureCall.html) and [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SslPolicyPatchCall.html) +* [subnetworks](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Subnetwork.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkDeleteCall.html), [*expand ip cidr range*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkExpandIpCidrRangeCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkGetCall.html), [*get iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkGetIamPolicyCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkListCall.html), [*list usable*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkListUsableCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkPatchCall.html), [*set iam policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkSetIamPolicyCall.html), [*set private ip google access*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkSetPrivateIpGoogleAccesCall.html) and [*test iam permissions*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.SubnetworkTestIamPermissionCall.html) +* [target http proxies](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpProxy.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpProxyListCall.html) and [*set url map*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpProxySetUrlMapCall.html) +* [target https proxies](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpsProxy.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpsProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpsProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpsProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpsProxyListCall.html), [*set quic override*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpsProxySetQuicOverrideCall.html), [*set ssl certificates*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpsProxySetSslCertificateCall.html), [*set ssl policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpsProxySetSslPolicyCall.html) and [*set url map*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetHttpsProxySetUrlMapCall.html) +* [target instances](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetInstance.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetInstanceAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetInstanceDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetInstanceGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetInstanceInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetInstanceListCall.html) +* [target pools](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPool.html) + * [*add health check*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolAddHealthCheckCall.html), [*add instance*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolAddInstanceCall.html), [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolGetCall.html), [*get health*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolGetHealthCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolListCall.html), [*remove health check*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolRemoveHealthCheckCall.html), [*remove instance*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolRemoveInstanceCall.html) and [*set backup*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetPoolSetBackupCall.html) +* [target ssl proxies](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetSslProxy.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetSslProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetSslProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetSslProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetSslProxyListCall.html), [*set backend service*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetSslProxySetBackendServiceCall.html), [*set proxy header*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetSslProxySetProxyHeaderCall.html), [*set ssl certificates*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetSslProxySetSslCertificateCall.html) and [*set ssl policy*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetSslProxySetSslPolicyCall.html) +* [target tcp proxies](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetTcpProxy.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetTcpProxyDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetTcpProxyGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetTcpProxyInsertCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetTcpProxyListCall.html), [*set backend service*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetTcpProxySetBackendServiceCall.html) and [*set proxy header*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetTcpProxySetProxyHeaderCall.html) +* [target vpn gateways](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetVpnGateway.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetVpnGatewayAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetVpnGatewayDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetVpnGatewayGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetVpnGatewayInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.TargetVpnGatewayListCall.html) +* [url maps](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.UrlMap.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.UrlMapDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.UrlMapGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.UrlMapInsertCall.html), [*invalidate cache*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.UrlMapInvalidateCacheCall.html), [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.UrlMapListCall.html), [*patch*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.UrlMapPatchCall.html), [*update*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.UrlMapUpdateCall.html) and [*validate*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.UrlMapValidateCall.html) +* [vpn tunnels](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.VpnTunnel.html) + * [*aggregated list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.VpnTunnelAggregatedListCall.html), [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.VpnTunnelDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.VpnTunnelGetCall.html), [*insert*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.VpnTunnelInsertCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.VpnTunnelListCall.html) * zone operations - * [*delete*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ZoneOperationDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ZoneOperationListCall.html) -* [zones](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Zone.html) - * [*get*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ZoneGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.ZoneListCall.html) + * [*delete*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ZoneOperationDeleteCall.html), [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ZoneOperationListCall.html) +* [zones](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Zone.html) + * [*get*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ZoneGetCall.html) and [*list*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.ZoneListCall.html) @@ -137,17 +139,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/struct.Compute.html)** +* **[Hub](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/struct.Compute.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.Part.html)** + * **[Parts](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -168,12 +170,14 @@ let r = hub.region_disks().resize(...).doit() let r = hub.autoscalers().patch(...).doit() let r = hub.instance_group_managers().resize(...).doit() let r = hub.instance_templates().delete(...).doit() +let r = hub.region_instance_group_managers().patch(...).doit() let r = hub.region_backend_services().delete(...).doit() let r = hub.interconnects().delete(...).doit() +let r = hub.instances().update_shielded_instance_config(...).doit() let r = hub.firewalls().patch(...).doit() let r = hub.vpn_tunnels().delete(...).doit() let r = hub.region_disks().set_labels(...).doit() -let r = hub.instances().set_machine_type(...).doit() +let r = hub.backend_services().delete(...).doit() let r = hub.https_health_checks().delete(...).doit() let r = hub.node_groups().delete(...).doit() let r = hub.ssl_policies().delete(...).doit() @@ -205,10 +209,10 @@ let r = hub.projects().set_default_network_tier(...).doit() let r = hub.instance_group_managers().set_instance_template(...).doit() let r = hub.node_groups().set_node_template(...).doit() let r = hub.region_autoscalers().delete(...).doit() +let r = hub.security_policies().insert(...).doit() let r = hub.networks().remove_peering(...).doit() let r = hub.ssl_policies().patch(...).doit() let r = hub.interconnect_attachments().delete(...).doit() -let r = hub.networks().delete(...).doit() let r = hub.target_pools().insert(...).doit() let r = hub.node_templates().insert(...).doit() let r = hub.projects().disable_xpn_resource(...).doit() @@ -223,13 +227,13 @@ let r = hub.instances().simulate_maintenance_event(...).doit() let r = hub.target_pools().remove_health_check(...).doit() let r = hub.target_https_proxies().set_url_map(...).doit() let r = hub.region_disks().create_snapshot(...).doit() -let r = hub.backend_services().delete(...).doit() +let r = hub.instances().set_machine_type(...).doit() let r = hub.instances().update_network_interface(...).doit() let r = hub.url_maps().insert(...).doit() let r = hub.instances().add_access_config(...).doit() let r = hub.instances().set_machine_resources(...).doit() let r = hub.instances().update_access_config(...).doit() -let r = hub.security_policies().insert(...).doit() +let r = hub.networks().delete(...).doit() let r = hub.addresses().insert(...).doit() let r = hub.health_checks().insert(...).doit() let r = hub.global_forwarding_rules().insert(...).doit() @@ -267,6 +271,7 @@ let r = hub.target_https_proxies().set_ssl_certificates(...).doit() let r = hub.instance_groups().add_instances(...).doit() let r = hub.instance_group_managers().abandon_instances(...).doit() let r = hub.instances().set_tags(...).doit() +let r = hub.network_endpoint_groups().attach_network_endpoints(...).doit() let r = hub.snapshots().delete(...).doit() let r = hub.target_https_proxies().insert(...).doit() let r = hub.node_groups().add_nodes(...).doit() @@ -274,6 +279,7 @@ let r = hub.target_tcp_proxies().set_proxy_header(...).doit() let r = hub.backend_services().update(...).doit() let r = hub.node_groups().delete_nodes(...).doit() let r = hub.licenses().delete(...).doit() +let r = hub.instance_group_managers().patch(...).doit() let r = hub.subnetworks().patch(...).doit() let r = hub.target_https_proxies().set_ssl_policy(...).doit() let r = hub.instances().attach_disk(...).doit() @@ -285,6 +291,7 @@ let r = hub.node_groups().insert(...).doit() let r = hub.licenses().insert(...).doit() let r = hub.backend_services().patch(...).doit() let r = hub.target_http_proxies().set_url_map(...).doit() +let r = hub.network_endpoint_groups().delete(...).doit() let r = hub.region_instance_group_managers().delete(...).doit() let r = hub.images().deprecate(...).doit() let r = hub.http_health_checks().patch(...).doit() @@ -312,6 +319,7 @@ let r = hub.region_disks().delete(...).doit() let r = hub.instances().stop(...).doit() let r = hub.target_pools().add_instance(...).doit() let r = hub.target_pools().remove_instance(...).doit() +let r = hub.network_endpoint_groups().detach_network_endpoints(...).doit() let r = hub.target_pools().delete(...).doit() let r = hub.firewalls().update(...).doit() let r = hub.instances().insert(...).doit() @@ -336,6 +344,7 @@ let r = hub.health_checks().delete(...).doit() let r = hub.backend_services().insert(...).doit() let r = hub.instances().set_labels(...).doit() let r = hub.region_backend_services().update(...).doit() +let r = hub.instances().set_shielded_instance_integrity_policy(...).doit() let r = hub.target_http_proxies().delete(...).doit() let r = hub.backend_buckets().patch(...).doit() let r = hub.global_addresses().delete(...).doit() @@ -361,6 +370,7 @@ let r = hub.target_ssl_proxies().insert(...).doit() let r = hub.instances().start_with_encryption_key(...).doit() let r = hub.instances().set_min_cpu_platform(...).doit() let r = hub.forwarding_rules().delete(...).doit() +let r = hub.network_endpoint_groups().insert(...).doit() let r = hub.backend_buckets().update(...).doit() let r = hub.region_instance_group_managers().insert(...).doit() let r = hub.firewalls().delete(...).doit() @@ -445,17 +455,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -465,29 +475,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-compute1/1.0.8+20180916/google_compute1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-compute1/1.0.8+20190320/google_compute1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/compute1/src/lib.rs b/gen/compute1/src/lib.rs index e5121c9da4..3b98541dad 100644 --- a/gen/compute1/src/lib.rs +++ b/gen/compute1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *compute* crate version *1.0.8+20180916*, where *20180916* is the exact revision of the *compute:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *compute* crate version *1.0.8+20190320*, where *20190320* is the exact revision of the *compute:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *compute* *v1* API can be found at the //! [official documentation site](https://developers.google.com/compute/docs/reference/latest/). @@ -24,7 +24,7 @@ //! * [disk types](struct.DiskType.html) //! * [*aggregated list*](struct.DiskTypeAggregatedListCall.html), [*get*](struct.DiskTypeGetCall.html) and [*list*](struct.DiskTypeListCall.html) //! * [disks](struct.Disk.html) -//! * [*aggregated list*](struct.DiskAggregatedListCall.html), [*create snapshot*](struct.DiskCreateSnapshotCall.html), [*delete*](struct.DiskDeleteCall.html), [*get*](struct.DiskGetCall.html), [*insert*](struct.DiskInsertCall.html), [*list*](struct.DiskListCall.html), [*resize*](struct.DiskResizeCall.html) and [*set labels*](struct.DiskSetLabelCall.html) +//! * [*aggregated list*](struct.DiskAggregatedListCall.html), [*create snapshot*](struct.DiskCreateSnapshotCall.html), [*delete*](struct.DiskDeleteCall.html), [*get*](struct.DiskGetCall.html), [*get iam policy*](struct.DiskGetIamPolicyCall.html), [*insert*](struct.DiskInsertCall.html), [*list*](struct.DiskListCall.html), [*resize*](struct.DiskResizeCall.html), [*set iam policy*](struct.DiskSetIamPolicyCall.html), [*set labels*](struct.DiskSetLabelCall.html) and [*test iam permissions*](struct.DiskTestIamPermissionCall.html) //! * [firewalls](struct.Firewall.html) //! * [*delete*](struct.FirewallDeleteCall.html), [*get*](struct.FirewallGetCall.html), [*insert*](struct.FirewallInsertCall.html), [*list*](struct.FirewallListCall.html), [*patch*](struct.FirewallPatchCall.html) and [*update*](struct.FirewallUpdateCall.html) //! * [forwarding rules](struct.ForwardingRule.html) @@ -42,33 +42,35 @@ //! * [https health checks](struct.HttpsHealthCheck.html) //! * [*delete*](struct.HttpsHealthCheckDeleteCall.html), [*get*](struct.HttpsHealthCheckGetCall.html), [*insert*](struct.HttpsHealthCheckInsertCall.html), [*list*](struct.HttpsHealthCheckListCall.html), [*patch*](struct.HttpsHealthCheckPatchCall.html) and [*update*](struct.HttpsHealthCheckUpdateCall.html) //! * [images](struct.Image.html) -//! * [*delete*](struct.ImageDeleteCall.html), [*deprecate*](struct.ImageDeprecateCall.html), [*get*](struct.ImageGetCall.html), [*get from family*](struct.ImageGetFromFamilyCall.html), [*insert*](struct.ImageInsertCall.html), [*list*](struct.ImageListCall.html) and [*set labels*](struct.ImageSetLabelCall.html) +//! * [*delete*](struct.ImageDeleteCall.html), [*deprecate*](struct.ImageDeprecateCall.html), [*get*](struct.ImageGetCall.html), [*get from family*](struct.ImageGetFromFamilyCall.html), [*get iam policy*](struct.ImageGetIamPolicyCall.html), [*insert*](struct.ImageInsertCall.html), [*list*](struct.ImageListCall.html), [*set iam policy*](struct.ImageSetIamPolicyCall.html), [*set labels*](struct.ImageSetLabelCall.html) and [*test iam permissions*](struct.ImageTestIamPermissionCall.html) //! * [instance group managers](struct.InstanceGroupManager.html) -//! * [*abandon instances*](struct.InstanceGroupManagerAbandonInstanceCall.html), [*aggregated list*](struct.InstanceGroupManagerAggregatedListCall.html), [*delete*](struct.InstanceGroupManagerDeleteCall.html), [*delete instances*](struct.InstanceGroupManagerDeleteInstanceCall.html), [*get*](struct.InstanceGroupManagerGetCall.html), [*insert*](struct.InstanceGroupManagerInsertCall.html), [*list*](struct.InstanceGroupManagerListCall.html), [*list managed instances*](struct.InstanceGroupManagerListManagedInstanceCall.html), [*recreate instances*](struct.InstanceGroupManagerRecreateInstanceCall.html), [*resize*](struct.InstanceGroupManagerResizeCall.html), [*set instance template*](struct.InstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](struct.InstanceGroupManagerSetTargetPoolCall.html) +//! * [*abandon instances*](struct.InstanceGroupManagerAbandonInstanceCall.html), [*aggregated list*](struct.InstanceGroupManagerAggregatedListCall.html), [*delete*](struct.InstanceGroupManagerDeleteCall.html), [*delete instances*](struct.InstanceGroupManagerDeleteInstanceCall.html), [*get*](struct.InstanceGroupManagerGetCall.html), [*insert*](struct.InstanceGroupManagerInsertCall.html), [*list*](struct.InstanceGroupManagerListCall.html), [*list managed instances*](struct.InstanceGroupManagerListManagedInstanceCall.html), [*patch*](struct.InstanceGroupManagerPatchCall.html), [*recreate instances*](struct.InstanceGroupManagerRecreateInstanceCall.html), [*resize*](struct.InstanceGroupManagerResizeCall.html), [*set instance template*](struct.InstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](struct.InstanceGroupManagerSetTargetPoolCall.html) //! * [instance groups](struct.InstanceGroup.html) //! * [*add instances*](struct.InstanceGroupAddInstanceCall.html), [*aggregated list*](struct.InstanceGroupAggregatedListCall.html), [*delete*](struct.InstanceGroupDeleteCall.html), [*get*](struct.InstanceGroupGetCall.html), [*insert*](struct.InstanceGroupInsertCall.html), [*list*](struct.InstanceGroupListCall.html), [*list instances*](struct.InstanceGroupListInstanceCall.html), [*remove instances*](struct.InstanceGroupRemoveInstanceCall.html) and [*set named ports*](struct.InstanceGroupSetNamedPortCall.html) //! * [instance templates](struct.InstanceTemplate.html) -//! * [*delete*](struct.InstanceTemplateDeleteCall.html), [*get*](struct.InstanceTemplateGetCall.html), [*insert*](struct.InstanceTemplateInsertCall.html) and [*list*](struct.InstanceTemplateListCall.html) +//! * [*delete*](struct.InstanceTemplateDeleteCall.html), [*get*](struct.InstanceTemplateGetCall.html), [*get iam policy*](struct.InstanceTemplateGetIamPolicyCall.html), [*insert*](struct.InstanceTemplateInsertCall.html), [*list*](struct.InstanceTemplateListCall.html), [*set iam policy*](struct.InstanceTemplateSetIamPolicyCall.html) and [*test iam permissions*](struct.InstanceTemplateTestIamPermissionCall.html) //! * [instances](struct.Instance.html) -//! * [*add access config*](struct.InstanceAddAccessConfigCall.html), [*aggregated list*](struct.InstanceAggregatedListCall.html), [*attach disk*](struct.InstanceAttachDiskCall.html), [*delete*](struct.InstanceDeleteCall.html), [*delete access config*](struct.InstanceDeleteAccessConfigCall.html), [*detach disk*](struct.InstanceDetachDiskCall.html), [*get*](struct.InstanceGetCall.html), [*get serial port output*](struct.InstanceGetSerialPortOutputCall.html), [*insert*](struct.InstanceInsertCall.html), [*list*](struct.InstanceListCall.html), [*list referrers*](struct.InstanceListReferrerCall.html), [*reset*](struct.InstanceResetCall.html), [*set deletion protection*](struct.InstanceSetDeletionProtectionCall.html), [*set disk auto delete*](struct.InstanceSetDiskAutoDeleteCall.html), [*set labels*](struct.InstanceSetLabelCall.html), [*set machine resources*](struct.InstanceSetMachineResourceCall.html), [*set machine type*](struct.InstanceSetMachineTypeCall.html), [*set metadata*](struct.InstanceSetMetadataCall.html), [*set min cpu platform*](struct.InstanceSetMinCpuPlatformCall.html), [*set scheduling*](struct.InstanceSetSchedulingCall.html), [*set service account*](struct.InstanceSetServiceAccountCall.html), [*set tags*](struct.InstanceSetTagCall.html), [*simulate maintenance event*](struct.InstanceSimulateMaintenanceEventCall.html), [*start*](struct.InstanceStartCall.html), [*start with encryption key*](struct.InstanceStartWithEncryptionKeyCall.html), [*stop*](struct.InstanceStopCall.html), [*update access config*](struct.InstanceUpdateAccessConfigCall.html) and [*update network interface*](struct.InstanceUpdateNetworkInterfaceCall.html) +//! * [*add access config*](struct.InstanceAddAccessConfigCall.html), [*aggregated list*](struct.InstanceAggregatedListCall.html), [*attach disk*](struct.InstanceAttachDiskCall.html), [*delete*](struct.InstanceDeleteCall.html), [*delete access config*](struct.InstanceDeleteAccessConfigCall.html), [*detach disk*](struct.InstanceDetachDiskCall.html), [*get*](struct.InstanceGetCall.html), [*get iam policy*](struct.InstanceGetIamPolicyCall.html), [*get serial port output*](struct.InstanceGetSerialPortOutputCall.html), [*get shielded instance identity*](struct.InstanceGetShieldedInstanceIdentityCall.html), [*insert*](struct.InstanceInsertCall.html), [*list*](struct.InstanceListCall.html), [*list referrers*](struct.InstanceListReferrerCall.html), [*reset*](struct.InstanceResetCall.html), [*set deletion protection*](struct.InstanceSetDeletionProtectionCall.html), [*set disk auto delete*](struct.InstanceSetDiskAutoDeleteCall.html), [*set iam policy*](struct.InstanceSetIamPolicyCall.html), [*set labels*](struct.InstanceSetLabelCall.html), [*set machine resources*](struct.InstanceSetMachineResourceCall.html), [*set machine type*](struct.InstanceSetMachineTypeCall.html), [*set metadata*](struct.InstanceSetMetadataCall.html), [*set min cpu platform*](struct.InstanceSetMinCpuPlatformCall.html), [*set scheduling*](struct.InstanceSetSchedulingCall.html), [*set service account*](struct.InstanceSetServiceAccountCall.html), [*set shielded instance integrity policy*](struct.InstanceSetShieldedInstanceIntegrityPolicyCall.html), [*set tags*](struct.InstanceSetTagCall.html), [*simulate maintenance event*](struct.InstanceSimulateMaintenanceEventCall.html), [*start*](struct.InstanceStartCall.html), [*start with encryption key*](struct.InstanceStartWithEncryptionKeyCall.html), [*stop*](struct.InstanceStopCall.html), [*test iam permissions*](struct.InstanceTestIamPermissionCall.html), [*update access config*](struct.InstanceUpdateAccessConfigCall.html), [*update network interface*](struct.InstanceUpdateNetworkInterfaceCall.html) and [*update shielded instance config*](struct.InstanceUpdateShieldedInstanceConfigCall.html) //! * [interconnect attachments](struct.InterconnectAttachment.html) //! * [*aggregated list*](struct.InterconnectAttachmentAggregatedListCall.html), [*delete*](struct.InterconnectAttachmentDeleteCall.html), [*get*](struct.InterconnectAttachmentGetCall.html), [*insert*](struct.InterconnectAttachmentInsertCall.html), [*list*](struct.InterconnectAttachmentListCall.html) and [*patch*](struct.InterconnectAttachmentPatchCall.html) //! * [interconnect locations](struct.InterconnectLocation.html) //! * [*get*](struct.InterconnectLocationGetCall.html) and [*list*](struct.InterconnectLocationListCall.html) //! * [interconnects](struct.Interconnect.html) -//! * [*delete*](struct.InterconnectDeleteCall.html), [*get*](struct.InterconnectGetCall.html), [*insert*](struct.InterconnectInsertCall.html), [*list*](struct.InterconnectListCall.html) and [*patch*](struct.InterconnectPatchCall.html) +//! * [*delete*](struct.InterconnectDeleteCall.html), [*get*](struct.InterconnectGetCall.html), [*get diagnostics*](struct.InterconnectGetDiagnosticCall.html), [*insert*](struct.InterconnectInsertCall.html), [*list*](struct.InterconnectListCall.html) and [*patch*](struct.InterconnectPatchCall.html) //! * [license codes](struct.LicenseCode.html) //! * [*get*](struct.LicenseCodeGetCall.html) and [*test iam permissions*](struct.LicenseCodeTestIamPermissionCall.html) //! * [licenses](struct.License.html) -//! * [*delete*](struct.LicenseDeleteCall.html), [*get*](struct.LicenseGetCall.html), [*insert*](struct.LicenseInsertCall.html), [*list*](struct.LicenseListCall.html) and [*test iam permissions*](struct.LicenseTestIamPermissionCall.html) +//! * [*delete*](struct.LicenseDeleteCall.html), [*get*](struct.LicenseGetCall.html), [*get iam policy*](struct.LicenseGetIamPolicyCall.html), [*insert*](struct.LicenseInsertCall.html), [*list*](struct.LicenseListCall.html), [*set iam policy*](struct.LicenseSetIamPolicyCall.html) and [*test iam permissions*](struct.LicenseTestIamPermissionCall.html) //! * [machine types](struct.MachineType.html) //! * [*aggregated list*](struct.MachineTypeAggregatedListCall.html), [*get*](struct.MachineTypeGetCall.html) and [*list*](struct.MachineTypeListCall.html) +//! * [network endpoint groups](struct.NetworkEndpointGroup.html) +//! * [*aggregated list*](struct.NetworkEndpointGroupAggregatedListCall.html), [*attach network endpoints*](struct.NetworkEndpointGroupAttachNetworkEndpointCall.html), [*delete*](struct.NetworkEndpointGroupDeleteCall.html), [*detach network endpoints*](struct.NetworkEndpointGroupDetachNetworkEndpointCall.html), [*get*](struct.NetworkEndpointGroupGetCall.html), [*insert*](struct.NetworkEndpointGroupInsertCall.html), [*list*](struct.NetworkEndpointGroupListCall.html), [*list network endpoints*](struct.NetworkEndpointGroupListNetworkEndpointCall.html) and [*test iam permissions*](struct.NetworkEndpointGroupTestIamPermissionCall.html) //! * [networks](struct.Network.html) //! * [*add peering*](struct.NetworkAddPeeringCall.html), [*delete*](struct.NetworkDeleteCall.html), [*get*](struct.NetworkGetCall.html), [*insert*](struct.NetworkInsertCall.html), [*list*](struct.NetworkListCall.html), [*patch*](struct.NetworkPatchCall.html), [*remove peering*](struct.NetworkRemovePeeringCall.html) and [*switch to custom mode*](struct.NetworkSwitchToCustomModeCall.html) //! * [node groups](struct.NodeGroup.html) -//! * [*add nodes*](struct.NodeGroupAddNodeCall.html), [*aggregated list*](struct.NodeGroupAggregatedListCall.html), [*delete*](struct.NodeGroupDeleteCall.html), [*delete nodes*](struct.NodeGroupDeleteNodeCall.html), [*get*](struct.NodeGroupGetCall.html), [*insert*](struct.NodeGroupInsertCall.html), [*list*](struct.NodeGroupListCall.html), [*list nodes*](struct.NodeGroupListNodeCall.html) and [*set node template*](struct.NodeGroupSetNodeTemplateCall.html) +//! * [*add nodes*](struct.NodeGroupAddNodeCall.html), [*aggregated list*](struct.NodeGroupAggregatedListCall.html), [*delete*](struct.NodeGroupDeleteCall.html), [*delete nodes*](struct.NodeGroupDeleteNodeCall.html), [*get*](struct.NodeGroupGetCall.html), [*get iam policy*](struct.NodeGroupGetIamPolicyCall.html), [*insert*](struct.NodeGroupInsertCall.html), [*list*](struct.NodeGroupListCall.html), [*list nodes*](struct.NodeGroupListNodeCall.html), [*set iam policy*](struct.NodeGroupSetIamPolicyCall.html), [*set node template*](struct.NodeGroupSetNodeTemplateCall.html) and [*test iam permissions*](struct.NodeGroupTestIamPermissionCall.html) //! * [node templates](struct.NodeTemplate.html) -//! * [*aggregated list*](struct.NodeTemplateAggregatedListCall.html), [*delete*](struct.NodeTemplateDeleteCall.html), [*get*](struct.NodeTemplateGetCall.html), [*insert*](struct.NodeTemplateInsertCall.html) and [*list*](struct.NodeTemplateListCall.html) +//! * [*aggregated list*](struct.NodeTemplateAggregatedListCall.html), [*delete*](struct.NodeTemplateDeleteCall.html), [*get*](struct.NodeTemplateGetCall.html), [*get iam policy*](struct.NodeTemplateGetIamPolicyCall.html), [*insert*](struct.NodeTemplateInsertCall.html), [*list*](struct.NodeTemplateListCall.html), [*set iam policy*](struct.NodeTemplateSetIamPolicyCall.html) and [*test iam permissions*](struct.NodeTemplateTestIamPermissionCall.html) //! * [node types](struct.NodeType.html) //! * [*aggregated list*](struct.NodeTypeAggregatedListCall.html), [*get*](struct.NodeTypeGetCall.html) and [*list*](struct.NodeTypeListCall.html) //! * [projects](struct.Project.html) @@ -84,7 +86,7 @@ //! * region disks //! * [*create snapshot*](struct.RegionDiskCreateSnapshotCall.html), [*delete*](struct.RegionDiskDeleteCall.html), [*get*](struct.RegionDiskGetCall.html), [*insert*](struct.RegionDiskInsertCall.html), [*list*](struct.RegionDiskListCall.html), [*resize*](struct.RegionDiskResizeCall.html), [*set labels*](struct.RegionDiskSetLabelCall.html) and [*test iam permissions*](struct.RegionDiskTestIamPermissionCall.html) //! * region instance group managers -//! * [*abandon instances*](struct.RegionInstanceGroupManagerAbandonInstanceCall.html), [*delete*](struct.RegionInstanceGroupManagerDeleteCall.html), [*delete instances*](struct.RegionInstanceGroupManagerDeleteInstanceCall.html), [*get*](struct.RegionInstanceGroupManagerGetCall.html), [*insert*](struct.RegionInstanceGroupManagerInsertCall.html), [*list*](struct.RegionInstanceGroupManagerListCall.html), [*list managed instances*](struct.RegionInstanceGroupManagerListManagedInstanceCall.html), [*recreate instances*](struct.RegionInstanceGroupManagerRecreateInstanceCall.html), [*resize*](struct.RegionInstanceGroupManagerResizeCall.html), [*set instance template*](struct.RegionInstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](struct.RegionInstanceGroupManagerSetTargetPoolCall.html) +//! * [*abandon instances*](struct.RegionInstanceGroupManagerAbandonInstanceCall.html), [*delete*](struct.RegionInstanceGroupManagerDeleteCall.html), [*delete instances*](struct.RegionInstanceGroupManagerDeleteInstanceCall.html), [*get*](struct.RegionInstanceGroupManagerGetCall.html), [*insert*](struct.RegionInstanceGroupManagerInsertCall.html), [*list*](struct.RegionInstanceGroupManagerListCall.html), [*list managed instances*](struct.RegionInstanceGroupManagerListManagedInstanceCall.html), [*patch*](struct.RegionInstanceGroupManagerPatchCall.html), [*recreate instances*](struct.RegionInstanceGroupManagerRecreateInstanceCall.html), [*resize*](struct.RegionInstanceGroupManagerResizeCall.html), [*set instance template*](struct.RegionInstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](struct.RegionInstanceGroupManagerSetTargetPoolCall.html) //! * region instance groups //! * [*get*](struct.RegionInstanceGroupGetCall.html), [*list*](struct.RegionInstanceGroupListCall.html), [*list instances*](struct.RegionInstanceGroupListInstanceCall.html) and [*set named ports*](struct.RegionInstanceGroupSetNamedPortCall.html) //! * region operations @@ -92,19 +94,19 @@ //! * [regions](struct.Region.html) //! * [*get*](struct.RegionGetCall.html) and [*list*](struct.RegionListCall.html) //! * [routers](struct.Router.html) -//! * [*aggregated list*](struct.RouterAggregatedListCall.html), [*delete*](struct.RouterDeleteCall.html), [*get*](struct.RouterGetCall.html), [*get router status*](struct.RouterGetRouterStatuCall.html), [*insert*](struct.RouterInsertCall.html), [*list*](struct.RouterListCall.html), [*patch*](struct.RouterPatchCall.html), [*preview*](struct.RouterPreviewCall.html) and [*update*](struct.RouterUpdateCall.html) +//! * [*aggregated list*](struct.RouterAggregatedListCall.html), [*delete*](struct.RouterDeleteCall.html), [*get*](struct.RouterGetCall.html), [*get nat mapping info*](struct.RouterGetNatMappingInfoCall.html), [*get router status*](struct.RouterGetRouterStatuCall.html), [*insert*](struct.RouterInsertCall.html), [*list*](struct.RouterListCall.html), [*patch*](struct.RouterPatchCall.html), [*preview*](struct.RouterPreviewCall.html) and [*update*](struct.RouterUpdateCall.html) //! * [routes](struct.Route.html) //! * [*delete*](struct.RouteDeleteCall.html), [*get*](struct.RouteGetCall.html), [*insert*](struct.RouteInsertCall.html) and [*list*](struct.RouteListCall.html) //! * [security policies](struct.SecurityPolicy.html) //! * [*add rule*](struct.SecurityPolicyAddRuleCall.html), [*delete*](struct.SecurityPolicyDeleteCall.html), [*get*](struct.SecurityPolicyGetCall.html), [*get rule*](struct.SecurityPolicyGetRuleCall.html), [*insert*](struct.SecurityPolicyInsertCall.html), [*list*](struct.SecurityPolicyListCall.html), [*patch*](struct.SecurityPolicyPatchCall.html), [*patch rule*](struct.SecurityPolicyPatchRuleCall.html) and [*remove rule*](struct.SecurityPolicyRemoveRuleCall.html) //! * [snapshots](struct.Snapshot.html) -//! * [*delete*](struct.SnapshotDeleteCall.html), [*get*](struct.SnapshotGetCall.html), [*list*](struct.SnapshotListCall.html) and [*set labels*](struct.SnapshotSetLabelCall.html) +//! * [*delete*](struct.SnapshotDeleteCall.html), [*get*](struct.SnapshotGetCall.html), [*get iam policy*](struct.SnapshotGetIamPolicyCall.html), [*list*](struct.SnapshotListCall.html), [*set iam policy*](struct.SnapshotSetIamPolicyCall.html), [*set labels*](struct.SnapshotSetLabelCall.html) and [*test iam permissions*](struct.SnapshotTestIamPermissionCall.html) //! * [ssl certificates](struct.SslCertificate.html) //! * [*delete*](struct.SslCertificateDeleteCall.html), [*get*](struct.SslCertificateGetCall.html), [*insert*](struct.SslCertificateInsertCall.html) and [*list*](struct.SslCertificateListCall.html) //! * [ssl policies](struct.SslPolicy.html) //! * [*delete*](struct.SslPolicyDeleteCall.html), [*get*](struct.SslPolicyGetCall.html), [*insert*](struct.SslPolicyInsertCall.html), [*list*](struct.SslPolicyListCall.html), [*list available features*](struct.SslPolicyListAvailableFeatureCall.html) and [*patch*](struct.SslPolicyPatchCall.html) //! * [subnetworks](struct.Subnetwork.html) -//! * [*aggregated list*](struct.SubnetworkAggregatedListCall.html), [*delete*](struct.SubnetworkDeleteCall.html), [*expand ip cidr range*](struct.SubnetworkExpandIpCidrRangeCall.html), [*get*](struct.SubnetworkGetCall.html), [*insert*](struct.SubnetworkInsertCall.html), [*list*](struct.SubnetworkListCall.html), [*list usable*](struct.SubnetworkListUsableCall.html), [*patch*](struct.SubnetworkPatchCall.html) and [*set private ip google access*](struct.SubnetworkSetPrivateIpGoogleAccesCall.html) +//! * [*aggregated list*](struct.SubnetworkAggregatedListCall.html), [*delete*](struct.SubnetworkDeleteCall.html), [*expand ip cidr range*](struct.SubnetworkExpandIpCidrRangeCall.html), [*get*](struct.SubnetworkGetCall.html), [*get iam policy*](struct.SubnetworkGetIamPolicyCall.html), [*insert*](struct.SubnetworkInsertCall.html), [*list*](struct.SubnetworkListCall.html), [*list usable*](struct.SubnetworkListUsableCall.html), [*patch*](struct.SubnetworkPatchCall.html), [*set iam policy*](struct.SubnetworkSetIamPolicyCall.html), [*set private ip google access*](struct.SubnetworkSetPrivateIpGoogleAccesCall.html) and [*test iam permissions*](struct.SubnetworkTestIamPermissionCall.html) //! * [target http proxies](struct.TargetHttpProxy.html) //! * [*delete*](struct.TargetHttpProxyDeleteCall.html), [*get*](struct.TargetHttpProxyGetCall.html), [*insert*](struct.TargetHttpProxyInsertCall.html), [*list*](struct.TargetHttpProxyListCall.html) and [*set url map*](struct.TargetHttpProxySetUrlMapCall.html) //! * [target https proxies](struct.TargetHttpsProxy.html) @@ -168,12 +170,14 @@ //! let r = hub.autoscalers().patch(...).doit() //! let r = hub.instance_group_managers().resize(...).doit() //! let r = hub.instance_templates().delete(...).doit() +//! let r = hub.region_instance_group_managers().patch(...).doit() //! let r = hub.region_backend_services().delete(...).doit() //! let r = hub.interconnects().delete(...).doit() +//! let r = hub.instances().update_shielded_instance_config(...).doit() //! let r = hub.firewalls().patch(...).doit() //! let r = hub.vpn_tunnels().delete(...).doit() //! let r = hub.region_disks().set_labels(...).doit() -//! let r = hub.instances().set_machine_type(...).doit() +//! let r = hub.backend_services().delete(...).doit() //! let r = hub.https_health_checks().delete(...).doit() //! let r = hub.node_groups().delete(...).doit() //! let r = hub.ssl_policies().delete(...).doit() @@ -205,10 +209,10 @@ //! let r = hub.instance_group_managers().set_instance_template(...).doit() //! let r = hub.node_groups().set_node_template(...).doit() //! let r = hub.region_autoscalers().delete(...).doit() +//! let r = hub.security_policies().insert(...).doit() //! let r = hub.networks().remove_peering(...).doit() //! let r = hub.ssl_policies().patch(...).doit() //! let r = hub.interconnect_attachments().delete(...).doit() -//! let r = hub.networks().delete(...).doit() //! let r = hub.target_pools().insert(...).doit() //! let r = hub.node_templates().insert(...).doit() //! let r = hub.projects().disable_xpn_resource(...).doit() @@ -223,13 +227,13 @@ //! let r = hub.target_pools().remove_health_check(...).doit() //! let r = hub.target_https_proxies().set_url_map(...).doit() //! let r = hub.region_disks().create_snapshot(...).doit() -//! let r = hub.backend_services().delete(...).doit() +//! let r = hub.instances().set_machine_type(...).doit() //! let r = hub.instances().update_network_interface(...).doit() //! let r = hub.url_maps().insert(...).doit() //! let r = hub.instances().add_access_config(...).doit() //! let r = hub.instances().set_machine_resources(...).doit() //! let r = hub.instances().update_access_config(...).doit() -//! let r = hub.security_policies().insert(...).doit() +//! let r = hub.networks().delete(...).doit() //! let r = hub.addresses().insert(...).doit() //! let r = hub.health_checks().insert(...).doit() //! let r = hub.global_forwarding_rules().insert(...).doit() @@ -267,6 +271,7 @@ //! let r = hub.instance_groups().add_instances(...).doit() //! let r = hub.instance_group_managers().abandon_instances(...).doit() //! let r = hub.instances().set_tags(...).doit() +//! let r = hub.network_endpoint_groups().attach_network_endpoints(...).doit() //! let r = hub.snapshots().delete(...).doit() //! let r = hub.target_https_proxies().insert(...).doit() //! let r = hub.node_groups().add_nodes(...).doit() @@ -274,6 +279,7 @@ //! let r = hub.backend_services().update(...).doit() //! let r = hub.node_groups().delete_nodes(...).doit() //! let r = hub.licenses().delete(...).doit() +//! let r = hub.instance_group_managers().patch(...).doit() //! let r = hub.subnetworks().patch(...).doit() //! let r = hub.target_https_proxies().set_ssl_policy(...).doit() //! let r = hub.instances().attach_disk(...).doit() @@ -285,6 +291,7 @@ //! let r = hub.licenses().insert(...).doit() //! let r = hub.backend_services().patch(...).doit() //! let r = hub.target_http_proxies().set_url_map(...).doit() +//! let r = hub.network_endpoint_groups().delete(...).doit() //! let r = hub.region_instance_group_managers().delete(...).doit() //! let r = hub.images().deprecate(...).doit() //! let r = hub.http_health_checks().patch(...).doit() @@ -312,6 +319,7 @@ //! let r = hub.instances().stop(...).doit() //! let r = hub.target_pools().add_instance(...).doit() //! let r = hub.target_pools().remove_instance(...).doit() +//! let r = hub.network_endpoint_groups().detach_network_endpoints(...).doit() //! let r = hub.target_pools().delete(...).doit() //! let r = hub.firewalls().update(...).doit() //! let r = hub.instances().insert(...).doit() @@ -336,6 +344,7 @@ //! let r = hub.backend_services().insert(...).doit() //! let r = hub.instances().set_labels(...).doit() //! let r = hub.region_backend_services().update(...).doit() +//! let r = hub.instances().set_shielded_instance_integrity_policy(...).doit() //! let r = hub.target_http_proxies().delete(...).doit() //! let r = hub.backend_buckets().patch(...).doit() //! let r = hub.global_addresses().delete(...).doit() @@ -361,6 +370,7 @@ //! let r = hub.instances().start_with_encryption_key(...).doit() //! let r = hub.instances().set_min_cpu_platform(...).doit() //! let r = hub.forwarding_rules().delete(...).doit() +//! let r = hub.network_endpoint_groups().insert(...).doit() //! let r = hub.backend_buckets().update(...).doit() //! let r = hub.region_instance_group_managers().insert(...).doit() //! let r = hub.firewalls().delete(...).doit() @@ -745,6 +755,9 @@ impl<'a, C, A> Compute pub fn machine_types(&'a self) -> MachineTypeMethods<'a, C, A> { MachineTypeMethods { hub: &self } } + pub fn network_endpoint_groups(&'a self) -> NetworkEndpointGroupMethods<'a, C, A> { + NetworkEndpointGroupMethods { hub: &self } + } pub fn networks(&'a self) -> NetworkMethods<'a, C, A> { NetworkMethods { hub: &self } } @@ -871,6 +884,60 @@ impl<'a, C, A> Compute // ############ // SCHEMAS ### // ########## +/// Represents a collection of network endpoints. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [detach network endpoints network endpoint groups](struct.NetworkEndpointGroupDetachNetworkEndpointCall.html) (none) +/// * [insert network endpoint groups](struct.NetworkEndpointGroupInsertCall.html) (request) +/// * [attach network endpoints network endpoint groups](struct.NetworkEndpointGroupAttachNetworkEndpointCall.html) (none) +/// * [aggregated list network endpoint groups](struct.NetworkEndpointGroupAggregatedListCall.html) (none) +/// * [delete network endpoint groups](struct.NetworkEndpointGroupDeleteCall.html) (none) +/// * [list network endpoints network endpoint groups](struct.NetworkEndpointGroupListNetworkEndpointCall.html) (none) +/// * [test iam permissions network endpoint groups](struct.NetworkEndpointGroupTestIamPermissionCall.html) (none) +/// * [list network endpoint groups](struct.NetworkEndpointGroupListCall.html) (none) +/// * [get network endpoint groups](struct.NetworkEndpointGroupGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroup { + /// [Output Only] Type of the resource. Always compute#networkEndpointGroup for network endpoint group. + pub kind: Option, + /// An optional description of this resource. Provide this property when you create the resource. + pub description: Option, + /// [Output Only] The URL of the zone where the network endpoint group is located. + pub zone: Option, + /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, + /// The default port used if the port number is not specified in the network endpoint. + #[serde(rename="defaultPort")] + pub default_port: Option, + /// Type of network endpoints in this network endpoint group. Currently the only supported value is GCE_VM_IP_PORT. + #[serde(rename="networkEndpointType")] + pub network_endpoint_type: Option, + /// The URL of the network to which all network endpoints in the NEG belong. Uses "default" project network if unspecified. + pub network: Option, + /// Optional URL of the subnetwork to which all network endpoints in the NEG belong. + pub subnetwork: Option, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for the resource. + #[serde(rename="selfLink")] + pub self_link: Option, + /// [Output only] Number of network endpoints in the network endpoint group. + pub size: Option, +} + +impl RequestValue for NetworkEndpointGroup {} +impl Resource for NetworkEndpointGroup {} +impl ResponseResult for NetworkEndpointGroup {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// @@ -899,7 +966,7 @@ impl Part for NodeTypeAggregatedListWarningData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupsSetNamedPortsRequest { - /// The fingerprint of the named ports information for this instance group. Use this optional property to prevent conflicts when multiple users change the named ports settings concurrently. Obtain the fingerprint with the instanceGroups.get method. Then, include the fingerprint in your request to ensure that you do not overwrite changes that were applied from another concurrent request. + /// The fingerprint of the named ports information for this instance group. Use this optional property to prevent conflicts when multiple users change the named ports settings concurrently. Obtain the fingerprint with the instanceGroups.get method. Then, include the fingerprint in your request to ensure that you do not overwrite changes that were applied from another concurrent request. A request with an incorrect fingerprint will fail with error 412 conditionNotMet. pub fingerprint: Option, /// The list of named ports to set for this instance group. #[serde(rename="namedPorts")] @@ -956,114 +1023,34 @@ pub struct UrlMapList { impl ResponseResult for UrlMapList {} -/// A BackendService resource. This resource defines a group of backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) (== resource_for beta.backendService ==) +/// Contains a list of BackendBucket resources. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get backend services](struct.BackendServiceGetCall.html) (response) -/// * [get health backend services](struct.BackendServiceGetHealthCall.html) (none) -/// * [insert backend services](struct.BackendServiceInsertCall.html) (request) -/// * [add signed url key backend services](struct.BackendServiceAddSignedUrlKeyCall.html) (none) -/// * [insert region backend services](struct.RegionBackendServiceInsertCall.html) (request) -/// * [list backend services](struct.BackendServiceListCall.html) (none) -/// * [update backend services](struct.BackendServiceUpdateCall.html) (request) -/// * [get region backend services](struct.RegionBackendServiceGetCall.html) (response) -/// * [aggregated list backend services](struct.BackendServiceAggregatedListCall.html) (none) -/// * [delete backend services](struct.BackendServiceDeleteCall.html) (none) -/// * [patch backend services](struct.BackendServicePatchCall.html) (request) -/// * [delete signed url key backend services](struct.BackendServiceDeleteSignedUrlKeyCall.html) (none) -/// * [patch region backend services](struct.RegionBackendServicePatchCall.html) (request) -/// * [update region backend services](struct.RegionBackendServiceUpdateCall.html) (request) -/// * [set security policy backend services](struct.BackendServiceSetSecurityPolicyCall.html) (none) +/// * [list backend buckets](struct.BackendBucketListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BackendService { - /// no description provided - #[serde(rename="connectionDraining")] - pub connection_draining: Option, - /// The protocol this BackendService uses to communicate with backends. - /// - /// Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. - /// - /// For internal load balancing, the possible values are TCP and UDP, and the default is TCP. - pub protocol: Option, - /// An optional description of this resource. Provide this property when you create the resource. - pub description: Option, - /// Cloud CDN configuration for this BackendService. - #[serde(rename="cdnPolicy")] - pub cdn_policy: Option, - /// Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot be used with the other. Possible values are INTERNAL and EXTERNAL. - #[serde(rename="loadBalancingScheme")] - pub load_balancing_scheme: Option, - /// [Output Only] The resource URL for the security policy associated with this backend service. - #[serde(rename="securityPolicy")] - pub security_policy: Option, - /// Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a BackendService. An up-to-date fingerprint must be provided in order to update the BackendService. - /// - /// To see the latest fingerprint, make a get() request to retrieve a BackendService. - pub fingerprint: Option, - /// Name of backend port. The same name should appear in the instance groups referenced by this service. Required when the load balancing scheme is EXTERNAL. - /// - /// When the load balancing scheme is INTERNAL, this field is not used. - #[serde(rename="portName")] - pub port_name: Option, - /// The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified, and a health check is required for Compute Engine backend services. A health check must not be specified for App Engine backend and Cloud Function backend. - /// - /// For internal load balancing, a URL to a HealthCheck resource must be specified instead. - #[serde(rename="healthChecks")] - pub health_checks: Option>, - /// Type of session affinity to use. The default is NONE. - /// - /// When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. - /// - /// When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, or CLIENT_IP_PORT_PROTO. - /// - /// When the protocol is UDP, this field is not used. - #[serde(rename="sessionAffinity")] - pub session_affinity: Option, - /// [Output Only] Creation timestamp in RFC3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. - pub id: Option, - /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, - /// [Output Only] Type of resource. Always compute#backendService for backend services. +pub struct BackendBucketList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Type of resource. pub kind: Option, - /// How many seconds to wait for the backend before considering it a failed request. Default is 30 seconds. - #[serde(rename="timeoutSec")] - pub timeout_sec: Option, - /// If true, enable Cloud CDN for this BackendService. - /// - /// When the load balancing scheme is INTERNAL, this field is not used. - #[serde(rename="enableCDN")] - pub enable_cdn: Option, - /// [Output Only] URL of the region where the regional backend service resides. This field is not applicable to global backend services. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. - pub region: Option, - /// Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set to 0, the cookie is non-persistent and lasts only until the end of the browser session (or equivalent). The maximum allowed value for TTL is one day. - /// - /// When the load balancing scheme is INTERNAL, this field is not used. - #[serde(rename="affinityCookieTtlSec")] - pub affinity_cookie_ttl_sec: Option, - /// Deprecated in favor of portName. The TCP port to connect on the backend. The default value is 80. - /// - /// This cannot be used for internal load balancing. - pub port: Option, - /// The list of backends that serve this BackendService. - pub backends: Option>, - /// no description provided - pub iap: Option, - /// [Output Only] Server-defined URL for the resource. + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of BackendBucket resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] pub self_link: Option, } -impl RequestValue for BackendService {} -impl Resource for BackendService {} -impl ResponseResult for BackendService {} +impl ResponseResult for BackendBucketList {} /// [Output Only] Informational warning message. @@ -1197,21 +1184,6 @@ pub struct SubnetworksSetPrivateIpGoogleAccessRequest { impl RequestValue for SubnetworksSetPrivateIpGoogleAccessRequest {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DisksScopedList { - /// [Output Only] A list of disks contained in this scope. - pub disks: Option>, - /// [Output Only] Informational warning which replaces the list of disks when the list is empty. - pub warning: Option, -} - -impl Part for DisksScopedList {} - - /// There is no detailed description. /// /// # Activities @@ -1345,6 +1317,25 @@ impl NestedType for TargetVpnGatewayListWarning {} impl Part for TargetVpnGatewayListWarning {} +/// [Output Only] Informational warning message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InstanceGroupAggregatedListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for InstanceGroupAggregatedListWarning {} +impl Part for InstanceGroupAggregatedListWarning {} + + /// A metadata key/value entry. /// /// # Activities @@ -1361,7 +1352,7 @@ pub struct Metadata { pub items: Option>, /// [Output Only] Type of the resource. Always compute#metadata for metadata. pub kind: Option, - /// Specifies a fingerprint for this request, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata. + /// Specifies a fingerprint for this request, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata, otherwise the request will fail with error 412 conditionNotMet. /// /// To see the latest fingerprint, make a get() request to retrieve the resource. pub fingerprint: Option, @@ -1489,38 +1480,48 @@ impl RequestValue for TargetHttpProxy {} impl ResponseResult for TargetHttpProxy {} -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InstanceAggregatedListWarningData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, +pub struct BackendServiceReference { + /// no description provided + #[serde(rename="backendService")] + pub backend_service: Option, } -impl NestedType for InstanceAggregatedListWarningData {} -impl Part for InstanceAggregatedListWarningData {} +impl Part for BackendServiceReference {} -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [aggregated list autoscalers](struct.AutoscalerAggregatedListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AutoscalerListWarningData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, +pub struct AutoscalerAggregatedList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] Type of resource. Always compute#autoscalerAggregatedList for aggregated lists of autoscalers. + pub kind: Option, + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of AutoscalersScopedList resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, } -impl NestedType for AutoscalerListWarningData {} -impl Part for AutoscalerListWarningData {} +impl ResponseResult for AutoscalerAggregatedList {} /// There is no detailed description. @@ -1529,7 +1530,7 @@ impl Part for AutoscalerListWarningData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetVpnGatewaysScopedList { - /// [Output Only] A list of target vpn gateways contained in this scope. + /// [Output Only] A list of target VPN gateways contained in this scope. #[serde(rename="targetVpnGateways")] pub target_vpn_gateways: Option>, /// [Output Only] Informational warning which replaces the list of addresses when the list is empty. @@ -1658,6 +1659,31 @@ impl NestedType for VpnTunnelAggregatedListWarning {} impl Part for VpnTunnelAggregatedListWarning {} +/// Increment a streamz counter with the specified metric and field names. +/// +/// Metric names should start with a '/', generally be lowercase-only, and end in "_count". Field names should not contain an initial slash. The actual exported metric names will have "/iam/policy" prepended. +/// +/// Field names correspond to IAM request parameters and field values are their respective values. +/// +/// Supported field names: - "authority", which is "[token]" if IAMContext.token is present, otherwise the value of IAMContext.authority_selector if present, and otherwise a representation of IAMContext.principal; or - "iam_principal", a representation of IAMContext.principal even if a token or authority selector is present; or - "" (empty string), resulting in a counter with no fields. +/// +/// Examples: counter { metric: "/debug_access_count" field: "iam_principal" } ==> increment counter /iam/policy/backend_debug_access_count {iam_principal=[value of IAMContext.principal]} +/// +/// At this time we do not support multiple field names (though this may be supported in the future). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogConfigCounterOptions { + /// The field value to attribute. + pub field: Option, + /// The metric to update. + pub metric: Option, +} + +impl Part for LogConfigCounterOptions {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// @@ -1711,23 +1737,21 @@ pub struct RegionDisksResizeRequest { impl RequestValue for RegionDisksResizeRequest {} -/// [Output Only] Informational warning message. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DiskListWarning { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, +pub struct TargetTcpProxyListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, } -impl NestedType for DiskListWarning {} -impl Part for DiskListWarning {} +impl NestedType for TargetTcpProxyListWarningData {} +impl Part for TargetTcpProxyListWarningData {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -1777,21 +1801,17 @@ pub struct AcceleratorTypeAggregatedList { impl ResponseResult for AcceleratorTypeAggregatedList {} -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// The available logging options for a firewall rule. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AcceleratorTypesScopedListWarningData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, +pub struct FirewallLogConfig { + /// This field denotes whether to enable logging for a particular firewall rule. + pub enable: Option, } -impl NestedType for AcceleratorTypesScopedListWarningData {} -impl Part for AcceleratorTypesScopedListWarningData {} +impl Part for FirewallLogConfig {} /// A matcher for the path portion of the URL. The BackendService from the longest-matched rule will serve the URL. If no rule was matched, the default service will be used. @@ -1800,13 +1820,19 @@ impl Part for AcceleratorTypesScopedListWarningData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PathMatcher { - /// The full or partial URL to the BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. For example, the following are all valid URLs to a BackendService resource: + /// The full or partial URL to the BackendService resource. This will be used if none of the pathRules or routeRules defined by this PathMatcher are matched. For example, the following are all valid URLs to a BackendService resource: /// - https://www.googleapis.com/compute/v1/projects/project/global/backendServices/backendService /// - compute/v1/projects/project/global/backendServices/backendService - /// - global/backendServices/backendService + /// - global/backendServices/backendService If defaultRouteAction is additionally specified, advanced routing actions like URL Rewrites, etc. take effect prior to sending the request to the backend. However, if defaultService is specified, defaultRouteAction cannot contain any weightedBackendServices. Conversely, if defaultRouteAction specifies any weightedBackendServices, defaultService must not be specified. + /// Only one of defaultService, defaultUrlRedirect or defaultRouteAction.weightedBackendService must be set. + /// Authorization requires one or more of the following Google IAM permissions on the specified resource default_service: + /// - compute.backendBuckets.use + /// - compute.backendServices.use #[serde(rename="defaultService")] pub default_service: Option, - /// The list of path rules. + /// The list of path rules. Use this list instead of routeRules when routing based on simple path matching is all that's required. The order by which path rules are specified does not matter. Matches are always done on the longest-path-first basis. + /// For example: a pathRule with a path /a/b/c/* will match before /a/b/* irrespective of the order in which those paths appear in this list. + /// Only one of pathRules or routeRules must be set. #[serde(rename="pathRules")] pub path_rules: Option>, /// An optional description of this resource. Provide this property when you create the resource. @@ -1831,6 +1857,22 @@ pub struct ManagedInstanceLastAttempt { impl Part for ManagedInstanceLastAttempt {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedInstanceVersion { + /// [Output Only] The intended template of the instance. This field is empty when current_action is one of { DELETING, ABANDONING }. + #[serde(rename="instanceTemplate")] + pub instance_template: Option, + /// [Output Only] Name of the version. + pub name: Option, +} + +impl Part for ManagedInstanceVersion {} + + /// Region resource. (== resource_for beta.regions ==) (== resource_for v1.regions ==) /// /// # Activities @@ -1907,6 +1949,8 @@ impl ResponseResult for NodeTemplateAggregatedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct HTTPHealthCheck { + /// The TCP port number for the health check request. The default value is 80. Valid values are 1 through 65535. + pub port: Option, /// The value of the host header in the HTTP health check request. If left empty (default value), the IP on behalf of which this health check is performed will be used. pub host: Option, /// The request path of the HTTP health check request. The default value is /. @@ -1918,8 +1962,23 @@ pub struct HTTPHealthCheck { /// Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. #[serde(rename="proxyHeader")] pub proxy_header: Option, - /// The TCP port number for the health check request. The default value is 80. Valid values are 1 through 65535. - pub port: Option, + /// Specifies how port is selected for health checking, can be one of following values: + /// USE_FIXED_PORT: The port number in + /// port + /// is used for health checking. + /// USE_NAMED_PORT: The + /// portName + /// is used for health checking. + /// USE_SERVING_PORT: For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. + /// + /// + /// If not specified, HTTP health check follows behavior specified in + /// port + /// and + /// portName + /// fields. + #[serde(rename="portSpecification")] + pub port_specification: Option, /// The string to match anywhere in the first 1024 bytes of the response body. If left empty (the default value), the status code determines health. The response data can only be ASCII. pub response: Option, } @@ -1944,23 +2003,23 @@ impl NestedType for RegionListWarningData {} impl Part for RegionListWarningData {} -/// [Output Only] Informational warning message. +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list network endpoints network endpoint groups](struct.NetworkEndpointGroupListNetworkEndpointCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LicensesListResponseWarning { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, +pub struct NetworkEndpointGroupsListEndpointsRequest { + /// Optional query parameter for showing the health status of each network endpoint. Valid options are SKIP or SHOW. If you don't specifiy this parameter, the health status of network endpoints will not be provided. + #[serde(rename="healthStatus")] + pub health_status: Option, } -impl NestedType for LicensesListResponseWarning {} -impl Part for LicensesListResponseWarning {} +impl RequestValue for NetworkEndpointGroupsListEndpointsRequest {} /// There is no detailed description. @@ -2034,75 +2093,6 @@ pub struct BackendServiceIAP { impl Part for BackendServiceIAP {} -/// A TargetPool resource. This resource defines a pool of instances, an associated HttpHealthCheck resource, and the fallback target pool. (== resource_for beta.targetPools ==) (== resource_for v1.targetPools ==) -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get health target pools](struct.TargetPoolGetHealthCall.html) (none) -/// * [add instance target pools](struct.TargetPoolAddInstanceCall.html) (none) -/// * [remove instance target pools](struct.TargetPoolRemoveInstanceCall.html) (none) -/// * [remove health check target pools](struct.TargetPoolRemoveHealthCheckCall.html) (none) -/// * [delete target pools](struct.TargetPoolDeleteCall.html) (none) -/// * [insert target pools](struct.TargetPoolInsertCall.html) (request) -/// * [aggregated list target pools](struct.TargetPoolAggregatedListCall.html) (none) -/// * [list target pools](struct.TargetPoolListCall.html) (none) -/// * [add health check target pools](struct.TargetPoolAddHealthCheckCall.html) (none) -/// * [get target pools](struct.TargetPoolGetCall.html) (response) -/// * [set backup target pools](struct.TargetPoolSetBackupCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetPool { - /// This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool (i.e., not as a backup pool to some other target pool). The value of the field must be in [0, 1]. - /// - /// If set, backupPool must also be set. They together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below this number, traffic arriving at the load-balanced IP will be directed to the backup pool. - /// - /// In case where failoverRatio is not set or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. - #[serde(rename="failoverRatio")] - pub failover_ratio: Option, - /// An optional description of this resource. Provide this property when you create the resource. - pub description: Option, - /// [Output Only] URL of the region where the target pool resides. - pub region: Option, - /// [Output Only] Type of the resource. Always compute#targetPool for target pools. - pub kind: Option, - /// Sesssion affinity option, must be one of the following values: - /// NONE: Connections from the same client IP may go to any instance in the pool. - /// CLIENT_IP: Connections from the same client IP will go to the same instance in the pool while that instance remains healthy. - /// CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol will go to the same instance in the pool while that instance remains healthy. - #[serde(rename="sessionAffinity")] - pub session_affinity: Option, - /// A list of resource URLs to the virtual machine instances serving this pool. They must live in zones contained in the same region as this pool. - pub instances: Option>, - /// This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool, and its failoverRatio field is properly set to a value between [0, 1]. - /// - /// backupPool and failoverRatio together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below failoverRatio, traffic arriving at the load-balanced IP will be directed to the backup pool. - /// - /// In case where failoverRatio and backupPool are not set, or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. - #[serde(rename="backupPool")] - pub backup_pool: Option, - /// The URL of the HttpHealthCheck resource. A member instance in this pool is considered healthy if and only if the health checks pass. An empty list means all member instances will be considered healthy at all times. Only HttpHealthChecks are supported. Only one health check may be specified. - #[serde(rename="healthChecks")] - pub health_checks: Option>, - /// [Output Only] Creation timestamp in RFC3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. - pub id: Option, - /// [Output Only] Server-defined URL for the resource. - #[serde(rename="selfLink")] - pub self_link: Option, - /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, -} - -impl RequestValue for TargetPool {} -impl Resource for TargetPool {} -impl ResponseResult for TargetPool {} - - /// An Instance Group Manager resource. (== resource_for beta.instanceGroupManagers ==) (== resource_for v1.instanceGroupManagers ==) (== resource_for beta.regionInstanceGroupManagers ==) (== resource_for v1.regionInstanceGroupManagers ==) /// /// # Activities @@ -2115,20 +2105,27 @@ impl ResponseResult for TargetPool {} /// * [aggregated list instance group managers](struct.InstanceGroupManagerAggregatedListCall.html) (none) /// * [get region instance group managers](struct.RegionInstanceGroupManagerGetCall.html) (response) /// * [delete instances instance group managers](struct.InstanceGroupManagerDeleteInstanceCall.html) (none) +/// * [list instance group managers](struct.InstanceGroupManagerListCall.html) (none) /// * [delete instance group managers](struct.InstanceGroupManagerDeleteCall.html) (none) /// * [abandon instances instance group managers](struct.InstanceGroupManagerAbandonInstanceCall.html) (none) /// * [get instance group managers](struct.InstanceGroupManagerGetCall.html) (response) /// * [set instance template instance group managers](struct.InstanceGroupManagerSetInstanceTemplateCall.html) (none) -/// * [list instance group managers](struct.InstanceGroupManagerListCall.html) (none) +/// * [insert region instance group managers](struct.RegionInstanceGroupManagerInsertCall.html) (request) /// * [insert instance group managers](struct.InstanceGroupManagerInsertCall.html) (request) /// * [set target pools instance group managers](struct.InstanceGroupManagerSetTargetPoolCall.html) (none) -/// * [insert region instance group managers](struct.RegionInstanceGroupManagerInsertCall.html) (request) +/// * [patch instance group managers](struct.InstanceGroupManagerPatchCall.html) (request) +/// * [patch region instance group managers](struct.RegionInstanceGroupManagerPatchCall.html) (request) /// * [recreate instances instance group managers](struct.InstanceGroupManagerRecreateInstanceCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupManager { + /// [Output Only] The status of this managed instance group. + pub status: Option, /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, + /// The autohealing policy for this managed instance group. You can specify only one value. + #[serde(rename="autoHealingPolicies")] + pub auto_healing_policies: Option>, /// [Output Only] The URL of the Instance Group resource. #[serde(rename="instanceGroup")] pub instance_group: Option, @@ -2138,7 +2135,7 @@ pub struct InstanceGroupManager { /// The URL of the instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. #[serde(rename="instanceTemplate")] pub instance_template: Option, - /// Fingerprint of this resource. This field may be used in optimistic locking. It will be ignored when inserting an InstanceGroupManager. An up-to-date fingerprint must be provided in order to update the InstanceGroupManager. + /// Fingerprint of this resource. This field may be used in optimistic locking. It will be ignored when inserting an InstanceGroupManager. An up-to-date fingerprint must be provided in order to update the InstanceGroupManager, otherwise the request will fail with error 412 conditionNotMet. /// /// To see the latest fingerprint, make a get() request to retrieve an InstanceGroupManager. pub fingerprint: Option, @@ -2154,6 +2151,10 @@ pub struct InstanceGroupManager { pub name: Option, /// [Output Only] The URL of the zone where the managed instance group is located (for zonal resources). pub zone: Option, + /// Specifies the instance templates used by this managed instance group to create instances. + /// + /// Each version is defined by an instanceTemplate. Every template can appear at most once per instance group. This field overrides the top-level instanceTemplate field. Read more about the relationships between these fields. Exactly one version must leave the targetSize field unset. That version will be applied to all remaining instances. For more information, read about canary updates. + pub versions: Option>, /// [Output Only] The URL of the region where the managed instance group resides (for regional resources). pub region: Option, /// Policy specifying intended distribution of instances in regional managed instance group. @@ -2164,6 +2165,9 @@ pub struct InstanceGroupManager { /// The base instance name to use for instances in this group. The value must be 1-58 characters long. Instances are named by appending a hyphen and a random four-character string to the base instance name. The base instance name must comply with RFC1035. #[serde(rename="baseInstanceName")] pub base_instance_name: Option, + /// The update policy for this managed instance group. + #[serde(rename="updatePolicy")] + pub update_policy: Option, /// The URLs for all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group. #[serde(rename="targetPools")] pub target_pools: Option>, @@ -2180,6 +2184,29 @@ impl Resource for InstanceGroupManager {} impl ResponseResult for InstanceGroupManager {} +/// Contain information of Nat mapping for an interface of this endpoint. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VmEndpointNatMappingsInterfaceNatMappings { + /// Primary IP of the VM for this NIC. + #[serde(rename="sourceVirtualIp")] + pub source_virtual_ip: Option, + /// Total number of ports across all NAT IPs allocated to this interface. It equals to the aggregated port number in the field nat_ip_port_ranges. + #[serde(rename="numTotalNatPorts")] + pub num_total_nat_ports: Option, + /// A list of all IP:port-range mappings assigned to this interface. These ranges are inclusive, that is, both the first and the last ports can be used for NAT. Example: ["2.2.2.2:12345-12355", "1.1.1.1:2234-2234"]. + #[serde(rename="natIpPortRanges")] + pub nat_ip_port_ranges: Option>, + /// Alias IP range for this interface endpoint. It will be a private (RFC 1918) IP range. Examples: "10.33.4.55/32", or "192.168.5.0/24". + #[serde(rename="sourceAliasIpRange")] + pub source_alias_ip_range: Option, +} + +impl Part for VmEndpointNatMappingsInterfaceNatMappings {} + + /// Contains a list of machine types. /// /// # Activities @@ -2317,26 +2344,26 @@ pub struct SslPoliciesList { impl ResponseResult for SslPoliciesList {} -/// Contains a list of firewalls. +/// There is no detailed description. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list firewalls](struct.FirewallListCall.html) (response) +/// * [aggregated list target vpn gateways](struct.TargetVpnGatewayAggregatedListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct FirewallList { +pub struct TargetVpnGatewayAggregatedList { /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// [Output Only] Type of resource. Always compute#firewallList for lists of firewalls. + /// [Output Only] Type of resource. Always compute#targetVpnGateway for target VPN gateways. pub kind: Option, /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of Firewall resources. - pub items: Option>, + pub warning: Option, + /// A list of TargetVpnGateway resources. + pub items: Option>, /// [Output Only] Unique identifier for the resource; defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. @@ -2344,7 +2371,7 @@ pub struct FirewallList { pub self_link: Option, } -impl ResponseResult for FirewallList {} +impl ResponseResult for TargetVpnGatewayAggregatedList {} /// Represents a reference to a resource. @@ -2401,6 +2428,39 @@ pub struct NodeGroupsScopedList { impl Part for NodeGroupsScopedList {} +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. NOTE: an unsatisfied condition will not allow user access via current binding. Different bindings, including their conditions, are examined independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` . + /// + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. + /// + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. + pub members: Option>, +} + +impl Part for Binding {} + + /// There is no detailed description. /// /// # Activities @@ -2420,49 +2480,18 @@ pub struct SecurityPolicyReference { impl RequestValue for SecurityPolicyReference {} -/// An Instance Template resource. (== resource_for beta.instanceTemplates ==) (== resource_for v1.instanceTemplates ==) +/// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list instance templates](struct.InstanceTemplateListCall.html) (none) -/// * [delete instance templates](struct.InstanceTemplateDeleteCall.html) (none) -/// * [insert instance templates](struct.InstanceTemplateInsertCall.html) (request) -/// * [get instance templates](struct.InstanceTemplateGetCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InstanceTemplate { - /// [Output Only] The resource type, which is always compute#instanceTemplate for instance templates. - pub kind: Option, - /// The source instance params to use to create this instance template. - #[serde(rename="sourceInstanceParams")] - pub source_instance_params: Option, - /// An optional description of this resource. Provide this property when you create the resource. - pub description: Option, - /// The instance properties for this instance template. - pub properties: Option, - /// The source instance used to create the template. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - /// - https://www.googleapis.com/compute/v1/projects/project/zones/zone/instances/instance - /// - projects/project/zones/zone/instances/instance - #[serde(rename="sourceInstance")] - pub source_instance: Option, - /// [Output Only] The creation timestamp for this instance template in RFC3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// [Output Only] A unique identifier for this instance template. The server defines this identifier. - pub id: Option, - /// [Output Only] The URL for this instance template. The server defines this URL. - #[serde(rename="selfLink")] - pub self_link: Option, - /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, +pub struct InstanceGroupManagerStatus { + /// [Output Only] A bit indicating whether the managed instance group is in a stable state. A stable state means that: none of the instances in the managed instance group is currently undergoing any type of change (for example, creation, restart, or deletion); no future changes are scheduled for instances in the managed instance group; and the managed instance group itself is not being modified. + #[serde(rename="isStable")] + pub is_stable: Option, } -impl RequestValue for InstanceTemplate {} -impl Resource for InstanceTemplate {} -impl ResponseResult for InstanceTemplate {} +impl Part for InstanceGroupManagerStatus {} /// Informational warning which replaces the list of backend services when the list is empty. @@ -2501,44 +2530,34 @@ impl NestedType for TargetInstanceListWarningData {} impl Part for TargetInstanceListWarningData {} -/// An Accelerator Type resource. (== resource_for beta.acceleratorTypes ==) (== resource_for v1.acceleratorTypes ==) +/// Contains a list of Route resources. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list accelerator types](struct.AcceleratorTypeListCall.html) (none) -/// * [get accelerator types](struct.AcceleratorTypeGetCall.html) (response) -/// * [aggregated list accelerator types](struct.AcceleratorTypeAggregatedListCall.html) (none) +/// * [list routes](struct.RouteListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AcceleratorType { - /// [Output Only] The type of the resource. Always compute#acceleratorType for accelerator types. +pub struct RouteList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Type of resource. pub kind: Option, - /// [Output Only] An optional textual description of the resource. - pub description: Option, - /// [Output Only] The name of the zone where the accelerator type resides, such as us-central1-a. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. - pub zone: Option, - /// [Output Only] The deprecation status associated with this accelerator type. - pub deprecated: Option, - /// [Output Only] Maximum accelerator cards allowed per instance. - #[serde(rename="maximumCardsPerInstance")] - pub maximum_cards_per_instance: Option, - /// [Output Only] Creation timestamp in RFC3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of Route resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. pub id: Option, - /// [Output Only] Server-defined fully-qualified URL for this resource. + /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] pub self_link: Option, - /// [Output Only] Name of the resource. - pub name: Option, } -impl Resource for AcceleratorType {} -impl ResponseResult for AcceleratorType {} +impl ResponseResult for RouteList {} /// There is no detailed description. @@ -2605,6 +2624,8 @@ impl Part for ForwardingRuleListWarning {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InterconnectLocation { + /// [Output Only] The status of this InterconnectLocation. If the status is AVAILABLE, new Interconnects may be provisioned in this InterconnectLocation. Otherwise, no new Interconnects may be provisioned. + pub status: Option, /// [Output Only] Metropolitan area designator that indicates which city an interconnect is located. For example: "Chicago, IL", "Amsterdam, Netherlands". pub city: Option, /// [Output Only] Type of the resource. Always compute#interconnectLocation for interconnect locations. @@ -2646,64 +2667,38 @@ impl Resource for InterconnectLocation {} impl ResponseResult for InterconnectLocation {} -/// InstanceGroups (== resource_for beta.instanceGroups ==) (== resource_for v1.instanceGroups ==) (== resource_for beta.regionInstanceGroups ==) (== resource_for v1.regionInstanceGroups ==) +/// The named port. For example: . /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list instances instance groups](struct.InstanceGroupListInstanceCall.html) (none) -/// * [insert instance groups](struct.InstanceGroupInsertCall.html) (request) -/// * [delete instance groups](struct.InstanceGroupDeleteCall.html) (none) -/// * [get instance groups](struct.InstanceGroupGetCall.html) (response) -/// * [add instances instance groups](struct.InstanceGroupAddInstanceCall.html) (none) -/// * [set named ports instance groups](struct.InstanceGroupSetNamedPortCall.html) (none) -/// * [list instance groups](struct.InstanceGroupListCall.html) (none) -/// * [get region instance groups](struct.RegionInstanceGroupGetCall.html) (response) -/// * [aggregated list instance groups](struct.InstanceGroupAggregatedListCall.html) (none) -/// * [remove instances instance groups](struct.InstanceGroupRemoveInstanceCall.html) (none) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InstanceGroup { - /// [Output Only] The resource type, which is always compute#instanceGroup for instance groups. - pub kind: Option, - /// The URL of the network to which all instances in the instance group belong. - pub network: Option, - /// [Output Only] The URL of the zone where the instance group is located (for zonal resources). - pub zone: Option, - /// [Output Only] The URL of the region where the instance group is located (for regional resources). - pub region: Option, - /// An optional description of this resource. Provide this property when you create the resource. - pub description: Option, - /// The name of the instance group. The name must be 1-63 characters long, and comply with RFC1035. +pub struct NamedPort { + /// The name for this named port. The name must be 1-63 characters long, and comply with RFC1035. pub name: Option, - /// [Output Only] The fingerprint of the named ports. The system uses this fingerprint to detect conflicts when multiple users change the named ports concurrently. - pub fingerprint: Option, - /// [Output Only] The URL of the subnetwork to which all instances in the instance group belong. - pub subnetwork: Option, - /// Assigns a name to a port number. For example: {name: "http", port: 80} - /// - /// This allows the system to reference ports by the assigned name instead of a port number. Named ports can also contain multiple ports. For example: [{name: "http", port: 80},{name: "http", port: 8080}] - /// - /// Named ports apply to all instances in this instance group. - #[serde(rename="namedPorts")] - pub named_ports: Option>, - /// [Output Only] The creation timestamp for this instance group in RFC3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// [Output Only] A unique identifier for this instance group, generated by the server. - pub id: Option, - /// [Output Only] The URL for this instance group. The server generates this URL. - #[serde(rename="selfLink")] - pub self_link: Option, - /// [Output Only] The total number of instances in the instance group. - pub size: Option, + /// The port number, which can be a value between 1 and 65535. + pub port: Option, } -impl RequestValue for InstanceGroup {} -impl Resource for InstanceGroup {} -impl ResponseResult for InstanceGroup {} +impl Part for NamedPort {} + + +/// [Output Only] Informational warning message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DiskListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for DiskListWarning {} +impl Part for DiskListWarning {} /// [Output Only] Informational warning message. @@ -2744,6 +2739,24 @@ impl NestedType for SubnetworkListWarning {} impl Part for SubnetworkListWarning {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get health target pools](struct.TargetPoolGetHealthCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InstanceReference { + /// The URL for a specific instance. + pub instance: Option, +} + +impl RequestValue for InstanceReference {} + + /// Contains a list of routers. /// /// # Activities @@ -2774,21 +2787,42 @@ pub struct RouterAggregatedList { impl ResponseResult for RouterAggregatedList {} -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// A Shielded Instance Identity Entry. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NodeGroupAggregatedListWarningData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, +pub struct ShieldedInstanceIdentityEntry { + /// A PEM-encoded X.509 certificate. This field can be empty. + #[serde(rename="ekCert")] + pub ek_cert: Option, + /// A PEM-encoded public key. + #[serde(rename="ekPub")] + pub ek_pub: Option, } -impl NestedType for NodeGroupAggregatedListWarningData {} -impl Part for NodeGroupAggregatedListWarningData {} +impl Part for ShieldedInstanceIdentityEntry {} + + +/// A condition to be met. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Condition { + /// Trusted attributes supplied by the IAM system. + pub iam: Option, + /// Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. + pub sys: Option, + /// The objects of the condition. + pub values: Option>, + /// Trusted attributes discharged by the service. + pub svc: Option, + /// An operator to apply the subject with. + pub op: Option, +} + +impl Part for Condition {} /// There is no detailed description. @@ -2810,23 +2844,22 @@ pub struct RegionInstanceGroupManagersListInstancesResponse { impl ResponseResult for RegionInstanceGroupManagersListInstancesResponse {} -/// Represents a customer-supplied encryption key +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete instances region instance group managers](struct.RegionInstanceGroupManagerDeleteInstanceCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CustomerEncryptionKey { - /// Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. - #[serde(rename="rawKey")] - pub raw_key: Option, - /// [Output only] The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. - pub sha256: Option, - /// The name of the encryption key that is stored in Google Cloud KMS. - #[serde(rename="kmsKeyName")] - pub kms_key_name: Option, +pub struct RegionInstanceGroupManagersDeleteInstancesRequest { + /// The URLs of one or more instances to delete. This can be a full URL or a partial URL, such as zones/[ZONE]/instances/[INSTANCE_NAME]. + pub instances: Option>, } -impl Part for CustomerEncryptionKey {} +impl RequestValue for RegionInstanceGroupManagersDeleteInstancesRequest {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -2846,60 +2879,44 @@ impl NestedType for XpnHostListWarningData {} impl Part for XpnHostListWarningData {} -/// An HttpHealthCheck resource. This resource defines a template for how individual instances should be checked for health, via HTTP. +/// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [insert http health checks](struct.HttpHealthCheckInsertCall.html) (request) -/// * [update http health checks](struct.HttpHealthCheckUpdateCall.html) (request) -/// * [get http health checks](struct.HttpHealthCheckGetCall.html) (response) -/// * [patch http health checks](struct.HttpHealthCheckPatchCall.html) (request) -/// * [list http health checks](struct.HttpHealthCheckListCall.html) (none) -/// * [delete http health checks](struct.HttpHealthCheckDeleteCall.html) (none) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct HttpHealthCheck { - /// [Output Only] Type of the resource. Always compute#httpHealthCheck for HTTP health checks. - pub kind: Option, - /// An optional description of this resource. Provide this property when you create the resource. - pub description: Option, - /// How long (in seconds) to wait before claiming failure. The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. - #[serde(rename="timeoutSec")] - pub timeout_sec: Option, - /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, - /// How often (in seconds) to send a health check. The default value is 5 seconds. - #[serde(rename="checkIntervalSec")] - pub check_interval_sec: Option, - /// A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. - #[serde(rename="unhealthyThreshold")] - pub unhealthy_threshold: Option, - /// A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. - #[serde(rename="healthyThreshold")] - pub healthy_threshold: Option, - /// The value of the host header in the HTTP health check request. If left empty (default value), the public IP on behalf of which this health check is performed will be used. - pub host: Option, - /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. - pub id: Option, - /// [Output Only] Creation timestamp in RFC3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// The TCP port number for the HTTP health check request. The default value is 80. +pub struct TCPHealthCheck { + /// The TCP port number for the health check request. The default value is 80. Valid values are 1 through 65535. pub port: Option, - /// [Output Only] Server-defined URL for the resource. - #[serde(rename="selfLink")] - pub self_link: Option, - /// The request path of the HTTP health check request. The default value is /. - #[serde(rename="requestPath")] - pub request_path: Option, + /// Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. + #[serde(rename="portName")] + pub port_name: Option, + /// Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. + #[serde(rename="proxyHeader")] + pub proxy_header: Option, + /// The application data to send once the TCP connection has been established (default value is empty). If both request and response are empty, the connection establishment alone will indicate health. The request data can only be ASCII. + pub request: Option, + /// Specifies how port is selected for health checking, can be one of following values: + /// USE_FIXED_PORT: The port number in + /// port + /// is used for health checking. + /// USE_NAMED_PORT: The + /// portName + /// is used for health checking. + /// USE_SERVING_PORT: For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. + /// + /// + /// If not specified, TCP health check follows behavior specified in + /// port + /// and + /// portName + /// fields. + #[serde(rename="portSpecification")] + pub port_specification: Option, + /// The bytes to match against the beginning of the response data. If left empty (the default value), any response will indicate health. The response data can only be ASCII. + pub response: Option, } -impl RequestValue for HttpHealthCheck {} -impl Resource for HttpHealthCheck {} -impl ResponseResult for HttpHealthCheck {} +impl Part for TCPHealthCheck {} /// There is no detailed description. @@ -2913,7 +2930,10 @@ impl ResponseResult for HttpHealthCheck {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct NetworksAddPeeringRequest { - /// Whether Google Compute Engine manages the routes automatically. + /// Network peering parameters. In order to specify route policies for peering using import/export custom routes, you will have to fill all peering related parameters (name, peer network, exchange_subnet_routes) in network_peeringfield. Corresponding fields in NetworksAddPeeringRequest will be deprecated soon. + #[serde(rename="networkPeering")] + pub network_peering: Option, + /// This field will be deprecated soon. Prefer using exchange_subnet_routes in network_peering instead. Whether Google Compute Engine manages the routes automatically. #[serde(rename="autoCreateRoutes")] pub auto_create_routes: Option, /// URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network. @@ -2926,20 +2946,34 @@ pub struct NetworksAddPeeringRequest { impl RequestValue for NetworksAddPeeringRequest {} -/// There is no detailed description. +/// A list of instance templates. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list instance templates](struct.InstanceTemplateListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CustomerEncryptionKeyProtectedDisk { - /// Decrypts data associated with the disk with a customer-supplied encryption key. - #[serde(rename="diskEncryptionKey")] - pub disk_encryption_key: Option, - /// Specifies a valid partial or full URL to an existing Persistent Disk resource. This field is only applicable for persistent disks. - pub source: Option, +pub struct InstanceTemplateList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] The resource type, which is always compute#instanceTemplatesListResponse for instance template lists. + pub kind: Option, + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of InstanceTemplate resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, } -impl Part for CustomerEncryptionKeyProtectedDisk {} +impl ResponseResult for InstanceTemplateList {} /// Contains a list of TargetTcpProxy resources. @@ -3040,23 +3074,22 @@ impl NestedType for InstanceGroupListWarningData {} impl Part for InstanceGroupListWarningData {} -/// [Output Only] Informational warning which replaces the list of operations when the list is empty. +/// Response for the InterconnectsGetDiagnosticsRequest. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get diagnostics interconnects](struct.InterconnectGetDiagnosticCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationsScopedListWarning { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, +pub struct InterconnectsGetDiagnosticsResponse { + /// no description provided + pub result: Option, } -impl NestedType for OperationsScopedListWarning {} -impl Part for OperationsScopedListWarning {} +impl ResponseResult for InterconnectsGetDiagnosticsResponse {} /// There is no detailed description. @@ -3096,6 +3129,54 @@ pub struct SchedulingNodeAffinity { impl Part for SchedulingNodeAffinity {} +/// An Instance Template resource. (== resource_for beta.instanceTemplates ==) (== resource_for v1.instanceTemplates ==) +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list instance templates](struct.InstanceTemplateListCall.html) (none) +/// * [delete instance templates](struct.InstanceTemplateDeleteCall.html) (none) +/// * [insert instance templates](struct.InstanceTemplateInsertCall.html) (request) +/// * [get instance templates](struct.InstanceTemplateGetCall.html) (response) +/// * [test iam permissions instance templates](struct.InstanceTemplateTestIamPermissionCall.html) (none) +/// * [get iam policy instance templates](struct.InstanceTemplateGetIamPolicyCall.html) (none) +/// * [set iam policy instance templates](struct.InstanceTemplateSetIamPolicyCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InstanceTemplate { + /// [Output Only] The resource type, which is always compute#instanceTemplate for instance templates. + pub kind: Option, + /// The source instance params to use to create this instance template. + #[serde(rename="sourceInstanceParams")] + pub source_instance_params: Option, + /// An optional description of this resource. Provide this property when you create the resource. + pub description: Option, + /// The instance properties for this instance template. + pub properties: Option, + /// The source instance used to create the template. You can provide this as a partial or full URL to the resource. For example, the following are valid values: + /// - https://www.googleapis.com/compute/v1/projects/project/zones/zone/instances/instance + /// - projects/project/zones/zone/instances/instance + #[serde(rename="sourceInstance")] + pub source_instance: Option, + /// [Output Only] The creation timestamp for this instance template in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] A unique identifier for this instance template. The server defines this identifier. + pub id: Option, + /// [Output Only] The URL for this instance template. The server defines this URL. + #[serde(rename="selfLink")] + pub self_link: Option, + /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, +} + +impl RequestValue for InstanceTemplate {} +impl Resource for InstanceTemplate {} +impl ResponseResult for InstanceTemplate {} + + /// There is no detailed description. /// /// # Activities @@ -3206,21 +3287,25 @@ impl NestedType for TargetInstanceListWarning {} impl Part for TargetInstanceListWarning {} -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// Encapsulates numeric value that can be either absolute or relative. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetTcpProxyListWarningData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, +pub struct FixedOrPercent { + /// [Output Only] Absolute value of VM instances calculated based on the specific mode. + /// + /// + /// - If the value is fixed, then the caculated value is equal to the fixed value. + /// - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded up. + pub calculated: Option, + /// Specifies a fixed number of VM instances. This must be a positive integer. + pub fixed: Option, + /// Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%. + pub percent: Option, } -impl NestedType for TargetTcpProxyListWarningData {} -impl Part for TargetTcpProxyListWarningData {} +impl Part for FixedOrPercent {} /// There is no detailed description. @@ -3246,18 +3331,23 @@ impl RequestValue for InstanceGroupManagersSetTargetPoolsRequest {} /// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set target pools region instance group managers](struct.RegionInstanceGroupManagerSetTargetPoolCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BackendServicesScopedList { - /// Informational warning which replaces the list of backend services when the list is empty. - pub warning: Option, - /// A list of BackendServices contained in this scope. - #[serde(rename="backendServices")] - pub backend_services: Option>, +pub struct RegionInstanceGroupManagersSetTargetPoolsRequest { + /// Fingerprint of the target pools information, which is a hash of the contents. This field is used for optimistic locking when you update the target pool entries. This field is optional. + pub fingerprint: Option, + /// The URL of all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group. + #[serde(rename="targetPools")] + pub target_pools: Option>, } -impl Part for BackendServicesScopedList {} +impl RequestValue for RegionInstanceGroupManagersSetTargetPoolsRequest {} /// [Output Only] Informational warning message. @@ -3279,7 +3369,26 @@ impl NestedType for TargetSslProxyListWarning {} impl Part for TargetSslProxyListWarning {} -/// A NodeGroup resource. +/// The list of ALLOW rules specified by this firewall. Each rule specifies a protocol and port-range tuple that describes a permitted connection. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FirewallAllowed { + /// The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp), or the IP protocol number. + #[serde(rename="IPProtocol")] + pub ip_protocol: Option, + /// An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. + /// + /// Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. + pub ports: Option>, +} + +impl NestedType for FirewallAllowed {} +impl Part for FirewallAllowed {} + + +/// A NodeGroup resource. (== resource_for beta.nodeGroups ==) (== resource_for v1.nodeGroups ==) /// /// # Activities /// @@ -3288,13 +3397,16 @@ impl Part for TargetSslProxyListWarning {} /// /// * [aggregated list node groups](struct.NodeGroupAggregatedListCall.html) (none) /// * [delete node groups](struct.NodeGroupDeleteCall.html) (none) +/// * [test iam permissions node groups](struct.NodeGroupTestIamPermissionCall.html) (none) /// * [insert node groups](struct.NodeGroupInsertCall.html) (request) /// * [delete nodes node groups](struct.NodeGroupDeleteNodeCall.html) (none) +/// * [get iam policy node groups](struct.NodeGroupGetIamPolicyCall.html) (none) /// * [set node template node groups](struct.NodeGroupSetNodeTemplateCall.html) (none) /// * [get node groups](struct.NodeGroupGetCall.html) (response) /// * [list node groups](struct.NodeGroupListCall.html) (none) /// * [list nodes node groups](struct.NodeGroupListNodeCall.html) (none) /// * [add nodes node groups](struct.NodeGroupAddNodeCall.html) (none) +/// * [set iam policy node groups](struct.NodeGroupSetIamPolicyCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct NodeGroup { @@ -3388,22 +3500,6 @@ pub struct ZoneList { impl ResponseResult for ZoneList {} -/// Represents a match condition that incoming traffic is evaluated against. Exactly one field must be specified. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SecurityPolicyRuleMatcher { - /// The configuration options available when specifying versioned_expr. This field must be specified if versioned_expr is specified and cannot be specified if versioned_expr is not specified. - pub config: Option, - /// Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. - #[serde(rename="versionedExpr")] - pub versioned_expr: Option, -} - -impl Part for SecurityPolicyRuleMatcher {} - - /// There is no detailed description. /// /// # Activities @@ -3411,15 +3507,48 @@ impl Part for SecurityPolicyRuleMatcher {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get health target pools](struct.TargetPoolGetHealthCall.html) (request) +/// * [aggregated list machine types](struct.MachineTypeAggregatedListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InstanceReference { - /// The URL for a specific instance. - pub instance: Option, +pub struct MachineTypeAggregatedList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] Type of resource. Always compute#machineTypeAggregatedList for aggregated lists of machine types. + pub kind: Option, + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of MachineTypesScopedList resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, } -impl RequestValue for InstanceReference {} +impl ResponseResult for MachineTypeAggregatedList {} + + +/// Provides the configuration for logging a type of permissions. Example: +/// +/// { "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:foo@gmail.com" ] }, { "log_type": "DATA_WRITE", } ] } +/// +/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting foo@gmail.com from DATA_READ logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditLogConfig { + /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of [Binding.members][]. + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The log type that this config enables. + #[serde(rename="logType")] + pub log_type: Option, +} + +impl Part for AuditLogConfig {} /// Contains a list of TargetInstance resources. @@ -3470,23 +3599,41 @@ pub struct SslPoliciesListAvailableFeaturesResponse { impl ResponseResult for SslPoliciesListAvailableFeaturesResponse {} -/// [Output Only] Informational warning message. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InstanceGroupAggregatedListWarning { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, +pub struct NodeGroupAggregatedListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, } -impl NestedType for InstanceGroupAggregatedListWarning {} -impl Part for InstanceGroupAggregatedListWarning {} +impl NestedType for NodeGroupAggregatedListWarningData {} +impl Part for NodeGroupAggregatedListWarningData {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set target forwarding rules](struct.ForwardingRuleSetTargetCall.html) (request) +/// * [set backup target pools](struct.TargetPoolSetBackupCall.html) (request) +/// * [set target global forwarding rules](struct.GlobalForwardingRuleSetTargetCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetReference { + /// no description provided + pub target: Option, +} + +impl RequestValue for TargetReference {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -3506,6 +3653,23 @@ impl NestedType for CommitmentAggregatedListWarningData {} impl Part for CommitmentAggregatedListWarningData {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VmEndpointNatMappingsListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for VmEndpointNatMappingsListWarningData {} +impl Part for VmEndpointNatMappingsListWarningData {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -3680,6 +3844,22 @@ impl NestedType for OperationWarnings {} impl Part for OperationWarnings {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointWithHealthStatus { + /// [Output only] The health status of network endpoint; + pub healths: Option>, + /// [Output only] The network endpoint; + #[serde(rename="networkEndpoint")] + pub network_endpoint: Option, +} + +impl Part for NetworkEndpointWithHealthStatus {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -3751,6 +3931,27 @@ impl NestedType for ForwardingRuleAggregatedListWarningData {} impl Part for ForwardingRuleAggregatedListWarningData {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InstanceGroupManagerVersion { + /// Specifies the intended number of instances to be created from the instanceTemplate. The final number of instances created from the template will be equal to: + /// - If expressed as a fixed number, the minimum of either targetSize.fixed or instanceGroupManager.targetSize is used. + /// - if expressed as a percent, the targetSize would be (targetSize.percent/100 * InstanceGroupManager.targetSize) If there is a remainder, the number is rounded up. If unset, this version will update any remaining instances not updated by another version. Read Starting a canary update for more information. + #[serde(rename="targetSize")] + pub target_size: Option, + /// no description provided + #[serde(rename="instanceTemplate")] + pub instance_template: Option, + /// Name of the version. Unique among all versions in the scope of this managed instance group. + pub name: Option, +} + +impl Part for InstanceGroupManagerVersion {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -3873,7 +4074,7 @@ pub struct SecurityPolicy { pub description: Option, /// A list of rules that belong to this policy. There must always be a default rule (rule with priority 2147483647 and match "*"). If no rules are provided when creating a security policy, a default rule with action "allow" will be added. pub rules: Option>, - /// Specifies a fingerprint for this resource, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata. + /// Specifies a fingerprint for this resource, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata, otherwise the request will fail with error 412 conditionNotMet. /// /// To see the latest fingerprint, make get() request to the security policy. pub fingerprint: Option, @@ -3919,9 +4120,18 @@ impl Part for ImageListWarning {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [test iam permissions region disks](struct.RegionDiskTestIamPermissionCall.html) (response) -/// * [test iam permissions licenses](struct.LicenseTestIamPermissionCall.html) (response) +/// * [test iam permissions instances](struct.InstanceTestIamPermissionCall.html) (response) +/// * [test iam permissions node templates](struct.NodeTemplateTestIamPermissionCall.html) (response) /// * [test iam permissions license codes](struct.LicenseCodeTestIamPermissionCall.html) (response) +/// * [test iam permissions snapshots](struct.SnapshotTestIamPermissionCall.html) (response) +/// * [test iam permissions node groups](struct.NodeGroupTestIamPermissionCall.html) (response) +/// * [test iam permissions images](struct.ImageTestIamPermissionCall.html) (response) +/// * [test iam permissions disks](struct.DiskTestIamPermissionCall.html) (response) +/// * [test iam permissions region disks](struct.RegionDiskTestIamPermissionCall.html) (response) +/// * [test iam permissions instance templates](struct.InstanceTemplateTestIamPermissionCall.html) (response) +/// * [test iam permissions subnetworks](struct.SubnetworkTestIamPermissionCall.html) (response) +/// * [test iam permissions licenses](struct.LicenseTestIamPermissionCall.html) (response) +/// * [test iam permissions network endpoint groups](struct.NetworkEndpointGroupTestIamPermissionCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestPermissionsResponse { @@ -3932,21 +4142,28 @@ pub struct TestPermissionsResponse { impl ResponseResult for TestPermissionsResponse {} -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// A shielded Instance identity entry. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get shielded instance identity instances](struct.InstanceGetShieldedInstanceIdentityCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SnapshotListWarningData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, +pub struct ShieldedInstanceIdentity { + /// An Attestation Key (AK) issued to the Shielded Instance's vTPM. + #[serde(rename="signingKey")] + pub signing_key: Option, + /// [Output Only] Type of the resource. Always compute#shieldedInstanceIdentity for shielded Instance identity entry. + pub kind: Option, + /// An Endorsement Key (EK) issued to the Shielded Instance's vTPM. + #[serde(rename="encryptionKey")] + pub encryption_key: Option, } -impl NestedType for SnapshotListWarningData {} -impl Part for SnapshotListWarningData {} +impl ResponseResult for ShieldedInstanceIdentity {} /// [Output Only] Informational warning message. @@ -3968,42 +4185,79 @@ impl NestedType for RegionInstanceGroupsListInstancesWarning {} impl Part for RegionInstanceGroupsListInstancesWarning {} -/// [Output Only] Informational warning message. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetInstanceAggregatedListWarning { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, +pub struct InstanceAggregatedListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, } -impl NestedType for TargetInstanceAggregatedListWarning {} -impl Part for TargetInstanceAggregatedListWarning {} +impl NestedType for InstanceAggregatedListWarningData {} +impl Part for InstanceAggregatedListWarningData {} -/// [Output Only] Informational warning message. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ZoneListWarning { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, +pub struct ForwardingRuleReference { + /// no description provided + #[serde(rename="forwardingRule")] + pub forwarding_rule: Option, } -impl NestedType for ZoneListWarning {} -impl Part for ZoneListWarning {} +impl Part for ForwardingRuleReference {} + + +/// Defines the IP ranges that want to use NAT for a subnetwork. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RouterNatSubnetworkToNat { + /// Specify the options for NAT ranges in the Subnetwork. All usages of single value are valid except NAT_IP_RANGE_OPTION_UNSPECIFIED. The only valid option with multiple values is: ["PRIMARY_IP_RANGE", "LIST_OF_SECONDARY_IP_RANGES"] Default: [ALL_IP_RANGES] + #[serde(rename="sourceIpRangesToNat")] + pub source_ip_ranges_to_nat: Option>, + /// A list of the secondary ranges of the Subnetwork that are allowed to use NAT. This can be populated only if "LIST_OF_SECONDARY_IP_RANGES" is one of the values in source_ip_ranges_to_nat. + #[serde(rename="secondaryIpRangeNames")] + pub secondary_ip_range_names: Option>, + /// URL for the subnetwork resource to use NAT. + pub name: Option, +} + +impl Part for RouterNatSubnetworkToNat {} + + +/// A set of Shielded Instance options. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update shielded instance config instances](struct.InstanceUpdateShieldedInstanceConfigCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ShieldedInstanceConfig { + /// Defines whether the instance has the vTPM enabled. + #[serde(rename="enableVtpm")] + pub enable_vtpm: Option, + /// Defines whether the instance has integrity monitoring enabled. + #[serde(rename="enableIntegrityMonitoring")] + pub enable_integrity_monitoring: Option, + /// Defines whether the instance has Secure Boot enabled. + #[serde(rename="enableSecureBoot")] + pub enable_secure_boot: Option, +} + +impl RequestValue for ShieldedInstanceConfig {} /// [Output Only] If potential misconfigurations are detected for this SSL policy, this field will be populated with warning messages. @@ -4040,7 +4294,7 @@ pub struct DeprecationStatus { pub deleted: Option, /// An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it. pub deprecated: Option, - /// The deprecation state of this resource. This can be DEPRECATED, OBSOLETE, or DELETED. Operations which create a new resource using a DEPRECATED resource will return successfully, but with a warning indicating the deprecated resource and recommending its replacement. Operations which use OBSOLETE or DELETED resources will be rejected and result in an error. + /// The deprecation state of this resource. This can be ACTIVE, DEPRECATED, OBSOLETE, or DELETED. Operations which communicate the end of life date for an image, can use ACTIVE. Operations which create a new resource using a DEPRECATED resource will return successfully, but with a warning indicating the deprecated resource and recommending its replacement. Operations which use OBSOLETE or DELETED resources will be rejected and result in an error. pub state: Option, /// An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it. pub obsolete: Option, @@ -4079,6 +4333,16 @@ impl RequestValue for InstancesStartWithEncryptionKeyRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManagedInstance { + /// [Output Only] The status of the instance. This field is empty when the instance does not exist. + #[serde(rename="instanceStatus")] + pub instance_status: Option, + /// [Output Only] Intended version of this instance. + pub version: Option, + /// [Output Only] The URL of the instance. The URL can exist even if the instance has not yet been created. + pub instance: Option, + /// [Output Only] Information about the last attempt to create or delete the instance. + #[serde(rename="lastAttempt")] + pub last_attempt: Option, /// [Output Only] The current action that the managed instance group has scheduled for the instance. Possible values: /// - NONE The instance is running, and the managed instance group does not have any scheduled actions for this instance. /// - CREATING The managed instance group is creating this instance. If the group fails to create this instance, it will try again until it is successful. @@ -4091,16 +4355,8 @@ pub struct ManagedInstance { /// - VERIFYING The managed instance group has created the instance and it is in the process of being verified. #[serde(rename="currentAction")] pub current_action: Option, - /// [Output Only] The URL of the instance. The URL can exist even if the instance has not yet been created. - pub instance: Option, - /// [Output Only] Information about the last attempt to create or delete the instance. - #[serde(rename="lastAttempt")] - pub last_attempt: Option, /// [Output only] The unique identifier for this resource. This field is empty when instance does not exist. pub id: Option, - /// [Output Only] The status of the instance. This field is empty when the instance does not exist. - #[serde(rename="instanceStatus")] - pub instance_status: Option, } impl Part for ManagedInstance {} @@ -4170,32 +4426,38 @@ impl Part for SecurityPolicyListWarning {} /// /// * [get serial port output instances](struct.InstanceGetSerialPortOutputCall.html) (none) /// * [stop instances](struct.InstanceStopCall.html) (none) -/// * [insert instances](struct.InstanceInsertCall.html) (request) +/// * [get iam policy instances](struct.InstanceGetIamPolicyCall.html) (none) /// * [get instances](struct.InstanceGetCall.html) (response) /// * [set tags instances](struct.InstanceSetTagCall.html) (none) /// * [set disk auto delete instances](struct.InstanceSetDiskAutoDeleteCall.html) (none) +/// * [update shielded instance config instances](struct.InstanceUpdateShieldedInstanceConfigCall.html) (none) /// * [set metadata instances](struct.InstanceSetMetadataCall.html) (none) /// * [simulate maintenance event instances](struct.InstanceSimulateMaintenanceEventCall.html) (none) /// * [detach disk instances](struct.InstanceDetachDiskCall.html) (none) /// * [delete access config instances](struct.InstanceDeleteAccessConfigCall.html) (none) /// * [set machine type instances](struct.InstanceSetMachineTypeCall.html) (none) +/// * [insert instances](struct.InstanceInsertCall.html) (request) /// * [update network interface instances](struct.InstanceUpdateNetworkInterfaceCall.html) (none) /// * [add access config instances](struct.InstanceAddAccessConfigCall.html) (none) /// * [set machine resources instances](struct.InstanceSetMachineResourceCall.html) (none) /// * [set labels instances](struct.InstanceSetLabelCall.html) (none) /// * [update access config instances](struct.InstanceUpdateAccessConfigCall.html) (none) +/// * [set deletion protection instances](struct.InstanceSetDeletionProtectionCall.html) (none) +/// * [set shielded instance integrity policy instances](struct.InstanceSetShieldedInstanceIntegrityPolicyCall.html) (none) /// * [set service account instances](struct.InstanceSetServiceAccountCall.html) (none) /// * [list referrers instances](struct.InstanceListReferrerCall.html) (none) /// * [set scheduling instances](struct.InstanceSetSchedulingCall.html) (none) /// * [delete instances](struct.InstanceDeleteCall.html) (none) /// * [reset instances](struct.InstanceResetCall.html) (none) +/// * [get shielded instance identity instances](struct.InstanceGetShieldedInstanceIdentityCall.html) (none) +/// * [test iam permissions instances](struct.InstanceTestIamPermissionCall.html) (none) /// * [attach disk instances](struct.InstanceAttachDiskCall.html) (none) /// * [list instances](struct.InstanceListCall.html) (none) /// * [start instances](struct.InstanceStartCall.html) (none) /// * [start with encryption key instances](struct.InstanceStartWithEncryptionKeyCall.html) (none) -/// * [set deletion protection instances](struct.InstanceSetDeletionProtectionCall.html) (none) -/// * [aggregated list instances](struct.InstanceAggregatedListCall.html) (none) /// * [set min cpu platform instances](struct.InstanceSetMinCpuPlatformCall.html) (none) +/// * [set iam policy instances](struct.InstanceSetIamPolicyCall.html) (none) +/// * [aggregated list instances](struct.InstanceAggregatedListCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Instance { @@ -4247,6 +4509,8 @@ pub struct Instance { pub creation_timestamp: Option, /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, + /// Tags to apply to this instance. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during instance creation. The tags can be later modified by the setTags method. Each tag within the list must comply with RFC1035. Multiple tags can be specified via the 'tags.items' field. + pub tags: Option, /// An array of network configurations for this instance. These specify how interfaces are configured to interact with other network services, such as connecting to the internet. Multiple interfaces are supported per instance. #[serde(rename="networkInterfaces")] pub network_interfaces: Option>, @@ -4255,15 +4519,21 @@ pub struct Instance { pub start_restricted: Option, /// [Output Only] Type of the resource. Always compute#instance for instances. pub kind: Option, - /// The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, + /// no description provided + #[serde(rename="shieldedInstanceConfig")] + pub shielded_instance_config: Option, /// [Output Only] URL of the zone where the instance resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. pub zone: Option, - /// Tags to apply to this instance. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during instance creation. The tags can be later modified by the setTags method. Each tag within the list must comply with RFC1035. Multiple tags can be specified via the 'tags.items' field. - pub tags: Option, + /// no description provided + pub hostname: Option, + /// The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] pub self_link: Option, + /// no description provided + #[serde(rename="shieldedInstanceIntegrityPolicy")] + pub shielded_instance_integrity_policy: Option, /// A fingerprint for this request, which is essentially a hash of the label's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. /// /// To see the latest fingerprint, make get() request to the instance. @@ -4384,34 +4654,21 @@ impl NestedType for RegionAutoscalerListWarning {} impl Part for RegionAutoscalerListWarning {} -/// Response to the list request, and contains a list of interconnect locations. /// -/// # Activities /// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list interconnect locations](struct.InterconnectLocationListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InterconnectLocationList { - /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// [Output Only] Type of resource. Always compute#interconnectLocationList for lists of interconnect locations. - pub kind: Option, - /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of InterconnectLocation resources. - pub items: Option>, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// [Output Only] Server-defined URL for this resource. - #[serde(rename="selfLink")] - pub self_link: Option, +pub struct InstanceGroupManagerAutoHealingPolicy { + /// The URL for the health check that signals autohealing. + #[serde(rename="healthCheck")] + pub health_check: Option, + /// The number of seconds that the managed instance group waits before it applies autohealing policies to new instances or recently recreated instances. This initial delay allows instances to initialize and run their startup scripts before the instance group determines that they are UNHEALTHY. This prevents the managed instance group from recreating its instances prematurely. This value must be from range [0, 3600]. + #[serde(rename="initialDelaySec")] + pub initial_delay_sec: Option, } -impl ResponseResult for InterconnectLocationList {} +impl Part for InstanceGroupManagerAutoHealingPolicy {} /// [Output Only] Informational warning which replaces the list of disk types when the list is empty. @@ -4433,6 +4690,51 @@ impl NestedType for DiskTypesScopedListWarning {} impl Part for DiskTypesScopedListWarning {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SnapshotListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for SnapshotListWarningData {} +impl Part for SnapshotListWarningData {} + + +/// Status of a NAT contained in this router. Next tag: 9 +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RouterStatusNatStatus { + /// A list of IPs user-allocated for NAT. They will be raw IP strings like "179.12.26.133". + #[serde(rename="userAllocatedNatIps")] + pub user_allocated_nat_ips: Option>, + /// Unique name of this NAT. + pub name: Option, + /// A list of IPs auto-allocated for NAT. Example: ["1.1.1.1", "129.2.16.89"] + #[serde(rename="autoAllocatedNatIps")] + pub auto_allocated_nat_ips: Option>, + /// Number of VM endpoints (i.e., Nics) that can use NAT. + #[serde(rename="numVmEndpointsWithNatMappings")] + pub num_vm_endpoints_with_nat_mappings: Option, + /// The number of extra IPs to allocate. This will be greater than 0 only if user-specified IPs are NOT enough to allow all configured VMs to use NAT. This value is meaningful only when auto-allocation of NAT IPs is *not* used. + #[serde(rename="minExtraNatIpsNeeded")] + pub min_extra_nat_ips_needed: Option, + /// A list of fully qualified URLs of reserved IP address resources. + #[serde(rename="userAllocatedNatIpResources")] + pub user_allocated_nat_ip_resources: Option>, +} + +impl Part for RouterStatusNatStatus {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// @@ -4462,7 +4764,7 @@ pub struct RouterInterface { /// URI of the linked VPN tunnel. It must be in the same region as the router. Each interface can have at most one linked resource and it could either be a VPN Tunnel or an interconnect attachment. #[serde(rename="linkedVpnTunnel")] pub linked_vpn_tunnel: Option, - /// [Output Only] Type of how the resource/configuration of the interface is managed. MANAGED_BY_USER is the default value; MANAGED_BY_ATTACHMENT represents an interface that is automatically created for PARTNER type interconnectAttachment, Google will automatically create/update/delete this type of interface when the PARTNER interconnectAttachment is created/provisioned/deleted. + /// [Output Only] The resource that configures and manages this interface. MANAGED_BY_USER is the default value and can be managed by you or other users; MANAGED_BY_ATTACHMENT is an interface that is configured and managed by Cloud Interconnect, specifically by an InterconnectAttachment of type PARTNER. Google will automatically create, update, and delete this type of interface when the PARTNER InterconnectAttachment is created, updated, or deleted. #[serde(rename="managementType")] pub management_type: Option, /// IP address and range of the interface. The IP range must be in the RFC3927 link-local IP space. The value must be a CIDR-formatted string, for example: 169.254.0.1/30. NOTE: Do not truncate the address as it represents the IP address of the interface. @@ -4610,6 +4912,25 @@ impl NestedType for InstancesScopedListWarningData {} impl Part for InstancesScopedListWarningData {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InterconnectDiagnosticsLinkLACPStatus { + /// System ID of the port on the neighbor?s side of the LACP exchange. + #[serde(rename="neighborSystemId")] + pub neighbor_system_id: Option, + /// no description provided + pub state: Option, + /// System ID of the port on Google?s side of the LACP exchange. + #[serde(rename="googleSystemId")] + pub google_system_id: Option, +} + +impl Part for InterconnectDiagnosticsLinkLACPStatus {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -4887,99 +5208,93 @@ pub struct ServiceAccount { impl Part for ServiceAccount {} -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// A rule to be applied in a Policy. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VpnTunnelListWarningData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, +pub struct Rule { + /// Human-readable description of the rule. + pub description: Option, + /// If one or more 'not_in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in none of the entries. + #[serde(rename="notIns")] + pub not_ins: Option>, + /// Required + pub action: Option, + /// A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs. + pub permissions: Option>, + /// If one or more 'in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in at least one of these entries. + pub ins: Option>, + /// Additional restrictions that must be met. All conditions must pass for the rule to match. + pub conditions: Option>, + /// The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action. + #[serde(rename="logConfigs")] + pub log_configs: Option>, } -impl NestedType for VpnTunnelListWarningData {} -impl Part for VpnTunnelListWarningData {} +impl Part for Rule {} -/// A persistent disk snapshot resource. (== resource_for beta.snapshots ==) (== resource_for v1.snapshots ==) +/// [Output Only] Informational warning which replaces the list of operations when the list is empty. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [delete snapshots](struct.SnapshotDeleteCall.html) (none) -/// * [get snapshots](struct.SnapshotGetCall.html) (response) -/// * [create snapshot region disks](struct.RegionDiskCreateSnapshotCall.html) (request) -/// * [create snapshot disks](struct.DiskCreateSnapshotCall.html) (request) -/// * [list snapshots](struct.SnapshotListCall.html) (none) -/// * [set labels snapshots](struct.SnapshotSetLabelCall.html) (none) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Snapshot { - /// [Output Only] The status of the snapshot. This can be CREATING, DELETING, FAILED, READY, or UPLOADING. - pub status: Option, - /// The customer-supplied encryption key of the source disk. Required if the source disk is protected by a customer-supplied encryption key. - #[serde(rename="sourceDiskEncryptionKey")] - pub source_disk_encryption_key: Option, - /// An optional description of this resource. Provide this property when you create the resource. - pub description: Option, - /// A fingerprint for the labels being applied to this snapshot, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. - /// - /// To see the latest fingerprint, make a get() request to retrieve a snapshot. - #[serde(rename="labelFingerprint")] - pub label_fingerprint: Option, - /// Labels to apply to this snapshot. These can be later modified by the setLabels method. Label values may be empty. - pub labels: Option>, - /// [Output Only] The ID value of the disk used to create this snapshot. This value may be used to determine whether the snapshot was taken from the current or a previous instance of a given disk name. - #[serde(rename="sourceDiskId")] - pub source_disk_id: Option, - /// [Output Only] A list of public visible licenses that apply to this snapshot. This can be because the original image had licenses attached (such as a Windows image). - pub licenses: Option>, - /// [Output Only] Creation timestamp in RFC3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. - pub id: Option, - /// [Output Only] Integer license codes indicating which licenses are attached to this snapshot. - #[serde(rename="licenseCodes")] - pub license_codes: Option>, - /// [Output Only] Type of the resource. Always compute#snapshot for Snapshot resources. - pub kind: Option, - /// [Output Only] A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion. - #[serde(rename="storageBytes")] - pub storage_bytes: Option, - /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, - /// [Output Only] The source disk used to create this snapshot. - #[serde(rename="sourceDisk")] - pub source_disk: Option, - /// [Output Only] Size of the snapshot, specified in GB. - #[serde(rename="diskSizeGb")] - pub disk_size_gb: Option, - /// Encrypts the snapshot using a customer-supplied encryption key. - /// - /// After you encrypt a snapshot using a customer-supplied key, you must provide the same key if you use the image later For example, you must provide the encryption key when you create a disk from the encrypted snapshot in a future request. - /// - /// Customer-supplied encryption keys do not protect access to metadata of the disk. - /// - /// If you do not provide an encryption key when creating the snapshot, then the snapshot will be encrypted using an automatically generated key and you do not need to provide a key to use the snapshot later. - #[serde(rename="snapshotEncryptionKey")] - pub snapshot_encryption_key: Option, - /// [Output Only] An indicator whether storageBytes is in a stable state or it is being adjusted as a result of shared storage reallocation. This status can either be UPDATING, meaning the size of the snapshot is being updated, or UP_TO_DATE, meaning the size of the snapshot is up-to-date. - #[serde(rename="storageBytesStatus")] - pub storage_bytes_status: Option, - /// [Output Only] Server-defined URL for the resource. - #[serde(rename="selfLink")] - pub self_link: Option, +pub struct OperationsScopedListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, } -impl RequestValue for Snapshot {} -impl Resource for Snapshot {} -impl ResponseResult for Snapshot {} +impl NestedType for OperationsScopedListWarning {} +impl Part for OperationsScopedListWarning {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HTTP2HealthCheck { + /// The TCP port number for the health check request. The default value is 443. Valid values are 1 through 65535. + pub port: Option, + /// The value of the host header in the HTTP/2 health check request. If left empty (default value), the IP on behalf of which this health check is performed will be used. + pub host: Option, + /// The request path of the HTTP/2 health check request. The default value is /. + #[serde(rename="requestPath")] + pub request_path: Option, + /// Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. + #[serde(rename="portName")] + pub port_name: Option, + /// Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. + #[serde(rename="proxyHeader")] + pub proxy_header: Option, + /// Specifies how port is selected for health checking, can be one of following values: + /// USE_FIXED_PORT: The port number in + /// port + /// is used for health checking. + /// USE_NAMED_PORT: The + /// portName + /// is used for health checking. + /// USE_SERVING_PORT: For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. + /// + /// + /// If not specified, HTTP2 health check follows behavior specified in + /// port + /// and + /// portName + /// fields. + #[serde(rename="portSpecification")] + pub port_specification: Option, + /// The string to match anywhere in the first 1024 bytes of the response body. If left empty (the default value), the status code determines health. The response data can only be ASCII. + pub response: Option, +} + +impl Part for HTTP2HealthCheck {} /// There is no detailed description. @@ -5025,6 +5340,7 @@ impl RequestValue for InstanceGroupManagersSetInstanceTemplateRequest {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [get routers](struct.RouterGetCall.html) (response) +/// * [get nat mapping info routers](struct.RouterGetNatMappingInfoCall.html) (none) /// * [list routers](struct.RouterListCall.html) (none) /// * [patch routers](struct.RouterPatchCall.html) (request) /// * [aggregated list routers](struct.RouterAggregatedListCall.html) (none) @@ -5042,6 +5358,8 @@ pub struct Router { pub description: Option, /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. pub name: Option, + /// A list of Nat services created in this router. + pub nats: Option>, /// Router interfaces. Each interface requires either one linked resource (e.g. linkedVpnTunnel), or IP address and IP address range (e.g. ipRange), or both. pub interfaces: Option>, /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. @@ -5260,19 +5578,64 @@ pub struct OperationList { impl ResponseResult for OperationList {} -/// The named port. For example: . +/// InstanceGroups (== resource_for beta.instanceGroups ==) (== resource_for v1.instanceGroups ==) (== resource_for beta.regionInstanceGroups ==) (== resource_for v1.regionInstanceGroups ==) /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list instances instance groups](struct.InstanceGroupListInstanceCall.html) (none) +/// * [insert instance groups](struct.InstanceGroupInsertCall.html) (request) +/// * [delete instance groups](struct.InstanceGroupDeleteCall.html) (none) +/// * [get instance groups](struct.InstanceGroupGetCall.html) (response) +/// * [add instances instance groups](struct.InstanceGroupAddInstanceCall.html) (none) +/// * [set named ports instance groups](struct.InstanceGroupSetNamedPortCall.html) (none) +/// * [list instance groups](struct.InstanceGroupListCall.html) (none) +/// * [get region instance groups](struct.RegionInstanceGroupGetCall.html) (response) +/// * [aggregated list instance groups](struct.InstanceGroupAggregatedListCall.html) (none) +/// * [remove instances instance groups](struct.InstanceGroupRemoveInstanceCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NamedPort { - /// The name for this named port. The name must be 1-63 characters long, and comply with RFC1035. +pub struct InstanceGroup { + /// [Output Only] The resource type, which is always compute#instanceGroup for instance groups. + pub kind: Option, + /// The URL of the network to which all instances in the instance group belong. + pub network: Option, + /// [Output Only] The URL of the zone where the instance group is located (for zonal resources). + pub zone: Option, + /// [Output Only] The URL of the region where the instance group is located (for regional resources). + pub region: Option, + /// An optional description of this resource. Provide this property when you create the resource. + pub description: Option, + /// The name of the instance group. The name must be 1-63 characters long, and comply with RFC1035. pub name: Option, - /// The port number, which can be a value between 1 and 65535. - pub port: Option, + /// [Output Only] The fingerprint of the named ports. The system uses this fingerprint to detect conflicts when multiple users change the named ports concurrently. + pub fingerprint: Option, + /// [Output Only] The URL of the subnetwork to which all instances in the instance group belong. + pub subnetwork: Option, + /// Assigns a name to a port number. For example: {name: "http", port: 80} + /// + /// This allows the system to reference ports by the assigned name instead of a port number. Named ports can also contain multiple ports. For example: [{name: "http", port: 80},{name: "http", port: 8080}] + /// + /// Named ports apply to all instances in this instance group. + #[serde(rename="namedPorts")] + pub named_ports: Option>, + /// [Output Only] The creation timestamp for this instance group in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] A unique identifier for this instance group, generated by the server. + pub id: Option, + /// [Output Only] The URL for this instance group. The server generates this URL. + #[serde(rename="selfLink")] + pub self_link: Option, + /// [Output Only] The total number of instances in the instance group. + pub size: Option, } -impl Part for NamedPort {} +impl RequestValue for InstanceGroup {} +impl Resource for InstanceGroup {} +impl ResponseResult for InstanceGroup {} /// A TargetInstance resource. This resource defines an endpoint instance that terminates traffic of certain protocols. (== resource_for beta.targetInstances ==) (== resource_for v1.targetInstances ==) @@ -5562,6 +5925,35 @@ pub struct LicenseResourceRequirements { impl Part for LicenseResourceRequirements {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InterconnectDiagnosticsLinkStatus { + /// An InterconnectDiagnostics.LinkOpticalPower object, describing the current value and status of the received light level. + #[serde(rename="receivingOpticalPower")] + pub receiving_optical_power: Option, + /// A list of InterconnectDiagnostics.ARPEntry objects, describing the ARP neighbor entries seen on this link. This will be empty if the link is bundled + #[serde(rename="arpCaches")] + pub arp_caches: Option>, + /// The unique ID for this link assigned during turn up by Google. + #[serde(rename="circuitId")] + pub circuit_id: Option, + /// no description provided + #[serde(rename="lacpStatus")] + pub lacp_status: Option, + /// The Demarc address assigned by Google and provided in the LoA. + #[serde(rename="googleDemarc")] + pub google_demarc: Option, + /// An InterconnectDiagnostics.LinkOpticalPower object, describing the current value and status of the transmitted light level. + #[serde(rename="transmittingOpticalPower")] + pub transmitting_optical_power: Option, +} + +impl Part for InterconnectDiagnosticsLinkStatus {} + + /// Contains a list of autoscalers. /// /// # Activities @@ -5592,6 +5984,20 @@ pub struct RegionAutoscalerList { impl ResponseResult for RegionAutoscalerList {} +/// Authorization-related information used by Cloud Audit Logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuthorizationLoggingOptions { + /// The type of the permission that was checked. + #[serde(rename="permissionType")] + pub permission_type: Option, +} + +impl Part for AuthorizationLoggingOptions {} + + /// There is no detailed description. /// /// # Activities @@ -5629,6 +6035,55 @@ impl NestedType for OperationErrorErrors {} impl Part for OperationErrorErrors {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [aggregated list network endpoint groups](struct.NetworkEndpointGroupAggregatedListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroupAggregatedList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] The resource type, which is always compute#networkEndpointGroupAggregatedList for aggregated lists of network endpoint groups. + pub kind: Option, + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of NetworkEndpointGroupsScopedList resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl ResponseResult for NetworkEndpointGroupAggregatedList {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [attach network endpoints network endpoint groups](struct.NetworkEndpointGroupAttachNetworkEndpointCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroupsAttachEndpointsRequest { + /// The list of network endpoints to be attached. + #[serde(rename="networkEndpoints")] + pub network_endpoints: Option>, +} + +impl RequestValue for NetworkEndpointGroupsAttachEndpointsRequest {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -5721,44 +6176,86 @@ impl NestedType for NodeGroupListWarningData {} impl Part for NodeGroupListWarningData {} -/// [Output Only] Informational warning message. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InstanceGroupListWarning { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, +pub struct NetworkEndpointGroupListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, } -impl NestedType for InstanceGroupListWarning {} -impl Part for InstanceGroupListWarning {} +impl NestedType for NetworkEndpointGroupListWarningData {} +impl Part for NetworkEndpointGroupListWarningData {} -/// There is no detailed description. +/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. +/// +/// +/// +/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. +/// +/// **JSON Example** +/// +/// { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com" ] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } +/// +/// **YAML Example** +/// +/// bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-other-app@appspot.gserviceaccount.com role: roles/owner - members: - user:sean@example.com role: roles/viewer +/// +/// +/// +/// For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam/docs). /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [set target pools region instance group managers](struct.RegionInstanceGroupManagerSetTargetPoolCall.html) (request) +/// * [set iam policy disks](struct.DiskSetIamPolicyCall.html) (response) +/// * [get iam policy instances](struct.InstanceGetIamPolicyCall.html) (response) +/// * [set iam policy snapshots](struct.SnapshotSetIamPolicyCall.html) (response) +/// * [get iam policy snapshots](struct.SnapshotGetIamPolicyCall.html) (response) +/// * [set iam policy licenses](struct.LicenseSetIamPolicyCall.html) (response) +/// * [get iam policy images](struct.ImageGetIamPolicyCall.html) (response) +/// * [get iam policy subnetworks](struct.SubnetworkGetIamPolicyCall.html) (response) +/// * [get iam policy node groups](struct.NodeGroupGetIamPolicyCall.html) (response) +/// * [set iam policy images](struct.ImageSetIamPolicyCall.html) (response) +/// * [get iam policy disks](struct.DiskGetIamPolicyCall.html) (response) +/// * [set iam policy node groups](struct.NodeGroupSetIamPolicyCall.html) (response) +/// * [get iam policy instance templates](struct.InstanceTemplateGetIamPolicyCall.html) (response) +/// * [set iam policy node templates](struct.NodeTemplateSetIamPolicyCall.html) (response) +/// * [get iam policy licenses](struct.LicenseGetIamPolicyCall.html) (response) +/// * [set iam policy instance templates](struct.InstanceTemplateSetIamPolicyCall.html) (response) +/// * [get iam policy node templates](struct.NodeTemplateGetIamPolicyCall.html) (response) +/// * [set iam policy instances](struct.InstanceSetIamPolicyCall.html) (response) +/// * [set iam policy subnetworks](struct.SubnetworkSetIamPolicyCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RegionInstanceGroupManagersSetTargetPoolsRequest { - /// Fingerprint of the target pools information, which is a hash of the contents. This field is used for optimistic locking when you update the target pool entries. This field is optional. - pub fingerprint: Option, - /// The URL of all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group. - #[serde(rename="targetPools")] - pub target_pools: Option>, +pub struct Policy { + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, + /// Deprecated. + pub version: Option, + /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly. + pub etag: Option, + /// If more than one rule is specified, the rules are applied in the following manner: - All matching LOG rules are always applied. - If any DENY/DENY_WITH_LOG rule matches, permission is denied. Logging will be applied if one or more matching rule requires logging. - Otherwise, if any ALLOW/ALLOW_WITH_LOG rule matches, permission is granted. Logging will be applied if one or more matching rule requires logging. - Otherwise, if no rule applies, permission is denied. + pub rules: Option>, + /// Associates a list of `members` to a `role`. `bindings` with no members will result in an error. + pub bindings: Option>, + /// + #[serde(rename="iamOwned")] + pub iam_owned: Option, } -impl RequestValue for RegionInstanceGroupManagersSetTargetPoolsRequest {} +impl ResponseResult for Policy {} /// There is no detailed description. @@ -5782,23 +6279,24 @@ pub struct RegionSetLabelsRequest { impl RequestValue for RegionSetLabelsRequest {} -/// [Output Only] An informational warning that replaces the list of instance groups when the list is empty. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InstanceGroupsScopedListWarning { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, +pub struct InterconnectDiagnosticsLinkOpticalPower { + /// The status of the current value when compared to the warning and alarm levels for the receiving or transmitting transceiver. Possible states include: + /// - OK: The value has not crossed a warning threshold. + /// - LOW_WARNING: The value has crossed below the low warning threshold. + /// - HIGH_WARNING: The value has crossed above the high warning threshold. + /// - LOW_ALARM: The value has crossed below the low alarm threshold. + /// - HIGH_ALARM: The value has crossed above the high alarm threshold. + pub state: Option, + /// Value of the current receiving or transmitting optical power, read in dBm. Take a known good optical value, give it a 10% margin and trigger warnings relative to that value. In general, a -7dBm warning and a -11dBm alarm are good optical value estimates for most links. + pub value: Option, } -impl NestedType for InstanceGroupsScopedListWarning {} -impl Part for InstanceGroupsScopedListWarning {} +impl Part for InterconnectDiagnosticsLinkOpticalPower {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -5917,9 +6415,18 @@ impl Part for TargetPoolAggregatedListWarningData {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [test iam permissions region disks](struct.RegionDiskTestIamPermissionCall.html) (request) -/// * [test iam permissions licenses](struct.LicenseTestIamPermissionCall.html) (request) +/// * [test iam permissions instances](struct.InstanceTestIamPermissionCall.html) (request) +/// * [test iam permissions node templates](struct.NodeTemplateTestIamPermissionCall.html) (request) /// * [test iam permissions license codes](struct.LicenseCodeTestIamPermissionCall.html) (request) +/// * [test iam permissions snapshots](struct.SnapshotTestIamPermissionCall.html) (request) +/// * [test iam permissions node groups](struct.NodeGroupTestIamPermissionCall.html) (request) +/// * [test iam permissions images](struct.ImageTestIamPermissionCall.html) (request) +/// * [test iam permissions disks](struct.DiskTestIamPermissionCall.html) (request) +/// * [test iam permissions region disks](struct.RegionDiskTestIamPermissionCall.html) (request) +/// * [test iam permissions instance templates](struct.InstanceTemplateTestIamPermissionCall.html) (request) +/// * [test iam permissions subnetworks](struct.SubnetworkTestIamPermissionCall.html) (request) +/// * [test iam permissions licenses](struct.LicenseTestIamPermissionCall.html) (request) +/// * [test iam permissions network endpoint groups](struct.NetworkEndpointGroupTestIamPermissionCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestPermissionsRequest { @@ -5930,6 +6437,58 @@ pub struct TestPermissionsRequest { impl RequestValue for TestPermissionsRequest {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationWarningsData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for OperationWarningsData {} +impl Part for OperationWarningsData {} + + +/// [Output Only] An informational warning that replaces the list of instance groups when the list is empty. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InstanceGroupsScopedListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for InstanceGroupsScopedListWarning {} +impl Part for InstanceGroupsScopedListWarning {} + + +/// Write a Data Access (Gin) log +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogConfigDataAccessOptions { + /// Whether Gin logging should happen in a fail-closed manner at the caller. This is relevant only in the LocalIAM implementation, for now. + /// + /// NOTE: Logging to Gin in a fail-closed manner is currently unsupported while work is being done to satisfy the requirements of go/345. Currently, setting LOG_FAIL_CLOSED mode will have no effect, but still exists because there is active work being done to support it (b/115874152). + #[serde(rename="logMode")] + pub log_mode: Option, +} + +impl Part for LogConfigDataAccessOptions {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// @@ -5947,23 +6506,73 @@ impl NestedType for TargetSslProxyListWarningData {} impl Part for TargetSslProxyListWarningData {} -/// Message for the expected URL mappings. +/// A TargetPool resource. This resource defines a pool of instances, an associated HttpHealthCheck resource, and the fallback target pool. (== resource_for beta.targetPools ==) (== resource_for v1.targetPools ==) /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get health target pools](struct.TargetPoolGetHealthCall.html) (none) +/// * [add instance target pools](struct.TargetPoolAddInstanceCall.html) (none) +/// * [remove instance target pools](struct.TargetPoolRemoveInstanceCall.html) (none) +/// * [remove health check target pools](struct.TargetPoolRemoveHealthCheckCall.html) (none) +/// * [delete target pools](struct.TargetPoolDeleteCall.html) (none) +/// * [insert target pools](struct.TargetPoolInsertCall.html) (request) +/// * [aggregated list target pools](struct.TargetPoolAggregatedListCall.html) (none) +/// * [list target pools](struct.TargetPoolListCall.html) (none) +/// * [add health check target pools](struct.TargetPoolAddHealthCheckCall.html) (none) +/// * [get target pools](struct.TargetPoolGetCall.html) (response) +/// * [set backup target pools](struct.TargetPoolSetBackupCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UrlMapTest { - /// Path portion of the URL. - pub path: Option, - /// Host portion of the URL. - pub host: Option, - /// Description of this test case. +pub struct TargetPool { + /// This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool (i.e., not as a backup pool to some other target pool). The value of the field must be in [0, 1]. + /// + /// If set, backupPool must also be set. They together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below this number, traffic arriving at the load-balanced IP will be directed to the backup pool. + /// + /// In case where failoverRatio is not set or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. + #[serde(rename="failoverRatio")] + pub failover_ratio: Option, + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, - /// Expected BackendService resource the given URL should be mapped to. - pub service: Option, + /// [Output Only] URL of the region where the target pool resides. + pub region: Option, + /// [Output Only] Type of the resource. Always compute#targetPool for target pools. + pub kind: Option, + /// Session affinity option, must be one of the following values: + /// NONE: Connections from the same client IP may go to any instance in the pool. + /// CLIENT_IP: Connections from the same client IP will go to the same instance in the pool while that instance remains healthy. + /// CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol will go to the same instance in the pool while that instance remains healthy. + #[serde(rename="sessionAffinity")] + pub session_affinity: Option, + /// A list of resource URLs to the virtual machine instances serving this pool. They must live in zones contained in the same region as this pool. + pub instances: Option>, + /// This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool, and its failoverRatio field is properly set to a value between [0, 1]. + /// + /// backupPool and failoverRatio together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below failoverRatio, traffic arriving at the load-balanced IP will be directed to the backup pool. + /// + /// In case where failoverRatio and backupPool are not set, or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. + #[serde(rename="backupPool")] + pub backup_pool: Option, + /// The URL of the HttpHealthCheck resource. A member instance in this pool is considered healthy if and only if the health checks pass. An empty list means all member instances will be considered healthy at all times. Only HttpHealthChecks are supported. Only one health check may be specified. + #[serde(rename="healthChecks")] + pub health_checks: Option>, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for the resource. + #[serde(rename="selfLink")] + pub self_link: Option, + /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, } -impl Part for UrlMapTest {} +impl RequestValue for TargetPool {} +impl Resource for TargetPool {} +impl ResponseResult for TargetPool {} /// [Output Only] Informational warning message. @@ -6055,45 +6664,71 @@ impl Part for BackendServiceAggregatedListWarning {} pub struct Address { /// [Output Only] The status of the address, which can be one of RESERVING, RESERVED, or IN_USE. An address that is RESERVING is currently in the process of being reserved. A RESERVED address is currently reserved and available to use. An IN_USE address is currently being used by another resource and is not available. pub status: Option, - /// [Output Only] Type of the resource. Always compute#address for addresses. - pub kind: Option, /// The type of address to reserve, either INTERNAL or EXTERNAL. If unspecified, defaults to EXTERNAL. #[serde(rename="addressType")] pub address_type: Option, - /// An optional description of this resource. Provide this property when you create the resource. - pub description: Option, - /// [Output Only] URL of the region where the regional address resides. This field is not applicable to global addresses. You must specify this field as part of the HTTP request URL. You cannot set this field in the request body. - pub region: Option, - /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, + /// [Output Only] The URLs of the resources that are using this address. + pub users: Option>, /// The IP Version that will be used by this address. Valid options are IPV4 or IPV6. This can only be specified for a global address. #[serde(rename="ipVersion")] pub ip_version: Option, - /// This signifies the networking tier used for configuring this Address and can only take the following values: PREMIUM , STANDARD. - /// - /// If this field is not specified, it is assumed to be PREMIUM. - #[serde(rename="networkTier")] - pub network_tier: Option, + /// The purpose of resource, only used with INTERNAL type. + pub purpose: Option, /// The static IP address represented by this resource. pub address: Option, - /// The URL of the subnetwork in which to reserve the address. If an IP address is specified, it must be within the subnetwork's IP range. This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. - pub subnetwork: Option, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, + /// The URL of the network in which to reserve the address. This field can only be used with INTERNAL type with VPC_PEERING purpose. + pub network: Option, + /// [Output Only] Type of the resource. Always compute#address for addresses. + pub kind: Option, + /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, + /// The prefix length if the resource reprensents an IP range. + #[serde(rename="prefixLength")] + pub prefix_length: Option, + /// [Output Only] URL of the region where the regional address resides. This field is not applicable to global addresses. You must specify this field as part of the HTTP request URL. You cannot set this field in the request body. + pub region: Option, + /// An optional description of this resource. Provide this property when you create the resource. + pub description: Option, + /// This signifies the networking tier used for configuring this Address and can only take the following values: PREMIUM, STANDARD. Global forwarding rules can only be Premium Tier. Regional forwarding rules can be either Premium or Standard Tier. Standard Tier addresses applied to regional forwarding rules can be used with any external load balancer. Regional forwarding rules in Premium Tier can only be used with a Network load balancer. + /// + /// If this field is not specified, it is assumed to be PREMIUM. + #[serde(rename="networkTier")] + pub network_tier: Option, + /// The URL of the subnetwork in which to reserve the address. If an IP address is specified, it must be within the subnetwork's IP range. This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. + pub subnetwork: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// [Output Only] The URLs of the resources that are using this address. - pub users: Option>, } impl RequestValue for Address {} impl ResponseResult for Address {} +/// [Output Only] Informational warning message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InstanceGroupListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for InstanceGroupListWarning {} +impl Part for InstanceGroupListWarning {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -6201,14 +6836,26 @@ impl ResponseResult for InterconnectList {} pub struct ForwardingRule { /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, + /// An optional prefix to the service name for this Forwarding Rule. If specified, will be the first label of the fully qualified service name. + /// + /// The label must be 1-63 characters long, and comply with RFC1035. Specifically, the label must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + /// + /// This field is only used for internal load balancing. + #[serde(rename="serviceLabel")] + pub service_label: Option, /// The IP Version that will be used by this forwarding rule. Valid options are IPV4 or IPV6. This can only be specified for an external global forwarding rule. #[serde(rename="ipVersion")] pub ip_version: Option, /// This signifies what the ForwardingRule will be used for and can only take the following values: INTERNAL, INTERNAL_SELF_MANAGED, EXTERNAL. The value of INTERNAL means that this will be used for Internal Network Load Balancing (TCP, UDP). The value of INTERNAL_SELF_MANAGED means that this will be used for Internal Global HTTP(S) LB. The value of EXTERNAL means that this will be used for External Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) #[serde(rename="loadBalancingScheme")] pub load_balancing_scheme: Option, - /// The URL of the target resource to receive the matched traffic. For regional forwarding rules, this target must live in the same region as the forwarding rule. For global forwarding rules, this target must be a global load balancing resource. The forwarded traffic must be of a type appropriate to the target object. For INTERNAL_SELF_MANAGED" load balancing, only HTTP and HTTPS targets are valid. + /// The URL of the target resource to receive the matched traffic. For regional forwarding rules, this target must live in the same region as the forwarding rule. For global forwarding rules, this target must be a global load balancing resource. The forwarded traffic must be of a type appropriate to the target object. For INTERNAL_SELF_MANAGED load balancing, only HTTP and HTTPS targets are valid. pub target: Option, + /// This field is used along with the backend_service field for internal load balancing or with the target field for internal TargetInstance. This field cannot be used with port or portRange fields. + /// + /// When the load balancing scheme is INTERNAL and protocol is TCP/UDP, specify this field to allow packets addressed to any ports will be forwarded to the backends configured with this forwarding rule. + #[serde(rename="allPorts")] + pub all_ports: Option, /// The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, SCTP or ICMP. /// /// When the load balancing scheme is INTERNAL, only TCP and UDP are valid. When the load balancing scheme is INTERNAL_SELF_MANAGED, only TCPis valid. @@ -6248,6 +6895,11 @@ pub struct ForwardingRule { /// If this field is not specified, it is assumed to be PREMIUM. If IPAddress is specified, this value must be equal to the networkTier of the Address. #[serde(rename="networkTier")] pub network_tier: Option, + /// [Output Only] The internal fully qualified service name for this Forwarding Rule. + /// + /// This field is only used for internal load balancing. + #[serde(rename="serviceName")] + pub service_name: Option, /// This field is only used for INTERNAL load balancing. /// /// For internal load balancing, this field identifies the BackendService resource to receive the matched traffic. @@ -6280,7 +6932,7 @@ pub struct ForwardingRule { pub ip_address: Option, /// This field is used along with the backend_service field for internal load balancing. /// - /// When the load balancing scheme is INTERNAL, a single port or a comma separated list of ports can be configured. Only packets addressed to these ports will be forwarded to the backends configured with this forwarding rule. + /// When the load balancing scheme is INTERNAL, a list of ports can be configured, for example, ['80'], ['8000','9000'] etc. Only packets addressed to these ports will be forwarded to the backends configured with this forwarding rule. /// /// You may specify a maximum of up to 5 ports. pub ports: Option>, @@ -6377,51 +7029,77 @@ pub struct RegionInstanceGroupManagerList { impl ResponseResult for RegionInstanceGroupManagerList {} -/// A license resource. +/// Describing the ARP neighbor entries seen on this link +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InterconnectDiagnosticsARPEntry { + /// The MAC address of this ARP neighbor. + #[serde(rename="macAddress")] + pub mac_address: Option, + /// The IP address of this ARP neighbor. + #[serde(rename="ipAddress")] + pub ip_address: Option, +} + +impl Part for InterconnectDiagnosticsARPEntry {} + + +/// An HttpHealthCheck resource. This resource defines a template for how individual instances should be checked for health, via HTTP. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get licenses](struct.LicenseGetCall.html) (response) -/// * [list licenses](struct.LicenseListCall.html) (none) -/// * [insert licenses](struct.LicenseInsertCall.html) (request) -/// * [test iam permissions licenses](struct.LicenseTestIamPermissionCall.html) (none) -/// * [delete licenses](struct.LicenseDeleteCall.html) (none) +/// * [insert http health checks](struct.HttpHealthCheckInsertCall.html) (request) +/// * [update http health checks](struct.HttpHealthCheckUpdateCall.html) (request) +/// * [get http health checks](struct.HttpHealthCheckGetCall.html) (response) +/// * [patch http health checks](struct.HttpHealthCheckPatchCall.html) (request) +/// * [list http health checks](struct.HttpHealthCheckListCall.html) (none) +/// * [delete http health checks](struct.HttpHealthCheckDeleteCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct License { - /// [Output Only] Type of resource. Always compute#license for licenses. +pub struct HttpHealthCheck { + /// [Output Only] Type of the resource. Always compute#httpHealthCheck for HTTP health checks. pub kind: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, - /// [Output Only] Deprecated. This field no longer reflects whether a license charges a usage fee. - #[serde(rename="chargesUseFee")] - pub charges_use_fee: Option, - /// [Output Only] The unique code used to attach this license to images, snapshots, and disks. - #[serde(rename="licenseCode")] - pub license_code: Option, - /// If false, licenses will not be copied from the source resource when creating an image from a disk, disk from snapshot, or snapshot from disk. - pub transferable: Option, - /// no description provided - #[serde(rename="resourceRequirements")] - pub resource_requirements: Option, + /// How long (in seconds) to wait before claiming failure. The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. + #[serde(rename="timeoutSec")] + pub timeout_sec: Option, + /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, + /// How often (in seconds) to send a health check. The default value is 5 seconds. + #[serde(rename="checkIntervalSec")] + pub check_interval_sec: Option, + /// A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. + #[serde(rename="unhealthyThreshold")] + pub unhealthy_threshold: Option, + /// A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. + #[serde(rename="healthyThreshold")] + pub healthy_threshold: Option, + /// The value of the host header in the HTTP health check request. If left empty (default value), the public IP on behalf of which this health check is performed will be used. + pub host: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. - pub id: Option, + /// The TCP port number for the HTTP health check request. The default value is 80. + pub port: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// Name of the resource. The name must be 1-63 characters long and comply with RFC1035. - pub name: Option, + /// The request path of the HTTP health check request. The default value is /. + #[serde(rename="requestPath")] + pub request_path: Option, } -impl RequestValue for License {} -impl Resource for License {} -impl ResponseResult for License {} +impl RequestValue for HttpHealthCheck {} +impl Resource for HttpHealthCheck {} +impl ResponseResult for HttpHealthCheck {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -6441,6 +7119,23 @@ impl NestedType for RegionDiskTypeListWarningData {} impl Part for RegionDiskTypeListWarningData {} +/// Contain information of Nat mapping for a VM endpoint (i.e., NIC). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VmEndpointNatMappings { + /// no description provided + #[serde(rename="interfaceNatMappings")] + pub interface_nat_mappings: Option>, + /// Name of the VM instance which the endpoint belongs to + #[serde(rename="instanceName")] + pub instance_name: Option, +} + +impl Part for VmEndpointNatMappings {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -6507,7 +7202,7 @@ pub struct NetworkInterface { /// An IPv4 internal network address to assign to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system. #[serde(rename="networkIP")] pub network_ip: Option, - /// Fingerprint hash of contents stored in this network interface. This field will be ignored when inserting an Instance or adding a NetworkInterface. An up-to-date fingerprint must be provided in order to update the NetworkInterface. + /// Fingerprint hash of contents stored in this network interface. This field will be ignored when inserting an Instance or adding a NetworkInterface. An up-to-date fingerprint must be provided in order to update the NetworkInterface, otherwise the request will fail with error 412 conditionNotMet. pub fingerprint: Option, /// The URL of the Subnetwork resource for this instance. If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. If you specify this property, you can specify the subnetwork as a full or partial URL. For example, the following are all valid URLs: /// - https://www.googleapis.com/compute/v1/projects/project/regions/region/subnetworks/subnetwork @@ -6525,19 +7220,14 @@ impl RequestValue for NetworkInterface {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NodeGroupNode { - /// no description provided - pub status: Option, - /// Instances scheduled on this node. - pub instances: Option>, - /// The type of this node. - #[serde(rename="nodeType")] - pub node_type: Option, - /// The name of the node. - pub name: Option, +pub struct DisksScopedList { + /// [Output Only] A list of disks contained in this scope. + pub disks: Option>, + /// [Output Only] Informational warning which replaces the list of disks when the list is empty. + pub warning: Option, } -impl Part for NodeGroupNode {} +impl Part for DisksScopedList {} /// [Output Only] An informational warning that appears when the nodeGroup list is empty. @@ -6682,7 +7372,8 @@ pub struct UrlMap { pub kind: Option, /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, - /// The URL of the BackendService resource if none of the hostRules match. + /// The full or partial URL of the defaultService resource to which traffic is directed if none of the hostRules match. If defaultRouteAction is additionally specified, advanced routing actions like URL Rewrites, etc. take effect prior to sending the request to the backend. However, if defaultService is specified, defaultRouteAction cannot contain any weightedBackendServices. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. + /// Only one of defaultService, defaultUrlRedirect or defaultRouteAction.weightedBackendService must be set. #[serde(rename="defaultService")] pub default_service: Option, /// The list of expected URL mapping tests. Request to update this UrlMap will succeed only if all of the test cases pass. You can specify a maximum of 100 tests per UrlMap. @@ -6690,7 +7381,7 @@ pub struct UrlMap { /// The list of HostRules to use against the URL. #[serde(rename="hostRules")] pub host_rules: Option>, - /// Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a UrlMap. An up-to-date fingerprint must be provided in order to update the UrlMap. + /// Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a UrlMap. An up-to-date fingerprint must be provided in order to update the UrlMap, otherwise the request will fail with error 412 conditionNotMet. /// /// To see the latest fingerprint, make a get() request to retrieve a UrlMap. pub fingerprint: Option, @@ -6714,6 +7405,25 @@ impl Resource for UrlMap {} impl ResponseResult for UrlMap {} +/// [Output Only] Informational warning message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroupsListNetworkEndpointsWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for NetworkEndpointGroupsListNetworkEndpointsWarning {} +impl Part for NetworkEndpointGroupsListNetworkEndpointsWarning {} + + /// There is no detailed description. /// /// # Activities @@ -6744,22 +7454,34 @@ pub struct CommitmentAggregatedList { impl ResponseResult for CommitmentAggregatedList {} -/// There is no detailed description. +/// Contains a list of VmEndpointNatMappings. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [set backend service target ssl proxies](struct.TargetSslProxySetBackendServiceCall.html) (request) +/// * [get nat mapping info routers](struct.RouterGetNatMappingInfoCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetSslProxiesSetBackendServiceRequest { - /// The URL of the new BackendService resource for the targetSslProxy. - pub service: Option, +pub struct VmEndpointNatMappingsList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] Type of resource. Always compute#vmEndpointNatMappingsList for lists of Nat mappings of VM endpoints. + pub kind: Option, + /// [Output Only] Informational warning message. + pub warning: Option, + /// [Output Only] A list of Nat mapping information of VM endpoints. + pub result: Option>, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, } -impl RequestValue for TargetSslProxiesSetBackendServiceRequest {} +impl ResponseResult for VmEndpointNatMappingsList {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -6808,7 +7530,7 @@ impl Part for TargetPoolListWarningData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GlobalSetLabelsRequest { - /// The fingerprint of the previous set of labels for this resource, used to detect conflicts. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash when updating or changing labels. Make a get() request to the resource to get the latest fingerprint. + /// The fingerprint of the previous set of labels for this resource, used to detect conflicts. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash when updating or changing labels, otherwise the request will fail with error 412 conditionNotMet. Make a get() request to the resource to get the latest fingerprint. #[serde(rename="labelFingerprint")] pub label_fingerprint: Option, /// A list of labels to apply for this resource. Each label key & value must comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. For example, "webserver-frontend": "images". A label value can also be empty (e.g. "my-label": ""). @@ -6838,6 +7560,8 @@ pub struct InstanceProperties { pub description: Option, /// Labels to apply to instances that are created from this template. pub labels: Option>, + /// The metadata key/value pairs to assign to instances that are created from this template. These pairs can consist of custom metadata or predefined keys. See Project and instance metadata for more information. + pub metadata: Option, /// Enables instances created based on this template to send packets with source IP addresses other than their own and receive packets with destination IP addresses other than their own. If these instances will be used as an IP gateway or it will be set as the next-hop in a Route resource, specify true. If unsure, leave this set to false. See the Enable IP forwarding documentation for more information. #[serde(rename="canIpForward")] pub can_ip_forward: Option, @@ -6849,11 +7573,12 @@ pub struct InstanceProperties { /// A list of service accounts with specified scopes. Access tokens for these service accounts are available to the instances that are created from this template. Use metadata queries to obtain the access tokens for these instances. #[serde(rename="serviceAccounts")] pub service_accounts: Option>, - /// The metadata key/value pairs to assign to instances that are created from this template. These pairs can consist of custom metadata or predefined keys. See Project and instance metadata for more information. - pub metadata: Option, /// An array of network access configurations for this interface. #[serde(rename="networkInterfaces")] pub network_interfaces: Option>, + /// no description provided + #[serde(rename="shieldedInstanceConfig")] + pub shielded_instance_config: Option, } impl Part for InstanceProperties {} @@ -7014,21 +7739,48 @@ impl NestedType for InstanceGroupManagerAggregatedListWarningData {} impl Part for InstanceGroupManagerAggregatedListWarningData {} +/// Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. +/// +/// If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. +/// +/// Example Policy with multiple AuditConfigs: +/// +/// { "audit_configs": [ { "service": "allServices" "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:foo@gmail.com" ] }, { "log_type": "DATA_WRITE", }, { "log_type": "ADMIN_READ", } ] }, { "service": "fooservice.googleapis.com" "audit_log_configs": [ { "log_type": "DATA_READ", }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:bar@gmail.com" ] } ] } ] } +/// +/// For fooservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts foo@gmail.com from DATA_READ logging, and bar@gmail.com from DATA_WRITE logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditConfig { + /// + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The configuration for logging of each type of permission. + #[serde(rename="auditLogConfigs")] + pub audit_log_configs: Option>, + /// Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all services. + pub service: Option, +} + +impl Part for AuditConfig {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RouterListWarningData { +pub struct NetworkEndpointGroupsScopedListWarningData { /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, } -impl NestedType for RouterListWarningData {} -impl Part for RouterListWarningData {} +impl NestedType for NetworkEndpointGroupsScopedListWarningData {} +impl Part for NetworkEndpointGroupsScopedListWarningData {} /// [Output Only] Informational warning message. @@ -7080,20 +7832,23 @@ pub struct HealthCheckList { impl ResponseResult for HealthCheckList {} -/// There is no detailed description. +/// Specifies what kind of log the caller must write /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InstanceGroupManagersScopedList { - /// [Output Only] The warning that replaces the list of managed instance groups when the list is empty. - pub warning: Option, - /// [Output Only] The list of managed instance groups that are contained in the specified project and zone. - #[serde(rename="instanceGroupManagers")] - pub instance_group_managers: Option>, +pub struct LogConfig { + /// Counter options. + pub counter: Option, + /// Data access options. + #[serde(rename="dataAccess")] + pub data_access: Option, + /// Cloud audit options. + #[serde(rename="cloudAudit")] + pub cloud_audit: Option, } -impl Part for InstanceGroupManagersScopedList {} +impl Part for LogConfig {} /// There is no detailed description. @@ -7102,7 +7857,7 @@ impl Part for InstanceGroupManagersScopedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct VpnTunnelsScopedList { - /// A list of vpn tunnels contained in this scope. + /// A list of VPN tunnels contained in this scope. #[serde(rename="vpnTunnels")] pub vpn_tunnels: Option>, /// Informational warning which replaces the list of addresses when the list is empty. @@ -7112,6 +7867,36 @@ pub struct VpnTunnelsScopedList { impl Part for VpnTunnelsScopedList {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list network endpoint groups](struct.NetworkEndpointGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroupList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] The resource type, which is always compute#networkEndpointGroupList for network endpoint group lists. + pub kind: Option, + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of NetworkEndpointGroup resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl ResponseResult for NetworkEndpointGroupList {} + + /// There is no detailed description. /// /// # Activities @@ -7138,15 +7923,16 @@ impl RequestValue for DisksResizeRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [delete interconnects](struct.InterconnectDeleteCall.html) (none) +/// * [get diagnostics interconnects](struct.InterconnectGetDiagnosticCall.html) (none) /// * [get interconnects](struct.InterconnectGetCall.html) (response) +/// * [delete interconnects](struct.InterconnectDeleteCall.html) (none) +/// * [insert interconnects](struct.InterconnectInsertCall.html) (request) /// * [patch interconnects](struct.InterconnectPatchCall.html) (request) /// * [list interconnects](struct.InterconnectListCall.html) (none) -/// * [insert interconnects](struct.InterconnectInsertCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Interconnect { - /// Type of link requested. This field indicates speed of each of the links in the bundle, not the entire bundle. Only 10G per link is allowed for a dedicated interconnect. Options: Ethernet_10G_LR + /// Type of link requested. This field indicates speed of each of the links in the bundle, not the entire bundle. #[serde(rename="linkType")] pub link_type: Option, /// Customer name, to put in the Letter of Authorization as the party authorized to request a crossconnect. @@ -7182,7 +7968,7 @@ pub struct Interconnect { /// [Output Only] IP address configured on the Google side of the Interconnect link. This can be used only for ping tests. #[serde(rename="googleIpAddress")] pub google_ip_address: Option, - /// [Output Only] Google reference ID; to be used when raising support tickets with Google or otherwise to debug backend connectivity issues. + /// [Output Only] Google reference ID to be used when raising support tickets with Google or otherwise to debug backend connectivity issues. #[serde(rename="googleReferenceId")] pub google_reference_id: Option, /// [Output Only] A list of outages expected for this Interconnect. @@ -7230,21 +8016,52 @@ impl NestedType for ForwardingRulesScopedListWarningData {} impl Part for ForwardingRulesScopedListWarningData {} -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// A list of Disk resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list disks](struct.DiskListCall.html) (response) +/// * [list region disks](struct.RegionDiskListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DiskList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] Type of resource. Always compute#diskList for lists of disks. + pub kind: Option, + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of Disk resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl ResponseResult for DiskList {} + + +/// Write a Cloud Audit log /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InterconnectListWarningData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, +pub struct LogConfigCloudAuditOptions { + /// The log_name to populate in the Cloud Audit Record. + #[serde(rename="logName")] + pub log_name: Option, + /// Information used by the Cloud Audit Logging pipeline. + #[serde(rename="authorizationLoggingOptions")] + pub authorization_logging_options: Option, } -impl NestedType for InterconnectListWarningData {} -impl Part for InterconnectListWarningData {} +impl Part for LogConfigCloudAuditOptions {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -7283,6 +8100,29 @@ pub struct InstancesSetMachineResourcesRequest { impl RequestValue for InstancesSetMachineResourcesRequest {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set iam policy node templates](struct.NodeTemplateSetIamPolicyCall.html) (request) +/// * [set iam policy subnetworks](struct.SubnetworkSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RegionSetPolicyRequest { + /// REQUIRED: The complete policy to be applied to the 'resource'. The size of the policy is limited to a few 10s of KB. An empty policy is in general a valid policy but certain services (like Projects) might reject them. + pub policy: Option, + /// Flatten Policy to create a backwacd compatible wire-format. Deprecated. Use 'policy' to specify bindings. + pub bindings: Option>, + /// Flatten Policy to create a backward compatible wire-format. Deprecated. Use 'policy' to specify the etag. + pub etag: Option, +} + +impl RequestValue for RegionSetPolicyRequest {} + + /// A SSL policy specifies the server-side support for SSL features. This can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects connections between clients and the HTTPS or SSL proxy load balancer. They do not affect the connection between the load balancers and the backends. /// /// # Activities @@ -7314,7 +8154,7 @@ pub struct SslPolicy { /// [Output Only] The list of features enabled in the SSL policy. #[serde(rename="enabledFeatures")] pub enabled_features: Option>, - /// Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a SslPolicy. An up-to-date fingerprint must be provided in order to update the SslPolicy. + /// Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a SslPolicy. An up-to-date fingerprint must be provided in order to update the SslPolicy, otherwise the request will fail with error 412 conditionNotMet. /// /// To see the latest fingerprint, make a get() request to retrieve an SslPolicy. pub fingerprint: Option, @@ -7355,7 +8195,7 @@ pub struct TargetSslProxy { /// Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. #[serde(rename="proxyHeader")] pub proxy_header: Option, - /// URLs to SslCertificate resources that are used to authenticate connections to Backends. Currently exactly one SSL certificate must be specified. + /// URLs to SslCertificate resources that are used to authenticate connections to Backends. At least one SSL certificate must be specified. Currently, you may specify up to 15 SSL certificates. #[serde(rename="sslCertificates")] pub ssl_certificates: Option>, /// URL of SslPolicy resource that will be associated with the TargetSslProxy resource. If not set, the TargetSslProxy resource will not have any SSL policy configured. @@ -7410,6 +8250,25 @@ pub struct MachineTypesScopedList { impl Part for MachineTypesScopedList {} +/// [Output Only] Informational warning message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetInstanceAggregatedListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for TargetInstanceAggregatedListWarning {} +impl Part for TargetInstanceAggregatedListWarning {} + + /// There is no detailed description. /// /// # Activities @@ -7437,7 +8296,7 @@ pub struct BackendBucketCdnPolicy { /// [Output Only] Names of the keys for signing request URLs. #[serde(rename="signedUrlKeyNames")] pub signed_url_key_names: Option>, - /// Maximum number of seconds the response to a signed URL request will be considered fresh. After this time period, the response will be revalidated before being served. Defaults to 1hr (3600s). When serving responses to signed URL requests, Cloud CDN will internally behave as though all responses from this backend had a ?Cache-Control: public, max-age=[TTL]? header, regardless of any existing Cache-Control header. The actual headers served in responses will not be altered. + /// Maximum number of seconds the response to a signed URL request will be considered fresh. After this time period, the response will be revalidated before being served. Defaults to 1hr (3600s). When serving responses to signed URL requests, Cloud CDN will internally behave as though all responses from this backend had a "Cache-Control: public, max-age=[TTL]" header, regardless of any existing Cache-Control header. The actual headers served in responses will not be altered. #[serde(rename="signedUrlCacheMaxAgeSec")] pub signed_url_cache_max_age_sec: Option, } @@ -7464,23 +8323,23 @@ pub struct ProjectsEnableXpnResourceRequest { impl RequestValue for ProjectsEnableXpnResourceRequest {} -/// The list of ALLOW rules specified by this firewall. Each rule specifies a protocol and port-range tuple that describes a permitted connection. +/// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct FirewallAllowed { - /// The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp), or the IP protocol number. - #[serde(rename="IPProtocol")] - pub ip_protocol: Option, - /// An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. - /// - /// Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. - pub ports: Option>, +pub struct ZoneListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, } -impl NestedType for FirewallAllowed {} -impl Part for FirewallAllowed {} +impl NestedType for ZoneListWarning {} +impl Part for ZoneListWarning {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -7795,14 +8654,17 @@ impl Part for UrlMapValidationResult {} pub struct NetworkPeering { /// [Output Only] State for the peering. pub state: Option, + /// The URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network. + pub network: Option, + /// This field will be deprecated soon. Prefer using exchange_subnet_routes instead. Indicates whether full mesh connectivity is created and managed automatically. When it is set to true, Google Compute Engine will automatically create and manage the routes between two networks when the state is ACTIVE. Otherwise, user needs to create routes manually to route packets to peer network. + #[serde(rename="autoCreateRoutes")] + pub auto_create_routes: Option, + /// Whether full mesh connectivity is created and managed automatically. When it is set to true, Google Compute Engine will automatically create and manage the routes between two networks when the peering state is ACTIVE. Otherwise, user needs to create routes manually to route packets to peer network. + #[serde(rename="exchangeSubnetRoutes")] + pub exchange_subnet_routes: Option, /// [Output Only] Details about the current state of the peering. #[serde(rename="stateDetails")] pub state_details: Option, - /// Whether full mesh connectivity is created and managed automatically. When it is set to true, Google Compute Engine will automatically create and manage the routes between two networks when the state is ACTIVE. Otherwise, user needs to create routes manually to route packets to peer network. - #[serde(rename="autoCreateRoutes")] - pub auto_create_routes: Option, - /// The URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network. - pub network: Option, /// Name of this peering. Provided by the client when the peering is created. The name must comply with RFC1035. Specifically, the name must be 1-63 characters long and match regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all the following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. pub name: Option, } @@ -7841,6 +8703,8 @@ pub struct InstanceGroupManagerActionsSummary { /// /// If you have disabled creation retries, this field will not be populated; instead, the creatingWithoutRetries field will be populated. pub creating: Option, + /// [Output Only] The number of instances in the managed instance group that are being verified. See the managedInstances[].currentAction property in the listManagedInstances method documentation. + pub verifying: Option, /// [Output Only] The number of instances in the managed instance group that are scheduled to be restarted or are currently being restarted. pub restarting: Option, /// [Output Only] The total number of instances in the managed instance group that are scheduled to be abandoned. Abandoning an instance removes it from the managed instance group without deleting it. @@ -7857,23 +8721,24 @@ pub struct InstanceGroupManagerActionsSummary { impl Part for InstanceGroupManagerActionsSummary {} -/// [Output Only] Informational warning which replaces the list of addresses when the list is empty. +/// The network endpoint. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetVpnGatewaysScopedListWarning { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, +pub struct NetworkEndpoint { + /// The name for a specific VM instance that the IP address belongs to. This is required for network endpoints of type GCE_VM_IP_PORT. The instance must be in the same zone of network endpoint group. + /// + /// The name must be 1-63 characters long, and comply with RFC1035. + pub instance: Option, + /// Optional IPv4 address of network endpoint. The IP address must belong to a VM in GCE (either the primary IP or as part of an aliased IP range). If the IP address is not specified, then the primary IP address for the VM instance in the network that the network endpoint group belongs to will be used. + #[serde(rename="ipAddress")] + pub ip_address: Option, + /// Optional port number of network endpoint. If not specified and the NetworkEndpointGroup.network_endpoint_type is GCE_IP_PORT, the defaultPort for the network endpoint group will be used. + pub port: Option, } -impl NestedType for TargetVpnGatewaysScopedListWarning {} -impl Part for TargetVpnGatewaysScopedListWarning {} +impl Part for NetworkEndpoint {} /// There is no detailed description. @@ -7914,7 +8779,8 @@ impl ResponseResult for TargetInstanceAggregatedList {} pub struct PathRule { /// The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here. pub paths: Option>, - /// The URL of the BackendService resource if this rule is matched. + /// The full or partial URL of the backend service resource to which traffic is directed if this rule is matched. If routeAction is additionally specified, advanced routing actions like URL Rewrites, etc. take effect prior to sending the request to the backend. However, if service is specified, routeAction cannot contain any weightedBackendService s. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. + /// Only one of urlRedirect, service or routeAction.weightedBackendService must be set. pub service: Option, } @@ -8061,26 +8927,26 @@ impl NestedType for DiskListWarningData {} impl Part for DiskListWarningData {} -/// There is no detailed description. +/// Contains a list of firewalls. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [aggregated list target vpn gateways](struct.TargetVpnGatewayAggregatedListCall.html) (response) +/// * [list firewalls](struct.FirewallListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetVpnGatewayAggregatedList { +pub struct FirewallList { /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// [Output Only] Type of resource. Always compute#targetVpnGateway for target VPN gateways. + /// [Output Only] Type of resource. Always compute#firewallList for lists of firewalls. pub kind: Option, /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of TargetVpnGateway resources. - pub items: Option>, + pub warning: Option, + /// A list of Firewall resources. + pub items: Option>, /// [Output Only] Unique identifier for the resource; defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. @@ -8088,7 +8954,7 @@ pub struct TargetVpnGatewayAggregatedList { pub self_link: Option, } -impl ResponseResult for TargetVpnGatewayAggregatedList {} +impl ResponseResult for FirewallList {} /// There is no detailed description. @@ -8103,7 +8969,7 @@ impl ResponseResult for TargetVpnGatewayAggregatedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceGroupReference { - /// A URI referencing one of the instance groups listed in the backend service. + /// A URI referencing one of the instance groups or network endpoint groups listed in the backend service. pub group: Option, } @@ -8264,34 +9130,23 @@ impl NestedType for InterconnectAttachmentsScopedListWarning {} impl Part for InterconnectAttachmentsScopedListWarning {} -/// There is no detailed description. +/// Message for the expected URL mappings. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [aggregated list autoscalers](struct.AutoscalerAggregatedListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AutoscalerAggregatedList { - /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// [Output Only] Type of resource. Always compute#autoscalerAggregatedList for aggregated lists of autoscalers. - pub kind: Option, - /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of AutoscalersScopedList resources. - pub items: Option>, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// [Output Only] Server-defined URL for this resource. - #[serde(rename="selfLink")] - pub self_link: Option, +pub struct UrlMapTest { + /// Path portion of the URL. + pub path: Option, + /// Host portion of the URL. + pub host: Option, + /// Description of this test case. + pub description: Option, + /// Expected BackendService resource the given URL should be mapped to. + pub service: Option, } -impl ResponseResult for AutoscalerAggregatedList {} +impl Part for UrlMapTest {} /// There is no detailed description. @@ -8514,12 +9369,14 @@ impl Part for ForwardingRulesScopedList {} /// * [patch autoscalers](struct.AutoscalerPatchCall.html) (response) /// * [resize instance group managers](struct.InstanceGroupManagerResizeCall.html) (response) /// * [delete instance templates](struct.InstanceTemplateDeleteCall.html) (response) +/// * [patch region instance group managers](struct.RegionInstanceGroupManagerPatchCall.html) (response) /// * [delete region backend services](struct.RegionBackendServiceDeleteCall.html) (response) /// * [delete interconnects](struct.InterconnectDeleteCall.html) (response) +/// * [update shielded instance config instances](struct.InstanceUpdateShieldedInstanceConfigCall.html) (response) /// * [patch firewalls](struct.FirewallPatchCall.html) (response) /// * [delete vpn tunnels](struct.VpnTunnelDeleteCall.html) (response) /// * [set labels region disks](struct.RegionDiskSetLabelCall.html) (response) -/// * [set machine type instances](struct.InstanceSetMachineTypeCall.html) (response) +/// * [delete backend services](struct.BackendServiceDeleteCall.html) (response) /// * [delete https health checks](struct.HttpsHealthCheckDeleteCall.html) (response) /// * [delete node groups](struct.NodeGroupDeleteCall.html) (response) /// * [delete ssl policies](struct.SslPolicyDeleteCall.html) (response) @@ -8551,10 +9408,10 @@ impl Part for ForwardingRulesScopedList {} /// * [set instance template instance group managers](struct.InstanceGroupManagerSetInstanceTemplateCall.html) (response) /// * [set node template node groups](struct.NodeGroupSetNodeTemplateCall.html) (response) /// * [delete region autoscalers](struct.RegionAutoscalerDeleteCall.html) (response) +/// * [insert security policies](struct.SecurityPolicyInsertCall.html) (response) /// * [remove peering networks](struct.NetworkRemovePeeringCall.html) (response) /// * [patch ssl policies](struct.SslPolicyPatchCall.html) (response) /// * [delete interconnect attachments](struct.InterconnectAttachmentDeleteCall.html) (response) -/// * [delete networks](struct.NetworkDeleteCall.html) (response) /// * [insert target pools](struct.TargetPoolInsertCall.html) (response) /// * [insert node templates](struct.NodeTemplateInsertCall.html) (response) /// * [disable xpn resource projects](struct.ProjectDisableXpnResourceCall.html) (response) @@ -8569,13 +9426,13 @@ impl Part for ForwardingRulesScopedList {} /// * [remove health check target pools](struct.TargetPoolRemoveHealthCheckCall.html) (response) /// * [set url map target https proxies](struct.TargetHttpsProxySetUrlMapCall.html) (response) /// * [create snapshot region disks](struct.RegionDiskCreateSnapshotCall.html) (response) -/// * [delete backend services](struct.BackendServiceDeleteCall.html) (response) +/// * [set machine type instances](struct.InstanceSetMachineTypeCall.html) (response) /// * [update network interface instances](struct.InstanceUpdateNetworkInterfaceCall.html) (response) /// * [insert url maps](struct.UrlMapInsertCall.html) (response) /// * [add access config instances](struct.InstanceAddAccessConfigCall.html) (response) /// * [set machine resources instances](struct.InstanceSetMachineResourceCall.html) (response) /// * [update access config instances](struct.InstanceUpdateAccessConfigCall.html) (response) -/// * [insert security policies](struct.SecurityPolicyInsertCall.html) (response) +/// * [delete networks](struct.NetworkDeleteCall.html) (response) /// * [insert addresses](struct.AddresseInsertCall.html) (response) /// * [insert health checks](struct.HealthCheckInsertCall.html) (response) /// * [insert global forwarding rules](struct.GlobalForwardingRuleInsertCall.html) (response) @@ -8613,6 +9470,7 @@ impl Part for ForwardingRulesScopedList {} /// * [add instances instance groups](struct.InstanceGroupAddInstanceCall.html) (response) /// * [abandon instances instance group managers](struct.InstanceGroupManagerAbandonInstanceCall.html) (response) /// * [set tags instances](struct.InstanceSetTagCall.html) (response) +/// * [attach network endpoints network endpoint groups](struct.NetworkEndpointGroupAttachNetworkEndpointCall.html) (response) /// * [delete snapshots](struct.SnapshotDeleteCall.html) (response) /// * [insert target https proxies](struct.TargetHttpsProxyInsertCall.html) (response) /// * [add nodes node groups](struct.NodeGroupAddNodeCall.html) (response) @@ -8620,6 +9478,7 @@ impl Part for ForwardingRulesScopedList {} /// * [update backend services](struct.BackendServiceUpdateCall.html) (response) /// * [delete nodes node groups](struct.NodeGroupDeleteNodeCall.html) (response) /// * [delete licenses](struct.LicenseDeleteCall.html) (response) +/// * [patch instance group managers](struct.InstanceGroupManagerPatchCall.html) (response) /// * [patch subnetworks](struct.SubnetworkPatchCall.html) (response) /// * [set ssl policy target https proxies](struct.TargetHttpsProxySetSslPolicyCall.html) (response) /// * [attach disk instances](struct.InstanceAttachDiskCall.html) (response) @@ -8631,6 +9490,7 @@ impl Part for ForwardingRulesScopedList {} /// * [insert licenses](struct.LicenseInsertCall.html) (response) /// * [patch backend services](struct.BackendServicePatchCall.html) (response) /// * [set url map target http proxies](struct.TargetHttpProxySetUrlMapCall.html) (response) +/// * [delete network endpoint groups](struct.NetworkEndpointGroupDeleteCall.html) (response) /// * [delete region instance group managers](struct.RegionInstanceGroupManagerDeleteCall.html) (response) /// * [deprecate images](struct.ImageDeprecateCall.html) (response) /// * [patch http health checks](struct.HttpHealthCheckPatchCall.html) (response) @@ -8658,6 +9518,7 @@ impl Part for ForwardingRulesScopedList {} /// * [stop instances](struct.InstanceStopCall.html) (response) /// * [add instance target pools](struct.TargetPoolAddInstanceCall.html) (response) /// * [remove instance target pools](struct.TargetPoolRemoveInstanceCall.html) (response) +/// * [detach network endpoints network endpoint groups](struct.NetworkEndpointGroupDetachNetworkEndpointCall.html) (response) /// * [delete target pools](struct.TargetPoolDeleteCall.html) (response) /// * [update firewalls](struct.FirewallUpdateCall.html) (response) /// * [insert instances](struct.InstanceInsertCall.html) (response) @@ -8682,6 +9543,7 @@ impl Part for ForwardingRulesScopedList {} /// * [insert backend services](struct.BackendServiceInsertCall.html) (response) /// * [set labels instances](struct.InstanceSetLabelCall.html) (response) /// * [update region backend services](struct.RegionBackendServiceUpdateCall.html) (response) +/// * [set shielded instance integrity policy instances](struct.InstanceSetShieldedInstanceIntegrityPolicyCall.html) (response) /// * [delete target http proxies](struct.TargetHttpProxyDeleteCall.html) (response) /// * [patch backend buckets](struct.BackendBucketPatchCall.html) (response) /// * [delete global addresses](struct.GlobalAddresseDeleteCall.html) (response) @@ -8707,6 +9569,7 @@ impl Part for ForwardingRulesScopedList {} /// * [start with encryption key instances](struct.InstanceStartWithEncryptionKeyCall.html) (response) /// * [set min cpu platform instances](struct.InstanceSetMinCpuPlatformCall.html) (response) /// * [delete forwarding rules](struct.ForwardingRuleDeleteCall.html) (response) +/// * [insert network endpoint groups](struct.NetworkEndpointGroupInsertCall.html) (response) /// * [update backend buckets](struct.BackendBucketUpdateCall.html) (response) /// * [insert region instance group managers](struct.RegionInstanceGroupManagerInsertCall.html) (response) /// * [delete firewalls](struct.FirewallDeleteCall.html) (response) @@ -8788,9 +9651,12 @@ impl ResponseResult for Operation {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [insert disks](struct.DiskInsertCall.html) (request) +/// * [set iam policy disks](struct.DiskSetIamPolicyCall.html) (none) /// * [delete disks](struct.DiskDeleteCall.html) (none) /// * [resize disks](struct.DiskResizeCall.html) (none) +/// * [test iam permissions disks](struct.DiskTestIamPermissionCall.html) (none) /// * [get disks](struct.DiskGetCall.html) (response) +/// * [get iam policy disks](struct.DiskGetIamPolicyCall.html) (none) /// * [insert region disks](struct.RegionDiskInsertCall.html) (request) /// * [create snapshot disks](struct.DiskCreateSnapshotCall.html) (none) /// * [set labels disks](struct.DiskSetLabelCall.html) (none) @@ -8821,7 +9687,7 @@ pub struct Disk { /// If you specify this field along with sourceImage or sourceSnapshot, the value of sizeGb must not be less than the size of the sourceImage or the size of the snapshot. Acceptable values are 1 to 65536, inclusive. #[serde(rename="sizeGb")] pub size_gb: Option, - /// A fingerprint for the labels being applied to this disk, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. + /// A fingerprint for the labels being applied to this disk, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. /// /// To see the latest fingerprint, make a get() request to retrieve a disk. #[serde(rename="labelFingerprint")] @@ -8869,6 +9735,9 @@ pub struct Disk { pub zone: Option, /// [Output Only] URL of the region where the disk resides. Only applicable for regional resources. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. pub region: Option, + /// Physical block size of the persistent disk, in bytes. If not present in a request, a default value is used. Currently supported sizes are 4096 and 16384, other sizes may be added in the future. If an unsupported value is requested, the error message will list the supported values for the caller's project. + #[serde(rename="physicalBlockSizeBytes")] + pub physical_block_size_bytes: Option, /// [Output Only] Last attach timestamp in RFC3339 text format. #[serde(rename="lastAttachTimestamp")] pub last_attach_timestamp: Option, @@ -8925,34 +9794,51 @@ impl NestedType for VpnTunnelsScopedListWarningData {} impl Part for VpnTunnelsScopedListWarningData {} -/// A list of TargetHttpProxy resources. +/// A TargetHttpsProxy resource. This resource defines an HTTPS proxy. (== resource_for beta.targetHttpsProxies ==) (== resource_for v1.targetHttpsProxies ==) /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list target http proxies](struct.TargetHttpProxyListCall.html) (response) +/// * [get target https proxies](struct.TargetHttpsProxyGetCall.html) (response) +/// * [insert target https proxies](struct.TargetHttpsProxyInsertCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetHttpProxyList { - /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Type of resource. Always compute#targetHttpProxyList for lists of target HTTP proxies. +pub struct TargetHttpsProxy { + /// [Output Only] Type of resource. Always compute#targetHttpsProxy for target HTTPS proxies. pub kind: Option, - /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of TargetHttpProxy resources. - pub items: Option>, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// An optional description of this resource. Provide this property when you create the resource. + pub description: Option, + /// URLs to SslCertificate resources that are used to authenticate connections between users and the load balancer. At least one SSL certificate must be specified. Currently, you may specify up to 15 SSL certificates. + #[serde(rename="sslCertificates")] + pub ssl_certificates: Option>, + /// URL of SslPolicy resource that will be associated with the TargetHttpsProxy resource. If not set, the TargetHttpsProxy resource will not have any SSL policy configured. + #[serde(rename="sslPolicy")] + pub ssl_policy: Option, + /// Specifies the QUIC override policy for this TargetHttpsProxy resource. This determines whether the load balancer will attempt to negotiate QUIC with clients or not. Can specify one of NONE, ENABLE, or DISABLE. Specify ENABLE to always enable QUIC, Enables QUIC when set to ENABLE, and disables QUIC when set to DISABLE. If NONE is specified, uses the QUIC policy with no user overrides, which is equivalent to DISABLE. Not specifying this field is equivalent to specifying NONE. + #[serde(rename="quicOverride")] + pub quic_override: Option, + /// A fully-qualified or valid partial URL to the UrlMap resource that defines the mapping from URL to the BackendService. For example, the following are all valid URLs for specifying a URL map: + /// - https://www.googleapis.compute/v1/projects/project/global/urlMaps/url-map + /// - projects/project/global/urlMaps/url-map + /// - global/urlMaps/url-map + #[serde(rename="urlMap")] + pub url_map: Option, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, - /// [Output Only] Server-defined URL for this resource. + /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, + /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, } -impl ResponseResult for TargetHttpProxyList {} +impl RequestValue for TargetHttpsProxy {} +impl ResponseResult for TargetHttpsProxy {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -8985,7 +9871,7 @@ impl Part for NodeTemplatesScopedListWarningData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SecurityPolicyRule { - /// An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated in the increasing order of priority. + /// An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest prority. pub priority: Option, /// [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules pub kind: Option, @@ -9009,18 +9895,18 @@ impl ResponseResult for SecurityPolicyRule {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InterconnectLocationListWarning { +pub struct RegionInstanceGroupManagerListWarning { /// [Output Only] A human-readable description of the warning code. pub message: Option, /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, + pub data: Option>, } -impl NestedType for InterconnectLocationListWarning {} -impl Part for InterconnectLocationListWarning {} +impl NestedType for RegionInstanceGroupManagerListWarning {} +impl Part for RegionInstanceGroupManagerListWarning {} /// Represents a Network resource. Read Virtual Private Cloud (VPC) Network Overview for more information. (== resource_for v1.networks ==) (== resource_for beta.networks ==) @@ -9051,7 +9937,7 @@ pub struct Network { pub subnetworks: Option>, /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, - /// The range of internal addresses that are legal on this network. This range is a CIDR specification, for example: 192.168.0.0/16. Provided by the client when the network is created. + /// Deprecated in favor of subnet mode networks. The range of internal addresses that are legal on this network. This range is a CIDR specification, for example: 192.168.0.0/16. Provided by the client when the network is created. #[serde(rename="IPv4Range")] pub i_pv4_range: Option, /// [Output Only] The gateway address for default routing out of the network. This value is read only and is selected by GCP. @@ -9121,6 +10007,25 @@ impl Resource for Zone {} impl ResponseResult for Zone {} +/// [Output Only] Informational warning message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LicensesListResponseWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for LicensesListResponseWarning {} +impl Part for LicensesListResponseWarning {} + + /// An access configuration attached to an instance's network interface. Only one access config per instance is supported. /// /// # Activities @@ -9375,51 +10280,20 @@ pub struct InstanceGroupsAddInstancesRequest { impl RequestValue for InstanceGroupsAddInstancesRequest {} -/// Represents a Target VPN gateway resource. (== resource_for beta.targetVpnGateways ==) (== resource_for v1.targetVpnGateways ==) +/// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [delete target vpn gateways](struct.TargetVpnGatewayDeleteCall.html) (none) -/// * [aggregated list target vpn gateways](struct.TargetVpnGatewayAggregatedListCall.html) (none) -/// * [get target vpn gateways](struct.TargetVpnGatewayGetCall.html) (response) -/// * [insert target vpn gateways](struct.TargetVpnGatewayInsertCall.html) (request) -/// * [list target vpn gateways](struct.TargetVpnGatewayListCall.html) (none) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetVpnGateway { - /// [Output Only] The status of the VPN gateway. - pub status: Option, - /// [Output Only] Type of resource. Always compute#targetVpnGateway for target VPN gateways. - pub kind: Option, - /// An optional description of this resource. Provide this property when you create the resource. - pub description: Option, - /// [Output Only] URL of the region where the target VPN gateway resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. - pub region: Option, - /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, - /// [Output Only] A list of URLs to the ForwardingRule resources. ForwardingRules are created using compute.forwardingRules.insert and associated to a VPN gateway. - #[serde(rename="forwardingRules")] - pub forwarding_rules: Option>, - /// [Output Only] Server-defined URL for the resource. - #[serde(rename="selfLink")] - pub self_link: Option, - /// [Output Only] Creation timestamp in RFC3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. - pub id: Option, - /// [Output Only] A list of URLs to VpnTunnel resources. VpnTunnels are created using compute.vpntunnels.insert method and associated to a VPN gateway. - pub tunnels: Option>, - /// URL of the network to which this VPN gateway is attached. Provided by the client when the VPN gateway is created. - pub network: Option, +pub struct BackendServicesScopedList { + /// Informational warning which replaces the list of backend services when the list is empty. + pub warning: Option, + /// A list of BackendServices contained in this scope. + #[serde(rename="backendServices")] + pub backend_services: Option>, } -impl RequestValue for TargetVpnGateway {} -impl Resource for TargetVpnGateway {} -impl ResponseResult for TargetVpnGateway {} +impl Part for BackendServicesScopedList {} /// There is no detailed description. @@ -9516,6 +10390,55 @@ impl NestedType for InstanceTemplateListWarningData {} impl Part for InstanceTemplateListWarningData {} +/// A license resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get iam policy licenses](struct.LicenseGetIamPolicyCall.html) (none) +/// * [get licenses](struct.LicenseGetCall.html) (response) +/// * [set iam policy licenses](struct.LicenseSetIamPolicyCall.html) (none) +/// * [list licenses](struct.LicenseListCall.html) (none) +/// * [insert licenses](struct.LicenseInsertCall.html) (request) +/// * [delete licenses](struct.LicenseDeleteCall.html) (none) +/// * [test iam permissions licenses](struct.LicenseTestIamPermissionCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct License { + /// [Output Only] Type of resource. Always compute#license for licenses. + pub kind: Option, + /// An optional textual description of the resource; provided by the client when the resource is created. + pub description: Option, + /// [Output Only] Deprecated. This field no longer reflects whether a license charges a usage fee. + #[serde(rename="chargesUseFee")] + pub charges_use_fee: Option, + /// [Output Only] The unique code used to attach this license to images, snapshots, and disks. + #[serde(rename="licenseCode")] + pub license_code: Option, + /// If false, licenses will not be copied from the source resource when creating an image from a disk, disk from snapshot, or snapshot from disk. + pub transferable: Option, + /// no description provided + #[serde(rename="resourceRequirements")] + pub resource_requirements: Option, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for the resource. + #[serde(rename="selfLink")] + pub self_link: Option, + /// Name of the resource. The name must be 1-63 characters long and comply with RFC1035. + pub name: Option, +} + +impl RequestValue for License {} +impl Resource for License {} +impl ResponseResult for License {} + + /// There is no detailed description. /// /// # Activities @@ -9587,34 +10510,31 @@ pub struct InstanceGroupManagerAggregatedList { impl ResponseResult for InstanceGroupManagerAggregatedList {} -/// Contains a list of disk types. +/// There is no detailed description. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list disk types](struct.DiskTypeListCall.html) (response) +/// * [list network endpoints network endpoint groups](struct.NetworkEndpointGroupListNetworkEndpointCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DiskTypeList { +pub struct NetworkEndpointGroupsListNetworkEndpoints { /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// [Output Only] Type of resource. Always compute#diskTypeList for disk types. + /// A list of NetworkEndpointWithHealthStatus resources. + pub items: Option>, + /// [Output Only] The resource type, which is always compute#networkEndpointGroupsListNetworkEndpoints for the list of network endpoints in the specified network endpoint group. pub kind: Option, /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of DiskType resources. - pub items: Option>, + pub warning: Option, /// [Output Only] Unique identifier for the resource; defined by the server. pub id: Option, - /// [Output Only] Server-defined URL for this resource. - #[serde(rename="selfLink")] - pub self_link: Option, } -impl ResponseResult for DiskTypeList {} +impl ResponseResult for NetworkEndpointGroupsListNetworkEndpoints {} /// Contains a list of instances. @@ -9647,6 +10567,31 @@ pub struct InstanceList { impl ResponseResult for InstanceList {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set iam policy images](struct.ImageSetIamPolicyCall.html) (request) +/// * [set iam policy snapshots](struct.SnapshotSetIamPolicyCall.html) (request) +/// * [set iam policy instance templates](struct.InstanceTemplateSetIamPolicyCall.html) (request) +/// * [set iam policy licenses](struct.LicenseSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GlobalSetPolicyRequest { + /// REQUIRED: The complete policy to be applied to the 'resource'. The size of the policy is limited to a few 10s of KB. An empty policy is in general a valid policy but certain services (like Projects) might reject them. + pub policy: Option, + /// Flatten Policy to create a backward compatible wire-format. Deprecated. Use 'policy' to specify bindings. + pub bindings: Option>, + /// Flatten Policy to create a backward compatible wire-format. Deprecated. Use 'policy' to specify the etag. + pub etag: Option, +} + +impl RequestValue for GlobalSetPolicyRequest {} + + /// An HttpsHealthCheck resource. This resource defines a template for how individual instances should be checked for health, via HTTPS. /// /// # Activities @@ -9775,6 +10720,29 @@ impl Resource for SslCertificate {} impl ResponseResult for SslCertificate {} +/// Represents an expression text. Example: +/// +/// title: "User account presence" description: "Determines whether the request has a user account" expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in Common Expression Language syntax. + /// + /// The application context of the containing message determines which well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. + pub title: Option, +} + +impl Part for Expr {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// @@ -9866,34 +10834,20 @@ pub struct TargetHttpsProxiesSetSslCertificatesRequest { impl RequestValue for TargetHttpsProxiesSetSslCertificatesRequest {} -/// A list of instance templates. +/// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list instance templates](struct.InstanceTemplateListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InstanceTemplateList { - /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// [Output Only] The resource type, which is always compute#instanceTemplatesListResponse for instance template lists. - pub kind: Option, - /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of InstanceTemplate resources. - pub items: Option>, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// [Output Only] Server-defined URL for this resource. - #[serde(rename="selfLink")] - pub self_link: Option, +pub struct CustomerEncryptionKeyProtectedDisk { + /// Decrypts data associated with the disk with a customer-supplied encryption key. + #[serde(rename="diskEncryptionKey")] + pub disk_encryption_key: Option, + /// Specifies a valid partial or full URL to an existing Persistent Disk resource. This field is only applicable for persistent disks. + pub source: Option, } -impl ResponseResult for InstanceTemplateList {} +impl Part for CustomerEncryptionKeyProtectedDisk {} /// Contains a list of HttpHealthCheck resources. @@ -9964,7 +10918,7 @@ pub struct AttachedDisk { pub disk_encryption_key: Option, /// Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance. /// - /// If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disks-x, where x is a number assigned by Google Compute Engine. This field is only applicable for persistent disks. + /// If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disk-x, where x is a number assigned by Google Compute Engine. This field is only applicable for persistent disks. #[serde(rename="deviceName")] pub device_name: Option, /// [Output Only] Type of the resource. Always compute#attachedDisk for attached disks. @@ -10004,6 +10958,36 @@ pub struct AttachedDisk { impl RequestValue for AttachedDisk {} +/// Response to the list request, and contains a list of interconnect locations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list interconnect locations](struct.InterconnectLocationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InterconnectLocationList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] Type of resource. Always compute#interconnectLocationList for lists of interconnect locations. + pub kind: Option, + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of InterconnectLocation resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl ResponseResult for InterconnectLocationList {} + + /// An HealthCheck resource. This resource defines a template for how individual virtual machines should be checked for health, via one of the supported protocols. /// /// # Activities @@ -10020,36 +11004,41 @@ impl RequestValue for AttachedDisk {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct HealthCheck { - /// Type of the resource. - pub kind: Option, /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// How long (in seconds) to wait before claiming failure. The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. #[serde(rename="timeoutSec")] pub timeout_sec: Option, - /// [Output Only] Creation timestamp in 3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// How often (in seconds) to send a health check. The default value is 5 seconds. - #[serde(rename="checkIntervalSec")] - pub check_interval_sec: Option, /// no description provided #[serde(rename="httpHealthCheck")] pub http_health_check: Option, + /// A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. + #[serde(rename="unhealthyThreshold")] + pub unhealthy_threshold: Option, + /// no description provided + #[serde(rename="http2HealthCheck")] + pub http2_health_check: Option, + /// no description provided + #[serde(rename="httpsHealthCheck")] + pub https_health_check: Option, + /// [Output Only] Creation timestamp in 3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// Type of the resource. + pub kind: Option, + /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, + /// How often (in seconds) to send a health check. The default value is 5 seconds. + #[serde(rename="checkIntervalSec")] + pub check_interval_sec: Option, /// no description provided #[serde(rename="tcpHealthCheck")] pub tcp_health_check: Option, /// A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. #[serde(rename="healthyThreshold")] pub healthy_threshold: Option, - /// no description provided - #[serde(rename="httpsHealthCheck")] - pub https_health_check: Option, - /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. - pub id: Option, - /// A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. - #[serde(rename="unhealthyThreshold")] - pub unhealthy_threshold: Option, /// Specifies the type of the healthCheck, either TCP, SSL, HTTP or HTTPS. If not specified, the default is TCP. Exactly one of the protocol-specific health check field must be specified, which must match type field. #[serde(rename="type")] pub type_: Option, @@ -10059,8 +11048,6 @@ pub struct HealthCheck { /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, } impl RequestValue for HealthCheck {} @@ -10077,7 +11064,7 @@ pub struct BackendServiceCdnPolicy { /// [Output Only] Names of the keys for signing request URLs. #[serde(rename="signedUrlKeyNames")] pub signed_url_key_names: Option>, - /// Maximum number of seconds the response to a signed URL request will be considered fresh. After this time period, the response will be revalidated before being served. Defaults to 1hr (3600s). When serving responses to signed URL requests, Cloud CDN will internally behave as though all responses from this backend had a ?Cache-Control: public, max-age=[TTL]? header, regardless of any existing Cache-Control header. The actual headers served in responses will not be altered. + /// Maximum number of seconds the response to a signed URL request will be considered fresh. After this time period, the response will be revalidated before being served. Defaults to 1hr (3600s). When serving responses to signed URL requests, Cloud CDN will internally behave as though all responses from this backend had a "Cache-Control: public, max-age=[TTL]" header, regardless of any existing Cache-Control header. The actual headers served in responses will not be altered. #[serde(rename="signedUrlCacheMaxAgeSec")] pub signed_url_cache_max_age_sec: Option, /// The CacheKeyPolicy for this CdnPolicy. @@ -10088,6 +11075,20 @@ pub struct BackendServiceCdnPolicy { impl Part for BackendServiceCdnPolicy {} +/// Configuration parameters of autoscaling based on load balancing. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AutoscalingPolicyLoadBalancingUtilization { + /// Fraction of backend capacity utilization (set in HTTP(S) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8. + #[serde(rename="utilizationTarget")] + pub utilization_target: Option, +} + +impl Part for AutoscalingPolicyLoadBalancingUtilization {} + + /// A Node Template resource. /// /// # Activities @@ -10095,11 +11096,14 @@ impl Part for BackendServiceCdnPolicy {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list node templates](struct.NodeTemplateListCall.html) (none) /// * [aggregated list node templates](struct.NodeTemplateAggregatedListCall.html) (none) -/// * [delete node templates](struct.NodeTemplateDeleteCall.html) (none) /// * [get node templates](struct.NodeTemplateGetCall.html) (response) +/// * [list node templates](struct.NodeTemplateListCall.html) (none) +/// * [delete node templates](struct.NodeTemplateDeleteCall.html) (none) +/// * [test iam permissions node templates](struct.NodeTemplateTestIamPermissionCall.html) (none) /// * [insert node templates](struct.NodeTemplateInsertCall.html) (request) +/// * [set iam policy node templates](struct.NodeTemplateSetIamPolicyCall.html) (none) +/// * [get iam policy node templates](struct.NodeTemplateGetIamPolicyCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct NodeTemplate { @@ -10133,7 +11137,7 @@ pub struct NodeTemplate { /// [Output Only] An optional, human-readable explanation of the status. #[serde(rename="statusMessage")] pub status_message: Option, - /// The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last charaicter, which cannot be a dash. + /// The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. pub name: Option, } @@ -10228,6 +11232,29 @@ pub struct TargetPoolAggregatedList { impl ResponseResult for TargetPoolAggregatedList {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HealthStatusForNetworkEndpoint { + /// URL of the forwarding rule associated with the health state of the network endpoint. + #[serde(rename="forwardingRule")] + pub forwarding_rule: Option, + /// Health state of the network endpoint determined based on the health checks configured. + #[serde(rename="healthState")] + pub health_state: Option, + /// URL of the backend service associated with the health state of the network endpoint. + #[serde(rename="backendService")] + pub backend_service: Option, + /// URL of the health check associated with the health state of the network endpoint. + #[serde(rename="healthCheck")] + pub health_check: Option, +} + +impl Part for HealthStatusForNetworkEndpoint {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// @@ -10256,7 +11283,10 @@ impl Part for ZoneListWarningData {} /// * [expand ip cidr range subnetworks](struct.SubnetworkExpandIpCidrRangeCall.html) (none) /// * [aggregated list subnetworks](struct.SubnetworkAggregatedListCall.html) (none) /// * [list usable subnetworks](struct.SubnetworkListUsableCall.html) (none) +/// * [get iam policy subnetworks](struct.SubnetworkGetIamPolicyCall.html) (none) /// * [insert subnetworks](struct.SubnetworkInsertCall.html) (request) +/// * [test iam permissions subnetworks](struct.SubnetworkTestIamPermissionCall.html) (none) +/// * [set iam policy subnetworks](struct.SubnetworkSetIamPolicyCall.html) (none) /// * [get subnetworks](struct.SubnetworkGetCall.html) (response) /// * [delete subnetworks](struct.SubnetworkDeleteCall.html) (none) /// * [list subnetworks](struct.SubnetworkListCall.html) (none) @@ -10280,7 +11310,7 @@ pub struct Subnetwork { /// Whether to enable flow logging for this subnetwork. If this field is not explicitly set, it will not appear in get listings. If not set the default behavior is to disable flow logging. #[serde(rename="enableFlowLogs")] pub enable_flow_logs: Option, - /// Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a Subnetwork. An up-to-date fingerprint must be provided in order to update the Subnetwork. + /// Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a Subnetwork. An up-to-date fingerprint must be provided in order to update the Subnetwork, otherwise the request will fail with error 412 conditionNotMet. /// /// To see the latest fingerprint, make a get() request to retrieve a Subnetwork. pub fingerprint: Option, @@ -10293,7 +11323,7 @@ pub struct Subnetwork { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange of the subnetwork. The alias IPs may belong to either primary or secondary ranges. + /// An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange of the subnetwork. The alias IPs may belong to either primary or secondary ranges. This field can be updated with a patch request. #[serde(rename="secondaryIpRanges")] pub secondary_ip_ranges: Option>, /// [Output Only] Server-defined URL for the resource. @@ -10325,34 +11355,44 @@ impl NestedType for NetworkListWarningData {} impl Part for NetworkListWarningData {} -/// Contains a list of Route resources. +/// An Accelerator Type resource. (== resource_for beta.acceleratorTypes ==) (== resource_for v1.acceleratorTypes ==) /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list routes](struct.RouteListCall.html) (response) +/// * [list accelerator types](struct.AcceleratorTypeListCall.html) (none) +/// * [get accelerator types](struct.AcceleratorTypeGetCall.html) (response) +/// * [aggregated list accelerator types](struct.AcceleratorTypeAggregatedListCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RouteList { - /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Type of resource. +pub struct AcceleratorType { + /// [Output Only] The type of the resource. Always compute#acceleratorType for accelerator types. pub kind: Option, - /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of Route resources. - pub items: Option>, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] An optional textual description of the resource. + pub description: Option, + /// [Output Only] The name of the zone where the accelerator type resides, such as us-central1-a. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. + pub zone: Option, + /// [Output Only] The deprecation status associated with this accelerator type. + pub deprecated: Option, + /// [Output Only] Maximum accelerator cards allowed per instance. + #[serde(rename="maximumCardsPerInstance")] + pub maximum_cards_per_instance: Option, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, - /// [Output Only] Server-defined URL for this resource. + /// [Output Only] Server-defined fully-qualified URL for this resource. #[serde(rename="selfLink")] pub self_link: Option, + /// [Output Only] Name of the resource. + pub name: Option, } -impl ResponseResult for RouteList {} +impl Resource for AcceleratorType {} +impl ResponseResult for AcceleratorType {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -10408,6 +11448,25 @@ pub struct CacheInvalidationRule { impl RequestValue for CacheInvalidationRule {} +/// Diagnostics information about interconnect, contains detailed and current technical information about Google?s side of the connection. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InterconnectDiagnostics { + /// The MAC address of the Interconnect's bundle interface. + #[serde(rename="macAddress")] + pub mac_address: Option, + /// A list of InterconnectDiagnostics.ARPEntry objects, describing individual neighbors currently seen by the Google router in the ARP cache for the Interconnect. This will be empty when the Interconnect is not bundled. + #[serde(rename="arpCaches")] + pub arp_caches: Option>, + /// A list of InterconnectDiagnostics.LinkStatus objects, describing the status for each link on the Interconnect. + pub links: Option>, +} + +impl Part for InterconnectDiagnostics {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -10465,7 +11524,10 @@ impl ResponseResult for XpnHostList {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [delete images](struct.ImageDeleteCall.html) (none) +/// * [set iam policy images](struct.ImageSetIamPolicyCall.html) (none) /// * [insert images](struct.ImageInsertCall.html) (request) +/// * [test iam permissions images](struct.ImageTestIamPermissionCall.html) (none) +/// * [get iam policy images](struct.ImageGetIamPolicyCall.html) (none) /// * [get images](struct.ImageGetCall.html) (response) /// * [get from family images](struct.ImageGetFromFamilyCall.html) (response) /// * [set labels images](struct.ImageSetLabelCall.html) (none) @@ -10493,7 +11555,7 @@ pub struct Image { pub description: Option, /// The name of the image family to which this image belongs. You can create disks by specifying an image family instead of a specific image name. The image family always returns its latest image that is not deprecated. The name of the image family must comply with RFC1035. pub family: Option, - /// A fingerprint for the labels being applied to this image, which is essentially a hash of the labels used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. + /// A fingerprint for the labels being applied to this image, which is essentially a hash of the labels used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. /// /// To see the latest fingerprint, make a get() request to retrieve an image. #[serde(rename="labelFingerprint")] @@ -10574,35 +11636,26 @@ impl Resource for Image {} impl ResponseResult for Image {} -/// A list of Disk resources. +/// A set of instance tags. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list disks](struct.DiskListCall.html) (response) -/// * [list region disks](struct.RegionDiskListCall.html) (response) +/// * [set tags instances](struct.InstanceSetTagCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DiskList { - /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// [Output Only] Type of resource. Always compute#diskList for lists of disks. - pub kind: Option, - /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of Disk resources. - pub items: Option>, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// [Output Only] Server-defined URL for this resource. - #[serde(rename="selfLink")] - pub self_link: Option, +pub struct Tags { + /// An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. + pub items: Option>, + /// Specifies a fingerprint for this request, which is essentially a hash of the tags' contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update tags. You must always provide an up-to-date fingerprint hash in order to update or change tags. + /// + /// To see the latest fingerprint, make get() request to the instance. + pub fingerprint: Option, } -impl ResponseResult for DiskList {} +impl RequestValue for Tags {} /// The parameters of the raw disk image. @@ -10616,7 +11669,7 @@ pub struct ImageRawDisk { pub container_type: Option, /// The full Google Cloud Storage URL where the disk image is stored. You must provide either this property or the sourceDisk property but not both. pub source: Option, - /// An optional SHA1 checksum of the disk image before unpackaging; provided by the client when the disk image is created. + /// An optional SHA1 checksum of the disk image before unpackaging provided by the client when the disk image is created. #[serde(rename="sha1Checksum")] pub sha1_checksum: Option, } @@ -10692,6 +11745,25 @@ pub struct AutoscalingPolicy { impl Part for AutoscalingPolicy {} +/// [Output Only] Informational warning message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VmEndpointNatMappingsListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for VmEndpointNatMappingsListWarning {} +impl Part for VmEndpointNatMappingsListWarning {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// @@ -10709,65 +11781,54 @@ impl NestedType for OperationsScopedListWarningData {} impl Part for OperationsScopedListWarningData {} -/// A TargetHttpsProxy resource. This resource defines an HTTPS proxy. (== resource_for beta.targetHttpsProxies ==) (== resource_for v1.targetHttpsProxies ==) +/// A list of TargetHttpProxy resources. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get target https proxies](struct.TargetHttpsProxyGetCall.html) (response) -/// * [insert target https proxies](struct.TargetHttpsProxyInsertCall.html) (request) +/// * [list target http proxies](struct.TargetHttpProxyListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetHttpsProxy { - /// [Output Only] Type of resource. Always compute#targetHttpsProxy for target HTTPS proxies. +pub struct TargetHttpProxyList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Type of resource. Always compute#targetHttpProxyList for lists of target HTTP proxies. pub kind: Option, - /// An optional description of this resource. Provide this property when you create the resource. - pub description: Option, - /// URLs to SslCertificate resources that are used to authenticate connections between users and the load balancer. Currently, exactly one SSL certificate must be specified. - #[serde(rename="sslCertificates")] - pub ssl_certificates: Option>, - /// URL of SslPolicy resource that will be associated with the TargetHttpsProxy resource. If not set, the TargetHttpsProxy resource will not have any SSL policy configured. - #[serde(rename="sslPolicy")] - pub ssl_policy: Option, - /// Specifies the QUIC override policy for this TargetHttpsProxy resource. This determines whether the load balancer will attempt to negotiate QUIC with clients or not. Can specify one of NONE, ENABLE, or DISABLE. Specify ENABLE to always enable QUIC, Enables QUIC when set to ENABLE, and disables QUIC when set to DISABLE. If NONE is specified, uses the QUIC policy with no user overrides, which is equivalent to DISABLE. Not specifying this field is equivalent to specifying NONE. - #[serde(rename="quicOverride")] - pub quic_override: Option, - /// A fully-qualified or valid partial URL to the UrlMap resource that defines the mapping from URL to the BackendService. For example, the following are all valid URLs for specifying a URL map: - /// - https://www.googleapis.compute/v1/projects/project/global/urlMaps/url-map - /// - projects/project/global/urlMaps/url-map - /// - global/urlMaps/url-map - #[serde(rename="urlMap")] - pub url_map: Option, - /// [Output Only] Creation timestamp in RFC3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of TargetHttpProxy resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. pub id: Option, - /// [Output Only] Server-defined URL for the resource. + /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] pub self_link: Option, - /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - pub name: Option, } -impl RequestValue for TargetHttpsProxy {} -impl ResponseResult for TargetHttpsProxy {} +impl ResponseResult for TargetHttpProxyList {} -/// Configuration parameters of autoscaling based on load balancing. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AutoscalingPolicyLoadBalancingUtilization { - /// Fraction of backend capacity utilization (set in HTTP(s) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8. - #[serde(rename="utilizationTarget")] - pub utilization_target: Option, +pub struct NodeGroupNode { + /// no description provided + pub status: Option, + /// Instances scheduled on this node. + pub instances: Option>, + /// The type of this node. + #[serde(rename="nodeType")] + pub node_type: Option, + /// The name of the node. + pub name: Option, } -impl Part for AutoscalingPolicyLoadBalancingUtilization {} +impl Part for NodeGroupNode {} /// [Output Only] Informational warning message. @@ -10825,11 +11886,15 @@ impl ResponseResult for RegionList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Backend { - /// The fully-qualified URL of a Instance Group resource. This instance group defines the list of instances that serve traffic. Member virtual machine instances from each instance group must live in the same zone as the instance group itself. No two backends in a backend service are allowed to use same Instance Group resource. + /// The fully-qualified URL of an Instance Group or Network Endpoint Group resource. In case of instance group this defines the list of instances that serve traffic. Member virtual machine instances from each instance group must live in the same zone as the instance group itself. No two backends in a backend service are allowed to use same Instance Group resource. /// - /// Note that you must specify an Instance Group resource using the fully-qualified URL, rather than a partial URL. + /// For Network Endpoint Groups this defines list of endpoints. All endpoints of Network Endpoint Group must be hosted on instances located in the same zone as the Network Endpoint Group. /// - /// When the BackendService has load balancing scheme INTERNAL, the instance group must be within the same region as the BackendService. + /// Backend service can not contain mix of Instance Group and Network Endpoint Group backends. + /// + /// Note that you must specify an Instance Group or Network Endpoint Group resource using the fully-qualified URL, rather than a partial URL. + /// + /// When the BackendService has load balancing scheme INTERNAL, the instance group must be within the same region as the BackendService. Network Endpoint Groups are not supported for INTERNAL load balancing scheme. pub group: Option, /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, @@ -10838,21 +11903,31 @@ pub struct Backend { /// This cannot be used for internal load balancing. #[serde(rename="maxUtilization")] pub max_utilization: Option, - /// The max requests per second (RPS) that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be set. + /// The max number of simultaneous connections that a single backend network endpoint can handle. This is used to calculate the capacity of the group. Can be used in either CONNECTION or UTILIZATION balancing modes. For CONNECTION mode, either maxConnections or maxConnectionsPerEndpoint must be set. /// /// This cannot be used for internal load balancing. - #[serde(rename="maxRatePerInstance")] - pub max_rate_per_instance: Option, - /// The max number of simultaneous connections that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either CONNECTION or UTILIZATION balancing modes. For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. - /// - /// This cannot be used for internal load balancing. - #[serde(rename="maxConnectionsPerInstance")] - pub max_connections_per_instance: Option, + #[serde(rename="maxConnectionsPerEndpoint")] + pub max_connections_per_endpoint: Option, /// A multiplier applied to the group's maximum servicing capacity (based on UTILIZATION, RATE or CONNECTION). Default value is 1, which means the group will serve up to 100% of its configured capacity (depending on balancingMode). A setting of 0 means the group is completely drained, offering 0% of its available Capacity. Valid range is [0.0,1.0]. /// /// This cannot be used for internal load balancing. #[serde(rename="capacityScaler")] pub capacity_scaler: Option, + /// The max number of simultaneous connections that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either CONNECTION or UTILIZATION balancing modes. For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. + /// + /// This cannot be used for internal load balancing. + #[serde(rename="maxConnectionsPerInstance")] + pub max_connections_per_instance: Option, + /// The max requests per second (RPS) that a single backend network endpoint can handle. This is used to calculate the capacity of the group. Can be used in either balancing mode. For RATE mode, either maxRate or maxRatePerEndpoint must be set. + /// + /// This cannot be used for internal load balancing. + #[serde(rename="maxRatePerEndpoint")] + pub max_rate_per_endpoint: Option, + /// The max requests per second (RPS) that a single backend instance can handle. This is used to calculate the capacity of the group. Can be used in either balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be set. + /// + /// This cannot be used for internal load balancing. + #[serde(rename="maxRatePerInstance")] + pub max_rate_per_instance: Option, /// The max requests per second (RPS) of the group. Can be used with either RATE or UTILIZATION balancing modes, but required if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be set. /// /// This cannot be used for internal load balancing. @@ -10892,31 +11967,25 @@ impl NestedType for NodeTypesScopedListWarning {} impl Part for NodeTypesScopedListWarning {} -/// An instance's serial console output. +/// There is no detailed description. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get serial port output instances](struct.InstanceGetSerialPortOutputCall.html) (response) +/// * [get health target pools](struct.TargetPoolGetHealthCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SerialPortOutput { - /// The starting byte position of the output that was returned. This should match the start parameter sent with the request. If the serial console output exceeds the size of the buffer, older output will be overwritten by newer content and the start values will be mismatched. - pub start: Option, - /// [Output Only] Type of the resource. Always compute#serialPortOutput for serial port output. +pub struct TargetPoolInstanceHealth { + /// [Output Only] Type of resource. Always compute#targetPoolInstanceHealth when checking the health of an instance. pub kind: Option, - /// [Output Only] The contents of the console output. - pub contents: Option, - /// [Output Only] Server-defined URL for this resource. - #[serde(rename="selfLink")] - pub self_link: Option, - /// [Output Only] The position of the next byte of content from the serial console output. Use this value in the next request as the start parameter. - pub next: Option, + /// no description provided + #[serde(rename="healthStatus")] + pub health_status: Option>, } -impl ResponseResult for SerialPortOutput {} +impl ResponseResult for TargetPoolInstanceHealth {} /// There is no detailed description. @@ -11033,6 +12102,9 @@ pub struct RouterStatus { /// Best routes learned by this router. #[serde(rename="bestRoutesForRouter")] pub best_routes_for_router: Option>, + /// no description provided + #[serde(rename="natStatus")] + pub nat_status: Option>, /// URI of the network to which this router belongs. pub network: Option, /// Best routes for this router's network. @@ -11104,18 +12176,18 @@ impl Part for MachineTypeScratchDisks {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RegionInstanceGroupManagerListWarning { +pub struct InterconnectLocationListWarning { /// [Output Only] A human-readable description of the warning code. pub message: Option, /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, + pub data: Option>, } -impl NestedType for RegionInstanceGroupManagerListWarning {} -impl Part for RegionInstanceGroupManagerListWarning {} +impl NestedType for InterconnectLocationListWarning {} +impl Part for InterconnectLocationListWarning {} /// [Output Only] Informational warning message. @@ -11156,6 +12228,25 @@ pub struct ProjectsSetDefaultNetworkTierRequest { impl RequestValue for ProjectsSetDefaultNetworkTierRequest {} +/// [Output Only] Informational warning message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroupAggregatedListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for NetworkEndpointGroupAggregatedListWarning {} +impl Part for NetworkEndpointGroupAggregatedListWarning {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -11224,6 +12315,25 @@ impl NestedType for BackendBucketListWarning {} impl Part for BackendBucketListWarning {} +/// [Output Only] Informational warning message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ForwardingRuleAggregatedListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for ForwardingRuleAggregatedListWarning {} +impl Part for ForwardingRuleAggregatedListWarning {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -11273,6 +12383,23 @@ pub struct InstanceGroupAggregatedList { impl ResponseResult for InstanceGroupAggregatedList {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroupsListNetworkEndpointsWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for NetworkEndpointGroupsListNetworkEndpointsWarningData {} +impl Part for NetworkEndpointGroupsListNetworkEndpointsWarningData {} + + /// Informational warning which replaces the list of routers when the list is empty. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -11302,7 +12429,7 @@ pub struct AutoscalingPolicyCustomMetricUtilization { /// /// The metric must have a value type of INT64 or DOUBLE. pub metric: Option, - /// Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. If not specified, the default is GAUGE. + /// Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. #[serde(rename="utilizationTargetType")] pub utilization_target_type: Option, /// The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. @@ -11411,6 +12538,45 @@ pub struct TargetTcpProxiesSetProxyHeaderRequest { impl RequestValue for TargetTcpProxiesSetProxyHeaderRequest {} +/// Represents a Nat resource. It enables the VMs within the specified subnetworks to access Internet without external IP addresses. It specifies a list of subnetworks (and the ranges within) that want to use NAT. Customers can also provide the external IPs that would be used for NAT. GCP would auto-allocate ephemeral IPs if no external IPs are provided. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RouterNat { + /// Timeout (in seconds) for UDP connections. Defaults to 30s if not set. + #[serde(rename="udpIdleTimeoutSec")] + pub udp_idle_timeout_sec: Option, + /// A list of URLs of the IP resources used for this Nat service. These IPs must be valid static external IP addresses assigned to the project. max_length is subject to change post alpha. + #[serde(rename="natIps")] + pub nat_ips: Option>, + /// Unique name of this Nat service. The name must be 1-63 characters long and comply with RFC1035. + pub name: Option, + /// Timeout (in seconds) for TCP transitory connections. Defaults to 30s if not set. + #[serde(rename="tcpTransitoryIdleTimeoutSec")] + pub tcp_transitory_idle_timeout_sec: Option, + /// A list of Subnetwork resources whose traffic should be translated by NAT Gateway. It is used only when LIST_OF_SUBNETWORKS is selected for the SubnetworkIpRangeToNatOption above. + pub subnetworks: Option>, + /// Specify the NatIpAllocateOption. If it is AUTO_ONLY, then nat_ip should be empty. + #[serde(rename="natIpAllocateOption")] + pub nat_ip_allocate_option: Option, + /// Timeout (in seconds) for ICMP connections. Defaults to 30s if not set. + #[serde(rename="icmpIdleTimeoutSec")] + pub icmp_idle_timeout_sec: Option, + /// Specify the Nat option. If this field contains ALL_SUBNETWORKS_ALL_IP_RANGES or ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES, then there should not be any other Router.Nat section in any Router for this network in this region. + #[serde(rename="sourceSubnetworkIpRangesToNat")] + pub source_subnetwork_ip_ranges_to_nat: Option, + /// Timeout (in seconds) for TCP established connections. Defaults to 1200s if not set. + #[serde(rename="tcpEstablishedIdleTimeoutSec")] + pub tcp_established_idle_timeout_sec: Option, + /// Minimum number of ports allocated to a VM from this NAT config. If not set, a default number of ports is allocated to a VM. This gets rounded up to the nearest power of 2. Eg. if the value of this field is 50, at least 64 ports will be allocated to a VM. + #[serde(rename="minPortsPerVm")] + pub min_ports_per_vm: Option, +} + +impl Part for RouterNat {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -11466,6 +12632,28 @@ impl NestedType for TargetVpnGatewayListWarningData {} impl Part for TargetVpnGatewayListWarningData {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get health backend services](struct.BackendServiceGetHealthCall.html) (response) +/// * [get health region backend services](struct.RegionBackendServiceGetHealthCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BackendServiceGroupHealth { + /// [Output Only] Type of resource. Always compute#backendServiceGroupHealth for the health of backend services. + pub kind: Option, + /// Health state of the backend instances or endpoints in requested instance or network endpoint group, determined based on configured health checks. + #[serde(rename="healthStatus")] + pub health_status: Option>, +} + +impl ResponseResult for BackendServiceGroupHealth {} + + /// There is no detailed description. /// /// # Activities @@ -11513,28 +12701,6 @@ impl NestedType for TargetVpnGatewayAggregatedListWarningData {} impl Part for TargetVpnGatewayAggregatedListWarningData {} -/// A set of instance tags. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [set tags instances](struct.InstanceSetTagCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Tags { - /// An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. - pub items: Option>, - /// Specifies a fingerprint for this request, which is essentially a hash of the tags' contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update tags. You must always provide an up-to-date fingerprint hash in order to update or change tags. - /// - /// To see the latest fingerprint, make get() request to the instance. - pub fingerprint: Option, -} - -impl RequestValue for Tags {} - - /// Informational warning which replaces the list of addresses when the list is empty. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -11554,6 +12720,44 @@ impl NestedType for TargetPoolsScopedListWarning {} impl Part for TargetPoolsScopedListWarning {} +/// [Output Only] Informational warning which replaces the list of addresses when the list is empty. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetVpnGatewaysScopedListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for TargetVpnGatewaysScopedListWarning {} +impl Part for TargetVpnGatewaysScopedListWarning {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [detach network endpoints network endpoint groups](struct.NetworkEndpointGroupDetachNetworkEndpointCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroupsDetachEndpointsRequest { + /// The list of network endpoints to be detached. + #[serde(rename="networkEndpoints")] + pub network_endpoints: Option>, +} + +impl RequestValue for NetworkEndpointGroupsDetachEndpointsRequest {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -11630,22 +12834,23 @@ impl NestedType for ForwardingRuleListWarningData {} impl Part for ForwardingRuleListWarningData {} -/// There is no detailed description. +/// Represents a customer-supplied encryption key /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [delete instances region instance group managers](struct.RegionInstanceGroupManagerDeleteInstanceCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RegionInstanceGroupManagersDeleteInstancesRequest { - /// The URLs of one or more instances to delete. This can be a full URL or a partial URL, such as zones/[ZONE]/instances/[INSTANCE_NAME]. - pub instances: Option>, +pub struct CustomerEncryptionKey { + /// Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. + #[serde(rename="rawKey")] + pub raw_key: Option, + /// [Output only] The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. + pub sha256: Option, + /// The name of the encryption key that is stored in Google Cloud KMS. + #[serde(rename="kmsKeyName")] + pub kms_key_name: Option, } -impl RequestValue for RegionInstanceGroupManagersDeleteInstancesRequest {} +impl Part for CustomerEncryptionKey {} /// There is no detailed description. @@ -11693,19 +12898,34 @@ pub struct SecurityPolicyList { impl ResponseResult for SecurityPolicyList {} -/// Description-tagged IP ranges for the router to advertise. +/// Contains a list of TargetPool resources. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list target pools](struct.TargetPoolListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RouterAdvertisedIpRange { - /// The IP range to advertise. The value must be a CIDR-formatted string. - pub range: Option, - /// User-specified description for the IP range. - pub description: Option, +pub struct TargetPoolList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] Type of resource. Always compute#targetPoolList for lists of target pools. + pub kind: Option, + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of TargetPool resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, } -impl Part for RouterAdvertisedIpRange {} +impl ResponseResult for TargetPoolList {} /// Subnetwork which the current user has compute.subnetworks.use permission on. @@ -11746,34 +12966,136 @@ impl NestedType for AcceleratorTypeListWarningData {} impl Part for AcceleratorTypeListWarningData {} -/// Contains a list of BackendBucket resources. +/// A BackendService resource. This resource defines a group of backend virtual machines and their serving capacity. (== resource_for v1.backendService ==) (== resource_for beta.backendService ==) /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list backend buckets](struct.BackendBucketListCall.html) (response) +/// * [get backend services](struct.BackendServiceGetCall.html) (response) +/// * [get health backend services](struct.BackendServiceGetHealthCall.html) (none) +/// * [insert backend services](struct.BackendServiceInsertCall.html) (request) +/// * [add signed url key backend services](struct.BackendServiceAddSignedUrlKeyCall.html) (none) +/// * [insert region backend services](struct.RegionBackendServiceInsertCall.html) (request) +/// * [list backend services](struct.BackendServiceListCall.html) (none) +/// * [update backend services](struct.BackendServiceUpdateCall.html) (request) +/// * [get region backend services](struct.RegionBackendServiceGetCall.html) (response) +/// * [aggregated list backend services](struct.BackendServiceAggregatedListCall.html) (none) +/// * [delete backend services](struct.BackendServiceDeleteCall.html) (none) +/// * [patch backend services](struct.BackendServicePatchCall.html) (request) +/// * [delete signed url key backend services](struct.BackendServiceDeleteSignedUrlKeyCall.html) (none) +/// * [patch region backend services](struct.RegionBackendServicePatchCall.html) (request) +/// * [update region backend services](struct.RegionBackendServiceUpdateCall.html) (request) +/// * [set security policy backend services](struct.BackendServiceSetSecurityPolicyCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BackendBucketList { - /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Type of resource. - pub kind: Option, - /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of BackendBucket resources. - pub items: Option>, - /// [Output Only] Unique identifier for the resource; defined by the server. +pub struct BackendService { + /// no description provided + #[serde(rename="connectionDraining")] + pub connection_draining: Option, + /// The protocol this BackendService uses to communicate with backends. + /// + /// Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. + /// + /// For internal load balancing, the possible values are TCP and UDP, and the default is TCP. + pub protocol: Option, + /// An optional description of this resource. Provide this property when you create the resource. + pub description: Option, + /// Cloud CDN configuration for this BackendService. + #[serde(rename="cdnPolicy")] + pub cdn_policy: Option, + /// Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot be used with the other. Possible values are INTERNAL and EXTERNAL. + #[serde(rename="loadBalancingScheme")] + pub load_balancing_scheme: Option, + /// [Output Only] The resource URL for the security policy associated with this backend service. + #[serde(rename="securityPolicy")] + pub security_policy: Option, + /// Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a BackendService. An up-to-date fingerprint must be provided in order to update the BackendService, otherwise the request will fail with error 412 conditionNotMet. + /// + /// To see the latest fingerprint, make a get() request to retrieve a BackendService. + pub fingerprint: Option, + /// Name of backend port. The same name should appear in the instance groups referenced by this service. Required when the load balancing scheme is EXTERNAL. + /// + /// When the load balancing scheme is INTERNAL, this field is not used. + #[serde(rename="portName")] + pub port_name: Option, + /// The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified, and a health check is required for Compute Engine backend services. A health check must not be specified for App Engine backend and Cloud Function backend. + /// + /// For internal load balancing, a URL to a HealthCheck resource must be specified instead. + #[serde(rename="healthChecks")] + pub health_checks: Option>, + /// Type of session affinity to use. The default is NONE. + /// + /// When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. + /// + /// When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, or CLIENT_IP_PORT_PROTO. + /// + /// When the protocol is UDP, this field is not used. + #[serde(rename="sessionAffinity")] + pub session_affinity: Option, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, - /// [Output Only] Server-defined URL for this resource. + /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, + /// [Output Only] Type of resource. Always compute#backendService for backend services. + pub kind: Option, + /// Headers that the HTTP/S load balancer should add to proxied requests. + #[serde(rename="customRequestHeaders")] + pub custom_request_headers: Option>, + /// If true, enable Cloud CDN for this BackendService. + /// + /// When the load balancing scheme is INTERNAL, this field is not used. + #[serde(rename="enableCDN")] + pub enable_cdn: Option, + /// [Output Only] URL of the region where the regional backend service resides. This field is not applicable to global backend services. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. + pub region: Option, + /// Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set to 0, the cookie is non-persistent and lasts only until the end of the browser session (or equivalent). The maximum allowed value for TTL is one day. + /// + /// When the load balancing scheme is INTERNAL, this field is not used. + #[serde(rename="affinityCookieTtlSec")] + pub affinity_cookie_ttl_sec: Option, + /// Deprecated in favor of portName. The TCP port to connect on the backend. The default value is 80. + /// + /// This cannot be used for internal load balancing. + pub port: Option, + /// How many seconds to wait for the backend before considering it a failed request. Default is 30 seconds. + #[serde(rename="timeoutSec")] + pub timeout_sec: Option, + /// The list of backends that serve this BackendService. + pub backends: Option>, + /// no description provided + pub iap: Option, + /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, } -impl ResponseResult for BackendBucketList {} +impl RequestValue for BackendService {} +impl Resource for BackendService {} +impl ResponseResult for BackendService {} + + +/// [Output Only] Informational warning message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroupListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for NetworkEndpointGroupListWarning {} +impl Part for NetworkEndpointGroupListWarning {} /// Contains a list of images. @@ -11806,29 +13128,6 @@ pub struct ImageList { impl ResponseResult for ImageList {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TCPHealthCheck { - /// Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. - #[serde(rename="portName")] - pub port_name: Option, - /// Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. - #[serde(rename="proxyHeader")] - pub proxy_header: Option, - /// The application data to send once the TCP connection has been established (default value is empty). If both request and response are empty, the connection establishment alone will indicate health. The request data can only be ASCII. - pub request: Option, - /// The TCP port number for the health check request. The default value is 80. Valid values are 1 through 65535. - pub port: Option, - /// The bytes to match against the beginning of the response data. If left empty (the default value), any response will indicate health. The response data can only be ASCII. - pub response: Option, -} - -impl Part for TCPHealthCheck {} - - /// An informational warning that appears when the list of addresses is empty. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -11879,21 +13178,28 @@ pub struct InterconnectOutageNotification { impl Part for InterconnectOutageNotification {} -/// [Output Only] Metadata about this warning in key: value format. For example: -/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set iam policy disks](struct.DiskSetIamPolicyCall.html) (request) +/// * [set iam policy node groups](struct.NodeGroupSetIamPolicyCall.html) (request) +/// * [set iam policy instances](struct.InstanceSetIamPolicyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationWarningsData { - /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - pub key: Option, - /// [Output Only] A warning data value corresponding to the key. - pub value: Option, +pub struct ZoneSetPolicyRequest { + /// REQUIRED: The complete policy to be applied to the 'resource'. The size of the policy is limited to a few 10s of KB. An empty policy is in general a valid policy but certain services (like Projects) might reject them. + pub policy: Option, + /// Flatten Policy to create a backwacd compatible wire-format. Deprecated. Use 'policy' to specify bindings. + pub bindings: Option>, + /// Flatten Policy to create a backward compatible wire-format. Deprecated. Use 'policy' to specify the etag. + pub etag: Option, } -impl NestedType for OperationWarningsData {} -impl Part for OperationWarningsData {} +impl RequestValue for ZoneSetPolicyRequest {} /// Informational metadata about Partner attachments from Partners to display to customers. These fields are propagated from PARTNER_PROVIDER attachments to their corresponding PARTNER attachments. @@ -11905,7 +13211,7 @@ pub struct InterconnectAttachmentPartnerMetadata { /// Plain text name of the Partner providing this attachment. This value may be validated to match approved Partner values. #[serde(rename="partnerName")] pub partner_name: Option, - /// Plain text name of the Interconnect this attachment is connected to, as displayed in the Partner?s portal. For instance ?Chicago 1?. This value may be validated to match approved Partner values. + /// Plain text name of the Interconnect this attachment is connected to, as displayed in the Partner?s portal. For instance "Chicago 1". This value may be validated to match approved Partner values. #[serde(rename="interconnectName")] pub interconnect_name: Option, /// URL of the Partner?s portal for this Attachment. Partners may customise this to be a deep-link to the specific resource on the Partner portal. This value may be validated to match approved Partner values. @@ -12082,11 +13388,14 @@ pub struct Firewall { pub target_tags: Option>, /// The list of ALLOW rules specified by this firewall. Each rule specifies a protocol and port-range tuple that describes a permitted connection. pub allowed: Option>, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. - pub id: Option, + /// If source service accounts are specified, the firewall will apply only to traffic originating from an instance with a service account in this list. Source service accounts cannot be used to control traffic to an instance's external IP address because service accounts are associated with an instance, not an IP address. sourceRanges can be set at the same time as sourceServiceAccounts. If both are set, the firewall will apply to traffic that has source IP address within sourceRanges OR the source IP belongs to an instance with service account listed in sourceServiceAccount. The connection does not need to match both properties for the firewall to apply. sourceServiceAccounts cannot be used at the same time as sourceTags or targetTags. + #[serde(rename="sourceServiceAccounts")] + pub source_service_accounts: Option>, /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. pub name: Option, /// [Output Only] Type of the resource. Always compute#firewall for firewall rules. @@ -12101,9 +13410,9 @@ pub struct Firewall { /// If source tags are specified, the firewall rule applies only to traffic with source IPs that match the primary network interfaces of VM instances that have the tag and are in the same VPC network. Source tags cannot be used to control traffic to an instance's external IP address, it only applies to traffic between instances in the same virtual network. Because tags are associated with instances, not IP addresses. One or both of sourceRanges and sourceTags may be set. If both properties are set, the firewall will apply to traffic that has source IP address within sourceRanges OR the source IP that belongs to a tag listed in the sourceTags property. The connection does not need to match both properties for the firewall to apply. #[serde(rename="sourceTags")] pub source_tags: Option>, - /// If source service accounts are specified, the firewall will apply only to traffic originating from an instance with a service account in this list. Source service accounts cannot be used to control traffic to an instance's external IP address because service accounts are associated with an instance, not an IP address. sourceRanges can be set at the same time as sourceServiceAccounts. If both are set, the firewall will apply to traffic that has source IP address within sourceRanges OR the source IP belongs to an instance with service account listed in sourceServiceAccount. The connection does not need to match both properties for the firewall to apply. sourceServiceAccounts cannot be used at the same time as sourceTags or targetTags. - #[serde(rename="sourceServiceAccounts")] - pub source_service_accounts: Option>, + /// This field denotes the logging options for a particular firewall rule. If logging is enabled, logs will be exported to Stackdriver. + #[serde(rename="logConfig")] + pub log_config: Option, /// Priority for this rule. This is an integer between 0 and 65535, both inclusive. When not specified, the value assumed is 1000. Relative priorities determine precedence of conflicting rules. Lower value of priority implies higher precedence (eg, a rule with priority 0 has higher precedence than a rule with priority 1). DENY rules take precedence over ALLOW rules having equal priority. pub priority: Option, /// A list of service accounts indicating sets of instances located in the network that may make network connections as specified in allowed[]. targetServiceAccounts cannot be used at the same time as targetTags or sourceTags. If neither targetServiceAccounts nor targetTags are specified, the firewall rule applies to all instances on the specified network. @@ -12121,6 +13430,23 @@ impl Resource for Firewall {} impl ResponseResult for Firewall {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InterconnectListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for InterconnectListWarningData {} +impl Part for InterconnectListWarningData {} + + /// Represents a Commitment resource. Creating a Commitment resource means that you are purchasing a committed use contract with an explicit start and end time. You can create commitments based on vCPUs and memory usage and receive discounted rates. For full details, read Signing Up for Committed Use Discounts. /// /// Committed use discounts are subject to Google Cloud Platform's Service Specific Terms. By purchasing a committed use discount, you agree to these terms. Committed use discounts will not renew, so you must purchase a new commitment to continue receiving discounts. (== resource_for beta.commitments ==) (== resource_for v1.commitments ==) @@ -12178,6 +13504,8 @@ impl ResponseResult for Commitment {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct HTTPSHealthCheck { + /// The TCP port number for the health check request. The default value is 443. Valid values are 1 through 65535. + pub port: Option, /// The value of the host header in the HTTPS health check request. If left empty (default value), the IP on behalf of which this health check is performed will be used. pub host: Option, /// The request path of the HTTPS health check request. The default value is /. @@ -12189,8 +13517,23 @@ pub struct HTTPSHealthCheck { /// Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. #[serde(rename="proxyHeader")] pub proxy_header: Option, - /// The TCP port number for the health check request. The default value is 443. Valid values are 1 through 65535. - pub port: Option, + /// Specifies how port is selected for health checking, can be one of following values: + /// USE_FIXED_PORT: The port number in + /// port + /// is used for health checking. + /// USE_NAMED_PORT: The + /// portName + /// is used for health checking. + /// USE_SERVING_PORT: For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. + /// + /// + /// If not specified, HTTPS health check follows behavior specified in + /// port + /// and + /// portName + /// fields. + #[serde(rename="portSpecification")] + pub port_specification: Option, /// The string to match anywhere in the first 1024 bytes of the response body. If left empty (the default value), the status code determines health. The response data can only be ASCII. pub response: Option, } @@ -12300,34 +13643,20 @@ impl NestedType for UrlMapListWarningData {} impl Part for UrlMapListWarningData {} -/// There is no detailed description. +/// Represents a match condition that incoming traffic is evaluated against. Exactly one field must be specified. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [aggregated list machine types](struct.MachineTypeAggregatedListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MachineTypeAggregatedList { - /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// [Output Only] Type of resource. Always compute#machineTypeAggregatedList for aggregated lists of machine types. - pub kind: Option, - /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of MachineTypesScopedList resources. - pub items: Option>, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// [Output Only] Server-defined URL for this resource. - #[serde(rename="selfLink")] - pub self_link: Option, +pub struct SecurityPolicyRuleMatcher { + /// The configuration options available when specifying versioned_expr. This field must be specified if versioned_expr is specified and cannot be specified if versioned_expr is not specified. + pub config: Option, + /// Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. + #[serde(rename="versionedExpr")] + pub versioned_expr: Option, } -impl ResponseResult for MachineTypeAggregatedList {} +impl Part for SecurityPolicyRuleMatcher {} /// There is no detailed description. @@ -12434,18 +13763,18 @@ pub struct VpnTunnel { /// [Output Only] Detailed status message for the VPN tunnel. #[serde(rename="detailedStatus")] pub detailed_status: Option, - /// IKE protocol version to use when establishing the VPN tunnel with peer VPN gateway. Acceptable IKE versions are 1 or 2. Default version is 2. + /// IKE protocol version to use when establishing the VPN tunnel with the peer VPN gateway. Acceptable IKE versions are 1 or 2. The default version is 2. #[serde(rename="ikeVersion")] pub ike_version: Option, /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, - /// Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway. The value should be a CIDR formatted string, for example: 192.168.0.0/16. The ranges should be disjoint. Only IPv4 is supported. + /// Local traffic selector to use when establishing the VPN tunnel with the peer VPN gateway. The value should be a CIDR formatted string, for example: 192.168.0.0/16. The ranges must be disjoint. Only IPv4 is supported. #[serde(rename="localTrafficSelector")] pub local_traffic_selector: Option>, /// Hash of the shared secret. #[serde(rename="sharedSecretHash")] pub shared_secret_hash: Option, - /// URL of router resource to be used for dynamic routing. + /// URL of the router resource to be used for dynamic routing. pub router: Option, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] @@ -12460,14 +13789,23 @@ pub struct VpnTunnel { pub peer_ip: Option, /// [Output Only] Type of resource. Always compute#vpnTunnel for VPN tunnels. pub kind: Option, - /// Remote traffic selectors to use when establishing the VPN tunnel with peer VPN gateway. The value should be a CIDR formatted string, for example: 192.168.0.0/16. The ranges should be disjoint. Only IPv4 is supported. + /// Remote traffic selectors to use when establishing the VPN tunnel with the peer VPN gateway. The value should be a CIDR formatted string, for example: 192.168.0.0/16. The ranges should be disjoint. Only IPv4 is supported. #[serde(rename="remoteTrafficSelector")] pub remote_traffic_selector: Option>, /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. pub name: Option, /// [Output Only] URL of the region where the VPN tunnel resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. pub region: Option, - /// [Output Only] The status of the VPN tunnel. + /// [Output Only] The status of the VPN tunnel, which can be one of the following: + /// - PROVISIONING: Resource is being allocated for the VPN tunnel. + /// - WAITING_FOR_FULL_CONFIG: Waiting to receive all VPN-related configs from the user. Network, TargetVpnGateway, VpnTunnel, ForwardingRule, and Route resources are needed to setup the VPN tunnel. + /// - FIRST_HANDSHAKE: Successful first handshake with the peer VPN. + /// - ESTABLISHED: Secure session is successfully established with the peer VPN. + /// - NETWORK_ERROR: Deprecated, replaced by NO_INCOMING_PACKETS + /// - AUTHORIZATION_ERROR: Auth error (for example, bad shared secret). + /// - NEGOTIATION_FAILURE: Handshake failed. + /// - DEPROVISIONING: Resources are being deallocated for the VPN tunnel. + /// - FAILED: Tunnel creation has failed and the tunnel is not ready to be used. pub status: Option, /// URL of the Target VPN gateway with which this VPN tunnel is associated. Provided by the client when the VPN tunnel is created. #[serde(rename="targetVpnGateway")] @@ -12539,7 +13877,7 @@ pub struct RouterBgpPeer { /// User-specified list of individual IP ranges to advertise in custom mode. This field can only be populated if advertise_mode is CUSTOM and overrides the list defined for the router (in Bgp message). These IP ranges will be advertised in addition to any specified groups. Leave this field blank to advertise no custom IP ranges. #[serde(rename="advertisedIpRanges")] pub advertised_ip_ranges: Option>, - /// [Output Only] Type of how the resource/configuration of the BGP peer is managed. MANAGED_BY_USER is the default value; MANAGED_BY_ATTACHMENT represents an BGP peer that is automatically created for PARTNER interconnectAttachment, Google will automatically create/delete this type of BGP peer when the PARTNER interconnectAttachment is created/deleted. + /// [Output Only] The resource that configures and manages this BGP peer. MANAGED_BY_USER is the default value and can be managed by you or other users; MANAGED_BY_ATTACHMENT is a BGP peer that is configured and managed by Cloud Interconnect, specifically by an InterconnectAttachment of type PARTNER. Google will automatically create, update, and delete this type of BGP peer when the PARTNER InterconnectAttachment is created, updated, or deleted. #[serde(rename="managementType")] pub management_type: Option, /// IP address of the interface inside Google Cloud Platform. Only IPv4 is supported. @@ -12647,6 +13985,8 @@ impl RequestValue for UrlMapReference {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SSLHealthCheck { + /// The TCP port number for the health check request. The default value is 443. Valid values are 1 through 65535. + pub port: Option, /// Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. #[serde(rename="portName")] pub port_name: Option, @@ -12655,8 +13995,23 @@ pub struct SSLHealthCheck { pub proxy_header: Option, /// The application data to send once the SSL connection has been established (default value is empty). If both request and response are empty, the connection establishment alone will indicate health. The request data can only be ASCII. pub request: Option, - /// The TCP port number for the health check request. The default value is 443. Valid values are 1 through 65535. - pub port: Option, + /// Specifies how port is selected for health checking, can be one of following values: + /// USE_FIXED_PORT: The port number in + /// port + /// is used for health checking. + /// USE_NAMED_PORT: The + /// portName + /// is used for health checking. + /// USE_SERVING_PORT: For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. + /// + /// + /// If not specified, SSL health check follows behavior specified in + /// port + /// and + /// portName + /// fields. + #[serde(rename="portSpecification")] + pub port_specification: Option, /// The bytes to match against the beginning of the response data. If left empty (the default value), any response will indicate health. The response data can only be ASCII. pub response: Option, } @@ -12753,6 +14108,70 @@ pub struct HealthCheckReference { impl Part for HealthCheckReference {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroupAggregatedListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for NetworkEndpointGroupAggregatedListWarningData {} +impl Part for NetworkEndpointGroupAggregatedListWarningData {} + + +/// Represents a Target VPN gateway resource. (== resource_for beta.targetVpnGateways ==) (== resource_for v1.targetVpnGateways ==) +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete target vpn gateways](struct.TargetVpnGatewayDeleteCall.html) (none) +/// * [aggregated list target vpn gateways](struct.TargetVpnGatewayAggregatedListCall.html) (none) +/// * [get target vpn gateways](struct.TargetVpnGatewayGetCall.html) (response) +/// * [insert target vpn gateways](struct.TargetVpnGatewayInsertCall.html) (request) +/// * [list target vpn gateways](struct.TargetVpnGatewayListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetVpnGateway { + /// [Output Only] The status of the VPN gateway, which can be one of the following: CREATING, READY, FAILED, or DELETING. + pub status: Option, + /// [Output Only] Type of resource. Always compute#targetVpnGateway for target VPN gateways. + pub kind: Option, + /// An optional description of this resource. Provide this property when you create the resource. + pub description: Option, + /// [Output Only] URL of the region where the target VPN gateway resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. + pub region: Option, + /// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, + /// [Output Only] A list of URLs to the ForwardingRule resources. ForwardingRules are created using compute.forwardingRules.insert and associated with a VPN gateway. + #[serde(rename="forwardingRules")] + pub forwarding_rules: Option>, + /// [Output Only] Server-defined URL for the resource. + #[serde(rename="selfLink")] + pub self_link: Option, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// [Output Only] A list of URLs to VpnTunnel resources. VpnTunnels are created using the compute.vpntunnels.insert method and associated with a VPN gateway. + pub tunnels: Option>, + /// URL of the network to which this VPN gateway is attached. Provided by the client when the VPN gateway is created. + pub network: Option, +} + +impl RequestValue for TargetVpnGateway {} +impl Resource for TargetVpnGateway {} +impl ResponseResult for TargetVpnGateway {} + + /// [Output Only] Informational warning message. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -12910,6 +14329,8 @@ impl Part for AttachedDiskInitializeParams {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Quota { + /// [Output Only] Owning resource. This is the resource on which this quota is applied. + pub owner: Option, /// [Output Only] Current usage of this metric. pub usage: Option, /// [Output Only] Name of the quota metric. @@ -12938,6 +14359,25 @@ impl NestedType for BackendServicesScopedListWarningData {} impl Part for BackendServicesScopedListWarningData {} +/// [Output Only] An informational warning that replaces the list of network endpoint groups when the list is empty. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkEndpointGroupsScopedListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for NetworkEndpointGroupsScopedListWarning {} +impl Part for NetworkEndpointGroupsScopedListWarning {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// @@ -12985,6 +14425,23 @@ pub struct VpnTunnelList { impl ResponseResult for VpnTunnelList {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RouterListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for RouterListWarningData {} +impl Part for RouterListWarningData {} + + /// Represents a secondary IP range of a subnetwork. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -13128,6 +14585,37 @@ impl NestedType for RegionDiskTypeListWarning {} impl Part for RegionDiskTypeListWarning {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InstanceGroupManagerUpdatePolicy { + /// The maximum number of instances that can be created above the specified targetSize during the update process. By default, a fixed value of 1 is used. This value can be either a fixed number or a percentage if the instance group has 10 or more instances. If you set a percentage, the number of instances will be rounded up if necessary. + /// + /// At least one of either maxSurge or maxUnavailable must be greater than 0. Learn more about maxSurge. + #[serde(rename="maxSurge")] + pub max_surge: Option, + /// no description provided + #[serde(rename="type")] + pub type_: Option, + /// The maximum number of instances that can be unavailable during the update process. An instance is considered available if all of the following conditions are satisfied: + /// + /// + /// - The instance's status is RUNNING. + /// - If there is a health check on the instance group, the instance's liveness health check result must be HEALTHY at least once. If there is no health check on the group, then the instance only needs to have a status of RUNNING to be considered available. By default, a fixed value of 1 is used. This value can be either a fixed number or a percentage if the instance group has 10 or more instances. If you set a percentage, the number of instances will be rounded up if necessary. + /// + /// At least one of either maxSurge or maxUnavailable must be greater than 0. Learn more about maxUnavailable. + #[serde(rename="maxUnavailable")] + pub max_unavailable: Option, + /// Minimal action to be taken on an instance. You can specify either RESTART to restart existing instances or REPLACE to delete and create new instances from the target template. If you specify a RESTART, the Updater will attempt to perform that action only. However, if the Updater determines that the minimal action you specify is not enough to perform the update, it might perform a more disruptive action. + #[serde(rename="minimalAction")] + pub minimal_action: Option, +} + +impl Part for InstanceGroupManagerUpdatePolicy {} + + /// [Output Only] Metadata about this warning in key: value format. For example: /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// @@ -13145,26 +14633,34 @@ impl NestedType for BackendBucketListWarningData {} impl Part for BackendBucketListWarningData {} -/// There is no detailed description. +/// Contains a list of disk types. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get health backend services](struct.BackendServiceGetHealthCall.html) (response) -/// * [get health region backend services](struct.RegionBackendServiceGetHealthCall.html) (response) +/// * [list disk types](struct.DiskTypeListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BackendServiceGroupHealth { - /// [Output Only] Type of resource. Always compute#backendServiceGroupHealth for the health of backend services. +pub struct DiskTypeList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] Type of resource. Always compute#diskTypeList for disk types. pub kind: Option, - /// no description provided - #[serde(rename="healthStatus")] - pub health_status: Option>, + /// [Output Only] Informational warning message. + pub warning: Option, + /// A list of DiskType resources. + pub items: Option>, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, } -impl ResponseResult for BackendServiceGroupHealth {} +impl ResponseResult for DiskTypeList {} /// [Output Only] Metadata about this warning in key: value format. For example: @@ -13294,58 +14790,121 @@ impl RequestValue for TargetSslProxiesSetSslCertificatesRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [set target forwarding rules](struct.ForwardingRuleSetTargetCall.html) (request) -/// * [set backup target pools](struct.TargetPoolSetBackupCall.html) (request) -/// * [set target global forwarding rules](struct.GlobalForwardingRuleSetTargetCall.html) (request) +/// * [set backend service target ssl proxies](struct.TargetSslProxySetBackendServiceCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetReference { - /// no description provided - pub target: Option, +pub struct TargetSslProxiesSetBackendServiceRequest { + /// The URL of the new BackendService resource for the targetSslProxy. + pub service: Option, } -impl RequestValue for TargetReference {} +impl RequestValue for TargetSslProxiesSetBackendServiceRequest {} -/// There is no detailed description. +/// Sets the scheduling options for an Instance. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get router status routers](struct.RouterGetRouterStatuCall.html) (response) +/// * [set scheduling instances](struct.InstanceSetSchedulingCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RouterStatusResponse { - /// Type of resource. - pub kind: Option, - /// no description provided - pub result: Option, +pub struct Scheduling { + /// Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). You can only set the automatic restart option for standard instances. Preemptible instances cannot be automatically restarted. + /// + /// By default, this is set to true so an instance is automatically restarted if it is terminated by Compute Engine. + #[serde(rename="automaticRestart")] + pub automatic_restart: Option, + /// A set of node affinity and anti-affinity. + #[serde(rename="nodeAffinities")] + pub node_affinities: Option>, + /// Defines whether the instance is preemptible. This can only be set during instance creation, it cannot be set or changed after the instance has been created. + pub preemptible: Option, + /// Defines the maintenance behavior for this instance. For standard instances, the default behavior is MIGRATE. For preemptible instances, the default and only possible behavior is TERMINATE. For more information, see Setting Instance Scheduling Options. + #[serde(rename="onHostMaintenance")] + pub on_host_maintenance: Option, } -impl ResponseResult for RouterStatusResponse {} +impl RequestValue for Scheduling {} -/// There is no detailed description. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AutoscalerListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for AutoscalerListWarningData {} +impl Part for AutoscalerListWarningData {} + + +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VpnTunnelListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for VpnTunnelListWarningData {} +impl Part for VpnTunnelListWarningData {} + + +/// An instance's serial console output. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get health target pools](struct.TargetPoolGetHealthCall.html) (response) +/// * [get serial port output instances](struct.InstanceGetSerialPortOutputCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetPoolInstanceHealth { - /// [Output Only] Type of resource. Always compute#targetPoolInstanceHealth when checking the health of an instance. +pub struct SerialPortOutput { + /// The starting byte position of the output that was returned. This should match the start parameter sent with the request. If the serial console output exceeds the size of the buffer, older output will be overwritten by newer content and the start values will be mismatched. + pub start: Option, + /// [Output Only] Type of the resource. Always compute#serialPortOutput for serial port output. pub kind: Option, - /// no description provided - #[serde(rename="healthStatus")] - pub health_status: Option>, + /// [Output Only] The contents of the console output. + pub contents: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, + /// [Output Only] The position of the next byte of content from the serial console output. Use this value in the next request as the start parameter. + pub next: Option, } -impl ResponseResult for TargetPoolInstanceHealth {} +impl ResponseResult for SerialPortOutput {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetPoolsScopedList { + /// Informational warning which replaces the list of addresses when the list is empty. + pub warning: Option, + /// A list of target pools contained in this scope. + #[serde(rename="targetPools")] + pub target_pools: Option>, +} + +impl Part for TargetPoolsScopedList {} /// [Output Only] Informational warning message. @@ -13367,23 +14926,23 @@ impl NestedType for RouterAggregatedListWarning {} impl Part for RouterAggregatedListWarning {} -/// [Output Only] Informational warning message. +/// The policy describes the baseline against which Instance boot integrity is measured. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set shielded instance integrity policy instances](struct.InstanceSetShieldedInstanceIntegrityPolicyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ForwardingRuleAggregatedListWarning { - /// [Output Only] A human-readable description of the warning code. - pub message: Option, - /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - pub code: Option, - /// [Output Only] Metadata about this warning in key: value format. For example: - /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } - pub data: Option>, +pub struct ShieldedInstanceIntegrityPolicy { + /// Updates the integrity policy baseline using the measurements from the VM instance's most recent boot. + #[serde(rename="updateAutoLearnPolicy")] + pub update_auto_learn_policy: Option, } -impl NestedType for ForwardingRuleAggregatedListWarning {} -impl Part for ForwardingRuleAggregatedListWarning {} +impl RequestValue for ShieldedInstanceIntegrityPolicy {} /// There is no detailed description. @@ -13402,6 +14961,23 @@ pub struct InstanceGroupsScopedList { impl Part for InstanceGroupsScopedList {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AcceleratorTypesScopedListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for AcceleratorTypesScopedListWarningData {} +impl Part for AcceleratorTypesScopedListWarningData {} + + /// Service resource (a.k.a service project) ID. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -13411,7 +14987,7 @@ pub struct XpnResourceId { /// The type of the service resource. #[serde(rename="type")] pub type_: Option, - /// The ID of the service resource. In the case of projects, this field matches the project ID (e.g., my-project), not the project number (e.g., 12345678). + /// The ID of the service resource. In the case of projects, this field supports project id (e.g., my-project-123) and project number (e.g. 12345678). pub id: Option, } @@ -13445,7 +15021,7 @@ pub struct InterconnectAttachment { /// Determines whether this Attachment will carry packets. Not present for PARTNER_PROVIDER. #[serde(rename="adminEnabled")] pub admin_enabled: Option, - /// Provisioned bandwidth capacity for the interconnectAttachment. Can be set by the partner to update the customer's provisioned bandwidth. Output only for for PARTNER type, mutable for PARTNER_PROVIDER, not available for DEDICATED. + /// Provisioned bandwidth capacity for the interconnectAttachment. Can be set by the partner to update the customer's provisioned bandwidth. Output only for PARTNER type, mutable for PARTNER_PROVIDER and DEDICATED. pub bandwidth: Option, /// Up to 16 candidate prefixes that can be used to restrict the allocation of cloudRouterIpAddress and customerRouterIpAddress for this attachment. All prefixes must be within link-local address space (169.254.0.0/16) and must be /29 or shorter (/28, /27, etc). Google will attempt to select an unused /29 from the supplied candidate prefix(es). The request will fail if all possible /29s are in use on Google?s edge. If not supplied, Google will randomly select an unused /29 from all of link-local space. #[serde(rename="candidateSubnets")] @@ -13460,7 +15036,7 @@ pub struct InterconnectAttachment { pub cloud_router_ip_address: Option, /// [Output Only] Type of the resource. Always compute#interconnectAttachment for interconnect attachments. pub kind: Option, - /// Available only for DEDICATED and PARTNER_PROVIDER. Desired VLAN tag for this attachment, in the range 2-4094. This field refers to 802.1q VLAN tag, also known as IEEE 802.1Q Only specified at creation time. + /// The IEEE 802.1Q VLAN tag for this attachment, in the range 2-4094. Only specified at creation time. #[serde(rename="vlanTag8021q")] pub vlan_tag8021q: Option, /// URL of the underlying Interconnect object that this attachment's traffic will traverse through. @@ -13484,7 +15060,7 @@ pub struct InterconnectAttachment { /// Desired availability domain for the attachment. Only available for type PARTNER, at creation time. For improved reliability, customers should configure a pair of attachments with one per availability domain. The selected availability domain will be provided to the Partner via the pairing key so that the provisioned circuit will lie in the specified domain. If not specified, the value will default to AVAILABILITY_DOMAIN_ANY. #[serde(rename="edgeAvailabilityDomain")] pub edge_availability_domain: Option, - /// URL of the cloud router to be used for dynamic routing. This router must be in the same region as this InterconnectAttachment. The InterconnectAttachment will automatically connect the Interconnect to the network & region within which the Cloud Router is configured. + /// URL of the Cloud Router to be used for dynamic routing. This router must be in the same region as this InterconnectAttachment. The InterconnectAttachment will automatically connect the Interconnect to the network & region within which the Cloud Router is configured. pub router: Option, /// Informational metadata about Partner attachments from Partners to display to customers. Output only for for PARTNER type, mutable for PARTNER_PROVIDER, not available for DEDICATED. #[serde(rename="partnerMetadata")] @@ -13523,34 +15099,19 @@ pub struct RegionInstanceGroupManagersSetTemplateRequest { impl RequestValue for RegionInstanceGroupManagersSetTemplateRequest {} -/// Contains a list of TargetPool resources. +/// Description-tagged IP ranges for the router to advertise. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list target pools](struct.TargetPoolListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetPoolList { - /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// [Output Only] Type of resource. Always compute#targetPoolList for lists of target pools. - pub kind: Option, - /// [Output Only] Informational warning message. - pub warning: Option, - /// A list of TargetPool resources. - pub items: Option>, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// [Output Only] Server-defined URL for this resource. - #[serde(rename="selfLink")] - pub self_link: Option, +pub struct RouterAdvertisedIpRange { + /// The IP range to advertise. The value must be a CIDR-formatted string. + pub range: Option, + /// User-specified description for the IP range. + pub description: Option, } -impl ResponseResult for TargetPoolList {} +impl Part for RouterAdvertisedIpRange {} /// A Machine Type resource. (== resource_for v1.machineTypes ==) (== resource_for beta.machineTypes ==) @@ -13620,7 +15181,7 @@ pub struct AcceleratorConfig { /// The number of the guest accelerator cards exposed to this instance. #[serde(rename="acceleratorCount")] pub accelerator_count: Option, - /// Full or partial URL of the accelerator type resource to attach to this instance. If you are creating an instance template, specify only the accelerator name. + /// Full or partial URL of the accelerator type resource to attach to this instance. For example: projects/my-project/zones/us-central1-c/acceleratorTypes/nvidia-tesla-p100 If you are creating an instance template, specify only the accelerator name. See GPUs on Compute Engine for a full list of accelerator types. #[serde(rename="acceleratorType")] pub accelerator_type: Option, } @@ -13701,6 +15262,22 @@ impl NestedType for SubnetworkAggregatedListWarning {} impl Part for SubnetworkAggregatedListWarning {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InstanceGroupManagersScopedList { + /// [Output Only] The warning that replaces the list of managed instance groups when the list is empty. + pub warning: Option, + /// [Output Only] The list of managed instance groups that are contained in the specified project and zone. + #[serde(rename="instanceGroupManagers")] + pub instance_group_managers: Option>, +} + +impl Part for InstanceGroupManagersScopedList {} + + /// Commitment for a particular resource (a Commitment is composed of one or more of these). /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -13783,33 +15360,108 @@ pub struct NodeGroupsAddNodesRequest { impl RequestValue for NodeGroupsAddNodesRequest {} -/// Sets the scheduling options for an Instance. +/// There is no detailed description. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [set scheduling instances](struct.InstanceSetSchedulingCall.html) (request) +/// * [get router status routers](struct.RouterGetRouterStatuCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Scheduling { - /// Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). You can only set the automatic restart option for standard instances. Preemptible instances cannot be automatically restarted. - /// - /// By default, this is set to true so an instance is automatically restarted if it is terminated by Compute Engine. - #[serde(rename="automaticRestart")] - pub automatic_restart: Option, - /// A set of node affinity and anti-affinity. - #[serde(rename="nodeAffinities")] - pub node_affinities: Option>, - /// Defines whether the instance is preemptible. This can only be set during instance creation, it cannot be set or changed after the instance has been created. - pub preemptible: Option, - /// Defines the maintenance behavior for this instance. For standard instances, the default behavior is MIGRATE. For preemptible instances, the default and only possible behavior is TERMINATE. For more information, see Setting Instance Scheduling Options. - #[serde(rename="onHostMaintenance")] - pub on_host_maintenance: Option, +pub struct RouterStatusResponse { + /// Type of resource. + pub kind: Option, + /// no description provided + pub result: Option, } -impl RequestValue for Scheduling {} +impl ResponseResult for RouterStatusResponse {} + + +/// A persistent disk snapshot resource. (== resource_for beta.snapshots ==) (== resource_for v1.snapshots ==) +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set iam policy snapshots](struct.SnapshotSetIamPolicyCall.html) (none) +/// * [delete snapshots](struct.SnapshotDeleteCall.html) (none) +/// * [get iam policy snapshots](struct.SnapshotGetIamPolicyCall.html) (none) +/// * [test iam permissions snapshots](struct.SnapshotTestIamPermissionCall.html) (none) +/// * [get snapshots](struct.SnapshotGetCall.html) (response) +/// * [create snapshot region disks](struct.RegionDiskCreateSnapshotCall.html) (request) +/// * [create snapshot disks](struct.DiskCreateSnapshotCall.html) (request) +/// * [list snapshots](struct.SnapshotListCall.html) (none) +/// * [set labels snapshots](struct.SnapshotSetLabelCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Snapshot { + /// [Output Only] The status of the snapshot. This can be CREATING, DELETING, FAILED, READY, or UPLOADING. + pub status: Option, + /// The customer-supplied encryption key of the source disk. Required if the source disk is protected by a customer-supplied encryption key. + #[serde(rename="sourceDiskEncryptionKey")] + pub source_disk_encryption_key: Option, + /// An optional description of this resource. Provide this property when you create the resource. + pub description: Option, + /// A fingerprint for the labels being applied to this snapshot, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. + /// + /// To see the latest fingerprint, make a get() request to retrieve a snapshot. + #[serde(rename="labelFingerprint")] + pub label_fingerprint: Option, + /// Labels to apply to this snapshot. These can be later modified by the setLabels method. Label values may be empty. + pub labels: Option>, + /// [Output Only] The ID value of the disk used to create this snapshot. This value may be used to determine whether the snapshot was taken from the current or a previous instance of a given disk name. + #[serde(rename="sourceDiskId")] + pub source_disk_id: Option, + /// [Output Only] A list of public visible licenses that apply to this snapshot. This can be because the original image had licenses attached (such as a Windows image). + pub licenses: Option>, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// [Output Only] Integer license codes indicating which licenses are attached to this snapshot. + #[serde(rename="licenseCodes")] + pub license_codes: Option>, + /// [Output Only] Type of the resource. Always compute#snapshot for Snapshot resources. + pub kind: Option, + /// [Output Only] A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion. + #[serde(rename="storageBytes")] + pub storage_bytes: Option, + /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, + /// [Output Only] The source disk used to create this snapshot. + #[serde(rename="sourceDisk")] + pub source_disk: Option, + /// [Output Only] Size of the snapshot, specified in GB. + #[serde(rename="diskSizeGb")] + pub disk_size_gb: Option, + /// GCS bucket storage location of the snapshot (regional or multi-regional). + #[serde(rename="storageLocations")] + pub storage_locations: Option>, + /// Encrypts the snapshot using a customer-supplied encryption key. + /// + /// After you encrypt a snapshot using a customer-supplied key, you must provide the same key if you use the image later For example, you must provide the encryption key when you create a disk from the encrypted snapshot in a future request. + /// + /// Customer-supplied encryption keys do not protect access to metadata of the disk. + /// + /// If you do not provide an encryption key when creating the snapshot, then the snapshot will be encrypted using an automatically generated key and you do not need to provide a key to use the snapshot later. + #[serde(rename="snapshotEncryptionKey")] + pub snapshot_encryption_key: Option, + /// [Output Only] An indicator whether storageBytes is in a stable state or it is being adjusted as a result of shared storage reallocation. This status can either be UPDATING, meaning the size of the snapshot is being updated, or UP_TO_DATE, meaning the size of the snapshot is up-to-date. + #[serde(rename="storageBytesStatus")] + pub storage_bytes_status: Option, + /// [Output Only] Server-defined URL for the resource. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl RequestValue for Snapshot {} +impl Resource for Snapshot {} +impl ResponseResult for Snapshot {} /// There is no detailed description. @@ -13817,15 +15469,15 @@ impl RequestValue for Scheduling {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetPoolsScopedList { - /// Informational warning which replaces the list of addresses when the list is empty. - pub warning: Option, - /// A list of target pools contained in this scope. - #[serde(rename="targetPools")] - pub target_pools: Option>, +pub struct NetworkEndpointGroupsScopedList { + /// [Output Only] An informational warning that replaces the list of network endpoint groups when the list is empty. + pub warning: Option, + /// [Output Only] The list of network endpoint groups that are contained in this scope. + #[serde(rename="networkEndpointGroups")] + pub network_endpoint_groups: Option>, } -impl Part for TargetPoolsScopedList {} +impl Part for NetworkEndpointGroupsScopedList {} /// There is no detailed description. @@ -14079,19 +15731,20 @@ impl<'a, C, A> BackendBucketMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of BackendBucket resources available to the specified project. + /// Adds a key for validating requests with signed URLs for this backend bucket. /// /// # Arguments /// + /// * `request` - No description provided. /// * `project` - Project ID for this request. - pub fn list(&self, project: &str) -> BackendBucketListCall<'a, C, A> { - BackendBucketListCall { + /// * `backendBucket` - Name of the BackendBucket resource to which the Signed URL Key should be added. The name should conform to RFC1035. + pub fn add_signed_url_key(&self, request: SignedUrlKey, project: &str, backend_bucket: &str) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { + BackendBucketAddSignedUrlKeyCall { hub: self.hub, + _request: request, _project: project.to_string(), - _page_token: Default::default(), - _order_by: Default::default(), - _max_results: Default::default(), - _filter: Default::default(), + _backend_bucket: backend_bucket.to_string(), + _request_id: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -14159,6 +15812,27 @@ impl<'a, C, A> BackendBucketMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of BackendBucket resources available to the specified project. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + pub fn list(&self, project: &str) -> BackendBucketListCall<'a, C, A> { + BackendBucketListCall { + hub: self.hub, + _project: project.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates the specified BackendBucket resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. @@ -14202,28 +15876,6 @@ impl<'a, C, A> BackendBucketMethods<'a, C, A> { _additional_params: Default::default(), } } - - /// Create a builder to help you perform the following task: - /// - /// Adds a key for validating requests with signed URLs for this backend bucket. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `project` - Project ID for this request. - /// * `backendBucket` - Name of the BackendBucket resource to which the Signed URL Key should be added. The name should conform to RFC1035. - pub fn add_signed_url_key(&self, request: SignedUrlKey, project: &str, backend_bucket: &str) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { - BackendBucketAddSignedUrlKeyCall { - hub: self.hub, - _request: request, - _project: project.to_string(), - _backend_bucket: backend_bucket.to_string(), - _request_id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } } @@ -14462,7 +16114,7 @@ impl<'a, C, A> TargetSslProxyMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `add_nodes(...)`, `aggregated_list(...)`, `delete(...)`, `delete_nodes(...)`, `get(...)`, `insert(...)`, `list(...)`, `list_nodes(...)` and `set_node_template(...)` +/// // like `add_nodes(...)`, `aggregated_list(...)`, `delete(...)`, `delete_nodes(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `list_nodes(...)`, `set_iam_policy(...)`, `set_node_template(...)` and `test_iam_permissions(...)` /// // to build up your call. /// let rb = hub.node_groups(); /// # } @@ -14570,6 +16222,27 @@ impl<'a, C, A> NodeGroupMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. May be empty if no such policy or resource exists. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn get_iam_policy(&self, project: &str, zone: &str, resource: &str) -> NodeGroupGetIamPolicyCall<'a, C, A> { + NodeGroupGetIamPolicyCall { + hub: self.hub, + _project: project.to_string(), + _zone: zone.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates the node template of the node group. @@ -14579,7 +16252,7 @@ impl<'a, C, A> NodeGroupMethods<'a, C, A> { /// * `request` - No description provided. /// * `project` - Project ID for this request. /// * `zone` - The name of the zone for this request. - /// * `nodeGroup` - Name of the NodeGroup resource to delete. + /// * `nodeGroup` - Name of the NodeGroup resource to update. pub fn set_node_template(&self, request: NodeGroupsSetNodeTemplateRequest, project: &str, zone: &str, node_group: &str) -> NodeGroupSetNodeTemplateCall<'a, C, A> { NodeGroupSetNodeTemplateCall { hub: self.hub, @@ -14594,6 +16267,50 @@ impl<'a, C, A> NodeGroupMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details about each group. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + pub fn aggregated_list(&self, project: &str) -> NodeGroupAggregatedListCall<'a, C, A> { + NodeGroupAggregatedListCall { + hub: self.hub, + _project: project.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, zone: &str, resource: &str) -> NodeGroupTestIamPermissionCall<'a, C, A> { + NodeGroupTestIamPermissionCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Deletes the specified NodeGroup resource. @@ -14642,19 +16359,21 @@ impl<'a, C, A> NodeGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details about each group. + /// Sets the access control policy on the specified resource. Replaces any existing policy. /// /// # Arguments /// + /// * `request` - No description provided. /// * `project` - Project ID for this request. - pub fn aggregated_list(&self, project: &str) -> NodeGroupAggregatedListCall<'a, C, A> { - NodeGroupAggregatedListCall { + /// * `zone` - The name of the zone for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn set_iam_policy(&self, request: ZoneSetPolicyRequest, project: &str, zone: &str, resource: &str) -> NodeGroupSetIamPolicyCall<'a, C, A> { + NodeGroupSetIamPolicyCall { hub: self.hub, + _request: request, _project: project.to_string(), - _page_token: Default::default(), - _order_by: Default::default(), - _max_results: Default::default(), - _filter: Default::default(), + _zone: zone.to_string(), + _resource: resource.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -14670,7 +16389,7 @@ impl<'a, C, A> NodeGroupMethods<'a, C, A> { /// * `request` - No description provided. /// * `project` - Project ID for this request. /// * `zone` - The name of the zone for this request. - /// * `nodeGroup` - Name of the NodeGroup resource to delete. + /// * `nodeGroup` - Name of the NodeGroup resource. pub fn add_nodes(&self, request: NodeGroupsAddNodesRequest, project: &str, zone: &str, node_group: &str) -> NodeGroupAddNodeCall<'a, C, A> { NodeGroupAddNodeCall { hub: self.hub, @@ -14809,6 +16528,27 @@ impl<'a, C, A> UrlMapMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of UrlMap resources available to the specified project. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + pub fn list(&self, project: &str) -> UrlMapListCall<'a, C, A> { + UrlMapListCall { + hub: self.hub, + _project: project.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates the specified UrlMap resource with the data included in the request. @@ -14851,27 +16591,6 @@ impl<'a, C, A> UrlMapMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Retrieves the list of UrlMap resources available to the specified project. - /// - /// # Arguments - /// - /// * `project` - Project ID for this request. - pub fn list(&self, project: &str) -> UrlMapListCall<'a, C, A> { - UrlMapListCall { - hub: self.hub, - _project: project.to_string(), - _page_token: Default::default(), - _order_by: Default::default(), - _max_results: Default::default(), - _filter: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. @@ -15043,7 +16762,7 @@ impl<'a, C, A> GlobalAddresseMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `get(...)`, `insert(...)` and `list(...)` +/// // like `delete(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `set_iam_policy(...)` and `test_iam_permissions(...)` /// // to build up your call. /// let rb = hub.instance_templates(); /// # } @@ -15060,7 +16779,7 @@ impl<'a, C, A> InstanceTemplateMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of instance templates that are contained within the specified project and zone. + /// Retrieves a list of instance templates that are contained within the specified project. /// /// # Arguments /// @@ -15081,7 +16800,26 @@ impl<'a, C, A> InstanceTemplateMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. It's not possible to delete templates which are in use by an instance group. + /// Gets the access control policy for a resource. May be empty if no such policy or resource exists. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn get_iam_policy(&self, project: &str, resource: &str) -> InstanceTemplateGetIamPolicyCall<'a, C, A> { + InstanceTemplateGetIamPolicyCall { + hub: self.hub, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. It is not possible to delete templates that are already in use by a managed instance group. /// /// # Arguments /// @@ -15099,6 +16837,48 @@ impl<'a, C, A> InstanceTemplateMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn set_iam_policy(&self, request: GlobalSetPolicyRequest, project: &str, resource: &str) -> InstanceTemplateSetIamPolicyCall<'a, C, A> { + InstanceTemplateSetIamPolicyCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, resource: &str) -> InstanceTemplateTestIamPermissionCall<'a, C, A> { + InstanceTemplateTestIamPermissionCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates an instance template in the specified project using the data that is included in the request. If you are creating a new template to update an existing instance group, your new instance template must use the same network or, if applicable, the same subnetwork as the original template. @@ -15165,7 +16945,7 @@ impl<'a, C, A> InstanceTemplateMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `get(...)`, `list(...)` and `set_labels(...)` +/// // like `delete(...)`, `get(...)`, `get_iam_policy(...)`, `list(...)`, `set_iam_policy(...)`, `set_labels(...)` and `test_iam_permissions(...)` /// // to build up your call. /// let rb = hub.snapshots(); /// # } @@ -15180,6 +16960,27 @@ impl<'a, C, A> MethodsBuilder for SnapshotMethods<'a, C, A> {} impl<'a, C, A> SnapshotMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, resource: &str) -> SnapshotTestIamPermissionCall<'a, C, A> { + SnapshotTestIamPermissionCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Retrieves the list of Snapshot resources contained within the specified project. @@ -15205,7 +17006,7 @@ impl<'a, C, A> SnapshotMethods<'a, C, A> { /// /// Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. /// - /// For more information, see Deleting snaphots. + /// For more information, see Deleting snapshots. /// /// # Arguments /// @@ -15223,6 +17024,27 @@ impl<'a, C, A> SnapshotMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn set_iam_policy(&self, request: GlobalSetPolicyRequest, project: &str, resource: &str) -> SnapshotSetIamPolicyCall<'a, C, A> { + SnapshotSetIamPolicyCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Returns the specified Snapshot resource. Gets a list of available snapshots by making a list() request. @@ -15250,7 +17072,7 @@ impl<'a, C, A> SnapshotMethods<'a, C, A> { /// /// * `request` - No description provided. /// * `project` - Project ID for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn set_labels(&self, request: GlobalSetLabelsRequest, project: &str, resource: &str) -> SnapshotSetLabelCall<'a, C, A> { SnapshotSetLabelCall { hub: self.hub, @@ -15262,6 +17084,25 @@ impl<'a, C, A> SnapshotMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. May be empty if no such policy or resource exists. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn get_iam_policy(&self, project: &str, resource: &str) -> SnapshotGetIamPolicyCall<'a, C, A> { + SnapshotGetIamPolicyCall { + hub: self.hub, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -15479,7 +17320,7 @@ impl<'a, C, A> ZoneMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `add_access_config(...)`, `aggregated_list(...)`, `attach_disk(...)`, `delete(...)`, `delete_access_config(...)`, `detach_disk(...)`, `get(...)`, `get_serial_port_output(...)`, `insert(...)`, `list(...)`, `list_referrers(...)`, `reset(...)`, `set_deletion_protection(...)`, `set_disk_auto_delete(...)`, `set_labels(...)`, `set_machine_resources(...)`, `set_machine_type(...)`, `set_metadata(...)`, `set_min_cpu_platform(...)`, `set_scheduling(...)`, `set_service_account(...)`, `set_tags(...)`, `simulate_maintenance_event(...)`, `start(...)`, `start_with_encryption_key(...)`, `stop(...)`, `update_access_config(...)` and `update_network_interface(...)` +/// // like `add_access_config(...)`, `aggregated_list(...)`, `attach_disk(...)`, `delete(...)`, `delete_access_config(...)`, `detach_disk(...)`, `get(...)`, `get_iam_policy(...)`, `get_serial_port_output(...)`, `get_shielded_instance_identity(...)`, `insert(...)`, `list(...)`, `list_referrers(...)`, `reset(...)`, `set_deletion_protection(...)`, `set_disk_auto_delete(...)`, `set_iam_policy(...)`, `set_labels(...)`, `set_machine_resources(...)`, `set_machine_type(...)`, `set_metadata(...)`, `set_min_cpu_platform(...)`, `set_scheduling(...)`, `set_service_account(...)`, `set_shielded_instance_integrity_policy(...)`, `set_tags(...)`, `simulate_maintenance_event(...)`, `start(...)`, `start_with_encryption_key(...)`, `stop(...)`, `test_iam_permissions(...)`, `update_access_config(...)`, `update_network_interface(...)` and `update_shielded_instance_config(...)` /// // to build up your call. /// let rb = hub.instances(); /// # } @@ -15518,32 +17359,6 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Adds an access config to an instance's network interface. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `project` - Project ID for this request. - /// * `zone` - The name of the zone for this request. - /// * `instance` - The instance name for this request. - /// * `networkInterface` - The name of the network interface to add to this instance. - pub fn add_access_config(&self, request: AccessConfig, project: &str, zone: &str, instance: &str, network_interface: &str) -> InstanceAddAccessConfigCall<'a, C, A> { - InstanceAddAccessConfigCall { - hub: self.hub, - _request: request, - _project: project.to_string(), - _zone: zone.to_string(), - _instance: instance.to_string(), - _network_interface: network_interface.to_string(), - _request_id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Changes the number and/or type of accelerator for a stopped instance to the values specified in the request. @@ -15577,7 +17392,7 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { /// * `request` - No description provided. /// * `project` - Project ID for this request. /// * `zone` - The name of the zone for this request. - /// * `instance` - Instance name. + /// * `instance` - Instance name for this request. pub fn set_scheduling(&self, request: Scheduling, project: &str, zone: &str, instance: &str) -> InstanceSetSchedulingCall<'a, C, A> { InstanceSetSchedulingCall { hub: self.hub, @@ -15664,7 +17479,7 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Performs a reset on the instance. For more information, see Resetting an instance. + /// Performs a reset on the instance. This is a hard reset the VM does not do a graceful shutdown. For more information, see Resetting an instance. /// /// # Arguments /// @@ -15733,7 +17548,7 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets tags for the specified instance to the data included in the request. + /// Sets network tags for the specified instance to the data included in the request. /// /// # Arguments /// @@ -15787,8 +17602,8 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { /// /// * `project` - Project ID for this request. /// * `zone` - The name of the zone for this request. - /// * `instance` - Instance name. - /// * `deviceName` - Disk device name to detach. + /// * `instance` - Instance name for this request. + /// * `deviceName` - The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names. pub fn detach_disk(&self, project: &str, zone: &str, instance: &str, device_name: &str) -> InstanceDetachDiskCall<'a, C, A> { InstanceDetachDiskCall { hub: self.hub, @@ -15803,6 +17618,27 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. May be empty if no such policy or resource exists. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn get_iam_policy(&self, project: &str, zone: &str, resource: &str) -> InstanceGetIamPolicyCall<'a, C, A> { + InstanceGetIamPolicyCall { + hub: self.hub, + _project: project.to_string(), + _zone: zone.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance. @@ -15830,7 +17666,7 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of referrers to instances contained within the specified zone. + /// Retrieves the list of referrers to instances contained within the specified zone. For more information, read Viewing Referrers to VM Instances. /// /// # Arguments /// @@ -15993,6 +17829,30 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `instance` - Name or id of the instance scoping this request. + pub fn set_shielded_instance_integrity_policy(&self, request: ShieldedInstanceIntegrityPolicy, project: &str, zone: &str, instance: &str) -> InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> { + InstanceSetShieldedInstanceIntegrityPolicyCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _instance: instance.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform. @@ -16017,6 +17877,53 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `instance` - Name or id of the instance scoping this request. + pub fn update_shielded_instance_config(&self, request: ShieldedInstanceConfig, project: &str, zone: &str, instance: &str) -> InstanceUpdateShieldedInstanceConfigCall<'a, C, A> { + InstanceUpdateShieldedInstanceConfigCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _instance: instance.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, zone: &str, resource: &str) -> InstanceTestIamPermissionCall<'a, C, A> { + InstanceTestIamPermissionCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates an instance resource in the specified project using the data included in the request. @@ -16071,9 +17978,9 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { /// /// * `project` - Project ID for this request. /// * `zone` - The name of the zone for this request. - /// * `instance` - The instance name. + /// * `instance` - The instance name for this request. /// * `autoDelete` - Whether to auto-delete the disk when the instance is deleted. - /// * `deviceName` - The device name of the disk to modify. + /// * `deviceName` - The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names. pub fn set_disk_auto_delete(&self, project: &str, zone: &str, instance: &str, auto_delete: bool, device_name: &str) -> InstanceSetDiskAutoDeleteCall<'a, C, A> { InstanceSetDiskAutoDeleteCall { hub: self.hub, @@ -16089,6 +17996,32 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Adds an access config to an instance's network interface. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `instance` - The instance name for this request. + /// * `networkInterface` - The name of the network interface to add to this instance. + pub fn add_access_config(&self, request: AccessConfig, project: &str, zone: &str, instance: &str, network_interface: &str) -> InstanceAddAccessConfigCall<'a, C, A> { + InstanceAddAccessConfigCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _instance: instance.to_string(), + _network_interface: network_interface.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance. @@ -16111,6 +18044,50 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn set_iam_policy(&self, request: ZoneSetPolicyRequest, project: &str, zone: &str, resource: &str) -> InstanceSetIamPolicyCall<'a, C, A> { + InstanceSetIamPolicyCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the Shielded Instance Identity of an instance + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `instance` - Name or id of the instance scoping this request. + pub fn get_shielded_instance_identity(&self, project: &str, zone: &str, instance: &str) -> InstanceGetShieldedInstanceIdentityCall<'a, C, A> { + InstanceGetShieldedInstanceIdentityCall { + hub: self.hub, + _project: project.to_string(), + _zone: zone.to_string(), + _instance: instance.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Sets deletion protection on the instance. @@ -16119,7 +18096,7 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { /// /// * `project` - Project ID for this request. /// * `zone` - The name of the zone for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn set_deletion_protection(&self, project: &str, zone: &str, resource: &str) -> InstanceSetDeletionProtectionCall<'a, C, A> { InstanceSetDeletionProtectionCall { hub: self.hub, @@ -16199,6 +18176,26 @@ impl<'a, C, A> MethodsBuilder for SecurityPolicyMethods<'a, C, A> {} impl<'a, C, A> SecurityPolicyMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Deletes a rule at the specified priority. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `securityPolicy` - Name of the security policy to update. + pub fn remove_rule(&self, project: &str, security_policy: &str) -> SecurityPolicyRemoveRuleCall<'a, C, A> { + SecurityPolicyRemoveRuleCall { + hub: self.hub, + _project: project.to_string(), + _security_policy: security_policy.to_string(), + _priority: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Inserts a rule into a security policy. @@ -16363,26 +18360,6 @@ impl<'a, C, A> SecurityPolicyMethods<'a, C, A> { _additional_params: Default::default(), } } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a rule at the specified priority. - /// - /// # Arguments - /// - /// * `project` - Project ID for this request. - /// * `securityPolicy` - Name of the security policy to update. - pub fn remove_rule(&self, project: &str, security_policy: &str) -> SecurityPolicyRemoveRuleCall<'a, C, A> { - SecurityPolicyRemoveRuleCall { - hub: self.hub, - _project: project.to_string(), - _security_policy: security_policy.to_string(), - _priority: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } } @@ -16513,7 +18490,7 @@ impl<'a, C, A> BackendServiceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns the specified BackendService resource. Gets a list of available backend services by making a list() request. + /// Returns the specified BackendService resource. Gets a list of available backend services. /// /// # Arguments /// @@ -16685,7 +18662,7 @@ impl<'a, C, A> BackendServiceMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `deprecate(...)`, `get(...)`, `get_from_family(...)`, `insert(...)`, `list(...)` and `set_labels(...)` +/// // like `delete(...)`, `deprecate(...)`, `get(...)`, `get_from_family(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `set_iam_policy(...)`, `set_labels(...)` and `test_iam_permissions(...)` /// // to build up your call. /// let rb = hub.images(); /// # } @@ -16748,7 +18725,7 @@ impl<'a, C, A> ImageMethods<'a, C, A> { /// /// * `request` - No description provided. /// * `project` - Project ID for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn set_labels(&self, request: GlobalSetLabelsRequest, project: &str, resource: &str) -> ImageSetLabelCall<'a, C, A> { ImageSetLabelCall { hub: self.hub, @@ -16785,6 +18762,46 @@ impl<'a, C, A> ImageMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, resource: &str) -> ImageTestIamPermissionCall<'a, C, A> { + ImageTestIamPermissionCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. May be empty if no such policy or resource exists. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn get_iam_policy(&self, project: &str, resource: &str) -> ImageGetIamPolicyCall<'a, C, A> { + ImageGetIamPolicyCall { + hub: self.hub, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Returns the latest image that is part of an image family and is not deprecated. @@ -16844,6 +18861,27 @@ impl<'a, C, A> ImageMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn set_iam_policy(&self, request: GlobalSetPolicyRequest, project: &str, resource: &str) -> ImageSetIamPolicyCall<'a, C, A> { + ImageSetIamPolicyCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -17073,7 +19111,7 @@ impl<'a, C, A> RegionBackendServiceMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)` and `test_iam_permissions(...)` +/// // like `delete(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `set_iam_policy(...)` and `test_iam_permissions(...)` /// // to build up your call. /// let rb = hub.licenses(); /// # } @@ -17129,6 +19167,46 @@ impl<'a, C, A> LicenseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. May be empty if no such policy or resource exists. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn get_iam_policy(&self, project: &str, resource: &str) -> LicenseGetIamPolicyCall<'a, C, A> { + LicenseGetIamPolicyCall { + hub: self.hub, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn set_iam_policy(&self, request: GlobalSetPolicyRequest, project: &str, resource: &str) -> LicenseSetIamPolicyCall<'a, C, A> { + LicenseSetIamPolicyCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Returns the specified License resource. @@ -17156,7 +19234,7 @@ impl<'a, C, A> LicenseMethods<'a, C, A> { /// /// * `request` - No description provided. /// * `project` - Project ID for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, resource: &str) -> LicenseTestIamPermissionCall<'a, C, A> { LicenseTestIamPermissionCall { hub: self.hub, @@ -17370,29 +19448,6 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Retrieves the list of instance groups that are located in the specified project and zone. - /// - /// # Arguments - /// - /// * `project` - Project ID for this request. - /// * `zone` - The name of the zone where the instance group is located. - pub fn list(&self, project: &str, zone: &str) -> InstanceGroupListCall<'a, C, A> { - InstanceGroupListCall { - hub: self.hub, - _project: project.to_string(), - _zone: zone.to_string(), - _page_token: Default::default(), - _order_by: Default::default(), - _max_results: Default::default(), - _filter: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Lists the instances in the specified instance group. @@ -17440,6 +19495,29 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of instance groups that are located in the specified project and zone. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone where the instance group is located. + pub fn list(&self, project: &str, zone: &str) -> InstanceGroupListCall<'a, C, A> { + InstanceGroupListCall { + hub: self.hub, + _project: project.to_string(), + _zone: zone.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -18225,29 +20303,6 @@ impl<'a, C, A> RegionAutoscalerMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `project` - Project ID for this request. - /// * `region` - Name of the region scoping this request. - pub fn patch(&self, request: Autoscaler, project: &str, region: &str) -> RegionAutoscalerPatchCall<'a, C, A> { - RegionAutoscalerPatchCall { - hub: self.hub, - _request: request, - _project: project.to_string(), - _region: region.to_string(), - _request_id: Default::default(), - _autoscaler: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Retrieves a list of autoscalers contained within the specified region. @@ -18271,6 +20326,29 @@ impl<'a, C, A> RegionAutoscalerMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `region` - Name of the region scoping this request. + pub fn patch(&self, request: Autoscaler, project: &str, region: &str) -> RegionAutoscalerPatchCall<'a, C, A> { + RegionAutoscalerPatchCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _region: region.to_string(), + _request_id: Default::default(), + _autoscaler: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates an autoscaler in the specified project using the data included in the request. @@ -18495,7 +20573,7 @@ impl<'a, C, A> InterconnectAttachmentMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)` and `patch(...)` +/// // like `delete(...)`, `get(...)`, `get_diagnostics(...)`, `insert(...)`, `list(...)` and `patch(...)` /// // to build up your call. /// let rb = hub.interconnects(); /// # } @@ -18510,6 +20588,25 @@ impl<'a, C, A> MethodsBuilder for InterconnectMethods<'a, C, A> {} impl<'a, C, A> InterconnectMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Returns the interconnectDiagnostics for the specified interconnect. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `interconnect` - Name of the interconnect resource to query. + pub fn get_diagnostics(&self, project: &str, interconnect: &str) -> InterconnectGetDiagnosticCall<'a, C, A> { + InterconnectGetDiagnosticCall { + hub: self.hub, + _project: project.to_string(), + _interconnect: interconnect.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates the specified interconnect with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. @@ -18836,7 +20933,7 @@ impl<'a, C, A> AutoscalerMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `aggregated_list(...)`, `delete(...)`, `expand_ip_cidr_range(...)`, `get(...)`, `insert(...)`, `list(...)`, `list_usable(...)`, `patch(...)` and `set_private_ip_google_access(...)` +/// // like `aggregated_list(...)`, `delete(...)`, `expand_ip_cidr_range(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `list_usable(...)`, `patch(...)`, `set_iam_policy(...)`, `set_private_ip_google_access(...)` and `test_iam_permissions(...)` /// // to build up your call. /// let rb = hub.subnetworks(); /// # } @@ -18873,6 +20970,29 @@ impl<'a, C, A> SubnetworkMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `region` - The name of the region for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, region: &str, resource: &str) -> SubnetworkTestIamPermissionCall<'a, C, A> { + SubnetworkTestIamPermissionCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _region: region.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Retrieves an aggregated list of usable subnetworks. @@ -18964,6 +21084,50 @@ impl<'a, C, A> SubnetworkMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. May be empty if no such policy or resource exists. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `region` - The name of the region for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn get_iam_policy(&self, project: &str, region: &str, resource: &str) -> SubnetworkGetIamPolicyCall<'a, C, A> { + SubnetworkGetIamPolicyCall { + hub: self.hub, + _project: project.to_string(), + _region: region.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `region` - The name of the region for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn set_iam_policy(&self, request: RegionSetPolicyRequest, project: &str, region: &str, resource: &str) -> SubnetworkSetIamPolicyCall<'a, C, A> { + SubnetworkSetIamPolicyCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _region: region.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Retrieves a list of subnetworks available to the specified project. @@ -19010,7 +21174,7 @@ impl<'a, C, A> SubnetworkMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Patches the specified subnetwork with the data included in the request. Only the following fields within the subnetwork resource can be specified in the request: secondary_ip_range, allow_subnet_cidr_routes_overlap and role. It is also mandatory to specify the current fingeprint of the subnetwork resource being patched. + /// Patches the specified subnetwork with the data included in the request. Only certain fields can up updated with a patch request as indicated in the field descriptions. You must specify the current fingeprint of the subnetwork resource being patched. /// /// # Arguments /// @@ -20315,6 +22479,26 @@ impl<'a, C, A> MethodsBuilder for HttpsHealthCheckMethods<'a, C, A> {} impl<'a, C, A> HttpsHealthCheckMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified HttpsHealthCheck resource. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `httpsHealthCheck` - Name of the HttpsHealthCheck resource to delete. + pub fn delete(&self, project: &str, https_health_check: &str) -> HttpsHealthCheckDeleteCall<'a, C, A> { + HttpsHealthCheckDeleteCall { + hub: self.hub, + _project: project.to_string(), + _https_health_check: https_health_check.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates a HttpsHealthCheck resource in the specified project using the data included in the request. @@ -20398,26 +22582,6 @@ impl<'a, C, A> HttpsHealthCheckMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Deletes the specified HttpsHealthCheck resource. - /// - /// # Arguments - /// - /// * `project` - Project ID for this request. - /// * `httpsHealthCheck` - Name of the HttpsHealthCheck resource to delete. - pub fn delete(&self, project: &str, https_health_check: &str) -> HttpsHealthCheckDeleteCall<'a, C, A> { - HttpsHealthCheckDeleteCall { - hub: self.hub, - _project: project.to_string(), - _https_health_check: https_health_check.to_string(), - _request_id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Retrieves the list of HttpsHealthCheck resources available to the specified project. @@ -20442,6 +22606,255 @@ impl<'a, C, A> HttpsHealthCheckMethods<'a, C, A> { +/// A builder providing access to all methods supported on *networkEndpointGroup* resources. +/// It is not used directly, but through the `Compute` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_compute1 as compute1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use compute1::Compute; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `aggregated_list(...)`, `attach_network_endpoints(...)`, `delete(...)`, `detach_network_endpoints(...)`, `get(...)`, `insert(...)`, `list(...)`, `list_network_endpoints(...)` and `test_iam_permissions(...)` +/// // to build up your call. +/// let rb = hub.network_endpoint_groups(); +/// # } +/// ``` +pub struct NetworkEndpointGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, +} + +impl<'a, C, A> MethodsBuilder for NetworkEndpointGroupMethods<'a, C, A> {} + +impl<'a, C, A> NetworkEndpointGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified network endpoint group. The network endpoints in the NEG and the VM instances they belong to are not terminated when the NEG is deleted. Note that the NEG cannot be deleted if there are backend services referencing it. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// * `networkEndpointGroup` - The name of the network endpoint group to delete. It should comply with RFC1035. + pub fn delete(&self, project: &str, zone: &str, network_endpoint_group: &str) -> NetworkEndpointGroupDeleteCall<'a, C, A> { + NetworkEndpointGroupDeleteCall { + hub: self.hub, + _project: project.to_string(), + _zone: zone.to_string(), + _network_endpoint_group: network_endpoint_group.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Detach a list of network endpoints from the specified network endpoint group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// * `networkEndpointGroup` - The name of the network endpoint group where you are removing network endpoints. It should comply with RFC1035. + pub fn detach_network_endpoints(&self, request: NetworkEndpointGroupsDetachEndpointsRequest, project: &str, zone: &str, network_endpoint_group: &str) -> NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> { + NetworkEndpointGroupDetachNetworkEndpointCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _network_endpoint_group: network_endpoint_group.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of network endpoint groups that are located in the specified project and zone. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone where the network endpoint group is located. It should comply with RFC1035. + pub fn list(&self, project: &str, zone: &str) -> NetworkEndpointGroupListCall<'a, C, A> { + NetworkEndpointGroupListCall { + hub: self.hub, + _project: project.to_string(), + _zone: zone.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a network endpoint group in the specified project using the parameters that are included in the request. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone where you want to create the network endpoint group. It should comply with RFC1035. + pub fn insert(&self, request: NetworkEndpointGroup, project: &str, zone: &str) -> NetworkEndpointGroupInsertCall<'a, C, A> { + NetworkEndpointGroupInsertCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, zone: &str, resource: &str) -> NetworkEndpointGroupTestIamPermissionCall<'a, C, A> { + NetworkEndpointGroupTestIamPermissionCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Attach a list of network endpoints to the specified network endpoint group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// * `networkEndpointGroup` - The name of the network endpoint group where you are attaching network endpoints to. It should comply with RFC1035. + pub fn attach_network_endpoints(&self, request: NetworkEndpointGroupsAttachEndpointsRequest, project: &str, zone: &str, network_endpoint_group: &str) -> NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> { + NetworkEndpointGroupAttachNetworkEndpointCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _network_endpoint_group: network_endpoint_group.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of network endpoint groups and sorts them by zone. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + pub fn aggregated_list(&self, project: &str) -> NetworkEndpointGroupAggregatedListCall<'a, C, A> { + NetworkEndpointGroupAggregatedListCall { + hub: self.hub, + _project: project.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the network endpoints in the specified network endpoint group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// * `networkEndpointGroup` - The name of the network endpoint group from which you want to generate a list of included network endpoints. It should comply with RFC1035. + pub fn list_network_endpoints(&self, request: NetworkEndpointGroupsListEndpointsRequest, project: &str, zone: &str, network_endpoint_group: &str) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> { + NetworkEndpointGroupListNetworkEndpointCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _network_endpoint_group: network_endpoint_group.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// * `networkEndpointGroup` - The name of the network endpoint group. It should comply with RFC1035. + pub fn get(&self, project: &str, zone: &str, network_endpoint_group: &str) -> NetworkEndpointGroupGetCall<'a, C, A> { + NetworkEndpointGroupGetCall { + hub: self.hub, + _project: project.to_string(), + _zone: zone.to_string(), + _network_endpoint_group: network_endpoint_group.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *licenseCode* resources. /// It is not used directly, but through the `Compute` hub. /// @@ -20508,7 +22921,7 @@ impl<'a, C, A> LicenseCodeMethods<'a, C, A> { /// /// * `request` - No description provided. /// * `project` - Project ID for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, resource: &str) -> LicenseCodeTestIamPermissionCall<'a, C, A> { LicenseCodeTestIamPermissionCall { hub: self.hub, @@ -20685,7 +23098,7 @@ impl<'a, C, A> RegionInstanceGroupMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `aggregated_list(...)`, `delete(...)`, `get(...)`, `get_router_status(...)`, `insert(...)`, `list(...)`, `patch(...)`, `preview(...)` and `update(...)` +/// // like `aggregated_list(...)`, `delete(...)`, `get(...)`, `get_nat_mapping_info(...)`, `get_router_status(...)`, `insert(...)`, `list(...)`, `patch(...)`, `preview(...)` and `update(...)` /// // to build up your call. /// let rb = hub.routers(); /// # } @@ -20879,6 +23292,31 @@ impl<'a, C, A> RouterMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Retrieves runtime Nat mapping information of VM endpoints. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `region` - Name of the region for this request. + /// * `router` - Name of the Router resource to query for Nat Mapping information of VM endpoints. + pub fn get_nat_mapping_info(&self, project: &str, region: &str, router: &str) -> RouterGetNatMappingInfoCall<'a, C, A> { + RouterGetNatMappingInfoCall { + hub: self.hub, + _project: project.to_string(), + _region: region.to_string(), + _router: router.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates a Router resource in the specified project and region using the data included in the request. @@ -21094,7 +23532,7 @@ impl<'a, C, A> HealthCheckMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `abandon_instances(...)`, `delete(...)`, `delete_instances(...)`, `get(...)`, `insert(...)`, `list(...)`, `list_managed_instances(...)`, `recreate_instances(...)`, `resize(...)`, `set_instance_template(...)` and `set_target_pools(...)` +/// // like `abandon_instances(...)`, `delete(...)`, `delete_instances(...)`, `get(...)`, `insert(...)`, `list(...)`, `list_managed_instances(...)`, `patch(...)`, `recreate_instances(...)`, `resize(...)`, `set_instance_template(...)` and `set_target_pools(...)` /// // to build up your call. /// let rb = hub.region_instance_group_managers(); /// # } @@ -21111,7 +23549,7 @@ impl<'a, C, A> RegionInstanceGroupManagerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Schedules a group action to delete the specified instances in the managed instance group. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. + /// Flags the specified instances in the managed instance group to be immediately deleted. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. The deleteInstances operation is marked DONE if the deleteInstances request is successful. The underlying actions take additional time. You must separately verify the status of the deleting action with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -21185,7 +23623,9 @@ impl<'a, C, A> RegionInstanceGroupManagerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Changes the intended size for the managed instance group. If you increase the size, the group schedules actions to create new instances using the current instance template. If you decrease the size, the group schedules delete actions on one or more instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. + /// Changes the intended size of the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes one or more instances. + /// + /// The resize operation is marked DONE if the resize request is successful. The underlying actions take additional time. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -21235,7 +23675,7 @@ impl<'a, C, A> RegionInstanceGroupManagerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a managed instance group using the information that you specify in the request. After the group is created, it schedules an action to create instances in the group using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. + /// Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. /// /// A regional managed instance group can contain up to 2000 instances. /// @@ -21305,7 +23745,31 @@ impl<'a, C, A> RegionInstanceGroupManagerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Schedules a group action to recreate the specified instances in the managed instance group. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the action is scheduled even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. + /// Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listmanagedinstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `region` - Name of the region scoping this request. + /// * `instanceGroupManager` - The name of the instance group manager. + pub fn patch(&self, request: InstanceGroupManager, project: &str, region: &str, instance_group_manager: &str) -> RegionInstanceGroupManagerPatchCall<'a, C, A> { + RegionInstanceGroupManagerPatchCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _region: region.to_string(), + _instance_group_manager: instance_group_manager.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Flags the specified instances in the managed instance group to be immediately recreated. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -21356,7 +23820,7 @@ impl<'a, C, A> RegionInstanceGroupManagerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Schedules a group action to remove the specified instances from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. + /// Flags the specified instances to be immediately removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -21796,7 +24260,7 @@ impl<'a, C, A> TargetVpnGatewayMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `abandon_instances(...)`, `aggregated_list(...)`, `delete(...)`, `delete_instances(...)`, `get(...)`, `insert(...)`, `list(...)`, `list_managed_instances(...)`, `recreate_instances(...)`, `resize(...)`, `set_instance_template(...)` and `set_target_pools(...)` +/// // like `abandon_instances(...)`, `aggregated_list(...)`, `delete(...)`, `delete_instances(...)`, `get(...)`, `insert(...)`, `list(...)`, `list_managed_instances(...)`, `patch(...)`, `recreate_instances(...)`, `resize(...)`, `set_instance_template(...)` and `set_target_pools(...)` /// // to build up your call. /// let rb = hub.instance_group_managers(); /// # } @@ -21838,7 +24302,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a managed instance group using the information that you specify in the request. After the group is created, it schedules an action to create instances in the group using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. + /// Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. /// /// A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit. /// @@ -21862,7 +24326,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Schedules a group action to recreate the specified instances in the managed instance group. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the action is scheduled even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. + /// Flags the specified instances in the managed instance group to be immediately recreated. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -22003,7 +24467,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Schedules a group action to remove the specified instances from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. + /// Flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -22029,10 +24493,40 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone where you want to create the managed instance group. + /// * `instanceGroupManager` - The name of the instance group manager. + pub fn patch(&self, request: InstanceGroupManager, project: &str, zone: &str, instance_group_manager: &str) -> InstanceGroupManagerPatchCall<'a, C, A> { + InstanceGroupManagerPatchCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _instance_group_manager: instance_group_manager.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. /// + /// When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: + /// + /// + The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. + /// + /// This list is subject to change. + /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// /// # Arguments @@ -22057,7 +24551,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Schedules a group action to delete the specified instances in the managed instance group. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. + /// Flags the specified instances in the managed instance group for immediate deletion. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -22295,6 +24789,26 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + pub fn enable_xpn_resource(&self, request: ProjectsEnableXpnResourceRequest, project: &str) -> ProjectEnableXpnResourceCall<'a, C, A> { + ProjectEnableXpnResourceCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _request_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Moves an instance and its attached persistent disks from one zone to another. @@ -22407,26 +24921,6 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `project` - Project ID for this request. - pub fn enable_xpn_resource(&self, request: ProjectsEnableXpnResourceRequest, project: &str) -> ProjectEnableXpnResourceCall<'a, C, A> { - ProjectEnableXpnResourceCall { - hub: self.hub, - _request: request, - _project: project.to_string(), - _request_id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field. @@ -22559,7 +25053,7 @@ impl<'a, C, A> RegionDiskMethods<'a, C, A> { /// * `request` - No description provided. /// * `project` - Project ID for this request. /// * `region` - The region for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn set_labels(&self, request: RegionSetLabelsRequest, project: &str, region: &str, resource: &str) -> RegionDiskSetLabelCall<'a, C, A> { RegionDiskSetLabelCall { hub: self.hub, @@ -22604,7 +25098,7 @@ impl<'a, C, A> RegionDiskMethods<'a, C, A> { /// * `request` - No description provided. /// * `project` - Project ID for this request. /// * `region` - The name of the region for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, region: &str, resource: &str) -> RegionDiskTestIamPermissionCall<'a, C, A> { RegionDiskTestIamPermissionCall { hub: self.hub, @@ -22796,6 +25290,27 @@ impl<'a, C, A> HttpHealthCheckMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of HttpHealthCheck resources available to the specified project. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + pub fn list(&self, project: &str) -> HttpHealthCheckListCall<'a, C, A> { + HttpHealthCheckListCall { + hub: self.hub, + _project: project.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates a HttpHealthCheck resource in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. @@ -22857,27 +25372,6 @@ impl<'a, C, A> HttpHealthCheckMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Retrieves the list of HttpHealthCheck resources available to the specified project. - /// - /// # Arguments - /// - /// * `project` - Project ID for this request. - pub fn list(&self, project: &str) -> HttpHealthCheckListCall<'a, C, A> { - HttpHealthCheckListCall { - hub: self.hub, - _project: project.to_string(), - _page_token: Default::default(), - _order_by: Default::default(), - _max_results: Default::default(), - _filter: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Updates a HttpHealthCheck resource in the specified project using the data included in the request. @@ -22927,7 +25421,7 @@ impl<'a, C, A> HttpHealthCheckMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `aggregated_list(...)`, `create_snapshot(...)`, `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `resize(...)` and `set_labels(...)` +/// // like `aggregated_list(...)`, `create_snapshot(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `resize(...)`, `set_iam_policy(...)`, `set_labels(...)` and `test_iam_permissions(...)` /// // to build up your call. /// let rb = hub.disks(); /// # } @@ -22964,6 +25458,29 @@ impl<'a, C, A> DiskMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn set_iam_policy(&self, request: ZoneSetPolicyRequest, project: &str, zone: &str, resource: &str) -> DiskSetIamPolicyCall<'a, C, A> { + DiskSetIamPolicyCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates a snapshot of a specified persistent disk. @@ -22989,6 +25506,29 @@ impl<'a, C, A> DiskMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, zone: &str, resource: &str) -> DiskTestIamPermissionCall<'a, C, A> { + DiskTestIamPermissionCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Retrieves an aggregated list of persistent disks. @@ -23042,7 +25582,7 @@ impl<'a, C, A> DiskMethods<'a, C, A> { /// * `request` - No description provided. /// * `project` - Project ID for this request. /// * `zone` - The name of the zone for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn set_labels(&self, request: ZoneSetLabelsRequest, project: &str, zone: &str, resource: &str) -> DiskSetLabelCall<'a, C, A> { DiskSetLabelCall { hub: self.hub, @@ -23104,6 +25644,27 @@ impl<'a, C, A> DiskMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. May be empty if no such policy or resource exists. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn get_iam_policy(&self, project: &str, zone: &str, resource: &str) -> DiskGetIamPolicyCall<'a, C, A> { + DiskGetIamPolicyCall { + hub: self.hub, + _project: project.to_string(), + _zone: zone.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Returns a specified persistent disk. Gets a list of available persistent disks by making a list() request. @@ -23910,29 +26471,6 @@ impl<'a, C, A> MethodsBuilder for VpnTunnelMethods<'a, C, A> {} impl<'a, C, A> VpnTunnelMethods<'a, C, A> { - /// Create a builder to help you perform the following task: - /// - /// Retrieves a list of VpnTunnel resources contained in the specified project and region. - /// - /// # Arguments - /// - /// * `project` - Project ID for this request. - /// * `region` - Name of the region for this request. - pub fn list(&self, project: &str, region: &str) -> VpnTunnelListCall<'a, C, A> { - VpnTunnelListCall { - hub: self.hub, - _project: project.to_string(), - _region: region.to_string(), - _page_token: Default::default(), - _order_by: Default::default(), - _max_results: Default::default(), - _filter: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Returns the specified VpnTunnel resource. Gets a list of available VPN tunnels by making a list() request. @@ -24018,6 +26556,29 @@ impl<'a, C, A> VpnTunnelMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of VpnTunnel resources contained in the specified project and region. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `region` - Name of the region for this request. + pub fn list(&self, project: &str, region: &str) -> VpnTunnelListCall<'a, C, A> { + VpnTunnelListCall { + hub: self.hub, + _project: project.to_string(), + _region: region.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -24046,7 +26607,7 @@ impl<'a, C, A> VpnTunnelMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `aggregated_list(...)`, `delete(...)`, `get(...)`, `insert(...)` and `list(...)` +/// // like `aggregated_list(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `set_iam_policy(...)` and `test_iam_permissions(...)` /// // to build up your call. /// let rb = hub.node_templates(); /// # } @@ -24169,6 +26730,73 @@ impl<'a, C, A> NodeTemplateMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. May be empty if no such policy or resource exists. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `region` - The name of the region for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn get_iam_policy(&self, project: &str, region: &str, resource: &str) -> NodeTemplateGetIamPolicyCall<'a, C, A> { + NodeTemplateGetIamPolicyCall { + hub: self.hub, + _project: project.to_string(), + _region: region.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `region` - The name of the region for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, region: &str, resource: &str) -> NodeTemplateTestIamPermissionCall<'a, C, A> { + NodeTemplateTestIamPermissionCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _region: region.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `region` - The name of the region for this request. + /// * `resource` - Name or id of the resource for this request. + pub fn set_iam_policy(&self, request: RegionSetPolicyRequest, project: &str, region: &str, resource: &str) -> NodeTemplateSetIamPolicyCall<'a, C, A> { + NodeTemplateSetIamPolicyCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _region: region.to_string(), + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -24391,10 +27019,7 @@ impl<'a, C, A> TargetTcpProxyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24414,7 +27039,7 @@ impl<'a, C, A> TargetTcpProxyDeleteCall<'a, C, A> where C: BorrowMut TargetTcpProxyDeleteCall<'a, C, A> where C: BorrowMut TargetTcpProxyGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24680,7 +27302,7 @@ impl<'a, C, A> TargetTcpProxyGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24768,7 +27390,7 @@ impl<'a, C, A> TargetTcpProxyGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24922,10 +27544,7 @@ impl<'a, C, A> TargetTcpProxyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24957,7 +27576,7 @@ impl<'a, C, A> TargetTcpProxyInsertCall<'a, C, A> where C: BorrowMut TargetTcpProxyInsertCall<'a, C, A> where C: BorrowMut TargetTcpProxySetBackendServiceCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25249,7 +27865,7 @@ impl<'a, C, A> TargetTcpProxySetBackendServiceCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25360,7 +27976,7 @@ impl<'a, C, A> TargetTcpProxySetBackendServiceCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25522,10 +28138,7 @@ impl<'a, C, A> TargetTcpProxyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25545,7 +28158,7 @@ impl<'a, C, A> TargetTcpProxyListCall<'a, C, A> where C: BorrowMut TargetTcpProxyListCall<'a, C, A> where C: BorrowMut TargetTcpProxySetProxyHeaderCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25852,7 +28462,7 @@ impl<'a, C, A> TargetTcpProxySetProxyHeaderCall<'a, C, A> where C: BorrowMut TargetTcpProxySetProxyHeaderCall<'a, C, A> where C: BorrowMut BackendBucketDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26135,7 +28742,7 @@ impl<'a, C, A> BackendBucketDeleteCall<'a, C, A> where C: BorrowMut BackendBucketDeleteCall<'a, C, A> where C: BorrowMut BackendBucketDeleteCall<'a, C, A> where C: BorrowMut BackendBucketDeleteCall<'a, C, A> where C: BorrowMut BackendBucketDeleteCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SignedUrlKey::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.backend_buckets().list("project") -/// .page_token("no") -/// .order_by("labore") -/// .max_results(62) -/// .filter("dolore") +/// let result = hub.backend_buckets().add_signed_url_key(req, "project", "backendBucket") +/// .request_id("labore") /// .doit(); /// # } /// ``` -pub struct BackendBucketListCall<'a, C, A> +pub struct BackendBucketAddSignedUrlKeyCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Compute, + _request: SignedUrlKey, _project: String, - _page_token: Option, - _order_by: Option, - _max_results: Option, - _filter: Option, + _backend_bucket: String, + _request_id: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for BackendBucketListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for BackendBucketAddSignedUrlKeyCall<'a, C, A> {} -impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> BackendBucketAddSignedUrlKeyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, BackendBucketList)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -26341,23 +28950,15 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.backendBuckets.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "compute.backendBuckets.addSignedUrlKey", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); params.push(("project", self._project.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); + params.push(("backendBucket", self._backend_bucket.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); } - if let Some(value) = self._order_by { - params.push(("orderBy", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } - for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { + for &field in ["alt", "project", "backendBucket", "requestId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -26369,12 +28970,12 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "{project}/global/backendBuckets"; + let mut url = self.hub._base_url.clone() + "{project}/global/backendBuckets/{backendBucket}/addSignedUrlKey"; if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{project}", "project")].iter() { + for &(find_this, param_name) in [("{project}", "project"), ("{backendBucket}", "backendBucket")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -26385,8 +28986,8 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["project"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["backendBucket", "project"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -26396,11 +28997,19 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -26417,11 +29026,15 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut } }; let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -26472,52 +29085,44 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut } + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SignedUrlKey) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { + self._request = new_value; + self + } /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> BackendBucketListCall<'a, C, A> { + pub fn project(mut self, new_value: &str) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// Name of the BackendBucket resource to which the Signed URL Key should be added. The name should conform to RFC1035. /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> BackendBucketListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); + /// Sets the *backend bucket* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn backend_bucket(mut self, new_value: &str) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { + self._backend_bucket = new_value.to_string(); self } - /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. /// - /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. /// - /// Currently, only sorting by name or creationTimestamp desc is supported. + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). /// - /// Sets the *order by* query property to the given value. - pub fn order_by(mut self, new_value: &str) -> BackendBucketListCall<'a, C, A> { - self._order_by = Some(new_value.to_string()); - self - } - /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> BackendBucketListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - /// - /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - /// - /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - /// - /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> BackendBucketListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -26526,7 +29131,7 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> BackendBucketListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -26535,7 +29140,7 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26547,7 +29152,7 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> BackendBucketListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -26556,7 +29161,7 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. + /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -26567,7 +29172,7 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> BackendBucketListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -26607,7 +29212,7 @@ impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.backend_buckets().delete_signed_url_key("project", "backendBucket", "keyName") -/// .request_id("Lorem") +/// .request_id("aliquyam") /// .doit(); /// # } /// ``` @@ -26686,10 +29291,7 @@ impl<'a, C, A> BackendBucketDeleteSignedUrlKeyCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26709,7 +29311,7 @@ impl<'a, C, A> BackendBucketDeleteSignedUrlKeyCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26818,7 +29420,7 @@ impl<'a, C, A> BackendBucketDeleteSignedUrlKeyCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26962,10 +29564,7 @@ impl<'a, C, A> BackendBucketGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26985,7 +29584,7 @@ impl<'a, C, A> BackendBucketGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -27073,7 +29672,7 @@ impl<'a, C, A> BackendBucketGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27227,10 +29826,7 @@ impl<'a, C, A> BackendBucketInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27262,7 +29858,7 @@ impl<'a, C, A> BackendBucketInsertCall<'a, C, A> where C: BorrowMut BackendBucketInsertCall<'a, C, A> where C: BorrowMut BackendBucketInsertCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.backend_buckets().list("project") +/// .page_token("et") +/// .order_by("eirmod") +/// .max_results(43) +/// .filter("et") +/// .doit(); +/// # } +/// ``` +pub struct BackendBucketListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BackendBucketListCall<'a, C, A> {} + +impl<'a, C, A> BackendBucketListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BackendBucketList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.backendBuckets.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/backendBuckets"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> BackendBucketListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> BackendBucketListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> BackendBucketListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> BackendBucketListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. + /// + /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. + /// + /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. + /// + /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> BackendBucketListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BackendBucketListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> BackendBucketListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BackendBucketListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates the specified BackendBucket resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. /// /// A builder for the *patch* method supported by a *backendBucket* resource. @@ -27441,7 +30335,7 @@ impl<'a, C, A> BackendBucketInsertCall<'a, C, A> where C: BorrowMut BackendBucketPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27554,7 +30445,7 @@ impl<'a, C, A> BackendBucketPatchCall<'a, C, A> where C: BorrowMut BackendBucketPatchCall<'a, C, A> where C: BorrowMut BackendBucketPatchCall<'a, C, A> where C: BorrowMut BackendBucketUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27856,7 +30744,7 @@ impl<'a, C, A> BackendBucketUpdateCall<'a, C, A> where C: BorrowMut BackendBucketUpdateCall<'a, C, A> where C: BorrowMut BackendBucketUpdateCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SignedUrlKey::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.backend_buckets().add_signed_url_key(req, "project", "backendBucket") -/// .request_id("sed") -/// .doit(); -/// # } -/// ``` -pub struct BackendBucketAddSignedUrlKeyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _request: SignedUrlKey, - _project: String, - _backend_bucket: String, - _request_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for BackendBucketAddSignedUrlKeyCall<'a, C, A> {} - -impl<'a, C, A> BackendBucketAddSignedUrlKeyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.backendBuckets.addSignedUrlKey", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("backendBucket", self._backend_bucket.to_string())); - if let Some(value) = self._request_id { - params.push(("requestId", value.to_string())); - } - for &field in ["alt", "project", "backendBucket", "requestId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/global/backendBuckets/{backendBucket}/addSignedUrlKey"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{backendBucket}", "backendBucket")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["backendBucket", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SignedUrlKey) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { - self._request = new_value; - self - } - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Name of the BackendBucket resource to which the Signed URL Key should be added. The name should conform to RFC1035. - /// - /// Sets the *backend bucket* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn backend_bucket(mut self, new_value: &str) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { - self._backend_bucket = new_value.to_string(); - self - } - /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - /// - /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - /// - /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - /// - /// Sets the *request id* query property to the given value. - pub fn request_id(mut self, new_value: &str) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { - self._request_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> BackendBucketAddSignedUrlKeyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Changes SslCertificates for TargetSslProxy. /// /// A builder for the *setSslCertificates* method supported by a *targetSslProxy* resource. @@ -28425,10 +31011,7 @@ impl<'a, C, A> TargetSslProxySetSslCertificateCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28460,7 +31043,7 @@ impl<'a, C, A> TargetSslProxySetSslCertificateCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -28571,7 +31154,7 @@ impl<'a, C, A> TargetSslProxySetSslCertificateCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28725,10 +31308,7 @@ impl<'a, C, A> TargetSslProxyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28760,7 +31340,7 @@ impl<'a, C, A> TargetSslProxyInsertCall<'a, C, A> where C: BorrowMut TargetSslProxyInsertCall<'a, C, A> where C: BorrowMut TargetSslProxyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29046,7 +31623,7 @@ impl<'a, C, A> TargetSslProxyListCall<'a, C, A> where C: BorrowMut TargetSslProxyListCall<'a, C, A> where C: BorrowMut TargetSslProxySetProxyHeaderCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29353,7 +31927,7 @@ impl<'a, C, A> TargetSslProxySetProxyHeaderCall<'a, C, A> where C: BorrowMut TargetSslProxySetProxyHeaderCall<'a, C, A> where C: BorrowMut TargetSslProxySetSslPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29655,7 +32226,7 @@ impl<'a, C, A> TargetSslProxySetSslPolicyCall<'a, C, A> where C: BorrowMut TargetSslProxySetSslPolicyCall<'a, C, A> where C: BorrowMut TargetSslProxyGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29933,7 +32501,7 @@ impl<'a, C, A> TargetSslProxyGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -30021,7 +32589,7 @@ impl<'a, C, A> TargetSslProxyGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -30177,10 +32745,7 @@ impl<'a, C, A> TargetSslProxySetBackendServiceCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30212,7 +32777,7 @@ impl<'a, C, A> TargetSslProxySetBackendServiceCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -30323,7 +32888,7 @@ impl<'a, C, A> TargetSslProxySetBackendServiceCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -30472,10 +33037,7 @@ impl<'a, C, A> TargetSslProxyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -30495,7 +33057,7 @@ impl<'a, C, A> TargetSslProxyDeleteCall<'a, C, A> where C: BorrowMut TargetSslProxyDeleteCall<'a, C, A> where C: BorrowMut NodeGroupListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -30781,7 +33340,7 @@ impl<'a, C, A> NodeGroupListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -30907,7 +33466,7 @@ impl<'a, C, A> NodeGroupListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31053,10 +33612,7 @@ impl<'a, C, A> NodeGroupGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31076,7 +33632,7 @@ impl<'a, C, A> NodeGroupGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31174,7 +33730,7 @@ impl<'a, C, A> NodeGroupGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31340,10 +33896,7 @@ impl<'a, C, A> NodeGroupListNodeCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31363,7 +33916,7 @@ impl<'a, C, A> NodeGroupListNodeCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31499,7 +34052,7 @@ impl<'a, C, A> NodeGroupListNodeCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31657,10 +34210,7 @@ impl<'a, C, A> NodeGroupInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -31692,7 +34242,7 @@ impl<'a, C, A> NodeGroupInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -31813,7 +34363,7 @@ impl<'a, C, A> NodeGroupInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31857,6 +34407,270 @@ impl<'a, C, A> NodeGroupInsertCall<'a, C, A> where C: BorrowMut, } +/// Gets the access control policy for a resource. May be empty if no such policy or resource exists. +/// +/// A builder for the *getIamPolicy* method supported by a *nodeGroup* resource. +/// It is not used directly, but through a `NodeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.node_groups().get_iam_policy("project", "zone", "resource") +/// .doit(); +/// # } +/// ``` +pub struct NodeGroupGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _zone: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NodeGroupGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> NodeGroupGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.nodeGroups.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "zone", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/nodeGroups/{resource}/getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NodeGroupGetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NodeGroupGetIamPolicyCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> NodeGroupGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NodeGroupGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NodeGroupGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NodeGroupGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates the node template of the node group. /// /// A builder for the *setNodeTemplate* method supported by a *nodeGroup* resource. @@ -31891,7 +34705,7 @@ impl<'a, C, A> NodeGroupInsertCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.node_groups().set_node_template(req, "project", "zone", "nodeGroup") -/// .request_id("ea") +/// .request_id("eos") /// .doit(); /// # } /// ``` @@ -31971,10 +34785,7 @@ impl<'a, C, A> NodeGroupSetNodeTemplateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32006,7 +34817,7 @@ impl<'a, C, A> NodeGroupSetNodeTemplateCall<'a, C, A> where C: BorrowMut NodeGroupSetNodeTemplateCall<'a, C, A> where C: BorrowMut NodeGroupSetNodeTemplateCall<'a, C, A> where C: BorrowMut NodeGroupSetNodeTemplateCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.node_groups().aggregated_list("project") +/// .page_token("sea") +/// .order_by("labore") +/// .max_results(47) +/// .filter("aliquyam") +/// .doit(); +/// # } +/// ``` +pub struct NodeGroupAggregatedListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NodeGroupAggregatedListCall<'a, C, A> {} + +impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, NodeGroupAggregatedList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.nodeGroups.aggregatedList", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/aggregated/nodeGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NodeGroupAggregatedListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> NodeGroupAggregatedListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> NodeGroupAggregatedListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> NodeGroupAggregatedListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. + /// + /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. + /// + /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. + /// + /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> NodeGroupAggregatedListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NodeGroupAggregatedListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NodeGroupAggregatedListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NodeGroupAggregatedListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on the specified resource. +/// +/// A builder for the *testIamPermissions* method supported by a *nodeGroup* resource. +/// It is not used directly, but through a `NodeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::TestPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.node_groups().test_iam_permissions(req, "project", "zone", "resource") +/// .doit(); +/// # } +/// ``` +pub struct NodeGroupTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: TestPermissionsRequest, + _project: String, + _zone: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NodeGroupTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> NodeGroupTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestPermissionsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.nodeGroups.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "zone", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/nodeGroups/{resource}/testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestPermissionsRequest) -> NodeGroupTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NodeGroupTestIamPermissionCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NodeGroupTestIamPermissionCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> NodeGroupTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NodeGroupTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NodeGroupTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NodeGroupTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Deletes the specified NodeGroup resource. /// /// A builder for the *delete* method supported by a *nodeGroup* resource. @@ -32199,7 +35603,7 @@ impl<'a, C, A> NodeGroupSetNodeTemplateCall<'a, C, A> where C: BorrowMut NodeGroupDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32301,7 +35702,7 @@ impl<'a, C, A> NodeGroupDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -32410,7 +35811,7 @@ impl<'a, C, A> NodeGroupDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32488,7 +35889,7 @@ impl<'a, C, A> NodeGroupDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.node_groups().delete_nodes(req, "project", "zone", "nodeGroup") -/// .request_id("aliquyam") +/// .request_id("justo") /// .doit(); /// # } /// ``` @@ -32568,10 +35969,7 @@ impl<'a, C, A> NodeGroupDeleteNodeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32603,7 +36001,7 @@ impl<'a, C, A> NodeGroupDeleteNodeCall<'a, C, A> where C: BorrowMut NodeGroupDeleteNodeCall<'a, C, A> where C: BorrowMut NodeGroupDeleteNodeCall<'a, C, A> where C: BorrowMut NodeGroupDeleteNodeCall<'a, C, A> where C: BorrowMut NodeGroupDeleteNodeCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ZoneSetPolicyRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.node_groups().aggregated_list("project") -/// .page_token("sit") -/// .order_by("diam") -/// .max_results(64) -/// .filter("justo") +/// let result = hub.node_groups().set_iam_policy(req, "project", "zone", "resource") /// .doit(); /// # } /// ``` -pub struct NodeGroupAggregatedListCall<'a, C, A> +pub struct NodeGroupSetIamPolicyCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Compute, + _request: ZoneSetPolicyRequest, _project: String, - _page_token: Option, - _order_by: Option, - _max_results: Option, - _filter: Option, + _zone: String, + _resource: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for NodeGroupAggregatedListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for NodeGroupSetIamPolicyCall<'a, C, A> {} -impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> NodeGroupSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, NodeGroupAggregatedList)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -32831,23 +36230,13 @@ impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.nodeGroups.aggregatedList", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "compute.nodeGroups.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); params.push(("project", self._project.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._order_by { - params.push(("orderBy", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } - for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { + params.push(("zone", self._zone.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "zone", "resource"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -32859,12 +36248,12 @@ impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -32875,8 +36264,8 @@ impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["project"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "zone", "project"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -32886,11 +36275,19 @@ impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -32907,11 +36304,15 @@ impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut NodeGroupSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> NodeGroupAggregatedListCall<'a, C, A> { + pub fn project(mut self, new_value: &str) -> NodeGroupSetIamPolicyCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// The name of the zone for this request. /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> NodeGroupAggregatedListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NodeGroupSetIamPolicyCall<'a, C, A> { + self._zone = new_value.to_string(); self } - /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - /// - /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - /// - /// Currently, only sorting by name or creationTimestamp desc is supported. + /// Name or id of the resource for this request. /// - /// Sets the *order by* query property to the given value. - pub fn order_by(mut self, new_value: &str) -> NodeGroupAggregatedListCall<'a, C, A> { - self._order_by = Some(new_value.to_string()); - self - } - /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + /// Sets the *resource* path property to the given value. /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> NodeGroupAggregatedListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - /// - /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - /// - /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - /// - /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> NodeGroupAggregatedListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> NodeGroupSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -33016,7 +36408,7 @@ impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut NodeGroupAggregatedListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NodeGroupSetIamPolicyCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -33025,7 +36417,7 @@ impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> NodeGroupAggregatedListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> NodeGroupSetIamPolicyCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -33046,7 +36438,7 @@ impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> NodeGroupAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> NodeGroupSetIamPolicyCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -33103,7 +36495,7 @@ impl<'a, C, A> NodeGroupAggregatedListCall<'a, C, A> where C: BorrowMut NodeGroupAddNodeCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -33218,7 +36607,7 @@ impl<'a, C, A> NodeGroupAddNodeCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -33303,7 +36692,7 @@ impl<'a, C, A> NodeGroupAddNodeCall<'a, C, A> where C: BorrowMut, self._zone = new_value.to_string(); self } - /// Name of the NodeGroup resource to delete. + /// Name of the NodeGroup resource. /// /// Sets the *node group* path property to the given value. /// @@ -33339,7 +36728,7 @@ impl<'a, C, A> NodeGroupAddNodeCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33417,7 +36806,7 @@ impl<'a, C, A> NodeGroupAddNodeCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.url_maps().insert(req, "project") -/// .request_id("justo") +/// .request_id("sed") /// .doit(); /// # } /// ``` @@ -33493,10 +36882,7 @@ impl<'a, C, A> UrlMapInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -33528,7 +36914,7 @@ impl<'a, C, A> UrlMapInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -33629,7 +37015,7 @@ impl<'a, C, A> UrlMapInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33773,10 +37159,7 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33796,7 +37179,7 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -33884,7 +37267,7 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34035,10 +37418,7 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34070,7 +37450,7 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -34170,7 +37550,7 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34248,7 +37628,7 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.url_maps().invalidate_cache(req, "project", "urlMap") -/// .request_id("voluptua.") +/// .request_id("kasd") /// .doit(); /// # } /// ``` @@ -34326,10 +37706,7 @@ impl<'a, C, A> UrlMapInvalidateCacheCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34361,7 +37738,7 @@ impl<'a, C, A> UrlMapInvalidateCacheCall<'a, C, A> where C: BorrowMut UrlMapInvalidateCacheCall<'a, C, A> where C: BorrowMut UrlMapInvalidateCacheCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = UrlMap::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.url_maps().update(req, "project", "urlMap") -/// .request_id("aliquyam") -/// .doit(); -/// # } -/// ``` -pub struct UrlMapUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _request: UrlMap, - _project: String, - _url_map: String, - _request_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for UrlMapUpdateCall<'a, C, A> {} - -impl<'a, C, A> UrlMapUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.urlMaps.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("urlMap", self._url_map.to_string())); - if let Some(value) = self._request_id { - params.push(("requestId", value.to_string())); - } - for &field in ["alt", "project", "urlMap", "requestId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/global/urlMaps/{urlMap}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{urlMap}", "urlMap")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["urlMap", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: UrlMap) -> UrlMapUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> UrlMapUpdateCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Name of the UrlMap resource to update. - /// - /// Sets the *url map* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn url_map(mut self, new_value: &str) -> UrlMapUpdateCall<'a, C, A> { - self._url_map = new_value.to_string(); - self - } - /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - /// - /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - /// - /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - /// - /// Sets the *request id* query property to the given value. - pub fn request_id(mut self, new_value: &str) -> UrlMapUpdateCall<'a, C, A> { - self._request_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> UrlMapUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> UrlMapUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> UrlMapUpdateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified UrlMap resource. -/// -/// A builder for the *delete* method supported by a *urlMap* resource. -/// It is not used directly, but through a `UrlMapMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_compute1 as compute1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use compute1::Compute; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.url_maps().delete("project", "urlMap") -/// .request_id("et") -/// .doit(); -/// # } -/// ``` -pub struct UrlMapDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _project: String, - _url_map: String, - _request_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for UrlMapDeleteCall<'a, C, A> {} - -impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.urlMaps.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("urlMap", self._url_map.to_string())); - if let Some(value) = self._request_id { - params.push(("requestId", value.to_string())); - } - for &field in ["alt", "project", "urlMap", "requestId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/global/urlMaps/{urlMap}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{urlMap}", "urlMap")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["urlMap", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> UrlMapDeleteCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Name of the UrlMap resource to delete. - /// - /// Sets the *url map* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn url_map(mut self, new_value: &str) -> UrlMapDeleteCall<'a, C, A> { - self._url_map = new_value.to_string(); - self - } - /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - /// - /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - /// - /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - /// - /// Sets the *request id* query property to the given value. - pub fn request_id(mut self, new_value: &str) -> UrlMapDeleteCall<'a, C, A> { - self._request_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> UrlMapDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> UrlMapDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> UrlMapDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Retrieves the list of UrlMap resources available to the specified project. /// /// A builder for the *list* method supported by a *urlMap* resource. @@ -35117,10 +37921,10 @@ impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.url_maps().list("project") -/// .page_token("diam") -/// .order_by("kasd") -/// .max_results(14) -/// .filter("rebum.") +/// .page_token("rebum.") +/// .order_by("Lorem") +/// .max_results(38) +/// .filter("invidunt") /// .doit(); /// # } /// ``` @@ -35207,10 +38011,7 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35230,7 +38031,7 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -35346,7 +38147,7 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -35390,6 +38191,573 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa } +/// Updates the specified UrlMap resource with the data included in the request. +/// +/// A builder for the *update* method supported by a *urlMap* resource. +/// It is not used directly, but through a `UrlMapMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::UrlMap; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UrlMap::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.url_maps().update(req, "project", "urlMap") +/// .request_id("consetetur") +/// .doit(); +/// # } +/// ``` +pub struct UrlMapUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: UrlMap, + _project: String, + _url_map: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UrlMapUpdateCall<'a, C, A> {} + +impl<'a, C, A> UrlMapUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.urlMaps.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("urlMap", self._url_map.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "urlMap", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/urlMaps/{urlMap}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{urlMap}", "urlMap")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["urlMap", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UrlMap) -> UrlMapUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> UrlMapUpdateCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the UrlMap resource to update. + /// + /// Sets the *url map* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn url_map(mut self, new_value: &str) -> UrlMapUpdateCall<'a, C, A> { + self._url_map = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> UrlMapUpdateCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UrlMapUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UrlMapUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UrlMapUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified UrlMap resource. +/// +/// A builder for the *delete* method supported by a *urlMap* resource. +/// It is not used directly, but through a `UrlMapMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.url_maps().delete("project", "urlMap") +/// .request_id("sit") +/// .doit(); +/// # } +/// ``` +pub struct UrlMapDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _url_map: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UrlMapDeleteCall<'a, C, A> {} + +impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.urlMaps.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("urlMap", self._url_map.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "urlMap", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/urlMaps/{urlMap}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{urlMap}", "urlMap")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["urlMap", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> UrlMapDeleteCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the UrlMap resource to delete. + /// + /// Sets the *url map* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn url_map(mut self, new_value: &str) -> UrlMapDeleteCall<'a, C, A> { + self._url_map = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> UrlMapDeleteCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UrlMapDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UrlMapDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UrlMapDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. /// /// A builder for the *patch* method supported by a *urlMap* resource. @@ -35424,7 +38792,7 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.url_maps().patch(req, "project", "urlMap") -/// .request_id("invidunt") +/// .request_id("nonumy") /// .doit(); /// # } /// ``` @@ -35502,10 +38870,7 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -35537,7 +38902,7 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -35648,7 +39013,7 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -35726,7 +39091,7 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.global_addresses().insert(req, "project") -/// .request_id("At") +/// .request_id("Lorem") /// .doit(); /// # } /// ``` @@ -35802,10 +39167,7 @@ impl<'a, C, A> GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -35837,7 +39199,7 @@ impl<'a, C, A> GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -36110,7 +39469,7 @@ impl<'a, C, A> GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut GlobalAddresseListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -36394,7 +39750,7 @@ impl<'a, C, A> GlobalAddresseListCall<'a, C, A> where C: BorrowMut GlobalAddresseListCall<'a, C, A> where C: BorrowMut GlobalAddresseGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -36677,7 +40030,7 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -36765,7 +40118,7 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -36809,7 +40162,7 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut } -/// Retrieves a list of instance templates that are contained within the specified project and zone. +/// Retrieves a list of instance templates that are contained within the specified project. /// /// A builder for the *list* method supported by a *instanceTemplate* resource. /// It is not used directly, but through a `InstanceTemplateMethods` instance. @@ -36837,10 +40190,10 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instance_templates().list("project") -/// .page_token("ut") -/// .order_by("ut") -/// .max_results(50) -/// .filter("ipsum") +/// .page_token("sanctus") +/// .order_by("voluptua.") +/// .max_results(2) +/// .filter("et") /// .doit(); /// # } /// ``` @@ -36927,10 +40280,7 @@ impl<'a, C, A> InstanceTemplateListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -36950,7 +40300,7 @@ impl<'a, C, A> InstanceTemplateListCall<'a, C, A> where C: BorrowMut InstanceTemplateListCall<'a, C, A> where C: BorrowMut InstanceTemplateListCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instance_templates().get_iam_policy("project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct InstanceTemplateGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceTemplateGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> InstanceTemplateGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instanceTemplates.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/instanceTemplates/{resource}/getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceTemplateGetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> InstanceTemplateGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceTemplateGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceTemplateGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceTemplateGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. It is not possible to delete templates that are already in use by a managed instance group. /// /// A builder for the *delete* method supported by a *instanceTemplate* resource. /// It is not used directly, but through a `InstanceTemplateMethods` instance. @@ -37138,7 +40740,7 @@ impl<'a, C, A> InstanceTemplateListCall<'a, C, A> where C: BorrowMut InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -37238,7 +40837,7 @@ impl<'a, C, A> InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GlobalSetPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instance_templates().set_iam_policy(req, "project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct InstanceTemplateSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: GlobalSetPolicyRequest, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceTemplateSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> InstanceTemplateSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instanceTemplates.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/instanceTemplates/{resource}/setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GlobalSetPolicyRequest) -> InstanceTemplateSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceTemplateSetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> InstanceTemplateSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceTemplateSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceTemplateSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceTemplateSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on the specified resource. +/// +/// A builder for the *testIamPermissions* method supported by a *instanceTemplate* resource. +/// It is not used directly, but through a `InstanceTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::TestPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instance_templates().test_iam_permissions(req, "project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct InstanceTemplateTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: TestPermissionsRequest, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceTemplateTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> InstanceTemplateTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestPermissionsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instanceTemplates.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/instanceTemplates/{resource}/testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestPermissionsRequest) -> InstanceTemplateTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceTemplateTestIamPermissionCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> InstanceTemplateTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceTemplateTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceTemplateTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceTemplateTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates an instance template in the specified project using the data that is included in the request. If you are creating a new template to update an existing instance group, your new instance template must use the same network or, if applicable, the same subnetwork as the original template. /// /// A builder for the *insert* method supported by a *instanceTemplate* resource. @@ -37415,7 +41580,7 @@ impl<'a, C, A> InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut InstanceTemplateInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -37526,7 +41688,7 @@ impl<'a, C, A> InstanceTemplateInsertCall<'a, C, A> where C: BorrowMut InstanceTemplateInsertCall<'a, C, A> where C: BorrowMut InstanceTemplateGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -37794,7 +41953,7 @@ impl<'a, C, A> InstanceTemplateGetCall<'a, C, A> where C: BorrowMut InstanceTemplateGetCall<'a, C, A> where C: BorrowMut InstanceTemplateGetCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.snapshots().test_iam_permissions(req, "project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct SnapshotTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: TestPermissionsRequest, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SnapshotTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> SnapshotTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestPermissionsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.snapshots.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/snapshots/{resource}/testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestPermissionsRequest) -> SnapshotTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SnapshotTestIamPermissionCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> SnapshotTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SnapshotTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SnapshotTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SnapshotTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves the list of Snapshot resources contained within the specified project. /// /// A builder for the *list* method supported by a *snapshot* resource. @@ -37954,10 +42396,10 @@ impl<'a, C, A> InstanceTemplateGetCall<'a, C, A> where C: BorrowMut SnapshotListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -38067,7 +42506,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -38183,7 +42622,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38229,7 +42668,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: /// Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. /// -/// For more information, see Deleting snaphots. +/// For more information, see Deleting snapshots. /// /// A builder for the *delete* method supported by a *snapshot* resource. /// It is not used directly, but through a `SnapshotMethods` instance. @@ -38257,7 +42696,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.snapshots().delete("project", "snapshot") -/// .request_id("ipsum") +/// .request_id("sea") /// .doit(); /// # } /// ``` @@ -38334,10 +42773,7 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -38357,7 +42793,7 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -38456,7 +42892,7 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38500,6 +42936,289 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A } +/// Sets the access control policy on the specified resource. Replaces any existing policy. +/// +/// A builder for the *setIamPolicy* method supported by a *snapshot* resource. +/// It is not used directly, but through a `SnapshotMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::GlobalSetPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GlobalSetPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.snapshots().set_iam_policy(req, "project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct SnapshotSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: GlobalSetPolicyRequest, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SnapshotSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> SnapshotSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.snapshots.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/snapshots/{resource}/setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GlobalSetPolicyRequest) -> SnapshotSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SnapshotSetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> SnapshotSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SnapshotSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SnapshotSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SnapshotSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Returns the specified Snapshot resource. Gets a list of available snapshots by making a list() request. /// /// A builder for the *get* method supported by a *snapshot* resource. @@ -38600,10 +43319,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -38623,7 +43339,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -38711,7 +43427,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38862,10 +43578,7 @@ impl<'a, C, A> SnapshotSetLabelCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -38897,7 +43610,7 @@ impl<'a, C, A> SnapshotSetLabelCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -38972,7 +43685,7 @@ impl<'a, C, A> SnapshotSetLabelCall<'a, C, A> where C: BorrowMut, self._project = new_value.to_string(); self } - /// Name of the resource for this request. + /// Name or id of the resource for this request. /// /// Sets the *resource* path property to the given value. /// @@ -38997,7 +43710,7 @@ impl<'a, C, A> SnapshotSetLabelCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -39041,6 +43754,258 @@ impl<'a, C, A> SnapshotSetLabelCall<'a, C, A> where C: BorrowMut, } +/// Gets the access control policy for a resource. May be empty if no such policy or resource exists. +/// +/// A builder for the *getIamPolicy* method supported by a *snapshot* resource. +/// It is not used directly, but through a `SnapshotMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.snapshots().get_iam_policy("project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct SnapshotGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SnapshotGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> SnapshotGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.snapshots.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/snapshots/{resource}/getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SnapshotGetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> SnapshotGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SnapshotGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SnapshotGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SnapshotGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Returns the specified disk type. Gets a list of available disk types by making a list() request. /// /// A builder for the *get* method supported by a *diskType* resource. @@ -39143,10 +44108,7 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -39166,7 +44128,7 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -39264,7 +44226,7 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -39336,10 +44298,10 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.disk_types().aggregated_list("project") -/// .page_token("sed") -/// .order_by("no") -/// .max_results(63) -/// .filter("rebum.") +/// .page_token("et") +/// .order_by("Stet") +/// .max_results(58) +/// .filter("dolor") /// .doit(); /// # } /// ``` @@ -39426,10 +44388,7 @@ impl<'a, C, A> DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -39449,7 +44408,7 @@ impl<'a, C, A> DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut DiskTypeListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -39752,7 +44708,7 @@ impl<'a, C, A> DiskTypeListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -39878,7 +44834,7 @@ impl<'a, C, A> DiskTypeListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -40022,10 +44978,7 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -40045,7 +44998,7 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -40133,7 +45086,7 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -40205,10 +45158,10 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.zones().list("project") -/// .page_token("diam") +/// .page_token("sadipscing") /// .order_by("accusam") -/// .max_results(33) -/// .filter("consetetur") +/// .max_results(69) +/// .filter("Lorem") /// .doit(); /// # } /// ``` @@ -40295,10 +45248,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -40318,7 +45268,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -40434,7 +45384,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -40512,7 +45462,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instances().set_service_account(req, "project", "zone", "instance") -/// .request_id("ea") +/// .request_id("eos") /// .doit(); /// # } /// ``` @@ -40592,10 +45542,7 @@ impl<'a, C, A> InstanceSetServiceAccountCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -40627,7 +45574,7 @@ impl<'a, C, A> InstanceSetServiceAccountCall<'a, C, A> where C: BorrowMut InstanceSetServiceAccountCall<'a, C, A> where C: BorrowMut InstanceSetServiceAccountCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = AccessConfig::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.instances().add_access_config(req, "project", "zone", "instance", "networkInterface") -/// .request_id("sanctus") -/// .doit(); -/// # } -/// ``` -pub struct InstanceAddAccessConfigCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _request: AccessConfig, - _project: String, - _zone: String, - _instance: String, - _network_interface: String, - _request_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for InstanceAddAccessConfigCall<'a, C, A> {} - -impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.instances.addAccessConfig", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("zone", self._zone.to_string())); - params.push(("instance", self._instance.to_string())); - params.push(("networkInterface", self._network_interface.to_string())); - if let Some(value) = self._request_id { - params.push(("requestId", value.to_string())); - } - for &field in ["alt", "project", "zone", "instance", "networkInterface", "requestId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instances/{instance}/addAccessConfig"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instance}", "instance")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["instance", "zone", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: AccessConfig) -> InstanceAddAccessConfigCall<'a, C, A> { - self._request = new_value; - self - } - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> InstanceAddAccessConfigCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// The name of the zone for this request. - /// - /// Sets the *zone* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn zone(mut self, new_value: &str) -> InstanceAddAccessConfigCall<'a, C, A> { - self._zone = new_value.to_string(); - self - } - /// The instance name for this request. - /// - /// Sets the *instance* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn instance(mut self, new_value: &str) -> InstanceAddAccessConfigCall<'a, C, A> { - self._instance = new_value.to_string(); - self - } - /// The name of the network interface to add to this instance. - /// - /// Sets the *network interface* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn network_interface(mut self, new_value: &str) -> InstanceAddAccessConfigCall<'a, C, A> { - self._network_interface = new_value.to_string(); - self - } - /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - /// - /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - /// - /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - /// - /// Sets the *request id* query property to the given value. - pub fn request_id(mut self, new_value: &str) -> InstanceAddAccessConfigCall<'a, C, A> { - self._request_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceAddAccessConfigCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> InstanceAddAccessConfigCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> InstanceAddAccessConfigCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Changes the number and/or type of accelerator for a stopped instance to the values specified in the request. /// /// A builder for the *setMachineResources* method supported by a *instance* resource. @@ -41152,7 +45773,7 @@ impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut InstanceSetMachineResourceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -41267,7 +45885,7 @@ impl<'a, C, A> InstanceSetMachineResourceCall<'a, C, A> where C: BorrowMut InstanceSetMachineResourceCall<'a, C, A> where C: BorrowMut InstanceSetMachineResourceCall<'a, C, A> where C: BorrowMut InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -41581,7 +46196,7 @@ impl<'a, C, A> InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -41876,7 +46488,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -41985,7 +46597,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -42063,7 +46675,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instances().update_network_interface(req, "project", "zone", "instance", "networkInterface") -/// .request_id("dolores") +/// .request_id("invidunt") /// .doit(); /// # } /// ``` @@ -42145,10 +46757,7 @@ impl<'a, C, A> InstanceUpdateNetworkInterfaceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -42180,7 +46789,7 @@ impl<'a, C, A> InstanceUpdateNetworkInterfaceCall<'a, C, A> where C: BorrowMut InstanceUpdateNetworkInterfaceCall<'a, C, A> where C: BorrowMut InstanceUpdateNetworkInterfaceCall<'a, C, A> where C: BorrowMut InstanceStartCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -42485,7 +47091,7 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -42594,7 +47200,7 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -42638,7 +47244,7 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: } -/// Performs a reset on the instance. For more information, see Resetting an instance. +/// Performs a reset on the instance. This is a hard reset the VM does not do a graceful shutdown. For more information, see Resetting an instance. /// /// A builder for the *reset* method supported by a *instance* resource. /// It is not used directly, but through a `InstanceMethods` instance. @@ -42666,7 +47272,7 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instances().reset("project", "zone", "instance") -/// .request_id("gubergren") +/// .request_id("dolor") /// .doit(); /// # } /// ``` @@ -42745,10 +47351,7 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -42768,7 +47371,7 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -42877,7 +47480,7 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -43023,10 +47626,7 @@ impl<'a, C, A> InstanceSimulateMaintenanceEventCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -43046,7 +47646,7 @@ impl<'a, C, A> InstanceSimulateMaintenanceEventCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -43144,7 +47744,7 @@ impl<'a, C, A> InstanceSimulateMaintenanceEventCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -43222,7 +47822,7 @@ impl<'a, C, A> InstanceSimulateMaintenanceEventCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instances().update_access_config(req, "project", "zone", "instance", "networkInterface") -/// .request_id("invidunt") +/// .request_id("erat") /// .doit(); /// # } /// ``` @@ -43304,10 +47904,7 @@ impl<'a, C, A> InstanceUpdateAccessConfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -43339,7 +47936,7 @@ impl<'a, C, A> InstanceUpdateAccessConfigCall<'a, C, A> where C: BorrowMut InstanceUpdateAccessConfigCall<'a, C, A> where C: BorrowMut InstanceUpdateAccessConfigCall<'a, C, A> where C: BorrowMut InstanceUpdateAccessConfigCall<'a, C, A> where C: BorrowMut InstanceSetTagCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -43663,7 +48257,7 @@ impl<'a, C, A> InstanceSetTagCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -43784,7 +48378,7 @@ impl<'a, C, A> InstanceSetTagCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -43862,7 +48456,7 @@ impl<'a, C, A> InstanceSetTagCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instances().set_metadata(req, "project", "zone", "instance") -/// .request_id("dolor") +/// .request_id("nonumy") /// .doit(); /// # } /// ``` @@ -43942,10 +48536,7 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -43977,7 +48568,7 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut InstanceSetMetadataCall<'a, C, A> where C: BorrowMut InstanceSetMetadataCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -44274,7 +48862,7 @@ impl<'a, C, A> InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instances().get_iam_policy("project", "zone", "resource") +/// .doit(); +/// # } +/// ``` +pub struct InstanceGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _zone: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> InstanceGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instances.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "zone", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instances/{resource}/getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceGetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceGetIamPolicyCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> InstanceGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance. /// /// A builder for the *attachDisk* method supported by a *instance* resource. @@ -44471,7 +49323,7 @@ impl<'a, C, A> InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44591,7 +49440,7 @@ impl<'a, C, A> InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> { @@ -44719,7 +49568,7 @@ impl<'a, C, A> InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceListReferrerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -44908,7 +49754,7 @@ impl<'a, C, A> InstanceListReferrerCall<'a, C, A> where C: BorrowMut InstanceListReferrerCall<'a, C, A> where C: BorrowMut InstanceListReferrerCall<'a, C, A> where C: BorrowMut InstanceSetLabelCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -45237,7 +50080,7 @@ impl<'a, C, A> InstanceSetLabelCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -45358,7 +50201,7 @@ impl<'a, C, A> InstanceSetLabelCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45436,7 +50279,7 @@ impl<'a, C, A> InstanceSetLabelCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instances().start_with_encryption_key(req, "project", "zone", "instance") -/// .request_id("amet") +/// .request_id("erat") /// .doit(); /// # } /// ``` @@ -45516,10 +50359,7 @@ impl<'a, C, A> InstanceStartWithEncryptionKeyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -45551,7 +50391,7 @@ impl<'a, C, A> InstanceStartWithEncryptionKeyCall<'a, C, A> where C: BorrowMut InstanceStartWithEncryptionKeyCall<'a, C, A> where C: BorrowMut InstanceStartWithEncryptionKeyCall<'a, C, A> where C: BorrowMut InstanceAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45857,7 +50694,7 @@ impl<'a, C, A> InstanceAggregatedListCall<'a, C, A> where C: BorrowMut InstanceAggregatedListCall<'a, C, A> where C: BorrowMut InstanceAggregatedListCall<'a, C, A> where C: BorrowMut InstanceSetMachineTypeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -46166,7 +51000,7 @@ impl<'a, C, A> InstanceSetMachineTypeCall<'a, C, A> where C: BorrowMut InstanceSetMachineTypeCall<'a, C, A> where C: BorrowMut InstanceGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -46456,7 +51287,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -46554,7 +51385,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -46709,10 +51540,7 @@ impl<'a, C, A> InstanceDeleteAccessConfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -46732,7 +51560,7 @@ impl<'a, C, A> InstanceDeleteAccessConfigCall<'a, C, A> where C: BorrowMut InstanceDeleteAccessConfigCall<'a, C, A> where C: BorrowMut InstanceDeleteAccessConfigCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ShieldedInstanceIntegrityPolicy::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instances().set_shielded_instance_integrity_policy(req, "project", "zone", "instance") +/// .request_id("rebum.") +/// .doit(); +/// # } +/// ``` +pub struct InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: ShieldedInstanceIntegrityPolicy, + _project: String, + _zone: String, + _instance: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> {} + +impl<'a, C, A> InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instances.setShieldedInstanceIntegrityPolicy", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("instance", self._instance.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "zone", "instance", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instances/{instance}/setShieldedInstanceIntegrityPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instance}", "instance")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["instance", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ShieldedInstanceIntegrityPolicy) -> InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the instance scoping this request. + /// + /// Sets the *instance* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance(mut self, new_value: &str) -> InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> { + self._instance = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceSetShieldedInstanceIntegrityPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform. /// /// A builder for the *setMinCpuPlatform* method supported by a *instance* resource. @@ -46939,7 +52078,7 @@ impl<'a, C, A> InstanceDeleteAccessConfigCall<'a, C, A> where C: BorrowMut InstanceSetMinCpuPlatformCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -47054,7 +52190,7 @@ impl<'a, C, A> InstanceSetMinCpuPlatformCall<'a, C, A> where C: BorrowMut InstanceSetMinCpuPlatformCall<'a, C, A> where C: BorrowMut InstanceSetMinCpuPlatformCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ShieldedInstanceConfig::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instances().update_shielded_instance_config(req, "project", "zone", "instance") +/// .request_id("no") +/// .doit(); +/// # } +/// ``` +pub struct InstanceUpdateShieldedInstanceConfigCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: ShieldedInstanceConfig, + _project: String, + _zone: String, + _instance: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceUpdateShieldedInstanceConfigCall<'a, C, A> {} + +impl<'a, C, A> InstanceUpdateShieldedInstanceConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instances.updateShieldedInstanceConfig", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("instance", self._instance.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "zone", "instance", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instances/{instance}/updateShieldedInstanceConfig"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instance}", "instance")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["instance", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ShieldedInstanceConfig) -> InstanceUpdateShieldedInstanceConfigCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceUpdateShieldedInstanceConfigCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceUpdateShieldedInstanceConfigCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the instance scoping this request. + /// + /// Sets the *instance* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance(mut self, new_value: &str) -> InstanceUpdateShieldedInstanceConfigCall<'a, C, A> { + self._instance = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> InstanceUpdateShieldedInstanceConfigCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceUpdateShieldedInstanceConfigCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceUpdateShieldedInstanceConfigCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceUpdateShieldedInstanceConfigCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on the specified resource. +/// +/// A builder for the *testIamPermissions* method supported by a *instance* resource. +/// It is not used directly, but through a `InstanceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::TestPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instances().test_iam_permissions(req, "project", "zone", "resource") +/// .doit(); +/// # } +/// ``` +pub struct InstanceTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: TestPermissionsRequest, + _project: String, + _zone: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> InstanceTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestPermissionsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instances.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "zone", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instances/{resource}/testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestPermissionsRequest) -> InstanceTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceTestIamPermissionCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceTestIamPermissionCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> InstanceTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates an instance resource in the specified project using the data included in the request. /// /// A builder for the *insert* method supported by a *instance* resource. @@ -47253,8 +52995,8 @@ impl<'a, C, A> InstanceSetMinCpuPlatformCall<'a, C, A> where C: BorrowMut InstanceInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -47371,7 +53110,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -47494,7 +53233,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -47566,8 +53305,8 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instances().get_serial_port_output("project", "zone", "instance") -/// .start("takimata") -/// .port(-53) +/// .start("consetetur") +/// .port(-73) /// .doit(); /// # } /// ``` @@ -47650,10 +53389,7 @@ impl<'a, C, A> InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47673,7 +53409,7 @@ impl<'a, C, A> InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47963,7 +53696,7 @@ impl<'a, C, A> InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccessConfig::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instances().add_access_config(req, "project", "zone", "instance", "networkInterface") +/// .request_id("dolores") +/// .doit(); +/// # } +/// ``` +pub struct InstanceAddAccessConfigCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: AccessConfig, + _project: String, + _zone: String, + _instance: String, + _network_interface: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceAddAccessConfigCall<'a, C, A> {} + +impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instances.addAccessConfig", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("instance", self._instance.to_string())); + params.push(("networkInterface", self._network_interface.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "zone", "instance", "networkInterface", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instances/{instance}/addAccessConfig"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instance}", "instance")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["instance", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccessConfig) -> InstanceAddAccessConfigCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceAddAccessConfigCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceAddAccessConfigCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// The instance name for this request. + /// + /// Sets the *instance* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance(mut self, new_value: &str) -> InstanceAddAccessConfigCall<'a, C, A> { + self._instance = new_value.to_string(); + self + } + /// The name of the network interface to add to this instance. + /// + /// Sets the *network interface* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn network_interface(mut self, new_value: &str) -> InstanceAddAccessConfigCall<'a, C, A> { + self._network_interface = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> InstanceAddAccessConfigCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceAddAccessConfigCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceAddAccessConfigCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceAddAccessConfigCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance. /// /// A builder for the *stop* method supported by a *instance* resource. @@ -48164,7 +54220,7 @@ impl<'a, C, A> InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceStopCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -48266,7 +54319,7 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -48375,7 +54428,7 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -48419,6 +54472,565 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: } +/// Sets the access control policy on the specified resource. Replaces any existing policy. +/// +/// A builder for the *setIamPolicy* method supported by a *instance* resource. +/// It is not used directly, but through a `InstanceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::ZoneSetPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ZoneSetPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instances().set_iam_policy(req, "project", "zone", "resource") +/// .doit(); +/// # } +/// ``` +pub struct InstanceSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: ZoneSetPolicyRequest, + _project: String, + _zone: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> InstanceSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instances.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "zone", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instances/{resource}/setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ZoneSetPolicyRequest) -> InstanceSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceSetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceSetIamPolicyCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> InstanceSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the Shielded Instance Identity of an instance +/// +/// A builder for the *getShieldedInstanceIdentity* method supported by a *instance* resource. +/// It is not used directly, but through a `InstanceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instances().get_shielded_instance_identity("project", "zone", "instance") +/// .doit(); +/// # } +/// ``` +pub struct InstanceGetShieldedInstanceIdentityCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _zone: String, + _instance: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceGetShieldedInstanceIdentityCall<'a, C, A> {} + +impl<'a, C, A> InstanceGetShieldedInstanceIdentityCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ShieldedInstanceIdentity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instances.getShieldedInstanceIdentity", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("instance", self._instance.to_string())); + for &field in ["alt", "project", "zone", "instance"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instances/{instance}/getShieldedInstanceIdentity"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instance}", "instance")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["instance", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceGetShieldedInstanceIdentityCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceGetShieldedInstanceIdentityCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the instance scoping this request. + /// + /// Sets the *instance* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance(mut self, new_value: &str) -> InstanceGetShieldedInstanceIdentityCall<'a, C, A> { + self._instance = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceGetShieldedInstanceIdentityCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceGetShieldedInstanceIdentityCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceGetShieldedInstanceIdentityCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Sets deletion protection on the instance. /// /// A builder for the *setDeletionProtection* method supported by a *instance* resource. @@ -48447,8 +55059,8 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instances().set_deletion_protection("project", "zone", "resource") -/// .request_id("takimata") -/// .deletion_protection(true) +/// .request_id("kasd") +/// .deletion_protection(false) /// .doit(); /// # } /// ``` @@ -48531,10 +55143,7 @@ impl<'a, C, A> InstanceSetDeletionProtectionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -48554,7 +55163,7 @@ impl<'a, C, A> InstanceSetDeletionProtectionCall<'a, C, A> where C: BorrowMut InstanceSetDeletionProtectionCall<'a, C, A> where C: BorrowMut InstanceSetDeletionProtectionCall<'a, C, A> where C: BorrowMut InstanceSetDeletionProtectionCall<'a, C, A> where C: BorrowMut InstanceListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -48857,7 +55463,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -48983,7 +55589,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -49027,6 +55633,270 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: } +/// Deletes a rule at the specified priority. +/// +/// A builder for the *removeRule* method supported by a *securityPolicy* resource. +/// It is not used directly, but through a `SecurityPolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.security_policies().remove_rule("project", "securityPolicy") +/// .priority(-62) +/// .doit(); +/// # } +/// ``` +pub struct SecurityPolicyRemoveRuleCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _security_policy: String, + _priority: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SecurityPolicyRemoveRuleCall<'a, C, A> {} + +impl<'a, C, A> SecurityPolicyRemoveRuleCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.securityPolicies.removeRule", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("securityPolicy", self._security_policy.to_string())); + if let Some(value) = self._priority { + params.push(("priority", value.to_string())); + } + for &field in ["alt", "project", "securityPolicy", "priority"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/securityPolicies/{securityPolicy}/removeRule"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{securityPolicy}", "securityPolicy")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["securityPolicy", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SecurityPolicyRemoveRuleCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the security policy to update. + /// + /// Sets the *security policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn security_policy(mut self, new_value: &str) -> SecurityPolicyRemoveRuleCall<'a, C, A> { + self._security_policy = new_value.to_string(); + self + } + /// The priority of the rule to remove from the security policy. + /// + /// Sets the *priority* query property to the given value. + pub fn priority(mut self, new_value: i32) -> SecurityPolicyRemoveRuleCall<'a, C, A> { + self._priority = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SecurityPolicyRemoveRuleCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SecurityPolicyRemoveRuleCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SecurityPolicyRemoveRuleCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Inserts a rule into a security policy. /// /// A builder for the *addRule* method supported by a *securityPolicy* resource. @@ -49134,10 +56004,7 @@ impl<'a, C, A> SecurityPolicyAddRuleCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -49169,7 +56036,7 @@ impl<'a, C, A> SecurityPolicyAddRuleCall<'a, C, A> where C: BorrowMut SecurityPolicyAddRuleCall<'a, C, A> where C: BorrowMut SecurityPolicyAddRuleCall<'a, C, A> where C: BorrowMut SecurityPolicyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -49441,7 +56305,7 @@ impl<'a, C, A> SecurityPolicyDeleteCall<'a, C, A> where C: BorrowMut SecurityPolicyDeleteCall<'a, C, A> where C: BorrowMut SecurityPolicyDeleteCall<'a, C, A> where C: BorrowMut SecurityPolicyPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -49731,7 +56592,7 @@ impl<'a, C, A> SecurityPolicyPatchCall<'a, C, A> where C: BorrowMut SecurityPolicyPatchCall<'a, C, A> where C: BorrowMut SecurityPolicyPatchCall<'a, C, A> where C: BorrowMut SecurityPolicyGetRuleCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50014,7 +56872,7 @@ impl<'a, C, A> SecurityPolicyGetRuleCall<'a, C, A> where C: BorrowMut SecurityPolicyGetRuleCall<'a, C, A> where C: BorrowMut SecurityPolicyGetRuleCall<'a, C, A> where C: BorrowMut SecurityPolicyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -50298,7 +57153,7 @@ impl<'a, C, A> SecurityPolicyInsertCall<'a, C, A> where C: BorrowMut SecurityPolicyInsertCall<'a, C, A> where C: BorrowMut SecurityPolicyGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50566,7 +57418,7 @@ impl<'a, C, A> SecurityPolicyGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -50654,7 +57506,7 @@ impl<'a, C, A> SecurityPolicyGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -50726,10 +57578,10 @@ impl<'a, C, A> SecurityPolicyGetCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.security_policies().list("project") -/// .page_token("sed") -/// .order_by("sit") -/// .max_results(3) -/// .filter("dolores") +/// .page_token("consetetur") +/// .order_by("et") +/// .max_results(30) +/// .filter("kasd") /// .doit(); /// # } /// ``` @@ -50816,10 +57668,7 @@ impl<'a, C, A> SecurityPolicyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50839,7 +57688,7 @@ impl<'a, C, A> SecurityPolicyListCall<'a, C, A> where C: BorrowMut SecurityPolicyListCall<'a, C, A> where C: BorrowMut SecurityPolicyListCall<'a, C, A> where C: BorrowMut SecurityPolicyPatchRuleCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -51146,7 +57992,7 @@ impl<'a, C, A> SecurityPolicyPatchRuleCall<'a, C, A> where C: BorrowMut SecurityPolicyPatchRuleCall<'a, C, A> where C: BorrowMut SecurityPolicyPatchRuleCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.security_policies().remove_rule("project", "securityPolicy") -/// .priority(-44) -/// .doit(); -/// # } -/// ``` -pub struct SecurityPolicyRemoveRuleCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _project: String, - _security_policy: String, - _priority: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for SecurityPolicyRemoveRuleCall<'a, C, A> {} - -impl<'a, C, A> SecurityPolicyRemoveRuleCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.securityPolicies.removeRule", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("securityPolicy", self._security_policy.to_string())); - if let Some(value) = self._priority { - params.push(("priority", value.to_string())); - } - for &field in ["alt", "project", "securityPolicy", "priority"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/global/securityPolicies/{securityPolicy}/removeRule"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{securityPolicy}", "securityPolicy")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["securityPolicy", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> SecurityPolicyRemoveRuleCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Name of the security policy to update. - /// - /// Sets the *security policy* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn security_policy(mut self, new_value: &str) -> SecurityPolicyRemoveRuleCall<'a, C, A> { - self._security_policy = new_value.to_string(); - self - } - /// The priority of the rule to remove from the security policy. - /// - /// Sets the *priority* query property to the given value. - pub fn priority(mut self, new_value: i32) -> SecurityPolicyRemoveRuleCall<'a, C, A> { - self._priority = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> SecurityPolicyRemoveRuleCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> SecurityPolicyRemoveRuleCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> SecurityPolicyRemoveRuleCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Gets the most recent health check results for this BackendService. /// /// A builder for the *getHealth* method supported by a *backendService* resource. @@ -51671,10 +58250,7 @@ impl<'a, C, A> BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -51706,7 +58282,7 @@ impl<'a, C, A> BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut BackendServiceDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -51977,7 +58550,7 @@ impl<'a, C, A> BackendServiceDeleteCall<'a, C, A> where C: BorrowMut BackendServiceDeleteCall<'a, C, A> where C: BorrowMut BackendServiceDeleteCall<'a, C, A> where C: BorrowMut BackendServiceUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -52267,7 +58837,7 @@ impl<'a, C, A> BackendServiceUpdateCall<'a, C, A> where C: BorrowMut BackendServiceUpdateCall<'a, C, A> where C: BorrowMut BackendServiceUpdateCall<'a, C, A> where C: BorrowMut BackendServicePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -52569,7 +59136,7 @@ impl<'a, C, A> BackendServicePatchCall<'a, C, A> where C: BorrowMut BackendServicePatchCall<'a, C, A> where C: BorrowMut BackendServicePatchCall<'a, C, A> where C: BorrowMut BackendServiceGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -52847,7 +59411,7 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -52935,7 +59499,7 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -53013,7 +59577,7 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.backend_services().add_signed_url_key(req, "project", "backendService") -/// .request_id("tempor") +/// .request_id("et") /// .doit(); /// # } /// ``` @@ -53091,10 +59655,7 @@ impl<'a, C, A> BackendServiceAddSignedUrlKeyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -53126,7 +59687,7 @@ impl<'a, C, A> BackendServiceAddSignedUrlKeyCall<'a, C, A> where C: BorrowMut BackendServiceAddSignedUrlKeyCall<'a, C, A> where C: BorrowMut BackendServiceAddSignedUrlKeyCall<'a, C, A> where C: BorrowMut BackendServiceAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -53422,7 +59980,7 @@ impl<'a, C, A> BackendServiceAggregatedListCall<'a, C, A> where C: BorrowMut BackendServiceAggregatedListCall<'a, C, A> where C: BorrowMut BackendServiceAggregatedListCall<'a, C, A> where C: BorrowMut BackendServiceSetSecurityPolicyCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -53729,7 +60284,7 @@ impl<'a, C, A> BackendServiceSetSecurityPolicyCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -53840,7 +60395,7 @@ impl<'a, C, A> BackendServiceSetSecurityPolicyCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -53912,7 +60467,7 @@ impl<'a, C, A> BackendServiceSetSecurityPolicyCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.backend_services().delete_signed_url_key("project", "backendService", "keyName") -/// .request_id("sea") +/// .request_id("eirmod") /// .doit(); /// # } /// ``` @@ -53991,10 +60546,7 @@ impl<'a, C, A> BackendServiceDeleteSignedUrlKeyCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -54014,7 +60566,7 @@ impl<'a, C, A> BackendServiceDeleteSignedUrlKeyCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -54123,7 +60675,7 @@ impl<'a, C, A> BackendServiceDeleteSignedUrlKeyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54195,10 +60747,10 @@ impl<'a, C, A> BackendServiceDeleteSignedUrlKeyCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.backend_services().list("project") -/// .page_token("labore") -/// .order_by("Lorem") -/// .max_results(70) -/// .filter("sanctus") +/// .page_token("sea") +/// .order_by("sanctus") +/// .max_results(40) +/// .filter("est") /// .doit(); /// # } /// ``` @@ -54285,10 +60837,7 @@ impl<'a, C, A> BackendServiceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -54308,7 +60857,7 @@ impl<'a, C, A> BackendServiceListCall<'a, C, A> where C: BorrowMut BackendServiceListCall<'a, C, A> where C: BorrowMut BackendServiceListCall<'a, C, A> where C: BorrowMut BackendServiceInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -54613,7 +61159,7 @@ impl<'a, C, A> BackendServiceInsertCall<'a, C, A> where C: BorrowMut BackendServiceInsertCall<'a, C, A> where C: BorrowMut BackendServiceInsertCall<'a, C, A> where C: BorrowMut ImageListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -54899,7 +61442,7 @@ impl<'a, C, A> ImageListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -55015,7 +61558,7 @@ impl<'a, C, A> ImageListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55159,10 +61702,7 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -55182,7 +61722,7 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -55270,7 +61810,7 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55421,10 +61961,7 @@ impl<'a, C, A> ImageSetLabelCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -55456,7 +61993,7 @@ impl<'a, C, A> ImageSetLabelCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -55531,7 +62068,7 @@ impl<'a, C, A> ImageSetLabelCall<'a, C, A> where C: BorrowMut, A: self._project = new_value.to_string(); self } - /// Name of the resource for this request. + /// Name or id of the resource for this request. /// /// Sets the *resource* path property to the given value. /// @@ -55556,7 +62093,7 @@ impl<'a, C, A> ImageSetLabelCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55636,7 +62173,7 @@ impl<'a, C, A> ImageSetLabelCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.images().deprecate(req, "project", "image") -/// .request_id("erat") +/// .request_id("accusam") /// .doit(); /// # } /// ``` @@ -55714,10 +62251,7 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -55749,7 +62283,7 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -55860,7 +62394,7 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55904,6 +62438,541 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A } +/// Returns permissions that a caller has on the specified resource. +/// +/// A builder for the *testIamPermissions* method supported by a *image* resource. +/// It is not used directly, but through a `ImageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::TestPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.images().test_iam_permissions(req, "project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct ImageTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: TestPermissionsRequest, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ImageTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ImageTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestPermissionsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.images.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/images/{resource}/testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestPermissionsRequest) -> ImageTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> ImageTestIamPermissionCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ImageTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ImageTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ImageTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ImageTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy for a resource. May be empty if no such policy or resource exists. +/// +/// A builder for the *getIamPolicy* method supported by a *image* resource. +/// It is not used directly, but through a `ImageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.images().get_iam_policy("project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct ImageGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ImageGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ImageGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.images.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/images/{resource}/getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> ImageGetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ImageGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ImageGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ImageGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ImageGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Returns the latest image that is part of an image family and is not deprecated. /// /// A builder for the *getFromFamily* method supported by a *image* resource. @@ -56004,10 +63073,7 @@ impl<'a, C, A> ImageGetFromFamilyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -56027,7 +63093,7 @@ impl<'a, C, A> ImageGetFromFamilyCall<'a, C, A> where C: BorrowMut ImageGetFromFamilyCall<'a, C, A> where C: BorrowMut ImageGetFromFamilyCall<'a, C, A> where C: BorrowMut ImageInsertCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -56309,7 +63372,7 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -56417,7 +63480,7 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56489,7 +63552,7 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.images().delete("project", "image") -/// .request_id("elitr") +/// .request_id("dolor") /// .doit(); /// # } /// ``` @@ -56566,10 +63629,7 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -56589,7 +63649,7 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -56688,7 +63748,7 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56732,6 +63792,289 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o } +/// Sets the access control policy on the specified resource. Replaces any existing policy. +/// +/// A builder for the *setIamPolicy* method supported by a *image* resource. +/// It is not used directly, but through a `ImageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::GlobalSetPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GlobalSetPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.images().set_iam_policy(req, "project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct ImageSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: GlobalSetPolicyRequest, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ImageSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ImageSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.images.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/images/{resource}/setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GlobalSetPolicyRequest) -> ImageSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> ImageSetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ImageSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ImageSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ImageSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ImageSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves the list of regional BackendService resources available to the specified project in the given region. /// /// A builder for the *list* method supported by a *regionBackendService* resource. @@ -56760,10 +64103,10 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_backend_services().list("project", "region") -/// .page_token("eirmod") -/// .order_by("ea") -/// .max_results(30) -/// .filter("sed") +/// .page_token("sed") +/// .order_by("et") +/// .max_results(63) +/// .filter("justo") /// .doit(); /// # } /// ``` @@ -56852,10 +64195,7 @@ impl<'a, C, A> RegionBackendServiceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -56875,7 +64215,7 @@ impl<'a, C, A> RegionBackendServiceListCall<'a, C, A> where C: BorrowMut RegionBackendServiceListCall<'a, C, A> where C: BorrowMut RegionBackendServiceListCall<'a, C, A> where C: BorrowMut RegionBackendServiceInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -57192,7 +64529,7 @@ impl<'a, C, A> RegionBackendServiceInsertCall<'a, C, A> where C: BorrowMut RegionBackendServiceInsertCall<'a, C, A> where C: BorrowMut RegionBackendServiceInsertCall<'a, C, A> where C: BorrowMut RegionBackendServiceUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -57496,7 +64830,7 @@ impl<'a, C, A> RegionBackendServiceUpdateCall<'a, C, A> where C: BorrowMut RegionBackendServiceUpdateCall<'a, C, A> where C: BorrowMut RegionBackendServiceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -57786,7 +65117,7 @@ impl<'a, C, A> RegionBackendServiceGetCall<'a, C, A> where C: BorrowMut RegionBackendServiceGetCall<'a, C, A> where C: BorrowMut RegionBackendServiceGetCall<'a, C, A> where C: BorrowMut RegionBackendServiceDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -58058,7 +65386,7 @@ impl<'a, C, A> RegionBackendServiceDeleteCall<'a, C, A> where C: BorrowMut RegionBackendServiceDeleteCall<'a, C, A> where C: BorrowMut RegionBackendServiceDeleteCall<'a, C, A> where C: BorrowMut RegionBackendServicePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -58360,7 +65685,7 @@ impl<'a, C, A> RegionBackendServicePatchCall<'a, C, A> where C: BorrowMut RegionBackendServicePatchCall<'a, C, A> where C: BorrowMut RegionBackendServiceGetHealthCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -58669,7 +65991,7 @@ impl<'a, C, A> RegionBackendServiceGetHealthCall<'a, C, A> where C: BorrowMut RegionBackendServiceGetHealthCall<'a, C, A> where C: BorrowMut RegionBackendServiceGetHealthCall<'a, C, A> where C: BorrowMut LicenseDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -58950,7 +66269,7 @@ impl<'a, C, A> LicenseDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -59049,7 +66368,7 @@ impl<'a, C, A> LicenseDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -59121,10 +66440,10 @@ impl<'a, C, A> LicenseDeleteCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.licenses().list("project") -/// .page_token("dolor") -/// .order_by("accusam") -/// .max_results(22) -/// .filter("dolor") +/// .page_token("tempor") +/// .order_by("sea") +/// .max_results(85) +/// .filter("nonumy") /// .doit(); /// # } /// ``` @@ -59211,10 +66530,7 @@ impl<'a, C, A> LicenseListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -59234,7 +66550,7 @@ impl<'a, C, A> LicenseListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -59350,7 +66666,7 @@ impl<'a, C, A> LicenseListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -59394,6 +66710,541 @@ impl<'a, C, A> LicenseListCall<'a, C, A> where C: BorrowMut, A: o } +/// Gets the access control policy for a resource. May be empty if no such policy or resource exists. +/// +/// A builder for the *getIamPolicy* method supported by a *license* resource. +/// It is not used directly, but through a `LicenseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.licenses().get_iam_policy("project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct LicenseGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LicenseGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> LicenseGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.licenses.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/licenses/{resource}/getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> LicenseGetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> LicenseGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LicenseGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LicenseGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> LicenseGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on the specified resource. Replaces any existing policy. +/// +/// A builder for the *setIamPolicy* method supported by a *license* resource. +/// It is not used directly, but through a `LicenseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::GlobalSetPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GlobalSetPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.licenses().set_iam_policy(req, "project", "resource") +/// .doit(); +/// # } +/// ``` +pub struct LicenseSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: GlobalSetPolicyRequest, + _project: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LicenseSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> LicenseSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.licenses.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/licenses/{resource}/setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resource", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GlobalSetPolicyRequest) -> LicenseSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> LicenseSetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> LicenseSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LicenseSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LicenseSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> LicenseSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Returns the specified License resource. /// /// A builder for the *get* method supported by a *license* resource. @@ -59494,10 +67345,7 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -59517,7 +67365,7 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -59605,7 +67453,7 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -59756,10 +67604,7 @@ impl<'a, C, A> LicenseTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -59791,7 +67636,7 @@ impl<'a, C, A> LicenseTestIamPermissionCall<'a, C, A> where C: BorrowMut LicenseTestIamPermissionCall<'a, C, A> where C: BorrowMut LicenseTestIamPermissionCall<'a, C, A> where C: BorrowMut LicenseTestIamPermissionCall<'a, C, A> where C: BorrowMut LicenseInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -60080,7 +67922,7 @@ impl<'a, C, A> LicenseInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -60181,7 +68023,7 @@ impl<'a, C, A> LicenseInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -60259,7 +68101,7 @@ impl<'a, C, A> LicenseInsertCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instance_groups().insert(req, "project", "zone") -/// .request_id("dolor") +/// .request_id("clita") /// .doit(); /// # } /// ``` @@ -60337,10 +68179,7 @@ impl<'a, C, A> InstanceGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -60372,7 +68211,7 @@ impl<'a, C, A> InstanceGroupInsertCall<'a, C, A> where C: BorrowMut InstanceGroupInsertCall<'a, C, A> where C: BorrowMut InstanceGroupInsertCall<'a, C, A> where C: BorrowMut InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -60676,7 +68512,7 @@ impl<'a, C, A> InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -60971,7 +68804,7 @@ impl<'a, C, A> InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -61275,7 +69105,7 @@ impl<'a, C, A> InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -61589,7 +69416,7 @@ impl<'a, C, A> InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -61895,7 +69719,7 @@ impl<'a, C, A> InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.instance_groups().list("project", "zone") -/// .page_token("sanctus") -/// .order_by("ut") -/// .max_results(68) -/// .filter("amet.") -/// .doit(); -/// # } -/// ``` -pub struct InstanceGroupListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _project: String, - _zone: String, - _page_token: Option, - _order_by: Option, - _max_results: Option, - _filter: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for InstanceGroupListCall<'a, C, A> {} - -impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, InstanceGroupList)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.instanceGroups.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("zone", self._zone.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._order_by { - params.push(("orderBy", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } - for &field in ["alt", "project", "zone", "pageToken", "orderBy", "maxResults", "filter"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instanceGroups"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["zone", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// The name of the zone where the instance group is located. - /// - /// Sets the *zone* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn zone(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { - self._zone = new_value.to_string(); - self - } - /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - /// - /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - /// - /// Currently, only sorting by name or creationTimestamp desc is supported. - /// - /// Sets the *order by* query property to the given value. - pub fn order_by(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { - self._order_by = Some(new_value.to_string()); - self - } - /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> InstanceGroupListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - /// - /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - /// - /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - /// - /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceGroupListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> InstanceGroupListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> InstanceGroupListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Lists the instances in the specified instance group. /// /// A builder for the *listInstances* method supported by a *instanceGroup* resource. @@ -62402,10 +69913,10 @@ impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instance_groups().list_instances(req, "project", "zone", "instanceGroup") -/// .page_token("et") -/// .order_by("sanctus") -/// .max_results(22) -/// .filter("eos") +/// .page_token("sit") +/// .order_by("erat") +/// .max_results(76) +/// .filter("accusam") /// .doit(); /// # } /// ``` @@ -62497,10 +70008,7 @@ impl<'a, C, A> InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -62532,7 +70040,7 @@ impl<'a, C, A> InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -62849,7 +70354,7 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62947,7 +70452,7 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -62991,6 +70496,316 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, } +/// Retrieves the list of instance groups that are located in the specified project and zone. +/// +/// A builder for the *list* method supported by a *instanceGroup* resource. +/// It is not used directly, but through a `InstanceGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instance_groups().list("project", "zone") +/// .page_token("diam") +/// .order_by("ut") +/// .max_results(72) +/// .filter("eos") +/// .doit(); +/// # } +/// ``` +pub struct InstanceGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _zone: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceGroupListCall<'a, C, A> {} + +impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, InstanceGroupList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instanceGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "zone", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instanceGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone where the instance group is located. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> InstanceGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. + /// + /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. + /// + /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. + /// + /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceGroupListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Returns the specified TargetHttpsProxy resource. Gets a list of available target HTTPS proxies by making a list() request. /// /// A builder for the *get* method supported by a *targetHttpsProxy* resource. @@ -63091,10 +70906,7 @@ impl<'a, C, A> TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63114,7 +70926,7 @@ impl<'a, C, A> TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetQuicOverrideCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -63393,7 +71202,7 @@ impl<'a, C, A> TargetHttpsProxySetQuicOverrideCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -63504,7 +71313,7 @@ impl<'a, C, A> TargetHttpsProxySetQuicOverrideCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -63582,7 +71391,7 @@ impl<'a, C, A> TargetHttpsProxySetQuicOverrideCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.target_https_proxies().insert(req, "project") -/// .request_id("no") +/// .request_id("gubergren") /// .doit(); /// # } /// ``` @@ -63658,10 +71467,7 @@ impl<'a, C, A> TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -63693,7 +71499,7 @@ impl<'a, C, A> TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63979,7 +71782,7 @@ impl<'a, C, A> TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -64267,7 +72067,7 @@ impl<'a, C, A> TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -64557,7 +72354,7 @@ impl<'a, C, A> TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -64859,7 +72653,7 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -64970,7 +72764,7 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -65048,7 +72842,7 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.target_https_proxies().set_ssl_policy(req, "project", "targetHttpsProxy") -/// .request_id("consetetur") +/// .request_id("sit") /// .doit(); /// # } /// ``` @@ -65126,10 +72920,7 @@ impl<'a, C, A> TargetHttpsProxySetSslPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -65161,7 +72952,7 @@ impl<'a, C, A> TargetHttpsProxySetSslPolicyCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetSslPolicyCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetSslPolicyCall<'a, C, A> where C: BorrowMut NetworkAddPeeringCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -65463,7 +73251,7 @@ impl<'a, C, A> NetworkAddPeeringCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -65574,7 +73362,7 @@ impl<'a, C, A> NetworkAddPeeringCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -65718,10 +73506,7 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -65741,7 +73526,7 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -65829,7 +73614,7 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -65907,7 +73692,7 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.networks().insert(req, "project") -/// .request_id("dolor") +/// .request_id("accusam") /// .doit(); /// # } /// ``` @@ -65983,10 +73768,7 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -66018,7 +73800,7 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -66119,7 +73901,7 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -66191,7 +73973,7 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.networks().switch_to_custom_mode("project", "network") -/// .request_id("sit") +/// .request_id("eirmod") /// .doit(); /// # } /// ``` @@ -66268,10 +74050,7 @@ impl<'a, C, A> NetworkSwitchToCustomModeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -66291,7 +74070,7 @@ impl<'a, C, A> NetworkSwitchToCustomModeCall<'a, C, A> where C: BorrowMut NetworkSwitchToCustomModeCall<'a, C, A> where C: BorrowMut NetworkSwitchToCustomModeCall<'a, C, A> where C: BorrowMut NetworkPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -66581,7 +74357,7 @@ impl<'a, C, A> NetworkPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -66692,7 +74468,7 @@ impl<'a, C, A> NetworkPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -66770,7 +74546,7 @@ impl<'a, C, A> NetworkPatchCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.networks().remove_peering(req, "project", "network") -/// .request_id("erat") +/// .request_id("et") /// .doit(); /// # } /// ``` @@ -66848,10 +74624,7 @@ impl<'a, C, A> NetworkRemovePeeringCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -66883,7 +74656,7 @@ impl<'a, C, A> NetworkRemovePeeringCall<'a, C, A> where C: BorrowMut NetworkRemovePeeringCall<'a, C, A> where C: BorrowMut NetworkRemovePeeringCall<'a, C, A> where C: BorrowMut NetworkListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -67179,7 +74949,7 @@ impl<'a, C, A> NetworkListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -67295,7 +75065,7 @@ impl<'a, C, A> NetworkListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -67367,7 +75137,7 @@ impl<'a, C, A> NetworkListCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.networks().delete("project", "network") -/// .request_id("diam") +/// .request_id("At") /// .doit(); /// # } /// ``` @@ -67444,10 +75214,7 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -67467,7 +75234,7 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -67566,7 +75333,7 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -67638,10 +75405,10 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.node_types().list("project", "zone") -/// .page_token("eos") -/// .order_by("elitr") -/// .max_results(63) -/// .filter("ipsum") +/// .page_token("ipsum") +/// .order_by("clita") +/// .max_results(88) +/// .filter("Stet") /// .doit(); /// # } /// ``` @@ -67730,10 +75497,7 @@ impl<'a, C, A> NodeTypeListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -67753,7 +75517,7 @@ impl<'a, C, A> NodeTypeListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -67879,7 +75643,7 @@ impl<'a, C, A> NodeTypeListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -67951,10 +75715,10 @@ impl<'a, C, A> NodeTypeListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.node_types().aggregated_list("project") -/// .page_token("takimata") -/// .order_by("takimata") -/// .max_results(90) -/// .filter("clita") +/// .page_token("et") +/// .order_by("tempor") +/// .max_results(59) +/// .filter("voluptua.") /// .doit(); /// # } /// ``` @@ -68041,10 +75805,7 @@ impl<'a, C, A> NodeTypeAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68064,7 +75825,7 @@ impl<'a, C, A> NodeTypeAggregatedListCall<'a, C, A> where C: BorrowMut NodeTypeAggregatedListCall<'a, C, A> where C: BorrowMut NodeTypeGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68349,7 +76107,7 @@ impl<'a, C, A> NodeTypeGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -68447,7 +76205,7 @@ impl<'a, C, A> NodeTypeGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -68519,7 +76277,7 @@ impl<'a, C, A> NodeTypeGetCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.addresses().delete("project", "region", "address") -/// .request_id("tempor") +/// .request_id("Stet") /// .doit(); /// # } /// ``` @@ -68598,10 +76356,7 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68621,7 +76376,7 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -68730,7 +76485,7 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -68802,10 +76557,10 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.addresses().list("project", "region") -/// .page_token("Stet") -/// .order_by("magna") -/// .max_results(51) -/// .filter("et") +/// .page_token("amet") +/// .order_by("invidunt") +/// .max_results(68) +/// .filter("dolor") /// .doit(); /// # } /// ``` @@ -68894,10 +76649,7 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68917,7 +76669,7 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69043,7 +76795,7 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69115,10 +76867,10 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.addresses().aggregated_list("project") -/// .page_token("rebum.") -/// .order_by("sit") -/// .max_results(46) -/// .filter("sanctus") +/// .page_token("et") +/// .order_by("kasd") +/// .max_results(72) +/// .filter("tempor") /// .doit(); /// # } /// ``` @@ -69205,10 +76957,7 @@ impl<'a, C, A> AddresseAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69228,7 +76977,7 @@ impl<'a, C, A> AddresseAggregatedListCall<'a, C, A> where C: BorrowMut AddresseAggregatedListCall<'a, C, A> where C: BorrowMut AddresseGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69513,7 +77259,7 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69611,7 +77357,7 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69689,7 +77435,7 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.addresses().insert(req, "project", "region") -/// .request_id("accusam") +/// .request_id("sed") /// .doit(); /// # } /// ``` @@ -69767,10 +77513,7 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -69802,7 +77545,7 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -69913,7 +77656,7 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69985,7 +77728,7 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_autoscalers().delete("project", "region", "autoscaler") -/// .request_id("elitr") +/// .request_id("voluptua.") /// .doit(); /// # } /// ``` @@ -70064,10 +77807,7 @@ impl<'a, C, A> RegionAutoscalerDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -70087,7 +77827,7 @@ impl<'a, C, A> RegionAutoscalerDeleteCall<'a, C, A> where C: BorrowMut RegionAutoscalerDeleteCall<'a, C, A> where C: BorrowMut RegionAutoscalerGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -70365,7 +78102,7 @@ impl<'a, C, A> RegionAutoscalerGetCall<'a, C, A> where C: BorrowMut RegionAutoscalerGetCall<'a, C, A> where C: BorrowMut RegionAutoscalerGetCall<'a, C, A> where C: BorrowMut RegionAutoscalerUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -70659,7 +78393,7 @@ impl<'a, C, A> RegionAutoscalerUpdateCall<'a, C, A> where C: BorrowMut RegionAutoscalerUpdateCall<'a, C, A> where C: BorrowMut RegionAutoscalerUpdateCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Autoscaler::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.region_autoscalers().patch(req, "project", "region") -/// .request_id("magna") -/// .autoscaler("invidunt") -/// .doit(); -/// # } -/// ``` -pub struct RegionAutoscalerPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _request: Autoscaler, - _project: String, - _region: String, - _request_id: Option, - _autoscaler: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RegionAutoscalerPatchCall<'a, C, A> {} - -impl<'a, C, A> RegionAutoscalerPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.regionAutoscalers.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("region", self._region.to_string())); - if let Some(value) = self._request_id { - params.push(("requestId", value.to_string())); - } - if let Some(value) = self._autoscaler { - params.push(("autoscaler", value.to_string())); - } - for &field in ["alt", "project", "region", "requestId", "autoscaler"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/autoscalers"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["region", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Autoscaler) -> RegionAutoscalerPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> RegionAutoscalerPatchCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Name of the region scoping this request. - /// - /// Sets the *region* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn region(mut self, new_value: &str) -> RegionAutoscalerPatchCall<'a, C, A> { - self._region = new_value.to_string(); - self - } - /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - /// - /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - /// - /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - /// - /// Sets the *request id* query property to the given value. - pub fn request_id(mut self, new_value: &str) -> RegionAutoscalerPatchCall<'a, C, A> { - self._request_id = Some(new_value.to_string()); - self - } - /// Name of the autoscaler to patch. - /// - /// Sets the *autoscaler* query property to the given value. - pub fn autoscaler(mut self, new_value: &str) -> RegionAutoscalerPatchCall<'a, C, A> { - self._autoscaler = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> RegionAutoscalerPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RegionAutoscalerPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> RegionAutoscalerPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Retrieves a list of autoscalers contained within the specified region. /// /// A builder for the *list* method supported by a *regionAutoscaler* resource. @@ -71163,10 +78583,10 @@ impl<'a, C, A> RegionAutoscalerPatchCall<'a, C, A> where C: BorrowMut RegionAutoscalerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -71278,7 +78695,7 @@ impl<'a, C, A> RegionAutoscalerListCall<'a, C, A> where C: BorrowMut RegionAutoscalerListCall<'a, C, A> where C: BorrowMut RegionAutoscalerListCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Autoscaler::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.region_autoscalers().patch(req, "project", "region") +/// .request_id("justo") +/// .autoscaler("dolore") +/// .doit(); +/// # } +/// ``` +pub struct RegionAutoscalerPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: Autoscaler, + _project: String, + _region: String, + _request_id: Option, + _autoscaler: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RegionAutoscalerPatchCall<'a, C, A> {} + +impl<'a, C, A> RegionAutoscalerPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.regionAutoscalers.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + if let Some(value) = self._autoscaler { + params.push(("autoscaler", value.to_string())); + } + for &field in ["alt", "project", "region", "requestId", "autoscaler"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/autoscalers"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Autoscaler) -> RegionAutoscalerPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> RegionAutoscalerPatchCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the region scoping this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> RegionAutoscalerPatchCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> RegionAutoscalerPatchCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// Name of the autoscaler to patch. + /// + /// Sets the *autoscaler* query property to the given value. + pub fn autoscaler(mut self, new_value: &str) -> RegionAutoscalerPatchCall<'a, C, A> { + self._autoscaler = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RegionAutoscalerPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RegionAutoscalerPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RegionAutoscalerPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates an autoscaler in the specified project using the data included in the request. /// /// A builder for the *insert* method supported by a *regionAutoscaler* resource. @@ -71482,7 +79210,7 @@ impl<'a, C, A> RegionAutoscalerListCall<'a, C, A> where C: BorrowMut RegionAutoscalerInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -71595,7 +79320,7 @@ impl<'a, C, A> RegionAutoscalerInsertCall<'a, C, A> where C: BorrowMut RegionAutoscalerInsertCall<'a, C, A> where C: BorrowMut RegionAutoscalerInsertCall<'a, C, A> where C: BorrowMut InterconnectAttachmentAggregatedListCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -71891,7 +79613,7 @@ impl<'a, C, A> InterconnectAttachmentAggregatedListCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -72007,7 +79729,7 @@ impl<'a, C, A> InterconnectAttachmentAggregatedListCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -72085,7 +79807,7 @@ impl<'a, C, A> InterconnectAttachmentAggregatedListCall<'a, C, A> where C: Borro /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.interconnect_attachments().patch(req, "project", "region", "interconnectAttachment") -/// .request_id("dolore") +/// .request_id("sea") /// .doit(); /// # } /// ``` @@ -72165,10 +79887,7 @@ impl<'a, C, A> InterconnectAttachmentPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -72200,7 +79919,7 @@ impl<'a, C, A> InterconnectAttachmentPatchCall<'a, C, A> where C: BorrowMut InterconnectAttachmentPatchCall<'a, C, A> where C: BorrowMut InterconnectAttachmentPatchCall<'a, C, A> where C: BorrowMut InterconnectAttachmentInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -72512,7 +80228,7 @@ impl<'a, C, A> InterconnectAttachmentInsertCall<'a, C, A> where C: BorrowMut InterconnectAttachmentInsertCall<'a, C, A> where C: BorrowMut InterconnectAttachmentGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -72792,7 +80505,7 @@ impl<'a, C, A> InterconnectAttachmentGetCall<'a, C, A> where C: BorrowMut InterconnectAttachmentGetCall<'a, C, A> where C: BorrowMut InterconnectAttachmentGetCall<'a, C, A> where C: BorrowMut InterconnectAttachmentDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -73064,7 +80774,7 @@ impl<'a, C, A> InterconnectAttachmentDeleteCall<'a, C, A> where C: BorrowMut InterconnectAttachmentDeleteCall<'a, C, A> where C: BorrowMut InterconnectAttachmentDeleteCall<'a, C, A> where C: BorrowMut InterconnectAttachmentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -73360,7 +81067,7 @@ impl<'a, C, A> InterconnectAttachmentListCall<'a, C, A> where C: BorrowMut InterconnectAttachmentListCall<'a, C, A> where C: BorrowMut InterconnectAttachmentListCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.interconnects().get_diagnostics("project", "interconnect") +/// .doit(); +/// # } +/// ``` +pub struct InterconnectGetDiagnosticCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _interconnect: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InterconnectGetDiagnosticCall<'a, C, A> {} + +impl<'a, C, A> InterconnectGetDiagnosticCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, InterconnectsGetDiagnosticsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.interconnects.getDiagnostics", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("interconnect", self._interconnect.to_string())); + for &field in ["alt", "project", "interconnect"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/interconnects/{interconnect}/getDiagnostics"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{interconnect}", "interconnect")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["interconnect", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InterconnectGetDiagnosticCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the interconnect resource to query. + /// + /// Sets the *interconnect* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn interconnect(mut self, new_value: &str) -> InterconnectGetDiagnosticCall<'a, C, A> { + self._interconnect = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InterconnectGetDiagnosticCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InterconnectGetDiagnosticCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InterconnectGetDiagnosticCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates the specified interconnect with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. /// /// A builder for the *patch* method supported by a *interconnect* resource. @@ -73564,7 +81523,7 @@ impl<'a, C, A> InterconnectAttachmentListCall<'a, C, A> where C: BorrowMut InterconnectPatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -73677,7 +81633,7 @@ impl<'a, C, A> InterconnectPatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -73788,7 +81744,7 @@ impl<'a, C, A> InterconnectPatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -73860,10 +81816,10 @@ impl<'a, C, A> InterconnectPatchCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.interconnects().list("project") -/// .page_token("sea") -/// .order_by("voluptua.") -/// .max_results(24) -/// .filter("sanctus") +/// .page_token("diam") +/// .order_by("et") +/// .max_results(3) +/// .filter("tempor") /// .doit(); /// # } /// ``` @@ -73950,10 +81906,7 @@ impl<'a, C, A> InterconnectListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -73973,7 +81926,7 @@ impl<'a, C, A> InterconnectListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -74089,7 +82042,7 @@ impl<'a, C, A> InterconnectListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -74161,7 +82114,7 @@ impl<'a, C, A> InterconnectListCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.interconnects().delete("project", "interconnect") -/// .request_id("magna") +/// .request_id("et") /// .doit(); /// # } /// ``` @@ -74238,10 +82191,7 @@ impl<'a, C, A> InterconnectDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -74261,7 +82211,7 @@ impl<'a, C, A> InterconnectDeleteCall<'a, C, A> where C: BorrowMut InterconnectDeleteCall<'a, C, A> where C: BorrowMut InterconnectDeleteCall<'a, C, A> where C: BorrowMut InterconnectInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -74549,7 +82496,7 @@ impl<'a, C, A> InterconnectInsertCall<'a, C, A> where C: BorrowMut InterconnectInsertCall<'a, C, A> where C: BorrowMut InterconnectGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -74817,7 +82761,7 @@ impl<'a, C, A> InterconnectGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -74905,7 +82849,7 @@ impl<'a, C, A> InterconnectGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -74977,7 +82921,7 @@ impl<'a, C, A> InterconnectGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.autoscalers().delete("project", "zone", "autoscaler") -/// .request_id("sit") +/// .request_id("voluptua.") /// .doit(); /// # } /// ``` @@ -75056,10 +83000,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -75079,7 +83020,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -75188,7 +83129,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -75260,10 +83201,10 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.autoscalers().aggregated_list("project") -/// .page_token("sea") -/// .order_by("justo") -/// .max_results(68) -/// .filter("At") +/// .page_token("dolor") +/// .order_by("ipsum") +/// .max_results(96) +/// .filter("takimata") /// .doit(); /// # } /// ``` @@ -75350,10 +83291,7 @@ impl<'a, C, A> AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -75373,7 +83311,7 @@ impl<'a, C, A> AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut AutoscalerListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -75676,7 +83611,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -75802,7 +83737,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -75880,8 +83815,8 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.autoscalers().patch(req, "project", "zone") -/// .request_id("ipsum") -/// .autoscaler("sadipscing") +/// .request_id("magna") +/// .autoscaler("dolores") /// .doit(); /// # } /// ``` @@ -75963,10 +83898,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -75998,7 +83930,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -76116,7 +84048,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -76194,8 +84126,8 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.autoscalers().update(req, "project", "zone") -/// .request_id("dolor") -/// .autoscaler("Lorem") +/// .request_id("sea") +/// .autoscaler("labore") /// .doit(); /// # } /// ``` @@ -76277,10 +84209,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -76312,7 +84241,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -76430,7 +84359,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -76508,7 +84437,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.autoscalers().insert(req, "project", "zone") -/// .request_id("kasd") +/// .request_id("duo") /// .doit(); /// # } /// ``` @@ -76586,10 +84515,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -76621,7 +84547,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -76732,7 +84658,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -76878,10 +84804,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -76901,7 +84824,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -76999,7 +84922,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -77077,7 +85000,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.subnetworks().insert(req, "project", "region") -/// .request_id("dolor") +/// .request_id("dolore") /// .doit(); /// # } /// ``` @@ -77155,10 +85078,7 @@ impl<'a, C, A> SubnetworkInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -77190,7 +85110,7 @@ impl<'a, C, A> SubnetworkInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -77301,7 +85221,7 @@ impl<'a, C, A> SubnetworkInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -77345,6 +85265,301 @@ impl<'a, C, A> SubnetworkInsertCall<'a, C, A> where C: BorrowMut, } +/// Returns permissions that a caller has on the specified resource. +/// +/// A builder for the *testIamPermissions* method supported by a *subnetwork* resource. +/// It is not used directly, but through a `SubnetworkMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::TestPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subnetworks().test_iam_permissions(req, "project", "region", "resource") +/// .doit(); +/// # } +/// ``` +pub struct SubnetworkTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: TestPermissionsRequest, + _project: String, + _region: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubnetworkTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> SubnetworkTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestPermissionsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.subnetworks.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "region", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/subnetworks/{resource}/testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestPermissionsRequest) -> SubnetworkTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SubnetworkTestIamPermissionCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the region for this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> SubnetworkTestIamPermissionCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> SubnetworkTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubnetworkTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubnetworkTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubnetworkTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves an aggregated list of usable subnetworks. /// /// A builder for the *listUsable* method supported by a *subnetwork* resource. @@ -77373,10 +85588,10 @@ impl<'a, C, A> SubnetworkInsertCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.subnetworks().list_usable("project") -/// .page_token("ipsum") -/// .order_by("gubergren") -/// .max_results(69) -/// .filter("Lorem") +/// .page_token("tempor") +/// .order_by("At") +/// .max_results(30) +/// .filter("et") /// .doit(); /// # } /// ``` @@ -77463,10 +85678,7 @@ impl<'a, C, A> SubnetworkListUsableCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -77486,7 +85698,7 @@ impl<'a, C, A> SubnetworkListUsableCall<'a, C, A> where C: BorrowMut SubnetworkListUsableCall<'a, C, A> where C: BorrowMut SubnetworkListUsableCall<'a, C, A> where C: BorrowMut SubnetworkDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -77776,7 +85985,7 @@ impl<'a, C, A> SubnetworkDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -77885,7 +86094,7 @@ impl<'a, C, A> SubnetworkDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -77963,7 +86172,7 @@ impl<'a, C, A> SubnetworkDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.subnetworks().set_private_ip_google_access(req, "project", "region", "subnetwork") -/// .request_id("sit") +/// .request_id("invidunt") /// .doit(); /// # } /// ``` @@ -78043,10 +86252,7 @@ impl<'a, C, A> SubnetworkSetPrivateIpGoogleAccesCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -78078,7 +86284,7 @@ impl<'a, C, A> SubnetworkSetPrivateIpGoogleAccesCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -78199,7 +86405,7 @@ impl<'a, C, A> SubnetworkSetPrivateIpGoogleAccesCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -78277,7 +86483,7 @@ impl<'a, C, A> SubnetworkSetPrivateIpGoogleAccesCall<'a, C, A> where C: BorrowMu /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.subnetworks().expand_ip_cidr_range(req, "project", "region", "subnetwork") -/// .request_id("et") +/// .request_id("tempor") /// .doit(); /// # } /// ``` @@ -78357,10 +86563,7 @@ impl<'a, C, A> SubnetworkExpandIpCidrRangeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -78392,7 +86595,7 @@ impl<'a, C, A> SubnetworkExpandIpCidrRangeCall<'a, C, A> where C: BorrowMut SubnetworkExpandIpCidrRangeCall<'a, C, A> where C: BorrowMut SubnetworkExpandIpCidrRangeCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subnetworks().get_iam_policy("project", "region", "resource") +/// .doit(); +/// # } +/// ``` +pub struct SubnetworkGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _region: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubnetworkGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> SubnetworkGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.subnetworks.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "region", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/subnetworks/{resource}/getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SubnetworkGetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the region for this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> SubnetworkGetIamPolicyCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> SubnetworkGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubnetworkGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubnetworkGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubnetworkGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on the specified resource. Replaces any existing policy. +/// +/// A builder for the *setIamPolicy* method supported by a *subnetwork* resource. +/// It is not used directly, but through a `SubnetworkMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::RegionSetPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RegionSetPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subnetworks().set_iam_policy(req, "project", "region", "resource") +/// .doit(); +/// # } +/// ``` +pub struct SubnetworkSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: RegionSetPolicyRequest, + _project: String, + _region: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubnetworkSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> SubnetworkSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.subnetworks.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "region", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/subnetworks/{resource}/setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RegionSetPolicyRequest) -> SubnetworkSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SubnetworkSetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the region for this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> SubnetworkSetIamPolicyCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> SubnetworkSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubnetworkSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubnetworkSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubnetworkSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves a list of subnetworks available to the specified project. /// /// A builder for the *list* method supported by a *subnetwork* resource. @@ -78585,10 +87347,10 @@ impl<'a, C, A> SubnetworkExpandIpCidrRangeCall<'a, C, A> where C: BorrowMut SubnetworkListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -78700,7 +87459,7 @@ impl<'a, C, A> SubnetworkListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -78826,7 +87585,7 @@ impl<'a, C, A> SubnetworkListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -78898,10 +87657,10 @@ impl<'a, C, A> SubnetworkListCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.subnetworks().aggregated_list("project") -/// .page_token("voluptua.") -/// .order_by("takimata") -/// .max_results(98) -/// .filter("ipsum") +/// .page_token("sit") +/// .order_by("invidunt") +/// .max_results(76) +/// .filter("sed") /// .doit(); /// # } /// ``` @@ -78988,10 +87747,7 @@ impl<'a, C, A> SubnetworkAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -79011,7 +87767,7 @@ impl<'a, C, A> SubnetworkAggregatedListCall<'a, C, A> where C: BorrowMut SubnetworkAggregatedListCall<'a, C, A> where C: BorrowMut SubnetworkAggregatedListCall<'a, C, A> where C: BorrowMut SubnetworkAggregatedListCall<'a, C, A> where C: BorrowMut SubnetworkPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -79320,7 +88073,7 @@ impl<'a, C, A> SubnetworkPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -79441,7 +88194,7 @@ impl<'a, C, A> SubnetworkPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -79587,10 +88340,7 @@ impl<'a, C, A> SubnetworkGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -79610,7 +88360,7 @@ impl<'a, C, A> SubnetworkGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -79708,7 +88458,7 @@ impl<'a, C, A> SubnetworkGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -79780,10 +88530,10 @@ impl<'a, C, A> SubnetworkGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_disk_types().list("project", "region") -/// .page_token("diam") -/// .order_by("magna") -/// .max_results(32) -/// .filter("eirmod") +/// .page_token("gubergren") +/// .order_by("invidunt") +/// .max_results(22) +/// .filter("At") /// .doit(); /// # } /// ``` @@ -79872,10 +88622,7 @@ impl<'a, C, A> RegionDiskTypeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -79895,7 +88642,7 @@ impl<'a, C, A> RegionDiskTypeListCall<'a, C, A> where C: BorrowMut RegionDiskTypeListCall<'a, C, A> where C: BorrowMut RegionDiskTypeGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -80190,7 +88934,7 @@ impl<'a, C, A> RegionDiskTypeGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -80288,7 +89032,7 @@ impl<'a, C, A> RegionDiskTypeGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -80360,10 +89104,10 @@ impl<'a, C, A> RegionDiskTypeGetCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.global_operations().list("project") -/// .page_token("amet.") -/// .order_by("duo") -/// .max_results(3) -/// .filter("At") +/// .page_token("gubergren") +/// .order_by("magna") +/// .max_results(24) +/// .filter("duo") /// .doit(); /// # } /// ``` @@ -80450,10 +89194,7 @@ impl<'a, C, A> GlobalOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -80473,7 +89214,7 @@ impl<'a, C, A> GlobalOperationListCall<'a, C, A> where C: BorrowMut GlobalOperationListCall<'a, C, A> where C: BorrowMut GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -80755,7 +89493,7 @@ impl<'a, C, A> GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalOperationAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -81018,7 +89753,7 @@ impl<'a, C, A> GlobalOperationAggregatedListCall<'a, C, A> where C: BorrowMut GlobalOperationAggregatedListCall<'a, C, A> where C: BorrowMut GlobalOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -81301,7 +90033,7 @@ impl<'a, C, A> GlobalOperationGetCall<'a, C, A> where C: BorrowMut GlobalOperationGetCall<'a, C, A> where C: BorrowMut SslPolicyGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -81556,7 +90285,7 @@ impl<'a, C, A> SslPolicyGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -81644,7 +90373,7 @@ impl<'a, C, A> SslPolicyGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -81716,10 +90445,10 @@ impl<'a, C, A> SslPolicyGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.ssl_policies().list("project") -/// .page_token("dolores") -/// .order_by("dolores") -/// .max_results(8) -/// .filter("sit") +/// .page_token("diam") +/// .order_by("justo") +/// .max_results(29) +/// .filter("elitr") /// .doit(); /// # } /// ``` @@ -81806,10 +90535,7 @@ impl<'a, C, A> SslPolicyListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -81829,7 +90555,7 @@ impl<'a, C, A> SslPolicyListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -81945,7 +90671,7 @@ impl<'a, C, A> SslPolicyListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -82023,7 +90749,7 @@ impl<'a, C, A> SslPolicyListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.ssl_policies().insert(req, "project") -/// .request_id("sea") +/// .request_id("dolores") /// .doit(); /// # } /// ``` @@ -82099,10 +90825,7 @@ impl<'a, C, A> SslPolicyInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -82134,7 +90857,7 @@ impl<'a, C, A> SslPolicyInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -82235,7 +90958,7 @@ impl<'a, C, A> SslPolicyInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -82307,10 +91030,10 @@ impl<'a, C, A> SslPolicyInsertCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.ssl_policies().list_available_features("project") -/// .page_token("invidunt") -/// .order_by("invidunt") -/// .max_results(51) -/// .filter("eirmod") +/// .page_token("tempor") +/// .order_by("et") +/// .max_results(4) +/// .filter("kasd") /// .doit(); /// # } /// ``` @@ -82397,10 +91120,7 @@ impl<'a, C, A> SslPolicyListAvailableFeatureCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -82420,7 +91140,7 @@ impl<'a, C, A> SslPolicyListAvailableFeatureCall<'a, C, A> where C: BorrowMut SslPolicyListAvailableFeatureCall<'a, C, A> where C: BorrowMut SslPolicyListAvailableFeatureCall<'a, C, A> where C: BorrowMut SslPolicyPatchCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -82727,7 +91444,7 @@ impl<'a, C, A> SslPolicyPatchCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -82838,7 +91555,7 @@ impl<'a, C, A> SslPolicyPatchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -82910,7 +91627,7 @@ impl<'a, C, A> SslPolicyPatchCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.ssl_policies().delete("project", "sslPolicy") -/// .request_id("Lorem") +/// .request_id("eirmod") /// .doit(); /// # } /// ``` @@ -82987,10 +91704,7 @@ impl<'a, C, A> SslPolicyDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -83010,7 +91724,7 @@ impl<'a, C, A> SslPolicyDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -83109,7 +91823,7 @@ impl<'a, C, A> SslPolicyDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -83253,10 +91967,7 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -83276,7 +91987,7 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -83364,7 +92075,7 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -83436,10 +92147,10 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.regions().list("project") -/// .page_token("dolores") -/// .order_by("voluptua.") -/// .max_results(82) -/// .filter("nonumy") +/// .page_token("vero") +/// .order_by("dolore") +/// .max_results(69) +/// .filter("sed") /// .doit(); /// # } /// ``` @@ -83526,10 +92237,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -83549,7 +92257,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -83665,7 +92373,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -83743,7 +92451,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.forwarding_rules().insert(req, "project", "region") -/// .request_id("invidunt") +/// .request_id("consetetur") /// .doit(); /// # } /// ``` @@ -83821,10 +92529,7 @@ impl<'a, C, A> ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -83856,7 +92561,7 @@ impl<'a, C, A> ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -84152,7 +92854,7 @@ impl<'a, C, A> ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -84442,7 +93141,7 @@ impl<'a, C, A> ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut ForwardingRuleListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -84738,7 +93434,7 @@ impl<'a, C, A> ForwardingRuleListCall<'a, C, A> where C: BorrowMut ForwardingRuleListCall<'a, C, A> where C: BorrowMut ForwardingRuleGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -85033,7 +93726,7 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -85131,7 +93824,7 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -85209,7 +93902,7 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.forwarding_rules().set_target(req, "project", "region", "forwardingRule") -/// .request_id("At") +/// .request_id("dolore") /// .doit(); /// # } /// ``` @@ -85289,10 +93982,7 @@ impl<'a, C, A> ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -85324,7 +94014,7 @@ impl<'a, C, A> ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -85638,7 +94325,7 @@ impl<'a, C, A> TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -85944,7 +94628,7 @@ impl<'a, C, A> TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -86258,7 +94939,7 @@ impl<'a, C, A> TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -86579,7 +95257,7 @@ impl<'a, C, A> TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut TargetPoolListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -86887,7 +95562,7 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -87013,7 +95688,7 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -87091,7 +95766,7 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.target_pools().add_health_check(req, "project", "region", "targetPool") -/// .request_id("et") +/// .request_id("ut") /// .doit(); /// # } /// ``` @@ -87171,10 +95846,7 @@ impl<'a, C, A> TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -87206,7 +95878,7 @@ impl<'a, C, A> TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -87518,7 +96187,7 @@ impl<'a, C, A> TargetPoolInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -87629,7 +96298,7 @@ impl<'a, C, A> TargetPoolInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -87782,10 +96451,7 @@ impl<'a, C, A> TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -87817,7 +96483,7 @@ impl<'a, C, A> TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -88096,7 +96759,7 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -88194,7 +96857,7 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -88272,7 +96935,7 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.target_pools().remove_instance(req, "project", "region", "targetPool") -/// .request_id("amet.") +/// .request_id("voluptua.") /// .doit(); /// # } /// ``` @@ -88352,10 +97015,7 @@ impl<'a, C, A> TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -88387,7 +97047,7 @@ impl<'a, C, A> TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -88682,7 +97339,7 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -88791,7 +97448,7 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -88869,7 +97526,7 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.target_instances().insert(req, "project", "zone") -/// .request_id("elitr") +/// .request_id("Lorem") /// .doit(); /// # } /// ``` @@ -88947,10 +97604,7 @@ impl<'a, C, A> TargetInstanceInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -88982,7 +97636,7 @@ impl<'a, C, A> TargetInstanceInsertCall<'a, C, A> where C: BorrowMut TargetInstanceInsertCall<'a, C, A> where C: BorrowMut TargetInstanceInsertCall<'a, C, A> where C: BorrowMut TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -89278,7 +97929,7 @@ impl<'a, C, A> TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -89568,7 +98216,7 @@ impl<'a, C, A> TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut TargetInstanceGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -89846,7 +98491,7 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -89944,7 +98589,7 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -90016,10 +98661,10 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.target_instances().list("project", "zone") -/// .page_token("clita") -/// .order_by("vero") -/// .max_results(14) -/// .filter("est") +/// .page_token("sit") +/// .order_by("ea") +/// .max_results(95) +/// .filter("voluptua.") /// .doit(); /// # } /// ``` @@ -90108,10 +98753,7 @@ impl<'a, C, A> TargetInstanceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -90131,7 +98773,7 @@ impl<'a, C, A> TargetInstanceListCall<'a, C, A> where C: BorrowMut TargetInstanceListCall<'a, C, A> where C: BorrowMut TargetInstanceListCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -90429,7 +99068,7 @@ impl<'a, C, A> GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -90695,7 +99331,7 @@ impl<'a, C, A> GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -90974,7 +99607,7 @@ impl<'a, C, A> GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -91270,7 +99900,7 @@ impl<'a, C, A> GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -91575,7 +100202,7 @@ impl<'a, C, A> GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.https_health_checks().delete("project", "httpsHealthCheck") +/// .request_id("sea") +/// .doit(); +/// # } +/// ``` +pub struct HttpsHealthCheckDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _https_health_check: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for HttpsHealthCheckDeleteCall<'a, C, A> {} + +impl<'a, C, A> HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("httpsHealthCheck", self._https_health_check.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "httpsHealthCheck", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/httpsHealthChecks/{httpsHealthCheck}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{httpsHealthCheck}", "httpsHealthCheck")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["httpsHealthCheck", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> HttpsHealthCheckDeleteCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the HttpsHealthCheck resource to delete. + /// + /// Sets the *https health check* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn https_health_check(mut self, new_value: &str) -> HttpsHealthCheckDeleteCall<'a, C, A> { + self._https_health_check = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> HttpsHealthCheckDeleteCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> HttpsHealthCheckDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> HttpsHealthCheckDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> HttpsHealthCheckDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates a HttpsHealthCheck resource in the specified project using the data included in the request. /// /// A builder for the *insert* method supported by a *httpsHealthCheck* resource. @@ -91754,7 +100649,7 @@ impl<'a, C, A> GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut HttpsHealthCheckInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -91865,7 +100757,7 @@ impl<'a, C, A> HttpsHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpsHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -92133,7 +101022,7 @@ impl<'a, C, A> HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -92412,7 +101298,7 @@ impl<'a, C, A> HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -92714,7 +101597,7 @@ impl<'a, C, A> HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.https_health_checks().delete("project", "httpsHealthCheck") -/// .request_id("aliquyam") -/// .doit(); -/// # } -/// ``` -pub struct HttpsHealthCheckDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _project: String, - _https_health_check: String, - _request_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for HttpsHealthCheckDeleteCall<'a, C, A> {} - -impl<'a, C, A> HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("httpsHealthCheck", self._https_health_check.to_string())); - if let Some(value) = self._request_id { - params.push(("requestId", value.to_string())); - } - for &field in ["alt", "project", "httpsHealthCheck", "requestId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/global/httpsHealthChecks/{httpsHealthCheck}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{httpsHealthCheck}", "httpsHealthCheck")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["httpsHealthCheck", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> HttpsHealthCheckDeleteCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Name of the HttpsHealthCheck resource to delete. - /// - /// Sets the *https health check* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn https_health_check(mut self, new_value: &str) -> HttpsHealthCheckDeleteCall<'a, C, A> { - self._https_health_check = new_value.to_string(); - self - } - /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - /// - /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - /// - /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - /// - /// Sets the *request id* query property to the given value. - pub fn request_id(mut self, new_value: &str) -> HttpsHealthCheckDeleteCall<'a, C, A> { - self._request_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> HttpsHealthCheckDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> HttpsHealthCheckDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> HttpsHealthCheckDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Retrieves the list of HttpsHealthCheck resources available to the specified project. /// /// A builder for the *list* method supported by a *httpsHealthCheck* resource. @@ -93168,10 +101780,10 @@ impl<'a, C, A> HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -93281,7 +101890,7 @@ impl<'a, C, A> HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.network_endpoint_groups().delete("project", "zone", "networkEndpointGroup") +/// .request_id("eos") +/// .doit(); +/// # } +/// ``` +pub struct NetworkEndpointGroupDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _zone: String, + _network_endpoint_group: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NetworkEndpointGroupDeleteCall<'a, C, A> {} + +impl<'a, C, A> NetworkEndpointGroupDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.networkEndpointGroups.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("networkEndpointGroup", self._network_endpoint_group.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "zone", "networkEndpointGroup", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/networkEndpointGroups/{networkEndpointGroup}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{networkEndpointGroup}", "networkEndpointGroup")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["networkEndpointGroup", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NetworkEndpointGroupDeleteCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NetworkEndpointGroupDeleteCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// The name of the network endpoint group to delete. It should comply with RFC1035. + /// + /// Sets the *network endpoint group* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn network_endpoint_group(mut self, new_value: &str) -> NetworkEndpointGroupDeleteCall<'a, C, A> { + self._network_endpoint_group = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> NetworkEndpointGroupDeleteCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NetworkEndpointGroupDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NetworkEndpointGroupDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NetworkEndpointGroupDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Detach a list of network endpoints from the specified network endpoint group. +/// +/// A builder for the *detachNetworkEndpoints* method supported by a *networkEndpointGroup* resource. +/// It is not used directly, but through a `NetworkEndpointGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::NetworkEndpointGroupsDetachEndpointsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = NetworkEndpointGroupsDetachEndpointsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.network_endpoint_groups().detach_network_endpoints(req, "project", "zone", "networkEndpointGroup") +/// .request_id("ea") +/// .doit(); +/// # } +/// ``` +pub struct NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: NetworkEndpointGroupsDetachEndpointsRequest, + _project: String, + _zone: String, + _network_endpoint_group: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> {} + +impl<'a, C, A> NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.networkEndpointGroups.detachNetworkEndpoints", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("networkEndpointGroup", self._network_endpoint_group.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "zone", "networkEndpointGroup", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/networkEndpointGroups/{networkEndpointGroup}/detachNetworkEndpoints"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{networkEndpointGroup}", "networkEndpointGroup")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["networkEndpointGroup", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: NetworkEndpointGroupsDetachEndpointsRequest) -> NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// The name of the network endpoint group where you are removing network endpoints. It should comply with RFC1035. + /// + /// Sets the *network endpoint group* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn network_endpoint_group(mut self, new_value: &str) -> NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> { + self._network_endpoint_group = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NetworkEndpointGroupDetachNetworkEndpointCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the list of network endpoint groups that are located in the specified project and zone. +/// +/// A builder for the *list* method supported by a *networkEndpointGroup* resource. +/// It is not used directly, but through a `NetworkEndpointGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.network_endpoint_groups().list("project", "zone") +/// .page_token("sadipscing") +/// .order_by("voluptua.") +/// .max_results(80) +/// .filter("accusam") +/// .doit(); +/// # } +/// ``` +pub struct NetworkEndpointGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _zone: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NetworkEndpointGroupListCall<'a, C, A> {} + +impl<'a, C, A> NetworkEndpointGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, NetworkEndpointGroupList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.networkEndpointGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "zone", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/networkEndpointGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NetworkEndpointGroupListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NetworkEndpointGroupListCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> NetworkEndpointGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> NetworkEndpointGroupListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> NetworkEndpointGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. + /// + /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. + /// + /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. + /// + /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> NetworkEndpointGroupListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NetworkEndpointGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NetworkEndpointGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NetworkEndpointGroupListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a network endpoint group in the specified project using the parameters that are included in the request. +/// +/// A builder for the *insert* method supported by a *networkEndpointGroup* resource. +/// It is not used directly, but through a `NetworkEndpointGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::NetworkEndpointGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = NetworkEndpointGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.network_endpoint_groups().insert(req, "project", "zone") +/// .request_id("sed") +/// .doit(); +/// # } +/// ``` +pub struct NetworkEndpointGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: NetworkEndpointGroup, + _project: String, + _zone: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NetworkEndpointGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> NetworkEndpointGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.networkEndpointGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "zone", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/networkEndpointGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: NetworkEndpointGroup) -> NetworkEndpointGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NetworkEndpointGroupInsertCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone where you want to create the network endpoint group. It should comply with RFC1035. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NetworkEndpointGroupInsertCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> NetworkEndpointGroupInsertCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NetworkEndpointGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NetworkEndpointGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NetworkEndpointGroupInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on the specified resource. +/// +/// A builder for the *testIamPermissions* method supported by a *networkEndpointGroup* resource. +/// It is not used directly, but through a `NetworkEndpointGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::TestPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.network_endpoint_groups().test_iam_permissions(req, "project", "zone", "resource") +/// .doit(); +/// # } +/// ``` +pub struct NetworkEndpointGroupTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: TestPermissionsRequest, + _project: String, + _zone: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NetworkEndpointGroupTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> NetworkEndpointGroupTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestPermissionsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.networkEndpointGroups.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "zone", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/networkEndpointGroups/{resource}/testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestPermissionsRequest) -> NetworkEndpointGroupTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NetworkEndpointGroupTestIamPermissionCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NetworkEndpointGroupTestIamPermissionCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> NetworkEndpointGroupTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NetworkEndpointGroupTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NetworkEndpointGroupTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NetworkEndpointGroupTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Attach a list of network endpoints to the specified network endpoint group. +/// +/// A builder for the *attachNetworkEndpoints* method supported by a *networkEndpointGroup* resource. +/// It is not used directly, but through a `NetworkEndpointGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::NetworkEndpointGroupsAttachEndpointsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = NetworkEndpointGroupsAttachEndpointsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.network_endpoint_groups().attach_network_endpoints(req, "project", "zone", "networkEndpointGroup") +/// .request_id("est") +/// .doit(); +/// # } +/// ``` +pub struct NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: NetworkEndpointGroupsAttachEndpointsRequest, + _project: String, + _zone: String, + _network_endpoint_group: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> {} + +impl<'a, C, A> NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.networkEndpointGroups.attachNetworkEndpoints", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("networkEndpointGroup", self._network_endpoint_group.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "zone", "networkEndpointGroup", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/networkEndpointGroups/{networkEndpointGroup}/attachNetworkEndpoints"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{networkEndpointGroup}", "networkEndpointGroup")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["networkEndpointGroup", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: NetworkEndpointGroupsAttachEndpointsRequest) -> NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// The name of the network endpoint group where you are attaching network endpoints to. It should comply with RFC1035. + /// + /// Sets the *network endpoint group* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn network_endpoint_group(mut self, new_value: &str) -> NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> { + self._network_endpoint_group = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NetworkEndpointGroupAttachNetworkEndpointCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the list of network endpoint groups and sorts them by zone. +/// +/// A builder for the *aggregatedList* method supported by a *networkEndpointGroup* resource. +/// It is not used directly, but through a `NetworkEndpointGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.network_endpoint_groups().aggregated_list("project") +/// .page_token("amet.") +/// .order_by("gubergren") +/// .max_results(51) +/// .filter("kasd") +/// .doit(); +/// # } +/// ``` +pub struct NetworkEndpointGroupAggregatedListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NetworkEndpointGroupAggregatedListCall<'a, C, A> {} + +impl<'a, C, A> NetworkEndpointGroupAggregatedListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, NetworkEndpointGroupAggregatedList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.networkEndpointGroups.aggregatedList", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/aggregated/networkEndpointGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NetworkEndpointGroupAggregatedListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> NetworkEndpointGroupAggregatedListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> NetworkEndpointGroupAggregatedListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> NetworkEndpointGroupAggregatedListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. + /// + /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. + /// + /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. + /// + /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> NetworkEndpointGroupAggregatedListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NetworkEndpointGroupAggregatedListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NetworkEndpointGroupAggregatedListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NetworkEndpointGroupAggregatedListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists the network endpoints in the specified network endpoint group. +/// +/// A builder for the *listNetworkEndpoints* method supported by a *networkEndpointGroup* resource. +/// It is not used directly, but through a `NetworkEndpointGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::NetworkEndpointGroupsListEndpointsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = NetworkEndpointGroupsListEndpointsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.network_endpoint_groups().list_network_endpoints(req, "project", "zone", "networkEndpointGroup") +/// .page_token("At") +/// .order_by("magna") +/// .max_results(4) +/// .filter("rebum.") +/// .doit(); +/// # } +/// ``` +pub struct NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: NetworkEndpointGroupsListEndpointsRequest, + _project: String, + _zone: String, + _network_endpoint_group: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> {} + +impl<'a, C, A> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, NetworkEndpointGroupsListNetworkEndpoints)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.networkEndpointGroups.listNetworkEndpoints", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("networkEndpointGroup", self._network_endpoint_group.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "zone", "networkEndpointGroup", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/networkEndpointGroups/{networkEndpointGroup}/listNetworkEndpoints"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{networkEndpointGroup}", "networkEndpointGroup")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["networkEndpointGroup", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: NetworkEndpointGroupsListEndpointsRequest) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// The name of the network endpoint group from which you want to generate a list of included network endpoints. It should comply with RFC1035. + /// + /// Sets the *network endpoint group* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn network_endpoint_group(mut self, new_value: &str) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> { + self._network_endpoint_group = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. + /// + /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. + /// + /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. + /// + /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NetworkEndpointGroupListNetworkEndpointCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. +/// +/// A builder for the *get* method supported by a *networkEndpointGroup* resource. +/// It is not used directly, but through a `NetworkEndpointGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.network_endpoint_groups().get("project", "zone", "networkEndpointGroup") +/// .doit(); +/// # } +/// ``` +pub struct NetworkEndpointGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _zone: String, + _network_endpoint_group: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NetworkEndpointGroupGetCall<'a, C, A> {} + +impl<'a, C, A> NetworkEndpointGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, NetworkEndpointGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.networkEndpointGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("networkEndpointGroup", self._network_endpoint_group.to_string())); + for &field in ["alt", "project", "zone", "networkEndpointGroup"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/networkEndpointGroups/{networkEndpointGroup}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{networkEndpointGroup}", "networkEndpointGroup")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["networkEndpointGroup", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NetworkEndpointGroupGetCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone where the network endpoint group is located. It should comply with RFC1035. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> NetworkEndpointGroupGetCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// The name of the network endpoint group. It should comply with RFC1035. + /// + /// Sets the *network endpoint group* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn network_endpoint_group(mut self, new_value: &str) -> NetworkEndpointGroupGetCall<'a, C, A> { + self._network_endpoint_group = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NetworkEndpointGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NetworkEndpointGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NetworkEndpointGroupGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. /// /// A builder for the *get* method supported by a *licenseCode* resource. @@ -93541,10 +104871,7 @@ impl<'a, C, A> LicenseCodeGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -93564,7 +104891,7 @@ impl<'a, C, A> LicenseCodeGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -93652,7 +104979,7 @@ impl<'a, C, A> LicenseCodeGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -93803,10 +105130,7 @@ impl<'a, C, A> LicenseCodeTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -93838,7 +105162,7 @@ impl<'a, C, A> LicenseCodeTestIamPermissionCall<'a, C, A> where C: BorrowMut LicenseCodeTestIamPermissionCall<'a, C, A> where C: BorrowMut LicenseCodeTestIamPermissionCall<'a, C, A> where C: BorrowMut LicenseCodeTestIamPermissionCall<'a, C, A> where C: BorrowMut RegionInstanceGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -94125,7 +105446,7 @@ impl<'a, C, A> RegionInstanceGroupListCall<'a, C, A> where C: BorrowMut RegionInstanceGroupListCall<'a, C, A> where C: BorrowMut RegionInstanceGroupListCall<'a, C, A> where C: BorrowMut RegionInstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -94444,7 +105762,7 @@ impl<'a, C, A> RegionInstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -94565,7 +105883,7 @@ impl<'a, C, A> RegionInstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -94711,10 +106029,7 @@ impl<'a, C, A> RegionInstanceGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -94734,7 +106049,7 @@ impl<'a, C, A> RegionInstanceGroupGetCall<'a, C, A> where C: BorrowMut RegionInstanceGroupGetCall<'a, C, A> where C: BorrowMut RegionInstanceGroupGetCall<'a, C, A> where C: BorrowMut RegionInstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -95040,7 +106352,7 @@ impl<'a, C, A> RegionInstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -95188,7 +106500,7 @@ impl<'a, C, A> RegionInstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -95260,7 +106572,7 @@ impl<'a, C, A> RegionInstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.routers().delete("project", "region", "router") -/// .request_id("Lorem") +/// .request_id("elitr") /// .doit(); /// # } /// ``` @@ -95339,10 +106651,7 @@ impl<'a, C, A> RouterDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -95362,7 +106671,7 @@ impl<'a, C, A> RouterDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -95471,7 +106780,7 @@ impl<'a, C, A> RouterDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -95624,10 +106933,7 @@ impl<'a, C, A> RouterPreviewCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -95659,7 +106965,7 @@ impl<'a, C, A> RouterPreviewCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -95769,7 +107075,7 @@ impl<'a, C, A> RouterPreviewCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -95841,10 +107147,10 @@ impl<'a, C, A> RouterPreviewCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.routers().aggregated_list("project") -/// .page_token("dolor") -/// .order_by("ea") -/// .max_results(58) -/// .filter("voluptua.") +/// .page_token("justo") +/// .order_by("tempor") +/// .max_results(44) +/// .filter("no") /// .doit(); /// # } /// ``` @@ -95931,10 +107237,7 @@ impl<'a, C, A> RouterAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -95954,7 +107257,7 @@ impl<'a, C, A> RouterAggregatedListCall<'a, C, A> where C: BorrowMut RouterAggregatedListCall<'a, C, A> where C: BorrowMut RouterGetRouterStatuCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -96239,7 +107539,7 @@ impl<'a, C, A> RouterGetRouterStatuCall<'a, C, A> where C: BorrowMut RouterGetRouterStatuCall<'a, C, A> where C: BorrowMut RouterGetRouterStatuCall<'a, C, A> where C: BorrowMut RouterUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -96530,7 +107827,7 @@ impl<'a, C, A> RouterUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -96651,7 +107948,7 @@ impl<'a, C, A> RouterUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -96797,10 +108094,7 @@ impl<'a, C, A> RouterGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -96820,7 +108114,7 @@ impl<'a, C, A> RouterGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -96918,7 +108212,7 @@ impl<'a, C, A> RouterGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -96990,9 +108284,9 @@ impl<'a, C, A> RouterGetCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.routers().list("project", "region") -/// .page_token("et") -/// .order_by("tempor") -/// .max_results(71) +/// .page_token("sadipscing") +/// .order_by("ea") +/// .max_results(61) /// .filter("eirmod") /// .doit(); /// # } @@ -97082,10 +108376,7 @@ impl<'a, C, A> RouterListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -97105,7 +108396,7 @@ impl<'a, C, A> RouterListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -97231,7 +108522,7 @@ impl<'a, C, A> RouterListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -97309,7 +108600,7 @@ impl<'a, C, A> RouterListCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.routers().patch(req, "project", "region", "router") -/// .request_id("labore") +/// .request_id("nonumy") /// .doit(); /// # } /// ``` @@ -97389,10 +108680,7 @@ impl<'a, C, A> RouterPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -97424,7 +108712,7 @@ impl<'a, C, A> RouterPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -97545,7 +108833,7 @@ impl<'a, C, A> RouterPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -97589,6 +108877,328 @@ impl<'a, C, A> RouterPatchCall<'a, C, A> where C: BorrowMut, A: o } +/// Retrieves runtime Nat mapping information of VM endpoints. +/// +/// A builder for the *getNatMappingInfo* method supported by a *router* resource. +/// It is not used directly, but through a `RouterMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.routers().get_nat_mapping_info("project", "region", "router") +/// .page_token("sit") +/// .order_by("sed") +/// .max_results(23) +/// .filter("At") +/// .doit(); +/// # } +/// ``` +pub struct RouterGetNatMappingInfoCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _region: String, + _router: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RouterGetNatMappingInfoCall<'a, C, A> {} + +impl<'a, C, A> RouterGetNatMappingInfoCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VmEndpointNatMappingsList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.routers.getNatMappingInfo", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("router", self._router.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "region", "router", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/routers/{router}/getNatMappingInfo"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{router}", "router")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["router", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> RouterGetNatMappingInfoCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the region for this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> RouterGetNatMappingInfoCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name of the Router resource to query for Nat Mapping information of VM endpoints. + /// + /// Sets the *router* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn router(mut self, new_value: &str) -> RouterGetNatMappingInfoCall<'a, C, A> { + self._router = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> RouterGetNatMappingInfoCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> RouterGetNatMappingInfoCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> RouterGetNatMappingInfoCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. + /// + /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. + /// + /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. + /// + /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> RouterGetNatMappingInfoCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RouterGetNatMappingInfoCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RouterGetNatMappingInfoCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RouterGetNatMappingInfoCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates a Router resource in the specified project and region using the data included in the request. /// /// A builder for the *insert* method supported by a *router* resource. @@ -97623,7 +109233,7 @@ impl<'a, C, A> RouterPatchCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.routers().insert(req, "project", "region") -/// .request_id("justo") +/// .request_id("sed") /// .doit(); /// # } /// ``` @@ -97701,10 +109311,7 @@ impl<'a, C, A> RouterInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -97736,7 +109343,7 @@ impl<'a, C, A> RouterInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -97847,7 +109454,7 @@ impl<'a, C, A> RouterInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -97925,7 +109532,7 @@ impl<'a, C, A> RouterInsertCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.health_checks().update(req, "project", "healthCheck") -/// .request_id("rebum.") +/// .request_id("ut") /// .doit(); /// # } /// ``` @@ -98003,10 +109610,7 @@ impl<'a, C, A> HealthCheckUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -98038,7 +109642,7 @@ impl<'a, C, A> HealthCheckUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -98149,7 +109753,7 @@ impl<'a, C, A> HealthCheckUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -98227,7 +109831,7 @@ impl<'a, C, A> HealthCheckUpdateCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.health_checks().insert(req, "project") -/// .request_id("nonumy") +/// .request_id("Lorem") /// .doit(); /// # } /// ``` @@ -98303,10 +109907,7 @@ impl<'a, C, A> HealthCheckInsertCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -98338,7 +109939,7 @@ impl<'a, C, A> HealthCheckInsertCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -98439,7 +110040,7 @@ impl<'a, C, A> HealthCheckInsertCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -98583,10 +110184,7 @@ impl<'a, C, A> HealthCheckGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -98606,7 +110204,7 @@ impl<'a, C, A> HealthCheckGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -98694,7 +110292,7 @@ impl<'a, C, A> HealthCheckGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -98766,7 +110364,7 @@ impl<'a, C, A> HealthCheckGetCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.health_checks().delete("project", "healthCheck") -/// .request_id("rebum.") +/// .request_id("aliquyam") /// .doit(); /// # } /// ``` @@ -98843,10 +110441,7 @@ impl<'a, C, A> HealthCheckDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -98866,7 +110461,7 @@ impl<'a, C, A> HealthCheckDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -98965,7 +110560,7 @@ impl<'a, C, A> HealthCheckDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -99043,7 +110638,7 @@ impl<'a, C, A> HealthCheckDeleteCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.health_checks().patch(req, "project", "healthCheck") -/// .request_id("Lorem") +/// .request_id("et") /// .doit(); /// # } /// ``` @@ -99121,10 +110716,7 @@ impl<'a, C, A> HealthCheckPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -99156,7 +110748,7 @@ impl<'a, C, A> HealthCheckPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -99267,7 +110859,7 @@ impl<'a, C, A> HealthCheckPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -99339,10 +110931,10 @@ impl<'a, C, A> HealthCheckPatchCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.health_checks().list("project") -/// .page_token("voluptua.") -/// .order_by("justo") -/// .max_results(28) -/// .filter("At") +/// .page_token("aliquyam") +/// .order_by("sea") +/// .max_results(42) +/// .filter("no") /// .doit(); /// # } /// ``` @@ -99429,10 +111021,7 @@ impl<'a, C, A> HealthCheckListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -99452,7 +111041,7 @@ impl<'a, C, A> HealthCheckListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -99568,7 +111157,7 @@ impl<'a, C, A> HealthCheckListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -99612,7 +111201,7 @@ impl<'a, C, A> HealthCheckListCall<'a, C, A> where C: BorrowMut, } -/// Schedules a group action to delete the specified instances in the managed instance group. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. +/// Flags the specified instances in the managed instance group to be immediately deleted. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. The deleteInstances operation is marked DONE if the deleteInstances request is successful. The underlying actions take additional time. You must separately verify the status of the deleting action with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -99730,10 +111319,7 @@ impl<'a, C, A> RegionInstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -99765,7 +111351,7 @@ impl<'a, C, A> RegionInstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -99886,7 +111472,7 @@ impl<'a, C, A> RegionInstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -99958,7 +111544,7 @@ impl<'a, C, A> RegionInstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: B /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_instance_group_managers().delete("project", "region", "instanceGroupManager") -/// .request_id("aliquyam") +/// .request_id("takimata") /// .doit(); /// # } /// ``` @@ -100037,10 +111623,7 @@ impl<'a, C, A> RegionInstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -100060,7 +111643,7 @@ impl<'a, C, A> RegionInstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -100169,7 +111752,7 @@ impl<'a, C, A> RegionInstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -100247,7 +111830,7 @@ impl<'a, C, A> RegionInstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_instance_group_managers().set_instance_template(req, "project", "region", "instanceGroupManager") -/// .request_id("gubergren") +/// .request_id("sit") /// .doit(); /// # } /// ``` @@ -100327,10 +111910,7 @@ impl<'a, C, A> RegionInstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -100362,7 +111942,7 @@ impl<'a, C, A> RegionInstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -100483,7 +112063,7 @@ impl<'a, C, A> RegionInstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -100527,7 +112107,9 @@ impl<'a, C, A> RegionInstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where } -/// Changes the intended size for the managed instance group. If you increase the size, the group schedules actions to create new instances using the current instance template. If you decrease the size, the group schedules delete actions on one or more instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. +/// Changes the intended size of the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes one or more instances. +/// +/// The resize operation is marked DONE if the resize request is successful. The underlying actions take additional time. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -100556,8 +112138,8 @@ impl<'a, C, A> RegionInstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.region_instance_group_managers().resize("project", "region", "instanceGroupManager", -55) -/// .request_id("kasd") +/// let result = hub.region_instance_group_managers().resize("project", "region", "instanceGroupManager", -93) +/// .request_id("sed") /// .doit(); /// # } /// ``` @@ -100638,10 +112220,7 @@ impl<'a, C, A> RegionInstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -100661,7 +112240,7 @@ impl<'a, C, A> RegionInstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -100780,7 +112359,7 @@ impl<'a, C, A> RegionInstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -100858,7 +112437,7 @@ impl<'a, C, A> RegionInstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_instance_group_managers().set_target_pools(req, "project", "region", "instanceGroupManager") -/// .request_id("rebum.") +/// .request_id("aliquyam") /// .doit(); /// # } /// ``` @@ -100938,10 +112517,7 @@ impl<'a, C, A> RegionInstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -100973,7 +112549,7 @@ impl<'a, C, A> RegionInstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -101094,7 +112670,7 @@ impl<'a, C, A> RegionInstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -101138,7 +112714,7 @@ impl<'a, C, A> RegionInstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: Bo } -/// Creates a managed instance group using the information that you specify in the request. After the group is created, it schedules an action to create instances in the group using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. +/// Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. /// /// A regional managed instance group can contain up to 2000 instances. /// @@ -101174,7 +112750,7 @@ impl<'a, C, A> RegionInstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_instance_group_managers().insert(req, "project", "region") -/// .request_id("est") +/// .request_id("tempor") /// .doit(); /// # } /// ``` @@ -101252,10 +112828,7 @@ impl<'a, C, A> RegionInstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -101287,7 +112860,7 @@ impl<'a, C, A> RegionInstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -101398,7 +112971,7 @@ impl<'a, C, A> RegionInstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -101544,10 +113117,7 @@ impl<'a, C, A> RegionInstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -101567,7 +113137,7 @@ impl<'a, C, A> RegionInstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut RegionInstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut RegionInstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut RegionInstanceGroupManagerListManagedInstanceCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -101854,7 +113421,7 @@ impl<'a, C, A> RegionInstanceGroupManagerListManagedInstanceCall<'a, C, A> where let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -101990,7 +113557,7 @@ impl<'a, C, A> RegionInstanceGroupManagerListManagedInstanceCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -102034,7 +113601,318 @@ impl<'a, C, A> RegionInstanceGroupManagerListManagedInstanceCall<'a, C, A> where } -/// Schedules a group action to recreate the specified instances in the managed instance group. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the action is scheduled even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. +/// Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listmanagedinstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +/// +/// A builder for the *patch* method supported by a *regionInstanceGroupManager* resource. +/// It is not used directly, but through a `RegionInstanceGroupManagerMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::InstanceGroupManager; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = InstanceGroupManager::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.region_instance_group_managers().patch(req, "project", "region", "instanceGroupManager") +/// .request_id("sadipscing") +/// .doit(); +/// # } +/// ``` +pub struct RegionInstanceGroupManagerPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: InstanceGroupManager, + _project: String, + _region: String, + _instance_group_manager: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RegionInstanceGroupManagerPatchCall<'a, C, A> {} + +impl<'a, C, A> RegionInstanceGroupManagerPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.regionInstanceGroupManagers.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("instanceGroupManager", self._instance_group_manager.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "region", "instanceGroupManager", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/instanceGroupManagers/{instanceGroupManager}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{instanceGroupManager}", "instanceGroupManager")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["instanceGroupManager", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: InstanceGroupManager) -> RegionInstanceGroupManagerPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> RegionInstanceGroupManagerPatchCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the region scoping this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> RegionInstanceGroupManagerPatchCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// The name of the instance group manager. + /// + /// Sets the *instance group manager* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance_group_manager(mut self, new_value: &str) -> RegionInstanceGroupManagerPatchCall<'a, C, A> { + self._instance_group_manager = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> RegionInstanceGroupManagerPatchCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RegionInstanceGroupManagerPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RegionInstanceGroupManagerPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RegionInstanceGroupManagerPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Flags the specified instances in the managed instance group to be immediately recreated. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -102072,7 +113950,7 @@ impl<'a, C, A> RegionInstanceGroupManagerListManagedInstanceCall<'a, C, A> where /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_instance_group_managers().recreate_instances(req, "project", "region", "instanceGroupManager") -/// .request_id("sit") +/// .request_id("est") /// .doit(); /// # } /// ``` @@ -102152,10 +114030,7 @@ impl<'a, C, A> RegionInstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -102187,7 +114062,7 @@ impl<'a, C, A> RegionInstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -102308,7 +114183,7 @@ impl<'a, C, A> RegionInstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -102380,10 +114255,10 @@ impl<'a, C, A> RegionInstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_instance_group_managers().list("project", "region") -/// .page_token("ea") -/// .order_by("Stet") -/// .max_results(27) -/// .filter("Lorem") +/// .page_token("labore") +/// .order_by("magna") +/// .max_results(29) +/// .filter("sed") /// .doit(); /// # } /// ``` @@ -102472,10 +114347,7 @@ impl<'a, C, A> RegionInstanceGroupManagerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -102495,7 +114367,7 @@ impl<'a, C, A> RegionInstanceGroupManagerListCall<'a, C, A> where C: BorrowMut RegionInstanceGroupManagerListCall<'a, C, A> where C: BorrowMut RegionInstanceGroupManagerListCall<'a, C, A> where C: BorrowMut RegionInstanceGroupManagerListCall<'a, C, A> where C: BorrowMut RegionInstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -102818,7 +114687,7 @@ impl<'a, C, A> RegionInstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -102939,7 +114808,7 @@ impl<'a, C, A> RegionInstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -103011,10 +114880,10 @@ impl<'a, C, A> RegionInstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.machine_types().aggregated_list("project") -/// .page_token("dolores") -/// .order_by("et") -/// .max_results(7) -/// .filter("vero") +/// .page_token("sadipscing") +/// .order_by("erat") +/// .max_results(86) +/// .filter("ipsum") /// .doit(); /// # } /// ``` @@ -103101,10 +114970,7 @@ impl<'a, C, A> MachineTypeAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -103124,7 +114990,7 @@ impl<'a, C, A> MachineTypeAggregatedListCall<'a, C, A> where C: BorrowMut MachineTypeAggregatedListCall<'a, C, A> where C: BorrowMut MachineTypeGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -103409,7 +115272,7 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -103507,7 +115370,7 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -103579,10 +115442,10 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.machine_types().list("project", "zone") -/// .page_token("sanctus") -/// .order_by("no") -/// .max_results(17) -/// .filter("sed") +/// .page_token("eos") +/// .order_by("eos") +/// .max_results(88) +/// .filter("sadipscing") /// .doit(); /// # } /// ``` @@ -103671,10 +115534,7 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -103694,7 +115554,7 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -103820,7 +115680,7 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -103966,10 +115826,7 @@ impl<'a, C, A> RegionCommitmentGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -103989,7 +115846,7 @@ impl<'a, C, A> RegionCommitmentGetCall<'a, C, A> where C: BorrowMut RegionCommitmentGetCall<'a, C, A> where C: BorrowMut RegionCommitmentGetCall<'a, C, A> where C: BorrowMut RegionCommitmentInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -104278,7 +116132,7 @@ impl<'a, C, A> RegionCommitmentInsertCall<'a, C, A> where C: BorrowMut RegionCommitmentInsertCall<'a, C, A> where C: BorrowMut RegionCommitmentInsertCall<'a, C, A> where C: BorrowMut RegionCommitmentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -104576,7 +116427,7 @@ impl<'a, C, A> RegionCommitmentListCall<'a, C, A> where C: BorrowMut RegionCommitmentListCall<'a, C, A> where C: BorrowMut RegionCommitmentListCall<'a, C, A> where C: BorrowMut RegionCommitmentAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -104887,7 +116735,7 @@ impl<'a, C, A> RegionCommitmentAggregatedListCall<'a, C, A> where C: BorrowMut RegionCommitmentAggregatedListCall<'a, C, A> where C: BorrowMut RegionCommitmentAggregatedListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -105194,7 +117039,7 @@ impl<'a, C, A> TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut TargetVpnGatewayAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -105490,7 +117332,7 @@ impl<'a, C, A> TargetVpnGatewayAggregatedListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayAggregatedListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -105775,7 +117614,7 @@ impl<'a, C, A> TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -106060,7 +117896,7 @@ impl<'a, C, A> TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -106360,7 +118193,7 @@ impl<'a, C, A> TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -106658,7 +118488,7 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -106794,7 +118624,7 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -106838,7 +118668,7 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo } -/// Creates a managed instance group using the information that you specify in the request. After the group is created, it schedules an action to create instances in the group using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. +/// Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. /// /// A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit. /// @@ -106952,10 +118782,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -106987,7 +118814,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -107295,7 +119119,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -107416,7 +119240,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -107488,10 +119312,10 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instance_group_managers().list("project", "zone") -/// .page_token("justo") -/// .order_by("rebum.") -/// .max_results(83) -/// .filter("sit") +/// .page_token("voluptua.") +/// .order_by("ipsum") +/// .max_results(66) +/// .filter("ea") /// .doit(); /// # } /// ``` @@ -107580,10 +119404,7 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -107603,7 +119424,7 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerAggregatedListCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -107914,7 +119732,7 @@ impl<'a, C, A> InstanceGroupManagerAggregatedListCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -108030,7 +119848,7 @@ impl<'a, C, A> InstanceGroupManagerAggregatedListCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -108176,10 +119994,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -108199,7 +120014,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -108490,7 +120302,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -108611,7 +120423,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -108689,7 +120501,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instance_group_managers().set_target_pools(req, "project", "zone", "instanceGroupManager") -/// .request_id("ea") +/// .request_id("voluptua.") /// .doit(); /// # } /// ``` @@ -108769,10 +120581,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -108804,7 +120613,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -108925,7 +120734,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -108969,7 +120778,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu } -/// Schedules a group action to remove the specified instances from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. +/// Flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. /// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// @@ -109007,7 +120816,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instance_group_managers().abandon_instances(req, "project", "zone", "instanceGroupManager") -/// .request_id("ut") +/// .request_id("ea") /// .doit(); /// # } /// ``` @@ -109087,10 +120896,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -109122,7 +120928,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -109243,7 +121049,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -109287,8 +121093,325 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow } +/// Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. +/// +/// A builder for the *patch* method supported by a *instanceGroupManager* resource. +/// It is not used directly, but through a `InstanceGroupManagerMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::InstanceGroupManager; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = InstanceGroupManager::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.instance_group_managers().patch(req, "project", "zone", "instanceGroupManager") +/// .request_id("ipsum") +/// .doit(); +/// # } +/// ``` +pub struct InstanceGroupManagerPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: InstanceGroupManager, + _project: String, + _zone: String, + _instance_group_manager: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceGroupManagerPatchCall<'a, C, A> {} + +impl<'a, C, A> InstanceGroupManagerPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("instanceGroupManager", self._instance_group_manager.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "zone", "instanceGroupManager", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/instanceGroupManagers/{instanceGroupManager}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instanceGroupManager}", "instanceGroupManager")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["instanceGroupManager", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: InstanceGroupManager) -> InstanceGroupManagerPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceGroupManagerPatchCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone where you want to create the managed instance group. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerPatchCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// The name of the instance group manager. + /// + /// Sets the *instance group manager* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerPatchCall<'a, C, A> { + self._instance_group_manager = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> InstanceGroupManagerPatchCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InstanceGroupManagerPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceGroupManagerPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. /// +/// When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: +/// +/// + The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. +/// +/// This list is subject to change. +/// /// If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. /// /// A builder for the *resize* method supported by a *instanceGroupManager* resource. @@ -109316,8 +121439,8 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.instance_group_managers().resize("project", "zone", "instanceGroupManager", -43) -/// .request_id("erat") +/// let result = hub.instance_group_managers().resize("project", "zone", "instanceGroupManager", -98) +/// .request_id("sanctus") /// .doit(); /// # } /// ``` @@ -109398,10 +121521,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -109421,7 +121541,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -109737,7 +121854,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -109858,7 +121975,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -109930,7 +122047,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instance_group_managers().delete("project", "zone", "instanceGroupManager") -/// .request_id("labore") +/// .request_id("accusam") /// .doit(); /// # } /// ``` @@ -110009,10 +122126,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -110032,7 +122146,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut AcceleratorTypeAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -110326,7 +122437,7 @@ impl<'a, C, A> AcceleratorTypeAggregatedListCall<'a, C, A> where C: BorrowMut AcceleratorTypeAggregatedListCall<'a, C, A> where C: BorrowMut AcceleratorTypeAggregatedListCall<'a, C, A> where C: BorrowMut AcceleratorTypeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -110629,7 +122737,7 @@ impl<'a, C, A> AcceleratorTypeListCall<'a, C, A> where C: BorrowMut AcceleratorTypeListCall<'a, C, A> where C: BorrowMut AcceleratorTypeGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -110924,7 +123029,7 @@ impl<'a, C, A> AcceleratorTypeGetCall<'a, C, A> where C: BorrowMut AcceleratorTypeGetCall<'a, C, A> where C: BorrowMut AcceleratorTypeGetCall<'a, C, A> where C: BorrowMut ProjectListXpnHostCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -111226,7 +123328,7 @@ impl<'a, C, A> ProjectListXpnHostCall<'a, C, A> where C: BorrowMut ProjectListXpnHostCall<'a, C, A> where C: BorrowMut ProjectListXpnHostCall<'a, C, A> where C: BorrowMut ProjectDisableXpnHostCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -111524,7 +123623,7 @@ impl<'a, C, A> ProjectDisableXpnHostCall<'a, C, A> where C: BorrowMut ProjectDisableXpnHostCall<'a, C, A> where C: BorrowMut ProjectDisableXpnHostCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ProjectsEnableXpnResourceRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().enable_xpn_resource(req, "project") +/// .request_id("tempor") +/// .doit(); +/// # } +/// ``` +pub struct ProjectEnableXpnResourceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: ProjectsEnableXpnResourceRequest, + _project: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectEnableXpnResourceCall<'a, C, A> {} + +impl<'a, C, A> ProjectEnableXpnResourceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.projects.enableXpnResource", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/enableXpnResource"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ProjectsEnableXpnResourceRequest) -> ProjectEnableXpnResourceCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> ProjectEnableXpnResourceCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> ProjectEnableXpnResourceCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectEnableXpnResourceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProjectEnableXpnResourceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectEnableXpnResourceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Moves an instance and its attached persistent disks from one zone to another. /// /// A builder for the *moveInstance* method supported by a *project* resource. @@ -111691,7 +124077,7 @@ impl<'a, C, A> ProjectDisableXpnHostCall<'a, C, A> where C: BorrowMut ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -111802,7 +124185,7 @@ impl<'a, C, A> ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -112092,7 +124472,7 @@ impl<'a, C, A> ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut ProjectEnableXpnHostCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -112363,7 +124740,7 @@ impl<'a, C, A> ProjectEnableXpnHostCall<'a, C, A> where C: BorrowMut ProjectEnableXpnHostCall<'a, C, A> where C: BorrowMut ProjectEnableXpnHostCall<'a, C, A> where C: BorrowMut ProjectDisableXpnResourceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -112641,7 +125015,7 @@ impl<'a, C, A> ProjectDisableXpnResourceCall<'a, C, A> where C: BorrowMut ProjectDisableXpnResourceCall<'a, C, A> where C: BorrowMut ProjectGetXpnHostCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -112907,7 +125278,7 @@ impl<'a, C, A> ProjectGetXpnHostCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -112985,7 +125356,7 @@ impl<'a, C, A> ProjectGetXpnHostCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -113127,10 +125498,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -113150,7 +125518,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -113228,7 +125596,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -113272,296 +125640,6 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project. -/// -/// A builder for the *enableXpnResource* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_compute1 as compute1; -/// use compute1::ProjectsEnableXpnResourceRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use compute1::Compute; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ProjectsEnableXpnResourceRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().enable_xpn_resource(req, "project") -/// .request_id("duo") -/// .doit(); -/// # } -/// ``` -pub struct ProjectEnableXpnResourceCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _request: ProjectsEnableXpnResourceRequest, - _project: String, - _request_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectEnableXpnResourceCall<'a, C, A> {} - -impl<'a, C, A> ProjectEnableXpnResourceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.projects.enableXpnResource", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - if let Some(value) = self._request_id { - params.push(("requestId", value.to_string())); - } - for &field in ["alt", "project", "requestId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/enableXpnResource"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ProjectsEnableXpnResourceRequest) -> ProjectEnableXpnResourceCall<'a, C, A> { - self._request = new_value; - self - } - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> ProjectEnableXpnResourceCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - /// - /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - /// - /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - /// - /// Sets the *request id* query property to the given value. - pub fn request_id(mut self, new_value: &str) -> ProjectEnableXpnResourceCall<'a, C, A> { - self._request_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectEnableXpnResourceCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ProjectEnableXpnResourceCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectEnableXpnResourceCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field. /// /// A builder for the *setDefaultNetworkTier* method supported by a *project* resource. @@ -113596,7 +125674,7 @@ impl<'a, C, A> ProjectEnableXpnResourceCall<'a, C, A> where C: BorrowMut ProjectSetDefaultNetworkTierCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -113707,7 +125782,7 @@ impl<'a, C, A> ProjectSetDefaultNetworkTierCall<'a, C, A> where C: BorrowMut ProjectSetDefaultNetworkTierCall<'a, C, A> where C: BorrowMut ProjectSetDefaultNetworkTierCall<'a, C, A> where C: BorrowMut ProjectGetXpnResourceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -113993,7 +126065,7 @@ impl<'a, C, A> ProjectGetXpnResourceCall<'a, C, A> where C: BorrowMut ProjectGetXpnResourceCall<'a, C, A> where C: BorrowMut ProjectGetXpnResourceCall<'a, C, A> where C: BorrowMut ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -114298,7 +126367,7 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -114399,7 +126468,7 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -114477,7 +126546,7 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().set_common_instance_metadata(req, "project") -/// .request_id("diam") +/// .request_id("et") /// .doit(); /// # } /// ``` @@ -114553,10 +126622,7 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -114588,7 +126654,7 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -114689,7 +126755,7 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -114767,7 +126833,7 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_disks().set_labels(req, "project", "region", "resource") -/// .request_id("ipsum") +/// .request_id("voluptua.") /// .doit(); /// # } /// ``` @@ -114847,10 +126913,7 @@ impl<'a, C, A> RegionDiskSetLabelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -114882,7 +126945,7 @@ impl<'a, C, A> RegionDiskSetLabelCall<'a, C, A> where C: BorrowMut RegionDiskSetLabelCall<'a, C, A> where C: BorrowMut RegionDiskSetLabelCall<'a, C, A> where C: BorrowMut RegionDiskGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -115172,7 +127232,7 @@ impl<'a, C, A> RegionDiskGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -115270,7 +127330,7 @@ impl<'a, C, A> RegionDiskGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -115423,10 +127483,7 @@ impl<'a, C, A> RegionDiskTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -115458,7 +127515,7 @@ impl<'a, C, A> RegionDiskTestIamPermissionCall<'a, C, A> where C: BorrowMut RegionDiskTestIamPermissionCall<'a, C, A> where C: BorrowMut RegionDiskTestIamPermissionCall<'a, C, A> where C: BorrowMut RegionDiskTestIamPermissionCall<'a, C, A> where C: BorrowMut RegionDiskCreateSnapshotCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -115761,7 +127815,7 @@ impl<'a, C, A> RegionDiskCreateSnapshotCall<'a, C, A> where C: BorrowMut RegionDiskCreateSnapshotCall<'a, C, A> where C: BorrowMut RegionDiskCreateSnapshotCall<'a, C, A> where C: BorrowMut RegionDiskListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -116069,7 +128120,7 @@ impl<'a, C, A> RegionDiskListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -116195,7 +128246,7 @@ impl<'a, C, A> RegionDiskListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -116273,8 +128324,8 @@ impl<'a, C, A> RegionDiskListCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_disks().insert(req, "project", "region") -/// .source_image("sit") -/// .request_id("ut") +/// .source_image("sed") +/// .request_id("sit") /// .doit(); /// # } /// ``` @@ -116356,10 +128407,7 @@ impl<'a, C, A> RegionDiskInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -116391,7 +128439,7 @@ impl<'a, C, A> RegionDiskInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -116509,7 +128557,7 @@ impl<'a, C, A> RegionDiskInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -116581,7 +128629,7 @@ impl<'a, C, A> RegionDiskInsertCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_disks().delete("project", "region", "disk") -/// .request_id("sadipscing") +/// .request_id("est") /// .doit(); /// # } /// ``` @@ -116660,10 +128708,7 @@ impl<'a, C, A> RegionDiskDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -116683,7 +128728,7 @@ impl<'a, C, A> RegionDiskDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -116792,7 +128837,7 @@ impl<'a, C, A> RegionDiskDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -116870,7 +128915,7 @@ impl<'a, C, A> RegionDiskDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.region_disks().resize(req, "project", "region", "disk") -/// .request_id("voluptua.") +/// .request_id("est") /// .doit(); /// # } /// ``` @@ -116950,10 +128995,7 @@ impl<'a, C, A> RegionDiskResizeCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -116985,7 +129027,7 @@ impl<'a, C, A> RegionDiskResizeCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -117106,7 +129148,7 @@ impl<'a, C, A> RegionDiskResizeCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -117184,7 +129226,7 @@ impl<'a, C, A> RegionDiskResizeCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.http_health_checks().insert(req, "project") -/// .request_id("labore") +/// .request_id("rebum.") /// .doit(); /// # } /// ``` @@ -117260,10 +129302,7 @@ impl<'a, C, A> HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -117295,7 +129334,7 @@ impl<'a, C, A> HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.http_health_checks().list("project") +/// .page_token("dolor") +/// .order_by("erat") +/// .max_results(58) +/// .filter("dolore") +/// .doit(); +/// # } +/// ``` +pub struct HttpHealthCheckListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for HttpHealthCheckListCall<'a, C, A> {} + +impl<'a, C, A> HttpHealthCheckListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpHealthCheckList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.httpHealthChecks.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/global/httpHealthChecks"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> HttpHealthCheckListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> HttpHealthCheckListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> HttpHealthCheckListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> HttpHealthCheckListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. + /// + /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. + /// + /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. + /// + /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> HttpHealthCheckListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> HttpHealthCheckListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> HttpHealthCheckListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> HttpHealthCheckListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates a HttpHealthCheck resource in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. /// /// A builder for the *patch* method supported by a *httpHealthCheck* resource. @@ -117474,7 +129811,7 @@ impl<'a, C, A> HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -117587,7 +129921,7 @@ impl<'a, C, A> HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -117870,7 +130201,7 @@ impl<'a, C, A> HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -118136,7 +130464,7 @@ impl<'a, C, A> HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.http_health_checks().list("project") -/// .page_token("sed") -/// .order_by("et") -/// .max_results(100) -/// .filter("magna") -/// .doit(); -/// # } -/// ``` -pub struct HttpHealthCheckListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _project: String, - _page_token: Option, - _order_by: Option, - _max_results: Option, - _filter: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for HttpHealthCheckListCall<'a, C, A> {} - -impl<'a, C, A> HttpHealthCheckListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, HttpHealthCheckList)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.httpHealthChecks.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._order_by { - params.push(("orderBy", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } - for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/global/httpHealthChecks"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> HttpHealthCheckListCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> HttpHealthCheckListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - /// - /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - /// - /// Currently, only sorting by name or creationTimestamp desc is supported. - /// - /// Sets the *order by* query property to the given value. - pub fn order_by(mut self, new_value: &str) -> HttpHealthCheckListCall<'a, C, A> { - self._order_by = Some(new_value.to_string()); - self - } - /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> HttpHealthCheckListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - /// - /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - /// - /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - /// - /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> HttpHealthCheckListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> HttpHealthCheckListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> HttpHealthCheckListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> HttpHealthCheckListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Updates a HttpHealthCheck resource in the specified project using the data included in the request. /// /// A builder for the *update* method supported by a *httpHealthCheck* resource. @@ -118603,7 +130630,7 @@ impl<'a, C, A> HttpHealthCheckListCall<'a, C, A> where C: BorrowMut HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -118716,7 +130740,7 @@ impl<'a, C, A> HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -119001,7 +131022,7 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -119110,7 +131131,7 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -119154,6 +131175,301 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } +/// Sets the access control policy on the specified resource. Replaces any existing policy. +/// +/// A builder for the *setIamPolicy* method supported by a *disk* resource. +/// It is not used directly, but through a `DiskMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::ZoneSetPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ZoneSetPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.disks().set_iam_policy(req, "project", "zone", "resource") +/// .doit(); +/// # } +/// ``` +pub struct DiskSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: ZoneSetPolicyRequest, + _project: String, + _zone: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DiskSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> DiskSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.disks.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "zone", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/disks/{resource}/setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ZoneSetPolicyRequest) -> DiskSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> DiskSetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> DiskSetIamPolicyCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> DiskSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DiskSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DiskSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DiskSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates a snapshot of a specified persistent disk. /// /// A builder for the *createSnapshot* method supported by a *disk* resource. @@ -119188,8 +131504,8 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.disks().create_snapshot(req, "project", "zone", "disk") -/// .request_id("est") -/// .guest_flush(false) +/// .request_id("amet.") +/// .guest_flush(true) /// .doit(); /// # } /// ``` @@ -119273,10 +131589,7 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -119308,7 +131621,7 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.disks().test_iam_permissions(req, "project", "zone", "resource") +/// .doit(); +/// # } +/// ``` +pub struct DiskTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: TestPermissionsRequest, + _project: String, + _zone: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DiskTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> DiskTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestPermissionsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.disks.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "zone", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/disks/{resource}/testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestPermissionsRequest) -> DiskTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> DiskTestIamPermissionCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> DiskTestIamPermissionCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> DiskTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DiskTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DiskTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DiskTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves an aggregated list of persistent disks. /// /// A builder for the *aggregatedList* method supported by a *disk* resource. @@ -119507,10 +132115,10 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut DiskAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -119620,7 +132225,7 @@ impl<'a, C, A> DiskAggregatedListCall<'a, C, A> where C: BorrowMut DiskAggregatedListCall<'a, C, A> where C: BorrowMut DiskAggregatedListCall<'a, C, A> where C: BorrowMut DiskListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -119923,7 +132525,7 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -120049,7 +132651,7 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -120127,7 +132729,7 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.disks().set_labels(req, "project", "zone", "resource") -/// .request_id("diam") +/// .request_id("dolor") /// .doit(); /// # } /// ``` @@ -120207,10 +132809,7 @@ impl<'a, C, A> DiskSetLabelCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -120242,7 +132841,7 @@ impl<'a, C, A> DiskSetLabelCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -120327,7 +132926,7 @@ impl<'a, C, A> DiskSetLabelCall<'a, C, A> where C: BorrowMut, A: self._zone = new_value.to_string(); self } - /// Name of the resource for this request. + /// Name or id of the resource for this request. /// /// Sets the *resource* path property to the given value. /// @@ -120363,7 +132962,7 @@ impl<'a, C, A> DiskSetLabelCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -120441,7 +133040,7 @@ impl<'a, C, A> DiskSetLabelCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.disks().resize(req, "project", "zone", "disk") -/// .request_id("tempor") +/// .request_id("sadipscing") /// .doit(); /// # } /// ``` @@ -120521,10 +133120,7 @@ impl<'a, C, A> DiskResizeCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -120556,7 +133152,7 @@ impl<'a, C, A> DiskResizeCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -120677,7 +133273,7 @@ impl<'a, C, A> DiskResizeCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -120755,8 +133351,8 @@ impl<'a, C, A> DiskResizeCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.disks().insert(req, "project", "zone") -/// .source_image("dolores") -/// .request_id("invidunt") +/// .source_image("eos") +/// .request_id("magna") /// .doit(); /// # } /// ``` @@ -120838,10 +133434,7 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -120873,7 +133466,7 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -120991,7 +133584,7 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -121035,6 +133628,270 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa } +/// Gets the access control policy for a resource. May be empty if no such policy or resource exists. +/// +/// A builder for the *getIamPolicy* method supported by a *disk* resource. +/// It is not used directly, but through a `DiskMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.disks().get_iam_policy("project", "zone", "resource") +/// .doit(); +/// # } +/// ``` +pub struct DiskGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _zone: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DiskGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> DiskGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.disks.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "zone", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/zones/{zone}/disks/{resource}/getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> DiskGetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> DiskGetIamPolicyCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> DiskGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DiskGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DiskGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DiskGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Returns a specified persistent disk. Gets a list of available persistent disks by making a list() request. /// /// A builder for the *get* method supported by a *disk* resource. @@ -121137,10 +133994,7 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -121160,7 +134014,7 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -121258,7 +134112,7 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -121402,10 +134256,7 @@ impl<'a, C, A> TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -121425,7 +134276,7 @@ impl<'a, C, A> TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -121685,7 +134533,7 @@ impl<'a, C, A> TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -121975,7 +134820,7 @@ impl<'a, C, A> TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpProxyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -122271,7 +135113,7 @@ impl<'a, C, A> TargetHttpProxyListCall<'a, C, A> where C: BorrowMut TargetHttpProxyListCall<'a, C, A> where C: BorrowMut TargetHttpProxyListCall<'a, C, A> where C: BorrowMut TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -122576,7 +135415,7 @@ impl<'a, C, A> TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut SslCertificateDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -122849,7 +135685,7 @@ impl<'a, C, A> SslCertificateDeleteCall<'a, C, A> where C: BorrowMut SslCertificateDeleteCall<'a, C, A> where C: BorrowMut SslCertificateDeleteCall<'a, C, A> where C: BorrowMut SslCertificateListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -123133,7 +135966,7 @@ impl<'a, C, A> SslCertificateListCall<'a, C, A> where C: BorrowMut SslCertificateListCall<'a, C, A> where C: BorrowMut SslCertificateListCall<'a, C, A> where C: BorrowMut SslCertificateInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -123438,7 +136268,7 @@ impl<'a, C, A> SslCertificateInsertCall<'a, C, A> where C: BorrowMut SslCertificateInsertCall<'a, C, A> where C: BorrowMut SslCertificateGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -123706,7 +136533,7 @@ impl<'a, C, A> SslCertificateGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -123794,7 +136621,7 @@ impl<'a, C, A> SslCertificateGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -123939,10 +136766,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -123962,7 +136786,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -124237,7 +137058,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -124363,7 +137184,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -124509,10 +137330,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -124532,7 +137350,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -124630,7 +137448,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -124708,7 +137526,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.routes().insert(req, "project") -/// .request_id("no") +/// .request_id("amet") /// .doit(); /// # } /// ``` @@ -124784,10 +137602,7 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -124819,7 +137634,7 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -124920,7 +137735,7 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -125064,10 +137879,7 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -125087,7 +137899,7 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -125175,7 +137987,7 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -125247,10 +138059,10 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.routes().list("project") -/// .page_token("est") -/// .order_by("et") -/// .max_results(12) -/// .filter("accusam") +/// .page_token("eirmod") +/// .order_by("sea") +/// .max_results(0) +/// .filter("Stet") /// .doit(); /// # } /// ``` @@ -125337,10 +138149,7 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -125360,7 +138169,7 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -125476,7 +138285,7 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -125548,7 +138357,7 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.routes().delete("project", "route") -/// .request_id("ipsum") +/// .request_id("voluptua.") /// .doit(); /// # } /// ``` @@ -125625,10 +138434,7 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -125648,7 +138454,7 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -125747,7 +138553,7 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -125819,10 +138625,10 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.interconnect_locations().list("project") -/// .page_token("elitr") -/// .order_by("sed") -/// .max_results(49) -/// .filter("Lorem") +/// .page_token("sit") +/// .order_by("nonumy") +/// .max_results(38) +/// .filter("eos") /// .doit(); /// # } /// ``` @@ -125909,10 +138715,7 @@ impl<'a, C, A> InterconnectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -125932,7 +138735,7 @@ impl<'a, C, A> InterconnectLocationListCall<'a, C, A> where C: BorrowMut InterconnectLocationListCall<'a, C, A> where C: BorrowMut InterconnectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -126215,7 +139015,7 @@ impl<'a, C, A> InterconnectLocationGetCall<'a, C, A> where C: BorrowMut InterconnectLocationGetCall<'a, C, A> where C: BorrowMut InterconnectLocationGetCall<'a, C, A> where C: BorrowMut FirewallInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -126492,7 +139289,7 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -126593,7 +139390,7 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -126665,7 +139462,7 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.firewalls().delete("project", "firewall") -/// .request_id("est") +/// .request_id("erat") /// .doit(); /// # } /// ``` @@ -126742,10 +139539,7 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -126765,7 +139559,7 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -126864,7 +139658,7 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -126936,10 +139730,10 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.firewalls().list("project") -/// .page_token("rebum.") -/// .order_by("Stet") -/// .max_results(47) -/// .filter("erat") +/// .page_token("eos") +/// .order_by("amet") +/// .max_results(68) +/// .filter("duo") /// .doit(); /// # } /// ``` @@ -127026,10 +139820,7 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -127049,7 +139840,7 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -127165,7 +139956,7 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -127243,7 +140034,7 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.firewalls().patch(req, "project", "firewall") -/// .request_id("no") +/// .request_id("vero") /// .doit(); /// # } /// ``` @@ -127321,10 +140112,7 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -127356,7 +140144,7 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -127467,7 +140255,7 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -127611,10 +140399,7 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -127634,7 +140419,7 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -127722,7 +140507,7 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -127800,7 +140585,7 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.firewalls().update(req, "project", "firewall") -/// .request_id("elitr") +/// .request_id("ut") /// .doit(); /// # } /// ``` @@ -127878,10 +140663,7 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -127913,7 +140695,7 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -128024,7 +140806,7 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -128068,6 +140850,1147 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A } +/// Returns the specified VpnTunnel resource. Gets a list of available VPN tunnels by making a list() request. +/// +/// A builder for the *get* method supported by a *vpnTunnel* resource. +/// It is not used directly, but through a `VpnTunnelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.vpn_tunnels().get("project", "region", "vpnTunnel") +/// .doit(); +/// # } +/// ``` +pub struct VpnTunnelGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _region: String, + _vpn_tunnel: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VpnTunnelGetCall<'a, C, A> {} + +impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VpnTunnel)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.vpnTunnels.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("vpnTunnel", self._vpn_tunnel.to_string())); + for &field in ["alt", "project", "region", "vpnTunnel"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/vpnTunnels/{vpnTunnel}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{vpnTunnel}", "vpnTunnel")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["vpnTunnel", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> VpnTunnelGetCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the region for this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> VpnTunnelGetCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name of the VpnTunnel resource to return. + /// + /// Sets the *vpn tunnel* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn vpn_tunnel(mut self, new_value: &str) -> VpnTunnelGetCall<'a, C, A> { + self._vpn_tunnel = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> VpnTunnelGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VpnTunnelGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> VpnTunnelGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a VpnTunnel resource in the specified project and region using the data included in the request. +/// +/// A builder for the *insert* method supported by a *vpnTunnel* resource. +/// It is not used directly, but through a `VpnTunnelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::VpnTunnel; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = VpnTunnel::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.vpn_tunnels().insert(req, "project", "region") +/// .request_id("takimata") +/// .doit(); +/// # } +/// ``` +pub struct VpnTunnelInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: VpnTunnel, + _project: String, + _region: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VpnTunnelInsertCall<'a, C, A> {} + +impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.vpnTunnels.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "region", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/vpnTunnels"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: VpnTunnel) -> VpnTunnelInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> VpnTunnelInsertCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the region for this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> VpnTunnelInsertCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> VpnTunnelInsertCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> VpnTunnelInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VpnTunnelInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> VpnTunnelInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves an aggregated list of VPN tunnels. +/// +/// A builder for the *aggregatedList* method supported by a *vpnTunnel* resource. +/// It is not used directly, but through a `VpnTunnelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.vpn_tunnels().aggregated_list("project") +/// .page_token("vero") +/// .order_by("eirmod") +/// .max_results(0) +/// .filter("ut") +/// .doit(); +/// # } +/// ``` +pub struct VpnTunnelAggregatedListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VpnTunnelAggregatedListCall<'a, C, A> {} + +impl<'a, C, A> VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VpnTunnelAggregatedList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.vpnTunnels.aggregatedList", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/aggregated/vpnTunnels"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> VpnTunnelAggregatedListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> VpnTunnelAggregatedListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> VpnTunnelAggregatedListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> VpnTunnelAggregatedListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. + /// + /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. + /// + /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. + /// + /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> VpnTunnelAggregatedListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> VpnTunnelAggregatedListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VpnTunnelAggregatedListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> VpnTunnelAggregatedListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified VpnTunnel resource. +/// +/// A builder for the *delete* method supported by a *vpnTunnel* resource. +/// It is not used directly, but through a `VpnTunnelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.vpn_tunnels().delete("project", "region", "vpnTunnel") +/// .request_id("elitr") +/// .doit(); +/// # } +/// ``` +pub struct VpnTunnelDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _region: String, + _vpn_tunnel: String, + _request_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VpnTunnelDeleteCall<'a, C, A> {} + +impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.vpnTunnels.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("vpnTunnel", self._vpn_tunnel.to_string())); + if let Some(value) = self._request_id { + params.push(("requestId", value.to_string())); + } + for &field in ["alt", "project", "region", "vpnTunnel", "requestId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/vpnTunnels/{vpnTunnel}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{vpnTunnel}", "vpnTunnel")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["vpnTunnel", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the region for this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name of the VpnTunnel resource to delete. + /// + /// Sets the *vpn tunnel* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn vpn_tunnel(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { + self._vpn_tunnel = new_value.to_string(); + self + } + /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. + /// + /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. + /// + /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). + /// + /// Sets the *request id* query property to the given value. + pub fn request_id(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { + self._request_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> VpnTunnelDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VpnTunnelDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> VpnTunnelDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves a list of VpnTunnel resources contained in the specified project and region. /// /// A builder for the *list* method supported by a *vpnTunnel* resource. @@ -128096,10 +142019,10 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.vpn_tunnels().list("project", "region") -/// .page_token("voluptua.") -/// .order_by("diam") -/// .max_results(19) -/// .filter("labore") +/// .page_token("sed") +/// .order_by("Lorem") +/// .max_results(74) +/// .filter("dolor") /// .doit(); /// # } /// ``` @@ -128188,10 +142111,7 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -128211,7 +142131,7 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -128337,7 +142257,7 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -128381,1159 +142301,6 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: } -/// Returns the specified VpnTunnel resource. Gets a list of available VPN tunnels by making a list() request. -/// -/// A builder for the *get* method supported by a *vpnTunnel* resource. -/// It is not used directly, but through a `VpnTunnelMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_compute1 as compute1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use compute1::Compute; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.vpn_tunnels().get("project", "region", "vpnTunnel") -/// .doit(); -/// # } -/// ``` -pub struct VpnTunnelGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _project: String, - _region: String, - _vpn_tunnel: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VpnTunnelGetCall<'a, C, A> {} - -impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VpnTunnel)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.vpnTunnels.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("region", self._region.to_string())); - params.push(("vpnTunnel", self._vpn_tunnel.to_string())); - for &field in ["alt", "project", "region", "vpnTunnel"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/vpnTunnels/{vpnTunnel}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{vpnTunnel}", "vpnTunnel")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["vpnTunnel", "region", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> VpnTunnelGetCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Name of the region for this request. - /// - /// Sets the *region* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn region(mut self, new_value: &str) -> VpnTunnelGetCall<'a, C, A> { - self._region = new_value.to_string(); - self - } - /// Name of the VpnTunnel resource to return. - /// - /// Sets the *vpn tunnel* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn vpn_tunnel(mut self, new_value: &str) -> VpnTunnelGetCall<'a, C, A> { - self._vpn_tunnel = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VpnTunnelGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VpnTunnelGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VpnTunnelGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a VpnTunnel resource in the specified project and region using the data included in the request. -/// -/// A builder for the *insert* method supported by a *vpnTunnel* resource. -/// It is not used directly, but through a `VpnTunnelMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_compute1 as compute1; -/// use compute1::VpnTunnel; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use compute1::Compute; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = VpnTunnel::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.vpn_tunnels().insert(req, "project", "region") -/// .request_id("magna") -/// .doit(); -/// # } -/// ``` -pub struct VpnTunnelInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _request: VpnTunnel, - _project: String, - _region: String, - _request_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VpnTunnelInsertCall<'a, C, A> {} - -impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.vpnTunnels.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("region", self._region.to_string())); - if let Some(value) = self._request_id { - params.push(("requestId", value.to_string())); - } - for &field in ["alt", "project", "region", "requestId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/vpnTunnels"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["region", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: VpnTunnel) -> VpnTunnelInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> VpnTunnelInsertCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Name of the region for this request. - /// - /// Sets the *region* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn region(mut self, new_value: &str) -> VpnTunnelInsertCall<'a, C, A> { - self._region = new_value.to_string(); - self - } - /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - /// - /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - /// - /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - /// - /// Sets the *request id* query property to the given value. - pub fn request_id(mut self, new_value: &str) -> VpnTunnelInsertCall<'a, C, A> { - self._request_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VpnTunnelInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VpnTunnelInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VpnTunnelInsertCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves an aggregated list of VPN tunnels. -/// -/// A builder for the *aggregatedList* method supported by a *vpnTunnel* resource. -/// It is not used directly, but through a `VpnTunnelMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_compute1 as compute1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use compute1::Compute; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.vpn_tunnels().aggregated_list("project") -/// .page_token("sit") -/// .order_by("takimata") -/// .max_results(49) -/// .filter("ipsum") -/// .doit(); -/// # } -/// ``` -pub struct VpnTunnelAggregatedListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _project: String, - _page_token: Option, - _order_by: Option, - _max_results: Option, - _filter: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VpnTunnelAggregatedListCall<'a, C, A> {} - -impl<'a, C, A> VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VpnTunnelAggregatedList)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.vpnTunnels.aggregatedList", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._order_by { - params.push(("orderBy", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } - for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/aggregated/vpnTunnels"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> VpnTunnelAggregatedListCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> VpnTunnelAggregatedListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - /// - /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - /// - /// Currently, only sorting by name or creationTimestamp desc is supported. - /// - /// Sets the *order by* query property to the given value. - pub fn order_by(mut self, new_value: &str) -> VpnTunnelAggregatedListCall<'a, C, A> { - self._order_by = Some(new_value.to_string()); - self - } - /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> VpnTunnelAggregatedListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - /// - /// For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - /// - /// You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - /// - /// To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> VpnTunnelAggregatedListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VpnTunnelAggregatedListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VpnTunnelAggregatedListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VpnTunnelAggregatedListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified VpnTunnel resource. -/// -/// A builder for the *delete* method supported by a *vpnTunnel* resource. -/// It is not used directly, but through a `VpnTunnelMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_compute1 as compute1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use compute1::Compute; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.vpn_tunnels().delete("project", "region", "vpnTunnel") -/// .request_id("sit") -/// .doit(); -/// # } -/// ``` -pub struct VpnTunnelDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _project: String, - _region: String, - _vpn_tunnel: String, - _request_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VpnTunnelDeleteCall<'a, C, A> {} - -impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.vpnTunnels.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("project", self._project.to_string())); - params.push(("region", self._region.to_string())); - params.push(("vpnTunnel", self._vpn_tunnel.to_string())); - if let Some(value) = self._request_id { - params.push(("requestId", value.to_string())); - } - for &field in ["alt", "project", "region", "vpnTunnel", "requestId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/vpnTunnels/{vpnTunnel}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{vpnTunnel}", "vpnTunnel")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["vpnTunnel", "region", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// Name of the region for this request. - /// - /// Sets the *region* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn region(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { - self._region = new_value.to_string(); - self - } - /// Name of the VpnTunnel resource to delete. - /// - /// Sets the *vpn tunnel* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn vpn_tunnel(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { - self._vpn_tunnel = new_value.to_string(); - self - } - /// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - /// - /// For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - /// - /// The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - /// - /// Sets the *request id* query property to the given value. - pub fn request_id(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { - self._request_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VpnTunnelDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VpnTunnelDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VpnTunnelDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Returns the specified node template. Gets a list of available node templates by making a list() request. /// /// A builder for the *get* method supported by a *nodeTemplate* resource. @@ -129636,10 +142403,7 @@ impl<'a, C, A> NodeTemplateGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -129659,7 +142423,7 @@ impl<'a, C, A> NodeTemplateGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -129757,7 +142521,7 @@ impl<'a, C, A> NodeTemplateGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -129829,7 +142593,7 @@ impl<'a, C, A> NodeTemplateGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.node_templates().delete("project", "region", "nodeTemplate") -/// .request_id("At") +/// .request_id("labore") /// .doit(); /// # } /// ``` @@ -129908,10 +142672,7 @@ impl<'a, C, A> NodeTemplateDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -129931,7 +142692,7 @@ impl<'a, C, A> NodeTemplateDeleteCall<'a, C, A> where C: BorrowMut NodeTemplateDeleteCall<'a, C, A> where C: BorrowMut NodeTemplateDeleteCall<'a, C, A> where C: BorrowMut NodeTemplateListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -130227,7 +142985,7 @@ impl<'a, C, A> NodeTemplateListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -130353,7 +143111,7 @@ impl<'a, C, A> NodeTemplateListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -130431,7 +143189,7 @@ impl<'a, C, A> NodeTemplateListCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.node_templates().insert(req, "project", "region") -/// .request_id("eirmod") +/// .request_id("kasd") /// .doit(); /// # } /// ``` @@ -130509,10 +143267,7 @@ impl<'a, C, A> NodeTemplateInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -130544,7 +143299,7 @@ impl<'a, C, A> NodeTemplateInsertCall<'a, C, A> where C: BorrowMut NodeTemplateInsertCall<'a, C, A> where C: BorrowMut NodeTemplateInsertCall<'a, C, A> where C: BorrowMut NodeTemplateAggregatedListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -130840,7 +143592,7 @@ impl<'a, C, A> NodeTemplateAggregatedListCall<'a, C, A> where C: BorrowMut NodeTemplateAggregatedListCall<'a, C, A> where C: BorrowMut NodeTemplateAggregatedListCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.node_templates().get_iam_policy("project", "region", "resource") +/// .doit(); +/// # } +/// ``` +pub struct NodeTemplateGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _region: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NodeTemplateGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> NodeTemplateGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.nodeTemplates.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "region", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/nodeTemplates/{resource}/getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NodeTemplateGetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the region for this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> NodeTemplateGetIamPolicyCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> NodeTemplateGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NodeTemplateGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NodeTemplateGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NodeTemplateGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on the specified resource. +/// +/// A builder for the *testIamPermissions* method supported by a *nodeTemplate* resource. +/// It is not used directly, but through a `NodeTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::TestPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.node_templates().test_iam_permissions(req, "project", "region", "resource") +/// .doit(); +/// # } +/// ``` +pub struct NodeTemplateTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: TestPermissionsRequest, + _project: String, + _region: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NodeTemplateTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> NodeTemplateTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestPermissionsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.nodeTemplates.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "region", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/nodeTemplates/{resource}/testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestPermissionsRequest) -> NodeTemplateTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NodeTemplateTestIamPermissionCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the region for this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> NodeTemplateTestIamPermissionCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> NodeTemplateTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NodeTemplateTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NodeTemplateTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NodeTemplateTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on the specified resource. Replaces any existing policy. +/// +/// A builder for the *setIamPolicy* method supported by a *nodeTemplate* resource. +/// It is not used directly, but through a `NodeTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::RegionSetPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RegionSetPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.node_templates().set_iam_policy(req, "project", "region", "resource") +/// .doit(); +/// # } +/// ``` +pub struct NodeTemplateSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: RegionSetPolicyRequest, + _project: String, + _region: String, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NodeTemplateSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> NodeTemplateSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.nodeTemplates.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "project", "region", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{project}/regions/{region}/nodeTemplates/{resource}/setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{resource}", "resource")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["resource", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RegionSetPolicyRequest) -> NodeTemplateSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> NodeTemplateSetIamPolicyCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the region for this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> NodeTemplateSetIamPolicyCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name or id of the resource for this request. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> NodeTemplateSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> NodeTemplateSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NodeTemplateSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> NodeTemplateSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves the specified region-specific Operations resource. /// /// A builder for the *get* method supported by a *regionOperation* resource. @@ -131102,10 +144708,7 @@ impl<'a, C, A> RegionOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -131125,7 +144728,7 @@ impl<'a, C, A> RegionOperationGetCall<'a, C, A> where C: BorrowMut RegionOperationGetCall<'a, C, A> where C: BorrowMut RegionOperationGetCall<'a, C, A> where C: BorrowMut RegionOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -131410,7 +145010,7 @@ impl<'a, C, A> RegionOperationListCall<'a, C, A> where C: BorrowMut RegionOperationListCall<'a, C, A> where C: BorrowMut RegionOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -131704,7 +145301,7 @@ impl<'a, C, A> RegionOperationDeleteCall<'a, C, A> where C: BorrowMut RegionOperationDeleteCall<'a, C, A> where C: BorrowMut SurveyDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1304,7 +1301,7 @@ impl<'a, C, A> SurveyDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1382,7 +1379,7 @@ impl<'a, C, A> SurveyDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1508,10 +1505,7 @@ impl<'a, C, A> SurveyInsertCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1543,7 +1537,7 @@ impl<'a, C, A> SurveyInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1623,7 +1617,7 @@ impl<'a, C, A> SurveyInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1757,10 +1751,7 @@ impl<'a, C, A> SurveyListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1780,7 +1771,7 @@ impl<'a, C, A> SurveyListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1866,7 +1857,7 @@ impl<'a, C, A> SurveyListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2015,10 +2006,7 @@ impl<'a, C, A> SurveyUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2050,7 +2038,7 @@ impl<'a, C, A> SurveyUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2140,7 +2128,7 @@ impl<'a, C, A> SurveyUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2282,10 +2270,7 @@ impl<'a, C, A> SurveyGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2305,7 +2290,7 @@ impl<'a, C, A> SurveyGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2383,7 +2368,7 @@ impl<'a, C, A> SurveyGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2525,10 +2510,7 @@ impl<'a, C, A> SurveyStopCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2548,7 +2530,7 @@ impl<'a, C, A> SurveyStopCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2625,7 +2607,7 @@ impl<'a, C, A> SurveyStopCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2774,10 +2756,7 @@ impl<'a, C, A> SurveyStartCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2809,7 +2788,7 @@ impl<'a, C, A> SurveyStartCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2898,7 +2877,7 @@ impl<'a, C, A> SurveyStartCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3068,10 +3047,7 @@ impl<'a, C, A> ResultGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3103,7 +3079,7 @@ impl<'a, C, A> ResultGetCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3193,7 +3169,7 @@ impl<'a, C, A> ResultGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3342,10 +3318,7 @@ impl<'a, C, A> MobileapppanelUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3377,7 +3350,7 @@ impl<'a, C, A> MobileapppanelUpdateCall<'a, C, A> where C: BorrowMut MobileapppanelUpdateCall<'a, C, A> where C: BorrowMut MobileapppanelGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3632,7 +3602,7 @@ impl<'a, C, A> MobileapppanelGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3710,7 +3680,7 @@ impl<'a, C, A> MobileapppanelGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3844,10 +3814,7 @@ impl<'a, C, A> MobileapppanelListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3867,7 +3834,7 @@ impl<'a, C, A> MobileapppanelListCall<'a, C, A> where C: BorrowMut MobileapppanelListCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Container (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/container1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-container1] path = "../container1" -version = "1.0.8+20180917" +version = "1.0.8+20190316" diff --git a/gen/container1-cli/README.md b/gen/container1-cli/README.md index 346373682c..1ae93f5918 100644 --- a/gen/container1-cli/README.md +++ b/gen/container1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Container* API at revision *20180917*. The CLI is at version *1.0.8*. +This documentation was generated from the *Container* API at revision *20190316*. The CLI is at version *1.0.8*. ```bash container1 [options] @@ -34,6 +34,7 @@ container1 [options] locations-clusters-create (-r )... [-p ]... [-o ] locations-clusters-delete [-p ]... [-o ] locations-clusters-get [-p ]... [-o ] + locations-clusters-get-jwks [-p ]... [-o ] locations-clusters-list [-p ]... [-o ] locations-clusters-node-pools-create (-r )... [-p ]... [-o ] locations-clusters-node-pools-delete [-p ]... [-o ] @@ -56,6 +57,7 @@ container1 [options] locations-clusters-start-ip-rotation (-r )... [-p ]... [-o ] locations-clusters-update (-r )... [-p ]... [-o ] locations-clusters-update-master (-r )... [-p ]... [-o ] + locations-clusters-well-known-get-openid-configuration [-p ]... [-o ] locations-get-server-config [-p ]... [-o ] locations-operations-cancel (-r )... [-p ]... [-o ] locations-operations-get [-p ]... [-o ] diff --git a/gen/container1-cli/mkdocs.yml b/gen/container1-cli/mkdocs.yml index abc8136621..d67412958f 100644 --- a/gen/container1-cli/mkdocs.yml +++ b/gen/container1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Container v1.0.8+20180917 +site_name: Container v1.0.8+20190316 site_url: http://byron.github.io/google-apis-rs/google-container1-cli site_description: A complete library to interact with Container (protocol v1) @@ -13,6 +13,7 @@ pages: - ['projects_locations-clusters-create.md', 'Projects', 'Locations Clusters Create'] - ['projects_locations-clusters-delete.md', 'Projects', 'Locations Clusters Delete'] - ['projects_locations-clusters-get.md', 'Projects', 'Locations Clusters Get'] +- ['projects_locations-clusters-get-jwks.md', 'Projects', 'Locations Clusters Get Jwks'] - ['projects_locations-clusters-list.md', 'Projects', 'Locations Clusters List'] - ['projects_locations-clusters-node-pools-create.md', 'Projects', 'Locations Clusters Node Pools Create'] - ['projects_locations-clusters-node-pools-delete.md', 'Projects', 'Locations Clusters Node Pools Delete'] @@ -35,6 +36,7 @@ pages: - ['projects_locations-clusters-start-ip-rotation.md', 'Projects', 'Locations Clusters Start Ip Rotation'] - ['projects_locations-clusters-update.md', 'Projects', 'Locations Clusters Update'] - ['projects_locations-clusters-update-master.md', 'Projects', 'Locations Clusters Update Master'] +- ['projects_locations-clusters-well-known-get-openid-configuration.md', 'Projects', 'Locations Clusters Well Known Get Openid Configuration'] - ['projects_locations-get-server-config.md', 'Projects', 'Locations Get Server Config'] - ['projects_locations-operations-cancel.md', 'Projects', 'Locations Operations Cancel'] - ['projects_locations-operations-get.md', 'Projects', 'Locations Operations Get'] diff --git a/gen/container1-cli/src/main.rs b/gen/container1-cli/src/main.rs index 3e46433b0a..390ceb86bb 100644 --- a/gen/container1-cli/src/main.rs +++ b/gen/container1-cli/src/main.rs @@ -157,9 +157,6 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-ipv4-cidr-size" => Some(("cluster.nodeIpv4CidrSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cluster.maintenance-policy.window.daily-maintenance-window.duration" => Some(("cluster.maintenancePolicy.window.dailyMaintenanceWindow.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.maintenance-policy.window.daily-maintenance-window.start-time" => Some(("cluster.maintenancePolicy.window.dailyMaintenanceWindow.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -171,15 +168,19 @@ impl<'n> Engine<'n> { "cluster.addons-config.kubernetes-dashboard.disabled" => Some(("cluster.addonsConfig.kubernetesDashboard.disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.addons-config.horizontal-pod-autoscaling.disabled" => Some(("cluster.addonsConfig.horizontalPodAutoscaling.disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.locations" => Some(("cluster.locations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "cluster.legacy-abac.enabled" => Some(("cluster.legacyAbac.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "cluster.resource-labels" => Some(("cluster.resourceLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "cluster.enable-kubernetes-alpha" => Some(("cluster.enableKubernetesAlpha", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.network" => Some(("cluster.network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.logging-service" => Some(("cluster.loggingService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.instance-group-urls" => Some(("cluster.instanceGroupUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "cluster.network-config.subnetwork" => Some(("cluster.networkConfig.subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.network-config.network" => Some(("cluster.networkConfig.network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.name" => Some(("cluster.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.location" => Some(("cluster.location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.private-cluster-config.enable-private-endpoint" => Some(("cluster.privateClusterConfig.enablePrivateEndpoint", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cluster.private-cluster-config.master-ipv4-cidr-block" => Some(("cluster.privateClusterConfig.masterIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.private-cluster-config.private-endpoint" => Some(("cluster.privateClusterConfig.privateEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.private-cluster-config.public-endpoint" => Some(("cluster.privateClusterConfig.publicEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.private-cluster-config.enable-private-nodes" => Some(("cluster.privateClusterConfig.enablePrivateNodes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cluster.services-ipv4-cidr" => Some(("cluster.servicesIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.status-message" => Some(("cluster.statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.node-ipv4-cidr" => Some(("cluster.ipAllocationPolicy.nodeIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.use-ip-aliases" => Some(("cluster.ipAllocationPolicy.useIpAliases", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -188,6 +189,7 @@ impl<'n> Engine<'n> { "cluster.ip-allocation-policy.services-ipv4-cidr-block" => Some(("cluster.ipAllocationPolicy.servicesIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.create-subnetwork" => Some(("cluster.ipAllocationPolicy.createSubnetwork", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.node-ipv4-cidr-block" => Some(("cluster.ipAllocationPolicy.nodeIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.ip-allocation-policy.tpu-ipv4-cidr-block" => Some(("cluster.ipAllocationPolicy.tpuIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.cluster-ipv4-cidr" => Some(("cluster.ipAllocationPolicy.clusterIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.subnetwork-name" => Some(("cluster.ipAllocationPolicy.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.services-secondary-range-name" => Some(("cluster.ipAllocationPolicy.servicesSecondaryRangeName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -204,18 +206,15 @@ impl<'n> Engine<'n> { "cluster.master-auth.password" => Some(("cluster.masterAuth.password", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.master-auth.cluster-ca-certificate" => Some(("cluster.masterAuth.clusterCaCertificate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.expire-time" => Some(("cluster.expireTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.zone" => Some(("cluster.zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.initial-node-count" => Some(("cluster.initialNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cluster.monitoring-service" => Some(("cluster.monitoringService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.create-time" => Some(("cluster.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.private-cluster-config.enable-private-endpoint" => Some(("cluster.privateClusterConfig.enablePrivateEndpoint", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "cluster.private-cluster-config.master-ipv4-cidr-block" => Some(("cluster.privateClusterConfig.masterIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.private-cluster-config.private-endpoint" => Some(("cluster.privateClusterConfig.privateEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.private-cluster-config.public-endpoint" => Some(("cluster.privateClusterConfig.publicEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.private-cluster-config.enable-private-nodes" => Some(("cluster.privateClusterConfig.enablePrivateNodes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cluster.enable-tpu" => Some(("cluster.enableTpu", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.endpoint" => Some(("cluster.endpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.current-node-count" => Some(("cluster.currentNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "cluster.zone" => Some(("cluster.zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.enable-kubernetes-alpha" => Some(("cluster.enableKubernetesAlpha", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cluster.name" => Some(("cluster.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.legacy-abac.enabled" => Some(("cluster.legacyAbac.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.initial-cluster-version" => Some(("cluster.initialClusterVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-config.machine-type" => Some(("cluster.nodeConfig.machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-config.tags" => Some(("cluster.nodeConfig.tags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -226,15 +225,19 @@ impl<'n> Engine<'n> { "cluster.node-config.disk-type" => Some(("cluster.nodeConfig.diskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-config.disk-size-gb" => Some(("cluster.nodeConfig.diskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cluster.node-config.min-cpu-platform" => Some(("cluster.nodeConfig.minCpuPlatform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.node-config.local-ssd-count" => Some(("cluster.nodeConfig.localSsdCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "cluster.node-config.image-type" => Some(("cluster.nodeConfig.imageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-config.metadata" => Some(("cluster.nodeConfig.metadata", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "cluster.node-config.image-type" => Some(("cluster.nodeConfig.imageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.node-config.local-ssd-count" => Some(("cluster.nodeConfig.localSsdCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cluster.cluster-ipv4-cidr" => Some(("cluster.clusterIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.subnetwork" => Some(("cluster.subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.services-ipv4-cidr" => Some(("cluster.servicesIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.resource-labels" => Some(("cluster.resourceLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "cluster.self-link" => Some(("cluster.selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.tpu-ipv4-cidr-block" => Some(("cluster.tpuIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["addons-config", "client-certificate", "client-certificate-config", "client-key", "cluster", "cluster-ca-certificate", "cluster-ipv4-cidr", "cluster-ipv4-cidr-block", "cluster-secondary-range-name", "create-subnetwork", "create-time", "current-master-version", "current-node-count", "current-node-version", "daily-maintenance-window", "description", "disabled", "disk-size-gb", "disk-type", "duration", "enable-kubernetes-alpha", "enable-private-endpoint", "enable-private-nodes", "enabled", "endpoint", "expire-time", "horizontal-pod-autoscaling", "http-load-balancing", "image-type", "initial-cluster-version", "initial-node-count", "instance-group-urls", "ip-allocation-policy", "issue-client-certificate", "kubernetes-dashboard", "label-fingerprint", "labels", "legacy-abac", "local-ssd-count", "location", "locations", "logging-service", "machine-type", "maintenance-policy", "master-auth", "master-authorized-networks-config", "master-ipv4-cidr-block", "metadata", "min-cpu-platform", "monitoring-service", "name", "network", "network-config", "network-policy", "network-policy-config", "node-config", "node-ipv4-cidr", "node-ipv4-cidr-block", "node-ipv4-cidr-size", "oauth-scopes", "parent", "password", "preemptible", "private-cluster-config", "private-endpoint", "project-id", "provider", "public-endpoint", "resource-labels", "self-link", "service-account", "services-ipv4-cidr", "services-ipv4-cidr-block", "services-secondary-range-name", "start-time", "status", "status-message", "subnetwork", "subnetwork-name", "tags", "use-ip-aliases", "username", "window", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["addons-config", "client-certificate", "client-certificate-config", "client-key", "cluster", "cluster-ca-certificate", "cluster-ipv4-cidr", "cluster-ipv4-cidr-block", "cluster-secondary-range-name", "create-subnetwork", "create-time", "current-master-version", "current-node-count", "current-node-version", "daily-maintenance-window", "description", "disabled", "disk-size-gb", "disk-type", "duration", "enable-kubernetes-alpha", "enable-private-endpoint", "enable-private-nodes", "enable-tpu", "enabled", "endpoint", "expire-time", "horizontal-pod-autoscaling", "http-load-balancing", "image-type", "initial-cluster-version", "initial-node-count", "instance-group-urls", "ip-allocation-policy", "issue-client-certificate", "kubernetes-dashboard", "label-fingerprint", "labels", "legacy-abac", "local-ssd-count", "location", "locations", "logging-service", "machine-type", "maintenance-policy", "master-auth", "master-authorized-networks-config", "master-ipv4-cidr-block", "metadata", "min-cpu-platform", "monitoring-service", "name", "network", "network-config", "network-policy", "network-policy-config", "node-config", "node-ipv4-cidr", "node-ipv4-cidr-block", "node-ipv4-cidr-size", "oauth-scopes", "parent", "password", "preemptible", "private-cluster-config", "private-endpoint", "project-id", "provider", "public-endpoint", "resource-labels", "self-link", "service-account", "services-ipv4-cidr", "services-ipv4-cidr-block", "services-secondary-range-name", "start-time", "status", "status-message", "subnetwork", "subnetwork-name", "tags", "tpu-ipv4-cidr-block", "use-ip-aliases", "username", "window", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -418,6 +421,58 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_clusters_get_jwks(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_clusters_get_jwks(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_locations_clusters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().locations_clusters_list(opt.value_of("parent").unwrap_or("")); @@ -500,11 +555,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-id" => Some(("clusterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.status" => Some(("nodePool.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "node-pool.self-link" => Some(("nodePool.selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.management.auto-repair" => Some(("nodePool.management.autoRepair", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "node-pool.management.upgrade-options.description" => Some(("nodePool.management.upgradeOptions.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.management.upgrade-options.auto-upgrade-start-time" => Some(("nodePool.management.upgradeOptions.autoUpgradeStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -516,6 +571,7 @@ impl<'n> Engine<'n> { "node-pool.autoscaling.max-node-count" => Some(("nodePool.autoscaling.maxNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "node-pool.version" => Some(("nodePool.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.initial-node-count" => Some(("nodePool.initialNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "node-pool.status-message" => Some(("nodePool.statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.config.machine-type" => Some(("nodePool.config.machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.config.tags" => Some(("nodePool.config.tags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "node-pool.config.preemptible" => Some(("nodePool.config.preemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -525,11 +581,10 @@ impl<'n> Engine<'n> { "node-pool.config.disk-type" => Some(("nodePool.config.diskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.config.disk-size-gb" => Some(("nodePool.config.diskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "node-pool.config.min-cpu-platform" => Some(("nodePool.config.minCpuPlatform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "node-pool.config.local-ssd-count" => Some(("nodePool.config.localSsdCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "node-pool.config.image-type" => Some(("nodePool.config.imageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.config.metadata" => Some(("nodePool.config.metadata", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "node-pool.status-message" => Some(("nodePool.statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "node-pool.config.image-type" => Some(("nodePool.config.imageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "node-pool.config.local-ssd-count" => Some(("nodePool.config.localSsdCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "node-pool.self-link" => Some(("nodePool.selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["auto-repair", "auto-upgrade", "auto-upgrade-start-time", "autoscaling", "cluster-id", "config", "description", "disk-size-gb", "disk-type", "enabled", "image-type", "initial-node-count", "instance-group-urls", "labels", "local-ssd-count", "machine-type", "management", "max-node-count", "metadata", "min-cpu-platform", "min-node-count", "name", "node-pool", "oauth-scopes", "parent", "preemptible", "project-id", "self-link", "service-account", "status", "status-message", "tags", "upgrade-options", "version", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1353,11 +1408,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled" => Some(("enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster-id" => Some(("clusterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "enabled" => Some(("enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["cluster-id", "enabled", "name", "project-id", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1896,10 +1951,10 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-id" => Some(("clusterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network-policy.enabled" => Some(("networkPolicy.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "network-policy.provider" => Some(("networkPolicy.provider", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["cluster-id", "enabled", "name", "network-policy", "project-id", "provider", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -2165,6 +2220,8 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-id" => Some(("clusterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.desired-master-authorized-networks-config.enabled" => Some(("update.desiredMasterAuthorizedNetworksConfig.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "update.desired-node-pool-id" => Some(("update.desiredNodePoolId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.desired-addons-config.http-load-balancing.disabled" => Some(("update.desiredAddonsConfig.httpLoadBalancing.disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -2174,13 +2231,11 @@ impl<'n> Engine<'n> { "update.desired-master-version" => Some(("update.desiredMasterVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.desired-locations" => Some(("update.desiredLocations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "update.desired-node-version" => Some(("update.desiredNodeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "update.desired-monitoring-service" => Some(("update.desiredMonitoringService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update.desired-image-type" => Some(("update.desiredImageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.desired-node-pool-autoscaling.min-node-count" => Some(("update.desiredNodePoolAutoscaling.minNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "update.desired-node-pool-autoscaling.enabled" => Some(("update.desiredNodePoolAutoscaling.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "update.desired-node-pool-autoscaling.max-node-count" => Some(("update.desiredNodePoolAutoscaling.maxNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "update.desired-image-type" => Some(("update.desiredImageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update.desired-monitoring-service" => Some(("update.desiredMonitoringService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["cluster-id", "desired-addons-config", "desired-image-type", "desired-locations", "desired-master-authorized-networks-config", "desired-master-version", "desired-monitoring-service", "desired-node-pool-autoscaling", "desired-node-pool-id", "desired-node-version", "disabled", "enabled", "horizontal-pod-autoscaling", "http-load-balancing", "kubernetes-dashboard", "max-node-count", "min-node-count", "name", "network-policy-config", "project-id", "update", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -2331,6 +2386,58 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_clusters_well_known_get_openid_configuration(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_clusters_well_known_get_openid_configuration(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_locations_get_server_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().locations_get_server_config(opt.value_of("name").unwrap_or("")); @@ -2802,9 +2909,6 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-ipv4-cidr-size" => Some(("cluster.nodeIpv4CidrSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cluster.maintenance-policy.window.daily-maintenance-window.duration" => Some(("cluster.maintenancePolicy.window.dailyMaintenanceWindow.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.maintenance-policy.window.daily-maintenance-window.start-time" => Some(("cluster.maintenancePolicy.window.dailyMaintenanceWindow.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2816,15 +2920,19 @@ impl<'n> Engine<'n> { "cluster.addons-config.kubernetes-dashboard.disabled" => Some(("cluster.addonsConfig.kubernetesDashboard.disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.addons-config.horizontal-pod-autoscaling.disabled" => Some(("cluster.addonsConfig.horizontalPodAutoscaling.disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.locations" => Some(("cluster.locations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "cluster.legacy-abac.enabled" => Some(("cluster.legacyAbac.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "cluster.resource-labels" => Some(("cluster.resourceLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "cluster.enable-kubernetes-alpha" => Some(("cluster.enableKubernetesAlpha", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.network" => Some(("cluster.network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.logging-service" => Some(("cluster.loggingService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.instance-group-urls" => Some(("cluster.instanceGroupUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "cluster.network-config.subnetwork" => Some(("cluster.networkConfig.subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.network-config.network" => Some(("cluster.networkConfig.network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.name" => Some(("cluster.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.location" => Some(("cluster.location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.private-cluster-config.enable-private-endpoint" => Some(("cluster.privateClusterConfig.enablePrivateEndpoint", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cluster.private-cluster-config.master-ipv4-cidr-block" => Some(("cluster.privateClusterConfig.masterIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.private-cluster-config.private-endpoint" => Some(("cluster.privateClusterConfig.privateEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.private-cluster-config.public-endpoint" => Some(("cluster.privateClusterConfig.publicEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.private-cluster-config.enable-private-nodes" => Some(("cluster.privateClusterConfig.enablePrivateNodes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cluster.services-ipv4-cidr" => Some(("cluster.servicesIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.status-message" => Some(("cluster.statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.node-ipv4-cidr" => Some(("cluster.ipAllocationPolicy.nodeIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.use-ip-aliases" => Some(("cluster.ipAllocationPolicy.useIpAliases", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -2833,6 +2941,7 @@ impl<'n> Engine<'n> { "cluster.ip-allocation-policy.services-ipv4-cidr-block" => Some(("cluster.ipAllocationPolicy.servicesIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.create-subnetwork" => Some(("cluster.ipAllocationPolicy.createSubnetwork", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.node-ipv4-cidr-block" => Some(("cluster.ipAllocationPolicy.nodeIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.ip-allocation-policy.tpu-ipv4-cidr-block" => Some(("cluster.ipAllocationPolicy.tpuIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.cluster-ipv4-cidr" => Some(("cluster.ipAllocationPolicy.clusterIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.subnetwork-name" => Some(("cluster.ipAllocationPolicy.subnetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.ip-allocation-policy.services-secondary-range-name" => Some(("cluster.ipAllocationPolicy.servicesSecondaryRangeName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2849,18 +2958,15 @@ impl<'n> Engine<'n> { "cluster.master-auth.password" => Some(("cluster.masterAuth.password", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.master-auth.cluster-ca-certificate" => Some(("cluster.masterAuth.clusterCaCertificate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.expire-time" => Some(("cluster.expireTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.zone" => Some(("cluster.zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.initial-node-count" => Some(("cluster.initialNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cluster.monitoring-service" => Some(("cluster.monitoringService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.create-time" => Some(("cluster.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.private-cluster-config.enable-private-endpoint" => Some(("cluster.privateClusterConfig.enablePrivateEndpoint", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "cluster.private-cluster-config.master-ipv4-cidr-block" => Some(("cluster.privateClusterConfig.masterIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.private-cluster-config.private-endpoint" => Some(("cluster.privateClusterConfig.privateEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.private-cluster-config.public-endpoint" => Some(("cluster.privateClusterConfig.publicEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.private-cluster-config.enable-private-nodes" => Some(("cluster.privateClusterConfig.enablePrivateNodes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cluster.enable-tpu" => Some(("cluster.enableTpu", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.endpoint" => Some(("cluster.endpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.current-node-count" => Some(("cluster.currentNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "cluster.zone" => Some(("cluster.zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.enable-kubernetes-alpha" => Some(("cluster.enableKubernetesAlpha", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cluster.name" => Some(("cluster.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.legacy-abac.enabled" => Some(("cluster.legacyAbac.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster.initial-cluster-version" => Some(("cluster.initialClusterVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-config.machine-type" => Some(("cluster.nodeConfig.machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-config.tags" => Some(("cluster.nodeConfig.tags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2871,15 +2977,19 @@ impl<'n> Engine<'n> { "cluster.node-config.disk-type" => Some(("cluster.nodeConfig.diskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-config.disk-size-gb" => Some(("cluster.nodeConfig.diskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cluster.node-config.min-cpu-platform" => Some(("cluster.nodeConfig.minCpuPlatform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.node-config.local-ssd-count" => Some(("cluster.nodeConfig.localSsdCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "cluster.node-config.image-type" => Some(("cluster.nodeConfig.imageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-config.metadata" => Some(("cluster.nodeConfig.metadata", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "cluster.node-config.image-type" => Some(("cluster.nodeConfig.imageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.node-config.local-ssd-count" => Some(("cluster.nodeConfig.localSsdCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "cluster.cluster-ipv4-cidr" => Some(("cluster.clusterIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.subnetwork" => Some(("cluster.subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "cluster.services-ipv4-cidr" => Some(("cluster.servicesIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.resource-labels" => Some(("cluster.resourceLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "cluster.self-link" => Some(("cluster.selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cluster.tpu-ipv4-cidr-block" => Some(("cluster.tpuIpv4CidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["addons-config", "client-certificate", "client-certificate-config", "client-key", "cluster", "cluster-ca-certificate", "cluster-ipv4-cidr", "cluster-ipv4-cidr-block", "cluster-secondary-range-name", "create-subnetwork", "create-time", "current-master-version", "current-node-count", "current-node-version", "daily-maintenance-window", "description", "disabled", "disk-size-gb", "disk-type", "duration", "enable-kubernetes-alpha", "enable-private-endpoint", "enable-private-nodes", "enabled", "endpoint", "expire-time", "horizontal-pod-autoscaling", "http-load-balancing", "image-type", "initial-cluster-version", "initial-node-count", "instance-group-urls", "ip-allocation-policy", "issue-client-certificate", "kubernetes-dashboard", "label-fingerprint", "labels", "legacy-abac", "local-ssd-count", "location", "locations", "logging-service", "machine-type", "maintenance-policy", "master-auth", "master-authorized-networks-config", "master-ipv4-cidr-block", "metadata", "min-cpu-platform", "monitoring-service", "name", "network", "network-config", "network-policy", "network-policy-config", "node-config", "node-ipv4-cidr", "node-ipv4-cidr-block", "node-ipv4-cidr-size", "oauth-scopes", "parent", "password", "preemptible", "private-cluster-config", "private-endpoint", "project-id", "provider", "public-endpoint", "resource-labels", "self-link", "service-account", "services-ipv4-cidr", "services-ipv4-cidr-block", "services-secondary-range-name", "start-time", "status", "status-message", "subnetwork", "subnetwork-name", "tags", "use-ip-aliases", "username", "window", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["addons-config", "client-certificate", "client-certificate-config", "client-key", "cluster", "cluster-ca-certificate", "cluster-ipv4-cidr", "cluster-ipv4-cidr-block", "cluster-secondary-range-name", "create-subnetwork", "create-time", "current-master-version", "current-node-count", "current-node-version", "daily-maintenance-window", "description", "disabled", "disk-size-gb", "disk-type", "duration", "enable-kubernetes-alpha", "enable-private-endpoint", "enable-private-nodes", "enable-tpu", "enabled", "endpoint", "expire-time", "horizontal-pod-autoscaling", "http-load-balancing", "image-type", "initial-cluster-version", "initial-node-count", "instance-group-urls", "ip-allocation-policy", "issue-client-certificate", "kubernetes-dashboard", "label-fingerprint", "labels", "legacy-abac", "local-ssd-count", "location", "locations", "logging-service", "machine-type", "maintenance-policy", "master-auth", "master-authorized-networks-config", "master-ipv4-cidr-block", "metadata", "min-cpu-platform", "monitoring-service", "name", "network", "network-config", "network-policy", "network-policy-config", "node-config", "node-ipv4-cidr", "node-ipv4-cidr-block", "node-ipv4-cidr-size", "oauth-scopes", "parent", "password", "preemptible", "private-cluster-config", "private-endpoint", "project-id", "provider", "public-endpoint", "resource-labels", "self-link", "service-account", "services-ipv4-cidr", "services-ipv4-cidr-block", "services-secondary-range-name", "start-time", "status", "status-message", "subnetwork", "subnetwork-name", "tags", "tpu-ipv4-cidr-block", "use-ip-aliases", "username", "window", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3074,11 +3184,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled" => Some(("enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "cluster-id" => Some(("clusterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "enabled" => Some(("enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["cluster-id", "enabled", "name", "project-id", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -3667,11 +3777,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-id" => Some(("clusterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.status" => Some(("nodePool.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "node-pool.self-link" => Some(("nodePool.selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.management.auto-repair" => Some(("nodePool.management.autoRepair", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "node-pool.management.upgrade-options.description" => Some(("nodePool.management.upgradeOptions.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.management.upgrade-options.auto-upgrade-start-time" => Some(("nodePool.management.upgradeOptions.autoUpgradeStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3683,6 +3793,7 @@ impl<'n> Engine<'n> { "node-pool.autoscaling.max-node-count" => Some(("nodePool.autoscaling.maxNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "node-pool.version" => Some(("nodePool.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.initial-node-count" => Some(("nodePool.initialNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "node-pool.status-message" => Some(("nodePool.statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.config.machine-type" => Some(("nodePool.config.machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.config.tags" => Some(("nodePool.config.tags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "node-pool.config.preemptible" => Some(("nodePool.config.preemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -3692,11 +3803,10 @@ impl<'n> Engine<'n> { "node-pool.config.disk-type" => Some(("nodePool.config.diskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.config.disk-size-gb" => Some(("nodePool.config.diskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "node-pool.config.min-cpu-platform" => Some(("nodePool.config.minCpuPlatform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "node-pool.config.local-ssd-count" => Some(("nodePool.config.localSsdCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "node-pool.config.image-type" => Some(("nodePool.config.imageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "node-pool.config.metadata" => Some(("nodePool.config.metadata", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "node-pool.status-message" => Some(("nodePool.statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "node-pool.config.image-type" => Some(("nodePool.config.imageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "node-pool.config.local-ssd-count" => Some(("nodePool.config.localSsdCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "node-pool.self-link" => Some(("nodePool.selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["auto-repair", "auto-upgrade", "auto-upgrade-start-time", "autoscaling", "cluster-id", "config", "description", "disk-size-gb", "disk-type", "enabled", "image-type", "initial-node-count", "instance-group-urls", "labels", "local-ssd-count", "machine-type", "management", "max-node-count", "metadata", "min-cpu-platform", "min-node-count", "name", "node-pool", "oauth-scopes", "parent", "preemptible", "project-id", "self-link", "service-account", "status", "status-message", "tags", "upgrade-options", "version", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -4589,10 +4699,10 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-id" => Some(("clusterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network-policy.enabled" => Some(("networkPolicy.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "network-policy.provider" => Some(("networkPolicy.provider", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["cluster-id", "enabled", "name", "network-policy", "project-id", "provider", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -4768,6 +4878,8 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-id" => Some(("clusterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.desired-master-authorized-networks-config.enabled" => Some(("update.desiredMasterAuthorizedNetworksConfig.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "update.desired-node-pool-id" => Some(("update.desiredNodePoolId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.desired-addons-config.http-load-balancing.disabled" => Some(("update.desiredAddonsConfig.httpLoadBalancing.disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -4777,13 +4889,11 @@ impl<'n> Engine<'n> { "update.desired-master-version" => Some(("update.desiredMasterVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.desired-locations" => Some(("update.desiredLocations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "update.desired-node-version" => Some(("update.desiredNodeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "update.desired-monitoring-service" => Some(("update.desiredMonitoringService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update.desired-image-type" => Some(("update.desiredImageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.desired-node-pool-autoscaling.min-node-count" => Some(("update.desiredNodePoolAutoscaling.minNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "update.desired-node-pool-autoscaling.enabled" => Some(("update.desiredNodePoolAutoscaling.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "update.desired-node-pool-autoscaling.max-node-count" => Some(("update.desiredNodePoolAutoscaling.maxNodeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "update.desired-image-type" => Some(("update.desiredImageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update.desired-monitoring-service" => Some(("update.desiredMonitoringService", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["cluster-id", "desired-addons-config", "desired-image-type", "desired-locations", "desired-master-authorized-networks-config", "desired-master-version", "desired-monitoring-service", "desired-node-pool-autoscaling", "desired-node-pool-id", "desired-node-version", "disabled", "enabled", "horizontal-pod-autoscaling", "http-load-balancing", "kubernetes-dashboard", "max-node-count", "min-node-count", "name", "network-policy-config", "project-id", "update", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -5120,6 +5230,9 @@ impl<'n> Engine<'n> { ("locations-clusters-get", Some(opt)) => { call_result = self._projects_locations_clusters_get(opt, dry_run, &mut err); }, + ("locations-clusters-get-jwks", Some(opt)) => { + call_result = self._projects_locations_clusters_get_jwks(opt, dry_run, &mut err); + }, ("locations-clusters-list", Some(opt)) => { call_result = self._projects_locations_clusters_list(opt, dry_run, &mut err); }, @@ -5186,6 +5299,9 @@ impl<'n> Engine<'n> { ("locations-clusters-update-master", Some(opt)) => { call_result = self._projects_locations_clusters_update_master(opt, dry_run, &mut err); }, + ("locations-clusters-well-known-get-openid-configuration", Some(opt)) => { + call_result = self._projects_locations_clusters_well_known_get_openid_configuration(opt, dry_run, &mut err); + }, ("locations-get-server-config", Some(opt)) => { call_result = self._projects_locations_get_server_config(opt, dry_run, &mut err); }, @@ -5379,7 +5495,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'locations-clusters-complete-ip-rotation', 'locations-clusters-create', 'locations-clusters-delete', 'locations-clusters-get', 'locations-clusters-list', 'locations-clusters-node-pools-create', 'locations-clusters-node-pools-delete', 'locations-clusters-node-pools-get', 'locations-clusters-node-pools-list', 'locations-clusters-node-pools-rollback', 'locations-clusters-node-pools-set-autoscaling', 'locations-clusters-node-pools-set-management', 'locations-clusters-node-pools-set-size', 'locations-clusters-node-pools-update', 'locations-clusters-set-addons', 'locations-clusters-set-legacy-abac', 'locations-clusters-set-locations', 'locations-clusters-set-logging', 'locations-clusters-set-maintenance-policy', 'locations-clusters-set-master-auth', 'locations-clusters-set-monitoring', 'locations-clusters-set-network-policy', 'locations-clusters-set-resource-labels', 'locations-clusters-start-ip-rotation', 'locations-clusters-update', 'locations-clusters-update-master', 'locations-get-server-config', 'locations-operations-cancel', 'locations-operations-get', 'locations-operations-list', 'zones-clusters-addons', 'zones-clusters-complete-ip-rotation', 'zones-clusters-create', 'zones-clusters-delete', 'zones-clusters-get', 'zones-clusters-legacy-abac', 'zones-clusters-list', 'zones-clusters-locations', 'zones-clusters-logging', 'zones-clusters-master', 'zones-clusters-monitoring', 'zones-clusters-node-pools-autoscaling', 'zones-clusters-node-pools-create', 'zones-clusters-node-pools-delete', 'zones-clusters-node-pools-get', 'zones-clusters-node-pools-list', 'zones-clusters-node-pools-rollback', 'zones-clusters-node-pools-set-management', 'zones-clusters-node-pools-set-size', 'zones-clusters-node-pools-update', 'zones-clusters-resource-labels', 'zones-clusters-set-maintenance-policy', 'zones-clusters-set-master-auth', 'zones-clusters-set-network-policy', 'zones-clusters-start-ip-rotation', 'zones-clusters-update', 'zones-get-serverconfig', 'zones-operations-cancel', 'zones-operations-get' and 'zones-operations-list'", vec![ + ("projects", "methods: 'locations-clusters-complete-ip-rotation', 'locations-clusters-create', 'locations-clusters-delete', 'locations-clusters-get', 'locations-clusters-get-jwks', 'locations-clusters-list', 'locations-clusters-node-pools-create', 'locations-clusters-node-pools-delete', 'locations-clusters-node-pools-get', 'locations-clusters-node-pools-list', 'locations-clusters-node-pools-rollback', 'locations-clusters-node-pools-set-autoscaling', 'locations-clusters-node-pools-set-management', 'locations-clusters-node-pools-set-size', 'locations-clusters-node-pools-update', 'locations-clusters-set-addons', 'locations-clusters-set-legacy-abac', 'locations-clusters-set-locations', 'locations-clusters-set-logging', 'locations-clusters-set-maintenance-policy', 'locations-clusters-set-master-auth', 'locations-clusters-set-monitoring', 'locations-clusters-set-network-policy', 'locations-clusters-set-resource-labels', 'locations-clusters-start-ip-rotation', 'locations-clusters-update', 'locations-clusters-update-master', 'locations-clusters-well-known-get-openid-configuration', 'locations-get-server-config', 'locations-operations-cancel', 'locations-operations-get', 'locations-operations-list', 'zones-clusters-addons', 'zones-clusters-complete-ip-rotation', 'zones-clusters-create', 'zones-clusters-delete', 'zones-clusters-get', 'zones-clusters-legacy-abac', 'zones-clusters-list', 'zones-clusters-locations', 'zones-clusters-logging', 'zones-clusters-master', 'zones-clusters-monitoring', 'zones-clusters-node-pools-autoscaling', 'zones-clusters-node-pools-create', 'zones-clusters-node-pools-delete', 'zones-clusters-node-pools-get', 'zones-clusters-node-pools-list', 'zones-clusters-node-pools-rollback', 'zones-clusters-node-pools-set-management', 'zones-clusters-node-pools-set-size', 'zones-clusters-node-pools-update', 'zones-clusters-resource-labels', 'zones-clusters-set-maintenance-policy', 'zones-clusters-set-master-auth', 'zones-clusters-set-network-policy', 'zones-clusters-start-ip-rotation', 'zones-clusters-update', 'zones-get-serverconfig', 'zones-operations-cancel', 'zones-operations-get' and 'zones-operations-list'", vec![ ("locations-clusters-complete-ip-rotation", Some(r##"Completes master IP rotation."##), "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_locations-clusters-complete-ip-rotation", @@ -5498,6 +5614,32 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-clusters-get-jwks", + Some(r##"GetJSONWebKeys gets the public component of the cluster signing keys in + JSON Web Key format. + This API is not yet intended for general use, and is not available for all + clusters."##), + "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_locations-clusters-get-jwks", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The cluster (project, location, cluster id) to get keys for. Specified in + the format 'projects/*/locations/*/clusters/*'."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -6126,6 +6268,33 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-clusters-well-known-get-openid-configuration", + Some(r##"GetOpenIDConfig gets the OIDC discovery document for the cluster. + See the OpenID Connect Discovery 1.0 specification for details. + https://openid.net/specs/openid-connect-discovery-1_0.html + This API is not yet intended for general use, and is not available for all + clusters."##), + "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_locations-clusters-well-known-get-openid-configuration", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The cluster (project, location, cluster id) to get the discovery document + for. Specified in the format 'projects/*/locations/*/clusters/*'."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -6138,8 +6307,8 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"The name (project and location) of the server config to get - Specified in the format 'projects/*/locations/*'."##), + Some(r##"The name (project and location) of the server config to get, + specified in the format 'projects/*/locations/*'."##), Some(true), Some(false)), @@ -7602,8 +7771,8 @@ fn main() { let mut app = App::new("container1") .author("Sebastian Thiel ") - .version("1.0.8+20180917") - .about("The Google Kubernetes Engine API is used for building and managing container based applications, powered by the open source Kubernetes technology.") + .version("1.0.8+20190316") + .about("Builds and manages container-based applications, powered by the open source Kubernetes technology.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_container1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/container1/Cargo.toml b/gen/container1/Cargo.toml index 9741da410e..b72d7f7ada 100644 --- a/gen/container1/Cargo.toml +++ b/gen/container1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-container1" -version = "1.0.8+20180917" +version = "1.0.8+20190316" authors = ["Sebastian Thiel "] description = "A complete library to interact with Container (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/container1" homepage = "https://cloud.google.com/container-engine/" -documentation = "https://docs.rs/google-container1/1.0.8+20180917" +documentation = "https://docs.rs/google-container1/1.0.8+20190316" license = "MIT" keywords = ["container", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/container1/README.md b/gen/container1/README.md index d9b1661371..768f222b4a 100644 --- a/gen/container1/README.md +++ b/gen/container1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-container1` library allows access to all features of the *Google Container* service. -This documentation was generated from *Container* crate version *1.0.8+20180917*, where *20180917* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Container* crate version *1.0.8+20190316*, where *20190316* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Container* *v1* API can be found at the [official documentation site](https://cloud.google.com/container-engine/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.Container.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.Container.html) ... * projects - * [*locations clusters complete ip rotation*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterCompleteIpRotationCall.html), [*locations clusters create*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterCreateCall.html), [*locations clusters delete*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterDeleteCall.html), [*locations clusters get*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterGetCall.html), [*locations clusters list*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterListCall.html), [*locations clusters node pools create*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterNodePoolCreateCall.html), [*locations clusters node pools delete*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterNodePoolDeleteCall.html), [*locations clusters node pools get*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterNodePoolGetCall.html), [*locations clusters node pools list*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterNodePoolListCall.html), [*locations clusters node pools rollback*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterNodePoolRollbackCall.html), [*locations clusters node pools set autoscaling*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterNodePoolSetAutoscalingCall.html), [*locations clusters node pools set management*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterNodePoolSetManagementCall.html), [*locations clusters node pools set size*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterNodePoolSetSizeCall.html), [*locations clusters node pools update*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterNodePoolUpdateCall.html), [*locations clusters set addons*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterSetAddonCall.html), [*locations clusters set legacy abac*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterSetLegacyAbacCall.html), [*locations clusters set locations*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterSetLocationCall.html), [*locations clusters set logging*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterSetLoggingCall.html), [*locations clusters set maintenance policy*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterSetMaintenancePolicyCall.html), [*locations clusters set master auth*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterSetMasterAuthCall.html), [*locations clusters set monitoring*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterSetMonitoringCall.html), [*locations clusters set network policy*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterSetNetworkPolicyCall.html), [*locations clusters set resource labels*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterSetResourceLabelCall.html), [*locations clusters start ip rotation*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterStartIpRotationCall.html), [*locations clusters update*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterUpdateCall.html), [*locations clusters update master*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationClusterUpdateMasterCall.html), [*locations get server config*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationGetServerConfigCall.html), [*locations operations cancel*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationOperationCancelCall.html), [*locations operations get*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationOperationGetCall.html), [*locations operations list*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectLocationOperationListCall.html), [*zones clusters addons*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterAddonCall.html), [*zones clusters complete ip rotation*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterCompleteIpRotationCall.html), [*zones clusters create*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterCreateCall.html), [*zones clusters delete*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterDeleteCall.html), [*zones clusters get*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterGetCall.html), [*zones clusters legacy abac*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterLegacyAbacCall.html), [*zones clusters list*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterListCall.html), [*zones clusters locations*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterLocationCall.html), [*zones clusters logging*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterLoggingCall.html), [*zones clusters master*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterMasterCall.html), [*zones clusters monitoring*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterMonitoringCall.html), [*zones clusters node pools autoscaling*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterNodePoolAutoscalingCall.html), [*zones clusters node pools create*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterNodePoolCreateCall.html), [*zones clusters node pools delete*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterNodePoolDeleteCall.html), [*zones clusters node pools get*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterNodePoolGetCall.html), [*zones clusters node pools list*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterNodePoolListCall.html), [*zones clusters node pools rollback*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterNodePoolRollbackCall.html), [*zones clusters node pools set management*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterNodePoolSetManagementCall.html), [*zones clusters node pools set size*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterNodePoolSetSizeCall.html), [*zones clusters node pools update*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterNodePoolUpdateCall.html), [*zones clusters resource labels*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterResourceLabelCall.html), [*zones clusters set maintenance policy*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterSetMaintenancePolicyCall.html), [*zones clusters set master auth*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterSetMasterAuthCall.html), [*zones clusters set network policy*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterSetNetworkPolicyCall.html), [*zones clusters start ip rotation*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterStartIpRotationCall.html), [*zones clusters update*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneClusterUpdateCall.html), [*zones get serverconfig*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneGetServerconfigCall.html), [*zones operations cancel*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneOperationCancelCall.html), [*zones operations get*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneOperationGetCall.html) and [*zones operations list*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.ProjectZoneOperationListCall.html) + * [*locations clusters complete ip rotation*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterCompleteIpRotationCall.html), [*locations clusters create*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterCreateCall.html), [*locations clusters delete*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterDeleteCall.html), [*locations clusters get*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterGetCall.html), [*locations clusters get jwks*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterGetJwkCall.html), [*locations clusters list*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterListCall.html), [*locations clusters node pools create*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterNodePoolCreateCall.html), [*locations clusters node pools delete*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterNodePoolDeleteCall.html), [*locations clusters node pools get*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterNodePoolGetCall.html), [*locations clusters node pools list*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterNodePoolListCall.html), [*locations clusters node pools rollback*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterNodePoolRollbackCall.html), [*locations clusters node pools set autoscaling*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterNodePoolSetAutoscalingCall.html), [*locations clusters node pools set management*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterNodePoolSetManagementCall.html), [*locations clusters node pools set size*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterNodePoolSetSizeCall.html), [*locations clusters node pools update*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterNodePoolUpdateCall.html), [*locations clusters set addons*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterSetAddonCall.html), [*locations clusters set legacy abac*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterSetLegacyAbacCall.html), [*locations clusters set locations*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterSetLocationCall.html), [*locations clusters set logging*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterSetLoggingCall.html), [*locations clusters set maintenance policy*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterSetMaintenancePolicyCall.html), [*locations clusters set master auth*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterSetMasterAuthCall.html), [*locations clusters set monitoring*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterSetMonitoringCall.html), [*locations clusters set network policy*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterSetNetworkPolicyCall.html), [*locations clusters set resource labels*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterSetResourceLabelCall.html), [*locations clusters start ip rotation*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterStartIpRotationCall.html), [*locations clusters update*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterUpdateCall.html), [*locations clusters update master*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterUpdateMasterCall.html), [*locations clusters well-known get openid-configuration*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationClusterWell-knownGetOpenid-configurationCall.html), [*locations get server config*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationGetServerConfigCall.html), [*locations operations cancel*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationOperationCancelCall.html), [*locations operations get*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationOperationGetCall.html), [*locations operations list*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectLocationOperationListCall.html), [*zones clusters addons*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterAddonCall.html), [*zones clusters complete ip rotation*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterCompleteIpRotationCall.html), [*zones clusters create*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterCreateCall.html), [*zones clusters delete*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterDeleteCall.html), [*zones clusters get*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterGetCall.html), [*zones clusters legacy abac*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterLegacyAbacCall.html), [*zones clusters list*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterListCall.html), [*zones clusters locations*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterLocationCall.html), [*zones clusters logging*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterLoggingCall.html), [*zones clusters master*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterMasterCall.html), [*zones clusters monitoring*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterMonitoringCall.html), [*zones clusters node pools autoscaling*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterNodePoolAutoscalingCall.html), [*zones clusters node pools create*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterNodePoolCreateCall.html), [*zones clusters node pools delete*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterNodePoolDeleteCall.html), [*zones clusters node pools get*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterNodePoolGetCall.html), [*zones clusters node pools list*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterNodePoolListCall.html), [*zones clusters node pools rollback*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterNodePoolRollbackCall.html), [*zones clusters node pools set management*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterNodePoolSetManagementCall.html), [*zones clusters node pools set size*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterNodePoolSetSizeCall.html), [*zones clusters node pools update*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterNodePoolUpdateCall.html), [*zones clusters resource labels*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterResourceLabelCall.html), [*zones clusters set maintenance policy*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterSetMaintenancePolicyCall.html), [*zones clusters set master auth*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterSetMasterAuthCall.html), [*zones clusters set network policy*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterSetNetworkPolicyCall.html), [*zones clusters start ip rotation*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterStartIpRotationCall.html), [*zones clusters update*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneClusterUpdateCall.html), [*zones get serverconfig*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneGetServerconfigCall.html), [*zones operations cancel*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneOperationCancelCall.html), [*zones operations get*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneOperationGetCall.html) and [*zones operations list*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.ProjectZoneOperationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-container1/1.0.8+20180917/google_container1/struct.Container.html)** +* **[Hub](https://docs.rs/google-container1/1.0.8+20190316/google_container1/struct.Container.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.Part.html)** + * **[Parts](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -54,7 +54,7 @@ let r = hub.projects().zones_clusters_monitoring(...).doit() let r = hub.projects().locations_clusters_update(...).doit() let r = hub.projects().zones_clusters_delete(...).doit() let r = hub.projects().zones_clusters_legacy_abac(...).doit() -let r = hub.projects().zones_clusters_set_master_auth(...).doit() +let r = hub.projects().zones_clusters_addons(...).doit() let r = hub.projects().locations_clusters_delete(...).doit() let r = hub.projects().locations_clusters_node_pools_delete(...).doit() let r = hub.projects().zones_clusters_start_ip_rotation(...).doit() @@ -87,7 +87,7 @@ let r = hub.projects().zones_clusters_master(...).doit() let r = hub.projects().zones_clusters_node_pools_update(...).doit() let r = hub.projects().zones_clusters_set_network_policy(...).doit() let r = hub.projects().locations_clusters_set_maintenance_policy(...).doit() -let r = hub.projects().zones_clusters_addons(...).doit() +let r = hub.projects().zones_clusters_set_master_auth(...).doit() let r = hub.projects().locations_clusters_set_master_auth(...).doit() let r = hub.projects().zones_clusters_complete_ip_rotation(...).doit() let r = hub.projects().zones_clusters_resource_labels(...).doit() @@ -175,17 +175,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-container1/1.0.8+20180917/google_container1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-container1/1.0.8+20190316/google_container1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-container1/1.0.8+20180917/google_container1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-container1/1.0.8+20190316/google_container1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -195,29 +195,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-container1/1.0.8+20180917/google_container1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-container1/1.0.8+20190316/google_container1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/container1/src/lib.rs b/gen/container1/src/lib.rs index a2896191b1..93793c524e 100644 --- a/gen/container1/src/lib.rs +++ b/gen/container1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Container* crate version *1.0.8+20180917*, where *20180917* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Container* crate version *1.0.8+20190316*, where *20190316* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Container* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/container-engine/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Container.html) ... //! //! * projects -//! * [*locations clusters complete ip rotation*](struct.ProjectLocationClusterCompleteIpRotationCall.html), [*locations clusters create*](struct.ProjectLocationClusterCreateCall.html), [*locations clusters delete*](struct.ProjectLocationClusterDeleteCall.html), [*locations clusters get*](struct.ProjectLocationClusterGetCall.html), [*locations clusters list*](struct.ProjectLocationClusterListCall.html), [*locations clusters node pools create*](struct.ProjectLocationClusterNodePoolCreateCall.html), [*locations clusters node pools delete*](struct.ProjectLocationClusterNodePoolDeleteCall.html), [*locations clusters node pools get*](struct.ProjectLocationClusterNodePoolGetCall.html), [*locations clusters node pools list*](struct.ProjectLocationClusterNodePoolListCall.html), [*locations clusters node pools rollback*](struct.ProjectLocationClusterNodePoolRollbackCall.html), [*locations clusters node pools set autoscaling*](struct.ProjectLocationClusterNodePoolSetAutoscalingCall.html), [*locations clusters node pools set management*](struct.ProjectLocationClusterNodePoolSetManagementCall.html), [*locations clusters node pools set size*](struct.ProjectLocationClusterNodePoolSetSizeCall.html), [*locations clusters node pools update*](struct.ProjectLocationClusterNodePoolUpdateCall.html), [*locations clusters set addons*](struct.ProjectLocationClusterSetAddonCall.html), [*locations clusters set legacy abac*](struct.ProjectLocationClusterSetLegacyAbacCall.html), [*locations clusters set locations*](struct.ProjectLocationClusterSetLocationCall.html), [*locations clusters set logging*](struct.ProjectLocationClusterSetLoggingCall.html), [*locations clusters set maintenance policy*](struct.ProjectLocationClusterSetMaintenancePolicyCall.html), [*locations clusters set master auth*](struct.ProjectLocationClusterSetMasterAuthCall.html), [*locations clusters set monitoring*](struct.ProjectLocationClusterSetMonitoringCall.html), [*locations clusters set network policy*](struct.ProjectLocationClusterSetNetworkPolicyCall.html), [*locations clusters set resource labels*](struct.ProjectLocationClusterSetResourceLabelCall.html), [*locations clusters start ip rotation*](struct.ProjectLocationClusterStartIpRotationCall.html), [*locations clusters update*](struct.ProjectLocationClusterUpdateCall.html), [*locations clusters update master*](struct.ProjectLocationClusterUpdateMasterCall.html), [*locations get server config*](struct.ProjectLocationGetServerConfigCall.html), [*locations operations cancel*](struct.ProjectLocationOperationCancelCall.html), [*locations operations get*](struct.ProjectLocationOperationGetCall.html), [*locations operations list*](struct.ProjectLocationOperationListCall.html), [*zones clusters addons*](struct.ProjectZoneClusterAddonCall.html), [*zones clusters complete ip rotation*](struct.ProjectZoneClusterCompleteIpRotationCall.html), [*zones clusters create*](struct.ProjectZoneClusterCreateCall.html), [*zones clusters delete*](struct.ProjectZoneClusterDeleteCall.html), [*zones clusters get*](struct.ProjectZoneClusterGetCall.html), [*zones clusters legacy abac*](struct.ProjectZoneClusterLegacyAbacCall.html), [*zones clusters list*](struct.ProjectZoneClusterListCall.html), [*zones clusters locations*](struct.ProjectZoneClusterLocationCall.html), [*zones clusters logging*](struct.ProjectZoneClusterLoggingCall.html), [*zones clusters master*](struct.ProjectZoneClusterMasterCall.html), [*zones clusters monitoring*](struct.ProjectZoneClusterMonitoringCall.html), [*zones clusters node pools autoscaling*](struct.ProjectZoneClusterNodePoolAutoscalingCall.html), [*zones clusters node pools create*](struct.ProjectZoneClusterNodePoolCreateCall.html), [*zones clusters node pools delete*](struct.ProjectZoneClusterNodePoolDeleteCall.html), [*zones clusters node pools get*](struct.ProjectZoneClusterNodePoolGetCall.html), [*zones clusters node pools list*](struct.ProjectZoneClusterNodePoolListCall.html), [*zones clusters node pools rollback*](struct.ProjectZoneClusterNodePoolRollbackCall.html), [*zones clusters node pools set management*](struct.ProjectZoneClusterNodePoolSetManagementCall.html), [*zones clusters node pools set size*](struct.ProjectZoneClusterNodePoolSetSizeCall.html), [*zones clusters node pools update*](struct.ProjectZoneClusterNodePoolUpdateCall.html), [*zones clusters resource labels*](struct.ProjectZoneClusterResourceLabelCall.html), [*zones clusters set maintenance policy*](struct.ProjectZoneClusterSetMaintenancePolicyCall.html), [*zones clusters set master auth*](struct.ProjectZoneClusterSetMasterAuthCall.html), [*zones clusters set network policy*](struct.ProjectZoneClusterSetNetworkPolicyCall.html), [*zones clusters start ip rotation*](struct.ProjectZoneClusterStartIpRotationCall.html), [*zones clusters update*](struct.ProjectZoneClusterUpdateCall.html), [*zones get serverconfig*](struct.ProjectZoneGetServerconfigCall.html), [*zones operations cancel*](struct.ProjectZoneOperationCancelCall.html), [*zones operations get*](struct.ProjectZoneOperationGetCall.html) and [*zones operations list*](struct.ProjectZoneOperationListCall.html) +//! * [*locations clusters complete ip rotation*](struct.ProjectLocationClusterCompleteIpRotationCall.html), [*locations clusters create*](struct.ProjectLocationClusterCreateCall.html), [*locations clusters delete*](struct.ProjectLocationClusterDeleteCall.html), [*locations clusters get*](struct.ProjectLocationClusterGetCall.html), [*locations clusters get jwks*](struct.ProjectLocationClusterGetJwkCall.html), [*locations clusters list*](struct.ProjectLocationClusterListCall.html), [*locations clusters node pools create*](struct.ProjectLocationClusterNodePoolCreateCall.html), [*locations clusters node pools delete*](struct.ProjectLocationClusterNodePoolDeleteCall.html), [*locations clusters node pools get*](struct.ProjectLocationClusterNodePoolGetCall.html), [*locations clusters node pools list*](struct.ProjectLocationClusterNodePoolListCall.html), [*locations clusters node pools rollback*](struct.ProjectLocationClusterNodePoolRollbackCall.html), [*locations clusters node pools set autoscaling*](struct.ProjectLocationClusterNodePoolSetAutoscalingCall.html), [*locations clusters node pools set management*](struct.ProjectLocationClusterNodePoolSetManagementCall.html), [*locations clusters node pools set size*](struct.ProjectLocationClusterNodePoolSetSizeCall.html), [*locations clusters node pools update*](struct.ProjectLocationClusterNodePoolUpdateCall.html), [*locations clusters set addons*](struct.ProjectLocationClusterSetAddonCall.html), [*locations clusters set legacy abac*](struct.ProjectLocationClusterSetLegacyAbacCall.html), [*locations clusters set locations*](struct.ProjectLocationClusterSetLocationCall.html), [*locations clusters set logging*](struct.ProjectLocationClusterSetLoggingCall.html), [*locations clusters set maintenance policy*](struct.ProjectLocationClusterSetMaintenancePolicyCall.html), [*locations clusters set master auth*](struct.ProjectLocationClusterSetMasterAuthCall.html), [*locations clusters set monitoring*](struct.ProjectLocationClusterSetMonitoringCall.html), [*locations clusters set network policy*](struct.ProjectLocationClusterSetNetworkPolicyCall.html), [*locations clusters set resource labels*](struct.ProjectLocationClusterSetResourceLabelCall.html), [*locations clusters start ip rotation*](struct.ProjectLocationClusterStartIpRotationCall.html), [*locations clusters update*](struct.ProjectLocationClusterUpdateCall.html), [*locations clusters update master*](struct.ProjectLocationClusterUpdateMasterCall.html), [*locations clusters well-known get openid-configuration*](struct.ProjectLocationClusterWell-knownGetOpenid-configurationCall.html), [*locations get server config*](struct.ProjectLocationGetServerConfigCall.html), [*locations operations cancel*](struct.ProjectLocationOperationCancelCall.html), [*locations operations get*](struct.ProjectLocationOperationGetCall.html), [*locations operations list*](struct.ProjectLocationOperationListCall.html), [*zones clusters addons*](struct.ProjectZoneClusterAddonCall.html), [*zones clusters complete ip rotation*](struct.ProjectZoneClusterCompleteIpRotationCall.html), [*zones clusters create*](struct.ProjectZoneClusterCreateCall.html), [*zones clusters delete*](struct.ProjectZoneClusterDeleteCall.html), [*zones clusters get*](struct.ProjectZoneClusterGetCall.html), [*zones clusters legacy abac*](struct.ProjectZoneClusterLegacyAbacCall.html), [*zones clusters list*](struct.ProjectZoneClusterListCall.html), [*zones clusters locations*](struct.ProjectZoneClusterLocationCall.html), [*zones clusters logging*](struct.ProjectZoneClusterLoggingCall.html), [*zones clusters master*](struct.ProjectZoneClusterMasterCall.html), [*zones clusters monitoring*](struct.ProjectZoneClusterMonitoringCall.html), [*zones clusters node pools autoscaling*](struct.ProjectZoneClusterNodePoolAutoscalingCall.html), [*zones clusters node pools create*](struct.ProjectZoneClusterNodePoolCreateCall.html), [*zones clusters node pools delete*](struct.ProjectZoneClusterNodePoolDeleteCall.html), [*zones clusters node pools get*](struct.ProjectZoneClusterNodePoolGetCall.html), [*zones clusters node pools list*](struct.ProjectZoneClusterNodePoolListCall.html), [*zones clusters node pools rollback*](struct.ProjectZoneClusterNodePoolRollbackCall.html), [*zones clusters node pools set management*](struct.ProjectZoneClusterNodePoolSetManagementCall.html), [*zones clusters node pools set size*](struct.ProjectZoneClusterNodePoolSetSizeCall.html), [*zones clusters node pools update*](struct.ProjectZoneClusterNodePoolUpdateCall.html), [*zones clusters resource labels*](struct.ProjectZoneClusterResourceLabelCall.html), [*zones clusters set maintenance policy*](struct.ProjectZoneClusterSetMaintenancePolicyCall.html), [*zones clusters set master auth*](struct.ProjectZoneClusterSetMasterAuthCall.html), [*zones clusters set network policy*](struct.ProjectZoneClusterSetNetworkPolicyCall.html), [*zones clusters start ip rotation*](struct.ProjectZoneClusterStartIpRotationCall.html), [*zones clusters update*](struct.ProjectZoneClusterUpdateCall.html), [*zones get serverconfig*](struct.ProjectZoneGetServerconfigCall.html), [*zones operations cancel*](struct.ProjectZoneOperationCancelCall.html), [*zones operations get*](struct.ProjectZoneOperationGetCall.html) and [*zones operations list*](struct.ProjectZoneOperationListCall.html) //! //! //! @@ -54,7 +54,7 @@ //! let r = hub.projects().locations_clusters_update(...).doit() //! let r = hub.projects().zones_clusters_delete(...).doit() //! let r = hub.projects().zones_clusters_legacy_abac(...).doit() -//! let r = hub.projects().zones_clusters_set_master_auth(...).doit() +//! let r = hub.projects().zones_clusters_addons(...).doit() //! let r = hub.projects().locations_clusters_delete(...).doit() //! let r = hub.projects().locations_clusters_node_pools_delete(...).doit() //! let r = hub.projects().zones_clusters_start_ip_rotation(...).doit() @@ -87,7 +87,7 @@ //! let r = hub.projects().zones_clusters_node_pools_update(...).doit() //! let r = hub.projects().zones_clusters_set_network_policy(...).doit() //! let r = hub.projects().locations_clusters_set_maintenance_policy(...).doit() -//! let r = hub.projects().zones_clusters_addons(...).doit() +//! let r = hub.projects().zones_clusters_set_master_auth(...).doit() //! let r = hub.projects().locations_clusters_set_master_auth(...).doit() //! let r = hub.projects().zones_clusters_complete_ip_rotation(...).doit() //! let r = hub.projects().zones_clusters_resource_labels(...).doit() @@ -463,7 +463,7 @@ pub struct ClusterUpdate { #[serde(rename="desiredMasterAuthorizedNetworksConfig")] pub desired_master_authorized_networks_config: Option, /// The desired list of Google Compute Engine - /// [locations](/compute/docs/zones#available) in which the cluster's nodes + /// [zones](/compute/docs/zones#available) in which the cluster's nodes /// should be located. Changing the locations a cluster is in will result /// in nodes being either created or removed from the cluster, depending on /// whether locations are being added or removed. @@ -505,6 +505,16 @@ pub struct ClusterUpdate { /// - "-": picks the Kubernetes master version #[serde(rename="desiredNodeVersion")] pub desired_node_version: Option, + /// The desired image type for the node pool. + /// NOTE: Set the "desired_node_pool" field as well. + #[serde(rename="desiredImageType")] + pub desired_image_type: Option, + /// Autoscaler configuration for the node pool specified in + /// desired_node_pool_id. If there is only one pool in the + /// cluster and desired_node_pool_id is not provided then + /// the change applies to that single node pool. + #[serde(rename="desiredNodePoolAutoscaling")] + pub desired_node_pool_autoscaling: Option, /// The monitoring service the cluster should use to write metrics. /// Currently available options: /// @@ -512,21 +522,115 @@ pub struct ClusterUpdate { /// * "none" - no metrics will be exported from the cluster #[serde(rename="desiredMonitoringService")] pub desired_monitoring_service: Option, - /// Autoscaler configuration for the node pool specified in - /// desired_node_pool_id. If there is only one pool in the - /// cluster and desired_node_pool_id is not provided then - /// the change applies to that single node pool. - #[serde(rename="desiredNodePoolAutoscaling")] - pub desired_node_pool_autoscaling: Option, - /// The desired image type for the node pool. - /// NOTE: Set the "desired_node_pool" field as well. - #[serde(rename="desiredImageType")] - pub desired_image_type: Option, } impl Part for ClusterUpdate {} +/// This operation resource represents operations that may have happened or are +/// happening on the cluster. All fields are output only. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [zones clusters node pools rollback projects](struct.ProjectZoneClusterNodePoolRollbackCall.html) (response) +/// * [locations clusters node pools set autoscaling projects](struct.ProjectLocationClusterNodePoolSetAutoscalingCall.html) (response) +/// * [zones clusters node pools create projects](struct.ProjectZoneClusterNodePoolCreateCall.html) (response) +/// * [zones clusters monitoring projects](struct.ProjectZoneClusterMonitoringCall.html) (response) +/// * [locations clusters update projects](struct.ProjectLocationClusterUpdateCall.html) (response) +/// * [zones clusters delete projects](struct.ProjectZoneClusterDeleteCall.html) (response) +/// * [zones clusters legacy abac projects](struct.ProjectZoneClusterLegacyAbacCall.html) (response) +/// * [zones clusters addons projects](struct.ProjectZoneClusterAddonCall.html) (response) +/// * [locations clusters delete projects](struct.ProjectLocationClusterDeleteCall.html) (response) +/// * [locations clusters node pools delete projects](struct.ProjectLocationClusterNodePoolDeleteCall.html) (response) +/// * [zones clusters start ip rotation projects](struct.ProjectZoneClusterStartIpRotationCall.html) (response) +/// * [zones clusters create projects](struct.ProjectZoneClusterCreateCall.html) (response) +/// * [locations clusters set addons projects](struct.ProjectLocationClusterSetAddonCall.html) (response) +/// * [locations clusters complete ip rotation projects](struct.ProjectLocationClusterCompleteIpRotationCall.html) (response) +/// * [locations clusters node pools update projects](struct.ProjectLocationClusterNodePoolUpdateCall.html) (response) +/// * [locations clusters node pools set size projects](struct.ProjectLocationClusterNodePoolSetSizeCall.html) (response) +/// * [locations clusters set network policy projects](struct.ProjectLocationClusterSetNetworkPolicyCall.html) (response) +/// * [zones clusters node pools set management projects](struct.ProjectZoneClusterNodePoolSetManagementCall.html) (response) +/// * [zones operations get projects](struct.ProjectZoneOperationGetCall.html) (response) +/// * [locations clusters set monitoring projects](struct.ProjectLocationClusterSetMonitoringCall.html) (response) +/// * [locations clusters set locations projects](struct.ProjectLocationClusterSetLocationCall.html) (response) +/// * [zones clusters logging projects](struct.ProjectZoneClusterLoggingCall.html) (response) +/// * [zones clusters update projects](struct.ProjectZoneClusterUpdateCall.html) (response) +/// * [zones clusters node pools autoscaling projects](struct.ProjectZoneClusterNodePoolAutoscalingCall.html) (response) +/// * [zones clusters node pools set size projects](struct.ProjectZoneClusterNodePoolSetSizeCall.html) (response) +/// * [locations clusters set legacy abac projects](struct.ProjectLocationClusterSetLegacyAbacCall.html) (response) +/// * [locations clusters create projects](struct.ProjectLocationClusterCreateCall.html) (response) +/// * [locations clusters node pools set management projects](struct.ProjectLocationClusterNodePoolSetManagementCall.html) (response) +/// * [locations clusters update master projects](struct.ProjectLocationClusterUpdateMasterCall.html) (response) +/// * [zones clusters set maintenance policy projects](struct.ProjectZoneClusterSetMaintenancePolicyCall.html) (response) +/// * [locations clusters node pools rollback projects](struct.ProjectLocationClusterNodePoolRollbackCall.html) (response) +/// * [zones clusters node pools delete projects](struct.ProjectZoneClusterNodePoolDeleteCall.html) (response) +/// * [zones clusters locations projects](struct.ProjectZoneClusterLocationCall.html) (response) +/// * [locations clusters start ip rotation projects](struct.ProjectLocationClusterStartIpRotationCall.html) (response) +/// * [locations clusters set resource labels projects](struct.ProjectLocationClusterSetResourceLabelCall.html) (response) +/// * [locations clusters node pools create projects](struct.ProjectLocationClusterNodePoolCreateCall.html) (response) +/// * [zones clusters master projects](struct.ProjectZoneClusterMasterCall.html) (response) +/// * [zones clusters node pools update projects](struct.ProjectZoneClusterNodePoolUpdateCall.html) (response) +/// * [zones clusters set network policy projects](struct.ProjectZoneClusterSetNetworkPolicyCall.html) (response) +/// * [locations clusters set maintenance policy projects](struct.ProjectLocationClusterSetMaintenancePolicyCall.html) (response) +/// * [zones clusters set master auth projects](struct.ProjectZoneClusterSetMasterAuthCall.html) (response) +/// * [locations clusters set master auth projects](struct.ProjectLocationClusterSetMasterAuthCall.html) (response) +/// * [zones clusters complete ip rotation projects](struct.ProjectZoneClusterCompleteIpRotationCall.html) (response) +/// * [zones clusters resource labels projects](struct.ProjectZoneClusterResourceLabelCall.html) (response) +/// * [locations clusters set logging projects](struct.ProjectLocationClusterSetLoggingCall.html) (response) +/// * [locations operations get projects](struct.ProjectLocationOperationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The current status of the operation. + pub status: Option, + /// Server-defined URL for the resource. + #[serde(rename="selfLink")] + pub self_link: Option, + /// [Output only] The time the operation completed, in + /// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + #[serde(rename="endTime")] + pub end_time: Option, + /// The server-assigned ID for the operation. + pub name: Option, + /// The name of the Google Compute Engine + /// [zone](/compute/docs/zones#available) in which the operation + /// is taking place. + /// This field is deprecated, use location instead. + pub zone: Option, + /// Detailed operation progress, if available. + pub detail: Option, + /// The operation type. + #[serde(rename="operationType")] + pub operation_type: Option, + /// Server-defined URL for the target of the operation. + #[serde(rename="targetLink")] + pub target_link: Option, + /// [Output only] The name of the Google Compute Engine + /// [zone](/compute/docs/regions-zones/regions-zones#available) or + /// [region](/compute/docs/regions-zones/regions-zones#available) in which + /// the cluster resides. + pub location: Option, + /// [Output only] The time the operation started, in + /// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + #[serde(rename="startTime")] + pub start_time: Option, + /// Which conditions caused the current node pool state. + #[serde(rename="nodepoolConditions")] + pub nodepool_conditions: Option>, + /// If an error has occurred, a textual description of the error. + #[serde(rename="statusMessage")] + pub status_message: Option, + /// Which conditions caused the current cluster state. + #[serde(rename="clusterConditions")] + pub cluster_conditions: Option>, +} + +impl ResponseResult for Operation {} + + /// Kubernetes Engine service configuration. /// /// # Activities @@ -565,6 +669,14 @@ impl ResponseResult for ServerConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct NodeConfig { + /// The number of local SSD disks to be attached to the node. + /// + /// The limit for this value is dependant upon the maximum number of + /// disks available on a machine per zone. See: + /// https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits + /// for more information. + #[serde(rename="localSsdCount")] + pub local_ssd_count: Option, /// The name of a Google Compute Engine [machine /// type](/compute/docs/machine-types) (e.g. /// `n1-standard-1`). @@ -595,6 +707,11 @@ pub struct NodeConfig { /// no Service Account is specified, the "default" service account is used. #[serde(rename="serviceAccount")] pub service_account: Option, + /// List of kubernetes taints to be applied to each node. + /// + /// For more information, including usage and the valid values, see: + /// https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + pub taints: Option>, /// The set of Google API scopes to be made available on all of the /// node VMs under the "default" service account. /// @@ -611,11 +728,6 @@ pub struct NodeConfig { /// Monitoring are enabled, in which case their required scopes will be added. #[serde(rename="oauthScopes")] pub oauth_scopes: Option>, - /// Type of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd') - /// - /// If unspecified, the default disk type is 'pd-standard' - #[serde(rename="diskType")] - pub disk_type: Option, /// Size of the disk attached to each node, specified in GB. /// The smallest allowed disk size is 10GB. /// @@ -635,6 +747,15 @@ pub struct NodeConfig { /// platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform) #[serde(rename="minCpuPlatform")] pub min_cpu_platform: Option, + /// Type of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd') + /// + /// If unspecified, the default disk type is 'pd-standard' + #[serde(rename="diskType")] + pub disk_type: Option, + /// The image type to use for this node. Note that for a given image type, + /// the latest version of it will be used. + #[serde(rename="imageType")] + pub image_type: Option, /// The metadata key/value pairs assigned to instances in the cluster. /// /// Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes @@ -645,6 +766,7 @@ pub struct NodeConfig { /// "cluster-name" /// "cluster-uid" /// "configure-sh" + /// "containerd-configure-sh" /// "enable-os-login" /// "gci-update-strategy" /// "gci-ensure-gke-docker" @@ -659,18 +781,6 @@ pub struct NodeConfig { /// /// The total size of all keys and values must be less than 512 KB. pub metadata: Option>, - /// The image type to use for this node. Note that for a given image type, - /// the latest version of it will be used. - #[serde(rename="imageType")] - pub image_type: Option, - /// The number of local SSD disks to be attached to the node. - /// - /// The limit for this value is dependant upon the maximum number of - /// disks available on a machine per zone. See: - /// https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits - /// for more information. - #[serde(rename="localSsdCount")] - pub local_ssd_count: Option, } impl Part for NodeConfig {} @@ -871,20 +981,37 @@ pub struct MaintenancePolicy { impl Part for MaintenancePolicy {} -/// Configuration options for the NetworkPolicy feature. -/// https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ +/// CreateClusterRequest creates a cluster. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations clusters create projects](struct.ProjectLocationClusterCreateCall.html) (request) +/// * [zones clusters create projects](struct.ProjectZoneClusterCreateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NetworkPolicy { - /// Whether network policy is enabled on the cluster. - pub enabled: Option, - /// The selected network policy provider. - pub provider: Option, +pub struct CreateClusterRequest { + /// A [cluster + /// resource](/container-engine/reference/rest/v1/projects.zones.clusters) + pub cluster: Option, + /// The parent (project and location) where the cluster will be created. + /// Specified in the format 'projects/*/locations/*'. + pub parent: Option, + /// Deprecated. The name of the Google Compute Engine + /// [zone](/compute/docs/zones#available) in which the cluster + /// resides. + /// This field has been deprecated and replaced by the parent field. + pub zone: Option, + /// Deprecated. The Google Developers Console [project ID or project + /// number](https://support.google.com/cloud/answer/6158840). + /// This field has been deprecated and replaced by the parent field. + #[serde(rename="projectId")] + pub project_id: Option, } -impl Part for NetworkPolicy {} +impl RequestValue for CreateClusterRequest {} /// SetNodePoolManagementRequest sets the node management properties of a node @@ -929,6 +1056,37 @@ pub struct SetNodePoolManagementRequest { impl RequestValue for SetNodePoolManagementRequest {} +/// GetOpenIDConfigResponse is an OIDC discovery document for the cluster. +/// See the OpenID Connect Discovery 1.0 specification for details. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations clusters well-known get openid-configuration projects](struct.ProjectLocationClusterWell-knownGetOpenid-configurationCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetOpenIDConfigResponse { + /// NOLINT + pub id_token_signing_alg_values_supported: Option>, + /// NOLINT + pub claims_supported: Option>, + /// NOLINT + pub response_types_supported: Option>, + /// NOLINT + pub jwks_uri: Option, + /// NOLINT + pub grant_types: Option>, + /// NOLINT + pub subject_types_supported: Option>, + /// NOLINT + pub issuer: Option, +} + +impl ResponseResult for GetOpenIDConfigResponse {} + + /// Configuration options for the master authorized networks feature. Enabled /// master authorized networks will disallow all external traffic to access /// Kubernetes master through HTTPS except traffic from the given CIDR blocks, @@ -1016,51 +1174,20 @@ pub struct SetAddonsConfigRequest { impl RequestValue for SetAddonsConfigRequest {} -/// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container -/// Engine cluster, which will in turn set them for Google Compute Engine -/// resources used by that cluster +/// Configuration options for the HTTP (L7) load balancing controller addon, +/// which makes it easy to set up HTTP load balancers for services in a cluster. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations clusters set resource labels projects](struct.ProjectLocationClusterSetResourceLabelCall.html) (request) -/// * [zones clusters resource labels projects](struct.ProjectZoneClusterResourceLabelCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SetLabelsRequest { - /// The name (project, location, cluster id) of the cluster to set labels. - /// Specified in the format 'projects/*/locations/*/clusters/*'. - pub name: Option, - /// Deprecated. The name of the Google Compute Engine - /// [zone](/compute/docs/zones#available) in which the cluster - /// resides. - /// This field has been deprecated and replaced by the name field. - pub zone: Option, - /// Deprecated. The Google Developers Console [project ID or project - /// number](https://developers.google.com/console/help/new/#projectnumber). - /// This field has been deprecated and replaced by the name field. - #[serde(rename="projectId")] - pub project_id: Option, - /// The fingerprint of the previous set of labels for this resource, - /// used to detect conflicts. The fingerprint is initially generated by - /// Kubernetes Engine and changes after every request to modify or update - /// labels. You must always provide an up-to-date fingerprint hash when - /// updating or changing labels. Make a get() request to the - /// resource to get the latest fingerprint. - #[serde(rename="labelFingerprint")] - pub label_fingerprint: Option, - /// Deprecated. The name of the cluster. - /// This field has been deprecated and replaced by the name field. - #[serde(rename="clusterId")] - pub cluster_id: Option, - /// The labels to set for that cluster. - #[serde(rename="resourceLabels")] - pub resource_labels: Option>, +pub struct HttpLoadBalancing { + /// Whether the HTTP Load Balancing controller is enabled in the cluster. + /// When enabled, it runs a small pod in the cluster that manages the load + /// balancers. + pub disabled: Option, } -impl RequestValue for SetLabelsRequest {} +impl Part for HttpLoadBalancing {} /// Configuration for the legacy Attribute Based Access Control authorization @@ -1128,7 +1255,7 @@ pub struct SetLocationsRequest { #[serde(rename="clusterId")] pub cluster_id: Option, /// The desired list of Google Compute Engine - /// [locations](/compute/docs/zones#available) in which the cluster's nodes + /// [zones](/compute/docs/zones#available) in which the cluster's nodes /// should be located. Changing the locations a cluster is in will result /// in nodes being either created or removed from the cluster, depending on /// whether locations are being added or removed. @@ -1234,102 +1361,37 @@ pub struct ClientCertificateConfig { impl Part for ClientCertificateConfig {} -/// This operation resource represents operations that may have happened or are -/// happening on the cluster. All fields are output only. +/// CancelOperationRequest cancels a single operation. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [zones clusters node pools rollback projects](struct.ProjectZoneClusterNodePoolRollbackCall.html) (response) -/// * [locations clusters node pools set autoscaling projects](struct.ProjectLocationClusterNodePoolSetAutoscalingCall.html) (response) -/// * [zones clusters node pools create projects](struct.ProjectZoneClusterNodePoolCreateCall.html) (response) -/// * [zones clusters monitoring projects](struct.ProjectZoneClusterMonitoringCall.html) (response) -/// * [locations clusters update projects](struct.ProjectLocationClusterUpdateCall.html) (response) -/// * [zones clusters delete projects](struct.ProjectZoneClusterDeleteCall.html) (response) -/// * [zones clusters legacy abac projects](struct.ProjectZoneClusterLegacyAbacCall.html) (response) -/// * [zones clusters set master auth projects](struct.ProjectZoneClusterSetMasterAuthCall.html) (response) -/// * [locations clusters delete projects](struct.ProjectLocationClusterDeleteCall.html) (response) -/// * [locations clusters node pools delete projects](struct.ProjectLocationClusterNodePoolDeleteCall.html) (response) -/// * [zones clusters start ip rotation projects](struct.ProjectZoneClusterStartIpRotationCall.html) (response) -/// * [zones clusters create projects](struct.ProjectZoneClusterCreateCall.html) (response) -/// * [locations clusters set addons projects](struct.ProjectLocationClusterSetAddonCall.html) (response) -/// * [locations clusters complete ip rotation projects](struct.ProjectLocationClusterCompleteIpRotationCall.html) (response) -/// * [locations clusters node pools update projects](struct.ProjectLocationClusterNodePoolUpdateCall.html) (response) -/// * [locations clusters node pools set size projects](struct.ProjectLocationClusterNodePoolSetSizeCall.html) (response) -/// * [locations clusters set network policy projects](struct.ProjectLocationClusterSetNetworkPolicyCall.html) (response) -/// * [zones clusters node pools set management projects](struct.ProjectZoneClusterNodePoolSetManagementCall.html) (response) -/// * [zones operations get projects](struct.ProjectZoneOperationGetCall.html) (response) -/// * [locations clusters set monitoring projects](struct.ProjectLocationClusterSetMonitoringCall.html) (response) -/// * [locations clusters set locations projects](struct.ProjectLocationClusterSetLocationCall.html) (response) -/// * [zones clusters logging projects](struct.ProjectZoneClusterLoggingCall.html) (response) -/// * [zones clusters update projects](struct.ProjectZoneClusterUpdateCall.html) (response) -/// * [zones clusters node pools autoscaling projects](struct.ProjectZoneClusterNodePoolAutoscalingCall.html) (response) -/// * [zones clusters node pools set size projects](struct.ProjectZoneClusterNodePoolSetSizeCall.html) (response) -/// * [locations clusters set legacy abac projects](struct.ProjectLocationClusterSetLegacyAbacCall.html) (response) -/// * [locations clusters create projects](struct.ProjectLocationClusterCreateCall.html) (response) -/// * [locations clusters node pools set management projects](struct.ProjectLocationClusterNodePoolSetManagementCall.html) (response) -/// * [locations clusters update master projects](struct.ProjectLocationClusterUpdateMasterCall.html) (response) -/// * [zones clusters set maintenance policy projects](struct.ProjectZoneClusterSetMaintenancePolicyCall.html) (response) -/// * [locations clusters node pools rollback projects](struct.ProjectLocationClusterNodePoolRollbackCall.html) (response) -/// * [zones clusters node pools delete projects](struct.ProjectZoneClusterNodePoolDeleteCall.html) (response) -/// * [zones clusters locations projects](struct.ProjectZoneClusterLocationCall.html) (response) -/// * [locations clusters start ip rotation projects](struct.ProjectLocationClusterStartIpRotationCall.html) (response) -/// * [locations clusters set resource labels projects](struct.ProjectLocationClusterSetResourceLabelCall.html) (response) -/// * [locations clusters node pools create projects](struct.ProjectLocationClusterNodePoolCreateCall.html) (response) -/// * [zones clusters master projects](struct.ProjectZoneClusterMasterCall.html) (response) -/// * [zones clusters node pools update projects](struct.ProjectZoneClusterNodePoolUpdateCall.html) (response) -/// * [zones clusters set network policy projects](struct.ProjectZoneClusterSetNetworkPolicyCall.html) (response) -/// * [locations clusters set maintenance policy projects](struct.ProjectLocationClusterSetMaintenancePolicyCall.html) (response) -/// * [zones clusters addons projects](struct.ProjectZoneClusterAddonCall.html) (response) -/// * [locations clusters set master auth projects](struct.ProjectLocationClusterSetMasterAuthCall.html) (response) -/// * [zones clusters complete ip rotation projects](struct.ProjectZoneClusterCompleteIpRotationCall.html) (response) -/// * [zones clusters resource labels projects](struct.ProjectZoneClusterResourceLabelCall.html) (response) -/// * [locations clusters set logging projects](struct.ProjectLocationClusterSetLoggingCall.html) (response) -/// * [locations operations get projects](struct.ProjectLocationOperationGetCall.html) (response) +/// * [zones operations cancel projects](struct.ProjectZoneOperationCancelCall.html) (request) +/// * [locations operations cancel projects](struct.ProjectLocationOperationCancelCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// The current status of the operation. - pub status: Option, - /// If an error has occurred, a textual description of the error. - #[serde(rename="statusMessage")] - pub status_message: Option, - /// The server-assigned ID for the operation. +pub struct CancelOperationRequest { + /// Deprecated. The Google Developers Console [project ID or project + /// number](https://support.google.com/cloud/answer/6158840). + /// This field has been deprecated and replaced by the name field. + #[serde(rename="projectId")] + pub project_id: Option, + /// The name (project, location, operation id) of the operation to cancel. + /// Specified in the format 'projects/*/locations/*/operations/*'. pub name: Option, - /// The name of the Google Compute Engine - /// [zone](/compute/docs/zones#available) in which the operation - /// is taking place. - /// This field is deprecated, use location instead. + /// Deprecated. The name of the Google Compute Engine + /// [zone](/compute/docs/zones#available) in which the operation resides. + /// This field has been deprecated and replaced by the name field. pub zone: Option, - /// [Output only] The time the operation started, in - /// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - #[serde(rename="startTime")] - pub start_time: Option, - /// Detailed operation progress, if available. - pub detail: Option, - /// [Output only] The name of the Google Compute Engine - /// [zone](/compute/docs/regions-zones/regions-zones#available) or - /// [region](/compute/docs/regions-zones/regions-zones#available) in which - /// the cluster resides. - pub location: Option, - /// The operation type. - #[serde(rename="operationType")] - pub operation_type: Option, - /// [Output only] The time the operation completed, in - /// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - #[serde(rename="endTime")] - pub end_time: Option, - /// Server-defined URL for the resource. - #[serde(rename="selfLink")] - pub self_link: Option, - /// Server-defined URL for the target of the operation. - #[serde(rename="targetLink")] - pub target_link: Option, + /// Deprecated. The server-assigned `name` of the operation. + /// This field has been deprecated and replaced by the name field. + #[serde(rename="operationId")] + pub operation_id: Option, } -impl ResponseResult for Operation {} +impl RequestValue for CancelOperationRequest {} /// CompleteIPRotationRequest moves the cluster master back into single-IP mode. @@ -1366,20 +1428,51 @@ pub struct CompleteIPRotationRequest { impl RequestValue for CompleteIPRotationRequest {} -/// Configuration options for the HTTP (L7) load balancing controller addon, -/// which makes it easy to set up HTTP load balancers for services in a cluster. +/// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container +/// Engine cluster, which will in turn set them for Google Compute Engine +/// resources used by that cluster /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations clusters set resource labels projects](struct.ProjectLocationClusterSetResourceLabelCall.html) (request) +/// * [zones clusters resource labels projects](struct.ProjectZoneClusterResourceLabelCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct HttpLoadBalancing { - /// Whether the HTTP Load Balancing controller is enabled in the cluster. - /// When enabled, it runs a small pod in the cluster that manages the load - /// balancers. - pub disabled: Option, +pub struct SetLabelsRequest { + /// The name (project, location, cluster id) of the cluster to set labels. + /// Specified in the format 'projects/*/locations/*/clusters/*'. + pub name: Option, + /// Deprecated. The name of the Google Compute Engine + /// [zone](/compute/docs/zones#available) in which the cluster + /// resides. + /// This field has been deprecated and replaced by the name field. + pub zone: Option, + /// Deprecated. The Google Developers Console [project ID or project + /// number](https://developers.google.com/console/help/new/#projectnumber). + /// This field has been deprecated and replaced by the name field. + #[serde(rename="projectId")] + pub project_id: Option, + /// The fingerprint of the previous set of labels for this resource, + /// used to detect conflicts. The fingerprint is initially generated by + /// Kubernetes Engine and changes after every request to modify or update + /// labels. You must always provide an up-to-date fingerprint hash when + /// updating or changing labels. Make a get() request to the + /// resource to get the latest fingerprint. + #[serde(rename="labelFingerprint")] + pub label_fingerprint: Option, + /// Deprecated. The name of the cluster. + /// This field has been deprecated and replaced by the name field. + #[serde(rename="clusterId")] + pub cluster_id: Option, + /// The labels to set for that cluster. + #[serde(rename="resourceLabels")] + pub resource_labels: Option>, } -impl Part for HttpLoadBalancing {} +impl RequestValue for SetLabelsRequest {} /// ListClustersResponse is the result of ListClustersRequest. @@ -1394,13 +1487,13 @@ impl Part for HttpLoadBalancing {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListClustersResponse { + /// A list of clusters in the project in the specified zone, or + /// across all ones. + pub clusters: Option>, /// If any zones are listed here, the list of clusters returned /// may be missing those zones. #[serde(rename="missingZones")] pub missing_zones: Option>, - /// A list of clusters in the project in the specified zone, or - /// across all ones. - pub clusters: Option>, } impl ResponseResult for ListClustersResponse {} @@ -1443,6 +1536,38 @@ pub struct HorizontalPodAutoscaling { impl Part for HorizontalPodAutoscaling {} +/// Jwk is a JSON Web Key as specified in RFC 7517 +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Jwk { + /// NOLINT + #[serde(rename="use")] + pub use_: Option, + /// NOLINT + pub crv: Option, + /// NOLINT + pub kty: Option, + /// NOLINT + pub alg: Option, + /// Fields for RSA keys. + /// NOLINT + pub n: Option, + /// NOLINT + pub y: Option, + /// Fields for ECDSA keys. + /// NOLINT + pub x: Option, + /// NOLINT + pub e: Option, + /// NOLINT + pub kid: Option, +} + +impl Part for Jwk {} + + /// CreateNodePoolRequest creates a node pool for a cluster. /// /// # Activities @@ -1460,80 +1585,46 @@ pub struct CreateNodePoolRequest { /// This field has been deprecated and replaced by the parent field. #[serde(rename="projectId")] pub project_id: Option, + /// Deprecated. The name of the cluster. + /// This field has been deprecated and replaced by the parent field. + #[serde(rename="clusterId")] + pub cluster_id: Option, + /// The parent (project, location, cluster id) where the node pool will be + /// created. Specified in the format + /// 'projects/*/locations/*/clusters/*'. + pub parent: Option, /// Deprecated. The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// This field has been deprecated and replaced by the parent field. pub zone: Option, - /// Deprecated. The name of the cluster. - /// This field has been deprecated and replaced by the parent field. - #[serde(rename="clusterId")] - pub cluster_id: Option, /// The node pool to create. #[serde(rename="nodePool")] pub node_pool: Option, - /// The parent (project, location, cluster id) where the node pool will be - /// created. Specified in the format - /// 'projects/*/locations/*/clusters/*'. - pub parent: Option, } impl RequestValue for CreateNodePoolRequest {} -/// UpdateNodePoolRequests update a node pool's image and/or version. +/// Kubernetes taint is comprised of three fields: key, value, and effect. Effect +/// can only be one of three types: NoSchedule, PreferNoSchedule or NoExecute. /// -/// # Activities +/// For more information, including usage and the valid values, see: +/// https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ /// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [zones clusters node pools update projects](struct.ProjectZoneClusterNodePoolUpdateCall.html) (request) -/// * [locations clusters node pools update projects](struct.ProjectLocationClusterNodePoolUpdateCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateNodePoolRequest { - /// The name (project, location, cluster, node pool) of the node pool to - /// update. Specified in the format - /// 'projects/*/locations/*/clusters/*/nodePools/*'. - pub name: Option, - /// Deprecated. The name of the Google Compute Engine - /// [zone](/compute/docs/zones#available) in which the cluster - /// resides. - /// This field has been deprecated and replaced by the name field. - pub zone: Option, - /// Deprecated. The Google Developers Console [project ID or project - /// number](https://support.google.com/cloud/answer/6158840). - /// This field has been deprecated and replaced by the name field. - #[serde(rename="projectId")] - pub project_id: Option, - /// The Kubernetes version to change the nodes to (typically an - /// upgrade). - /// - /// Users may specify either explicit versions offered by Kubernetes Engine or - /// version aliases, which have the following behavior: - /// - /// - "latest": picks the highest valid Kubernetes version - /// - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - /// - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - /// - "1.X.Y-gke.N": picks an explicit Kubernetes version - /// - "-": picks the Kubernetes master version - #[serde(rename="nodeVersion")] - pub node_version: Option, - /// Deprecated. The name of the cluster to upgrade. - /// This field has been deprecated and replaced by the name field. - #[serde(rename="clusterId")] - pub cluster_id: Option, - /// The desired image type for the node pool. - #[serde(rename="imageType")] - pub image_type: Option, - /// Deprecated. The name of the node pool to upgrade. - /// This field has been deprecated and replaced by the name field. - #[serde(rename="nodePoolId")] - pub node_pool_id: Option, +pub struct NodeTaint { + /// Key for taint. + pub key: Option, + /// Effect for taint. + pub effect: Option, + /// Value for taint. + pub value: Option, } -impl RequestValue for UpdateNodePoolRequest {} +impl Part for NodeTaint {} /// SetLoggingServiceRequest sets the logging service of a cluster. @@ -1630,6 +1721,9 @@ impl ResponseResult for ListNodePoolsResponse {} pub struct NodePool { /// [Output only] The status of the nodes in this pool instance. pub status: Option, + /// [Output only] Server-defined URL for the resource. + #[serde(rename="selfLink")] + pub self_link: Option, /// NodeManagement configuration for this NodePool. pub management: Option, /// The name of the node pool. @@ -1650,51 +1744,49 @@ pub struct NodePool { /// firewall and routes quota. #[serde(rename="initialNodeCount")] pub initial_node_count: Option, + /// The node configuration of the pool. + pub config: Option, + /// Which conditions caused the current node pool state. + pub conditions: Option>, /// [Output only] Additional information about the current status of this /// node pool instance, if available. #[serde(rename="statusMessage")] pub status_message: Option, - /// The node configuration of the pool. - pub config: Option, - /// [Output only] Server-defined URL for the resource. - #[serde(rename="selfLink")] - pub self_link: Option, } impl ResponseResult for NodePool {} -/// CreateClusterRequest creates a cluster. +/// Configuration options for the NetworkPolicy feature. +/// https://kubernetes.io/docs/concepts/services-networking/networkpolicies/ /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations clusters create projects](struct.ProjectLocationClusterCreateCall.html) (request) -/// * [zones clusters create projects](struct.ProjectZoneClusterCreateCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateClusterRequest { - /// Deprecated. The Google Developers Console [project ID or project - /// number](https://support.google.com/cloud/answer/6158840). - /// This field has been deprecated and replaced by the parent field. - #[serde(rename="projectId")] - pub project_id: Option, - /// Deprecated. The name of the Google Compute Engine - /// [zone](/compute/docs/zones#available) in which the cluster - /// resides. - /// This field has been deprecated and replaced by the parent field. - pub zone: Option, - /// The parent (project and location) where the cluster will be created. - /// Specified in the format 'projects/*/locations/*'. - pub parent: Option, - /// A [cluster - /// resource](/container-engine/reference/rest/v1/projects.zones.clusters) - pub cluster: Option, +pub struct NetworkPolicy { + /// Whether network policy is enabled on the cluster. + pub enabled: Option, + /// The selected network policy provider. + pub provider: Option, } -impl RequestValue for CreateClusterRequest {} +impl Part for NetworkPolicy {} + + +/// StatusCondition describes why a cluster or a node pool has a certain status +/// (e.g., ERROR or DEGRADED). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StatusCondition { + /// Human-friendly representation of the condition + pub message: Option, + /// Machine-friendly representation of the condition + pub code: Option, +} + +impl Part for StatusCondition {} /// UpdateMasterRequest updates the master of the cluster. @@ -1779,11 +1871,6 @@ impl ResponseResult for ListOperationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetLegacyAbacRequest { - /// Deprecated. The Google Developers Console [project ID or project - /// number](https://support.google.com/cloud/answer/6158840). - /// This field has been deprecated and replaced by the name field. - #[serde(rename="projectId")] - pub project_id: Option, /// Deprecated. The name of the cluster to update. /// This field has been deprecated and replaced by the name field. #[serde(rename="clusterId")] @@ -1798,6 +1885,11 @@ pub struct SetLegacyAbacRequest { /// resides. /// This field has been deprecated and replaced by the name field. pub zone: Option, + /// Deprecated. The Google Developers Console [project ID or project + /// number](https://support.google.com/cloud/answer/6158840). + /// This field has been deprecated and replaced by the name field. + #[serde(rename="projectId")] + pub project_id: Option, } impl RequestValue for SetLegacyAbacRequest {} @@ -1852,8 +1944,8 @@ impl Part for NodePoolAutoscaling {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MasterAuth { /// The username to use for HTTP basic authentication to the master endpoint. - /// For clusters v1.6.0 and later, you can disable basic authentication by - /// providing an empty username. + /// For clusters v1.6.0 and later, basic authentication can be disabled by + /// leaving username unspecified (or setting it to the empty string). pub username: Option, /// The password to use for HTTP basic authentication to the master endpoint. /// Because the master endpoint is open to the Internet, you should create a @@ -1903,16 +1995,16 @@ pub struct UpdateClusterRequest { /// This field has been deprecated and replaced by the name field. #[serde(rename="clusterId")] pub cluster_id: Option, - /// A description of the update. - pub update: Option, + /// The name (project, location, cluster) of the cluster to update. + /// Specified in the format 'projects/*/locations/*/clusters/*'. + pub name: Option, /// Deprecated. The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// This field has been deprecated and replaced by the name field. pub zone: Option, - /// The name (project, location, cluster) of the cluster to update. - /// Specified in the format 'projects/*/locations/*/clusters/*'. - pub name: Option, + /// A description of the update. + pub update: Option, } impl RequestValue for UpdateClusterRequest {} @@ -1948,12 +2040,21 @@ pub struct Cluster { #[serde(rename="addonsConfig")] pub addons_config: Option, /// The list of Google Compute Engine - /// [locations](/compute/docs/zones#available) in which the cluster's nodes + /// [zones](/compute/docs/zones#available) in which the cluster's nodes /// should be located. pub locations: Option>, - /// Configuration for the legacy ABAC authorization mode. - #[serde(rename="legacyAbac")] - pub legacy_abac: Option, + /// Kubernetes alpha features are enabled on this cluster. This includes alpha + /// API groups (e.g. v1alpha1) and features that may not be production ready in + /// the kubernetes version of the master and nodes. + /// The cluster has no SLA for uptime and master/node upgrades are disabled. + /// Alpha enabled clusters are automatically deleted thirty days after + /// creation. + #[serde(rename="enableKubernetesAlpha")] + pub enable_kubernetes_alpha: Option, + /// The resource labels for the cluster to use to annotate any related + /// Google Compute Engine resources. + #[serde(rename="resourceLabels")] + pub resource_labels: Option>, /// The name of the Google Compute Engine /// [network](/compute/docs/networks-and-firewalls#networks) to which the /// cluster is connected. If left unspecified, the `default` network @@ -1973,30 +2074,30 @@ pub struct Cluster { /// Configuration for cluster networking. #[serde(rename="networkConfig")] pub network_config: Option, - /// Configuration for cluster IP allocation. - #[serde(rename="ipAllocationPolicy")] - pub ip_allocation_policy: Option, - /// [Output only] The name of the Google Compute Engine - /// [zone](/compute/docs/zones#available) in which the cluster - /// resides. - /// This field is deprecated, use location instead. - pub zone: Option, - /// [Output only] The IP address range of the Kubernetes services in - /// this cluster, in - /// [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - /// notation (e.g. `1.2.3.4/29`). Service addresses are - /// typically put in the last `/16` from the container CIDR. - #[serde(rename="servicesIpv4Cidr")] - pub services_ipv4_cidr: Option, - /// [Output only] Additional information about the current status of this - /// cluster, if available. - #[serde(rename="statusMessage")] - pub status_message: Option, + /// The name of this cluster. The name must be unique within this project + /// and zone, and can be up to 40 characters with the following restrictions: + /// + /// * Lowercase letters, numbers, and hyphens only. + /// * Must start with a letter. + /// * Must end with a number or a letter. + pub name: Option, /// [Output only] The name of the Google Compute Engine /// [zone](/compute/docs/regions-zones/regions-zones#available) or /// [region](/compute/docs/regions-zones/regions-zones#available) in which /// the cluster resides. pub location: Option, + /// Enable the ability to use Cloud TPUs in this cluster. + #[serde(rename="enableTpu")] + pub enable_tpu: Option, + /// Which conditions caused the current cluster state. + pub conditions: Option>, + /// [Output only] Additional information about the current status of this + /// cluster, if available. + #[serde(rename="statusMessage")] + pub status_message: Option, + /// Configuration for cluster IP allocation. + #[serde(rename="ipAllocationPolicy")] + pub ip_allocation_policy: Option, /// [Output only] The current status of this cluster. pub status: Option, /// An optional description of this cluster. @@ -2015,6 +2116,10 @@ pub struct Cluster { #[serde(rename="currentMasterVersion")] pub current_master_version: Option, /// The authentication information for accessing the master endpoint. + /// If unspecified, the defaults are used: + /// For clusters before v1.12, if master_auth is unspecified, `username` will + /// be set to "admin", a random password will be generated, and a client + /// certificate will be issued. #[serde(rename="masterAuth")] pub master_auth: Option, /// [Output only] The time the cluster will be automatically @@ -2058,24 +2163,18 @@ pub struct Cluster { /// See the `masterAuth` property of this resource for username and /// password information. pub endpoint: Option, - /// [Output only] The number of nodes currently in the cluster. + /// [Output only] The number of nodes currently in the cluster. Deprecated. + /// Call Kubernetes API directly to retrieve node information. #[serde(rename="currentNodeCount")] pub current_node_count: Option, - /// The name of this cluster. The name must be unique within this project - /// and zone, and can be up to 40 characters with the following restrictions: - /// - /// * Lowercase letters, numbers, and hyphens only. - /// * Must start with a letter. - /// * Must end with a number or a letter. - pub name: Option, - /// Kubernetes alpha features are enabled on this cluster. This includes alpha - /// API groups (e.g. v1alpha1) and features that may not be production ready in - /// the kubernetes version of the master and nodes. - /// The cluster has no SLA for uptime and master/node upgrades are disabled. - /// Alpha enabled clusters are automatically deleted thirty days after - /// creation. - #[serde(rename="enableKubernetesAlpha")] - pub enable_kubernetes_alpha: Option, + /// [Output only] The name of the Google Compute Engine + /// [zone](/compute/docs/zones#available) in which the cluster + /// resides. + /// This field is deprecated, use location instead. + pub zone: Option, + /// Configuration for the legacy ABAC authorization mode. + #[serde(rename="legacyAbac")] + pub legacy_abac: Option, /// The initial Kubernetes version for this cluster. Valid versions are those /// found in validMasterVersions returned by getServerConfig. The version can /// be upgraded over time; such upgrades are reflected in @@ -2113,13 +2212,21 @@ pub struct Cluster { /// [subnetwork](/compute/docs/subnetworks) to which the /// cluster is connected. pub subnetwork: Option, - /// The resource labels for the cluster to use to annotate any related - /// Google Compute Engine resources. - #[serde(rename="resourceLabels")] - pub resource_labels: Option>, + /// [Output only] The IP address range of the Kubernetes services in + /// this cluster, in + /// [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + /// notation (e.g. `1.2.3.4/29`). Service addresses are + /// typically put in the last `/16` from the container CIDR. + #[serde(rename="servicesIpv4Cidr")] + pub services_ipv4_cidr: Option, /// [Output only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, + /// [Output only] The IP address range of the Cloud TPUs in this cluster, in + /// [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + /// notation (e.g. `1.2.3.4/29`). + #[serde(rename="tpuIpv4CidrBlock")] + pub tpu_ipv4_cidr_block: Option, } impl ResponseResult for Cluster {} @@ -2184,17 +2291,17 @@ pub struct SetNetworkPolicyRequest { /// This field has been deprecated and replaced by the name field. #[serde(rename="clusterId")] pub cluster_id: Option, - /// Configuration options for the NetworkPolicy feature. - #[serde(rename="networkPolicy")] - pub network_policy: Option, + /// The name (project, location, cluster id) of the cluster to set networking + /// policy. Specified in the format 'projects/*/locations/*/clusters/*'. + pub name: Option, /// Deprecated. The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// This field has been deprecated and replaced by the name field. pub zone: Option, - /// The name (project, location, cluster id) of the cluster to set networking - /// policy. Specified in the format 'projects/*/locations/*/clusters/*'. - pub name: Option, + /// Configuration options for the NetworkPolicy feature. + #[serde(rename="networkPolicy")] + pub network_policy: Option, } impl RequestValue for SetNetworkPolicyRequest {} @@ -2276,6 +2383,23 @@ pub struct IPAllocationPolicy { /// to use. #[serde(rename="nodeIpv4CidrBlock")] pub node_ipv4_cidr_block: Option, + /// The IP address range of the Cloud TPUs in this cluster. If unspecified, a + /// range will be automatically chosen with the default size. + /// + /// This field is only applicable when `use_ip_aliases` is true. + /// + /// If unspecified, the range will use the default size. + /// + /// Set to /netmask (e.g. `/14`) to have a range chosen with a specific + /// netmask. + /// + /// Set to a + /// [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + /// notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. + /// `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range + /// to use. + #[serde(rename="tpuIpv4CidrBlock")] + pub tpu_ipv4_cidr_block: Option, /// This field is deprecated, use cluster_ipv4_cidr_block. #[serde(rename="clusterIpv4Cidr")] pub cluster_ipv4_cidr: Option, @@ -2301,37 +2425,23 @@ pub struct IPAllocationPolicy { impl Part for IPAllocationPolicy {} -/// CancelOperationRequest cancels a single operation. +/// GetJSONWebKeysResponse is a valid JSON Web Key Set as specififed in rfc 7517 /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [zones operations cancel projects](struct.ProjectZoneOperationCancelCall.html) (request) -/// * [locations operations cancel projects](struct.ProjectLocationOperationCancelCall.html) (request) +/// * [locations clusters get jwks projects](struct.ProjectLocationClusterGetJwkCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CancelOperationRequest { - /// Deprecated. The Google Developers Console [project ID or project - /// number](https://support.google.com/cloud/answer/6158840). - /// This field has been deprecated and replaced by the name field. - #[serde(rename="projectId")] - pub project_id: Option, - /// The name (project, location, operation id) of the operation to cancel. - /// Specified in the format 'projects/*/locations/*/operations/*'. - pub name: Option, - /// Deprecated. The name of the Google Compute Engine - /// [zone](/compute/docs/zones#available) in which the operation resides. - /// This field has been deprecated and replaced by the name field. - pub zone: Option, - /// Deprecated. The server-assigned `name` of the operation. - /// This field has been deprecated and replaced by the name field. - #[serde(rename="operationId")] - pub operation_id: Option, +pub struct GetJSONWebKeysResponse { + /// The public component of the keys used by the cluster to sign token + /// requests. + pub keys: Option>, } -impl RequestValue for CancelOperationRequest {} +impl ResponseResult for GetJSONWebKeysResponse {} /// SetNodePoolSizeRequest sets the size a node @@ -2425,6 +2535,61 @@ pub struct CidrBlock { impl Part for CidrBlock {} +/// UpdateNodePoolRequests update a node pool's image and/or version. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [zones clusters node pools update projects](struct.ProjectZoneClusterNodePoolUpdateCall.html) (request) +/// * [locations clusters node pools update projects](struct.ProjectLocationClusterNodePoolUpdateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UpdateNodePoolRequest { + /// The name (project, location, cluster, node pool) of the node pool to + /// update. Specified in the format + /// 'projects/*/locations/*/clusters/*/nodePools/*'. + pub name: Option, + /// Deprecated. The name of the Google Compute Engine + /// [zone](/compute/docs/zones#available) in which the cluster + /// resides. + /// This field has been deprecated and replaced by the name field. + pub zone: Option, + /// Deprecated. The Google Developers Console [project ID or project + /// number](https://support.google.com/cloud/answer/6158840). + /// This field has been deprecated and replaced by the name field. + #[serde(rename="projectId")] + pub project_id: Option, + /// The Kubernetes version to change the nodes to (typically an + /// upgrade). + /// + /// Users may specify either explicit versions offered by Kubernetes Engine or + /// version aliases, which have the following behavior: + /// + /// - "latest": picks the highest valid Kubernetes version + /// - "1.X": picks the highest valid patch+gke.N patch in the 1.X version + /// - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version + /// - "1.X.Y-gke.N": picks an explicit Kubernetes version + /// - "-": picks the Kubernetes master version + #[serde(rename="nodeVersion")] + pub node_version: Option, + /// Deprecated. The name of the cluster to upgrade. + /// This field has been deprecated and replaced by the name field. + #[serde(rename="clusterId")] + pub cluster_id: Option, + /// The desired image type for the node pool. + #[serde(rename="imageType")] + pub image_type: Option, + /// Deprecated. The name of the node pool to upgrade. + /// This field has been deprecated and replaced by the name field. + #[serde(rename="nodePoolId")] + pub node_pool_id: Option, +} + +impl RequestValue for UpdateNodePoolRequest {} + + // ################### // MethodBuilders ### @@ -2454,7 +2619,7 @@ impl Part for CidrBlock {} /// ::default(), None); /// let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `locations_clusters_complete_ip_rotation(...)`, `locations_clusters_create(...)`, `locations_clusters_delete(...)`, `locations_clusters_get(...)`, `locations_clusters_list(...)`, `locations_clusters_node_pools_create(...)`, `locations_clusters_node_pools_delete(...)`, `locations_clusters_node_pools_get(...)`, `locations_clusters_node_pools_list(...)`, `locations_clusters_node_pools_rollback(...)`, `locations_clusters_node_pools_set_autoscaling(...)`, `locations_clusters_node_pools_set_management(...)`, `locations_clusters_node_pools_set_size(...)`, `locations_clusters_node_pools_update(...)`, `locations_clusters_set_addons(...)`, `locations_clusters_set_legacy_abac(...)`, `locations_clusters_set_locations(...)`, `locations_clusters_set_logging(...)`, `locations_clusters_set_maintenance_policy(...)`, `locations_clusters_set_master_auth(...)`, `locations_clusters_set_monitoring(...)`, `locations_clusters_set_network_policy(...)`, `locations_clusters_set_resource_labels(...)`, `locations_clusters_start_ip_rotation(...)`, `locations_clusters_update(...)`, `locations_clusters_update_master(...)`, `locations_get_server_config(...)`, `locations_operations_cancel(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `zones_clusters_addons(...)`, `zones_clusters_complete_ip_rotation(...)`, `zones_clusters_create(...)`, `zones_clusters_delete(...)`, `zones_clusters_get(...)`, `zones_clusters_legacy_abac(...)`, `zones_clusters_list(...)`, `zones_clusters_locations(...)`, `zones_clusters_logging(...)`, `zones_clusters_master(...)`, `zones_clusters_monitoring(...)`, `zones_clusters_node_pools_autoscaling(...)`, `zones_clusters_node_pools_create(...)`, `zones_clusters_node_pools_delete(...)`, `zones_clusters_node_pools_get(...)`, `zones_clusters_node_pools_list(...)`, `zones_clusters_node_pools_rollback(...)`, `zones_clusters_node_pools_set_management(...)`, `zones_clusters_node_pools_set_size(...)`, `zones_clusters_node_pools_update(...)`, `zones_clusters_resource_labels(...)`, `zones_clusters_set_maintenance_policy(...)`, `zones_clusters_set_master_auth(...)`, `zones_clusters_set_network_policy(...)`, `zones_clusters_start_ip_rotation(...)`, `zones_clusters_update(...)`, `zones_get_serverconfig(...)`, `zones_operations_cancel(...)`, `zones_operations_get(...)` and `zones_operations_list(...)` +/// // like `locations_clusters_complete_ip_rotation(...)`, `locations_clusters_create(...)`, `locations_clusters_delete(...)`, `locations_clusters_get(...)`, `locations_clusters_get_jwks(...)`, `locations_clusters_list(...)`, `locations_clusters_node_pools_create(...)`, `locations_clusters_node_pools_delete(...)`, `locations_clusters_node_pools_get(...)`, `locations_clusters_node_pools_list(...)`, `locations_clusters_node_pools_rollback(...)`, `locations_clusters_node_pools_set_autoscaling(...)`, `locations_clusters_node_pools_set_management(...)`, `locations_clusters_node_pools_set_size(...)`, `locations_clusters_node_pools_update(...)`, `locations_clusters_set_addons(...)`, `locations_clusters_set_legacy_abac(...)`, `locations_clusters_set_locations(...)`, `locations_clusters_set_logging(...)`, `locations_clusters_set_maintenance_policy(...)`, `locations_clusters_set_master_auth(...)`, `locations_clusters_set_monitoring(...)`, `locations_clusters_set_network_policy(...)`, `locations_clusters_set_resource_labels(...)`, `locations_clusters_start_ip_rotation(...)`, `locations_clusters_update(...)`, `locations_clusters_update_master(...)`, `locations_clusters_well_known_get_openid_configuration(...)`, `locations_get_server_config(...)`, `locations_operations_cancel(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `zones_clusters_addons(...)`, `zones_clusters_complete_ip_rotation(...)`, `zones_clusters_create(...)`, `zones_clusters_delete(...)`, `zones_clusters_get(...)`, `zones_clusters_legacy_abac(...)`, `zones_clusters_list(...)`, `zones_clusters_locations(...)`, `zones_clusters_logging(...)`, `zones_clusters_master(...)`, `zones_clusters_monitoring(...)`, `zones_clusters_node_pools_autoscaling(...)`, `zones_clusters_node_pools_create(...)`, `zones_clusters_node_pools_delete(...)`, `zones_clusters_node_pools_get(...)`, `zones_clusters_node_pools_list(...)`, `zones_clusters_node_pools_rollback(...)`, `zones_clusters_node_pools_set_management(...)`, `zones_clusters_node_pools_set_size(...)`, `zones_clusters_node_pools_update(...)`, `zones_clusters_resource_labels(...)`, `zones_clusters_set_maintenance_policy(...)`, `zones_clusters_set_master_auth(...)`, `zones_clusters_set_network_policy(...)`, `zones_clusters_start_ip_rotation(...)`, `zones_clusters_update(...)`, `zones_get_serverconfig(...)`, `zones_operations_cancel(...)`, `zones_operations_get(...)` and `zones_operations_list(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -2721,6 +2886,27 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// GetJSONWebKeys gets the public component of the cluster signing keys in + /// JSON Web Key format. + /// This API is not yet intended for general use, and is not available for all + /// clusters. + /// + /// # Arguments + /// + /// * `parent` - The cluster (project, location, cluster id) to get keys for. Specified in + /// the format 'projects/*/locations/*/clusters/*'. + pub fn locations_clusters_get_jwks(&self, parent: &str) -> ProjectLocationClusterGetJwkCall<'a, C, A> { + ProjectLocationClusterGetJwkCall { + hub: self.hub, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Enables or disables the ABAC authorization mechanism on a cluster. @@ -2781,20 +2967,20 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists all clusters owned by a project in either the specified zone or all - /// zones. + /// GetOpenIDConfig gets the OIDC discovery document for the cluster. + /// See the OpenID Connect Discovery 1.0 specification for details. + /// https://openid.net/specs/openid-connect-discovery-1_0.html + /// This API is not yet intended for general use, and is not available for all + /// clusters. /// /// # Arguments /// - /// * `parent` - The parent (project and location) where the clusters will be listed. - /// Specified in the format 'projects/*/locations/*'. - /// Location "-" matches all zones and all regions. - pub fn locations_clusters_list(&self, parent: &str) -> ProjectLocationClusterListCall<'a, C, A> { - ProjectLocationClusterListCall { + /// * `parent` - The cluster (project, location, cluster id) to get the discovery document + /// for. Specified in the format 'projects/*/locations/*/clusters/*'. + pub fn locations_clusters_well_known_get_openid_configuration(&self, parent: &str) -> ProjectLocationClusterWell-knownGetOpenid-configurationCall<'a, C, A> { + ProjectLocationClusterWell-knownGetOpenid-configurationCall { hub: self.hub, _parent: parent.to_string(), - _zone: Default::default(), - _project_id: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2979,8 +3165,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `name` - The name (project and location) of the server config to get - /// Specified in the format 'projects/*/locations/*'. + /// * `name` - The name (project and location) of the server config to get, + /// specified in the format 'projects/*/locations/*'. pub fn locations_get_server_config(&self, name: &str) -> ProjectLocationGetServerConfigCall<'a, C, A> { ProjectLocationGetServerConfigCall { hub: self.hub, @@ -3404,6 +3590,28 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Lists all clusters owned by a project in either the specified zone or all + /// zones. + /// + /// # Arguments + /// + /// * `parent` - The parent (project and location) where the clusters will be listed. + /// Specified in the format 'projects/*/locations/*'. + /// Location "-" matches all zones and all regions. + pub fn locations_clusters_list(&self, parent: &str) -> ProjectLocationClusterListCall<'a, C, A> { + ProjectLocationClusterListCall { + hub: self.hub, + _parent: parent.to_string(), + _zone: Default::default(), + _project_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates the master for a specific cluster. @@ -4118,10 +4326,7 @@ impl<'a, C, A> ProjectZoneOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4153,7 +4358,7 @@ impl<'a, C, A> ProjectZoneOperationCancelCall<'a, C, A> where C: BorrowMut ProjectZoneOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C, A> where } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4425,10 +4630,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4460,7 +4662,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C, A> where request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4552,7 +4754,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4709,10 +4911,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4744,7 +4943,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4860,7 +5059,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5017,10 +5216,7 @@ impl<'a, C, A> ProjectZoneClusterMonitoringCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5052,7 +5248,7 @@ impl<'a, C, A> ProjectZoneClusterMonitoringCall<'a, C, A> where C: BorrowMut ProjectZoneClusterMonitoringCall<'a, C, A> where C: BorrowMut ProjectLocationClusterNodePoolGetCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5338,10 +5534,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolGetCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5361,7 +5554,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolGetCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5476,7 +5669,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolGetCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5633,7 +5826,7 @@ impl<'a, C, A> ProjectLocationClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationClusterDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5672,7 +5862,7 @@ impl<'a, C, A> ProjectLocationClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterNodePoolRollbackCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5973,7 +6160,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolRollbackCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6100,7 +6287,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolRollbackCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6263,10 +6450,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6286,7 +6470,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6574,7 +6755,7 @@ impl<'a, C, A> ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut ProjectZoneGetServerconfigCall<'a, C, A> { @@ -6674,7 +6855,7 @@ impl<'a, C, A> ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_clusters_get_jwks("parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationClusterGetJwkCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Container, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationClusterGetJwkCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationClusterGetJwkCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GetJSONWebKeysResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "container.projects.locations.clusters.getJwks", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/jwks"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The cluster (project, location, cluster id) to get keys for. Specified in + /// the format 'projects/*/locations/*/clusters/*'. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterGetJwkCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationClusterGetJwkCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationClusterGetJwkCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationClusterGetJwkCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Enables or disables the ABAC authorization mechanism on a cluster. /// /// A builder for the *zones.clusters.legacyAbac* method supported by a *project* resource. @@ -6831,10 +7264,7 @@ impl<'a, C, A> ProjectZoneClusterLegacyAbacCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6866,7 +7296,7 @@ impl<'a, C, A> ProjectZoneClusterLegacyAbacCall<'a, C, A> where C: BorrowMut ProjectZoneClusterLegacyAbacCall<'a, C, A> where C: BorrowMut ProjectZoneClusterAddonCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7174,7 +7601,7 @@ impl<'a, C, A> ProjectZoneClusterAddonCall<'a, C, A> where C: BorrowMut ProjectZoneClusterAddonCall<'a, C, A> where C: BorrowMut ProjectZoneClusterAddonCall<'a, C, A> where C: BorrowMut ProjectZoneClusterAddonCall<'a, C, A> where C: BorrowMut +pub struct ProjectLocationClusterWell-knownGetOpenid-configurationCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _parent: String, - _zone: Option, - _project_id: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectLocationClusterListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectLocationClusterWell-knownGetOpenid-configurationCall<'a, C, A> {} -impl<'a, C, A> ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectLocationClusterWell-knownGetOpenid-configurationCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListClustersResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GetOpenIDConfigResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -7399,17 +7825,11 @@ impl<'a, C, A> ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.locations.clusters.list", + dlg.begin(MethodInfo { id: "container.projects.locations.clusters.well-known.getOpenid-configuration", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); - if let Some(value) = self._zone { - params.push(("zone", value.to_string())); - } - if let Some(value) = self._project_id { - params.push(("projectId", value.to_string())); - } - for &field in ["alt", "parent", "zone", "projectId"].iter() { + for &field in ["alt", "parent"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -7421,7 +7841,7 @@ impl<'a, C, A> ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7474,7 +7891,7 @@ impl<'a, C, A> ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut ProjectLocationClusterListCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterWell-knownGetOpenid-configurationCall<'a, C, A> { self._parent = new_value.to_string(); self } - /// Deprecated. The name of the Google Compute Engine - /// [zone](/compute/docs/zones#available) in which the cluster - /// resides, or "-" for all zones. - /// This field has been deprecated and replaced by the parent field. - /// - /// Sets the *zone* query property to the given value. - pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C, A> { - self._zone = Some(new_value.to_string()); - self - } - /// Deprecated. The Google Developers Console [project ID or project - /// number](https://support.google.com/cloud/answer/6158840). - /// This field has been deprecated and replaced by the parent field. - /// - /// Sets the *project id* query property to the given value. - pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C, A> { - self._project_id = Some(new_value.to_string()); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationClusterListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationClusterWell-knownGetOpenid-configurationCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -7573,7 +7970,7 @@ impl<'a, C, A> ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationClusterListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectLocationClusterWell-knownGetOpenid-configurationCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -7609,7 +8006,7 @@ impl<'a, C, A> ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLocationClusterListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLocationClusterWell-knownGetOpenid-configurationCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -7714,7 +8111,7 @@ impl<'a, C, A> ProjectLocationClusterCompleteIpRotationCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7730,10 +8127,7 @@ impl<'a, C, A> ProjectLocationClusterCompleteIpRotationCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7765,7 +8159,7 @@ impl<'a, C, A> ProjectLocationClusterCompleteIpRotationCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7856,7 +8250,7 @@ impl<'a, C, A> ProjectLocationClusterCompleteIpRotationCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7932,10 +8326,10 @@ impl<'a, C, A> ProjectLocationClusterCompleteIpRotationCall<'a, C, A> where C: B /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_clusters_node_pools_delete("name") -/// .zone("sanctus") -/// .project_id("et") -/// .node_pool_id("amet") -/// .cluster_id("et") +/// .zone("eirmod") +/// .project_id("sanctus") +/// .node_pool_id("et") +/// .cluster_id("amet") /// .doit(); /// # } /// ``` @@ -8010,7 +8404,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolDeleteCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8026,10 +8420,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolDeleteCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8049,7 +8440,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolDeleteCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8164,7 +8555,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolDeleteCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8321,10 +8712,7 @@ impl<'a, C, A> ProjectZoneClusterStartIpRotationCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8356,7 +8744,7 @@ impl<'a, C, A> ProjectZoneClusterStartIpRotationCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8472,7 +8860,7 @@ impl<'a, C, A> ProjectZoneClusterStartIpRotationCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8548,7 +8936,7 @@ impl<'a, C, A> ProjectZoneClusterStartIpRotationCall<'a, C, A> where C: BorrowMu /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_clusters_get("name") -/// .zone("dolor") +/// .zone("sed") /// .project_id("dolor") /// .cluster_id("dolor") /// .doit(); @@ -8621,7 +9009,7 @@ impl<'a, C, A> ProjectLocationClusterGetCall<'a, C, A> where C: BorrowMut ProjectLocationClusterGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8660,7 +9045,7 @@ impl<'a, C, A> ProjectLocationClusterGetCall<'a, C, A> where C: BorrowMut ProjectLocationClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8968,7 +9350,7 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectLocationClusterSetAddonCall<'a, C, A> where C: BorrowMut ProjectLocationClusterSetAddonCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9265,7 +9644,7 @@ impl<'a, C, A> ProjectLocationClusterSetAddonCall<'a, C, A> where C: BorrowMut ProjectLocationClusterSetAddonCall<'a, C, A> where C: BorrowMut ProjectLocationClusterSetAddonCall<'a, C, A> where C: BorrowMut ProjectLocationClusterNodePoolListCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9521,10 +9900,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolListCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9544,7 +9920,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolListCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9650,7 +10026,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolListCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9726,8 +10102,8 @@ impl<'a, C, A> ProjectLocationClusterNodePoolListCall<'a, C, A> where C: BorrowM /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_get_server_config("name") -/// .zone("vero") -/// .project_id("diam") +/// .zone("sit") +/// .project_id("vero") /// .doit(); /// # } /// ``` @@ -9794,7 +10170,7 @@ impl<'a, C, A> ProjectLocationGetServerConfigCall<'a, C, A> where C: BorrowMut ProjectLocationGetServerConfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9833,7 +10206,7 @@ impl<'a, C, A> ProjectLocationGetServerConfigCall<'a, C, A> where C: BorrowMut ProjectLocationGetServerConfigCall<'a, C, A> where C: BorrowMut ProjectLocationGetServerConfigCall<'a, C, A> where C: BorrowMut ProjectLocationGetServerConfigCall<'a, C, A> where C: BorrowMut ProjectZoneClusterNodePoolListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10108,7 +10478,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterNodePoolListCall<'a, C, A> where C: BorrowMut ProjectLocationClusterNodePoolUpdateCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10377,10 +10747,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolUpdateCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10412,7 +10779,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolUpdateCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10504,7 +10871,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolUpdateCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10645,7 +11012,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetSizeCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10661,10 +11028,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetSizeCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10696,7 +11060,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetSizeCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10788,7 +11152,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetSizeCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10929,7 +11293,7 @@ impl<'a, C, A> ProjectLocationClusterSetNetworkPolicyCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10945,10 +11309,7 @@ impl<'a, C, A> ProjectLocationClusterSetNetworkPolicyCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10980,7 +11341,7 @@ impl<'a, C, A> ProjectLocationClusterSetNetworkPolicyCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11071,7 +11432,7 @@ impl<'a, C, A> ProjectLocationClusterSetNetworkPolicyCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11230,10 +11591,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11265,7 +11623,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11392,7 +11750,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11468,7 +11826,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().zones_operations_get("projectId", "zone", "operationId") -/// .name("takimata") +/// .name("consetetur") /// .doit(); /// # } /// ``` @@ -11547,10 +11905,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11570,7 +11925,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationClusterSetMonitoringCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11839,10 +12194,7 @@ impl<'a, C, A> ProjectLocationClusterSetMonitoringCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11874,7 +12226,7 @@ impl<'a, C, A> ProjectLocationClusterSetMonitoringCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11965,7 +12317,7 @@ impl<'a, C, A> ProjectLocationClusterSetMonitoringCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12106,7 +12458,7 @@ impl<'a, C, A> ProjectLocationClusterSetLocationCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12122,10 +12474,7 @@ impl<'a, C, A> ProjectLocationClusterSetLocationCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12157,7 +12506,7 @@ impl<'a, C, A> ProjectLocationClusterSetLocationCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12248,7 +12597,7 @@ impl<'a, C, A> ProjectLocationClusterSetLocationCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12405,10 +12754,7 @@ impl<'a, C, A> ProjectZoneClusterLoggingCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12440,7 +12786,7 @@ impl<'a, C, A> ProjectZoneClusterLoggingCall<'a, C, A> where C: BorrowMut ProjectZoneClusterLoggingCall<'a, C, A> where C: BorrowMut ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12748,7 +13091,7 @@ impl<'a, C, A> ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13041,7 +13381,7 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13337,7 +13674,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13464,7 +13801,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13623,10 +13960,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13658,7 +13992,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13785,7 +14119,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13926,7 +14260,7 @@ impl<'a, C, A> ProjectLocationClusterSetLegacyAbacCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -13942,10 +14276,7 @@ impl<'a, C, A> ProjectLocationClusterSetLegacyAbacCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13977,7 +14308,7 @@ impl<'a, C, A> ProjectLocationClusterSetLegacyAbacCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14068,7 +14399,7 @@ impl<'a, C, A> ProjectLocationClusterSetLegacyAbacCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14221,7 +14552,7 @@ impl<'a, C, A> ProjectLocationClusterCreateCall<'a, C, A> where C: BorrowMut ProjectLocationClusterCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14272,7 +14600,7 @@ impl<'a, C, A> ProjectLocationClusterCreateCall<'a, C, A> where C: BorrowMut ProjectLocationClusterCreateCall<'a, C, A> where C: BorrowMut ProjectLocationClusterNodePoolSetManagementCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -14520,10 +14848,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetManagementCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14555,7 +14880,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetManagementCall<'a, C, A> where C request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14647,7 +14972,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetManagementCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14695,6 +15020,286 @@ impl<'a, C, A> ProjectLocationClusterNodePoolSetManagementCall<'a, C, A> where C } +/// Lists all clusters owned by a project in either the specified zone or all +/// zones. +/// +/// A builder for the *locations.clusters.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_container1 as container1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use container1::Container; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_clusters_list("parent") +/// .zone("eos") +/// .project_id("tempor") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationClusterListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Container, + _parent: String, + _zone: Option, + _project_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationClusterListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationClusterListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListClustersResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "container.projects.locations.clusters.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._zone { + params.push(("zone", value.to_string())); + } + if let Some(value) = self._project_id { + params.push(("projectId", value.to_string())); + } + for &field in ["alt", "parent", "zone", "projectId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The parent (project and location) where the clusters will be listed. + /// Specified in the format 'projects/*/locations/*'. + /// Location "-" matches all zones and all regions. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Deprecated. The name of the Google Compute Engine + /// [zone](/compute/docs/zones#available) in which the cluster + /// resides, or "-" for all zones. + /// This field has been deprecated and replaced by the parent field. + /// + /// Sets the *zone* query property to the given value. + pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C, A> { + self._zone = Some(new_value.to_string()); + self + } + /// Deprecated. The Google Developers Console [project ID or project + /// number](https://support.google.com/cloud/answer/6158840). + /// This field has been deprecated and replaced by the parent field. + /// + /// Sets the *project id* query property to the given value. + pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C, A> { + self._project_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationClusterListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationClusterListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationClusterListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates the master for a specific cluster. /// /// A builder for the *locations.clusters.updateMaster* method supported by a *project* resource. @@ -14788,7 +15393,7 @@ impl<'a, C, A> ProjectLocationClusterUpdateMasterCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -14804,10 +15409,7 @@ impl<'a, C, A> ProjectLocationClusterUpdateMasterCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14839,7 +15441,7 @@ impl<'a, C, A> ProjectLocationClusterUpdateMasterCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14930,7 +15532,7 @@ impl<'a, C, A> ProjectLocationClusterUpdateMasterCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15087,10 +15689,7 @@ impl<'a, C, A> ProjectZoneClusterSetMaintenancePolicyCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15122,7 +15721,7 @@ impl<'a, C, A> ProjectZoneClusterSetMaintenancePolicyCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15235,7 +15834,7 @@ impl<'a, C, A> ProjectZoneClusterSetMaintenancePolicyCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15377,7 +15976,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolRollbackCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -15393,10 +15992,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolRollbackCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15428,7 +16024,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolRollbackCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15520,7 +16116,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolRollbackCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15661,7 +16257,7 @@ impl<'a, C, A> ProjectLocationClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectLocationClusterUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15712,7 +16305,7 @@ impl<'a, C, A> ProjectLocationClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectLocationClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectLocationClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterNodePoolDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15983,7 +16573,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16107,7 +16697,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16264,10 +16854,7 @@ impl<'a, C, A> ProjectZoneClusterLocationCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16299,7 +16886,7 @@ impl<'a, C, A> ProjectZoneClusterLocationCall<'a, C, A> where C: BorrowMut ProjectZoneClusterLocationCall<'a, C, A> where C: BorrowMut ProjectLocationClusterStartIpRotationCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -16572,10 +17159,7 @@ impl<'a, C, A> ProjectLocationClusterStartIpRotationCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16607,7 +17191,7 @@ impl<'a, C, A> ProjectLocationClusterStartIpRotationCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16698,7 +17282,7 @@ impl<'a, C, A> ProjectLocationClusterStartIpRotationCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16774,8 +17358,8 @@ impl<'a, C, A> ProjectLocationClusterStartIpRotationCall<'a, C, A> where C: Borr /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_operations_list("parent") -/// .zone("justo") -/// .project_id("est") +/// .zone("clita") +/// .project_id("invidunt") /// .doit(); /// # } /// ``` @@ -16842,7 +17426,7 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16881,7 +17462,7 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationClusterSetResourceLabelCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -17136,10 +17717,7 @@ impl<'a, C, A> ProjectLocationClusterSetResourceLabelCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17171,7 +17749,7 @@ impl<'a, C, A> ProjectLocationClusterSetResourceLabelCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17262,7 +17840,7 @@ impl<'a, C, A> ProjectLocationClusterSetResourceLabelCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17403,7 +17981,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolCreateCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -17419,10 +17997,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolCreateCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17454,7 +18029,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolCreateCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17546,7 +18121,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolCreateCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17622,7 +18197,7 @@ impl<'a, C, A> ProjectLocationClusterNodePoolCreateCall<'a, C, A> where C: Borro /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().zones_clusters_get("projectId", "zone", "clusterId") -/// .name("voluptua.") +/// .name("sed") /// .doit(); /// # } /// ``` @@ -17701,10 +18276,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17724,7 +18296,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterMasterCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18028,7 +18597,7 @@ impl<'a, C, A> ProjectZoneClusterMasterCall<'a, C, A> where C: BorrowMut ProjectZoneClusterMasterCall<'a, C, A> where C: BorrowMut ProjectZoneClusterNodePoolUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18338,7 +18904,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18465,7 +19031,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18622,10 +19188,7 @@ impl<'a, C, A> ProjectZoneClusterSetNetworkPolicyCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18657,7 +19220,7 @@ impl<'a, C, A> ProjectZoneClusterSetNetworkPolicyCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18773,7 +19336,7 @@ impl<'a, C, A> ProjectZoneClusterSetNetworkPolicyCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18914,7 +19477,7 @@ impl<'a, C, A> ProjectLocationClusterSetMaintenancePolicyCall<'a, C, A> where C: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -18930,10 +19493,7 @@ impl<'a, C, A> ProjectLocationClusterSetMaintenancePolicyCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18965,7 +19525,7 @@ impl<'a, C, A> ProjectLocationClusterSetMaintenancePolicyCall<'a, C, A> where C: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -19057,7 +19617,7 @@ impl<'a, C, A> ProjectLocationClusterSetMaintenancePolicyCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19133,7 +19693,7 @@ impl<'a, C, A> ProjectLocationClusterSetMaintenancePolicyCall<'a, C, A> where C: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().zones_clusters_node_pools_get("projectId", "zone", "clusterId", "nodePoolId") -/// .name("At") +/// .name("et") /// .doit(); /// # } /// ``` @@ -19214,10 +19774,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19237,7 +19794,7 @@ impl<'a, C, A> ProjectZoneClusterNodePoolGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterNodePoolGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterSetMasterAuthCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19555,7 +20109,7 @@ impl<'a, C, A> ProjectZoneClusterSetMasterAuthCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -19671,7 +20225,7 @@ impl<'a, C, A> ProjectZoneClusterSetMasterAuthCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19814,7 +20368,7 @@ impl<'a, C, A> ProjectLocationClusterSetMasterAuthCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -19830,10 +20384,7 @@ impl<'a, C, A> ProjectLocationClusterSetMasterAuthCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19865,7 +20416,7 @@ impl<'a, C, A> ProjectLocationClusterSetMasterAuthCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -19956,7 +20507,7 @@ impl<'a, C, A> ProjectLocationClusterSetMasterAuthCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20113,10 +20664,7 @@ impl<'a, C, A> ProjectZoneClusterCompleteIpRotationCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20148,7 +20696,7 @@ impl<'a, C, A> ProjectZoneClusterCompleteIpRotationCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20264,7 +20812,7 @@ impl<'a, C, A> ProjectZoneClusterCompleteIpRotationCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20421,10 +20969,7 @@ impl<'a, C, A> ProjectZoneClusterResourceLabelCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20456,7 +21001,7 @@ impl<'a, C, A> ProjectZoneClusterResourceLabelCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20572,7 +21117,7 @@ impl<'a, C, A> ProjectZoneClusterResourceLabelCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20713,7 +21258,7 @@ impl<'a, C, A> ProjectLocationClusterSetLoggingCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -20729,10 +21274,7 @@ impl<'a, C, A> ProjectLocationClusterSetLoggingCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20764,7 +21306,7 @@ impl<'a, C, A> ProjectLocationClusterSetLoggingCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20855,7 +21397,7 @@ impl<'a, C, A> ProjectLocationClusterSetLoggingCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20931,7 +21473,7 @@ impl<'a, C, A> ProjectLocationClusterSetLoggingCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().zones_operations_list("projectId", "zone") -/// .parent("amet.") +/// .parent("ut") /// .doit(); /// # } /// ``` @@ -21008,10 +21550,7 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21031,7 +21570,7 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21324,7 +21860,7 @@ impl<'a, C, A> ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21603,7 +22136,7 @@ impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut"] +description = "A complete library to interact with Container Analysis (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/containeranalysis1_beta1-cli" +homepage = "https://cloud.google.com/container-analysis/api/reference/rest/" +documentation = "http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli" +license = "MIT" +keywords = ["containeranalysis", "google", "cli"] +autobins = false + +[[bin]] +name = "containeranalysis1-beta1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-containeranalysis1_beta1] +path = "../containeranalysis1_beta1" +version = "1.0.8+20190401" diff --git a/gen/containeranalysis1_beta1-cli/LICENSE.md b/gen/containeranalysis1_beta1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/containeranalysis1_beta1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/containeranalysis1_beta1-cli/README.md b/gen/containeranalysis1_beta1-cli/README.md new file mode 100644 index 0000000000..d487e90bf3 --- /dev/null +++ b/gen/containeranalysis1_beta1-cli/README.md @@ -0,0 +1,137 @@ + +The `containeranalysis1-beta1` command-line interface *(CLI)* allows to use most features of the *Google Container Analysis* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Container Analysis* API can be found at the +[official documentation site](https://cloud.google.com/container-analysis/api/reference/rest/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-containeranalysis1_beta1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/containeranalysis1_beta1-cli). + +# Usage + +This documentation was generated from the *Container Analysis* API at revision *20190401*. The CLI is at version *1.0.8*. + +```bash +containeranalysis1-beta1 [options] + projects + notes-batch-create (-r )... [-p ]... [-o ] + notes-create (-r )... [-p ]... [-o ] + notes-delete [-p ]... [-o ] + notes-get [-p ]... [-o ] + notes-get-iam-policy (-r )... [-p ]... [-o ] + notes-list [-p ]... [-o ] + notes-occurrences-list [-p ]... [-o ] + notes-patch (-r )... [-p ]... [-o ] + notes-set-iam-policy (-r )... [-p ]... [-o ] + notes-test-iam-permissions (-r )... [-p ]... [-o ] + occurrences-batch-create (-r )... [-p ]... [-o ] + occurrences-create (-r )... [-p ]... [-o ] + occurrences-delete [-p ]... [-o ] + occurrences-get [-p ]... [-o ] + occurrences-get-iam-policy (-r )... [-p ]... [-o ] + occurrences-get-notes [-p ]... [-o ] + occurrences-get-vulnerability-summary [-p ]... [-o ] + occurrences-list [-p ]... [-o ] + occurrences-patch (-r )... [-p ]... [-o ] + occurrences-set-iam-policy (-r )... [-p ]... [-o ] + occurrences-test-iam-permissions (-r )... [-p ]... [-o ] + scan-configs-get [-p ]... [-o ] + scan-configs-list [-p ]... [-o ] + scan-configs-update (-r )... [-p ]... [-o ] + containeranalysis1-beta1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `containeranalysis1-beta1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/containeranalysis1-beta1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/containeranalysis1-beta1-secret.json`, assuming that the required *containeranalysis* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `containeranalysis1-beta1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/containeranalysis1_beta1-cli/mkdocs.yml b/gen/containeranalysis1_beta1-cli/mkdocs.yml new file mode 100644 index 0000000000..2fa13239b0 --- /dev/null +++ b/gen/containeranalysis1_beta1-cli/mkdocs.yml @@ -0,0 +1,40 @@ +site_name: Container Analysis v1.0.8+20190401 +site_url: http://byron.github.io/google-apis-rs/google-containeranalysis1_beta1-cli +site_description: A complete library to interact with Container Analysis (protocol v1beta1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/containeranalysis1_beta1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['projects_notes-batch-create.md', 'Projects', 'Notes Batch Create'] +- ['projects_notes-create.md', 'Projects', 'Notes Create'] +- ['projects_notes-delete.md', 'Projects', 'Notes Delete'] +- ['projects_notes-get.md', 'Projects', 'Notes Get'] +- ['projects_notes-get-iam-policy.md', 'Projects', 'Notes Get Iam Policy'] +- ['projects_notes-list.md', 'Projects', 'Notes List'] +- ['projects_notes-occurrences-list.md', 'Projects', 'Notes Occurrences List'] +- ['projects_notes-patch.md', 'Projects', 'Notes Patch'] +- ['projects_notes-set-iam-policy.md', 'Projects', 'Notes Set Iam Policy'] +- ['projects_notes-test-iam-permissions.md', 'Projects', 'Notes Test Iam Permissions'] +- ['projects_occurrences-batch-create.md', 'Projects', 'Occurrences Batch Create'] +- ['projects_occurrences-create.md', 'Projects', 'Occurrences Create'] +- ['projects_occurrences-delete.md', 'Projects', 'Occurrences Delete'] +- ['projects_occurrences-get.md', 'Projects', 'Occurrences Get'] +- ['projects_occurrences-get-iam-policy.md', 'Projects', 'Occurrences Get Iam Policy'] +- ['projects_occurrences-get-notes.md', 'Projects', 'Occurrences Get Notes'] +- ['projects_occurrences-get-vulnerability-summary.md', 'Projects', 'Occurrences Get Vulnerability Summary'] +- ['projects_occurrences-list.md', 'Projects', 'Occurrences List'] +- ['projects_occurrences-patch.md', 'Projects', 'Occurrences Patch'] +- ['projects_occurrences-set-iam-policy.md', 'Projects', 'Occurrences Set Iam Policy'] +- ['projects_occurrences-test-iam-permissions.md', 'Projects', 'Occurrences Test Iam Permissions'] +- ['projects_scan-configs-get.md', 'Projects', 'Scan Configs Get'] +- ['projects_scan-configs-list.md', 'Projects', 'Scan Configs List'] +- ['projects_scan-configs-update.md', 'Projects', 'Scan Configs Update'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/containeranalysis1_beta1-cli/src/cmn.rs b/gen/containeranalysis1_beta1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/containeranalysis1_beta1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/containeranalysis1_beta1-cli/src/main.rs b/gen/containeranalysis1_beta1-cli/src/main.rs new file mode 100644 index 0000000000..61f4068a2e --- /dev/null +++ b/gen/containeranalysis1_beta1-cli/src/main.rs @@ -0,0 +1,2903 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_containeranalysis1_beta1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::ContainerAnalysis>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _projects_notes_batch_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BatchCreateNotesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().notes_batch_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_notes_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "related-note-names" => Some(("relatedNoteNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "package.name" => Some(("package.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.cvss-score" => Some(("vulnerability.cvssScore", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "vulnerability.severity" => Some(("vulnerability.severity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployable.resource-uri" => Some(("deployable.resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "attestation-authority.hint.human-readable-name" => Some(("attestationAuthority.hint.humanReadableName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.builder-version" => Some(("build.builderVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.signature.public-key" => Some(("build.signature.publicKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.signature.key-type" => Some(("build.signature.keyType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.signature.key-id" => Some(("build.signature.keyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.signature.signature" => Some(("build.signature.signature", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "base-image.resource-url" => Some(("baseImage.resourceUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "base-image.fingerprint.v1-name" => Some(("baseImage.fingerprint.v1Name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "base-image.fingerprint.v2-name" => Some(("baseImage.fingerprint.v2Name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "base-image.fingerprint.v2-blob" => Some(("baseImage.fingerprint.v2Blob", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "expiration-time" => Some(("expirationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "long-description" => Some(("longDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "short-description" => Some(("shortDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "discovery.analysis-kind" => Some(("discovery.analysisKind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["analysis-kind", "attestation-authority", "base-image", "build", "builder-version", "create-time", "cvss-score", "deployable", "discovery", "expiration-time", "fingerprint", "hint", "human-readable-name", "key-id", "key-type", "kind", "long-description", "name", "package", "public-key", "related-note-names", "resource-uri", "resource-url", "severity", "short-description", "signature", "update-time", "v1-name", "v2-blob", "v2-name", "vulnerability"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Note = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().notes_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "note-id" => { + call = call.note_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["note-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_notes_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().notes_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_notes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().notes_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_notes_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().notes_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_notes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().notes_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_notes_occurrences_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().notes_occurrences_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_notes_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "related-note-names" => Some(("relatedNoteNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "package.name" => Some(("package.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.cvss-score" => Some(("vulnerability.cvssScore", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "vulnerability.severity" => Some(("vulnerability.severity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployable.resource-uri" => Some(("deployable.resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "attestation-authority.hint.human-readable-name" => Some(("attestationAuthority.hint.humanReadableName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.builder-version" => Some(("build.builderVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.signature.public-key" => Some(("build.signature.publicKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.signature.key-type" => Some(("build.signature.keyType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.signature.key-id" => Some(("build.signature.keyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.signature.signature" => Some(("build.signature.signature", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "base-image.resource-url" => Some(("baseImage.resourceUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "base-image.fingerprint.v1-name" => Some(("baseImage.fingerprint.v1Name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "base-image.fingerprint.v2-name" => Some(("baseImage.fingerprint.v2Name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "base-image.fingerprint.v2-blob" => Some(("baseImage.fingerprint.v2Blob", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "expiration-time" => Some(("expirationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "long-description" => Some(("longDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "short-description" => Some(("shortDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "discovery.analysis-kind" => Some(("discovery.analysisKind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["analysis-kind", "attestation-authority", "base-image", "build", "builder-version", "create-time", "cvss-score", "deployable", "discovery", "expiration-time", "fingerprint", "hint", "human-readable-name", "key-id", "key-type", "kind", "long-description", "name", "package", "public-key", "related-note-names", "resource-uri", "resource-url", "severity", "short-description", "signature", "update-time", "v1-name", "v2-blob", "v2-name", "vulnerability"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Note = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().notes_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_notes_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().notes_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_notes_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().notes_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_batch_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BatchCreateOccurrencesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().occurrences_batch_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "installation.installation.name" => Some(("installation.installation.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.cvss-score" => Some(("vulnerability.cvssScore", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "vulnerability.severity" => Some(("vulnerability.severity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.type" => Some(("vulnerability.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.effective-severity" => Some(("vulnerability.effectiveSeverity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.long-description" => Some(("vulnerability.longDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.short-description" => Some(("vulnerability.shortDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "discovered.discovered.last-analysis-time" => Some(("discovered.discovered.lastAnalysisTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "discovered.discovered.analysis-status" => Some(("discovered.discovered.analysisStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "discovered.discovered.analysis-status-error.message" => Some(("discovered.discovered.analysisStatusError.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "discovered.discovered.analysis-status-error.code" => Some(("discovered.discovered.analysisStatusError.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "discovered.discovered.continuous-analysis" => Some(("discovered.discovered.continuousAnalysis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attestation.attestation.pgp-signed-attestation.pgp-key-id" => Some(("attestation.attestation.pgpSignedAttestation.pgpKeyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attestation.attestation.pgp-signed-attestation.content-type" => Some(("attestation.attestation.pgpSignedAttestation.contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attestation.attestation.pgp-signed-attestation.signature" => Some(("attestation.attestation.pgpSignedAttestation.signature", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attestation.attestation.generic-signed-attestation.content-type" => Some(("attestation.attestation.genericSignedAttestation.contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attestation.attestation.generic-signed-attestation.serialized-payload" => Some(("attestation.attestation.genericSignedAttestation.serializedPayload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.start-time" => Some(("build.provenance.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.build-options" => Some(("build.provenance.buildOptions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "build.provenance.creator" => Some(("build.provenance.creator", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.project-id" => Some(("build.provenance.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.builder-version" => Some(("build.provenance.builderVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.id" => Some(("build.provenance.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.trigger-id" => Some(("build.provenance.triggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.artifact-storage-source-uri" => Some(("build.provenance.sourceProvenance.artifactStorageSourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.labels" => Some(("build.provenance.sourceProvenance.context.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "build.provenance.source-provenance.context.cloud-repo.alias-context.kind" => Some(("build.provenance.sourceProvenance.context.cloudRepo.aliasContext.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.cloud-repo.alias-context.name" => Some(("build.provenance.sourceProvenance.context.cloudRepo.aliasContext.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.cloud-repo.revision-id" => Some(("build.provenance.sourceProvenance.context.cloudRepo.revisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.cloud-repo.repo-id.project-repo-id.project-id" => Some(("build.provenance.sourceProvenance.context.cloudRepo.repoId.projectRepoId.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.cloud-repo.repo-id.project-repo-id.repo-name" => Some(("build.provenance.sourceProvenance.context.cloudRepo.repoId.projectRepoId.repoName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.cloud-repo.repo-id.uid" => Some(("build.provenance.sourceProvenance.context.cloudRepo.repoId.uid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.git.url" => Some(("build.provenance.sourceProvenance.context.git.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.git.revision-id" => Some(("build.provenance.sourceProvenance.context.git.revisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.gerrit.alias-context.kind" => Some(("build.provenance.sourceProvenance.context.gerrit.aliasContext.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.gerrit.alias-context.name" => Some(("build.provenance.sourceProvenance.context.gerrit.aliasContext.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.gerrit.revision-id" => Some(("build.provenance.sourceProvenance.context.gerrit.revisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.gerrit.gerrit-project" => Some(("build.provenance.sourceProvenance.context.gerrit.gerritProject", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.gerrit.host-uri" => Some(("build.provenance.sourceProvenance.context.gerrit.hostUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.end-time" => Some(("build.provenance.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.create-time" => Some(("build.provenance.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.logs-uri" => Some(("build.provenance.logsUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance-bytes" => Some(("build.provenanceBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.resource-uri" => Some(("deployment.deployment.resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "deployment.deployment.user-email" => Some(("deployment.deployment.userEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.address" => Some(("deployment.deployment.address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.platform" => Some(("deployment.deployment.platform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.deploy-time" => Some(("deployment.deployment.deployTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.undeploy-time" => Some(("deployment.deployment.undeployTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.config" => Some(("deployment.deployment.config", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remediation" => Some(("remediation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource.content-hash.type" => Some(("resource.contentHash.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource.content-hash.value" => Some(("resource.contentHash.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource.name" => Some(("resource.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource.uri" => Some(("resource.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "derived-image.derived-image.distance" => Some(("derivedImage.derivedImage.distance", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "derived-image.derived-image.base-resource-url" => Some(("derivedImage.derivedImage.baseResourceUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "derived-image.derived-image.fingerprint.v1-name" => Some(("derivedImage.derivedImage.fingerprint.v1Name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "derived-image.derived-image.fingerprint.v2-name" => Some(("derivedImage.derivedImage.fingerprint.v2Name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "derived-image.derived-image.fingerprint.v2-blob" => Some(("derivedImage.derivedImage.fingerprint.v2Blob", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "note-name" => Some(("noteName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "alias-context", "analysis-status", "analysis-status-error", "artifact-storage-source-uri", "attestation", "base-resource-url", "build", "build-options", "builder-version", "cloud-repo", "code", "config", "content-hash", "content-type", "context", "continuous-analysis", "create-time", "creator", "cvss-score", "deploy-time", "deployment", "derived-image", "discovered", "distance", "effective-severity", "end-time", "fingerprint", "generic-signed-attestation", "gerrit", "gerrit-project", "git", "host-uri", "id", "installation", "kind", "labels", "last-analysis-time", "logs-uri", "long-description", "message", "name", "note-name", "pgp-key-id", "pgp-signed-attestation", "platform", "project-id", "project-repo-id", "provenance", "provenance-bytes", "remediation", "repo-id", "repo-name", "resource", "resource-uri", "revision-id", "serialized-payload", "severity", "short-description", "signature", "source-provenance", "start-time", "trigger-id", "type", "uid", "undeploy-time", "update-time", "uri", "url", "user-email", "v1-name", "v2-blob", "v2-name", "value", "vulnerability"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Occurrence = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().occurrences_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().occurrences_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().occurrences_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().occurrences_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_get_notes(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().occurrences_get_notes(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_get_vulnerability_summary(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().occurrences_get_vulnerability_summary(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().occurrences_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "installation.installation.name" => Some(("installation.installation.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.cvss-score" => Some(("vulnerability.cvssScore", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "vulnerability.severity" => Some(("vulnerability.severity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.type" => Some(("vulnerability.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.effective-severity" => Some(("vulnerability.effectiveSeverity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.long-description" => Some(("vulnerability.longDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vulnerability.short-description" => Some(("vulnerability.shortDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "discovered.discovered.last-analysis-time" => Some(("discovered.discovered.lastAnalysisTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "discovered.discovered.analysis-status" => Some(("discovered.discovered.analysisStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "discovered.discovered.analysis-status-error.message" => Some(("discovered.discovered.analysisStatusError.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "discovered.discovered.analysis-status-error.code" => Some(("discovered.discovered.analysisStatusError.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "discovered.discovered.continuous-analysis" => Some(("discovered.discovered.continuousAnalysis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attestation.attestation.pgp-signed-attestation.pgp-key-id" => Some(("attestation.attestation.pgpSignedAttestation.pgpKeyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attestation.attestation.pgp-signed-attestation.content-type" => Some(("attestation.attestation.pgpSignedAttestation.contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attestation.attestation.pgp-signed-attestation.signature" => Some(("attestation.attestation.pgpSignedAttestation.signature", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attestation.attestation.generic-signed-attestation.content-type" => Some(("attestation.attestation.genericSignedAttestation.contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attestation.attestation.generic-signed-attestation.serialized-payload" => Some(("attestation.attestation.genericSignedAttestation.serializedPayload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.start-time" => Some(("build.provenance.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.build-options" => Some(("build.provenance.buildOptions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "build.provenance.creator" => Some(("build.provenance.creator", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.project-id" => Some(("build.provenance.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.builder-version" => Some(("build.provenance.builderVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.id" => Some(("build.provenance.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.trigger-id" => Some(("build.provenance.triggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.artifact-storage-source-uri" => Some(("build.provenance.sourceProvenance.artifactStorageSourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.labels" => Some(("build.provenance.sourceProvenance.context.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "build.provenance.source-provenance.context.cloud-repo.alias-context.kind" => Some(("build.provenance.sourceProvenance.context.cloudRepo.aliasContext.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.cloud-repo.alias-context.name" => Some(("build.provenance.sourceProvenance.context.cloudRepo.aliasContext.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.cloud-repo.revision-id" => Some(("build.provenance.sourceProvenance.context.cloudRepo.revisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.cloud-repo.repo-id.project-repo-id.project-id" => Some(("build.provenance.sourceProvenance.context.cloudRepo.repoId.projectRepoId.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.cloud-repo.repo-id.project-repo-id.repo-name" => Some(("build.provenance.sourceProvenance.context.cloudRepo.repoId.projectRepoId.repoName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.cloud-repo.repo-id.uid" => Some(("build.provenance.sourceProvenance.context.cloudRepo.repoId.uid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.git.url" => Some(("build.provenance.sourceProvenance.context.git.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.git.revision-id" => Some(("build.provenance.sourceProvenance.context.git.revisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.gerrit.alias-context.kind" => Some(("build.provenance.sourceProvenance.context.gerrit.aliasContext.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.gerrit.alias-context.name" => Some(("build.provenance.sourceProvenance.context.gerrit.aliasContext.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.gerrit.revision-id" => Some(("build.provenance.sourceProvenance.context.gerrit.revisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.gerrit.gerrit-project" => Some(("build.provenance.sourceProvenance.context.gerrit.gerritProject", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.source-provenance.context.gerrit.host-uri" => Some(("build.provenance.sourceProvenance.context.gerrit.hostUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.end-time" => Some(("build.provenance.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.create-time" => Some(("build.provenance.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance.logs-uri" => Some(("build.provenance.logsUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "build.provenance-bytes" => Some(("build.provenanceBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.resource-uri" => Some(("deployment.deployment.resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "deployment.deployment.user-email" => Some(("deployment.deployment.userEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.address" => Some(("deployment.deployment.address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.platform" => Some(("deployment.deployment.platform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.deploy-time" => Some(("deployment.deployment.deployTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.undeploy-time" => Some(("deployment.deployment.undeployTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployment.deployment.config" => Some(("deployment.deployment.config", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remediation" => Some(("remediation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource.content-hash.type" => Some(("resource.contentHash.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource.content-hash.value" => Some(("resource.contentHash.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource.name" => Some(("resource.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource.uri" => Some(("resource.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "derived-image.derived-image.distance" => Some(("derivedImage.derivedImage.distance", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "derived-image.derived-image.base-resource-url" => Some(("derivedImage.derivedImage.baseResourceUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "derived-image.derived-image.fingerprint.v1-name" => Some(("derivedImage.derivedImage.fingerprint.v1Name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "derived-image.derived-image.fingerprint.v2-name" => Some(("derivedImage.derivedImage.fingerprint.v2Name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "derived-image.derived-image.fingerprint.v2-blob" => Some(("derivedImage.derivedImage.fingerprint.v2Blob", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "note-name" => Some(("noteName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "alias-context", "analysis-status", "analysis-status-error", "artifact-storage-source-uri", "attestation", "base-resource-url", "build", "build-options", "builder-version", "cloud-repo", "code", "config", "content-hash", "content-type", "context", "continuous-analysis", "create-time", "creator", "cvss-score", "deploy-time", "deployment", "derived-image", "discovered", "distance", "effective-severity", "end-time", "fingerprint", "generic-signed-attestation", "gerrit", "gerrit-project", "git", "host-uri", "id", "installation", "kind", "labels", "last-analysis-time", "logs-uri", "long-description", "message", "name", "note-name", "pgp-key-id", "pgp-signed-attestation", "platform", "project-id", "project-repo-id", "provenance", "provenance-bytes", "remediation", "repo-id", "repo-name", "resource", "resource-uri", "revision-id", "serialized-payload", "severity", "short-description", "signature", "source-provenance", "start-time", "trigger-id", "type", "uid", "undeploy-time", "update-time", "uri", "url", "user-email", "v1-name", "v2-blob", "v2-name", "value", "vulnerability"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Occurrence = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().occurrences_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().occurrences_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_occurrences_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().occurrences_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_scan_configs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().scan_configs_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_scan_configs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().scan_configs_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_scan_configs_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled" => Some(("enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "enabled", "name", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ScanConfig = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().scan_configs_update(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("projects", Some(opt)) => { + match opt.subcommand() { + ("notes-batch-create", Some(opt)) => { + call_result = self._projects_notes_batch_create(opt, dry_run, &mut err); + }, + ("notes-create", Some(opt)) => { + call_result = self._projects_notes_create(opt, dry_run, &mut err); + }, + ("notes-delete", Some(opt)) => { + call_result = self._projects_notes_delete(opt, dry_run, &mut err); + }, + ("notes-get", Some(opt)) => { + call_result = self._projects_notes_get(opt, dry_run, &mut err); + }, + ("notes-get-iam-policy", Some(opt)) => { + call_result = self._projects_notes_get_iam_policy(opt, dry_run, &mut err); + }, + ("notes-list", Some(opt)) => { + call_result = self._projects_notes_list(opt, dry_run, &mut err); + }, + ("notes-occurrences-list", Some(opt)) => { + call_result = self._projects_notes_occurrences_list(opt, dry_run, &mut err); + }, + ("notes-patch", Some(opt)) => { + call_result = self._projects_notes_patch(opt, dry_run, &mut err); + }, + ("notes-set-iam-policy", Some(opt)) => { + call_result = self._projects_notes_set_iam_policy(opt, dry_run, &mut err); + }, + ("notes-test-iam-permissions", Some(opt)) => { + call_result = self._projects_notes_test_iam_permissions(opt, dry_run, &mut err); + }, + ("occurrences-batch-create", Some(opt)) => { + call_result = self._projects_occurrences_batch_create(opt, dry_run, &mut err); + }, + ("occurrences-create", Some(opt)) => { + call_result = self._projects_occurrences_create(opt, dry_run, &mut err); + }, + ("occurrences-delete", Some(opt)) => { + call_result = self._projects_occurrences_delete(opt, dry_run, &mut err); + }, + ("occurrences-get", Some(opt)) => { + call_result = self._projects_occurrences_get(opt, dry_run, &mut err); + }, + ("occurrences-get-iam-policy", Some(opt)) => { + call_result = self._projects_occurrences_get_iam_policy(opt, dry_run, &mut err); + }, + ("occurrences-get-notes", Some(opt)) => { + call_result = self._projects_occurrences_get_notes(opt, dry_run, &mut err); + }, + ("occurrences-get-vulnerability-summary", Some(opt)) => { + call_result = self._projects_occurrences_get_vulnerability_summary(opt, dry_run, &mut err); + }, + ("occurrences-list", Some(opt)) => { + call_result = self._projects_occurrences_list(opt, dry_run, &mut err); + }, + ("occurrences-patch", Some(opt)) => { + call_result = self._projects_occurrences_patch(opt, dry_run, &mut err); + }, + ("occurrences-set-iam-policy", Some(opt)) => { + call_result = self._projects_occurrences_set_iam_policy(opt, dry_run, &mut err); + }, + ("occurrences-test-iam-permissions", Some(opt)) => { + call_result = self._projects_occurrences_test_iam_permissions(opt, dry_run, &mut err); + }, + ("scan-configs-get", Some(opt)) => { + call_result = self._projects_scan_configs_get(opt, dry_run, &mut err); + }, + ("scan-configs-list", Some(opt)) => { + call_result = self._projects_scan_configs_list(opt, dry_run, &mut err); + }, + ("scan-configs-update", Some(opt)) => { + call_result = self._projects_scan_configs_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "containeranalysis1-beta1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "containeranalysis1-beta1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::ContainerAnalysis::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("projects", "methods: 'notes-batch-create', 'notes-create', 'notes-delete', 'notes-get', 'notes-get-iam-policy', 'notes-list', 'notes-occurrences-list', 'notes-patch', 'notes-set-iam-policy', 'notes-test-iam-permissions', 'occurrences-batch-create', 'occurrences-create', 'occurrences-delete', 'occurrences-get', 'occurrences-get-iam-policy', 'occurrences-get-notes', 'occurrences-get-vulnerability-summary', 'occurrences-list', 'occurrences-patch', 'occurrences-set-iam-policy', 'occurrences-test-iam-permissions', 'scan-configs-get', 'scan-configs-list' and 'scan-configs-update'", vec![ + ("notes-batch-create", + Some(r##"Creates new notes in batch."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_notes-batch-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the project in the form of `projects/[PROJECT_ID]`, under which + the notes are to be created."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("notes-create", + Some(r##"Creates a new note."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_notes-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the project in the form of `projects/[PROJECT_ID]`, under which + the note is to be created."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("notes-delete", + Some(r##"Deletes the specified note."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_notes-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the note in the form of + `projects/[PROVIDER_ID]/notes/[NOTE_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("notes-get", + Some(r##"Gets the specified note."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_notes-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the note in the form of + `projects/[PROVIDER_ID]/notes/[NOTE_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("notes-get-iam-policy", + Some(r##"Gets the access control policy for a note or an occurrence resource. + Requires `containeranalysis.notes.setIamPolicy` or + `containeranalysis.occurrences.setIamPolicy` permission if the resource is + a note or occurrence, respectively. + + The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + occurrences."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_notes-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("notes-list", + Some(r##"Lists notes for the specified project."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_notes-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the project to list notes for in the form of + `projects/[PROJECT_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("notes-occurrences-list", + Some(r##"Lists occurrences referencing the specified note. Provider projects can use + this method to get all occurrences across consumer projects referencing the + specified note."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_notes-occurrences-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the note to list occurrences for in the form of + `projects/[PROVIDER_ID]/notes/[NOTE_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("notes-patch", + Some(r##"Updates the specified note."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_notes-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the note in the form of + `projects/[PROVIDER_ID]/notes/[NOTE_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("notes-set-iam-policy", + Some(r##"Sets the access control policy on the specified note or occurrence. + Requires `containeranalysis.notes.setIamPolicy` or + `containeranalysis.occurrences.setIamPolicy` permission if the resource is + a note or an occurrence, respectively. + + The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + occurrences."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_notes-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("notes-test-iam-permissions", + Some(r##"Returns the permissions that a caller has on the specified note or + occurrence. Requires list permission on the project (for example, + `containeranalysis.notes.list`). + + The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + occurrences."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_notes-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-batch-create", + Some(r##"Creates new occurrences in batch."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-batch-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the project in the form of `projects/[PROJECT_ID]`, under which + the occurrences are to be created."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-create", + Some(r##"Creates a new occurrence."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the project in the form of `projects/[PROJECT_ID]`, under which + the occurrence is to be created."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-delete", + Some(r##"Deletes the specified occurrence. For example, use this method to delete an + occurrence when the occurrence is no longer applicable for the given + resource."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the occurrence in the form of + `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-get", + Some(r##"Gets the specified occurrence."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the occurrence in the form of + `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-get-iam-policy", + Some(r##"Gets the access control policy for a note or an occurrence resource. + Requires `containeranalysis.notes.setIamPolicy` or + `containeranalysis.occurrences.setIamPolicy` permission if the resource is + a note or occurrence, respectively. + + The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + occurrences."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-get-notes", + Some(r##"Gets the note attached to the specified occurrence. Consumer projects can + use this method to get a note that belongs to a provider project."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-get-notes", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the occurrence in the form of + `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-get-vulnerability-summary", + Some(r##"Gets a summary of the number and severity of occurrences."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-get-vulnerability-summary", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the project to get a vulnerability summary for in the form of + `projects/[PROJECT_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-list", + Some(r##"Lists occurrences for the specified project."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the project to list occurrences for in the form of + `projects/[PROJECT_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-patch", + Some(r##"Updates the specified occurrence."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the occurrence in the form of + `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-set-iam-policy", + Some(r##"Sets the access control policy on the specified note or occurrence. + Requires `containeranalysis.notes.setIamPolicy` or + `containeranalysis.occurrences.setIamPolicy` permission if the resource is + a note or an occurrence, respectively. + + The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + occurrences."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("occurrences-test-iam-permissions", + Some(r##"Returns the permissions that a caller has on the specified note or + occurrence. Requires list permission on the project (for example, + `containeranalysis.notes.list`). + + The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + occurrences."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_occurrences-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("scan-configs-get", + Some(r##"Gets the specified scan configuration."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_scan-configs-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the scan configuration in the form of + `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("scan-configs-list", + Some(r##"Lists scan configurations for the specified project."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_scan-configs-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the project to list scan configurations for in the form of + `projects/[PROJECT_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("scan-configs-update", + Some(r##"Updates the specified scan configuration."##), + "Details at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli/projects_scan-configs-update", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the scan configuration in the form of + `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("containeranalysis1-beta1") + .author("Sebastian Thiel ") + .version("1.0.8+20190401") + .about("An implementation of the Grafeas API, which stores, and enables querying and retrieval of critical metadata about all of your software artifacts.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_containeranalysis1_beta1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/containeranalysis1_beta1/Cargo.toml b/gen/containeranalysis1_beta1/Cargo.toml new file mode 100644 index 0000000000..5b78d84902 --- /dev/null +++ b/gen/containeranalysis1_beta1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-containeranalysis1_beta1" +version = "1.0.8+20190401" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Container Analysis (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/containeranalysis1_beta1" +homepage = "https://cloud.google.com/container-analysis/api/reference/rest/" +documentation = "https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401" +license = "MIT" +keywords = ["containeranalysis", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/containeranalysis1_beta1/LICENSE.md b/gen/containeranalysis1_beta1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/containeranalysis1_beta1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/containeranalysis1_beta1/README.md b/gen/containeranalysis1_beta1/README.md new file mode 100644 index 0000000000..61c8129dd3 --- /dev/null +++ b/gen/containeranalysis1_beta1/README.md @@ -0,0 +1,192 @@ + +The `google-containeranalysis1_beta1` library allows access to all features of the *Google Container Analysis* service. + +This documentation was generated from *Container Analysis* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *containeranalysis:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Container Analysis* *v1_beta1* API can be found at the +[official documentation site](https://cloud.google.com/container-analysis/api/reference/rest/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ContainerAnalysis.html) ... + +* projects + * [*notes batch create*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectNoteBatchCreateCall.html), [*notes create*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectNoteCreateCall.html), [*notes delete*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectNoteDeleteCall.html), [*notes get*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectNoteGetCall.html), [*notes get iam policy*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectNoteGetIamPolicyCall.html), [*notes list*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectNoteListCall.html), [*notes occurrences list*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectNoteOccurrenceListCall.html), [*notes patch*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectNotePatchCall.html), [*notes set iam policy*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectNoteSetIamPolicyCall.html), [*notes test iam permissions*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectNoteTestIamPermissionCall.html), [*occurrences batch create*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrenceBatchCreateCall.html), [*occurrences create*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrenceCreateCall.html), [*occurrences delete*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrenceDeleteCall.html), [*occurrences get*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrenceGetCall.html), [*occurrences get iam policy*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrenceGetIamPolicyCall.html), [*occurrences get notes*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrenceGetNoteCall.html), [*occurrences get vulnerability summary*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrenceGetVulnerabilitySummaryCall.html), [*occurrences list*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrenceListCall.html), [*occurrences patch*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrencePatchCall.html), [*occurrences set iam policy*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrenceSetIamPolicyCall.html), [*occurrences test iam permissions*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectOccurrenceTestIamPermissionCall.html), [*scan configs get*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectScanConfigGetCall.html), [*scan configs list*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectScanConfigListCall.html) and [*scan configs update*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ProjectScanConfigUpdateCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/struct.ContainerAnalysis.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.projects().notes_patch(...).doit() +let r = hub.projects().notes_create(...).doit() +let r = hub.projects().notes_get(...).doit() +let r = hub.projects().occurrences_get_notes(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-containeranalysis1_beta1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +use containeranalysis1_beta1::Note; +use containeranalysis1_beta1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use containeranalysis1_beta1::ContainerAnalysis; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = Note::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.projects().notes_patch(req, "name") + .update_mask("sit") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-containeranalysis1_beta1/1.0.8+20190401/google_containeranalysis1_beta1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **containeranalysis1_beta1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/containeranalysis1_beta1/src/cmn.rs b/gen/containeranalysis1_beta1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/containeranalysis1_beta1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/containeranalysis1_beta1/src/lib.rs b/gen/containeranalysis1_beta1/src/lib.rs new file mode 100644 index 0000000000..86a3380fc8 --- /dev/null +++ b/gen/containeranalysis1_beta1/src/lib.rs @@ -0,0 +1,9521 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Container Analysis* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *containeranalysis:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Container Analysis* *v1_beta1* API can be found at the +//! [official documentation site](https://cloud.google.com/container-analysis/api/reference/rest/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/containeranalysis1_beta1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.ContainerAnalysis.html) ... +//! +//! * projects +//! * [*notes batch create*](struct.ProjectNoteBatchCreateCall.html), [*notes create*](struct.ProjectNoteCreateCall.html), [*notes delete*](struct.ProjectNoteDeleteCall.html), [*notes get*](struct.ProjectNoteGetCall.html), [*notes get iam policy*](struct.ProjectNoteGetIamPolicyCall.html), [*notes list*](struct.ProjectNoteListCall.html), [*notes occurrences list*](struct.ProjectNoteOccurrenceListCall.html), [*notes patch*](struct.ProjectNotePatchCall.html), [*notes set iam policy*](struct.ProjectNoteSetIamPolicyCall.html), [*notes test iam permissions*](struct.ProjectNoteTestIamPermissionCall.html), [*occurrences batch create*](struct.ProjectOccurrenceBatchCreateCall.html), [*occurrences create*](struct.ProjectOccurrenceCreateCall.html), [*occurrences delete*](struct.ProjectOccurrenceDeleteCall.html), [*occurrences get*](struct.ProjectOccurrenceGetCall.html), [*occurrences get iam policy*](struct.ProjectOccurrenceGetIamPolicyCall.html), [*occurrences get notes*](struct.ProjectOccurrenceGetNoteCall.html), [*occurrences get vulnerability summary*](struct.ProjectOccurrenceGetVulnerabilitySummaryCall.html), [*occurrences list*](struct.ProjectOccurrenceListCall.html), [*occurrences patch*](struct.ProjectOccurrencePatchCall.html), [*occurrences set iam policy*](struct.ProjectOccurrenceSetIamPolicyCall.html), [*occurrences test iam permissions*](struct.ProjectOccurrenceTestIamPermissionCall.html), [*scan configs get*](struct.ProjectScanConfigGetCall.html), [*scan configs list*](struct.ProjectScanConfigListCall.html) and [*scan configs update*](struct.ProjectScanConfigUpdateCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.ContainerAnalysis.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().notes_patch(...).doit() +//! let r = hub.projects().notes_create(...).doit() +//! let r = hub.projects().notes_get(...).doit() +//! let r = hub.projects().occurrences_get_notes(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-containeranalysis1_beta1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +//! use containeranalysis1_beta1::Note; +//! use containeranalysis1_beta1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use containeranalysis1_beta1::ContainerAnalysis; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = Note::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.projects().notes_patch(req, "name") +//! .update_mask("sed") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all ContainerAnalysis related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::Note; +/// use containeranalysis1_beta1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use containeranalysis1_beta1::ContainerAnalysis; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Note::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_patch(req, "name") +/// .update_mask("dolores") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct ContainerAnalysis { + client: RefCell, + auth: RefCell
, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for ContainerAnalysis {} + +impl<'a, C, A> ContainerAnalysis + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> ContainerAnalysis { + ContainerAnalysis { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://containeranalysis.googleapis.com/".to_string(), + _root_url: "https://containeranalysis.googleapis.com/".to_string(), + } + } + + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://containeranalysis.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://containeranalysis.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// A scan configuration specifies whether Cloud components in a project have a +/// particular type of analysis being run. For example, it can configure whether +/// vulnerability scanning is being done on Docker images or not. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [scan configs get projects](struct.ProjectScanConfigGetCall.html) (response) +/// * [scan configs update projects](struct.ProjectScanConfigUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ScanConfig { + /// Output only. The time this scan config was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Whether the scan is enabled. + pub enabled: Option, + /// Output only. A human-readable description of what the scan configuration + /// does. + pub description: Option, + /// Output only. The time this scan config was created. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. The name of the scan configuration in the form of + /// `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`. + pub name: Option, +} + +impl RequestValue for ScanConfig {} +impl ResponseResult for ScanConfig {} + + +/// Basis describes the base image portion (Note) of the DockerImage +/// relationship. Linked occurrences are derived from this or an +/// equivalent image via: +/// FROM +/// Or an equivalent reference, e.g. a tag of the resource_url. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Basis { + /// Required. Immutable. The resource_url for the resource representing the + /// basis of associated occurrence images. + #[serde(rename="resourceUrl")] + pub resource_url: Option, + /// Required. Immutable. The fingerprint of the base image. + pub fingerprint: Option, +} + +impl Part for Basis {} + + +/// Identifies all appearances of this vulnerability in the package for a +/// specific distro/location. For example: glibc in +/// cpe:/o:debian:debian_linux:8 for versions 2.1 - 2.2 +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Detail { + /// The severity (eg: distro assigned severity) for this vulnerability. + #[serde(rename="severityName")] + pub severity_name: Option, + /// Required. The CPE URI in + /// [cpe format](https://cpe.mitre.org/specification/) in which the + /// vulnerability manifests. Examples include distro or storage location for + /// vulnerable jar. + #[serde(rename="cpeUri")] + pub cpe_uri: Option, + /// A vendor-specific description of this note. + pub description: Option, + /// The min version of the package in which the vulnerability exists. + #[serde(rename="minAffectedVersion")] + pub min_affected_version: Option, + /// Required. The name of the package where the vulnerability was found. + pub package: Option, + /// The type of package; whether native or non native(ruby gems, node.js + /// packages etc). + #[serde(rename="packageType")] + pub package_type: Option, + /// Whether this detail is obsolete. Occurrences are expected not to point to + /// obsolete details. + #[serde(rename="isObsolete")] + pub is_obsolete: Option, + /// The max version of the package in which the vulnerability exists. + #[serde(rename="maxAffectedVersion")] + pub max_affected_version: Option, + /// The fix for this specific package version. + #[serde(rename="fixedLocation")] + pub fixed_location: Option, +} + +impl Part for Detail {} + + +/// Metadata for any related URL information. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RelatedUrl { + /// Specific URL associated with the resource. + pub url: Option, + /// Label to describe usage of the URL. + pub label: Option, +} + +impl Part for RelatedUrl {} + + +/// Response for listing occurrences for a note. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notes occurrences list projects](struct.ProjectNoteOccurrenceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListNoteOccurrencesResponse { + /// Token to provide to skip to a particular spot in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The occurrences attached to the specified note. + pub occurrences: Option>, +} + +impl ResponseResult for ListNoteOccurrencesResponse {} + + +/// An attestation wrapper that uses the Grafeas `Signature` message. +/// This attestation must define the `serialized_payload` that the `signatures` +/// verify and any metadata necessary to interpret that plaintext. The +/// signatures should always be over the `serialized_payload` bytestring. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GenericSignedAttestation { + /// One or more signatures over `serialized_payload`. Verifier implementations + /// should consider this attestation message verified if at least one + /// `signature` verifies `serialized_payload`. See `Signature` in common.proto + /// for more details on signature structure and verification. + pub signatures: Option>, + /// Type (for example schema) of the attestation payload that was signed. + /// The verifier must ensure that the provided type is one that the verifier + /// supports, and that the attestation payload is a valid instantiation of that + /// type (for example by validating a JSON schema). + #[serde(rename="contentType")] + pub content_type: Option, + /// The serialized payload that is verified by one or more `signatures`. + /// The encoding and semantic meaning of this payload must match what is set in + /// `content_type`. + #[serde(rename="serializedPayload")] + pub serialized_payload: Option, +} + +impl Part for GenericSignedAttestation {} + + +/// Request to create occurrences in batch. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [occurrences batch create projects](struct.ProjectOccurrenceBatchCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchCreateOccurrencesRequest { + /// The occurrences to create. Max allowed length is 1000. + pub occurrences: Option>, +} + +impl RequestValue for BatchCreateOccurrencesRequest {} + + +/// An alias to a repo revision. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AliasContext { + /// The alias kind. + pub kind: Option, + /// The alias name. + pub name: Option, +} + +impl Part for AliasContext {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notes delete projects](struct.ProjectNoteDeleteCall.html) (response) +/// * [occurrences delete projects](struct.ProjectOccurrenceDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notes test iam permissions projects](struct.ProjectNoteTestIamPermissionCall.html) (response) +/// * [occurrences test iam permissions projects](struct.ProjectOccurrenceTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestIamPermissionsResponse {} + + +/// Container message for hash values. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Hash { + /// Required. The type of hash that was performed. + #[serde(rename="type")] + pub type_: Option, + /// Required. The hash value. + pub value: Option, +} + +impl Part for Hash {} + + +/// Request message for `SetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [occurrences set iam policy projects](struct.ProjectOccurrenceSetIamPolicyCall.html) (request) +/// * [notes set iam policy projects](struct.ProjectNoteSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetIamPolicyRequest { + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. + pub policy: Option, + /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + /// the fields in the mask will be modified. If no mask is provided, the + /// following default mask is used: + /// paths: "bindings, etag" + /// This field is only used by Cloud IAM. + #[serde(rename="updateMask")] + pub update_mask: Option, +} + +impl RequestValue for SetIamPolicyRequest {} + + +/// A GitSourceContext denotes a particular revision in a third party Git +/// repository (e.g., GitHub). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GitSourceContext { + /// Git repository URL. + pub url: Option, + /// Git commit hash. + #[serde(rename="revisionId")] + pub revision_id: Option, +} + +impl Part for GitSourceContext {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct KnowledgeBase { + /// A link to the KB in the Windows update catalog - + /// https://www.catalog.update.microsoft.com/ + pub url: Option, + /// The KB name (generally of the form KB[0-9]+ i.e. KB123456). + pub name: Option, +} + +impl Part for KnowledgeBase {} + + +/// A set of properties that uniquely identify a given Docker image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Fingerprint { + /// Required. The layer ID of the final layer in the Docker image's v1 + /// representation. + #[serde(rename="v1Name")] + pub v1_name: Option, + /// Required. The ordered list of v2 blobs that represent a given image. + #[serde(rename="v2Blob")] + pub v2_blob: Option>, + /// Output only. The name of the image's v2 blobs computed via: + /// [bottom] := v2_blobbottom := sha256(v2_blob[N] + " " + v2_name[N+1]) + /// Only the name of the final blob is kept. + #[serde(rename="v2Name")] + pub v2_name: Option, +} + +impl Part for Fingerprint {} + + +/// Response for listing scan configurations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [scan configs list projects](struct.ProjectScanConfigListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListScanConfigsResponse { + /// The next pagination token in the list response. It should be used as + /// `page_token` for the following request. An empty value means no more + /// results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The scan configurations requested. + #[serde(rename="scanConfigs")] + pub scan_configs: Option>, +} + +impl ResponseResult for ListScanConfigsResponse {} + + +/// Request message for `GetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notes get iam policy projects](struct.ProjectNoteGetIamPolicyCall.html) (request) +/// * [occurrences get iam policy projects](struct.ProjectOccurrenceGetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetIamPolicyRequest { _never_set: Option } + +impl RequestValue for GetIamPolicyRequest {} + + +/// This represents how a particular software package may be installed on a +/// system. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Installation { + /// Required. All of the places within the filesystem versions of this package + /// have been found. + pub location: Option>, + /// Output only. The name of the installed package. + pub name: Option, +} + +impl Part for Installation {} + + +/// Response for creating notes in batch. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notes batch create projects](struct.ProjectNoteBatchCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchCreateNotesResponse { + /// The notes that were created. + pub notes: Option>, +} + +impl ResponseResult for BatchCreateNotesResponse {} + + +/// Response for creating occurrences in batch. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [occurrences batch create projects](struct.ProjectOccurrenceBatchCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchCreateOccurrencesResponse { + /// The occurrences that were created. + pub occurrences: Option>, +} + +impl ResponseResult for BatchCreateOccurrencesResponse {} + + +/// A CloudRepoSourceContext denotes a particular revision in a Google Cloud +/// Source Repo. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CloudRepoSourceContext { + /// An alias, which may be a branch or tag. + #[serde(rename="aliasContext")] + pub alias_context: Option, + /// A revision ID. + #[serde(rename="revisionId")] + pub revision_id: Option, + /// The ID of the repo. + #[serde(rename="repoId")] + pub repo_id: Option, +} + +impl Part for CloudRepoSourceContext {} + + +/// A unique identifier for a Cloud Repo. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RepoId { + /// A combination of a project ID and a repo name. + #[serde(rename="projectRepoId")] + pub project_repo_id: Option, + /// A server-assigned, globally unique identifier. + pub uid: Option, +} + +impl Part for RepoId {} + + +/// A type of analysis that can be done for a resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notes patch projects](struct.ProjectNotePatchCall.html) (request|response) +/// * [notes create projects](struct.ProjectNoteCreateCall.html) (request|response) +/// * [notes get projects](struct.ProjectNoteGetCall.html) (response) +/// * [occurrences get notes projects](struct.ProjectOccurrenceGetNoteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Note { + /// Output only. The time this note was last updated. This field can be used as + /// a filter in list requests. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Other notes related to this note. + #[serde(rename="relatedNoteNames")] + pub related_note_names: Option>, + /// A detailed description of this note. + #[serde(rename="longDescription")] + pub long_description: Option, + /// A note describing something that can be deployed. + pub deployable: Option, + /// A one sentence description of this note. + #[serde(rename="shortDescription")] + pub short_description: Option, + /// Output only. The time this note was created. This field can be used as a + /// filter in list requests. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. The type of analysis. This field can be used as a filter in + /// list requests. + pub kind: Option, + /// Output only. The name of the note in the form of + /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + pub name: Option, + /// A note describing a package hosted by various package managers. + pub package: Option, + /// A note describing a package vulnerability. + pub vulnerability: Option, + /// URLs associated with this note. + #[serde(rename="relatedUrl")] + pub related_url: Option>, + /// A note describing an attestation role. + #[serde(rename="attestationAuthority")] + pub attestation_authority: Option, + /// A note describing build provenance for a verifiable build. + pub build: Option, + /// A note describing a base image. + #[serde(rename="baseImage")] + pub base_image: Option, + /// Time of expiration for this note. Empty if note does not expire. + #[serde(rename="expirationTime")] + pub expiration_time: Option, + /// A note describing the initial analysis of a resource. + pub discovery: Option, +} + +impl RequestValue for Note {} +impl ResponseResult for Note {} + + +/// Layer holds metadata specific to a layer of a Docker image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Layer { + /// The recovered arguments to the Dockerfile directive. + pub arguments: Option, + /// Required. The recovered Dockerfile directive used to construct this layer. + pub directive: Option, +} + +impl Part for Layer {} + + +/// A SourceContext referring to a Gerrit project. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GerritSourceContext { + /// An alias, which may be a branch or tag. + #[serde(rename="aliasContext")] + pub alias_context: Option, + /// A revision (commit) ID. + #[serde(rename="revisionId")] + pub revision_id: Option, + /// The full project name within the host. Projects may be nested, so + /// "project/subproject" is a valid project name. The "repo name" is the + /// hostURI/project. + #[serde(rename="gerritProject")] + pub gerrit_project: Option, + /// The URI of a running Gerrit instance. + #[serde(rename="hostUri")] + pub host_uri: Option, +} + +impl Part for GerritSourceContext {} + + +/// Details of a vulnerability Occurrence. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GrafeasV1beta1VulnerabilityDetails { + /// Output only. The CVSS score of this vulnerability. CVSS score is on a + /// scale of 0-10 where 0 indicates low severity and 10 indicates high + /// severity. + #[serde(rename="cvssScore")] + pub cvss_score: Option, + /// Output only. The note provider assigned Severity of the vulnerability. + pub severity: Option, + /// Output only. A one sentence description of this vulnerability. + #[serde(rename="shortDescription")] + pub short_description: Option, + /// Output only. A detailed description of this vulnerability. + #[serde(rename="longDescription")] + pub long_description: Option, + /// Output only. URLs related to this vulnerability. + #[serde(rename="relatedUrls")] + pub related_urls: Option>, + /// Required. The set of affected locations and their fixes (if available) + /// within the associated resource. + #[serde(rename="packageIssue")] + pub package_issue: Option>, + /// The distro assigned severity for this vulnerability when it is + /// available, and note provider assigned severity when distro has not yet + /// assigned a severity for this vulnerability. + #[serde(rename="effectiveSeverity")] + pub effective_severity: Option, + /// The type of package; whether native or non native(ruby gems, node.js + /// packages etc) + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for GrafeasV1beta1VulnerabilityDetails {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + +/// Note kind that represents a logical attestation "role" or "authority". For +/// example, an organization might have one `Authority` for "QA" and one for +/// "build". This note is intended to act strictly as a grouping mechanism for +/// the attached occurrences (Attestations). This grouping mechanism also +/// provides a security boundary, since IAM ACLs gate the ability for a principle +/// to attach an occurrence to a given note. It also provides a single point of +/// lookup to find all attached attestation occurrences, even if they don't all +/// live in the same project. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Authority { + /// Hint hints at the purpose of the attestation authority. + pub hint: Option, +} + +impl Part for Authority {} + + +/// Provides information about the analysis status of a discovered resource. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Discovered { + /// The last time continuous analysis was done for this resource. + /// Deprecated, do not use. + #[serde(rename="lastAnalysisTime")] + pub last_analysis_time: Option, + /// The status of discovery for the resource. + #[serde(rename="analysisStatus")] + pub analysis_status: Option, + /// When an error is encountered this will contain a LocalizedMessage under + /// details to show to the user. The LocalizedMessage is output only and + /// populated by the API. + #[serde(rename="analysisStatusError")] + pub analysis_status_error: Option, + /// Whether the resource is continuously analyzed. + #[serde(rename="continuousAnalysis")] + pub continuous_analysis: Option, +} + +impl Part for Discovered {} + + +/// Details of a discovery occurrence. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GrafeasV1beta1DiscoveryDetails { + /// Required. Analysis status for the discovered resource. + pub discovered: Option, +} + +impl Part for GrafeasV1beta1DiscoveryDetails {} + + +/// Details of a build occurrence. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GrafeasV1beta1BuildDetails { + /// Required. The actual provenance for the build. + pub provenance: Option, + /// Serialized JSON representation of the provenance, used in generating the + /// build signature in the corresponding build note. After verifying the + /// signature, `provenance_bytes` can be unmarshalled and compared to the + /// provenance to confirm that it is unchanged. A base64-encoded string + /// representation of the provenance bytes is used for the signature in order + /// to interoperate with openssl which expects this format for signature + /// verification. + /// + /// The serialized form is captured both to avoid ambiguity in how the + /// provenance is marshalled to json as well to prevent incompatibilities with + /// future changes. + #[serde(rename="provenanceBytes")] + pub provenance_bytes: Option, +} + +impl Part for GrafeasV1beta1BuildDetails {} + + +/// Provenance of a build. Contains all information needed to verify the full +/// details about the build from source to completion. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildProvenance { + /// Commands requested by the build. + pub commands: Option>, + /// Details of the Source input to the build. + #[serde(rename="sourceProvenance")] + pub source_provenance: Option, + /// Special options applied to this build. This is a catch-all field where + /// build providers can enter any desired additional details. + #[serde(rename="buildOptions")] + pub build_options: Option>, + /// E-mail address of the user who initiated this build. Note that this was the + /// user's e-mail address at the time the build was initiated; this address may + /// not represent the same end-user for all time. + pub creator: Option, + /// ID of the project. + #[serde(rename="projectId")] + pub project_id: Option, + /// Version string of the builder at the time this build was executed. + #[serde(rename="builderVersion")] + pub builder_version: Option, + /// Time at which the build was created. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output of the build. + #[serde(rename="builtArtifacts")] + pub built_artifacts: Option>, + /// Trigger identifier if the build was triggered automatically; empty if not. + #[serde(rename="triggerId")] + pub trigger_id: Option, + /// Time at which execution of the build was started. + #[serde(rename="startTime")] + pub start_time: Option, + /// Time at which execution of the build was finished. + #[serde(rename="endTime")] + pub end_time: Option, + /// Required. Unique identifier of the build. + pub id: Option, + /// URI where any logs for this provenance were written. + #[serde(rename="logsUri")] + pub logs_uri: Option, +} + +impl Part for BuildProvenance {} + + +/// Details of an attestation occurrence. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Details { + /// Required. Attestation for the resource. + pub attestation: Option, +} + +impl Part for Details {} + + +/// Details of a deployment occurrence. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GrafeasV1beta1DeploymentDetails { + /// Required. Deployment history for the resource. + pub deployment: Option, +} + +impl Part for GrafeasV1beta1DeploymentDetails {} + + +/// Request to create notes in batch. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notes batch create projects](struct.ProjectNoteBatchCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchCreateNotesRequest { + /// The notes to create. Max allowed length is 1000. + pub notes: Option>, +} + +impl RequestValue for BatchCreateNotesRequest {} + + +/// This submessage provides human-readable hints about the purpose of the +/// authority. Because the name of a note acts as its resource reference, it is +/// important to disambiguate the canonical name of the Note (which might be a +/// UUID for security purposes) from "readable" names more suitable for debug +/// output. Note that these hints should not be used to look up authorities in +/// security sensitive contexts, such as when looking up attestations to +/// verify. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Hint { + /// Required. The human readable name of this attestation authority, for + /// example "qa". + #[serde(rename="humanReadableName")] + pub human_readable_name: Option, +} + +impl Part for Hint {} + + +/// An attestation wrapper with a PGP-compatible signature. This message only +/// supports `ATTACHED` signatures, where the payload that is signed is included +/// alongside the signature itself in the same file. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PgpSignedAttestation { + /// The cryptographic fingerprint of the key used to generate the signature, + /// as output by, e.g. `gpg --list-keys`. This should be the version 4, full + /// 160-bit fingerprint, expressed as a 40 character hexidecimal string. See + /// https://tools.ietf.org/html/rfc4880#section-12.2 for details. + /// Implementations may choose to acknowledge "LONG", "SHORT", or other + /// abbreviated key IDs, but only the full fingerprint is guaranteed to work. + /// In gpg, the full fingerprint can be retrieved from the `fpr` field + /// returned when calling --list-keys with --with-colons. For example: + /// ``` + /// gpg --with-colons --with-fingerprint --force-v4-certs \ + /// --list-keys attester@example.com + /// tru::1:1513631572:0:3:1:5 + /// pub:...... + /// fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB: + /// ``` + /// Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`. + #[serde(rename="pgpKeyId")] + pub pgp_key_id: Option, + /// Type (for example schema) of the attestation payload that was signed. + /// The verifier must ensure that the provided type is one that the verifier + /// supports, and that the attestation payload is a valid instantiation of that + /// type (for example by validating a JSON schema). + #[serde(rename="contentType")] + pub content_type: Option, + /// Required. The raw content of the signature, as output by GNU Privacy Guard + /// (GPG) or equivalent. Since this message only supports attached signatures, + /// the payload that was signed must be attached. While the signature format + /// supported is dependent on the verification implementation, currently only + /// ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than + /// `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor + /// --output=signature.gpg payload.json` will create the signature content + /// expected in this field in `signature.gpg` for the `payload.json` + /// attestation payload. + pub signature: Option, +} + +impl Part for PgpSignedAttestation {} + + +/// A summary of how many vulnerability occurrences there are per resource and +/// severity type. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [occurrences get vulnerability summary projects](struct.ProjectOccurrenceGetVulnerabilitySummaryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VulnerabilityOccurrencesSummary { + /// A listing by resource of the number of fixable and total vulnerabilities. + pub counts: Option>, +} + +impl ResponseResult for VulnerabilityOccurrencesSummary {} + + +/// Selects a repo using a Google Cloud Platform project ID (e.g., +/// winged-cargo-31) and a repo name within that project. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ProjectRepoId { + /// The ID of the project. + #[serde(rename="projectId")] + pub project_id: Option, + /// The name of the repo. Leave empty for the default repo. + #[serde(rename="repoName")] + pub repo_name: Option, +} + +impl Part for ProjectRepoId {} + + +/// Source describes the location of the source used for the build. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Source { + /// If provided, the input binary artifacts for the build came from this + /// location. + #[serde(rename="artifactStorageSourceUri")] + pub artifact_storage_source_uri: Option, + /// Hash(es) of the build source, which can be used to verify that the original + /// source integrity was maintained in the build. + /// + /// The keys to this map are file paths used as build source and the values + /// contain the hash values for those files. + /// + /// If the build source came in a single package such as a gzipped tarfile + /// (.tar.gz), the FileHash will be for the single path to that file. + #[serde(rename="fileHashes")] + pub file_hashes: Option>, + /// If provided, some of the source code used for the build may be found in + /// these locations, in the case where the source repository had multiple + /// remotes or submodules. This list will not include the context specified in + /// the context field. + #[serde(rename="additionalContexts")] + pub additional_contexts: Option>, + /// If provided, the source code used for the build came from this location. + pub context: Option, +} + +impl Part for Source {} + + +/// Version contains structured information about the version of a package. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Version { + /// Used to correct mistakes in the version numbering scheme. + pub epoch: Option, + /// Required. Distinguishes between sentinel MIN/MAX versions and normal + /// versions. + pub kind: Option, + /// Required only when version kind is NORMAL. The main part of the version + /// name. + pub name: Option, + /// The iteration of the package build from the above version. + pub revision: Option, +} + +impl Part for Version {} + + +/// Note holding the version of the provider's builder and the signature of the +/// provenance message in the build details occurrence. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Build { + /// Required. Immutable. Version of the builder which produced this build. + #[serde(rename="builderVersion")] + pub builder_version: Option, + /// Signature of the build in occurrences pointing to this build note + /// containing build details. + pub signature: Option, +} + +impl Part for Build {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **JSON Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// **YAML Example** +/// +/// bindings: +/// - members: +/// - user:mike@example.com +/// - group:admins@example.com +/// - domain:google.com +/// - serviceAccount:my-other-app@appspot.gserviceaccount.com +/// role: roles/owner +/// - members: +/// - user:sean@example.com +/// role: roles/viewer +/// +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam/docs). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notes get iam policy projects](struct.ProjectNoteGetIamPolicyCall.html) (response) +/// * [occurrences set iam policy projects](struct.ProjectOccurrenceSetIamPolicyCall.html) (response) +/// * [notes set iam policy projects](struct.ProjectNoteSetIamPolicyCall.html) (response) +/// * [occurrences get iam policy projects](struct.ProjectOccurrenceGetIamPolicyCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, + /// Deprecated. + pub version: Option, +} + +impl ResponseResult for Policy {} + + +/// A note that indicates a type of analysis a provider would perform. This note +/// exists in a provider's project. A `Discovery` occurrence is created in a +/// consumer's project at the start of analysis. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Discovery { + /// Required. Immutable. The kind of analysis that is handled by this + /// discovery. + #[serde(rename="analysisKind")] + pub analysis_kind: Option, +} + +impl Part for Discovery {} + + +/// Response for listing occurrences. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [occurrences list projects](struct.ProjectOccurrenceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOccurrencesResponse { + /// The next pagination token in the list response. It should be used as + /// `page_token` for the following request. An empty value means no more + /// results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The occurrences requested. + pub occurrences: Option>, +} + +impl ResponseResult for ListOccurrencesResponse {} + + +/// Details of an image occurrence. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GrafeasV1beta1ImageDetails { + /// Required. Immutable. The child image derived from the base image. + #[serde(rename="derivedImage")] + pub derived_image: Option, +} + +impl Part for GrafeasV1beta1ImageDetails {} + + +/// Details of a package occurrence. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GrafeasV1beta1PackageDetails { + /// Required. Where the package was installed. + pub installation: Option, +} + +impl Part for GrafeasV1beta1PackageDetails {} + + +/// A SourceContext is a reference to a tree of files. A SourceContext together +/// with a path point to a unique revision of a single file or directory. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SourceContext { + /// A SourceContext referring to any third party Git repo (e.g., GitHub). + pub git: Option, + /// A SourceContext referring to a revision in a Google Cloud Source Repo. + #[serde(rename="cloudRepo")] + pub cloud_repo: Option, + /// Labels with user defined metadata. + pub labels: Option>, + /// A SourceContext referring to a Gerrit project. + pub gerrit: Option, +} + +impl Part for SourceContext {} + + +/// Derived describes the derived image portion (Occurrence) of the DockerImage +/// relationship. This image would be produced from a Dockerfile with FROM +/// . +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Derived { + /// Output only. The number of layers by which this image differs from the + /// associated image basis. + pub distance: Option, + /// Output only. This contains the base image URL for the derived image + /// occurrence. + #[serde(rename="baseResourceUrl")] + pub base_resource_url: Option, + /// This contains layer-specific metadata, if populated it has length + /// "distance" and is ordered with [distance] being the layer immediately + /// following the base image and [1] being the final layer. + #[serde(rename="layerInfo")] + pub layer_info: Option>, + /// Required. The fingerprint of the derived image. + pub fingerprint: Option, +} + +impl Part for Derived {} + + +/// Artifact describes a build product. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Artifact { + /// Hash or checksum value of a binary, or Docker Registry 2.0 digest of a + /// container. + pub checksum: Option, + /// Artifact ID, if any; for container images, this will be a URL by digest + /// like `gcr.io/projectID/imagename@sha256:123456`. + pub id: Option, + /// Related artifact names. This may be the path to a binary or jar file, or in + /// the case of a container build, the name used to push the container image to + /// Google Container Registry, as presented to `docker push`. Note that a + /// single Artifact ID can have multiple names, for example if two tags are + /// applied to one image. + pub names: Option>, +} + +impl Part for Artifact {} + + +/// Container message for hashes of byte content of files, used in source +/// messages to verify integrity of source input to the build. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileHashes { + /// Required. Collection of file hashes. + #[serde(rename="fileHash")] + pub file_hash: Option>, +} + +impl Part for FileHashes {} + + +/// The location of the vulnerability. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VulnerabilityLocation { + /// Required. The CPE URI in [cpe format](https://cpe.mitre.org/specification/) + /// format. Examples include distro or storage location for vulnerable jar. + #[serde(rename="cpeUri")] + pub cpe_uri: Option, + /// Required. The version of the package being described. + pub version: Option, + /// Required. The package being described. + pub package: Option, +} + +impl Part for VulnerabilityLocation {} + + +/// The period during which some deployable was active in a runtime. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Deployment { + /// Output only. Resource URI for the artifact being deployed taken from + /// the deployable field with the same name. + #[serde(rename="resourceUri")] + pub resource_uri: Option>, + /// Identity of the user that triggered this deployment. + #[serde(rename="userEmail")] + pub user_email: Option, + /// Required. Beginning of the lifetime of this deployment. + #[serde(rename="deployTime")] + pub deploy_time: Option, + /// Platform hosting this deployment. + pub platform: Option, + /// Address of the runtime element hosting this deployment. + pub address: Option, + /// End of the lifetime of this deployment. + #[serde(rename="undeployTime")] + pub undeploy_time: Option, + /// Configuration used to create this deployment. + pub config: Option, +} + +impl Part for Deployment {} + + +/// Message encapsulating the signature of the verified build. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildSignature { + /// Public key of the builder which can be used to verify that the related + /// findings are valid and unchanged. If `key_type` is empty, this defaults + /// to PEM encoded public keys. + /// + /// This field may be empty if `key_id` references an external key. + /// + /// For Cloud Build based signatures, this is a PEM encoded public + /// key. To verify the Cloud Build signature, place the contents of + /// this field into a file (public.pem). The signature field is base64-decoded + /// into its binary representation in signature.bin, and the provenance bytes + /// from `BuildDetails` are base64-decoded into a binary representation in + /// signed.bin. OpenSSL can then verify the signature: + /// `openssl sha256 -verify public.pem -signature signature.bin signed.bin` + #[serde(rename="publicKey")] + pub public_key: Option, + /// The type of the key, either stored in `public_key` or referenced in + /// `key_id`. + #[serde(rename="keyType")] + pub key_type: Option, + /// An ID for the key used to sign. This could be either an ID for the key + /// stored in `public_key` (such as the ID or fingerprint for a PGP key, or the + /// CN for a cert), or a reference to an external key (such as a reference to a + /// key in Cloud Key Management Service). + #[serde(rename="keyId")] + pub key_id: Option, + /// Required. Signature of the related `BuildProvenance`. In JSON, this is + /// base-64 encoded. + pub signature: Option, +} + +impl Part for BuildSignature {} + + +/// Provides the configuration for logging a type of permissions. +/// Example: +/// +/// { +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// } +/// ] +/// } +/// +/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting +/// foo@gmail.com from DATA_READ logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditLogConfig { + /// Specifies the identities that do not cause logging for this type of + /// permission. + /// Follows the same format of Binding.members. + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The log type that this config enables. + #[serde(rename="logType")] + pub log_type: Option, +} + +impl Part for AuditLogConfig {} + + +/// An entity that can have metadata. For example, a Docker image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceType { + /// The hash of the resource content. For example, the Docker digest. + #[serde(rename="contentHash")] + pub content_hash: Option, + /// The name of the resource. For example, the name of a Docker image - + /// "Debian". + pub name: Option, + /// Required. The unique URI of the resource. For example, + /// `https://gcr.io/project/image@sha256:foo` for a Docker image. + pub uri: Option, +} + +impl Part for ResourceType {} + + +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notes test iam permissions projects](struct.ProjectNoteTestIamPermissionCall.html) (request) +/// * [occurrences test iam permissions projects](struct.ProjectOccurrenceTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, +} + +impl RequestValue for TestIamPermissionsRequest {} + + +/// This represents a particular package that is distributed over various +/// channels. E.g., glibc (aka libc6) is distributed by many, at various +/// versions. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Package { + /// The various channels by which a package is distributed. + pub distribution: Option>, + /// Required. Immutable. The name of the package. + pub name: Option, +} + +impl Part for Package {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// Vulnerability provides metadata about a security vulnerability in a Note. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Vulnerability { + /// Windows details get their own format because the information format and + /// model don't match a normal detail. Specifically Windows updates are done as + /// patches, thus Windows vulnerabilities really are a missing package, rather + /// than a package being at an incorrect version. + #[serde(rename="windowsDetails")] + pub windows_details: Option>, + /// The CVSS score for this vulnerability. + #[serde(rename="cvssScore")] + pub cvss_score: Option, + /// All information about the package to specifically identify this + /// vulnerability. One entry per (version range and cpe_uri) the package + /// vulnerability has manifested in. + pub details: Option>, + /// Note provider assigned impact of the vulnerability. + pub severity: Option, +} + +impl Part for Vulnerability {} + + +/// Occurrence that represents a single "attestation". The authenticity of an +/// attestation can be verified using the attached signature. If the verifier +/// trusts the public key of the signer, then verifying the signature is +/// sufficient to establish trust. In this circumstance, the authority to which +/// this attestation is attached is primarily useful for look-up (how to find +/// this attestation if you already know the authority and artifact to be +/// verified) and intent (which authority was this attestation intended to sign +/// for). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Attestation { + /// A PGP signed attestation. + #[serde(rename="pgpSignedAttestation")] + pub pgp_signed_attestation: Option, + /// no description provided + #[serde(rename="genericSignedAttestation")] + pub generic_signed_attestation: Option, +} + +impl Part for Attestation {} + + +/// Command describes a step performed as part of the build pipeline. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Command { + /// The ID(s) of the command(s) that this command depends on. + #[serde(rename="waitFor")] + pub wait_for: Option>, + /// Required. Name of the command, as presented on the command line, or if the + /// command is packaged as a Docker container, as presented to `docker pull`. + pub name: Option, + /// Environment variables set before running this command. + pub env: Option>, + /// Command-line arguments used when executing this command. + pub args: Option>, + /// Optional unique identifier for this command, used in wait_for to reference + /// this command as a dependency. + pub id: Option, + /// Working directory (relative to project source root) used when running this + /// command. + pub dir: Option, +} + +impl Part for Command {} + + +/// This message wraps a location affected by a vulnerability and its +/// associated fix (if one is available). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PackageIssue { + /// Deprecated, use Details.effective_severity instead + /// The severity (e.g., distro assigned severity) for this vulnerability. + #[serde(rename="severityName")] + pub severity_name: Option, + /// Required. The location of the vulnerability. + #[serde(rename="affectedLocation")] + pub affected_location: Option, + /// The location of the available fix for vulnerability. + #[serde(rename="fixedLocation")] + pub fixed_location: Option, +} + +impl Part for PackageIssue {} + + +/// Verifiers (e.g. Kritis implementations) MUST verify signatures +/// with respect to the trust anchors defined in policy (e.g. a Kritis policy). +/// Typically this means that the verifier has been configured with a map from +/// `public_key_id` to public key material (and any required parameters, e.g. +/// signing algorithm). +/// +/// In particular, verification implementations MUST NOT treat the signature +/// `public_key_id` as anything more than a key lookup hint. The `public_key_id` +/// DOES NOT validate or authenticate a public key; it only provides a mechanism +/// for quickly selecting a public key ALREADY CONFIGURED on the verifier through +/// a trusted channel. Verification implementations MUST reject signatures in any +/// of the following circumstances: +/// * The `public_key_id` is not recognized by the verifier. +/// * The public key that `public_key_id` refers to does not verify the +/// signature with respect to the payload. +/// +/// The `signature` contents SHOULD NOT be "attached" (where the payload is +/// included with the serialized `signature` bytes). Verifiers MUST ignore any +/// "attached" payload and only verify signatures with respect to explicitly +/// provided payload (e.g. a `payload` field on the proto message that holds +/// this Signature, or the canonical serialization of the proto message that +/// holds this signature). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Signature { + /// The identifier for the public key that verifies this signature. + /// * The `public_key_id` is required. + /// * The `public_key_id` MUST be an RFC3986 conformant URI. + /// * When possible, the `public_key_id` SHOULD be an immutable reference, + /// such as a cryptographic digest. + /// + /// Examples of valid `public_key_id`s: + /// + /// OpenPGP V4 public key fingerprint: + /// * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" + /// See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more + /// details on this scheme. + /// + /// RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER + /// serialization): + /// * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" + /// * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5" + #[serde(rename="publicKeyId")] + pub public_key_id: Option, + /// The content of the signature, an opaque bytestring. + /// The payload that this signature verifies MUST be unambiguously provided + /// with the Signature during verification. A wrapper message might provide + /// the payload explicitly. Alternatively, a message might have a canonical + /// serialization that can always be unambiguously computed to derive the + /// payload. + pub signature: Option, +} + +impl Part for Signature {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WindowsDetail { + /// Required. The CPE URI in + /// [cpe format](https://cpe.mitre.org/specification/) in which the + /// vulnerability manifests. Examples include distro or storage location for + /// vulnerable jar. + #[serde(rename="cpeUri")] + pub cpe_uri: Option, + /// Required. The names of the KBs which have hotfixes to mitigate this + /// vulnerability. Note that there may be multiple hotfixes (and thus + /// multiple KBs) that mitigate a given vulnerability. Currently any listed + /// kb's presence is considered a fix. + #[serde(rename="fixingKbs")] + pub fixing_kbs: Option>, + /// The description of the vulnerability. + pub description: Option, + /// Required. The name of the vulnerability. + pub name: Option, +} + +impl Part for WindowsDetail {} + + +/// This represents a particular channel of distribution for a given package. +/// E.g., Debian's jessie-backports dpkg mirror. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Distribution { + /// Required. The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + /// denoting the package manager version distributing a package. + #[serde(rename="cpeUri")] + pub cpe_uri: Option, + /// A freeform string denoting the maintainer of this package. + pub maintainer: Option, + /// The distribution channel-specific description of this package. + pub description: Option, + /// The distribution channel-specific homepage for this package. + pub url: Option, + /// The latest available version of this package in this distribution channel. + #[serde(rename="latestVersion")] + pub latest_version: Option, + /// The CPU architecture for which packages in this distribution channel were + /// built. + pub architecture: Option, +} + +impl Part for Distribution {} + + +/// An occurrence of a particular package installation found within a system's +/// filesystem. E.g., glibc was found in `/var/lib/dpkg/status`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Location { + /// The path from which we gathered that this package/version is installed. + pub path: Option, + /// Required. The CPE URI in [CPE format](https://cpe.mitre.org/specification/) + /// denoting the package manager version distributing a package. + #[serde(rename="cpeUri")] + pub cpe_uri: Option, + /// The version installed at this location. + pub version: Option, +} + +impl Part for Location {} + + +/// An instance of an analysis type that has been found on a resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [occurrences create projects](struct.ProjectOccurrenceCreateCall.html) (request|response) +/// * [occurrences get projects](struct.ProjectOccurrenceGetCall.html) (response) +/// * [occurrences patch projects](struct.ProjectOccurrencePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Occurrence { + /// Output only. This explicitly denotes which of the occurrence details are + /// specified. This field can be used as a filter in list requests. + pub kind: Option, + /// Describes the installation of a package on the linked resource. + pub installation: Option, + /// Output only. The name of the occurrence in the form of + /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + pub name: Option, + /// Describes a security vulnerability. + pub vulnerability: Option, + /// Output only. The time this occurrence was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Describes when a resource was discovered. + pub discovered: Option, + /// Describes an attestation of an artifact. + pub attestation: Option
, + /// Describes a verifiable build. + pub build: Option, + /// Describes the deployment of an artifact on a runtime. + pub deployment: Option, + /// A description of actions that can be taken to remedy the note. + pub remediation: Option, + /// Required. Immutable. The resource for which the occurrence applies. + pub resource: Option, + /// Output only. The time this occurrence was created. + #[serde(rename="createTime")] + pub create_time: Option, + /// Describes how this resource derives from the basis in the associated + /// note. + #[serde(rename="derivedImage")] + pub derived_image: Option, + /// Required. Immutable. The analysis note associated with this occurrence, in + /// the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be + /// used as a filter in list requests. + #[serde(rename="noteName")] + pub note_name: Option, +} + +impl RequestValue for Occurrence {} +impl ResponseResult for Occurrence {} + + +/// Response for listing notes. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notes list projects](struct.ProjectNoteListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListNotesResponse { + /// The next pagination token in the list response. It should be used as + /// `page_token` for the following request. An empty value means no more + /// results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The notes requested. + pub notes: Option>, +} + +impl ResponseResult for ListNotesResponse {} + + +/// An artifact that can be deployed in some runtime. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Deployable { + /// Required. Resource URI for the artifact being deployed. + #[serde(rename="resourceUri")] + pub resource_uri: Option>, +} + +impl Part for Deployable {} + + +/// Specifies the audit configuration for a service. +/// The configuration determines which permission types are logged, and what +/// identities, if any, are exempted from logging. +/// An AuditConfig must have one or more AuditLogConfigs. +/// +/// If there are AuditConfigs for both `allServices` and a specific service, +/// the union of the two AuditConfigs is used for that service: the log_types +/// specified in each AuditConfig are enabled, and the exempted_members in each +/// AuditLogConfig are exempted. +/// +/// Example Policy with multiple AuditConfigs: +/// +/// { +/// "audit_configs": [ +/// { +/// "service": "allServices" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// }, +/// { +/// "log_type": "ADMIN_READ", +/// } +/// ] +/// }, +/// { +/// "service": "fooservice.googleapis.com" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// "exempted_members": [ +/// "user:bar@gmail.com" +/// ] +/// } +/// ] +/// } +/// ] +/// } +/// +/// For fooservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ +/// logging. It also exempts foo@gmail.com from DATA_READ logging, and +/// bar@gmail.com from DATA_WRITE logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditConfig { + /// The configuration for logging of each type of permission. + #[serde(rename="auditLogConfigs")] + pub audit_log_configs: Option>, + /// Specifies a service that will be enabled for audit logging. + /// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + /// `allServices` is a special value that covers all services. + pub service: Option, +} + +impl Part for AuditConfig {} + + +/// Per resource and severity counts of fixable and total vulnerabilities. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FixableTotalByDigest { + /// The total number of vulnerabilities associated with this resource. + #[serde(rename="totalCount")] + pub total_count: Option, + /// The affected resource. + pub resource: Option, + /// The severity for this count. SEVERITY_UNSPECIFIED indicates total across + /// all severities. + pub severity: Option, + /// The number of fixable vulnerabilities associated with this resource. + #[serde(rename="fixableCount")] + pub fixable_count: Option, +} + +impl Part for FixableTotalByDigest {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `ContainerAnalysis` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use containeranalysis1_beta1::ContainerAnalysis; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `notes_batch_create(...)`, `notes_create(...)`, `notes_delete(...)`, `notes_get(...)`, `notes_get_iam_policy(...)`, `notes_list(...)`, `notes_occurrences_list(...)`, `notes_patch(...)`, `notes_set_iam_policy(...)`, `notes_test_iam_permissions(...)`, `occurrences_batch_create(...)`, `occurrences_create(...)`, `occurrences_delete(...)`, `occurrences_get(...)`, `occurrences_get_iam_policy(...)`, `occurrences_get_notes(...)`, `occurrences_get_vulnerability_summary(...)`, `occurrences_list(...)`, `occurrences_patch(...)`, `occurrences_set_iam_policy(...)`, `occurrences_test_iam_permissions(...)`, `scan_configs_get(...)`, `scan_configs_list(...)` and `scan_configs_update(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists scan configurations for the specified project. + /// + /// # Arguments + /// + /// * `parent` - The name of the project to list scan configurations for in the form of + /// `projects/[PROJECT_ID]`. + pub fn scan_configs_list(&self, parent: &str) -> ProjectScanConfigListCall<'a, C, A> { + ProjectScanConfigListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the permissions that a caller has on the specified note or + /// occurrence. Requires list permission on the project (for example, + /// `containeranalysis.notes.list`). + /// + /// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + /// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + /// occurrences. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn notes_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectNoteTestIamPermissionCall<'a, C, A> { + ProjectNoteTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified note or occurrence. + /// Requires `containeranalysis.notes.setIamPolicy` or + /// `containeranalysis.occurrences.setIamPolicy` permission if the resource is + /// a note or an occurrence, respectively. + /// + /// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + /// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + /// occurrences. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn occurrences_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectOccurrenceSetIamPolicyCall<'a, C, A> { + ProjectOccurrenceSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates new occurrences in batch. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the project in the form of `projects/[PROJECT_ID]`, under which + /// the occurrences are to be created. + pub fn occurrences_batch_create(&self, request: BatchCreateOccurrencesRequest, parent: &str) -> ProjectOccurrenceBatchCreateCall<'a, C, A> { + ProjectOccurrenceBatchCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the specified note. + /// + /// # Arguments + /// + /// * `name` - The name of the note in the form of + /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + pub fn notes_get(&self, name: &str) -> ProjectNoteGetCall<'a, C, A> { + ProjectNoteGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the specified occurrence. + /// + /// # Arguments + /// + /// * `name` - The name of the occurrence in the form of + /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + pub fn occurrences_get(&self, name: &str) -> ProjectOccurrenceGetCall<'a, C, A> { + ProjectOccurrenceGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the specified note. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the note in the form of + /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + pub fn notes_patch(&self, request: Note, name: &str) -> ProjectNotePatchCall<'a, C, A> { + ProjectNotePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists occurrences referencing the specified note. Provider projects can use + /// this method to get all occurrences across consumer projects referencing the + /// specified note. + /// + /// # Arguments + /// + /// * `name` - The name of the note to list occurrences for in the form of + /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + pub fn notes_occurrences_list(&self, name: &str) -> ProjectNoteOccurrenceListCall<'a, C, A> { + ProjectNoteOccurrenceListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists notes for the specified project. + /// + /// # Arguments + /// + /// * `parent` - The name of the project to list notes for in the form of + /// `projects/[PROJECT_ID]`. + pub fn notes_list(&self, parent: &str) -> ProjectNoteListCall<'a, C, A> { + ProjectNoteListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the specified occurrence. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the occurrence in the form of + /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + pub fn occurrences_patch(&self, request: Occurrence, name: &str) -> ProjectOccurrencePatchCall<'a, C, A> { + ProjectOccurrencePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a summary of the number and severity of occurrences. + /// + /// # Arguments + /// + /// * `parent` - The name of the project to get a vulnerability summary for in the form of + /// `projects/[PROJECT_ID]`. + pub fn occurrences_get_vulnerability_summary(&self, parent: &str) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C, A> { + ProjectOccurrenceGetVulnerabilitySummaryCall { + hub: self.hub, + _parent: parent.to_string(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new occurrence. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the project in the form of `projects/[PROJECT_ID]`, under which + /// the occurrence is to be created. + pub fn occurrences_create(&self, request: Occurrence, parent: &str) -> ProjectOccurrenceCreateCall<'a, C, A> { + ProjectOccurrenceCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a note or an occurrence resource. + /// Requires `containeranalysis.notes.setIamPolicy` or + /// `containeranalysis.occurrences.setIamPolicy` permission if the resource is + /// a note or occurrence, respectively. + /// + /// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + /// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + /// occurrences. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn notes_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectNoteGetIamPolicyCall<'a, C, A> { + ProjectNoteGetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified note or occurrence. + /// Requires `containeranalysis.notes.setIamPolicy` or + /// `containeranalysis.occurrences.setIamPolicy` permission if the resource is + /// a note or an occurrence, respectively. + /// + /// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + /// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + /// occurrences. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn notes_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectNoteSetIamPolicyCall<'a, C, A> { + ProjectNoteSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the note attached to the specified occurrence. Consumer projects can + /// use this method to get a note that belongs to a provider project. + /// + /// # Arguments + /// + /// * `name` - The name of the occurrence in the form of + /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + pub fn occurrences_get_notes(&self, name: &str) -> ProjectOccurrenceGetNoteCall<'a, C, A> { + ProjectOccurrenceGetNoteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the specified scan configuration. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the scan configuration in the form of + /// `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`. + pub fn scan_configs_update(&self, request: ScanConfig, name: &str) -> ProjectScanConfigUpdateCall<'a, C, A> { + ProjectScanConfigUpdateCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists occurrences for the specified project. + /// + /// # Arguments + /// + /// * `parent` - The name of the project to list occurrences for in the form of + /// `projects/[PROJECT_ID]`. + pub fn occurrences_list(&self, parent: &str) -> ProjectOccurrenceListCall<'a, C, A> { + ProjectOccurrenceListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified occurrence. For example, use this method to delete an + /// occurrence when the occurrence is no longer applicable for the given + /// resource. + /// + /// # Arguments + /// + /// * `name` - The name of the occurrence in the form of + /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + pub fn occurrences_delete(&self, name: &str) -> ProjectOccurrenceDeleteCall<'a, C, A> { + ProjectOccurrenceDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates new notes in batch. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the project in the form of `projects/[PROJECT_ID]`, under which + /// the notes are to be created. + pub fn notes_batch_create(&self, request: BatchCreateNotesRequest, parent: &str) -> ProjectNoteBatchCreateCall<'a, C, A> { + ProjectNoteBatchCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified note. + /// + /// # Arguments + /// + /// * `name` - The name of the note in the form of + /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + pub fn notes_delete(&self, name: &str) -> ProjectNoteDeleteCall<'a, C, A> { + ProjectNoteDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the specified scan configuration. + /// + /// # Arguments + /// + /// * `name` - The name of the scan configuration in the form of + /// `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`. + pub fn scan_configs_get(&self, name: &str) -> ProjectScanConfigGetCall<'a, C, A> { + ProjectScanConfigGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a note or an occurrence resource. + /// Requires `containeranalysis.notes.setIamPolicy` or + /// `containeranalysis.occurrences.setIamPolicy` permission if the resource is + /// a note or occurrence, respectively. + /// + /// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + /// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + /// occurrences. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn occurrences_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectOccurrenceGetIamPolicyCall<'a, C, A> { + ProjectOccurrenceGetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new note. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the project in the form of `projects/[PROJECT_ID]`, under which + /// the note is to be created. + pub fn notes_create(&self, request: Note, parent: &str) -> ProjectNoteCreateCall<'a, C, A> { + ProjectNoteCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _note_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the permissions that a caller has on the specified note or + /// occurrence. Requires list permission on the project (for example, + /// `containeranalysis.notes.list`). + /// + /// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + /// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + /// occurrences. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn occurrences_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectOccurrenceTestIamPermissionCall<'a, C, A> { + ProjectOccurrenceTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Lists scan configurations for the specified project. +/// +/// A builder for the *scanConfigs.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().scan_configs_list("parent") +/// .page_token("accusam") +/// .page_size(-8) +/// .filter("justo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectScanConfigListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectScanConfigListCall<'a, C, A> {} + +impl<'a, C, A> ProjectScanConfigListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListScanConfigsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.scanConfigs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/scanConfigs"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the project to list scan configurations for in the form of + /// `projects/[PROJECT_ID]`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectScanConfigListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Token to provide to skip to a particular spot in the list. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectScanConfigListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The number of scan configs to return in the list. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectScanConfigListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The filter expression. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectScanConfigListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectScanConfigListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectScanConfigListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectScanConfigListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the permissions that a caller has on the specified note or +/// occurrence. Requires list permission on the project (for example, +/// `containeranalysis.notes.list`). +/// +/// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for +/// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for +/// occurrences. +/// +/// A builder for the *notes.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNoteTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNoteTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectNoteTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.notes.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectNoteTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectNoteTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNoteTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNoteTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNoteTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on the specified note or occurrence. +/// Requires `containeranalysis.notes.setIamPolicy` or +/// `containeranalysis.occurrences.setIamPolicy` permission if the resource is +/// a note or an occurrence, respectively. +/// +/// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for +/// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for +/// occurrences. +/// +/// A builder for the *occurrences.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrenceSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrenceSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrenceSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectOccurrenceSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectOccurrenceSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrenceSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrenceSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrenceSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates new occurrences in batch. +/// +/// A builder for the *occurrences.batchCreate* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::BatchCreateOccurrencesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BatchCreateOccurrencesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_batch_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrenceBatchCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: BatchCreateOccurrencesRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrenceBatchCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrenceBatchCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BatchCreateOccurrencesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.batchCreate", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences:batchCreate"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BatchCreateOccurrencesRequest) -> ProjectOccurrenceBatchCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the project in the form of `projects/[PROJECT_ID]`, under which + /// the occurrences are to be created. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectOccurrenceBatchCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrenceBatchCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrenceBatchCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrenceBatchCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the specified note. +/// +/// A builder for the *notes.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNoteGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNoteGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectNoteGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Note)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.notes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the note in the form of + /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectNoteGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNoteGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNoteGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNoteGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the specified occurrence. +/// +/// A builder for the *occurrences.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrenceGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrenceGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrenceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Occurrence)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the occurrence in the form of + /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectOccurrenceGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrenceGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrenceGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrenceGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified note. +/// +/// A builder for the *notes.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::Note; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Note::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_patch(req, "name") +/// .update_mask("gubergren") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNotePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: Note, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNotePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectNotePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Note)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.notes.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Note) -> ProjectNotePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the note in the form of + /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectNotePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The fields to update. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectNotePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNotePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNotePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNotePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists occurrences referencing the specified note. Provider projects can use +/// this method to get all occurrences across consumer projects referencing the +/// specified note. +/// +/// A builder for the *notes.occurrences.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_occurrences_list("name") +/// .page_token("aliquyam") +/// .page_size(-66) +/// .filter("no") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNoteOccurrenceListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNoteOccurrenceListCall<'a, C, A> {} + +impl<'a, C, A> ProjectNoteOccurrenceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListNoteOccurrencesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.notes.occurrences.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/occurrences"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the note to list occurrences for in the form of + /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectNoteOccurrenceListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Token to provide to skip to a particular spot in the list. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectNoteOccurrenceListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Number of occurrences to return in the list. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectNoteOccurrenceListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The filter expression. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectNoteOccurrenceListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNoteOccurrenceListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNoteOccurrenceListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNoteOccurrenceListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists notes for the specified project. +/// +/// A builder for the *notes.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_list("parent") +/// .page_token("justo") +/// .page_size(-34) +/// .filter("et") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNoteListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNoteListCall<'a, C, A> {} + +impl<'a, C, A> ProjectNoteListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListNotesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.notes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the project to list notes for in the form of + /// `projects/[PROJECT_ID]`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectNoteListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Token to provide to skip to a particular spot in the list. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectNoteListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Number of notes to return in the list. Must be positive. Max allowed page + /// size is 1000. If not specified, page size defaults to 20. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectNoteListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The filter expression. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectNoteListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNoteListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNoteListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNoteListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified occurrence. +/// +/// A builder for the *occurrences.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::Occurrence; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Occurrence::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_patch(req, "name") +/// .update_mask("ipsum") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrencePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: Occurrence, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrencePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrencePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Occurrence)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Occurrence) -> ProjectOccurrencePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the occurrence in the form of + /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectOccurrencePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The fields to update. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectOccurrencePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrencePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrencePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrencePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a summary of the number and severity of occurrences. +/// +/// A builder for the *occurrences.getVulnerabilitySummary* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_get_vulnerability_summary("parent") +/// .filter("et") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _parent: String, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VulnerabilityOccurrencesSummary)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.getVulnerabilitySummary", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences:vulnerabilitySummary"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the project to get a vulnerability summary for in the form of + /// `projects/[PROJECT_ID]`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The filter expression. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new occurrence. +/// +/// A builder for the *occurrences.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::Occurrence; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Occurrence::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrenceCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: Occurrence, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrenceCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrenceCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Occurrence)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Occurrence) -> ProjectOccurrenceCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the project in the form of `projects/[PROJECT_ID]`, under which + /// the occurrence is to be created. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectOccurrenceCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrenceCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrenceCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrenceCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy for a note or an occurrence resource. +/// Requires `containeranalysis.notes.setIamPolicy` or +/// `containeranalysis.occurrences.setIamPolicy` permission if the resource is +/// a note or occurrence, respectively. +/// +/// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for +/// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for +/// occurrences. +/// +/// A builder for the *notes.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::GetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_get_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNoteGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: GetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNoteGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectNoteGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.notes.getIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectNoteGetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectNoteGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNoteGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNoteGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNoteGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on the specified note or occurrence. +/// Requires `containeranalysis.notes.setIamPolicy` or +/// `containeranalysis.occurrences.setIamPolicy` permission if the resource is +/// a note or an occurrence, respectively. +/// +/// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for +/// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for +/// occurrences. +/// +/// A builder for the *notes.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNoteSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNoteSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectNoteSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.notes.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectNoteSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectNoteSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNoteSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNoteSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNoteSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the note attached to the specified occurrence. Consumer projects can +/// use this method to get a note that belongs to a provider project. +/// +/// A builder for the *occurrences.getNotes* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_get_notes("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrenceGetNoteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrenceGetNoteCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrenceGetNoteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Note)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.getNotes", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/notes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the occurrence in the form of + /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectOccurrenceGetNoteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrenceGetNoteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrenceGetNoteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrenceGetNoteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified scan configuration. +/// +/// A builder for the *scanConfigs.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::ScanConfig; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ScanConfig::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().scan_configs_update(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectScanConfigUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: ScanConfig, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectScanConfigUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectScanConfigUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ScanConfig)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.scanConfigs.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ScanConfig) -> ProjectScanConfigUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the scan configuration in the form of + /// `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectScanConfigUpdateCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectScanConfigUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectScanConfigUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectScanConfigUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists occurrences for the specified project. +/// +/// A builder for the *occurrences.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_list("parent") +/// .page_token("sadipscing") +/// .page_size(-48) +/// .filter("eirmod") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrenceListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrenceListCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrenceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListOccurrencesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the project to list occurrences for in the form of + /// `projects/[PROJECT_ID]`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectOccurrenceListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Token to provide to skip to a particular spot in the list. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectOccurrenceListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Number of occurrences to return in the list. Must be positive. Max allowed + /// page size is 1000. If not specified, page size defaults to 20. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectOccurrenceListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The filter expression. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectOccurrenceListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrenceListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrenceListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrenceListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified occurrence. For example, use this method to delete an +/// occurrence when the occurrence is no longer applicable for the given +/// resource. +/// +/// A builder for the *occurrences.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrenceDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrenceDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrenceDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the occurrence in the form of + /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectOccurrenceDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrenceDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrenceDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrenceDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates new notes in batch. +/// +/// A builder for the *notes.batchCreate* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::BatchCreateNotesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BatchCreateNotesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_batch_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNoteBatchCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: BatchCreateNotesRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNoteBatchCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectNoteBatchCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BatchCreateNotesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.notes.batchCreate", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes:batchCreate"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BatchCreateNotesRequest) -> ProjectNoteBatchCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the project in the form of `projects/[PROJECT_ID]`, under which + /// the notes are to be created. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectNoteBatchCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNoteBatchCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNoteBatchCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNoteBatchCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified note. +/// +/// A builder for the *notes.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNoteDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNoteDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectNoteDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.notes.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the note in the form of + /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectNoteDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNoteDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNoteDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNoteDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the specified scan configuration. +/// +/// A builder for the *scanConfigs.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().scan_configs_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectScanConfigGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectScanConfigGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectScanConfigGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ScanConfig)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.scanConfigs.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the scan configuration in the form of + /// `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectScanConfigGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectScanConfigGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectScanConfigGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectScanConfigGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy for a note or an occurrence resource. +/// Requires `containeranalysis.notes.setIamPolicy` or +/// `containeranalysis.occurrences.setIamPolicy` permission if the resource is +/// a note or occurrence, respectively. +/// +/// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for +/// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for +/// occurrences. +/// +/// A builder for the *occurrences.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::GetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_get_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrenceGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: GetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrenceGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrenceGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.getIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectOccurrenceGetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectOccurrenceGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrenceGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrenceGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrenceGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new note. +/// +/// A builder for the *notes.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::Note; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Note::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notes_create(req, "parent") +/// .note_id("invidunt") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNoteCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: Note, + _parent: String, + _note_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNoteCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectNoteCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Note)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.notes.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._note_id { + params.push(("noteId", value.to_string())); + } + for &field in ["alt", "parent", "noteId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Note) -> ProjectNoteCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the project in the form of `projects/[PROJECT_ID]`, under which + /// the note is to be created. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectNoteCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The ID to use for this note. + /// + /// Sets the *note id* query property to the given value. + pub fn note_id(mut self, new_value: &str) -> ProjectNoteCreateCall<'a, C, A> { + self._note_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNoteCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNoteCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNoteCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the permissions that a caller has on the specified note or +/// occurrence. Requires list permission on the project (for example, +/// `containeranalysis.notes.list`). +/// +/// The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for +/// notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for +/// occurrences. +/// +/// A builder for the *occurrences.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1; +/// use containeranalysis1_beta1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use containeranalysis1_beta1::ContainerAnalysis; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ContainerAnalysis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().occurrences_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOccurrenceTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ContainerAnalysis, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOccurrenceTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectOccurrenceTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "containeranalysis.projects.occurrences.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectOccurrenceTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectOccurrenceTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOccurrenceTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOccurrenceTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOccurrenceTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/content2-cli/Cargo.toml b/gen/content2-cli/Cargo.toml index 387040f408..e8dc2f2aa9 100644 --- a/gen/content2-cli/Cargo.toml +++ b/gen/content2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-content2-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Shopping Content (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/content2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-content2] path = "../content2" -version = "1.0.8+20181009" +version = "1.0.8+20190327" diff --git a/gen/content2-cli/README.md b/gen/content2-cli/README.md index 4caf244485..bc5e2f9d25 100644 --- a/gen/content2-cli/README.md +++ b/gen/content2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Shopping Content* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *Shopping Content* API at revision *20190327*. The CLI is at version *1.0.8*. ```bash content2 [options] @@ -73,10 +73,10 @@ content2 [options] list [-p ]... [-o ] listposdataproviders [-p ]... [-o ] patch (-r )... [-p ]... [-o ] - requestgmbaccess [-p ]... [-o ] + requestgmbaccess [-p ]... [-o ] requestinventoryverification [-p ]... [-o ] - setinventoryverificationcontact [-p ]... [-o ] - setposdataprovider [-p ]... [-o ] + setinventoryverificationcontact [-p ]... [-o ] + setposdataprovider [-p ]... [-o ] update (-r )... [-p ]... [-o ] orderinvoices createchargeinvoice (-r )... [-p ]... [-o ] diff --git a/gen/content2-cli/mkdocs.yml b/gen/content2-cli/mkdocs.yml index 8f6649e238..5fbe501af4 100644 --- a/gen/content2-cli/mkdocs.yml +++ b/gen/content2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Shopping Content v1.0.8+20181009 +site_name: Shopping Content v1.0.8+20190327 site_url: http://byron.github.io/google-apis-rs/google-content2-cli site_description: A complete library to interact with Shopping Content (protocol v2) diff --git a/gen/content2-cli/src/main.rs b/gen/content2-cli/src/main.rs index 7bc19a0de5..025021ecc3 100644 --- a/gen/content2-cli/src/main.rs +++ b/gen/content2-cli/src/main.rs @@ -2336,21 +2336,27 @@ impl<'n> Engine<'n> { "installment.amount.currency" => Some(("installment.amount.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "installment.amount.value" => Some(("installment.amount.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "installment.months" => Some(("installment.months", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "quantity" => Some(("quantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "sale-price-effective-date" => Some(("salePriceEffectiveDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "price.currency" => Some(("price.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "price.value" => Some(("price.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "availability" => Some(("availability", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "sell-on-google-quantity" => Some(("sellOnGoogleQuantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "pickup.pickup-method" => Some(("pickup.pickupMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "pickup.pickup-sla" => Some(("pickup.pickupSla", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "sale-price.currency" => Some(("salePrice.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "sale-price.value" => Some(("salePrice.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "availability" => Some(("availability", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instore-product-location" => Some(("instoreProductLocation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "loyalty-points.ratio" => Some(("loyaltyPoints.ratio", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "loyalty-points.name" => Some(("loyaltyPoints.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "loyalty-points.points-value" => Some(("loyaltyPoints.pointsValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "quantity" => Some(("quantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "custom-label4" => Some(("customLabel4", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-label3" => Some(("customLabel3", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-label2" => Some(("customLabel2", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-label1" => Some(("customLabel1", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-label0" => Some(("customLabel0", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["amount", "availability", "currency", "installment", "loyalty-points", "months", "name", "pickup", "pickup-method", "pickup-sla", "points-value", "price", "quantity", "ratio", "sale-price", "sale-price-effective-date", "sell-on-google-quantity", "value"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["amount", "availability", "currency", "custom-label0", "custom-label1", "custom-label2", "custom-label3", "custom-label4", "installment", "instore-product-location", "loyalty-points", "months", "name", "pickup", "pickup-method", "pickup-sla", "points-value", "price", "quantity", "ratio", "sale-price", "sale-price-effective-date", "sell-on-google-quantity", "value"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2809,13 +2815,10 @@ impl<'n> Engine<'n> { fn _liasettings_requestgmbaccess(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.liasettings().requestgmbaccess(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); + let mut call = self.hub.liasettings().requestgmbaccess(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or(""), opt.value_of("gmb-email").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { - "gmb-email" => { - call = call.gmb_email(value.unwrap_or("")); - }, _ => { let mut found = false; for param in &self.gp { @@ -2829,7 +2832,6 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["gmb-email"].iter().map(|v|*v)); v } )); } } @@ -2917,22 +2919,10 @@ impl<'n> Engine<'n> { fn _liasettings_setinventoryverificationcontact(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.liasettings().setinventoryverificationcontact(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); + let mut call = self.hub.liasettings().setinventoryverificationcontact(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or(""), opt.value_of("contact-email").unwrap_or(""), opt.value_of("contact-name").unwrap_or(""), opt.value_of("country").unwrap_or(""), opt.value_of("language").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { - "language" => { - call = call.language(value.unwrap_or("")); - }, - "country" => { - call = call.country(value.unwrap_or("")); - }, - "contact-name" => { - call = call.contact_name(value.unwrap_or("")); - }, - "contact-email" => { - call = call.contact_email(value.unwrap_or("")); - }, _ => { let mut found = false; for param in &self.gp { @@ -2946,7 +2936,6 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["contact-email", "country", "contact-name", "language"].iter().map(|v|*v)); v } )); } } @@ -2982,7 +2971,7 @@ impl<'n> Engine<'n> { fn _liasettings_setposdataprovider(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.liasettings().setposdataprovider(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); + let mut call = self.hub.liasettings().setposdataprovider(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or(""), opt.value_of("country").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { @@ -2992,9 +2981,6 @@ impl<'n> Engine<'n> { "pos-data-provider-id" => { call = call.pos_data_provider_id(value.unwrap_or("")); }, - "country" => { - call = call.country(value.unwrap_or("")); - }, _ => { let mut found = false; for param in &self.gp { @@ -3008,7 +2994,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["country", "pos-external-account-id", "pos-data-provider-id"].iter().map(|v|*v)); + v.extend(["pos-external-account-id", "pos-data-provider-id"].iter().map(|v|*v)); v } )); } } @@ -8150,7 +8136,7 @@ fn main() { ("accountstatuses", "methods: 'custombatch', 'get' and 'list'", vec![ ("custombatch", - None, + Some(r##"Retrieves multiple Merchant Center account statuses in a single request."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountstatuses_custombatch", vec![ (Some(r##"kv"##), @@ -8172,7 +8158,7 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Retrieves the status of a Merchant Center account. Multi-client accounts can only call this method for sub-accounts."##), + Some(r##"Retrieves the status of a Merchant Center account. No itemLevelIssues are returned for multi-client accounts."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountstatuses_get", vec![ (Some(r##"merchant-id"##), @@ -8368,7 +8354,7 @@ fn main() { ("datafeeds", "methods: 'custombatch', 'delete', 'fetchnow', 'get', 'insert', 'list', 'patch' and 'update'", vec![ ("custombatch", - None, + Some(r##"Deletes, fetches, gets, inserts and updates multiple datafeeds in a single request."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_custombatch", vec![ (Some(r##"kv"##), @@ -8589,7 +8575,7 @@ fn main() { ("datafeedstatuses", "methods: 'custombatch', 'get' and 'list'", vec![ ("custombatch", - None, + Some(r##"Gets multiple Merchant Center datafeed statuses in a single request."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeedstatuses_custombatch", vec![ (Some(r##"kv"##), @@ -8703,7 +8689,7 @@ fn main() { (Some(r##"product-id"##), None, - Some(r##"The REST id of the product for which to update price and availability."##), + Some(r##"The REST ID of the product for which to update price and availability."##), Some(true), Some(false)), @@ -8894,6 +8880,12 @@ fn main() { Some(true), Some(false)), + (Some(r##"gmb-email"##), + None, + Some(r##"The email of the Google My Business account."##), + Some(true), + Some(false)), + (Some(r##"v"##), Some(r##"p"##), Some(r##"Set various optional parameters, matching the key=value form"##), @@ -8956,6 +8948,30 @@ fn main() { Some(true), Some(false)), + (Some(r##"contact-email"##), + None, + Some(r##"The email of the inventory verification contact."##), + Some(true), + Some(false)), + + (Some(r##"contact-name"##), + None, + Some(r##"The name of the inventory verification contact."##), + Some(true), + Some(false)), + + (Some(r##"country"##), + None, + Some(r##"The country for which inventory verification is requested."##), + Some(true), + Some(false)), + + (Some(r##"language"##), + None, + Some(r##"The language for which inventory verification is requested."##), + Some(true), + Some(false)), + (Some(r##"v"##), Some(r##"p"##), Some(r##"Set various optional parameters, matching the key=value form"##), @@ -8984,6 +9000,12 @@ fn main() { Some(true), Some(false)), + (Some(r##"country"##), + None, + Some(r##"The country for which the POS data provider is selected."##), + Some(true), + Some(false)), + (Some(r##"v"##), Some(r##"p"##), Some(r##"Set various optional parameters, matching the key=value form"##), @@ -9272,7 +9294,7 @@ fn main() { Some(false)), ]), ("listtransactions", - Some(r##"Retrieves a list of transactions for an disbursement from your Merchant Center account."##), + Some(r##"Retrieves a list of transactions for a disbursement from your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orderreports_listtransactions", vec![ (Some(r##"merchant-id"##), @@ -9638,7 +9660,7 @@ fn main() { Some(false)), ]), ("getbymerchantorderid", - Some(r##"Retrieves an order using merchant order id."##), + Some(r##"Retrieves an order using merchant order ID."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_getbymerchantorderid", vec![ (Some(r##"merchant-id"##), @@ -9649,7 +9671,7 @@ fn main() { (Some(r##"merchant-order-id"##), None, - Some(r##"The merchant order id to be looked for."##), + Some(r##"The merchant order ID to be looked for."##), Some(true), Some(false)), @@ -9694,7 +9716,8 @@ fn main() { Some(false)), ]), ("instorerefundlineitem", - Some(r##"Notifies that item return and refund was handled directly by merchant outside of Google payments processing (e.g. cash refund done in store)."##), + Some(r##"Notifies that item return and refund was handled directly by merchant outside of Google payments processing (e.g. cash refund done in store). + Note: We recommend calling the returnrefundlineitem method to refund in-store returns. We will issue the refund directly to the customer. This helps to prevent possible differences arising between merchant and Google transaction records. We also recommend having the point of sale system communicate with Google to ensure that customers do not receive a double refund by first refunding via Google then via an in-store return."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_instorerefundlineitem", vec![ (Some(r##"merchant-id"##), @@ -9886,7 +9909,7 @@ fn main() { Some(false)), ]), ("setlineitemmetadata", - Some(r##"Sets (overrides) merchant provided annotations on the line item."##), + Some(r##"Sets (or overrides if it already exists) merchant provided annotations in the form of key-value pairs. A common use case would be to supply us with additional structured information about a line item that cannot be provided via other methods. Submitted key-value pairs can be retrieved as part of the orders resource."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_setlineitemmetadata", vec![ (Some(r##"merchant-id"##), @@ -10309,7 +10332,7 @@ fn main() { (Some(r##"product-id"##), None, - Some(r##"The REST id of the product."##), + Some(r##"The REST ID of the product."##), Some(true), Some(false)), @@ -10331,7 +10354,7 @@ fn main() { (Some(r##"product-id"##), None, - Some(r##"The REST id of the product."##), + Some(r##"The REST ID of the product."##), Some(true), Some(false)), @@ -10434,7 +10457,7 @@ fn main() { (Some(r##"product-id"##), None, - Some(r##"The REST id of the product."##), + Some(r##"The REST ID of the product."##), Some(true), Some(false)), @@ -10665,7 +10688,7 @@ fn main() { let mut app = App::new("content2") .author("Sebastian Thiel ") - .version("1.0.8+20181009") + .version("1.0.8+20190327") .about("Manages product items, inventory, and Merchant Center accounts for Google Shopping.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_content2_cli") .arg(Arg::with_name("url") diff --git a/gen/content2/Cargo.toml b/gen/content2/Cargo.toml index 9eb7721a6e..e052560007 100644 --- a/gen/content2/Cargo.toml +++ b/gen/content2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-content2" -version = "1.0.8+20181009" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Shopping Content (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/content2" homepage = "https://developers.google.com/shopping-content" -documentation = "https://docs.rs/google-content2/1.0.8+20181009" +documentation = "https://docs.rs/google-content2/1.0.8+20190327" license = "MIT" keywords = ["content", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/content2/README.md b/gen/content2/README.md index 501013f66b..7e9f1150e8 100644 --- a/gen/content2/README.md +++ b/gen/content2/README.md @@ -5,46 +5,46 @@ DO NOT EDIT ! --> The `google-content2` library allows access to all features of the *Google Shopping Content* service. -This documentation was generated from *Shopping Content* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Shopping Content* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Shopping Content* *v2* API can be found at the [official documentation site](https://developers.google.com/shopping-content). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ShoppingContent.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ShoppingContent.html) ... -* [accounts](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.Account.html) - * [*authinfo*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountAuthinfoCall.html), [*claimwebsite*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountClaimwebsiteCall.html), [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountInsertCall.html), [*link*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountLinkCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountListCall.html), [*patch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountUpdateCall.html) +* [accounts](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.Account.html) + * [*authinfo*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountAuthinfoCall.html), [*claimwebsite*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountClaimwebsiteCall.html), [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountInsertCall.html), [*link*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountLinkCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountListCall.html), [*patch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountUpdateCall.html) * accountstatuses - * [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccountstatuseListCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccountstatuseListCall.html) * accounttax - * [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccounttaxCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccounttaxGetCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccounttaxListCall.html), [*patch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccounttaxPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.AccounttaxUpdateCall.html) -* [datafeeds](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.Datafeed.html) - * [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedDeleteCall.html), [*fetchnow*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedFetchnowCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedInsertCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedListCall.html), [*patch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedUpdateCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccounttaxCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccounttaxGetCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccounttaxListCall.html), [*patch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccounttaxPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.AccounttaxUpdateCall.html) +* [datafeeds](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.Datafeed.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedDeleteCall.html), [*fetchnow*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedFetchnowCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedInsertCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedListCall.html), [*patch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedUpdateCall.html) * datafeedstatuses - * [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.DatafeedstatuseListCall.html) -* [inventory](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.Inventory.html) - * [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.InventoryCustombatchCall.html) and [*set*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.InventorySetCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.DatafeedstatuseListCall.html) +* [inventory](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.Inventory.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.InventoryCustombatchCall.html) and [*set*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.InventorySetCall.html) * liasettings - * [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingGetCall.html), [*getaccessiblegmbaccounts*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingGetaccessiblegmbaccountCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingListCall.html), [*listposdataproviders*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingListposdataproviderCall.html), [*patch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingPatchCall.html), [*requestgmbaccess*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingRequestgmbaccesCall.html), [*requestinventoryverification*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingRequestinventoryverificationCall.html), [*setinventoryverificationcontact*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingSetinventoryverificationcontactCall.html), [*setposdataprovider*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingSetposdataproviderCall.html) and [*update*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.LiasettingUpdateCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingGetCall.html), [*getaccessiblegmbaccounts*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingGetaccessiblegmbaccountCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingListCall.html), [*listposdataproviders*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingListposdataproviderCall.html), [*patch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingPatchCall.html), [*requestgmbaccess*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingRequestgmbaccesCall.html), [*requestinventoryverification*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingRequestinventoryverificationCall.html), [*setinventoryverificationcontact*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingSetinventoryverificationcontactCall.html), [*setposdataprovider*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingSetposdataproviderCall.html) and [*update*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.LiasettingUpdateCall.html) * orderinvoices - * [*createchargeinvoice*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderinvoiceCreatechargeinvoiceCall.html) and [*createrefundinvoice*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderinvoiceCreaterefundinvoiceCall.html) + * [*createchargeinvoice*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderinvoiceCreatechargeinvoiceCall.html) and [*createrefundinvoice*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderinvoiceCreaterefundinvoiceCall.html) * orderpayments - * [*notifyauthapproved*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderpaymentNotifyauthapprovedCall.html), [*notifyauthdeclined*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderpaymentNotifyauthdeclinedCall.html), [*notifycharge*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderpaymentNotifychargeCall.html) and [*notifyrefund*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderpaymentNotifyrefundCall.html) + * [*notifyauthapproved*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderpaymentNotifyauthapprovedCall.html), [*notifyauthdeclined*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderpaymentNotifyauthdeclinedCall.html), [*notifycharge*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderpaymentNotifychargeCall.html) and [*notifyrefund*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderpaymentNotifyrefundCall.html) * orderreports - * [*listdisbursements*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderreportListdisbursementCall.html) and [*listtransactions*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderreportListtransactionCall.html) + * [*listdisbursements*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderreportListdisbursementCall.html) and [*listtransactions*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderreportListtransactionCall.html) * orderreturns - * [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderreturnGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderreturnListCall.html) -* [orders](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.Order.html) - * [*acknowledge*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderAcknowledgeCall.html), [*advancetestorder*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderAdvancetestorderCall.html), [*cancel*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderCancelCall.html), [*cancellineitem*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderCancellineitemCall.html), [*canceltestorderbycustomer*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderCanceltestorderbycustomerCall.html), [*createtestorder*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderCreatetestorderCall.html), [*createtestreturn*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderCreatetestreturnCall.html), [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderGetCall.html), [*getbymerchantorderid*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderGetbymerchantorderidCall.html), [*gettestordertemplate*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderGettestordertemplateCall.html), [*instorerefundlineitem*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderInstorerefundlineitemCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderListCall.html), [*refund*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderRefundCall.html), [*rejectreturnlineitem*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderRejectreturnlineitemCall.html), [*returnlineitem*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderReturnlineitemCall.html), [*returnrefundlineitem*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderReturnrefundlineitemCall.html), [*setlineitemmetadata*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderSetlineitemmetadataCall.html), [*shiplineitems*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderShiplineitemCall.html), [*updatelineitemshippingdetails*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderUpdatelineitemshippingdetailCall.html), [*updatemerchantorderid*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderUpdatemerchantorderidCall.html) and [*updateshipment*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.OrderUpdateshipmentCall.html) + * [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderreturnGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderreturnListCall.html) +* [orders](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.Order.html) + * [*acknowledge*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderAcknowledgeCall.html), [*advancetestorder*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderAdvancetestorderCall.html), [*cancel*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderCancelCall.html), [*cancellineitem*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderCancellineitemCall.html), [*canceltestorderbycustomer*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderCanceltestorderbycustomerCall.html), [*createtestorder*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderCreatetestorderCall.html), [*createtestreturn*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderCreatetestreturnCall.html), [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderGetCall.html), [*getbymerchantorderid*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderGetbymerchantorderidCall.html), [*gettestordertemplate*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderGettestordertemplateCall.html), [*instorerefundlineitem*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderInstorerefundlineitemCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderListCall.html), [*refund*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderRefundCall.html), [*rejectreturnlineitem*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderRejectreturnlineitemCall.html), [*returnlineitem*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderReturnlineitemCall.html), [*returnrefundlineitem*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderReturnrefundlineitemCall.html), [*setlineitemmetadata*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderSetlineitemmetadataCall.html), [*shiplineitems*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderShiplineitemCall.html), [*updatelineitemshippingdetails*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderUpdatelineitemshippingdetailCall.html), [*updatemerchantorderid*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderUpdatemerchantorderidCall.html) and [*updateshipment*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.OrderUpdateshipmentCall.html) * pos - * [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.PoCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.PoDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.PoGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.PoInsertCall.html), [*inventory*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.PoInventoryCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.PoListCall.html) and [*sale*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.PoSaleCall.html) -* [products](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.Product.html) - * [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ProductCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ProductDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ProductGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ProductInsertCall.html) and [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ProductListCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.PoCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.PoDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.PoGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.PoInsertCall.html), [*inventory*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.PoInventoryCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.PoListCall.html) and [*sale*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.PoSaleCall.html) +* [products](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.Product.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ProductCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ProductDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ProductGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ProductInsertCall.html) and [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ProductListCall.html) * productstatuses - * [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ProductstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ProductstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ProductstatuseListCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ProductstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ProductstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ProductstatuseListCall.html) * shippingsettings - * [*custombatch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ShippingsettingCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ShippingsettingGetCall.html), [*getsupportedcarriers*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ShippingsettingGetsupportedcarrierCall.html), [*getsupportedholidays*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ShippingsettingGetsupportedholidayCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ShippingsettingListCall.html), [*patch*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ShippingsettingPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ShippingsettingUpdateCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ShippingsettingCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ShippingsettingGetCall.html), [*getsupportedcarriers*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ShippingsettingGetsupportedcarrierCall.html), [*getsupportedholidays*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ShippingsettingGetsupportedholidayCall.html), [*list*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ShippingsettingListCall.html), [*patch*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ShippingsettingPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ShippingsettingUpdateCall.html) @@ -53,17 +53,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-content2/1.0.8+20181009/google_content2/struct.ShoppingContent.html)** +* **[Hub](https://docs.rs/google-content2/1.0.8+20190327/google_content2/struct.ShoppingContent.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.Part.html)** + * **[Parts](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -182,17 +182,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-content2/1.0.8+20181009/google_content2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-content2/1.0.8+20190327/google_content2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-content2/1.0.8+20181009/google_content2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-content2/1.0.8+20190327/google_content2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -202,29 +202,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-content2/1.0.8+20181009/google_content2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-content2/1.0.8+20190327/google_content2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/content2/src/lib.rs b/gen/content2/src/lib.rs index e309eecadd..473fd69ea3 100644 --- a/gen/content2/src/lib.rs +++ b/gen/content2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Shopping Content* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Shopping Content* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Shopping Content* *v2* API can be found at the //! [official documentation site](https://developers.google.com/shopping-content). @@ -481,7 +481,7 @@ pub struct OrdersCustomBatchRequestEntryUpdateShipment { pub status: Option, /// The carrier handling the shipment. Not updated if missing. See shipments[].carrier in the Orders resource representation for a list of acceptable values. pub carrier: Option, - /// The tracking id for the shipment. Not updated if missing. + /// The tracking ID for the shipment. Not updated if missing. #[serde(rename="trackingId")] pub tracking_id: Option, /// The ID of the shipment. @@ -560,9 +560,18 @@ impl Part for ErrorType {} pub struct AccountUser { /// Whether user is an admin. pub admin: Option, + /// Whether user is an order manager. + #[serde(rename="orderManager")] + pub order_manager: Option, + /// Whether user can access payment statements. + #[serde(rename="paymentsAnalyst")] + pub payments_analyst: Option, /// User's email address. #[serde(rename="emailAddress")] pub email_address: Option, + /// Whether user can manage payment settings. + #[serde(rename="paymentsManager")] + pub payments_manager: Option, } impl Part for AccountUser {} @@ -606,7 +615,7 @@ pub struct AccountBusinessInformation { impl Part for AccountBusinessInformation {} -/// The status of a product, i.e., information about a product computed asynchronously by the data quality analysis. +/// The status of a product, i.e., information about a product computed asynchronously. /// /// # Activities /// @@ -640,10 +649,10 @@ pub struct ProductStatus { pub creation_date: Option, /// Identifies what kind of resource this is. Value: the fixed string "content#productStatus". pub kind: Option, - /// A list of data quality issues associated with the product. + /// DEPRECATED - never populated #[serde(rename="dataQualityIssues")] pub data_quality_issues: Option>, - /// The id of the product for which status is reported. + /// The ID of the product for which status is reported. #[serde(rename="productId")] pub product_id: Option, } @@ -710,17 +719,9 @@ impl Part for OrderAddress {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrderLineItemProduct { - /// The CLDR territory code of the target country of the product. - #[serde(rename="targetCountry")] - pub target_country: Option, - /// URL to the cached image shown to the user when order was placed. - #[serde(rename="shownImage")] - pub shown_image: Option, /// The two-letter ISO 639-1 language code for the item. #[serde(rename="contentLanguage")] pub content_language: Option, - /// The title of the product. - pub title: Option, /// Manufacturer Part Number (MPN) of the item. pub mpn: Option, /// Variant attributes for the item. These are dimensions of the product, such as color, gender, material, pattern, and size. You can find a comprehensive list of variant attributes here. @@ -728,21 +729,31 @@ pub struct OrderLineItemProduct { pub variant_attributes: Option>, /// Brand of the item. pub brand: Option, - /// URL of an image of the item. - #[serde(rename="imageLink")] - pub image_link: Option, /// An identifier of the item. #[serde(rename="offerId")] pub offer_id: Option, - /// The REST id of the product. - pub id: Option, /// Shared identifier for all variants of the same product. #[serde(rename="itemGroupId")] pub item_group_id: Option, /// Global Trade Item Number (GTIN) of the item. pub gtin: Option, + /// Associated fees at order creation time. + pub fees: Option>, + /// The REST ID of the product. + pub id: Option, /// Condition or state of the item. pub condition: Option, + /// The CLDR territory code of the target country of the product. + #[serde(rename="targetCountry")] + pub target_country: Option, + /// URL to the cached image shown to the user when order was placed. + #[serde(rename="shownImage")] + pub shown_image: Option, + /// The title of the product. + pub title: Option, + /// URL of an image of the item. + #[serde(rename="imageLink")] + pub image_link: Option, /// Price of the item. pub price: Option, /// The item's channel (online or local). @@ -795,7 +806,7 @@ pub struct OrderpaymentsNotifyAuthDeclinedResponse { impl ResponseResult for OrderpaymentsNotifyAuthDeclinedResponse {} -/// Account data. +/// Account data. After the creation of a new account it may take a few minutes before it is fully operational. The methods delete, insert, patch, and update require the admin role. /// /// # Activities /// @@ -879,22 +890,26 @@ impl ResponseResult for LiasettingsListResponse {} /// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [getsupportedholidays shippingsettings](struct.ShippingsettingGetsupportedholidayCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ShippingsettingsGetSupportedHolidaysResponse { - /// Identifies what kind of resource this is. Value: the fixed string "content#shippingsettingsGetSupportedHolidaysResponse". - pub kind: Option, - /// A list of holidays applicable for delivery guarantees. May be empty. - pub holidays: Option>, +pub struct OrdersCustomBatchRequestEntryReturnLineItem { + /// The reason for the return. + pub reason: Option, + /// The explanation of the reason. + #[serde(rename="reasonText")] + pub reason_text: Option, + /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required. + #[serde(rename="productId")] + pub product_id: Option, + /// The ID of the line item to return. Either lineItemId or productId is required. + #[serde(rename="lineItemId")] + pub line_item_id: Option, + /// The quantity to return. + pub quantity: Option, } -impl ResponseResult for ShippingsettingsGetSupportedHolidaysResponse {} +impl Part for OrdersCustomBatchRequestEntryReturnLineItem {} /// There is no detailed description. @@ -909,7 +924,7 @@ pub struct OrderCustomerMarketingRightsInfo { /// Timestamp when last time marketing preference was updated. Could be empty, if user wasn't offered a selection yet. #[serde(rename="lastUpdatedTimestamp")] pub last_updated_timestamp: Option, - /// Email address that can be used for marketing purposes. This field is only filled when explicitMarketingPreference is equal to 'granted'. + /// Email address that can be used for marketing purposes. The field may be empty even if explicitMarketingPreference is 'granted'. This happens when retrieving an old order from the customer who deleted their account. #[serde(rename="marketingEmailAddress")] pub marketing_email_address: Option, } @@ -917,33 +932,24 @@ pub struct OrderCustomerMarketingRightsInfo { impl Part for OrderCustomerMarketingRightsInfo {} -/// The single value of a rate group or the value of a rate group table's cell. Exactly one of noShipping, flatRate, pricePercentage, carrierRateName, subtableName must be set. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Value { - /// The name of a carrier rate referring to a carrier rate defined in the same rate group. Can only be set if all other fields are not set. - #[serde(rename="carrierRateName")] - pub carrier_rate_name: Option, - /// If true, then the product can't ship. Must be true when set, can only be set if all other fields are not set. - #[serde(rename="noShipping")] - pub no_shipping: Option, - /// A percentage of the price represented as a number in decimal notation (e.g., "5.4"). Can only be set if all other fields are not set. - #[serde(rename="pricePercentage")] - pub price_percentage: Option, - /// A flat rate. Can only be set if all other fields are not set. - #[serde(rename="flatRate")] - pub flat_rate: Option, - /// The name of a subtable. Can only be set in table cells (i.e., not for single values), and only if all other fields are not set. - #[serde(rename="subtableName")] - pub subtable_name: Option, +pub struct TransitTableTransitTimeRowTransitTimeValue { + /// Must be greater than or equal to minTransitTimeInDays. + #[serde(rename="maxTransitTimeInDays")] + pub max_transit_time_in_days: Option, + /// Transit time range (min-max) in business days. 0 means same day delivery, 1 means next day delivery. + #[serde(rename="minTransitTimeInDays")] + pub min_transit_time_in_days: Option, } -impl Part for Value {} +impl Part for TransitTableTransitTimeRowTransitTimeValue {} -/// A non-empty list of row or column headers for a table. Exactly one of prices, weights, numItems, postalCodeGroupNames, or locations must be set. +/// A non-empty list of row or column headers for a table. Exactly one of prices, weights, numItems, postalCodeGroupNames, or location must be set. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -1089,10 +1095,10 @@ pub struct OrdersCustomBatchRequestEntryRefund { /// The explanation of the reason. #[serde(rename="reasonText")] pub reason_text: Option, - /// Tax amount that correspond to refund amount in amountPretax. + /// Tax amount that corresponds to refund amount in amountPretax. Optional, but if filled, amountPretax must be set. Calculated automatically if not provided. #[serde(rename="amountTax")] pub amount_tax: Option, - /// The amount that is refunded. Either amount or amountPretax and amountTax should be filled. + /// The amount that is refunded. Either amount or amountPretax should be filled. #[serde(rename="amountPretax")] pub amount_pretax: Option, } @@ -1255,14 +1261,22 @@ pub struct ReturnShipment { #[serde(rename="returnMethodType")] pub return_method_type: Option, /// no description provided - #[serde(rename="creationDate")] - pub creation_date: Option, + pub state: Option, /// no description provided #[serde(rename="shipmentTrackingInfos")] pub shipment_tracking_infos: Option>, /// no description provided #[serde(rename="shipmentId")] pub shipment_id: Option, + /// no description provided + #[serde(rename="deliveryDate")] + pub delivery_date: Option, + /// no description provided + #[serde(rename="creationDate")] + pub creation_date: Option, + /// no description provided + #[serde(rename="shippingDate")] + pub shipping_date: Option, } impl Part for ReturnShipment {} @@ -1514,10 +1528,6 @@ impl Part for DatafeedstatusesCustomBatchResponseEntry {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Inventory { - /// Identifies what kind of resource this is. Value: the fixed string "content#inventory". - pub kind: Option, - /// Number and amount of installments to pay for an item. Brazil only. - pub installment: Option, /// A date range represented by a pair of ISO 8601 dates separated by a space, comma, or slash. Both dates might be specified as 'null' if undecided. #[serde(rename="salePriceEffectiveDate")] pub sale_price_effective_date: Option, @@ -1526,16 +1536,38 @@ pub struct Inventory { /// The quantity of the product that is available for selling on Google. Supported only for online products. #[serde(rename="sellOnGoogleQuantity")] pub sell_on_google_quantity: Option, + /// The instore product location. Supported only for local products. + #[serde(rename="instoreProductLocation")] + pub instore_product_location: Option, + /// Loyalty points that users receive after purchasing the item. Japan only. + #[serde(rename="loyaltyPoints")] + pub loyalty_points: Option, + /// Custom label 3 for custom grouping of items in a Shopping campaign. Only supported for online products. + #[serde(rename="customLabel4")] + pub custom_label4: Option, + /// Custom label 3 for custom grouping of items in a Shopping campaign. Only supported for online products. + #[serde(rename="customLabel3")] + pub custom_label3: Option, + /// Custom label 2 for custom grouping of items in a Shopping campaign. Only supported for online products. + #[serde(rename="customLabel2")] + pub custom_label2: Option, + /// Custom label 1 for custom grouping of items in a Shopping campaign. Only supported for online products. + #[serde(rename="customLabel1")] + pub custom_label1: Option, + /// Custom label 0 for custom grouping of items in a Shopping campaign. Only supported for online products. + #[serde(rename="customLabel0")] + pub custom_label0: Option, + /// Identifies what kind of resource this is. Value: the fixed string "content#inventory". + pub kind: Option, + /// Number and amount of installments to pay for an item. Brazil only. + pub installment: Option, + /// The availability of the product. + pub availability: Option, /// Store pickup information. Only supported for local inventory. Not setting pickup means "don't update" while setting it to the empty value ({} in JSON) means "delete". Otherwise, pickupMethod and pickupSla must be set together, unless pickupMethod is "not supported". pub pickup: Option, /// The sale price of the product. Mandatory if sale_price_effective_date is defined. #[serde(rename="salePrice")] pub sale_price: Option, - /// The availability of the product. - pub availability: Option, - /// Loyalty points that users receive after purchasing the item. Japan only. - #[serde(rename="loyaltyPoints")] - pub loyalty_points: Option, /// The quantity of the product. Must be equal to or greater than zero. Supported only for local products. pub quantity: Option, } @@ -1559,7 +1591,7 @@ pub struct OrdersShipLineItemsRequest { pub line_items: Option>, /// Deprecated. Please use shipmentInfo instead. The carrier handling the shipment. See shipments[].carrier in the Orders resource representation for a list of acceptable values. pub carrier: Option, - /// Deprecated. Please use shipmentInfo instead. The tracking id for the shipment. + /// Deprecated. Please use shipmentInfo instead. The tracking ID for the shipment. #[serde(rename="trackingId")] pub tracking_id: Option, /// ID of the shipment group. Required for orders that use the orderinvoices service. @@ -1597,6 +1629,26 @@ pub struct LiasettingsSetInventoryVerificationContactResponse { impl ResponseResult for LiasettingsSetInventoryVerificationContactResponse {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ProductAmount { + /// The pre-tax or post-tax price depending on the location of the order. + #[serde(rename="priceAmount")] + pub price_amount: Option, + /// Remitted tax value. + #[serde(rename="remittedTaxAmount")] + pub remitted_tax_amount: Option, + /// Tax value. + #[serde(rename="taxAmount")] + pub tax_amount: Option, +} + +impl Part for ProductAmount {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1620,7 +1672,7 @@ impl Part for CarriersCarrier {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UnitInvoice { - /// Promotions applied to a unit. + /// Deprecated. pub promotions: Option>, /// [required] Price of the unit, before applying taxes. #[serde(rename="unitPricePretax")] @@ -1636,6 +1688,21 @@ pub struct UnitInvoice { impl Part for UnitInvoice {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderLineItemProductFee { + /// Amount of the fee. + pub amount: Option, + /// Name of the fee. + pub name: Option, +} + +impl Part for OrderLineItemProductFee {} + + /// There is no detailed description. /// /// # Activities @@ -1735,7 +1802,7 @@ pub struct OrdersCustomBatchRequestEntry { /// Required for returnLineItem method. #[serde(rename="returnLineItem")] pub return_line_item: Option, - /// The merchant order id. Required for updateMerchantOrderId and getByMerchantOrderId methods. + /// The merchant order ID. Required for updateMerchantOrderId and getByMerchantOrderId methods. #[serde(rename="merchantOrderId")] pub merchant_order_id: Option, /// Required for returnRefundLineItem method. @@ -1796,26 +1863,6 @@ pub struct AccountsLinkResponse { impl ResponseResult for AccountsLinkResponse {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ProductCustomAttribute { - /// Free-form unit of the attribute. Unit can only be used for values of type int, float, or price. - pub unit: Option, - /// The type of the attribute. - #[serde(rename="type")] - pub type_: Option, - /// The name of the attribute. Underscores will be replaced by spaces upon insertion. - pub name: Option, - /// The value of the attribute. - pub value: Option, -} - -impl Part for ProductCustomAttribute {} - - /// There is no detailed description. /// /// # Activities @@ -1880,7 +1927,7 @@ pub struct OrdersCancelLineItemRequest { pub line_item_id: Option, /// The reason for the cancellation. pub reason: Option, - /// Tax amount that correspond to cancellation amount in amountPretax. + /// Tax amount that corresponds to cancellation amount in amountPretax. Optional, but if filled, then amountPretax must be set. Calculated automatically if not provided. #[serde(rename="amountTax")] pub amount_tax: Option, /// The ID of the operation. Unique across all operations for a given order. @@ -2056,7 +2103,7 @@ pub struct DatafeedFetchSchedule { impl Part for DatafeedFetchSchedule {} -/// There is no detailed description. +/// Local Inventory ads (LIA) settings. All methods except listposdataproviders require the admin role. /// /// # Activities /// @@ -2197,10 +2244,10 @@ impl Part for PosSale {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrderpaymentsNotifyAuthApprovedRequest { - /// no description provided + /// Authorized amount for pre-tax charge on user's credit card. #[serde(rename="authAmountPretax")] pub auth_amount_pretax: Option, - /// no description provided + /// Authorized amount for tax charge on user's credit card. #[serde(rename="authAmountTax")] pub auth_amount_tax: Option, } @@ -2387,21 +2434,6 @@ pub struct DatafeedStatus { impl ResponseResult for DatafeedStatus {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ProductCustomGroup { - /// The sub-attributes. - pub attributes: Option>, - /// The name of the group. Underscores will be replaced by spaces upon insertion. - pub name: Option, -} - -impl Part for ProductCustomGroup {} - - /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -2649,29 +2681,25 @@ impl ResponseResult for OrdersCreateTestOrderResponse {} /// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [getsupportedholidays shippingsettings](struct.ShippingsettingGetsupportedholidayCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OrdersCustomBatchRequestEntryReturnLineItem { - /// The reason for the return. - pub reason: Option, - /// The explanation of the reason. - #[serde(rename="reasonText")] - pub reason_text: Option, - /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required. - #[serde(rename="productId")] - pub product_id: Option, - /// The ID of the line item to return. Either lineItemId or productId is required. - #[serde(rename="lineItemId")] - pub line_item_id: Option, - /// The quantity to return. - pub quantity: Option, +pub struct ShippingsettingsGetSupportedHolidaysResponse { + /// Identifies what kind of resource this is. Value: the fixed string "content#shippingsettingsGetSupportedHolidaysResponse". + pub kind: Option, + /// A list of holidays applicable for delivery guarantees. May be empty. + pub holidays: Option>, } -impl Part for OrdersCustomBatchRequestEntryReturnLineItem {} +impl ResponseResult for ShippingsettingsGetSupportedHolidaysResponse {} -/// The tax settings of a merchant account. +/// The tax settings of a merchant account. All methods require the admin role. /// /// # Activities /// @@ -2853,7 +2881,7 @@ impl Part for OrdersCustomBatchRequestEntryCreateTestReturnReturnItem {} pub struct TestOrder { /// The details of the customer who placed the order. pub customer: Option, - /// Deprecated. The details of the merchant provided promotions applied to the order. More details about the program are here. + /// Deprecated. Ignored if provided. pub promotions: Option>, /// Identifies what kind of resource this is. Value: the fixed string "content#testOrder". pub kind: Option, @@ -2866,7 +2894,7 @@ pub struct TestOrder { /// Identifier of one of the predefined delivery addresses for the delivery. #[serde(rename="predefinedDeliveryAddress")] pub predefined_delivery_address: Option, - /// The total cost of shipping for all items. + /// The price of shipping for all items. Shipping tax is automatically calculated for MFL orders. For non-MFL orders, tax settings from Merchant Center are applied. Note that shipping is not taxed in certain states. #[serde(rename="shippingCost")] pub shipping_cost: Option, /// The requested shipping option. @@ -2875,7 +2903,7 @@ pub struct TestOrder { /// Whether the orderinvoices service should support this order. #[serde(rename="enableOrderinvoices")] pub enable_orderinvoices: Option, - /// The tax for the total shipping cost. + /// Deprecated. Ignored if provided. #[serde(rename="shippingCostTax")] pub shipping_cost_tax: Option, /// The details of the payment method. @@ -2980,7 +3008,7 @@ pub struct AccountStatus { /// The ID of the account for which the status is reported. #[serde(rename="accountId")] pub account_id: Option, - /// A list of data quality issues. + /// DEPRECATED - never populated. #[serde(rename="dataQualityIssues")] pub data_quality_issues: Option>, /// A list of account level issues. @@ -3061,7 +3089,7 @@ impl RequestValue for PosSaleRequest {} pub struct OrdersReturnRefundLineItemRequest { /// The quantity to return and refund. pub quantity: Option, - /// The amount that is refunded. If omitted, refundless return is assumed (same as calling returnLineItem method). Optional, but if filled then both amountPretax and amountTax must be set. + /// The amount that is refunded. If omitted, refundless return is assumed (same as calling returnLineItem method). #[serde(rename="amountPretax")] pub amount_pretax: Option, /// The reason for the return. @@ -3072,7 +3100,7 @@ pub struct OrdersReturnRefundLineItemRequest { /// The ID of the line item to return. Either lineItemId or productId is required. #[serde(rename="lineItemId")] pub line_item_id: Option, - /// Tax amount that correspond to refund amount in amountPretax. + /// Tax amount that corresponds to refund amount in amountPretax. Optional, but if filled, then amountPretax must be set. Calculated automatically if not provided. #[serde(rename="amountTax")] pub amount_tax: Option, /// The ID of the product to return. This is the REST ID used in the products service. Either lineItemId or productId is required. @@ -3102,24 +3130,24 @@ pub struct RefundReason { impl Part for RefundReason {} -/// An example of an item that has poor data quality. An item value on the landing page differs from what is submitted, or conflicts with a policy. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AccountStatusExampleItem { - /// Unique item ID as specified in the uploaded product data. + /// no description provided #[serde(rename="itemId")] pub item_id: Option, - /// The item value that was submitted. + /// no description provided #[serde(rename="submittedValue")] pub submitted_value: Option, - /// Landing page of the item. + /// no description provided pub link: Option, - /// The actual value on the landing page. + /// no description provided #[serde(rename="valueOnLandingPage")] pub value_on_landing_page: Option, - /// Title of the item. + /// no description provided pub title: Option, } @@ -3196,7 +3224,7 @@ pub struct OrderLineItemShippingDetails { impl Part for OrderLineItemShippingDetails {} -/// The merchant account's shipping settings. +/// The merchant account's shipping settings. All methods except getsupportedcarriers and getsupportedholidays require the admin role. /// /// # Activities /// @@ -3223,7 +3251,7 @@ impl RequestValue for ShippingSettings {} impl ResponseResult for ShippingSettings {} -/// There is no detailed description. +/// Order disbursement. All methods require the payment analyst role. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -3257,10 +3285,10 @@ impl Part for OrderReportDisbursement {} pub struct OrdersCustomBatchRequestEntryShipLineItemsShipmentInfo { /// The carrier handling the shipment. See shipments[].carrier in the Orders resource representation for a list of acceptable values. pub carrier: Option, - /// The tracking id for the shipment. + /// The tracking ID for the shipment. #[serde(rename="trackingId")] pub tracking_id: Option, - /// The ID of the shipment. + /// The ID of the shipment. This is assigned by the merchant and is unique to each shipment. #[serde(rename="shipmentId")] pub shipment_id: Option, } @@ -3329,7 +3357,7 @@ pub struct AccountTaxTaxRule { /// If true, shipping charges are also taxed. #[serde(rename="shippingTaxed")] pub shipping_taxed: Option, - /// State (or province) is which the tax is applicable, described by its location id (also called criteria id). + /// State (or province) is which the tax is applicable, described by its location ID (also called criteria ID). #[serde(rename="locationId")] pub location_id: Option, /// Whether the tax rate is taken from a global tax table or specified explicitly. @@ -3400,6 +3428,32 @@ pub struct OrderpaymentsNotifyAuthApprovedResponse { impl ResponseResult for OrderpaymentsNotifyAuthApprovedResponse {} +/// The single value of a rate group or the value of a rate group table's cell. Exactly one of noShipping, flatRate, pricePercentage, carrierRateName, subtableName must be set. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Value { + /// The name of a carrier rate referring to a carrier rate defined in the same rate group. Can only be set if all other fields are not set. + #[serde(rename="carrierRateName")] + pub carrier_rate_name: Option, + /// If true, then the product can't ship. Must be true when set, can only be set if all other fields are not set. + #[serde(rename="noShipping")] + pub no_shipping: Option, + /// A percentage of the price represented as a number in decimal notation (e.g., "5.4"). Can only be set if all other fields are not set. + #[serde(rename="pricePercentage")] + pub price_percentage: Option, + /// A flat rate. Can only be set if all other fields are not set. + #[serde(rename="flatRate")] + pub flat_rate: Option, + /// The name of a subtable. Can only be set in table cells (i.e., not for single values), and only if all other fields are not set. + #[serde(rename="subtableName")] + pub subtable_name: Option, +} + +impl Part for Value {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -3490,7 +3544,7 @@ pub struct OrderreturnsListResponse { impl ResponseResult for OrderreturnsListResponse {} -/// There is no detailed description. +/// Order. All methods require the order manager role. /// /// # Activities /// @@ -3526,18 +3580,21 @@ pub struct Order { pub shipments: Option>, /// The details of the customer who placed the order. pub customer: Option, + /// The party responsible for collecting and remitting taxes. + #[serde(rename="taxCollector")] + pub tax_collector: Option, /// The total cost of shipping for all items. #[serde(rename="shippingCost")] pub shipping_cost: Option, - /// The channel type of the order: "purchaseOnGoogle" or "googleExpress". + /// Deprecated. #[serde(rename="channelType")] pub channel_type: Option, /// The net amount for the order. For example, if an order was originally for a grand total of $100 and a refund was issued for $20, the net amount will be $80. #[serde(rename="netAmount")] pub net_amount: Option, - /// The REST id of the order. Globally unique. + /// The REST ID of the order. Globally unique. pub id: Option, - /// Deprecated. The details of the merchant provided promotions applied to the order. More details about the program are here. + /// The details of the merchant provided promotions applied to the order. More details about the program are here. pub promotions: Option>, /// Identifies what kind of resource this is. Value: the fixed string "content#order". pub kind: Option, @@ -3554,10 +3611,10 @@ pub struct Order { /// no description provided #[serde(rename="merchantId")] pub merchant_id: Option, - /// Merchant-provided id of the order. + /// Merchant-provided ID of the order. #[serde(rename="merchantOrderId")] pub merchant_order_id: Option, - /// The requested shipping option. + /// Deprecated. Shipping details are provided with line items instead. #[serde(rename="shippingOption")] pub shipping_option: Option, /// The status of the order. @@ -3675,7 +3732,7 @@ pub struct OrdersCustomBatchRequestEntryShipLineItems { pub line_items: Option>, /// Deprecated. Please use shipmentInfo instead. The carrier handling the shipment. See shipments[].carrier in the Orders resource representation for a list of acceptable values. pub carrier: Option, - /// Deprecated. Please use shipmentInfo instead. The tracking id for the shipment. + /// Deprecated. Please use shipmentInfo instead. The tracking ID for the shipment. #[serde(rename="trackingId")] pub tracking_id: Option, /// ID of the shipment group. Required for orders that use the orderinvoices service. @@ -3704,7 +3761,7 @@ pub struct ShipmentInvoice { /// [required] Invoice details per line item. #[serde(rename="lineItemInvoices")] pub line_item_invoices: Option>, - /// [required] ID of the shipment group. + /// [required] ID of the shipment group. It is assigned by the merchant in the shipLineItems method and is used to group multiple line items that have the same kind of shipping charges. #[serde(rename="shipmentGroupId")] pub shipment_group_id: Option, } @@ -3721,7 +3778,7 @@ pub struct OrderShipmentLineItemShipment { /// The ID of the product to ship. This is the REST ID used in the products service. Either lineItemId or productId is required. #[serde(rename="productId")] pub product_id: Option, - /// The id of the line item that is shipped. Either lineItemId or productId is required. + /// The ID of the line item that is shipped. Either lineItemId or productId is required. #[serde(rename="lineItemId")] pub line_item_id: Option, /// The quantity that is shipped. @@ -3806,7 +3863,7 @@ pub struct OrdersUpdateShipmentRequest { pub status: Option, /// The carrier handling the shipment. Not updated if missing. See shipments[].carrier in the Orders resource representation for a list of acceptable values. pub carrier: Option, - /// The tracking id for the shipment. Not updated if missing. + /// The tracking ID for the shipment. Not updated if missing. #[serde(rename="trackingId")] pub tracking_id: Option, /// The ID of the shipment. @@ -3873,18 +3930,16 @@ pub struct InvoiceSummary { /// [required] Total price for the product. #[serde(rename="productTotal")] pub product_total: Option, - /// [required] Google balance on this invoice. A negative amount means Google is paying, a positive one means Google is receiving money. Note: the sum of merchant_balance, customer_balance and google_balance must always be zero. + /// Deprecated. #[serde(rename="googleBalance")] pub google_balance: Option, - /// [required] Merchant balance on this invoice. A negative amount means the merchant is paying, a positive one means the merchant is receiving money. Note: the sum of merchant_balance, customer_balance and google_balance must always be zero. + /// Deprecated. #[serde(rename="merchantBalance")] pub merchant_balance: Option, - /// Summary for each promotion. + /// Deprecated. #[serde(rename="promotionSummaries")] pub promotion_summaries: Option>, - /// [required] Customer balance on this invoice. A negative amount means the customer is paying, a positive one means the customer is receiving money. Note: the sum of merchant_balance, customer_balance and google_balance must always be zero. - /// - /// Furthermore the absolute value of this amount is expected to be equal to the sum of product amount and additional charges, minus promotions. + /// Deprecated. #[serde(rename="customerBalance")] pub customer_balance: Option, /// Summary of the total amounts of the additional charges. @@ -3958,6 +4013,8 @@ pub struct OrdersUpdateLineItemShippingDetailsRequest { #[serde(rename="operationId")] pub operation_id: Option, /// Updated delivery by date, in ISO 8601 format. If not specified only ship by date is updated. + /// + /// Provided date should be within 1 year timeframe and can not be a date in the past. #[serde(rename="deliverByDate")] pub deliver_by_date: Option, /// The ID of the product to set metadata. This is the REST ID used in the products service. Either lineItemId or productId is required. @@ -3967,6 +4024,8 @@ pub struct OrdersUpdateLineItemShippingDetailsRequest { #[serde(rename="lineItemId")] pub line_item_id: Option, /// Updated ship by date, in ISO 8601 format. If not specified only deliver by date is updated. + /// + /// Provided date should be within 1 year timeframe and can not be a date in the past. #[serde(rename="shipByDate")] pub ship_by_date: Option, } @@ -4049,6 +4108,8 @@ impl ResponseResult for OrderinvoicesCreateRefundInvoiceResponse {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrdersCustomBatchRequestEntryUpdateLineItemShippingDetails { /// Updated delivery by date, in ISO 8601 format. If not specified only ship by date is updated. + /// + /// Provided date should be within 1 year timeframe and can not be a date in the past. #[serde(rename="deliverByDate")] pub deliver_by_date: Option, /// The ID of the product to set metadata. This is the REST ID used in the products service. Either lineItemId or productId is required. @@ -4058,6 +4119,8 @@ pub struct OrdersCustomBatchRequestEntryUpdateLineItemShippingDetails { #[serde(rename="lineItemId")] pub line_item_id: Option, /// Updated ship by date, in ISO 8601 format. If not specified only deliver by date is updated. + /// + /// Provided date should be within 1 year timeframe and can not be a date in the past. #[serde(rename="shipByDate")] pub ship_by_date: Option, } @@ -4142,12 +4205,15 @@ impl ResponseResult for AccounttaxCustomBatchResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrderReportTransaction { - /// The id of the order. + /// The ID of the order. #[serde(rename="orderId")] pub order_id: Option, /// The date the disbursement was created, in ISO 8601 format. #[serde(rename="disbursementCreationDate")] pub disbursement_creation_date: Option, + /// Total amount with remitted tax for the items. + #[serde(rename="productAmountWithRemittedTax")] + pub product_amount_with_remitted_tax: Option, /// Total amount for the items. #[serde(rename="productAmount")] pub product_amount: Option, @@ -4157,7 +4223,7 @@ pub struct OrderReportTransaction { /// The date of the transaction, in ISO 8601 format. #[serde(rename="transactionDate")] pub transaction_date: Option, - /// Merchant-provided id of the order. + /// Merchant-provided ID of the order. #[serde(rename="merchantOrderId")] pub merchant_order_id: Option, /// The disbursement amount. @@ -4192,6 +4258,26 @@ pub struct InventorySetResponse { impl ResponseResult for InventorySetResponse {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CustomAttribute { + /// Free-form unit of the attribute. Unit can only be used for values of type int, float, or price. + pub unit: Option, + /// The type of the attribute. + #[serde(rename="type")] + pub type_: Option, + /// The name of the attribute. Underscores will be replaced by spaces upon insertion. + pub name: Option, + /// The value of the attribute. + pub value: Option, +} + +impl Part for CustomAttribute {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -4204,7 +4290,7 @@ pub struct TestOrderCustomer { /// Full name of the customer. #[serde(rename="fullName")] pub full_name: Option, - /// Deprecated. + /// Email address of the customer. pub email: Option, /// Customer's marketing preferences. #[serde(rename="marketingRightsInfo")] @@ -4267,10 +4353,6 @@ impl Part for ProductStatusItemLevelIssue {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ProductShippingDimension { /// The unit of value. - /// - /// Acceptable values are: - /// - "cm" - /// - "in" pub unit: Option, /// The dimension of the product used to calculate the shipping cost of the item. pub value: Option, @@ -4308,7 +4390,7 @@ impl ResponseResult for OrdersListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ProductShipping { - /// The numeric id of a location that the shipping rate applies to as defined in the AdWords API. + /// The numeric ID of a location that the shipping rate applies to as defined in the AdWords API. #[serde(rename="locationId")] pub location_id: Option, /// A free-form description of the service class or delivery speed. @@ -4465,7 +4547,7 @@ impl Part for OrderReturn {} pub struct ProductTax { /// The percentage of tax rate that applies to the item price. pub rate: Option, - /// The numeric id of a location that the tax rate applies to as defined in the AdWords API. + /// The numeric ID of a location that the tax rate applies to as defined in the AdWords API. #[serde(rename="locationId")] pub location_id: Option, /// The postal code range that the tax rate applies to, represented by a ZIP code, a ZIP code prefix using * wildcard, a range between two ZIP codes or two ZIP code prefixes of equal length. Examples: 94114, 94*, 94002-95460, 94*-95*. @@ -4533,7 +4615,7 @@ pub struct UnitInvoiceAdditionalCharge { /// [required] Type of the additional charge. #[serde(rename="type")] pub type_: Option, - /// Promotions applied to the additional charge. + /// Deprecated. #[serde(rename="additionalChargePromotions")] pub additional_charge_promotions: Option>, } @@ -4739,25 +4821,25 @@ impl ResponseResult for PosCustomBatchResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ProductStatusDataQualityIssue { - /// The value the attribute had at time of evaluation. + /// no description provided #[serde(rename="valueProvided")] pub value_provided: Option, - /// The severity of the data quality issue. + /// no description provided pub severity: Option, - /// The time stamp of the data quality issue. + /// no description provided pub timestamp: Option, - /// The destination the issue applies to. + /// no description provided pub destination: Option, - /// A more detailed error string. + /// no description provided pub detail: Option, - /// The attribute name that is relevant for the issue. + /// no description provided pub location: Option, - /// The value of that attribute that was found on the landing page + /// no description provided #[serde(rename="valueOnLandingPage")] pub value_on_landing_page: Option, - /// The id of the data quality issue. + /// no description provided pub id: Option, - /// The fetch status for landing_page_errors. + /// no description provided #[serde(rename="fetchStatus")] pub fetch_status: Option, } @@ -4856,7 +4938,7 @@ impl Part for LiaAboutPageSettings {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrderLineItem { - /// Product data from the time of the order placement. + /// Product data as seen by customer from the time of the order placement. Note that certain attributes values (e.g. title or gtin) might be reformatted and no longer match values submitted via product feed. pub product: Option, /// Number of items delivered. #[serde(rename="quantityDelivered")] @@ -4876,7 +4958,7 @@ pub struct OrderLineItem { /// Number of items canceled. #[serde(rename="quantityCanceled")] pub quantity_canceled: Option, - /// The id of the line item. + /// The ID of the line item. pub id: Option, /// Returns of the line item. pub returns: Option>, @@ -4918,7 +5000,7 @@ pub struct OrdersCustomBatchRequestEntryCancelLineItem { pub line_item_id: Option, /// The reason for the cancellation. pub reason: Option, - /// Tax amount that correspond to cancellation amount in amountPretax. + /// Tax amount that corresponds to cancellation amount in amountPretax. Optional, but if filled, then amountPretax must be set. Calculated automatically if not provided. #[serde(rename="amountTax")] pub amount_tax: Option, /// The quantity to cancel. @@ -5003,7 +5085,7 @@ impl ResponseResult for AccountsClaimWebsiteResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrdersCustomBatchRequestEntryReturnRefundLineItem { - /// The amount that is refunded. If omitted, refundless return is assumed (same as calling returnLineItem method). Optional, but if filled then both amountPretax and amountTax must be set. + /// The amount that is refunded. If omitted, refundless return is assumed (same as calling returnLineItem method). #[serde(rename="amountPretax")] pub amount_pretax: Option, /// The explanation of the reason. @@ -5012,7 +5094,7 @@ pub struct OrdersCustomBatchRequestEntryReturnRefundLineItem { /// The ID of the line item to return. Either lineItemId or productId is required. #[serde(rename="lineItemId")] pub line_item_id: Option, - /// Tax amount that correspond to refund amount in amountPretax. + /// Tax amount that corresponds to refund amount in amountPretax. Optional, but if filled, then amountPretax must be set. Calculated automatically if not provided. #[serde(rename="amountTax")] pub amount_tax: Option, /// The quantity to return and refund. @@ -5071,10 +5153,10 @@ pub struct DeliveryTime { /// Business days cutoff time definition. If not configured the cutoff time will be defaulted to 8AM PST. #[serde(rename="cutoffTime")] pub cutoff_time: Option, - /// Maximum number of business days that is spent in transit. 0 means same day delivery, 1 means next day delivery. Must be greater than or equal to minTransitTimeInDays. Required. + /// Maximum number of business days that is spent in transit. 0 means same day delivery, 1 means next day delivery. Must be greater than or equal to minTransitTimeInDays. #[serde(rename="maxTransitTimeInDays")] pub max_transit_time_in_days: Option, - /// Minimum number of business days that is spent in transit. 0 means same day delivery, 1 means next day delivery. Required. + /// Minimum number of business days that is spent in transit. 0 means same day delivery, 1 means next day delivery. Either {min,max}transitTimeInDays or transitTimeTable must be set, but not both. #[serde(rename="minTransitTimeInDays")] pub min_transit_time_in_days: Option, /// Maximum number of business days spent before an order is shipped. 0 means same day shipped, 1 means next day shipped. Must be greater than or equal to minHandlingTimeInDays. @@ -5083,6 +5165,9 @@ pub struct DeliveryTime { /// Holiday cutoff definitions. If configured, they specify order cutoff times for holiday-specific shipping. #[serde(rename="holidayCutoffs")] pub holiday_cutoffs: Option>, + /// Transit time table, number of business days spent in transit based on row and column dimensions. Either {min,max}transitTimeInDays or transitTimeTable can be set, but not both. + #[serde(rename="transitTimeTable")] + pub transit_time_table: Option, } impl Part for DeliveryTime {} @@ -5181,6 +5266,25 @@ pub struct ShippingsettingsCustomBatchResponse { impl ResponseResult for ShippingsettingsCustomBatchResponse {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TransitTable { + /// no description provided + pub rows: Option>, + /// A list of postal group names. The last value can be "all other locations". Example: ["zone 1", "zone 2", "all other locations"]. The referred postal code groups must match the delivery country of the service. + #[serde(rename="postalCodeGroupNames")] + pub postal_code_group_names: Option>, + /// A list of transit time labels. The last value can be "all other labels". Example: ["food", "electronics", "all other labels"]. + #[serde(rename="transitTimeLabels")] + pub transit_time_labels: Option>, +} + +impl Part for TransitTable {} + + /// There is no detailed description. /// /// # Activities @@ -5333,25 +5437,30 @@ pub struct LiasettingsCustomBatchRequestEntry { impl Part for LiasettingsCustomBatchRequestEntry {} -/// There is no detailed description. +/// A batch entry encoding a single non-batch datafeedstatuses request. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [cancellineitem orders](struct.OrderCancellineitemCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OrdersCancelLineItemResponse { - /// Identifies what kind of resource this is. Value: the fixed string "content#ordersCancelLineItemResponse". - pub kind: Option, - /// The status of the execution. - #[serde(rename="executionStatus")] - pub execution_status: Option, +pub struct DatafeedstatusesCustomBatchRequestEntry { + /// An entry ID, unique within the batch request. + #[serde(rename="batchId")] + pub batch_id: Option, + /// The language for which to get the datafeed status. If this parameter is provided then country must also be provided. Note that for multi-target datafeeds this parameter is required. + pub language: Option, + /// The ID of the data feed to get. + #[serde(rename="datafeedId")] + pub datafeed_id: Option, + /// The country for which to get the datafeed status. If this parameter is provided then language must also be provided. Note that for multi-target datafeeds this parameter is required. + pub country: Option, + /// The ID of the managing account. + #[serde(rename="merchantId")] + pub merchant_id: Option, + /// no description provided + pub method: Option, } -impl ResponseResult for OrdersCancelLineItemResponse {} +impl Part for DatafeedstatusesCustomBatchRequestEntry {} /// There is no detailed description. @@ -5433,7 +5542,7 @@ pub struct ShipmentInvoiceLineItemInvoice { /// [required] Invoice details for a single unit. #[serde(rename="unitInvoice")] pub unit_invoice: Option, - /// [required] Unit IDs to define specific units within the line item. + /// [required] The shipment unit ID is assigned by the merchant and defines individual quantities within a line item. The same ID can be assigned to units that are the same while units that differ must be assigned a different ID (for example: free or promotional units). #[serde(rename="shipmentUnitIds")] pub shipment_unit_ids: Option>, /// ID of the line item. Either lineItemId or productId must be set. @@ -5485,30 +5594,25 @@ pub struct InventoryCustomBatchResponseEntry { impl Part for InventoryCustomBatchResponseEntry {} -/// A batch entry encoding a single non-batch datafeedstatuses request. +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [cancellineitem orders](struct.OrderCancellineitemCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DatafeedstatusesCustomBatchRequestEntry { - /// An entry ID, unique within the batch request. - #[serde(rename="batchId")] - pub batch_id: Option, - /// The language for which to get the datafeed status. If this parameter is provided then country must also be provided. Note that for multi-target datafeeds this parameter is required. - pub language: Option, - /// The ID of the data feed to get. - #[serde(rename="datafeedId")] - pub datafeed_id: Option, - /// The country for which to get the datafeed status. If this parameter is provided then language must also be provided. Note that for multi-target datafeeds this parameter is required. - pub country: Option, - /// The ID of the managing account. - #[serde(rename="merchantId")] - pub merchant_id: Option, - /// no description provided - pub method: Option, +pub struct OrdersCancelLineItemResponse { + /// Identifies what kind of resource this is. Value: the fixed string "content#ordersCancelLineItemResponse". + pub kind: Option, + /// The status of the execution. + #[serde(rename="executionStatus")] + pub execution_status: Option, } -impl Part for DatafeedstatusesCustomBatchRequestEntry {} +impl ResponseResult for OrdersCancelLineItemResponse {} /// There is no detailed description. @@ -5594,7 +5698,7 @@ impl RequestValue for DatafeedstatusesCustomBatchRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrdersRefundRequest { - /// The amount that is refunded. Either amount or amountPretax and amountTax should be filled. + /// The amount that is refunded. Either amount or amountPretax should be filled. #[serde(rename="amountPretax")] pub amount_pretax: Option, /// The explanation of the reason. @@ -5602,7 +5706,7 @@ pub struct OrdersRefundRequest { pub reason_text: Option, /// The reason for the refund. pub reason: Option, - /// Tax amount that correspond to refund amount in amountPretax. + /// Tax amount that corresponds to refund amount in amountPretax. Optional, but if filled, amountPretax must be set. Calculated automatically if not provided. #[serde(rename="amountTax")] pub amount_tax: Option, /// Deprecated. Please use amountPretax and amountTax instead. @@ -5656,6 +5760,21 @@ pub struct DatafeedsListResponse { impl ResponseResult for DatafeedsListResponse {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CustomGroup { + /// The sub-attributes. + pub attributes: Option>, + /// The name of the group. Underscores will be replaced by spaces upon insertion. + pub name: Option, +} + +impl Part for CustomGroup {} + + /// There is no detailed description. /// /// # Activities @@ -5900,31 +6019,31 @@ impl ResponseResult for AccountsListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AccountStatusDataQualityIssue { - /// Actual value displayed on the landing page. + /// no description provided #[serde(rename="displayedValue")] pub displayed_value: Option, - /// Severity of the problem. + /// no description provided pub severity: Option, - /// Last time the account was checked for this issue. + /// no description provided #[serde(rename="lastChecked")] pub last_checked: Option, - /// Country for which this issue is reported. + /// no description provided pub country: Option, - /// The destination the issue applies to. + /// no description provided pub destination: Option, - /// A more detailed description of the issue. + /// no description provided pub detail: Option, - /// Submitted value that causes the issue. + /// no description provided #[serde(rename="submittedValue")] pub submitted_value: Option, - /// Number of items in the account found to have the said issue. + /// no description provided #[serde(rename="numItems")] pub num_items: Option, - /// The attribute name that is relevant for the issue. + /// no description provided pub location: Option, - /// Issue identifier. + /// no description provided pub id: Option, - /// Example items featuring the issue. + /// no description provided #[serde(rename="exampleItems")] pub example_items: Option>, } @@ -5991,7 +6110,7 @@ pub struct OrderShipment { pub creation_date: Option, /// The carrier handling the shipment. /// - /// Acceptable values are: + /// Acceptable values for US are: /// - "gsx" /// - "ups" /// - "usps" @@ -6007,9 +6126,13 @@ pub struct OrderShipment { /// - "dynamex" /// - "lasership" /// - "mpx" - /// - "uds" + /// - "uds" + /// + /// Acceptable values for FR are: + /// - "colissimo" + /// - "chronopost" pub carrier: Option, - /// The tracking id for the shipment. + /// The tracking ID for the shipment. #[serde(rename="trackingId")] pub tracking_id: Option, /// Date on which the shipment has been delivered, in ISO 8601 format. Present only if status is delivered @@ -6018,7 +6141,7 @@ pub struct OrderShipment { /// The line items that are shipped. #[serde(rename="lineItems")] pub line_items: Option>, - /// The id of the shipment. + /// The ID of the shipment. pub id: Option, } @@ -6036,7 +6159,7 @@ pub struct TestOrderLineItem { pub return_info: Option, /// Product data from the time of the order placement. pub product: Option, - /// Unit tax for the line item. + /// Deprecated. Ignored if provided. #[serde(rename="unitTax")] pub unit_tax: Option, /// Number of items ordered. @@ -6217,6 +6340,19 @@ pub struct MerchantOrderReturnItem { impl Part for MerchantOrderReturnItem {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TransitTableTransitTimeRow { + /// no description provided + pub values: Option>, +} + +impl Part for TransitTableTransitTimeRow {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -6251,9 +6387,9 @@ pub struct TestOrderLineItemProduct { pub gtin: Option, /// Condition or state of the item. pub condition: Option, - /// The price for the product. + /// The price for the product. Tax is automatically calculated for MFL orders. For non-MFL orders, tax settings from Merchant Center are applied. pub price: Option, - /// The item's channel. + /// Deprecated. pub channel: Option, } @@ -6447,6 +6583,12 @@ pub struct InventorySetRequest { pub sale_price_effective_date: Option, /// The price of the product. pub price: Option, + /// Custom label 2 for custom grouping of items in a Shopping campaign. Only supported for online products. + #[serde(rename="customLabel2")] + pub custom_label2: Option, + /// Custom label 1 for custom grouping of items in a Shopping campaign. Only supported for online products. + #[serde(rename="customLabel1")] + pub custom_label1: Option, /// The quantity of the product that is available for selling on Google. Supported only for online products. #[serde(rename="sellOnGoogleQuantity")] pub sell_on_google_quantity: Option, @@ -6455,6 +6597,18 @@ pub struct InventorySetRequest { /// The sale price of the product. Mandatory if sale_price_effective_date is defined. #[serde(rename="salePrice")] pub sale_price: Option, + /// The instore product location. Supported only for local products. + #[serde(rename="instoreProductLocation")] + pub instore_product_location: Option, + /// Custom label 0 for custom grouping of items in a Shopping campaign. Only supported for online products. + #[serde(rename="customLabel0")] + pub custom_label0: Option, + /// Custom label 3 for custom grouping of items in a Shopping campaign. Only supported for online products. + #[serde(rename="customLabel4")] + pub custom_label4: Option, + /// Custom label 3 for custom grouping of items in a Shopping campaign. Only supported for online products. + #[serde(rename="customLabel3")] + pub custom_label3: Option, /// The availability of the product. pub availability: Option, /// Loyalty points that users receive after purchasing the item. Japan only. @@ -6505,7 +6659,7 @@ pub struct OrderinvoicesCreateChargeInvoiceRequest { /// [required] Invoice details per line item. #[serde(rename="lineItemInvoices")] pub line_item_invoices: Option>, - /// [required] ID of the shipment group. + /// [required] ID of the shipment group. It is assigned by the merchant in the shipLineItems method and is used to group multiple line items that have the same kind of shipping charges. #[serde(rename="shipmentGroupId")] pub shipment_group_id: Option, /// [required] The ID of the operation, unique across all operations for a given order. @@ -6659,7 +6813,7 @@ pub struct ProductstatusesCustomBatchResponseEntry { impl Part for ProductstatusesCustomBatchResponseEntry {} -/// Product data. +/// Product data. After inserting, updating, or deleting a product, it may take several minutes before changes take effect. /// /// # Activities /// @@ -6799,7 +6953,7 @@ pub struct Product { #[serde(rename="additionalImageLinks")] pub additional_image_links: Option>, /// A unique identifier for the item. Leading and trailing whitespaces are stripped and multiple whitespaces are replaced by a single whitespace upon submission. Only valid unicode characters are accepted. See the products feed specification for details. - /// Note: Content API methods that operate on products take the REST id of the product, not this identifier. + /// Note: Content API methods that operate on products take the REST ID of the product, not this identifier. #[serde(rename="offerId")] pub offer_id: Option, /// Minimal product handling time (in business days). @@ -6821,8 +6975,8 @@ pub struct Product { /// Offer margin for dynamic remarketing campaigns. #[serde(rename="displayAdsValue")] pub display_ads_value: Option, - /// The REST id of the product. Content API methods that operate on products take this as their productId parameter. - /// The REST id for a product is of the form channel:contentLanguage:targetCountry:offerId. + /// The REST ID of the product. Content API methods that operate on products take this as their productId parameter. + /// The REST ID for a product is of the form channel:contentLanguage:targetCountry:offerId. pub id: Option, /// Width of the item for shipping. #[serde(rename="shippingWidth")] @@ -6832,9 +6986,9 @@ pub struct Product { /// The measure and dimension of an item. #[serde(rename="unitPricingMeasure")] pub unit_pricing_measure: Option, - /// A list of custom (merchant-provided) attributes. It can also be used for submitting any attribute of the feed specification in its generic form (e.g., { "name": "size type", "type": "text", "value": "regular" }). This is useful for submitting attributes not explicitly exposed by the API. + /// A list of custom (merchant-provided) attributes. It can also be used for submitting any attribute of the feed specification in its generic form (e.g., { "name": "size type", "value": "regular" }). This is useful for submitting attributes not explicitly exposed by the API. #[serde(rename="customAttributes")] - pub custom_attributes: Option>, + pub custom_attributes: Option>, /// The day a pre-ordered product becomes available for delivery, in ISO 8601 format. #[serde(rename="availabilityDate")] pub availability_date: Option, @@ -6865,7 +7019,7 @@ pub struct Product { pub validated_destinations: Option>, /// A list of custom (merchant-provided) custom attribute groups. #[serde(rename="customGroups")] - pub custom_groups: Option>, + pub custom_groups: Option>, /// Loyalty points that users receive after purchasing the item. Japan only. #[serde(rename="loyaltyPoints")] pub loyalty_points: Option, @@ -7050,7 +7204,7 @@ impl<'a, C, A> OrderreportMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of transactions for an disbursement from your Merchant Center account. + /// Retrieves a list of transactions for a disbursement from your Merchant Center account. /// /// # Arguments /// @@ -7683,6 +7837,9 @@ impl<'a, C, A> DatafeedMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes, fetches, gets, inserts and updates multiple datafeeds in a single request. /// /// # Arguments /// @@ -8048,6 +8205,9 @@ impl<'a, C, A> AccountstatuseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Retrieves multiple Merchant Center account statuses in a single request. /// /// # Arguments /// @@ -8064,7 +8224,7 @@ impl<'a, C, A> AccountstatuseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the status of a Merchant Center account. Multi-client accounts can only call this method for sub-accounts. + /// Retrieves the status of a Merchant Center account. No itemLevelIssues are returned for multi-client accounts. /// /// # Arguments /// @@ -8387,7 +8547,7 @@ impl<'a, C, A> InventoryMethods<'a, C, A> { /// * `request` - No description provided. /// * `merchantId` - The ID of the account that contains the product. This account cannot be a multi-client account. /// * `storeCode` - The code of the store for which to update price and availability. Use online to update price and availability of an online product. - /// * `productId` - The REST id of the product for which to update price and availability. + /// * `productId` - The REST ID of the product for which to update price and availability. pub fn set(&self, request: InventorySetRequest, merchant_id: &str, store_code: &str, product_id: &str) -> InventorySetCall<'a, C, A> { InventorySetCall { hub: self.hub, @@ -8452,15 +8612,19 @@ impl<'a, C, A> LiasettingMethods<'a, C, A> { /// /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and accountId must be the ID of a sub-account of this account. /// * `accountId` - The ID of the account that manages the order. This cannot be a multi-client account. - pub fn setinventoryverificationcontact(&self, merchant_id: &str, account_id: &str) -> LiasettingSetinventoryverificationcontactCall<'a, C, A> { + /// * `contactEmail` - The email of the inventory verification contact. + /// * `contactName` - The name of the inventory verification contact. + /// * `country` - The country for which inventory verification is requested. + /// * `language` - The language for which inventory verification is requested. + pub fn setinventoryverificationcontact(&self, merchant_id: &str, account_id: &str, contact_email: &str, contact_name: &str, country: &str, language: &str) -> LiasettingSetinventoryverificationcontactCall<'a, C, A> { LiasettingSetinventoryverificationcontactCall { hub: self.hub, _merchant_id: merchant_id.to_string(), _account_id: account_id.to_string(), - _language: Default::default(), - _country: Default::default(), - _contact_name: Default::default(), - _contact_email: Default::default(), + _contact_email: contact_email.to_string(), + _contact_name: contact_name.to_string(), + _country: country.to_string(), + _language: language.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -8569,12 +8733,13 @@ impl<'a, C, A> LiasettingMethods<'a, C, A> { /// /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and accountId must be the ID of a sub-account of this account. /// * `accountId` - The ID of the account for which GMB access is requested. - pub fn requestgmbaccess(&self, merchant_id: &str, account_id: &str) -> LiasettingRequestgmbaccesCall<'a, C, A> { + /// * `gmbEmail` - The email of the Google My Business account. + pub fn requestgmbaccess(&self, merchant_id: &str, account_id: &str, gmb_email: &str) -> LiasettingRequestgmbaccesCall<'a, C, A> { LiasettingRequestgmbaccesCall { hub: self.hub, _merchant_id: merchant_id.to_string(), _account_id: account_id.to_string(), - _gmb_email: Default::default(), + _gmb_email: gmb_email.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -8647,14 +8812,15 @@ impl<'a, C, A> LiasettingMethods<'a, C, A> { /// /// * `merchantId` - The ID of the managing account. If this parameter is not the same as accountId, then this account must be a multi-client account and accountId must be the ID of a sub-account of this account. /// * `accountId` - The ID of the account for which to retrieve accessible Google My Business accounts. - pub fn setposdataprovider(&self, merchant_id: &str, account_id: &str) -> LiasettingSetposdataproviderCall<'a, C, A> { + /// * `country` - The country for which the POS data provider is selected. + pub fn setposdataprovider(&self, merchant_id: &str, account_id: &str, country: &str) -> LiasettingSetposdataproviderCall<'a, C, A> { LiasettingSetposdataproviderCall { hub: self.hub, _merchant_id: merchant_id.to_string(), _account_id: account_id.to_string(), + _country: country.to_string(), _pos_external_account_id: Default::default(), _pos_data_provider_id: Default::default(), - _country: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -8732,7 +8898,7 @@ impl<'a, C, A> ProductstatuseMethods<'a, C, A> { /// # Arguments /// /// * `merchantId` - The ID of the account that contains the product. This account cannot be a multi-client account. - /// * `productId` - The REST id of the product. + /// * `productId` - The REST ID of the product. pub fn get(&self, merchant_id: &str, product_id: &str) -> ProductstatuseGetCall<'a, C, A> { ProductstatuseGetCall { hub: self.hub, @@ -8851,7 +9017,7 @@ impl<'a, C, A> ProductMethods<'a, C, A> { /// # Arguments /// /// * `merchantId` - The ID of the account that contains the product. This account cannot be a multi-client account. - /// * `productId` - The REST id of the product. + /// * `productId` - The REST ID of the product. pub fn delete(&self, merchant_id: &str, product_id: &str) -> ProductDeleteCall<'a, C, A> { ProductDeleteCall { hub: self.hub, @@ -8891,7 +9057,7 @@ impl<'a, C, A> ProductMethods<'a, C, A> { /// # Arguments /// /// * `merchantId` - The ID of the account that contains the product. This account cannot be a multi-client account. - /// * `productId` - The REST id of the product. + /// * `productId` - The REST ID of the product. pub fn get(&self, merchant_id: &str, product_id: &str) -> ProductGetCall<'a, C, A> { ProductGetCall { hub: self.hub, @@ -8985,6 +9151,9 @@ impl<'a, C, A> DatafeedstatuseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets multiple Merchant Center datafeed statuses in a single request. /// /// # Arguments /// @@ -9044,6 +9213,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Notifies that item return and refund was handled directly by merchant outside of Google payments processing (e.g. cash refund done in store). + /// Note: We recommend calling the returnrefundlineitem method to refund in-store returns. We will issue the refund directly to the customer. This helps to prevent possible differences arising between merchant and Google transaction records. We also recommend having the point of sale system communicate with Google to ensure that customers do not receive a double refund by first refunding via Google then via an in-store return. /// /// # Arguments /// @@ -9085,12 +9255,12 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves an order using merchant order id. + /// Retrieves an order using merchant order ID. /// /// # Arguments /// /// * `merchantId` - The ID of the account that manages the order. This cannot be a multi-client account. - /// * `merchantOrderId` - The merchant order id to be looked for. + /// * `merchantOrderId` - The merchant order ID to be looked for. pub fn getbymerchantorderid(&self, merchant_id: &str, merchant_order_id: &str) -> OrderGetbymerchantorderidCall<'a, C, A> { OrderGetbymerchantorderidCall { hub: self.hub, @@ -9104,7 +9274,7 @@ impl<'a, C, A> OrderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets (overrides) merchant provided annotations on the line item. + /// Sets (or overrides if it already exists) merchant provided annotations in the form of key-value pairs. A common use case would be to supply us with additional structured information about a line item that cannot be provided via other methods. Submitted key-value pairs can be retrieved as part of the orders resource. /// /// # Arguments /// @@ -9701,10 +9871,7 @@ impl<'a, C, A> OrderreportListdisbursementCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9724,7 +9891,7 @@ impl<'a, C, A> OrderreportListdisbursementCall<'a, C, A> where C: BorrowMut OrderreportListdisbursementCall<'a, C, A> where C: BorrowMut OrderreportListdisbursementCall<'a, C, A> where C: BorrowMut OrderreportListtransactionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10017,7 +10181,7 @@ impl<'a, C, A> OrderreportListtransactionCall<'a, C, A> where C: BorrowMut OrderreportListtransactionCall<'a, C, A> where C: BorrowMut OrderreturnGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10303,7 +10464,7 @@ impl<'a, C, A> OrderreturnGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10391,7 +10552,7 @@ impl<'a, C, A> OrderreturnGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10558,10 +10719,7 @@ impl<'a, C, A> OrderreturnListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10581,7 +10739,7 @@ impl<'a, C, A> OrderreturnListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10694,7 +10852,7 @@ impl<'a, C, A> OrderreturnListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10850,10 +11008,7 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10885,7 +11040,7 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10970,7 +11125,7 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, self._account_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> AccounttaxUpdateCall<'a, C, A> { @@ -10992,7 +11147,7 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11136,10 +11291,7 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11159,7 +11311,7 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11247,7 +11399,7 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11378,10 +11530,7 @@ impl<'a, C, A> AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11413,7 +11562,7 @@ impl<'a, C, A> AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut AccounttaxCustombatchCall<'a, C, A> { @@ -11500,7 +11649,7 @@ impl<'a, C, A> AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut AccounttaxPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11691,7 +11837,7 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11776,7 +11922,7 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, self._account_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> AccounttaxPatchCall<'a, C, A> { @@ -11798,7 +11944,7 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11950,10 +12096,7 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11973,7 +12116,7 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12065,7 +12208,7 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12216,10 +12359,7 @@ impl<'a, C, A> OrderpaymentNotifyauthapprovedCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12251,7 +12391,7 @@ impl<'a, C, A> OrderpaymentNotifyauthapprovedCall<'a, C, A> where C: BorrowMut OrderpaymentNotifyauthapprovedCall<'a, C, A> where C: BorrowMut OrderpaymentNotifyauthdeclinedCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12537,7 +12674,7 @@ impl<'a, C, A> OrderpaymentNotifyauthdeclinedCall<'a, C, A> where C: BorrowMut OrderpaymentNotifyauthdeclinedCall<'a, C, A> where C: BorrowMut OrderpaymentNotifychargeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12823,7 +12957,7 @@ impl<'a, C, A> OrderpaymentNotifychargeCall<'a, C, A> where C: BorrowMut OrderpaymentNotifychargeCall<'a, C, A> where C: BorrowMut OrderpaymentNotifyrefundCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13109,7 +13240,7 @@ impl<'a, C, A> OrderpaymentNotifyrefundCall<'a, C, A> where C: BorrowMut OrderpaymentNotifyrefundCall<'a, C, A> where C: BorrowMut ShippingsettingGetsupportedcarrierCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13374,7 +13502,7 @@ impl<'a, C, A> ShippingsettingGetsupportedcarrierCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13452,7 +13580,7 @@ impl<'a, C, A> ShippingsettingGetsupportedcarrierCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13583,10 +13711,7 @@ impl<'a, C, A> ShippingsettingCustombatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13618,7 +13743,7 @@ impl<'a, C, A> ShippingsettingCustombatchCall<'a, C, A> where C: BorrowMut ShippingsettingCustombatchCall<'a, C, A> where C: BorrowMut ShippingsettingCustombatchCall<'a, C, A> { @@ -13705,7 +13830,7 @@ impl<'a, C, A> ShippingsettingCustombatchCall<'a, C, A> where C: BorrowMut ShippingsettingPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13896,7 +14018,7 @@ impl<'a, C, A> ShippingsettingPatchCall<'a, C, A> where C: BorrowMut ShippingsettingPatchCall<'a, C, A> where C: BorrowMut ShippingsettingPatchCall<'a, C, A> { @@ -14003,7 +14125,7 @@ impl<'a, C, A> ShippingsettingPatchCall<'a, C, A> where C: BorrowMut ShippingsettingGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14170,7 +14289,7 @@ impl<'a, C, A> ShippingsettingGetCall<'a, C, A> where C: BorrowMut ShippingsettingGetCall<'a, C, A> where C: BorrowMut ShippingsettingGetsupportedholidayCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14423,7 +14539,7 @@ impl<'a, C, A> ShippingsettingGetsupportedholidayCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14501,7 +14617,7 @@ impl<'a, C, A> ShippingsettingGetsupportedholidayCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14653,10 +14769,7 @@ impl<'a, C, A> ShippingsettingListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14676,7 +14789,7 @@ impl<'a, C, A> ShippingsettingListCall<'a, C, A> where C: BorrowMut ShippingsettingListCall<'a, C, A> where C: BorrowMut ShippingsettingUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14959,7 +15069,7 @@ impl<'a, C, A> ShippingsettingUpdateCall<'a, C, A> where C: BorrowMut ShippingsettingUpdateCall<'a, C, A> where C: BorrowMut ShippingsettingUpdateCall<'a, C, A> { @@ -15066,7 +15176,7 @@ impl<'a, C, A> ShippingsettingUpdateCall<'a, C, A> where C: BorrowMut DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15257,7 +15364,7 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15342,7 +15449,7 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: self._datafeed_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> DatafeedPatchCall<'a, C, A> { @@ -15364,7 +15471,7 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15512,10 +15619,7 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15535,7 +15639,7 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15598,7 +15702,7 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A self._datafeed_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> DatafeedDeleteCall<'a, C, A> { @@ -15620,7 +15724,7 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15664,6 +15768,8 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A } +/// Deletes, fetches, gets, inserts and updates multiple datafeeds in a single request. +/// /// A builder for the *custombatch* method supported by a *datafeed* resource. /// It is not used directly, but through a `DatafeedMethods` instance. /// @@ -15749,10 +15855,7 @@ impl<'a, C, A> DatafeedCustombatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15784,7 +15887,7 @@ impl<'a, C, A> DatafeedCustombatchCall<'a, C, A> where C: BorrowMut DatafeedCustombatchCall<'a, C, A> where C: BorrowMut DatafeedCustombatchCall<'a, C, A> { @@ -15871,7 +15974,7 @@ impl<'a, C, A> DatafeedCustombatchCall<'a, C, A> where C: BorrowMut DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16038,7 +16138,7 @@ impl<'a, C, A> DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16126,7 +16226,7 @@ impl<'a, C, A> DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16275,10 +16375,7 @@ impl<'a, C, A> DatafeedFetchnowCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16298,7 +16395,7 @@ impl<'a, C, A> DatafeedFetchnowCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16371,7 +16468,7 @@ impl<'a, C, A> DatafeedFetchnowCall<'a, C, A> where C: BorrowMut, self._datafeed_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> DatafeedFetchnowCall<'a, C, A> { @@ -16393,7 +16490,7 @@ impl<'a, C, A> DatafeedFetchnowCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16547,10 +16644,7 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16582,7 +16676,7 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16657,7 +16751,7 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A self._merchant_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> DatafeedInsertCall<'a, C, A> { @@ -16679,7 +16773,7 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16835,10 +16929,7 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16870,7 +16961,7 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16955,7 +17046,7 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A self._datafeed_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> DatafeedUpdateCall<'a, C, A> { @@ -16977,7 +17068,7 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17129,10 +17220,7 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17152,7 +17240,7 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17244,7 +17332,7 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17394,10 +17482,7 @@ impl<'a, C, A> PoDeleteCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17417,7 +17502,7 @@ impl<'a, C, A> PoDeleteCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17490,7 +17575,7 @@ impl<'a, C, A> PoDeleteCall<'a, C, A> where C: BorrowMut, A: oaut self._store_code = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> PoDeleteCall<'a, C, A> { @@ -17512,7 +17597,7 @@ impl<'a, C, A> PoDeleteCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17656,10 +17741,7 @@ impl<'a, C, A> PoListCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17679,7 +17761,7 @@ impl<'a, C, A> PoListCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17767,7 +17849,7 @@ impl<'a, C, A> PoListCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17898,10 +17980,7 @@ impl<'a, C, A> PoCustombatchCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17933,7 +18012,7 @@ impl<'a, C, A> PoCustombatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17998,7 +18077,7 @@ impl<'a, C, A> PoCustombatchCall<'a, C, A> where C: BorrowMut, A: self._request = new_value; self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> PoCustombatchCall<'a, C, A> { @@ -18020,7 +18099,7 @@ impl<'a, C, A> PoCustombatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18166,10 +18245,7 @@ impl<'a, C, A> PoGetCall<'a, C, A> where C: BorrowMut, A: oauth2: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18189,7 +18265,7 @@ impl<'a, C, A> PoGetCall<'a, C, A> where C: BorrowMut, A: oauth2: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18287,7 +18363,7 @@ impl<'a, C, A> PoGetCall<'a, C, A> where C: BorrowMut, A: oauth2: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18443,10 +18519,7 @@ impl<'a, C, A> PoInventoryCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18478,7 +18551,7 @@ impl<'a, C, A> PoInventoryCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18563,7 +18636,7 @@ impl<'a, C, A> PoInventoryCall<'a, C, A> where C: BorrowMut, A: o self._target_merchant_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> PoInventoryCall<'a, C, A> { @@ -18585,7 +18658,7 @@ impl<'a, C, A> PoInventoryCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18741,10 +18814,7 @@ impl<'a, C, A> PoInsertCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18776,7 +18846,7 @@ impl<'a, C, A> PoInsertCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18861,7 +18931,7 @@ impl<'a, C, A> PoInsertCall<'a, C, A> where C: BorrowMut, A: oaut self._target_merchant_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> PoInsertCall<'a, C, A> { @@ -18883,7 +18953,7 @@ impl<'a, C, A> PoInsertCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19039,10 +19109,7 @@ impl<'a, C, A> PoSaleCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19074,7 +19141,7 @@ impl<'a, C, A> PoSaleCall<'a, C, A> where C: BorrowMut, A: oauth2 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -19159,7 +19226,7 @@ impl<'a, C, A> PoSaleCall<'a, C, A> where C: BorrowMut, A: oauth2 self._target_merchant_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> PoSaleCall<'a, C, A> { @@ -19181,7 +19248,7 @@ impl<'a, C, A> PoSaleCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19340,10 +19407,7 @@ impl<'a, C, A> AccountstatuseListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19363,7 +19427,7 @@ impl<'a, C, A> AccountstatuseListCall<'a, C, A> where C: BorrowMut AccountstatuseListCall<'a, C, A> where C: BorrowMut AccountstatuseListCall<'a, C, A> where C: BorrowMut AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19622,7 +19685,7 @@ impl<'a, C, A> AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut AccountstatuseGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19876,7 +19936,7 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19972,7 +20032,7 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20091,10 +20151,7 @@ impl<'a, C, A> AccountAuthinfoCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20114,7 +20171,7 @@ impl<'a, C, A> AccountAuthinfoCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20182,7 +20239,7 @@ impl<'a, C, A> AccountAuthinfoCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20338,10 +20395,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20373,7 +20427,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20458,7 +20512,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: self._account_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> AccountUpdateCall<'a, C, A> { @@ -20480,7 +20534,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20632,10 +20686,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20655,7 +20706,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20747,7 +20798,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20900,10 +20951,7 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20923,7 +20971,7 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20993,7 +21041,7 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: self._force = Some(new_value); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> AccountDeleteCall<'a, C, A> { @@ -21015,7 +21063,7 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21169,10 +21217,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21204,7 +21249,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21279,7 +21324,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: self._merchant_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> AccountInsertCall<'a, C, A> { @@ -21301,7 +21346,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21445,10 +21490,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21468,7 +21510,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21556,7 +21598,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21687,10 +21729,7 @@ impl<'a, C, A> AccountCustombatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21722,7 +21761,7 @@ impl<'a, C, A> AccountCustombatchCall<'a, C, A> where C: BorrowMut AccountCustombatchCall<'a, C, A> where C: BorrowMut AccountCustombatchCall<'a, C, A> { @@ -21809,7 +21848,7 @@ impl<'a, C, A> AccountCustombatchCall<'a, C, A> where C: BorrowMut AccountPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22000,7 +22036,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -22085,7 +22121,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: self._account_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> AccountPatchCall<'a, C, A> { @@ -22107,7 +22143,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22258,10 +22294,7 @@ impl<'a, C, A> AccountLinkCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22293,7 +22326,7 @@ impl<'a, C, A> AccountLinkCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -22393,7 +22426,7 @@ impl<'a, C, A> AccountLinkCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22542,10 +22575,7 @@ impl<'a, C, A> AccountClaimwebsiteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22565,7 +22595,7 @@ impl<'a, C, A> AccountClaimwebsiteCall<'a, C, A> where C: BorrowMut AccountClaimwebsiteCall<'a, C, A> where C: BorrowMut InventoryCustombatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22826,7 +22853,7 @@ impl<'a, C, A> InventoryCustombatchCall<'a, C, A> where C: BorrowMut InventoryCustombatchCall<'a, C, A> where C: BorrowMut InventoryCustombatchCall<'a, C, A> { @@ -22913,7 +22940,7 @@ impl<'a, C, A> InventoryCustombatchCall<'a, C, A> where C: BorrowMut InventorySetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -23106,7 +23130,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -23191,7 +23215,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: self._store_code = new_value.to_string(); self } - /// The REST id of the product for which to update price and availability. + /// The REST ID of the product for which to update price and availability. /// /// Sets the *product id* path property to the given value. /// @@ -23201,7 +23225,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: self._product_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> InventorySetCall<'a, C, A> { @@ -23223,7 +23247,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23294,11 +23318,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.liasettings().setinventoryverificationcontact("merchantId", "accountId") -/// .language("sed") -/// .country("sit") -/// .contact_name("takimata") -/// .contact_email("elitr") +/// let result = hub.liasettings().setinventoryverificationcontact("merchantId", "accountId", "contactEmail", "contactName", "country", "language") /// .doit(); /// # } /// ``` @@ -23308,10 +23328,10 @@ pub struct LiasettingSetinventoryverificationcontactCall<'a, C, A> hub: &'a ShoppingContent, _merchant_id: String, _account_id: String, - _language: Option, - _country: Option, - _contact_name: Option, - _contact_email: Option, + _contact_email: String, + _contact_name: String, + _country: String, + _language: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -23336,19 +23356,11 @@ impl<'a, C, A> LiasettingSetinventoryverificationcontactCall<'a, C, A> where C: let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); params.push(("merchantId", self._merchant_id.to_string())); params.push(("accountId", self._account_id.to_string())); - if let Some(value) = self._language { - params.push(("language", value.to_string())); - } - if let Some(value) = self._country { - params.push(("country", value.to_string())); - } - if let Some(value) = self._contact_name { - params.push(("contactName", value.to_string())); - } - if let Some(value) = self._contact_email { - params.push(("contactEmail", value.to_string())); - } - for &field in ["alt", "merchantId", "accountId", "language", "country", "contactName", "contactEmail"].iter() { + params.push(("contactEmail", self._contact_email.to_string())); + params.push(("contactName", self._contact_name.to_string())); + params.push(("country", self._country.to_string())); + params.push(("language", self._language.to_string())); + for &field in ["alt", "merchantId", "accountId", "contactEmail", "contactName", "country", "language"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -23387,10 +23399,7 @@ impl<'a, C, A> LiasettingSetinventoryverificationcontactCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23410,7 +23419,7 @@ impl<'a, C, A> LiasettingSetinventoryverificationcontactCall<'a, C, A> where C: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23483,32 +23492,44 @@ impl<'a, C, A> LiasettingSetinventoryverificationcontactCall<'a, C, A> where C: self._account_id = new_value.to_string(); self } - /// The language for which inventory verification is requested. + /// The email of the inventory verification contact. /// - /// Sets the *language* query property to the given value. - pub fn language(mut self, new_value: &str) -> LiasettingSetinventoryverificationcontactCall<'a, C, A> { - self._language = Some(new_value.to_string()); - self - } - /// The country for which inventory verification is requested. + /// Sets the *contact email* query property to the given value. /// - /// Sets the *country* query property to the given value. - pub fn country(mut self, new_value: &str) -> LiasettingSetinventoryverificationcontactCall<'a, C, A> { - self._country = Some(new_value.to_string()); + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn contact_email(mut self, new_value: &str) -> LiasettingSetinventoryverificationcontactCall<'a, C, A> { + self._contact_email = new_value.to_string(); self } /// The name of the inventory verification contact. /// /// Sets the *contact name* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. pub fn contact_name(mut self, new_value: &str) -> LiasettingSetinventoryverificationcontactCall<'a, C, A> { - self._contact_name = Some(new_value.to_string()); + self._contact_name = new_value.to_string(); self } - /// The email of the inventory verification contact. + /// The country for which inventory verification is requested. /// - /// Sets the *contact email* query property to the given value. - pub fn contact_email(mut self, new_value: &str) -> LiasettingSetinventoryverificationcontactCall<'a, C, A> { - self._contact_email = Some(new_value.to_string()); + /// Sets the *country* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn country(mut self, new_value: &str) -> LiasettingSetinventoryverificationcontactCall<'a, C, A> { + self._country = new_value.to_string(); + self + } + /// The language for which inventory verification is requested. + /// + /// Sets the *language* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn language(mut self, new_value: &str) -> LiasettingSetinventoryverificationcontactCall<'a, C, A> { + self._language = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -23526,7 +23547,7 @@ impl<'a, C, A> LiasettingSetinventoryverificationcontactCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23682,10 +23703,7 @@ impl<'a, C, A> LiasettingPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -23717,7 +23735,7 @@ impl<'a, C, A> LiasettingPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -23802,7 +23820,7 @@ impl<'a, C, A> LiasettingPatchCall<'a, C, A> where C: BorrowMut, self._account_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> LiasettingPatchCall<'a, C, A> { @@ -23824,7 +23842,7 @@ impl<'a, C, A> LiasettingPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23943,10 +23961,7 @@ impl<'a, C, A> LiasettingListposdataproviderCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23966,7 +23981,7 @@ impl<'a, C, A> LiasettingListposdataproviderCall<'a, C, A> where C: BorrowMut LiasettingListposdataproviderCall<'a, C, A> where C: BorrowMut LiasettingGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24201,7 +24213,7 @@ impl<'a, C, A> LiasettingGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24289,7 +24301,7 @@ impl<'a, C, A> LiasettingGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24445,10 +24457,7 @@ impl<'a, C, A> LiasettingUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24480,7 +24489,7 @@ impl<'a, C, A> LiasettingUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -24565,7 +24574,7 @@ impl<'a, C, A> LiasettingUpdateCall<'a, C, A> where C: BorrowMut, self._account_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> LiasettingUpdateCall<'a, C, A> { @@ -24587,7 +24596,7 @@ impl<'a, C, A> LiasettingUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24731,10 +24740,7 @@ impl<'a, C, A> LiasettingGetaccessiblegmbaccountCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24754,7 +24760,7 @@ impl<'a, C, A> LiasettingGetaccessiblegmbaccountCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24842,7 +24848,7 @@ impl<'a, C, A> LiasettingGetaccessiblegmbaccountCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24913,8 +24919,7 @@ impl<'a, C, A> LiasettingGetaccessiblegmbaccountCall<'a, C, A> where C: BorrowMu /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.liasettings().requestgmbaccess("merchantId", "accountId") -/// .gmb_email("ut") +/// let result = hub.liasettings().requestgmbaccess("merchantId", "accountId", "gmbEmail") /// .doit(); /// # } /// ``` @@ -24924,7 +24929,7 @@ pub struct LiasettingRequestgmbaccesCall<'a, C, A> hub: &'a ShoppingContent, _merchant_id: String, _account_id: String, - _gmb_email: Option, + _gmb_email: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -24949,9 +24954,7 @@ impl<'a, C, A> LiasettingRequestgmbaccesCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(5 + self._additional_params.len()); params.push(("merchantId", self._merchant_id.to_string())); params.push(("accountId", self._account_id.to_string())); - if let Some(value) = self._gmb_email { - params.push(("gmbEmail", value.to_string())); - } + params.push(("gmbEmail", self._gmb_email.to_string())); for &field in ["alt", "merchantId", "accountId", "gmbEmail"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); @@ -24991,10 +24994,7 @@ impl<'a, C, A> LiasettingRequestgmbaccesCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25014,7 +25014,7 @@ impl<'a, C, A> LiasettingRequestgmbaccesCall<'a, C, A> where C: BorrowMut LiasettingRequestgmbaccesCall<'a, C, A> where C: BorrowMut LiasettingRequestgmbaccesCall<'a, C, A> { - self._gmb_email = Some(new_value.to_string()); + self._gmb_email = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -25109,7 +25112,7 @@ impl<'a, C, A> LiasettingRequestgmbaccesCall<'a, C, A> where C: BorrowMut LiasettingCustombatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25275,7 +25275,7 @@ impl<'a, C, A> LiasettingCustombatchCall<'a, C, A> where C: BorrowMut LiasettingCustombatchCall<'a, C, A> where C: BorrowMut LiasettingCustombatchCall<'a, C, A> { @@ -25362,7 +25362,7 @@ impl<'a, C, A> LiasettingCustombatchCall<'a, C, A> where C: BorrowMut LiasettingListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25537,7 +25534,7 @@ impl<'a, C, A> LiasettingListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -25629,7 +25626,7 @@ impl<'a, C, A> LiasettingListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25775,10 +25772,7 @@ impl<'a, C, A> LiasettingRequestinventoryverificationCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25798,7 +25792,7 @@ impl<'a, C, A> LiasettingRequestinventoryverificationCall<'a, C, A> where C: Bor let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -25896,7 +25890,7 @@ impl<'a, C, A> LiasettingRequestinventoryverificationCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25967,10 +25961,9 @@ impl<'a, C, A> LiasettingRequestinventoryverificationCall<'a, C, A> where C: Bor /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.liasettings().setposdataprovider("merchantId", "accountId") -/// .pos_external_account_id("et") -/// .pos_data_provider_id("ipsum") -/// .country("justo") +/// let result = hub.liasettings().setposdataprovider("merchantId", "accountId", "country") +/// .pos_external_account_id("ipsum") +/// .pos_data_provider_id("justo") /// .doit(); /// # } /// ``` @@ -25980,9 +25973,9 @@ pub struct LiasettingSetposdataproviderCall<'a, C, A> hub: &'a ShoppingContent, _merchant_id: String, _account_id: String, + _country: String, _pos_external_account_id: Option, _pos_data_provider_id: Option, - _country: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -26007,16 +26000,14 @@ impl<'a, C, A> LiasettingSetposdataproviderCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(7 + self._additional_params.len()); params.push(("merchantId", self._merchant_id.to_string())); params.push(("accountId", self._account_id.to_string())); + params.push(("country", self._country.to_string())); if let Some(value) = self._pos_external_account_id { params.push(("posExternalAccountId", value.to_string())); } if let Some(value) = self._pos_data_provider_id { params.push(("posDataProviderId", value.to_string())); } - if let Some(value) = self._country { - params.push(("country", value.to_string())); - } - for &field in ["alt", "merchantId", "accountId", "posExternalAccountId", "posDataProviderId", "country"].iter() { + for &field in ["alt", "merchantId", "accountId", "country", "posExternalAccountId", "posDataProviderId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -26055,10 +26046,7 @@ impl<'a, C, A> LiasettingSetposdataproviderCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26078,7 +26066,7 @@ impl<'a, C, A> LiasettingSetposdataproviderCall<'a, C, A> where C: BorrowMut LiasettingSetposdataproviderCall<'a, C, A> where C: BorrowMut LiasettingSetposdataproviderCall<'a, C, A> { + self._country = new_value.to_string(); + self + } /// The account ID by which this merchant is known to the POS data provider. /// /// Sets the *pos external account id* query property to the given value. @@ -26165,13 +26163,6 @@ impl<'a, C, A> LiasettingSetposdataproviderCall<'a, C, A> where C: BorrowMut LiasettingSetposdataproviderCall<'a, C, A> { - self._country = Some(new_value.to_string()); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -26187,7 +26178,7 @@ impl<'a, C, A> LiasettingSetposdataproviderCall<'a, C, A> where C: BorrowMut ProductstatuseListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26379,7 +26367,7 @@ impl<'a, C, A> ProductstatuseListCall<'a, C, A> where C: BorrowMut ProductstatuseListCall<'a, C, A> where C: BorrowMut ProductstatuseGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26672,7 +26657,7 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26735,7 +26720,7 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut self._merchant_id = new_value.to_string(); self } - /// The REST id of the product. + /// The REST ID of the product. /// /// Sets the *product id* path property to the given value. /// @@ -26775,7 +26760,7 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26906,10 +26891,7 @@ impl<'a, C, A> ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -26941,7 +26923,7 @@ impl<'a, C, A> ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut ProductCustombatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27194,7 +27173,7 @@ impl<'a, C, A> ProductCustombatchCall<'a, C, A> where C: BorrowMut ProductCustombatchCall<'a, C, A> where C: BorrowMut ProductCustombatchCall<'a, C, A> { @@ -27281,7 +27260,7 @@ impl<'a, C, A> ProductCustombatchCall<'a, C, A> where C: BorrowMut ProductListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -27461,7 +27437,7 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -27560,7 +27536,7 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27708,10 +27684,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -27731,7 +27704,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -27784,7 +27757,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: self._merchant_id = new_value.to_string(); self } - /// The REST id of the product. + /// The REST ID of the product. /// /// Sets the *product id* path property to the given value. /// @@ -27794,7 +27767,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: self._product_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> ProductDeleteCall<'a, C, A> { @@ -27816,7 +27789,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27970,10 +27943,7 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28005,7 +27975,7 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -28080,7 +28050,7 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: self._merchant_id = new_value.to_string(); self } - /// Flag to run the request in dry-run mode. + /// Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). /// /// Sets the *dry run* query property to the given value. pub fn dry_run(mut self, new_value: bool) -> ProductInsertCall<'a, C, A> { @@ -28102,7 +28072,7 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28246,10 +28216,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28269,7 +28236,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -28332,7 +28299,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa self._merchant_id = new_value.to_string(); self } - /// The REST id of the product. + /// The REST ID of the product. /// /// Sets the *product id* path property to the given value. /// @@ -28357,7 +28324,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28511,10 +28478,7 @@ impl<'a, C, A> DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28534,7 +28498,7 @@ impl<'a, C, A> DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut DatafeedstatuseListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28811,7 +28772,7 @@ impl<'a, C, A> DatafeedstatuseListCall<'a, C, A> where C: BorrowMut DatafeedstatuseListCall<'a, C, A> where C: BorrowMut DatafeedstatuseListCall<'a, C, A> where C: BorrowMut DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29062,7 +29022,7 @@ impl<'a, C, A> DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut OrderInstorerefundlineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29328,7 +29286,7 @@ impl<'a, C, A> OrderInstorerefundlineitemCall<'a, C, A> where C: BorrowMut OrderInstorerefundlineitemCall<'a, C, A> where C: BorrowMut OrderCreatetestreturnCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29614,7 +29569,7 @@ impl<'a, C, A> OrderCreatetestreturnCall<'a, C, A> where C: BorrowMut OrderCreatetestreturnCall<'a, C, A> where C: BorrowMut OrderCreatetestreturnCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29881,7 +29833,7 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderSetlineitemmetadataCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30155,7 +30104,7 @@ impl<'a, C, A> OrderSetlineitemmetadataCall<'a, C, A> where C: BorrowMut OrderSetlineitemmetadataCall<'a, C, A> where C: BorrowMut OrderUpdatelineitemshippingdetailCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30441,7 +30387,7 @@ impl<'a, C, A> OrderUpdatelineitemshippingdetailCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -30541,7 +30487,7 @@ impl<'a, C, A> OrderUpdatelineitemshippingdetailCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -30692,10 +30638,7 @@ impl<'a, C, A> OrderCanceltestorderbycustomerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30727,7 +30670,7 @@ impl<'a, C, A> OrderCanceltestorderbycustomerCall<'a, C, A> where C: BorrowMut OrderCanceltestorderbycustomerCall<'a, C, A> where C: BorrowMut OrderShiplineitemCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -31013,7 +30953,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -31113,7 +31053,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31292,10 +31232,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31315,7 +31252,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31445,7 +31382,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31596,10 +31533,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -31631,7 +31565,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31903,7 +31834,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderRefundCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32184,7 +32112,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -32284,7 +32212,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32435,10 +32363,7 @@ impl<'a, C, A> OrderRejectreturnlineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32470,7 +32395,7 @@ impl<'a, C, A> OrderRejectreturnlineitemCall<'a, C, A> where C: BorrowMut OrderRejectreturnlineitemCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32756,7 +32678,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderCancelCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -33042,7 +32961,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -33142,7 +33061,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33286,10 +33205,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33309,7 +33225,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -33583,7 +33496,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -33683,7 +33596,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33832,10 +33745,7 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -33867,7 +33777,7 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderReturnrefundlineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34143,7 +34050,7 @@ impl<'a, C, A> OrderReturnrefundlineitemCall<'a, C, A> where C: BorrowMut OrderReturnrefundlineitemCall<'a, C, A> where C: BorrowMut OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34410,7 +34314,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -34498,7 +34402,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34649,10 +34553,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34684,7 +34585,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderCustombatchCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34945,7 +34843,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -35025,7 +34923,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -35176,10 +35074,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -35211,7 +35106,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderinvoiceCreaterefundinvoiceCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -35497,7 +35389,7 @@ impl<'a, C, A> OrderinvoiceCreaterefundinvoiceCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -35597,7 +35489,7 @@ impl<'a, C, A> OrderinvoiceCreaterefundinvoiceCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -35748,10 +35640,7 @@ impl<'a, C, A> OrderinvoiceCreatechargeinvoiceCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -35783,7 +35672,7 @@ impl<'a, C, A> OrderinvoiceCreatechargeinvoiceCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -35883,7 +35772,7 @@ impl<'a, C, A> OrderinvoiceCreatechargeinvoiceCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/content2_sandbox/Cargo.toml b/gen/content2_sandbox/Cargo.toml index c85e5b2fb4..159ef7e113 100644 --- a/gen/content2_sandbox/Cargo.toml +++ b/gen/content2_sandbox/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/content2_sandbox/src/lib.rs b/gen/content2_sandbox/src/lib.rs index 6897d701f1..dc12f542be 100644 --- a/gen/content2_sandbox/src/lib.rs +++ b/gen/content2_sandbox/src/lib.rs @@ -4098,10 +4098,7 @@ impl<'a, C, A> OrderpaymentNotifyauthdeclinedCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4133,7 +4130,7 @@ impl<'a, C, A> OrderpaymentNotifyauthdeclinedCall<'a, C, A> where C: BorrowMut OrderpaymentNotifyauthdeclinedCall<'a, C, A> where C: BorrowMut OrderpaymentNotifyauthapprovedCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4419,7 +4413,7 @@ impl<'a, C, A> OrderpaymentNotifyauthapprovedCall<'a, C, A> where C: BorrowMut OrderpaymentNotifyauthapprovedCall<'a, C, A> where C: BorrowMut OrderpaymentNotifychargeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4705,7 +4696,7 @@ impl<'a, C, A> OrderpaymentNotifychargeCall<'a, C, A> where C: BorrowMut OrderpaymentNotifychargeCall<'a, C, A> where C: BorrowMut OrderpaymentNotifyrefundCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4991,7 +4979,7 @@ impl<'a, C, A> OrderpaymentNotifyrefundCall<'a, C, A> where C: BorrowMut OrderpaymentNotifyrefundCall<'a, C, A> where C: BorrowMut OrderreturnGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5258,7 +5243,7 @@ impl<'a, C, A> OrderreturnGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5346,7 +5331,7 @@ impl<'a, C, A> OrderreturnGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5513,10 +5498,7 @@ impl<'a, C, A> OrderreturnListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5536,7 +5518,7 @@ impl<'a, C, A> OrderreturnListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5649,7 +5631,7 @@ impl<'a, C, A> OrderreturnListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5800,10 +5782,7 @@ impl<'a, C, A> OrderinvoiceCreaterefundinvoiceCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5835,7 +5814,7 @@ impl<'a, C, A> OrderinvoiceCreaterefundinvoiceCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5935,7 +5914,7 @@ impl<'a, C, A> OrderinvoiceCreaterefundinvoiceCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6086,10 +6065,7 @@ impl<'a, C, A> OrderinvoiceCreatechargeinvoiceCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6121,7 +6097,7 @@ impl<'a, C, A> OrderinvoiceCreatechargeinvoiceCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6221,7 +6197,7 @@ impl<'a, C, A> OrderinvoiceCreatechargeinvoiceCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6400,10 +6376,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6423,7 +6396,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6553,7 +6526,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6704,10 +6677,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6739,7 +6709,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7011,7 +6978,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderRefundCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7292,7 +7256,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7392,7 +7356,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7543,10 +7507,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7578,7 +7539,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7678,7 +7639,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7822,10 +7783,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7845,7 +7803,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderRejectreturnlineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8119,7 +8074,7 @@ impl<'a, C, A> OrderRejectreturnlineitemCall<'a, C, A> where C: BorrowMut OrderRejectreturnlineitemCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8403,7 +8355,7 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderShiplineitemCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8679,7 +8628,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8779,7 +8728,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8930,10 +8879,7 @@ impl<'a, C, A> OrderCanceltestorderbycustomerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8965,7 +8911,7 @@ impl<'a, C, A> OrderCanceltestorderbycustomerCall<'a, C, A> where C: BorrowMut OrderCanceltestorderbycustomerCall<'a, C, A> where C: BorrowMut OrderReturnrefundlineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9251,7 +9194,7 @@ impl<'a, C, A> OrderReturnrefundlineitemCall<'a, C, A> where C: BorrowMut OrderReturnrefundlineitemCall<'a, C, A> where C: BorrowMut OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9518,7 +9458,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9606,7 +9546,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9757,10 +9697,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9792,7 +9729,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderUpdatelineitemshippingdetailCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10078,7 +10012,7 @@ impl<'a, C, A> OrderUpdatelineitemshippingdetailCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10178,7 +10112,7 @@ impl<'a, C, A> OrderUpdatelineitemshippingdetailCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10304,10 +10238,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10339,7 +10270,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10419,7 +10350,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10570,10 +10501,7 @@ impl<'a, C, A> OrderInstorerefundlineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10605,7 +10533,7 @@ impl<'a, C, A> OrderInstorerefundlineitemCall<'a, C, A> where C: BorrowMut OrderInstorerefundlineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10891,7 +10816,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCreatetestreturnCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11177,7 +11099,7 @@ impl<'a, C, A> OrderCreatetestreturnCall<'a, C, A> where C: BorrowMut OrderCreatetestreturnCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11463,7 +11382,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11730,7 +11646,7 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderSetlineitemmetadataCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12004,7 +11917,7 @@ impl<'a, C, A> OrderSetlineitemmetadataCall<'a, C, A> where C: BorrowMut OrderSetlineitemmetadataCall<'a, C, A> where C: BorrowMut OrderCancelCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12290,7 +12200,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12390,7 +12300,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/coordinate1/Cargo.toml b/gen/coordinate1/Cargo.toml index 1d99792756..8013416a24 100644 --- a/gen/coordinate1/Cargo.toml +++ b/gen/coordinate1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/coordinate1/src/lib.rs b/gen/coordinate1/src/lib.rs index d4e0868718..4cecfc230f 100644 --- a/gen/coordinate1/src/lib.rs +++ b/gen/coordinate1/src/lib.rs @@ -1454,10 +1454,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1477,7 +1474,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1565,7 +1562,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1768,10 +1765,7 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1803,7 +1797,7 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1974,7 +1968,7 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2177,10 +2171,7 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2212,7 +2203,7 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2383,7 +2374,7 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2545,10 +2536,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2568,7 +2556,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2674,7 +2662,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2858,10 +2846,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2893,7 +2878,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3059,7 +3044,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3230,10 +3215,7 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3265,7 +3247,7 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3393,7 +3375,7 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3564,10 +3546,7 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3599,7 +3578,7 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3727,7 +3706,7 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3871,10 +3850,7 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3894,7 +3870,7 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3982,7 +3958,7 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4124,10 +4100,7 @@ impl<'a, C, A> WorkerListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4147,7 +4120,7 @@ impl<'a, C, A> WorkerListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4225,7 +4198,7 @@ impl<'a, C, A> WorkerListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4381,10 +4354,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4404,7 +4374,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4516,7 +4486,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4650,10 +4620,7 @@ impl<'a, C, A> TeamListCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4673,7 +4640,7 @@ impl<'a, C, A> TeamListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4762,7 +4729,7 @@ impl<'a, C, A> TeamListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4904,10 +4871,7 @@ impl<'a, C, A> CustomFieldDefListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4927,7 +4891,7 @@ impl<'a, C, A> CustomFieldDefListCall<'a, C, A> where C: BorrowMut CustomFieldDefListCall<'a, C, A> where C: BorrowMut CseSiterestrictListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1470,7 +1467,7 @@ impl<'a, C, A> CseSiterestrictListCall<'a, C, A> where C: BorrowMut CseListCall<'a, C, A> where C: BorrowMut, A: oauth } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -2023,7 +2017,7 @@ impl<'a, C, A> CseListCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/dataproc1-cli/Cargo.toml b/gen/dataproc1-cli/Cargo.toml index 037d9b59bb..8ca1caa8fd 100644 --- a/gen/dataproc1-cli/Cargo.toml +++ b/gen/dataproc1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dataproc1-cli" -version = "1.0.8+20181005" +version = "1.0.8+20190313" authors = ["Sebastian Thiel "] description = "A complete library to interact with Dataproc (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dataproc1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-dataproc1] path = "../dataproc1" -version = "1.0.8+20181005" +version = "1.0.8+20190313" diff --git a/gen/dataproc1-cli/README.md b/gen/dataproc1-cli/README.md index 228563cb9d..35432c3631 100644 --- a/gen/dataproc1-cli/README.md +++ b/gen/dataproc1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Dataproc* API at revision *20181005*. The CLI is at version *1.0.8*. +This documentation was generated from the *Dataproc* API at revision *20190313*. The CLI is at version *1.0.8*. ```bash dataproc1 [options] diff --git a/gen/dataproc1-cli/mkdocs.yml b/gen/dataproc1-cli/mkdocs.yml index c8de58801c..b2d1d1ea90 100644 --- a/gen/dataproc1-cli/mkdocs.yml +++ b/gen/dataproc1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Dataproc v1.0.8+20181005 +site_name: Dataproc v1.0.8+20190313 site_url: http://byron.github.io/google-apis-rs/google-dataproc1-cli site_description: A complete library to interact with Dataproc (protocol v1) diff --git a/gen/dataproc1-cli/src/main.rs b/gen/dataproc1-cli/src/main.rs index 919132204f..15ecf62c04 100644 --- a/gen/dataproc1-cli/src/main.rs +++ b/gen/dataproc1-cli/src/main.rs @@ -75,6 +75,7 @@ impl<'n> Engine<'n> { "placement.managed-cluster.cluster-name" => Some(("placement.managedCluster.clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.labels" => Some(("placement.managedCluster.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.software-config.image-version" => Some(("placement.managedCluster.config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.software-config.optional-components" => Some(("placement.managedCluster.config.softwareConfig.optionalComponents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "placement.managed-cluster.config.software-config.properties" => Some(("placement.managedCluster.config.softwareConfig.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.config-bucket" => Some(("placement.managedCluster.config.configBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.gce-cluster-config.internal-ip-only" => Some(("placement.managedCluster.config.gceClusterConfig.internalIpOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -88,41 +89,41 @@ impl<'n> Engine<'n> { "placement.managed-cluster.config.worker-config.num-instances" => Some(("placement.managedCluster.config.workerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.machine-type-uri" => Some(("placement.managedCluster.config.workerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.instance-names" => Some(("placement.managedCluster.config.workerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.is-preemptible" => Some(("placement.managedCluster.config.workerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.encryption-config.gce-pd-kms-key-name" => Some(("placement.managedCluster.config.encryptionConfig.gcePdKmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.num-instances" => Some(("placement.managedCluster.config.secondaryWorkerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.machine-type-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.instance-names" => Some(("placement.managedCluster.config.secondaryWorkerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.is-preemptible" => Some(("placement.managedCluster.config.secondaryWorkerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.num-instances" => Some(("placement.managedCluster.config.masterConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.machine-type-uri" => Some(("placement.managedCluster.config.masterConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.instance-names" => Some(("placement.managedCluster.config.masterConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.is-preemptible" => Some(("placement.managedCluster.config.masterConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "optional-components", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -494,6 +495,7 @@ impl<'n> Engine<'n> { "placement.managed-cluster.cluster-name" => Some(("placement.managedCluster.clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.labels" => Some(("placement.managedCluster.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.software-config.image-version" => Some(("placement.managedCluster.config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.software-config.optional-components" => Some(("placement.managedCluster.config.softwareConfig.optionalComponents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "placement.managed-cluster.config.software-config.properties" => Some(("placement.managedCluster.config.softwareConfig.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.config-bucket" => Some(("placement.managedCluster.config.configBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.gce-cluster-config.internal-ip-only" => Some(("placement.managedCluster.config.gceClusterConfig.internalIpOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -507,41 +509,41 @@ impl<'n> Engine<'n> { "placement.managed-cluster.config.worker-config.num-instances" => Some(("placement.managedCluster.config.workerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.machine-type-uri" => Some(("placement.managedCluster.config.workerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.instance-names" => Some(("placement.managedCluster.config.workerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.is-preemptible" => Some(("placement.managedCluster.config.workerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.encryption-config.gce-pd-kms-key-name" => Some(("placement.managedCluster.config.encryptionConfig.gcePdKmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.num-instances" => Some(("placement.managedCluster.config.secondaryWorkerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.machine-type-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.instance-names" => Some(("placement.managedCluster.config.secondaryWorkerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.is-preemptible" => Some(("placement.managedCluster.config.secondaryWorkerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.num-instances" => Some(("placement.managedCluster.config.masterConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.machine-type-uri" => Some(("placement.managedCluster.config.masterConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.instance-names" => Some(("placement.managedCluster.config.masterConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.is-preemptible" => Some(("placement.managedCluster.config.masterConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "optional-components", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -864,6 +866,7 @@ impl<'n> Engine<'n> { "placement.managed-cluster.cluster-name" => Some(("placement.managedCluster.clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.labels" => Some(("placement.managedCluster.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.software-config.image-version" => Some(("placement.managedCluster.config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.software-config.optional-components" => Some(("placement.managedCluster.config.softwareConfig.optionalComponents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "placement.managed-cluster.config.software-config.properties" => Some(("placement.managedCluster.config.softwareConfig.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.config-bucket" => Some(("placement.managedCluster.config.configBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.gce-cluster-config.internal-ip-only" => Some(("placement.managedCluster.config.gceClusterConfig.internalIpOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -877,41 +880,41 @@ impl<'n> Engine<'n> { "placement.managed-cluster.config.worker-config.num-instances" => Some(("placement.managedCluster.config.workerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.machine-type-uri" => Some(("placement.managedCluster.config.workerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.instance-names" => Some(("placement.managedCluster.config.workerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.is-preemptible" => Some(("placement.managedCluster.config.workerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.encryption-config.gce-pd-kms-key-name" => Some(("placement.managedCluster.config.encryptionConfig.gcePdKmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.num-instances" => Some(("placement.managedCluster.config.secondaryWorkerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.machine-type-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.instance-names" => Some(("placement.managedCluster.config.secondaryWorkerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.is-preemptible" => Some(("placement.managedCluster.config.secondaryWorkerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.num-instances" => Some(("placement.managedCluster.config.masterConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.machine-type-uri" => Some(("placement.managedCluster.config.masterConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.instance-names" => Some(("placement.managedCluster.config.masterConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.is-preemptible" => Some(("placement.managedCluster.config.masterConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "optional-components", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -996,8 +999,8 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "status.state" => Some(("status.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.state-start-time" => Some(("status.stateStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "status.substate" => Some(("status.substate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.detail" => Some(("status.detail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status.substate" => Some(("status.substate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-uuid" => Some(("clusterUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-name" => Some(("clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1005,6 +1008,7 @@ impl<'n> Engine<'n> { "metrics.yarn-metrics" => Some(("metrics.yarnMetrics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "metrics.hdfs-metrics" => Some(("metrics.hdfsMetrics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.software-config.image-version" => Some(("config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.software-config.optional-components" => Some(("config.softwareConfig.optionalComponents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "config.software-config.properties" => Some(("config.softwareConfig.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.config-bucket" => Some(("config.configBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.gce-cluster-config.internal-ip-only" => Some(("config.gceClusterConfig.internalIpOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1018,36 +1022,36 @@ impl<'n> Engine<'n> { "config.worker-config.num-instances" => Some(("config.workerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.worker-config.machine-type-uri" => Some(("config.workerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.worker-config.instance-names" => Some(("config.workerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "config.worker-config.disk-config.num-local-ssds" => Some(("config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "config.worker-config.disk-config.boot-disk-type" => Some(("config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.worker-config.disk-config.boot-disk-size-gb" => Some(("config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.worker-config.image-uri" => Some(("config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.worker-config.managed-group-config.instance-template-name" => Some(("config.workerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.worker-config.managed-group-config.instance-group-manager-name" => Some(("config.workerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.worker-config.is-preemptible" => Some(("config.workerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "config.worker-config.image-uri" => Some(("config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.worker-config.disk-config.num-local-ssds" => Some(("config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.worker-config.disk-config.boot-disk-type" => Some(("config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.worker-config.disk-config.boot-disk-size-gb" => Some(("config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.encryption-config.gce-pd-kms-key-name" => Some(("config.encryptionConfig.gcePdKmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.secondary-worker-config.num-instances" => Some(("config.secondaryWorkerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.secondary-worker-config.machine-type-uri" => Some(("config.secondaryWorkerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.secondary-worker-config.instance-names" => Some(("config.secondaryWorkerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "config.secondary-worker-config.disk-config.num-local-ssds" => Some(("config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "config.secondary-worker-config.disk-config.boot-disk-type" => Some(("config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.secondary-worker-config.image-uri" => Some(("config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.secondary-worker-config.managed-group-config.instance-template-name" => Some(("config.secondaryWorkerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.secondary-worker-config.managed-group-config.instance-group-manager-name" => Some(("config.secondaryWorkerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.secondary-worker-config.is-preemptible" => Some(("config.secondaryWorkerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "config.secondary-worker-config.image-uri" => Some(("config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.secondary-worker-config.disk-config.num-local-ssds" => Some(("config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.secondary-worker-config.disk-config.boot-disk-type" => Some(("config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.master-config.num-instances" => Some(("config.masterConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.master-config.machine-type-uri" => Some(("config.masterConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.master-config.instance-names" => Some(("config.masterConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "config.master-config.disk-config.num-local-ssds" => Some(("config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "config.master-config.disk-config.boot-disk-type" => Some(("config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.master-config.disk-config.boot-disk-size-gb" => Some(("config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.master-config.image-uri" => Some(("config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.master-config.managed-group-config.instance-template-name" => Some(("config.masterConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.master-config.managed-group-config.instance-group-manager-name" => Some(("config.masterConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.master-config.is-preemptible" => Some(("config.masterConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "config.master-config.image-uri" => Some(("config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.master-config.disk-config.num-local-ssds" => Some(("config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.master-config.disk-config.boot-disk-type" => Some(("config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.master-config.disk-config.boot-disk-size-gb" => Some(("config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-name", "cluster-uuid", "config", "config-bucket", "detail", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "hdfs-metrics", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-group-config", "master-config", "metadata", "metrics", "network-uri", "num-instances", "num-local-ssds", "project-id", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "state", "state-start-time", "status", "subnetwork-uri", "substate", "tags", "worker-config", "yarn-metrics", "zone-uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-name", "cluster-uuid", "config", "config-bucket", "detail", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "hdfs-metrics", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-group-config", "master-config", "metadata", "metrics", "network-uri", "num-instances", "num-local-ssds", "optional-components", "project-id", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "state", "state-start-time", "status", "subnetwork-uri", "substate", "tags", "worker-config", "yarn-metrics", "zone-uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1477,8 +1481,8 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "status.state" => Some(("status.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.state-start-time" => Some(("status.stateStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "status.substate" => Some(("status.substate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.detail" => Some(("status.detail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status.substate" => Some(("status.substate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-uuid" => Some(("clusterUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster-name" => Some(("clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1486,6 +1490,7 @@ impl<'n> Engine<'n> { "metrics.yarn-metrics" => Some(("metrics.yarnMetrics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "metrics.hdfs-metrics" => Some(("metrics.hdfsMetrics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.software-config.image-version" => Some(("config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.software-config.optional-components" => Some(("config.softwareConfig.optionalComponents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "config.software-config.properties" => Some(("config.softwareConfig.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "config.config-bucket" => Some(("config.configBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.gce-cluster-config.internal-ip-only" => Some(("config.gceClusterConfig.internalIpOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1499,36 +1504,36 @@ impl<'n> Engine<'n> { "config.worker-config.num-instances" => Some(("config.workerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.worker-config.machine-type-uri" => Some(("config.workerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.worker-config.instance-names" => Some(("config.workerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "config.worker-config.disk-config.num-local-ssds" => Some(("config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "config.worker-config.disk-config.boot-disk-type" => Some(("config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.worker-config.disk-config.boot-disk-size-gb" => Some(("config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.worker-config.image-uri" => Some(("config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.worker-config.managed-group-config.instance-template-name" => Some(("config.workerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.worker-config.managed-group-config.instance-group-manager-name" => Some(("config.workerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.worker-config.is-preemptible" => Some(("config.workerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "config.worker-config.image-uri" => Some(("config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.worker-config.disk-config.num-local-ssds" => Some(("config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.worker-config.disk-config.boot-disk-type" => Some(("config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.worker-config.disk-config.boot-disk-size-gb" => Some(("config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.encryption-config.gce-pd-kms-key-name" => Some(("config.encryptionConfig.gcePdKmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.secondary-worker-config.num-instances" => Some(("config.secondaryWorkerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.secondary-worker-config.machine-type-uri" => Some(("config.secondaryWorkerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.secondary-worker-config.instance-names" => Some(("config.secondaryWorkerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "config.secondary-worker-config.disk-config.num-local-ssds" => Some(("config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "config.secondary-worker-config.disk-config.boot-disk-type" => Some(("config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.secondary-worker-config.image-uri" => Some(("config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.secondary-worker-config.managed-group-config.instance-template-name" => Some(("config.secondaryWorkerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.secondary-worker-config.managed-group-config.instance-group-manager-name" => Some(("config.secondaryWorkerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.secondary-worker-config.is-preemptible" => Some(("config.secondaryWorkerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "config.secondary-worker-config.image-uri" => Some(("config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.secondary-worker-config.disk-config.num-local-ssds" => Some(("config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.secondary-worker-config.disk-config.boot-disk-type" => Some(("config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.master-config.num-instances" => Some(("config.masterConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.master-config.machine-type-uri" => Some(("config.masterConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.master-config.instance-names" => Some(("config.masterConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "config.master-config.disk-config.num-local-ssds" => Some(("config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "config.master-config.disk-config.boot-disk-type" => Some(("config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.master-config.disk-config.boot-disk-size-gb" => Some(("config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.master-config.image-uri" => Some(("config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.master-config.managed-group-config.instance-template-name" => Some(("config.masterConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.master-config.managed-group-config.instance-group-manager-name" => Some(("config.masterConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.master-config.is-preemptible" => Some(("config.masterConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "config.master-config.image-uri" => Some(("config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.master-config.disk-config.num-local-ssds" => Some(("config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.master-config.disk-config.boot-disk-type" => Some(("config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.master-config.disk-config.boot-disk-size-gb" => Some(("config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-name", "cluster-uuid", "config", "config-bucket", "detail", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "hdfs-metrics", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-group-config", "master-config", "metadata", "metrics", "network-uri", "num-instances", "num-local-ssds", "project-id", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "state", "state-start-time", "status", "subnetwork-uri", "substate", "tags", "worker-config", "yarn-metrics", "zone-uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-name", "cluster-uuid", "config", "config-bucket", "detail", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "hdfs-metrics", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-group-config", "master-config", "metadata", "metrics", "network-uri", "num-instances", "num-local-ssds", "optional-components", "project-id", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "state", "state-start-time", "status", "subnetwork-uri", "substate", "tags", "worker-config", "yarn-metrics", "zone-uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2134,14 +2139,16 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "status.state" => Some(("status.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.state-start-time" => Some(("status.stateStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "status.substate" => Some(("status.substate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.details" => Some(("status.details", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "spark-sql-job.query-file-uri" => Some(("sparkSqlJob.queryFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "spark-sql-job.script-variables" => Some(("sparkSqlJob.scriptVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "spark-sql-job.logging-config.driver-log-levels" => Some(("sparkSqlJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "spark-sql-job.jar-file-uris" => Some(("sparkSqlJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "spark-sql-job.query-list.queries" => Some(("sparkSqlJob.queryList.queries", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "spark-sql-job.properties" => Some(("sparkSqlJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "status.substate" => Some(("status.substate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hadoop-job.args" => Some(("hadoopJob.args", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "hadoop-job.logging-config.driver-log-levels" => Some(("hadoopJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "hadoop-job.jar-file-uris" => Some(("hadoopJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "hadoop-job.file-uris" => Some(("hadoopJob.fileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "hadoop-job.main-class" => Some(("hadoopJob.mainClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hadoop-job.archive-uris" => Some(("hadoopJob.archiveUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "hadoop-job.main-jar-file-uri" => Some(("hadoopJob.mainJarFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hadoop-job.properties" => Some(("hadoopJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "pig-job.query-file-uri" => Some(("pigJob.queryFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "pig-job.script-variables" => Some(("pigJob.scriptVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "pig-job.logging-config.driver-log-levels" => Some(("pigJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -2153,14 +2160,12 @@ impl<'n> Engine<'n> { "placement.cluster-uuid" => Some(("placement.clusterUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reference.project-id" => Some(("reference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reference.job-id" => Some(("reference.jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "hadoop-job.args" => Some(("hadoopJob.args", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "hadoop-job.logging-config.driver-log-levels" => Some(("hadoopJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "hadoop-job.jar-file-uris" => Some(("hadoopJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "hadoop-job.file-uris" => Some(("hadoopJob.fileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "hadoop-job.main-class" => Some(("hadoopJob.mainClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "hadoop-job.archive-uris" => Some(("hadoopJob.archiveUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "hadoop-job.main-jar-file-uri" => Some(("hadoopJob.mainJarFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "hadoop-job.properties" => Some(("hadoopJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "spark-sql-job.query-file-uri" => Some(("sparkSqlJob.queryFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "spark-sql-job.script-variables" => Some(("sparkSqlJob.scriptVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "spark-sql-job.logging-config.driver-log-levels" => Some(("sparkSqlJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "spark-sql-job.jar-file-uris" => Some(("sparkSqlJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "spark-sql-job.query-list.queries" => Some(("sparkSqlJob.queryList.queries", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "spark-sql-job.properties" => Some(("sparkSqlJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "driver-output-resource-uri" => Some(("driverOutputResourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "driver-control-files-uri" => Some(("driverControlFilesUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2172,6 +2177,7 @@ impl<'n> Engine<'n> { "spark-job.archive-uris" => Some(("sparkJob.archiveUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "spark-job.main-jar-file-uri" => Some(("sparkJob.mainJarFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "spark-job.properties" => Some(("sparkJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job-uuid" => Some(("jobUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "scheduling.max-failures-per-hour" => Some(("scheduling.maxFailuresPerHour", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "pyspark-job.main-python-file-uri" => Some(("pysparkJob.mainPythonFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "pyspark-job.args" => Some(("pysparkJob.args", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2188,7 +2194,7 @@ impl<'n> Engine<'n> { "hive-job.continue-on-failure" => Some(("hiveJob.continueOnFailure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "hive-job.properties" => Some(("hiveJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["archive-uris", "args", "cluster-name", "cluster-uuid", "continue-on-failure", "details", "driver-control-files-uri", "driver-log-levels", "driver-output-resource-uri", "file-uris", "hadoop-job", "hive-job", "jar-file-uris", "job-id", "labels", "logging-config", "main-class", "main-jar-file-uri", "main-python-file-uri", "max-failures-per-hour", "pig-job", "placement", "project-id", "properties", "pyspark-job", "python-file-uris", "queries", "query-file-uri", "query-list", "reference", "scheduling", "script-variables", "spark-job", "spark-sql-job", "state", "state-start-time", "status", "substate"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["archive-uris", "args", "cluster-name", "cluster-uuid", "continue-on-failure", "details", "driver-control-files-uri", "driver-log-levels", "driver-output-resource-uri", "file-uris", "hadoop-job", "hive-job", "jar-file-uris", "job-id", "job-uuid", "labels", "logging-config", "main-class", "main-jar-file-uri", "main-python-file-uri", "max-failures-per-hour", "pig-job", "placement", "project-id", "properties", "pyspark-job", "python-file-uris", "queries", "query-file-uri", "query-list", "reference", "scheduling", "script-variables", "spark-job", "spark-sql-job", "state", "state-start-time", "status", "substate"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2363,14 +2369,16 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "job.status.state" => Some(("job.status.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.status.state-start-time" => Some(("job.status.stateStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.status.substate" => Some(("job.status.substate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.status.details" => Some(("job.status.details", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.spark-sql-job.query-file-uri" => Some(("job.sparkSqlJob.queryFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.spark-sql-job.script-variables" => Some(("job.sparkSqlJob.scriptVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "job.spark-sql-job.logging-config.driver-log-levels" => Some(("job.sparkSqlJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "job.spark-sql-job.jar-file-uris" => Some(("job.sparkSqlJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job.spark-sql-job.query-list.queries" => Some(("job.sparkSqlJob.queryList.queries", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job.spark-sql-job.properties" => Some(("job.sparkSqlJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job.status.substate" => Some(("job.status.substate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.hadoop-job.args" => Some(("job.hadoopJob.args", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.hadoop-job.logging-config.driver-log-levels" => Some(("job.hadoopJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job.hadoop-job.jar-file-uris" => Some(("job.hadoopJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.hadoop-job.file-uris" => Some(("job.hadoopJob.fileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.hadoop-job.main-class" => Some(("job.hadoopJob.mainClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.hadoop-job.archive-uris" => Some(("job.hadoopJob.archiveUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.hadoop-job.main-jar-file-uri" => Some(("job.hadoopJob.mainJarFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.hadoop-job.properties" => Some(("job.hadoopJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "job.pig-job.query-file-uri" => Some(("job.pigJob.queryFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.pig-job.script-variables" => Some(("job.pigJob.scriptVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "job.pig-job.logging-config.driver-log-levels" => Some(("job.pigJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -2382,14 +2390,12 @@ impl<'n> Engine<'n> { "job.placement.cluster-uuid" => Some(("job.placement.clusterUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.reference.project-id" => Some(("job.reference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.reference.job-id" => Some(("job.reference.jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.hadoop-job.args" => Some(("job.hadoopJob.args", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job.hadoop-job.logging-config.driver-log-levels" => Some(("job.hadoopJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "job.hadoop-job.jar-file-uris" => Some(("job.hadoopJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job.hadoop-job.file-uris" => Some(("job.hadoopJob.fileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job.hadoop-job.main-class" => Some(("job.hadoopJob.mainClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.hadoop-job.archive-uris" => Some(("job.hadoopJob.archiveUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job.hadoop-job.main-jar-file-uri" => Some(("job.hadoopJob.mainJarFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.hadoop-job.properties" => Some(("job.hadoopJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job.spark-sql-job.query-file-uri" => Some(("job.sparkSqlJob.queryFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.spark-sql-job.script-variables" => Some(("job.sparkSqlJob.scriptVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job.spark-sql-job.logging-config.driver-log-levels" => Some(("job.sparkSqlJob.loggingConfig.driverLogLevels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job.spark-sql-job.jar-file-uris" => Some(("job.sparkSqlJob.jarFileUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.spark-sql-job.query-list.queries" => Some(("job.sparkSqlJob.queryList.queries", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.spark-sql-job.properties" => Some(("job.sparkSqlJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "job.labels" => Some(("job.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "job.driver-output-resource-uri" => Some(("job.driverOutputResourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.driver-control-files-uri" => Some(("job.driverControlFilesUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2401,6 +2407,7 @@ impl<'n> Engine<'n> { "job.spark-job.archive-uris" => Some(("job.sparkJob.archiveUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.spark-job.main-jar-file-uri" => Some(("job.sparkJob.mainJarFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.spark-job.properties" => Some(("job.sparkJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job.job-uuid" => Some(("job.jobUuid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.scheduling.max-failures-per-hour" => Some(("job.scheduling.maxFailuresPerHour", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job.pyspark-job.main-python-file-uri" => Some(("job.pysparkJob.mainPythonFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.pyspark-job.args" => Some(("job.pysparkJob.args", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2418,7 +2425,7 @@ impl<'n> Engine<'n> { "job.hive-job.properties" => Some(("job.hiveJob.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "request-id" => Some(("requestId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["archive-uris", "args", "cluster-name", "cluster-uuid", "continue-on-failure", "details", "driver-control-files-uri", "driver-log-levels", "driver-output-resource-uri", "file-uris", "hadoop-job", "hive-job", "jar-file-uris", "job", "job-id", "labels", "logging-config", "main-class", "main-jar-file-uri", "main-python-file-uri", "max-failures-per-hour", "pig-job", "placement", "project-id", "properties", "pyspark-job", "python-file-uris", "queries", "query-file-uri", "query-list", "reference", "request-id", "scheduling", "script-variables", "spark-job", "spark-sql-job", "state", "state-start-time", "status", "substate"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["archive-uris", "args", "cluster-name", "cluster-uuid", "continue-on-failure", "details", "driver-control-files-uri", "driver-log-levels", "driver-output-resource-uri", "file-uris", "hadoop-job", "hive-job", "jar-file-uris", "job", "job-id", "job-uuid", "labels", "logging-config", "main-class", "main-jar-file-uri", "main-python-file-uri", "max-failures-per-hour", "pig-job", "placement", "project-id", "properties", "pyspark-job", "python-file-uris", "queries", "query-file-uri", "query-list", "reference", "request-id", "scheduling", "script-variables", "spark-job", "spark-sql-job", "state", "state-start-time", "status", "substate"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3065,6 +3072,7 @@ impl<'n> Engine<'n> { "placement.managed-cluster.cluster-name" => Some(("placement.managedCluster.clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.labels" => Some(("placement.managedCluster.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.software-config.image-version" => Some(("placement.managedCluster.config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.software-config.optional-components" => Some(("placement.managedCluster.config.softwareConfig.optionalComponents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "placement.managed-cluster.config.software-config.properties" => Some(("placement.managedCluster.config.softwareConfig.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.config-bucket" => Some(("placement.managedCluster.config.configBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.gce-cluster-config.internal-ip-only" => Some(("placement.managedCluster.config.gceClusterConfig.internalIpOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -3078,41 +3086,41 @@ impl<'n> Engine<'n> { "placement.managed-cluster.config.worker-config.num-instances" => Some(("placement.managedCluster.config.workerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.machine-type-uri" => Some(("placement.managedCluster.config.workerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.instance-names" => Some(("placement.managedCluster.config.workerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.is-preemptible" => Some(("placement.managedCluster.config.workerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.encryption-config.gce-pd-kms-key-name" => Some(("placement.managedCluster.config.encryptionConfig.gcePdKmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.num-instances" => Some(("placement.managedCluster.config.secondaryWorkerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.machine-type-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.instance-names" => Some(("placement.managedCluster.config.secondaryWorkerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.is-preemptible" => Some(("placement.managedCluster.config.secondaryWorkerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.num-instances" => Some(("placement.managedCluster.config.masterConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.machine-type-uri" => Some(("placement.managedCluster.config.masterConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.instance-names" => Some(("placement.managedCluster.config.masterConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.is-preemptible" => Some(("placement.managedCluster.config.masterConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "optional-components", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3484,6 +3492,7 @@ impl<'n> Engine<'n> { "placement.managed-cluster.cluster-name" => Some(("placement.managedCluster.clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.labels" => Some(("placement.managedCluster.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.software-config.image-version" => Some(("placement.managedCluster.config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.software-config.optional-components" => Some(("placement.managedCluster.config.softwareConfig.optionalComponents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "placement.managed-cluster.config.software-config.properties" => Some(("placement.managedCluster.config.softwareConfig.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.config-bucket" => Some(("placement.managedCluster.config.configBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.gce-cluster-config.internal-ip-only" => Some(("placement.managedCluster.config.gceClusterConfig.internalIpOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -3497,41 +3506,41 @@ impl<'n> Engine<'n> { "placement.managed-cluster.config.worker-config.num-instances" => Some(("placement.managedCluster.config.workerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.machine-type-uri" => Some(("placement.managedCluster.config.workerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.instance-names" => Some(("placement.managedCluster.config.workerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.is-preemptible" => Some(("placement.managedCluster.config.workerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.encryption-config.gce-pd-kms-key-name" => Some(("placement.managedCluster.config.encryptionConfig.gcePdKmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.num-instances" => Some(("placement.managedCluster.config.secondaryWorkerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.machine-type-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.instance-names" => Some(("placement.managedCluster.config.secondaryWorkerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.is-preemptible" => Some(("placement.managedCluster.config.secondaryWorkerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.num-instances" => Some(("placement.managedCluster.config.masterConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.machine-type-uri" => Some(("placement.managedCluster.config.masterConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.instance-names" => Some(("placement.managedCluster.config.masterConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.is-preemptible" => Some(("placement.managedCluster.config.masterConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "optional-components", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3854,6 +3863,7 @@ impl<'n> Engine<'n> { "placement.managed-cluster.cluster-name" => Some(("placement.managedCluster.clusterName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.labels" => Some(("placement.managedCluster.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.software-config.image-version" => Some(("placement.managedCluster.config.softwareConfig.imageVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.software-config.optional-components" => Some(("placement.managedCluster.config.softwareConfig.optionalComponents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "placement.managed-cluster.config.software-config.properties" => Some(("placement.managedCluster.config.softwareConfig.properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "placement.managed-cluster.config.config-bucket" => Some(("placement.managedCluster.config.configBucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.gce-cluster-config.internal-ip-only" => Some(("placement.managedCluster.config.gceClusterConfig.internalIpOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -3867,41 +3877,41 @@ impl<'n> Engine<'n> { "placement.managed-cluster.config.worker-config.num-instances" => Some(("placement.managedCluster.config.workerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.machine-type-uri" => Some(("placement.managedCluster.config.workerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.instance-names" => Some(("placement.managedCluster.config.workerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.workerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.worker-config.is-preemptible" => Some(("placement.managedCluster.config.workerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.worker-config.image-uri" => Some(("placement.managedCluster.config.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.workerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.workerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.encryption-config.gce-pd-kms-key-name" => Some(("placement.managedCluster.config.encryptionConfig.gcePdKmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.num-instances" => Some(("placement.managedCluster.config.secondaryWorkerConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.machine-type-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.instance-names" => Some(("placement.managedCluster.config.secondaryWorkerConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.secondaryWorkerConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.secondary-worker-config.is-preemptible" => Some(("placement.managedCluster.config.secondaryWorkerConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.secondary-worker-config.image-uri" => Some(("placement.managedCluster.config.secondaryWorkerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.secondary-worker-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.secondaryWorkerConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.num-instances" => Some(("placement.managedCluster.config.masterConfig.numInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.machine-type-uri" => Some(("placement.managedCluster.config.masterConfig.machineTypeUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.instance-names" => Some(("placement.managedCluster.config.masterConfig.instanceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-template-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.managed-group-config.instance-group-manager-name" => Some(("placement.managedCluster.config.masterConfig.managedGroupConfig.instanceGroupManagerName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "placement.managed-cluster.config.master-config.is-preemptible" => Some(("placement.managedCluster.config.masterConfig.isPreemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "placement.managed-cluster.config.master-config.image-uri" => Some(("placement.managedCluster.config.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.num-local-ssds" => Some(("placement.managedCluster.config.masterConfig.diskConfig.numLocalSsds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-type" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement.managed-cluster.config.master-config.disk-config.boot-disk-size-gb" => Some(("placement.managedCluster.config.masterConfig.diskConfig.bootDiskSizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["boot-disk-size-gb", "boot-disk-type", "cluster-labels", "cluster-name", "cluster-selector", "config", "config-bucket", "create-time", "disk-config", "encryption-config", "gce-cluster-config", "gce-pd-kms-key-name", "id", "image-uri", "image-version", "instance-group-manager-name", "instance-names", "instance-template-name", "internal-ip-only", "is-preemptible", "labels", "machine-type-uri", "managed-cluster", "managed-group-config", "master-config", "metadata", "name", "network-uri", "num-instances", "num-local-ssds", "optional-components", "placement", "properties", "secondary-worker-config", "service-account", "service-account-scopes", "software-config", "subnetwork-uri", "tags", "update-time", "version", "worker-config", "zone", "zone-uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -5485,7 +5495,7 @@ fn main() { let mut app = App::new("dataproc1") .author("Sebastian Thiel ") - .version("1.0.8+20181005") + .version("1.0.8+20190313") .about("Manages Hadoop-based clusters and jobs on Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dataproc1_cli") .arg(Arg::with_name("url") diff --git a/gen/dataproc1/Cargo.toml b/gen/dataproc1/Cargo.toml index 7007058314..4567474d46 100644 --- a/gen/dataproc1/Cargo.toml +++ b/gen/dataproc1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dataproc1" -version = "1.0.8+20181005" +version = "1.0.8+20190313" authors = ["Sebastian Thiel "] description = "A complete library to interact with Dataproc (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dataproc1" homepage = "https://cloud.google.com/dataproc/" -documentation = "https://docs.rs/google-dataproc1/1.0.8+20181005" +documentation = "https://docs.rs/google-dataproc1/1.0.8+20190313" license = "MIT" keywords = ["dataproc", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/dataproc1/README.md b/gen/dataproc1/README.md index f14eb035d1..8da3806b39 100644 --- a/gen/dataproc1/README.md +++ b/gen/dataproc1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-dataproc1` library allows access to all features of the *Google Dataproc* service. -This documentation was generated from *Dataproc* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Dataproc* crate version *1.0.8+20190313*, where *20190313* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Dataproc* *v1* API can be found at the [official documentation site](https://cloud.google.com/dataproc/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.Dataproc.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.Dataproc.html) ... * projects - * [*locations workflow templates create*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectLocationWorkflowTemplateCreateCall.html), [*locations workflow templates delete*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectLocationWorkflowTemplateDeleteCall.html), [*locations workflow templates get*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectLocationWorkflowTemplateGetCall.html), [*locations workflow templates get iam policy*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectLocationWorkflowTemplateGetIamPolicyCall.html), [*locations workflow templates instantiate*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectLocationWorkflowTemplateInstantiateCall.html), [*locations workflow templates instantiate inline*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectLocationWorkflowTemplateInstantiateInlineCall.html), [*locations workflow templates list*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectLocationWorkflowTemplateListCall.html), [*locations workflow templates set iam policy*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectLocationWorkflowTemplateSetIamPolicyCall.html), [*locations workflow templates test iam permissions*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectLocationWorkflowTemplateTestIamPermissionCall.html), [*locations workflow templates update*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectLocationWorkflowTemplateUpdateCall.html), [*regions clusters create*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionClusterCreateCall.html), [*regions clusters delete*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionClusterDeleteCall.html), [*regions clusters diagnose*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionClusterDiagnoseCall.html), [*regions clusters get*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionClusterGetCall.html), [*regions clusters get iam policy*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionClusterGetIamPolicyCall.html), [*regions clusters list*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionClusterListCall.html), [*regions clusters patch*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionClusterPatchCall.html), [*regions clusters set iam policy*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionClusterSetIamPolicyCall.html), [*regions clusters test iam permissions*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionClusterTestIamPermissionCall.html), [*regions jobs cancel*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionJobCancelCall.html), [*regions jobs delete*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionJobDeleteCall.html), [*regions jobs get*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionJobGetCall.html), [*regions jobs get iam policy*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionJobGetIamPolicyCall.html), [*regions jobs list*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionJobListCall.html), [*regions jobs patch*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionJobPatchCall.html), [*regions jobs set iam policy*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionJobSetIamPolicyCall.html), [*regions jobs submit*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionJobSubmitCall.html), [*regions jobs test iam permissions*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionJobTestIamPermissionCall.html), [*regions operations cancel*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionOperationCancelCall.html), [*regions operations delete*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionOperationDeleteCall.html), [*regions operations get*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionOperationGetCall.html), [*regions operations get iam policy*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionOperationGetIamPolicyCall.html), [*regions operations list*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionOperationListCall.html), [*regions operations set iam policy*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionOperationSetIamPolicyCall.html), [*regions operations test iam permissions*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionOperationTestIamPermissionCall.html), [*regions workflow templates create*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionWorkflowTemplateCreateCall.html), [*regions workflow templates delete*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionWorkflowTemplateDeleteCall.html), [*regions workflow templates get*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionWorkflowTemplateGetCall.html), [*regions workflow templates get iam policy*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionWorkflowTemplateGetIamPolicyCall.html), [*regions workflow templates instantiate*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionWorkflowTemplateInstantiateCall.html), [*regions workflow templates instantiate inline*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionWorkflowTemplateInstantiateInlineCall.html), [*regions workflow templates list*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionWorkflowTemplateListCall.html), [*regions workflow templates set iam policy*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionWorkflowTemplateSetIamPolicyCall.html), [*regions workflow templates test iam permissions*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionWorkflowTemplateTestIamPermissionCall.html) and [*regions workflow templates update*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.ProjectRegionWorkflowTemplateUpdateCall.html) + * [*locations workflow templates create*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectLocationWorkflowTemplateCreateCall.html), [*locations workflow templates delete*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectLocationWorkflowTemplateDeleteCall.html), [*locations workflow templates get*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectLocationWorkflowTemplateGetCall.html), [*locations workflow templates get iam policy*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectLocationWorkflowTemplateGetIamPolicyCall.html), [*locations workflow templates instantiate*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectLocationWorkflowTemplateInstantiateCall.html), [*locations workflow templates instantiate inline*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectLocationWorkflowTemplateInstantiateInlineCall.html), [*locations workflow templates list*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectLocationWorkflowTemplateListCall.html), [*locations workflow templates set iam policy*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectLocationWorkflowTemplateSetIamPolicyCall.html), [*locations workflow templates test iam permissions*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectLocationWorkflowTemplateTestIamPermissionCall.html), [*locations workflow templates update*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectLocationWorkflowTemplateUpdateCall.html), [*regions clusters create*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionClusterCreateCall.html), [*regions clusters delete*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionClusterDeleteCall.html), [*regions clusters diagnose*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionClusterDiagnoseCall.html), [*regions clusters get*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionClusterGetCall.html), [*regions clusters get iam policy*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionClusterGetIamPolicyCall.html), [*regions clusters list*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionClusterListCall.html), [*regions clusters patch*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionClusterPatchCall.html), [*regions clusters set iam policy*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionClusterSetIamPolicyCall.html), [*regions clusters test iam permissions*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionClusterTestIamPermissionCall.html), [*regions jobs cancel*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionJobCancelCall.html), [*regions jobs delete*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionJobDeleteCall.html), [*regions jobs get*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionJobGetCall.html), [*regions jobs get iam policy*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionJobGetIamPolicyCall.html), [*regions jobs list*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionJobListCall.html), [*regions jobs patch*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionJobPatchCall.html), [*regions jobs set iam policy*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionJobSetIamPolicyCall.html), [*regions jobs submit*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionJobSubmitCall.html), [*regions jobs test iam permissions*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionJobTestIamPermissionCall.html), [*regions operations cancel*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionOperationCancelCall.html), [*regions operations delete*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionOperationDeleteCall.html), [*regions operations get*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionOperationGetCall.html), [*regions operations get iam policy*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionOperationGetIamPolicyCall.html), [*regions operations list*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionOperationListCall.html), [*regions operations set iam policy*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionOperationSetIamPolicyCall.html), [*regions operations test iam permissions*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionOperationTestIamPermissionCall.html), [*regions workflow templates create*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionWorkflowTemplateCreateCall.html), [*regions workflow templates delete*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionWorkflowTemplateDeleteCall.html), [*regions workflow templates get*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionWorkflowTemplateGetCall.html), [*regions workflow templates get iam policy*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionWorkflowTemplateGetIamPolicyCall.html), [*regions workflow templates instantiate*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionWorkflowTemplateInstantiateCall.html), [*regions workflow templates instantiate inline*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionWorkflowTemplateInstantiateInlineCall.html), [*regions workflow templates list*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionWorkflowTemplateListCall.html), [*regions workflow templates set iam policy*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionWorkflowTemplateSetIamPolicyCall.html), [*regions workflow templates test iam permissions*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionWorkflowTemplateTestIamPermissionCall.html) and [*regions workflow templates update*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.ProjectRegionWorkflowTemplateUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/struct.Dataproc.html)** +* **[Hub](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/struct.Dataproc.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.Part.html)** + * **[Parts](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -139,17 +139,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -159,29 +159,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-dataproc1/1.0.8+20181005/google_dataproc1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dataproc1/1.0.8+20190313/google_dataproc1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dataproc1/src/lib.rs b/gen/dataproc1/src/lib.rs index f7831907c2..2838e67b8c 100644 --- a/gen/dataproc1/src/lib.rs +++ b/gen/dataproc1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Dataproc* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Dataproc* crate version *1.0.8+20190313*, where *20190313* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Dataproc* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/dataproc/). @@ -439,9 +439,9 @@ pub struct InstanceGroupConfig { /// Output only. The list of instance names. Cloud Dataproc derives the names from cluster_name, num_instances, and the instance group. #[serde(rename="instanceNames")] pub instance_names: Option>, - /// Optional. Disk option config settings. - #[serde(rename="diskConfig")] - pub disk_config: Option, + /// Optional. The Compute Engine image resource used for cluster instances. It can be specified or may be inferred from SoftwareConfig.image_version. + #[serde(rename="imageUri")] + pub image_uri: Option, /// Optional. The Compute Engine accelerator configuration for these instances.Beta Feature: This feature is still under development. It may be changed before final release. pub accelerators: Option>, /// Output only. The config for Compute Engine Instance Group Manager that manages this group. This is only used for preemptible instance groups. @@ -450,9 +450,9 @@ pub struct InstanceGroupConfig { /// Optional. The number of VM instances in the instance group. For master instance groups, must be set to 1. #[serde(rename="numInstances")] pub num_instances: Option, - /// Optional. The Compute Engine image resource used for cluster instances. It can be specified or may be inferred from SoftwareConfig.image_version. - #[serde(rename="imageUri")] - pub image_uri: Option, + /// Optional. Disk option config settings. + #[serde(rename="diskConfig")] + pub disk_config: Option, } impl Part for InstanceGroupConfig {} @@ -464,38 +464,38 @@ impl Part for InstanceGroupConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TemplateParameter { - /// Required. Paths to all fields that the parameter replaces. A field is allowed to appear in at most one parameter's list of field paths.A field path is similar in syntax to a google.protobuf.FieldMask. For example, a field path that references the zone field of a workflow template's cluster selector would be specified as placement.clusterSelector.zone.Also, field paths can reference fields using the following syntax: - /// Values in maps can be referenced by key. Examples
+ /// Required. Paths to all fields that the parameter replaces. A field is allowed to appear in at most one parameter's list of field paths.A field path is similar in syntax to a google.protobuf.FieldMask. For example, a field path that references the zone field of a workflow template's cluster selector would be specified as placement.clusterSelector.zone.Also, field paths can reference fields using the following syntax: + /// Values in maps can be referenced by key: /// labels'key' /// placement.clusterSelector.clusterLabels'key' /// placement.managedCluster.labels'key' /// placement.clusterSelector.clusterLabels'key' - /// jobsstep-id.labels'key' - /// Jobs in the jobs list can be referenced by step-id. Examples:
- /// jobsstep-id.hadoopJob.mainJarFileUri - /// jobsstep-id.hiveJob.queryFileUri - /// jobsstep-id.pySparkJob.mainPythonFileUri - /// jobsstep-id.hadoopJob.jarFileUris0 - /// jobsstep-id.hadoopJob.archiveUris0 - /// jobsstep-id.hadoopJob.fileUris0 - /// jobsstep-id.pySparkJob.pythonFileUris0 - /// Items in repeated fields can be referenced by a zero-based index. Example:
- /// jobsstep-id.sparkJob.args0 + /// jobs'step-id'.labels'key' + /// Jobs in the jobs list can be referenced by step-id: + /// jobs'step-id'.hadoopJob.mainJarFileUri + /// jobs'step-id'.hiveJob.queryFileUri + /// jobs'step-id'.pySparkJob.mainPythonFileUri + /// jobs'step-id'.hadoopJob.jarFileUris0 + /// jobs'step-id'.hadoopJob.archiveUris0 + /// jobs'step-id'.hadoopJob.fileUris0 + /// jobs'step-id'.pySparkJob.pythonFileUris0 + /// Items in repeated fields can be referenced by a zero-based index: + /// jobs'step-id'.sparkJob.args0 /// Other examples: - /// jobsstep-id.hadoopJob.properties'key' - /// jobsstep-id.hadoopJob.args0 - /// jobsstep-id.hiveJob.scriptVariables'key' - /// jobsstep-id.hadoopJob.mainJarFileUri + /// jobs'step-id'.hadoopJob.properties'key' + /// jobs'step-id'.hadoopJob.args0 + /// jobs'step-id'.hiveJob.scriptVariables'key' + /// jobs'step-id'.hadoopJob.mainJarFileUri /// placement.clusterSelector.zoneIt may not be possible to parameterize maps and repeated fields in their entirety since only individual map values and individual items in repeated fields can be referenced. For example, the following field paths are invalid: /// placement.clusterSelector.clusterLabels - /// jobsstep-id.sparkJob.args + /// jobs'step-id'.sparkJob.args pub fields: Option>, /// Optional. Validation rules to be applied to this parameter's value. pub validation: Option, - /// Required. Parameter name. The parameter name is used as the key, and paired with the parameter value, which are passed to the template when the template is instantiated. The name must contain only capital letters (A-Z), numbers (0-9), and underscores (_), and must not start with a number. The maximum length is 40 characters. - pub name: Option, /// Optional. Brief description of the parameter. Must not exceed 1024 characters. pub description: Option, + /// Required. Parameter name. The parameter name is used as the key, and paired with the parameter value, which are passed to the template when the template is instantiated. The name must contain only capital letters (A-Z), numbers (0-9), and underscores (_), and must not start with a number. The maximum length is 40 characters. + pub name: Option, } impl Part for TemplateParameter {} @@ -659,7 +659,7 @@ pub struct JobReference { /// Required. The ID of the Google Cloud Platform project that the job belongs to. #[serde(rename="projectId")] pub project_id: Option, - /// Optional. The job ID, which must be unique within the project. The job ID is generated by the server upon job submission or provided by the user as a means to perform retries without creating duplicate jobs. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or hyphens (-). The maximum length is 100 characters. + /// Optional. The job ID, which must be unique within the project.The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or hyphens (-). The maximum length is 100 characters.If not specified by the caller, the job ID will be provided by the server. #[serde(rename="jobId")] pub job_id: Option, } @@ -747,10 +747,10 @@ pub struct ClusterConfig { /// Optional. The config settings for software inside the cluster. #[serde(rename="softwareConfig")] pub software_config: Option, - /// Optional. A Cloud Storage staging bucket used for sharing generated SSH keys and config. If you do not specify a staging bucket, Cloud Dataproc will determine an appropriate Cloud Storage location (US, ASIA, or EU) for your cluster's staging bucket according to the Google Compute Engine zone where your cluster is deployed, and then it will create and manage this project-level, per-location bucket for you. + /// Optional. A Google Cloud Storage bucket used to stage job dependencies, config files, and job driver console output. If you do not specify a staging bucket, Cloud Dataproc will determine a Cloud Storage location (US, ASIA, or EU) for your cluster's staging bucket according to the Google Compute Engine zone where your cluster is deployed, and then create and manage this project-level, per-location bucket (see Cloud Dataproc staging bucket). #[serde(rename="configBucket")] pub config_bucket: Option, - /// Required. The shared Compute Engine config settings for all instances in a cluster. + /// Optional. The shared Compute Engine config settings for all instances in a cluster. #[serde(rename="gceClusterConfig")] pub gce_cluster_config: Option, /// Optional. The Compute Engine config settings for worker instances in a cluster. @@ -873,15 +873,15 @@ pub struct WorkflowTemplate { pub parameters: Option>, /// Optional. The labels to associate with this template. These labels will be propagated to all jobs and clusters created by the workflow instance.Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt).Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt).No more than 32 labels can be associated with a template. pub labels: Option>, - /// Required. The template id.The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of between 3 and 50 characters. - pub id: Option, + /// Output only. The time template was created. + #[serde(rename="createTime")] + pub create_time: Option, /// Optional. Used to perform a consistent read-modify-write.This field should be left blank for a CreateWorkflowTemplate request. It is required for an UpdateWorkflowTemplate request, and must match the current server version. A typical update template flow would fetch the current template with a GetWorkflowTemplate request, which will return the current template with the version field filled in with the current server version. The user updates other fields in the template, then returns it as part of the UpdateWorkflowTemplate request. pub version: Option, /// Required. WorkflowTemplate scheduling information. pub placement: Option, - /// Output only. The time template was created. - #[serde(rename="createTime")] - pub create_time: Option, + /// Required. The template id.The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of between 3 and 50 characters. + pub id: Option, } impl RequestValue for WorkflowTemplate {} @@ -904,38 +904,41 @@ impl ResponseResult for WorkflowTemplate {} pub struct Job { /// Output only. The job status. Additional application-specific status information may be contained in the type_job and yarn_applications fields. pub status: Option, - /// Job is a SparkSql job. - #[serde(rename="sparkSqlJob")] - pub spark_sql_job: Option, - /// Optional. The labels to associate with this job. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a job. - pub labels: Option>, - /// Required. Job information, including how, when, and where to run the job. - pub placement: Option, - /// Optional. The fully qualified reference to the job, which can be used to obtain the equivalent REST path of the job resource. If this property is not specified when a job is created, the server generates a job_id. - pub reference: Option, /// Job is a Hadoop job. #[serde(rename="hadoopJob")] pub hadoop_job: Option, + /// Optional. The labels to associate with this job. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a job. + pub labels: Option>, + /// Output only. The collection of YARN applications spun up by this job.Beta Feature: This report is available for testing purposes only. It may be changed before final release. + #[serde(rename="yarnApplications")] + pub yarn_applications: Option>, + /// Optional. The fully qualified reference to the job, which can be used to obtain the equivalent REST path of the job resource. If this property is not specified when a job is created, the server generates a job_id. + pub reference: Option, /// Job is a Pig job. #[serde(rename="pigJob")] pub pig_job: Option, /// Output only. A URI pointing to the location of the stdout of the job's driver program. #[serde(rename="driverOutputResourceUri")] pub driver_output_resource_uri: Option, - /// Output only. If present, the location of miscellaneous control files which may be used as part of job setup and handling. If not present, control files may be placed in the same location as driver_output_uri. - #[serde(rename="driverControlFilesUri")] - pub driver_control_files_uri: Option, /// Job is a Spark job. #[serde(rename="sparkJob")] pub spark_job: Option, - /// Output only. The collection of YARN applications spun up by this job.Beta Feature: This report is available for testing purposes only. It may be changed before final release. - #[serde(rename="yarnApplications")] - pub yarn_applications: Option>, + /// Output only. A UUID that uniquely identifies a job within the project over time. This is in contrast to a user-settable reference.job_id that may be reused over time. + #[serde(rename="jobUuid")] + pub job_uuid: Option, /// Optional. Job scheduling configuration. pub scheduling: Option, /// Output only. The previous job status. #[serde(rename="statusHistory")] pub status_history: Option>, + /// Job is a SparkSql job. + #[serde(rename="sparkSqlJob")] + pub spark_sql_job: Option, + /// Required. Job information, including how, when, and where to run the job. + pub placement: Option, + /// Output only. If present, the location of miscellaneous control files which may be used as part of job setup and handling. If not present, control files may be placed in the same location as driver_output_uri. + #[serde(rename="driverControlFilesUri")] + pub driver_control_files_uri: Option, /// Job is a Pyspark job. #[serde(rename="pysparkJob")] pub pyspark_job: Option, @@ -1190,14 +1193,14 @@ impl RequestValue for InstantiateWorkflowTemplateRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in Common Expression Language syntax.The application context of the containing message determines which well-known feature set of CEL is supported. pub expression: Option, /// An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file. pub location: Option, - /// An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. - pub description: Option, + /// An optional title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. + pub title: Option, } impl Part for Expr {} @@ -1271,10 +1274,10 @@ pub struct JobStatus { /// Output only. The time when this state was entered. #[serde(rename="stateStartTime")] pub state_start_time: Option, - /// Output only. Additional state information, which includes status reported by the agent. - pub substate: Option, /// Output only. Optional job state details, such as an error description if the state is ERROR. pub details: Option, + /// Output only. Additional state information, which includes status reported by the agent. + pub substate: Option, } impl Part for JobStatus {} @@ -1297,24 +1300,18 @@ pub struct JobPlacement { impl Part for JobPlacement {} -/// The status of a cluster and its instances. +/// Encryption settings for the cluster. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ClusterStatus { - /// Output only. The cluster's state. - pub state: Option, - /// Output only. Time when this state was entered. - #[serde(rename="stateStartTime")] - pub state_start_time: Option, - /// Output only. Additional state information that includes status reported by the agent. - pub substate: Option, - /// Output only. Optional details of cluster's state. - pub detail: Option, +pub struct EncryptionConfig { + /// Optional. The Cloud KMS key name to use for PD disk encryption for all instances in the cluster. + #[serde(rename="gcePdKmsKeyName")] + pub gce_pd_kms_key_name: Option, } -impl Part for ClusterStatus {} +impl Part for EncryptionConfig {} /// The runtime logging config of the job. @@ -1447,7 +1444,10 @@ pub struct SoftwareConfig { /// Optional. The version of software inside the cluster. It must be one of the supported Cloud Dataproc Versions, such as "1.2" (including a subminor version, such as "1.2.29"), or the "preview" version. If unspecified, it defaults to the latest version. #[serde(rename="imageVersion")] pub image_version: Option, - /// Optional. The properties to set on daemon config files.Property keys are specified in prefix:property format, such as core:fs.defaultFS. The following are supported prefixes and their mappings: + /// The set of optional components to activate on the cluster. + #[serde(rename="optionalComponents")] + pub optional_components: Option>, + /// Optional. The properties to set on daemon config files.Property keys are specified in prefix:property format, for example core:hadoop.tmp.dir. The following are supported prefixes and their mappings: /// capacity-scheduler: capacity-scheduler.xml /// core: core-site.xml /// distcp: distcp-default.xml @@ -1531,7 +1531,7 @@ pub struct Binding { /// user:{emailid}: An email address that represents a specific Google account. For example, alice@gmail.com . /// serviceAccount:{emailid}: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com. /// group:{emailid}: An email address that represents a Google group. For example, admins@example.com. - /// domain:{domain}: A Google Apps domain name that represents all the users of that domain. For example, google.com or example.com. + /// domain:{domain}: The G Suite domain (primary) that represents all the users of that domain. For example, google.com or example.com. pub members: Option>, } @@ -1643,18 +1643,24 @@ pub struct SparkJob { impl Part for SparkJob {} -/// Encryption settings for the cluster. +/// The status of a cluster and its instances. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EncryptionConfig { - /// Optional. The Cloud KMS key name to use for PD disk encryption for all instances in the cluster. - #[serde(rename="gcePdKmsKeyName")] - pub gce_pd_kms_key_name: Option, +pub struct ClusterStatus { + /// Output only. The cluster's state. + pub state: Option, + /// Output only. Time when this state was entered. + #[serde(rename="stateStartTime")] + pub state_start_time: Option, + /// Output only. Optional details of cluster's state. + pub detail: Option, + /// Output only. Additional state information that includes status reported by the agent. + pub substate: Option, } -impl Part for EncryptionConfig {} +impl Part for ClusterStatus {} /// This resource represents a long-running operation that is the result of a network API call. @@ -2756,7 +2762,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C, A> wher } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2772,10 +2778,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C, A> wher } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2807,7 +2810,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C, A> wher request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2897,7 +2900,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C, A> wher /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2905,12 +2908,12 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C, A> wher /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C, A> @@ -3047,10 +3050,7 @@ impl<'a, C, A> ProjectRegionClusterGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3070,7 +3070,7 @@ impl<'a, C, A> ProjectRegionClusterGetCall<'a, C, A> where C: BorrowMut ProjectRegionClusterGetCall<'a, C, A> where C: BorrowMut ProjectRegionClusterGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionClusterGetCall<'a, C, A> @@ -3309,7 +3309,7 @@ impl<'a, C, A> ProjectRegionOperationTestIamPermissionCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3325,10 +3325,7 @@ impl<'a, C, A> ProjectRegionOperationTestIamPermissionCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3360,7 +3357,7 @@ impl<'a, C, A> ProjectRegionOperationTestIamPermissionCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3450,7 +3447,7 @@ impl<'a, C, A> ProjectRegionOperationTestIamPermissionCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3458,12 +3455,12 @@ impl<'a, C, A> ProjectRegionOperationTestIamPermissionCall<'a, C, A> where C: Bo /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionOperationTestIamPermissionCall<'a, C, A> @@ -3594,7 +3591,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateListCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3610,10 +3607,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateListCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3633,7 +3627,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateListCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3725,7 +3719,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateListCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3733,12 +3727,12 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateListCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateListCall<'a, C, A> @@ -3859,7 +3853,7 @@ impl<'a, C, A> ProjectRegionOperationGetCall<'a, C, A> where C: BorrowMut ProjectRegionOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3898,7 +3889,7 @@ impl<'a, C, A> ProjectRegionOperationGetCall<'a, C, A> where C: BorrowMut ProjectRegionOperationGetCall<'a, C, A> where C: BorrowMut ProjectRegionOperationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionOperationGetCall<'a, C, A> @@ -4120,7 +4111,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateListCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4136,10 +4127,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateListCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4159,7 +4147,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateListCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4251,7 +4239,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateListCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4259,12 +4247,12 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateListCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateListCall<'a, C, A> @@ -4392,7 +4380,7 @@ impl<'a, C, A> ProjectRegionOperationSetIamPolicyCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4408,10 +4396,7 @@ impl<'a, C, A> ProjectRegionOperationSetIamPolicyCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4443,7 +4428,7 @@ impl<'a, C, A> ProjectRegionOperationSetIamPolicyCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4533,7 +4518,7 @@ impl<'a, C, A> ProjectRegionOperationSetIamPolicyCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4541,12 +4526,12 @@ impl<'a, C, A> ProjectRegionOperationSetIamPolicyCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionOperationSetIamPolicyCall<'a, C, A> @@ -4672,7 +4657,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateGetCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4688,10 +4673,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateGetCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4711,7 +4693,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateGetCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4796,7 +4778,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateGetCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4804,12 +4786,12 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateGetCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateGetCall<'a, C, A> @@ -4958,10 +4940,7 @@ impl<'a, C, A> ProjectRegionJobPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4993,7 +4972,7 @@ impl<'a, C, A> ProjectRegionJobPatchCall<'a, C, A> where C: BorrowMut ProjectRegionJobPatchCall<'a, C, A> where C: BorrowMut ProjectRegionJobPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionJobPatchCall<'a, C, A> @@ -5251,7 +5230,7 @@ impl<'a, C, A> ProjectRegionJobTestIamPermissionCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5267,10 +5246,7 @@ impl<'a, C, A> ProjectRegionJobTestIamPermissionCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5302,7 +5278,7 @@ impl<'a, C, A> ProjectRegionJobTestIamPermissionCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5392,7 +5368,7 @@ impl<'a, C, A> ProjectRegionJobTestIamPermissionCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5400,12 +5376,12 @@ impl<'a, C, A> ProjectRegionJobTestIamPermissionCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionJobTestIamPermissionCall<'a, C, A> @@ -5533,7 +5509,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateInstantiateCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5549,10 +5525,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateInstantiateCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5584,7 +5557,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateInstantiateCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5674,7 +5647,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateInstantiateCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5682,12 +5655,12 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateInstantiateCall<'a, C, A> where C: B /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateInstantiateCall<'a, C, A> @@ -5815,7 +5788,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C, A> wh } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5831,10 +5804,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C, A> wh } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5866,7 +5836,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C, A> wh request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5956,7 +5926,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C, A> wh /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5964,12 +5934,12 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C, A> wh /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C, A> @@ -6097,7 +6067,7 @@ impl<'a, C, A> ProjectRegionClusterSetIamPolicyCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6113,10 +6083,7 @@ impl<'a, C, A> ProjectRegionClusterSetIamPolicyCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6148,7 +6115,7 @@ impl<'a, C, A> ProjectRegionClusterSetIamPolicyCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6238,7 +6205,7 @@ impl<'a, C, A> ProjectRegionClusterSetIamPolicyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6246,12 +6213,12 @@ impl<'a, C, A> ProjectRegionClusterSetIamPolicyCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionClusterSetIamPolicyCall<'a, C, A> @@ -6379,7 +6346,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateCreateCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6395,10 +6362,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateCreateCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6430,7 +6394,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateCreateCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6520,7 +6484,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateCreateCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6528,12 +6492,12 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateCreateCall<'a, C, A> where C: Borr /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateCreateCall<'a, C, A> @@ -6661,7 +6625,7 @@ impl<'a, C, A> ProjectRegionClusterTestIamPermissionCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6677,10 +6641,7 @@ impl<'a, C, A> ProjectRegionClusterTestIamPermissionCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6712,7 +6673,7 @@ impl<'a, C, A> ProjectRegionClusterTestIamPermissionCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6802,7 +6763,7 @@ impl<'a, C, A> ProjectRegionClusterTestIamPermissionCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6810,12 +6771,12 @@ impl<'a, C, A> ProjectRegionClusterTestIamPermissionCall<'a, C, A> where C: Borr /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionClusterTestIamPermissionCall<'a, C, A> @@ -6974,10 +6935,7 @@ impl<'a, C, A> ProjectRegionClusterPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7009,7 +6967,7 @@ impl<'a, C, A> ProjectRegionClusterPatchCall<'a, C, A> where C: BorrowMut ProjectRegionClusterPatchCall<'a, C, A> where C: BorrowMut ProjectRegionClusterPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionClusterPatchCall<'a, C, A> @@ -7290,7 +7248,7 @@ impl<'a, C, A> ProjectRegionOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectRegionOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7329,7 +7284,7 @@ impl<'a, C, A> ProjectRegionOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectRegionOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectRegionOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionOperationDeleteCall<'a, C, A> @@ -7562,10 +7517,7 @@ impl<'a, C, A> ProjectRegionJobSubmitCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7597,7 +7549,7 @@ impl<'a, C, A> ProjectRegionJobSubmitCall<'a, C, A> where C: BorrowMut ProjectRegionJobSubmitCall<'a, C, A> where C: BorrowMut ProjectRegionJobSubmitCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionJobSubmitCall<'a, C, A> @@ -7857,10 +7809,7 @@ impl<'a, C, A> ProjectRegionClusterCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7892,7 +7841,7 @@ impl<'a, C, A> ProjectRegionClusterCreateCall<'a, C, A> where C: BorrowMut ProjectRegionClusterCreateCall<'a, C, A> where C: BorrowMut ProjectRegionClusterCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionClusterCreateCall<'a, C, A> @@ -8140,7 +8089,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8156,10 +8105,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8191,7 +8137,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C, A> where C request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8281,7 +8227,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8289,12 +8235,12 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C, A> where C /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C, A> @@ -8427,7 +8373,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C, A> wh } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8443,10 +8389,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C, A> wh } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8478,7 +8421,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C, A> wh request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8575,7 +8518,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C, A> wh /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8583,12 +8526,12 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C, A> wh /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C, A> @@ -8716,7 +8659,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateUpdateCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8732,10 +8675,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateUpdateCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8767,7 +8707,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateUpdateCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8857,7 +8797,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateUpdateCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8865,12 +8805,12 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateUpdateCall<'a, C, A> where C: Borr /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateUpdateCall<'a, C, A> @@ -8998,7 +8938,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateInstantiateCall<'a, C, A> where C: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9014,10 +8954,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateInstantiateCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9049,7 +8986,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateInstantiateCall<'a, C, A> where C: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9139,7 +9076,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateInstantiateCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9147,12 +9084,12 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateInstantiateCall<'a, C, A> where C: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateInstantiateCall<'a, C, A> @@ -9280,7 +9217,7 @@ impl<'a, C, A> ProjectRegionClusterGetIamPolicyCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9296,10 +9233,7 @@ impl<'a, C, A> ProjectRegionClusterGetIamPolicyCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9331,7 +9265,7 @@ impl<'a, C, A> ProjectRegionClusterGetIamPolicyCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9421,7 +9355,7 @@ impl<'a, C, A> ProjectRegionClusterGetIamPolicyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9429,12 +9363,12 @@ impl<'a, C, A> ProjectRegionClusterGetIamPolicyCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionClusterGetIamPolicyCall<'a, C, A> @@ -9584,10 +9518,7 @@ impl<'a, C, A> ProjectRegionClusterListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9607,7 +9538,7 @@ impl<'a, C, A> ProjectRegionClusterListCall<'a, C, A> where C: BorrowMut ProjectRegionClusterListCall<'a, C, A> where C: BorrowMut ProjectRegionClusterListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionClusterListCall<'a, C, A> @@ -9889,10 +9820,7 @@ impl<'a, C, A> ProjectRegionJobListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9912,7 +9840,7 @@ impl<'a, C, A> ProjectRegionJobListCall<'a, C, A> where C: BorrowMut ProjectRegionJobListCall<'a, C, A> where C: BorrowMut ProjectRegionJobListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionJobListCall<'a, C, A> @@ -10176,7 +10104,7 @@ impl<'a, C, A> ProjectRegionJobGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRegionJobGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10227,7 +10152,7 @@ impl<'a, C, A> ProjectRegionJobGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRegionJobGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRegionJobGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionJobGetIamPolicyCall<'a, C, A> @@ -10451,7 +10376,7 @@ impl<'a, C, A> ProjectRegionOperationCancelCall<'a, C, A> where C: BorrowMut ProjectRegionOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10490,7 +10412,7 @@ impl<'a, C, A> ProjectRegionOperationCancelCall<'a, C, A> where C: BorrowMut ProjectRegionOperationCancelCall<'a, C, A> where C: BorrowMut ProjectRegionOperationCancelCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionOperationCancelCall<'a, C, A> @@ -10725,10 +10647,7 @@ impl<'a, C, A> ProjectRegionClusterDiagnoseCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10760,7 +10679,7 @@ impl<'a, C, A> ProjectRegionClusterDiagnoseCall<'a, C, A> where C: BorrowMut ProjectRegionClusterDiagnoseCall<'a, C, A> where C: BorrowMut ProjectRegionClusterDiagnoseCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionClusterDiagnoseCall<'a, C, A> @@ -11011,7 +10930,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateUpdateCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11027,10 +10946,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateUpdateCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11062,7 +10978,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateUpdateCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11152,7 +11068,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateUpdateCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11160,12 +11076,12 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateUpdateCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateUpdateCall<'a, C, A> @@ -11301,7 +11217,7 @@ impl<'a, C, A> ProjectRegionOperationListCall<'a, C, A> where C: BorrowMut ProjectRegionOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11340,7 +11253,7 @@ impl<'a, C, A> ProjectRegionOperationListCall<'a, C, A> where C: BorrowMut ProjectRegionOperationListCall<'a, C, A> where C: BorrowMut ProjectRegionOperationListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionOperationListCall<'a, C, A> @@ -11578,7 +11491,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateDeleteCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11594,10 +11507,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateDeleteCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11617,7 +11527,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateDeleteCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11702,7 +11612,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateDeleteCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11710,12 +11620,12 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateDeleteCall<'a, C, A> where C: Borr /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateDeleteCall<'a, C, A> @@ -11843,7 +11753,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C, A> where C: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11859,10 +11769,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11894,7 +11801,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C, A> where C: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11984,7 +11891,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11992,12 +11899,12 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C, A> where C: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C, A> @@ -12125,7 +12032,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C, A> where C: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12141,10 +12048,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C, A> where C: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12176,7 +12080,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C, A> where C: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12266,7 +12170,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C, A> where C: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12274,12 +12178,12 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C, A> where C: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C, A> @@ -12416,10 +12320,7 @@ impl<'a, C, A> ProjectRegionJobGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12439,7 +12340,7 @@ impl<'a, C, A> ProjectRegionJobGetCall<'a, C, A> where C: BorrowMut ProjectRegionJobGetCall<'a, C, A> where C: BorrowMut ProjectRegionJobGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionJobGetCall<'a, C, A> @@ -12678,7 +12579,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12694,10 +12595,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12729,7 +12627,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C, A> where C request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12819,7 +12717,7 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12827,12 +12725,12 @@ impl<'a, C, A> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C, A> where C /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C, A> @@ -12979,10 +12877,7 @@ impl<'a, C, A> ProjectRegionClusterDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13002,7 +12897,7 @@ impl<'a, C, A> ProjectRegionClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectRegionClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectRegionClusterDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionClusterDeleteCall<'a, C, A> @@ -13260,7 +13155,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C, A> wher } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -13276,10 +13171,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C, A> wher } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13311,7 +13203,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C, A> wher request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13408,7 +13300,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C, A> wher /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13416,12 +13308,12 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C, A> wher /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C, A> @@ -13547,7 +13439,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateDeleteCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -13563,10 +13455,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateDeleteCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13586,7 +13475,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateDeleteCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13671,7 +13560,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateDeleteCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13679,12 +13568,12 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateDeleteCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateDeleteCall<'a, C, A> @@ -13812,7 +13701,7 @@ impl<'a, C, A> ProjectRegionOperationGetIamPolicyCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -13828,10 +13717,7 @@ impl<'a, C, A> ProjectRegionOperationGetIamPolicyCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13863,7 +13749,7 @@ impl<'a, C, A> ProjectRegionOperationGetIamPolicyCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13953,7 +13839,7 @@ impl<'a, C, A> ProjectRegionOperationGetIamPolicyCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13961,12 +13847,12 @@ impl<'a, C, A> ProjectRegionOperationGetIamPolicyCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionOperationGetIamPolicyCall<'a, C, A> @@ -14092,7 +13978,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateGetCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -14108,10 +13994,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14131,7 +14014,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14216,7 +14099,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14224,12 +14107,12 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateGetCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateGetCall<'a, C, A> @@ -14357,7 +14240,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateCreateCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -14373,10 +14256,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateCreateCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14408,7 +14288,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateCreateCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14498,7 +14378,7 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateCreateCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14506,12 +14386,12 @@ impl<'a, C, A> ProjectRegionWorkflowTemplateCreateCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateCreateCall<'a, C, A> @@ -14648,10 +14528,7 @@ impl<'a, C, A> ProjectRegionJobDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14671,7 +14548,7 @@ impl<'a, C, A> ProjectRegionJobDeleteCall<'a, C, A> where C: BorrowMut ProjectRegionJobDeleteCall<'a, C, A> where C: BorrowMut ProjectRegionJobDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionJobDeleteCall<'a, C, A> @@ -14910,7 +14787,7 @@ impl<'a, C, A> ProjectRegionJobSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRegionJobSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14961,7 +14835,7 @@ impl<'a, C, A> ProjectRegionJobSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRegionJobSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRegionJobSetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionJobSetIamPolicyCall<'a, C, A> @@ -15208,10 +15082,7 @@ impl<'a, C, A> ProjectRegionJobCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15243,7 +15114,7 @@ impl<'a, C, A> ProjectRegionJobCancelCall<'a, C, A> where C: BorrowMut ProjectRegionJobCancelCall<'a, C, A> where C: BorrowMut ProjectRegionJobCancelCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectRegionJobCancelCall<'a, C, A> diff --git a/gen/datastore1-cli/Cargo.toml b/gen/datastore1-cli/Cargo.toml index d421b984fd..ebe8455355 100644 --- a/gen/datastore1-cli/Cargo.toml +++ b/gen/datastore1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-datastore1-cli" -version = "1.0.8+20181002" +version = "1.0.8+20190105" authors = ["Sebastian Thiel "] description = "A complete library to interact with datastore (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/datastore1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-datastore1] path = "../datastore1" -version = "1.0.8+20181002" +version = "1.0.8+20190105" diff --git a/gen/datastore1-cli/README.md b/gen/datastore1-cli/README.md index 06c3b85a49..51f29877b7 100644 --- a/gen/datastore1-cli/README.md +++ b/gen/datastore1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *datastore* API at revision *20181002*. The CLI is at version *1.0.8*. +This documentation was generated from the *datastore* API at revision *20190105*. The CLI is at version *1.0.8*. ```bash datastore1 [options] diff --git a/gen/datastore1-cli/mkdocs.yml b/gen/datastore1-cli/mkdocs.yml index ab7417b2bc..39d585ff33 100644 --- a/gen/datastore1-cli/mkdocs.yml +++ b/gen/datastore1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: datastore v1.0.8+20181002 +site_name: datastore v1.0.8+20190105 site_url: http://byron.github.io/google-apis-rs/google-datastore1-cli site_description: A complete library to interact with datastore (protocol v1) diff --git a/gen/datastore1-cli/src/main.rs b/gen/datastore1-cli/src/main.rs index f50f2eb08b..e17d2f591b 100644 --- a/gen/datastore1-cli/src/main.rs +++ b/gen/datastore1-cli/src/main.rs @@ -1099,8 +1099,8 @@ impl<'n> Engine<'n> { "query.filter.property-filter.value.exclude-from-indexes" => Some(("query.filter.propertyFilter.value.excludeFromIndexes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "query.filter.property-filter.value.key-value.partition-id.project-id" => Some(("query.filter.propertyFilter.value.keyValue.partitionId.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.filter.property-filter.value.key-value.partition-id.namespace-id" => Some(("query.filter.propertyFilter.value.keyValue.partitionId.namespaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "query.filter.property-filter.value.blob-value" => Some(("query.filter.propertyFilter.value.blobValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.filter.property-filter.value.string-value" => Some(("query.filter.propertyFilter.value.stringValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.filter.property-filter.value.blob-value" => Some(("query.filter.propertyFilter.value.blobValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.filter.property-filter.value.boolean-value" => Some(("query.filter.propertyFilter.value.booleanValue", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "query.filter.property-filter.value.integer-value" => Some(("query.filter.propertyFilter.value.integerValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.filter.property-filter.value.geo-point-value.latitude" => Some(("query.filter.propertyFilter.value.geoPointValue.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -1756,7 +1756,7 @@ fn main() { let mut app = App::new("datastore1") .author("Sebastian Thiel ") - .version("1.0.8+20181002") + .version("1.0.8+20190105") .about("Accesses the schemaless NoSQL database to provide fully managed, robust, scalable storage for your application. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_datastore1_cli") diff --git a/gen/datastore1/Cargo.toml b/gen/datastore1/Cargo.toml index 37922f1ebc..44ceb4aec4 100644 --- a/gen/datastore1/Cargo.toml +++ b/gen/datastore1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-datastore1" -version = "1.0.8+20181002" +version = "1.0.8+20190105" authors = ["Sebastian Thiel "] description = "A complete library to interact with datastore (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/datastore1" homepage = "https://cloud.google.com/datastore/" -documentation = "https://docs.rs/google-datastore1/1.0.8+20181002" +documentation = "https://docs.rs/google-datastore1/1.0.8+20190105" license = "MIT" keywords = ["datastore", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/datastore1/README.md b/gen/datastore1/README.md index d8390ea1cd..67b2d0bf99 100644 --- a/gen/datastore1/README.md +++ b/gen/datastore1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-datastore1` library allows access to all features of the *Google datastore* service. -This documentation was generated from *datastore* crate version *1.0.8+20181002*, where *20181002* is the exact revision of the *datastore:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *datastore* crate version *1.0.8+20190105*, where *20190105* is the exact revision of the *datastore:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *datastore* *v1* API can be found at the [official documentation site](https://cloud.google.com/datastore/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.Datastore.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.Datastore.html) ... * projects - * [*allocate ids*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectAllocateIdCall.html), [*begin transaction*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectBeginTransactionCall.html), [*commit*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectCommitCall.html), [*export*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectExportCall.html), [*import*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectImportCall.html), [*indexes get*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectIndexeGetCall.html), [*indexes list*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectIndexeListCall.html), [*lookup*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectLookupCall.html), [*operations cancel*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectOperationCancelCall.html), [*operations delete*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectOperationDeleteCall.html), [*operations get*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectOperationGetCall.html), [*operations list*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectOperationListCall.html), [*reserve ids*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectReserveIdCall.html), [*rollback*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectRollbackCall.html) and [*run query*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.ProjectRunQueryCall.html) + * [*allocate ids*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectAllocateIdCall.html), [*begin transaction*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectBeginTransactionCall.html), [*commit*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectCommitCall.html), [*export*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectExportCall.html), [*import*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectImportCall.html), [*indexes get*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectIndexeGetCall.html), [*indexes list*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectIndexeListCall.html), [*lookup*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectLookupCall.html), [*operations cancel*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectOperationCancelCall.html), [*operations delete*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectOperationDeleteCall.html), [*operations get*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectOperationGetCall.html), [*operations list*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectOperationListCall.html), [*reserve ids*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectReserveIdCall.html), [*rollback*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectRollbackCall.html) and [*run query*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.ProjectRunQueryCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/struct.Datastore.html)** +* **[Hub](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/struct.Datastore.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.Part.html)** + * **[Parts](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-datastore1/1.0.8+20181002/google_datastore1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-datastore1/1.0.8+20190105/google_datastore1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/datastore1/src/lib.rs b/gen/datastore1/src/lib.rs index c382d4cabb..fe95d4fccc 100644 --- a/gen/datastore1/src/lib.rs +++ b/gen/datastore1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *datastore* crate version *1.0.8+20181002*, where *20181002* is the exact revision of the *datastore:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *datastore* crate version *1.0.8+20190105*, where *20190105* is the exact revision of the *datastore:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *datastore* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/datastore/). @@ -451,7 +451,7 @@ pub struct PartitionId { impl Part for PartitionId {} -/// Next tag: 3 +/// A property of an index. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -586,31 +586,40 @@ pub struct RunQueryResponse { impl ResponseResult for RunQueryResponse {} -/// A mutation to apply to an entity. +/// A minimal index definition. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [indexes get projects](struct.ProjectIndexeGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Mutation { - /// The entity to insert. The entity must not already exist. - /// The entity key's final path element may be incomplete. - pub insert: Option, - /// The key of the entity to delete. The entity may or may not already exist. - /// Must have a complete key path and must not be reserved/read-only. - pub delete: Option, - /// The entity to update. The entity must already exist. - /// Must have a complete key path. - pub update: Option, - /// The version of the entity that this mutation is being applied to. If this - /// does not match the current version on the server, the mutation conflicts. - #[serde(rename="baseVersion")] - pub base_version: Option, - /// The entity to upsert. The entity may or may not already exist. - /// The entity key's final path element may be incomplete. - pub upsert: Option, +pub struct GoogleDatastoreAdminV1Index { + /// The entity kind to which this index applies. + /// Required. + pub kind: Option, + /// Project ID. + /// Output only. + #[serde(rename="projectId")] + pub project_id: Option, + /// The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED. + /// Required. + pub ancestor: Option, + /// The resource ID of the index. + /// Output only. + #[serde(rename="indexId")] + pub index_id: Option, + /// The state of the index. + /// Output only. + pub state: Option, + /// An ordered sequence of property names and their index attributes. + /// Required. + pub properties: Option>, } -impl Part for Mutation {} +impl ResponseResult for GoogleDatastoreAdminV1Index {} /// An array value. @@ -652,304 +661,6 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// Options for beginning a new transaction. -/// -/// Transactions can be created explicitly with calls to -/// Datastore.BeginTransaction or implicitly by setting -/// ReadOptions.new_transaction in read requests. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TransactionOptions { - /// The transaction should allow both reads and writes. - #[serde(rename="readWrite")] - pub read_write: Option, - /// The transaction should only allow reads. - #[serde(rename="readOnly")] - pub read_only: Option, -} - -impl Part for TransactionOptions {} - - -/// A batch of results produced by a query. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct QueryResultBatch { - /// The state of the query after the current batch. - #[serde(rename="moreResults")] - pub more_results: Option, - /// The result type for every entity in `entity_results`. - #[serde(rename="entityResultType")] - pub entity_result_type: Option, - /// The version number of the snapshot this batch was returned from. - /// This applies to the range of results from the query's `start_cursor` (or - /// the beginning of the query if no cursor was given) to this batch's - /// `end_cursor` (not the query's `end_cursor`). - /// - /// In a single transaction, subsequent query result batches for the same query - /// can have a greater snapshot version number. Each batch's snapshot version - /// is valid for all preceding batches. - /// The value will be zero for eventually consistent queries. - #[serde(rename="snapshotVersion")] - pub snapshot_version: Option, - /// The number of results skipped, typically because of an offset. - #[serde(rename="skippedResults")] - pub skipped_results: Option, - /// A cursor that points to the position after the last result in the batch. - #[serde(rename="endCursor")] - pub end_cursor: Option, - /// A cursor that points to the position after the last skipped result. - /// Will be set when `skipped_results` != 0. - #[serde(rename="skippedCursor")] - pub skipped_cursor: Option, - /// The results for this batch. - #[serde(rename="entityResults")] - pub entity_results: Option>, -} - -impl Part for QueryResultBatch {} - - -/// A reference to a property relative to the kind expressions. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PropertyReference { - /// The name of the property. - /// If name includes "."s, it may be interpreted as a property name path. - pub name: Option, -} - -impl Part for PropertyReference {} - - -/// The response for Datastore.Commit. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [commit projects](struct.ProjectCommitCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CommitResponse { - /// The result of performing the mutations. - /// The i-th mutation result corresponds to the i-th mutation in the request. - #[serde(rename="mutationResults")] - pub mutation_results: Option>, - /// The number of index entries updated during the commit, or zero if none were - /// updated. - #[serde(rename="indexUpdates")] - pub index_updates: Option, -} - -impl ResponseResult for CommitResponse {} - - -/// The result of fetching an entity from Datastore. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EntityResult { - /// A cursor that points to the position after the result entity. - /// Set only when the `EntityResult` is part of a `QueryResultBatch` message. - pub cursor: Option, - /// The version of the entity, a strictly positive number that monotonically - /// increases with changes to the entity. - /// - /// This field is set for `FULL` entity - /// results. - /// - /// For missing entities in `LookupResponse`, this - /// is the version of the snapshot that was used to look up the entity, and it - /// is always set except for eventually consistent reads. - pub version: Option, - /// The resulting entity. - pub entity: Option, -} - -impl Part for EntityResult {} - - -/// The response for Datastore.Rollback. -/// (an empty message). -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [rollback projects](struct.ProjectRollbackCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RollbackResponse { _never_set: Option } - -impl ResponseResult for RollbackResponse {} - - -/// The request for Datastore.BeginTransaction. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [begin transaction projects](struct.ProjectBeginTransactionCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BeginTransactionRequest { - /// Options for a new transaction. - #[serde(rename="transactionOptions")] - pub transaction_options: Option, -} - -impl RequestValue for BeginTransactionRequest {} - - -/// The result of applying a mutation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MutationResult { - /// The version of the entity on the server after processing the mutation. If - /// the mutation doesn't change anything on the server, then the version will - /// be the version of the current entity or, if no entity is present, a version - /// that is strictly greater than the version of any previous entity and less - /// than the version of any possible future entity. - pub version: Option, - /// Whether a conflict was detected for this mutation. Always false when a - /// conflict detection strategy field is not set in the mutation. - #[serde(rename="conflictDetected")] - pub conflict_detected: Option, - /// The automatically allocated key. - /// Set only when the mutation allocated a key. - pub key: Option, -} - -impl Part for MutationResult {} - - -/// A unique identifier for an entity. -/// If a key's partition ID or any of its path kinds or names are -/// reserved/read-only, the key is reserved/read-only. -/// A reserved/read-only key is forbidden in certain documented contexts. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Key { - /// The entity path. - /// An entity path consists of one or more elements composed of a kind and a - /// string or numerical identifier, which identify entities. The first - /// element identifies a _root entity_, the second element identifies - /// a _child_ of the root entity, the third element identifies a child of the - /// second entity, and so forth. The entities identified by all prefixes of - /// the path are called the element's _ancestors_. - /// - /// An entity path is always fully complete: *all* of the entity's ancestors - /// are required to be in the path along with the entity identifier itself. - /// The only exception is that in some documented cases, the identifier in the - /// last path element (for the entity) itself may be omitted. For example, - /// the last path element of the key of `Mutation.insert` may have no - /// identifier. - /// - /// A path can never be empty, and a path can have at most 100 elements. - pub path: Option>, - /// Entities are partitioned into subsets, currently identified by a project - /// ID and namespace ID. - /// Queries are scoped to a single partition. - #[serde(rename="partitionId")] - pub partition_id: Option, -} - -impl Part for Key {} - - -/// A [GQL query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GqlQuery { - /// A string of the format described - /// [here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). - #[serde(rename="queryString")] - pub query_string: Option, - /// Numbered binding site @1 references the first numbered parameter, - /// effectively using 1-based indexing, rather than the usual 0. - /// - /// For each binding site numbered i in `query_string`, there must be an i-th - /// numbered parameter. The inverse must also be true. - #[serde(rename="positionalBindings")] - pub positional_bindings: Option>, - /// For each non-reserved named binding site in the query string, there must be - /// a named parameter with that name, but not necessarily the inverse. - /// - /// Key must match regex `A-Za-z_$*`, must not match regex - /// `__.*__`, and must not be `""`. - #[serde(rename="namedBindings")] - pub named_bindings: Option>, - /// When false, the query string must not contain any literals and instead must - /// bind all values. For example, - /// `SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while - /// `SELECT * FROM Kind WHERE a = @value` is. - #[serde(rename="allowLiterals")] - pub allow_literals: Option, -} - -impl Part for GqlQuery {} - - -/// The request for -/// google.datastore.admin.v1.DatastoreAdmin.ExportEntities. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [export projects](struct.ProjectExportCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleDatastoreAdminV1ExportEntitiesRequest { - /// Location for the export metadata and data files. - /// - /// The full resource URL of the external storage location. Currently, only - /// Google Cloud Storage is supported. So output_url_prefix should be of the - /// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the - /// name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud - /// Storage namespace path (this is not a Cloud Datastore namespace). For more - /// information about Cloud Storage namespace paths, see - /// [Object name - /// considerations](https://cloud.google.com/storage/docs/naming#object-considerations). - /// - /// The resulting files will be nested deeper than the specified URL prefix. - /// The final output URL will be provided in the - /// google.datastore.admin.v1.ExportEntitiesResponse.output_url field. That - /// value should be used for subsequent ImportEntities operations. - /// - /// By nesting the data files deeper, the same Cloud Storage bucket can be used - /// in multiple ExportEntities operations without conflict. - #[serde(rename="outputUrlPrefix")] - pub output_url_prefix: Option, - /// Client-assigned labels. - pub labels: Option>, - /// Description of what data from the project is included in the export. - #[serde(rename="entityFilter")] - pub entity_filter: Option, -} - -impl RequestValue for GoogleDatastoreAdminV1ExportEntitiesRequest {} - - /// The `Status` type defines a logical error model that is suitable for different /// programming environments, including REST APIs and RPC APIs. It is used by /// [gRPC](https://github.com/grpc). The error model is designed to be: @@ -1021,6 +732,290 @@ pub struct Status { impl Part for Status {} +/// A batch of results produced by a query. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryResultBatch { + /// The state of the query after the current batch. + #[serde(rename="moreResults")] + pub more_results: Option, + /// The result type for every entity in `entity_results`. + #[serde(rename="entityResultType")] + pub entity_result_type: Option, + /// The version number of the snapshot this batch was returned from. + /// This applies to the range of results from the query's `start_cursor` (or + /// the beginning of the query if no cursor was given) to this batch's + /// `end_cursor` (not the query's `end_cursor`). + /// + /// In a single transaction, subsequent query result batches for the same query + /// can have a greater snapshot version number. Each batch's snapshot version + /// is valid for all preceding batches. + /// The value will be zero for eventually consistent queries. + #[serde(rename="snapshotVersion")] + pub snapshot_version: Option, + /// The number of results skipped, typically because of an offset. + #[serde(rename="skippedResults")] + pub skipped_results: Option, + /// A cursor that points to the position after the last result in the batch. + #[serde(rename="endCursor")] + pub end_cursor: Option, + /// A cursor that points to the position after the last skipped result. + /// Will be set when `skipped_results` != 0. + #[serde(rename="skippedCursor")] + pub skipped_cursor: Option, + /// The results for this batch. + #[serde(rename="entityResults")] + pub entity_results: Option>, +} + +impl Part for QueryResultBatch {} + + +/// The response for Datastore.Commit. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [commit projects](struct.ProjectCommitCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CommitResponse { + /// The number of index entries updated during the commit, or zero if none were + /// updated. + #[serde(rename="indexUpdates")] + pub index_updates: Option, + /// The result of performing the mutations. + /// The i-th mutation result corresponds to the i-th mutation in the request. + #[serde(rename="mutationResults")] + pub mutation_results: Option>, +} + +impl ResponseResult for CommitResponse {} + + +/// The result of fetching an entity from Datastore. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EntityResult { + /// A cursor that points to the position after the result entity. + /// Set only when the `EntityResult` is part of a `QueryResultBatch` message. + pub cursor: Option, + /// The version of the entity, a strictly positive number that monotonically + /// increases with changes to the entity. + /// + /// This field is set for `FULL` entity + /// results. + /// + /// For missing entities in `LookupResponse`, this + /// is the version of the snapshot that was used to look up the entity, and it + /// is always set except for eventually consistent reads. + pub version: Option, + /// The resulting entity. + pub entity: Option, +} + +impl Part for EntityResult {} + + +/// The response for Datastore.Rollback. +/// (an empty message). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [rollback projects](struct.ProjectRollbackCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RollbackResponse { _never_set: Option } + +impl ResponseResult for RollbackResponse {} + + +/// The request for Datastore.BeginTransaction. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [begin transaction projects](struct.ProjectBeginTransactionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BeginTransactionRequest { + /// Options for a new transaction. + #[serde(rename="transactionOptions")] + pub transaction_options: Option, +} + +impl RequestValue for BeginTransactionRequest {} + + +/// A [GQL query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GqlQuery { + /// For each non-reserved named binding site in the query string, there must be + /// a named parameter with that name, but not necessarily the inverse. + /// + /// Key must match regex `A-Za-z_$*`, must not match regex + /// `__.*__`, and must not be `""`. + #[serde(rename="namedBindings")] + pub named_bindings: Option>, + /// Numbered binding site @1 references the first numbered parameter, + /// effectively using 1-based indexing, rather than the usual 0. + /// + /// For each binding site numbered i in `query_string`, there must be an i-th + /// numbered parameter. The inverse must also be true. + #[serde(rename="positionalBindings")] + pub positional_bindings: Option>, + /// A string of the format described + /// [here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). + #[serde(rename="queryString")] + pub query_string: Option, + /// When false, the query string must not contain any literals and instead must + /// bind all values. For example, + /// `SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while + /// `SELECT * FROM Kind WHERE a = @value` is. + #[serde(rename="allowLiterals")] + pub allow_literals: Option, +} + +impl Part for GqlQuery {} + + +/// A unique identifier for an entity. +/// If a key's partition ID or any of its path kinds or names are +/// reserved/read-only, the key is reserved/read-only. +/// A reserved/read-only key is forbidden in certain documented contexts. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Key { + /// The entity path. + /// An entity path consists of one or more elements composed of a kind and a + /// string or numerical identifier, which identify entities. The first + /// element identifies a _root entity_, the second element identifies + /// a _child_ of the root entity, the third element identifies a child of the + /// second entity, and so forth. The entities identified by all prefixes of + /// the path are called the element's _ancestors_. + /// + /// An entity path is always fully complete: *all* of the entity's ancestors + /// are required to be in the path along with the entity identifier itself. + /// The only exception is that in some documented cases, the identifier in the + /// last path element (for the entity) itself may be omitted. For example, + /// the last path element of the key of `Mutation.insert` may have no + /// identifier. + /// + /// A path can never be empty, and a path can have at most 100 elements. + pub path: Option>, + /// Entities are partitioned into subsets, currently identified by a project + /// ID and namespace ID. + /// Queries are scoped to a single partition. + #[serde(rename="partitionId")] + pub partition_id: Option, +} + +impl Part for Key {} + + +/// The result of applying a mutation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MutationResult { + /// The version of the entity on the server after processing the mutation. If + /// the mutation doesn't change anything on the server, then the version will + /// be the version of the current entity or, if no entity is present, a version + /// that is strictly greater than the version of any previous entity and less + /// than the version of any possible future entity. + pub version: Option, + /// Whether a conflict was detected for this mutation. Always false when a + /// conflict detection strategy field is not set in the mutation. + #[serde(rename="conflictDetected")] + pub conflict_detected: Option, + /// The automatically allocated key. + /// Set only when the mutation allocated a key. + pub key: Option, +} + +impl Part for MutationResult {} + + +/// The request for +/// google.datastore.admin.v1.DatastoreAdmin.ExportEntities. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [export projects](struct.ProjectExportCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleDatastoreAdminV1ExportEntitiesRequest { + /// Location for the export metadata and data files. + /// + /// The full resource URL of the external storage location. Currently, only + /// Google Cloud Storage is supported. So output_url_prefix should be of the + /// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the + /// name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud + /// Storage namespace path (this is not a Cloud Datastore namespace). For more + /// information about Cloud Storage namespace paths, see + /// [Object name + /// considerations](https://cloud.google.com/storage/docs/naming#object-considerations). + /// + /// The resulting files will be nested deeper than the specified URL prefix. + /// The final output URL will be provided in the + /// google.datastore.admin.v1.ExportEntitiesResponse.output_url field. That + /// value should be used for subsequent ImportEntities operations. + /// + /// By nesting the data files deeper, the same Cloud Storage bucket can be used + /// in multiple ExportEntities operations without conflict. + #[serde(rename="outputUrlPrefix")] + pub output_url_prefix: Option, + /// Client-assigned labels. + pub labels: Option>, + /// Description of what data from the project is included in the export. + #[serde(rename="entityFilter")] + pub entity_filter: Option, +} + +impl RequestValue for GoogleDatastoreAdminV1ExportEntitiesRequest {} + + +/// Options for beginning a new transaction. +/// +/// Transactions can be created explicitly with calls to +/// Datastore.BeginTransaction or implicitly by setting +/// ReadOptions.new_transaction in read requests. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TransactionOptions { + /// The transaction should allow both reads and writes. + #[serde(rename="readWrite")] + pub read_write: Option, + /// The transaction should only allow reads. + #[serde(rename="readOnly")] + pub read_only: Option, +} + +impl Part for TransactionOptions {} + + /// The request for Datastore.ReserveIds. /// /// # Activities @@ -1095,85 +1090,48 @@ pub struct GqlQueryParameter { impl Part for GqlQueryParameter {} -/// A message that can hold any of the supported value types and associated -/// metadata. +/// A representation of a kind. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Value { - /// An entity value. - /// - /// - May have no key. - /// - May have a key with an incomplete key path. - /// - May have a reserved/read-only key. - #[serde(rename="entityValue")] - pub entity_value: Option, - /// A timestamp value. - /// When stored in the Datastore, precise only to microseconds; - /// any additional precision is rounded down. - #[serde(rename="timestampValue")] - pub timestamp_value: Option, - /// A UTF-8 encoded string value. - /// When `exclude_from_indexes` is false (it is indexed) , may have at most 1500 bytes. - /// Otherwise, may be set to at least 1,000,000 bytes. - #[serde(rename="stringValue")] - pub string_value: Option, - /// A double value. - #[serde(rename="doubleValue")] - pub double_value: Option, - /// The `meaning` field should only be populated for backwards compatibility. - pub meaning: Option, - /// If the value should be excluded from all indexes including those defined - /// explicitly. - #[serde(rename="excludeFromIndexes")] - pub exclude_from_indexes: Option, - /// A blob value. - /// May have at most 1,000,000 bytes. - /// When `exclude_from_indexes` is false, may have at most 1500 bytes. - /// In JSON requests, must be base64-encoded. - #[serde(rename="blobValue")] - pub blob_value: Option, - /// A key value. - #[serde(rename="keyValue")] - pub key_value: Option, - /// A boolean value. - #[serde(rename="booleanValue")] - pub boolean_value: Option, - /// An array value. - /// Cannot contain another array value. - /// A `Value` instance that sets field `array_value` must not set fields - /// `meaning` or `exclude_from_indexes`. - #[serde(rename="arrayValue")] - pub array_value: Option, - /// An integer value. - #[serde(rename="integerValue")] - pub integer_value: Option, - /// A geo point value representing a point on the surface of Earth. - #[serde(rename="geoPointValue")] - pub geo_point_value: Option, - /// A null value. - #[serde(rename="nullValue")] - pub null_value: Option, +pub struct KindExpression { + /// The name of the kind. + pub name: Option, } -impl Part for Value {} +impl Part for KindExpression {} -/// A filter that merges multiple other filters using the given operator. +/// A holder for any type of filter. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CompositeFilter { - /// The list of filters to combine. - /// Must contain at least one filter. - pub filters: Option>, - /// The operator for combining multiple filters. - pub op: Option, +pub struct Filter { + /// A composite filter. + #[serde(rename="compositeFilter")] + pub composite_filter: Option, + /// A filter on a property. + #[serde(rename="propertyFilter")] + pub property_filter: Option, } -impl Part for CompositeFilter {} +impl Part for Filter {} + + +/// A reference to a property relative to the kind expressions. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PropertyReference { + /// The name of the property. + /// If name includes "."s, it may be interpreted as a property name path. + pub name: Option, +} + +impl Part for PropertyReference {} /// The response message for Operations.ListOperations. @@ -1197,17 +1155,69 @@ pub struct GoogleLongrunningListOperationsResponse { impl ResponseResult for GoogleLongrunningListOperationsResponse {} -/// A representation of a kind. +/// A message that can hold any of the supported value types and associated +/// metadata. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct KindExpression { - /// The name of the kind. - pub name: Option, +pub struct Value { + /// An entity value. + /// + /// - May have no key. + /// - May have a key with an incomplete key path. + /// - May have a reserved/read-only key. + #[serde(rename="entityValue")] + pub entity_value: Option, + /// A timestamp value. + /// When stored in the Datastore, precise only to microseconds; + /// any additional precision is rounded down. + #[serde(rename="timestampValue")] + pub timestamp_value: Option, + /// A geo point value representing a point on the surface of Earth. + #[serde(rename="geoPointValue")] + pub geo_point_value: Option, + /// A blob value. + /// May have at most 1,000,000 bytes. + /// When `exclude_from_indexes` is false, may have at most 1500 bytes. + /// In JSON requests, must be base64-encoded. + #[serde(rename="blobValue")] + pub blob_value: Option, + /// A double value. + #[serde(rename="doubleValue")] + pub double_value: Option, + /// The `meaning` field should only be populated for backwards compatibility. + pub meaning: Option, + /// If the value should be excluded from all indexes including those defined + /// explicitly. + #[serde(rename="excludeFromIndexes")] + pub exclude_from_indexes: Option, + /// A UTF-8 encoded string value. + /// When `exclude_from_indexes` is false (it is indexed) , may have at most 1500 bytes. + /// Otherwise, may be set to at least 1,000,000 bytes. + #[serde(rename="stringValue")] + pub string_value: Option, + /// A key value. + #[serde(rename="keyValue")] + pub key_value: Option, + /// A boolean value. + #[serde(rename="booleanValue")] + pub boolean_value: Option, + /// An array value. + /// Cannot contain another array value. + /// A `Value` instance that sets field `array_value` must not set fields + /// `meaning` or `exclude_from_indexes`. + #[serde(rename="arrayValue")] + pub array_value: Option, + /// An integer value. + #[serde(rename="integerValue")] + pub integer_value: Option, + /// A null value. + #[serde(rename="nullValue")] + pub null_value: Option, } -impl Part for KindExpression {} +impl Part for Value {} /// The response for Datastore.Lookup. @@ -1238,36 +1248,33 @@ pub struct LookupResponse { impl ResponseResult for LookupResponse {} -/// The response for Datastore.ReserveIds. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [reserve ids projects](struct.ProjectReserveIdCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReserveIdsResponse { _never_set: Option } - -impl ResponseResult for ReserveIdsResponse {} - - -/// A holder for any type of filter. +/// A representation of a property in a projection. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Filter { - /// A composite filter. - #[serde(rename="compositeFilter")] - pub composite_filter: Option, - /// A filter on a property. - #[serde(rename="propertyFilter")] - pub property_filter: Option, +pub struct Projection { + /// The property to project. + pub property: Option, } -impl Part for Filter {} +impl Part for Projection {} + + +/// A filter that merges multiple other filters using the given operator. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompositeFilter { + /// The list of filters to combine. + /// Must contain at least one filter. + pub filters: Option>, + /// The operator for combining multiple filters. + pub op: Option, +} + +impl Part for CompositeFilter {} /// The response for @@ -1307,6 +1314,8 @@ pub struct CommitRequest { /// transaction identifier is returned by a call to /// Datastore.BeginTransaction. pub transaction: Option, + /// The type of commit to perform. Defaults to `TRANSACTIONAL`. + pub mode: Option, /// The mutations to perform. /// /// When mode is `TRANSACTIONAL`, mutations affecting a single entity are @@ -1321,24 +1330,24 @@ pub struct CommitRequest { /// When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single /// entity. pub mutations: Option>, - /// The type of commit to perform. Defaults to `TRANSACTIONAL`. - pub mode: Option, } impl RequestValue for CommitRequest {} -/// A representation of a property in a projection. +/// The response for Datastore.ReserveIds. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [reserve ids projects](struct.ProjectReserveIdCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Projection { - /// The property to project. - pub property: Option, -} +pub struct ReserveIdsResponse { _never_set: Option } -impl Part for Projection {} +impl ResponseResult for ReserveIdsResponse {} /// Options specific to read / write transactions. @@ -1610,41 +1619,31 @@ pub struct Query { impl Part for Query {} -/// A minimal index definition. -/// Next tag: 8 +/// A mutation to apply to an entity. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [indexes get projects](struct.ProjectIndexeGetCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleDatastoreAdminV1Index { - /// The entity kind to which this index applies. - /// Required. - pub kind: Option, - /// Project ID. - /// Output only. - #[serde(rename="projectId")] - pub project_id: Option, - /// The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED. - /// Required. - pub ancestor: Option, - /// The resource ID of the index. - /// Output only. - #[serde(rename="indexId")] - pub index_id: Option, - /// The state of the index. - /// Output only. - pub state: Option, - /// An ordered sequence of property names and their index attributes. - /// Required. - pub properties: Option>, +pub struct Mutation { + /// The entity to insert. The entity must not already exist. + /// The entity key's final path element may be incomplete. + pub insert: Option, + /// The key of the entity to delete. The entity may or may not already exist. + /// Must have a complete key path and must not be reserved/read-only. + pub delete: Option, + /// The entity to update. The entity must already exist. + /// Must have a complete key path. + pub update: Option, + /// The version of the entity that this mutation is being applied to. If this + /// does not match the current version on the server, the mutation conflicts. + #[serde(rename="baseVersion")] + pub base_version: Option, + /// The entity to upsert. The entity may or may not already exist. + /// The entity key's final path element may be incomplete. + pub upsert: Option, } -impl ResponseResult for GoogleDatastoreAdminV1Index {} +impl Part for Mutation {} @@ -1952,18 +1951,14 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Imports entities into Google Cloud Datastore. Existing entities with the - /// same key are overwritten. The import occurs in the background and its - /// progress can be monitored and managed via the Operation resource that is - /// created. If an ImportEntities operation is cancelled, it is possible - /// that a subset of the data has already been imported to Cloud Datastore. + /// Begins a new transaction. /// /// # Arguments /// /// * `request` - No description provided. - /// * `projectId` - Project ID against which to make the request. - pub fn import(&self, request: GoogleDatastoreAdminV1ImportEntitiesRequest, project_id: &str) -> ProjectImportCall<'a, C, A> { - ProjectImportCall { + /// * `projectId` - The ID of the project against which to make the request. + pub fn begin_transaction(&self, request: BeginTransactionRequest, project_id: &str) -> ProjectBeginTransactionCall<'a, C, A> { + ProjectBeginTransactionCall { hub: self.hub, _request: request, _project_id: project_id.to_string(), @@ -1994,14 +1989,18 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Begins a new transaction. + /// Imports entities into Google Cloud Datastore. Existing entities with the + /// same key are overwritten. The import occurs in the background and its + /// progress can be monitored and managed via the Operation resource that is + /// created. If an ImportEntities operation is cancelled, it is possible + /// that a subset of the data has already been imported to Cloud Datastore. /// /// # Arguments /// /// * `request` - No description provided. - /// * `projectId` - The ID of the project against which to make the request. - pub fn begin_transaction(&self, request: BeginTransactionRequest, project_id: &str) -> ProjectBeginTransactionCall<'a, C, A> { - ProjectBeginTransactionCall { + /// * `projectId` - Project ID against which to make the request. + pub fn import(&self, request: GoogleDatastoreAdminV1ImportEntitiesRequest, project_id: &str) -> ProjectImportCall<'a, C, A> { + ProjectImportCall { hub: self.hub, _request: request, _project_id: project_id.to_string(), @@ -2130,7 +2129,7 @@ impl<'a, C, A> ProjectOperationListCall<'a, C, A> where C: BorrowMut ProjectOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2169,7 +2165,7 @@ impl<'a, C, A> ProjectOperationListCall<'a, C, A> where C: BorrowMut ProjectOperationListCall<'a, C, A> where C: BorrowMut ProjectOperationListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectOperationListCall<'a, C, A> @@ -2428,10 +2424,7 @@ impl<'a, C, A> ProjectExportCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2463,7 +2456,7 @@ impl<'a, C, A> ProjectExportCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2553,7 +2546,7 @@ impl<'a, C, A> ProjectExportCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2561,12 +2554,12 @@ impl<'a, C, A> ProjectExportCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectExportCall<'a, C, A> @@ -2706,10 +2699,7 @@ impl<'a, C, A> ProjectRunQueryCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2741,7 +2731,7 @@ impl<'a, C, A> ProjectRunQueryCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2831,7 +2821,7 @@ impl<'a, C, A> ProjectRunQueryCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2839,12 +2829,12 @@ impl<'a, C, A> ProjectRunQueryCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectRunQueryCall<'a, C, A> @@ -2985,10 +2975,7 @@ impl<'a, C, A> ProjectReserveIdCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3020,7 +3007,7 @@ impl<'a, C, A> ProjectReserveIdCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3110,7 +3097,7 @@ impl<'a, C, A> ProjectReserveIdCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3118,12 +3105,12 @@ impl<'a, C, A> ProjectReserveIdCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectReserveIdCall<'a, C, A> @@ -3263,10 +3250,7 @@ impl<'a, C, A> ProjectLookupCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3298,7 +3282,7 @@ impl<'a, C, A> ProjectLookupCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3388,7 +3372,7 @@ impl<'a, C, A> ProjectLookupCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3396,12 +3380,12 @@ impl<'a, C, A> ProjectLookupCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLookupCall<'a, C, A> @@ -3542,10 +3526,7 @@ impl<'a, C, A> ProjectCommitCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3577,7 +3558,7 @@ impl<'a, C, A> ProjectCommitCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3667,7 +3648,7 @@ impl<'a, C, A> ProjectCommitCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3675,12 +3656,12 @@ impl<'a, C, A> ProjectCommitCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectCommitCall<'a, C, A> @@ -3821,10 +3802,7 @@ impl<'a, C, A> ProjectAllocateIdCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3856,7 +3834,7 @@ impl<'a, C, A> ProjectAllocateIdCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3946,7 +3924,7 @@ impl<'a, C, A> ProjectAllocateIdCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3954,12 +3932,12 @@ impl<'a, C, A> ProjectAllocateIdCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAllocateIdCall<'a, C, A> @@ -4083,7 +4061,7 @@ impl<'a, C, A> ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4122,7 +4097,7 @@ impl<'a, C, A> ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectOperationDeleteCall<'a, C, A> @@ -4336,7 +4311,7 @@ impl<'a, C, A> ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4375,7 +4347,7 @@ impl<'a, C, A> ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectOperationGetCall<'a, C, A> @@ -4596,7 +4568,7 @@ impl<'a, C, A> ProjectOperationCancelCall<'a, C, A> where C: BorrowMut ProjectOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4635,7 +4604,7 @@ impl<'a, C, A> ProjectOperationCancelCall<'a, C, A> where C: BorrowMut ProjectOperationCancelCall<'a, C, A> where C: BorrowMut ProjectOperationCancelCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectOperationCancelCall<'a, C, A> @@ -4861,10 +4830,7 @@ impl<'a, C, A> ProjectIndexeGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4884,7 +4850,7 @@ impl<'a, C, A> ProjectIndexeGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4972,7 +4938,7 @@ impl<'a, C, A> ProjectIndexeGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4980,12 +4946,12 @@ impl<'a, C, A> ProjectIndexeGetCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectIndexeGetCall<'a, C, A> @@ -5135,10 +5101,7 @@ impl<'a, C, A> ProjectIndexeListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5158,7 +5121,7 @@ impl<'a, C, A> ProjectIndexeListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5257,7 +5220,7 @@ impl<'a, C, A> ProjectIndexeListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5265,12 +5228,12 @@ impl<'a, C, A> ProjectIndexeListCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectIndexeListCall<'a, C, A> @@ -5305,6 +5268,556 @@ impl<'a, C, A> ProjectIndexeListCall<'a, C, A> where C: BorrowMut } +/// Begins a new transaction. +/// +/// A builder for the *beginTransaction* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_datastore1 as datastore1; +/// use datastore1::BeginTransactionRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use datastore1::Datastore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Datastore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BeginTransactionRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().begin_transaction(req, "projectId") +/// .doit(); +/// # } +/// ``` +pub struct ProjectBeginTransactionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Datastore, + _request: BeginTransactionRequest, + _project_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectBeginTransactionCall<'a, C, A> {} + +impl<'a, C, A> ProjectBeginTransactionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BeginTransactionResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "datastore.projects.beginTransaction", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("projectId", self._project_id.to_string())); + for &field in ["alt", "projectId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}:beginTransaction"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["projectId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BeginTransactionRequest) -> ProjectBeginTransactionCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the project against which to make the request. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> ProjectBeginTransactionCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectBeginTransactionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectBeginTransactionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectBeginTransactionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Rolls back a transaction. +/// +/// A builder for the *rollback* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_datastore1 as datastore1; +/// use datastore1::RollbackRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use datastore1::Datastore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Datastore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RollbackRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().rollback(req, "projectId") +/// .doit(); +/// # } +/// ``` +pub struct ProjectRollbackCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Datastore, + _request: RollbackRequest, + _project_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectRollbackCall<'a, C, A> {} + +impl<'a, C, A> ProjectRollbackCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RollbackResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "datastore.projects.rollback", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("projectId", self._project_id.to_string())); + for &field in ["alt", "projectId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}:rollback"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["projectId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RollbackRequest) -> ProjectRollbackCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the project against which to make the request. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> ProjectRollbackCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectRollbackCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectRollbackCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectRollbackCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Imports entities into Google Cloud Datastore. Existing entities with the /// same key are overwritten. The import occurs in the background and its /// progress can be monitored and managed via the Operation resource that is @@ -5414,10 +5927,7 @@ impl<'a, C, A> ProjectImportCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5449,7 +5959,7 @@ impl<'a, C, A> ProjectImportCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5539,7 +6049,7 @@ impl<'a, C, A> ProjectImportCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5547,12 +6057,12 @@ impl<'a, C, A> ProjectImportCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectImportCall<'a, C, A> @@ -5587,559 +6097,3 @@ impl<'a, C, A> ProjectImportCall<'a, C, A> where C: BorrowMut, A: } -/// Rolls back a transaction. -/// -/// A builder for the *rollback* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_datastore1 as datastore1; -/// use datastore1::RollbackRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use datastore1::Datastore; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Datastore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = RollbackRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().rollback(req, "projectId") -/// .doit(); -/// # } -/// ``` -pub struct ProjectRollbackCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Datastore, - _request: RollbackRequest, - _project_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectRollbackCall<'a, C, A> {} - -impl<'a, C, A> ProjectRollbackCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, RollbackResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "datastore.projects.rollback", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("projectId", self._project_id.to_string())); - for &field in ["alt", "projectId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}:rollback"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{projectId}", "projectId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["projectId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: RollbackRequest) -> ProjectRollbackCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the project against which to make the request. - /// - /// Sets the *project id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project_id(mut self, new_value: &str) -> ProjectRollbackCall<'a, C, A> { - self._project_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectRollbackCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectRollbackCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectRollbackCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Begins a new transaction. -/// -/// A builder for the *beginTransaction* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_datastore1 as datastore1; -/// use datastore1::BeginTransactionRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use datastore1::Datastore; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Datastore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = BeginTransactionRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().begin_transaction(req, "projectId") -/// .doit(); -/// # } -/// ``` -pub struct ProjectBeginTransactionCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Datastore, - _request: BeginTransactionRequest, - _project_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectBeginTransactionCall<'a, C, A> {} - -impl<'a, C, A> ProjectBeginTransactionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, BeginTransactionResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "datastore.projects.beginTransaction", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("projectId", self._project_id.to_string())); - for &field in ["alt", "projectId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}:beginTransaction"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{projectId}", "projectId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["projectId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: BeginTransactionRequest) -> ProjectBeginTransactionCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the project against which to make the request. - /// - /// Sets the *project id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project_id(mut self, new_value: &str) -> ProjectBeginTransactionCall<'a, C, A> { - self._project_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectBeginTransactionCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectBeginTransactionCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectBeginTransactionCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - diff --git a/gen/datastore1_beta3-cli/Cargo.toml b/gen/datastore1_beta3-cli/Cargo.toml index 35730442c6..6063edf9c0 100644 --- a/gen/datastore1_beta3-cli/Cargo.toml +++ b/gen/datastore1_beta3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-datastore1_beta3-cli" -version = "1.0.8+20181002" +version = "1.0.8+20190105" authors = ["Sebastian Thiel "] description = "A complete library to interact with datastore (protocol v1beta3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/datastore1_beta3-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-datastore1_beta3] path = "../datastore1_beta3" -version = "1.0.8+20181002" +version = "1.0.8+20190105" diff --git a/gen/datastore1_beta3-cli/README.md b/gen/datastore1_beta3-cli/README.md index 6875d95725..c890044013 100644 --- a/gen/datastore1_beta3-cli/README.md +++ b/gen/datastore1_beta3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *datastore* API at revision *20181002*. The CLI is at version *1.0.8*. +This documentation was generated from the *datastore* API at revision *20190105*. The CLI is at version *1.0.8*. ```bash datastore1-beta3 [options] diff --git a/gen/datastore1_beta3-cli/mkdocs.yml b/gen/datastore1_beta3-cli/mkdocs.yml index d9e2441ada..f4f4e439d1 100644 --- a/gen/datastore1_beta3-cli/mkdocs.yml +++ b/gen/datastore1_beta3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: datastore v1.0.8+20181002 +site_name: datastore v1.0.8+20190105 site_url: http://byron.github.io/google-apis-rs/google-datastore1_beta3-cli site_description: A complete library to interact with datastore (protocol v1beta3) diff --git a/gen/datastore1_beta3-cli/src/main.rs b/gen/datastore1_beta3-cli/src/main.rs index ae44cbf621..948a5ea3fb 100644 --- a/gen/datastore1_beta3-cli/src/main.rs +++ b/gen/datastore1_beta3-cli/src/main.rs @@ -585,8 +585,7 @@ impl<'n> Engine<'n> { "query.filter.property-filter.value.entity-value.key.partition-id.project-id" => Some(("query.filter.propertyFilter.value.entityValue.key.partitionId.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.filter.property-filter.value.entity-value.key.partition-id.namespace-id" => Some(("query.filter.propertyFilter.value.entityValue.key.partitionId.namespaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.filter.property-filter.value.timestamp-value" => Some(("query.filter.propertyFilter.value.timestampValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "query.filter.property-filter.value.geo-point-value.latitude" => Some(("query.filter.propertyFilter.value.geoPointValue.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "query.filter.property-filter.value.geo-point-value.longitude" => Some(("query.filter.propertyFilter.value.geoPointValue.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "query.filter.property-filter.value.null-value" => Some(("query.filter.propertyFilter.value.nullValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.filter.property-filter.value.double-value" => Some(("query.filter.propertyFilter.value.doubleValue", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "query.filter.property-filter.value.meaning" => Some(("query.filter.propertyFilter.value.meaning", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "query.filter.property-filter.value.exclude-from-indexes" => Some(("query.filter.propertyFilter.value.excludeFromIndexes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -596,7 +595,8 @@ impl<'n> Engine<'n> { "query.filter.property-filter.value.blob-value" => Some(("query.filter.propertyFilter.value.blobValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.filter.property-filter.value.boolean-value" => Some(("query.filter.propertyFilter.value.booleanValue", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "query.filter.property-filter.value.integer-value" => Some(("query.filter.propertyFilter.value.integerValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "query.filter.property-filter.value.null-value" => Some(("query.filter.propertyFilter.value.nullValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.filter.property-filter.value.geo-point-value.latitude" => Some(("query.filter.propertyFilter.value.geoPointValue.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "query.filter.property-filter.value.geo-point-value.longitude" => Some(("query.filter.propertyFilter.value.geoPointValue.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "query.filter.property-filter.op" => Some(("query.filter.propertyFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.start-cursor" => Some(("query.startCursor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.end-cursor" => Some(("query.endCursor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -994,7 +994,7 @@ fn main() { let mut app = App::new("datastore1-beta3") .author("Sebastian Thiel ") - .version("1.0.8+20181002") + .version("1.0.8+20190105") .about("Accesses the schemaless NoSQL database to provide fully managed, robust, scalable storage for your application. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_datastore1_beta3_cli") diff --git a/gen/datastore1_beta3/Cargo.toml b/gen/datastore1_beta3/Cargo.toml index b48112e751..a6fbc0cf51 100644 --- a/gen/datastore1_beta3/Cargo.toml +++ b/gen/datastore1_beta3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-datastore1_beta3" -version = "1.0.8+20181002" +version = "1.0.8+20190105" authors = ["Sebastian Thiel "] description = "A complete library to interact with datastore (protocol v1beta3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/datastore1_beta3" homepage = "https://cloud.google.com/datastore/" -documentation = "https://docs.rs/google-datastore1_beta3/1.0.8+20181002" +documentation = "https://docs.rs/google-datastore1_beta3/1.0.8+20190105" license = "MIT" keywords = ["datastore", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/datastore1_beta3/README.md b/gen/datastore1_beta3/README.md index fe6ca0eafe..2ddcfe2bf5 100644 --- a/gen/datastore1_beta3/README.md +++ b/gen/datastore1_beta3/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-datastore1_beta3` library allows access to all features of the *Google datastore* service. -This documentation was generated from *datastore* crate version *1.0.8+20181002*, where *20181002* is the exact revision of the *datastore:v1beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *datastore* crate version *1.0.8+20190105*, where *20190105* is the exact revision of the *datastore:v1beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *datastore* *v1_beta3* API can be found at the [official documentation site](https://cloud.google.com/datastore/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/struct.Datastore.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/struct.Datastore.html) ... * projects - * [*allocate ids*](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/struct.ProjectAllocateIdCall.html), [*begin transaction*](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/struct.ProjectBeginTransactionCall.html), [*commit*](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/struct.ProjectCommitCall.html), [*lookup*](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/struct.ProjectLookupCall.html), [*reserve ids*](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/struct.ProjectReserveIdCall.html), [*rollback*](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/struct.ProjectRollbackCall.html) and [*run query*](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/struct.ProjectRunQueryCall.html) + * [*allocate ids*](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/struct.ProjectAllocateIdCall.html), [*begin transaction*](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/struct.ProjectBeginTransactionCall.html), [*commit*](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/struct.ProjectCommitCall.html), [*lookup*](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/struct.ProjectLookupCall.html), [*reserve ids*](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/struct.ProjectReserveIdCall.html), [*rollback*](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/struct.ProjectRollbackCall.html) and [*run query*](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/struct.ProjectRunQueryCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/struct.Datastore.html)** +* **[Hub](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/struct.Datastore.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.Part.html)** + * **[Parts](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -130,17 +130,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -150,29 +150,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-datastore1_beta3/1.0.8+20181002/google_datastore1_beta3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-datastore1_beta3/1.0.8+20190105/google_datastore1_beta3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/datastore1_beta3/src/lib.rs b/gen/datastore1_beta3/src/lib.rs index 9d8e8faa59..4b326c82b3 100644 --- a/gen/datastore1_beta3/src/lib.rs +++ b/gen/datastore1_beta3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *datastore* crate version *1.0.8+20181002*, where *20181002* is the exact revision of the *datastore:v1beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *datastore* crate version *1.0.8+20190105*, where *20190105* is the exact revision of the *datastore:v1beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *datastore* *v1_beta3* API can be found at the //! [official documentation site](https://cloud.google.com/datastore/). @@ -496,9 +496,9 @@ pub struct Mutation { /// The entity to insert. The entity must not already exist. /// The entity key's final path element may be incomplete. pub insert: Option, - /// The entity to upsert. The entity may or may not already exist. - /// The entity key's final path element may be incomplete. - pub upsert: Option, + /// The key of the entity to delete. The entity may or may not already exist. + /// Must have a complete key path and must not be reserved/read-only. + pub delete: Option, /// The entity to update. The entity must already exist. /// Must have a complete key path. pub update: Option, @@ -506,9 +506,9 @@ pub struct Mutation { /// does not match the current version on the server, the mutation conflicts. #[serde(rename="baseVersion")] pub base_version: Option, - /// The key of the entity to delete. The entity may or may not already exist. - /// Must have a complete key path and must not be reserved/read-only. - pub delete: Option, + /// The entity to upsert. The entity may or may not already exist. + /// The entity key's final path element may be incomplete. + pub upsert: Option, } impl Part for Mutation {} @@ -602,14 +602,14 @@ impl Part for QueryResultBatch {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CommitResponse { - /// The result of performing the mutations. - /// The i-th mutation result corresponds to the i-th mutation in the request. - #[serde(rename="mutationResults")] - pub mutation_results: Option>, /// The number of index entries updated during the commit, or zero if none were /// updated. #[serde(rename="indexUpdates")] pub index_updates: Option, + /// The result of performing the mutations. + /// The i-th mutation result corresponds to the i-th mutation in the request. + #[serde(rename="mutationResults")] + pub mutation_results: Option>, } impl ResponseResult for CommitResponse {} @@ -676,28 +676,39 @@ pub struct BeginTransactionRequest { impl RequestValue for BeginTransactionRequest {} -/// The result of applying a mutation. +/// A [GQL query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MutationResult { - /// The version of the entity on the server after processing the mutation. If - /// the mutation doesn't change anything on the server, then the version will - /// be the version of the current entity or, if no entity is present, a version - /// that is strictly greater than the version of any previous entity and less - /// than the version of any possible future entity. - pub version: Option, - /// Whether a conflict was detected for this mutation. Always false when a - /// conflict detection strategy field is not set in the mutation. - #[serde(rename="conflictDetected")] - pub conflict_detected: Option, - /// The automatically allocated key. - /// Set only when the mutation allocated a key. - pub key: Option, +pub struct GqlQuery { + /// For each non-reserved named binding site in the query string, there must be + /// a named parameter with that name, but not necessarily the inverse. + /// + /// Key must match regex `A-Za-z_$*`, must not match regex + /// `__.*__`, and must not be `""`. + #[serde(rename="namedBindings")] + pub named_bindings: Option>, + /// Numbered binding site @1 references the first numbered parameter, + /// effectively using 1-based indexing, rather than the usual 0. + /// + /// For each binding site numbered i in `query_string`, there must be an i-th + /// numbered parameter. The inverse must also be true. + #[serde(rename="positionalBindings")] + pub positional_bindings: Option>, + /// A string of the format described + /// [here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). + #[serde(rename="queryString")] + pub query_string: Option, + /// When false, the query string must not contain any literals and instead must + /// bind all values. For example, + /// `SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while + /// `SELECT * FROM Kind WHERE a = @value` is. + #[serde(rename="allowLiterals")] + pub allow_literals: Option, } -impl Part for MutationResult {} +impl Part for GqlQuery {} /// A unique identifier for an entity. @@ -736,39 +747,28 @@ pub struct Key { impl Part for Key {} -/// A [GQL query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). +/// The result of applying a mutation. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GqlQuery { - /// A string of the format described - /// [here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). - #[serde(rename="queryString")] - pub query_string: Option, - /// Numbered binding site @1 references the first numbered parameter, - /// effectively using 1-based indexing, rather than the usual 0. - /// - /// For each binding site numbered i in `query_string`, there must be an i-th - /// numbered parameter. The inverse must also be true. - #[serde(rename="positionalBindings")] - pub positional_bindings: Option>, - /// For each non-reserved named binding site in the query string, there must be - /// a named parameter with that name, but not necessarily the inverse. - /// - /// Key must match regex `A-Za-z_$*`, must not match regex - /// `__.*__`, and must not be `""`. - #[serde(rename="namedBindings")] - pub named_bindings: Option>, - /// When false, the query string must not contain any literals and instead must - /// bind all values. For example, - /// `SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while - /// `SELECT * FROM Kind WHERE a = @value` is. - #[serde(rename="allowLiterals")] - pub allow_literals: Option, +pub struct MutationResult { + /// The version of the entity on the server after processing the mutation. If + /// the mutation doesn't change anything on the server, then the version will + /// be the version of the current entity or, if no entity is present, a version + /// that is strictly greater than the version of any previous entity and less + /// than the version of any possible future entity. + pub version: Option, + /// Whether a conflict was detected for this mutation. Always false when a + /// conflict detection strategy field is not set in the mutation. + #[serde(rename="conflictDetected")] + pub conflict_detected: Option, + /// The automatically allocated key. + /// Set only when the mutation allocated a key. + pub key: Option, } -impl Part for GqlQuery {} +impl Part for MutationResult {} /// The request for Datastore.ReserveIds. @@ -829,6 +829,22 @@ pub struct PropertyFilter { impl Part for PropertyFilter {} +/// A binding parameter for a GQL query. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GqlQueryParameter { + /// A query cursor. Query cursors are returned in query + /// result batches. + pub cursor: Option, + /// A value parameter. + pub value: Option, +} + +impl Part for GqlQueryParameter {} + + /// A representation of a kind. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -842,20 +858,21 @@ pub struct KindExpression { impl Part for KindExpression {} -/// A filter that merges multiple other filters using the given operator. +/// A holder for any type of filter. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CompositeFilter { - /// The list of filters to combine. - /// Must contain at least one filter. - pub filters: Option>, - /// The operator for combining multiple filters. - pub op: Option, +pub struct Filter { + /// A composite filter. + #[serde(rename="compositeFilter")] + pub composite_filter: Option, + /// A filter on a property. + #[serde(rename="propertyFilter")] + pub property_filter: Option, } -impl Part for CompositeFilter {} +impl Part for Filter {} /// A reference to a property relative to the kind expressions. @@ -891,9 +908,9 @@ pub struct Value { /// any additional precision is rounded down. #[serde(rename="timestampValue")] pub timestamp_value: Option, - /// A null value. - #[serde(rename="nullValue")] - pub null_value: Option, + /// A geo point value representing a point on the surface of Earth. + #[serde(rename="geoPointValue")] + pub geo_point_value: Option, /// A blob value. /// May have at most 1,000,000 bytes. /// When `exclude_from_indexes` is false, may have at most 1500 bytes. @@ -929,57 +946,14 @@ pub struct Value { /// An integer value. #[serde(rename="integerValue")] pub integer_value: Option, - /// A geo point value representing a point on the surface of Earth. - #[serde(rename="geoPointValue")] - pub geo_point_value: Option, + /// A null value. + #[serde(rename="nullValue")] + pub null_value: Option, } impl Part for Value {} -/// A query for entities. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Query { - /// A starting point for the query results. Query cursors are - /// returned in query result batches and - /// [can only be used to continue the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets). - #[serde(rename="startCursor")] - pub start_cursor: Option, - /// The kinds to query (if empty, returns entities of all kinds). - /// Currently at most 1 kind may be specified. - pub kind: Option>, - /// The projection to return. Defaults to returning all properties. - pub projection: Option>, - /// The properties to make distinct. The query results will contain the first - /// result for each distinct combination of values for the given properties - /// (if empty, all results are returned). - #[serde(rename="distinctOn")] - pub distinct_on: Option>, - /// The filter to apply. - pub filter: Option, - /// The maximum number of results to return. Applies after all other - /// constraints. Optional. - /// Unspecified is interpreted as no limit. - /// Must be >= 0 if specified. - pub limit: Option, - /// The number of results to skip. Applies before limit, but after all other - /// constraints. Optional. Must be >= 0 if specified. - pub offset: Option, - /// An ending point for the query results. Query cursors are - /// returned in query result batches and - /// [can only be used to limit the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets). - #[serde(rename="endCursor")] - pub end_cursor: Option, - /// The order to apply to the query results (if empty, order is unspecified). - pub order: Option>, -} - -impl Part for Query {} - - /// The response for Datastore.Lookup. /// /// # Activities @@ -995,49 +969,46 @@ pub struct LookupResponse { /// field is undefined and has no relation to the order of the keys in the /// input. pub found: Option>, - /// Entities not found as `ResultType.KEY_ONLY` entities. The order of results - /// in this field is undefined and has no relation to the order of the keys - /// in the input. - pub missing: Option>, /// A list of keys that were not looked up due to resource constraints. The /// order of results in this field is undefined and has no relation to the /// order of the keys in the input. pub deferred: Option>, + /// Entities not found as `ResultType.KEY_ONLY` entities. The order of results + /// in this field is undefined and has no relation to the order of the keys + /// in the input. + pub missing: Option>, } impl ResponseResult for LookupResponse {} -/// The response for Datastore.ReserveIds. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [reserve ids projects](struct.ProjectReserveIdCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReserveIdsResponse { _never_set: Option } - -impl ResponseResult for ReserveIdsResponse {} - - -/// A holder for any type of filter. +/// A representation of a property in a projection. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Filter { - /// A composite filter. - #[serde(rename="compositeFilter")] - pub composite_filter: Option, - /// A filter on a property. - #[serde(rename="propertyFilter")] - pub property_filter: Option, +pub struct Projection { + /// The property to project. + pub property: Option, } -impl Part for Filter {} +impl Part for Projection {} + + +/// A filter that merges multiple other filters using the given operator. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompositeFilter { + /// The list of filters to combine. + /// Must contain at least one filter. + pub filters: Option>, + /// The operator for combining multiple filters. + pub op: Option, +} + +impl Part for CompositeFilter {} /// The request for Datastore.Commit. @@ -1076,33 +1047,33 @@ pub struct CommitRequest { impl RequestValue for CommitRequest {} -/// A representation of a property in a projection. +/// The response for Datastore.ReserveIds. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [reserve ids projects](struct.ProjectReserveIdCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReserveIdsResponse { _never_set: Option } + +impl ResponseResult for ReserveIdsResponse {} + + +/// Options specific to read / write transactions. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Projection { - /// The property to project. - pub property: Option, +pub struct ReadWrite { + /// The transaction identifier of the transaction being retried. + #[serde(rename="previousTransaction")] + pub previous_transaction: Option, } -impl Part for Projection {} - - -/// A binding parameter for a GQL query. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GqlQueryParameter { - /// A query cursor. Query cursors are returned in query - /// result batches. - pub cursor: Option, - /// A value parameter. - pub value: Option, -} - -impl Part for GqlQueryParameter {} +impl Part for ReadWrite {} /// An object representing a latitude/longitude pair. This is expressed as a pair @@ -1191,20 +1162,6 @@ pub struct RollbackRequest { impl RequestValue for RollbackRequest {} -/// Options specific to read / write transactions. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReadWrite { - /// The transaction identifier of the transaction being retried. - #[serde(rename="previousTransaction")] - pub previous_transaction: Option, -} - -impl Part for ReadWrite {} - - /// Options specific to read-only transactions. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1288,6 +1245,49 @@ pub struct PathElement { impl Part for PathElement {} +/// A query for entities. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Query { + /// A starting point for the query results. Query cursors are + /// returned in query result batches and + /// [can only be used to continue the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets). + #[serde(rename="startCursor")] + pub start_cursor: Option, + /// The kinds to query (if empty, returns entities of all kinds). + /// Currently at most 1 kind may be specified. + pub kind: Option>, + /// The projection to return. Defaults to returning all properties. + pub projection: Option>, + /// The properties to make distinct. The query results will contain the first + /// result for each distinct combination of values for the given properties + /// (if empty, all results are returned). + #[serde(rename="distinctOn")] + pub distinct_on: Option>, + /// The filter to apply. + pub filter: Option, + /// The maximum number of results to return. Applies after all other + /// constraints. Optional. + /// Unspecified is interpreted as no limit. + /// Must be >= 0 if specified. + pub limit: Option, + /// The number of results to skip. Applies before limit, but after all other + /// constraints. Optional. Must be >= 0 if specified. + pub offset: Option, + /// An ending point for the query results. Query cursors are + /// returned in query result batches and + /// [can only be used to limit the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets). + #[serde(rename="endCursor")] + pub end_cursor: Option, + /// The order to apply to the query results (if empty, order is unspecified). + pub order: Option>, +} + +impl Part for Query {} + + // ################### // MethodBuilders ### @@ -1582,10 +1582,7 @@ impl<'a, C, A> ProjectRunQueryCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1617,7 +1614,7 @@ impl<'a, C, A> ProjectRunQueryCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1707,7 +1704,7 @@ impl<'a, C, A> ProjectRunQueryCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1861,10 +1858,7 @@ impl<'a, C, A> ProjectReserveIdCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1896,7 +1890,7 @@ impl<'a, C, A> ProjectReserveIdCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1986,7 +1980,7 @@ impl<'a, C, A> ProjectReserveIdCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2139,10 +2133,7 @@ impl<'a, C, A> ProjectLookupCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2174,7 +2165,7 @@ impl<'a, C, A> ProjectLookupCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2264,7 +2255,7 @@ impl<'a, C, A> ProjectLookupCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2418,10 +2409,7 @@ impl<'a, C, A> ProjectCommitCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2453,7 +2441,7 @@ impl<'a, C, A> ProjectCommitCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2543,7 +2531,7 @@ impl<'a, C, A> ProjectCommitCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2697,10 +2685,7 @@ impl<'a, C, A> ProjectAllocateIdCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2732,7 +2717,7 @@ impl<'a, C, A> ProjectAllocateIdCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2822,7 +2807,7 @@ impl<'a, C, A> ProjectAllocateIdCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2975,10 +2960,7 @@ impl<'a, C, A> ProjectRollbackCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3010,7 +2992,7 @@ impl<'a, C, A> ProjectRollbackCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3100,7 +3082,7 @@ impl<'a, C, A> ProjectRollbackCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3253,10 +3235,7 @@ impl<'a, C, A> ProjectBeginTransactionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3288,7 +3267,7 @@ impl<'a, C, A> ProjectBeginTransactionCall<'a, C, A> where C: BorrowMut ProjectBeginTransactionCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Deployment Manager (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-deploymentmanager2] path = "../deploymentmanager2" -version = "1.0.8+20180609" +version = "1.0.8+20181207" diff --git a/gen/deploymentmanager2-cli/README.md b/gen/deploymentmanager2-cli/README.md index 6a1f00b805..e05d0b8e5e 100644 --- a/gen/deploymentmanager2-cli/README.md +++ b/gen/deploymentmanager2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Deployment Manager* API at revision *20180609*. The CLI is at version *1.0.8*. +This documentation was generated from the *Deployment Manager* API at revision *20181207*. The CLI is at version *1.0.8*. ```bash deploymentmanager2 [options] diff --git a/gen/deploymentmanager2-cli/mkdocs.yml b/gen/deploymentmanager2-cli/mkdocs.yml index 1d022c2cd1..1a71674cb9 100644 --- a/gen/deploymentmanager2-cli/mkdocs.yml +++ b/gen/deploymentmanager2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Deployment Manager v1.0.8+20180609 +site_name: Deployment Manager v1.0.8+20181207 site_url: http://byron.github.io/google-apis-rs/google-deploymentmanager2-cli site_description: A complete library to interact with Deployment Manager (protocol v2) diff --git a/gen/deploymentmanager2-cli/src/main.rs b/gen/deploymentmanager2-cli/src/main.rs index 056536640f..28a80286f2 100644 --- a/gen/deploymentmanager2-cli/src/main.rs +++ b/gen/deploymentmanager2-cli/src/main.rs @@ -314,6 +314,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.description" => Some(("update.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.manifest" => Some(("update.manifest", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -346,7 +347,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["client-operation-id", "config", "content", "creation-timestamp", "description", "end-time", "fingerprint", "http-error-message", "http-error-status-code", "id", "insert-time", "kind", "manifest", "name", "operation", "operation-type", "progress", "region", "self-link", "start-time", "status", "status-message", "target", "target-id", "target-link", "update", "user", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["client-operation-id", "config", "content", "creation-timestamp", "description", "end-time", "fingerprint", "http-error-message", "http-error-status-code", "id", "insert-time", "kind", "manifest", "name", "operation", "operation-type", "progress", "region", "self-link", "start-time", "status", "status-message", "target", "target-id", "target-link", "update", "update-time", "user", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -501,6 +502,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.description" => Some(("update.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.manifest" => Some(("update.manifest", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -533,7 +535,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["client-operation-id", "config", "content", "creation-timestamp", "description", "end-time", "fingerprint", "http-error-message", "http-error-status-code", "id", "insert-time", "kind", "manifest", "name", "operation", "operation-type", "progress", "region", "self-link", "start-time", "status", "status-message", "target", "target-id", "target-link", "update", "user", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["client-operation-id", "config", "content", "creation-timestamp", "description", "end-time", "fingerprint", "http-error-message", "http-error-status-code", "id", "insert-time", "kind", "manifest", "name", "operation", "operation-type", "progress", "region", "self-link", "start-time", "status", "status-message", "target", "target-id", "target-link", "update", "update-time", "user", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -884,6 +886,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.description" => Some(("update.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.manifest" => Some(("update.manifest", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -916,7 +919,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["client-operation-id", "config", "content", "creation-timestamp", "description", "end-time", "fingerprint", "http-error-message", "http-error-status-code", "id", "insert-time", "kind", "manifest", "name", "operation", "operation-type", "progress", "region", "self-link", "start-time", "status", "status-message", "target", "target-id", "target-link", "update", "user", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["client-operation-id", "config", "content", "creation-timestamp", "description", "end-time", "fingerprint", "http-error-message", "http-error-status-code", "id", "insert-time", "kind", "manifest", "name", "operation", "operation-type", "progress", "region", "self-link", "start-time", "status", "status-message", "target", "target-id", "target-link", "update", "update-time", "user", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1686,7 +1689,7 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -1798,7 +1801,7 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -1866,7 +1869,7 @@ fn main() { (Some(r##"resource"##), None, - Some(r##"Name of the resource for this request."##), + Some(r##"Name or id of the resource for this request."##), Some(true), Some(false)), @@ -2136,7 +2139,7 @@ fn main() { let mut app = App::new("deploymentmanager2") .author("Sebastian Thiel ") - .version("1.0.8+20180609") + .version("1.0.8+20181207") .about("Declares, configures, and deploys complex solutions on Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli") .arg(Arg::with_name("url") diff --git a/gen/deploymentmanager2/Cargo.toml b/gen/deploymentmanager2/Cargo.toml index 712c890b5b..7041f1fefe 100644 --- a/gen/deploymentmanager2/Cargo.toml +++ b/gen/deploymentmanager2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-deploymentmanager2" -version = "1.0.8+20180609" +version = "1.0.8+20181207" authors = ["Sebastian Thiel "] description = "A complete library to interact with Deployment Manager (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2" homepage = "https://cloud.google.com/deployment-manager/" -documentation = "https://docs.rs/google-deploymentmanager2/1.0.8+20180609" +documentation = "https://docs.rs/google-deploymentmanager2/1.0.8+20181207" license = "MIT" keywords = ["deploymentmanager", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/deploymentmanager2/README.md b/gen/deploymentmanager2/README.md index 4298233df9..b31b84daa6 100644 --- a/gen/deploymentmanager2/README.md +++ b/gen/deploymentmanager2/README.md @@ -5,24 +5,24 @@ DO NOT EDIT ! --> The `google-deploymentmanager2` library allows access to all features of the *Google Deployment Manager* service. -This documentation was generated from *Deployment Manager* crate version *1.0.8+20180609*, where *20180609* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Deployment Manager* crate version *1.0.8+20181207*, where *20181207* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Deployment Manager* *v2* API can be found at the [official documentation site](https://cloud.google.com/deployment-manager/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentManager.html) ... -* [deployments](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.Deployment.html) - * [*cancel preview*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentCancelPreviewCall.html), [*delete*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentDeleteCall.html), [*get*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentGetCall.html), [*get iam policy*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentGetIamPolicyCall.html), [*insert*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentInsertCall.html), [*list*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentListCall.html), [*patch*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentPatchCall.html), [*set iam policy*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentSetIamPolicyCall.html), [*stop*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentStopCall.html), [*test iam permissions*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentTestIamPermissionCall.html) and [*update*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentUpdateCall.html) -* [manifests](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.Manifest.html) - * [*get*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.ManifestGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.ManifestListCall.html) -* [operations](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.Operation.html) - * [*get*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.OperationListCall.html) -* [resources](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.ResourceType.html) - * [*get*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.ResourceGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.ResourceListCall.html) -* [types](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.Type.html) - * [*list*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.TypeListCall.html) +* [deployments](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.Deployment.html) + * [*cancel preview*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentCancelPreviewCall.html), [*delete*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentDeleteCall.html), [*get*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentGetCall.html), [*get iam policy*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentGetIamPolicyCall.html), [*insert*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentInsertCall.html), [*list*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentListCall.html), [*patch*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentPatchCall.html), [*set iam policy*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentSetIamPolicyCall.html), [*stop*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentStopCall.html), [*test iam permissions*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentTestIamPermissionCall.html) and [*update*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentUpdateCall.html) +* [manifests](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.Manifest.html) + * [*get*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.ManifestGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.ManifestListCall.html) +* [operations](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.Operation.html) + * [*get*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.OperationListCall.html) +* [resources](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.ResourceType.html) + * [*get*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.ResourceGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.ResourceListCall.html) +* [types](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.Type.html) + * [*list*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.TypeListCall.html) @@ -31,17 +31,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/struct.DeploymentManager.html)** +* **[Hub](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/struct.DeploymentManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.Part.html)** + * **[Parts](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -151,17 +151,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -171,29 +171,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-deploymentmanager2/1.0.8+20180609/google_deploymentmanager2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-deploymentmanager2/1.0.8+20181207/google_deploymentmanager2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/deploymentmanager2/src/lib.rs b/gen/deploymentmanager2/src/lib.rs index ca2a62acdb..b5576b0754 100644 --- a/gen/deploymentmanager2/src/lib.rs +++ b/gen/deploymentmanager2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Deployment Manager* crate version *1.0.8+20180609*, where *20180609* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Deployment Manager* crate version *1.0.8+20181207*, where *20181207* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Deployment Manager* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/deployment-manager/). @@ -675,12 +675,12 @@ impl ResponseResult for OperationsListResponse {} pub struct Type { /// Output only. The Operation that most recently ran, or is currently running, on this type. pub operation: Option, - /// Output only. Timestamp when the type was created, in RFC3339 text format. + /// Output only. Creation timestamp in RFC3339 text format. #[serde(rename="insertTime")] pub insert_time: Option, - /// Output only. Unique identifier for the resource; defined by the server. + /// no description provided pub id: Option, - /// Output only. Self link for the type. + /// Output only. Server defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, /// Name of the type. @@ -760,6 +760,8 @@ impl Part for DeploymentLabelEntry {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LogConfigDataAccessOptions { /// Whether Gin logging should happen in a fail-closed manner at the caller. This is relevant only in the LocalIAM implementation, for now. + /// + /// NOTE: Logging to Gin in a fail-closed manner is currently unsupported while work is being done to satisfy the requirements of go/345. Currently, setting LOG_FAIL_CLOSED mode will have no effect, but still exists because there is active work being done to support it (b/115874152). #[serde(rename="logMode")] pub log_mode: Option, } @@ -780,7 +782,7 @@ impl Part for LogConfigDataAccessOptions {} pub struct GlobalSetPolicyRequest { /// REQUIRED: The complete policy to be applied to the 'resource'. The size of the policy is limited to a few 10s of KB. An empty policy is in general a valid policy but certain services (like Projects) might reject them. pub policy: Option, - /// Flatten Policy to create a backwacd compatible wire-format. Deprecated. Use 'policy' to specify bindings. + /// Flatten Policy to create a backward compatible wire-format. Deprecated. Use 'policy' to specify bindings. pub bindings: Option>, /// Flatten Policy to create a backward compatible wire-format. Deprecated. Use 'policy' to specify the etag. pub etag: Option, @@ -845,6 +847,9 @@ impl ResponseResult for DeploymentsListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Deployment { + /// Output only. Update timestamp in RFC3339 text format. + #[serde(rename="updateTime")] + pub update_time: Option, /// An optional user-provided description of the deployment. pub description: Option, /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. @@ -855,7 +860,7 @@ pub struct Deployment { pub update: Option, /// Output only. URL of the manifest representing the last manifest that was successfully deployed. pub manifest: Option, - /// Output only. Timestamp when the deployment was created, in RFC3339 text format . + /// Output only. Creation timestamp in RFC3339 text format. #[serde(rename="insertTime")] pub insert_time: Option, /// Provides a fingerprint to use in requests to modify a deployment, such as update(), stop(), and cancelPreview() requests. A fingerprint is a randomly generated value that must be provided with update(), stop(), and cancelPreview() requests to perform optimistic locking. This ensures optimistic concurrency so that only one request happens at a time. @@ -864,9 +869,9 @@ pub struct Deployment { pub fingerprint: Option, /// Output only. The Operation that most recently ran, or is currently running, on this deployment. pub operation: Option, - /// Output only. Unique identifier for the resource; defined by the server. + /// no description provided pub id: Option, - /// Output only. Self link for the deployment. + /// Output only. Server defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, /// [Input Only] The parameters that define your deployment, including the deployment configuration and relevant templates. @@ -955,7 +960,7 @@ pub struct ResourceType { /// Output only. The evaluated properties of the resource with references expanded. Returned as serialized YAML. #[serde(rename="finalProperties")] pub final_properties: Option, - /// Output only. Timestamp when the resource was updated, in RFC3339 text format . + /// Output only. Update timestamp in RFC3339 text format. #[serde(rename="updateTime")] pub update_time: Option, /// Output only. The name of the resource as it appears in the YAML config. @@ -968,10 +973,10 @@ pub struct ResourceType { pub update: Option, /// Output only. URL of the manifest representing the current configuration of this resource. pub manifest: Option, - /// Output only. Timestamp when the resource was created or acquired, in RFC3339 text format . + /// Output only. Creation timestamp in RFC3339 text format. #[serde(rename="insertTime")] pub insert_time: Option, - /// Output only. Unique identifier for the resource; defined by the server. + /// no description provided pub id: Option, /// Output only. The type of the resource, for example compute.v1.instance, or cloudfunctions.v1beta1.function. #[serde(rename="type")] @@ -1078,12 +1083,12 @@ pub struct Manifest { pub expanded_config: Option, /// Output only. The imported files for this manifest. pub imports: Option>, - /// Output only. Timestamp when the manifest was created, in RFC3339 text format. + /// Output only. Creation timestamp in RFC3339 text format. #[serde(rename="insertTime")] pub insert_time: Option, /// Output only. The YAML configuration for this manifest. pub config: Option, - /// Output only. Unique identifier for the resource; defined by the server. + /// no description provided pub id: Option, /// Output only. Self link for the manifest. #[serde(rename="selfLink")] @@ -1331,7 +1336,7 @@ impl Part for ResourceUpdateWarnings {} pub struct Binding { /// Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, - /// The condition that is associated with this binding. NOTE: an unsatisfied condition will not allow user access via current binding. Different bindings, including their conditions, are examined independently. This field is only visible as GOOGLE_INTERNAL or CONDITION_TRUSTED_TESTER. + /// Unimplemented. The condition that is associated with this binding. NOTE: an unsatisfied condition will not allow user access via current binding. Different bindings, including their conditions, are examined independently. pub condition: Option, /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: /// @@ -1362,11 +1367,11 @@ impl Part for Binding {} /// /// Field names correspond to IAM request parameters and field values are their respective values. /// -/// At present the only supported field names are - "iam_principal", corresponding to IAMContext.principal; - "" (empty string), resulting in one aggretated counter with no field. +/// Supported field names: - "authority", which is "[token]" if IAMContext.token is present, otherwise the value of IAMContext.authority_selector if present, and otherwise a representation of IAMContext.principal; or - "iam_principal", a representation of IAMContext.principal even if a token or authority selector is present; or - "" (empty string), resulting in a counter with no fields. /// /// Examples: counter { metric: "/debug_access_count" field: "iam_principal" } ==> increment counter /iam/policy/backend_debug_access_count {iam_principal=[value of IAMContext.principal]} /// -/// At this time we do not support: * multiple field names (though this may be supported in the future) * decrementing the counter * incrementing it by anything other than 1 +/// At this time we do not support multiple field names (though this may be supported in the future). /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -1901,7 +1906,7 @@ impl<'a, C, A> DeploymentMethods<'a, C, A> { /// /// * `request` - No description provided. /// * `project` - Project ID for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn test_iam_permissions(&self, request: TestPermissionsRequest, project: &str, resource: &str) -> DeploymentTestIamPermissionCall<'a, C, A> { DeploymentTestIamPermissionCall { hub: self.hub, @@ -1921,7 +1926,7 @@ impl<'a, C, A> DeploymentMethods<'a, C, A> { /// # Arguments /// /// * `project` - Project ID for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn get_iam_policy(&self, project: &str, resource: &str) -> DeploymentGetIamPolicyCall<'a, C, A> { DeploymentGetIamPolicyCall { hub: self.hub, @@ -2028,7 +2033,7 @@ impl<'a, C, A> DeploymentMethods<'a, C, A> { /// /// * `request` - No description provided. /// * `project` - Project ID for this request. - /// * `resource` - Name of the resource for this request. + /// * `resource` - Name or id of the resource for this request. pub fn set_iam_policy(&self, request: GlobalSetPolicyRequest, project: &str, resource: &str) -> DeploymentSetIamPolicyCall<'a, C, A> { DeploymentSetIamPolicyCall { hub: self.hub, @@ -2170,10 +2175,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2193,7 +2195,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2281,7 +2283,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2443,10 +2445,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2466,7 +2465,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2582,7 +2581,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2746,10 +2745,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2769,7 +2765,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2895,7 +2891,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3041,10 +3037,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3064,7 +3057,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3162,7 +3155,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3324,10 +3317,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3347,7 +3337,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3463,7 +3453,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3609,10 +3599,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3632,7 +3619,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3730,7 +3717,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3894,10 +3881,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3917,7 +3901,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4043,7 +4027,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4209,10 +4193,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4244,7 +4225,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4365,7 +4346,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4509,10 +4490,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4532,7 +4510,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4620,7 +4598,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4779,10 +4757,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4814,7 +4789,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4918,7 +4893,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5069,10 +5044,7 @@ impl<'a, C, A> DeploymentTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5104,7 +5076,7 @@ impl<'a, C, A> DeploymentTestIamPermissionCall<'a, C, A> where C: BorrowMut DeploymentTestIamPermissionCall<'a, C, A> where C: BorrowMut DeploymentTestIamPermissionCall<'a, C, A> where C: BorrowMut DeploymentGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5371,7 +5340,7 @@ impl<'a, C, A> DeploymentGetIamPolicyCall<'a, C, A> where C: BorrowMut DeploymentGetIamPolicyCall<'a, C, A> where C: BorrowMut DeploymentGetIamPolicyCall<'a, C, A> where C: BorrowMut DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5645,7 +5611,7 @@ impl<'a, C, A> DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut DeploymentListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5930,7 +5893,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6046,7 +6009,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6212,10 +6175,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6247,7 +6207,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6368,7 +6328,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6519,10 +6479,7 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6554,7 +6511,7 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6654,7 +6611,7 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6805,10 +6762,7 @@ impl<'a, C, A> DeploymentSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6840,7 +6794,7 @@ impl<'a, C, A> DeploymentSetIamPolicyCall<'a, C, A> where C: BorrowMut DeploymentSetIamPolicyCall<'a, C, A> where C: BorrowMut DeploymentSetIamPolicyCall<'a, C, A> where C: BorrowMut DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7112,7 +7063,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7207,7 +7158,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/deploymentmanager2_beta2/Cargo.toml b/gen/deploymentmanager2_beta2/Cargo.toml index bdc75d72e5..1219808b9a 100644 --- a/gen/deploymentmanager2_beta2/Cargo.toml +++ b/gen/deploymentmanager2_beta2/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/deploymentmanager2_beta2/src/lib.rs b/gen/deploymentmanager2_beta2/src/lib.rs index 5916847d25..03401f1b51 100644 --- a/gen/deploymentmanager2_beta2/src/lib.rs +++ b/gen/deploymentmanager2_beta2/src/lib.rs @@ -1484,10 +1484,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1507,7 +1504,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1595,7 +1592,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1752,10 +1749,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1775,7 +1769,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1882,7 +1876,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2041,10 +2035,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2064,7 +2055,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2181,7 +2172,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2327,10 +2318,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2350,7 +2338,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2448,7 +2436,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2594,10 +2582,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2617,7 +2602,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2715,7 +2700,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2874,10 +2859,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2897,7 +2879,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3014,7 +2996,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3171,10 +3153,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3194,7 +3173,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3301,7 +3280,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3467,10 +3446,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3502,7 +3478,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3623,7 +3599,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3767,10 +3743,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3790,7 +3763,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3878,7 +3851,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4027,10 +4000,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4062,7 +4032,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4152,7 +4122,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4309,10 +4279,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4332,7 +4299,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4439,7 +4406,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4605,10 +4572,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4640,7 +4604,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4761,7 +4725,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4905,10 +4869,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4928,7 +4889,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5016,7 +4977,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/dfareporting2d8/Cargo.toml b/gen/dfareporting2d8/Cargo.toml index fd34fadac7..2c8d11a91e 100644 --- a/gen/dfareporting2d8/Cargo.toml +++ b/gen/dfareporting2d8/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/dfareporting2d8/src/lib.rs b/gen/dfareporting2d8/src/lib.rs index 43b051ba1c..63626cc1f6 100644 --- a/gen/dfareporting2d8/src/lib.rs +++ b/gen/dfareporting2d8/src/lib.rs @@ -14522,10 +14522,7 @@ impl<'a, C, A> ConversionBatchupdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14557,7 +14554,7 @@ impl<'a, C, A> ConversionBatchupdateCall<'a, C, A> where C: BorrowMut ConversionBatchupdateCall<'a, C, A> where C: BorrowMut ConversionBatchinsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14831,7 +14825,7 @@ impl<'a, C, A> ConversionBatchinsertCall<'a, C, A> where C: BorrowMut ConversionBatchinsertCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15088,7 +15079,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15341,7 +15329,7 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut PlatformTypeGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15586,7 +15571,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15674,7 +15659,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15816,10 +15801,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15839,7 +15821,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15917,7 +15899,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16063,10 +16045,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16086,7 +16065,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16184,7 +16163,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16379,10 +16358,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16402,7 +16378,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16556,7 +16532,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16705,10 +16681,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16740,7 +16713,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17034,7 +17004,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17163,7 +17133,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17306,10 +17276,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17329,7 +17296,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17574,7 +17538,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17662,7 +17626,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17811,10 +17775,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17846,7 +17807,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18122,7 +18080,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut UserRoleInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18406,7 +18361,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18496,7 +18451,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18640,10 +18595,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18663,7 +18615,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18751,7 +18703,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18900,10 +18852,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18935,7 +18884,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -19025,7 +18974,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19168,10 +19117,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19191,7 +19137,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19269,7 +19215,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19420,10 +19366,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19455,7 +19398,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -19555,7 +19498,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19739,10 +19682,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19762,7 +19702,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19897,7 +19837,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20041,10 +19981,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20064,7 +20001,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20317,7 +20251,7 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut LandingPageGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20564,7 +20495,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20662,7 +20593,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20813,10 +20744,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20848,7 +20776,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20948,7 +20876,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21092,10 +21020,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21115,7 +21040,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21203,7 +21128,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21354,10 +21279,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21389,7 +21311,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21489,7 +21411,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21642,10 +21564,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21677,7 +21596,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21787,7 +21706,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21932,10 +21851,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21955,7 +21871,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22043,7 +21959,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22204,10 +22120,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22268,7 +22181,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -22443,7 +22356,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22629,7 +22539,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -22729,7 +22639,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22888,10 +22798,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22911,7 +22818,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23020,7 +22927,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23218,10 +23125,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23241,7 +23145,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23392,7 +23296,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23536,10 +23440,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23559,7 +23460,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23647,7 +23548,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23791,10 +23692,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23814,7 +23712,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24088,7 +23983,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24372,7 +24264,7 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut ReportRunCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24634,7 +24523,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24729,7 +24618,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24880,10 +24769,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24915,7 +24801,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25015,7 +24901,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25179,10 +25065,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25202,7 +25085,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -25318,7 +25201,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25467,10 +25350,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25502,7 +25382,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25592,7 +25472,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25741,10 +25621,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25776,7 +25653,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26033,7 +25907,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26121,7 +25995,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26288,10 +26162,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26311,7 +26182,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26409,7 +26280,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26552,10 +26423,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26575,7 +26443,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26653,7 +26521,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26804,10 +26672,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -26839,7 +26704,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -26939,7 +26804,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27106,10 +26971,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -27129,7 +26991,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -27242,7 +27104,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27391,10 +27253,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27426,7 +27285,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -27516,7 +27375,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27667,10 +27526,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27702,7 +27558,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -27802,7 +27658,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28010,10 +27866,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28033,7 +27886,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -28198,7 +28051,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28347,10 +28200,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28382,7 +28232,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -28472,7 +28322,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28616,10 +28466,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28639,7 +28486,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -28727,7 +28574,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28886,10 +28733,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28921,7 +28765,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29192,7 +29033,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29466,7 +29304,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29778,7 +29613,7 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30104,7 +29936,7 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30378,7 +30207,7 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut MetroListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -30633,7 +30459,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -30711,7 +30537,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -30894,10 +30720,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -30917,7 +30740,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31056,7 +30879,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31202,10 +31025,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31225,7 +31045,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31323,7 +31143,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31465,10 +31285,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31488,7 +31305,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31566,7 +31383,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31710,10 +31527,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31733,7 +31547,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32025,7 +31836,7 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut UserProfileListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32296,7 +32104,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -32364,7 +32172,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32506,10 +32314,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32529,7 +32334,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -32607,7 +32412,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32758,10 +32563,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32793,7 +32595,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -32893,7 +32695,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33042,10 +32844,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -33077,7 +32876,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -33167,7 +32966,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33444,10 +33243,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33467,7 +33263,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -33716,7 +33512,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33860,10 +33656,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33883,7 +33676,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -33971,7 +33764,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34120,10 +33913,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34155,7 +33945,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -34245,7 +34035,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34389,10 +34179,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34412,7 +34199,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34665,7 +34449,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34908,7 +34689,7 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35153,7 +34931,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -35241,7 +35019,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -35415,10 +35193,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35438,7 +35213,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35735,7 +35507,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35990,7 +35759,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -36275,7 +36041,7 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -36580,7 +36343,7 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -36854,7 +36614,7 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -37130,7 +36887,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -37396,7 +37150,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -37658,7 +37409,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -37748,7 +37499,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -37892,10 +37643,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -37915,7 +37663,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -38003,7 +37751,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38226,10 +37974,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -38249,7 +37994,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -38435,7 +38180,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38584,10 +38329,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -38619,7 +38361,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -38709,7 +38451,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38860,10 +38602,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -38895,7 +38634,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -38995,7 +38734,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -39139,10 +38878,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -39162,7 +38898,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -39484,7 +39217,7 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -39839,7 +39569,7 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -40095,7 +39822,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -40359,7 +40083,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -40629,7 +40350,7 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -40898,7 +40616,7 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut RegionListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -41153,7 +40868,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -41231,7 +40946,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -41380,10 +41095,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -41415,7 +41127,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -41672,7 +41381,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -41760,7 +41469,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -41909,10 +41618,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -41944,7 +41650,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -42243,7 +41946,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -42379,7 +42082,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -42530,10 +42233,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -42565,7 +42265,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> where C: BorrowMut TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -42851,7 +42548,7 @@ impl<'a, C, A> TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut TargetingTemplateListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -43153,7 +42847,7 @@ impl<'a, C, A> TargetingTemplateListCall<'a, C, A> where C: BorrowMut TargetingTemplateListCall<'a, C, A> where C: BorrowMut TargetingTemplateGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -43448,7 +43139,7 @@ impl<'a, C, A> TargetingTemplateGetCall<'a, C, A> where C: BorrowMut TargetingTemplateGetCall<'a, C, A> where C: BorrowMut TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -43720,7 +43408,7 @@ impl<'a, C, A> TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -43994,7 +43679,7 @@ impl<'a, C, A> TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut SubaccountPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44270,7 +43952,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -44370,7 +44052,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -44519,10 +44201,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44554,7 +44233,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -44644,7 +44323,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -44793,10 +44472,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44828,7 +44504,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -44918,7 +44594,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45092,10 +44768,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45115,7 +44788,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45236,7 +44909,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45380,10 +45053,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45403,7 +45073,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45491,7 +45161,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45635,10 +45305,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45658,7 +45325,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45746,7 +45413,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45888,10 +45555,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45911,7 +45575,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45989,7 +45653,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -46133,10 +45797,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -46156,7 +45817,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -46428,7 +46086,7 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -46704,7 +46359,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -46976,7 +46628,7 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47227,7 +46876,7 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47472,7 +47118,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut FileListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47750,7 +47393,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -47863,7 +47506,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -48028,10 +47671,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -48051,7 +47691,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -48139,7 +47779,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -48392,10 +48032,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -48415,7 +48052,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -48818,7 +48452,7 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -49092,7 +48723,7 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -49349,7 +48977,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -49437,7 +49065,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -49588,10 +49216,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -49623,7 +49248,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> where C: BorrowMut InventoryItemListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -49941,7 +49563,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -50095,7 +49717,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -50241,10 +49863,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50264,7 +49883,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -50362,7 +49981,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -50506,10 +50125,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50529,7 +50145,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50789,7 +50402,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -51040,7 +50650,7 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -51285,7 +50892,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -51570,7 +51174,7 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -51875,7 +51476,7 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -52149,7 +51747,7 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -52405,7 +52000,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -52650,7 +52242,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -52924,7 +52513,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut CreativeUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -53208,7 +52794,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -53298,7 +52884,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -53447,10 +53033,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -53482,7 +53065,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -53572,7 +53155,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -53716,10 +53299,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -53739,7 +53319,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -53827,7 +53407,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54061,10 +53641,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -54084,7 +53661,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -54280,7 +53857,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54431,10 +54008,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -54466,7 +54040,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -54566,7 +54140,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54710,10 +54284,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -54733,7 +54304,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -54821,7 +54392,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54974,10 +54545,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -55009,7 +54577,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -55119,7 +54687,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55270,10 +54838,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -55305,7 +54870,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -55405,7 +54970,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55554,10 +55119,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -55589,7 +55151,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -55679,7 +55241,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55894,10 +55456,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -55917,7 +55476,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -56090,7 +55649,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56233,10 +55792,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -56256,7 +55812,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -56334,7 +55890,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56530,10 +56086,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -56553,7 +56106,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -56703,7 +56256,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56852,10 +56405,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -56887,7 +56437,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -56977,7 +56527,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57128,10 +56678,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -57163,7 +56710,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -57263,7 +56810,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57412,10 +56959,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -57447,7 +56991,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -57537,7 +57081,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57681,10 +57225,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -57704,7 +57245,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -57792,7 +57333,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57936,10 +57477,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -57959,7 +57497,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -58231,7 +57766,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -58523,7 +58055,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -58846,7 +58375,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -59130,7 +58656,7 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut CityListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -59411,7 +58934,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -59520,7 +59043,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -59669,10 +59192,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -59704,7 +59224,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -59961,7 +59478,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -60246,7 +59760,7 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -60533,7 +60044,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -60795,7 +60303,7 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -61071,7 +60576,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut ProjectListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -61375,7 +60877,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -61504,7 +61006,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -61648,10 +61150,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -61671,7 +61170,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -61759,7 +61258,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -61908,10 +61407,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -61943,7 +61439,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -62265,7 +61758,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62435,7 +61928,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -62579,10 +62072,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -62602,7 +62092,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62690,7 +62180,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -62834,10 +62324,7 @@ impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -62857,7 +62344,7 @@ impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62945,7 +62432,7 @@ impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -63087,10 +62574,7 @@ impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63110,7 +62594,7 @@ impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -63188,7 +62672,7 @@ impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -63335,10 +62819,7 @@ impl<'a, C, A> DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63358,7 +62839,7 @@ impl<'a, C, A> DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63643,7 +63121,7 @@ impl<'a, C, A> DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -63934,7 +63409,7 @@ impl<'a, C, A> DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -64208,7 +63680,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -64298,7 +63770,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -64462,10 +63934,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -64485,7 +63954,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -64592,7 +64061,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -64736,10 +64205,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -64759,7 +64225,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -64847,7 +64313,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -64991,10 +64457,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -65014,7 +64477,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -65286,7 +64746,7 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -65588,7 +65045,7 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -65914,7 +65368,7 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -66190,7 +65641,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -66457,7 +65905,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut CountryListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -66710,7 +66155,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -66788,7 +66233,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -66932,10 +66377,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -66955,7 +66397,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -67043,7 +66485,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -67196,10 +66638,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -67231,7 +66670,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -67510,7 +66946,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -67776,7 +67209,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -68050,7 +67480,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -68336,7 +67763,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68635,7 +68059,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68933,7 +68354,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69021,7 +68442,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69163,10 +68584,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69186,7 +68604,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69264,7 +68682,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69406,10 +68824,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69429,7 +68844,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69507,7 +68922,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69651,10 +69066,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69674,7 +69086,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69762,7 +69174,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69941,10 +69353,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69964,7 +69373,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -70092,7 +69501,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -70241,10 +69650,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -70276,7 +69682,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -70366,7 +69772,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -70517,10 +69923,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -70552,7 +69955,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -70652,7 +70055,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -70803,10 +70206,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -70838,7 +70238,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -70938,7 +70338,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -71212,10 +70612,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -71235,7 +70632,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -71478,7 +70875,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -71622,10 +71019,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -71645,7 +71039,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -71733,7 +71127,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -71882,10 +71276,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -71917,7 +71308,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -72007,7 +71398,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -72156,10 +71547,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -72191,7 +71579,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -72281,7 +71669,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -72442,10 +71830,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -72465,7 +71850,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut PlacementGeneratetagCall<'a, C, A> where C: BorrowMut ConversionBatchupdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14570,7 +14567,7 @@ impl<'a, C, A> ConversionBatchupdateCall<'a, C, A> where C: BorrowMut ConversionBatchupdateCall<'a, C, A> where C: BorrowMut ConversionBatchinsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14844,7 +14838,7 @@ impl<'a, C, A> ConversionBatchinsertCall<'a, C, A> where C: BorrowMut ConversionBatchinsertCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15101,7 +15092,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15354,7 +15342,7 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15646,7 +15631,7 @@ impl<'a, C, A> AdvertiserLandingPageListCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageListCall<'a, C, A> where C: BorrowMut AdvertiserLandingPagePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15975,7 +15957,7 @@ impl<'a, C, A> AdvertiserLandingPagePatchCall<'a, C, A> where C: BorrowMut AdvertiserLandingPagePatchCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16259,7 +16238,7 @@ impl<'a, C, A> AdvertiserLandingPageUpdateCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageUpdateCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16533,7 +16509,7 @@ impl<'a, C, A> AdvertiserLandingPageInsertCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageInsertCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16790,7 +16763,7 @@ impl<'a, C, A> AdvertiserLandingPageGetCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageGetCall<'a, C, A> where C: BorrowMut PlatformTypeGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17045,7 +17015,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17133,7 +17103,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17275,10 +17245,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17298,7 +17265,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17376,7 +17343,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17522,10 +17489,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17545,7 +17509,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17643,7 +17607,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17838,10 +17802,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17861,7 +17822,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18015,7 +17976,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18164,10 +18125,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18199,7 +18157,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18493,7 +18448,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18622,7 +18577,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18765,10 +18720,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18788,7 +18740,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19033,7 +18982,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19121,7 +19070,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19270,10 +19219,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19305,7 +19251,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19581,7 +19524,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut UserRoleInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19865,7 +19805,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -19955,7 +19895,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20099,10 +20039,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20122,7 +20059,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20210,7 +20147,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20359,10 +20296,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20394,7 +20328,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20484,7 +20418,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20627,10 +20561,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20650,7 +20581,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20728,7 +20659,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20879,10 +20810,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20914,7 +20842,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21014,7 +20942,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21198,10 +21126,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21221,7 +21146,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21356,7 +21281,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21500,10 +21425,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21523,7 +21445,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21776,7 +21695,7 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22079,7 +21995,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -22254,7 +22170,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22440,7 +22353,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -22540,7 +22453,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22699,10 +22612,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22722,7 +22632,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22831,7 +22741,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23029,10 +22939,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23052,7 +22959,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23203,7 +23110,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23347,10 +23254,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23370,7 +23274,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23458,7 +23362,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23602,10 +23506,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23625,7 +23526,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -23899,7 +23797,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24183,7 +24078,7 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut ReportRunCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24445,7 +24337,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24540,7 +24432,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24691,10 +24583,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24726,7 +24615,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -24826,7 +24715,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24990,10 +24879,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25013,7 +24899,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -25129,7 +25015,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25278,10 +25164,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25313,7 +25196,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25403,7 +25286,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25554,10 +25437,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25589,7 +25469,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25689,7 +25569,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25838,10 +25718,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25873,7 +25750,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26130,7 +26004,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26218,7 +26092,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26385,10 +26259,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26408,7 +26279,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26506,7 +26377,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26649,10 +26520,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26672,7 +26540,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26750,7 +26618,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26917,10 +26785,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26940,7 +26805,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -27053,7 +26918,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27202,10 +27067,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27237,7 +27099,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -27327,7 +27189,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27478,10 +27340,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27513,7 +27372,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -27613,7 +27472,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27821,10 +27680,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -27844,7 +27700,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -28009,7 +27865,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28158,10 +28014,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28193,7 +28046,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -28283,7 +28136,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28427,10 +28280,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28450,7 +28300,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -28538,7 +28388,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28697,10 +28547,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28732,7 +28579,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29022,7 +28866,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29334,7 +29175,7 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29643,7 +29481,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29915,7 +29750,7 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30189,7 +30021,7 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut MetroListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -30444,7 +30273,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -30522,7 +30351,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -30705,10 +30534,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -30728,7 +30554,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -30867,7 +30693,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31013,10 +30839,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31036,7 +30859,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31134,7 +30957,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31276,10 +31099,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31299,7 +31119,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31377,7 +31197,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31521,10 +31341,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31544,7 +31361,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31836,7 +31650,7 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut UserProfileListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32107,7 +31918,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -32175,7 +31986,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32317,10 +32128,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32340,7 +32148,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -32418,7 +32226,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32569,10 +32377,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32604,7 +32409,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -32704,7 +32509,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32853,10 +32658,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32888,7 +32690,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -32978,7 +32780,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33255,10 +33057,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33278,7 +33077,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -33527,7 +33326,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33671,10 +33470,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33694,7 +33490,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -33782,7 +33578,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33931,10 +33727,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -33966,7 +33759,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -34056,7 +33849,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34200,10 +33993,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34223,7 +34013,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34476,7 +34263,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34719,7 +34503,7 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34964,7 +34745,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -35052,7 +34833,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -35226,10 +35007,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35249,7 +35027,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35546,7 +35321,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -35820,7 +35592,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -36087,7 +35856,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -36372,7 +36138,7 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -36677,7 +36440,7 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -36951,7 +36711,7 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -37207,7 +36964,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -37469,7 +37223,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -37559,7 +37313,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -37703,10 +37457,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -37726,7 +37477,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -37814,7 +37565,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38037,10 +37788,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -38060,7 +37808,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -38246,7 +37994,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38395,10 +38143,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -38430,7 +38175,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -38520,7 +38265,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38671,10 +38416,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -38706,7 +38448,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -38806,7 +38548,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38950,10 +38692,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -38973,7 +38712,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -39295,7 +39031,7 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -39650,7 +39383,7 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -39906,7 +39636,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -40170,7 +39897,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -40440,7 +40164,7 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -40709,7 +40430,7 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut RegionListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -40964,7 +40682,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -41042,7 +40760,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -41191,10 +40909,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -41226,7 +40941,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -41483,7 +41195,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -41571,7 +41283,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -41720,10 +41432,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -41755,7 +41464,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -42054,7 +41760,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -42190,7 +41896,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -42341,10 +42047,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -42376,7 +42079,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> where C: BorrowMut TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -42662,7 +42362,7 @@ impl<'a, C, A> TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut TargetingTemplateListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -42964,7 +42661,7 @@ impl<'a, C, A> TargetingTemplateListCall<'a, C, A> where C: BorrowMut TargetingTemplateListCall<'a, C, A> where C: BorrowMut TargetingTemplateGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -43259,7 +42953,7 @@ impl<'a, C, A> TargetingTemplateGetCall<'a, C, A> where C: BorrowMut TargetingTemplateGetCall<'a, C, A> where C: BorrowMut TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -43531,7 +43222,7 @@ impl<'a, C, A> TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -43805,7 +43493,7 @@ impl<'a, C, A> TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut SubaccountPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44081,7 +43766,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -44181,7 +43866,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -44330,10 +44015,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44365,7 +44047,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -44455,7 +44137,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -44604,10 +44286,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44639,7 +44318,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -44729,7 +44408,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -44903,10 +44582,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -44926,7 +44602,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45047,7 +44723,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45191,10 +44867,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45214,7 +44887,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45302,7 +44975,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45446,10 +45119,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45469,7 +45139,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45557,7 +45227,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45699,10 +45369,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45722,7 +45389,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45800,7 +45467,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45944,10 +45611,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45967,7 +45631,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -46239,7 +45900,7 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -46515,7 +46173,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -46787,7 +46442,7 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47038,7 +46690,7 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47283,7 +46932,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut FileListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47561,7 +47207,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -47674,7 +47320,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -47839,10 +47485,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47862,7 +47505,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -47950,7 +47593,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -48203,10 +47846,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -48226,7 +47866,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -48629,7 +48266,7 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -48903,7 +48537,7 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -49160,7 +48791,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -49248,7 +48879,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -49399,10 +49030,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -49434,7 +49062,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> where C: BorrowMut InventoryItemListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -49752,7 +49377,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -49906,7 +49531,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -50052,10 +49677,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50075,7 +49697,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -50173,7 +49795,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -50322,10 +49944,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50345,7 +49964,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50598,7 +50214,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50851,7 +50464,7 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -51096,7 +50706,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -51381,7 +50988,7 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -51686,7 +51290,7 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -51960,7 +51561,7 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -52216,7 +51814,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -52461,7 +52056,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -52735,7 +52327,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut CreativeUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -53019,7 +52608,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -53109,7 +52698,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -53258,10 +52847,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -53293,7 +52879,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -53383,7 +52969,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -53527,10 +53113,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -53550,7 +53133,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -53638,7 +53221,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -53872,10 +53455,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -53895,7 +53475,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -54091,7 +53671,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54242,10 +53822,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -54277,7 +53854,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -54377,7 +53954,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54521,10 +54098,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -54544,7 +54118,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -54632,7 +54206,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54781,10 +54355,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -54816,7 +54387,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -54906,7 +54477,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55057,10 +54628,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -55092,7 +54660,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -55192,7 +54760,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55341,10 +54909,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -55376,7 +54941,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -55466,7 +55031,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55681,10 +55246,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -55704,7 +55266,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -55877,7 +55439,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56020,10 +55582,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -56043,7 +55602,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -56121,7 +55680,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56317,10 +55876,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -56340,7 +55896,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -56490,7 +56046,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56639,10 +56195,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -56674,7 +56227,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -56764,7 +56317,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56915,10 +56468,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -56950,7 +56500,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -57050,7 +56600,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57199,10 +56749,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -57234,7 +56781,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -57324,7 +56871,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57468,10 +57015,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -57491,7 +57035,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -57579,7 +57123,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57723,10 +57267,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -57746,7 +57287,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -58018,7 +57556,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -58310,7 +57845,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -58633,7 +58165,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -58917,7 +58446,7 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut CityListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -59198,7 +58724,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -59307,7 +58833,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -59456,10 +58982,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -59491,7 +59014,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -59748,7 +59268,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -60033,7 +59550,7 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -60320,7 +59834,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -60582,7 +60093,7 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -60858,7 +60366,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut ProjectListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -61162,7 +60667,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -61291,7 +60796,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -61435,10 +60940,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -61458,7 +60960,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -61546,7 +61048,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -61695,10 +61197,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -61730,7 +61229,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -62052,7 +61548,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62222,7 +61718,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -62366,10 +61862,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -62389,7 +61882,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62477,7 +61970,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -62621,10 +62114,7 @@ impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -62644,7 +62134,7 @@ impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62732,7 +62222,7 @@ impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -62874,10 +62364,7 @@ impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -62897,7 +62384,7 @@ impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62975,7 +62462,7 @@ impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -63122,10 +62609,7 @@ impl<'a, C, A> DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63145,7 +62629,7 @@ impl<'a, C, A> DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63430,7 +62911,7 @@ impl<'a, C, A> DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -63721,7 +63199,7 @@ impl<'a, C, A> DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -63995,7 +63470,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -64085,7 +63560,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -64249,10 +63724,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -64272,7 +63744,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -64379,7 +63851,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -64523,10 +63995,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -64546,7 +64015,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -64634,7 +64103,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -64778,10 +64247,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -64801,7 +64267,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -65073,7 +64536,7 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -65375,7 +64835,7 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -65701,7 +65158,7 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -65977,7 +65431,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -66244,7 +65695,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut CountryListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -66497,7 +65945,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -66575,7 +66023,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -66719,10 +66167,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -66742,7 +66187,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -66830,7 +66275,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -66983,10 +66428,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -67018,7 +66460,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -67297,7 +66736,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -67563,7 +66999,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -67837,7 +67270,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -68123,7 +67553,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68422,7 +67849,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68720,7 +68144,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -68808,7 +68232,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -68950,10 +68374,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68973,7 +68394,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69051,7 +68472,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69193,10 +68614,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69216,7 +68634,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69294,7 +68712,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69438,10 +68856,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69461,7 +68876,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69549,7 +68964,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69728,10 +69143,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69751,7 +69163,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69879,7 +69291,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -70028,10 +69440,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -70063,7 +69472,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -70153,7 +69562,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -70304,10 +69713,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -70339,7 +69745,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -70439,7 +69845,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -70590,10 +69996,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -70625,7 +70028,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -70725,7 +70128,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -70999,10 +70402,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -71022,7 +70422,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -71265,7 +70665,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -71409,10 +70809,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -71432,7 +70829,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -71520,7 +70917,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -71669,10 +71066,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -71704,7 +71098,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -71794,7 +71188,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -71943,10 +71337,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -71978,7 +71369,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -72068,7 +71459,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -72229,10 +71620,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -72252,7 +71640,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut PlacementGeneratetagCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with dfareporting (protocol v3.2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting3d2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-dfareporting3d2] path = "../dfareporting3d2" -version = "1.0.8+20180830" +version = "1.0.8+20190206" diff --git a/gen/dfareporting3d2-cli/README.md b/gen/dfareporting3d2-cli/README.md index 6bf394a7fe..91a625f679 100644 --- a/gen/dfareporting3d2-cli/README.md +++ b/gen/dfareporting3d2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dfareporting* API at revision *20180830*. The CLI is at version *1.0.8*. +This documentation was generated from the *dfareporting* API at revision *20190206*. The CLI is at version *1.0.8*. ```bash dfareporting3d2 [options] diff --git a/gen/dfareporting3d2-cli/mkdocs.yml b/gen/dfareporting3d2-cli/mkdocs.yml index 46eafe41c4..9e51a41836 100644 --- a/gen/dfareporting3d2-cli/mkdocs.yml +++ b/gen/dfareporting3d2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v1.0.8+20180830 +site_name: dfareporting v1.0.8+20190206 site_url: http://byron.github.io/google-apis-rs/google-dfareporting3d2-cli site_description: A complete library to interact with dfareporting (protocol v3.2) diff --git a/gen/dfareporting3d2-cli/src/main.rs b/gen/dfareporting3d2-cli/src/main.rs index 53c471ec9f..693e1af9fb 100644 --- a/gen/dfareporting3d2-cli/src/main.rs +++ b/gen/dfareporting3d2-cli/src/main.rs @@ -23888,7 +23888,7 @@ fn main() { let mut app = App::new("dfareporting3d2") .author("Sebastian Thiel ") - .version("1.0.8+20180830") + .version("1.0.8+20190206") .about("Manages your DoubleClick Campaign Manager ad campaigns and reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dfareporting3d2_cli") .arg(Arg::with_name("url") diff --git a/gen/dfareporting3d2/Cargo.toml b/gen/dfareporting3d2/Cargo.toml index 0a4fdfd869..830536a688 100644 --- a/gen/dfareporting3d2/Cargo.toml +++ b/gen/dfareporting3d2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dfareporting3d2" -version = "1.0.8+20180830" +version = "1.0.8+20190206" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v3.2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting3d2" homepage = "https://developers.google.com/doubleclick-advertisers/" -documentation = "https://docs.rs/google-dfareporting3d2/1.0.8+20180830" +documentation = "https://docs.rs/google-dfareporting3d2/1.0.8+20190206" license = "MIT" keywords = ["dfareporting", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/dfareporting3d2/README.md b/gen/dfareporting3d2/README.md index c0b3c7798b..29e28ca887 100644 --- a/gen/dfareporting3d2/README.md +++ b/gen/dfareporting3d2/README.md @@ -5,146 +5,146 @@ DO NOT EDIT ! --> The `google-dfareporting3d2` library allows access to all features of the *Google dfareporting* service. -This documentation was generated from *dfareporting* crate version *1.0.8+20180830*, where *20180830* is the exact revision of the *dfareporting:v3.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *dfareporting* crate version *1.0.8+20190206*, where *20190206* is the exact revision of the *dfareporting:v3.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *dfareporting* *v3d2* API can be found at the [official documentation site](https://developers.google.com/doubleclick-advertisers/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Dfareporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Dfareporting.html) ... -* [account active ad summaries](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountActiveAdSummary.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountActiveAdSummaryGetCall.html) -* [account permission groups](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountPermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountPermissionGroupListCall.html) -* [account permissions](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountPermission.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountPermissionListCall.html) -* [account user profiles](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountUserProfile.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountUserProfileUpdateCall.html) -* [accounts](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Account.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AccountUpdateCall.html) -* [ads](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Ad.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdUpdateCall.html) -* [advertiser groups](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserGroup.html) - * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserGroupUpdateCall.html) +* [account active ad summaries](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountActiveAdSummary.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountPermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountPermissionGroupListCall.html) +* [account permissions](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountPermission.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountPermissionListCall.html) +* [account user profiles](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountUserProfile.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountUserProfileUpdateCall.html) +* [accounts](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Account.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AccountUpdateCall.html) +* [ads](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Ad.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdUpdateCall.html) +* [advertiser groups](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserGroup.html) + * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserGroupUpdateCall.html) * advertiser landing pages - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserLandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserLandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserLandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserLandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserLandingPageUpdateCall.html) -* [advertisers](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Advertiser.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.AdvertiserUpdateCall.html) -* [browsers](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Browser.html) - * [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.BrowserListCall.html) -* [campaign creative associations](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CampaignCreativeAssociation.html) - * [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CampaignCreativeAssociationListCall.html) -* [campaigns](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Campaign.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CampaignUpdateCall.html) -* [change logs](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ChangeLog.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ChangeLogListCall.html) -* [cities](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.City.html) - * [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CityListCall.html) -* [connection types](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ConnectionType.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ConnectionTypeListCall.html) -* [content categories](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ContentCategory.html) - * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ContentCategoryUpdateCall.html) -* [conversions](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Conversion.html) - * [*batchinsert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ConversionBatchinsertCall.html) and [*batchupdate*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ConversionBatchupdateCall.html) -* [countries](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Country.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CountryListCall.html) -* [creative assets](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeAsset.html) - * [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeAssetInsertCall.html) -* [creative field values](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldValue.html) - * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldValueUpdateCall.html) -* [creative fields](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeField.html) - * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeFieldUpdateCall.html) -* [creative groups](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeGroup.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeGroupUpdateCall.html) -* [creatives](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Creative.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeUpdateCall.html) -* [dimension values](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DimensionValue.html) - * [*query*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DimensionValueQueryCall.html) -* [directory site contacts](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DirectorySiteContact.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DirectorySiteContactListCall.html) -* [directory sites](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DirectorySite.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DirectorySiteListCall.html) -* [dynamic targeting keys](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DynamicTargetingKey.html) - * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DynamicTargetingKeyDeleteCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DynamicTargetingKeyInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.DynamicTargetingKeyListCall.html) -* [event tags](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.EventTag.html) - * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.EventTagUpdateCall.html) -* [files](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.File.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FileListCall.html) -* [floodlight activities](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivity.html) - * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityUpdateCall.html) -* [floodlight activity groups](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityGroup.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightActivityGroupUpdateCall.html) -* [floodlight configurations](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightConfiguration.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FloodlightConfigurationUpdateCall.html) -* [inventory items](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.InventoryItem.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.InventoryItemListCall.html) -* [languages](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Language.html) - * [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.LanguageListCall.html) -* [metros](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Metro.html) - * [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.MetroListCall.html) -* [mobile apps](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.MobileApp.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.MobileAppGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.MobileAppListCall.html) -* [mobile carriers](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.MobileCarrier.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.MobileCarrierListCall.html) -* [operating system versions](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OperatingSystemVersion.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OperatingSystemVersionListCall.html) -* [operating systems](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OperatingSystem.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OperatingSystemListCall.html) -* [order documents](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OrderDocument.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OrderDocumentListCall.html) -* [orders](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Order.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.OrderListCall.html) -* [placement groups](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementGroup.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementGroupUpdateCall.html) -* [placement strategies](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementStrategy.html) - * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementStrategyUpdateCall.html) -* [placements](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Placement.html) - * [*generatetags*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlacementUpdateCall.html) -* [platform types](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlatformType.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PlatformTypeListCall.html) -* [postal codes](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PostalCode.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.PostalCodeListCall.html) -* [projects](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Project.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ProjectListCall.html) -* [regions](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Region.html) - * [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RegionListCall.html) -* [remarketing list shares](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RemarketingListShare.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RemarketingListShareUpdateCall.html) -* [remarketing lists](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.RemarketingListUpdateCall.html) -* [reports](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Report.html) - * [*compatible fields query*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportUpdateCall.html) -* [sites](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Site.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SiteUpdateCall.html) -* [sizes](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Size.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SizeListCall.html) -* [subaccounts](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Subaccount.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.SubaccountUpdateCall.html) -* [targetable remarketing lists](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.TargetableRemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.TargetableRemarketingListListCall.html) -* [targeting templates](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.TargetingTemplate.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.TargetingTemplateGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.TargetingTemplateInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.TargetingTemplateListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.TargetingTemplatePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.TargetingTemplateUpdateCall.html) -* [user profiles](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserProfile.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserProfileListCall.html) -* [user role permission groups](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRolePermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRolePermissionGroupListCall.html) -* [user role permissions](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRolePermission.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRolePermissionListCall.html) -* [user roles](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRole.html) - * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.UserRoleUpdateCall.html) -* [video formats](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.VideoFormat.html) - * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.VideoFormatGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.VideoFormatListCall.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserLandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserLandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserLandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserLandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserLandingPageUpdateCall.html) +* [advertisers](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Advertiser.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.AdvertiserUpdateCall.html) +* [browsers](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Browser.html) + * [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.BrowserListCall.html) +* [campaign creative associations](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CampaignCreativeAssociation.html) + * [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Campaign.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CampaignUpdateCall.html) +* [change logs](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ChangeLog.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ChangeLogListCall.html) +* [cities](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.City.html) + * [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CityListCall.html) +* [connection types](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ConnectionType.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ConnectionTypeListCall.html) +* [content categories](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ContentCategory.html) + * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ContentCategoryUpdateCall.html) +* [conversions](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Conversion.html) + * [*batchinsert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ConversionBatchinsertCall.html) and [*batchupdate*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ConversionBatchupdateCall.html) +* [countries](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Country.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CountryListCall.html) +* [creative assets](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeAsset.html) + * [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeAssetInsertCall.html) +* [creative field values](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldValue.html) + * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeField.html) + * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeFieldUpdateCall.html) +* [creative groups](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeGroup.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeGroupUpdateCall.html) +* [creatives](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Creative.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeUpdateCall.html) +* [dimension values](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DimensionValue.html) + * [*query*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DimensionValueQueryCall.html) +* [directory site contacts](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DirectorySiteContact.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DirectorySiteContactListCall.html) +* [directory sites](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DirectorySite.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DirectorySiteListCall.html) +* [dynamic targeting keys](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DynamicTargetingKey.html) + * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DynamicTargetingKeyDeleteCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DynamicTargetingKeyInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.DynamicTargetingKeyListCall.html) +* [event tags](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.EventTag.html) + * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.EventTagUpdateCall.html) +* [files](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.File.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FileListCall.html) +* [floodlight activities](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivity.html) + * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityGroup.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightConfiguration.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.InventoryItem.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.InventoryItemListCall.html) +* [languages](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Language.html) + * [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.LanguageListCall.html) +* [metros](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Metro.html) + * [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.MetroListCall.html) +* [mobile apps](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.MobileApp.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.MobileAppGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.MobileAppListCall.html) +* [mobile carriers](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.MobileCarrier.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.MobileCarrierListCall.html) +* [operating system versions](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OperatingSystemVersion.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OperatingSystemVersionListCall.html) +* [operating systems](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OperatingSystem.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OperatingSystemListCall.html) +* [order documents](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OrderDocument.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OrderDocumentListCall.html) +* [orders](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Order.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.OrderListCall.html) +* [placement groups](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementGroup.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementGroupUpdateCall.html) +* [placement strategies](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementStrategy.html) + * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementStrategyUpdateCall.html) +* [placements](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Placement.html) + * [*generatetags*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlacementUpdateCall.html) +* [platform types](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlatformType.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PlatformTypeListCall.html) +* [postal codes](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PostalCode.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.PostalCodeListCall.html) +* [projects](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Project.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ProjectListCall.html) +* [regions](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Region.html) + * [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RegionListCall.html) +* [remarketing list shares](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RemarketingListShare.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.RemarketingListUpdateCall.html) +* [reports](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Report.html) + * [*compatible fields query*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportUpdateCall.html) +* [sites](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Site.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SiteUpdateCall.html) +* [sizes](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Size.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SizeListCall.html) +* [subaccounts](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Subaccount.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.TargetableRemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.TargetableRemarketingListListCall.html) +* [targeting templates](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.TargetingTemplate.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.TargetingTemplateGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.TargetingTemplateInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.TargetingTemplateListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.TargetingTemplatePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.TargetingTemplateUpdateCall.html) +* [user profiles](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserProfile.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserProfileListCall.html) +* [user role permission groups](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRolePermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRolePermission.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRolePermissionListCall.html) +* [user roles](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRole.html) + * [*delete*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.UserRoleUpdateCall.html) +* [video formats](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.VideoFormat.html) + * [*get*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.VideoFormatGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.VideoFormatListCall.html) Upload supported by ... -* [*insert creative assets*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.CreativeAssetInsertCall.html) +* [*insert creative assets*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.CreativeAssetInsertCall.html) Download supported by ... -* [*get files*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.FileGetCall.html) -* [*files get reports*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.ReportFileGetCall.html) +* [*get files*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.FileGetCall.html) +* [*files get reports*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.ReportFileGetCall.html) @@ -152,17 +152,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/struct.Dfareporting.html)** +* **[Hub](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/struct.Dfareporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.Part.html)** + * **[Parts](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -267,17 +267,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -287,29 +287,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-dfareporting3d2/1.0.8+20180830/google_dfareporting3d2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dfareporting3d2/1.0.8+20190206/google_dfareporting3d2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dfareporting3d2/src/lib.rs b/gen/dfareporting3d2/src/lib.rs index 11d295fb3a..0089fae68f 100644 --- a/gen/dfareporting3d2/src/lib.rs +++ b/gen/dfareporting3d2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *dfareporting* crate version *1.0.8+20180830*, where *20180830* is the exact revision of the *dfareporting:v3.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *dfareporting* crate version *1.0.8+20190206*, where *20190206* is the exact revision of the *dfareporting:v3.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *dfareporting* *v3d2* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/). @@ -14723,10 +14723,7 @@ impl<'a, C, A> ConversionBatchupdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14758,7 +14755,7 @@ impl<'a, C, A> ConversionBatchupdateCall<'a, C, A> where C: BorrowMut ConversionBatchupdateCall<'a, C, A> where C: BorrowMut ConversionBatchinsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15032,7 +15026,7 @@ impl<'a, C, A> ConversionBatchinsertCall<'a, C, A> where C: BorrowMut ConversionBatchinsertCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15289,7 +15280,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15542,7 +15530,7 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15841,7 +15826,7 @@ impl<'a, C, A> AdvertiserLandingPageListCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageListCall<'a, C, A> where C: BorrowMut AdvertiserLandingPagePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16178,7 +16160,7 @@ impl<'a, C, A> AdvertiserLandingPagePatchCall<'a, C, A> where C: BorrowMut AdvertiserLandingPagePatchCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16462,7 +16441,7 @@ impl<'a, C, A> AdvertiserLandingPageUpdateCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageUpdateCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16736,7 +16712,7 @@ impl<'a, C, A> AdvertiserLandingPageInsertCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageInsertCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16993,7 +16966,7 @@ impl<'a, C, A> AdvertiserLandingPageGetCall<'a, C, A> where C: BorrowMut AdvertiserLandingPageGetCall<'a, C, A> where C: BorrowMut PlatformTypeGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17248,7 +17218,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17336,7 +17306,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17478,10 +17448,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17501,7 +17468,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17579,7 +17546,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17725,10 +17692,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17748,7 +17712,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17846,7 +17810,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18041,10 +18005,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18064,7 +18025,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18218,7 +18179,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18367,10 +18328,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18402,7 +18360,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18696,7 +18651,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18825,7 +18780,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18968,10 +18923,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18991,7 +18943,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19236,7 +19185,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19324,7 +19273,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19473,10 +19422,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19508,7 +19454,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19784,7 +19727,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut UserRoleInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20068,7 +20008,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20158,7 +20098,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20302,10 +20242,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20325,7 +20262,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20413,7 +20350,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20562,10 +20499,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20597,7 +20531,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20687,7 +20621,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20830,10 +20764,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20853,7 +20784,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20931,7 +20862,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21082,10 +21013,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21117,7 +21045,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21217,7 +21145,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21401,10 +21329,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21424,7 +21349,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21559,7 +21484,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21703,10 +21628,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21726,7 +21648,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21979,7 +21898,7 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22282,7 +22198,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -22457,7 +22373,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22643,7 +22556,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -22743,7 +22656,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22902,10 +22815,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22925,7 +22835,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23034,7 +22944,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23232,10 +23142,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23255,7 +23162,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23406,7 +23313,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23550,10 +23457,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23573,7 +23477,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23661,7 +23565,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23805,10 +23709,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23828,7 +23729,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24102,7 +24000,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24386,7 +24281,7 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut ReportRunCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24648,7 +24540,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24743,7 +24635,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24894,10 +24786,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24929,7 +24818,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25029,7 +24918,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25193,10 +25082,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25216,7 +25102,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -25332,7 +25218,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25481,10 +25367,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25516,7 +25399,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25606,7 +25489,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25757,10 +25640,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25792,7 +25672,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25892,7 +25772,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26041,10 +25921,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -26076,7 +25953,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26333,7 +26207,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26421,7 +26295,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26588,10 +26462,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26611,7 +26482,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26709,7 +26580,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26852,10 +26723,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26875,7 +26743,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26953,7 +26821,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27120,10 +26988,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -27143,7 +27008,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -27256,7 +27121,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27405,10 +27270,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27440,7 +27302,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -27530,7 +27392,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27681,10 +27543,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27716,7 +27575,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -27816,7 +27675,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28024,10 +27883,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28047,7 +27903,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -28212,7 +28068,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28361,10 +28217,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28396,7 +28249,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -28486,7 +28339,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28630,10 +28483,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28653,7 +28503,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -28741,7 +28591,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28900,10 +28750,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28935,7 +28782,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29225,7 +29069,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29537,7 +29378,7 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29846,7 +29684,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30118,7 +29953,7 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30392,7 +30224,7 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut MetroListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -30647,7 +30476,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -30725,7 +30554,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -30908,10 +30737,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -30931,7 +30757,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31070,7 +30896,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31216,10 +31042,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31239,7 +31062,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31337,7 +31160,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31481,10 +31304,7 @@ impl<'a, C, A> MobileAppGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31504,7 +31324,7 @@ impl<'a, C, A> MobileAppGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31592,7 +31412,7 @@ impl<'a, C, A> MobileAppGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31763,10 +31583,7 @@ impl<'a, C, A> MobileAppListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31786,7 +31603,7 @@ impl<'a, C, A> MobileAppListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31901,7 +31718,7 @@ impl<'a, C, A> MobileAppListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32045,10 +31862,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32068,7 +31882,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32360,7 +32171,7 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut UserProfileListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32631,7 +32439,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -32699,7 +32507,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32841,10 +32649,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32864,7 +32669,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -32942,7 +32747,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33093,10 +32898,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -33128,7 +32930,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -33228,7 +33030,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33377,10 +33179,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -33412,7 +33211,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -33502,7 +33301,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33779,10 +33578,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33802,7 +33598,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -34051,7 +33847,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34195,10 +33991,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34218,7 +34011,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -34306,7 +34099,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34455,10 +34248,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34490,7 +34280,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -34580,7 +34370,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -34724,10 +34514,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -34747,7 +34534,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35000,7 +34784,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35243,7 +35024,7 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35488,7 +35266,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -35576,7 +35354,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -35750,10 +35528,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -35773,7 +35548,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -36070,7 +35842,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -36344,7 +36113,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -36611,7 +36377,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -36896,7 +36659,7 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -37201,7 +36961,7 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -37475,7 +37232,7 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -37731,7 +37485,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -37993,7 +37744,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -38083,7 +37834,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38227,10 +37978,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -38250,7 +37998,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -38338,7 +38086,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38561,10 +38309,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -38584,7 +38329,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -38770,7 +38515,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -38919,10 +38664,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -38954,7 +38696,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -39044,7 +38786,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -39195,10 +38937,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -39230,7 +38969,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -39330,7 +39069,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -39474,10 +39213,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -39497,7 +39233,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -39819,7 +39552,7 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -40174,7 +39904,7 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -40430,7 +40157,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -40694,7 +40418,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -40964,7 +40685,7 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -41233,7 +40951,7 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut RegionListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -41488,7 +41203,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -41566,7 +41281,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -41715,10 +41430,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -41750,7 +41462,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -42007,7 +41716,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -42095,7 +41804,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -42244,10 +41953,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -42279,7 +41985,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -42578,7 +42281,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -42714,7 +42417,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -42865,10 +42568,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -42900,7 +42600,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> where C: BorrowMut TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -43186,7 +42883,7 @@ impl<'a, C, A> TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut TargetingTemplateListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -43488,7 +43182,7 @@ impl<'a, C, A> TargetingTemplateListCall<'a, C, A> where C: BorrowMut TargetingTemplateListCall<'a, C, A> where C: BorrowMut TargetingTemplateGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -43783,7 +43474,7 @@ impl<'a, C, A> TargetingTemplateGetCall<'a, C, A> where C: BorrowMut TargetingTemplateGetCall<'a, C, A> where C: BorrowMut TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44055,7 +43743,7 @@ impl<'a, C, A> TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44329,7 +44014,7 @@ impl<'a, C, A> TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut SubaccountPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44605,7 +44287,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -44705,7 +44387,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -44854,10 +44536,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -44889,7 +44568,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -44979,7 +44658,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45128,10 +44807,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -45163,7 +44839,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -45253,7 +44929,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45427,10 +45103,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45450,7 +45123,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45571,7 +45244,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45715,10 +45388,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45738,7 +45408,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45826,7 +45496,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -45970,10 +45640,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -45993,7 +45660,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -46081,7 +45748,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -46223,10 +45890,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -46246,7 +45910,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -46324,7 +45988,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -46468,10 +46132,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -46491,7 +46152,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -46763,7 +46421,7 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -47039,7 +46694,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47311,7 +46963,7 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47562,7 +47211,7 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -47807,7 +47453,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut FileListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -48085,7 +47728,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -48198,7 +47841,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -48363,10 +48006,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -48386,7 +48026,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -48474,7 +48114,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -48727,10 +48367,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -48750,7 +48387,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -49153,7 +48787,7 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -49427,7 +49058,7 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -49684,7 +49312,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -49772,7 +49400,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -49923,10 +49551,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -49958,7 +49583,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> where C: BorrowMut LanguageListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50223,7 +49845,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -50301,7 +49923,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -50496,10 +50118,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50519,7 +50138,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -50673,7 +50292,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -50819,10 +50438,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -50842,7 +50458,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -50940,7 +50556,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -51089,10 +50705,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -51112,7 +50725,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -51365,7 +50975,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -51618,7 +51225,7 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -51863,7 +51467,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -52148,7 +51749,7 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -52453,7 +52051,7 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -52727,7 +52322,7 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -52983,7 +52575,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -53228,7 +52817,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -53502,7 +53088,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut CreativeUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -53786,7 +53369,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -53876,7 +53459,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54025,10 +53608,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -54060,7 +53640,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -54150,7 +53730,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54294,10 +53874,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -54317,7 +53894,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -54405,7 +53982,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -54639,10 +54216,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -54662,7 +54236,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -54858,7 +54432,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55009,10 +54583,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -55044,7 +54615,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -55144,7 +54715,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55288,10 +54859,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -55311,7 +54879,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -55399,7 +54967,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55548,10 +55116,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -55583,7 +55148,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -55673,7 +55238,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -55824,10 +55389,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -55859,7 +55421,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -55959,7 +55521,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56108,10 +55670,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -56143,7 +55702,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -56233,7 +55792,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56448,10 +56007,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -56471,7 +56027,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -56644,7 +56200,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -56787,10 +56343,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -56810,7 +56363,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -56888,7 +56441,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57084,10 +56637,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -57107,7 +56657,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -57257,7 +56807,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57406,10 +56956,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -57441,7 +56988,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -57531,7 +57078,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57682,10 +57229,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -57717,7 +57261,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -57817,7 +57361,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -57966,10 +57510,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -58001,7 +57542,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -58091,7 +57632,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -58235,10 +57776,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -58258,7 +57796,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -58346,7 +57884,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -58490,10 +58028,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -58513,7 +58048,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -58785,7 +58317,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -59077,7 +58606,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -59400,7 +58926,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -59684,7 +59207,7 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut CityListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -59965,7 +59485,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -60074,7 +59594,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -60223,10 +59743,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -60258,7 +59775,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -60515,7 +60029,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -60800,7 +60311,7 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -61087,7 +60595,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -61349,7 +60854,7 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -61625,7 +61127,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut ProjectListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -61929,7 +61428,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62058,7 +61557,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -62202,10 +61701,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -62225,7 +61721,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62313,7 +61809,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -62462,10 +61958,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -62497,7 +61990,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -62819,7 +62309,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62989,7 +62479,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -63133,10 +62623,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63156,7 +62643,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -63244,7 +62731,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -63388,10 +62875,7 @@ impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63411,7 +62895,7 @@ impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -63499,7 +62983,7 @@ impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -63641,10 +63125,7 @@ impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63664,7 +63145,7 @@ impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -63742,7 +63223,7 @@ impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -63889,10 +63370,7 @@ impl<'a, C, A> DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -63912,7 +63390,7 @@ impl<'a, C, A> DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -64197,7 +63672,7 @@ impl<'a, C, A> DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -64488,7 +63960,7 @@ impl<'a, C, A> DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -64762,7 +64231,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -64852,7 +64321,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -65016,10 +64485,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -65039,7 +64505,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -65146,7 +64612,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -65290,10 +64756,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -65313,7 +64776,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -65401,7 +64864,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -65545,10 +65008,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -65568,7 +65028,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -65840,7 +65297,7 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -66142,7 +65596,7 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -66468,7 +65919,7 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -66744,7 +66192,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -67011,7 +66456,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut CountryListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -67264,7 +66706,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -67342,7 +66784,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -67486,10 +66928,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -67509,7 +66948,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -67597,7 +67036,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -67750,10 +67189,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -67785,7 +67221,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68064,7 +67497,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -68330,7 +67760,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -68604,7 +68031,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -68890,7 +68314,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69189,7 +68610,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69487,7 +68905,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69575,7 +68993,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69717,10 +69135,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69740,7 +69155,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -69818,7 +69233,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -69960,10 +69375,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -69983,7 +69395,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -70061,7 +69473,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -70205,10 +69617,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -70228,7 +69637,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -70316,7 +69725,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -70495,10 +69904,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -70518,7 +69924,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -70646,7 +70052,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -70795,10 +70201,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -70830,7 +70233,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -70920,7 +70323,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -71071,10 +70474,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -71106,7 +70506,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -71206,7 +70606,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -71357,10 +70757,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -71392,7 +70789,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -71492,7 +70889,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -71766,10 +71163,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -71789,7 +71183,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -72032,7 +71426,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -72176,10 +71570,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -72199,7 +71590,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -72287,7 +71678,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -72436,10 +71827,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -72471,7 +71859,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -72561,7 +71949,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -72710,10 +72098,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -72745,7 +72130,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -72835,7 +72220,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -72996,10 +72381,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -73019,7 +72401,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut PlacementGeneratetagCall<'a, C, A> where C: BorrowMut"] +description = "A complete library to interact with dfareporting (protocol v3.3)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting3d3-cli" +homepage = "https://developers.google.com/doubleclick-advertisers/" +documentation = "http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli" +license = "MIT" +keywords = ["dfareporting", "google", "cli"] +autobins = false + +[[bin]] +name = "dfareporting3d3" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-dfareporting3d3] +path = "../dfareporting3d3" +version = "1.0.8+20190206" diff --git a/gen/dfareporting3d3-cli/LICENSE.md b/gen/dfareporting3d3-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/dfareporting3d3-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/dfareporting3d3-cli/README.md b/gen/dfareporting3d3-cli/README.md new file mode 100644 index 0000000000..047de65e1e --- /dev/null +++ b/gen/dfareporting3d3-cli/README.md @@ -0,0 +1,376 @@ + +The `dfareporting3d3` command-line interface *(CLI)* allows to use most features of the *Google dfareporting* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *dfareporting* API can be found at the +[official documentation site](https://developers.google.com/doubleclick-advertisers/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-dfareporting3d3-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting3d3-cli). + +# Usage + +This documentation was generated from the *dfareporting* API at revision *20190206*. The CLI is at version *1.0.8*. + +```bash +dfareporting3d3 [options] + account-active-ad-summaries + get [-p ]... [-o ] + account-permission-groups + get [-p ]... [-o ] + list [-p ]... [-o ] + account-permissions + get [-p ]... [-o ] + list [-p ]... [-o ] + account-user-profiles + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + accounts + get [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + ads + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + advertiser-groups + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + advertiser-landing-pages + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + advertisers + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + browsers + list [-p ]... [-o ] + campaign-creative-associations + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + campaigns + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + change-logs + get [-p ]... [-o ] + list [-p ]... [-o ] + cities + list [-p ]... [-o ] + connection-types + get [-p ]... [-o ] + list [-p ]... [-o ] + content-categories + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + conversions + batchinsert (-r )... [-p ]... [-o ] + batchupdate (-r )... [-p ]... [-o ] + countries + get [-p ]... [-o ] + list [-p ]... [-o ] + creative-assets + insert (-r )... (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] + creative-field-values + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + creative-fields + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + creative-groups + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + creatives + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + dimension-values + query (-r )... [-p ]... [-o ] + directory-sites + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + dynamic-targeting-keys + delete [-p ]... + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + event-tags + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + files + get [-p ]... [-o ] + list [-p ]... [-o ] + floodlight-activities + delete [-p ]... + generatetag [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + floodlight-activity-groups + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + floodlight-configurations + get [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + inventory-items + get [-p ]... [-o ] + list [-p ]... [-o ] + languages + list [-p ]... [-o ] + metros + list [-p ]... [-o ] + mobile-apps + get [-p ]... [-o ] + list [-p ]... [-o ] + mobile-carriers + get [-p ]... [-o ] + list [-p ]... [-o ] + operating-system-versions + get [-p ]... [-o ] + list [-p ]... [-o ] + operating-systems + get [-p ]... [-o ] + list [-p ]... [-o ] + order-documents + get [-p ]... [-o ] + list [-p ]... [-o ] + orders + get [-p ]... [-o ] + list [-p ]... [-o ] + placement-groups + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + placement-strategies + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + placements + generatetags [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + platform-types + get [-p ]... [-o ] + list [-p ]... [-o ] + postal-codes + get [-p ]... [-o ] + list [-p ]... [-o ] + projects + get [-p ]... [-o ] + list [-p ]... [-o ] + regions + list [-p ]... [-o ] + remarketing-list-shares + get [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + remarketing-lists + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + reports + compatible-fields-query (-r )... [-p ]... [-o ] + delete [-p ]... + files-get [-p ]... [-o ] + files-list [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + run [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + sites + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + sizes + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + subaccounts + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + targetable-remarketing-lists + get [-p ]... [-o ] + list [-p ]... [-o ] + targeting-templates + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + user-profiles + get [-p ]... [-o ] + list [-p ]... [-o ] + user-role-permission-groups + get [-p ]... [-o ] + list [-p ]... [-o ] + user-role-permissions + get [-p ]... [-o ] + list [-p ]... [-o ] + user-roles + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + video-formats + get [-p ]... [-o ] + list [-p ]... [-o ] + dfareporting3d3 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `dfareporting3d3-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/dfareporting3d3-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/dfareporting3d3-secret.json`, assuming that the required *dfareporting* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `dfareporting3d3 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/dfareporting3d3-cli/mkdocs.yml b/gen/dfareporting3d3-cli/mkdocs.yml new file mode 100644 index 0000000000..2a0deaac2a --- /dev/null +++ b/gen/dfareporting3d3-cli/mkdocs.yml @@ -0,0 +1,220 @@ +site_name: dfareporting v1.0.8+20190206 +site_url: http://byron.github.io/google-apis-rs/google-dfareporting3d3-cli +site_description: A complete library to interact with dfareporting (protocol v3.3) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting3d3-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['account-active-ad-summaries_get.md', 'Account Active Ad Summaries', 'Get'] +- ['account-permission-groups_get.md', 'Account Permission Groups', 'Get'] +- ['account-permission-groups_list.md', 'Account Permission Groups', 'List'] +- ['account-permissions_get.md', 'Account Permissions', 'Get'] +- ['account-permissions_list.md', 'Account Permissions', 'List'] +- ['account-user-profiles_get.md', 'Account User Profiles', 'Get'] +- ['account-user-profiles_insert.md', 'Account User Profiles', 'Insert'] +- ['account-user-profiles_list.md', 'Account User Profiles', 'List'] +- ['account-user-profiles_patch.md', 'Account User Profiles', 'Patch'] +- ['account-user-profiles_update.md', 'Account User Profiles', 'Update'] +- ['accounts_get.md', 'Accounts', 'Get'] +- ['accounts_list.md', 'Accounts', 'List'] +- ['accounts_patch.md', 'Accounts', 'Patch'] +- ['accounts_update.md', 'Accounts', 'Update'] +- ['ads_get.md', 'Ads', 'Get'] +- ['ads_insert.md', 'Ads', 'Insert'] +- ['ads_list.md', 'Ads', 'List'] +- ['ads_patch.md', 'Ads', 'Patch'] +- ['ads_update.md', 'Ads', 'Update'] +- ['advertiser-groups_delete.md', 'Advertiser Groups', 'Delete'] +- ['advertiser-groups_get.md', 'Advertiser Groups', 'Get'] +- ['advertiser-groups_insert.md', 'Advertiser Groups', 'Insert'] +- ['advertiser-groups_list.md', 'Advertiser Groups', 'List'] +- ['advertiser-groups_patch.md', 'Advertiser Groups', 'Patch'] +- ['advertiser-groups_update.md', 'Advertiser Groups', 'Update'] +- ['advertiser-landing-pages_get.md', 'Advertiser Landing Pages', 'Get'] +- ['advertiser-landing-pages_insert.md', 'Advertiser Landing Pages', 'Insert'] +- ['advertiser-landing-pages_list.md', 'Advertiser Landing Pages', 'List'] +- ['advertiser-landing-pages_patch.md', 'Advertiser Landing Pages', 'Patch'] +- ['advertiser-landing-pages_update.md', 'Advertiser Landing Pages', 'Update'] +- ['advertisers_get.md', 'Advertisers', 'Get'] +- ['advertisers_insert.md', 'Advertisers', 'Insert'] +- ['advertisers_list.md', 'Advertisers', 'List'] +- ['advertisers_patch.md', 'Advertisers', 'Patch'] +- ['advertisers_update.md', 'Advertisers', 'Update'] +- ['browsers_list.md', 'Browsers', 'List'] +- ['campaign-creative-associations_insert.md', 'Campaign Creative Associations', 'Insert'] +- ['campaign-creative-associations_list.md', 'Campaign Creative Associations', 'List'] +- ['campaigns_get.md', 'Campaigns', 'Get'] +- ['campaigns_insert.md', 'Campaigns', 'Insert'] +- ['campaigns_list.md', 'Campaigns', 'List'] +- ['campaigns_patch.md', 'Campaigns', 'Patch'] +- ['campaigns_update.md', 'Campaigns', 'Update'] +- ['change-logs_get.md', 'Change Logs', 'Get'] +- ['change-logs_list.md', 'Change Logs', 'List'] +- ['cities_list.md', 'Cities', 'List'] +- ['connection-types_get.md', 'Connection Types', 'Get'] +- ['connection-types_list.md', 'Connection Types', 'List'] +- ['content-categories_delete.md', 'Content Categories', 'Delete'] +- ['content-categories_get.md', 'Content Categories', 'Get'] +- ['content-categories_insert.md', 'Content Categories', 'Insert'] +- ['content-categories_list.md', 'Content Categories', 'List'] +- ['content-categories_patch.md', 'Content Categories', 'Patch'] +- ['content-categories_update.md', 'Content Categories', 'Update'] +- ['conversions_batchinsert.md', 'Conversions', 'Batchinsert'] +- ['conversions_batchupdate.md', 'Conversions', 'Batchupdate'] +- ['countries_get.md', 'Countries', 'Get'] +- ['countries_list.md', 'Countries', 'List'] +- ['creative-assets_insert.md', 'Creative Assets', 'Insert'] +- ['creative-field-values_delete.md', 'Creative Field Values', 'Delete'] +- ['creative-field-values_get.md', 'Creative Field Values', 'Get'] +- ['creative-field-values_insert.md', 'Creative Field Values', 'Insert'] +- ['creative-field-values_list.md', 'Creative Field Values', 'List'] +- ['creative-field-values_patch.md', 'Creative Field Values', 'Patch'] +- ['creative-field-values_update.md', 'Creative Field Values', 'Update'] +- ['creative-fields_delete.md', 'Creative Fields', 'Delete'] +- ['creative-fields_get.md', 'Creative Fields', 'Get'] +- ['creative-fields_insert.md', 'Creative Fields', 'Insert'] +- ['creative-fields_list.md', 'Creative Fields', 'List'] +- ['creative-fields_patch.md', 'Creative Fields', 'Patch'] +- ['creative-fields_update.md', 'Creative Fields', 'Update'] +- ['creative-groups_get.md', 'Creative Groups', 'Get'] +- ['creative-groups_insert.md', 'Creative Groups', 'Insert'] +- ['creative-groups_list.md', 'Creative Groups', 'List'] +- ['creative-groups_patch.md', 'Creative Groups', 'Patch'] +- ['creative-groups_update.md', 'Creative Groups', 'Update'] +- ['creatives_get.md', 'Creatives', 'Get'] +- ['creatives_insert.md', 'Creatives', 'Insert'] +- ['creatives_list.md', 'Creatives', 'List'] +- ['creatives_patch.md', 'Creatives', 'Patch'] +- ['creatives_update.md', 'Creatives', 'Update'] +- ['dimension-values_query.md', 'Dimension Values', 'Query'] +- ['directory-sites_get.md', 'Directory Sites', 'Get'] +- ['directory-sites_insert.md', 'Directory Sites', 'Insert'] +- ['directory-sites_list.md', 'Directory Sites', 'List'] +- ['dynamic-targeting-keys_delete.md', 'Dynamic Targeting Keys', 'Delete'] +- ['dynamic-targeting-keys_insert.md', 'Dynamic Targeting Keys', 'Insert'] +- ['dynamic-targeting-keys_list.md', 'Dynamic Targeting Keys', 'List'] +- ['event-tags_delete.md', 'Event Tags', 'Delete'] +- ['event-tags_get.md', 'Event Tags', 'Get'] +- ['event-tags_insert.md', 'Event Tags', 'Insert'] +- ['event-tags_list.md', 'Event Tags', 'List'] +- ['event-tags_patch.md', 'Event Tags', 'Patch'] +- ['event-tags_update.md', 'Event Tags', 'Update'] +- ['files_get.md', 'Files', 'Get'] +- ['files_list.md', 'Files', 'List'] +- ['floodlight-activities_delete.md', 'Floodlight Activities', 'Delete'] +- ['floodlight-activities_generatetag.md', 'Floodlight Activities', 'Generatetag'] +- ['floodlight-activities_get.md', 'Floodlight Activities', 'Get'] +- ['floodlight-activities_insert.md', 'Floodlight Activities', 'Insert'] +- ['floodlight-activities_list.md', 'Floodlight Activities', 'List'] +- ['floodlight-activities_patch.md', 'Floodlight Activities', 'Patch'] +- ['floodlight-activities_update.md', 'Floodlight Activities', 'Update'] +- ['floodlight-activity-groups_get.md', 'Floodlight Activity Groups', 'Get'] +- ['floodlight-activity-groups_insert.md', 'Floodlight Activity Groups', 'Insert'] +- ['floodlight-activity-groups_list.md', 'Floodlight Activity Groups', 'List'] +- ['floodlight-activity-groups_patch.md', 'Floodlight Activity Groups', 'Patch'] +- ['floodlight-activity-groups_update.md', 'Floodlight Activity Groups', 'Update'] +- ['floodlight-configurations_get.md', 'Floodlight Configurations', 'Get'] +- ['floodlight-configurations_list.md', 'Floodlight Configurations', 'List'] +- ['floodlight-configurations_patch.md', 'Floodlight Configurations', 'Patch'] +- ['floodlight-configurations_update.md', 'Floodlight Configurations', 'Update'] +- ['inventory-items_get.md', 'Inventory Items', 'Get'] +- ['inventory-items_list.md', 'Inventory Items', 'List'] +- ['languages_list.md', 'Languages', 'List'] +- ['metros_list.md', 'Metros', 'List'] +- ['mobile-apps_get.md', 'Mobile Apps', 'Get'] +- ['mobile-apps_list.md', 'Mobile Apps', 'List'] +- ['mobile-carriers_get.md', 'Mobile Carriers', 'Get'] +- ['mobile-carriers_list.md', 'Mobile Carriers', 'List'] +- ['operating-system-versions_get.md', 'Operating System Versions', 'Get'] +- ['operating-system-versions_list.md', 'Operating System Versions', 'List'] +- ['operating-systems_get.md', 'Operating Systems', 'Get'] +- ['operating-systems_list.md', 'Operating Systems', 'List'] +- ['order-documents_get.md', 'Order Documents', 'Get'] +- ['order-documents_list.md', 'Order Documents', 'List'] +- ['orders_get.md', 'Orders', 'Get'] +- ['orders_list.md', 'Orders', 'List'] +- ['placement-groups_get.md', 'Placement Groups', 'Get'] +- ['placement-groups_insert.md', 'Placement Groups', 'Insert'] +- ['placement-groups_list.md', 'Placement Groups', 'List'] +- ['placement-groups_patch.md', 'Placement Groups', 'Patch'] +- ['placement-groups_update.md', 'Placement Groups', 'Update'] +- ['placement-strategies_delete.md', 'Placement Strategies', 'Delete'] +- ['placement-strategies_get.md', 'Placement Strategies', 'Get'] +- ['placement-strategies_insert.md', 'Placement Strategies', 'Insert'] +- ['placement-strategies_list.md', 'Placement Strategies', 'List'] +- ['placement-strategies_patch.md', 'Placement Strategies', 'Patch'] +- ['placement-strategies_update.md', 'Placement Strategies', 'Update'] +- ['placements_generatetags.md', 'Placements', 'Generatetags'] +- ['placements_get.md', 'Placements', 'Get'] +- ['placements_insert.md', 'Placements', 'Insert'] +- ['placements_list.md', 'Placements', 'List'] +- ['placements_patch.md', 'Placements', 'Patch'] +- ['placements_update.md', 'Placements', 'Update'] +- ['platform-types_get.md', 'Platform Types', 'Get'] +- ['platform-types_list.md', 'Platform Types', 'List'] +- ['postal-codes_get.md', 'Postal Codes', 'Get'] +- ['postal-codes_list.md', 'Postal Codes', 'List'] +- ['projects_get.md', 'Projects', 'Get'] +- ['projects_list.md', 'Projects', 'List'] +- ['regions_list.md', 'Regions', 'List'] +- ['remarketing-list-shares_get.md', 'Remarketing List Shares', 'Get'] +- ['remarketing-list-shares_patch.md', 'Remarketing List Shares', 'Patch'] +- ['remarketing-list-shares_update.md', 'Remarketing List Shares', 'Update'] +- ['remarketing-lists_get.md', 'Remarketing Lists', 'Get'] +- ['remarketing-lists_insert.md', 'Remarketing Lists', 'Insert'] +- ['remarketing-lists_list.md', 'Remarketing Lists', 'List'] +- ['remarketing-lists_patch.md', 'Remarketing Lists', 'Patch'] +- ['remarketing-lists_update.md', 'Remarketing Lists', 'Update'] +- ['reports_compatible-fields-query.md', 'Reports', 'Compatible Fields Query'] +- ['reports_delete.md', 'Reports', 'Delete'] +- ['reports_files-get.md', 'Reports', 'Files Get'] +- ['reports_files-list.md', 'Reports', 'Files List'] +- ['reports_get.md', 'Reports', 'Get'] +- ['reports_insert.md', 'Reports', 'Insert'] +- ['reports_list.md', 'Reports', 'List'] +- ['reports_patch.md', 'Reports', 'Patch'] +- ['reports_run.md', 'Reports', 'Run'] +- ['reports_update.md', 'Reports', 'Update'] +- ['sites_get.md', 'Sites', 'Get'] +- ['sites_insert.md', 'Sites', 'Insert'] +- ['sites_list.md', 'Sites', 'List'] +- ['sites_patch.md', 'Sites', 'Patch'] +- ['sites_update.md', 'Sites', 'Update'] +- ['sizes_get.md', 'Sizes', 'Get'] +- ['sizes_insert.md', 'Sizes', 'Insert'] +- ['sizes_list.md', 'Sizes', 'List'] +- ['subaccounts_get.md', 'Subaccounts', 'Get'] +- ['subaccounts_insert.md', 'Subaccounts', 'Insert'] +- ['subaccounts_list.md', 'Subaccounts', 'List'] +- ['subaccounts_patch.md', 'Subaccounts', 'Patch'] +- ['subaccounts_update.md', 'Subaccounts', 'Update'] +- ['targetable-remarketing-lists_get.md', 'Targetable Remarketing Lists', 'Get'] +- ['targetable-remarketing-lists_list.md', 'Targetable Remarketing Lists', 'List'] +- ['targeting-templates_get.md', 'Targeting Templates', 'Get'] +- ['targeting-templates_insert.md', 'Targeting Templates', 'Insert'] +- ['targeting-templates_list.md', 'Targeting Templates', 'List'] +- ['targeting-templates_patch.md', 'Targeting Templates', 'Patch'] +- ['targeting-templates_update.md', 'Targeting Templates', 'Update'] +- ['user-profiles_get.md', 'User Profiles', 'Get'] +- ['user-profiles_list.md', 'User Profiles', 'List'] +- ['user-role-permission-groups_get.md', 'User Role Permission Groups', 'Get'] +- ['user-role-permission-groups_list.md', 'User Role Permission Groups', 'List'] +- ['user-role-permissions_get.md', 'User Role Permissions', 'Get'] +- ['user-role-permissions_list.md', 'User Role Permissions', 'List'] +- ['user-roles_delete.md', 'User Roles', 'Delete'] +- ['user-roles_get.md', 'User Roles', 'Get'] +- ['user-roles_insert.md', 'User Roles', 'Insert'] +- ['user-roles_list.md', 'User Roles', 'List'] +- ['user-roles_patch.md', 'User Roles', 'Patch'] +- ['user-roles_update.md', 'User Roles', 'Update'] +- ['video-formats_get.md', 'Video Formats', 'Get'] +- ['video-formats_list.md', 'Video Formats', 'List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/dfareporting3d3-cli/src/cmn.rs b/gen/dfareporting3d3-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/dfareporting3d3-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/dfareporting3d3-cli/src/main.rs b/gen/dfareporting3d3-cli/src/main.rs new file mode 100644 index 0000000000..0508fc3270 --- /dev/null +++ b/gen/dfareporting3d3-cli/src/main.rs @@ -0,0 +1,23819 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_dfareporting3d3 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Dfareporting>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _account_active_ad_summaries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_active_ad_summaries().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("summary-account-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permission_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permission_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permission_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permission_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permissions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permissions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_user_profiles().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.object-ids" => Some(("userRoleFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-role-filter.status" => Some(("userRoleFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.kind" => Some(("userRoleFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.object-ids" => Some(("siteFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "site-filter.status" => Some(("siteFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.kind" => Some(("siteFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-type" => Some(("traffickerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.object-ids" => Some(("advertiserFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "advertiser-filter.status" => Some(("advertiserFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.kind" => Some(("advertiserFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.object-ids" => Some(("campaignFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "campaign-filter.status" => Some(("campaignFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.kind" => Some(("campaignFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-id" => Some(("userRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-access-type" => Some(("userAccessType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-filter", "campaign-filter", "comments", "email", "id", "kind", "locale", "name", "object-ids", "site-filter", "status", "subaccount-id", "trafficker-type", "user-access-type", "user-role-filter", "user-role-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.account_user_profiles().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_user_profiles().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "user-role-id" => { + call = call.user_role_id(value.unwrap_or("")); + }, + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "subaccount-id", "sort-field", "ids", "max-results", "page-token", "user-role-id", "sort-order", "active"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.object-ids" => Some(("userRoleFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-role-filter.status" => Some(("userRoleFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.kind" => Some(("userRoleFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.object-ids" => Some(("siteFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "site-filter.status" => Some(("siteFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.kind" => Some(("siteFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-type" => Some(("traffickerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.object-ids" => Some(("advertiserFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "advertiser-filter.status" => Some(("advertiserFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.kind" => Some(("advertiserFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.object-ids" => Some(("campaignFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "campaign-filter.status" => Some(("campaignFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.kind" => Some(("campaignFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-id" => Some(("userRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-access-type" => Some(("userAccessType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-filter", "campaign-filter", "comments", "email", "id", "kind", "locale", "name", "object-ids", "site-filter", "status", "subaccount-id", "trafficker-type", "user-access-type", "user-role-filter", "user-role-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.account_user_profiles().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.object-ids" => Some(("userRoleFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-role-filter.status" => Some(("userRoleFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.kind" => Some(("userRoleFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.object-ids" => Some(("siteFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "site-filter.status" => Some(("siteFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.kind" => Some(("siteFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-type" => Some(("traffickerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.object-ids" => Some(("advertiserFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "advertiser-filter.status" => Some(("advertiserFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.kind" => Some(("advertiserFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.object-ids" => Some(("campaignFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "campaign-filter.status" => Some(("campaignFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.kind" => Some(("campaignFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-id" => Some(("userRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-access-type" => Some(("userAccessType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-filter", "campaign-filter", "comments", "email", "id", "kind", "locale", "name", "object-ids", "site-filter", "status", "subaccount-id", "trafficker-type", "user-access-type", "user-role-filter", "user-role-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.account_user_profiles().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order", "active"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teaser-size-limit" => Some(("teaserSizeLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "maximum-image-size" => Some(("maximumImageSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-creative-size-id" => Some(("defaultCreativeSizeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-permission-ids" => Some(("accountPermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "account-profile" => Some(("accountProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.report-generation-time-zone-id" => Some(("reportsConfiguration.reportGenerationTimeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reports-configuration.exposure-to-conversion-enabled" => Some(("reportsConfiguration.exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.click-duration" => Some(("reportsConfiguration.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.post-impression-activities-duration" => Some(("reportsConfiguration.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "currency-id" => Some(("currencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "active-view-opt-out" => Some(("activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "active-ads-limit-tier" => Some(("activeAdsLimitTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "share-reports-with-twitter" => Some(("shareReportsWithTwitter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "country-id" => Some(("countryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-permission-ids", "account-profile", "active", "active-ads-limit-tier", "active-view-opt-out", "available-permission-ids", "click-duration", "country-id", "currency-id", "default-creative-size-id", "description", "exposure-to-conversion-enabled", "id", "kind", "locale", "lookback-configuration", "maximum-image-size", "name", "nielsen-ocr-enabled", "post-impression-activities-duration", "report-generation-time-zone-id", "reports-configuration", "share-reports-with-twitter", "teaser-size-limit"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Account = json::value::from_value(object).unwrap(); + let mut call = self.hub.accounts().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teaser-size-limit" => Some(("teaserSizeLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "maximum-image-size" => Some(("maximumImageSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-creative-size-id" => Some(("defaultCreativeSizeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-permission-ids" => Some(("accountPermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "account-profile" => Some(("accountProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.report-generation-time-zone-id" => Some(("reportsConfiguration.reportGenerationTimeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reports-configuration.exposure-to-conversion-enabled" => Some(("reportsConfiguration.exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.click-duration" => Some(("reportsConfiguration.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.post-impression-activities-duration" => Some(("reportsConfiguration.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "currency-id" => Some(("currencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "active-view-opt-out" => Some(("activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "active-ads-limit-tier" => Some(("activeAdsLimitTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "share-reports-with-twitter" => Some(("shareReportsWithTwitter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "country-id" => Some(("countryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-permission-ids", "account-profile", "active", "active-ads-limit-tier", "active-view-opt-out", "available-permission-ids", "click-duration", "country-id", "currency-id", "default-creative-size-id", "description", "exposure-to-conversion-enabled", "id", "kind", "locale", "lookback-configuration", "maximum-image-size", "name", "nielsen-ocr-enabled", "post-impression-activities-duration", "report-generation-time-zone-id", "reports-configuration", "share-reports-with-twitter", "teaser-size-limit"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Account = json::value::from_value(object).unwrap(); + let mut call = self.hub.accounts().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.ads().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.priority" => Some(("deliverySchedule.priority", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.hard-cutoff" => Some(("deliverySchedule.hardCutoff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.duration" => Some(("deliverySchedule.frequencyCap.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.impressions" => Some(("deliverySchedule.frequencyCap.impressions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.impression-ratio" => Some(("deliverySchedule.impressionRatio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "targeting-template-id" => Some(("targetingTemplateId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.weight-calculation-strategy" => Some(("creativeRotation.weightCalculationStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.creative-optimization-configuration-id" => Some(("creativeRotation.creativeOptimizationConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.type" => Some(("creativeRotation.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.computed-click-through-url" => Some(("clickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.custom-click-through-url" => Some(("clickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.landing-page-id" => Some(("clickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.default-landing-page" => Some(("clickThroughUrl.defaultLandingPage", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-expression.expression" => Some(("remarketingListExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "audience-segment-id" => Some(("audienceSegmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-click-tracker" => Some(("dynamicClickTracker", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "archived", "audience-segment-id", "campaign-id", "campaign-id-dimension-value", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comments", "compatibility", "computed-click-through-url", "create-info", "creative-optimization-configuration-id", "creative-rotation", "custom-click-through-url", "day-part-targeting", "days-of-week", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page", "delivery-schedule", "dimension-name", "duration", "dynamic-click-tracker", "end-time", "etag", "exclude-countries", "expression", "frequency-cap", "geo-targeting", "hard-cutoff", "height", "hours-of-day", "iab", "id", "id-dimension-value", "impression-ratio", "impressions", "key-value-targeting-expression", "kind", "landing-page-id", "last-modified-info", "match-type", "name", "override-inherited-event-tag", "override-inherited-suffix", "priority", "remarketing-list-expression", "size", "ssl-compliant", "ssl-required", "start-time", "subaccount-id", "targeting-template-id", "time", "type", "user-local-time", "value", "weight-calculation-strategy", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Ad = json::value::from_value(object).unwrap(); + let mut call = self.hub.ads().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.ads().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "type" => { + call = call.add_type(value.unwrap_or("")); + }, + "ssl-required" => { + call = call.ssl_required(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); + }, + "ssl-compliant" => { + call = call.ssl_compliant(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "size-ids" => { + call = call.add_size_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "remarketing-list-ids" => { + call = call.add_remarketing_list_ids(value.unwrap_or("")); + }, + "placement-ids" => { + call = call.add_placement_ids(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "overridden-event-tag-id" => { + call = call.overridden_event_tag_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "landing-page-ids" => { + call = call.add_landing_page_ids(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "dynamic-click-tracker" => { + call = call.dynamic_click_tracker(arg_from_str(value.unwrap_or("false"), err, "dynamic-click-tracker", "boolean")); + }, + "creative-optimization-configuration-ids" => { + call = call.add_creative_optimization_configuration_ids(value.unwrap_or("")); + }, + "creative-ids" => { + call = call.add_creative_ids(value.unwrap_or("")); + }, + "compatibility" => { + call = call.compatibility(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "audience-segment-ids" => { + call = call.add_audience_segment_ids(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["landing-page-ids", "overridden-event-tag-id", "campaign-ids", "archived", "creative-optimization-configuration-ids", "ssl-compliant", "size-ids", "page-token", "sort-order", "type", "ssl-required", "creative-ids", "max-results", "placement-ids", "active", "compatibility", "advertiser-id", "search-string", "sort-field", "audience-segment-ids", "ids", "remarketing-list-ids", "dynamic-click-tracker"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.priority" => Some(("deliverySchedule.priority", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.hard-cutoff" => Some(("deliverySchedule.hardCutoff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.duration" => Some(("deliverySchedule.frequencyCap.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.impressions" => Some(("deliverySchedule.frequencyCap.impressions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.impression-ratio" => Some(("deliverySchedule.impressionRatio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "targeting-template-id" => Some(("targetingTemplateId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.weight-calculation-strategy" => Some(("creativeRotation.weightCalculationStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.creative-optimization-configuration-id" => Some(("creativeRotation.creativeOptimizationConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.type" => Some(("creativeRotation.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.computed-click-through-url" => Some(("clickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.custom-click-through-url" => Some(("clickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.landing-page-id" => Some(("clickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.default-landing-page" => Some(("clickThroughUrl.defaultLandingPage", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-expression.expression" => Some(("remarketingListExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "audience-segment-id" => Some(("audienceSegmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-click-tracker" => Some(("dynamicClickTracker", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "archived", "audience-segment-id", "campaign-id", "campaign-id-dimension-value", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comments", "compatibility", "computed-click-through-url", "create-info", "creative-optimization-configuration-id", "creative-rotation", "custom-click-through-url", "day-part-targeting", "days-of-week", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page", "delivery-schedule", "dimension-name", "duration", "dynamic-click-tracker", "end-time", "etag", "exclude-countries", "expression", "frequency-cap", "geo-targeting", "hard-cutoff", "height", "hours-of-day", "iab", "id", "id-dimension-value", "impression-ratio", "impressions", "key-value-targeting-expression", "kind", "landing-page-id", "last-modified-info", "match-type", "name", "override-inherited-event-tag", "override-inherited-suffix", "priority", "remarketing-list-expression", "size", "ssl-compliant", "ssl-required", "start-time", "subaccount-id", "targeting-template-id", "time", "type", "user-local-time", "value", "weight-calculation-strategy", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Ad = json::value::from_value(object).unwrap(); + let mut call = self.hub.ads().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.priority" => Some(("deliverySchedule.priority", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.hard-cutoff" => Some(("deliverySchedule.hardCutoff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.duration" => Some(("deliverySchedule.frequencyCap.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.impressions" => Some(("deliverySchedule.frequencyCap.impressions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.impression-ratio" => Some(("deliverySchedule.impressionRatio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "targeting-template-id" => Some(("targetingTemplateId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.weight-calculation-strategy" => Some(("creativeRotation.weightCalculationStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.creative-optimization-configuration-id" => Some(("creativeRotation.creativeOptimizationConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.type" => Some(("creativeRotation.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.computed-click-through-url" => Some(("clickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.custom-click-through-url" => Some(("clickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.landing-page-id" => Some(("clickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.default-landing-page" => Some(("clickThroughUrl.defaultLandingPage", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-expression.expression" => Some(("remarketingListExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "audience-segment-id" => Some(("audienceSegmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-click-tracker" => Some(("dynamicClickTracker", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "archived", "audience-segment-id", "campaign-id", "campaign-id-dimension-value", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comments", "compatibility", "computed-click-through-url", "create-info", "creative-optimization-configuration-id", "creative-rotation", "custom-click-through-url", "day-part-targeting", "days-of-week", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page", "delivery-schedule", "dimension-name", "duration", "dynamic-click-tracker", "end-time", "etag", "exclude-countries", "expression", "frequency-cap", "geo-targeting", "hard-cutoff", "height", "hours-of-day", "iab", "id", "id-dimension-value", "impression-ratio", "impressions", "key-value-targeting-expression", "kind", "landing-page-id", "last-modified-info", "match-type", "name", "override-inherited-event-tag", "override-inherited-suffix", "priority", "remarketing-list-expression", "size", "ssl-compliant", "ssl-required", "start-time", "subaccount-id", "targeting-template-id", "time", "type", "user-local-time", "value", "weight-calculation-strategy", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Ad = json::value::from_value(object).unwrap(); + let mut call = self.hub.ads().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_groups().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _advertiser_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_landing_pages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_landing_pages().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_landing_pages_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["advertiser-id", "archived", "id", "kind", "name", "url"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LandingPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_landing_pages().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_landing_pages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_landing_pages().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["archived", "search-string", "subaccount-id", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order", "campaign-ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_landing_pages_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["advertiser-id", "archived", "id", "kind", "name", "url"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LandingPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_landing_pages().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_landing_pages_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["advertiser-id", "archived", "id", "kind", "name", "url"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LandingPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_landing_pages().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertisers().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-floodlight-configuration-id" => Some(("originalFloodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix" => Some(("clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "suspended" => Some(("suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-email" => Some(("defaultEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "click-through-url-suffix", "default-click-through-event-tag-id", "default-email", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "original-floodlight-configuration-id", "status", "subaccount-id", "suspended", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Advertiser = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertisers().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertisers().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "status" => { + call = call.status(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "only-parent" => { + call = call.only_parent(arg_from_str(value.unwrap_or("false"), err, "only-parent", "boolean")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "include-advertisers-without-groups-only" => { + call = call.include_advertisers_without_groups_only(arg_from_str(value.unwrap_or("false"), err, "include-advertisers-without-groups-only", "boolean")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "floodlight-configuration-ids" => { + call = call.add_floodlight_configuration_ids(value.unwrap_or("")); + }, + "advertiser-group-ids" => { + call = call.add_advertiser_group_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["status", "search-string", "subaccount-id", "include-advertisers-without-groups-only", "sort-field", "ids", "max-results", "page-token", "only-parent", "sort-order", "floodlight-configuration-ids", "advertiser-group-ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-floodlight-configuration-id" => Some(("originalFloodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix" => Some(("clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "suspended" => Some(("suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-email" => Some(("defaultEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "click-through-url-suffix", "default-click-through-event-tag-id", "default-email", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "original-floodlight-configuration-id", "status", "subaccount-id", "suspended", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Advertiser = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertisers().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-floodlight-configuration-id" => Some(("originalFloodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix" => Some(("clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "suspended" => Some(("suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-email" => Some(("defaultEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "click-through-url-suffix", "default-click-through-event-tag-id", "default-email", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "original-floodlight-configuration-id", "status", "subaccount-id", "suspended", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Advertiser = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertisers().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _browsers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.browsers().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaign_creative_associations_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "creative-id" => Some(("creativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["creative-id", "kind"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CampaignCreativeAssociation = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaign_creative_associations().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaign_creative_associations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.campaign_creative_associations().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "sort-order", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.campaigns().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-landing-page-id" => Some(("defaultLandingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.optimization-model" => Some(("creativeOptimizationConfiguration.optimizationModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.id" => Some(("creativeOptimizationConfiguration.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.name" => Some(("creativeOptimizationConfiguration.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-emails" => Some(("traffickerEmails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billing-invoice-code" => Some(("billingInvoiceCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-group-ids" => Some(("creativeGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-configuration.creative-bundle-id" => Some(("adBlockingConfiguration.creativeBundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-configuration.click-through-url" => Some(("adBlockingConfiguration.clickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-configuration.enabled" => Some(("adBlockingConfiguration.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ad-blocking-configuration.override-click-through-url" => Some(("adBlockingConfiguration.overrideClickThroughUrl", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "ad-blocking-configuration", "advertiser-group-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "billing-invoice-code", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comment", "create-info", "creative-bundle-id", "creative-group-ids", "creative-optimization-configuration", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page-id", "dimension-name", "enabled", "end-date", "etag", "external-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "nielsen-ocr-enabled", "optimization-model", "override-click-through-url", "override-inherited-event-tag", "override-inherited-suffix", "start-date", "subaccount-id", "time", "trafficker-emails", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Campaign = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaigns().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.campaigns().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "overridden-event-tag-id" => { + call = call.overridden_event_tag_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "excluded-ids" => { + call = call.add_excluded_ids(value.unwrap_or("")); + }, + "at-least-one-optimization-activity" => { + call = call.at_least_one_optimization_activity(arg_from_str(value.unwrap_or("false"), err, "at-least-one-optimization-activity", "boolean")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + "advertiser-group-ids" => { + call = call.add_advertiser_group_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["archived", "search-string", "subaccount-id", "sort-field", "advertiser-ids", "ids", "max-results", "excluded-ids", "page-token", "advertiser-group-ids", "sort-order", "overridden-event-tag-id", "at-least-one-optimization-activity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-landing-page-id" => Some(("defaultLandingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.optimization-model" => Some(("creativeOptimizationConfiguration.optimizationModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.id" => Some(("creativeOptimizationConfiguration.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.name" => Some(("creativeOptimizationConfiguration.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-emails" => Some(("traffickerEmails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billing-invoice-code" => Some(("billingInvoiceCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-group-ids" => Some(("creativeGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-configuration.creative-bundle-id" => Some(("adBlockingConfiguration.creativeBundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-configuration.click-through-url" => Some(("adBlockingConfiguration.clickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-configuration.enabled" => Some(("adBlockingConfiguration.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ad-blocking-configuration.override-click-through-url" => Some(("adBlockingConfiguration.overrideClickThroughUrl", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "ad-blocking-configuration", "advertiser-group-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "billing-invoice-code", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comment", "create-info", "creative-bundle-id", "creative-group-ids", "creative-optimization-configuration", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page-id", "dimension-name", "enabled", "end-date", "etag", "external-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "nielsen-ocr-enabled", "optimization-model", "override-click-through-url", "override-inherited-event-tag", "override-inherited-suffix", "start-date", "subaccount-id", "time", "trafficker-emails", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Campaign = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaigns().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-landing-page-id" => Some(("defaultLandingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.optimization-model" => Some(("creativeOptimizationConfiguration.optimizationModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.id" => Some(("creativeOptimizationConfiguration.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.name" => Some(("creativeOptimizationConfiguration.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-emails" => Some(("traffickerEmails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billing-invoice-code" => Some(("billingInvoiceCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-group-ids" => Some(("creativeGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-configuration.creative-bundle-id" => Some(("adBlockingConfiguration.creativeBundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-configuration.click-through-url" => Some(("adBlockingConfiguration.clickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-configuration.enabled" => Some(("adBlockingConfiguration.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ad-blocking-configuration.override-click-through-url" => Some(("adBlockingConfiguration.overrideClickThroughUrl", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "ad-blocking-configuration", "advertiser-group-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "billing-invoice-code", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comment", "create-info", "creative-bundle-id", "creative-group-ids", "creative-optimization-configuration", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page-id", "dimension-name", "enabled", "end-date", "etag", "external-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "nielsen-ocr-enabled", "optimization-model", "override-click-through-url", "override-inherited-event-tag", "override-inherited-suffix", "start-date", "subaccount-id", "time", "trafficker-emails", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Campaign = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaigns().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _change_logs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.change_logs().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _change_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.change_logs().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "user-profile-ids" => { + call = call.add_user_profile_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "object-type" => { + call = call.object_type(value.unwrap_or("")); + }, + "object-ids" => { + call = call.add_object_ids(value.unwrap_or("")); + }, + "min-change-time" => { + call = call.min_change_time(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "max-change-time" => { + call = call.max_change_time(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "action" => { + call = call.action(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["min-change-time", "search-string", "max-change-time", "user-profile-ids", "ids", "max-results", "object-ids", "page-token", "action", "object-type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _cities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.cities().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "region-dart-ids" => { + call = call.add_region_dart_ids(value.unwrap_or("")); + }, + "name-prefix" => { + call = call.name_prefix(value.unwrap_or("")); + }, + "dart-ids" => { + call = call.add_dart_ids(value.unwrap_or("")); + }, + "country-dart-ids" => { + call = call.add_country_dart_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["dart-ids", "country-dart-ids", "region-dart-ids", "name-prefix"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _connection_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.connection_types().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _connection_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.connection_types().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.content_categories().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _content_categories_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.content_categories().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); + let mut call = self.hub.content_categories().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.content_categories().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); + let mut call = self.hub.content_categories().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); + let mut call = self.hub.content_categories().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _conversions_batchinsert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.kind" => Some(("encryptionInfo.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.encryption-entity-id" => Some(("encryptionInfo.encryptionEntityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.encryption-source" => Some(("encryptionInfo.encryptionSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.encryption-entity-type" => Some(("encryptionInfo.encryptionEntityType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["encryption-entity-id", "encryption-entity-type", "encryption-info", "encryption-source", "kind"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ConversionsBatchInsertRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.conversions().batchinsert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _conversions_batchupdate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.kind" => Some(("encryptionInfo.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.encryption-entity-id" => Some(("encryptionInfo.encryptionEntityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.encryption-source" => Some(("encryptionInfo.encryptionSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encryption-info.encryption-entity-type" => Some(("encryptionInfo.encryptionEntityType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["encryption-entity-id", "encryption-entity-type", "encryption-info", "encryption-source", "kind"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ConversionsBatchUpdateRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.conversions().batchupdate(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _countries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.countries().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("dart-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _countries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.countries().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_assets_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "detected-features" => Some(("detectedFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "asset-identifier.type" => Some(("assetIdentifier.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "asset-identifier.name" => Some(("assetIdentifier.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "warned-validation-rules" => Some(("warnedValidationRules", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["asset-identifier", "detected-features", "dimension-name", "etag", "id", "id-dimension-value", "kind", "match-type", "name", "type", "value", "warned-validation-rules"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeAssetMetadata = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_assets().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let vals = opt.values_of("mode").unwrap().collect::>(); + let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); + let mut input_file = input_file_from_opts(vals[1], err); + let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Upload(UploadProtocol::Simple) => call.upload(input_file.unwrap(), mime_type.unwrap()), + CallType::Upload(UploadProtocol::Resumable) => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), + CallType::Standard => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_field_values().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _creative_field_values_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_field_values().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_field_values().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_field_values().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_field_values().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_field_values().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_fields().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _creative_fields_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_fields().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeField = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_fields().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_fields().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeField = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_fields().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeField = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_fields().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-number" => Some(("groupNumber", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "group-number", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "group-number" => { + call = call.group_number(arg_from_str(value.unwrap_or("-0"), err, "group-number", "integer")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "group-number", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-number" => Some(("groupNumber", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "group-number", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-number" => Some(("groupNumber", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "group-number", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creatives().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "total-file-size" => Some(("totalFileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-tag-keys" => Some(("adTagKeys", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "third-party-backup-image-impressions-url" => Some(("thirdPartyBackupImageImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.kind" => Some(("renderingIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.value" => Some(("renderingIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.dimension-name" => Some(("renderingIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.etag" => Some(("renderingIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.match-type" => Some(("renderingIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.id" => Some(("renderingIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.window-height" => Some(("fsCommand.windowHeight", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.top" => Some(("fsCommand.top", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.window-width" => Some(("fsCommand.windowWidth", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.position-option" => Some(("fsCommand.positionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.left" => Some(("fsCommand.left", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "dynamic-asset-selection" => Some(("dynamicAssetSelection", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "universal-ad-id.registry" => Some(("universalAdId.registry", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "universal-ad-id.value" => Some(("universalAdId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "studio-trafficked-creative-id" => Some(("studioTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "override-css" => Some(("overrideCss", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-source" => Some(("authoringSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "media-description" => Some(("mediaDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id" => Some(("renderingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skip-offset.offset-percentage" => Some(("skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "skip-offset.offset-seconds" => Some(("skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "backup-image-reporting-label" => Some(("backupImageReportingLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "progress-offset.offset-percentage" => Some(("progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "progress-offset.offset-seconds" => Some(("progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "background-color" => Some(("backgroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-key-values" => Some(("customKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "redirect-url" => Some(("redirectUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-rich-media-impressions-url" => Some(("thirdPartyRichMediaImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-advertiser-id" => Some(("studioAdvertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-features" => Some(("backupImageFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "auto-advance-images" => Some(("autoAdvanceImages", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "html-code-locked" => Some(("htmlCodeLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "commercial-id" => Some(("commercialId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.custom-html" => Some(("backupImageTargetWindow.customHtml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.target-window-option" => Some(("backupImageTargetWindow.targetWindowOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-plugin-version" => Some(("requiredFlashPluginVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "ad-parameters" => Some(("adParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "convert-flash-to-html5" => Some(("convertFlashToHtml5", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ssl-override" => Some(("sslOverride", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url.computed-click-through-url" => Some(("backupImageClickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url.custom-click-through-url" => Some(("backupImageClickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url.landing-page-id" => Some(("backupImageClickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-creative-id" => Some(("studioCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-tool" => Some(("authoringTool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-script-access" => Some(("allowScriptAccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "companion-creatives" => Some(("companionCreatives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creative-asset-selection.default-asset-id" => Some(("creativeAssetSelection.defaultAssetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code" => Some(("htmlCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-version" => Some(("requiredFlashVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "media-duration" => Some(("mediaDuration", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "skippable" => Some(("skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "ad-parameters", "ad-tag-keys", "advertiser-id", "allow-script-access", "archived", "artwork-type", "authoring-source", "authoring-tool", "auto-advance-images", "background-color", "backup-image-click-through-url", "backup-image-features", "backup-image-reporting-label", "backup-image-target-window", "commercial-id", "companion-creatives", "compatibility", "computed-click-through-url", "convert-flash-to-html5", "creative-asset-selection", "custom-click-through-url", "custom-html", "custom-key-values", "default-asset-id", "dimension-name", "dynamic-asset-selection", "etag", "fs-command", "height", "html-code", "html-code-locked", "iab", "id", "id-dimension-value", "kind", "landing-page-id", "last-modified-info", "latest-trafficked-creative-id", "left", "match-type", "media-description", "media-duration", "name", "offset-percentage", "offset-seconds", "override-css", "position-option", "progress-offset", "redirect-url", "registry", "rendering-id", "rendering-id-dimension-value", "required-flash-plugin-version", "required-flash-version", "size", "skip-offset", "skippable", "ssl-compliant", "ssl-override", "studio-advertiser-id", "studio-creative-id", "studio-trafficked-creative-id", "subaccount-id", "target-window-option", "third-party-backup-image-impressions-url", "third-party-rich-media-impressions-url", "time", "top", "total-file-size", "type", "universal-ad-id", "value", "version", "width", "window-height", "window-width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Creative = json::value::from_value(object).unwrap(); + let mut call = self.hub.creatives().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creatives().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "types" => { + call = call.add_types(value.unwrap_or("")); + }, + "studio-creative-id" => { + call = call.studio_creative_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "size-ids" => { + call = call.add_size_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "rendering-ids" => { + call = call.add_rendering_ids(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "creative-field-ids" => { + call = call.add_creative_field_ids(value.unwrap_or("")); + }, + "companion-creative-ids" => { + call = call.add_companion_creative_ids(value.unwrap_or("")); + }, + "campaign-id" => { + call = call.campaign_id(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["advertiser-id", "archived", "search-string", "max-results", "campaign-id", "sort-field", "rendering-ids", "ids", "studio-creative-id", "size-ids", "page-token", "sort-order", "companion-creative-ids", "active", "creative-field-ids", "types"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "total-file-size" => Some(("totalFileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-tag-keys" => Some(("adTagKeys", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "third-party-backup-image-impressions-url" => Some(("thirdPartyBackupImageImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.kind" => Some(("renderingIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.value" => Some(("renderingIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.dimension-name" => Some(("renderingIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.etag" => Some(("renderingIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.match-type" => Some(("renderingIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.id" => Some(("renderingIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.window-height" => Some(("fsCommand.windowHeight", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.top" => Some(("fsCommand.top", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.window-width" => Some(("fsCommand.windowWidth", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.position-option" => Some(("fsCommand.positionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.left" => Some(("fsCommand.left", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "dynamic-asset-selection" => Some(("dynamicAssetSelection", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "universal-ad-id.registry" => Some(("universalAdId.registry", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "universal-ad-id.value" => Some(("universalAdId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "studio-trafficked-creative-id" => Some(("studioTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "override-css" => Some(("overrideCss", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-source" => Some(("authoringSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "media-description" => Some(("mediaDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id" => Some(("renderingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skip-offset.offset-percentage" => Some(("skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "skip-offset.offset-seconds" => Some(("skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "backup-image-reporting-label" => Some(("backupImageReportingLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "progress-offset.offset-percentage" => Some(("progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "progress-offset.offset-seconds" => Some(("progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "background-color" => Some(("backgroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-key-values" => Some(("customKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "redirect-url" => Some(("redirectUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-rich-media-impressions-url" => Some(("thirdPartyRichMediaImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-advertiser-id" => Some(("studioAdvertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-features" => Some(("backupImageFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "auto-advance-images" => Some(("autoAdvanceImages", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "html-code-locked" => Some(("htmlCodeLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "commercial-id" => Some(("commercialId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.custom-html" => Some(("backupImageTargetWindow.customHtml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.target-window-option" => Some(("backupImageTargetWindow.targetWindowOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-plugin-version" => Some(("requiredFlashPluginVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "ad-parameters" => Some(("adParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "convert-flash-to-html5" => Some(("convertFlashToHtml5", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ssl-override" => Some(("sslOverride", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url.computed-click-through-url" => Some(("backupImageClickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url.custom-click-through-url" => Some(("backupImageClickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url.landing-page-id" => Some(("backupImageClickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-creative-id" => Some(("studioCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-tool" => Some(("authoringTool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-script-access" => Some(("allowScriptAccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "companion-creatives" => Some(("companionCreatives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creative-asset-selection.default-asset-id" => Some(("creativeAssetSelection.defaultAssetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code" => Some(("htmlCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-version" => Some(("requiredFlashVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "media-duration" => Some(("mediaDuration", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "skippable" => Some(("skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "ad-parameters", "ad-tag-keys", "advertiser-id", "allow-script-access", "archived", "artwork-type", "authoring-source", "authoring-tool", "auto-advance-images", "background-color", "backup-image-click-through-url", "backup-image-features", "backup-image-reporting-label", "backup-image-target-window", "commercial-id", "companion-creatives", "compatibility", "computed-click-through-url", "convert-flash-to-html5", "creative-asset-selection", "custom-click-through-url", "custom-html", "custom-key-values", "default-asset-id", "dimension-name", "dynamic-asset-selection", "etag", "fs-command", "height", "html-code", "html-code-locked", "iab", "id", "id-dimension-value", "kind", "landing-page-id", "last-modified-info", "latest-trafficked-creative-id", "left", "match-type", "media-description", "media-duration", "name", "offset-percentage", "offset-seconds", "override-css", "position-option", "progress-offset", "redirect-url", "registry", "rendering-id", "rendering-id-dimension-value", "required-flash-plugin-version", "required-flash-version", "size", "skip-offset", "skippable", "ssl-compliant", "ssl-override", "studio-advertiser-id", "studio-creative-id", "studio-trafficked-creative-id", "subaccount-id", "target-window-option", "third-party-backup-image-impressions-url", "third-party-rich-media-impressions-url", "time", "top", "total-file-size", "type", "universal-ad-id", "value", "version", "width", "window-height", "window-width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Creative = json::value::from_value(object).unwrap(); + let mut call = self.hub.creatives().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "total-file-size" => Some(("totalFileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-tag-keys" => Some(("adTagKeys", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "third-party-backup-image-impressions-url" => Some(("thirdPartyBackupImageImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.kind" => Some(("renderingIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.value" => Some(("renderingIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.dimension-name" => Some(("renderingIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.etag" => Some(("renderingIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.match-type" => Some(("renderingIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.id" => Some(("renderingIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.window-height" => Some(("fsCommand.windowHeight", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.top" => Some(("fsCommand.top", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.window-width" => Some(("fsCommand.windowWidth", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.position-option" => Some(("fsCommand.positionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.left" => Some(("fsCommand.left", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "dynamic-asset-selection" => Some(("dynamicAssetSelection", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "universal-ad-id.registry" => Some(("universalAdId.registry", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "universal-ad-id.value" => Some(("universalAdId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "studio-trafficked-creative-id" => Some(("studioTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "override-css" => Some(("overrideCss", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-source" => Some(("authoringSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "media-description" => Some(("mediaDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id" => Some(("renderingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skip-offset.offset-percentage" => Some(("skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "skip-offset.offset-seconds" => Some(("skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "backup-image-reporting-label" => Some(("backupImageReportingLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "progress-offset.offset-percentage" => Some(("progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "progress-offset.offset-seconds" => Some(("progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "background-color" => Some(("backgroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-key-values" => Some(("customKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "redirect-url" => Some(("redirectUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-rich-media-impressions-url" => Some(("thirdPartyRichMediaImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-advertiser-id" => Some(("studioAdvertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-features" => Some(("backupImageFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "auto-advance-images" => Some(("autoAdvanceImages", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "html-code-locked" => Some(("htmlCodeLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "commercial-id" => Some(("commercialId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.custom-html" => Some(("backupImageTargetWindow.customHtml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.target-window-option" => Some(("backupImageTargetWindow.targetWindowOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-plugin-version" => Some(("requiredFlashPluginVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "ad-parameters" => Some(("adParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "convert-flash-to-html5" => Some(("convertFlashToHtml5", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ssl-override" => Some(("sslOverride", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url.computed-click-through-url" => Some(("backupImageClickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url.custom-click-through-url" => Some(("backupImageClickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url.landing-page-id" => Some(("backupImageClickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-creative-id" => Some(("studioCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-tool" => Some(("authoringTool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-script-access" => Some(("allowScriptAccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "companion-creatives" => Some(("companionCreatives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "creative-asset-selection.default-asset-id" => Some(("creativeAssetSelection.defaultAssetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code" => Some(("htmlCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-version" => Some(("requiredFlashVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "media-duration" => Some(("mediaDuration", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "skippable" => Some(("skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "ad-parameters", "ad-tag-keys", "advertiser-id", "allow-script-access", "archived", "artwork-type", "authoring-source", "authoring-tool", "auto-advance-images", "background-color", "backup-image-click-through-url", "backup-image-features", "backup-image-reporting-label", "backup-image-target-window", "commercial-id", "companion-creatives", "compatibility", "computed-click-through-url", "convert-flash-to-html5", "creative-asset-selection", "custom-click-through-url", "custom-html", "custom-key-values", "default-asset-id", "dimension-name", "dynamic-asset-selection", "etag", "fs-command", "height", "html-code", "html-code-locked", "iab", "id", "id-dimension-value", "kind", "landing-page-id", "last-modified-info", "latest-trafficked-creative-id", "left", "match-type", "media-description", "media-duration", "name", "offset-percentage", "offset-seconds", "override-css", "position-option", "progress-offset", "redirect-url", "registry", "rendering-id", "rendering-id-dimension-value", "required-flash-plugin-version", "required-flash-version", "size", "skip-offset", "skippable", "ssl-compliant", "ssl-override", "studio-advertiser-id", "studio-creative-id", "studio-trafficked-creative-id", "subaccount-id", "target-window-option", "third-party-backup-image-impressions-url", "third-party-rich-media-impressions-url", "time", "top", "total-file-size", "type", "universal-ad-id", "value", "version", "width", "window-height", "window-width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Creative = json::value::from_value(object).unwrap(); + let mut call = self.hub.creatives().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _dimension_values_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "dimension-name" => Some(("dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["dimension-name", "end-date", "kind", "start-date"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DimensionValueRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.dimension_values().query(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.directory_sites().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_sites_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.interstitial-placement-accepted" => Some(("settings.interstitialPlacementAccepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.active-view-opt-out" => Some(("settings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.instream-video-placement-accepted" => Some(("settings.instreamVideoPlacementAccepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.dfp-network-code" => Some(("settings.dfpSettings.dfpNetworkCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.dfp-settings.publisher-portal-only" => Some(("settings.dfpSettings.publisherPortalOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.programmatic-placement-accepted" => Some(("settings.dfpSettings.programmaticPlacementAccepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.pub-paid-placement-accepted" => Some(("settings.dfpSettings.pubPaidPlacementAccepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.dfp-network-name" => Some(("settings.dfpSettings.dfpNetworkName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "inpage-tag-formats" => Some(("inpageTagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "interstitial-tag-formats" => Some(("interstitialTagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["active", "active-view-opt-out", "dfp-network-code", "dfp-network-name", "dfp-settings", "dimension-name", "etag", "id", "id-dimension-value", "inpage-tag-formats", "instream-video-placement-accepted", "interstitial-placement-accepted", "interstitial-tag-formats", "kind", "match-type", "name", "programmatic-placement-accepted", "pub-paid-placement-accepted", "publisher-portal-only", "settings", "url", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DirectorySite = json::value::from_value(object).unwrap(); + let mut call = self.hub.directory_sites().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.directory_sites().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "dfp-network-code" => { + call = call.dfp_network_code(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + "accepts-publisher-paid-placements" => { + call = call.accepts_publisher_paid_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-publisher-paid-placements", "boolean")); + }, + "accepts-interstitial-placements" => { + call = call.accepts_interstitial_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-interstitial-placements", "boolean")); + }, + "accepts-in-stream-video-placements" => { + call = call.accepts_in_stream_video_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-in-stream-video-placements", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["accepts-interstitial-placements", "dfp-network-code", "search-string", "sort-field", "ids", "max-results", "page-token", "sort-order", "accepts-in-stream-video-placements", "active", "accepts-publisher-paid-placements"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _dynamic_targeting_keys_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.dynamic_targeting_keys().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("object-id").unwrap_or(""), opt.value_of("name").unwrap_or(""), opt.value_of("object-type").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _dynamic_targeting_keys_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "object-id" => Some(("objectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "object-type" => Some(("objectType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "name", "object-id", "object-type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DynamicTargetingKey = json::value::from_value(object).unwrap(); + let mut call = self.hub.dynamic_targeting_keys().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _dynamic_targeting_keys_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.dynamic_targeting_keys().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "object-type" => { + call = call.object_type(value.unwrap_or("")); + }, + "object-id" => { + call = call.object_id(value.unwrap_or("")); + }, + "names" => { + call = call.add_names(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["advertiser-id", "names", "object-id", "object-type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.event_tags().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _event_tags_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.event_tags().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url-escape-levels" => Some(("urlEscapeLevels", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled-by-default" => Some(("enabledByDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter-type" => Some(("siteFilterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exclude-from-adx-requests" => Some(("excludeFromAdxRequests", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "campaign-id", "campaign-id-dimension-value", "dimension-name", "enabled-by-default", "etag", "exclude-from-adx-requests", "id", "kind", "match-type", "name", "site-filter-type", "site-ids", "ssl-compliant", "status", "subaccount-id", "type", "url", "url-escape-levels", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::EventTag = json::value::from_value(object).unwrap(); + let mut call = self.hub.event_tags().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.event_tags().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "event-tag-types" => { + call = call.add_event_tag_types(value.unwrap_or("")); + }, + "enabled" => { + call = call.enabled(arg_from_str(value.unwrap_or("false"), err, "enabled", "boolean")); + }, + "definitions-only" => { + call = call.definitions_only(arg_from_str(value.unwrap_or("false"), err, "definitions-only", "boolean")); + }, + "campaign-id" => { + call = call.campaign_id(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + "ad-id" => { + call = call.ad_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "campaign-id", "sort-field", "enabled", "ids", "advertiser-id", "ad-id", "sort-order", "event-tag-types", "definitions-only"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url-escape-levels" => Some(("urlEscapeLevels", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled-by-default" => Some(("enabledByDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter-type" => Some(("siteFilterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exclude-from-adx-requests" => Some(("excludeFromAdxRequests", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "campaign-id", "campaign-id-dimension-value", "dimension-name", "enabled-by-default", "etag", "exclude-from-adx-requests", "id", "kind", "match-type", "name", "site-filter-type", "site-ids", "ssl-compliant", "status", "subaccount-id", "type", "url", "url-escape-levels", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::EventTag = json::value::from_value(object).unwrap(); + let mut call = self.hub.event_tags().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url-escape-levels" => Some(("urlEscapeLevels", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled-by-default" => Some(("enabledByDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter-type" => Some(("siteFilterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exclude-from-adx-requests" => Some(("excludeFromAdxRequests", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "campaign-id", "campaign-id-dimension-value", "dimension-name", "enabled-by-default", "etag", "exclude-from-adx-requests", "id", "kind", "match-type", "name", "site-filter-type", "site-ids", "ssl-compliant", "status", "subaccount-id", "type", "url", "url-escape-levels", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::EventTag = json::value::from_value(object).unwrap(); + let mut call = self.hub.event_tags().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut download_mode = false; + let mut call = self.hub.files().get(opt.value_of("report-id").unwrap_or(""), opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + if !download_mode { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.files().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "scope" => { + call = call.scope(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["sort-field", "max-results", "sort-order", "page-token", "scope"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _floodlight_activities_generatetag(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().generatetag(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "floodlight-activity-id" => { + call = call.floodlight_activity_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["floodlight-activity-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-activity-group-name" => Some(("floodlightActivityGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-id" => Some(("floodlightActivityGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-tag-string" => Some(("floodlightActivityGroupTagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-format" => Some(("tagFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hidden" => Some(("hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-tag-type" => Some(("floodlightTagType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cache-busting-type" => Some(("cacheBustingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "expected-url" => Some(("expectedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-defined-variable-types" => Some(("userDefinedVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "counting-method" => Some(("countingMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-type" => Some(("floodlightActivityGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "cache-busting-type", "counting-method", "dimension-name", "etag", "expected-url", "floodlight-activity-group-id", "floodlight-activity-group-name", "floodlight-activity-group-tag-string", "floodlight-activity-group-type", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "floodlight-tag-type", "hidden", "id", "id-dimension-value", "kind", "match-type", "name", "notes", "secure", "ssl-compliant", "ssl-required", "subaccount-id", "tag-format", "tag-string", "user-defined-variable-types", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activities().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "tag-string" => { + call = call.tag_string(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "floodlight-configuration-id" => { + call = call.floodlight_configuration_id(value.unwrap_or("")); + }, + "floodlight-activity-group-type" => { + call = call.floodlight_activity_group_type(value.unwrap_or("")); + }, + "floodlight-activity-group-tag-string" => { + call = call.floodlight_activity_group_tag_string(value.unwrap_or("")); + }, + "floodlight-activity-group-name" => { + call = call.floodlight_activity_group_name(value.unwrap_or("")); + }, + "floodlight-activity-group-ids" => { + call = call.add_floodlight_activity_group_ids(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["floodlight-activity-group-ids", "search-string", "floodlight-activity-group-name", "sort-field", "floodlight-configuration-id", "ids", "max-results", "advertiser-id", "page-token", "sort-order", "tag-string", "floodlight-activity-group-tag-string", "floodlight-activity-group-type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-activity-group-name" => Some(("floodlightActivityGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-id" => Some(("floodlightActivityGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-tag-string" => Some(("floodlightActivityGroupTagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-format" => Some(("tagFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hidden" => Some(("hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-tag-type" => Some(("floodlightTagType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cache-busting-type" => Some(("cacheBustingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "expected-url" => Some(("expectedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-defined-variable-types" => Some(("userDefinedVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "counting-method" => Some(("countingMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-type" => Some(("floodlightActivityGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "cache-busting-type", "counting-method", "dimension-name", "etag", "expected-url", "floodlight-activity-group-id", "floodlight-activity-group-name", "floodlight-activity-group-tag-string", "floodlight-activity-group-type", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "floodlight-tag-type", "hidden", "id", "id-dimension-value", "kind", "match-type", "name", "notes", "secure", "ssl-compliant", "ssl-required", "subaccount-id", "tag-format", "tag-string", "user-defined-variable-types", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activities().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-activity-group-name" => Some(("floodlightActivityGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-id" => Some(("floodlightActivityGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-tag-string" => Some(("floodlightActivityGroupTagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-format" => Some(("tagFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hidden" => Some(("hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-tag-type" => Some(("floodlightTagType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cache-busting-type" => Some(("cacheBustingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "expected-url" => Some(("expectedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-defined-variable-types" => Some(("userDefinedVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "counting-method" => Some(("countingMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-type" => Some(("floodlightActivityGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "cache-busting-type", "counting-method", "dimension-name", "etag", "expected-url", "floodlight-activity-group-id", "floodlight-activity-group-name", "floodlight-activity-group-tag-string", "floodlight-activity-group-type", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "floodlight-tag-type", "hidden", "id", "id-dimension-value", "kind", "match-type", "name", "notes", "secure", "ssl-compliant", "ssl-required", "subaccount-id", "tag-format", "tag-string", "user-defined-variable-types", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activities().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activity_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "subaccount-id", "tag-string", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activity_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activity_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "type" => { + call = call.type_(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "floodlight-configuration-id" => { + call = call.floodlight_configuration_id(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "floodlight-configuration-id", "ids", "max-results", "advertiser-id", "page-token", "sort-order", "type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "subaccount-id", "tag-string", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activity_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "subaccount-id", "tag-string", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activity_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_configurations().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_configurations().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "natural-search-conversion-attribution-option" => Some(("naturalSearchConversionAttributionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exposure-to-conversion-enabled" => Some(("exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "analytics-data-sharing-enabled" => Some(("analyticsDataSharingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "first-day-of-week" => Some(("firstDayOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "omniture-settings.omniture-cost-data-enabled" => Some(("omnitureSettings.omnitureCostDataEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "omniture-settings.omniture-integration-enabled" => Some(("omnitureSettings.omnitureIntegrationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-settings.dynamic-tag-enabled" => Some(("tagSettings.dynamicTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-settings.image-tag-enabled" => Some(("tagSettings.imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "in-app-attribution-tracking-enabled" => Some(("inAppAttributionTrackingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-viewability-metric.configuration.time-percent" => Some(("customViewabilityMetric.configuration.timePercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "custom-viewability-metric.configuration.time-millis" => Some(("customViewabilityMetric.configuration.timeMillis", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "custom-viewability-metric.configuration.viewability-percent" => Some(("customViewabilityMetric.configuration.viewabilityPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "custom-viewability-metric.configuration.audible" => Some(("customViewabilityMetric.configuration.audible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "custom-viewability-metric.id" => Some(("customViewabilityMetric.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-viewability-metric.name" => Some(("customViewabilityMetric.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "analytics-data-sharing-enabled", "audible", "click-duration", "configuration", "custom-viewability-metric", "dimension-name", "dynamic-tag-enabled", "etag", "exposure-to-conversion-enabled", "first-day-of-week", "id", "id-dimension-value", "image-tag-enabled", "in-app-attribution-tracking-enabled", "kind", "lookback-configuration", "match-type", "name", "natural-search-conversion-attribution-option", "omniture-cost-data-enabled", "omniture-integration-enabled", "omniture-settings", "post-impression-activities-duration", "subaccount-id", "tag-settings", "time-millis", "time-percent", "value", "viewability-percent"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightConfiguration = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_configurations().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "natural-search-conversion-attribution-option" => Some(("naturalSearchConversionAttributionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exposure-to-conversion-enabled" => Some(("exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "analytics-data-sharing-enabled" => Some(("analyticsDataSharingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "first-day-of-week" => Some(("firstDayOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "omniture-settings.omniture-cost-data-enabled" => Some(("omnitureSettings.omnitureCostDataEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "omniture-settings.omniture-integration-enabled" => Some(("omnitureSettings.omnitureIntegrationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-settings.dynamic-tag-enabled" => Some(("tagSettings.dynamicTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-settings.image-tag-enabled" => Some(("tagSettings.imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "in-app-attribution-tracking-enabled" => Some(("inAppAttributionTrackingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-viewability-metric.configuration.time-percent" => Some(("customViewabilityMetric.configuration.timePercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "custom-viewability-metric.configuration.time-millis" => Some(("customViewabilityMetric.configuration.timeMillis", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "custom-viewability-metric.configuration.viewability-percent" => Some(("customViewabilityMetric.configuration.viewabilityPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "custom-viewability-metric.configuration.audible" => Some(("customViewabilityMetric.configuration.audible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "custom-viewability-metric.id" => Some(("customViewabilityMetric.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-viewability-metric.name" => Some(("customViewabilityMetric.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "analytics-data-sharing-enabled", "audible", "click-duration", "configuration", "custom-viewability-metric", "dimension-name", "dynamic-tag-enabled", "etag", "exposure-to-conversion-enabled", "first-day-of-week", "id", "id-dimension-value", "image-tag-enabled", "in-app-attribution-tracking-enabled", "kind", "lookback-configuration", "match-type", "name", "natural-search-conversion-attribution-option", "omniture-cost-data-enabled", "omniture-integration-enabled", "omniture-settings", "post-impression-activities-duration", "subaccount-id", "tag-settings", "time-millis", "time-percent", "value", "viewability-percent"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightConfiguration = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_configurations().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _inventory_items_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.inventory_items().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _inventory_items_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.inventory_items().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "type" => { + call = call.type_(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-id" => { + call = call.add_site_id(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "order-id" => { + call = call.add_order_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "in-plan" => { + call = call.in_plan(arg_from_str(value.unwrap_or("false"), err, "in-plan", "boolean")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-id", "sort-field", "ids", "max-results", "page-token", "in-plan", "site-id", "sort-order", "type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _languages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.languages().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _metros_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.metros().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _mobile_apps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.mobile_apps().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _mobile_apps_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.mobile_apps().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "directories" => { + call = call.add_directories(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "directories", "search-string", "ids", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _mobile_carriers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.mobile_carriers().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _mobile_carriers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.mobile_carriers().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_system_versions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_system_versions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_system_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_system_versions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_systems_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_systems().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("dart-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_systems_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_systems().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _order_documents_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.order_documents().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _order_documents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.order_documents().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-id" => { + call = call.add_site_id(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "order-id" => { + call = call.add_order_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "approved" => { + call = call.approved(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-id", "search-string", "sort-field", "ids", "max-results", "page-token", "site-id", "sort-order", "approved"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _orders_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.orders().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _orders_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.orders().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-id" => { + call = call.add_site_id(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "site-id", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-type" => Some(("placementGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "child-placement-ids" => Some(("childPlacementIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.kind" => Some(("primaryPlacementIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.value" => Some(("primaryPlacementIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.dimension-name" => Some(("primaryPlacementIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.etag" => Some(("primaryPlacementIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.match-type" => Some(("primaryPlacementIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.id" => Some(("primaryPlacementIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "child-placement-ids", "comment", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "placement-group-type", "placement-strategy-id", "pricing-schedule", "pricing-type", "primary-placement-id", "primary-placement-id-dimension-value", "site-id", "site-id-dimension-value", "start-date", "subaccount-id", "testing-start-date", "time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-ids" => { + call = call.add_site_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "pricing-types" => { + call = call.add_pricing_types(value.unwrap_or("")); + }, + "placement-strategy-ids" => { + call = call.add_placement_strategy_ids(value.unwrap_or("")); + }, + "placement-group-type" => { + call = call.placement_group_type(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "min-start-date" => { + call = call.min_start_date(value.unwrap_or("")); + }, + "min-end-date" => { + call = call.min_end_date(value.unwrap_or("")); + }, + "max-start-date" => { + call = call.max_start_date(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "max-end-date" => { + call = call.max_end_date(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + "content-category-ids" => { + call = call.add_content_category_ids(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["placement-strategy-ids", "site-ids", "search-string", "min-end-date", "directory-site-ids", "sort-field", "advertiser-ids", "archived", "ids", "max-results", "min-start-date", "page-token", "max-start-date", "sort-order", "placement-group-type", "pricing-types", "content-category-ids", "campaign-ids", "max-end-date"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-type" => Some(("placementGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "child-placement-ids" => Some(("childPlacementIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.kind" => Some(("primaryPlacementIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.value" => Some(("primaryPlacementIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.dimension-name" => Some(("primaryPlacementIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.etag" => Some(("primaryPlacementIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.match-type" => Some(("primaryPlacementIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.id" => Some(("primaryPlacementIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "child-placement-ids", "comment", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "placement-group-type", "placement-strategy-id", "pricing-schedule", "pricing-type", "primary-placement-id", "primary-placement-id-dimension-value", "site-id", "site-id-dimension-value", "start-date", "subaccount-id", "testing-start-date", "time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-type" => Some(("placementGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "child-placement-ids" => Some(("childPlacementIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.kind" => Some(("primaryPlacementIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.value" => Some(("primaryPlacementIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.dimension-name" => Some(("primaryPlacementIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.etag" => Some(("primaryPlacementIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.match-type" => Some(("primaryPlacementIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.id" => Some(("primaryPlacementIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "child-placement-ids", "comment", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "placement-group-type", "placement-strategy-id", "pricing-schedule", "pricing-type", "primary-placement-id", "primary-placement-id-dimension-value", "site-id", "site-id-dimension-value", "start-date", "subaccount-id", "testing-start-date", "time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_strategies().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _placement_strategies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_strategies().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_strategies().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_strategies().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_strategies().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_strategies().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_generatetags(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placements().generatetags(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "tag-formats" => { + call = call.add_tag_formats(value.unwrap_or("")); + }, + "placement-ids" => { + call = call.add_placement_ids(value.unwrap_or("")); + }, + "campaign-id" => { + call = call.campaign_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["tag-formats", "placement-ids", "campaign-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placements().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-active-view-opt-out" => Some(("videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payment-source" => Some(("paymentSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.kind" => Some(("videoSettings.skippableSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skippable" => Some(("videoSettings.skippableSettings.skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-percentage" => Some(("videoSettings.skippableSettings.skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-seconds" => Some(("videoSettings.skippableSettings.skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-percentage" => Some(("videoSettings.skippableSettings.progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-seconds" => Some(("videoSettings.skippableSettings.progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.kind" => Some(("videoSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.kind" => Some(("videoSettings.companionSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.companions-disabled" => Some(("videoSettings.companionSettings.companionsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.companion-settings.image-only" => Some(("videoSettings.companionSettings.imageOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.orientation" => Some(("videoSettings.orientation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.kind" => Some(("videoSettings.transcodeSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.enabled-video-formats" => Some(("videoSettings.transcodeSettings.enabledVideoFormats", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "publisher-update-info.time" => Some(("publisherUpdateInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-formats" => Some(("tagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payment-approved" => Some(("paymentApproved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-through-urls" => Some(("tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-tracking" => Some(("tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.additional-key-values" => Some(("tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-setting.keyword-option" => Some(("tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-opt-out" => Some(("adBlockingOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary" => Some(("primary", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "placement-group-id" => Some(("placementGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.kind" => Some(("placementGroupIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.value" => Some(("placementGroupIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.dimension-name" => Some(("placementGroupIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.etag" => Some(("placementGroupIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.match-type" => Some(("placementGroupIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.id" => Some(("placementGroupIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vpaid-adapter-choice" => Some(("vpaidAdapterChoice", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "ad-blocking-opt-out", "additional-key-values", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "click-duration", "comment", "companion-settings", "companions-disabled", "compatibility", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "enabled-video-formats", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "height", "iab", "id", "id-dimension-value", "image-only", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "offset-percentage", "offset-seconds", "orientation", "payment-approved", "payment-source", "placement-group-id", "placement-group-id-dimension-value", "placement-strategy-id", "post-impression-activities-duration", "pricing-schedule", "pricing-type", "primary", "progress-offset", "publisher-update-info", "site-id", "site-id-dimension-value", "size", "skip-offset", "skippable", "skippable-settings", "ssl-required", "start-date", "status", "subaccount-id", "tag-formats", "tag-setting", "testing-start-date", "time", "transcode-settings", "value", "video-active-view-opt-out", "video-settings", "vpaid-adapter-choice", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Placement = json::value::from_value(object).unwrap(); + let mut call = self.hub.placements().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placements().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "size-ids" => { + call = call.add_size_ids(value.unwrap_or("")); + }, + "site-ids" => { + call = call.add_site_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "pricing-types" => { + call = call.add_pricing_types(value.unwrap_or("")); + }, + "placement-strategy-ids" => { + call = call.add_placement_strategy_ids(value.unwrap_or("")); + }, + "payment-source" => { + call = call.payment_source(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "min-start-date" => { + call = call.min_start_date(value.unwrap_or("")); + }, + "min-end-date" => { + call = call.min_end_date(value.unwrap_or("")); + }, + "max-start-date" => { + call = call.max_start_date(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "max-end-date" => { + call = call.max_end_date(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "group-ids" => { + call = call.add_group_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + "content-category-ids" => { + call = call.add_content_category_ids(value.unwrap_or("")); + }, + "compatibilities" => { + call = call.add_compatibilities(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["site-ids", "payment-source", "pricing-types", "campaign-ids", "archived", "advertiser-ids", "size-ids", "page-token", "max-start-date", "sort-order", "max-end-date", "placement-strategy-ids", "content-category-ids", "max-results", "min-start-date", "compatibilities", "search-string", "min-end-date", "directory-site-ids", "sort-field", "ids", "group-ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-active-view-opt-out" => Some(("videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payment-source" => Some(("paymentSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.kind" => Some(("videoSettings.skippableSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skippable" => Some(("videoSettings.skippableSettings.skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-percentage" => Some(("videoSettings.skippableSettings.skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-seconds" => Some(("videoSettings.skippableSettings.skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-percentage" => Some(("videoSettings.skippableSettings.progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-seconds" => Some(("videoSettings.skippableSettings.progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.kind" => Some(("videoSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.kind" => Some(("videoSettings.companionSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.companions-disabled" => Some(("videoSettings.companionSettings.companionsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.companion-settings.image-only" => Some(("videoSettings.companionSettings.imageOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.orientation" => Some(("videoSettings.orientation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.kind" => Some(("videoSettings.transcodeSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.enabled-video-formats" => Some(("videoSettings.transcodeSettings.enabledVideoFormats", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "publisher-update-info.time" => Some(("publisherUpdateInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-formats" => Some(("tagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payment-approved" => Some(("paymentApproved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-through-urls" => Some(("tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-tracking" => Some(("tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.additional-key-values" => Some(("tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-setting.keyword-option" => Some(("tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-opt-out" => Some(("adBlockingOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary" => Some(("primary", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "placement-group-id" => Some(("placementGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.kind" => Some(("placementGroupIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.value" => Some(("placementGroupIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.dimension-name" => Some(("placementGroupIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.etag" => Some(("placementGroupIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.match-type" => Some(("placementGroupIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.id" => Some(("placementGroupIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vpaid-adapter-choice" => Some(("vpaidAdapterChoice", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "ad-blocking-opt-out", "additional-key-values", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "click-duration", "comment", "companion-settings", "companions-disabled", "compatibility", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "enabled-video-formats", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "height", "iab", "id", "id-dimension-value", "image-only", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "offset-percentage", "offset-seconds", "orientation", "payment-approved", "payment-source", "placement-group-id", "placement-group-id-dimension-value", "placement-strategy-id", "post-impression-activities-duration", "pricing-schedule", "pricing-type", "primary", "progress-offset", "publisher-update-info", "site-id", "site-id-dimension-value", "size", "skip-offset", "skippable", "skippable-settings", "ssl-required", "start-date", "status", "subaccount-id", "tag-formats", "tag-setting", "testing-start-date", "time", "transcode-settings", "value", "video-active-view-opt-out", "video-settings", "vpaid-adapter-choice", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Placement = json::value::from_value(object).unwrap(); + let mut call = self.hub.placements().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-active-view-opt-out" => Some(("videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payment-source" => Some(("paymentSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.kind" => Some(("videoSettings.skippableSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skippable" => Some(("videoSettings.skippableSettings.skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-percentage" => Some(("videoSettings.skippableSettings.skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-seconds" => Some(("videoSettings.skippableSettings.skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-percentage" => Some(("videoSettings.skippableSettings.progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-seconds" => Some(("videoSettings.skippableSettings.progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.kind" => Some(("videoSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.kind" => Some(("videoSettings.companionSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.companions-disabled" => Some(("videoSettings.companionSettings.companionsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.companion-settings.image-only" => Some(("videoSettings.companionSettings.imageOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.orientation" => Some(("videoSettings.orientation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.kind" => Some(("videoSettings.transcodeSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.enabled-video-formats" => Some(("videoSettings.transcodeSettings.enabledVideoFormats", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "publisher-update-info.time" => Some(("publisherUpdateInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-formats" => Some(("tagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payment-approved" => Some(("paymentApproved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-through-urls" => Some(("tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-tracking" => Some(("tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.additional-key-values" => Some(("tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-setting.keyword-option" => Some(("tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-blocking-opt-out" => Some(("adBlockingOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary" => Some(("primary", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "placement-group-id" => Some(("placementGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.kind" => Some(("placementGroupIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.value" => Some(("placementGroupIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.dimension-name" => Some(("placementGroupIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.etag" => Some(("placementGroupIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.match-type" => Some(("placementGroupIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.id" => Some(("placementGroupIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "vpaid-adapter-choice" => Some(("vpaidAdapterChoice", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "ad-blocking-opt-out", "additional-key-values", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "click-duration", "comment", "companion-settings", "companions-disabled", "compatibility", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "enabled-video-formats", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "height", "iab", "id", "id-dimension-value", "image-only", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "offset-percentage", "offset-seconds", "orientation", "payment-approved", "payment-source", "placement-group-id", "placement-group-id-dimension-value", "placement-strategy-id", "post-impression-activities-duration", "pricing-schedule", "pricing-type", "primary", "progress-offset", "publisher-update-info", "site-id", "site-id-dimension-value", "size", "skip-offset", "skippable", "skippable-settings", "ssl-required", "start-date", "status", "subaccount-id", "tag-formats", "tag-setting", "testing-start-date", "time", "transcode-settings", "value", "video-active-view-opt-out", "video-settings", "vpaid-adapter-choice", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Placement = json::value::from_value(object).unwrap(); + let mut call = self.hub.placements().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _platform_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.platform_types().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _platform_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.platform_types().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _postal_codes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.postal_codes().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("code").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _postal_codes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.postal_codes().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _regions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.regions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_list_shares_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.remarketing_list_shares().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("remarketing-list-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_list_shares_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "shared-advertiser-ids" => Some(("sharedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-id" => Some(("remarketingListId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "shared-account-ids" => Some(("sharedAccountIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "remarketing-list-id", "shared-account-ids", "shared-advertiser-ids"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingListShare = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_list_shares().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("remarketing-list-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_list_shares_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "shared-advertiser-ids" => Some(("sharedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-id" => Some(("remarketingListId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "shared-account-ids" => Some(("sharedAccountIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "remarketing-list-id", "shared-account-ids", "shared-advertiser-ids"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingListShare = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_list_shares().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.remarketing_lists().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-size" => Some(("listSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "life-span" => Some(("lifeSpan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-source" => Some(("listSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "description", "dimension-name", "etag", "floodlight-activity-id", "floodlight-activity-name", "id", "kind", "life-span", "list-population-rule", "list-size", "list-source", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_lists().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.remarketing_lists().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "name" => { + call = call.name(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "floodlight-activity-id" => { + call = call.floodlight_activity_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["name", "sort-field", "max-results", "page-token", "sort-order", "active", "floodlight-activity-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-size" => Some(("listSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "life-span" => Some(("lifeSpan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-source" => Some(("listSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "description", "dimension-name", "etag", "floodlight-activity-id", "floodlight-activity-name", "id", "kind", "life-span", "list-population-rule", "list-size", "list-source", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_lists().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-size" => Some(("listSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "life-span" => Some(("lifeSpan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-source" => Some(("listSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "description", "dimension-name", "etag", "floodlight-activity-id", "floodlight-activity-name", "id", "kind", "life-span", "list-population-rule", "list-size", "list-source", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_lists().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_compatible_fields_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().compatible_fields_query(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _reports_files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut download_mode = false; + let mut call = self.hub.reports().files_get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or(""), opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + if !download_mode { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _reports_files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().files_list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["sort-field", "sort-order", "max-results", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "scope" => { + call = call.scope(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["sort-field", "max-results", "sort-order", "page-token", "scope"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_run(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().run(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "synchronous" => { + call = call.synchronous(arg_from_str(value.unwrap_or("false"), err, "synchronous", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["synchronous"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sites().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.kind" => Some(("videoSettings.skippableSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skippable" => Some(("videoSettings.skippableSettings.skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-percentage" => Some(("videoSettings.skippableSettings.skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-seconds" => Some(("videoSettings.skippableSettings.skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-percentage" => Some(("videoSettings.skippableSettings.progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-seconds" => Some(("videoSettings.skippableSettings.progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.kind" => Some(("videoSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.kind" => Some(("videoSettings.companionSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.companions-disabled" => Some(("videoSettings.companionSettings.companionsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.companion-settings.image-only" => Some(("videoSettings.companionSettings.imageOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.orientation" => Some(("videoSettings.orientation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.kind" => Some(("videoSettings.transcodeSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.enabled-video-formats" => Some(("videoSettings.transcodeSettings.enabledVideoFormats", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.active-view-opt-out" => Some(("siteSettings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.video-active-view-opt-out-template" => Some(("siteSettings.videoActiveViewOptOutTemplate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.disable-new-cookie" => Some(("siteSettings.disableNewCookie", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-through-urls" => Some(("siteSettings.tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-tracking" => Some(("siteSettings.tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.additional-key-values" => Some(("siteSettings.tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.tag-setting.keyword-option" => Some(("siteSettings.tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.vpaid-adapter-choice-template" => Some(("siteSettings.vpaidAdapterChoiceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.ad-blocking-opt-out" => Some(("siteSettings.adBlockingOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "approved" => Some(("approved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active-view-opt-out", "ad-blocking-opt-out", "additional-key-values", "approved", "companion-settings", "companions-disabled", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disable-new-cookie", "enabled-video-formats", "etag", "id", "id-dimension-value", "image-only", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "match-type", "name", "offset-percentage", "offset-seconds", "orientation", "progress-offset", "site-settings", "skip-offset", "skippable", "skippable-settings", "subaccount-id", "tag-setting", "transcode-settings", "value", "video-active-view-opt-out-template", "video-settings", "vpaid-adapter-choice-template"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Site = json::value::from_value(object).unwrap(); + let mut call = self.hub.sites().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sites().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unmapped-site" => { + call = call.unmapped_site(arg_from_str(value.unwrap_or("false"), err, "unmapped-site", "boolean")); + }, + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "approved" => { + call = call.approved(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); + }, + "ad-words-site" => { + call = call.ad_words_site(arg_from_str(value.unwrap_or("false"), err, "ad-words-site", "boolean")); + }, + "accepts-publisher-paid-placements" => { + call = call.accepts_publisher_paid_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-publisher-paid-placements", "boolean")); + }, + "accepts-interstitial-placements" => { + call = call.accepts_interstitial_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-interstitial-placements", "boolean")); + }, + "accepts-in-stream-video-placements" => { + call = call.accepts_in_stream_video_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-in-stream-video-placements", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["accepts-interstitial-placements", "accepts-publisher-paid-placements", "search-string", "subaccount-id", "directory-site-ids", "sort-field", "ids", "max-results", "page-token", "unmapped-site", "accepts-in-stream-video-placements", "ad-words-site", "campaign-ids", "approved", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.kind" => Some(("videoSettings.skippableSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skippable" => Some(("videoSettings.skippableSettings.skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-percentage" => Some(("videoSettings.skippableSettings.skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-seconds" => Some(("videoSettings.skippableSettings.skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-percentage" => Some(("videoSettings.skippableSettings.progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-seconds" => Some(("videoSettings.skippableSettings.progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.kind" => Some(("videoSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.kind" => Some(("videoSettings.companionSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.companions-disabled" => Some(("videoSettings.companionSettings.companionsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.companion-settings.image-only" => Some(("videoSettings.companionSettings.imageOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.orientation" => Some(("videoSettings.orientation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.kind" => Some(("videoSettings.transcodeSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.enabled-video-formats" => Some(("videoSettings.transcodeSettings.enabledVideoFormats", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.active-view-opt-out" => Some(("siteSettings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.video-active-view-opt-out-template" => Some(("siteSettings.videoActiveViewOptOutTemplate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.disable-new-cookie" => Some(("siteSettings.disableNewCookie", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-through-urls" => Some(("siteSettings.tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-tracking" => Some(("siteSettings.tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.additional-key-values" => Some(("siteSettings.tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.tag-setting.keyword-option" => Some(("siteSettings.tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.vpaid-adapter-choice-template" => Some(("siteSettings.vpaidAdapterChoiceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.ad-blocking-opt-out" => Some(("siteSettings.adBlockingOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "approved" => Some(("approved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active-view-opt-out", "ad-blocking-opt-out", "additional-key-values", "approved", "companion-settings", "companions-disabled", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disable-new-cookie", "enabled-video-formats", "etag", "id", "id-dimension-value", "image-only", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "match-type", "name", "offset-percentage", "offset-seconds", "orientation", "progress-offset", "site-settings", "skip-offset", "skippable", "skippable-settings", "subaccount-id", "tag-setting", "transcode-settings", "value", "video-active-view-opt-out-template", "video-settings", "vpaid-adapter-choice-template"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Site = json::value::from_value(object).unwrap(); + let mut call = self.hub.sites().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.kind" => Some(("videoSettings.skippableSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skippable" => Some(("videoSettings.skippableSettings.skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-percentage" => Some(("videoSettings.skippableSettings.skipOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.skip-offset.offset-seconds" => Some(("videoSettings.skippableSettings.skipOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-percentage" => Some(("videoSettings.skippableSettings.progressOffset.offsetPercentage", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.skippable-settings.progress-offset.offset-seconds" => Some(("videoSettings.skippableSettings.progressOffset.offsetSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-settings.kind" => Some(("videoSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.kind" => Some(("videoSettings.companionSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.companion-settings.companions-disabled" => Some(("videoSettings.companionSettings.companionsDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.companion-settings.image-only" => Some(("videoSettings.companionSettings.imageOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-settings.orientation" => Some(("videoSettings.orientation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.kind" => Some(("videoSettings.transcodeSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-settings.transcode-settings.enabled-video-formats" => Some(("videoSettings.transcodeSettings.enabledVideoFormats", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.active-view-opt-out" => Some(("siteSettings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.video-active-view-opt-out-template" => Some(("siteSettings.videoActiveViewOptOutTemplate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.disable-new-cookie" => Some(("siteSettings.disableNewCookie", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-through-urls" => Some(("siteSettings.tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-tracking" => Some(("siteSettings.tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.additional-key-values" => Some(("siteSettings.tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.tag-setting.keyword-option" => Some(("siteSettings.tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.vpaid-adapter-choice-template" => Some(("siteSettings.vpaidAdapterChoiceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.ad-blocking-opt-out" => Some(("siteSettings.adBlockingOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "approved" => Some(("approved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active-view-opt-out", "ad-blocking-opt-out", "additional-key-values", "approved", "companion-settings", "companions-disabled", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disable-new-cookie", "enabled-video-formats", "etag", "id", "id-dimension-value", "image-only", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "match-type", "name", "offset-percentage", "offset-seconds", "orientation", "progress-offset", "site-settings", "skip-offset", "skippable", "skippable-settings", "subaccount-id", "tag-setting", "transcode-settings", "value", "video-active-view-opt-out-template", "video-settings", "vpaid-adapter-choice-template"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Site = json::value::from_value(object).unwrap(); + let mut call = self.hub.sites().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sizes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sizes().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sizes_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "width" => Some(("width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "iab" => Some(("iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "height" => Some(("height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["height", "iab", "id", "kind", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Size = json::value::from_value(object).unwrap(); + let mut call = self.hub.sizes().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sizes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sizes().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "width" => { + call = call.width(arg_from_str(value.unwrap_or("-0"), err, "width", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "iab-standard" => { + call = call.iab_standard(arg_from_str(value.unwrap_or("false"), err, "iab-standard", "boolean")); + }, + "height" => { + call = call.height(arg_from_str(value.unwrap_or("-0"), err, "height", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["iab-standard", "width", "ids", "height"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.subaccounts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "available-permission-ids", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Subaccount = json::value::from_value(object).unwrap(); + let mut call = self.hub.subaccounts().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.subaccounts().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "available-permission-ids", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Subaccount = json::value::from_value(object).unwrap(); + let mut call = self.hub.subaccounts().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "available-permission-ids", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Subaccount = json::value::from_value(object).unwrap(); + let mut call = self.hub.subaccounts().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targetable_remarketing_lists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.targetable_remarketing_lists().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targetable_remarketing_lists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.targetable_remarketing_lists().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "name" => { + call = call.name(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["name", "sort-field", "max-results", "page-token", "sort-order", "active"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targeting_templates_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.targeting_templates().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targeting_templates_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "list-targeting-expression.expression" => Some(("listTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "day-part-targeting", "days-of-week", "dimension-name", "etag", "exclude-countries", "expression", "geo-targeting", "hours-of-day", "id", "key-value-targeting-expression", "kind", "list-targeting-expression", "match-type", "name", "subaccount-id", "user-local-time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TargetingTemplate = json::value::from_value(object).unwrap(); + let mut call = self.hub.targeting_templates().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targeting_templates_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.targeting_templates().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "advertiser-id", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targeting_templates_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "list-targeting-expression.expression" => Some(("listTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "day-part-targeting", "days-of-week", "dimension-name", "etag", "exclude-countries", "expression", "geo-targeting", "hours-of-day", "id", "key-value-targeting-expression", "kind", "list-targeting-expression", "match-type", "name", "subaccount-id", "user-local-time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TargetingTemplate = json::value::from_value(object).unwrap(); + let mut call = self.hub.targeting_templates().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targeting_templates_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "list-targeting-expression.expression" => Some(("listTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "day-part-targeting", "days-of-week", "dimension-name", "etag", "exclude-countries", "expression", "geo-targeting", "hours-of-day", "id", "key-value-targeting-expression", "kind", "list-targeting-expression", "match-type", "name", "subaccount-id", "user-local-time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TargetingTemplate = json::value::from_value(object).unwrap(); + let mut call = self.hub.targeting_templates().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_profiles().get(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_profiles().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permission_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permission_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permission_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permission_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permissions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permissions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_roles().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _user_roles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_roles().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-user-role-id" => Some(("parentUserRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "default-user-role", "id", "kind", "name", "parent-user-role-id", "subaccount-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UserRole = json::value::from_value(object).unwrap(); + let mut call = self.hub.user_roles().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_roles().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "account-user-role-only" => { + call = call.account_user_role_only(arg_from_str(value.unwrap_or("false"), err, "account-user-role-only", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "subaccount-id", "sort-field", "ids", "max-results", "page-token", "sort-order", "account-user-role-only"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-user-role-id" => Some(("parentUserRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "default-user-role", "id", "kind", "name", "parent-user-role-id", "subaccount-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UserRole = json::value::from_value(object).unwrap(); + let mut call = self.hub.user_roles().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-user-role-id" => Some(("parentUserRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "default-user-role", "id", "kind", "name", "parent-user-role-id", "subaccount-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UserRole = json::value::from_value(object).unwrap(); + let mut call = self.hub.user_roles().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _video_formats_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let id: i32 = arg_from_str(&opt.value_of("id").unwrap_or(""), err, "", "integer"); + let mut call = self.hub.video_formats().get(opt.value_of("profile-id").unwrap_or(""), id); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _video_formats_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.video_formats().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("account-active-ad-summaries", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_active_ad_summaries_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-active-ad-summaries".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("account-permission-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_permission_groups_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._account_permission_groups_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-permission-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("account-permissions", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_permissions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._account_permissions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-permissions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("account-user-profiles", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_user_profiles_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._account_user_profiles_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._account_user_profiles_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._account_user_profiles_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._account_user_profiles_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-user-profiles".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("accounts", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._accounts_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._accounts_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._accounts_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._accounts_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("accounts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("ads", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._ads_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._ads_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._ads_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._ads_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._ads_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("ads".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("advertiser-groups", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._advertiser_groups_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._advertiser_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._advertiser_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._advertiser_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._advertiser_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._advertiser_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("advertiser-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("advertiser-landing-pages", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._advertiser_landing_pages_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._advertiser_landing_pages_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._advertiser_landing_pages_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._advertiser_landing_pages_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._advertiser_landing_pages_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("advertiser-landing-pages".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("advertisers", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._advertisers_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._advertisers_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._advertisers_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._advertisers_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._advertisers_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("advertisers".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("browsers", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._browsers_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("browsers".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("campaign-creative-associations", Some(opt)) => { + match opt.subcommand() { + ("insert", Some(opt)) => { + call_result = self._campaign_creative_associations_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._campaign_creative_associations_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("campaign-creative-associations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("campaigns", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._campaigns_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._campaigns_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._campaigns_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._campaigns_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._campaigns_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("campaigns".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("change-logs", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._change_logs_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._change_logs_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("change-logs".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("cities", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._cities_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("cities".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("connection-types", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._connection_types_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._connection_types_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("connection-types".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("content-categories", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._content_categories_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._content_categories_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._content_categories_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._content_categories_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._content_categories_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._content_categories_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("content-categories".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("conversions", Some(opt)) => { + match opt.subcommand() { + ("batchinsert", Some(opt)) => { + call_result = self._conversions_batchinsert(opt, dry_run, &mut err); + }, + ("batchupdate", Some(opt)) => { + call_result = self._conversions_batchupdate(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("conversions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("countries", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._countries_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._countries_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("countries".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-assets", Some(opt)) => { + match opt.subcommand() { + ("insert", Some(opt)) => { + call_result = self._creative_assets_insert(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-assets".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-field-values", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._creative_field_values_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._creative_field_values_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creative_field_values_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creative_field_values_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creative_field_values_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creative_field_values_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-field-values".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-fields", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._creative_fields_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._creative_fields_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creative_fields_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creative_fields_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creative_fields_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creative_fields_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-fields".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._creative_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creative_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creative_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creative_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creative_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creatives", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._creatives_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creatives_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creatives_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creatives_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creatives_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creatives".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("dimension-values", Some(opt)) => { + match opt.subcommand() { + ("query", Some(opt)) => { + call_result = self._dimension_values_query(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("dimension-values".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("directory-sites", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._directory_sites_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._directory_sites_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._directory_sites_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("directory-sites".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("dynamic-targeting-keys", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._dynamic_targeting_keys_delete(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._dynamic_targeting_keys_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._dynamic_targeting_keys_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("dynamic-targeting-keys".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("event-tags", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._event_tags_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._event_tags_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._event_tags_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._event_tags_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._event_tags_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._event_tags_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("event-tags".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("files", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._files_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._files_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("files".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("floodlight-activities", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._floodlight_activities_delete(opt, dry_run, &mut err); + }, + ("generatetag", Some(opt)) => { + call_result = self._floodlight_activities_generatetag(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._floodlight_activities_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._floodlight_activities_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._floodlight_activities_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._floodlight_activities_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._floodlight_activities_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("floodlight-activities".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("floodlight-activity-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._floodlight_activity_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._floodlight_activity_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._floodlight_activity_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._floodlight_activity_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._floodlight_activity_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("floodlight-activity-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("floodlight-configurations", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._floodlight_configurations_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._floodlight_configurations_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._floodlight_configurations_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._floodlight_configurations_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("floodlight-configurations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("inventory-items", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._inventory_items_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._inventory_items_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("inventory-items".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("languages", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._languages_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("languages".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("metros", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._metros_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("metros".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("mobile-apps", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._mobile_apps_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._mobile_apps_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("mobile-apps".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("mobile-carriers", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._mobile_carriers_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._mobile_carriers_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("mobile-carriers".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("operating-system-versions", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._operating_system_versions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._operating_system_versions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operating-system-versions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("operating-systems", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._operating_systems_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._operating_systems_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operating-systems".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("order-documents", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._order_documents_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._order_documents_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("order-documents".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("orders", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._orders_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._orders_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("orders".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("placement-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._placement_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._placement_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._placement_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._placement_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._placement_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("placement-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("placement-strategies", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._placement_strategies_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._placement_strategies_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._placement_strategies_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._placement_strategies_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._placement_strategies_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._placement_strategies_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("placement-strategies".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("placements", Some(opt)) => { + match opt.subcommand() { + ("generatetags", Some(opt)) => { + call_result = self._placements_generatetags(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._placements_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._placements_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._placements_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._placements_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._placements_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("placements".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("platform-types", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._platform_types_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._platform_types_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("platform-types".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("postal-codes", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._postal_codes_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._postal_codes_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("postal-codes".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("projects", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._projects_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._projects_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("regions", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._regions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("regions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("remarketing-list-shares", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._remarketing_list_shares_get(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._remarketing_list_shares_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._remarketing_list_shares_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("remarketing-list-shares".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("remarketing-lists", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._remarketing_lists_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._remarketing_lists_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._remarketing_lists_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._remarketing_lists_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._remarketing_lists_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("remarketing-lists".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("reports", Some(opt)) => { + match opt.subcommand() { + ("compatible-fields-query", Some(opt)) => { + call_result = self._reports_compatible_fields_query(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._reports_delete(opt, dry_run, &mut err); + }, + ("files-get", Some(opt)) => { + call_result = self._reports_files_get(opt, dry_run, &mut err); + }, + ("files-list", Some(opt)) => { + call_result = self._reports_files_list(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._reports_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._reports_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._reports_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._reports_patch(opt, dry_run, &mut err); + }, + ("run", Some(opt)) => { + call_result = self._reports_run(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._reports_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("reports".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("sites", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._sites_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._sites_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._sites_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._sites_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._sites_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("sites".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("sizes", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._sizes_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._sizes_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._sizes_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("sizes".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("subaccounts", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._subaccounts_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._subaccounts_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._subaccounts_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._subaccounts_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._subaccounts_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("subaccounts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("targetable-remarketing-lists", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._targetable_remarketing_lists_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._targetable_remarketing_lists_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("targetable-remarketing-lists".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("targeting-templates", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._targeting_templates_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._targeting_templates_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._targeting_templates_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._targeting_templates_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._targeting_templates_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("targeting-templates".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-profiles", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._user_profiles_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_profiles_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-profiles".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-role-permission-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._user_role_permission_groups_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_role_permission_groups_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-role-permission-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-role-permissions", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._user_role_permissions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_role_permissions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-role-permissions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-roles", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._user_roles_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._user_roles_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._user_roles_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_roles_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._user_roles_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._user_roles_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-roles".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("video-formats", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._video_formats_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._video_formats_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("video-formats".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "dfareporting3d3-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "dfareporting3d3", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::Dfareporting::new(client, auth), + gp: vec!["alt", "fields", "key", "oauth-token", "pretty-print", "quota-user", "user-ip"], + gpm: vec![ + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("user-ip", "userIp"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let upload_value_names = ["mode", "file"]; + let arg_data = [ + ("account-active-ad-summaries", "methods: 'get'", vec![ + ("get", + Some(r##"Gets the account's active ad summary by account ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/account-active-ad-summaries_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"summary-account-id"##), + None, + Some(r##"Account ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("account-permission-groups", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one account permission group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/account-permission-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account permission group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of account permission groups."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/account-permission-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("account-permissions", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one account permission by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/account-permissions_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account permission ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of account permissions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/account-permissions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("account-user-profiles", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one account user profile by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/account-user-profiles_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new account user profile."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/account-user-profiles_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of account user profiles, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/account-user-profiles_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing account user profile. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/account-user-profiles_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing account user profile."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/account-user-profiles_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("accounts", "methods: 'get', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one account by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/accounts_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of accounts, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/accounts_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing account. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/accounts_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing account."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/accounts_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("ads", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one ad by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/ads_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Ad ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new ad."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/ads_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of ads, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/ads_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing ad. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/ads_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Ad ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing ad."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/ads_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("advertiser-groups", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing advertiser group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-groups_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one advertiser group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new advertiser group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of advertiser groups, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing advertiser group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing advertiser group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("advertiser-landing-pages", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one landing page by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-landing-pages_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Landing page ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new landing page."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-landing-pages_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of landing pages."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-landing-pages_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing landing page. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-landing-pages_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Landing page ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing landing page."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertiser-landing-pages_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("advertisers", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one advertiser by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertisers_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new advertiser."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertisers_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of advertisers, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertisers_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing advertiser. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertisers_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing advertiser."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/advertisers_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("browsers", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of browsers."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/browsers_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("campaign-creative-associations", "methods: 'insert' and 'list'", vec![ + ("insert", + Some(r##"Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/campaign-creative-associations_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Campaign ID in this association."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of creative IDs associated with the specified campaign. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/campaign-creative-associations_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Campaign ID in this association."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("campaigns", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one campaign by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/campaigns_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/campaigns_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of campaigns, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/campaigns_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing campaign. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/campaigns_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/campaigns_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("change-logs", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one change log by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/change-logs_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Change log ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of change logs. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/change-logs_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("cities", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of cities, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/cities_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("connection-types", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one connection type by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/connection-types_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Connection type ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of connection types."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/connection-types_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("content-categories", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing content category."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/content-categories_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Content category ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one content category by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/content-categories_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Content category ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new content category."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/content-categories_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of content categories, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/content-categories_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing content category. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/content-categories_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Content category ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing content category."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/content-categories_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("conversions", "methods: 'batchinsert' and 'batchupdate'", vec![ + ("batchinsert", + Some(r##"Inserts conversions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/conversions_batchinsert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("batchupdate", + Some(r##"Updates existing conversions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/conversions_batchupdate", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("countries", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one country by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/countries_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"dart-id"##), + None, + Some(r##"Country DART ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of countries."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/countries_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-assets", "methods: 'insert'", vec![ + ("insert", + Some(r##"Inserts a new creative asset."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-assets_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"advertiser-id"##), + None, + Some(r##"Advertiser ID of this creative. This is a required field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"mode"##), + Some(r##"u"##), + Some(r##"Specify the upload protocol (simple|resumable) and the file to upload"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-field-values", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing creative field value."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-field-values_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field Value ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one creative field value by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-field-values_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field Value ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative field value."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-field-values_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creative field values, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-field-values_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative field value. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-field-values_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field Value ID"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative field value."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-field-values_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-fields", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing creative field."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-fields_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one creative field by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-fields_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative field."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-fields_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creative fields, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-fields_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative field. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-fields_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field ID"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative field."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-fields_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one creative group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creative groups, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creative-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creatives", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one creative by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creatives_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creatives_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creatives, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creatives_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creatives_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/creatives_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("dimension-values", "methods: 'query'", vec![ + ("query", + Some(r##"Retrieves list of report dimension values for a list of filters."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/dimension-values_query", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("directory-sites", "methods: 'get', 'insert' and 'list'", vec![ + ("get", + Some(r##"Gets one directory site by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/directory-sites_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Directory site ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new directory site."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/directory-sites_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of directory sites, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/directory-sites_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("dynamic-targeting-keys", "methods: 'delete', 'insert' and 'list'", vec![ + ("delete", + Some(r##"Deletes an existing dynamic targeting key."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/dynamic-targeting-keys_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"object-id"##), + None, + Some(r##"ID of the object of this dynamic targeting key. This is a required field."##), + Some(true), + Some(false)), + + (Some(r##"name"##), + None, + Some(r##"Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase."##), + Some(true), + Some(false)), + + (Some(r##"object-type"##), + None, + Some(r##"Type of the object of this dynamic targeting key. This is a required field."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("insert", + Some(r##"Inserts a new dynamic targeting key. Keys must be created at the advertiser level before being assigned to the advertiser's ads, creatives, or placements. There is a maximum of 1000 keys per advertiser, out of which a maximum of 20 keys can be assigned per ad, creative, or placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/dynamic-targeting-keys_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of dynamic targeting keys."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/dynamic-targeting-keys_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("event-tags", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing event tag."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/event-tags_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Event tag ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one event tag by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/event-tags_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Event tag ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new event tag."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/event-tags_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of event tags, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/event-tags_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing event tag. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/event-tags_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Event tag ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing event tag."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/event-tags_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("files", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Retrieves a report file by its report ID and file ID. This method supports media download."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/files_get", + vec![ + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"file-id"##), + None, + Some(r##"The ID of the report file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists files for a user profile."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/files_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("floodlight-activities", "methods: 'delete', 'generatetag', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activities_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("generatetag", + Some(r##"Generates a tag for a floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activities_generatetag", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets one floodlight activity by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activities_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activities_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of floodlight activities, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activities_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing floodlight activity. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activities_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activities_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("floodlight-activity-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one floodlight activity group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activity-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity Group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new floodlight activity group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activity-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activity-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing floodlight activity group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activity-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity Group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing floodlight activity group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-activity-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("floodlight-configurations", "methods: 'get', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one floodlight configuration by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-configurations_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight configuration ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of floodlight configurations, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-configurations_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing floodlight configuration. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-configurations_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight configuration ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing floodlight configuration."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/floodlight-configurations_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("inventory-items", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one inventory item by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/inventory-items_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Inventory item ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of inventory items, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/inventory-items_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("languages", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of languages."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/languages_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("metros", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of metros."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/metros_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("mobile-apps", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one mobile app by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/mobile-apps_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Mobile app ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves list of available mobile apps."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/mobile-apps_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("mobile-carriers", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one mobile carrier by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/mobile-carriers_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Mobile carrier ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of mobile carriers."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/mobile-carriers_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("operating-system-versions", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one operating system version by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/operating-system-versions_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Operating system version ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of operating system versions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/operating-system-versions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("operating-systems", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one operating system by DART ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/operating-systems_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"dart-id"##), + None, + Some(r##"Operating system DART ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of operating systems."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/operating-systems_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("order-documents", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one order document by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/order-documents_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Order document ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of order documents, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/order-documents_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("orders", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one order by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/orders_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for orders."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Order ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of orders, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/orders_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for orders."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("placement-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one placement group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new placement group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of placement groups, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing placement group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing placement group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("placement-strategies", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing placement strategy."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-strategies_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement strategy ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one placement strategy by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-strategies_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement strategy ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new placement strategy."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-strategies_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of placement strategies, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-strategies_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing placement strategy. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-strategies_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement strategy ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing placement strategy."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placement-strategies_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("placements", "methods: 'generatetags', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("generatetags", + Some(r##"Generates tags for a placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placements_generatetags", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets one placement by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placements_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placements_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of placements, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placements_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing placement. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placements_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/placements_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("platform-types", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one platform type by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/platform-types_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Platform type ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of platform types."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/platform-types_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("postal-codes", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one postal code by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/postal-codes_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"code"##), + None, + Some(r##"Postal code ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of postal codes."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/postal-codes_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("projects", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one project by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/projects_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Project ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of projects, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/projects_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("regions", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of regions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/regions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("remarketing-list-shares", "methods: 'get', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one remarketing list share by remarketing list ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/remarketing-list-shares_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"remarketing-list-id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing remarketing list share. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/remarketing-list-shares_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"remarketing-list-id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing remarketing list share."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/remarketing-list-shares_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("remarketing-lists", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one remarketing list by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/remarketing-lists_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new remarketing list."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/remarketing-lists_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of remarketing lists, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/remarketing-lists_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"advertiser-id"##), + None, + Some(r##"Select only remarketing lists owned by this advertiser."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing remarketing list. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/remarketing-lists_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing remarketing list."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/remarketing-lists_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("reports", "methods: 'compatible-fields-query', 'delete', 'files-get', 'files-list', 'get', 'insert', 'list', 'patch', 'run' and 'update'", vec![ + ("compatible-fields-query", + Some(r##"Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/reports_compatible-fields-query", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes a report by its ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/reports_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("files-get", + Some(r##"Retrieves a report file. This method supports media download."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/reports_files-get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"file-id"##), + None, + Some(r##"The ID of the report file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("files-list", + Some(r##"Lists files for a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/reports_files-list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the parent report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Retrieves a report by its ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/reports_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Creates a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/reports_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves list of reports."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/reports_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates a report. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/reports_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("run", + Some(r##"Runs a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/reports_run", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/reports_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("sites", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one site by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/sites_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Site ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new site."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/sites_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of sites, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/sites_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing site. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/sites_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Site ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing site."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/sites_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("sizes", "methods: 'get', 'insert' and 'list'", vec![ + ("get", + Some(r##"Gets one size by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/sizes_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Size ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new size."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/sizes_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of sizes, possibly filtered. Retrieved sizes are globally unique and may include values not currently in use by your account. Due to this, the list of sizes returned by this method may differ from the list seen in the Trafficking UI."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/sizes_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("subaccounts", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one subaccount by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/subaccounts_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Subaccount ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new subaccount."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/subaccounts_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Gets a list of subaccounts, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/subaccounts_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing subaccount. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/subaccounts_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Subaccount ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing subaccount."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/subaccounts_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("targetable-remarketing-lists", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one remarketing list by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/targetable-remarketing-lists_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/targetable-remarketing-lists_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"advertiser-id"##), + None, + Some(r##"Select only targetable remarketing lists targetable by these advertisers."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("targeting-templates", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one targeting template by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/targeting-templates_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Targeting template ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new targeting template."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/targeting-templates_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of targeting templates, optionally filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/targeting-templates_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing targeting template. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/targeting-templates_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Targeting template ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing targeting template."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/targeting-templates_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-profiles", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one user profile by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-profiles_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves list of user profiles for a user."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-profiles_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-role-permission-groups", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one user role permission group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-role-permission-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role permission group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Gets a list of all supported user role permission groups."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-role-permission-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-role-permissions", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one user role permission by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-role-permissions_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role permission ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Gets a list of user role permissions, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-role-permissions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-roles", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing user role."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-roles_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one user role by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-roles_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new user role."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-roles_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of user roles, possibly filtered. This method supports paging."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-roles_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing user role. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-roles_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing user role."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/user-roles_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("video-formats", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one video format by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/video-formats_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Video format ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists available video formats."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli/video-formats_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("dfareporting3d3") + .author("Sebastian Thiel ") + .version("1.0.8+20190206") + .about("Manages your DoubleClick Campaign Manager ad campaigns and reports.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dfareporting3d3_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + if arg_name_str == "mode" { + arg = arg.number_of_values(2); + arg = arg.value_names(&upload_value_names); + + scmd = scmd.arg(Arg::with_name("mime") + .short("m") + .requires("mode") + .required(false) + .help("The file's mime time, like 'application/octet-stream'") + .takes_value(true)); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/dfareporting3d3/Cargo.toml b/gen/dfareporting3d3/Cargo.toml new file mode 100644 index 0000000000..41f1a10f9e --- /dev/null +++ b/gen/dfareporting3d3/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-dfareporting3d3" +version = "1.0.8+20190206" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with dfareporting (protocol v3.3)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting3d3" +homepage = "https://developers.google.com/doubleclick-advertisers/" +documentation = "https://docs.rs/google-dfareporting3d3/1.0.8+20190206" +license = "MIT" +keywords = ["dfareporting", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/dfareporting3d3/LICENSE.md b/gen/dfareporting3d3/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/dfareporting3d3/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/dfareporting3d3/README.md b/gen/dfareporting3d3/README.md new file mode 100644 index 0000000000..391c602107 --- /dev/null +++ b/gen/dfareporting3d3/README.md @@ -0,0 +1,323 @@ + +The `google-dfareporting3d3` library allows access to all features of the *Google dfareporting* service. + +This documentation was generated from *dfareporting* crate version *1.0.8+20190206*, where *20190206* is the exact revision of the *dfareporting:v3.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *dfareporting* *v3d3* API can be found at the +[official documentation site](https://developers.google.com/doubleclick-advertisers/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Dfareporting.html) ... + +* [account active ad summaries](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountActiveAdSummary.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountPermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountPermissionGroupListCall.html) +* [account permissions](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountPermission.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountPermissionListCall.html) +* [account user profiles](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountUserProfile.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountUserProfileUpdateCall.html) +* [accounts](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Account.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AccountUpdateCall.html) +* [ads](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Ad.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdUpdateCall.html) +* [advertiser groups](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserGroup.html) + * [*delete*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserGroupUpdateCall.html) +* advertiser landing pages + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserLandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserLandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserLandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserLandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserLandingPageUpdateCall.html) +* [advertisers](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Advertiser.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.AdvertiserUpdateCall.html) +* [browsers](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Browser.html) + * [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.BrowserListCall.html) +* [campaign creative associations](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CampaignCreativeAssociation.html) + * [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Campaign.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CampaignUpdateCall.html) +* [change logs](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ChangeLog.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ChangeLogListCall.html) +* [cities](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.City.html) + * [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CityListCall.html) +* [connection types](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ConnectionType.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ConnectionTypeListCall.html) +* [content categories](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ContentCategory.html) + * [*delete*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ContentCategoryUpdateCall.html) +* [conversions](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Conversion.html) + * [*batchinsert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ConversionBatchinsertCall.html) and [*batchupdate*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ConversionBatchupdateCall.html) +* [countries](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Country.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CountryListCall.html) +* [creative assets](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeAsset.html) + * [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeAssetInsertCall.html) +* [creative field values](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldValue.html) + * [*delete*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeField.html) + * [*delete*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeFieldUpdateCall.html) +* [creative groups](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeGroup.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeGroupUpdateCall.html) +* [creatives](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Creative.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeUpdateCall.html) +* [dimension values](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.DimensionValue.html) + * [*query*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.DimensionValueQueryCall.html) +* [directory sites](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.DirectorySite.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.DirectorySiteListCall.html) +* [dynamic targeting keys](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.DynamicTargetingKey.html) + * [*delete*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.DynamicTargetingKeyDeleteCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.DynamicTargetingKeyInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.DynamicTargetingKeyListCall.html) +* [event tags](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.EventTag.html) + * [*delete*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.EventTagUpdateCall.html) +* [files](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.File.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FileListCall.html) +* [floodlight activities](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivity.html) + * [*delete*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityGroup.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightConfiguration.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.InventoryItem.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.InventoryItemListCall.html) +* [languages](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Language.html) + * [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.LanguageListCall.html) +* [metros](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Metro.html) + * [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.MetroListCall.html) +* [mobile apps](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.MobileApp.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.MobileAppGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.MobileAppListCall.html) +* [mobile carriers](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.MobileCarrier.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.MobileCarrierListCall.html) +* [operating system versions](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OperatingSystemVersion.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OperatingSystemVersionListCall.html) +* [operating systems](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OperatingSystem.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OperatingSystemListCall.html) +* [order documents](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OrderDocument.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OrderDocumentListCall.html) +* [orders](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Order.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.OrderListCall.html) +* [placement groups](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementGroup.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementGroupUpdateCall.html) +* [placement strategies](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementStrategy.html) + * [*delete*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementStrategyUpdateCall.html) +* [placements](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Placement.html) + * [*generatetags*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlacementUpdateCall.html) +* [platform types](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlatformType.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PlatformTypeListCall.html) +* [postal codes](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PostalCode.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.PostalCodeListCall.html) +* [projects](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Project.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ProjectListCall.html) +* [regions](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Region.html) + * [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RegionListCall.html) +* [remarketing list shares](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RemarketingListShare.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.RemarketingListUpdateCall.html) +* [reports](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Report.html) + * [*compatible fields query*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportUpdateCall.html) +* [sites](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Site.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SiteUpdateCall.html) +* [sizes](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Size.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SizeListCall.html) +* [subaccounts](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Subaccount.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.TargetableRemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.TargetableRemarketingListListCall.html) +* [targeting templates](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.TargetingTemplate.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.TargetingTemplateGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.TargetingTemplateInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.TargetingTemplateListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.TargetingTemplatePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.TargetingTemplateUpdateCall.html) +* [user profiles](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserProfile.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserProfileListCall.html) +* [user role permission groups](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRolePermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRolePermission.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRolePermissionListCall.html) +* [user roles](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRole.html) + * [*delete*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.UserRoleUpdateCall.html) +* [video formats](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.VideoFormat.html) + * [*get*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.VideoFormatGetCall.html) and [*list*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.VideoFormatListCall.html) + + +Upload supported by ... + +* [*insert creative assets*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.CreativeAssetInsertCall.html) + +Download supported by ... + +* [*get files*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.FileGetCall.html) +* [*files get reports*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.ReportFileGetCall.html) + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/struct.Dfareporting.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.reports().run(...).doit() +let r = hub.reports().get(...).doit() +let r = hub.reports().list(...).doit() +let r = hub.reports().delete(...).doit() +let r = hub.reports().files_list(...).doit() +let r = hub.reports().insert(...).doit() +let r = hub.reports().patch(...).doit() +let r = hub.reports().compatible_fields_query(...).doit() +let r = hub.reports().update(...).doit() +let r = hub.reports().files_get(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-dfareporting3d3 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_dfareporting3d3 as dfareporting3d3; +use dfareporting3d3::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use dfareporting3d3::Dfareporting; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.reports().list("profileId") + .sort_order("sit") + .sort_field("Stet") + .scope("sed") + .page_token("et") + .max_results(-18) + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-dfareporting3d3/1.0.8+20190206/google_dfareporting3d3/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **dfareporting3d3** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/dfareporting3d3/src/cmn.rs b/gen/dfareporting3d3/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/dfareporting3d3/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/dfareporting3d3/src/lib.rs b/gen/dfareporting3d3/src/lib.rs new file mode 100644 index 0000000000..8d5e8da763 --- /dev/null +++ b/gen/dfareporting3d3/src/lib.rs @@ -0,0 +1,71809 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *dfareporting* crate version *1.0.8+20190206*, where *20190206* is the exact revision of the *dfareporting:v3.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *dfareporting* *v3d3* API can be found at the +//! [official documentation site](https://developers.google.com/doubleclick-advertisers/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting3d3). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Dfareporting.html) ... +//! +//! * [account active ad summaries](struct.AccountActiveAdSummary.html) +//! * [*get*](struct.AccountActiveAdSummaryGetCall.html) +//! * [account permission groups](struct.AccountPermissionGroup.html) +//! * [*get*](struct.AccountPermissionGroupGetCall.html) and [*list*](struct.AccountPermissionGroupListCall.html) +//! * [account permissions](struct.AccountPermission.html) +//! * [*get*](struct.AccountPermissionGetCall.html) and [*list*](struct.AccountPermissionListCall.html) +//! * [account user profiles](struct.AccountUserProfile.html) +//! * [*get*](struct.AccountUserProfileGetCall.html), [*insert*](struct.AccountUserProfileInsertCall.html), [*list*](struct.AccountUserProfileListCall.html), [*patch*](struct.AccountUserProfilePatchCall.html) and [*update*](struct.AccountUserProfileUpdateCall.html) +//! * [accounts](struct.Account.html) +//! * [*get*](struct.AccountGetCall.html), [*list*](struct.AccountListCall.html), [*patch*](struct.AccountPatchCall.html) and [*update*](struct.AccountUpdateCall.html) +//! * [ads](struct.Ad.html) +//! * [*get*](struct.AdGetCall.html), [*insert*](struct.AdInsertCall.html), [*list*](struct.AdListCall.html), [*patch*](struct.AdPatchCall.html) and [*update*](struct.AdUpdateCall.html) +//! * [advertiser groups](struct.AdvertiserGroup.html) +//! * [*delete*](struct.AdvertiserGroupDeleteCall.html), [*get*](struct.AdvertiserGroupGetCall.html), [*insert*](struct.AdvertiserGroupInsertCall.html), [*list*](struct.AdvertiserGroupListCall.html), [*patch*](struct.AdvertiserGroupPatchCall.html) and [*update*](struct.AdvertiserGroupUpdateCall.html) +//! * advertiser landing pages +//! * [*get*](struct.AdvertiserLandingPageGetCall.html), [*insert*](struct.AdvertiserLandingPageInsertCall.html), [*list*](struct.AdvertiserLandingPageListCall.html), [*patch*](struct.AdvertiserLandingPagePatchCall.html) and [*update*](struct.AdvertiserLandingPageUpdateCall.html) +//! * [advertisers](struct.Advertiser.html) +//! * [*get*](struct.AdvertiserGetCall.html), [*insert*](struct.AdvertiserInsertCall.html), [*list*](struct.AdvertiserListCall.html), [*patch*](struct.AdvertiserPatchCall.html) and [*update*](struct.AdvertiserUpdateCall.html) +//! * [browsers](struct.Browser.html) +//! * [*list*](struct.BrowserListCall.html) +//! * [campaign creative associations](struct.CampaignCreativeAssociation.html) +//! * [*insert*](struct.CampaignCreativeAssociationInsertCall.html) and [*list*](struct.CampaignCreativeAssociationListCall.html) +//! * [campaigns](struct.Campaign.html) +//! * [*get*](struct.CampaignGetCall.html), [*insert*](struct.CampaignInsertCall.html), [*list*](struct.CampaignListCall.html), [*patch*](struct.CampaignPatchCall.html) and [*update*](struct.CampaignUpdateCall.html) +//! * [change logs](struct.ChangeLog.html) +//! * [*get*](struct.ChangeLogGetCall.html) and [*list*](struct.ChangeLogListCall.html) +//! * [cities](struct.City.html) +//! * [*list*](struct.CityListCall.html) +//! * [connection types](struct.ConnectionType.html) +//! * [*get*](struct.ConnectionTypeGetCall.html) and [*list*](struct.ConnectionTypeListCall.html) +//! * [content categories](struct.ContentCategory.html) +//! * [*delete*](struct.ContentCategoryDeleteCall.html), [*get*](struct.ContentCategoryGetCall.html), [*insert*](struct.ContentCategoryInsertCall.html), [*list*](struct.ContentCategoryListCall.html), [*patch*](struct.ContentCategoryPatchCall.html) and [*update*](struct.ContentCategoryUpdateCall.html) +//! * [conversions](struct.Conversion.html) +//! * [*batchinsert*](struct.ConversionBatchinsertCall.html) and [*batchupdate*](struct.ConversionBatchupdateCall.html) +//! * [countries](struct.Country.html) +//! * [*get*](struct.CountryGetCall.html) and [*list*](struct.CountryListCall.html) +//! * [creative assets](struct.CreativeAsset.html) +//! * [*insert*](struct.CreativeAssetInsertCall.html) +//! * [creative field values](struct.CreativeFieldValue.html) +//! * [*delete*](struct.CreativeFieldValueDeleteCall.html), [*get*](struct.CreativeFieldValueGetCall.html), [*insert*](struct.CreativeFieldValueInsertCall.html), [*list*](struct.CreativeFieldValueListCall.html), [*patch*](struct.CreativeFieldValuePatchCall.html) and [*update*](struct.CreativeFieldValueUpdateCall.html) +//! * [creative fields](struct.CreativeField.html) +//! * [*delete*](struct.CreativeFieldDeleteCall.html), [*get*](struct.CreativeFieldGetCall.html), [*insert*](struct.CreativeFieldInsertCall.html), [*list*](struct.CreativeFieldListCall.html), [*patch*](struct.CreativeFieldPatchCall.html) and [*update*](struct.CreativeFieldUpdateCall.html) +//! * [creative groups](struct.CreativeGroup.html) +//! * [*get*](struct.CreativeGroupGetCall.html), [*insert*](struct.CreativeGroupInsertCall.html), [*list*](struct.CreativeGroupListCall.html), [*patch*](struct.CreativeGroupPatchCall.html) and [*update*](struct.CreativeGroupUpdateCall.html) +//! * [creatives](struct.Creative.html) +//! * [*get*](struct.CreativeGetCall.html), [*insert*](struct.CreativeInsertCall.html), [*list*](struct.CreativeListCall.html), [*patch*](struct.CreativePatchCall.html) and [*update*](struct.CreativeUpdateCall.html) +//! * [dimension values](struct.DimensionValue.html) +//! * [*query*](struct.DimensionValueQueryCall.html) +//! * [directory sites](struct.DirectorySite.html) +//! * [*get*](struct.DirectorySiteGetCall.html), [*insert*](struct.DirectorySiteInsertCall.html) and [*list*](struct.DirectorySiteListCall.html) +//! * [dynamic targeting keys](struct.DynamicTargetingKey.html) +//! * [*delete*](struct.DynamicTargetingKeyDeleteCall.html), [*insert*](struct.DynamicTargetingKeyInsertCall.html) and [*list*](struct.DynamicTargetingKeyListCall.html) +//! * [event tags](struct.EventTag.html) +//! * [*delete*](struct.EventTagDeleteCall.html), [*get*](struct.EventTagGetCall.html), [*insert*](struct.EventTagInsertCall.html), [*list*](struct.EventTagListCall.html), [*patch*](struct.EventTagPatchCall.html) and [*update*](struct.EventTagUpdateCall.html) +//! * [files](struct.File.html) +//! * [*get*](struct.FileGetCall.html) and [*list*](struct.FileListCall.html) +//! * [floodlight activities](struct.FloodlightActivity.html) +//! * [*delete*](struct.FloodlightActivityDeleteCall.html), [*generatetag*](struct.FloodlightActivityGeneratetagCall.html), [*get*](struct.FloodlightActivityGetCall.html), [*insert*](struct.FloodlightActivityInsertCall.html), [*list*](struct.FloodlightActivityListCall.html), [*patch*](struct.FloodlightActivityPatchCall.html) and [*update*](struct.FloodlightActivityUpdateCall.html) +//! * [floodlight activity groups](struct.FloodlightActivityGroup.html) +//! * [*get*](struct.FloodlightActivityGroupGetCall.html), [*insert*](struct.FloodlightActivityGroupInsertCall.html), [*list*](struct.FloodlightActivityGroupListCall.html), [*patch*](struct.FloodlightActivityGroupPatchCall.html) and [*update*](struct.FloodlightActivityGroupUpdateCall.html) +//! * [floodlight configurations](struct.FloodlightConfiguration.html) +//! * [*get*](struct.FloodlightConfigurationGetCall.html), [*list*](struct.FloodlightConfigurationListCall.html), [*patch*](struct.FloodlightConfigurationPatchCall.html) and [*update*](struct.FloodlightConfigurationUpdateCall.html) +//! * [inventory items](struct.InventoryItem.html) +//! * [*get*](struct.InventoryItemGetCall.html) and [*list*](struct.InventoryItemListCall.html) +//! * [languages](struct.Language.html) +//! * [*list*](struct.LanguageListCall.html) +//! * [metros](struct.Metro.html) +//! * [*list*](struct.MetroListCall.html) +//! * [mobile apps](struct.MobileApp.html) +//! * [*get*](struct.MobileAppGetCall.html) and [*list*](struct.MobileAppListCall.html) +//! * [mobile carriers](struct.MobileCarrier.html) +//! * [*get*](struct.MobileCarrierGetCall.html) and [*list*](struct.MobileCarrierListCall.html) +//! * [operating system versions](struct.OperatingSystemVersion.html) +//! * [*get*](struct.OperatingSystemVersionGetCall.html) and [*list*](struct.OperatingSystemVersionListCall.html) +//! * [operating systems](struct.OperatingSystem.html) +//! * [*get*](struct.OperatingSystemGetCall.html) and [*list*](struct.OperatingSystemListCall.html) +//! * [order documents](struct.OrderDocument.html) +//! * [*get*](struct.OrderDocumentGetCall.html) and [*list*](struct.OrderDocumentListCall.html) +//! * [orders](struct.Order.html) +//! * [*get*](struct.OrderGetCall.html) and [*list*](struct.OrderListCall.html) +//! * [placement groups](struct.PlacementGroup.html) +//! * [*get*](struct.PlacementGroupGetCall.html), [*insert*](struct.PlacementGroupInsertCall.html), [*list*](struct.PlacementGroupListCall.html), [*patch*](struct.PlacementGroupPatchCall.html) and [*update*](struct.PlacementGroupUpdateCall.html) +//! * [placement strategies](struct.PlacementStrategy.html) +//! * [*delete*](struct.PlacementStrategyDeleteCall.html), [*get*](struct.PlacementStrategyGetCall.html), [*insert*](struct.PlacementStrategyInsertCall.html), [*list*](struct.PlacementStrategyListCall.html), [*patch*](struct.PlacementStrategyPatchCall.html) and [*update*](struct.PlacementStrategyUpdateCall.html) +//! * [placements](struct.Placement.html) +//! * [*generatetags*](struct.PlacementGeneratetagCall.html), [*get*](struct.PlacementGetCall.html), [*insert*](struct.PlacementInsertCall.html), [*list*](struct.PlacementListCall.html), [*patch*](struct.PlacementPatchCall.html) and [*update*](struct.PlacementUpdateCall.html) +//! * [platform types](struct.PlatformType.html) +//! * [*get*](struct.PlatformTypeGetCall.html) and [*list*](struct.PlatformTypeListCall.html) +//! * [postal codes](struct.PostalCode.html) +//! * [*get*](struct.PostalCodeGetCall.html) and [*list*](struct.PostalCodeListCall.html) +//! * [projects](struct.Project.html) +//! * [*get*](struct.ProjectGetCall.html) and [*list*](struct.ProjectListCall.html) +//! * [regions](struct.Region.html) +//! * [*list*](struct.RegionListCall.html) +//! * [remarketing list shares](struct.RemarketingListShare.html) +//! * [*get*](struct.RemarketingListShareGetCall.html), [*patch*](struct.RemarketingListSharePatchCall.html) and [*update*](struct.RemarketingListShareUpdateCall.html) +//! * [remarketing lists](struct.RemarketingList.html) +//! * [*get*](struct.RemarketingListGetCall.html), [*insert*](struct.RemarketingListInsertCall.html), [*list*](struct.RemarketingListListCall.html), [*patch*](struct.RemarketingListPatchCall.html) and [*update*](struct.RemarketingListUpdateCall.html) +//! * [reports](struct.Report.html) +//! * [*compatible fields query*](struct.ReportCompatibleFieldQueryCall.html), [*delete*](struct.ReportDeleteCall.html), [*files get*](struct.ReportFileGetCall.html), [*files list*](struct.ReportFileListCall.html), [*get*](struct.ReportGetCall.html), [*insert*](struct.ReportInsertCall.html), [*list*](struct.ReportListCall.html), [*patch*](struct.ReportPatchCall.html), [*run*](struct.ReportRunCall.html) and [*update*](struct.ReportUpdateCall.html) +//! * [sites](struct.Site.html) +//! * [*get*](struct.SiteGetCall.html), [*insert*](struct.SiteInsertCall.html), [*list*](struct.SiteListCall.html), [*patch*](struct.SitePatchCall.html) and [*update*](struct.SiteUpdateCall.html) +//! * [sizes](struct.Size.html) +//! * [*get*](struct.SizeGetCall.html), [*insert*](struct.SizeInsertCall.html) and [*list*](struct.SizeListCall.html) +//! * [subaccounts](struct.Subaccount.html) +//! * [*get*](struct.SubaccountGetCall.html), [*insert*](struct.SubaccountInsertCall.html), [*list*](struct.SubaccountListCall.html), [*patch*](struct.SubaccountPatchCall.html) and [*update*](struct.SubaccountUpdateCall.html) +//! * [targetable remarketing lists](struct.TargetableRemarketingList.html) +//! * [*get*](struct.TargetableRemarketingListGetCall.html) and [*list*](struct.TargetableRemarketingListListCall.html) +//! * [targeting templates](struct.TargetingTemplate.html) +//! * [*get*](struct.TargetingTemplateGetCall.html), [*insert*](struct.TargetingTemplateInsertCall.html), [*list*](struct.TargetingTemplateListCall.html), [*patch*](struct.TargetingTemplatePatchCall.html) and [*update*](struct.TargetingTemplateUpdateCall.html) +//! * [user profiles](struct.UserProfile.html) +//! * [*get*](struct.UserProfileGetCall.html) and [*list*](struct.UserProfileListCall.html) +//! * [user role permission groups](struct.UserRolePermissionGroup.html) +//! * [*get*](struct.UserRolePermissionGroupGetCall.html) and [*list*](struct.UserRolePermissionGroupListCall.html) +//! * [user role permissions](struct.UserRolePermission.html) +//! * [*get*](struct.UserRolePermissionGetCall.html) and [*list*](struct.UserRolePermissionListCall.html) +//! * [user roles](struct.UserRole.html) +//! * [*delete*](struct.UserRoleDeleteCall.html), [*get*](struct.UserRoleGetCall.html), [*insert*](struct.UserRoleInsertCall.html), [*list*](struct.UserRoleListCall.html), [*patch*](struct.UserRolePatchCall.html) and [*update*](struct.UserRoleUpdateCall.html) +//! * [video formats](struct.VideoFormat.html) +//! * [*get*](struct.VideoFormatGetCall.html) and [*list*](struct.VideoFormatListCall.html) +//! +//! +//! Upload supported by ... +//! +//! * [*insert creative assets*](struct.CreativeAssetInsertCall.html) +//! +//! Download supported by ... +//! +//! * [*get files*](struct.FileGetCall.html) +//! * [*files get reports*](struct.ReportFileGetCall.html) +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Dfareporting.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.reports().run(...).doit() +//! let r = hub.reports().get(...).doit() +//! let r = hub.reports().list(...).doit() +//! let r = hub.reports().delete(...).doit() +//! let r = hub.reports().files_list(...).doit() +//! let r = hub.reports().insert(...).doit() +//! let r = hub.reports().patch(...).doit() +//! let r = hub.reports().compatible_fields_query(...).doit() +//! let r = hub.reports().update(...).doit() +//! let r = hub.reports().files_get(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-dfareporting3d3 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_dfareporting3d3 as dfareporting3d3; +//! use dfareporting3d3::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use dfareporting3d3::Dfareporting; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.reports().list("profileId") +//! .sort_order("accusam") +//! .sort_field("takimata") +//! .scope("justo") +//! .page_token("amet.") +//! .max_results(-81) +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your DoubleClick Campaign Manager's (DCM) display ad campaigns + Dfatrafficking, + + /// View and manage DoubleClick for Advertisers reports + Full, + + /// Manage DoubleClick Digital Marketing conversions + Ddmconversion, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::Dfatrafficking => "https://www.googleapis.com/auth/dfatrafficking", + Scope::Full => "https://www.googleapis.com/auth/dfareporting", + Scope::Ddmconversion => "https://www.googleapis.com/auth/ddmconversions", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::Full + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Dfareporting related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().list("profileId") +/// .sort_order("sea") +/// .sort_field("nonumy") +/// .scope("dolores") +/// .page_token("gubergren") +/// .max_results(-95) +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Dfareporting { + client: RefCell, + auth: RefCell
, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for Dfareporting {} + +impl<'a, C, A> Dfareporting + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Dfareporting { + Dfareporting { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://www.googleapis.com/dfareporting/v3.3/".to_string(), + _root_url: "https://www.googleapis.com/".to_string(), + } + } + + pub fn account_active_ad_summaries(&'a self) -> AccountActiveAdSummaryMethods<'a, C, A> { + AccountActiveAdSummaryMethods { hub: &self } + } + pub fn account_permission_groups(&'a self) -> AccountPermissionGroupMethods<'a, C, A> { + AccountPermissionGroupMethods { hub: &self } + } + pub fn account_permissions(&'a self) -> AccountPermissionMethods<'a, C, A> { + AccountPermissionMethods { hub: &self } + } + pub fn account_user_profiles(&'a self) -> AccountUserProfileMethods<'a, C, A> { + AccountUserProfileMethods { hub: &self } + } + pub fn accounts(&'a self) -> AccountMethods<'a, C, A> { + AccountMethods { hub: &self } + } + pub fn ads(&'a self) -> AdMethods<'a, C, A> { + AdMethods { hub: &self } + } + pub fn advertiser_groups(&'a self) -> AdvertiserGroupMethods<'a, C, A> { + AdvertiserGroupMethods { hub: &self } + } + pub fn advertiser_landing_pages(&'a self) -> AdvertiserLandingPageMethods<'a, C, A> { + AdvertiserLandingPageMethods { hub: &self } + } + pub fn advertisers(&'a self) -> AdvertiserMethods<'a, C, A> { + AdvertiserMethods { hub: &self } + } + pub fn browsers(&'a self) -> BrowserMethods<'a, C, A> { + BrowserMethods { hub: &self } + } + pub fn campaign_creative_associations(&'a self) -> CampaignCreativeAssociationMethods<'a, C, A> { + CampaignCreativeAssociationMethods { hub: &self } + } + pub fn campaigns(&'a self) -> CampaignMethods<'a, C, A> { + CampaignMethods { hub: &self } + } + pub fn change_logs(&'a self) -> ChangeLogMethods<'a, C, A> { + ChangeLogMethods { hub: &self } + } + pub fn cities(&'a self) -> CityMethods<'a, C, A> { + CityMethods { hub: &self } + } + pub fn connection_types(&'a self) -> ConnectionTypeMethods<'a, C, A> { + ConnectionTypeMethods { hub: &self } + } + pub fn content_categories(&'a self) -> ContentCategoryMethods<'a, C, A> { + ContentCategoryMethods { hub: &self } + } + pub fn conversions(&'a self) -> ConversionMethods<'a, C, A> { + ConversionMethods { hub: &self } + } + pub fn countries(&'a self) -> CountryMethods<'a, C, A> { + CountryMethods { hub: &self } + } + pub fn creative_assets(&'a self) -> CreativeAssetMethods<'a, C, A> { + CreativeAssetMethods { hub: &self } + } + pub fn creative_field_values(&'a self) -> CreativeFieldValueMethods<'a, C, A> { + CreativeFieldValueMethods { hub: &self } + } + pub fn creative_fields(&'a self) -> CreativeFieldMethods<'a, C, A> { + CreativeFieldMethods { hub: &self } + } + pub fn creative_groups(&'a self) -> CreativeGroupMethods<'a, C, A> { + CreativeGroupMethods { hub: &self } + } + pub fn creatives(&'a self) -> CreativeMethods<'a, C, A> { + CreativeMethods { hub: &self } + } + pub fn dimension_values(&'a self) -> DimensionValueMethods<'a, C, A> { + DimensionValueMethods { hub: &self } + } + pub fn directory_sites(&'a self) -> DirectorySiteMethods<'a, C, A> { + DirectorySiteMethods { hub: &self } + } + pub fn dynamic_targeting_keys(&'a self) -> DynamicTargetingKeyMethods<'a, C, A> { + DynamicTargetingKeyMethods { hub: &self } + } + pub fn event_tags(&'a self) -> EventTagMethods<'a, C, A> { + EventTagMethods { hub: &self } + } + pub fn files(&'a self) -> FileMethods<'a, C, A> { + FileMethods { hub: &self } + } + pub fn floodlight_activities(&'a self) -> FloodlightActivityMethods<'a, C, A> { + FloodlightActivityMethods { hub: &self } + } + pub fn floodlight_activity_groups(&'a self) -> FloodlightActivityGroupMethods<'a, C, A> { + FloodlightActivityGroupMethods { hub: &self } + } + pub fn floodlight_configurations(&'a self) -> FloodlightConfigurationMethods<'a, C, A> { + FloodlightConfigurationMethods { hub: &self } + } + pub fn inventory_items(&'a self) -> InventoryItemMethods<'a, C, A> { + InventoryItemMethods { hub: &self } + } + pub fn languages(&'a self) -> LanguageMethods<'a, C, A> { + LanguageMethods { hub: &self } + } + pub fn metros(&'a self) -> MetroMethods<'a, C, A> { + MetroMethods { hub: &self } + } + pub fn mobile_apps(&'a self) -> MobileAppMethods<'a, C, A> { + MobileAppMethods { hub: &self } + } + pub fn mobile_carriers(&'a self) -> MobileCarrierMethods<'a, C, A> { + MobileCarrierMethods { hub: &self } + } + pub fn operating_system_versions(&'a self) -> OperatingSystemVersionMethods<'a, C, A> { + OperatingSystemVersionMethods { hub: &self } + } + pub fn operating_systems(&'a self) -> OperatingSystemMethods<'a, C, A> { + OperatingSystemMethods { hub: &self } + } + pub fn order_documents(&'a self) -> OrderDocumentMethods<'a, C, A> { + OrderDocumentMethods { hub: &self } + } + pub fn orders(&'a self) -> OrderMethods<'a, C, A> { + OrderMethods { hub: &self } + } + pub fn placement_groups(&'a self) -> PlacementGroupMethods<'a, C, A> { + PlacementGroupMethods { hub: &self } + } + pub fn placement_strategies(&'a self) -> PlacementStrategyMethods<'a, C, A> { + PlacementStrategyMethods { hub: &self } + } + pub fn placements(&'a self) -> PlacementMethods<'a, C, A> { + PlacementMethods { hub: &self } + } + pub fn platform_types(&'a self) -> PlatformTypeMethods<'a, C, A> { + PlatformTypeMethods { hub: &self } + } + pub fn postal_codes(&'a self) -> PostalCodeMethods<'a, C, A> { + PostalCodeMethods { hub: &self } + } + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + pub fn regions(&'a self) -> RegionMethods<'a, C, A> { + RegionMethods { hub: &self } + } + pub fn remarketing_list_shares(&'a self) -> RemarketingListShareMethods<'a, C, A> { + RemarketingListShareMethods { hub: &self } + } + pub fn remarketing_lists(&'a self) -> RemarketingListMethods<'a, C, A> { + RemarketingListMethods { hub: &self } + } + pub fn reports(&'a self) -> ReportMethods<'a, C, A> { + ReportMethods { hub: &self } + } + pub fn sites(&'a self) -> SiteMethods<'a, C, A> { + SiteMethods { hub: &self } + } + pub fn sizes(&'a self) -> SizeMethods<'a, C, A> { + SizeMethods { hub: &self } + } + pub fn subaccounts(&'a self) -> SubaccountMethods<'a, C, A> { + SubaccountMethods { hub: &self } + } + pub fn targetable_remarketing_lists(&'a self) -> TargetableRemarketingListMethods<'a, C, A> { + TargetableRemarketingListMethods { hub: &self } + } + pub fn targeting_templates(&'a self) -> TargetingTemplateMethods<'a, C, A> { + TargetingTemplateMethods { hub: &self } + } + pub fn user_profiles(&'a self) -> UserProfileMethods<'a, C, A> { + UserProfileMethods { hub: &self } + } + pub fn user_role_permission_groups(&'a self) -> UserRolePermissionGroupMethods<'a, C, A> { + UserRolePermissionGroupMethods { hub: &self } + } + pub fn user_role_permissions(&'a self) -> UserRolePermissionMethods<'a, C, A> { + UserRolePermissionMethods { hub: &self } + } + pub fn user_roles(&'a self) -> UserRoleMethods<'a, C, A> { + UserRoleMethods { hub: &self } + } + pub fn video_formats(&'a self) -> VideoFormatMethods<'a, C, A> { + VideoFormatMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://www.googleapis.com/dfareporting/v3.3/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://www.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Operating System List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operating systems](struct.OperatingSystemListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystemsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemsListResponse". + pub kind: Option, + /// Operating system collection. + #[serde(rename="operatingSystems")] + pub operating_systems: Option>, +} + +impl ResponseResult for OperatingSystemsListResponse {} + + +/// A Conversion represents when a user successfully performs a desired action after seeing an ad. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batchinsert conversions](struct.ConversionBatchinsertCall.html) (none) +/// * [batchupdate conversions](struct.ConversionBatchupdateCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Conversion { + /// The ordinal of the conversion. Use this field to control how conversions of the same user and day are de-duplicated. This is a required field. + pub ordinal: Option, + /// The timestamp of conversion, in Unix epoch micros. This is a required field. + #[serde(rename="timestampMicros")] + pub timestamp_micros: Option, + /// Whether this particular request may come from a user under the age of 16 (may differ by country), under compliance with the European Union's General Data Protection Regulation (GDPR). + #[serde(rename="treatmentForUnderage")] + pub treatment_for_underage: Option, + /// The Google click ID. This field is mutually exclusive with encryptedUserId, encryptedUserIdCandidates[] and mobileDeviceId. This or encryptedUserId or encryptedUserIdCandidates[] or mobileDeviceId is a required field. + pub gclid: Option, + /// The mobile device ID. This field is mutually exclusive with encryptedUserId, encryptedUserIdCandidates[] and gclid. This or encryptedUserId or encryptedUserIdCandidates[] or gclid is a required field. + #[serde(rename="mobileDeviceId")] + pub mobile_device_id: Option, + /// Whether the conversion was for a non personalized ad. + #[serde(rename="nonPersonalizedAd")] + pub non_personalized_ad: Option, + /// The alphanumeric encrypted user ID. When set, encryptionInfo should also be specified. This field is mutually exclusive with encryptedUserIdCandidates[], mobileDeviceId and gclid. This or encryptedUserIdCandidates[] or mobileDeviceId or gclid is a required field. + #[serde(rename="encryptedUserId")] + pub encrypted_user_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversion". + pub kind: Option, + /// Whether this particular request may come from a user under the age of 13, under COPPA compliance. + #[serde(rename="childDirectedTreatment")] + pub child_directed_treatment: Option, + /// A list of the alphanumeric encrypted user IDs. Any user ID with exposure prior to the conversion timestamp will be used in the inserted conversion. If no such user ID is found then the conversion will be rejected with NO_COOKIE_MATCH_FOUND error. When set, encryptionInfo should also be specified. This field may only be used when calling batchinsert; it is not supported by batchupdate. This field is mutually exclusive with encryptedUserId, mobileDeviceId and gclid. This or encryptedUserId or mobileDeviceId or gclid is a required field. + #[serde(rename="encryptedUserIdCandidates")] + pub encrypted_user_id_candidates: Option>, + /// Custom floodlight variables. + #[serde(rename="customVariables")] + pub custom_variables: Option>, + /// Floodlight Configuration ID of this conversion. This is a required field. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// The value of the conversion. + pub value: Option, + /// Whether Limit Ad Tracking is enabled. When set to true, the conversion will be used for reporting but not targeting. This will prevent remarketing. + #[serde(rename="limitAdTracking")] + pub limit_ad_tracking: Option, + /// Floodlight Activity ID of this conversion. This is a required field. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, + /// The quantity of the conversion. + pub quantity: Option, +} + +impl Resource for Conversion {} + + +/// Contains information about a mobile carrier that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list mobile carriers](struct.MobileCarrierListCall.html) (none) +/// * [get mobile carriers](struct.MobileCarrierGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MobileCarrier { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileCarrier". + pub kind: Option, + /// DART ID of the country to which this mobile carrier belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// ID of this mobile carrier. + pub id: Option, + /// Country code of the country to which this mobile carrier belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Name of this mobile carrier. + pub name: Option, +} + +impl Resource for MobileCarrier {} +impl ResponseResult for MobileCarrier {} + + +/// Contains properties of a Campaign Manager subaccount. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get subaccounts](struct.SubaccountGetCall.html) (response) +/// * [update subaccounts](struct.SubaccountUpdateCall.html) (request|response) +/// * [patch subaccounts](struct.SubaccountPatchCall.html) (request|response) +/// * [list subaccounts](struct.SubaccountListCall.html) (none) +/// * [insert subaccounts](struct.SubaccountInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Subaccount { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#subaccount". + pub kind: Option, + /// ID of the account that contains this subaccount. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// IDs of the available user role permissions for this subaccount. + #[serde(rename="availablePermissionIds")] + pub available_permission_ids: Option>, + /// ID of this subaccount. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this subaccount. This is a required field. Must be less than 128 characters long and be unique among subaccounts of the same account. + pub name: Option, +} + +impl RequestValue for Subaccount {} +impl Resource for Subaccount {} +impl ResponseResult for Subaccount {} + + +/// AccountPermissionGroups contains a mapping of permission group IDs to names. A permission group is a grouping of account permissions. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permission groups](struct.AccountPermissionGroupListCall.html) (none) +/// * [get account permission groups](struct.AccountPermissionGroupGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermissionGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionGroup". + pub kind: Option, + /// ID of this account permission group. + pub id: Option, + /// Name of this account permission group. + pub name: Option, +} + +impl Resource for AccountPermissionGroup {} +impl ResponseResult for AccountPermissionGroup {} + + +/// Represents the list of DimensionValue resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query dimension values](struct.DimensionValueQueryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionValueList { + /// Continuation token used to page through dimension values. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The dimension values returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#dimensionValueList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for DimensionValueList {} + + +/// The attributes, like playtime and percent onscreen, that define the Custom Viewability Metric. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CustomViewabilityMetricConfiguration { + /// The percentage of video that must play for the Custom Viewability Metric to count an impression. If both this and timeMillis are specified, the earlier of the two will be used. + #[serde(rename="timePercent")] + pub time_percent: Option, + /// The time in milliseconds the video must play for the Custom Viewability Metric to count an impression. If both this and timePercent are specified, the earlier of the two will be used. + #[serde(rename="timeMillis")] + pub time_millis: Option, + /// The percentage of video that must be on screen for the Custom Viewability Metric to count an impression. + #[serde(rename="viewabilityPercent")] + pub viewability_percent: Option, + /// Whether the video must be audible to count an impression. + pub audible: Option, +} + +impl Part for CustomViewabilityMetricConfiguration {} + + +/// Campaign Creative Association List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list campaign creative associations](struct.CampaignCreativeAssociationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CampaignCreativeAssociationsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Campaign creative association collection + #[serde(rename="campaignCreativeAssociations")] + pub campaign_creative_associations: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignCreativeAssociationsListResponse". + pub kind: Option, +} + +impl ResponseResult for CampaignCreativeAssociationsListResponse {} + + +/// Directory Site Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySiteSettings { + /// Whether this site accepts interstitial ads. + #[serde(rename="interstitialPlacementAccepted")] + pub interstitial_placement_accepted: Option, + /// Whether this directory site has disabled active view creatives. + #[serde(rename="activeViewOptOut")] + pub active_view_opt_out: Option, + /// Directory site Ad Manager settings. + #[serde(rename="dfpSettings")] + pub dfp_settings: Option, + /// Whether this site accepts in-stream video ads. + #[serde(rename="instreamVideoPlacementAccepted")] + pub instream_video_placement_accepted: Option, +} + +impl Part for DirectorySiteSettings {} + + +/// User Role Permission Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user role permission groups](struct.UserRolePermissionGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermissionGroupsListResponse { + /// User role permission group collection. + #[serde(rename="userRolePermissionGroups")] + pub user_role_permission_groups: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionGroupsListResponse". + pub kind: Option, +} + +impl ResponseResult for UserRolePermissionGroupsListResponse {} + + +/// Represents the list of File resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list files](struct.FileListCall.html) (response) +/// * [files list reports](struct.ReportFileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileList { + /// Continuation token used to page through files. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The files returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#fileList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for FileList {} + + +/// Represents a Custom Rich Media Events group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CustomRichMediaEvents { + /// The kind of resource this is, in this case dfareporting#customRichMediaEvents. + pub kind: Option, + /// List of custom rich media event IDs. Dimension values must be all of type dfa:richMediaEventTypeIdAndName. + #[serde(rename="filteredEventIds")] + pub filtered_event_ids: Option>, +} + +impl Part for CustomRichMediaEvents {} + + +/// Event tag override information. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EventTagOverride { + /// Whether this override is enabled. + pub enabled: Option, + /// ID of this event tag override. This is a read-only, auto-generated field. + pub id: Option, +} + +impl Part for EventTagOverride {} + + +/// Contains information about a landing page deep link. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeepLink { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#deepLink". + pub kind: Option, + /// The mobile app targeted by this deep link. + #[serde(rename="mobileApp")] + pub mobile_app: Option, + /// The URL of the mobile app being linked to. + #[serde(rename="appUrl")] + pub app_url: Option, + /// The fallback URL. This URL will be served to users who do not have the mobile app installed. + #[serde(rename="fallbackUrl")] + pub fallback_url: Option, + /// Ads served to users on these remarketing lists will use this deep link. Applicable when mobileApp.directory is APPLE_APP_STORE. + #[serde(rename="remarketingListIds")] + pub remarketing_list_ids: Option>, +} + +impl Part for DeepLink {} + + +/// Video Offset +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VideoOffset { + /// Duration, as a percentage of video duration. Do not set when offsetSeconds is set. Acceptable values are 0 to 100, inclusive. + #[serde(rename="offsetPercentage")] + pub offset_percentage: Option, + /// Duration, in seconds. Do not set when offsetPercentage is set. Acceptable values are 0 to 86399, inclusive. + #[serde(rename="offsetSeconds")] + pub offset_seconds: Option, +} + +impl Part for VideoOffset {} + + +/// Update Conversions Request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batchupdate conversions](struct.ConversionBatchupdateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConversionsBatchUpdateRequest { + /// The set of conversions to update. + pub conversions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionsBatchUpdateRequest". + pub kind: Option, + /// Describes how encryptedUserId is encrypted. This is a required field if encryptedUserId is used. + #[serde(rename="encryptionInfo")] + pub encryption_info: Option, +} + +impl RequestValue for ConversionsBatchUpdateRequest {} + + +/// Change Log List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list change logs](struct.ChangeLogListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChangeLogsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#changeLogsListResponse". + pub kind: Option, + /// Change log collection. + #[serde(rename="changeLogs")] + pub change_logs: Option>, +} + +impl ResponseResult for ChangeLogsListResponse {} + + +/// Gets a summary of active ads in an account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get account active ad summaries](struct.AccountActiveAdSummaryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountActiveAdSummary { + /// Ads that can be activated for the account. + #[serde(rename="availableAds")] + pub available_ads: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountActiveAdSummary". + pub kind: Option, + /// ID of the account. + #[serde(rename="accountId")] + pub account_id: Option, + /// Ads that have been activated for the account + #[serde(rename="activeAds")] + pub active_ads: Option, + /// Maximum number of active ads allowed for the account. + #[serde(rename="activeAdsLimitTier")] + pub active_ads_limit_tier: Option, +} + +impl ResponseResult for AccountActiveAdSummary {} + + +/// Lookback configuration settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LookbackConfiguration { + /// Lookback window, in days, from the last time a given user clicked on one of your ads. If you enter 0, clicks will not be considered as triggering events for floodlight tracking. If you leave this field blank, the default value for your account will be used. Acceptable values are 0 to 90, inclusive. + #[serde(rename="clickDuration")] + pub click_duration: Option, + /// Lookback window, in days, from the last time a given user viewed one of your ads. If you enter 0, impressions will not be considered as triggering events for floodlight tracking. If you leave this field blank, the default value for your account will be used. Acceptable values are 0 to 90, inclusive. + #[serde(rename="postImpressionActivitiesDuration")] + pub post_impression_activities_duration: Option, +} + +impl Part for LookbackConfiguration {} + + +/// Floodlight Activity GenerateTag Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [generatetag floodlight activities](struct.FloodlightActivityGeneratetagCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivitiesGenerateTagResponse { + /// The global snippet section of a global site tag. The global site tag sets new cookies on your domain, which will store a unique identifier for a user or the ad click that brought the user to your site. Learn more. + #[serde(rename="globalSiteTagGlobalSnippet")] + pub global_site_tag_global_snippet: Option, + /// Generated tag for this Floodlight activity. For global site tags, this is the event snippet. + #[serde(rename="floodlightActivityTag")] + pub floodlight_activity_tag: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivitiesGenerateTagResponse". + pub kind: Option, +} + +impl ResponseResult for FloodlightActivitiesGenerateTagResponse {} + + +/// Remarketing List Population Rule Term. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListPopulationTerm { + /// ID of the list in question. This field is only relevant when type is set to LIST_MEMBERSHIP_TERM. + #[serde(rename="remarketingListId")] + pub remarketing_list_id: Option, + /// Will be true if the term should check if the user is in the list and false if the term should check if the user is not in the list. This field is only relevant when type is set to LIST_MEMBERSHIP_TERM. False by default. + pub contains: Option, + /// Whether to negate the comparison result of this term during rule evaluation. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM. + pub negation: Option, + /// Literal to compare the variable to. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM. + pub value: Option, + /// Friendly name of this term's variable. This is a read-only, auto-generated field. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM. + #[serde(rename="variableFriendlyName")] + pub variable_friendly_name: Option, + /// Comparison operator of this term. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM. + pub operator: Option, + /// List population term type determines the applicable fields in this object. If left unset or set to CUSTOM_VARIABLE_TERM, then variableName, variableFriendlyName, operator, value, and negation are applicable. If set to LIST_MEMBERSHIP_TERM then remarketingListId and contains are applicable. If set to REFERRER_TERM then operator, value, and negation are applicable. + #[serde(rename="type")] + pub type_: Option, + /// Name of the variable (U1, U2, etc.) being compared in this term. This field is only relevant when type is set to null, CUSTOM_VARIABLE_TERM or REFERRER_TERM. + #[serde(rename="variableName")] + pub variable_name: Option, +} + +impl Part for ListPopulationTerm {} + + +/// Site Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteSettings { + /// Default VPAID adapter setting for new placements created under this site. This value will be used to populate the placements.vpaidAdapterChoice field, when no value is specified for the new placement. Controls which VPAID format the measurement adapter will use for in-stream video creatives assigned to the placement. The publisher's specifications will typically determine this setting. For VPAID creatives, the adapter format will match the VPAID format (HTML5 VPAID creatives use the HTML5 adapter). + /// + /// Note: Flash is no longer supported. This field now defaults to HTML5 when the following values are provided: FLASH, BOTH. + #[serde(rename="vpaidAdapterChoiceTemplate")] + pub vpaid_adapter_choice_template: Option, + /// Whether this site opts out of ad blocking. When true, ad blocking is disabled for all placements under the site, regardless of the individual placement settings. When false, the campaign and placement settings take effect. + #[serde(rename="adBlockingOptOut")] + pub ad_blocking_opt_out: Option, + /// Whether active view creatives are disabled for this site. + #[serde(rename="activeViewOptOut")] + pub active_view_opt_out: Option, + /// Whether Verification and ActiveView for in-stream video creatives are disabled by default for new placements created under this site. This value will be used to populate the placement.videoActiveViewOptOut field, when no value is specified for the new placement. + #[serde(rename="videoActiveViewOptOutTemplate")] + pub video_active_view_opt_out_template: Option, + /// Whether new cookies are disabled for this site. + #[serde(rename="disableNewCookie")] + pub disable_new_cookie: Option, + /// Configuration settings for dynamic and image floodlight tags. + #[serde(rename="tagSetting")] + pub tag_setting: Option, +} + +impl Part for SiteSettings {} + + +/// AccountUserProfiles contains properties of a Campaign Manager user profile. This resource is specifically for managing user profiles, whereas UserProfiles is for accessing the API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch account user profiles](struct.AccountUserProfilePatchCall.html) (request|response) +/// * [list account user profiles](struct.AccountUserProfileListCall.html) (none) +/// * [insert account user profiles](struct.AccountUserProfileInsertCall.html) (request|response) +/// * [get account user profiles](struct.AccountUserProfileGetCall.html) (response) +/// * [update account user profiles](struct.AccountUserProfileUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountUserProfile { + /// Locale of the user profile. This is a required field. + /// Acceptable values are: + /// - "cs" (Czech) + /// - "de" (German) + /// - "en" (English) + /// - "en-GB" (English United Kingdom) + /// - "es" (Spanish) + /// - "fr" (French) + /// - "it" (Italian) + /// - "ja" (Japanese) + /// - "ko" (Korean) + /// - "pl" (Polish) + /// - "pt-BR" (Portuguese Brazil) + /// - "ru" (Russian) + /// - "sv" (Swedish) + /// - "tr" (Turkish) + /// - "zh-CN" (Chinese Simplified) + /// - "zh-TW" (Chinese Traditional) + pub locale: Option, + /// Filter that describes which sites are visible to the user profile. + #[serde(rename="siteFilter")] + pub site_filter: Option, + /// Filter that describes which campaigns are visible to the user profile. + #[serde(rename="campaignFilter")] + pub campaign_filter: Option, + /// User role ID of the user profile. This is a required field. + #[serde(rename="userRoleId")] + pub user_role_id: Option, + /// User type of the user profile. This is a read-only field that can be left blank. + #[serde(rename="userAccessType")] + pub user_access_type: Option, + /// Whether this user profile is active. This defaults to false, and must be set true on insert for the user profile to be usable. + pub active: Option, + /// ID of the user profile. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of the user profile. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountUserProfile". + pub kind: Option, + /// Subaccount ID of the user profile. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Filter that describes which user roles are visible to the user profile. + #[serde(rename="userRoleFilter")] + pub user_role_filter: Option, + /// Trafficker type of this user profile. This is a read-only field. + #[serde(rename="traffickerType")] + pub trafficker_type: Option, + /// Comments for this user profile. + pub comments: Option, + /// Name of the user profile. This is a required field. Must be less than 64 characters long, must be globally unique, and cannot contain whitespace or any of the following characters: "&;"#%,". + pub name: Option, + /// Filter that describes which advertisers are visible to the user profile. + #[serde(rename="advertiserFilter")] + pub advertiser_filter: Option, + /// Email of the user profile. The email addresss must be linked to a Google Account. This field is required on insertion and is read-only after insertion. + pub email: Option, +} + +impl RequestValue for AccountUserProfile {} +impl Resource for AccountUserProfile {} +impl ResponseResult for AccountUserProfile {} + + +/// Dynamic and Image Tag Settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TagSettings { + /// Whether dynamic floodlight tags are enabled. + #[serde(rename="dynamicTagEnabled")] + pub dynamic_tag_enabled: Option, + /// Whether image tags are enabled. + #[serde(rename="imageTagEnabled")] + pub image_tag_enabled: Option, +} + +impl Part for TagSettings {} + + +/// Contains properties of a targetable remarketing list. Remarketing enables you to create lists of users who have performed specific actions on a site, then target ads to members of those lists. This resource is a read-only view of a remarketing list to be used to faciliate targeting ads to specific lists. Remarketing lists that are owned by your advertisers and those that are shared to your advertisers or account are accessible via this resource. To manage remarketing lists that are owned by your advertisers, use the RemarketingLists resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list targetable remarketing lists](struct.TargetableRemarketingListListCall.html) (none) +/// * [get targetable remarketing lists](struct.TargetableRemarketingListGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetableRemarketingList { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetableRemarketingList". + pub kind: Option, + /// Subaccount ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Targetable remarketing list description. + pub description: Option, + /// Number of users currently in the list. This is a read-only field. + #[serde(rename="listSize")] + pub list_size: Option, + /// Number of days that a user should remain in the targetable remarketing list without an impression. + #[serde(rename="lifeSpan")] + pub life_span: Option, + /// Dimension value for the advertiser ID that owns this targetable remarketing list. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Product from which this targetable remarketing list was originated. + #[serde(rename="listSource")] + pub list_source: Option, + /// Whether this targetable remarketing list is active. + pub active: Option, + /// Dimension value for the ID of the advertiser. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Account ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="accountId")] + pub account_id: Option, + /// Targetable remarketing list ID. + pub id: Option, + /// Name of the targetable remarketing list. Is no greater than 128 characters long. + pub name: Option, +} + +impl Resource for TargetableRemarketingList {} +impl ResponseResult for TargetableRemarketingList {} + + +/// Contains information about a particular version of an operating system that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get operating system versions](struct.OperatingSystemVersionGetCall.html) (response) +/// * [list operating system versions](struct.OperatingSystemVersionListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystemVersion { + /// Major version (leftmost number) of this operating system version. + #[serde(rename="majorVersion")] + pub major_version: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemVersion". + pub kind: Option, + /// Minor version (number after the first dot) of this operating system version. + #[serde(rename="minorVersion")] + pub minor_version: Option, + /// Name of this operating system version. + pub name: Option, + /// Operating system of this operating system version. + #[serde(rename="operatingSystem")] + pub operating_system: Option, + /// ID of this operating system version. + pub id: Option, +} + +impl Resource for OperatingSystemVersion {} +impl ResponseResult for OperatingSystemVersion {} + + +/// Remarketing list response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list remarketing lists](struct.RemarketingListListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RemarketingListsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Remarketing list collection. + #[serde(rename="remarketingLists")] + pub remarketing_lists: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingListsListResponse". + pub kind: Option, +} + +impl ResponseResult for RemarketingListsListResponse {} + + +/// Campaign ad blocking settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdBlockingConfiguration { + /// ID of a creative bundle to use for this campaign. If set, brand-neutral ads will select creatives from this bundle. Otherwise, a default transparent pixel will be used. + #[serde(rename="creativeBundleId")] + pub creative_bundle_id: Option, + /// Click-through URL used by brand-neutral ads. This is a required field when overrideClickThroughUrl is set to true. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// Whether this campaign has enabled ad blocking. When true, ad blocking is enabled for placements in the campaign, but this may be overridden by site and placement settings. When false, ad blocking is disabled for all placements under the campaign, regardless of site and placement settings. + pub enabled: Option, + /// Whether the brand-neutral ad's click-through URL comes from the campaign's creative bundle or the override URL. Must be set to true if ad blocking is enabled and no creative bundle is configured. + #[serde(rename="overrideClickThroughUrl")] + pub override_click_through_url: Option, +} + +impl Part for AdBlockingConfiguration {} + + +/// Creative Field Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldAssignment { + /// ID of the creative field. + #[serde(rename="creativeFieldId")] + pub creative_field_id: Option, + /// ID of the creative field value. + #[serde(rename="creativeFieldValueId")] + pub creative_field_value_id: Option, +} + +impl Part for CreativeFieldAssignment {} + + +/// Remarketing List Population Rule. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListPopulationRule { + /// Floodlight activity ID associated with this rule. This field can be left blank. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, + /// Name of floodlight activity associated with this rule. This is a read-only, auto-generated field. + #[serde(rename="floodlightActivityName")] + pub floodlight_activity_name: Option, + /// Clauses that make up this list population rule. Clauses are joined by ANDs, and the clauses themselves are made up of list population terms which are joined by ORs. + #[serde(rename="listPopulationClauses")] + pub list_population_clauses: Option>, +} + +impl Part for ListPopulationRule {} + + +/// Contains properties of a Campaign Manager account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update accounts](struct.AccountUpdateCall.html) (request|response) +/// * [list accounts](struct.AccountListCall.html) (none) +/// * [get accounts](struct.AccountGetCall.html) (response) +/// * [patch accounts](struct.AccountPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Account { + /// File size limit in kilobytes of Rich Media teaser creatives. Acceptable values are 1 to 10240, inclusive. + #[serde(rename="teaserSizeLimit")] + pub teaser_size_limit: Option, + /// User role permissions available to the user roles of this account. + #[serde(rename="availablePermissionIds")] + pub available_permission_ids: Option>, + /// Description of this account. + pub description: Option, + /// Locale of this account. + /// Acceptable values are: + /// - "cs" (Czech) + /// - "de" (German) + /// - "en" (English) + /// - "en-GB" (English United Kingdom) + /// - "es" (Spanish) + /// - "fr" (French) + /// - "it" (Italian) + /// - "ja" (Japanese) + /// - "ko" (Korean) + /// - "pl" (Polish) + /// - "pt-BR" (Portuguese Brazil) + /// - "ru" (Russian) + /// - "sv" (Swedish) + /// - "tr" (Turkish) + /// - "zh-CN" (Chinese Simplified) + /// - "zh-TW" (Chinese Traditional) + pub locale: Option, + /// Profile for this account. This is a read-only field that can be left blank. + #[serde(rename="accountProfile")] + pub account_profile: Option, + /// Whether this account is active. + pub active: Option, + /// Whether to serve creatives with Active View tags. If disabled, viewability data will not be available for any impressions. + #[serde(rename="activeViewOptOut")] + pub active_view_opt_out: Option, + /// Share Path to Conversion reports with Twitter. + #[serde(rename="shareReportsWithTwitter")] + pub share_reports_with_twitter: Option, + /// ID of this account. This is a read-only, auto-generated field. + pub id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#account". + pub kind: Option, + /// ID of the country associated with this account. + #[serde(rename="countryId")] + pub country_id: Option, + /// Name of this account. This is a required field, and must be less than 128 characters long and be globally unique. + pub name: Option, + /// Maximum image size allowed for this account, in kilobytes. Value must be greater than or equal to 1. + #[serde(rename="maximumImageSize")] + pub maximum_image_size: Option, + /// Whether campaigns created in this account will be enabled for Nielsen OCR reach ratings by default. + #[serde(rename="nielsenOcrEnabled")] + pub nielsen_ocr_enabled: Option, + /// Default placement dimensions for this account. + #[serde(rename="defaultCreativeSizeId")] + pub default_creative_size_id: Option, + /// Account permissions assigned to this account. + #[serde(rename="accountPermissionIds")] + pub account_permission_ids: Option>, + /// ID of currency associated with this account. This is a required field. + /// Acceptable values are: + /// - "1" for USD + /// - "2" for GBP + /// - "3" for ESP + /// - "4" for SEK + /// - "5" for CAD + /// - "6" for JPY + /// - "7" for DEM + /// - "8" for AUD + /// - "9" for FRF + /// - "10" for ITL + /// - "11" for DKK + /// - "12" for NOK + /// - "13" for FIM + /// - "14" for ZAR + /// - "15" for IEP + /// - "16" for NLG + /// - "17" for EUR + /// - "18" for KRW + /// - "19" for TWD + /// - "20" for SGD + /// - "21" for CNY + /// - "22" for HKD + /// - "23" for NZD + /// - "24" for MYR + /// - "25" for BRL + /// - "26" for PTE + /// - "27" for MXP + /// - "28" for CLP + /// - "29" for TRY + /// - "30" for ARS + /// - "31" for PEN + /// - "32" for ILS + /// - "33" for CHF + /// - "34" for VEF + /// - "35" for COP + /// - "36" for GTQ + /// - "37" for PLN + /// - "39" for INR + /// - "40" for THB + /// - "41" for IDR + /// - "42" for CZK + /// - "43" for RON + /// - "44" for HUF + /// - "45" for RUB + /// - "46" for AED + /// - "47" for BGN + /// - "48" for HRK + /// - "49" for MXN + /// - "50" for NGN + #[serde(rename="currencyId")] + pub currency_id: Option, + /// Reporting configuration of this account. + #[serde(rename="reportsConfiguration")] + pub reports_configuration: Option, + /// Maximum number of active ads allowed for this account. + #[serde(rename="activeAdsLimitTier")] + pub active_ads_limit_tier: Option, +} + +impl RequestValue for Account {} +impl Resource for Account {} +impl ResponseResult for Account {} + + +/// Day Part Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DayPartTargeting { + /// Days of the week when the ad will serve. + /// + /// Acceptable values are: + /// - "SUNDAY" + /// - "MONDAY" + /// - "TUESDAY" + /// - "WEDNESDAY" + /// - "THURSDAY" + /// - "FRIDAY" + /// - "SATURDAY" + #[serde(rename="daysOfWeek")] + pub days_of_week: Option>, + /// Hours of the day when the ad will serve, where 0 is midnight to 1 AM and 23 is 11 PM to midnight. Can be specified with days of week, in which case the ad would serve during these hours on the specified days. For example if Monday, Wednesday, Friday are the days of week specified and 9-10am, 3-5pm (hours 9, 15, and 16) is specified, the ad would serve Monday, Wednesdays, and Fridays at 9-10am and 3-5pm. Acceptable values are 0 to 23, inclusive. + #[serde(rename="hoursOfDay")] + pub hours_of_day: Option>, + /// Whether or not to use the user's local time. If false, the America/New York time zone applies. + #[serde(rename="userLocalTime")] + pub user_local_time: Option, +} + +impl Part for DayPartTargeting {} + + +/// Represents a response to the queryCompatibleFields method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [compatible fields query reports](struct.ReportCompatibleFieldQueryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompatibleFields { + /// The kind of resource this is, in this case dfareporting#compatibleFields. + pub kind: Option, + /// Contains items that are compatible to be selected for a report of type "CROSS_DIMENSION_REACH". + #[serde(rename="crossDimensionReachReportCompatibleFields")] + pub cross_dimension_reach_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "REACH". + #[serde(rename="reachReportCompatibleFields")] + pub reach_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "PATH_TO_CONVERSION". + #[serde(rename="pathToConversionReportCompatibleFields")] + pub path_to_conversion_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "FLOODLIGHT". + #[serde(rename="floodlightReportCompatibleFields")] + pub floodlight_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "STANDARD". + #[serde(rename="reportCompatibleFields")] + pub report_compatible_fields: Option, +} + +impl ResponseResult for CompatibleFields {} + + +/// Contains information about a region that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list regions](struct.RegionListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Region { + /// Region code. + #[serde(rename="regionCode")] + pub region_code: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#region". + pub kind: Option, + /// DART ID of the country to which this region belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// Name of this region. + pub name: Option, + /// Country code of the country to which this region belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// DART ID of this region. + #[serde(rename="dartId")] + pub dart_id: Option, +} + +impl Resource for Region {} + + +/// The report criteria for a report of type "STANDARD". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportCriteria { + /// Activity group. + pub activities: Option, + /// The list of standard dimensions the report should include. + pub dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range for which this report should be run. + #[serde(rename="dateRange")] + pub date_range: Option, + /// Custom Rich Media Events group. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option, + /// The list of filters on which dimensions are filtered. + /// Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, +} + +impl NestedType for ReportCriteria {} +impl Part for ReportCriteria {} + + +/// Order List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list orders](struct.OrderListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrdersListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#ordersListResponse". + pub kind: Option, + /// Order collection. + pub orders: Option>, +} + +impl ResponseResult for OrdersListResponse {} + + +/// Represents fields that are compatible to be selected for a report of type "CROSS_DIMENSION_REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CrossDimensionReachReportCompatibleFields { + /// Dimensions which are compatible to be selected in the "breakdown" section of the report. + pub breakdown: Option>, + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#crossDimensionReachReportCompatibleFields. + pub kind: Option, + /// Metrics which are compatible to be selected in the "overlapMetricNames" section of the report. + #[serde(rename="overlapMetrics")] + pub overlap_metrics: Option>, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, +} + +impl Part for CrossDimensionReachReportCompatibleFields {} + + +/// The error code and description for a conversion that failed to insert or update. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConversionError { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionError". + pub kind: Option, + /// The error code. + pub code: Option, + /// A description of the error. + pub message: Option, +} + +impl Part for ConversionError {} + + +/// Event Tag List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list event tags](struct.EventTagListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EventTagsListResponse { + /// Event tag collection. + #[serde(rename="eventTags")] + pub event_tags: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#eventTagsListResponse". + pub kind: Option, +} + +impl ResponseResult for EventTagsListResponse {} + + +/// Contains properties of a Floodlight activity group. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight activity groups](struct.FloodlightActivityGroupListCall.html) (none) +/// * [get floodlight activity groups](struct.FloodlightActivityGroupGetCall.html) (response) +/// * [insert floodlight activity groups](struct.FloodlightActivityGroupInsertCall.html) (request|response) +/// * [patch floodlight activity groups](struct.FloodlightActivityGroupPatchCall.html) (request|response) +/// * [update floodlight activity groups](struct.FloodlightActivityGroupUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivityGroup". + pub kind: Option, + /// Subaccount ID of this floodlight activity group. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this floodlight activity group. This is a required field. Must be less than 65 characters long and cannot contain quotes. + pub name: Option, + /// Floodlight configuration ID of this floodlight activity group. This is a required field. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// Advertiser ID of this floodlight activity group. If this field is left blank, the value will be copied over either from the floodlight configuration's advertiser or from the existing activity group's advertiser. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="floodlightConfigurationIdDimensionValue")] + pub floodlight_configuration_id_dimension_value: Option, + /// Dimension value for the ID of this floodlight activity group. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Value of the type= parameter in the floodlight tag, which the ad servers use to identify the activity group that the activity belongs to. This is optional: if empty, a new tag string will be generated for you. This string must be 1 to 8 characters long, with valid characters being [a-z][A-Z][0-9][-][ _ ]. This tag string must also be unique among activity groups of the same floodlight configuration. This field is read-only after insertion. + #[serde(rename="tagString")] + pub tag_string: Option, + /// Type of the floodlight activity group. This is a required field that is read-only after insertion. + #[serde(rename="type")] + pub type_: Option, + /// ID of this floodlight activity group. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this floodlight activity group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for FloodlightActivityGroup {} +impl Resource for FloodlightActivityGroup {} +impl ResponseResult for FloodlightActivityGroup {} + + +/// Audience Segment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AudienceSegment { + /// Weight allocated to this segment. The weight assigned will be understood in proportion to the weights assigned to other segments in the same segment group. Acceptable values are 1 to 1000, inclusive. + pub allocation: Option, + /// ID of this audience segment. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this audience segment. This is a required field and must be less than 65 characters long. + pub name: Option, +} + +impl Part for AudienceSegment {} + + +/// Contains properties of a Campaign Manager campaign. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert campaigns](struct.CampaignInsertCall.html) (request|response) +/// * [update campaigns](struct.CampaignUpdateCall.html) (request|response) +/// * [patch campaigns](struct.CampaignPatchCall.html) (request|response) +/// * [get campaigns](struct.CampaignGetCall.html) (response) +/// * [list campaigns](struct.CampaignListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Campaign { + /// Arbitrary comments about this campaign. Must be less than 256 characters long. + pub comment: Option, + /// Date on which the campaign starts running. The start date can be any date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. This is a required field. + #[serde(rename="startDate")] + pub start_date: Option, + /// Date on which the campaign will stop running. On insert, the end date must be today or a future date. The end date must be later than or be the same as the start date. If, for example, you set 6/25/2015 as both the start and end dates, the effective campaign run date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. This is a required field. + #[serde(rename="endDate")] + pub end_date: Option, + /// Click-through URL suffix override properties for this campaign. + #[serde(rename="clickThroughUrlSuffixProperties")] + pub click_through_url_suffix_properties: Option, + /// Whether this campaign has been archived. + pub archived: Option, + /// Additional creative optimization configurations for the campaign. + #[serde(rename="additionalCreativeOptimizationConfigurations")] + pub additional_creative_optimization_configurations: Option>, + /// Advertiser ID of this campaign. This is a required field. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Audience segment groups assigned to this campaign. Cannot have more than 300 segment groups. + #[serde(rename="audienceSegmentGroups")] + pub audience_segment_groups: Option>, + /// The default landing page ID for this campaign. + #[serde(rename="defaultLandingPageId")] + pub default_landing_page_id: Option, + /// Click-through event tag ID override properties for this campaign. + #[serde(rename="defaultClickThroughEventTagProperties")] + pub default_click_through_event_tag_properties: Option, + /// Dimension value for the advertiser ID of this campaign. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Overrides that can be used to activate or deactivate advertiser event tags. + #[serde(rename="eventTagOverrides")] + pub event_tag_overrides: Option>, + /// Creative optimization configuration for the campaign. + #[serde(rename="creativeOptimizationConfiguration")] + pub creative_optimization_configuration: Option, + /// ID of this campaign. This is a read-only auto-generated field. + pub id: Option, + /// Account ID of this campaign. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Campaign trafficker contact emails. + #[serde(rename="traffickerEmails")] + pub trafficker_emails: Option>, + /// List of creative group IDs that are assigned to the campaign. + #[serde(rename="creativeGroupIds")] + pub creative_group_ids: Option>, + /// Ad blocking settings for this campaign. + #[serde(rename="adBlockingConfiguration")] + pub ad_blocking_configuration: Option, + /// Subaccount ID of this campaign. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this campaign. This is a required field and must be less than 256 characters long and unique among campaigns of the same advertiser. + pub name: Option, + /// Whether Nielsen reports are enabled for this campaign. + #[serde(rename="nielsenOcrEnabled")] + pub nielsen_ocr_enabled: Option, + /// Information about the most recent modification of this campaign. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Information about the creation of this campaign. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaign". + pub kind: Option, + /// External ID for this campaign. + #[serde(rename="externalId")] + pub external_id: Option, + /// Advertiser group ID of the associated advertiser. + #[serde(rename="advertiserGroupId")] + pub advertiser_group_id: Option, + /// Dimension value for the ID of this campaign. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Billing invoice code included in the Campaign Manager client billing invoices associated with the campaign. + #[serde(rename="billingInvoiceCode")] + pub billing_invoice_code: Option, +} + +impl RequestValue for Campaign {} +impl Resource for Campaign {} +impl ResponseResult for Campaign {} + + +/// Describes a change that a user has made to a resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list change logs](struct.ChangeLogListCall.html) (none) +/// * [get change logs](struct.ChangeLogGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChangeLog { + /// Time when the object was modified. + #[serde(rename="changeTime")] + pub change_time: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#changeLog". + pub kind: Option, + /// Subaccount ID of the modified object. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Old value of the object field. + #[serde(rename="oldValue")] + pub old_value: Option, + /// ID of the object of this change log. The object could be a campaign, placement, ad, or other type. + #[serde(rename="objectId")] + pub object_id: Option, + /// ID of this change log. + pub id: Option, + /// User profile name of the user who modified the object. + #[serde(rename="userProfileName")] + pub user_profile_name: Option, + /// Field name of the object which changed. + #[serde(rename="fieldName")] + pub field_name: Option, + /// ID of the user who modified the object. + #[serde(rename="userProfileId")] + pub user_profile_id: Option, + /// Action which caused the change. + pub action: Option, + /// Transaction ID of this change log. When a single API call results in many changes, each change will have a separate ID in the change log but will share the same transactionId. + #[serde(rename="transactionId")] + pub transaction_id: Option, + /// Account ID of the modified object. + #[serde(rename="accountId")] + pub account_id: Option, + /// New value of the object field. + #[serde(rename="newValue")] + pub new_value: Option, + /// Object type of the change log. + #[serde(rename="objectType")] + pub object_type: Option, +} + +impl Resource for ChangeLog {} +impl ResponseResult for ChangeLog {} + + +/// Tag Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TagSetting { + /// Whether static landing page URLs should be included in the tags. This setting applies only to placements. + #[serde(rename="includeClickThroughUrls")] + pub include_click_through_urls: Option, + /// Whether click-tracking string should be included in the tags. + #[serde(rename="includeClickTracking")] + pub include_click_tracking: Option, + /// Additional key-values to be included in tags. Each key-value pair must be of the form key=value, and pairs must be separated by a semicolon (;). Keys and values must not contain commas. For example, id=2;color=red is a valid value for this field. + #[serde(rename="additionalKeyValues")] + pub additional_key_values: Option, + /// Option specifying how keywords are embedded in ad tags. This setting can be used to specify whether keyword placeholders are inserted in placement tags for this site. Publishers can then add keywords to those placeholders. + #[serde(rename="keywordOption")] + pub keyword_option: Option, +} + +impl Part for TagSetting {} + + +/// Represents a File resource. A file contains the metadata for a report run. It shows the status of the run and holds the URLs to the generated report data if the run is finished and the status is "REPORT_AVAILABLE". +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get files](struct.FileGetCall.html) (response) +/// * [list files](struct.FileListCall.html) (none) +/// * [files get reports](struct.ReportFileGetCall.html) (response) +/// * [run reports](struct.ReportRunCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct File { + /// The status of the report file. + pub status: Option, + /// The kind of resource this is, in this case dfareporting#file. + pub kind: Option, + /// The output format of the report. Only available once the file is available. + pub format: Option, + /// The date range for which the file has report data. The date range will always be the absolute date range for which the report is run. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The filename of the file. + #[serde(rename="fileName")] + pub file_name: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// The ID of the report this file was generated from. + #[serde(rename="reportId")] + pub report_id: Option, + /// The URLs where the completed report file can be downloaded. + pub urls: Option, + /// The timestamp in milliseconds since epoch when this file was last modified. + #[serde(rename="lastModifiedTime")] + pub last_modified_time: Option, + /// The unique ID of this report file. + pub id: Option, +} + +impl Resource for File {} +impl ResponseResult for File {} + + +/// Key Value Targeting Expression. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct KeyValueTargetingExpression { + /// Keyword expression being targeted by the ad. + pub expression: Option, +} + +impl Part for KeyValueTargetingExpression {} + + +/// Transcode Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TranscodeSetting { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#transcodeSetting". + pub kind: Option, + /// Whitelist of video formats to be served to this placement. Set this list to null or empty to serve all video formats. + #[serde(rename="enabledVideoFormats")] + pub enabled_video_formats: Option>, +} + +impl Part for TranscodeSetting {} + + +/// The report criteria for a report of type "CROSS_DIMENSION_REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportCrossDimensionReachCriteria { + /// The list of dimensions the report should include. + pub breakdown: Option>, + /// Whether the report is pivoted or not. Defaults to true. + pub pivoted: Option, + /// The list of names of overlap metrics the report should include. + #[serde(rename="overlapMetricNames")] + pub overlap_metric_names: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of filters on which dimensions are filtered. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// The dimension option. + pub dimension: Option, +} + +impl NestedType for ReportCrossDimensionReachCriteria {} +impl Part for ReportCrossDimensionReachCriteria {} + + +/// Contains properties of a placement. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [generatetags placements](struct.PlacementGeneratetagCall.html) (none) +/// * [insert placements](struct.PlacementInsertCall.html) (request|response) +/// * [update placements](struct.PlacementUpdateCall.html) (request|response) +/// * [list placements](struct.PlacementListCall.html) (none) +/// * [get placements](struct.PlacementGetCall.html) (response) +/// * [patch placements](struct.PlacementPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Placement { + /// Comments for this placement. + pub comment: Option, + /// Whether Verification and ActiveView are disabled for in-stream video creatives for this placement. The same setting videoActiveViewOptOut exists on the site level -- the opt out occurs if either of these settings are true. These settings are distinct from DirectorySites.settings.activeViewOptOut or Sites.siteSettings.activeViewOptOut which only apply to display ads. However, Accounts.activeViewOptOut opts out both video traffic, as well as display ads, from Verification and ActiveView. + #[serde(rename="videoActiveViewOptOut")] + pub video_active_view_opt_out: Option, + /// Campaign ID of this placement. This field is a required field on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Payment source for this placement. This is a required field that is read-only after insertion. + #[serde(rename="paymentSource")] + pub payment_source: Option, + /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field. + #[serde(rename="directorySiteIdDimensionValue")] + pub directory_site_id_dimension_value: Option, + /// Advertiser ID of this placement. This field can be left blank. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Additional sizes associated with this placement. When inserting or updating a placement, only the size ID field is used. + #[serde(rename="additionalSizes")] + pub additional_sizes: Option>, + /// Key name of this placement. This is a read-only, auto-generated field. + #[serde(rename="keyName")] + pub key_name: Option, + /// Directory site ID of this placement. On insert, you must set either this field or the siteId field to specify the site associated with this placement. This is a required field that is read-only after insertion. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of the content category assigned to this placement. + #[serde(rename="contentCategoryId")] + pub content_category_id: Option, + /// Account ID of this placement. This field can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Whether this placement is archived. + pub archived: Option, + /// A collection of settings which affect video creatives served through this placement. Applicable to placements with IN_STREAM_VIDEO compatibility. + #[serde(rename="videoSettings")] + pub video_settings: Option, + /// Information about the last publisher update. This is a read-only field. + #[serde(rename="publisherUpdateInfo")] + pub publisher_update_info: Option, + /// Tag formats to generate for this placement. This field is required on insertion. + /// Acceptable values are: + /// - "PLACEMENT_TAG_STANDARD" + /// - "PLACEMENT_TAG_IFRAME_JAVASCRIPT" + /// - "PLACEMENT_TAG_IFRAME_ILAYER" + /// - "PLACEMENT_TAG_INTERNAL_REDIRECT" + /// - "PLACEMENT_TAG_JAVASCRIPT" + /// - "PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT" + /// - "PLACEMENT_TAG_INTERSTITIAL_INTERNAL_REDIRECT" + /// - "PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT" + /// - "PLACEMENT_TAG_CLICK_COMMANDS" + /// - "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH" + /// - "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH_VAST_3" + /// - "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH_VAST_4" + /// - "PLACEMENT_TAG_TRACKING" + /// - "PLACEMENT_TAG_TRACKING_IFRAME" + /// - "PLACEMENT_TAG_TRACKING_JAVASCRIPT" + #[serde(rename="tagFormats")] + pub tag_formats: Option>, + /// Whether payment was approved for this placement. This is a read-only field relevant only to publisher-paid placements. + #[serde(rename="paymentApproved")] + pub payment_approved: Option, + /// Tag settings for this placement. + #[serde(rename="tagSetting")] + pub tag_setting: Option, + /// ID of this placement. This is a read-only, auto-generated field. + pub id: Option, + /// Whether this placement opts out of ad blocking. When true, ad blocking is disabled for this placement. When false, the campaign and site settings take effect. + #[serde(rename="adBlockingOptOut")] + pub ad_blocking_opt_out: Option, + /// External ID for this placement. + #[serde(rename="externalId")] + pub external_id: Option, + /// Dimension value for the ID of this placement. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Size associated with this placement. When inserting or updating a placement, only the size ID field is used. This field is required on insertion. + pub size: Option, + /// Whether creatives assigned to this placement must be SSL-compliant. + #[serde(rename="sslRequired")] + pub ssl_required: Option, + /// Third-party placement status. + pub status: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Whether this placement is the primary placement of a roadblock (placement group). You cannot change this field from true to false. Setting this field to true will automatically set the primary field on the original primary placement of the roadblock to false, and it will automatically set the roadblock's primaryPlacementId field to the ID of this placement. + pub primary: Option, + /// ID of this placement's group, if applicable. + #[serde(rename="placementGroupId")] + pub placement_group_id: Option, + /// Information about the creation of this placement. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Site ID associated with this placement. On insert, you must set either this field or the directorySiteId field to specify the site associated with this placement. This is a required field that is read-only after insertion. + #[serde(rename="siteId")] + pub site_id: Option, + /// Dimension value for the ID of the site. This is a read-only, auto-generated field. + #[serde(rename="siteIdDimensionValue")] + pub site_id_dimension_value: Option, + /// Placement compatibility. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering on desktop, on mobile devices or in mobile apps for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are no longer allowed for new placement insertions. Instead, use DISPLAY or DISPLAY_INTERSTITIAL. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. This field is required on insertion. + pub compatibility: Option, + /// ID of the placement strategy assigned to this placement. + #[serde(rename="placementStrategyId")] + pub placement_strategy_id: Option, + /// Dimension value for the ID of the placement group. This is a read-only, auto-generated field. + #[serde(rename="placementGroupIdDimensionValue")] + pub placement_group_id_dimension_value: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placement". + pub kind: Option, + /// Subaccount ID of this placement. This field can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this placement.This is a required field and must be less than 256 characters long. + pub name: Option, + /// Lookback window settings for this placement. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, + /// Information about the most recent modification of this placement. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Pricing schedule of this placement. This field is required on insertion, specifically subfields startDate, endDate and pricingType. + #[serde(rename="pricingSchedule")] + pub pricing_schedule: Option, + /// VPAID adapter setting for this placement. Controls which VPAID format the measurement adapter will use for in-stream video creatives assigned to this placement. + /// + /// Note: Flash is no longer supported. This field now defaults to HTML5 when the following values are provided: FLASH, BOTH. + #[serde(rename="vpaidAdapterChoice")] + pub vpaid_adapter_choice: Option, +} + +impl RequestValue for Placement {} +impl Resource for Placement {} +impl ResponseResult for Placement {} + + +/// Inventory item List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list inventory items](struct.InventoryItemListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InventoryItemsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#inventoryItemsListResponse". + pub kind: Option, + /// Inventory item collection + #[serde(rename="inventoryItems")] + pub inventory_items: Option>, +} + +impl ResponseResult for InventoryItemsListResponse {} + + +/// Audience Segment Group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AudienceSegmentGroup { + /// Audience segments assigned to this group. The number of segments must be between 2 and 100. + #[serde(rename="audienceSegments")] + pub audience_segments: Option>, + /// ID of this audience segment group. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this audience segment group. This is a required field and must be less than 65 characters long. + pub name: Option, +} + +impl Part for AudienceSegmentGroup {} + + +/// Contains properties of a placement strategy. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch placement strategies](struct.PlacementStrategyPatchCall.html) (request|response) +/// * [insert placement strategies](struct.PlacementStrategyInsertCall.html) (request|response) +/// * [get placement strategies](struct.PlacementStrategyGetCall.html) (response) +/// * [update placement strategies](struct.PlacementStrategyUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementStrategy { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementStrategy". + pub kind: Option, + /// Account ID of this placement strategy.This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this placement strategy. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this placement strategy. This is a required field. It must be less than 256 characters long and unique among placement strategies of the same account. + pub name: Option, +} + +impl RequestValue for PlacementStrategy {} +impl ResponseResult for PlacementStrategy {} + + +/// Creative optimization activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OptimizationActivity { + /// Floodlight activity ID of this optimization activity. This is a required field. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, + /// Dimension value for the ID of the floodlight activity. This is a read-only, auto-generated field. + #[serde(rename="floodlightActivityIdDimensionValue")] + pub floodlight_activity_id_dimension_value: Option, + /// Weight associated with this optimization. The weight assigned will be understood in proportion to the weights assigned to the other optimization activities. Value must be greater than or equal to 1. + pub weight: Option, +} + +impl Part for OptimizationActivity {} + + +/// Placement Tag +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementTag { + /// Tags generated for this placement. + #[serde(rename="tagDatas")] + pub tag_datas: Option>, + /// Placement ID + #[serde(rename="placementId")] + pub placement_id: Option, +} + +impl Part for PlacementTag {} + + +/// Country List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list countries](struct.CountryListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CountriesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#countriesListResponse". + pub kind: Option, + /// Country collection. + pub countries: Option>, +} + +impl ResponseResult for CountriesListResponse {} + + +/// Click-through URL +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClickThroughUrl { + /// Read-only convenience field representing the actual URL that will be used for this click-through. The URL is computed as follows: + /// - If defaultLandingPage is enabled then the campaign's default landing page URL is assigned to this field. + /// - If defaultLandingPage is not enabled and a landingPageId is specified then that landing page's URL is assigned to this field. + /// - If neither of the above cases apply, then the customClickThroughUrl is assigned to this field. + #[serde(rename="computedClickThroughUrl")] + pub computed_click_through_url: Option, + /// Custom click-through URL. Applicable if the defaultLandingPage field is set to false and the landingPageId field is left unset. + #[serde(rename="customClickThroughUrl")] + pub custom_click_through_url: Option, + /// ID of the landing page for the click-through URL. Applicable if the defaultLandingPage field is set to false. + #[serde(rename="landingPageId")] + pub landing_page_id: Option, + /// Whether the campaign default landing page is used. + #[serde(rename="defaultLandingPage")] + pub default_landing_page: Option, +} + +impl Part for ClickThroughUrl {} + + +/// Companion Click-through override. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompanionClickThroughOverride { + /// Click-through URL of this companion click-through override. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// ID of the creative for this companion click-through override. + #[serde(rename="creativeId")] + pub creative_id: Option, +} + +impl Part for CompanionClickThroughOverride {} + + +/// Frequency Cap. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FrequencyCap { + /// Duration of time, in seconds, for this frequency cap. The maximum duration is 90 days. Acceptable values are 1 to 7776000, inclusive. + pub duration: Option, + /// Number of times an individual user can be served the ad within the specified duration. Acceptable values are 1 to 15, inclusive. + pub impressions: Option, +} + +impl Part for FrequencyCap {} + + +/// Identifies a creative which has been associated with a given campaign. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list campaign creative associations](struct.CampaignCreativeAssociationListCall.html) (none) +/// * [insert campaign creative associations](struct.CampaignCreativeAssociationInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CampaignCreativeAssociation { + /// ID of the creative associated with the campaign. This is a required field. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignCreativeAssociation". + pub kind: Option, +} + +impl RequestValue for CampaignCreativeAssociation {} +impl Resource for CampaignCreativeAssociation {} +impl ResponseResult for CampaignCreativeAssociation {} + + +/// Contains properties of a remarketing list's sharing information. Sharing allows other accounts or advertisers to target to your remarketing lists. This resource can be used to manage remarketing list sharing to other accounts and advertisers. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get remarketing list shares](struct.RemarketingListShareGetCall.html) (response) +/// * [patch remarketing list shares](struct.RemarketingListSharePatchCall.html) (request|response) +/// * [update remarketing list shares](struct.RemarketingListShareUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RemarketingListShare { + /// Advertisers that the remarketing list is shared with. + #[serde(rename="sharedAdvertiserIds")] + pub shared_advertiser_ids: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingListShare". + pub kind: Option, + /// Remarketing list ID. This is a read-only, auto-generated field. + #[serde(rename="remarketingListId")] + pub remarketing_list_id: Option, + /// Accounts that the remarketing list is shared with. + #[serde(rename="sharedAccountIds")] + pub shared_account_ids: Option>, +} + +impl RequestValue for RemarketingListShare {} +impl Resource for RemarketingListShare {} +impl ResponseResult for RemarketingListShare {} + + +/// Operating System Version List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operating system versions](struct.OperatingSystemVersionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystemVersionsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemVersionsListResponse". + pub kind: Option, + /// Operating system version collection. + #[serde(rename="operatingSystemVersions")] + pub operating_system_versions: Option>, +} + +impl ResponseResult for OperatingSystemVersionsListResponse {} + + +/// Organizes placements according to the contents of their associated webpages. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch content categories](struct.ContentCategoryPatchCall.html) (request|response) +/// * [insert content categories](struct.ContentCategoryInsertCall.html) (request|response) +/// * [update content categories](struct.ContentCategoryUpdateCall.html) (request|response) +/// * [get content categories](struct.ContentCategoryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ContentCategory { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#contentCategory". + pub kind: Option, + /// Account ID of this content category. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this content category. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this content category. This is a required field and must be less than 256 characters long and unique among content categories of the same account. + pub name: Option, +} + +impl RequestValue for ContentCategory {} +impl ResponseResult for ContentCategory {} + + +/// Targetable remarketing list response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list targetable remarketing lists](struct.TargetableRemarketingListListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetableRemarketingListsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetableRemarketingListsListResponse". + pub kind: Option, + /// Targetable remarketing list collection. + #[serde(rename="targetableRemarketingLists")] + pub targetable_remarketing_lists: Option>, +} + +impl ResponseResult for TargetableRemarketingListsListResponse {} + + +/// Represents a buy from the Planning inventory store. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get inventory items](struct.InventoryItemGetCall.html) (response) +/// * [list inventory items](struct.InventoryItemListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InventoryItem { + /// Order ID of this inventory item. + #[serde(rename="orderId")] + pub order_id: Option, + /// Advertiser ID of this inventory item. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// ID of the site this inventory item is associated with. + #[serde(rename="siteId")] + pub site_id: Option, + /// Ad slots of this inventory item. If this inventory item represents a standalone placement, there will be exactly one ad slot. If this inventory item represents a placement group, there will be more than one ad slot, each representing one child placement in that placement group. + #[serde(rename="adSlots")] + pub ad_slots: Option>, + /// RFP ID of this inventory item. + #[serde(rename="rfpId")] + pub rfp_id: Option, + /// Content category ID of this inventory item. + #[serde(rename="contentCategoryId")] + pub content_category_id: Option, + /// Placement strategy ID of this inventory item. + #[serde(rename="placementStrategyId")] + pub placement_strategy_id: Option, + /// Account ID of this inventory item. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#inventoryItem". + pub kind: Option, + /// Negotiation channel ID of this inventory item. + #[serde(rename="negotiationChannelId")] + pub negotiation_channel_id: Option, + /// Subaccount ID of this inventory item. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this inventory item. For standalone inventory items, this is the same name as that of its only ad slot. For group inventory items, this can differ from the name of any of its ad slots. + pub name: Option, + /// Estimated click-through rate of this inventory item. + #[serde(rename="estimatedClickThroughRate")] + pub estimated_click_through_rate: Option, + /// Information about the most recent modification of this inventory item. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Estimated conversion rate of this inventory item. + #[serde(rename="estimatedConversionRate")] + pub estimated_conversion_rate: Option, + /// Whether this inventory item is in plan. + #[serde(rename="inPlan")] + pub in_plan: Option, + /// ID of this inventory item. + pub id: Option, + /// Project ID of this inventory item. + #[serde(rename="projectId")] + pub project_id: Option, + /// Type of inventory item. + #[serde(rename="type")] + pub type_: Option, + /// Pricing of this inventory item. + pub pricing: Option, +} + +impl Resource for InventoryItem {} +impl ResponseResult for InventoryItem {} + + +/// Landing Page List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list advertiser landing pages](struct.AdvertiserLandingPageListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdvertiserLandingPagesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiserLandingPagesListResponse". + pub kind: Option, + /// Landing page collection + #[serde(rename="landingPages")] + pub landing_pages: Option>, +} + +impl ResponseResult for AdvertiserLandingPagesListResponse {} + + +/// Creative Asset ID. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssetId { + /// Type of asset to upload. This is a required field. FLASH and IMAGE are no longer supported for new uploads. All image assets should use HTML_IMAGE. + #[serde(rename="type")] + pub type_: Option, + /// Name of the creative asset. This is a required field while inserting an asset. After insertion, this assetIdentifier is used to identify the uploaded asset. Characters in the name must be alphanumeric or one of the following: ".-_ ". Spaces are allowed. + pub name: Option, +} + +impl Part for CreativeAssetId {} + + +/// Creative Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssignment { + /// Weight of the creative assignment, applicable when the rotation type is CREATIVE_ROTATION_TYPE_RANDOM. Value must be greater than or equal to 1. + pub weight: Option, + /// Sequence number of the creative assignment, applicable when the rotation type is CREATIVE_ROTATION_TYPE_SEQUENTIAL. Acceptable values are 1 to 65535, inclusive. + pub sequence: Option, + /// Click-through URL of the creative assignment. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// Rich media exit overrides for this creative assignment. + /// Applicable when the creative type is any of the following: + /// - DISPLAY + /// - RICH_MEDIA_INPAGE + /// - RICH_MEDIA_INPAGE_FLOATING + /// - RICH_MEDIA_IM_EXPAND + /// - RICH_MEDIA_EXPANDING + /// - RICH_MEDIA_INTERSTITIAL_FLOAT + /// - RICH_MEDIA_MOBILE_IN_APP + /// - RICH_MEDIA_MULTI_FLOATING + /// - RICH_MEDIA_PEEL_DOWN + /// - VPAID_LINEAR + /// - VPAID_NON_LINEAR + #[serde(rename="richMediaExitOverrides")] + pub rich_media_exit_overrides: Option>, + /// Whether applicable event tags should fire when this creative assignment is rendered. If this value is unset when the ad is inserted or updated, it will default to true for all creative types EXCEPT for INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO. + #[serde(rename="applyEventTags")] + pub apply_event_tags: Option, + /// Creative group assignments for this creative assignment. Only one assignment per creative group number is allowed for a maximum of two assignments. + #[serde(rename="creativeGroupAssignments")] + pub creative_group_assignments: Option>, + /// Companion creative overrides for this creative assignment. Applicable to video ads. + #[serde(rename="companionCreativeOverrides")] + pub companion_creative_overrides: Option>, + /// Date and time that the assigned creative should start serving. + #[serde(rename="startTime")] + pub start_time: Option, + /// Whether the creative to be assigned is SSL-compliant. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Whether this creative assignment is active. When true, the creative will be included in the ad's rotation. + pub active: Option, + /// ID of the creative to be assigned. This is a required field. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// Date and time that the assigned creative should stop serving. Must be later than the start time. + #[serde(rename="endTime")] + pub end_time: Option, + /// Dimension value for the ID of the creative. This is a read-only, auto-generated field. + #[serde(rename="creativeIdDimensionValue")] + pub creative_id_dimension_value: Option, +} + +impl Part for CreativeAssignment {} + + +/// Represents a DimensionValuesRequest. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query dimension values](struct.DimensionValueQueryCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionValueRequest { + /// The name of the dimension for which values should be requested. + #[serde(rename="dimensionName")] + pub dimension_name: Option, + /// The start date of the date range for which to retrieve dimension values. A string of the format "yyyy-MM-dd". + #[serde(rename="startDate")] + pub start_date: Option, + /// The kind of request this is, in this case dfareporting#dimensionValueRequest. + pub kind: Option, + /// The end date of the date range for which to retrieve dimension values. A string of the format "yyyy-MM-dd". + #[serde(rename="endDate")] + pub end_date: Option, + /// The list of filters by which to filter values. The filters are ANDed. + pub filters: Option>, +} + +impl RequestValue for DimensionValueRequest {} + + +/// Click-through URL +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeClickThroughUrl { + /// Read-only convenience field representing the actual URL that will be used for this click-through. The URL is computed as follows: + /// - If landingPageId is specified then that landing page's URL is assigned to this field. + /// - Otherwise, the customClickThroughUrl is assigned to this field. + #[serde(rename="computedClickThroughUrl")] + pub computed_click_through_url: Option, + /// Custom click-through URL. Applicable if the landingPageId field is left unset. + #[serde(rename="customClickThroughUrl")] + pub custom_click_through_url: Option, + /// ID of the landing page for the click-through URL. + #[serde(rename="landingPageId")] + pub landing_page_id: Option, +} + +impl Part for CreativeClickThroughUrl {} + + +/// Ad Slot +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdSlot { + /// Comment for this ad slot. + pub comment: Option, + /// ID of the placement from an external platform that is linked to this ad slot. + #[serde(rename="linkedPlacementId")] + pub linked_placement_id: Option, + /// Name of this ad slot. + pub name: Option, + /// Primary ad slot of a roadblock inventory item. + pub primary: Option, + /// Height of this ad slot. + pub height: Option, + /// Width of this ad slot. + pub width: Option, + /// Payment source type of this ad slot. + #[serde(rename="paymentSourceType")] + pub payment_source_type: Option, + /// Ad slot compatibility. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop, mobile devices or in mobile apps for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. + pub compatibility: Option, +} + +impl Part for AdSlot {} + + +/// Properties of inheriting and overriding the default click-through event tag. A campaign may override the event tag defined at the advertiser level, and an ad may also override the campaign's setting further. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DefaultClickThroughEventTagProperties { + /// Whether this entity should override the inherited default click-through event tag with its own defined value. + #[serde(rename="overrideInheritedEventTag")] + pub override_inherited_event_tag: Option, + /// ID of the click-through event tag to apply to all ads in this entity's scope. + #[serde(rename="defaultClickThroughEventTagId")] + pub default_click_through_event_tag_id: Option, +} + +impl Part for DefaultClickThroughEventTagProperties {} + + +/// Represents the list of user profiles. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user profiles](struct.UserProfileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserProfileList { + /// The user profiles returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#userProfileList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for UserProfileList {} + + +/// Subaccount List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list subaccounts](struct.SubaccountListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SubaccountsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#subaccountsListResponse". + pub kind: Option, + /// Subaccount collection. + pub subaccounts: Option>, +} + +impl ResponseResult for SubaccountsListResponse {} + + +/// Contains properties of a Planning order document. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get order documents](struct.OrderDocumentGetCall.html) (response) +/// * [list order documents](struct.OrderDocumentListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderDocument { + /// ID of the order from which this order document is created. + #[serde(rename="orderId")] + pub order_id: Option, + /// Timestamp of the last email sent with this order document. + #[serde(rename="lastSentTime")] + pub last_sent_time: Option, + /// The amended order document ID of this order document. An order document can be created by optionally amending another order document so that the change history can be preserved. + #[serde(rename="amendedOrderDocumentId")] + pub amended_order_document_id: Option, + /// List of email addresses that received the last sent document. + #[serde(rename="lastSentRecipients")] + pub last_sent_recipients: Option>, + /// IDs of users who have approved this order document. + #[serde(rename="approvedByUserProfileIds")] + pub approved_by_user_profile_ids: Option>, + /// ID of this order document. + pub id: Option, + /// Account ID of this order document. + #[serde(rename="accountId")] + pub account_id: Option, + /// Advertiser ID of this order document. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#orderDocument". + pub kind: Option, + /// Subaccount ID of this order document. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Effective date of this order document. + #[serde(rename="effectiveDate")] + pub effective_date: Option, + /// Title of this order document. + pub title: Option, + /// Project ID of this order document. + #[serde(rename="projectId")] + pub project_id: Option, + /// Whether this order document has been signed. + pub signed: Option, + /// Information about the creation of this order document. + #[serde(rename="createdInfo")] + pub created_info: Option, + /// Whether this order document is cancelled. + pub cancelled: Option, + /// Type of this order document + #[serde(rename="type")] + pub type_: Option, +} + +impl Resource for OrderDocument {} +impl ResponseResult for OrderDocument {} + + +/// Represents a Report resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [run reports](struct.ReportRunCall.html) (none) +/// * [get reports](struct.ReportGetCall.html) (response) +/// * [list reports](struct.ReportListCall.html) (none) +/// * [delete reports](struct.ReportDeleteCall.html) (none) +/// * [files list reports](struct.ReportFileListCall.html) (none) +/// * [insert reports](struct.ReportInsertCall.html) (request|response) +/// * [patch reports](struct.ReportPatchCall.html) (request|response) +/// * [compatible fields query reports](struct.ReportCompatibleFieldQueryCall.html) (request) +/// * [update reports](struct.ReportUpdateCall.html) (request|response) +/// * [files get reports](struct.ReportFileGetCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Report { + /// The user profile id of the owner of this report. + #[serde(rename="ownerProfileId")] + pub owner_profile_id: Option, + /// The subaccount ID to which this report belongs if applicable. + #[serde(rename="subAccountId")] + pub sub_account_id: Option, + /// The report's schedule. Can only be set if the report's 'dateRange' is a relative date range and the relative date range is not "TODAY". + pub schedule: Option, + /// The report criteria for a report of type "PATH_TO_CONVERSION". + #[serde(rename="pathToConversionCriteria")] + pub path_to_conversion_criteria: Option, + /// The report criteria for a report of type "REACH". + #[serde(rename="reachCriteria")] + pub reach_criteria: Option, + /// The report criteria for a report of type "FLOODLIGHT". + #[serde(rename="floodlightCriteria")] + pub floodlight_criteria: Option, + /// The filename used when generating report files for this report. + #[serde(rename="fileName")] + pub file_name: Option, + /// The report's email delivery settings. + pub delivery: Option, + /// The timestamp (in milliseconds since epoch) of when this report was last modified. + #[serde(rename="lastModifiedTime")] + pub last_modified_time: Option, + /// The report criteria for a report of type "CROSS_DIMENSION_REACH". + #[serde(rename="crossDimensionReachCriteria")] + pub cross_dimension_reach_criteria: Option, + /// The account ID to which this report belongs. + #[serde(rename="accountId")] + pub account_id: Option, + /// The kind of resource this is, in this case dfareporting#report. + pub kind: Option, + /// The name of the report. + pub name: Option, + /// The output format of the report. If not specified, default format is "CSV". Note that the actual format in the completed report file might differ if for instance the report's size exceeds the format's capabilities. "CSV" will then be the fallback format. + pub format: Option, + /// The unique ID identifying this report resource. + pub id: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// The report criteria for a report of type "STANDARD". + pub criteria: Option, + /// The type of the report. + #[serde(rename="type")] + pub type_: Option, +} + +impl RequestValue for Report {} +impl Resource for Report {} +impl ResponseResult for Report {} + + +/// Contains information about a platform type that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get platform types](struct.PlatformTypeGetCall.html) (response) +/// * [list platform types](struct.PlatformTypeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlatformType { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#platformType". + pub kind: Option, + /// ID of this platform type. + pub id: Option, + /// Name of this platform type. + pub name: Option, +} + +impl Resource for PlatformType {} +impl ResponseResult for PlatformType {} + + +/// Advertiser List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list advertisers](struct.AdvertiserListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdvertisersListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Advertiser collection. + pub advertisers: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertisersListResponse". + pub kind: Option, +} + +impl ResponseResult for AdvertisersListResponse {} + + +/// Creative Asset. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creative assets](struct.CreativeAssetInsertCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAsset { + /// Detected MIME type for audio or video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// Artwork type of rich media creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="artworkType")] + pub artwork_type: Option, + /// Offset left unit for an asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="positionLeftUnit")] + pub position_left_unit: Option, + /// Size of an asset when collapsed. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID. Additionally, applicable to assets whose displayType is ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN. + #[serde(rename="collapsedSize")] + pub collapsed_size: Option, + /// Audio sample bit rate in hertz. This is a read-only field. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID. + #[serde(rename="audioSampleRate")] + pub audio_sample_rate: Option, + /// Video frame rate for video asset in frames per second. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="frameRate")] + pub frame_rate: Option, + /// Flash version of the asset. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="flashVersion")] + pub flash_version: Option, + /// Additional sizes associated with this creative asset. HTML5 asset generated by compatible software such as GWD will be able to support more sizes this creative asset can render. + #[serde(rename="additionalSizes")] + pub additional_sizes: Option>, + /// Whether to hide Flash objects flag for an asset. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="hideFlashObjects")] + pub hide_flash_objects: Option, + /// List of feature dependencies for the creative asset that are detected by Campaign Manager. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative correctly. This is a read-only, auto-generated field. Applicable to the following creative types: HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="detectedFeatures")] + pub detected_features: Option>, + /// List of companion creatives assigned to an in-stream video creative asset. Acceptable values include IDs of existing flash and image creatives. Applicable to INSTREAM_VIDEO creative type with dynamicAssetSelection set to true. + #[serde(rename="companionCreativeIds")] + pub companion_creative_ids: Option>, + /// Duration in seconds for which an asset will be displayed. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and VPAID_LINEAR_VIDEO. Value must be greater than or equal to 1. + pub duration: Option, + /// Offset top unit for an asset. This is a read-only field if the asset displayType is ASSET_DISPLAY_TYPE_OVERLAY. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="positionTopUnit")] + pub position_top_unit: Option, + /// Numeric ID of this creative asset. This is a required field and should not be modified. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + pub id: Option, + /// Possible alignments for an asset. This is a read-only field. Applicable to the following creative types: RICH_MEDIA_DISPLAY_MULTI_FLOATING_INTERSTITIAL. + pub alignment: Option, + /// Orientation of video asset. This is a read-only, auto-generated field. + pub orientation: Option, + /// Whether this asset is used as a polite load asset. + #[serde(rename="politeLoad")] + pub polite_load: Option, + /// Whether the asset is horizontally locked. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="horizontallyLocked")] + pub horizontally_locked: Option, + /// Initial wait time type before making the asset visible. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="startTimeType")] + pub start_time_type: Option, + /// Type of rich media asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="displayType")] + pub display_type: Option, + /// Detected expanded dimension for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="expandedDimension")] + pub expanded_dimension: Option, + /// Whether the asset is vertically locked. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="verticallyLocked")] + pub vertically_locked: Option, + /// Dimension value for the ID of the asset. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Role of the asset in relation to creative. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. This is a required field. + /// PRIMARY applies to DISPLAY, FLASH_INPAGE, HTML5_BANNER, IMAGE, DISPLAY_IMAGE_GALLERY, all RICH_MEDIA (which may contain multiple primary assets), and all VPAID creatives. + /// BACKUP_IMAGE applies to FLASH_INPAGE, HTML5_BANNER, all RICH_MEDIA, and all VPAID creatives. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + /// ADDITIONAL_IMAGE and ADDITIONAL_FLASH apply to FLASH_INPAGE creatives. + /// OTHER refers to assets from sources other than Campaign Manager, such as Studio uploaded assets, applicable to all RICH_MEDIA and all VPAID creatives. + /// PARENT_VIDEO refers to videos uploaded by the user in Campaign Manager and is applicable to INSTREAM_VIDEO and VPAID_LINEAR_VIDEO creatives. + /// TRANSCODED_VIDEO refers to videos transcoded by Campaign Manager from PARENT_VIDEO assets and is applicable to INSTREAM_VIDEO and VPAID_LINEAR_VIDEO creatives. + /// ALTERNATE_VIDEO refers to the Campaign Manager representation of child asset videos from Studio, and is applicable to VPAID_LINEAR_VIDEO creatives. These cannot be added or removed within Campaign Manager. + /// For VPAID_LINEAR_VIDEO creatives, PARENT_VIDEO, TRANSCODED_VIDEO and ALTERNATE_VIDEO assets that are marked active serve as backup in case the VPAID creative cannot be served. Only PARENT_VIDEO assets can be added or removed for an INSTREAM_VIDEO or VPAID_LINEAR_VIDEO creative. + /// PARENT_AUDIO refers to audios uploaded by the user in Campaign Manager and is applicable to INSTREAM_AUDIO creatives. + /// TRANSCODED_AUDIO refers to audios transcoded by Campaign Manager from PARENT_AUDIO assets and is applicable to INSTREAM_AUDIO creatives. + pub role: Option, + /// Size associated with this creative asset. This is a required field when applicable; however for IMAGE and FLASH_INPAGE, creatives if left blank, this field will be automatically set using the actual size of the associated image asset. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all RICH_MEDIA. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + pub size: Option, + /// Detected bit-rate for audio or video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID. + #[serde(rename="bitRate")] + pub bit_rate: Option, + /// Detected duration for audio or video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID. + #[serde(rename="mediaDuration")] + pub media_duration: Option, + /// Window mode options for flash assets. Applicable to the following creative types: FLASH_INPAGE, RICH_MEDIA_DISPLAY_EXPANDING, RICH_MEDIA_IM_EXPAND, RICH_MEDIA_DISPLAY_BANNER, and RICH_MEDIA_INPAGE_FLOATING. + #[serde(rename="windowMode")] + pub window_mode: Option, + /// Audio stream bit rate in kbps. This is a read-only field. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID. + #[serde(rename="audioBitRate")] + pub audio_bit_rate: Option, + /// Whether the asset pushes down other content. Applicable to the following creative types: all RICH_MEDIA. Additionally, only applicable when the asset offsets are 0, the collapsedSize.width matches size.width, and the collapsedSize.height is less than size.height. + pub pushdown: Option, + /// Progressive URL for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="progressiveServingUrl")] + pub progressive_serving_url: Option, + /// Duration type for which an asset will be displayed. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="durationType")] + pub duration_type: Option, + /// zIndex value of an asset. Applicable to the following creative types: all RICH_MEDIA.Additionally, only applicable to assets whose displayType is NOT one of the following types: ASSET_DISPLAY_TYPE_INPAGE or ASSET_DISPLAY_TYPE_OVERLAY. Acceptable values are -999999999 to 999999999, inclusive. + #[serde(rename="zIndex")] + pub z_index: Option, + /// File size associated with this creative asset. This is a read-only field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + #[serde(rename="fileSize")] + pub file_size: Option, + /// Offset position for an asset in collapsed mode. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID. Additionally, only applicable to assets whose displayType is ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN. + pub offset: Option, + /// Whether the video or audio asset is active. This is a read-only field for VPAID_NON_LINEAR_VIDEO assets. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID. + pub active: Option, + /// Whether the backup asset is original or changed by the user in Campaign Manager. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="originalBackup")] + pub original_backup: Option, + /// Whether to hide selection boxes flag for an asset. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="hideSelectionBoxes")] + pub hide_selection_boxes: Option, + /// Streaming URL for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="streamingServingUrl")] + pub streaming_serving_url: Option, + /// Size of zip file. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. + #[serde(rename="zipFilesize")] + pub zip_filesize: Option, + /// Rich media child asset type. This is a read-only field. Applicable to the following creative types: all VPAID. + #[serde(rename="childAssetType")] + pub child_asset_type: Option, + /// Exit event configured for the backup image. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="backupImageExit")] + pub backup_image_exit: Option, + /// Whether ActionScript3 is enabled for the flash asset. This is a read-only field. Applicable to the following creative type: FLASH_INPAGE. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="actionScript3")] + pub action_script3: Option, + /// Pushdown duration in seconds for an asset. Applicable to the following creative types: all RICH_MEDIA.Additionally, only applicable when the asset pushdown field is true, the offsets are 0, the collapsedSize.width matches size.width, and the collapsedSize.height is less than size.height. Acceptable values are 0 to 9.99, inclusive. + #[serde(rename="pushdownDuration")] + pub pushdown_duration: Option, + /// Identifier of this asset. This is the same identifier returned during creative asset insert operation. This is a required field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + #[serde(rename="assetIdentifier")] + pub asset_identifier: Option, + /// Whether the asset is transparent. Applicable to the following creative types: all RICH_MEDIA. Additionally, only applicable to HTML5 assets. + pub transparency: Option, + /// Whether the asset is SSL-compliant. This is a read-only field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Offset position for an asset. Applicable to the following creative types: all RICH_MEDIA. + pub position: Option, + /// Custom start time in seconds for making the asset visible. Applicable to the following creative types: all RICH_MEDIA. Value must be greater than or equal to 0. + #[serde(rename="customStartTimeValue")] + pub custom_start_time_value: Option, + /// File name of zip file. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. + #[serde(rename="zipFilename")] + pub zip_filename: Option, +} + +impl Resource for CreativeAsset {} + + +/// Video Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VideoSettings { + /// Settings for the skippability of video creatives served to this placement. If this object is provided, the creative-level skippable settings will be overridden. + #[serde(rename="skippableSettings")] + pub skippable_settings: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#videoSettings". + pub kind: Option, + /// Settings for the companion creatives of video creatives served to this placement. + #[serde(rename="companionSettings")] + pub companion_settings: Option, + /// Orientation of a video placement. If this value is set, placement will return assets matching the specified orientation. + pub orientation: Option, + /// Settings for the transcodes of video creatives served to this placement. If this object is provided, the creative-level transcode settings will be overridden. + #[serde(rename="transcodeSettings")] + pub transcode_settings: Option, +} + +impl Part for VideoSettings {} + + +/// Directory Site List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list directory sites](struct.DirectorySiteListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySitesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySitesListResponse". + pub kind: Option, + /// Directory site collection. + #[serde(rename="directorySites")] + pub directory_sites: Option>, +} + +impl ResponseResult for DirectorySitesListResponse {} + + +/// Modification timestamp. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LastModifiedInfo { + /// Timestamp of the last change in milliseconds since epoch. + pub time: Option, +} + +impl Part for LastModifiedInfo {} + + +/// Region List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list regions](struct.RegionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RegionsListResponse { + /// Region collection. + pub regions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#regionsListResponse". + pub kind: Option, +} + +impl ResponseResult for RegionsListResponse {} + + +/// Represents a grouping of related user role permissions. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user role permission groups](struct.UserRolePermissionGroupListCall.html) (none) +/// * [get user role permission groups](struct.UserRolePermissionGroupGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermissionGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionGroup". + pub kind: Option, + /// ID of this user role permission. + pub id: Option, + /// Name of this user role permission group. + pub name: Option, +} + +impl Resource for UserRolePermissionGroup {} +impl ResponseResult for UserRolePermissionGroup {} + + +/// Contact of an order. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderContact { + /// Type of this contact. + #[serde(rename="contactType")] + pub contact_type: Option, + /// Title of this contact. + #[serde(rename="contactTitle")] + pub contact_title: Option, + /// Free-form information about this contact. It could be any information related to this contact in addition to type, title, name, and signature user profile ID. + #[serde(rename="contactInfo")] + pub contact_info: Option, + /// Name of this contact. + #[serde(rename="contactName")] + pub contact_name: Option, + /// ID of the user profile containing the signature that will be embedded into order documents. + #[serde(rename="signatureUserProfileId")] + pub signature_user_profile_id: Option, +} + +impl Part for OrderContact {} + + +/// Mobile app List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list mobile apps](struct.MobileAppListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MobileAppsListResponse { + /// Mobile apps collection. + #[serde(rename="mobileApps")] + pub mobile_apps: Option>, + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileAppsListResponse". + pub kind: Option, +} + +impl ResponseResult for MobileAppsListResponse {} + + +/// Contains information about an internet connection type that can be targeted by ads. Clients can use the connection type to target mobile vs. broadband users. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get connection types](struct.ConnectionTypeGetCall.html) (response) +/// * [list connection types](struct.ConnectionTypeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConnectionType { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#connectionType". + pub kind: Option, + /// ID of this connection type. + pub id: Option, + /// Name of this connection type. + pub name: Option, +} + +impl Resource for ConnectionType {} +impl ResponseResult for ConnectionType {} + + +/// Browser List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list browsers](struct.BrowserListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BrowsersListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#browsersListResponse". + pub kind: Option, + /// Browser collection. + pub browsers: Option>, +} + +impl ResponseResult for BrowsersListResponse {} + + +/// Object Filter. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ObjectFilter { + /// Applicable when status is ASSIGNED. The user has access to objects with these object IDs. + #[serde(rename="objectIds")] + pub object_ids: Option>, + /// Status of the filter. NONE means the user has access to none of the objects. ALL means the user has access to all objects. ASSIGNED means the user has access to the objects with IDs in the objectIds list. + pub status: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#objectFilter". + pub kind: Option, +} + +impl Part for ObjectFilter {} + + +/// Represents a dimension. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Dimension { + /// The kind of resource this is, in this case dfareporting#dimension. + pub kind: Option, + /// The dimension name, e.g. dfa:advertiser + pub name: Option, +} + +impl Part for Dimension {} + + +/// Contains information about supported video formats. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list video formats](struct.VideoFormatListCall.html) (none) +/// * [get video formats](struct.VideoFormatGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VideoFormat { + /// File type of the video format. + #[serde(rename="fileType")] + pub file_type: Option, + /// The resolution of this video format. + pub resolution: Option, + /// ID of the video format. + pub id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#videoFormat". + pub kind: Option, + /// The target bit rate of this video format. + #[serde(rename="targetBitRate")] + pub target_bit_rate: Option, +} + +impl Resource for VideoFormat {} +impl ResponseResult for VideoFormat {} + + +/// Creative Click Tag. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClickTag { + /// Advertiser event name associated with the click tag. This field is used by DISPLAY_IMAGE_GALLERY and HTML5_BANNER creatives. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="eventName")] + pub event_name: Option, + /// Parameter value for the specified click tag. This field contains a click-through url. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// Parameter name for the specified click tag. For DISPLAY_IMAGE_GALLERY creative assets, this field must match the value of the creative asset's creativeAssetId.name field. + pub name: Option, +} + +impl Part for ClickTag {} + + +/// DirectorySites contains properties of a website from the Site Directory. Sites need to be added to an account via the Sites resource before they can be assigned to a placement. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get directory sites](struct.DirectorySiteGetCall.html) (response) +/// * [list directory sites](struct.DirectorySiteListCall.html) (none) +/// * [insert directory sites](struct.DirectorySiteInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySite { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySite". + pub kind: Option, + /// Name of this directory site. + pub name: Option, + /// Directory site settings. + pub settings: Option, + /// URL of this directory site. + pub url: Option, + /// Tag types for regular placements. + /// + /// Acceptable values are: + /// - "STANDARD" + /// - "IFRAME_JAVASCRIPT_INPAGE" + /// - "INTERNAL_REDIRECT_INPAGE" + /// - "JAVASCRIPT_INPAGE" + #[serde(rename="inpageTagFormats")] + pub inpage_tag_formats: Option>, + /// Whether this directory site is active. + pub active: Option, + /// Tag types for interstitial placements. + /// + /// Acceptable values are: + /// - "IFRAME_JAVASCRIPT_INTERSTITIAL" + /// - "INTERNAL_REDIRECT_INTERSTITIAL" + /// - "JAVASCRIPT_INTERSTITIAL" + #[serde(rename="interstitialTagFormats")] + pub interstitial_tag_formats: Option>, + /// Dimension value for the ID of this directory site. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// ID of this directory site. This is a read-only, auto-generated field. + pub id: Option, +} + +impl RequestValue for DirectorySite {} +impl Resource for DirectorySite {} +impl ResponseResult for DirectorySite {} + + +/// City List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list cities](struct.CityListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CitiesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#citiesListResponse". + pub kind: Option, + /// City collection. + pub cities: Option>, +} + +impl ResponseResult for CitiesListResponse {} + + +/// Publisher Dynamic Tag +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityPublisherDynamicTag { + /// Whether this tag is applicable only for view-throughs. + #[serde(rename="viewThrough")] + pub view_through: Option, + /// Site ID of this dynamic tag. + #[serde(rename="siteId")] + pub site_id: Option, + /// Whether this tag is applicable only for click-throughs. + #[serde(rename="clickThrough")] + pub click_through: Option, + /// Directory site ID of this dynamic tag. This is a write-only field that can be used as an alternative to the siteId field. When this resource is retrieved, only the siteId field will be populated. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Dimension value for the ID of the site. This is a read-only, auto-generated field. + #[serde(rename="siteIdDimensionValue")] + pub site_id_dimension_value: Option, + /// Dynamic floodlight tag. + #[serde(rename="dynamicTag")] + pub dynamic_tag: Option, +} + +impl Part for FloodlightActivityPublisherDynamicTag {} + + +/// Represents a metric. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Metric { + /// The kind of resource this is, in this case dfareporting#metric. + pub kind: Option, + /// The metric name, e.g. dfa:impressions + pub name: Option, +} + +impl Part for Metric {} + + +/// Transcode Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteTranscodeSetting { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#siteTranscodeSetting". + pub kind: Option, + /// Whitelist of video formats to be served to this site template. Set this list to null or empty to serve all video formats. + #[serde(rename="enabledVideoFormats")] + pub enabled_video_formats: Option>, +} + +impl Part for SiteTranscodeSetting {} + + +/// Rich Media Exit Override. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RichMediaExitOverride { + /// Click-through URL of this rich media exit override. Applicable if the enabled field is set to true. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// Whether to use the clickThroughUrl. If false, the creative-level exit will be used. + pub enabled: Option, + /// ID for the override to refer to a specific exit in the creative. + #[serde(rename="exitId")] + pub exit_id: Option, +} + +impl Part for RichMediaExitOverride {} + + +/// Account Permission List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permissions](struct.AccountPermissionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermissionsListResponse { + /// Account permission collection. + #[serde(rename="accountPermissions")] + pub account_permissions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionsListResponse". + pub kind: Option, +} + +impl ResponseResult for AccountPermissionsListResponse {} + + +/// Placement GenerateTags Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [generatetags placements](struct.PlacementGeneratetagCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementsGenerateTagsResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementsGenerateTagsResponse". + pub kind: Option, + /// Set of generated tags for the specified placements. + #[serde(rename="placementTags")] + pub placement_tags: Option>, +} + +impl ResponseResult for PlacementsGenerateTagsResponse {} + + +/// Contains properties of a creative field value. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creative field values](struct.CreativeFieldValueInsertCall.html) (request|response) +/// * [get creative field values](struct.CreativeFieldValueGetCall.html) (response) +/// * [update creative field values](struct.CreativeFieldValueUpdateCall.html) (request|response) +/// * [patch creative field values](struct.CreativeFieldValuePatchCall.html) (request|response) +/// * [list creative field values](struct.CreativeFieldValueListCall.html) (none) +/// * [delete creative field values](struct.CreativeFieldValueDeleteCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldValue { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldValue". + pub kind: Option, + /// ID of this creative field value. This is a read-only, auto-generated field. + pub id: Option, + /// Value of this creative field value. It needs to be less than 256 characters in length and unique per creative field. + pub value: Option, +} + +impl RequestValue for CreativeFieldValue {} +impl Resource for CreativeFieldValue {} +impl ResponseResult for CreativeFieldValue {} + + +/// Floodlight Activity Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight activity groups](struct.FloodlightActivityGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivityGroupsListResponse". + pub kind: Option, + /// Floodlight activity group collection. + #[serde(rename="floodlightActivityGroups")] + pub floodlight_activity_groups: Option>, +} + +impl ResponseResult for FloodlightActivityGroupsListResponse {} + + +/// Creative Custom Event. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeCustomEvent { + /// Target type used by the event. + #[serde(rename="targetType")] + pub target_type: Option, + /// Artwork type used by the creative.This is a read-only field. + #[serde(rename="artworkType")] + pub artwork_type: Option, + /// Exit click-through URL for the event. This field is used only for exit events. + #[serde(rename="exitClickThroughUrl")] + pub exit_click_through_url: Option, + /// Video reporting ID, used to differentiate multiple videos in a single creative. This is a read-only field. + #[serde(rename="videoReportingId")] + pub video_reporting_id: Option, + /// Properties for rich media popup windows. This field is used only for exit events. + #[serde(rename="popupWindowProperties")] + pub popup_window_properties: Option, + /// Unique ID of this event used by Reporting and Data Transfer. This is a read-only field. + #[serde(rename="advertiserCustomEventId")] + pub advertiser_custom_event_id: Option, + /// Artwork label column, used to link events in Campaign Manager back to events in Studio. This is a required field and should not be modified after insertion. + #[serde(rename="artworkLabel")] + pub artwork_label: Option, + /// Type of the event. This is a read-only field. + #[serde(rename="advertiserCustomEventType")] + pub advertiser_custom_event_type: Option, + /// ID of this event. This is a required field and should not be modified after insertion. + pub id: Option, + /// User-entered name for the event. + #[serde(rename="advertiserCustomEventName")] + pub advertiser_custom_event_name: Option, +} + +impl Part for CreativeCustomEvent {} + + +/// Creative List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creatives](struct.CreativeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativesListResponse". + pub kind: Option, + /// Creative collection. + pub creatives: Option>, +} + +impl ResponseResult for CreativesListResponse {} + + +/// Omniture Integration Settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OmnitureSettings { + /// Whether placement cost data will be sent to Omniture. This property can be enabled only if omnitureIntegrationEnabled is true. + #[serde(rename="omnitureCostDataEnabled")] + pub omniture_cost_data_enabled: Option, + /// Whether Omniture integration is enabled. This property can be enabled only when the "Advanced Ad Serving" account setting is enabled. + #[serde(rename="omnitureIntegrationEnabled")] + pub omniture_integration_enabled: Option, +} + +impl Part for OmnitureSettings {} + + +/// Represents fields that are compatible to be selected for a report of type "PATH_TO_CONVERSION". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PathToConversionReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// Per-interaction dimensions which are compatible to be selected in the "perInteractionDimensions" section of the report. + #[serde(rename="perInteractionDimensions")] + pub per_interaction_dimensions: Option>, + /// The kind of resource this is, in this case dfareporting#pathToConversionReportCompatibleFields. + pub kind: Option, + /// Conversion dimensions which are compatible to be selected in the "conversionDimensions" section of the report. + #[serde(rename="conversionDimensions")] + pub conversion_dimensions: Option>, + /// Custom floodlight variables which are compatible to be selected in the "customFloodlightVariables" section of the report. + #[serde(rename="customFloodlightVariables")] + pub custom_floodlight_variables: Option>, +} + +impl Part for PathToConversionReportCompatibleFields {} + + +/// Mobile Carrier List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list mobile carriers](struct.MobileCarrierListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MobileCarriersListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileCarriersListResponse". + pub kind: Option, + /// Mobile carrier collection. + #[serde(rename="mobileCarriers")] + pub mobile_carriers: Option>, +} + +impl ResponseResult for MobileCarriersListResponse {} + + +/// Dynamic Targeting Key List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list dynamic targeting keys](struct.DynamicTargetingKeyListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DynamicTargetingKeysListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#dynamicTargetingKeysListResponse". + pub kind: Option, + /// Dynamic targeting key collection. + #[serde(rename="dynamicTargetingKeys")] + pub dynamic_targeting_keys: Option>, +} + +impl ResponseResult for DynamicTargetingKeysListResponse {} + + +/// Dynamic Tag +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityDynamicTag { + /// Tag code. + pub tag: Option, + /// ID of this dynamic tag. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this tag. + pub name: Option, +} + +impl Part for FloodlightActivityDynamicTag {} + + +/// Contains properties of a Creative. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creatives](struct.CreativeInsertCall.html) (request|response) +/// * [get creatives](struct.CreativeGetCall.html) (response) +/// * [list creatives](struct.CreativeListCall.html) (none) +/// * [update creatives](struct.CreativeUpdateCall.html) (request|response) +/// * [patch creatives](struct.CreativePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Creative { + /// Type of artwork used for the creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="artworkType")] + pub artwork_type: Option, + /// Combined size of all creative assets. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="totalFileSize")] + pub total_file_size: Option, + /// Keywords for a Rich Media creative. Keywords let you customize the creative settings of a Rich Media ad running on your site without having to contact the advertiser. You can use keywords to dynamically change the look or functionality of a creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="adTagKeys")] + pub ad_tag_keys: Option>, + /// Additional sizes associated with a responsive creative. When inserting or updating a creative either the size ID field or size width and height fields can be used. Applicable to DISPLAY creatives when the primary asset type is HTML_IMAGE. + #[serde(rename="additionalSizes")] + pub additional_sizes: Option>, + /// Set this to true to enable the use of rules to target individual assets in this creative. When set to true creativeAssetSelection must be set. This also controls asset-level companions. When this is true, companion creatives should be assigned to creative assets. Learn more. Applicable to INSTREAM_VIDEO creatives. + #[serde(rename="dynamicAssetSelection")] + pub dynamic_asset_selection: Option, + /// Size associated with this creative. When inserting or updating a creative either the size ID field or size width and height fields can be used. This is a required field when applicable; however for IMAGE, FLASH_INPAGE creatives, and for DISPLAY creatives with a primary asset of type HTML_IMAGE, if left blank, this field will be automatically set using the actual size of the associated image assets. Applicable to the following creative types: DISPLAY, DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all RICH_MEDIA. + pub size: Option, + /// Reporting label used for HTML5 banner backup image. Applicable to the following creative types: DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="backupImageReportingLabel")] + pub backup_image_reporting_label: Option, + /// Whether the creative is archived. Applicable to all creative types. + pub archived: Option, + /// Override CSS value for rich media creatives. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="overrideCss")] + pub override_css: Option, + /// Source application where creative was authored. Presently, only DBM authored creatives will have this field set. Applicable to all creative types. + #[serde(rename="authoringSource")] + pub authoring_source: Option, + /// Whether the creative is SSL-compliant. This is a read-only field. Applicable to all creative types. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Description of the audio or video ad. Applicable to the following creative types: all INSTREAM_VIDEO, INSTREAM_AUDIO, and all VPAID. + #[serde(rename="mediaDescription")] + pub media_description: Option, + /// ID of current rendering version. This is a read-only field. Applicable to all creative types. + #[serde(rename="renderingId")] + pub rendering_id: Option, + /// Custom key-values for a Rich Media creative. Key-values let you customize the creative settings of a Rich Media ad running on your site without having to contact the advertiser. You can use key-values to dynamically change the look or functionality of a creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="customKeyValues")] + pub custom_key_values: Option>, + /// URL of hosted image or hosted video or another ad tag. For INSTREAM_VIDEO_REDIRECT creatives this is the in-stream video redirect URL. The standard for a VAST (Video Ad Serving Template) ad response allows for a redirect link to another VAST 2.0 or 3.0 call. This is a required field when applicable. Applicable to the following creative types: DISPLAY_REDIRECT, INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO_REDIRECT + #[serde(rename="redirectUrl")] + pub redirect_url: Option, + /// Type of this creative. This is a required field. Applicable to all creative types. + /// + /// Note: FLASH_INPAGE, HTML5_BANNER, and IMAGE are only used for existing creatives. New creatives should use DISPLAY as a replacement for these types. + #[serde(rename="type")] + pub type_: Option, + /// Creative field assignments for this creative. Applicable to all creative types. + #[serde(rename="creativeFieldAssignments")] + pub creative_field_assignments: Option>, + /// Studio advertiser ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="studioAdvertiserId")] + pub studio_advertiser_id: Option, + /// Whether HTML code is generated by Campaign Manager or manually entered. Set to true to ignore changes to htmlCode. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER. + #[serde(rename="htmlCodeLocked")] + pub html_code_locked: Option, + /// The minimum required Flash plugin version for this creative. For example, 11.2.202.235. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="requiredFlashPluginVersion")] + pub required_flash_plugin_version: Option, + /// Ad parameters user for VPAID creative. This is a read-only field. Applicable to the following creative types: all VPAID. + #[serde(rename="adParameters")] + pub ad_parameters: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creative". + pub kind: Option, + /// Name of the creative. This is a required field and must be less than 256 characters long. Applicable to all creative types. + pub name: Option, + /// Click-through URL for backup image. Applicable to ENHANCED_BANNER when the primary asset type is not HTML_IMAGE. + #[serde(rename="backupImageClickThroughUrl")] + pub backup_image_click_through_url: Option, + /// Studio creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="studioCreativeId")] + pub studio_creative_id: Option, + /// Authoring tool for HTML5 banner creatives. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. + #[serde(rename="authoringTool")] + pub authoring_tool: Option, + /// Whether script access is allowed for this creative. This is a read-only and deprecated field which will automatically be set to true on update. Applicable to the following creative types: FLASH_INPAGE. + #[serde(rename="allowScriptAccess")] + pub allow_script_access: Option, + /// Required if dynamicAssetSelection is true. + #[serde(rename="creativeAssetSelection")] + pub creative_asset_selection: Option, + /// Creative audio or video duration in seconds. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO, INSTREAM_AUDIO, all RICH_MEDIA, and all VPAID. + #[serde(rename="mediaDuration")] + pub media_duration: Option, + /// Latest Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="latestTraffickedCreativeId")] + pub latest_trafficked_creative_id: Option, + /// Advertiser ID of this creative. This is a required field. Applicable to all creative types. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// List of timer events configured for the creative. For DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset is not HTML_IMAGE. + #[serde(rename="timerCustomEvents")] + pub timer_custom_events: Option>, + /// OpenWindow FSCommand of this creative. This lets the SWF file communicate with either Flash Player or the program hosting Flash Player, such as a web browser. This is only triggered if allowScriptAccess field is true. Applicable to the following creative types: FLASH_INPAGE. + #[serde(rename="fsCommand")] + pub fs_command: Option, + /// Dimension value for the rendering ID of this creative. This is a read-only field. Applicable to all creative types. + #[serde(rename="renderingIdDimensionValue")] + pub rendering_id_dimension_value: Option, + /// ID of this creative. This is a read-only, auto-generated field. Applicable to all creative types. + pub id: Option, + /// A Universal Ad ID as per the VAST 4.0 spec. Applicable to the following creative types: INSTREAM_AUDIO and INSTREAM_VIDEO and VPAID. + #[serde(rename="universalAdId")] + pub universal_ad_id: Option, + /// Account ID of this creative. This field, if left unset, will be auto-generated for both insert and update operations. Applicable to all creative types. + #[serde(rename="accountId")] + pub account_id: Option, + /// Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="studioTraffickedCreativeId")] + pub studio_trafficked_creative_id: Option, + /// The internal Flash version for this creative as calculated by Studio. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="requiredFlashVersion")] + pub required_flash_version: Option, + /// List of exit events configured for the creative. For DISPLAY and DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags, For DISPLAY, an event is also created from the backupImageReportingLabel. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="exitCustomEvents")] + pub exit_custom_events: Option>, + /// List of counter events configured for the creative. For DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. + #[serde(rename="counterCustomEvents")] + pub counter_custom_events: Option>, + /// Amount of time to play the video before the skip button appears. Applicable to the following creative types: all INSTREAM_VIDEO. + #[serde(rename="skipOffset")] + pub skip_offset: Option, + /// Third-party URL used to record backup image impressions. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="thirdPartyBackupImageImpressionsUrl")] + pub third_party_backup_image_impressions_url: Option, + /// The version number helps you keep track of multiple versions of your creative in your reports. The version number will always be auto-generated during insert operations to start at 1. For tracking creatives the version cannot be incremented and will always remain at 1. For all other creative types the version can be incremented only by 1 during update operations. In addition, the version will be automatically incremented by 1 when undergoing Rich Media creative merging. Applicable to all creative types. + pub version: Option, + /// Amount of time to play the video before counting a view. Applicable to the following creative types: all INSTREAM_VIDEO. + #[serde(rename="progressOffset")] + pub progress_offset: Option, + /// The 6-character HTML color code, beginning with #, for the background of the window area where the Flash file is displayed. Default is white. Applicable to the following creative types: FLASH_INPAGE. + #[serde(rename="backgroundColor")] + pub background_color: Option, + /// Dimension value for the ID of this creative. This is a read-only field. Applicable to all creative types. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Third-party URL used to record rich media impressions. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="thirdPartyRichMediaImpressionsUrl")] + pub third_party_rich_media_impressions_url: Option, + /// Assets associated with a creative. Applicable to all but the following creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and REDIRECT + #[serde(rename="creativeAssets")] + pub creative_assets: Option>, + /// Whether images are automatically advanced for image gallery creatives. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY. + #[serde(rename="autoAdvanceImages")] + pub auto_advance_images: Option, + /// Whether Flash assets associated with the creative need to be automatically converted to HTML5. This flag is enabled by default and users can choose to disable it if they don't want the system to generate and use HTML5 asset for this creative. Applicable to the following creative type: FLASH_INPAGE. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="convertFlashToHtml5")] + pub convert_flash_to_html5: Option, + /// Click tags of the creative. For DISPLAY, FLASH_INPAGE, and HTML5_BANNER creatives, this is a subset of detected click tags for the assets associated with this creative. After creating a flash asset, detected click tags will be returned in the creativeAssetMetadata. When inserting the creative, populate the creative clickTags field using the creativeAssetMetadata.clickTags field. For DISPLAY_IMAGE_GALLERY creatives, there should be exactly one entry in this list for each image creative asset. A click tag is matched with a corresponding creative asset by matching the clickTag.name field with the creativeAsset.assetIdentifier.name field. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="clickTags")] + pub click_tags: Option>, + /// Target window for backup image. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="backupImageTargetWindow")] + pub backup_image_target_window: Option, + /// Whether the creative is active. Applicable to all creative types. + pub active: Option, + /// Compatibilities associated with this creative. This is a read-only field. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. Only pre-existing creatives may have these compatibilities since new creatives will either be assigned DISPLAY or DISPLAY_INTERSTITIAL instead. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. IN_STREAM_AUDIO refers to rendering in in-stream audio ads developed with the VAST standard. Applicable to all creative types. + /// + /// Acceptable values are: + /// - "APP" + /// - "APP_INTERSTITIAL" + /// - "IN_STREAM_VIDEO" + /// - "IN_STREAM_AUDIO" + /// - "DISPLAY" + /// - "DISPLAY_INTERSTITIAL" + pub compatibility: Option>, + /// Subaccount ID of this creative. This field, if left unset, will be auto-generated for both insert and update operations. Applicable to all creative types. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Whether creative should be treated as SSL compliant even if the system scan shows it's not. Applicable to all creative types. + #[serde(rename="sslOverride")] + pub ssl_override: Option, + /// Creative last modification information. This is a read-only field. Applicable to all creative types. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Third-party URLs for tracking in-stream creative events. Applicable to the following creative types: all INSTREAM_VIDEO, all INSTREAM_AUDIO, and all VPAID. + #[serde(rename="thirdPartyUrls")] + pub third_party_urls: Option>, + /// List of companion creatives assigned to an in-Stream video creative. Acceptable values include IDs of existing flash and image creatives. Applicable to the following creative types: all VPAID, all INSTREAM_AUDIO and all INSTREAM_VIDEO with dynamicAssetSelection set to false. + #[serde(rename="companionCreatives")] + pub companion_creatives: Option>, + /// HTML code for the creative. This is a required field when applicable. This field is ignored if htmlCodeLocked is true. Applicable to the following creative types: all CUSTOM, FLASH_INPAGE, and HTML5_BANNER, and all RICH_MEDIA. + #[serde(rename="htmlCode")] + pub html_code: Option, + /// List of feature dependencies that will cause a backup image to be served if the browser that serves the ad does not support them. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative asset correctly. This field is initially auto-generated to contain all features detected by Campaign Manager for all the assets of this creative and can then be modified by the client. To reset this field, copy over all the creativeAssets' detected features. Applicable to the following creative types: HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. + #[serde(rename="backupImageFeatures")] + pub backup_image_features: Option>, + /// Industry standard ID assigned to creative for reach and frequency. Applicable to INSTREAM_VIDEO_REDIRECT creatives. + #[serde(rename="commercialId")] + pub commercial_id: Option, + /// Whether the user can choose to skip the creative. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. + pub skippable: Option, +} + +impl RequestValue for Creative {} +impl Resource for Creative {} +impl ResponseResult for Creative {} + + +/// Reporting Configuration +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportsConfiguration { + /// Whether the exposure to conversion report is enabled. This report shows detailed pathway information on up to 10 of the most recent ad exposures seen by a user before converting. + #[serde(rename="exposureToConversionEnabled")] + pub exposure_to_conversion_enabled: Option, + /// Report generation time zone ID of this account. This is a required field that can only be changed by a superuser. + /// Acceptable values are: + /// + /// - "1" for "America/New_York" + /// - "2" for "Europe/London" + /// - "3" for "Europe/Paris" + /// - "4" for "Africa/Johannesburg" + /// - "5" for "Asia/Jerusalem" + /// - "6" for "Asia/Shanghai" + /// - "7" for "Asia/Hong_Kong" + /// - "8" for "Asia/Tokyo" + /// - "9" for "Australia/Sydney" + /// - "10" for "Asia/Dubai" + /// - "11" for "America/Los_Angeles" + /// - "12" for "Pacific/Auckland" + /// - "13" for "America/Sao_Paulo" + #[serde(rename="reportGenerationTimeZoneId")] + pub report_generation_time_zone_id: Option, + /// Default lookback windows for new advertisers in this account. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, +} + +impl Part for ReportsConfiguration {} + + +/// Campaign List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list campaigns](struct.CampaignListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CampaignsListResponse { + /// Campaign collection. + pub campaigns: Option>, + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignsListResponse". + pub kind: Option, +} + +impl ResponseResult for CampaignsListResponse {} + + +/// User Role Permission List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user role permissions](struct.UserRolePermissionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermissionsListResponse { + /// User role permission collection. + #[serde(rename="userRolePermissions")] + pub user_role_permissions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionsListResponse". + pub kind: Option, +} + +impl ResponseResult for UserRolePermissionsListResponse {} + + +/// Represents a UserProfile resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user profiles](struct.UserProfileListCall.html) (none) +/// * [get user profiles](struct.UserProfileGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserProfile { + /// The user name. + #[serde(rename="userName")] + pub user_name: Option, + /// The kind of resource this is, in this case dfareporting#userProfile. + pub kind: Option, + /// The sub account ID this profile belongs to if applicable. + #[serde(rename="subAccountId")] + pub sub_account_id: Option, + /// The account name this profile belongs to. + #[serde(rename="accountName")] + pub account_name: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// The sub account name this profile belongs to if applicable. + #[serde(rename="subAccountName")] + pub sub_account_name: Option, + /// The unique ID of the user profile. + #[serde(rename="profileId")] + pub profile_id: Option, + /// The account ID to which this profile belongs. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl Resource for UserProfile {} +impl ResponseResult for UserProfile {} + + +/// Creative Group Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeGroupAssignment { + /// ID of the creative group to be assigned. + #[serde(rename="creativeGroupId")] + pub creative_group_id: Option, + /// Creative group number of the creative group assignment. + #[serde(rename="creativeGroupNumber")] + pub creative_group_number: Option, +} + +impl Part for CreativeGroupAssignment {} + + +/// The report criteria for a report of type "PATH_TO_CONVERSION". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportPathToConversionCriteria { + /// The list of conversion dimensions the report should include. + #[serde(rename="conversionDimensions")] + pub conversion_dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of custom floodlight variables the report should include. + #[serde(rename="customFloodlightVariables")] + pub custom_floodlight_variables: Option>, + /// The list of 'dfa:activity' values to filter on. + #[serde(rename="activityFilters")] + pub activity_filters: Option>, + /// The list of custom rich media events to include. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option>, + /// The list of per interaction dimensions the report should include. + #[serde(rename="perInteractionDimensions")] + pub per_interaction_dimensions: Option>, + /// The properties of the report. + #[serde(rename="reportProperties")] + pub report_properties: Option, + /// The floodlight ID for which to show data in this report. All advertisers associated with that ID will automatically be added. The dimension of the value needs to be 'dfa:floodlightConfigId'. + #[serde(rename="floodlightConfigId")] + pub floodlight_config_id: Option, +} + +impl NestedType for ReportPathToConversionCriteria {} +impl Part for ReportPathToConversionCriteria {} + + +/// Creative Field List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative fields](struct.CreativeFieldListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Creative field collection. + #[serde(rename="creativeFields")] + pub creative_fields: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldsListResponse". + pub kind: Option, +} + +impl ResponseResult for CreativeFieldsListResponse {} + + +/// The report's email delivery settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportDelivery { + /// The message to be sent with each email. + pub message: Option, + /// The type of delivery for the owner to receive, if enabled. + #[serde(rename="emailOwnerDeliveryType")] + pub email_owner_delivery_type: Option, + /// The list of recipients to which to email the report. + pub recipients: Option>, + /// Whether the report should be emailed to the report owner. + #[serde(rename="emailOwner")] + pub email_owner: Option, +} + +impl NestedType for ReportDelivery {} +impl Part for ReportDelivery {} + + +/// Companion Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompanionSetting { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#companionSetting". + pub kind: Option, + /// Whether companions are disabled for this placement. + #[serde(rename="companionsDisabled")] + pub companions_disabled: Option, + /// Whether to serve only static images as companions. + #[serde(rename="imageOnly")] + pub image_only: Option, + /// Whitelist of companion sizes to be served to this placement. Set this list to null or empty to serve all companion sizes. + #[serde(rename="enabledSizes")] + pub enabled_sizes: Option>, +} + +impl Part for CompanionSetting {} + + +/// Project List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list projects](struct.ProjectListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ProjectsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#projectsListResponse". + pub kind: Option, + /// Project collection. + pub projects: Option>, +} + +impl ResponseResult for ProjectsListResponse {} + + +/// Contains properties of a dynamic targeting key. Dynamic targeting keys are unique, user-friendly labels, created at the advertiser level in DCM, that can be assigned to ads, creatives, and placements and used for targeting with Studio dynamic creatives. Use these labels instead of numeric Campaign Manager IDs (such as placement IDs) to save time and avoid errors in your dynamic feeds. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list dynamic targeting keys](struct.DynamicTargetingKeyListCall.html) (none) +/// * [delete dynamic targeting keys](struct.DynamicTargetingKeyDeleteCall.html) (none) +/// * [insert dynamic targeting keys](struct.DynamicTargetingKeyInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DynamicTargetingKey { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#dynamicTargetingKey". + pub kind: Option, + /// Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase. + pub name: Option, + /// ID of the object of this dynamic targeting key. This is a required field. + #[serde(rename="objectId")] + pub object_id: Option, + /// Type of the object of this dynamic targeting key. This is a required field. + #[serde(rename="objectType")] + pub object_type: Option, +} + +impl RequestValue for DynamicTargetingKey {} +impl Resource for DynamicTargetingKey {} +impl ResponseResult for DynamicTargetingKey {} + + +/// Geographical Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GeoTargeting { + /// Regions to be targeted. For each region only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a region, do not target or exclude the country of the region. + pub regions: Option>, + /// Countries to be targeted or excluded from targeting, depending on the setting of the excludeCountries field. For each country only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting or excluding a country, do not target regions, cities, metros, or postal codes in the same country. + pub countries: Option>, + /// Metros to be targeted. For each metro only dmaId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a metro, do not target or exclude the country of the metro. + pub metros: Option>, + /// Cities to be targeted. For each city only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a city, do not target or exclude the country of the city, and do not target the metro or region of the city. + pub cities: Option>, + /// Whether or not to exclude the countries in the countries field from targeting. If false, the countries field refers to countries which will be targeted by the ad. + #[serde(rename="excludeCountries")] + pub exclude_countries: Option, + /// Postal codes to be targeted. For each postal code only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a postal code, do not target or exclude the country of the postal code. + #[serde(rename="postalCodes")] + pub postal_codes: Option>, +} + +impl Part for GeoTargeting {} + + +/// Contains properties of a targeting template. A targeting template encapsulates targeting information which can be reused across multiple ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert targeting templates](struct.TargetingTemplateInsertCall.html) (request|response) +/// * [update targeting templates](struct.TargetingTemplateUpdateCall.html) (request|response) +/// * [get targeting templates](struct.TargetingTemplateGetCall.html) (response) +/// * [list targeting templates](struct.TargetingTemplateListCall.html) (none) +/// * [patch targeting templates](struct.TargetingTemplatePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetingTemplate { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetingTemplate". + pub kind: Option, + /// Subaccount ID of this targeting template. This field, if left unset, will be auto-generated on insert and is read-only after insert. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this targeting template. This field is required. It must be less than 256 characters long and unique within an advertiser. + pub name: Option, + /// Time and day targeting criteria. + #[serde(rename="dayPartTargeting")] + pub day_part_targeting: Option, + /// Key-value targeting criteria. + #[serde(rename="keyValueTargetingExpression")] + pub key_value_targeting_expression: Option, + /// Remarketing list targeting criteria. + #[serde(rename="listTargetingExpression")] + pub list_targeting_expression: Option, + /// Language targeting criteria. + #[serde(rename="languageTargeting")] + pub language_targeting: Option, + /// Advertiser ID of this targeting template. This is a required field on insert and is read-only after insert. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Geographical targeting criteria. + #[serde(rename="geoTargeting")] + pub geo_targeting: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Technology platform targeting criteria. + #[serde(rename="technologyTargeting")] + pub technology_targeting: Option, + /// ID of this targeting template. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this targeting template. This field, if left unset, will be auto-generated on insert and is read-only after insert. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for TargetingTemplate {} +impl Resource for TargetingTemplate {} +impl ResponseResult for TargetingTemplate {} + + +/// Delivery Schedule. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeliverySchedule { + /// Serving priority of an ad, with respect to other ads. The lower the priority number, the greater the priority with which it is served. + pub priority: Option, + /// Whether or not hard cutoff is enabled. If true, the ad will not serve after the end date and time. Otherwise the ad will continue to be served until it has reached its delivery goals. + #[serde(rename="hardCutoff")] + pub hard_cutoff: Option, + /// Limit on the number of times an individual user can be served the ad within a specified period of time. + #[serde(rename="frequencyCap")] + pub frequency_cap: Option, + /// Impression ratio for this ad. This ratio determines how often each ad is served relative to the others. For example, if ad A has an impression ratio of 1 and ad B has an impression ratio of 3, then Campaign Manager will serve ad B three times as often as ad A. Acceptable values are 1 to 10, inclusive. + #[serde(rename="impressionRatio")] + pub impression_ratio: Option, +} + +impl Part for DeliverySchedule {} + + +/// The report's schedule. Can only be set if the report's 'dateRange' is a relative date range and the relative date range is not "TODAY". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportSchedule { + /// Start date of date range for which scheduled reports should be run. + #[serde(rename="startDate")] + pub start_date: Option, + /// Enum to define for "MONTHLY" scheduled reports whether reports should be repeated on the same day of the month as "startDate" or the same day of the week of the month. + /// Example: If 'startDate' is Monday, April 2nd 2012 (2012-04-02), "DAY_OF_MONTH" would run subsequent reports on the 2nd of every Month, and "WEEK_OF_MONTH" would run subsequent reports on the first Monday of the month. + #[serde(rename="runsOnDayOfMonth")] + pub runs_on_day_of_month: Option, + /// The expiration date when the scheduled report stops running. + #[serde(rename="expirationDate")] + pub expiration_date: Option, + /// Whether the schedule is active or not. Must be set to either true or false. + pub active: Option, + /// Defines every how many days, weeks or months the report should be run. Needs to be set when "repeats" is either "DAILY", "WEEKLY" or "MONTHLY". + pub every: Option, + /// The interval for which the report is repeated. Note: + /// - "DAILY" also requires field "every" to be set. + /// - "WEEKLY" also requires fields "every" and "repeatsOnWeekDays" to be set. + /// - "MONTHLY" also requires fields "every" and "runsOnDayOfMonth" to be set. + pub repeats: Option, + /// List of week days "WEEKLY" on which scheduled reports should run. + #[serde(rename="repeatsOnWeekDays")] + pub repeats_on_week_days: Option>, +} + +impl NestedType for ReportSchedule {} +impl Part for ReportSchedule {} + + +/// Represents a recipient. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Recipient { + /// The kind of resource this is, in this case dfareporting#recipient. + pub kind: Option, + /// The delivery type for the recipient. + #[serde(rename="deliveryType")] + pub delivery_type: Option, + /// The email address of the recipient. + pub email: Option, +} + +impl Part for Recipient {} + + +/// Represents fields that are compatible to be selected for a report of type "STANDARD". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#reportCompatibleFields. + pub kind: Option, + /// Metrics which are compatible to be selected as activity metrics to pivot on in the "activities" section of the report. + #[serde(rename="pivotedActivityMetrics")] + pub pivoted_activity_metrics: Option>, + /// Dimensions which are compatible to be selected in the "dimensions" section of the report. + pub dimensions: Option>, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, +} + +impl Part for ReportCompatibleFields {} + + +/// Advertiser Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list advertiser groups](struct.AdvertiserGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdvertiserGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiserGroupsListResponse". + pub kind: Option, + /// Advertiser group collection. + #[serde(rename="advertiserGroups")] + pub advertiser_groups: Option>, +} + +impl ResponseResult for AdvertiserGroupsListResponse {} + + +/// Placement Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list placement groups](struct.PlacementGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementGroupsListResponse". + pub kind: Option, + /// Placement group collection. + #[serde(rename="placementGroups")] + pub placement_groups: Option>, +} + +impl ResponseResult for PlacementGroupsListResponse {} + + +/// The properties of the report. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportPathToConversionCriteriaReportProperties { + /// DFA checks to see if a click interaction occurred within the specified period of time before a conversion. By default the value is pulled from Floodlight or you can manually enter a custom value. Valid values: 1-90. + #[serde(rename="clicksLookbackWindow")] + pub clicks_lookback_window: Option, + /// Enable pivoting on interaction path. + #[serde(rename="pivotOnInteractionPath")] + pub pivot_on_interaction_path: Option, + /// DFA checks to see if an impression interaction occurred within the specified period of time before a conversion. By default the value is pulled from Floodlight or you can manually enter a custom value. Valid values: 1-90. + #[serde(rename="impressionsLookbackWindow")] + pub impressions_lookback_window: Option, + /// Include conversions that have no associated cookies and no exposures. It’s therefore impossible to know how the user was exposed to your ads during the lookback window prior to a conversion. + #[serde(rename="includeUnattributedIPConversions")] + pub include_unattributed_ip_conversions: Option, + /// Include conversions of users with a DoubleClick cookie but without an exposure. That means the user did not click or see an ad from the advertiser within the Floodlight group, or that the interaction happened outside the lookback window. + #[serde(rename="includeUnattributedCookieConversions")] + pub include_unattributed_cookie_conversions: Option, + /// The maximum amount of time that can take place between interactions (clicks or impressions) by the same user. Valid values: 1-90. + #[serde(rename="maximumInteractionGap")] + pub maximum_interaction_gap: Option, + /// Deprecated: has no effect. + #[serde(rename="includeAttributedIPConversions")] + pub include_attributed_ip_conversions: Option, + /// The maximum number of click interactions to include in the report. Advertisers currently paying for E2C reports get up to 200 (100 clicks, 100 impressions). If another advertiser in your network is paying for E2C, you can have up to 5 total exposures per report. + #[serde(rename="maximumClickInteractions")] + pub maximum_click_interactions: Option, + /// The maximum number of click interactions to include in the report. Advertisers currently paying for E2C reports get up to 200 (100 clicks, 100 impressions). If another advertiser in your network is paying for E2C, you can have up to 5 total exposures per report. + #[serde(rename="maximumImpressionInteractions")] + pub maximum_impression_interactions: Option, +} + +impl NestedType for ReportPathToConversionCriteriaReportProperties {} +impl Part for ReportPathToConversionCriteriaReportProperties {} + + +/// Technology Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TechnologyTargeting { + /// Browsers that this ad targets. For each browser either set browserVersionId or dartId along with the version numbers. If both are specified, only browserVersionId will be used. The other fields are populated automatically when the ad is inserted or updated. + pub browsers: Option>, + /// Operating systems that this ad targets. To target specific versions, use operatingSystemVersions. For each operating system only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system, do not set targeting for operating system versions for the same operating system. + #[serde(rename="operatingSystems")] + pub operating_systems: Option>, + /// Mobile carriers that this ad targets. For each mobile carrier only id is required, and the other fields are populated automatically when the ad is inserted or updated. If targeting a mobile carrier, do not set targeting for any zip codes. + #[serde(rename="mobileCarriers")] + pub mobile_carriers: Option>, + /// Connection types that this ad targets. For each connection type only id is required. The other fields are populated automatically when the ad is inserted or updated. + #[serde(rename="connectionTypes")] + pub connection_types: Option>, + /// Platform types that this ad targets. For example, desktop, mobile, or tablet. For each platform type, only id is required, and the other fields are populated automatically when the ad is inserted or updated. + #[serde(rename="platformTypes")] + pub platform_types: Option>, + /// Operating system versions that this ad targets. To target all versions, use operatingSystems. For each operating system version, only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system version, do not set targeting for the corresponding operating system in operatingSystems. + #[serde(rename="operatingSystemVersions")] + pub operating_system_versions: Option>, +} + +impl Part for TechnologyTargeting {} + + +/// Language List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list languages](struct.LanguageListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LanguagesListResponse { + /// Language collection. + pub languages: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#languagesListResponse". + pub kind: Option, +} + +impl ResponseResult for LanguagesListResponse {} + + +/// Contains information about a language that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list languages](struct.LanguageListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Language { + /// Format of language code is an ISO 639 two-letter language code optionally followed by an underscore followed by an ISO 3166 code. Examples are "en" for English or "zh_CN" for Simplified Chinese. + #[serde(rename="languageCode")] + pub language_code: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#language". + pub kind: Option, + /// Language ID of this language. This is the ID used for targeting and generating reports. + pub id: Option, + /// Name of this language. + pub name: Option, +} + +impl Resource for Language {} + + +/// Represents the list of reports. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list reports](struct.ReportListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportList { + /// Continuation token used to page through reports. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The reports returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#reportList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for ReportList {} + + +/// Remarketing List Targeting Expression. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListTargetingExpression { + /// Expression describing which lists are being targeted by the ad. + pub expression: Option, +} + +impl Part for ListTargetingExpression {} + + +/// CreativeAssets contains properties of a creative asset file which will be uploaded or has already been uploaded. Refer to the creative sample code for how to upload assets and insert a creative. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creative assets](struct.CreativeAssetInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssetMetadata { + /// Dimension value for the numeric ID of the asset. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeAssetMetadata". + pub kind: Option, + /// List of feature dependencies for the creative asset that are detected by Campaign Manager. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative correctly. This is a read-only, auto-generated field. + #[serde(rename="detectedFeatures")] + pub detected_features: Option>, + /// List of detected click tags for assets. This is a read-only auto-generated field. + #[serde(rename="clickTags")] + pub click_tags: Option>, + /// Rules validated during code generation that generated a warning. This is a read-only, auto-generated field. + /// + /// Possible values are: + /// - "ADMOB_REFERENCED" + /// - "ASSET_FORMAT_UNSUPPORTED_DCM" + /// - "ASSET_INVALID" + /// - "CLICK_TAG_HARD_CODED" + /// - "CLICK_TAG_INVALID" + /// - "CLICK_TAG_IN_GWD" + /// - "CLICK_TAG_MISSING" + /// - "CLICK_TAG_MORE_THAN_ONE" + /// - "CLICK_TAG_NON_TOP_LEVEL" + /// - "COMPONENT_UNSUPPORTED_DCM" + /// - "ENABLER_UNSUPPORTED_METHOD_DCM" + /// - "EXTERNAL_FILE_REFERENCED" + /// - "FILE_DETAIL_EMPTY" + /// - "FILE_TYPE_INVALID" + /// - "GWD_PROPERTIES_INVALID" + /// - "HTML5_FEATURE_UNSUPPORTED" + /// - "LINKED_FILE_NOT_FOUND" + /// - "MAX_FLASH_VERSION_11" + /// - "MRAID_REFERENCED" + /// - "NOT_SSL_COMPLIANT" + /// - "ORPHANED_ASSET" + /// - "PRIMARY_HTML_MISSING" + /// - "SVG_INVALID" + /// - "ZIP_INVALID" + #[serde(rename="warnedValidationRules")] + pub warned_validation_rules: Option>, + /// ID of the creative asset. This is a required field. + #[serde(rename="assetIdentifier")] + pub asset_identifier: Option, + /// Numeric ID of the asset. This is a read-only, auto-generated field. + pub id: Option, +} + +impl RequestValue for CreativeAssetMetadata {} +impl ResponseResult for CreativeAssetMetadata {} + + +/// A rule associates an asset with a targeting template for asset-level targeting. Applicable to INSTREAM_VIDEO creatives. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Rule { + /// A creativeAssets[].id. This should refer to one of the parent assets in this creative. This is a required field. + #[serde(rename="assetId")] + pub asset_id: Option, + /// A targeting template ID. The targeting from the targeting template will be used to determine whether this asset should be served. This is a required field. + #[serde(rename="targetingTemplateId")] + pub targeting_template_id: Option, + /// A user-friendly name for this rule. This is a required field. + pub name: Option, +} + +impl Part for Rule {} + + +/// Companion Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteCompanionSetting { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#siteCompanionSetting". + pub kind: Option, + /// Whether companions are disabled for this site template. + #[serde(rename="companionsDisabled")] + pub companions_disabled: Option, + /// Whether to serve only static images as companions. + #[serde(rename="imageOnly")] + pub image_only: Option, + /// Whitelist of companion sizes to be served via this site template. Set this list to null or empty to serve all companion sizes. + #[serde(rename="enabledSizes")] + pub enabled_sizes: Option>, +} + +impl Part for SiteCompanionSetting {} + + +/// The report criteria for a report of type "FLOODLIGHT". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportFloodlightCriteria { + /// The floodlight ID for which to show data in this report. All advertisers associated with that ID will automatically be added. The dimension of the value needs to be 'dfa:floodlightConfigId'. + #[serde(rename="floodlightConfigId")] + pub floodlight_config_id: Option, + /// The list of dimensions the report should include. + pub dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of custom rich media events to include. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option>, + /// The list of filters on which dimensions are filtered. + /// Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// The properties of the report. + #[serde(rename="reportProperties")] + pub report_properties: Option, +} + +impl NestedType for ReportFloodlightCriteria {} +impl Part for ReportFloodlightCriteria {} + + +/// Encapsulates the list of rules for asset selection and a default asset in case none of the rules match. Applicable to INSTREAM_VIDEO creatives. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssetSelection { + /// Rules determine which asset will be served to a viewer. Rules will be evaluated in the order in which they are stored in this list. This list must contain at least one rule. Applicable to INSTREAM_VIDEO creatives. + pub rules: Option>, + /// A creativeAssets[].id. This should refer to one of the parent assets in this creative, and will be served if none of the rules match. This is a required field. + #[serde(rename="defaultAssetId")] + pub default_asset_id: Option, +} + +impl Part for CreativeAssetSelection {} + + +/// Site List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list sites](struct.SiteListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SitesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#sitesListResponse". + pub kind: Option, + /// Site collection. + pub sites: Option>, +} + +impl ResponseResult for SitesListResponse {} + + +/// Represents a dimension filter. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionFilter { + /// The name of the dimension to filter. + #[serde(rename="dimensionName")] + pub dimension_name: Option, + /// The kind of resource this is, in this case dfareporting#dimensionFilter. + pub kind: Option, + /// The value of the dimension to filter. + pub value: Option, +} + +impl Part for DimensionFilter {} + + +/// Contains information about a postal code that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get postal codes](struct.PostalCodeGetCall.html) (response) +/// * [list postal codes](struct.PostalCodeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PostalCode { + /// Postal code. This is equivalent to the id field. + pub code: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#postalCode". + pub kind: Option, + /// DART ID of the country to which this postal code belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// ID of this postal code. + pub id: Option, + /// Country code of the country to which this postal code belongs. + #[serde(rename="countryCode")] + pub country_code: Option, +} + +impl Resource for PostalCode {} +impl ResponseResult for PostalCode {} + + +/// Contains properties of a remarketing list. Remarketing enables you to create lists of users who have performed specific actions on a site, then target ads to members of those lists. This resource can be used to manage remarketing lists that are owned by your advertisers. To see all remarketing lists that are visible to your advertisers, including those that are shared to your advertiser or account, use the TargetableRemarketingLists resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert remarketing lists](struct.RemarketingListInsertCall.html) (request|response) +/// * [get remarketing lists](struct.RemarketingListGetCall.html) (response) +/// * [update remarketing lists](struct.RemarketingListUpdateCall.html) (request|response) +/// * [list remarketing lists](struct.RemarketingListListCall.html) (none) +/// * [patch remarketing lists](struct.RemarketingListPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RemarketingList { + /// Rule used to populate the remarketing list with users. + #[serde(rename="listPopulationRule")] + pub list_population_rule: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingList". + pub kind: Option, + /// Subaccount ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Remarketing list description. + pub description: Option, + /// Number of users currently in the list. This is a read-only field. + #[serde(rename="listSize")] + pub list_size: Option, + /// Number of days that a user should remain in the remarketing list without an impression. Acceptable values are 1 to 540, inclusive. + #[serde(rename="lifeSpan")] + pub life_span: Option, + /// Dimension value for the advertiser ID that owns this remarketing list. This is a required field. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Product from which this remarketing list was originated. + #[serde(rename="listSource")] + pub list_source: Option, + /// Whether this remarketing list is active. + pub active: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Account ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="accountId")] + pub account_id: Option, + /// Remarketing list ID. This is a read-only, auto-generated field. + pub id: Option, + /// Name of the remarketing list. This is a required field. Must be no greater than 128 characters long. + pub name: Option, +} + +impl RequestValue for RemarketingList {} +impl Resource for RemarketingList {} +impl ResponseResult for RemarketingList {} + + +/// Contains properties of a Floodlight activity. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get floodlight activities](struct.FloodlightActivityGetCall.html) (response) +/// * [insert floodlight activities](struct.FloodlightActivityInsertCall.html) (request|response) +/// * [patch floodlight activities](struct.FloodlightActivityPatchCall.html) (request|response) +/// * [update floodlight activities](struct.FloodlightActivityUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivity { + /// Whether this tag should use SSL. + pub secure: Option, + /// The type of Floodlight tag this activity will generate. This is a required field. + #[serde(rename="floodlightTagType")] + pub floodlight_tag_type: Option, + /// Name of the associated floodlight activity group. This is a read-only field. + #[serde(rename="floodlightActivityGroupName")] + pub floodlight_activity_group_name: Option, + /// Code type used for cache busting in the generated tag. Applicable only when floodlightActivityGroupType is COUNTER and countingMethod is STANDARD_COUNTING or UNIQUE_COUNTING. + #[serde(rename="cacheBustingType")] + pub cache_busting_type: Option, + /// Advertiser ID of this floodlight activity. If this field is left blank, the value will be copied over either from the activity group's advertiser or the existing activity's advertiser. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Dimension value for the ID of this floodlight activity. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Floodlight activity group ID of this floodlight activity. This is a required field. + #[serde(rename="floodlightActivityGroupId")] + pub floodlight_activity_group_id: Option, + /// List of the user-defined variables used by this conversion tag. These map to the "u[1-100]=" in the tags. Each of these can have a user defined type. + /// Acceptable values are U1 to U100, inclusive. + #[serde(rename="userDefinedVariableTypes")] + pub user_defined_variable_types: Option>, + /// Value of the cat= parameter in the floodlight tag, which the ad servers use to identify the activity. This is optional: if empty, a new tag string will be generated for you. This string must be 1 to 8 characters long, with valid characters being [a-z][A-Z][0-9][-][ _ ]. This tag string must also be unique among activities of the same activity group. This field is read-only after insertion. + #[serde(rename="tagString")] + pub tag_string: Option, + /// Tag string of the associated floodlight activity group. This is a read-only field. + #[serde(rename="floodlightActivityGroupTagString")] + pub floodlight_activity_group_tag_string: Option, + /// URL where this tag will be deployed. If specified, must be less than 256 characters long. + #[serde(rename="expectedUrl")] + pub expected_url: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivity". + pub kind: Option, + /// Subaccount ID of this floodlight activity. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this floodlight activity. This is a required field. Must be less than 129 characters long and cannot contain quotes. + pub name: Option, + /// Publisher dynamic floodlight tags. + #[serde(rename="publisherTags")] + pub publisher_tags: Option>, + /// Whether the floodlight activity is SSL-compliant. This is a read-only field, its value detected by the system from the floodlight tags. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// General notes or implementation instructions for the tag. + pub notes: Option, + /// Floodlight configuration ID of this floodlight activity. If this field is left blank, the value will be copied over either from the activity group's floodlight configuration or from the existing activity's floodlight configuration. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// ID of this floodlight activity. This is a read-only, auto-generated field. + pub id: Option, + /// Counting method for conversions for this floodlight activity. This is a required field. + #[serde(rename="countingMethod")] + pub counting_method: Option, + /// Dynamic floodlight tags. + #[serde(rename="defaultTags")] + pub default_tags: Option>, + /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="floodlightConfigurationIdDimensionValue")] + pub floodlight_configuration_id_dimension_value: Option, + /// Tag format type for the floodlight activity. If left blank, the tag format will default to HTML. + #[serde(rename="tagFormat")] + pub tag_format: Option, + /// Whether this activity is archived. + pub hidden: Option, + /// Account ID of this floodlight activity. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Whether this floodlight activity must be SSL-compliant. + #[serde(rename="sslRequired")] + pub ssl_required: Option, + /// Type of the associated floodlight activity group. This is a read-only field. + #[serde(rename="floodlightActivityGroupType")] + pub floodlight_activity_group_type: Option, +} + +impl RequestValue for FloodlightActivity {} +impl ResponseResult for FloodlightActivity {} + + +/// Contains information about a browser that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list browsers](struct.BrowserListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Browser { + /// Major version number (leftmost number) of this browser. For example, for Chrome 5.0.376.86 beta, this field should be set to 5. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is. + #[serde(rename="majorVersion")] + pub major_version: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#browser". + pub kind: Option, + /// ID referring to this grouping of browser and version numbers. This is the ID used for targeting. + #[serde(rename="browserVersionId")] + pub browser_version_id: Option, + /// Name of this browser. + pub name: Option, + /// DART ID of this browser. This is the ID used when generating reports. + #[serde(rename="dartId")] + pub dart_id: Option, + /// Minor version number (number after first dot on left) of this browser. For example, for Chrome 5.0.375.86 beta, this field should be set to 0. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is. + #[serde(rename="minorVersion")] + pub minor_version: Option, +} + +impl Resource for Browser {} + + +/// Account User Profile List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account user profiles](struct.AccountUserProfileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountUserProfilesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Account user profile collection. + #[serde(rename="accountUserProfiles")] + pub account_user_profiles: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountUserProfilesListResponse". + pub kind: Option, +} + +impl ResponseResult for AccountUserProfilesListResponse {} + + +/// Contains properties of a Campaign Manager advertiser. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get advertisers](struct.AdvertiserGetCall.html) (response) +/// * [update advertisers](struct.AdvertiserUpdateCall.html) (request|response) +/// * [patch advertisers](struct.AdvertiserPatchCall.html) (request|response) +/// * [list advertisers](struct.AdvertiserListCall.html) (none) +/// * [insert advertisers](struct.AdvertiserInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Advertiser { + /// Status of this advertiser. + pub status: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiser". + pub kind: Option, + /// Subaccount ID of this advertiser.This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this advertiser. This is a required field and must be less than 256 characters long and unique among advertisers of the same account. + pub name: Option, + /// ID of the click-through event tag to apply by default to the landing pages of this advertiser's campaigns. + #[serde(rename="defaultClickThroughEventTagId")] + pub default_click_through_event_tag_id: Option, + /// Original floodlight configuration before any sharing occurred. Set the floodlightConfigurationId of this advertiser to originalFloodlightConfigurationId to unshare the advertiser's current floodlight configuration. You cannot unshare an advertiser's floodlight configuration if the shared configuration has activities associated with any campaign or placement. + #[serde(rename="originalFloodlightConfigurationId")] + pub original_floodlight_configuration_id: Option, + /// Suffix added to click-through URL of ad creative associations under this advertiser. Must be less than 129 characters long. + #[serde(rename="clickThroughUrlSuffix")] + pub click_through_url_suffix: Option, + /// Floodlight configuration ID of this advertiser. The floodlight configuration ID will be created automatically, so on insert this field should be left blank. This field can be set to another advertiser's floodlight configuration ID in order to share that advertiser's floodlight configuration with this advertiser, so long as: + /// - This advertiser's original floodlight configuration is not already associated with floodlight activities or floodlight activity groups. + /// - This advertiser's original floodlight configuration is not already shared with another advertiser. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// ID of the advertiser group this advertiser belongs to. You can group advertisers for reporting purposes, allowing you to see aggregated information for all advertisers in each group. + #[serde(rename="advertiserGroupId")] + pub advertiser_group_id: Option, + /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="floodlightConfigurationIdDimensionValue")] + pub floodlight_configuration_id_dimension_value: Option, + /// Suspension status of this advertiser. + pub suspended: Option, + /// Dimension value for the ID of this advertiser. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Default email address used in sender field for tag emails. + #[serde(rename="defaultEmail")] + pub default_email: Option, + /// ID of this advertiser. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this advertiser.This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for Advertiser {} +impl Resource for Advertiser {} +impl ResponseResult for Advertiser {} + + +/// Platform Type List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list platform types](struct.PlatformTypeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlatformTypesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#platformTypesListResponse". + pub kind: Option, + /// Platform type collection. + #[serde(rename="platformTypes")] + pub platform_types: Option>, +} + +impl ResponseResult for PlatformTypesListResponse {} + + +/// A description of how user IDs are encrypted. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EncryptionInfo { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#encryptionInfo". + pub kind: Option, + /// The encryption entity ID. This should match the encryption configuration for ad serving or Data Transfer. + #[serde(rename="encryptionEntityId")] + pub encryption_entity_id: Option, + /// Describes whether the encrypted cookie was received from ad serving (the %m macro) or from Data Transfer. + #[serde(rename="encryptionSource")] + pub encryption_source: Option, + /// The encryption entity type. This should match the encryption configuration for ad serving or Data Transfer. + #[serde(rename="encryptionEntityType")] + pub encryption_entity_type: Option, +} + +impl Part for EncryptionInfo {} + + +/// Placement List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list placements](struct.PlacementListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementsListResponse". + pub kind: Option, + /// Placement collection. + pub placements: Option>, +} + +impl ResponseResult for PlacementsListResponse {} + + +/// Ad List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list ads](struct.AdListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#adsListResponse". + pub kind: Option, + /// Ad collection. + pub ads: Option>, +} + +impl ResponseResult for AdsListResponse {} + + +/// The report criteria for a report of type "REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportReachCriteria { + /// Activity group. + pub activities: Option, + /// The list of dimensions the report should include. + pub dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of filters on which dimensions are filtered. + /// Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// The list of names of Reach By Frequency metrics the report should include. + #[serde(rename="reachByFrequencyMetricNames")] + pub reach_by_frequency_metric_names: Option>, + /// Custom Rich Media Events group. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option, + /// Whether to enable all reach dimension combinations in the report. Defaults to false. If enabled, the date range of the report should be within the last 42 days. + #[serde(rename="enableAllDimensionCombinations")] + pub enable_all_dimension_combinations: Option, +} + +impl NestedType for ReportReachCriteria {} +impl Part for ReportReachCriteria {} + + +/// The URLs where the completed report file can be downloaded. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileUrls { + /// The URL for downloading the report data through a browser. + #[serde(rename="browserUrl")] + pub browser_url: Option, + /// The URL for downloading the report data through the API. + #[serde(rename="apiUrl")] + pub api_url: Option, +} + +impl NestedType for FileUrls {} +impl Part for FileUrls {} + + +/// Order document List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list order documents](struct.OrderDocumentListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderDocumentsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#orderDocumentsListResponse". + pub kind: Option, + /// Order document collection + #[serde(rename="orderDocuments")] + pub order_documents: Option>, +} + +impl ResponseResult for OrderDocumentsListResponse {} + + +/// User Defined Variable configuration. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserDefinedVariableConfiguration { + /// Data type for the variable. This is a required field. + #[serde(rename="dataType")] + pub data_type: Option, + /// User-friendly name for the variable which will appear in reports. This is a required field, must be less than 64 characters long, and cannot contain the following characters: ""<>". + #[serde(rename="reportName")] + pub report_name: Option, + /// Variable name in the tag. This is a required field. + #[serde(rename="variableType")] + pub variable_type: Option, +} + +impl Part for UserDefinedVariableConfiguration {} + + +/// Pricing Information +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Pricing { + /// Group type of this inventory item if it represents a placement group. Is null otherwise. There are two type of placement groups: PLANNING_PLACEMENT_GROUP_TYPE_PACKAGE is a simple group of inventory items that acts as a single pricing point for a group of tags. PLANNING_PLACEMENT_GROUP_TYPE_ROADBLOCK is a group of inventory items that not only acts as a single pricing point, but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned inventory items to be marked as primary. + #[serde(rename="groupType")] + pub group_type: Option, + /// Start date of this inventory item. + #[serde(rename="startDate")] + pub start_date: Option, + /// Flights of this inventory item. A flight (a.k.a. pricing period) represents the inventory item pricing information for a specific period of time. + pub flights: Option>, + /// End date of this inventory item. + #[serde(rename="endDate")] + pub end_date: Option, + /// Pricing type of this inventory item. + #[serde(rename="pricingType")] + pub pricing_type: Option, + /// Cap cost type of this inventory item. + #[serde(rename="capCostType")] + pub cap_cost_type: Option, +} + +impl Part for Pricing {} + + +/// Skippable Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SkippableSetting { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#skippableSetting". + pub kind: Option, + /// Amount of time to play videos served to this placement before the skip button should appear. Applicable when skippable is true. + #[serde(rename="skipOffset")] + pub skip_offset: Option, + /// Whether the user can skip creatives served to this placement. + pub skippable: Option, + /// Amount of time to play videos served to this placement before counting a view. Applicable when skippable is true. + #[serde(rename="progressOffset")] + pub progress_offset: Option, +} + +impl Part for SkippableSetting {} + + +/// Contains information about where a user's browser is taken after the user clicks an ad. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert advertiser landing pages](struct.AdvertiserLandingPageInsertCall.html) (request|response) +/// * [patch advertiser landing pages](struct.AdvertiserLandingPagePatchCall.html) (request|response) +/// * [get advertiser landing pages](struct.AdvertiserLandingPageGetCall.html) (response) +/// * [update advertiser landing pages](struct.AdvertiserLandingPageUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LandingPage { + /// Advertiser ID of this landing page. This is a required field. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Whether this landing page has been archived. + pub archived: Option, + /// Name of this landing page. This is a required field. It must be less than 256 characters long. + pub name: Option, + /// URL of this landing page. This is a required field. + pub url: Option, + /// Links that will direct the user to a mobile app, if installed. + #[serde(rename="deepLinks")] + pub deep_links: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#landingPage". + pub kind: Option, + /// ID of this landing page. This is a read-only, auto-generated field. + pub id: Option, +} + +impl RequestValue for LandingPage {} +impl ResponseResult for LandingPage {} + + +/// Represents the dimensions of ads, placements, creatives, or creative assets. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert sizes](struct.SizeInsertCall.html) (request|response) +/// * [get sizes](struct.SizeGetCall.html) (response) +/// * [list sizes](struct.SizeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Size { + /// Width of this size. Acceptable values are 0 to 32767, inclusive. + pub width: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#size". + pub kind: Option, + /// Height of this size. Acceptable values are 0 to 32767, inclusive. + pub height: Option, + /// ID of this size. This is a read-only, auto-generated field. + pub id: Option, + /// IAB standard size. This is a read-only, auto-generated field. + pub iab: Option, +} + +impl RequestValue for Size {} +impl Resource for Size {} +impl ResponseResult for Size {} + + +/// Contains information about a city that can be targeted by ads. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct City { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#city". + pub kind: Option, + /// DART ID of the country to which this city belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// Name of this city. + pub name: Option, + /// Country code of the country to which this city belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Metro region code of the metro region (DMA) to which this city belongs. + #[serde(rename="metroCode")] + pub metro_code: Option, + /// Region code of the region to which this city belongs. + #[serde(rename="regionCode")] + pub region_code: Option, + /// ID of the metro region (DMA) to which this city belongs. + #[serde(rename="metroDmaId")] + pub metro_dma_id: Option, + /// DART ID of this city. This is the ID used for targeting and generating reports. + #[serde(rename="dartId")] + pub dart_id: Option, + /// DART ID of the region to which this city belongs. + #[serde(rename="regionDartId")] + pub region_dart_id: Option, +} + +impl Part for City {} + + +/// Click Through URL Suffix settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClickThroughUrlSuffixProperties { + /// Click-through URL suffix to apply to all ads in this entity's scope. Must be less than 128 characters long. + #[serde(rename="clickThroughUrlSuffix")] + pub click_through_url_suffix: Option, + /// Whether this entity should override the inherited click-through URL suffix with its own defined value. + #[serde(rename="overrideInheritedSuffix")] + pub override_inherited_suffix: Option, +} + +impl Part for ClickThroughUrlSuffixProperties {} + + +/// Contains properties of a package or roadblock. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update placement groups](struct.PlacementGroupUpdateCall.html) (request|response) +/// * [patch placement groups](struct.PlacementGroupPatchCall.html) (request|response) +/// * [get placement groups](struct.PlacementGroupGetCall.html) (response) +/// * [insert placement groups](struct.PlacementGroupInsertCall.html) (request|response) +/// * [list placement groups](struct.PlacementGroupListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementGroup { + /// Comments for this placement group. + pub comment: Option, + /// ID of the primary placement, used to calculate the media cost of a roadblock (placement group). Modifying this field will automatically modify the primary field on all affected roadblock child placements. + #[serde(rename="primaryPlacementId")] + pub primary_placement_id: Option, + /// Campaign ID of this placement group. This field is required on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Dimension value for the ID of the primary placement. This is a read-only, auto-generated field. + #[serde(rename="primaryPlacementIdDimensionValue")] + pub primary_placement_id_dimension_value: Option, + /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field. + #[serde(rename="directorySiteIdDimensionValue")] + pub directory_site_id_dimension_value: Option, + /// Advertiser ID of this placement group. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Directory site ID associated with this placement group. On insert, you must set either this field or the site_id field to specify the site associated with this placement group. This is a required field that is read-only after insertion. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Information about the creation of this placement group. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Site ID associated with this placement group. On insert, you must set either this field or the directorySiteId field to specify the site associated with this placement group. This is a required field that is read-only after insertion. + #[serde(rename="siteId")] + pub site_id: Option, + /// Pricing schedule of this placement group. This field is required on insertion. + #[serde(rename="pricingSchedule")] + pub pricing_schedule: Option, + /// Dimension value for the ID of the site. This is a read-only, auto-generated field. + #[serde(rename="siteIdDimensionValue")] + pub site_id_dimension_value: Option, + /// Type of this placement group. A package is a simple group of placements that acts as a single pricing point for a group of tags. A roadblock is a group of placements that not only acts as a single pricing point, but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned placements to be marked as primary for reporting. This field is required on insertion. + #[serde(rename="placementGroupType")] + pub placement_group_type: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Whether this placement group is archived. + pub archived: Option, + /// ID of this placement group. This is a read-only, auto-generated field. + pub id: Option, + /// ID of the placement strategy assigned to this placement group. + #[serde(rename="placementStrategyId")] + pub placement_strategy_id: Option, + /// Account ID of this placement group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Subaccount ID of this placement group. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this placement group. This is a required field and must be less than 256 characters long. + pub name: Option, + /// IDs of placements which are assigned to this placement group. This is a read-only, auto-generated field. + #[serde(rename="childPlacementIds")] + pub child_placement_ids: Option>, + /// Information about the most recent modification of this placement group. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementGroup". + pub kind: Option, + /// ID of the content category assigned to this placement group. + #[serde(rename="contentCategoryId")] + pub content_category_id: Option, + /// External ID for this placement. + #[serde(rename="externalId")] + pub external_id: Option, + /// Dimension value for the ID of this placement group. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, +} + +impl RequestValue for PlacementGroup {} +impl Resource for PlacementGroup {} +impl ResponseResult for PlacementGroup {} + + +/// Third-party Tracking URL. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ThirdPartyTrackingUrl { + /// URL for the specified third-party URL type. + pub url: Option, + /// Third-party URL type for in-stream video and in-stream audio creatives. + #[serde(rename="thirdPartyUrlType")] + pub third_party_url_type: Option, +} + +impl Part for ThirdPartyTrackingUrl {} + + +/// Represents a date range. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DateRange { + /// The start date of the date range, inclusive. A string of the format: "yyyy-MM-dd". + #[serde(rename="startDate")] + pub start_date: Option, + /// The kind of resource this is, in this case dfareporting#dateRange. + pub kind: Option, + /// The end date of the date range, inclusive. A string of the format: "yyyy-MM-dd". + #[serde(rename="endDate")] + pub end_date: Option, + /// The date range relative to the date of when the report is run. + #[serde(rename="relativeDateRange")] + pub relative_date_range: Option, +} + +impl Part for DateRange {} + + +/// Metro List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list metros](struct.MetroListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MetrosListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#metrosListResponse". + pub kind: Option, + /// Metro collection. + pub metros: Option>, +} + +impl ResponseResult for MetrosListResponse {} + + +/// Pricing Schedule +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PricingSchedule { + /// Placement start date. This date must be later than, or the same day as, the campaign start date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. This field is required on insertion. + #[serde(rename="startDate")] + pub start_date: Option, + /// Placement end date. This date must be later than, or the same day as, the placement start date, but not later than the campaign end date. If, for example, you set 6/25/2015 as both the start and end dates, the effective placement date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. This field is required on insertion. + #[serde(rename="endDate")] + pub end_date: Option, + /// Whether this placement is flighted. If true, pricing periods will be computed automatically. + pub flighted: Option, + /// Whether cap costs are ignored by ad serving. + #[serde(rename="disregardOverdelivery")] + pub disregard_overdelivery: Option, + /// Placement cap cost option. + #[serde(rename="capCostOption")] + pub cap_cost_option: Option, + /// Pricing periods for this placement. + #[serde(rename="pricingPeriods")] + pub pricing_periods: Option>, + /// Placement pricing type. This field is required on insertion. + #[serde(rename="pricingType")] + pub pricing_type: Option, + /// Testing start date of this placement. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. + #[serde(rename="testingStartDate")] + pub testing_start_date: Option, + /// Floodlight activity ID associated with this placement. This field should be set when placement pricing type is set to PRICING_TYPE_CPA. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, +} + +impl Part for PricingSchedule {} + + +/// Account List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list accounts](struct.AccountListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountsListResponse". + pub kind: Option, + /// Account collection. + pub accounts: Option>, +} + +impl ResponseResult for AccountsListResponse {} + + +/// Targeting Template List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list targeting templates](struct.TargetingTemplateListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetingTemplatesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetingTemplatesListResponse". + pub kind: Option, + /// Targeting template collection. + #[serde(rename="targetingTemplates")] + pub targeting_templates: Option>, +} + +impl ResponseResult for TargetingTemplatesListResponse {} + + +/// Contains properties of a creative group. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get creative groups](struct.CreativeGroupGetCall.html) (response) +/// * [update creative groups](struct.CreativeGroupUpdateCall.html) (request|response) +/// * [patch creative groups](struct.CreativeGroupPatchCall.html) (request|response) +/// * [list creative groups](struct.CreativeGroupListCall.html) (none) +/// * [insert creative groups](struct.CreativeGroupInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeGroup". + pub kind: Option, + /// Subaccount ID of this creative group. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this creative group. This is a required field and must be less than 256 characters long and unique among creative groups of the same advertiser. + pub name: Option, + /// Subgroup of the creative group. Assign your creative groups to a subgroup in order to filter or manage them more easily. This field is required on insertion and is read-only after insertion. Acceptable values are 1 to 2, inclusive. + #[serde(rename="groupNumber")] + pub group_number: Option, + /// Advertiser ID of this creative group. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of this creative group. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this creative group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for CreativeGroup {} +impl Resource for CreativeGroup {} +impl ResponseResult for CreativeGroup {} + + +/// Update Conversions Response. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batchupdate conversions](struct.ConversionBatchupdateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConversionsBatchUpdateResponse { + /// The update status of each conversion. Statuses are returned in the same order that conversions are updated. + pub status: Option>, + /// Indicates that some or all conversions failed to update. + #[serde(rename="hasFailures")] + pub has_failures: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionsBatchUpdateResponse". + pub kind: Option, +} + +impl ResponseResult for ConversionsBatchUpdateResponse {} + + +/// The original conversion that was inserted or updated and whether there were any errors. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConversionStatus { + /// The original conversion that was inserted or updated. + pub conversion: Option, + /// A list of errors related to this conversion. + pub errors: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionStatus". + pub kind: Option, +} + +impl Part for ConversionStatus {} + + +/// Custom Viewability Metric +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CustomViewabilityMetric { + /// Configuration of the custom viewability metric. + pub configuration: Option, + /// ID of the custom viewability metric. + pub id: Option, + /// Name of the custom viewability metric. + pub name: Option, +} + +impl Part for CustomViewabilityMetric {} + + +/// Video Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteVideoSettings { + /// Settings for the skippability of video creatives served to this site. This will act as default for new placements created under this site. + #[serde(rename="skippableSettings")] + pub skippable_settings: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#siteVideoSettings". + pub kind: Option, + /// Settings for the companion creatives of video creatives served to this site. + #[serde(rename="companionSettings")] + pub companion_settings: Option, + /// Orientation of a site template used for video. This will act as default for new placements created under this site. + pub orientation: Option, + /// Settings for the transcodes of video creatives served to this site. This will act as default for new placements created under this site. + #[serde(rename="transcodeSettings")] + pub transcode_settings: Option, +} + +impl Part for SiteVideoSettings {} + + +/// Represents an activity group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Activities { + /// The kind of resource this is, in this case dfareporting#activities. + pub kind: Option, + /// List of activity filters. The dimension values need to be all either of type "dfa:activity" or "dfa:activityGroup". + pub filters: Option>, + /// List of names of floodlight activity metrics. + #[serde(rename="metricNames")] + pub metric_names: Option>, +} + +impl Part for Activities {} + + +/// A group clause made up of list population terms representing constraints joined by ORs. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListPopulationClause { + /// Terms of this list population clause. Each clause is made up of list population terms representing constraints and are joined by ORs. + pub terms: Option>, +} + +impl Part for ListPopulationClause {} + + +/// Represents fields that are compatible to be selected for a report of type "FlOODLIGHT". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#floodlightReportCompatibleFields. + pub kind: Option, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// Dimensions which are compatible to be selected in the "dimensions" section of the report. + pub dimensions: Option>, +} + +impl Part for FloodlightReportCompatibleFields {} + + +/// Flight +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Flight { + /// Rate or cost of this flight. + #[serde(rename="rateOrCost")] + pub rate_or_cost: Option, + /// Inventory item flight start date. + #[serde(rename="startDate")] + pub start_date: Option, + /// Units of this flight. + pub units: Option, + /// Inventory item flight end date. + #[serde(rename="endDate")] + pub end_date: Option, +} + +impl Part for Flight {} + + +/// Represents a sorted dimension. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SortedDimension { + /// The kind of resource this is, in this case dfareporting#sortedDimension. + pub kind: Option, + /// The name of the dimension. + pub name: Option, + /// An optional sort order for the dimension column. + #[serde(rename="sortOrder")] + pub sort_order: Option, +} + +impl Part for SortedDimension {} + + +/// Skippable Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteSkippableSetting { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#siteSkippableSetting". + pub kind: Option, + /// Amount of time to play videos served to this site before the skip button should appear. Applicable when skippable is true. + #[serde(rename="skipOffset")] + pub skip_offset: Option, + /// Whether the user can skip creatives served to this site. This will act as default for new placements created under this site. + pub skippable: Option, + /// Amount of time to play videos served to this site template before counting a view. Applicable when skippable is true. + #[serde(rename="progressOffset")] + pub progress_offset: Option, +} + +impl Part for SiteSkippableSetting {} + + +/// Contains information about a mobile app. Used as a landing page deep link. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get mobile apps](struct.MobileAppGetCall.html) (response) +/// * [list mobile apps](struct.MobileAppListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MobileApp { + /// Mobile app directory. + pub directory: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileApp". + pub kind: Option, + /// Publisher name. + #[serde(rename="publisherName")] + pub publisher_name: Option, + /// ID of this mobile app. + pub id: Option, + /// Title of this mobile app. + pub title: Option, +} + +impl Resource for MobileApp {} +impl ResponseResult for MobileApp {} + + +/// Placement Strategy List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list placement strategies](struct.PlacementStrategyListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementStrategiesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementStrategiesListResponse". + pub kind: Option, + /// Placement strategy collection. + #[serde(rename="placementStrategies")] + pub placement_strategies: Option>, +} + +impl ResponseResult for PlacementStrategiesListResponse {} + + +/// Language Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LanguageTargeting { + /// Languages that this ad targets. For each language only languageId is required. The other fields are populated automatically when the ad is inserted or updated. + pub languages: Option>, +} + +impl Part for LanguageTargeting {} + + +/// Contains information about an operating system that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get operating systems](struct.OperatingSystemGetCall.html) (response) +/// * [list operating systems](struct.OperatingSystemListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystem { + /// Whether this operating system is for mobile. + pub mobile: Option, + /// DART ID of this operating system. This is the ID used for targeting. + #[serde(rename="dartId")] + pub dart_id: Option, + /// Whether this operating system is for desktop. + pub desktop: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystem". + pub kind: Option, + /// Name of this operating system. + pub name: Option, +} + +impl Resource for OperatingSystem {} +impl ResponseResult for OperatingSystem {} + + +/// Third Party Authentication Token +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ThirdPartyAuthenticationToken { + /// Name of the third-party authentication token. + pub name: Option, + /// Value of the third-party authentication token. This is a read-only, auto-generated field. + pub value: Option, +} + +impl Part for ThirdPartyAuthenticationToken {} + + +/// Groups advertisers together so that reports can be generated for the entire group at once. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete advertiser groups](struct.AdvertiserGroupDeleteCall.html) (none) +/// * [get advertiser groups](struct.AdvertiserGroupGetCall.html) (response) +/// * [update advertiser groups](struct.AdvertiserGroupUpdateCall.html) (request|response) +/// * [list advertiser groups](struct.AdvertiserGroupListCall.html) (none) +/// * [patch advertiser groups](struct.AdvertiserGroupPatchCall.html) (request|response) +/// * [insert advertiser groups](struct.AdvertiserGroupInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdvertiserGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiserGroup". + pub kind: Option, + /// Account ID of this advertiser group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this advertiser group. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this advertiser group. This is a required field and must be less than 256 characters long and unique among advertiser groups of the same account. + pub name: Option, +} + +impl RequestValue for AdvertiserGroup {} +impl Resource for AdvertiserGroup {} +impl ResponseResult for AdvertiserGroup {} + + +/// FsCommand. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FsCommand { + /// Height of the window. + #[serde(rename="windowHeight")] + pub window_height: Option, + /// Distance from the top of the browser. Applicable when positionOption is DISTANCE_FROM_TOP_LEFT_CORNER. + pub top: Option, + /// Width of the window. + #[serde(rename="windowWidth")] + pub window_width: Option, + /// Position in the browser where the window will open. + #[serde(rename="positionOption")] + pub position_option: Option, + /// Distance from the left of the browser.Applicable when positionOption is DISTANCE_FROM_TOP_LEFT_CORNER. + pub left: Option, +} + +impl Part for FsCommand {} + + +/// Creative optimization settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeOptimizationConfiguration { + /// List of optimization activities associated with this configuration. + #[serde(rename="optimizationActivitys")] + pub optimization_activitys: Option>, + /// ID of this creative optimization config. This field is auto-generated when the campaign is inserted or updated. It can be null for existing campaigns. + pub id: Option, + /// Name of this creative optimization config. This is a required field and must be less than 129 characters long. + pub name: Option, + /// Optimization model for this configuration. + #[serde(rename="optimizationModel")] + pub optimization_model: Option, +} + +impl Part for CreativeOptimizationConfiguration {} + + +/// Creative Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative groups](struct.CreativeGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Creative group collection. + #[serde(rename="creativeGroups")] + pub creative_groups: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeGroupsListResponse". + pub kind: Option, +} + +impl ResponseResult for CreativeGroupsListResponse {} + + +/// Offset Position. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OffsetPosition { + /// Offset distance from top side of an asset or a window. + pub top: Option, + /// Offset distance from left side of an asset or a window. + pub left: Option, +} + +impl Part for OffsetPosition {} + + +/// Target Window. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetWindow { + /// User-entered value. + #[serde(rename="customHtml")] + pub custom_html: Option, + /// Type of browser window for which the backup image of the flash creative can be displayed. + #[serde(rename="targetWindowOption")] + pub target_window_option: Option, +} + +impl Part for TargetWindow {} + + +/// Contains properties of a user role permission. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get user role permissions](struct.UserRolePermissionGetCall.html) (response) +/// * [list user role permissions](struct.UserRolePermissionListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermission { + /// ID of the permission group that this user role permission belongs to. + #[serde(rename="permissionGroupId")] + pub permission_group_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermission". + pub kind: Option, + /// Levels of availability for a user role permission. + pub availability: Option, + /// ID of this user role permission. + pub id: Option, + /// Name of this user role permission. + pub name: Option, +} + +impl Resource for UserRolePermission {} +impl ResponseResult for UserRolePermission {} + + +/// Site Contact +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteContact { + /// First name of this site contact. + #[serde(rename="firstName")] + pub first_name: Option, + /// Title or designation of this site contact. + pub title: Option, + /// Last name of this site contact. + #[serde(rename="lastName")] + pub last_name: Option, + /// Site contact type. + #[serde(rename="contactType")] + pub contact_type: Option, + /// ID of this site contact. This is a read-only, auto-generated field. + pub id: Option, + /// Primary phone number of this site contact. + pub phone: Option, + /// Address of this site contact. + pub address: Option, + /// Email address of this site contact. This is a required field. + pub email: Option, +} + +impl Part for SiteContact {} + + +/// Creative Rotation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeRotation { + /// Creative assignments in this creative rotation. + #[serde(rename="creativeAssignments")] + pub creative_assignments: Option>, + /// Strategy for calculating weights. Used with CREATIVE_ROTATION_TYPE_RANDOM. + #[serde(rename="weightCalculationStrategy")] + pub weight_calculation_strategy: Option, + /// Creative optimization configuration that is used by this ad. It should refer to one of the existing optimization configurations in the ad's campaign. If it is unset or set to 0, then the campaign's default optimization configuration will be used for this ad. + #[serde(rename="creativeOptimizationConfigurationId")] + pub creative_optimization_configuration_id: Option, + /// Type of creative rotation. Can be used to specify whether to use sequential or random rotation. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for CreativeRotation {} + + +/// Contains information about a metro region that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list metros](struct.MetroListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Metro { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#metro". + pub kind: Option, + /// DART ID of the country to which this metro region belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// Name of this metro region. + pub name: Option, + /// Country code of the country to which this metro region belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Metro code of this metro region. This is equivalent to dma_id. + #[serde(rename="metroCode")] + pub metro_code: Option, + /// DART ID of this metro region. + #[serde(rename="dartId")] + pub dart_id: Option, + /// DMA ID of this metro region. This is the ID used for targeting and generating reports, and is equivalent to metro_code. + #[serde(rename="dmaId")] + pub dma_id: Option, +} + +impl Resource for Metro {} + + +/// Contains information about a country that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get countries](struct.CountryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Country { + /// DART ID of this country. This is the ID used for targeting and generating reports. + #[serde(rename="dartId")] + pub dart_id: Option, + /// Whether ad serving supports secure servers in this country. + #[serde(rename="sslEnabled")] + pub ssl_enabled: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#country". + pub kind: Option, + /// Country code. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Name of this country. + pub name: Option, +} + +impl ResponseResult for Country {} + + +/// Postal Code List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list postal codes](struct.PostalCodeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PostalCodesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#postalCodesListResponse". + pub kind: Option, + /// Postal code collection. + #[serde(rename="postalCodes")] + pub postal_codes: Option>, +} + +impl ResponseResult for PostalCodesListResponse {} + + +/// Video Format List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list video formats](struct.VideoFormatListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VideoFormatsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#videoFormatsListResponse". + pub kind: Option, + /// Video format collection. + #[serde(rename="videoFormats")] + pub video_formats: Option>, +} + +impl ResponseResult for VideoFormatsListResponse {} + + +/// Contains properties of a creative field. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative fields](struct.CreativeFieldListCall.html) (none) +/// * [update creative fields](struct.CreativeFieldUpdateCall.html) (request|response) +/// * [get creative fields](struct.CreativeFieldGetCall.html) (response) +/// * [insert creative fields](struct.CreativeFieldInsertCall.html) (request|response) +/// * [delete creative fields](struct.CreativeFieldDeleteCall.html) (none) +/// * [patch creative fields](struct.CreativeFieldPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeField { + /// Advertiser ID of this creative field. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeField". + pub kind: Option, + /// Subaccount ID of this creative field. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this creative field. This is a required field and must be less than 256 characters long and unique among creative fields of the same advertiser. + pub name: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of this creative field. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this creative field. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for CreativeField {} +impl Resource for CreativeField {} +impl ResponseResult for CreativeField {} + + +/// Creative Field Value List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative field values](struct.CreativeFieldValueListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldValuesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldValuesListResponse". + pub kind: Option, + /// Creative field value collection. + #[serde(rename="creativeFieldValues")] + pub creative_field_values: Option>, +} + +impl ResponseResult for CreativeFieldValuesListResponse {} + + +/// Placement Tag Data +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TagData { + /// Tag string to record a click. + #[serde(rename="clickTag")] + pub click_tag: Option, + /// Tag string for serving an ad. + #[serde(rename="impressionTag")] + pub impression_tag: Option, + /// Creative associated with this placement tag. Applicable only when format is PLACEMENT_TAG_TRACKING. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// Ad associated with this placement tag. Applicable only when format is PLACEMENT_TAG_TRACKING. + #[serde(rename="adId")] + pub ad_id: Option, + /// TagData tag format of this tag. + pub format: Option, +} + +impl Part for TagData {} + + +/// The properties of the report. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportFloodlightCriteriaReportProperties { + /// Include conversions that have no associated cookies and no exposures. It’s therefore impossible to know how the user was exposed to your ads during the lookback window prior to a conversion. + #[serde(rename="includeUnattributedIPConversions")] + pub include_unattributed_ip_conversions: Option, + /// Include conversions of users with a DoubleClick cookie but without an exposure. That means the user did not click or see an ad from the advertiser within the Floodlight group, or that the interaction happened outside the lookback window. + #[serde(rename="includeUnattributedCookieConversions")] + pub include_unattributed_cookie_conversions: Option, + /// Include conversions that have no cookie, but do have an exposure path. + #[serde(rename="includeAttributedIPConversions")] + pub include_attributed_ip_conversions: Option, +} + +impl NestedType for ReportFloodlightCriteriaReportProperties {} +impl Part for ReportFloodlightCriteriaReportProperties {} + + +/// Insert Conversions Response. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batchinsert conversions](struct.ConversionBatchinsertCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConversionsBatchInsertResponse { + /// The insert status of each conversion. Statuses are returned in the same order that conversions are inserted. + pub status: Option>, + /// Indicates that some or all conversions failed to insert. + #[serde(rename="hasFailures")] + pub has_failures: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionsBatchInsertResponse". + pub kind: Option, +} + +impl ResponseResult for ConversionsBatchInsertResponse {} + + +/// Represents a DimensionValue resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query dimension values](struct.DimensionValueQueryCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionValue { + /// The name of the dimension. + #[serde(rename="dimensionName")] + pub dimension_name: Option, + /// The kind of resource this is, in this case dfareporting#dimensionValue. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// Determines how the 'value' field is matched when filtering. If not specified, defaults to EXACT. If set to WILDCARD_EXPRESSION, '*' is allowed as a placeholder for variable length character sequences, and it can be escaped with a backslash. Note, only paid search dimensions ('dfa:paidSearch*') allow a matchType other than EXACT. + #[serde(rename="matchType")] + pub match_type: Option, + /// The ID associated with the value if available. + pub id: Option, + /// The value of the dimension. + pub value: Option, +} + +impl Resource for DimensionValue {} + + +/// Content Category List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list content categories](struct.ContentCategoryListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ContentCategoriesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#contentCategoriesListResponse". + pub kind: Option, + /// Content category collection. + #[serde(rename="contentCategories")] + pub content_categories: Option>, +} + +impl ResponseResult for ContentCategoriesListResponse {} + + +/// Floodlight Configuration List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight configurations](struct.FloodlightConfigurationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightConfigurationsListResponse { + /// Floodlight configuration collection. + #[serde(rename="floodlightConfigurations")] + pub floodlight_configurations: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightConfigurationsListResponse". + pub kind: Option, +} + +impl ResponseResult for FloodlightConfigurationsListResponse {} + + +/// Describes properties of a Planning order. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list orders](struct.OrderListCall.html) (none) +/// * [get orders](struct.OrderGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Order { + /// Terms and conditions of this order. + #[serde(rename="termsAndConditions")] + pub terms_and_conditions: Option, + /// Name of the buyer organization. + #[serde(rename="buyerOrganizationName")] + pub buyer_organization_name: Option, + /// Advertiser ID of this order. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Site IDs this order is associated with. + #[serde(rename="siteId")] + pub site_id: Option>, + /// Buyer invoice ID associated with this order. + #[serde(rename="buyerInvoiceId")] + pub buyer_invoice_id: Option, + /// ID of the terms and conditions template used in this order. + #[serde(rename="planningTermId")] + pub planning_term_id: Option, + /// ID of this order. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this order. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#order". + pub kind: Option, + /// Subaccount ID of this order. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this order. + pub name: Option, + /// Contacts for this order. + pub contacts: Option>, + /// Information about the most recent modification of this order. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Notes of this order. + pub notes: Option, + /// Name of the seller organization. + #[serde(rename="sellerOrganizationName")] + pub seller_organization_name: Option, + /// Comments in this order. + pub comments: Option, + /// IDs for users that have to approve documents created for this order. + #[serde(rename="approverUserProfileIds")] + pub approver_user_profile_ids: Option>, + /// Seller order ID associated with this order. + #[serde(rename="sellerOrderId")] + pub seller_order_id: Option, + /// Project ID of this order. + #[serde(rename="projectId")] + pub project_id: Option, + /// Free-form site names this order is associated with. + #[serde(rename="siteNames")] + pub site_names: Option>, +} + +impl Resource for Order {} +impl ResponseResult for Order {} + + +/// A custom floodlight variable. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CustomFloodlightVariable { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#customFloodlightVariable". + pub kind: Option, + /// The type of custom floodlight variable to supply a value for. These map to the "u[1-20]=" in the tags. + #[serde(rename="type")] + pub type_: Option, + /// The value of the custom floodlight variable. The length of string must not exceed 50 characters. + pub value: Option, +} + +impl Part for CustomFloodlightVariable {} + + +/// AccountPermissions contains information about a particular account permission. Some features of Campaign Manager require an account permission to be present in the account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permissions](struct.AccountPermissionListCall.html) (none) +/// * [get account permissions](struct.AccountPermissionGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermission { + /// Permission group of this account permission. + #[serde(rename="permissionGroupId")] + pub permission_group_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermission". + pub kind: Option, + /// Name of this account permission. + pub name: Option, + /// Administrative level required to enable this account permission. + pub level: Option, + /// Account profiles associated with this account permission. + /// + /// Possible values are: + /// - "ACCOUNT_PROFILE_BASIC" + /// - "ACCOUNT_PROFILE_STANDARD" + #[serde(rename="accountProfiles")] + pub account_profiles: Option>, + /// ID of this account permission. + pub id: Option, +} + +impl Resource for AccountPermission {} +impl ResponseResult for AccountPermission {} + + +/// Contains properties of a Planning project. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get projects](struct.ProjectGetCall.html) (response) +/// * [list projects](struct.ProjectListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Project { + /// Start date of the project. + #[serde(rename="startDate")] + pub start_date: Option, + /// CPM that the advertiser is targeting. + #[serde(rename="targetCpmNanos")] + pub target_cpm_nanos: Option, + /// End date of the project. + #[serde(rename="endDate")] + pub end_date: Option, + /// Client billing code of this project. + #[serde(rename="clientBillingCode")] + pub client_billing_code: Option, + /// Overview of this project. + pub overview: Option, + /// Number of clicks that the advertiser is targeting. + #[serde(rename="targetClicks")] + pub target_clicks: Option, + /// CPA that the advertiser is targeting. + #[serde(rename="targetCpaNanos")] + pub target_cpa_nanos: Option, + /// Advertiser ID of this project. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Number of impressions that the advertiser is targeting. + #[serde(rename="targetImpressions")] + pub target_impressions: Option, + /// Subaccount ID of this project. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Audience gender of this project. + #[serde(rename="audienceGender")] + pub audience_gender: Option, + /// ID of this project. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this project. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#project". + pub kind: Option, + /// CPC that the advertiser is targeting. + #[serde(rename="targetCpcNanos")] + pub target_cpc_nanos: Option, + /// Name of this project. + pub name: Option, + /// vCPM from Active View that the advertiser is targeting. + #[serde(rename="targetCpmActiveViewNanos")] + pub target_cpm_active_view_nanos: Option, + /// Information about the most recent modification of this project. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Budget of this project in the currency specified by the current account. The value stored in this field represents only the non-fractional amount. For example, for USD, the smallest value that can be represented by this field is 1 US dollar. + pub budget: Option, + /// Audience age group of this project. + #[serde(rename="audienceAgeGroup")] + pub audience_age_group: Option, + /// Number of conversions that the advertiser is targeting. + #[serde(rename="targetConversions")] + pub target_conversions: Option, + /// Name of the project client. + #[serde(rename="clientName")] + pub client_name: Option, +} + +impl Resource for Project {} +impl ResponseResult for Project {} + + +/// Popup Window Properties. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PopupWindowProperties { + /// Whether to display the browser status bar. + #[serde(rename="showStatusBar")] + pub show_status_bar: Option, + /// Whether to display the browser scroll bar. + #[serde(rename="showScrollBar")] + pub show_scroll_bar: Option, + /// Whether to display the browser address bar. + #[serde(rename="showAddressBar")] + pub show_address_bar: Option, + /// Whether to display the browser menu bar. + #[serde(rename="showMenuBar")] + pub show_menu_bar: Option, + /// Title of popup window. + pub title: Option, + /// Upper-left corner coordinates of the popup window. Applicable if positionType is COORDINATES. + pub offset: Option, + /// Popup window position either centered or at specific coordinate. + #[serde(rename="positionType")] + pub position_type: Option, + /// Whether to display the browser tool bar. + #[serde(rename="showToolBar")] + pub show_tool_bar: Option, + /// Popup dimension for a creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID + pub dimension: Option, +} + +impl Part for PopupWindowProperties {} + + +/// Contains properties of a Campaign Manager ad. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch ads](struct.AdPatchCall.html) (request|response) +/// * [list ads](struct.AdListCall.html) (none) +/// * [insert ads](struct.AdInsertCall.html) (request|response) +/// * [get ads](struct.AdGetCall.html) (response) +/// * [update ads](struct.AdUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Ad { + /// Click-through URL suffix properties for this ad. Applies to the URL in the ad or (if overriding ad properties) the URL in the creative. + #[serde(rename="clickThroughUrlSuffixProperties")] + pub click_through_url_suffix_properties: Option, + /// Campaign ID of this ad. This is a required field on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Language targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="languageTargeting")] + pub language_targeting: Option, + /// Advertiser ID of this ad. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Geographical targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="geoTargeting")] + pub geo_targeting: Option, + /// Comments for this ad. + pub comments: Option, + /// Delivery schedule information for this ad. Applicable when type is AD_SERVING_STANDARD_AD or AD_SERVING_TRACKING. This field along with subfields priority and impressionRatio are required on insertion when type is AD_SERVING_STANDARD_AD. + #[serde(rename="deliverySchedule")] + pub delivery_schedule: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Event tag overrides for this ad. + #[serde(rename="eventTagOverrides")] + pub event_tag_overrides: Option>, + /// ID of this ad. This is a read-only, auto-generated field. + pub id: Option, + /// Size of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. + pub size: Option, + /// Whether this ad is archived. When true, active must be false. + pub archived: Option, + /// Targeting template ID, used to apply preconfigured targeting information to this ad. This cannot be set while any of dayPartTargeting, geoTargeting, keyValueTargetingExpression, languageTargeting, remarketingListExpression, or technologyTargeting are set. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="targetingTemplateId")] + pub targeting_template_id: Option, + /// Technology platform targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="technologyTargeting")] + pub technology_targeting: Option, + /// Creative rotation for this ad. Applicable when type is AD_SERVING_DEFAULT_AD, AD_SERVING_STANDARD_AD, or AD_SERVING_TRACKING. When type is AD_SERVING_DEFAULT_AD, this field should have exactly one creativeAssignment. + #[serde(rename="creativeRotation")] + pub creative_rotation: Option, + /// Click-through URL for this ad. This is a required field on insertion. Applicable when type is AD_SERVING_CLICK_TRACKER. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// Creative group assignments for this ad. Applicable when type is AD_SERVING_CLICK_TRACKER. Only one assignment per creative group number is allowed for a maximum of two assignments. + #[serde(rename="creativeGroupAssignments")] + pub creative_group_assignments: Option>, + /// Remarketing list targeting expression for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="remarketingListExpression")] + pub remarketing_list_expression: Option, + /// Dimension value for the ID of this ad. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Account ID of this ad. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Type of ad. This is a required field on insertion. Note that default ads (AD_SERVING_DEFAULT_AD) cannot be created directly (see Creative resource). + #[serde(rename="type")] + pub type_: Option, + /// Whether this ad requires ssl. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslRequired")] + pub ssl_required: Option, + /// Audience segment ID that is being targeted for this ad. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="audienceSegmentId")] + pub audience_segment_id: Option, + /// Key-value targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="keyValueTargetingExpression")] + pub key_value_targeting_expression: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Default click-through event tag properties for this ad. + #[serde(rename="defaultClickThroughEventTagProperties")] + pub default_click_through_event_tag_properties: Option, + /// Information about the creation of this ad. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Date and time that this ad should start serving. If creating an ad, this field must be a time in the future. This is a required field on insertion. + #[serde(rename="startTime")] + pub start_time: Option, + /// Whether this ad is active. When true, archived must be false. + pub active: Option, + /// Compatibility of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to either rendering on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are only used for existing default ads. New mobile placements must be assigned DISPLAY or DISPLAY_INTERSTITIAL and default ads created for those placements will be limited to those compatibility types. IN_STREAM_VIDEO refers to rendering in-stream video ads developed with the VAST standard. + pub compatibility: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#ad". + pub kind: Option, + /// Subaccount ID of this ad. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this ad. This is a required field and must be less than 256 characters long. + pub name: Option, + /// Time and day targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="dayPartTargeting")] + pub day_part_targeting: Option, + /// Information about the most recent modification of this ad. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Whether this ad is ssl compliant. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Date and time that this ad should stop serving. Must be later than the start time. This is a required field on insertion. + #[serde(rename="endTime")] + pub end_time: Option, + /// Whether this ad is a dynamic click tracker. Applicable when type is AD_SERVING_CLICK_TRACKER. This is a required field on insert, and is read-only after insert. + #[serde(rename="dynamicClickTracker")] + pub dynamic_click_tracker: Option, + /// Placement assignments for this ad. + #[serde(rename="placementAssignments")] + pub placement_assignments: Option>, +} + +impl RequestValue for Ad {} +impl Resource for Ad {} +impl ResponseResult for Ad {} + + +/// Pricing Period +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PricingSchedulePricingPeriod { + /// Units of this pricing period. Acceptable values are 0 to 10000000000, inclusive. + pub units: Option, + /// Pricing period start date. This date must be later than, or the same day as, the placement start date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. + #[serde(rename="startDate")] + pub start_date: Option, + /// Rate or cost of this pricing period in nanos (i.e., multipled by 1000000000). Acceptable values are 0 to 1000000000000000000, inclusive. + #[serde(rename="rateOrCostNanos")] + pub rate_or_cost_nanos: Option, + /// Pricing period end date. This date must be later than, or the same day as, the pricing period start date, but not later than the placement end date. The period end date can be the same date as the period start date. If, for example, you set 6/25/2015 as both the start and end dates, the effective pricing period date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. + #[serde(rename="endDate")] + pub end_date: Option, + /// Comments for this pricing period. + #[serde(rename="pricingComment")] + pub pricing_comment: Option, +} + +impl Part for PricingSchedulePricingPeriod {} + + +/// Contains properties of an event tag. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete event tags](struct.EventTagDeleteCall.html) (none) +/// * [patch event tags](struct.EventTagPatchCall.html) (request|response) +/// * [list event tags](struct.EventTagListCall.html) (none) +/// * [update event tags](struct.EventTagUpdateCall.html) (request|response) +/// * [insert event tags](struct.EventTagInsertCall.html) (request|response) +/// * [get event tags](struct.EventTagGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EventTag { + /// Status of this event tag. Must be ENABLED for this event tag to fire. This is a required field. + pub status: Option, + /// Filter list of site IDs associated with this event tag. The siteFilterType determines whether this is a whitelist or blacklist filter. + #[serde(rename="siteIds")] + pub site_ids: Option>, + /// Campaign ID of this event tag. This field or the advertiserId field is required on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Whether this event tag should be automatically enabled for all of the advertiser's campaigns and ads. + #[serde(rename="enabledByDefault")] + pub enabled_by_default: Option, + /// Advertiser ID of this event tag. This field or the campaignId field is required on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Site filter type for this event tag. If no type is specified then the event tag will be applied to all sites. + #[serde(rename="siteFilterType")] + pub site_filter_type: Option, + /// Event tag type. Can be used to specify whether to use a third-party pixel, a third-party JavaScript URL, or a third-party click-through URL for either impression or click tracking. This is a required field. + #[serde(rename="type")] + pub type_: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of this event tag. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this event tag. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#eventTag". + pub kind: Option, + /// Subaccount ID of this event tag. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this event tag. This is a required field and must be less than 256 characters long. + pub name: Option, + /// Payload URL for this event tag. The URL on a click-through event tag should have a landing page URL appended to the end of it. This field is required on insertion. + pub url: Option, + /// Whether this tag is SSL-compliant or not. This is a read-only field. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Whether to remove this event tag from ads that are trafficked through Display & Video 360 to Ad Exchange. This may be useful if the event tag uses a pixel that is unapproved for Ad Exchange bids on one or more networks, such as the Google Display Network. + #[serde(rename="excludeFromAdxRequests")] + pub exclude_from_adx_requests: Option, + /// Number of times the landing page URL should be URL-escaped before being appended to the click-through event tag URL. Only applies to click-through event tags as specified by the event tag type. + #[serde(rename="urlEscapeLevels")] + pub url_escape_levels: Option, +} + +impl RequestValue for EventTag {} +impl Resource for EventTag {} +impl ResponseResult for EventTag {} + + +/// Placement Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementAssignment { + /// Whether this placement assignment is active. When true, the placement will be included in the ad's rotation. + pub active: Option, + /// Dimension value for the ID of the placement. This is a read-only, auto-generated field. + #[serde(rename="placementIdDimensionValue")] + pub placement_id_dimension_value: Option, + /// ID of the placement to be assigned. This is a required field. + #[serde(rename="placementId")] + pub placement_id: Option, + /// Whether the placement to be assigned requires SSL. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslRequired")] + pub ssl_required: Option, +} + +impl Part for PlacementAssignment {} + + +/// Represents fields that are compatible to be selected for a report of type "REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReachReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#reachReportCompatibleFields. + pub kind: Option, + /// Dimensions which are compatible to be selected in the "dimensions" section of the report. + pub dimensions: Option>, + /// Metrics which are compatible to be selected in the "reachByFrequencyMetricNames" section of the report. + #[serde(rename="reachByFrequencyMetrics")] + pub reach_by_frequency_metrics: Option>, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// Metrics which are compatible to be selected as activity metrics to pivot on in the "activities" section of the report. + #[serde(rename="pivotedActivityMetrics")] + pub pivoted_activity_metrics: Option>, +} + +impl Part for ReachReportCompatibleFields {} + + +/// Insert Conversions Request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batchinsert conversions](struct.ConversionBatchinsertCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConversionsBatchInsertRequest { + /// The set of conversions to insert. + pub conversions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionsBatchInsertRequest". + pub kind: Option, + /// Describes how encryptedUserId or encryptedUserIdCandidates[] is encrypted. This is a required field if encryptedUserId or encryptedUserIdCandidates[] is used. + #[serde(rename="encryptionInfo")] + pub encryption_info: Option, +} + +impl RequestValue for ConversionsBatchInsertRequest {} + + +/// Contains properties of a site. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update sites](struct.SiteUpdateCall.html) (request|response) +/// * [list sites](struct.SiteListCall.html) (none) +/// * [insert sites](struct.SiteInsertCall.html) (request|response) +/// * [get sites](struct.SiteGetCall.html) (response) +/// * [patch sites](struct.SitePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Site { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#site". + pub kind: Option, + /// Subaccount ID of this site. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this site.This is a required field. Must be less than 128 characters long. If this site is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this site is a top-level site, and the name must be unique among top-level sites of the same account. + pub name: Option, + /// Default video settings for new placements created under this site. This value will be used to populate the placements.videoSettings field, when no value is specified for the new placement. + #[serde(rename="videoSettings")] + pub video_settings: Option, + /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field. + #[serde(rename="directorySiteIdDimensionValue")] + pub directory_site_id_dimension_value: Option, + /// Site-wide settings. + #[serde(rename="siteSettings")] + pub site_settings: Option, + /// ID of this site. This is a read-only, auto-generated field. + pub id: Option, + /// Directory site associated with this site. This is a required field that is read-only after insertion. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Site contacts. + #[serde(rename="siteContacts")] + pub site_contacts: Option>, + /// Key name of this site. This is a read-only, auto-generated field. + #[serde(rename="keyName")] + pub key_name: Option, + /// Dimension value for the ID of this site. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Whether this site is approved. + pub approved: Option, + /// Account ID of this site. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for Site {} +impl Resource for Site {} +impl ResponseResult for Site {} + + +/// Google Ad Manager Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DfpSettings { + /// Ad Manager network code for this directory site. + #[serde(rename="dfpNetworkCode")] + pub dfp_network_code: Option, + /// Ad Manager network name for this directory site. + #[serde(rename="dfpNetworkName")] + pub dfp_network_name: Option, + /// Whether this directory site is available only via Publisher Portal. + #[serde(rename="publisherPortalOnly")] + pub publisher_portal_only: Option, + /// Whether this directory site accepts programmatic placements. + #[serde(rename="programmaticPlacementAccepted")] + pub programmatic_placement_accepted: Option, + /// Whether this directory site accepts publisher-paid tags. + #[serde(rename="pubPaidPlacementAccepted")] + pub pub_paid_placement_accepted: Option, +} + +impl Part for DfpSettings {} + + +/// Connection Type List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list connection types](struct.ConnectionTypeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConnectionTypesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#connectionTypesListResponse". + pub kind: Option, + /// Collection of connection types such as broadband and mobile. + #[serde(rename="connectionTypes")] + pub connection_types: Option>, +} + +impl ResponseResult for ConnectionTypesListResponse {} + + +/// Contains properties of a Floodlight configuration. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get floodlight configurations](struct.FloodlightConfigurationGetCall.html) (response) +/// * [update floodlight configurations](struct.FloodlightConfigurationUpdateCall.html) (request|response) +/// * [patch floodlight configurations](struct.FloodlightConfigurationPatchCall.html) (request|response) +/// * [list floodlight configurations](struct.FloodlightConfigurationListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightConfiguration { + /// List of user defined variables enabled for this configuration. + #[serde(rename="userDefinedVariableConfigurations")] + pub user_defined_variable_configurations: Option>, + /// List of third-party authentication tokens enabled for this configuration. + #[serde(rename="thirdPartyAuthenticationTokens")] + pub third_party_authentication_tokens: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightConfiguration". + pub kind: Option, + /// Advertiser ID of the parent advertiser of this floodlight configuration. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Configuration settings for dynamic and image floodlight tags. + #[serde(rename="tagSettings")] + pub tag_settings: Option, + /// Whether in-app attribution tracking is enabled. + #[serde(rename="inAppAttributionTrackingEnabled")] + pub in_app_attribution_tracking_enabled: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Subaccount ID of this floodlight configuration. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// ID of this floodlight configuration. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this floodlight configuration. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Types of attribution options for natural search conversions. + #[serde(rename="naturalSearchConversionAttributionOption")] + pub natural_search_conversion_attribution_option: Option, + /// Settings for Campaign Manager Omniture integration. + #[serde(rename="omnitureSettings")] + pub omniture_settings: Option, + /// Whether the exposure-to-conversion report is enabled. This report shows detailed pathway information on up to 10 of the most recent ad exposures seen by a user before converting. + #[serde(rename="exposureToConversionEnabled")] + pub exposure_to_conversion_enabled: Option, + /// Lookback window settings for this floodlight configuration. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, + /// Day that will be counted as the first day of the week in reports. This is a required field. + #[serde(rename="firstDayOfWeek")] + pub first_day_of_week: Option, + /// Whether advertiser data is shared with Google Analytics. + #[serde(rename="analyticsDataSharingEnabled")] + pub analytics_data_sharing_enabled: Option, + /// Dimension value for the ID of this floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Custom Viewability metric for the floodlight configuration. + #[serde(rename="customViewabilityMetric")] + pub custom_viewability_metric: Option, +} + +impl RequestValue for FloodlightConfiguration {} +impl Resource for FloodlightConfiguration {} +impl ResponseResult for FloodlightConfiguration {} + + +/// Account Permission Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permission groups](struct.AccountPermissionGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermissionGroupsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionGroupsListResponse". + pub kind: Option, + /// Account permission group collection. + #[serde(rename="accountPermissionGroups")] + pub account_permission_groups: Option>, +} + +impl ResponseResult for AccountPermissionGroupsListResponse {} + + +/// Size List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list sizes](struct.SizeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SizesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#sizesListResponse". + pub kind: Option, + /// Size collection. + pub sizes: Option>, +} + +impl ResponseResult for SizesListResponse {} + + +/// User Role List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user roles](struct.UserRoleListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolesListResponse". + pub kind: Option, + /// User role collection. + #[serde(rename="userRoles")] + pub user_roles: Option>, +} + +impl ResponseResult for UserRolesListResponse {} + + +/// Floodlight Activity List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight activities](struct.FloodlightActivityListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivitiesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivitiesListResponse". + pub kind: Option, + /// Floodlight activity collection. + #[serde(rename="floodlightActivities")] + pub floodlight_activities: Option>, +} + +impl ResponseResult for FloodlightActivitiesListResponse {} + + +/// A Universal Ad ID as per the VAST 4.0 spec. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and VPAID. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UniversalAdId { + /// Registry used for the Ad ID value. + pub registry: Option, + /// ID value for this creative. Only alphanumeric characters and the following symbols are valid: "_/\-". Maximum length is 64 characters. Read only when registry is DCM. + pub value: Option, +} + +impl Part for UniversalAdId {} + + +/// Contains properties of auser role, which is used to manage user access. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert user roles](struct.UserRoleInsertCall.html) (request|response) +/// * [update user roles](struct.UserRoleUpdateCall.html) (request|response) +/// * [delete user roles](struct.UserRoleDeleteCall.html) (none) +/// * [patch user roles](struct.UserRolePatchCall.html) (request|response) +/// * [list user roles](struct.UserRoleListCall.html) (none) +/// * [get user roles](struct.UserRoleGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRole { + /// Whether this is a default user role. Default user roles are created by the system for the account/subaccount and cannot be modified or deleted. Each default user role comes with a basic set of preassigned permissions. + #[serde(rename="defaultUserRole")] + pub default_user_role: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRole". + pub kind: Option, + /// Subaccount ID of this user role. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this user role. This is a required field. Must be less than 256 characters long. If this user role is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this user role is a top-level user role, and the name must be unique among top-level user roles of the same account. + pub name: Option, + /// ID of the user role that this user role is based on or copied from. This is a required field. + #[serde(rename="parentUserRoleId")] + pub parent_user_role_id: Option, + /// Account ID of this user role. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this user role. This is a read-only, auto-generated field. + pub id: Option, + /// List of permissions associated with this user role. + pub permissions: Option>, +} + +impl RequestValue for UserRole {} +impl Resource for UserRole {} +impl ResponseResult for UserRole {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *conversion* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `batchinsert(...)` and `batchupdate(...)` +/// // to build up your call. +/// let rb = hub.conversions(); +/// # } +/// ``` +pub struct ConversionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ConversionMethods<'a, C, A> {} + +impl<'a, C, A> ConversionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates existing conversions. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn batchupdate(&self, request: ConversionsBatchUpdateRequest, profile_id: &str) -> ConversionBatchupdateCall<'a, C, A> { + ConversionBatchupdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts conversions. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn batchinsert(&self, request: ConversionsBatchInsertRequest, profile_id: &str) -> ConversionBatchinsertCall<'a, C, A> { + ConversionBatchinsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userRolePermissionGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.user_role_permission_groups(); +/// # } +/// ``` +pub struct UserRolePermissionGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserRolePermissionGroupMethods<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one user role permission group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role permission group ID. + pub fn get(&self, profile_id: &str, id: &str) -> UserRolePermissionGroupGetCall<'a, C, A> { + UserRolePermissionGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a list of all supported user role permission groups. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> UserRolePermissionGroupListCall<'a, C, A> { + UserRolePermissionGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *advertiserLandingPage* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.advertiser_landing_pages(); +/// # } +/// ``` +pub struct AdvertiserLandingPageMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AdvertiserLandingPageMethods<'a, C, A> {} + +impl<'a, C, A> AdvertiserLandingPageMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of landing pages. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AdvertiserLandingPageListCall<'a, C, A> { + AdvertiserLandingPageListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _campaign_ids: Default::default(), + _archived: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing landing page. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Landing page ID. + pub fn patch(&self, request: LandingPage, profile_id: &str, id: &str) -> AdvertiserLandingPagePatchCall<'a, C, A> { + AdvertiserLandingPagePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing landing page. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: LandingPage, profile_id: &str) -> AdvertiserLandingPageUpdateCall<'a, C, A> { + AdvertiserLandingPageUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new landing page. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: LandingPage, profile_id: &str) -> AdvertiserLandingPageInsertCall<'a, C, A> { + AdvertiserLandingPageInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one landing page by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Landing page ID. + pub fn get(&self, profile_id: &str, id: &str) -> AdvertiserLandingPageGetCall<'a, C, A> { + AdvertiserLandingPageGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *platformType* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.platform_types(); +/// # } +/// ``` +pub struct PlatformTypeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlatformTypeMethods<'a, C, A> {} + +impl<'a, C, A> PlatformTypeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one platform type by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Platform type ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlatformTypeGetCall<'a, C, A> { + PlatformTypeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of platform types. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlatformTypeListCall<'a, C, A> { + PlatformTypeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *orderDocument* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.order_documents(); +/// # } +/// ``` +pub struct OrderDocumentMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OrderDocumentMethods<'a, C, A> {} + +impl<'a, C, A> OrderDocumentMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one order document by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + /// * `id` - Order document ID. + pub fn get(&self, profile_id: &str, project_id: &str, id: &str) -> OrderDocumentGetCall<'a, C, A> { + OrderDocumentGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of order documents, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + pub fn list(&self, profile_id: &str, project_id: &str) -> OrderDocumentListCall<'a, C, A> { + OrderDocumentListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_id: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _order_id: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _approved: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeField* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creative_fields(); +/// # } +/// ``` +pub struct CreativeFieldMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeFieldMethods<'a, C, A> {} + +impl<'a, C, A> CreativeFieldMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: CreativeField, profile_id: &str) -> CreativeFieldUpdateCall<'a, C, A> { + CreativeFieldUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creative fields, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CreativeFieldListCall<'a, C, A> { + CreativeFieldListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing creative field. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative Field ID + pub fn delete(&self, profile_id: &str, id: &str) -> CreativeFieldDeleteCall<'a, C, A> { + CreativeFieldDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative field by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative Field ID + pub fn get(&self, profile_id: &str, id: &str) -> CreativeFieldGetCall<'a, C, A> { + CreativeFieldGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: CreativeField, profile_id: &str) -> CreativeFieldInsertCall<'a, C, A> { + CreativeFieldInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative Field ID + pub fn patch(&self, request: CreativeField, profile_id: &str, id: &str) -> CreativeFieldPatchCall<'a, C, A> { + CreativeFieldPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userRole* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.user_roles(); +/// # } +/// ``` +pub struct UserRoleMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserRoleMethods<'a, C, A> {} + +impl<'a, C, A> UserRoleMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new user role. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: UserRole, profile_id: &str) -> UserRoleInsertCall<'a, C, A> { + UserRoleInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one user role by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role ID. + pub fn get(&self, profile_id: &str, id: &str) -> UserRoleGetCall<'a, C, A> { + UserRoleGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing user role. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: UserRole, profile_id: &str) -> UserRoleUpdateCall<'a, C, A> { + UserRoleUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing user role. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role ID. + pub fn delete(&self, profile_id: &str, id: &str) -> UserRoleDeleteCall<'a, C, A> { + UserRoleDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing user role. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role ID. + pub fn patch(&self, request: UserRole, profile_id: &str, id: &str) -> UserRolePatchCall<'a, C, A> { + UserRolePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of user roles, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> UserRoleListCall<'a, C, A> { + UserRoleListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _account_user_role_only: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *operatingSystemVersion* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.operating_system_versions(); +/// # } +/// ``` +pub struct OperatingSystemVersionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OperatingSystemVersionMethods<'a, C, A> {} + +impl<'a, C, A> OperatingSystemVersionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one operating system version by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Operating system version ID. + pub fn get(&self, profile_id: &str, id: &str) -> OperatingSystemVersionGetCall<'a, C, A> { + OperatingSystemVersionGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of operating system versions. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> OperatingSystemVersionListCall<'a, C, A> { + OperatingSystemVersionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeAsset* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `insert(...)` +/// // to build up your call. +/// let rb = hub.creative_assets(); +/// # } +/// ``` +pub struct CreativeAssetMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeAssetMethods<'a, C, A> {} + +impl<'a, C, A> CreativeAssetMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative asset. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `advertiserId` - Advertiser ID of this creative. This is a required field. + pub fn insert(&self, request: CreativeAssetMetadata, profile_id: &str, advertiser_id: &str) -> CreativeAssetInsertCall<'a, C, A> { + CreativeAssetInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _advertiser_id: advertiser_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *campaignCreativeAssociation* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.campaign_creative_associations(); +/// # } +/// ``` +pub struct CampaignCreativeAssociationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CampaignCreativeAssociationMethods<'a, C, A> {} + +impl<'a, C, A> CampaignCreativeAssociationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Campaign ID in this association. + pub fn insert(&self, request: CampaignCreativeAssociation, profile_id: &str, campaign_id: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + CampaignCreativeAssociationInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of creative IDs associated with the specified campaign. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Campaign ID in this association. + pub fn list(&self, profile_id: &str, campaign_id: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + CampaignCreativeAssociationListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _sort_order: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *changeLog* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.change_logs(); +/// # } +/// ``` +pub struct ChangeLogMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ChangeLogMethods<'a, C, A> {} + +impl<'a, C, A> ChangeLogMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of change logs. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ChangeLogListCall<'a, C, A> { + ChangeLogListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _user_profile_ids: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _object_type: Default::default(), + _object_ids: Default::default(), + _min_change_time: Default::default(), + _max_results: Default::default(), + _max_change_time: Default::default(), + _ids: Default::default(), + _action: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one change log by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Change log ID. + pub fn get(&self, profile_id: &str, id: &str) -> ChangeLogGetCall<'a, C, A> { + ChangeLogGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *remarketingListShare* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.remarketing_list_shares(); +/// # } +/// ``` +pub struct RemarketingListShareMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for RemarketingListShareMethods<'a, C, A> {} + +impl<'a, C, A> RemarketingListShareMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one remarketing list share by remarketing list ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `remarketingListId` - Remarketing list ID. + pub fn get(&self, profile_id: &str, remarketing_list_id: &str) -> RemarketingListShareGetCall<'a, C, A> { + RemarketingListShareGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _remarketing_list_id: remarketing_list_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list share. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `remarketingListId` - Remarketing list ID. + pub fn patch(&self, request: RemarketingListShare, profile_id: &str, remarketing_list_id: &str) -> RemarketingListSharePatchCall<'a, C, A> { + RemarketingListSharePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _remarketing_list_id: remarketing_list_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list share. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: RemarketingListShare, profile_id: &str) -> RemarketingListShareUpdateCall<'a, C, A> { + RemarketingListShareUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *report* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `compatible_fields_query(...)`, `delete(...)`, `files_get(...)`, `files_list(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)`, `run(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.reports(); +/// # } +/// ``` +pub struct ReportMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ReportMethods<'a, C, A> {} + +impl<'a, C, A> ReportMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Runs a report. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + /// * `reportId` - The ID of the report. + pub fn run(&self, profile_id: &str, report_id: &str) -> ReportRunCall<'a, C, A> { + ReportRunCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _synchronous: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a report. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn patch(&self, request: Report, profile_id: &str, report_id: &str) -> ReportPatchCall<'a, C, A> { + ReportPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists files for a report. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + /// * `reportId` - The ID of the parent report. + pub fn files_list(&self, profile_id: &str, report_id: &str) -> ReportFileListCall<'a, C, A> { + ReportFileListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a report. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + pub fn insert(&self, request: Report, profile_id: &str) -> ReportInsertCall<'a, C, A> { + ReportInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a report. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn update(&self, request: Report, profile_id: &str, report_id: &str) -> ReportUpdateCall<'a, C, A> { + ReportUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + pub fn compatible_fields_query(&self, request: Report, profile_id: &str) -> ReportCompatibleFieldQueryCall<'a, C, A> { + ReportCompatibleFieldQueryCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a report by its ID. + /// + /// # Arguments + /// + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn get(&self, profile_id: &str, report_id: &str) -> ReportGetCall<'a, C, A> { + ReportGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a report file. This method supports media download. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + /// * `reportId` - The ID of the report. + /// * `fileId` - The ID of the report file. + pub fn files_get(&self, profile_id: &str, report_id: &str, file_id: &str) -> ReportFileGetCall<'a, C, A> { + ReportFileGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _file_id: file_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a report by its ID. + /// + /// # Arguments + /// + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn delete(&self, profile_id: &str, report_id: &str) -> ReportDeleteCall<'a, C, A> { + ReportDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves list of reports. + /// + /// # Arguments + /// + /// * `profileId` - The DFA user profile ID. + pub fn list(&self, profile_id: &str) -> ReportListCall<'a, C, A> { + ReportListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _scope: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *advertiser* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.advertisers(); +/// # } +/// ``` +pub struct AdvertiserMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AdvertiserMethods<'a, C, A> {} + +impl<'a, C, A> AdvertiserMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new advertiser. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Advertiser, profile_id: &str) -> AdvertiserInsertCall<'a, C, A> { + AdvertiserInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser ID. + pub fn patch(&self, request: Advertiser, profile_id: &str, id: &str) -> AdvertiserPatchCall<'a, C, A> { + AdvertiserPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of advertisers, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AdvertiserListCall<'a, C, A> { + AdvertiserListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _subaccount_id: Default::default(), + _status: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _only_parent: Default::default(), + _max_results: Default::default(), + _include_advertisers_without_groups_only: Default::default(), + _ids: Default::default(), + _floodlight_configuration_ids: Default::default(), + _advertiser_group_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Advertiser, profile_id: &str) -> AdvertiserUpdateCall<'a, C, A> { + AdvertiserUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one advertiser by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser ID. + pub fn get(&self, profile_id: &str, id: &str) -> AdvertiserGetCall<'a, C, A> { + AdvertiserGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *dimensionValue* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `query(...)` +/// // to build up your call. +/// let rb = hub.dimension_values(); +/// # } +/// ``` +pub struct DimensionValueMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for DimensionValueMethods<'a, C, A> {} + +impl<'a, C, A> DimensionValueMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves list of report dimension values for a list of filters. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + pub fn query(&self, request: DimensionValueRequest, profile_id: &str) -> DimensionValueQueryCall<'a, C, A> { + DimensionValueQueryCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *floodlightActivityGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.floodlight_activity_groups(); +/// # } +/// ``` +pub struct FloodlightActivityGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FloodlightActivityGroupMethods<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity Group ID. + pub fn patch(&self, request: FloodlightActivityGroup, profile_id: &str, id: &str) -> FloodlightActivityGroupPatchCall<'a, C, A> { + FloodlightActivityGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + FloodlightActivityGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _type_: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _floodlight_configuration_id: Default::default(), + _advertiser_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one floodlight activity group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity Group ID. + pub fn get(&self, profile_id: &str, id: &str) -> FloodlightActivityGroupGetCall<'a, C, A> { + FloodlightActivityGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new floodlight activity group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: FloodlightActivityGroup, profile_id: &str) -> FloodlightActivityGroupInsertCall<'a, C, A> { + FloodlightActivityGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: FloodlightActivityGroup, profile_id: &str) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + FloodlightActivityGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *metro* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.metros(); +/// # } +/// ``` +pub struct MetroMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for MetroMethods<'a, C, A> {} + +impl<'a, C, A> MetroMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of metros. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> MetroListCall<'a, C, A> { + MetroListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *order* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.orders(); +/// # } +/// ``` +pub struct OrderMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OrderMethods<'a, C, A> {} + +impl<'a, C, A> OrderMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of orders, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for orders. + pub fn list(&self, profile_id: &str, project_id: &str) -> OrderListCall<'a, C, A> { + OrderListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_id: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one order by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for orders. + /// * `id` - Order ID. + pub fn get(&self, profile_id: &str, project_id: &str, id: &str) -> OrderGetCall<'a, C, A> { + OrderGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *mobileApp* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.mobile_apps(); +/// # } +/// ``` +pub struct MobileAppMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for MobileAppMethods<'a, C, A> {} + +impl<'a, C, A> MobileAppMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one mobile app by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Mobile app ID. + pub fn get(&self, profile_id: &str, id: &str) -> MobileAppGetCall<'a, C, A> { + MobileAppGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves list of available mobile apps. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> MobileAppListCall<'a, C, A> { + MobileAppListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _directories: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *language* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.languages(); +/// # } +/// ``` +pub struct LanguageMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for LanguageMethods<'a, C, A> {} + +impl<'a, C, A> LanguageMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of languages. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> LanguageListCall<'a, C, A> { + LanguageListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userProfile* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.user_profiles(); +/// # } +/// ``` +pub struct UserProfileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserProfileMethods<'a, C, A> {} + +impl<'a, C, A> UserProfileMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves list of user profiles for a user. + pub fn list(&self) -> UserProfileListCall<'a, C, A> { + UserProfileListCall { + hub: self.hub, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one user profile by ID. + /// + /// # Arguments + /// + /// * `profileId` - The user profile ID. + pub fn get(&self, profile_id: &str) -> UserProfileGetCall<'a, C, A> { + UserProfileGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *ad* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.ads(); +/// # } +/// ``` +pub struct AdMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AdMethods<'a, C, A> {} + +impl<'a, C, A> AdMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing ad. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Ad ID. + pub fn patch(&self, request: Ad, profile_id: &str, id: &str) -> AdPatchCall<'a, C, A> { + AdPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new ad. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Ad, profile_id: &str) -> AdInsertCall<'a, C, A> { + AdInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of ads, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AdListCall<'a, C, A> { + AdListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _type_: Default::default(), + _ssl_required: Default::default(), + _ssl_compliant: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _size_ids: Default::default(), + _search_string: Default::default(), + _remarketing_list_ids: Default::default(), + _placement_ids: Default::default(), + _page_token: Default::default(), + _overridden_event_tag_id: Default::default(), + _max_results: Default::default(), + _landing_page_ids: Default::default(), + _ids: Default::default(), + _dynamic_click_tracker: Default::default(), + _creative_optimization_configuration_ids: Default::default(), + _creative_ids: Default::default(), + _compatibility: Default::default(), + _campaign_ids: Default::default(), + _audience_segment_ids: Default::default(), + _archived: Default::default(), + _advertiser_id: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one ad by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Ad ID. + pub fn get(&self, profile_id: &str, id: &str) -> AdGetCall<'a, C, A> { + AdGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing ad. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Ad, profile_id: &str) -> AdUpdateCall<'a, C, A> { + AdUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountPermission* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.account_permissions(); +/// # } +/// ``` +pub struct AccountPermissionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountPermissionMethods<'a, C, A> {} + +impl<'a, C, A> AccountPermissionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one account permission by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account permission ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountPermissionGetCall<'a, C, A> { + AccountPermissionGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of account permissions. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountPermissionListCall<'a, C, A> { + AccountPermissionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *connectionType* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.connection_types(); +/// # } +/// ``` +pub struct ConnectionTypeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ConnectionTypeMethods<'a, C, A> {} + +impl<'a, C, A> ConnectionTypeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of connection types. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ConnectionTypeListCall<'a, C, A> { + ConnectionTypeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one connection type by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Connection type ID. + pub fn get(&self, profile_id: &str, id: &str) -> ConnectionTypeGetCall<'a, C, A> { + ConnectionTypeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *targetableRemarketingList* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.targetable_remarketing_lists(); +/// # } +/// ``` +pub struct TargetableRemarketingListMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for TargetableRemarketingListMethods<'a, C, A> {} + +impl<'a, C, A> TargetableRemarketingListMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `advertiserId` - Select only targetable remarketing lists targetable by these advertisers. + pub fn list(&self, profile_id: &str, advertiser_id: &str) -> TargetableRemarketingListListCall<'a, C, A> { + TargetableRemarketingListListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _advertiser_id: advertiser_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _page_token: Default::default(), + _name: Default::default(), + _max_results: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one remarketing list by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Remarketing list ID. + pub fn get(&self, profile_id: &str, id: &str) -> TargetableRemarketingListGetCall<'a, C, A> { + TargetableRemarketingListGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *advertiserGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.advertiser_groups(); +/// # } +/// ``` +pub struct AdvertiserGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AdvertiserGroupMethods<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser group ID. + pub fn patch(&self, request: AdvertiserGroup, profile_id: &str, id: &str) -> AdvertiserGroupPatchCall<'a, C, A> { + AdvertiserGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one advertiser group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser group ID. + pub fn get(&self, profile_id: &str, id: &str) -> AdvertiserGroupGetCall<'a, C, A> { + AdvertiserGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of advertiser groups, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AdvertiserGroupListCall<'a, C, A> { + AdvertiserGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new advertiser group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: AdvertiserGroup, profile_id: &str) -> AdvertiserGroupInsertCall<'a, C, A> { + AdvertiserGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: AdvertiserGroup, profile_id: &str) -> AdvertiserGroupUpdateCall<'a, C, A> { + AdvertiserGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing advertiser group. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser group ID. + pub fn delete(&self, profile_id: &str, id: &str) -> AdvertiserGroupDeleteCall<'a, C, A> { + AdvertiserGroupDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *site* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.sites(); +/// # } +/// ``` +pub struct SiteMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for SiteMethods<'a, C, A> {} + +impl<'a, C, A> SiteMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new site. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Site, profile_id: &str) -> SiteInsertCall<'a, C, A> { + SiteInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one site by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Site ID. + pub fn get(&self, profile_id: &str, id: &str) -> SiteGetCall<'a, C, A> { + SiteGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of sites, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> SiteListCall<'a, C, A> { + SiteListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _unmapped_site: Default::default(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _directory_site_ids: Default::default(), + _campaign_ids: Default::default(), + _approved: Default::default(), + _ad_words_site: Default::default(), + _accepts_publisher_paid_placements: Default::default(), + _accepts_interstitial_placements: Default::default(), + _accepts_in_stream_video_placements: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing site. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Site, profile_id: &str) -> SiteUpdateCall<'a, C, A> { + SiteUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing site. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Site ID. + pub fn patch(&self, request: Site, profile_id: &str, id: &str) -> SitePatchCall<'a, C, A> { + SitePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *floodlightActivity* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `generatetag(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.floodlight_activities(); +/// # } +/// ``` +pub struct FloodlightActivityMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FloodlightActivityMethods<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one floodlight activity by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity ID. + pub fn get(&self, profile_id: &str, id: &str) -> FloodlightActivityGetCall<'a, C, A> { + FloodlightActivityGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of floodlight activities, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> FloodlightActivityListCall<'a, C, A> { + FloodlightActivityListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _tag_string: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _floodlight_configuration_id: Default::default(), + _floodlight_activity_group_type: Default::default(), + _floodlight_activity_group_tag_string: Default::default(), + _floodlight_activity_group_name: Default::default(), + _floodlight_activity_group_ids: Default::default(), + _advertiser_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new floodlight activity. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: FloodlightActivity, profile_id: &str) -> FloodlightActivityInsertCall<'a, C, A> { + FloodlightActivityInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing floodlight activity. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity ID. + pub fn delete(&self, profile_id: &str, id: &str) -> FloodlightActivityDeleteCall<'a, C, A> { + FloodlightActivityDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity ID. + pub fn patch(&self, request: FloodlightActivity, profile_id: &str, id: &str) -> FloodlightActivityPatchCall<'a, C, A> { + FloodlightActivityPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Generates a tag for a floodlight activity. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn generatetag(&self, profile_id: &str) -> FloodlightActivityGeneratetagCall<'a, C, A> { + FloodlightActivityGeneratetagCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _floodlight_activity_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: FloodlightActivity, profile_id: &str) -> FloodlightActivityUpdateCall<'a, C, A> { + FloodlightActivityUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *region* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.regions(); +/// # } +/// ``` +pub struct RegionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for RegionMethods<'a, C, A> {} + +impl<'a, C, A> RegionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of regions. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> RegionListCall<'a, C, A> { + RegionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creative_groups(); +/// # } +/// ``` +pub struct CreativeGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeGroupMethods<'a, C, A> {} + +impl<'a, C, A> CreativeGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: CreativeGroup, profile_id: &str) -> CreativeGroupInsertCall<'a, C, A> { + CreativeGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative group ID. + pub fn get(&self, profile_id: &str, id: &str) -> CreativeGroupGetCall<'a, C, A> { + CreativeGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: CreativeGroup, profile_id: &str) -> CreativeGroupUpdateCall<'a, C, A> { + CreativeGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creative groups, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CreativeGroupListCall<'a, C, A> { + CreativeGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _group_number: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative group ID. + pub fn patch(&self, request: CreativeGroup, profile_id: &str, id: &str) -> CreativeGroupPatchCall<'a, C, A> { + CreativeGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *targetingTemplate* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.targeting_templates(); +/// # } +/// ``` +pub struct TargetingTemplateMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for TargetingTemplateMethods<'a, C, A> {} + +impl<'a, C, A> TargetingTemplateMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing targeting template. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Targeting template ID. + pub fn patch(&self, request: TargetingTemplate, profile_id: &str, id: &str) -> TargetingTemplatePatchCall<'a, C, A> { + TargetingTemplatePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of targeting templates, optionally filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> TargetingTemplateListCall<'a, C, A> { + TargetingTemplateListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _advertiser_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one targeting template by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Targeting template ID. + pub fn get(&self, profile_id: &str, id: &str) -> TargetingTemplateGetCall<'a, C, A> { + TargetingTemplateGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new targeting template. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: TargetingTemplate, profile_id: &str) -> TargetingTemplateInsertCall<'a, C, A> { + TargetingTemplateInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing targeting template. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: TargetingTemplate, profile_id: &str) -> TargetingTemplateUpdateCall<'a, C, A> { + TargetingTemplateUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *subaccount* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.subaccounts(); +/// # } +/// ``` +pub struct SubaccountMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for SubaccountMethods<'a, C, A> {} + +impl<'a, C, A> SubaccountMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing subaccount. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Subaccount ID. + pub fn patch(&self, request: Subaccount, profile_id: &str, id: &str) -> SubaccountPatchCall<'a, C, A> { + SubaccountPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new subaccount. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Subaccount, profile_id: &str) -> SubaccountInsertCall<'a, C, A> { + SubaccountInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing subaccount. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Subaccount, profile_id: &str) -> SubaccountUpdateCall<'a, C, A> { + SubaccountUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a list of subaccounts, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> SubaccountListCall<'a, C, A> { + SubaccountListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one subaccount by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Subaccount ID. + pub fn get(&self, profile_id: &str, id: &str) -> SubaccountGetCall<'a, C, A> { + SubaccountGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *mobileCarrier* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.mobile_carriers(); +/// # } +/// ``` +pub struct MobileCarrierMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for MobileCarrierMethods<'a, C, A> {} + +impl<'a, C, A> MobileCarrierMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one mobile carrier by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Mobile carrier ID. + pub fn get(&self, profile_id: &str, id: &str) -> MobileCarrierGetCall<'a, C, A> { + MobileCarrierGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of mobile carriers. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> MobileCarrierListCall<'a, C, A> { + MobileCarrierListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *floodlightConfiguration* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.floodlight_configurations(); +/// # } +/// ``` +pub struct FloodlightConfigurationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FloodlightConfigurationMethods<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one floodlight configuration by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight configuration ID. + pub fn get(&self, profile_id: &str, id: &str) -> FloodlightConfigurationGetCall<'a, C, A> { + FloodlightConfigurationGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight configuration. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: FloodlightConfiguration, profile_id: &str) -> FloodlightConfigurationUpdateCall<'a, C, A> { + FloodlightConfigurationUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight configuration. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight configuration ID. + pub fn patch(&self, request: FloodlightConfiguration, profile_id: &str, id: &str) -> FloodlightConfigurationPatchCall<'a, C, A> { + FloodlightConfigurationPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of floodlight configurations, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> FloodlightConfigurationListCall<'a, C, A> { + FloodlightConfigurationListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *operatingSystem* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.operating_systems(); +/// # } +/// ``` +pub struct OperatingSystemMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OperatingSystemMethods<'a, C, A> {} + +impl<'a, C, A> OperatingSystemMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of operating systems. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> OperatingSystemListCall<'a, C, A> { + OperatingSystemListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one operating system by DART ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `dartId` - Operating system DART ID. + pub fn get(&self, profile_id: &str, dart_id: &str) -> OperatingSystemGetCall<'a, C, A> { + OperatingSystemGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _dart_id: dart_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *file* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.files(); +/// # } +/// ``` +pub struct FileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FileMethods<'a, C, A> {} + +impl<'a, C, A> FileMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists files for a user profile. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + pub fn list(&self, profile_id: &str) -> FileListCall<'a, C, A> { + FileListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _scope: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a report file by its report ID and file ID. This method supports media download. + /// + /// # Arguments + /// + /// * `reportId` - The ID of the report. + /// * `fileId` - The ID of the report file. + pub fn get(&self, report_id: &str, file_id: &str) -> FileGetCall<'a, C, A> { + FileGetCall { + hub: self.hub, + _report_id: report_id.to_string(), + _file_id: file_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *placementGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.placement_groups(); +/// # } +/// ``` +pub struct PlacementGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlacementGroupMethods<'a, C, A> {} + +impl<'a, C, A> PlacementGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of placement groups, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlacementGroupListCall<'a, C, A> { + PlacementGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_ids: Default::default(), + _search_string: Default::default(), + _pricing_types: Default::default(), + _placement_strategy_ids: Default::default(), + _placement_group_type: Default::default(), + _page_token: Default::default(), + _min_start_date: Default::default(), + _min_end_date: Default::default(), + _max_start_date: Default::default(), + _max_results: Default::default(), + _max_end_date: Default::default(), + _ids: Default::default(), + _directory_site_ids: Default::default(), + _content_category_ids: Default::default(), + _campaign_ids: Default::default(), + _archived: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: PlacementGroup, profile_id: &str) -> PlacementGroupUpdateCall<'a, C, A> { + PlacementGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new placement group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: PlacementGroup, profile_id: &str) -> PlacementGroupInsertCall<'a, C, A> { + PlacementGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one placement group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement group ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlacementGroupGetCall<'a, C, A> { + PlacementGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement group ID. + pub fn patch(&self, request: PlacementGroup, profile_id: &str, id: &str) -> PlacementGroupPatchCall<'a, C, A> { + PlacementGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *inventoryItem* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.inventory_items(); +/// # } +/// ``` +pub struct InventoryItemMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for InventoryItemMethods<'a, C, A> {} + +impl<'a, C, A> InventoryItemMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of inventory items, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + pub fn list(&self, profile_id: &str, project_id: &str) -> InventoryItemListCall<'a, C, A> { + InventoryItemListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _type_: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_id: Default::default(), + _page_token: Default::default(), + _order_id: Default::default(), + _max_results: Default::default(), + _in_plan: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one inventory item by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + /// * `id` - Inventory item ID. + pub fn get(&self, profile_id: &str, project_id: &str, id: &str) -> InventoryItemGetCall<'a, C, A> { + InventoryItemGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userRolePermission* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.user_role_permissions(); +/// # } +/// ``` +pub struct UserRolePermissionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserRolePermissionMethods<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets a list of user role permissions, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> UserRolePermissionListCall<'a, C, A> { + UserRolePermissionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one user role permission by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role permission ID. + pub fn get(&self, profile_id: &str, id: &str) -> UserRolePermissionGetCall<'a, C, A> { + UserRolePermissionGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountPermissionGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.account_permission_groups(); +/// # } +/// ``` +pub struct AccountPermissionGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountPermissionGroupMethods<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of account permission groups. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountPermissionGroupListCall<'a, C, A> { + AccountPermissionGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one account permission group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account permission group ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountPermissionGroupGetCall<'a, C, A> { + AccountPermissionGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *contentCategory* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.content_categories(); +/// # } +/// ``` +pub struct ContentCategoryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ContentCategoryMethods<'a, C, A> {} + +impl<'a, C, A> ContentCategoryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of content categories, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ContentCategoryListCall<'a, C, A> { + ContentCategoryListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing content category. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: ContentCategory, profile_id: &str) -> ContentCategoryUpdateCall<'a, C, A> { + ContentCategoryUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new content category. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: ContentCategory, profile_id: &str) -> ContentCategoryInsertCall<'a, C, A> { + ContentCategoryInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing content category. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Content category ID. + pub fn delete(&self, profile_id: &str, id: &str) -> ContentCategoryDeleteCall<'a, C, A> { + ContentCategoryDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one content category by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Content category ID. + pub fn get(&self, profile_id: &str, id: &str) -> ContentCategoryGetCall<'a, C, A> { + ContentCategoryGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing content category. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Content category ID. + pub fn patch(&self, request: ContentCategory, profile_id: &str, id: &str) -> ContentCategoryPatchCall<'a, C, A> { + ContentCategoryPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creative* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creatives(); +/// # } +/// ``` +pub struct CreativeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeMethods<'a, C, A> {} + +impl<'a, C, A> CreativeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Creative, profile_id: &str) -> CreativeUpdateCall<'a, C, A> { + CreativeUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Creative, profile_id: &str) -> CreativeInsertCall<'a, C, A> { + CreativeInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative ID. + pub fn get(&self, profile_id: &str, id: &str) -> CreativeGetCall<'a, C, A> { + CreativeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creatives, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CreativeListCall<'a, C, A> { + CreativeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _types: Default::default(), + _studio_creative_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _size_ids: Default::default(), + _search_string: Default::default(), + _rendering_ids: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _creative_field_ids: Default::default(), + _companion_creative_ids: Default::default(), + _campaign_id: Default::default(), + _archived: Default::default(), + _advertiser_id: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative ID. + pub fn patch(&self, request: Creative, profile_id: &str, id: &str) -> CreativePatchCall<'a, C, A> { + CreativePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *campaign* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.campaigns(); +/// # } +/// ``` +pub struct CampaignMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CampaignMethods<'a, C, A> {} + +impl<'a, C, A> CampaignMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one campaign by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Campaign ID. + pub fn get(&self, profile_id: &str, id: &str) -> CampaignGetCall<'a, C, A> { + CampaignGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new campaign. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Campaign, profile_id: &str) -> CampaignInsertCall<'a, C, A> { + CampaignInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing campaign. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Campaign ID. + pub fn patch(&self, request: Campaign, profile_id: &str, id: &str) -> CampaignPatchCall<'a, C, A> { + CampaignPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing campaign. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Campaign, profile_id: &str) -> CampaignUpdateCall<'a, C, A> { + CampaignUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of campaigns, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CampaignListCall<'a, C, A> { + CampaignListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _overridden_event_tag_id: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _excluded_ids: Default::default(), + _at_least_one_optimization_activity: Default::default(), + _archived: Default::default(), + _advertiser_ids: Default::default(), + _advertiser_group_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *eventTag* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.event_tags(); +/// # } +/// ``` +pub struct EventTagMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for EventTagMethods<'a, C, A> {} + +impl<'a, C, A> EventTagMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing event tag. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Event tag ID. + pub fn delete(&self, profile_id: &str, id: &str) -> EventTagDeleteCall<'a, C, A> { + EventTagDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of event tags, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> EventTagListCall<'a, C, A> { + EventTagListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _ids: Default::default(), + _event_tag_types: Default::default(), + _enabled: Default::default(), + _definitions_only: Default::default(), + _campaign_id: Default::default(), + _advertiser_id: Default::default(), + _ad_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new event tag. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: EventTag, profile_id: &str) -> EventTagInsertCall<'a, C, A> { + EventTagInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing event tag. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Event tag ID. + pub fn patch(&self, request: EventTag, profile_id: &str, id: &str) -> EventTagPatchCall<'a, C, A> { + EventTagPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing event tag. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: EventTag, profile_id: &str) -> EventTagUpdateCall<'a, C, A> { + EventTagUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one event tag by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Event tag ID. + pub fn get(&self, profile_id: &str, id: &str) -> EventTagGetCall<'a, C, A> { + EventTagGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *remarketingList* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.remarketing_lists(); +/// # } +/// ``` +pub struct RemarketingListMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for RemarketingListMethods<'a, C, A> {} + +impl<'a, C, A> RemarketingListMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one remarketing list by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Remarketing list ID. + pub fn get(&self, profile_id: &str, id: &str) -> RemarketingListGetCall<'a, C, A> { + RemarketingListGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: RemarketingList, profile_id: &str) -> RemarketingListUpdateCall<'a, C, A> { + RemarketingListUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of remarketing lists, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `advertiserId` - Select only remarketing lists owned by this advertiser. + pub fn list(&self, profile_id: &str, advertiser_id: &str) -> RemarketingListListCall<'a, C, A> { + RemarketingListListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _advertiser_id: advertiser_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _page_token: Default::default(), + _name: Default::default(), + _max_results: Default::default(), + _floodlight_activity_id: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Remarketing list ID. + pub fn patch(&self, request: RemarketingList, profile_id: &str, id: &str) -> RemarketingListPatchCall<'a, C, A> { + RemarketingListPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new remarketing list. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: RemarketingList, profile_id: &str) -> RemarketingListInsertCall<'a, C, A> { + RemarketingListInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *city* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.cities(); +/// # } +/// ``` +pub struct CityMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CityMethods<'a, C, A> {} + +impl<'a, C, A> CityMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of cities, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CityListCall<'a, C, A> { + CityListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _region_dart_ids: Default::default(), + _name_prefix: Default::default(), + _dart_ids: Default::default(), + _country_dart_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *placementStrategy* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.placement_strategies(); +/// # } +/// ``` +pub struct PlacementStrategyMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlacementStrategyMethods<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement strategy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: PlacementStrategy, profile_id: &str) -> PlacementStrategyUpdateCall<'a, C, A> { + PlacementStrategyUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one placement strategy by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement strategy ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlacementStrategyGetCall<'a, C, A> { + PlacementStrategyGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of placement strategies, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlacementStrategyListCall<'a, C, A> { + PlacementStrategyListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing placement strategy. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement strategy ID. + pub fn delete(&self, profile_id: &str, id: &str) -> PlacementStrategyDeleteCall<'a, C, A> { + PlacementStrategyDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new placement strategy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: PlacementStrategy, profile_id: &str) -> PlacementStrategyInsertCall<'a, C, A> { + PlacementStrategyInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement strategy. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement strategy ID. + pub fn patch(&self, request: PlacementStrategy, profile_id: &str, id: &str) -> PlacementStrategyPatchCall<'a, C, A> { + PlacementStrategyPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of projects, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ProjectListCall<'a, C, A> { + ProjectListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one project by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Project ID. + pub fn get(&self, profile_id: &str, id: &str) -> ProjectGetCall<'a, C, A> { + ProjectGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *directorySite* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.directory_sites(); +/// # } +/// ``` +pub struct DirectorySiteMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for DirectorySiteMethods<'a, C, A> {} + +impl<'a, C, A> DirectorySiteMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new directory site. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: DirectorySite, profile_id: &str) -> DirectorySiteInsertCall<'a, C, A> { + DirectorySiteInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of directory sites, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> DirectorySiteListCall<'a, C, A> { + DirectorySiteListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _dfp_network_code: Default::default(), + _active: Default::default(), + _accepts_publisher_paid_placements: Default::default(), + _accepts_interstitial_placements: Default::default(), + _accepts_in_stream_video_placements: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one directory site by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Directory site ID. + pub fn get(&self, profile_id: &str, id: &str) -> DirectorySiteGetCall<'a, C, A> { + DirectorySiteGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *videoFormat* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.video_formats(); +/// # } +/// ``` +pub struct VideoFormatMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for VideoFormatMethods<'a, C, A> {} + +impl<'a, C, A> VideoFormatMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one video format by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Video format ID. + pub fn get(&self, profile_id: &str, id: i32) -> VideoFormatGetCall<'a, C, A> { + VideoFormatGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists available video formats. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> VideoFormatListCall<'a, C, A> { + VideoFormatListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *dynamicTargetingKey* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.dynamic_targeting_keys(); +/// # } +/// ``` +pub struct DynamicTargetingKeyMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for DynamicTargetingKeyMethods<'a, C, A> {} + +impl<'a, C, A> DynamicTargetingKeyMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing dynamic targeting key. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `objectId` - ID of the object of this dynamic targeting key. This is a required field. + /// * `name` - Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase. + /// * `objectType` - Type of the object of this dynamic targeting key. This is a required field. + pub fn delete(&self, profile_id: &str, object_id: &str, name: &str, object_type: &str) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + DynamicTargetingKeyDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _object_id: object_id.to_string(), + _name: name.to_string(), + _object_type: object_type.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of dynamic targeting keys. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + DynamicTargetingKeyListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _object_type: Default::default(), + _object_id: Default::default(), + _names: Default::default(), + _advertiser_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new dynamic targeting key. Keys must be created at the advertiser level before being assigned to the advertiser's ads, creatives, or placements. There is a maximum of 1000 keys per advertiser, out of which a maximum of 20 keys can be assigned per ad, creative, or placement. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: DynamicTargetingKey, profile_id: &str) -> DynamicTargetingKeyInsertCall<'a, C, A> { + DynamicTargetingKeyInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *size* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.sizes(); +/// # } +/// ``` +pub struct SizeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for SizeMethods<'a, C, A> {} + +impl<'a, C, A> SizeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new size. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Size, profile_id: &str) -> SizeInsertCall<'a, C, A> { + SizeInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of sizes, possibly filtered. Retrieved sizes are globally unique and may include values not currently in use by your account. Due to this, the list of sizes returned by this method may differ from the list seen in the Trafficking UI. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> SizeListCall<'a, C, A> { + SizeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _width: Default::default(), + _ids: Default::default(), + _iab_standard: Default::default(), + _height: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one size by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Size ID. + pub fn get(&self, profile_id: &str, id: &str) -> SizeGetCall<'a, C, A> { + SizeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountActiveAdSummary* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` +/// // to build up your call. +/// let rb = hub.account_active_ad_summaries(); +/// # } +/// ``` +pub struct AccountActiveAdSummaryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountActiveAdSummaryMethods<'a, C, A> {} + +impl<'a, C, A> AccountActiveAdSummaryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets the account's active ad summary by account ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `summaryAccountId` - Account ID. + pub fn get(&self, profile_id: &str, summary_account_id: &str) -> AccountActiveAdSummaryGetCall<'a, C, A> { + AccountActiveAdSummaryGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _summary_account_id: summary_account_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountUserProfile* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.account_user_profiles(); +/// # } +/// ``` +pub struct AccountUserProfileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountUserProfileMethods<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account user profile. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: AccountUserProfile, profile_id: &str) -> AccountUserProfileUpdateCall<'a, C, A> { + AccountUserProfileUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of account user profiles, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountUserProfileListCall<'a, C, A> { + AccountUserProfileListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _user_role_id: Default::default(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new account user profile. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: AccountUserProfile, profile_id: &str) -> AccountUserProfileInsertCall<'a, C, A> { + AccountUserProfileInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account user profile. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User profile ID. + pub fn patch(&self, request: AccountUserProfile, profile_id: &str, id: &str) -> AccountUserProfilePatchCall<'a, C, A> { + AccountUserProfilePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one account user profile by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User profile ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountUserProfileGetCall<'a, C, A> { + AccountUserProfileGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *country* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.countries(); +/// # } +/// ``` +pub struct CountryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CountryMethods<'a, C, A> {} + +impl<'a, C, A> CountryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of countries. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CountryListCall<'a, C, A> { + CountryListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one country by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `dartId` - Country DART ID. + pub fn get(&self, profile_id: &str, dart_id: &str) -> CountryGetCall<'a, C, A> { + CountryGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _dart_id: dart_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeFieldValue* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creative_field_values(); +/// # } +/// ``` +pub struct CreativeFieldValueMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeFieldValueMethods<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field value. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + /// * `id` - Creative Field Value ID + pub fn patch(&self, request: CreativeFieldValue, profile_id: &str, creative_field_id: &str, id: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + CreativeFieldValuePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative field value by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + /// * `id` - Creative Field Value ID + pub fn get(&self, profile_id: &str, creative_field_id: &str, id: &str) -> CreativeFieldValueGetCall<'a, C, A> { + CreativeFieldValueGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing creative field value. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + /// * `id` - Creative Field Value ID + pub fn delete(&self, profile_id: &str, creative_field_id: &str, id: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + CreativeFieldValueDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative field value. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + pub fn insert(&self, request: CreativeFieldValue, profile_id: &str, creative_field_id: &str) -> CreativeFieldValueInsertCall<'a, C, A> { + CreativeFieldValueInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field value. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + pub fn update(&self, request: CreativeFieldValue, profile_id: &str, creative_field_id: &str) -> CreativeFieldValueUpdateCall<'a, C, A> { + CreativeFieldValueUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creative field values, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + pub fn list(&self, profile_id: &str, creative_field_id: &str) -> CreativeFieldValueListCall<'a, C, A> { + CreativeFieldValueListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *postalCode* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.postal_codes(); +/// # } +/// ``` +pub struct PostalCodeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PostalCodeMethods<'a, C, A> {} + +impl<'a, C, A> PostalCodeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one postal code by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `code` - Postal code ID. + pub fn get(&self, profile_id: &str, code: &str) -> PostalCodeGetCall<'a, C, A> { + PostalCodeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _code: code.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of postal codes. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PostalCodeListCall<'a, C, A> { + PostalCodeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *browser* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.browsers(); +/// # } +/// ``` +pub struct BrowserMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for BrowserMethods<'a, C, A> {} + +impl<'a, C, A> BrowserMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of browsers. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> BrowserListCall<'a, C, A> { + BrowserListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *account* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.accounts(); +/// # } +/// ``` +pub struct AccountMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountMethods<'a, C, A> {} + +impl<'a, C, A> AccountMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one account by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountGetCall<'a, C, A> { + AccountGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of accounts, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountListCall<'a, C, A> { + AccountListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Account, profile_id: &str) -> AccountUpdateCall<'a, C, A> { + AccountUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account ID. + pub fn patch(&self, request: Account, profile_id: &str, id: &str) -> AccountPatchCall<'a, C, A> { + AccountPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *placement* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting3d3 as dfareporting3d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting3d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `generatetags(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.placements(); +/// # } +/// ``` +pub struct PlacementMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlacementMethods<'a, C, A> {} + +impl<'a, C, A> PlacementMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement ID. + pub fn patch(&self, request: Placement, profile_id: &str, id: &str) -> PlacementPatchCall<'a, C, A> { + PlacementPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of placements, possibly filtered. This method supports paging. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlacementListCall<'a, C, A> { + PlacementListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _size_ids: Default::default(), + _site_ids: Default::default(), + _search_string: Default::default(), + _pricing_types: Default::default(), + _placement_strategy_ids: Default::default(), + _payment_source: Default::default(), + _page_token: Default::default(), + _min_start_date: Default::default(), + _min_end_date: Default::default(), + _max_start_date: Default::default(), + _max_results: Default::default(), + _max_end_date: Default::default(), + _ids: Default::default(), + _group_ids: Default::default(), + _directory_site_ids: Default::default(), + _content_category_ids: Default::default(), + _compatibilities: Default::default(), + _campaign_ids: Default::default(), + _archived: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one placement by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlacementGetCall<'a, C, A> { + PlacementGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new placement. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Placement, profile_id: &str) -> PlacementInsertCall<'a, C, A> { + PlacementInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Placement, profile_id: &str) -> PlacementUpdateCall<'a, C, A> { + PlacementUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Generates tags for a placement. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn generatetags(&self, profile_id: &str) -> PlacementGeneratetagCall<'a, C, A> { + PlacementGeneratetagCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _tag_formats: Default::default(), + _placement_ids: Default::default(), + _campaign_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Updates existing conversions. +/// +/// A builder for the *batchupdate* method supported by a *conversion* resource. +/// It is not used directly, but through a `ConversionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::ConversionsBatchUpdateRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ConversionsBatchUpdateRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.conversions().batchupdate(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ConversionBatchupdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ConversionsBatchUpdateRequest, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ConversionBatchupdateCall<'a, C, A> {} + +impl<'a, C, A> ConversionBatchupdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ConversionsBatchUpdateResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.conversions.batchupdate", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/conversions/batchupdate"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Ddmconversion.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ConversionsBatchUpdateRequest) -> ConversionBatchupdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ConversionBatchupdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ConversionBatchupdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ConversionBatchupdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Ddmconversion`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ConversionBatchupdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts conversions. +/// +/// A builder for the *batchinsert* method supported by a *conversion* resource. +/// It is not used directly, but through a `ConversionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::ConversionsBatchInsertRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ConversionsBatchInsertRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.conversions().batchinsert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ConversionBatchinsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ConversionsBatchInsertRequest, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ConversionBatchinsertCall<'a, C, A> {} + +impl<'a, C, A> ConversionBatchinsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ConversionsBatchInsertResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.conversions.batchinsert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/conversions/batchinsert"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Ddmconversion.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ConversionsBatchInsertRequest) -> ConversionBatchinsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ConversionBatchinsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ConversionBatchinsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ConversionBatchinsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Ddmconversion`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ConversionBatchinsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one user role permission group by ID. +/// +/// A builder for the *get* method supported by a *userRolePermissionGroup* resource. +/// It is not used directly, but through a `UserRolePermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_role_permission_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionGroupGetCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermissionGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRolePermissionGroups/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role permission group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRolePermissionGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRolePermissionGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGroupGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a list of all supported user role permission groups. +/// +/// A builder for the *list* method supported by a *userRolePermissionGroup* resource. +/// It is not used directly, but through a `UserRolePermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_role_permission_groups().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionGroupListCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermissionGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRolePermissionGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRolePermissionGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGroupListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of landing pages. +/// +/// A builder for the *list* method supported by a *advertiserLandingPage* resource. +/// It is not used directly, but through a `AdvertiserLandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_landing_pages().list("profileId") +/// .subaccount_id("et") +/// .sort_order("diam") +/// .sort_field("ipsum") +/// .search_string("Lorem") +/// .page_token("et") +/// .max_results(-70) +/// .add_ids("aliquyam") +/// .add_campaign_ids("sea") +/// .archived(false) +/// .add_advertiser_ids("eos") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserLandingPageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _campaign_ids: Vec, + _archived: Option, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserLandingPageListCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserLandingPageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserLandingPagesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserLandingPages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(13 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._campaign_ids.len() > 0 { + for f in self._campaign_ids.iter() { + params.push(("campaignIds", f.to_string())); + } + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "campaignIds", "archived", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserLandingPages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only landing pages that belong to this subaccount. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for landing pages by name or ID. Wildcards (*) are allowed. For example, "landingpage*2017" will return landing pages with names like "landingpage July 2017", "landingpage March 2017", or simply "landingpage 2017". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "landingpage" will match campaigns with name "my landingpage", "landingpage 2015", or simply "landingpage". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AdvertiserLandingPageListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only landing pages with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only landing pages that are associated with these campaigns. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only archived landing pages. Don't set this field to select both archived and non-archived landing pages. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> AdvertiserLandingPageListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only landing pages that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserLandingPageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserLandingPageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserLandingPageListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing landing page. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *advertiserLandingPage* resource. +/// It is not used directly, but through a `AdvertiserLandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::LandingPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LandingPage::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_landing_pages().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserLandingPagePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: LandingPage, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserLandingPagePatchCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserLandingPagePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserLandingPages.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserLandingPages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LandingPage) -> AdvertiserLandingPagePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserLandingPagePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserLandingPagePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserLandingPagePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserLandingPagePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserLandingPagePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing landing page. +/// +/// A builder for the *update* method supported by a *advertiserLandingPage* resource. +/// It is not used directly, but through a `AdvertiserLandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::LandingPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LandingPage::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_landing_pages().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserLandingPageUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: LandingPage, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserLandingPageUpdateCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserLandingPageUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserLandingPages.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserLandingPages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LandingPage) -> AdvertiserLandingPageUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserLandingPageUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserLandingPageUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserLandingPageUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserLandingPageUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new landing page. +/// +/// A builder for the *insert* method supported by a *advertiserLandingPage* resource. +/// It is not used directly, but through a `AdvertiserLandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::LandingPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LandingPage::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_landing_pages().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserLandingPageInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: LandingPage, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserLandingPageInsertCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserLandingPageInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserLandingPages.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserLandingPages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LandingPage) -> AdvertiserLandingPageInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserLandingPageInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserLandingPageInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserLandingPageInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserLandingPageInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one landing page by ID. +/// +/// A builder for the *get* method supported by a *advertiserLandingPage* resource. +/// It is not used directly, but through a `AdvertiserLandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_landing_pages().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserLandingPageGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserLandingPageGetCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserLandingPageGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserLandingPages.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserLandingPages/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserLandingPageGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserLandingPageGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserLandingPageGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserLandingPageGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserLandingPageGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one platform type by ID. +/// +/// A builder for the *get* method supported by a *platformType* resource. +/// It is not used directly, but through a `PlatformTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.platform_types().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlatformTypeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlatformTypeGetCall<'a, C, A> {} + +impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlatformType)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.platformTypes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/platformTypes/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlatformTypeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Platform type ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlatformTypeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlatformTypeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlatformTypeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlatformTypeGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of platform types. +/// +/// A builder for the *list* method supported by a *platformType* resource. +/// It is not used directly, but through a `PlatformTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.platform_types().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlatformTypeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlatformTypeListCall<'a, C, A> {} + +impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlatformTypesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.platformTypes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/platformTypes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlatformTypeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlatformTypeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlatformTypeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlatformTypeListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one order document by ID. +/// +/// A builder for the *get* method supported by a *orderDocument* resource. +/// It is not used directly, but through a `OrderDocumentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.order_documents().get("profileId", "projectId", "id") +/// .doit(); +/// # } +/// ``` +pub struct OrderDocumentGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderDocumentGetCall<'a, C, A> {} + +impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrderDocument)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "projectId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/projects/{projectId}/orderDocuments/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order document ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrderDocumentGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderDocumentGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrderDocumentGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of order documents, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *orderDocument* resource. +/// It is not used directly, but through a `OrderDocumentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.order_documents().list("profileId", "projectId") +/// .sort_order("sea") +/// .sort_field("et") +/// .add_site_id("duo") +/// .search_string("et") +/// .page_token("eirmod") +/// .add_order_id("sanctus") +/// .max_results(-22) +/// .add_ids("amet") +/// .approved(true) +/// .doit(); +/// # } +/// ``` +pub struct OrderDocumentListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _sort_order: Option, + _sort_field: Option, + _site_id: Vec, + _search_string: Option, + _page_token: Option, + _order_id: Vec, + _max_results: Option, + _ids: Vec, + _approved: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderDocumentListCall<'a, C, A> {} + +impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrderDocumentsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(13 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_id.len() > 0 { + for f in self._site_id.iter() { + params.push(("siteId", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if self._order_id.len() > 0 { + for f in self._order_id.iter() { + params.push(("orderId", f.to_string())); + } + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._approved { + params.push(("approved", value.to_string())); + } + for &field in ["alt", "profileId", "projectId", "sortOrder", "sortField", "siteId", "searchString", "pageToken", "orderId", "maxResults", "ids", "approved"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/projects/{projectId}/orderDocuments"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only order documents that are associated with these sites. + /// + /// Append the given value to the *site id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._site_id.push(new_value.to_string()); + self + } + /// Allows searching for order documents by name or ID. Wildcards (*) are allowed. For example, "orderdocument*2015" will return order documents with names like "orderdocument June 2015", "orderdocument April 2015", or simply "orderdocument 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "orderdocument" will match order documents with name "my orderdocument", "orderdocument 2015", or simply "orderdocument". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only order documents for specified orders. + /// + /// Append the given value to the *order id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_order_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._order_id.push(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> OrderDocumentListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only order documents with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only order documents that have been approved by at least one user. + /// + /// Sets the *approved* query property to the given value. + pub fn approved(mut self, new_value: bool) -> OrderDocumentListCall<'a, C, A> { + self._approved = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrderDocumentListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderDocumentListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrderDocumentListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing creative field. +/// +/// A builder for the *update* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CreativeField; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeField::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeField, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeField) -> CreativeFieldUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of creative fields, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().list("profileId") +/// .sort_order("ea") +/// .sort_field("sed") +/// .search_string("dolor") +/// .page_token("dolor") +/// .max_results(-48) +/// .add_ids("et") +/// .add_advertiser_ids("consetetur") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldListCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for creative fields by name or ID. Wildcards (*) are allowed. For example, "creativefield*2015" will return creative fields with names like "creativefield June 2015", "creativefield April 2015", or simply "creativefield 2015". Most of the searches also add wild-cards implicitly at the start and the end of the search string. For example, a search string of "creativefield" will match creative fields with the name "my creativefield", "creativefield 2015", or simply "creativefield". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeFieldListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creative fields with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only creative fields that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an existing creative field. +/// +/// A builder for the *delete* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldDeleteCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative Field ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one creative field by ID. +/// +/// A builder for the *get* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative Field ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new creative field. +/// +/// A builder for the *insert* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CreativeField; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeField::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeField, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeField) -> CreativeFieldInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing creative field. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CreativeField; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeField::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_fields().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeField, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldPatchCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeField) -> CreativeFieldPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative Field ID + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new user role. +/// +/// A builder for the *insert* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::UserRole; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UserRole::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: UserRole, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleInsertCall<'a, C, A> {} + +impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UserRole) -> UserRoleInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRoleInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRoleInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one user role by ID. +/// +/// A builder for the *get* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleGetCall<'a, C, A> {} + +impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRoleGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRoleGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRoleGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing user role. +/// +/// A builder for the *update* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::UserRole; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UserRole::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: UserRole, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleUpdateCall<'a, C, A> {} + +impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UserRole) -> UserRoleUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRoleUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRoleUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an existing user role. +/// +/// A builder for the *delete* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleDeleteCall<'a, C, A> {} + +impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRoleDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRoleDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRoleDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing user role. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::UserRole; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UserRole::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: UserRole, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePatchCall<'a, C, A> {} + +impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UserRole) -> UserRolePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRolePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRolePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRolePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of user roles, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_roles().list("profileId") +/// .subaccount_id("duo") +/// .sort_order("aliquyam") +/// .sort_field("Lorem") +/// .search_string("et") +/// .page_token("clita") +/// .max_results(-45) +/// .add_ids("takimata") +/// .account_user_role_only(true) +/// .doit(); +/// # } +/// ``` +pub struct UserRoleListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _account_user_role_only: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleListCall<'a, C, A> {} + +impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(11 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._account_user_role_only { + params.push(("accountUserRoleOnly", value.to_string())); + } + for &field in ["alt", "profileId", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "accountUserRoleOnly"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only user roles that belong to this subaccount. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "userrole*2015" will return objects with names like "userrole June 2015", "userrole April 2015", or simply "userrole 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "userrole" will match objects with name "my userrole", "userrole 2015", or simply "userrole". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> UserRoleListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only user roles with the specified IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only account level user roles not associated with any specific subaccount. + /// + /// Sets the *account user role only* query property to the given value. + pub fn account_user_role_only(mut self, new_value: bool) -> UserRoleListCall<'a, C, A> { + self._account_user_role_only = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRoleListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRoleListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one operating system version by ID. +/// +/// A builder for the *get* method supported by a *operatingSystemVersion* resource. +/// It is not used directly, but through a `OperatingSystemVersionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operating_system_versions().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemVersionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemVersionGetCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystemVersion)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/operatingSystemVersions/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemVersionGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Operating system version ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> OperatingSystemVersionGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperatingSystemVersionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemVersionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperatingSystemVersionGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of operating system versions. +/// +/// A builder for the *list* method supported by a *operatingSystemVersion* resource. +/// It is not used directly, but through a `OperatingSystemVersionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operating_system_versions().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemVersionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemVersionListCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystemVersionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/operatingSystemVersions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemVersionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperatingSystemVersionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemVersionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperatingSystemVersionListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new creative asset. +/// +/// A builder for the *insert* method supported by a *creativeAsset* resource. +/// It is not used directly, but through a `CreativeAssetMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CreativeAssetMetadata; +/// use std::fs; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeAssetMetadata::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload_resumable(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_assets().insert(req, "profileId", "advertiserId") +/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct CreativeAssetInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeAssetMetadata, + _profile_id: String, + _advertiser_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeAssetInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, CreativeAssetMetadata)> + where RS: ReadSeek { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeAssets.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("advertiserId", self._advertiser_id.to_string())); + for &field in ["alt", "profileId", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let (mut url, upload_type) = + if protocol == "simple" { + (self.hub._root_url.clone() + "upload/dfareporting/v3.3/userprofiles/{profileId}/creativeAssets/{advertiserId}/creativeAssets", "multipart") + } else if protocol == "resumable" { + (self.hub._root_url.clone() + "resumable/upload/dfareporting/v3.3/userprofiles/{profileId}/creativeAssets/{advertiserId}/creativeAssets", "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{advertiserId}", "advertiserId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["advertiserId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut mp_reader: MultiPartReader = Default::default(); + let (mut body_reader, content_type) = match protocol { + "simple" => { + mp_reader.reserve_exact(2); + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 1073741824 { + return Err(Error::UploadSizeLimitExceeded(size, 1073741824)) + } + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) + .add_part(&mut reader, size, reader_mime_type.clone()); + let mime_type = mp_reader.mime_type(); + (&mut mp_reader as &mut io::Read, ContentType(mime_type)) + }, + _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), + }; + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(content_type) + .body(&mut body_reader); + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 1073741824 { + return Err(Error::UploadSizeLimitExceeded(size, 1073741824)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 1024MB + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, CreativeAssetMetadata)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 1024MB + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, CreativeAssetMetadata)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeAssetMetadata) -> CreativeAssetInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeAssetInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser ID of this creative. This is a required field. + /// + /// Sets the *advertiser id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn advertiser_id(mut self, new_value: &str) -> CreativeAssetInsertCall<'a, C, A> { + self._advertiser_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeAssetInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeAssetInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeAssetInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already. +/// +/// A builder for the *insert* method supported by a *campaignCreativeAssociation* resource. +/// It is not used directly, but through a `CampaignCreativeAssociationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CampaignCreativeAssociation; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CampaignCreativeAssociation::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaign_creative_associations().insert(req, "profileId", "campaignId") +/// .doit(); +/// # } +/// ``` +pub struct CampaignCreativeAssociationInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CampaignCreativeAssociation, + _profile_id: String, + _campaign_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignCreativeAssociationInsertCall<'a, C, A> {} + +impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CampaignCreativeAssociation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + for &field in ["alt", "profileId", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CampaignCreativeAssociation) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID in this association. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignCreativeAssociationInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignCreativeAssociationInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the list of creative IDs associated with the specified campaign. This method supports paging. +/// +/// A builder for the *list* method supported by a *campaignCreativeAssociation* resource. +/// It is not used directly, but through a `CampaignCreativeAssociationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaign_creative_associations().list("profileId", "campaignId") +/// .sort_order("dolore") +/// .page_token("nonumy") +/// .max_results(-29) +/// .doit(); +/// # } +/// ``` +pub struct CampaignCreativeAssociationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _campaign_id: String, + _sort_order: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignCreativeAssociationListCall<'a, C, A> {} + +impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CampaignCreativeAssociationsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "campaignId", "sortOrder", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID in this association. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignCreativeAssociationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignCreativeAssociationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of change logs. This method supports paging. +/// +/// A builder for the *list* method supported by a *changeLog* resource. +/// It is not used directly, but through a `ChangeLogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.change_logs().list("profileId") +/// .add_user_profile_ids("sit") +/// .search_string("eirmod") +/// .page_token("consetetur") +/// .object_type("labore") +/// .add_object_ids("sed") +/// .min_change_time("ea") +/// .max_results(-62) +/// .max_change_time("aliquyam") +/// .add_ids("eos") +/// .action("tempor") +/// .doit(); +/// # } +/// ``` +pub struct ChangeLogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _user_profile_ids: Vec, + _search_string: Option, + _page_token: Option, + _object_type: Option, + _object_ids: Vec, + _min_change_time: Option, + _max_results: Option, + _max_change_time: Option, + _ids: Vec, + _action: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChangeLogListCall<'a, C, A> {} + +impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChangeLogsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.changeLogs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(13 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if self._user_profile_ids.len() > 0 { + for f in self._user_profile_ids.iter() { + params.push(("userProfileIds", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._object_type { + params.push(("objectType", value.to_string())); + } + if self._object_ids.len() > 0 { + for f in self._object_ids.iter() { + params.push(("objectIds", f.to_string())); + } + } + if let Some(value) = self._min_change_time { + params.push(("minChangeTime", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._max_change_time { + params.push(("maxChangeTime", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._action { + params.push(("action", value.to_string())); + } + for &field in ["alt", "profileId", "userProfileIds", "searchString", "pageToken", "objectType", "objectIds", "minChangeTime", "maxResults", "maxChangeTime", "ids", "action"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/changeLogs"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only change logs with these user profile IDs. + /// + /// Append the given value to the *user profile ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_user_profile_ids(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._user_profile_ids.push(new_value.to_string()); + self + } + /// Select only change logs whose object ID, user name, old or new values match the search string. + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only change logs with the specified object type. + /// + /// Sets the *object type* query property to the given value. + pub fn object_type(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._object_type = Some(new_value.to_string()); + self + } + /// Select only change logs with these object IDs. + /// + /// Append the given value to the *object ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_object_ids(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._object_ids.push(new_value.to_string()); + self + } + /// Select only change logs whose change time is before the specified minChangeTime.The time should be formatted as an RFC3339 date/time string. For example, for 10:54 PM on July 18th, 2015, in the America/New York time zone, the format is "2015-07-18T22:54:00-04:00". In other words, the year, month, day, the letter T, the hour (24-hour clock system), minute, second, and then the time zone offset. + /// + /// Sets the *min change time* query property to the given value. + pub fn min_change_time(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._min_change_time = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ChangeLogListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only change logs whose change time is before the specified maxChangeTime.The time should be formatted as an RFC3339 date/time string. For example, for 10:54 PM on July 18th, 2015, in the America/New York time zone, the format is "2015-07-18T22:54:00-04:00". In other words, the year, month, day, the letter T, the hour (24-hour clock system), minute, second, and then the time zone offset. + /// + /// Sets the *max change time* query property to the given value. + pub fn max_change_time(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._max_change_time = Some(new_value.to_string()); + self + } + /// Select only change logs with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only change logs with the specified action. + /// + /// Sets the *action* query property to the given value. + pub fn action(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._action = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ChangeLogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChangeLogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ChangeLogListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one change log by ID. +/// +/// A builder for the *get* method supported by a *changeLog* resource. +/// It is not used directly, but through a `ChangeLogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.change_logs().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ChangeLogGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChangeLogGetCall<'a, C, A> {} + +impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChangeLog)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.changeLogs.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/changeLogs/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ChangeLogGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Change log ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ChangeLogGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ChangeLogGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChangeLogGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ChangeLogGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one remarketing list share by remarketing list ID. +/// +/// A builder for the *get* method supported by a *remarketingListShare* resource. +/// It is not used directly, but through a `RemarketingListShareMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_list_shares().get("profileId", "remarketingListId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListShareGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _remarketing_list_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListShareGetCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListShare)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("remarketingListId", self._remarketing_list_id.to_string())); + for &field in ["alt", "profileId", "remarketingListId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingListShares/{remarketingListId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{remarketingListId}", "remarketingListId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["remarketingListId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListShareGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *remarketing list id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn remarketing_list_id(mut self, new_value: &str) -> RemarketingListShareGetCall<'a, C, A> { + self._remarketing_list_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListShareGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListShareGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListShareGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing remarketing list share. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *remarketingListShare* resource. +/// It is not used directly, but through a `RemarketingListShareMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::RemarketingListShare; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RemarketingListShare::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_list_shares().patch(req, "profileId", "remarketingListId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListSharePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingListShare, + _profile_id: String, + _remarketing_list_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListSharePatchCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListShare)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("remarketingListId", self._remarketing_list_id.to_string())); + for &field in ["alt", "profileId", "remarketingListId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingListShares"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RemarketingListShare) -> RemarketingListSharePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListSharePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *remarketing list id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn remarketing_list_id(mut self, new_value: &str) -> RemarketingListSharePatchCall<'a, C, A> { + self._remarketing_list_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListSharePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListSharePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListSharePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing remarketing list share. +/// +/// A builder for the *update* method supported by a *remarketingListShare* resource. +/// It is not used directly, but through a `RemarketingListShareMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::RemarketingListShare; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RemarketingListShare::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_list_shares().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListShareUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingListShare, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListShareUpdateCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListShare)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingListShares"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RemarketingListShare) -> RemarketingListShareUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListShareUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListShareUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListShareUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListShareUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Runs a report. +/// +/// A builder for the *run* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().run("profileId", "reportId") +/// .synchronous(true) +/// .doit(); +/// # } +/// ``` +pub struct ReportRunCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _synchronous: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportRunCall<'a, C, A> {} + +impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.run", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + if let Some(value) = self._synchronous { + params.push(("synchronous", value.to_string())); + } + for &field in ["alt", "profileId", "reportId", "synchronous"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}/run"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportRunCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportRunCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// If set and true, tries to run the report synchronously. + /// + /// Sets the *synchronous* query property to the given value. + pub fn synchronous(mut self, new_value: bool) -> ReportRunCall<'a, C, A> { + self._synchronous = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportRunCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportRunCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportRunCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a report. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Report::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().patch(req, "profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportPatchCall<'a, C, A> {} + +impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["alt", "profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Report) -> ReportPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportPatchCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists files for a report. +/// +/// A builder for the *files.list* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().files_list("profileId", "reportId") +/// .sort_order("justo") +/// .sort_field("est") +/// .page_token("clita") +/// .max_results(-37) +/// .doit(); +/// # } +/// ``` +pub struct ReportFileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _sort_order: Option, + _sort_field: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportFileListCall<'a, C, A> {} + +impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FileList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.files.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "reportId", "sortOrder", "sortField", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}/files"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the parent report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// The field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ReportFileListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportFileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportFileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportFileListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a report. +/// +/// A builder for the *insert* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Report::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ReportInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportInsertCall<'a, C, A> {} + +impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Report) -> ReportInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a report. +/// +/// A builder for the *update* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Report::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().update(req, "profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportUpdateCall<'a, C, A> {} + +impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["alt", "profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Report) -> ReportUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportUpdateCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions. +/// +/// A builder for the *compatibleFields.query* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Report::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().compatible_fields_query(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ReportCompatibleFieldQueryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportCompatibleFieldQueryCall<'a, C, A> {} + +impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CompatibleFields)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.compatibleFields.query", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/compatiblefields/query"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Report) -> ReportCompatibleFieldQueryCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportCompatibleFieldQueryCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportCompatibleFieldQueryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportCompatibleFieldQueryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportCompatibleFieldQueryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a report by its ID. +/// +/// A builder for the *get* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().get("profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportGetCall<'a, C, A> {} + +impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["alt", "profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a report file. This method supports media download. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `File` structure that you would usually get. The latter will be a default value. +/// +/// A builder for the *files.get* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().files_get("profileId", "reportId", "fileId") +/// .doit(); +/// # } +/// ``` +pub struct ReportFileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _file_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportFileGetCall<'a, C, A> {} + +impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.files.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + params.push(("fileId", self._file_id.to_string())); + for &field in ["profileId", "reportId", "fileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if >::as_ref(&value) != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}/files/{fileId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId"), ("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["fileId", "reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = if enable_resource_parsing { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + } else { (res, Default::default()) }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The ID of the report file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportFileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportFileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportFileGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a report by its ID. +/// +/// A builder for the *delete* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().delete("profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportDeleteCall<'a, C, A> {} + +impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportDeleteCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves list of reports. +/// +/// A builder for the *list* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.reports().list("profileId") +/// .sort_order("kasd") +/// .sort_field("invidunt") +/// .scope("rebum.") +/// .page_token("Lorem") +/// .max_results(-63) +/// .doit(); +/// # } +/// ``` +pub struct ReportListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _scope: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportListCall<'a, C, A> {} + +impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ReportList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._scope { + params.push(("scope", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "scope", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// The field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// The scope that defines which results are returned. + /// + /// Sets the *scope* query property to the given value. + pub fn scope(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._scope = Some(new_value.to_string()); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ReportListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReportListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ReportListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new advertiser. +/// +/// A builder for the *insert* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Advertiser; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Advertiser::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertisers().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Advertiser, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserInsertCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertisers"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Advertiser) -> AdvertiserInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing advertiser. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Advertiser; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Advertiser::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertisers().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Advertiser, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserPatchCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertisers"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Advertiser) -> AdvertiserPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of advertisers, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertisers().list("profileId") +/// .subaccount_id("et") +/// .status("sed") +/// .sort_order("sit") +/// .sort_field("takimata") +/// .search_string("elitr") +/// .page_token("nonumy") +/// .only_parent(true) +/// .max_results(-6) +/// .include_advertisers_without_groups_only(true) +/// .add_ids("diam") +/// .add_floodlight_configuration_ids("ut") +/// .add_advertiser_group_ids("ut") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _subaccount_id: Option, + _status: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _only_parent: Option, + _max_results: Option, + _include_advertisers_without_groups_only: Option, + _ids: Vec, + _floodlight_configuration_ids: Vec, + _advertiser_group_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserListCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertisersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(15 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._status { + params.push(("status", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._only_parent { + params.push(("onlyParent", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._include_advertisers_without_groups_only { + params.push(("includeAdvertisersWithoutGroupsOnly", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._floodlight_configuration_ids.len() > 0 { + for f in self._floodlight_configuration_ids.iter() { + params.push(("floodlightConfigurationIds", f.to_string())); + } + } + if self._advertiser_group_ids.len() > 0 { + for f in self._advertiser_group_ids.iter() { + params.push(("advertiserGroupIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "subaccountId", "status", "sortOrder", "sortField", "searchString", "pageToken", "onlyParent", "maxResults", "includeAdvertisersWithoutGroupsOnly", "ids", "floodlightConfigurationIds", "advertiserGroupIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertisers"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only advertisers with these subaccount IDs. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Select only advertisers with the specified status. + /// + /// Sets the *status* query property to the given value. + pub fn status(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._status = Some(new_value.to_string()); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "advertiser*2015" will return objects with names like "advertiser June 2015", "advertiser April 2015", or simply "advertiser 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "advertiser" will match objects with name "my advertiser", "advertiser 2015", or simply "advertiser". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only advertisers which use another advertiser's floodlight configuration. + /// + /// Sets the *only parent* query property to the given value. + pub fn only_parent(mut self, new_value: bool) -> AdvertiserListCall<'a, C, A> { + self._only_parent = Some(new_value); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AdvertiserListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only advertisers which do not belong to any advertiser group. + /// + /// Sets the *include advertisers without groups only* query property to the given value. + pub fn include_advertisers_without_groups_only(mut self, new_value: bool) -> AdvertiserListCall<'a, C, A> { + self._include_advertisers_without_groups_only = Some(new_value); + self + } + /// Select only advertisers with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only advertisers with these floodlight configuration IDs. + /// + /// Append the given value to the *floodlight configuration ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_floodlight_configuration_ids(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._floodlight_configuration_ids.push(new_value.to_string()); + self + } + /// Select only advertisers with these advertiser group IDs. + /// + /// Append the given value to the *advertiser group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_group_ids(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._advertiser_group_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing advertiser. +/// +/// A builder for the *update* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Advertiser; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Advertiser::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertisers().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Advertiser, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserUpdateCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertisers"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Advertiser) -> AdvertiserUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one advertiser by ID. +/// +/// A builder for the *get* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertisers().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGetCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertisers/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves list of report dimension values for a list of filters. +/// +/// A builder for the *query* method supported by a *dimensionValue* resource. +/// It is not used directly, but through a `DimensionValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::DimensionValueRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DimensionValueRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.dimension_values().query(req, "profileId") +/// .page_token("sea") +/// .max_results(-36) +/// .doit(); +/// # } +/// ``` +pub struct DimensionValueQueryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: DimensionValueRequest, + _profile_id: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DimensionValueQueryCall<'a, C, A> {} + +impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DimensionValueList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.dimensionValues.query", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/dimensionvalues/query"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DimensionValueRequest) -> DimensionValueQueryCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DimensionValueQueryCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> DimensionValueQueryCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> DimensionValueQueryCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DimensionValueQueryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DimensionValueQueryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DimensionValueQueryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing floodlight activity group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::FloodlightActivityGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivityGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activity_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivityGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivityGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivityGroup) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity Group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activity_groups().list("profileId") +/// .type_("dolor") +/// .sort_order("et") +/// .sort_field("et") +/// .search_string("vero") +/// .page_token("ut") +/// .max_results(-30) +/// .add_ids("et") +/// .floodlight_configuration_id("ipsum") +/// .advertiser_id("justo") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _type_: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _floodlight_configuration_id: Option, + _advertiser_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupListCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(12 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._type_ { + params.push(("type", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._floodlight_configuration_id { + params.push(("floodlightConfigurationId", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + for &field in ["alt", "profileId", "type", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "floodlightConfigurationId", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivityGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only floodlight activity groups with the specified floodlight activity group type. + /// + /// Sets the *type* query property to the given value. + pub fn type_(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._type_ = Some(new_value.to_string()); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "floodlightactivitygroup*2015" will return objects with names like "floodlightactivitygroup June 2015", "floodlightactivitygroup April 2015", or simply "floodlightactivitygroup 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "floodlightactivitygroup" will match objects with name "my floodlightactivitygroup activity", "floodlightactivitygroup 2015", or simply "floodlightactivitygroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> FloodlightActivityGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only floodlight activity groups with the specified IDs. Must specify either advertiserId or floodlightConfigurationId for a non-empty result. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only floodlight activity groups with the specified floodlight configuration ID. Must specify either advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *floodlight configuration id* query property to the given value. + pub fn floodlight_configuration_id(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._floodlight_configuration_id = Some(new_value.to_string()); + self + } + /// Select only floodlight activity groups with the specified advertiser ID. Must specify either advertiserId or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one floodlight activity group by ID. +/// +/// A builder for the *get* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activity_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupGetCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivityGroups/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity Group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new floodlight activity group. +/// +/// A builder for the *insert* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::FloodlightActivityGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivityGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activity_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivityGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivityGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivityGroup) -> FloodlightActivityGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing floodlight activity group. +/// +/// A builder for the *update* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::FloodlightActivityGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivityGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activity_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivityGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivityGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivityGroup) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of metros. +/// +/// A builder for the *list* method supported by a *metro* resource. +/// It is not used directly, but through a `MetroMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.metros().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct MetroListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MetroListCall<'a, C, A> {} + +impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MetrosListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.metros.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/metros"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MetroListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MetroListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MetroListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MetroListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of orders, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *order* resource. +/// It is not used directly, but through a `OrderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.orders().list("profileId", "projectId") +/// .sort_order("sed") +/// .sort_field("no") +/// .add_site_id("invidunt") +/// .search_string("rebum.") +/// .page_token("labore") +/// .max_results(-82) +/// .add_ids("elitr") +/// .doit(); +/// # } +/// ``` +pub struct OrderListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _sort_order: Option, + _sort_field: Option, + _site_id: Vec, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderListCall<'a, C, A> {} + +impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrdersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orders.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(11 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_id.len() > 0 { + for f in self._site_id.iter() { + params.push(("siteId", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "projectId", "sortOrder", "sortField", "siteId", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/projects/{projectId}/orders"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for orders. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only orders that are associated with these site IDs. + /// + /// Append the given value to the *site id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._site_id.push(new_value.to_string()); + self + } + /// Allows searching for orders by name or ID. Wildcards (*) are allowed. For example, "order*2015" will return orders with names like "order June 2015", "order April 2015", or simply "order 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "order" will match orders with name "my order", "order 2015", or simply "order". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> OrderListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only orders with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrderListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrderListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one order by ID. +/// +/// A builder for the *get* method supported by a *order* resource. +/// It is not used directly, but through a `OrderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.orders().get("profileId", "projectId", "id") +/// .doit(); +/// # } +/// ``` +pub struct OrderGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderGetCall<'a, C, A> {} + +impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Order)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orders.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "projectId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/projects/{projectId}/orders/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for orders. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrderGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrderGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one mobile app by ID. +/// +/// A builder for the *get* method supported by a *mobileApp* resource. +/// It is not used directly, but through a `MobileAppMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.mobile_apps().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct MobileAppGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobileAppGetCall<'a, C, A> {} + +impl<'a, C, A> MobileAppGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MobileApp)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.mobileApps.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/mobileApps/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MobileAppGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Mobile app ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> MobileAppGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MobileAppGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobileAppGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MobileAppGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves list of available mobile apps. +/// +/// A builder for the *list* method supported by a *mobileApp* resource. +/// It is not used directly, but through a `MobileAppMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.mobile_apps().list("profileId") +/// .search_string("diam") +/// .page_token("accusam") +/// .max_results(-68) +/// .add_ids("consetetur") +/// .add_directories("dolor") +/// .doit(); +/// # } +/// ``` +pub struct MobileAppListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _directories: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobileAppListCall<'a, C, A> {} + +impl<'a, C, A> MobileAppListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MobileAppsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.mobileApps.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._directories.len() > 0 { + for f in self._directories.iter() { + params.push(("directories", f.to_string())); + } + } + for &field in ["alt", "profileId", "searchString", "pageToken", "maxResults", "ids", "directories"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/mobileApps"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MobileAppListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "app*2015" will return objects with names like "app Jan 2018", "app Jan 2018", or simply "app 2018". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "app" will match objects with name "my app", "app 2018", or simply "app". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> MobileAppListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> MobileAppListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> MobileAppListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only apps with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> MobileAppListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only apps from these directories. + /// + /// Append the given value to the *directories* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directories(mut self, new_value: &str) -> MobileAppListCall<'a, C, A> { + self._directories.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MobileAppListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobileAppListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MobileAppListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of languages. +/// +/// A builder for the *list* method supported by a *language* resource. +/// It is not used directly, but through a `LanguageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.languages().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct LanguageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LanguageListCall<'a, C, A> {} + +impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LanguagesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.languages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/languages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LanguageListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LanguageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LanguageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> LanguageListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves list of user profiles for a user. +/// +/// A builder for the *list* method supported by a *userProfile* resource. +/// It is not used directly, but through a `UserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_profiles().list() +/// .doit(); +/// # } +/// ``` +pub struct UserProfileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserProfileListCall<'a, C, A> {} + +impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserProfileList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userProfiles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(2 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserProfileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserProfileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserProfileListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one user profile by ID. +/// +/// A builder for the *get* method supported by a *userProfile* resource. +/// It is not used directly, but through a `UserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_profiles().get("profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserProfileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserProfileGetCall<'a, C, A> {} + +impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userProfiles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserProfileGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserProfileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserProfileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserProfileGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing ad. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Ad; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Ad::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.ads().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Ad, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdPatchCall<'a, C, A> {} + +impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/ads"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Ad) -> AdPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Ad ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new ad. +/// +/// A builder for the *insert* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Ad; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Ad::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.ads().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Ad, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdInsertCall<'a, C, A> {} + +impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/ads"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Ad) -> AdInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of ads, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.ads().list("profileId") +/// .add_type("dolor") +/// .ssl_required(true) +/// .ssl_compliant(true) +/// .sort_order("Lorem") +/// .sort_field("consetetur") +/// .add_size_ids("consetetur") +/// .search_string("eirmod") +/// .add_remarketing_list_ids("labore") +/// .add_placement_ids("gubergren") +/// .page_token("et") +/// .overridden_event_tag_id("sadipscing") +/// .max_results(-73) +/// .add_landing_page_ids("magna") +/// .add_ids("Lorem") +/// .dynamic_click_tracker(true) +/// .add_creative_optimization_configuration_ids("et") +/// .add_creative_ids("clita") +/// .compatibility("eos") +/// .add_campaign_ids("dolores") +/// .add_audience_segment_ids("vero") +/// .archived(false) +/// .advertiser_id("vero") +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct AdListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _type_: Vec, + _ssl_required: Option, + _ssl_compliant: Option, + _sort_order: Option, + _sort_field: Option, + _size_ids: Vec, + _search_string: Option, + _remarketing_list_ids: Vec, + _placement_ids: Vec, + _page_token: Option, + _overridden_event_tag_id: Option, + _max_results: Option, + _landing_page_ids: Vec, + _ids: Vec, + _dynamic_click_tracker: Option, + _creative_optimization_configuration_ids: Vec, + _creative_ids: Vec, + _compatibility: Option, + _campaign_ids: Vec, + _audience_segment_ids: Vec, + _archived: Option, + _advertiser_id: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdListCall<'a, C, A> {} + +impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(26 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if self._type_.len() > 0 { + for f in self._type_.iter() { + params.push(("type", f.to_string())); + } + } + if let Some(value) = self._ssl_required { + params.push(("sslRequired", value.to_string())); + } + if let Some(value) = self._ssl_compliant { + params.push(("sslCompliant", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._size_ids.len() > 0 { + for f in self._size_ids.iter() { + params.push(("sizeIds", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._remarketing_list_ids.len() > 0 { + for f in self._remarketing_list_ids.iter() { + params.push(("remarketingListIds", f.to_string())); + } + } + if self._placement_ids.len() > 0 { + for f in self._placement_ids.iter() { + params.push(("placementIds", f.to_string())); + } + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._overridden_event_tag_id { + params.push(("overriddenEventTagId", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._landing_page_ids.len() > 0 { + for f in self._landing_page_ids.iter() { + params.push(("landingPageIds", f.to_string())); + } + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._dynamic_click_tracker { + params.push(("dynamicClickTracker", value.to_string())); + } + if self._creative_optimization_configuration_ids.len() > 0 { + for f in self._creative_optimization_configuration_ids.iter() { + params.push(("creativeOptimizationConfigurationIds", f.to_string())); + } + } + if self._creative_ids.len() > 0 { + for f in self._creative_ids.iter() { + params.push(("creativeIds", f.to_string())); + } + } + if let Some(value) = self._compatibility { + params.push(("compatibility", value.to_string())); + } + if self._campaign_ids.len() > 0 { + for f in self._campaign_ids.iter() { + params.push(("campaignIds", f.to_string())); + } + } + if self._audience_segment_ids.len() > 0 { + for f in self._audience_segment_ids.iter() { + params.push(("audienceSegmentIds", f.to_string())); + } + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "type", "sslRequired", "sslCompliant", "sortOrder", "sortField", "sizeIds", "searchString", "remarketingListIds", "placementIds", "pageToken", "overriddenEventTagId", "maxResults", "landingPageIds", "ids", "dynamicClickTracker", "creativeOptimizationConfigurationIds", "creativeIds", "compatibility", "campaignIds", "audienceSegmentIds", "archived", "advertiserId", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/ads"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only ads with these types. + /// + /// Append the given value to the *type* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_type(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._type_.push(new_value.to_string()); + self + } + /// Select only ads that require SSL. + /// + /// Sets the *ssl required* query property to the given value. + pub fn ssl_required(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._ssl_required = Some(new_value); + self + } + /// Select only ads that are SSL-compliant. + /// + /// Sets the *ssl compliant* query property to the given value. + pub fn ssl_compliant(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._ssl_compliant = Some(new_value); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only ads with these size IDs. + /// + /// Append the given value to the *size ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_size_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._size_ids.push(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "ad*2015" will return objects with names like "ad June 2015", "ad April 2015", or simply "ad 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "ad" will match objects with name "my ad", "ad 2015", or simply "ad". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only ads whose list targeting expression use these remarketing list IDs. + /// + /// Append the given value to the *remarketing list ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_remarketing_list_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._remarketing_list_ids.push(new_value.to_string()); + self + } + /// Select only ads with these placement IDs assigned. + /// + /// Append the given value to the *placement ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._placement_ids.push(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only ads with this event tag override ID. + /// + /// Sets the *overridden event tag id* query property to the given value. + pub fn overridden_event_tag_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._overridden_event_tag_id = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AdListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only ads with these landing page IDs. + /// + /// Append the given value to the *landing page ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_landing_page_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._landing_page_ids.push(new_value.to_string()); + self + } + /// Select only ads with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only dynamic click trackers. Applicable when type is AD_SERVING_CLICK_TRACKER. If true, select dynamic click trackers. If false, select static click trackers. Leave unset to select both. + /// + /// Sets the *dynamic click tracker* query property to the given value. + pub fn dynamic_click_tracker(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._dynamic_click_tracker = Some(new_value); + self + } + /// Select only ads with these creative optimization configuration IDs. + /// + /// Append the given value to the *creative optimization configuration ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_creative_optimization_configuration_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._creative_optimization_configuration_ids.push(new_value.to_string()); + self + } + /// Select only ads with these creative IDs assigned. + /// + /// Append the given value to the *creative ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_creative_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._creative_ids.push(new_value.to_string()); + self + } + /// Select default ads with the specified compatibility. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering an in-stream video ads developed with the VAST standard. + /// + /// Sets the *compatibility* query property to the given value. + pub fn compatibility(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._compatibility = Some(new_value.to_string()); + self + } + /// Select only ads with these campaign IDs. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only ads with these audience segment IDs. + /// + /// Append the given value to the *audience segment ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_audience_segment_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._audience_segment_ids.push(new_value.to_string()); + self + } + /// Select only archived ads. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only ads with this advertiser ID. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// Select only active ads. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one ad by ID. +/// +/// A builder for the *get* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.ads().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdGetCall<'a, C, A> {} + +impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/ads/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Ad ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing ad. +/// +/// A builder for the *update* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Ad; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Ad::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.ads().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Ad, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdUpdateCall<'a, C, A> {} + +impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/ads"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Ad) -> AdUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one account permission by ID. +/// +/// A builder for the *get* method supported by a *accountPermission* resource. +/// It is not used directly, but through a `AccountPermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_permissions().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionGetCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermission)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountPermissions/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account permission ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountPermissionGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountPermissionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountPermissionGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the list of account permissions. +/// +/// A builder for the *list* method supported by a *accountPermission* resource. +/// It is not used directly, but through a `AccountPermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_permissions().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionListCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermissionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountPermissionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountPermissionListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of connection types. +/// +/// A builder for the *list* method supported by a *connectionType* resource. +/// It is not used directly, but through a `ConnectionTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.connection_types().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct ConnectionTypeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ConnectionTypeListCall<'a, C, A> {} + +impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ConnectionTypesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/connectionTypes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ConnectionTypeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ConnectionTypeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ConnectionTypeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ConnectionTypeListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one connection type by ID. +/// +/// A builder for the *get* method supported by a *connectionType* resource. +/// It is not used directly, but through a `ConnectionTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.connection_types().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ConnectionTypeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ConnectionTypeGetCall<'a, C, A> {} + +impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ConnectionType)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/connectionTypes/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ConnectionTypeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Connection type ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ConnectionTypeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ConnectionTypeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ConnectionTypeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ConnectionTypeGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *targetableRemarketingList* resource. +/// It is not used directly, but through a `TargetableRemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targetable_remarketing_lists().list("profileId", "advertiserId") +/// .sort_order("invidunt") +/// .sort_field("accusam") +/// .page_token("labore") +/// .name("diam") +/// .max_results(-41) +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct TargetableRemarketingListListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _advertiser_id: String, + _sort_order: Option, + _sort_field: Option, + _page_token: Option, + _name: Option, + _max_results: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetableRemarketingListListCall<'a, C, A> {} + +impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetableRemarketingListsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("advertiserId", self._advertiser_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._name { + params.push(("name", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "advertiserId", "sortOrder", "sortField", "pageToken", "name", "maxResults", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetableRemarketingLists"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only targetable remarketing lists targetable by these advertisers. + /// + /// Sets the *advertiser id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn advertiser_id(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._advertiser_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "remarketing list*2015" will return objects with names like "remarketing list June 2015", "remarketing list April 2015", or simply "remarketing list 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "remarketing list" will match objects with name "my remarketing list", "remarketing list 2015", or simply "remarketing list". + /// + /// Sets the *name* query property to the given value. + pub fn name(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._name = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> TargetableRemarketingListListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only active or only inactive targetable remarketing lists. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> TargetableRemarketingListListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetableRemarketingListListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetableRemarketingListListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetableRemarketingListListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one remarketing list by ID. +/// +/// A builder for the *get* method supported by a *targetableRemarketingList* resource. +/// It is not used directly, but through a `TargetableRemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targetable_remarketing_lists().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct TargetableRemarketingListGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetableRemarketingListGetCall<'a, C, A> {} + +impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetableRemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetableRemarketingLists/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetableRemarketingListGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> TargetableRemarketingListGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetableRemarketingListGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetableRemarketingListGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetableRemarketingListGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing advertiser group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::AdvertiserGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AdvertiserGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AdvertiserGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AdvertiserGroup) -> AdvertiserGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one advertiser group by ID. +/// +/// A builder for the *get* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupGetCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of advertiser groups, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().list("profileId") +/// .sort_order("takimata") +/// .sort_field("dolores") +/// .search_string("consetetur") +/// .page_token("erat") +/// .max_results(-52) +/// .add_ids("dolores") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupListCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "advertiser*2015" will return objects with names like "advertiser group June 2015", "advertiser group April 2015", or simply "advertiser group 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "advertisergroup" will match objects with name "my advertisergroup", "advertisergroup 2015", or simply "advertisergroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AdvertiserGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only advertiser groups with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new advertiser group. +/// +/// A builder for the *insert* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::AdvertiserGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AdvertiserGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AdvertiserGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AdvertiserGroup) -> AdvertiserGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing advertiser group. +/// +/// A builder for the *update* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::AdvertiserGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AdvertiserGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AdvertiserGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AdvertiserGroup) -> AdvertiserGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an existing advertiser group. +/// +/// A builder for the *delete* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.advertiser_groups().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupDeleteCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGroupDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AdvertiserGroupDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new site. +/// +/// A builder for the *insert* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Site; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Site::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SiteInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Site, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteInsertCall<'a, C, A> {} + +impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sites"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Site) -> SiteInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SiteInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SiteInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one site by ID. +/// +/// A builder for the *get* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SiteGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteGetCall<'a, C, A> {} + +impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sites/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Site ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SiteGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SiteGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of sites, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().list("profileId") +/// .unmapped_site(false) +/// .subaccount_id("magna") +/// .sort_order("gubergren") +/// .sort_field("sit") +/// .search_string("gubergren") +/// .page_token("sit") +/// .max_results(-97) +/// .add_ids("eirmod") +/// .add_directory_site_ids("sanctus") +/// .add_campaign_ids("Lorem") +/// .approved(true) +/// .ad_words_site(true) +/// .accepts_publisher_paid_placements(true) +/// .accepts_interstitial_placements(true) +/// .accepts_in_stream_video_placements(true) +/// .doit(); +/// # } +/// ``` +pub struct SiteListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _unmapped_site: Option, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _directory_site_ids: Vec, + _campaign_ids: Vec, + _approved: Option, + _ad_words_site: Option, + _accepts_publisher_paid_placements: Option, + _accepts_interstitial_placements: Option, + _accepts_in_stream_video_placements: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteListCall<'a, C, A> {} + +impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SitesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(18 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._unmapped_site { + params.push(("unmappedSite", value.to_string())); + } + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._directory_site_ids.len() > 0 { + for f in self._directory_site_ids.iter() { + params.push(("directorySiteIds", f.to_string())); + } + } + if self._campaign_ids.len() > 0 { + for f in self._campaign_ids.iter() { + params.push(("campaignIds", f.to_string())); + } + } + if let Some(value) = self._approved { + params.push(("approved", value.to_string())); + } + if let Some(value) = self._ad_words_site { + params.push(("adWordsSite", value.to_string())); + } + if let Some(value) = self._accepts_publisher_paid_placements { + params.push(("acceptsPublisherPaidPlacements", value.to_string())); + } + if let Some(value) = self._accepts_interstitial_placements { + params.push(("acceptsInterstitialPlacements", value.to_string())); + } + if let Some(value) = self._accepts_in_stream_video_placements { + params.push(("acceptsInStreamVideoPlacements", value.to_string())); + } + for &field in ["alt", "profileId", "unmappedSite", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "directorySiteIds", "campaignIds", "approved", "adWordsSite", "acceptsPublisherPaidPlacements", "acceptsInterstitialPlacements", "acceptsInStreamVideoPlacements"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sites"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only sites that have not been mapped to a directory site. + /// + /// Sets the *unmapped site* query property to the given value. + pub fn unmapped_site(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._unmapped_site = Some(new_value); + self + } + /// Select only sites with this subaccount ID. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or keyName. Wildcards (*) are allowed. For example, "site*2015" will return objects with names like "site June 2015", "site April 2015", or simply "site 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "site" will match objects with name "my site", "site 2015", or simply "site". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> SiteListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only sites with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only sites with these directory site IDs. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// Select only sites with these campaign IDs. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only approved sites. + /// + /// Sets the *approved* query property to the given value. + pub fn approved(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._approved = Some(new_value); + self + } + /// Select only AdWords sites. + /// + /// Sets the *ad words site* query property to the given value. + pub fn ad_words_site(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._ad_words_site = Some(new_value); + self + } + /// Select only sites that accept publisher paid placements. + /// + /// Sets the *accepts publisher paid placements* query property to the given value. + pub fn accepts_publisher_paid_placements(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._accepts_publisher_paid_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts interstitial placements* query property to the given value. + pub fn accepts_interstitial_placements(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._accepts_interstitial_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts in stream video placements* query property to the given value. + pub fn accepts_in_stream_video_placements(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._accepts_in_stream_video_placements = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SiteListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SiteListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing site. +/// +/// A builder for the *update* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Site; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Site::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SiteUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Site, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteUpdateCall<'a, C, A> {} + +impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sites"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Site) -> SiteUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SiteUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SiteUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing site. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Site; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Site::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SitePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Site, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SitePatchCall<'a, C, A> {} + +impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sites"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Site) -> SitePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SitePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Site ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SitePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SitePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SitePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SitePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one floodlight activity by ID. +/// +/// A builder for the *get* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGetCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of floodlight activities, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().list("profileId") +/// .tag_string("ut") +/// .sort_order("diam") +/// .sort_field("tempor") +/// .search_string("et") +/// .page_token("erat") +/// .max_results(-18) +/// .add_ids("kasd") +/// .floodlight_configuration_id("et") +/// .floodlight_activity_group_type("clita") +/// .floodlight_activity_group_tag_string("sed") +/// .floodlight_activity_group_name("dolores") +/// .add_floodlight_activity_group_ids("clita") +/// .advertiser_id("eos") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _tag_string: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _floodlight_configuration_id: Option, + _floodlight_activity_group_type: Option, + _floodlight_activity_group_tag_string: Option, + _floodlight_activity_group_name: Option, + _floodlight_activity_group_ids: Vec, + _advertiser_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityListCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivitiesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(16 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._tag_string { + params.push(("tagString", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._floodlight_configuration_id { + params.push(("floodlightConfigurationId", value.to_string())); + } + if let Some(value) = self._floodlight_activity_group_type { + params.push(("floodlightActivityGroupType", value.to_string())); + } + if let Some(value) = self._floodlight_activity_group_tag_string { + params.push(("floodlightActivityGroupTagString", value.to_string())); + } + if let Some(value) = self._floodlight_activity_group_name { + params.push(("floodlightActivityGroupName", value.to_string())); + } + if self._floodlight_activity_group_ids.len() > 0 { + for f in self._floodlight_activity_group_ids.iter() { + params.push(("floodlightActivityGroupIds", f.to_string())); + } + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + for &field in ["alt", "profileId", "tagString", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "floodlightConfigurationId", "floodlightActivityGroupType", "floodlightActivityGroupTagString", "floodlightActivityGroupName", "floodlightActivityGroupIds", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only floodlight activities with the specified tag string. + /// + /// Sets the *tag string* query property to the given value. + pub fn tag_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._tag_string = Some(new_value.to_string()); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "floodlightactivity*2015" will return objects with names like "floodlightactivity June 2015", "floodlightactivity April 2015", or simply "floodlightactivity 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "floodlightactivity" will match objects with name "my floodlightactivity activity", "floodlightactivity 2015", or simply "floodlightactivity". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> FloodlightActivityListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only floodlight activities with the specified IDs. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only floodlight activities for the specified floodlight configuration ID. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *floodlight configuration id* query property to the given value. + pub fn floodlight_configuration_id(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_configuration_id = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group type. + /// + /// Sets the *floodlight activity group type* query property to the given value. + pub fn floodlight_activity_group_type(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_type = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group tag string. + /// + /// Sets the *floodlight activity group tag string* query property to the given value. + pub fn floodlight_activity_group_tag_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_tag_string = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group name. + /// + /// Sets the *floodlight activity group name* query property to the given value. + pub fn floodlight_activity_group_name(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_name = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group IDs. + /// + /// Append the given value to the *floodlight activity group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_floodlight_activity_group_ids(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_ids.push(new_value.to_string()); + self + } + /// Select only floodlight activities for the specified advertiser ID. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new floodlight activity. +/// +/// A builder for the *insert* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::FloodlightActivity; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivity::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivity, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityInsertCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivity) -> FloodlightActivityInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an existing floodlight activity. +/// +/// A builder for the *delete* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityDeleteCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing floodlight activity. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::FloodlightActivity; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivity::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivity, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityPatchCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivity) -> FloodlightActivityPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Generates a tag for a floodlight activity. +/// +/// A builder for the *generatetag* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().generatetag("profileId") +/// .floodlight_activity_id("erat") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGeneratetagCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _floodlight_activity_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGeneratetagCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivitiesGenerateTagResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.generatetag", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._floodlight_activity_id { + params.push(("floodlightActivityId", value.to_string())); + } + for &field in ["alt", "profileId", "floodlightActivityId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities/generatetag"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGeneratetagCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID for which we want to generate a tag. + /// + /// Sets the *floodlight activity id* query property to the given value. + pub fn floodlight_activity_id(mut self, new_value: &str) -> FloodlightActivityGeneratetagCall<'a, C, A> { + self._floodlight_activity_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityGeneratetagCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGeneratetagCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGeneratetagCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing floodlight activity. +/// +/// A builder for the *update* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::FloodlightActivity; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightActivity::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_activities().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivity, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityUpdateCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightActivity) -> FloodlightActivityUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightActivityUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightActivityUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of regions. +/// +/// A builder for the *list* method supported by a *region* resource. +/// It is not used directly, but through a `RegionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.regions().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct RegionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RegionListCall<'a, C, A> {} + +impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RegionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.regions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/regions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RegionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RegionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RegionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RegionListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new creative group. +/// +/// A builder for the *insert* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CreativeGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeGroup) -> CreativeGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGroupInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one creative group by ID. +/// +/// A builder for the *get* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeGroups/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGroupGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing creative group. +/// +/// A builder for the *update* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CreativeGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeGroup) -> CreativeGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGroupUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of creative groups, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_groups().list("profileId") +/// .sort_order("justo") +/// .sort_field("labore") +/// .search_string("voluptua.") +/// .page_token("takimata") +/// .max_results(-48) +/// .add_ids("takimata") +/// .group_number(-28) +/// .add_advertiser_ids("no") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _group_number: Option, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupListCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(11 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._group_number { + params.push(("groupNumber", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "groupNumber", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for creative groups by name or ID. Wildcards (*) are allowed. For example, "creativegroup*2015" will return creative groups with names like "creativegroup June 2015", "creativegroup April 2015", or simply "creativegroup 2015". Most of the searches also add wild-cards implicitly at the start and the end of the search string. For example, a search string of "creativegroup" will match creative groups with the name "my creativegroup", "creativegroup 2015", or simply "creativegroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creative groups with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only creative groups that belong to this subgroup. + /// + /// Sets the *group number* query property to the given value. + pub fn group_number(mut self, new_value: i32) -> CreativeGroupListCall<'a, C, A> { + self._group_number = Some(new_value); + self + } + /// Select only creative groups that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGroupListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing creative group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CreativeGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeGroup) -> CreativeGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGroupPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing targeting template. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *targetingTemplate* resource. +/// It is not used directly, but through a `TargetingTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::TargetingTemplate; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TargetingTemplate::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targeting_templates().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct TargetingTemplatePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: TargetingTemplate, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetingTemplatePatchCall<'a, C, A> {} + +impl<'a, C, A> TargetingTemplatePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetingTemplate)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetingTemplates.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetingTemplates"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TargetingTemplate) -> TargetingTemplatePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetingTemplatePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Targeting template ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> TargetingTemplatePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetingTemplatePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetingTemplatePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetingTemplatePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of targeting templates, optionally filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *targetingTemplate* resource. +/// It is not used directly, but through a `TargetingTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targeting_templates().list("profileId") +/// .sort_order("sit") +/// .sort_field("et") +/// .search_string("consetetur") +/// .page_token("sea") +/// .max_results(-91) +/// .add_ids("consetetur") +/// .advertiser_id("accusam") +/// .doit(); +/// # } +/// ``` +pub struct TargetingTemplateListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _advertiser_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetingTemplateListCall<'a, C, A> {} + +impl<'a, C, A> TargetingTemplateListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetingTemplatesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetingTemplates.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetingTemplates"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "template*2015" will return objects with names like "template June 2015", "template April 2015", or simply "template 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "template" will match objects with name "my template", "template 2015", or simply "template". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> TargetingTemplateListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only targeting templates with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only targeting templates with this advertiser ID. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetingTemplateListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetingTemplateListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetingTemplateListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one targeting template by ID. +/// +/// A builder for the *get* method supported by a *targetingTemplate* resource. +/// It is not used directly, but through a `TargetingTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targeting_templates().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct TargetingTemplateGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetingTemplateGetCall<'a, C, A> {} + +impl<'a, C, A> TargetingTemplateGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetingTemplate)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetingTemplates.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetingTemplates/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetingTemplateGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Targeting template ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> TargetingTemplateGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetingTemplateGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetingTemplateGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetingTemplateGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new targeting template. +/// +/// A builder for the *insert* method supported by a *targetingTemplate* resource. +/// It is not used directly, but through a `TargetingTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::TargetingTemplate; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TargetingTemplate::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targeting_templates().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct TargetingTemplateInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: TargetingTemplate, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetingTemplateInsertCall<'a, C, A> {} + +impl<'a, C, A> TargetingTemplateInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetingTemplate)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetingTemplates.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetingTemplates"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TargetingTemplate) -> TargetingTemplateInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetingTemplateInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetingTemplateInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetingTemplateInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetingTemplateInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing targeting template. +/// +/// A builder for the *update* method supported by a *targetingTemplate* resource. +/// It is not used directly, but through a `TargetingTemplateMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::TargetingTemplate; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TargetingTemplate::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.targeting_templates().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct TargetingTemplateUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: TargetingTemplate, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetingTemplateUpdateCall<'a, C, A> {} + +impl<'a, C, A> TargetingTemplateUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetingTemplate)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetingTemplates.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetingTemplates"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TargetingTemplate) -> TargetingTemplateUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetingTemplateUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> TargetingTemplateUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetingTemplateUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> TargetingTemplateUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing subaccount. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Subaccount; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Subaccount::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subaccounts().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Subaccount, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountPatchCall<'a, C, A> {} + +impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/subaccounts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Subaccount) -> SubaccountPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Subaccount ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SubaccountPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubaccountPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubaccountPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new subaccount. +/// +/// A builder for the *insert* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Subaccount; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Subaccount::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subaccounts().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Subaccount, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountInsertCall<'a, C, A> {} + +impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/subaccounts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Subaccount) -> SubaccountInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubaccountInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubaccountInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing subaccount. +/// +/// A builder for the *update* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Subaccount; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Subaccount::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subaccounts().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Subaccount, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountUpdateCall<'a, C, A> {} + +impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/subaccounts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Subaccount) -> SubaccountUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubaccountUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubaccountUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a list of subaccounts, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subaccounts().list("profileId") +/// .sort_order("sit") +/// .sort_field("dolores") +/// .search_string("et") +/// .page_token("sanctus") +/// .max_results(-58) +/// .add_ids("kasd") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountListCall<'a, C, A> {} + +impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SubaccountsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/subaccounts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "subaccount*2015" will return objects with names like "subaccount June 2015", "subaccount April 2015", or simply "subaccount 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "subaccount" will match objects with name "my subaccount", "subaccount 2015", or simply "subaccount". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> SubaccountListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only subaccounts with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubaccountListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubaccountListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one subaccount by ID. +/// +/// A builder for the *get* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.subaccounts().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountGetCall<'a, C, A> {} + +impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/subaccounts/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Subaccount ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SubaccountGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SubaccountGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SubaccountGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one mobile carrier by ID. +/// +/// A builder for the *get* method supported by a *mobileCarrier* resource. +/// It is not used directly, but through a `MobileCarrierMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.mobile_carriers().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct MobileCarrierGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobileCarrierGetCall<'a, C, A> {} + +impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MobileCarrier)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/mobileCarriers/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MobileCarrierGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Mobile carrier ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> MobileCarrierGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MobileCarrierGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobileCarrierGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MobileCarrierGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of mobile carriers. +/// +/// A builder for the *list* method supported by a *mobileCarrier* resource. +/// It is not used directly, but through a `MobileCarrierMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.mobile_carriers().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct MobileCarrierListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobileCarrierListCall<'a, C, A> {} + +impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MobileCarriersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/mobileCarriers"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MobileCarrierListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MobileCarrierListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobileCarrierListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MobileCarrierListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one floodlight configuration by ID. +/// +/// A builder for the *get* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_configurations().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationGetCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfiguration)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightConfigurations/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight configuration ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightConfigurationGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightConfigurationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing floodlight configuration. +/// +/// A builder for the *update* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::FloodlightConfiguration; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightConfiguration::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_configurations().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightConfiguration, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationUpdateCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfiguration)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightConfigurations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightConfiguration) -> FloodlightConfigurationUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightConfigurationUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing floodlight configuration. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::FloodlightConfiguration; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FloodlightConfiguration::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_configurations().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightConfiguration, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationPatchCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfiguration)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightConfigurations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FloodlightConfiguration) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight configuration ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of floodlight configurations, possibly filtered. +/// +/// A builder for the *list* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.floodlight_configurations().list("profileId") +/// .add_ids("et") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationListCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfigurationsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightConfigurations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Set of IDs of floodlight configurations to retrieve. Required field; otherwise an empty list will be returned. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> FloodlightConfigurationListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FloodlightConfigurationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of operating systems. +/// +/// A builder for the *list* method supported by a *operatingSystem* resource. +/// It is not used directly, but through a `OperatingSystemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operating_systems().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemListCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystemsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/operatingSystems"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperatingSystemListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperatingSystemListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one operating system by DART ID. +/// +/// A builder for the *get* method supported by a *operatingSystem* resource. +/// It is not used directly, but through a `OperatingSystemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operating_systems().get("profileId", "dartId") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _dart_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemGetCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystem)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("dartId", self._dart_id.to_string())); + for &field in ["alt", "profileId", "dartId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/operatingSystems/{dartId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{dartId}", "dartId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dartId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Operating system DART ID. + /// + /// Sets the *dart id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dart_id(mut self, new_value: &str) -> OperatingSystemGetCall<'a, C, A> { + self._dart_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperatingSystemGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperatingSystemGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists files for a user profile. +/// +/// A builder for the *list* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.files().list("profileId") +/// .sort_order("sed") +/// .sort_field("tempor") +/// .scope("clita") +/// .page_token("kasd") +/// .max_results(-94) +/// .doit(); +/// # } +/// ``` +pub struct FileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _scope: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileListCall<'a, C, A> {} + +impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FileList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.files.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._scope { + params.push(("scope", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "scope", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/files"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// The field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// The scope that defines which results are returned. + /// + /// Sets the *scope* query property to the given value. + pub fn scope(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._scope = Some(new_value.to_string()); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> FileListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FileListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a report file by its report ID and file ID. This method supports media download. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `File` structure that you would usually get. The latter will be a default value. +/// +/// A builder for the *get* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.files().get("reportId", "fileId") +/// .doit(); +/// # } +/// ``` +pub struct FileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _report_id: String, + _file_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileGetCall<'a, C, A> {} + +impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.files.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("reportId", self._report_id.to_string())); + params.push(("fileId", self._file_id.to_string())); + for &field in ["reportId", "fileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if >::as_ref(&value) != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + + let mut url = self.hub._base_url.clone() + "reports/{reportId}/files/{fileId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{reportId}", "reportId"), ("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["fileId", "reportId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = if enable_resource_parsing { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + } else { (res, Default::default()) }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The ID of the report file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FileGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of placement groups, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_groups().list("profileId") +/// .sort_order("sed") +/// .sort_field("vero") +/// .add_site_ids("nonumy") +/// .search_string("magna") +/// .add_pricing_types("ea") +/// .add_placement_strategy_ids("sea") +/// .placement_group_type("ipsum") +/// .page_token("labore") +/// .min_start_date("Lorem") +/// .min_end_date("aliquyam") +/// .max_start_date("sanctus") +/// .max_results(-34) +/// .max_end_date("consetetur") +/// .add_ids("et") +/// .add_directory_site_ids("justo") +/// .add_content_category_ids("kasd") +/// .add_campaign_ids("kasd") +/// .archived(true) +/// .add_advertiser_ids("eos") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _site_ids: Vec, + _search_string: Option, + _pricing_types: Vec, + _placement_strategy_ids: Vec, + _placement_group_type: Option, + _page_token: Option, + _min_start_date: Option, + _min_end_date: Option, + _max_start_date: Option, + _max_results: Option, + _max_end_date: Option, + _ids: Vec, + _directory_site_ids: Vec, + _content_category_ids: Vec, + _campaign_ids: Vec, + _archived: Option, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupListCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(22 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_ids.len() > 0 { + for f in self._site_ids.iter() { + params.push(("siteIds", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._pricing_types.len() > 0 { + for f in self._pricing_types.iter() { + params.push(("pricingTypes", f.to_string())); + } + } + if self._placement_strategy_ids.len() > 0 { + for f in self._placement_strategy_ids.iter() { + params.push(("placementStrategyIds", f.to_string())); + } + } + if let Some(value) = self._placement_group_type { + params.push(("placementGroupType", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._min_start_date { + params.push(("minStartDate", value.to_string())); + } + if let Some(value) = self._min_end_date { + params.push(("minEndDate", value.to_string())); + } + if let Some(value) = self._max_start_date { + params.push(("maxStartDate", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._max_end_date { + params.push(("maxEndDate", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._directory_site_ids.len() > 0 { + for f in self._directory_site_ids.iter() { + params.push(("directorySiteIds", f.to_string())); + } + } + if self._content_category_ids.len() > 0 { + for f in self._content_category_ids.iter() { + params.push(("contentCategoryIds", f.to_string())); + } + } + if self._campaign_ids.len() > 0 { + for f in self._campaign_ids.iter() { + params.push(("campaignIds", f.to_string())); + } + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "siteIds", "searchString", "pricingTypes", "placementStrategyIds", "placementGroupType", "pageToken", "minStartDate", "minEndDate", "maxStartDate", "maxResults", "maxEndDate", "ids", "directorySiteIds", "contentCategoryIds", "campaignIds", "archived", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these sites. + /// + /// Append the given value to the *site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._site_ids.push(new_value.to_string()); + self + } + /// Allows searching for placement groups by name or ID. Wildcards (*) are allowed. For example, "placement*2015" will return placement groups with names like "placement group June 2015", "placement group May 2015", or simply "placements 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placementgroup" will match placement groups with name "my placementgroup", "placementgroup 2015", or simply "placementgroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only placement groups with these pricing types. + /// + /// Append the given value to the *pricing types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_pricing_types(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._pricing_types.push(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these placement strategies. + /// + /// Append the given value to the *placement strategy ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_strategy_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._placement_strategy_ids.push(new_value.to_string()); + self + } + /// Select only placement groups belonging with this group type. A package is a simple group of placements that acts as a single pricing point for a group of tags. A roadblock is a group of placements that not only acts as a single pricing point but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned placements to be marked as primary for reporting. + /// + /// Sets the *placement group type* query property to the given value. + pub fn placement_group_type(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._placement_group_type = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or after the specified minStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min start date* query property to the given value. + pub fn min_start_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._min_start_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose end date is on or after the specified minEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min end date* query property to the given value. + pub fn min_end_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._min_end_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or before the specified maxStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max start date* query property to the given value. + pub fn max_start_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._max_start_date = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> PlacementGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only placements or placement groups whose end date is on or before the specified maxEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max end date* query property to the given value. + pub fn max_end_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._max_end_date = Some(new_value.to_string()); + self + } + /// Select only placement groups with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these directory sites. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these content categories. + /// + /// Append the given value to the *content category ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_content_category_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._content_category_ids.push(new_value.to_string()); + self + } + /// Select only placement groups that belong to these campaigns. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only archived placements. Don't set this field to select both archived and non-archived placements. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> PlacementGroupListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only placement groups that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGroupListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing placement group. +/// +/// A builder for the *update* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::PlacementGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementGroup) -> PlacementGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGroupUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new placement group. +/// +/// A builder for the *insert* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::PlacementGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementGroup) -> PlacementGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGroupInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one placement group by ID. +/// +/// A builder for the *get* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupGetCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementGroups/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGroupGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing placement group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::PlacementGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementGroup::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementGroup) -> PlacementGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGroupPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of inventory items, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *inventoryItem* resource. +/// It is not used directly, but through a `InventoryItemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.inventory_items().list("profileId", "projectId") +/// .type_("consetetur") +/// .sort_order("tempor") +/// .sort_field("amet") +/// .add_site_id("Lorem") +/// .page_token("eirmod") +/// .add_order_id("elitr") +/// .max_results(-13) +/// .in_plan(true) +/// .add_ids("eirmod") +/// .doit(); +/// # } +/// ``` +pub struct InventoryItemListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _type_: Option, + _sort_order: Option, + _sort_field: Option, + _site_id: Vec, + _page_token: Option, + _order_id: Vec, + _max_results: Option, + _in_plan: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InventoryItemListCall<'a, C, A> {} + +impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, InventoryItemsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(13 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + if let Some(value) = self._type_ { + params.push(("type", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_id.len() > 0 { + for f in self._site_id.iter() { + params.push(("siteId", f.to_string())); + } + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if self._order_id.len() > 0 { + for f in self._order_id.iter() { + params.push(("orderId", f.to_string())); + } + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._in_plan { + params.push(("inPlan", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "projectId", "type", "sortOrder", "sortField", "siteId", "pageToken", "orderId", "maxResults", "inPlan", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/projects/{projectId}/inventoryItems"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Select only inventory items with this type. + /// + /// Sets the *type* query property to the given value. + pub fn type_(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._type_ = Some(new_value.to_string()); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only inventory items that are associated with these sites. + /// + /// Append the given value to the *site id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._site_id.push(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only inventory items that belong to specified orders. + /// + /// Append the given value to the *order id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_order_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._order_id.push(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> InventoryItemListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only inventory items that are in plan. + /// + /// Sets the *in plan* query property to the given value. + pub fn in_plan(mut self, new_value: bool) -> InventoryItemListCall<'a, C, A> { + self._in_plan = Some(new_value); + self + } + /// Select only inventory items with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InventoryItemListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InventoryItemListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InventoryItemListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one inventory item by ID. +/// +/// A builder for the *get* method supported by a *inventoryItem* resource. +/// It is not used directly, but through a `InventoryItemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.inventory_items().get("profileId", "projectId", "id") +/// .doit(); +/// # } +/// ``` +pub struct InventoryItemGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InventoryItemGetCall<'a, C, A> {} + +impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, InventoryItem)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "projectId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/projects/{projectId}/inventoryItems/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Inventory item ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> InventoryItemGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InventoryItemGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> InventoryItemGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a list of user role permissions, possibly filtered. +/// +/// A builder for the *list* method supported by a *userRolePermission* resource. +/// It is not used directly, but through a `UserRolePermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_role_permissions().list("profileId") +/// .add_ids("sea") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionListCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermissionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRolePermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only user role permissions with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> UserRolePermissionListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRolePermissionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRolePermissionListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one user role permission by ID. +/// +/// A builder for the *get* method supported by a *userRolePermission* resource. +/// It is not used directly, but through a `UserRolePermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.user_role_permissions().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionGetCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermission)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRolePermissions/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role permission ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRolePermissionGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserRolePermissionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the list of account permission groups. +/// +/// A builder for the *list* method supported by a *accountPermissionGroup* resource. +/// It is not used directly, but through a `AccountPermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_permission_groups().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionGroupListCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermissionGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountPermissionGroups"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountPermissionGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountPermissionGroupListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one account permission group by ID. +/// +/// A builder for the *get* method supported by a *accountPermissionGroup* resource. +/// It is not used directly, but through a `AccountPermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_permission_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionGroupGetCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermissionGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountPermissionGroups/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account permission group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountPermissionGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountPermissionGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountPermissionGroupGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of content categories, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().list("profileId") +/// .sort_order("Stet") +/// .sort_field("sea") +/// .search_string("sanctus") +/// .page_token("gubergren") +/// .max_results(-56) +/// .add_ids("invidunt") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryListCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategoriesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "contentcategory*2015" will return objects with names like "contentcategory June 2015", "contentcategory April 2015", or simply "contentcategory 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "contentcategory" will match objects with name "my contentcategory", "contentcategory 2015", or simply "contentcategory". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ContentCategoryListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only content categories with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing content category. +/// +/// A builder for the *update* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::ContentCategory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ContentCategory::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ContentCategory, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryUpdateCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ContentCategory) -> ContentCategoryUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new content category. +/// +/// A builder for the *insert* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::ContentCategory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ContentCategory::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ContentCategory, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryInsertCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ContentCategory) -> ContentCategoryInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an existing content category. +/// +/// A builder for the *delete* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryDeleteCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Content category ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ContentCategoryDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one content category by ID. +/// +/// A builder for the *get* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryGetCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Content category ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ContentCategoryGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing content category. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::ContentCategory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ContentCategory::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.content_categories().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ContentCategory, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryPatchCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ContentCategory) -> ContentCategoryPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Content category ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ContentCategoryPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ContentCategoryPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ContentCategoryPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing creative. +/// +/// A builder for the *update* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Creative; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Creative::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Creative, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creatives"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Creative) -> CreativeUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new creative. +/// +/// A builder for the *insert* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Creative; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Creative::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Creative, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creatives"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Creative) -> CreativeInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one creative by ID. +/// +/// A builder for the *get* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creatives/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of creatives, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().list("profileId") +/// .add_types("diam") +/// .studio_creative_id("dolor") +/// .sort_order("eirmod") +/// .sort_field("amet") +/// .add_size_ids("ipsum") +/// .search_string("voluptua.") +/// .add_rendering_ids("eirmod") +/// .page_token("sed") +/// .max_results(-73) +/// .add_ids("sanctus") +/// .add_creative_field_ids("dolor") +/// .add_companion_creative_ids("dolor") +/// .campaign_id("dolore") +/// .archived(false) +/// .advertiser_id("ipsum") +/// .active(true) +/// .doit(); +/// # } +/// ``` +pub struct CreativeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _types: Vec, + _studio_creative_id: Option, + _sort_order: Option, + _sort_field: Option, + _size_ids: Vec, + _search_string: Option, + _rendering_ids: Vec, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _creative_field_ids: Vec, + _companion_creative_ids: Vec, + _campaign_id: Option, + _archived: Option, + _advertiser_id: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeListCall<'a, C, A> {} + +impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(19 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if self._types.len() > 0 { + for f in self._types.iter() { + params.push(("types", f.to_string())); + } + } + if let Some(value) = self._studio_creative_id { + params.push(("studioCreativeId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._size_ids.len() > 0 { + for f in self._size_ids.iter() { + params.push(("sizeIds", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._rendering_ids.len() > 0 { + for f in self._rendering_ids.iter() { + params.push(("renderingIds", f.to_string())); + } + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._creative_field_ids.len() > 0 { + for f in self._creative_field_ids.iter() { + params.push(("creativeFieldIds", f.to_string())); + } + } + if self._companion_creative_ids.len() > 0 { + for f in self._companion_creative_ids.iter() { + params.push(("companionCreativeIds", f.to_string())); + } + } + if let Some(value) = self._campaign_id { + params.push(("campaignId", value.to_string())); + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "types", "studioCreativeId", "sortOrder", "sortField", "sizeIds", "searchString", "renderingIds", "pageToken", "maxResults", "ids", "creativeFieldIds", "companionCreativeIds", "campaignId", "archived", "advertiserId", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creatives"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only creatives with these creative types. + /// + /// Append the given value to the *types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_types(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._types.push(new_value.to_string()); + self + } + /// Select only creatives corresponding to this Studio creative ID. + /// + /// Sets the *studio creative id* query property to the given value. + pub fn studio_creative_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._studio_creative_id = Some(new_value.to_string()); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only creatives with these size IDs. + /// + /// Append the given value to the *size ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_size_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._size_ids.push(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "creative*2015" will return objects with names like "creative June 2015", "creative April 2015", or simply "creative 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "creative" will match objects with name "my creative", "creative 2015", or simply "creative". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only creatives with these rendering IDs. + /// + /// Append the given value to the *rendering ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_rendering_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._rendering_ids.push(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creatives with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only creatives with these creative field IDs. + /// + /// Append the given value to the *creative field ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_creative_field_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._creative_field_ids.push(new_value.to_string()); + self + } + /// Select only in-stream video creatives with these companion IDs. + /// + /// Append the given value to the *companion creative ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_companion_creative_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._companion_creative_ids.push(new_value.to_string()); + self + } + /// Select only creatives with this campaign ID. + /// + /// Sets the *campaign id* query property to the given value. + pub fn campaign_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._campaign_id = Some(new_value.to_string()); + self + } + /// Select only archived creatives. Leave blank to select archived and unarchived creatives. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> CreativeListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only creatives with this advertiser ID. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// Select only active creatives. Leave blank to select active and inactive creatives. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> CreativeListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing creative. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Creative; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Creative::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creatives().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Creative, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativePatchCall<'a, C, A> {} + +impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creatives"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Creative) -> CreativePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one campaign by ID. +/// +/// A builder for the *get* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaigns().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CampaignGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignGetCall<'a, C, A> {} + +impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CampaignGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new campaign. +/// +/// A builder for the *insert* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Campaign; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Campaign::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaigns().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CampaignInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Campaign, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignInsertCall<'a, C, A> {} + +impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Campaign) -> CampaignInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing campaign. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Campaign; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Campaign::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaigns().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CampaignPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Campaign, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignPatchCall<'a, C, A> {} + +impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Campaign) -> CampaignPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CampaignPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing campaign. +/// +/// A builder for the *update* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Campaign; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Campaign::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaigns().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CampaignUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Campaign, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignUpdateCall<'a, C, A> {} + +impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Campaign) -> CampaignUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of campaigns, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.campaigns().list("profileId") +/// .subaccount_id("et") +/// .sort_order("elitr") +/// .sort_field("kasd") +/// .search_string("sit") +/// .page_token("justo") +/// .overridden_event_tag_id("gubergren") +/// .max_results(-54) +/// .add_ids("amet.") +/// .add_excluded_ids("dolor") +/// .at_least_one_optimization_activity(false) +/// .archived(false) +/// .add_advertiser_ids("magna") +/// .add_advertiser_group_ids("amet.") +/// .doit(); +/// # } +/// ``` +pub struct CampaignListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _overridden_event_tag_id: Option, + _max_results: Option, + _ids: Vec, + _excluded_ids: Vec, + _at_least_one_optimization_activity: Option, + _archived: Option, + _advertiser_ids: Vec, + _advertiser_group_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignListCall<'a, C, A> {} + +impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CampaignsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(16 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._overridden_event_tag_id { + params.push(("overriddenEventTagId", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._excluded_ids.len() > 0 { + for f in self._excluded_ids.iter() { + params.push(("excludedIds", f.to_string())); + } + } + if let Some(value) = self._at_least_one_optimization_activity { + params.push(("atLeastOneOptimizationActivity", value.to_string())); + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + if self._advertiser_group_ids.len() > 0 { + for f in self._advertiser_group_ids.iter() { + params.push(("advertiserGroupIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "overriddenEventTagId", "maxResults", "ids", "excludedIds", "atLeastOneOptimizationActivity", "archived", "advertiserIds", "advertiserGroupIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only campaigns that belong to this subaccount. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for campaigns by name or ID. Wildcards (*) are allowed. For example, "campaign*2015" will return campaigns with names like "campaign June 2015", "campaign April 2015", or simply "campaign 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "campaign" will match campaigns with name "my campaign", "campaign 2015", or simply "campaign". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only campaigns that have overridden this event tag ID. + /// + /// Sets the *overridden event tag id* query property to the given value. + pub fn overridden_event_tag_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._overridden_event_tag_id = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CampaignListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only campaigns with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Exclude campaigns with these IDs. + /// + /// Append the given value to the *excluded ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_excluded_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._excluded_ids.push(new_value.to_string()); + self + } + /// Select only campaigns that have at least one optimization activity. + /// + /// Sets the *at least one optimization activity* query property to the given value. + pub fn at_least_one_optimization_activity(mut self, new_value: bool) -> CampaignListCall<'a, C, A> { + self._at_least_one_optimization_activity = Some(new_value); + self + } + /// Select only archived campaigns. Don't set this field to select both archived and non-archived campaigns. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> CampaignListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only campaigns that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// Select only campaigns whose advertisers belong to these advertiser groups. + /// + /// Append the given value to the *advertiser group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_group_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._advertiser_group_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CampaignListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CampaignListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an existing event tag. +/// +/// A builder for the *delete* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct EventTagDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagDeleteCall<'a, C, A> {} + +impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Event tag ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> EventTagDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of event tags, possibly filtered. +/// +/// A builder for the *list* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().list("profileId") +/// .sort_order("et") +/// .sort_field("sanctus") +/// .search_string("diam") +/// .add_ids("eos") +/// .add_event_tag_types("tempor") +/// .enabled(true) +/// .definitions_only(true) +/// .campaign_id("nonumy") +/// .advertiser_id("duo") +/// .ad_id("tempor") +/// .doit(); +/// # } +/// ``` +pub struct EventTagListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _ids: Vec, + _event_tag_types: Vec, + _enabled: Option, + _definitions_only: Option, + _campaign_id: Option, + _advertiser_id: Option, + _ad_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagListCall<'a, C, A> {} + +impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTagsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(13 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._event_tag_types.len() > 0 { + for f in self._event_tag_types.iter() { + params.push(("eventTagTypes", f.to_string())); + } + } + if let Some(value) = self._enabled { + params.push(("enabled", value.to_string())); + } + if let Some(value) = self._definitions_only { + params.push(("definitionsOnly", value.to_string())); + } + if let Some(value) = self._campaign_id { + params.push(("campaignId", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + if let Some(value) = self._ad_id { + params.push(("adId", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "ids", "eventTagTypes", "enabled", "definitionsOnly", "campaignId", "advertiserId", "adId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "eventtag*2015" will return objects with names like "eventtag June 2015", "eventtag April 2015", or simply "eventtag 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "eventtag" will match objects with name "my eventtag", "eventtag 2015", or simply "eventtag". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only event tags with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only event tags with the specified event tag types. Event tag types can be used to specify whether to use a third-party pixel, a third-party JavaScript URL, or a third-party click-through URL for either impression or click tracking. + /// + /// Append the given value to the *event tag types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_event_tag_types(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._event_tag_types.push(new_value.to_string()); + self + } + /// Select only enabled event tags. What is considered enabled or disabled depends on the definitionsOnly parameter. When definitionsOnly is set to true, only the specified advertiser or campaign's event tags' enabledByDefault field is examined. When definitionsOnly is set to false, the specified ad or specified campaign's parent advertiser's or parent campaign's event tags' enabledByDefault and status fields are examined as well. + /// + /// Sets the *enabled* query property to the given value. + pub fn enabled(mut self, new_value: bool) -> EventTagListCall<'a, C, A> { + self._enabled = Some(new_value); + self + } + /// Examine only the specified campaign or advertiser's event tags for matching selector criteria. When set to false, the parent advertiser and parent campaign of the specified ad or campaign is examined as well. In addition, when set to false, the status field is examined as well, along with the enabledByDefault field. This parameter can not be set to true when adId is specified as ads do not define their own even tags. + /// + /// Sets the *definitions only* query property to the given value. + pub fn definitions_only(mut self, new_value: bool) -> EventTagListCall<'a, C, A> { + self._definitions_only = Some(new_value); + self + } + /// Select only event tags that belong to this campaign. + /// + /// Sets the *campaign id* query property to the given value. + pub fn campaign_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._campaign_id = Some(new_value.to_string()); + self + } + /// Select only event tags that belong to this advertiser. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// Select only event tags that belong to this ad. + /// + /// Sets the *ad id* query property to the given value. + pub fn ad_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._ad_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new event tag. +/// +/// A builder for the *insert* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::EventTag; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = EventTag::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct EventTagInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: EventTag, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagInsertCall<'a, C, A> {} + +impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: EventTag) -> EventTagInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing event tag. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::EventTag; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = EventTag::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct EventTagPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: EventTag, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagPatchCall<'a, C, A> {} + +impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: EventTag) -> EventTagPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Event tag ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> EventTagPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing event tag. +/// +/// A builder for the *update* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::EventTag; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = EventTag::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct EventTagUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: EventTag, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagUpdateCall<'a, C, A> {} + +impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: EventTag) -> EventTagUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one event tag by ID. +/// +/// A builder for the *get* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.event_tags().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct EventTagGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagGetCall<'a, C, A> {} + +impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Event tag ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> EventTagGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> EventTagGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> EventTagGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one remarketing list by ID. +/// +/// A builder for the *get* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_lists().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListGetCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingLists/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> RemarketingListGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing remarketing list. +/// +/// A builder for the *update* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::RemarketingList; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RemarketingList::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_lists().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingList, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListUpdateCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingLists"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RemarketingList) -> RemarketingListUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of remarketing lists, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_lists().list("profileId", "advertiserId") +/// .sort_order("est") +/// .sort_field("sit") +/// .page_token("ipsum") +/// .name("dolore") +/// .max_results(-44) +/// .floodlight_activity_id("ipsum") +/// .active(true) +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _advertiser_id: String, + _sort_order: Option, + _sort_field: Option, + _page_token: Option, + _name: Option, + _max_results: Option, + _floodlight_activity_id: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListListCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(11 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("advertiserId", self._advertiser_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._name { + params.push(("name", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._floodlight_activity_id { + params.push(("floodlightActivityId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "advertiserId", "sortOrder", "sortField", "pageToken", "name", "maxResults", "floodlightActivityId", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingLists"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only remarketing lists owned by this advertiser. + /// + /// Sets the *advertiser id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn advertiser_id(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._advertiser_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "remarketing list*2015" will return objects with names like "remarketing list June 2015", "remarketing list April 2015", or simply "remarketing list 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "remarketing list" will match objects with name "my remarketing list", "remarketing list 2015", or simply "remarketing list". + /// + /// Sets the *name* query property to the given value. + pub fn name(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._name = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> RemarketingListListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only remarketing lists that have this floodlight activity ID. + /// + /// Sets the *floodlight activity id* query property to the given value. + pub fn floodlight_activity_id(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._floodlight_activity_id = Some(new_value.to_string()); + self + } + /// Select only active or only inactive remarketing lists. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> RemarketingListListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing remarketing list. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::RemarketingList; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RemarketingList::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_lists().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingList, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListPatchCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingLists"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RemarketingList) -> RemarketingListPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> RemarketingListPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new remarketing list. +/// +/// A builder for the *insert* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::RemarketingList; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RemarketingList::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.remarketing_lists().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingList, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListInsertCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingLists"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RemarketingList) -> RemarketingListInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> RemarketingListInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> RemarketingListInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of cities, possibly filtered. +/// +/// A builder for the *list* method supported by a *city* resource. +/// It is not used directly, but through a `CityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.cities().list("profileId") +/// .add_region_dart_ids("ipsum") +/// .name_prefix("et") +/// .add_dart_ids("invidunt") +/// .add_country_dart_ids("amet.") +/// .doit(); +/// # } +/// ``` +pub struct CityListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _region_dart_ids: Vec, + _name_prefix: Option, + _dart_ids: Vec, + _country_dart_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CityListCall<'a, C, A> {} + +impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CitiesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.cities.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if self._region_dart_ids.len() > 0 { + for f in self._region_dart_ids.iter() { + params.push(("regionDartIds", f.to_string())); + } + } + if let Some(value) = self._name_prefix { + params.push(("namePrefix", value.to_string())); + } + if self._dart_ids.len() > 0 { + for f in self._dart_ids.iter() { + params.push(("dartIds", f.to_string())); + } + } + if self._country_dart_ids.len() > 0 { + for f in self._country_dart_ids.iter() { + params.push(("countryDartIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "regionDartIds", "namePrefix", "dartIds", "countryDartIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/cities"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only cities from these regions. + /// + /// Append the given value to the *region dart ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_region_dart_ids(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._region_dart_ids.push(new_value.to_string()); + self + } + /// Select only cities with names starting with this prefix. + /// + /// Sets the *name prefix* query property to the given value. + pub fn name_prefix(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._name_prefix = Some(new_value.to_string()); + self + } + /// Select only cities with these DART IDs. + /// + /// Append the given value to the *dart ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_dart_ids(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._dart_ids.push(new_value.to_string()); + self + } + /// Select only cities from these countries. + /// + /// Append the given value to the *country dart ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_country_dart_ids(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._country_dart_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CityListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CityListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CityListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing placement strategy. +/// +/// A builder for the *update* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::PlacementStrategy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementStrategy::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementStrategy, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyUpdateCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementStrategy) -> PlacementStrategyUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one placement strategy by ID. +/// +/// A builder for the *get* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyGetCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement strategy ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementStrategyGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of placement strategies, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().list("profileId") +/// .sort_order("sit") +/// .sort_field("vero") +/// .search_string("nonumy") +/// .page_token("accusam") +/// .max_results(-6) +/// .add_ids("sit") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyListCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategiesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "placementstrategy*2015" will return objects with names like "placementstrategy June 2015", "placementstrategy April 2015", or simply "placementstrategy 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placementstrategy" will match objects with name "my placementstrategy", "placementstrategy 2015", or simply "placementstrategy". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> PlacementStrategyListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only placement strategies with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an existing placement strategy. +/// +/// A builder for the *delete* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyDeleteCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement strategy ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementStrategyDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new placement strategy. +/// +/// A builder for the *insert* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::PlacementStrategy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementStrategy::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementStrategy, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyInsertCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementStrategy) -> PlacementStrategyInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing placement strategy. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::PlacementStrategy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PlacementStrategy::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placement_strategies().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementStrategy, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyPatchCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PlacementStrategy) -> PlacementStrategyPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement strategy ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementStrategyPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementStrategyPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementStrategyPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of projects, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().list("profileId") +/// .sort_order("ut") +/// .sort_field("kasd") +/// .search_string("diam") +/// .page_token("ut") +/// .max_results(-29) +/// .add_ids("eos") +/// .add_advertiser_ids("elitr") +/// .doit(); +/// # } +/// ``` +pub struct ProjectListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectListCall<'a, C, A> {} + +impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ProjectsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.projects.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/projects"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for projects by name or ID. Wildcards (*) are allowed. For example, "project*2015" will return projects with names like "project June 2015", "project April 2015", or simply "project 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "project" will match projects with name "my project", "project 2015", or simply "project". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ProjectListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only projects with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only projects with these advertiser IDs. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProjectListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one project by ID. +/// +/// A builder for the *get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ProjectGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Project)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.projects.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/projects/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProjectGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new directory site. +/// +/// A builder for the *insert* method supported by a *directorySite* resource. +/// It is not used directly, but through a `DirectorySiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::DirectorySite; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DirectorySite::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.directory_sites().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: DirectorySite, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteInsertCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySite)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySites.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/directorySites"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DirectorySite) -> DirectorySiteInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DirectorySiteInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DirectorySiteInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of directory sites, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *directorySite* resource. +/// It is not used directly, but through a `DirectorySiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.directory_sites().list("profileId") +/// .sort_order("takimata") +/// .sort_field("gubergren") +/// .search_string("clita") +/// .page_token("et") +/// .max_results(-70) +/// .add_ids("clita") +/// .dfp_network_code("eos") +/// .active(true) +/// .accepts_publisher_paid_placements(false) +/// .accepts_interstitial_placements(true) +/// .accepts_in_stream_video_placements(true) +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _dfp_network_code: Option, + _active: Option, + _accepts_publisher_paid_placements: Option, + _accepts_interstitial_placements: Option, + _accepts_in_stream_video_placements: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteListCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySitesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySites.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(14 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._dfp_network_code { + params.push(("dfpNetworkCode", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + if let Some(value) = self._accepts_publisher_paid_placements { + params.push(("acceptsPublisherPaidPlacements", value.to_string())); + } + if let Some(value) = self._accepts_interstitial_placements { + params.push(("acceptsInterstitialPlacements", value.to_string())); + } + if let Some(value) = self._accepts_in_stream_video_placements { + params.push(("acceptsInStreamVideoPlacements", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "dfpNetworkCode", "active", "acceptsPublisherPaidPlacements", "acceptsInterstitialPlacements", "acceptsInStreamVideoPlacements"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/directorySites"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or URL. Wildcards (*) are allowed. For example, "directory site*2015" will return objects with names like "directory site June 2015", "directory site April 2015", or simply "directory site 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "directory site" will match objects with name "my directory site", "directory site 2015" or simply, "directory site". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> DirectorySiteListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only directory sites with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only directory sites with this Ad Manager network code. + /// + /// Sets the *dfp network code* query property to the given value. + pub fn dfp_network_code(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._dfp_network_code = Some(new_value.to_string()); + self + } + /// Select only active directory sites. Leave blank to retrieve both active and inactive directory sites. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// Select only directory sites that accept publisher paid placements. This field can be left blank. + /// + /// Sets the *accepts publisher paid placements* query property to the given value. + pub fn accepts_publisher_paid_placements(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._accepts_publisher_paid_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts interstitial placements* query property to the given value. + pub fn accepts_interstitial_placements(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._accepts_interstitial_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts in stream video placements* query property to the given value. + pub fn accepts_in_stream_video_placements(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._accepts_in_stream_video_placements = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DirectorySiteListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DirectorySiteListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one directory site by ID. +/// +/// A builder for the *get* method supported by a *directorySite* resource. +/// It is not used directly, but through a `DirectorySiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.directory_sites().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteGetCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySite)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySites.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/directorySites/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Directory site ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> DirectorySiteGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DirectorySiteGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DirectorySiteGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one video format by ID. +/// +/// A builder for the *get* method supported by a *videoFormat* resource. +/// It is not used directly, but through a `VideoFormatMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.video_formats().get("profileId", -50) +/// .doit(); +/// # } +/// ``` +pub struct VideoFormatGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: i32, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VideoFormatGetCall<'a, C, A> {} + +impl<'a, C, A> VideoFormatGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VideoFormat)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.videoFormats.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/videoFormats/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> VideoFormatGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Video format ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: i32) -> VideoFormatGetCall<'a, C, A> { + self._id = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> VideoFormatGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VideoFormatGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> VideoFormatGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists available video formats. +/// +/// A builder for the *list* method supported by a *videoFormat* resource. +/// It is not used directly, but through a `VideoFormatMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.video_formats().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct VideoFormatListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VideoFormatListCall<'a, C, A> {} + +impl<'a, C, A> VideoFormatListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VideoFormatsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.videoFormats.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/videoFormats"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> VideoFormatListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> VideoFormatListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VideoFormatListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> VideoFormatListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an existing dynamic targeting key. +/// +/// A builder for the *delete* method supported by a *dynamicTargetingKey* resource. +/// It is not used directly, but through a `DynamicTargetingKeyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.dynamic_targeting_keys().delete("profileId", "objectId", "name", "objectType") +/// .doit(); +/// # } +/// ``` +pub struct DynamicTargetingKeyDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _object_id: String, + _name: String, + _object_type: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DynamicTargetingKeyDeleteCall<'a, C, A> {} + +impl<'a, C, A> DynamicTargetingKeyDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.dynamicTargetingKeys.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("objectId", self._object_id.to_string())); + params.push(("name", self._name.to_string())); + params.push(("objectType", self._object_type.to_string())); + for &field in ["profileId", "objectId", "name", "objectType"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/dynamicTargetingKeys/{objectId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{objectId}", "objectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["objectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// ID of the object of this dynamic targeting key. This is a required field. + /// + /// Sets the *object id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn object_id(mut self, new_value: &str) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + self._object_id = new_value.to_string(); + self + } + /// Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase. + /// + /// Sets the *name* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Type of the object of this dynamic targeting key. This is a required field. + /// + /// Sets the *object type* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn object_type(mut self, new_value: &str) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + self._object_type = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DynamicTargetingKeyDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DynamicTargetingKeyDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DynamicTargetingKeyDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of dynamic targeting keys. +/// +/// A builder for the *list* method supported by a *dynamicTargetingKey* resource. +/// It is not used directly, but through a `DynamicTargetingKeyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.dynamic_targeting_keys().list("profileId") +/// .object_type("accusam") +/// .object_id("dolore") +/// .add_names("est") +/// .advertiser_id("invidunt") +/// .doit(); +/// # } +/// ``` +pub struct DynamicTargetingKeyListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _object_type: Option, + _object_id: Option, + _names: Vec, + _advertiser_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DynamicTargetingKeyListCall<'a, C, A> {} + +impl<'a, C, A> DynamicTargetingKeyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DynamicTargetingKeysListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.dynamicTargetingKeys.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._object_type { + params.push(("objectType", value.to_string())); + } + if let Some(value) = self._object_id { + params.push(("objectId", value.to_string())); + } + if self._names.len() > 0 { + for f in self._names.iter() { + params.push(("names", f.to_string())); + } + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + for &field in ["alt", "profileId", "objectType", "objectId", "names", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/dynamicTargetingKeys"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only dynamic targeting keys with this object type. + /// + /// Sets the *object type* query property to the given value. + pub fn object_type(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + self._object_type = Some(new_value.to_string()); + self + } + /// Select only dynamic targeting keys with this object ID. + /// + /// Sets the *object id* query property to the given value. + pub fn object_id(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + self._object_id = Some(new_value.to_string()); + self + } + /// Select only dynamic targeting keys exactly matching these names. + /// + /// Append the given value to the *names* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_names(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + self._names.push(new_value.to_string()); + self + } + /// Select only dynamic targeting keys whose object has this advertiser ID. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DynamicTargetingKeyListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DynamicTargetingKeyListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DynamicTargetingKeyListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new dynamic targeting key. Keys must be created at the advertiser level before being assigned to the advertiser's ads, creatives, or placements. There is a maximum of 1000 keys per advertiser, out of which a maximum of 20 keys can be assigned per ad, creative, or placement. +/// +/// A builder for the *insert* method supported by a *dynamicTargetingKey* resource. +/// It is not used directly, but through a `DynamicTargetingKeyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::DynamicTargetingKey; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DynamicTargetingKey::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.dynamic_targeting_keys().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct DynamicTargetingKeyInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: DynamicTargetingKey, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DynamicTargetingKeyInsertCall<'a, C, A> {} + +impl<'a, C, A> DynamicTargetingKeyInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DynamicTargetingKey)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.dynamicTargetingKeys.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/dynamicTargetingKeys"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DynamicTargetingKey) -> DynamicTargetingKeyInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DynamicTargetingKeyInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DynamicTargetingKeyInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DynamicTargetingKeyInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DynamicTargetingKeyInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new size. +/// +/// A builder for the *insert* method supported by a *size* resource. +/// It is not used directly, but through a `SizeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Size; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Size::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sizes().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SizeInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Size, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SizeInsertCall<'a, C, A> {} + +impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Size)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sizes.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sizes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Size) -> SizeInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SizeInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SizeInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SizeInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SizeInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of sizes, possibly filtered. Retrieved sizes are globally unique and may include values not currently in use by your account. Due to this, the list of sizes returned by this method may differ from the list seen in the Trafficking UI. +/// +/// A builder for the *list* method supported by a *size* resource. +/// It is not used directly, but through a `SizeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sizes().list("profileId") +/// .width(-40) +/// .add_ids("sit") +/// .iab_standard(false) +/// .height(-46) +/// .doit(); +/// # } +/// ``` +pub struct SizeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _width: Option, + _ids: Vec, + _iab_standard: Option, + _height: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SizeListCall<'a, C, A> {} + +impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SizesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sizes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._width { + params.push(("width", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._iab_standard { + params.push(("iabStandard", value.to_string())); + } + if let Some(value) = self._height { + params.push(("height", value.to_string())); + } + for &field in ["alt", "profileId", "width", "ids", "iabStandard", "height"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sizes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SizeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only sizes with this width. + /// + /// Sets the *width* query property to the given value. + pub fn width(mut self, new_value: i32) -> SizeListCall<'a, C, A> { + self._width = Some(new_value); + self + } + /// Select only sizes with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> SizeListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only IAB standard sizes. + /// + /// Sets the *iab standard* query property to the given value. + pub fn iab_standard(mut self, new_value: bool) -> SizeListCall<'a, C, A> { + self._iab_standard = Some(new_value); + self + } + /// Select only sizes with this height. + /// + /// Sets the *height* query property to the given value. + pub fn height(mut self, new_value: i32) -> SizeListCall<'a, C, A> { + self._height = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SizeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SizeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SizeListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one size by ID. +/// +/// A builder for the *get* method supported by a *size* resource. +/// It is not used directly, but through a `SizeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sizes().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SizeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SizeGetCall<'a, C, A> {} + +impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Size)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sizes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sizes/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SizeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Size ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SizeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SizeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SizeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SizeGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the account's active ad summary by account ID. +/// +/// A builder for the *get* method supported by a *accountActiveAdSummary* resource. +/// It is not used directly, but through a `AccountActiveAdSummaryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_active_ad_summaries().get("profileId", "summaryAccountId") +/// .doit(); +/// # } +/// ``` +pub struct AccountActiveAdSummaryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _summary_account_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountActiveAdSummaryGetCall<'a, C, A> {} + +impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountActiveAdSummary)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountActiveAdSummaries.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("summaryAccountId", self._summary_account_id.to_string())); + for &field in ["alt", "profileId", "summaryAccountId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountActiveAdSummaries/{summaryAccountId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{summaryAccountId}", "summaryAccountId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["summaryAccountId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountActiveAdSummaryGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account ID. + /// + /// Sets the *summary account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn summary_account_id(mut self, new_value: &str) -> AccountActiveAdSummaryGetCall<'a, C, A> { + self._summary_account_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountActiveAdSummaryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountActiveAdSummaryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountActiveAdSummaryGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing account user profile. +/// +/// A builder for the *update* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::AccountUserProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccountUserProfile::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_user_profiles().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AccountUserProfile, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileUpdateCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountUserProfiles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccountUserProfile) -> AccountUserProfileUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUserProfileUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUserProfileUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of account user profiles, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_user_profiles().list("profileId") +/// .user_role_id("clita") +/// .subaccount_id("consetetur") +/// .sort_order("magna") +/// .sort_field("invidunt") +/// .search_string("At") +/// .page_token("rebum.") +/// .max_results(-47) +/// .add_ids("ipsum") +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _user_role_id: Option, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileListCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfilesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(12 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._user_role_id { + params.push(("userRoleId", value.to_string())); + } + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "userRoleId", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountUserProfiles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only user profiles with the specified user role ID. + /// + /// Sets the *user role id* query property to the given value. + pub fn user_role_id(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._user_role_id = Some(new_value.to_string()); + self + } + /// Select only user profiles with the specified subaccount ID. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or email. Wildcards (*) are allowed. For example, "user profile*2015" will return objects with names like "user profile June 2015", "user profile April 2015", or simply "user profile 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "user profile" will match objects with name "my user profile", "user profile 2015", or simply "user profile". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AccountUserProfileListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only user profiles with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only active user profiles. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> AccountUserProfileListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUserProfileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUserProfileListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new account user profile. +/// +/// A builder for the *insert* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::AccountUserProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccountUserProfile::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_user_profiles().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AccountUserProfile, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileInsertCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountUserProfiles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccountUserProfile) -> AccountUserProfileInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUserProfileInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUserProfileInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing account user profile. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::AccountUserProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AccountUserProfile::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_user_profiles().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfilePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AccountUserProfile, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfilePatchCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountUserProfiles"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AccountUserProfile) -> AccountUserProfilePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfilePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User profile ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountUserProfilePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUserProfilePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfilePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUserProfilePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one account user profile by ID. +/// +/// A builder for the *get* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.account_user_profiles().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileGetCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountUserProfiles/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User profile ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountUserProfileGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUserProfileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUserProfileGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of countries. +/// +/// A builder for the *list* method supported by a *country* resource. +/// It is not used directly, but through a `CountryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.countries().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct CountryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CountryListCall<'a, C, A> {} + +impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CountriesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.countries.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/countries"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CountryListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CountryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CountryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CountryListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one country by ID. +/// +/// A builder for the *get* method supported by a *country* resource. +/// It is not used directly, but through a `CountryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.countries().get("profileId", "dartId") +/// .doit(); +/// # } +/// ``` +pub struct CountryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _dart_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CountryGetCall<'a, C, A> {} + +impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Country)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.countries.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("dartId", self._dart_id.to_string())); + for &field in ["alt", "profileId", "dartId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/countries/{dartId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{dartId}", "dartId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dartId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CountryGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Country DART ID. + /// + /// Sets the *dart id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dart_id(mut self, new_value: &str) -> CountryGetCall<'a, C, A> { + self._dart_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CountryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CountryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CountryGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing creative field value. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CreativeFieldValue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeFieldValue::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().patch(req, "profileId", "creativeFieldId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValuePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeFieldValue, + _profile_id: String, + _creative_field_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValuePatchCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeFieldValue) -> CreativeFieldValuePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Creative Field Value ID + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValuePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValuePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValuePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one creative field value by ID. +/// +/// A builder for the *get* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().get("profileId", "creativeFieldId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _creative_field_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueGetCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Creative Field Value ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldValueGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValueGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an existing creative field value. +/// +/// A builder for the *delete* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().delete("profileId", "creativeFieldId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _creative_field_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueDeleteCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "creativeFieldId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Creative Field Value ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new creative field value. +/// +/// A builder for the *insert* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CreativeFieldValue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeFieldValue::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().insert(req, "profileId", "creativeFieldId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeFieldValue, + _profile_id: String, + _creative_field_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeFieldValue) -> CreativeFieldValueInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueInsertCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValueInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing creative field value. +/// +/// A builder for the *update* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::CreativeFieldValue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreativeFieldValue::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().update(req, "profileId", "creativeFieldId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeFieldValue, + _profile_id: String, + _creative_field_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreativeFieldValue) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of creative field values, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_field_values().list("profileId", "creativeFieldId") +/// .sort_order("sed") +/// .sort_field("tempor") +/// .search_string("diam") +/// .page_token("takimata") +/// .max_results(-50) +/// .add_ids("dolor") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _creative_field_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueListCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValuesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + for &field in ["alt", "profileId", "creativeFieldId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for creative field values by their values. Wildcards (e.g. *) are not allowed. + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeFieldValueListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creative field values with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeFieldValueListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one postal code by ID. +/// +/// A builder for the *get* method supported by a *postalCode* resource. +/// It is not used directly, but through a `PostalCodeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.postal_codes().get("profileId", "code") +/// .doit(); +/// # } +/// ``` +pub struct PostalCodeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _code: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PostalCodeGetCall<'a, C, A> {} + +impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PostalCode)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.postalCodes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("code", self._code.to_string())); + for &field in ["alt", "profileId", "code"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/postalCodes/{code}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{code}", "code")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["code", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PostalCodeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Postal code ID. + /// + /// Sets the *code* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn code(mut self, new_value: &str) -> PostalCodeGetCall<'a, C, A> { + self._code = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PostalCodeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PostalCodeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PostalCodeGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of postal codes. +/// +/// A builder for the *list* method supported by a *postalCode* resource. +/// It is not used directly, but through a `PostalCodeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.postal_codes().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct PostalCodeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PostalCodeListCall<'a, C, A> {} + +impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PostalCodesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.postalCodes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/postalCodes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PostalCodeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PostalCodeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PostalCodeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PostalCodeListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of browsers. +/// +/// A builder for the *list* method supported by a *browser* resource. +/// It is not used directly, but through a `BrowserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.browsers().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct BrowserListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BrowserListCall<'a, C, A> {} + +impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BrowsersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.browsers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/browsers"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> BrowserListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BrowserListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> BrowserListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BrowserListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one account by ID. +/// +/// A builder for the *get* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountGetCall<'a, C, A> {} + +impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accounts/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the list of accounts, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().list("profileId") +/// .sort_order("sanctus") +/// .sort_field("sit") +/// .search_string("sit") +/// .page_token("magna") +/// .max_results(-52) +/// .add_ids("clita") +/// .active(true) +/// .doit(); +/// # } +/// ``` +pub struct AccountListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountListCall<'a, C, A> {} + +impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accounts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "account*2015" will return objects with names like "account June 2015", "account April 2015", or simply "account 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "account" will match objects with name "my account", "account 2015", or simply "account". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AccountListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only accounts with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only active accounts. Don't set this field to select both active and non-active accounts. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> AccountListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing account. +/// +/// A builder for the *update* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Account; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Account::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Account, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUpdateCall<'a, C, A> {} + +impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accounts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Account) -> AccountUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing account. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Account; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Account::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Account, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPatchCall<'a, C, A> {} + +impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accounts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Account) -> AccountPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing placement. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Placement; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Placement::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Placement, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementPatchCall<'a, C, A> {} + +impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Placement) -> PlacementPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves a list of placements, possibly filtered. This method supports paging. +/// +/// A builder for the *list* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().list("profileId") +/// .sort_order("sea") +/// .sort_field("justo") +/// .add_size_ids("dolore") +/// .add_site_ids("At") +/// .search_string("dolor") +/// .add_pricing_types("tempor") +/// .add_placement_strategy_ids("ipsum") +/// .payment_source("est") +/// .page_token("et") +/// .min_start_date("no") +/// .min_end_date("sed") +/// .max_start_date("kasd") +/// .max_results(-54) +/// .max_end_date("sadipscing") +/// .add_ids("sea") +/// .add_group_ids("eos") +/// .add_directory_site_ids("dolor") +/// .add_content_category_ids("Lorem") +/// .add_compatibilities("amet") +/// .add_campaign_ids("Lorem") +/// .archived(true) +/// .add_advertiser_ids("nonumy") +/// .doit(); +/// # } +/// ``` +pub struct PlacementListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _size_ids: Vec, + _site_ids: Vec, + _search_string: Option, + _pricing_types: Vec, + _placement_strategy_ids: Vec, + _payment_source: Option, + _page_token: Option, + _min_start_date: Option, + _min_end_date: Option, + _max_start_date: Option, + _max_results: Option, + _max_end_date: Option, + _ids: Vec, + _group_ids: Vec, + _directory_site_ids: Vec, + _content_category_ids: Vec, + _compatibilities: Vec, + _campaign_ids: Vec, + _archived: Option, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementListCall<'a, C, A> {} + +impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(25 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._size_ids.len() > 0 { + for f in self._size_ids.iter() { + params.push(("sizeIds", f.to_string())); + } + } + if self._site_ids.len() > 0 { + for f in self._site_ids.iter() { + params.push(("siteIds", f.to_string())); + } + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._pricing_types.len() > 0 { + for f in self._pricing_types.iter() { + params.push(("pricingTypes", f.to_string())); + } + } + if self._placement_strategy_ids.len() > 0 { + for f in self._placement_strategy_ids.iter() { + params.push(("placementStrategyIds", f.to_string())); + } + } + if let Some(value) = self._payment_source { + params.push(("paymentSource", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._min_start_date { + params.push(("minStartDate", value.to_string())); + } + if let Some(value) = self._min_end_date { + params.push(("minEndDate", value.to_string())); + } + if let Some(value) = self._max_start_date { + params.push(("maxStartDate", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._max_end_date { + params.push(("maxEndDate", value.to_string())); + } + if self._ids.len() > 0 { + for f in self._ids.iter() { + params.push(("ids", f.to_string())); + } + } + if self._group_ids.len() > 0 { + for f in self._group_ids.iter() { + params.push(("groupIds", f.to_string())); + } + } + if self._directory_site_ids.len() > 0 { + for f in self._directory_site_ids.iter() { + params.push(("directorySiteIds", f.to_string())); + } + } + if self._content_category_ids.len() > 0 { + for f in self._content_category_ids.iter() { + params.push(("contentCategoryIds", f.to_string())); + } + } + if self._compatibilities.len() > 0 { + for f in self._compatibilities.iter() { + params.push(("compatibilities", f.to_string())); + } + } + if self._campaign_ids.len() > 0 { + for f in self._campaign_ids.iter() { + params.push(("campaignIds", f.to_string())); + } + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + for f in self._advertiser_ids.iter() { + params.push(("advertiserIds", f.to_string())); + } + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "sizeIds", "siteIds", "searchString", "pricingTypes", "placementStrategyIds", "paymentSource", "pageToken", "minStartDate", "minEndDate", "maxStartDate", "maxResults", "maxEndDate", "ids", "groupIds", "directorySiteIds", "contentCategoryIds", "compatibilities", "campaignIds", "archived", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only placements that are associated with these sizes. + /// + /// Append the given value to the *size ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_size_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._size_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these sites. + /// + /// Append the given value to the *site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._site_ids.push(new_value.to_string()); + self + } + /// Allows searching for placements by name or ID. Wildcards (*) are allowed. For example, "placement*2015" will return placements with names like "placement June 2015", "placement May 2015", or simply "placements 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placement" will match placements with name "my placement", "placement 2015", or simply "placement". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only placements with these pricing types. + /// + /// Append the given value to the *pricing types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_pricing_types(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._pricing_types.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these placement strategies. + /// + /// Append the given value to the *placement strategy ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_strategy_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._placement_strategy_ids.push(new_value.to_string()); + self + } + /// Select only placements with this payment source. + /// + /// Sets the *payment source* query property to the given value. + pub fn payment_source(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._payment_source = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or after the specified minStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min start date* query property to the given value. + pub fn min_start_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._min_start_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose end date is on or after the specified minEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min end date* query property to the given value. + pub fn min_end_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._min_end_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or before the specified maxStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max start date* query property to the given value. + pub fn max_start_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._max_start_date = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> PlacementListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only placements or placement groups whose end date is on or before the specified maxEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max end date* query property to the given value. + pub fn max_end_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._max_end_date = Some(new_value.to_string()); + self + } + /// Select only placements with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only placements that belong to these placement groups. + /// + /// Append the given value to the *group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_group_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._group_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these directory sites. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these content categories. + /// + /// Append the given value to the *content category ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_content_category_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._content_category_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these compatibilities. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. + /// + /// Append the given value to the *compatibilities* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_compatibilities(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._compatibilities.push(new_value.to_string()); + self + } + /// Select only placements that belong to these campaigns. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only archived placements. Don't set this field to select both archived and non-archived placements. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> PlacementListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only placements that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets one placement by ID. +/// +/// A builder for the *get* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGetCall<'a, C, A> {} + +impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements/{id}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Inserts a new placement. +/// +/// A builder for the *insert* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Placement; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Placement::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Placement, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementInsertCall<'a, C, A> {} + +impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Placement) -> PlacementInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementInsertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing placement. +/// +/// A builder for the *update* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// use dfareporting3d3::Placement; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Placement::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Placement, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementUpdateCall<'a, C, A> {} + +impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Placement) -> PlacementUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Generates tags for a placement. +/// +/// A builder for the *generatetags* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting3d3 as dfareporting3d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting3d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.placements().generatetags("profileId") +/// .add_tag_formats("et") +/// .add_placement_ids("ipsum") +/// .campaign_id("gubergren") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGeneratetagCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _tag_formats: Vec, + _placement_ids: Vec, + _campaign_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGeneratetagCall<'a, C, A> {} + +impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementsGenerateTagsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.generatetags", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("profileId", self._profile_id.to_string())); + if self._tag_formats.len() > 0 { + for f in self._tag_formats.iter() { + params.push(("tagFormats", f.to_string())); + } + } + if self._placement_ids.len() > 0 { + for f in self._placement_ids.iter() { + params.push(("placementIds", f.to_string())); + } + } + if let Some(value) = self._campaign_id { + params.push(("campaignId", value.to_string())); + } + for &field in ["alt", "profileId", "tagFormats", "placementIds", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements/generatetags"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Tag formats to generate for these placements. + /// + /// Note: PLACEMENT_TAG_STANDARD can only be generated for 1x1 placements. + /// + /// Append the given value to the *tag formats* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_tag_formats(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._tag_formats.push(new_value.to_string()); + self + } + /// Generate tags for these placements. + /// + /// Append the given value to the *placement ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_ids(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._placement_ids.push(new_value.to_string()); + self + } + /// Generate placements belonging to this campaign. This is a required field. + /// + /// Sets the *campaign id* query property to the given value. + pub fn campaign_id(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._campaign_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PlacementGeneratetagCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGeneratetagCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PlacementGeneratetagCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/dialogflow2-cli/Cargo.toml b/gen/dialogflow2-cli/Cargo.toml index 6632cc33f8..1c7cb6dc65 100644 --- a/gen/dialogflow2-cli/Cargo.toml +++ b/gen/dialogflow2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dialogflow2-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with Dialogflow (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dialogflow2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-dialogflow2] path = "../dialogflow2" -version = "1.0.8+20181009" +version = "1.0.8+20190402" diff --git a/gen/dialogflow2-cli/README.md b/gen/dialogflow2-cli/README.md index 3d6b8e0a26..524c04156c 100644 --- a/gen/dialogflow2-cli/README.md +++ b/gen/dialogflow2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Dialogflow* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *Dialogflow* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash dialogflow2 [options] diff --git a/gen/dialogflow2-cli/mkdocs.yml b/gen/dialogflow2-cli/mkdocs.yml index 6c71d9205f..319a32a98c 100644 --- a/gen/dialogflow2-cli/mkdocs.yml +++ b/gen/dialogflow2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Dialogflow v1.0.8+20181009 +site_name: Dialogflow v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-dialogflow2-cli site_description: A complete library to interact with Dialogflow (protocol v2) diff --git a/gen/dialogflow2-cli/src/main.rs b/gen/dialogflow2-cli/src/main.rs index d5a3b070a2..96d01f9783 100644 --- a/gen/dialogflow2-cli/src/main.rs +++ b/gen/dialogflow2-cli/src/main.rs @@ -155,8 +155,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "language-code" => Some(("languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entity-type-batch-uri" => Some(("entityTypeBatchUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["entity-type-batch-uri", "language-code", "update-mask"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -2122,20 +2122,29 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "input-audio" => Some(("inputAudio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "query-input.text.text" => Some(("queryInput.text.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-audio-config.sample-rate-hertz" => Some(("outputAudioConfig.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "output-audio-config.audio-encoding" => Some(("outputAudioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-audio-config.synthesize-speech-config.effects-profile-id" => Some(("outputAudioConfig.synthesizeSpeechConfig.effectsProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "output-audio-config.synthesize-speech-config.voice.ssml-gender" => Some(("outputAudioConfig.synthesizeSpeechConfig.voice.ssmlGender", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-audio-config.synthesize-speech-config.voice.name" => Some(("outputAudioConfig.synthesizeSpeechConfig.voice.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-audio-config.synthesize-speech-config.speaking-rate" => Some(("outputAudioConfig.synthesizeSpeechConfig.speakingRate", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "output-audio-config.synthesize-speech-config.volume-gain-db" => Some(("outputAudioConfig.synthesizeSpeechConfig.volumeGainDb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "output-audio-config.synthesize-speech-config.pitch" => Some(("outputAudioConfig.synthesizeSpeechConfig.pitch", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "query-input.text.language-code" => Some(("queryInput.text.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query-input.text.text" => Some(("queryInput.text.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.event.language-code" => Some(("queryInput.event.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.event.name" => Some(("queryInput.event.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.audio-config.phrase-hints" => Some(("queryInput.audioConfig.phraseHints", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "query-input.audio-config.language-code" => Some(("queryInput.audioConfig.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "query-input.audio-config.audio-encoding" => Some(("queryInput.audioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.audio-config.sample-rate-hertz" => Some(("queryInput.audioConfig.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "query-params.reset-contexts" => Some(("queryParams.resetContexts", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "query-input.audio-config.audio-encoding" => Some(("queryInput.audioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query-params.sentiment-analysis-request-config.analyze-query-text-sentiment" => Some(("queryParams.sentimentAnalysisRequestConfig.analyzeQueryTextSentiment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "query-params.geo-location.latitude" => Some(("queryParams.geoLocation.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "query-params.geo-location.longitude" => Some(("queryParams.geoLocation.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "query-params.reset-contexts" => Some(("queryParams.resetContexts", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "query-params.time-zone" => Some(("queryParams.timeZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["audio-config", "audio-encoding", "event", "geo-location", "input-audio", "language-code", "latitude", "longitude", "name", "phrase-hints", "query-input", "query-params", "reset-contexts", "sample-rate-hertz", "text", "time-zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["analyze-query-text-sentiment", "audio-config", "audio-encoding", "effects-profile-id", "event", "geo-location", "input-audio", "language-code", "latitude", "longitude", "name", "output-audio-config", "phrase-hints", "pitch", "query-input", "query-params", "reset-contexts", "sample-rate-hertz", "sentiment-analysis-request-config", "speaking-rate", "ssml-gender", "synthesize-speech-config", "text", "time-zone", "voice", "volume-gain-db"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2932,8 +2941,7 @@ fn main() { ("agent-entity-types-batch-delete", Some(r##"Deletes entity types in the specified agent. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_cli/projects_agent-entity-types-batch-delete", vec![ (Some(r##"parent"##), @@ -2964,8 +2972,7 @@ fn main() { ("agent-entity-types-batch-update", Some(r##"Updates/Creates multiple entity types in the specified agent. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_cli/projects_agent-entity-types-batch-update", vec![ (Some(r##"parent"##), @@ -3079,8 +3086,7 @@ fn main() { ("agent-entity-types-entities-batch-delete", Some(r##"Deletes entities in the specified entity type. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_cli/projects_agent-entity-types-entities-batch-delete", vec![ (Some(r##"parent"##), @@ -3113,8 +3119,7 @@ fn main() { method does not affect entities in the entity type that aren't explicitly specified in the request. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_cli/projects_agent-entity-types-entities-batch-update", vec![ (Some(r##"parent"##), @@ -3194,10 +3199,10 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"Required for all methods except `create` (`create` populates the name - automatically. - The unique identifier of the entity type. Format: - `projects//agent/entityTypes/`."##), + Some(r##"The unique identifier of the entity type. + Required for EntityTypes.UpdateEntityType and + EntityTypes.BatchUpdateEntityTypes methods. + Format: `projects//agent/entityTypes/`."##), Some(true), Some(false)), @@ -3222,8 +3227,7 @@ fn main() { ("agent-export", Some(r##"Exports the specified agent to a ZIP file. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_cli/projects_agent-export", vec![ (Some(r##"parent"##), @@ -3258,8 +3262,7 @@ fn main() { Intents and entity types with the same name are replaced with the new versions from ImportAgentRequest. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_cli/projects_agent-import", vec![ (Some(r##"parent"##), @@ -3386,7 +3389,6 @@ fn main() { None, Some(r##"Required. The name of the intent to delete. If this intent has direct or indirect followup intents, we also delete them. - Format: `projects//agent/intents/`."##), Some(true), Some(false)), @@ -3455,9 +3457,9 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"Required for all methods except `create` (`create` populates the name - automatically. - The unique identifier of this intent. + Some(r##"The unique identifier of this intent. + Required for Intents.UpdateIntent and Intents.BatchUpdateIntents + methods. Format: `projects//agent/intents/`."##), Some(true), Some(false)), @@ -3486,8 +3488,7 @@ fn main() { Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_cli/projects_agent-restore", vec![ (Some(r##"parent"##), @@ -3651,7 +3652,10 @@ fn main() { (Some(r##"name"##), None, Some(r##"Required. The unique identifier of the context. Format: - `projects//agent/sessions//contexts/`."##), + `projects//agent/sessions//contexts/`. + + The `Context ID` is always converted to lowercase, may only contain + characters in [a-zA-Z0-9_-%] and may be at most 250 bytes long."##), Some(true), Some(false)), @@ -3870,8 +3874,7 @@ fn main() { ("agent-train", Some(r##"Trains the specified agent. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_cli/projects_agent-train", vec![ (Some(r##"parent"##), @@ -3952,8 +3955,8 @@ fn main() { let mut app = App::new("dialogflow2") .author("Sebastian Thiel ") - .version("1.0.8+20181009") - .about("An end-to-end development suite for conversational interfaces (e.g., chatbots, voice-powered apps and devices).") + .version("1.0.8+20190402") + .about("Builds conversational interfaces (for example, chatbots, and voice-powered apps and devices).") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dialogflow2_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/dialogflow2/Cargo.toml b/gen/dialogflow2/Cargo.toml index c2af18a742..0a48bba9b3 100644 --- a/gen/dialogflow2/Cargo.toml +++ b/gen/dialogflow2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dialogflow2" -version = "1.0.8+20181009" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with Dialogflow (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dialogflow2" homepage = "https://cloud.google.com/dialogflow-enterprise/" -documentation = "https://docs.rs/google-dialogflow2/1.0.8+20181009" +documentation = "https://docs.rs/google-dialogflow2/1.0.8+20190402" license = "MIT" keywords = ["dialogflow", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/dialogflow2/README.md b/gen/dialogflow2/README.md index 81ae9be42b..e7ee9c20f5 100644 --- a/gen/dialogflow2/README.md +++ b/gen/dialogflow2/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-dialogflow2` library allows access to all features of the *Google Dialogflow* service. -This documentation was generated from *Dialogflow* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *dialogflow:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Dialogflow* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *dialogflow:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Dialogflow* *v2* API can be found at the [official documentation site](https://cloud.google.com/dialogflow-enterprise/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.Dialogflow.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.Dialogflow.html) ... * projects - * [*agent entity types batch delete*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentEntityTypeBatchDeleteCall.html), [*agent entity types batch update*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentEntityTypeBatchUpdateCall.html), [*agent entity types create*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentEntityTypeCreateCall.html), [*agent entity types delete*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentEntityTypeDeleteCall.html), [*agent entity types entities batch create*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentEntityTypeEntityBatchCreateCall.html), [*agent entity types entities batch delete*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentEntityTypeEntityBatchDeleteCall.html), [*agent entity types entities batch update*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html), [*agent entity types get*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentEntityTypeGetCall.html), [*agent entity types list*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentEntityTypeListCall.html), [*agent entity types patch*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentEntityTypePatchCall.html), [*agent export*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentExportCall.html), [*agent import*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentImportCall.html), [*agent intents batch delete*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentIntentBatchDeleteCall.html), [*agent intents batch update*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentIntentBatchUpdateCall.html), [*agent intents create*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentIntentCreateCall.html), [*agent intents delete*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentIntentDeleteCall.html), [*agent intents get*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentIntentGetCall.html), [*agent intents list*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentIntentListCall.html), [*agent intents patch*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentIntentPatchCall.html), [*agent restore*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentRestoreCall.html), [*agent search*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSearchCall.html), [*agent sessions contexts create*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionContextCreateCall.html), [*agent sessions contexts delete*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionContextDeleteCall.html), [*agent sessions contexts get*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionContextGetCall.html), [*agent sessions contexts list*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionContextListCall.html), [*agent sessions contexts patch*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionContextPatchCall.html), [*agent sessions delete contexts*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionDeleteContextCall.html), [*agent sessions detect intent*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionDetectIntentCall.html), [*agent sessions entity types create*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionEntityTypeCreateCall.html), [*agent sessions entity types delete*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionEntityTypeDeleteCall.html), [*agent sessions entity types get*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionEntityTypeGetCall.html), [*agent sessions entity types list*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionEntityTypeListCall.html), [*agent sessions entity types patch*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentSessionEntityTypePatchCall.html), [*agent train*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectAgentTrainCall.html), [*get agent*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectGetAgentCall.html) and [*operations get*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.ProjectOperationGetCall.html) + * [*agent entity types batch delete*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentEntityTypeBatchDeleteCall.html), [*agent entity types batch update*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentEntityTypeBatchUpdateCall.html), [*agent entity types create*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentEntityTypeCreateCall.html), [*agent entity types delete*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentEntityTypeDeleteCall.html), [*agent entity types entities batch create*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentEntityTypeEntityBatchCreateCall.html), [*agent entity types entities batch delete*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentEntityTypeEntityBatchDeleteCall.html), [*agent entity types entities batch update*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html), [*agent entity types get*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentEntityTypeGetCall.html), [*agent entity types list*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentEntityTypeListCall.html), [*agent entity types patch*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentEntityTypePatchCall.html), [*agent export*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentExportCall.html), [*agent import*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentImportCall.html), [*agent intents batch delete*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentIntentBatchDeleteCall.html), [*agent intents batch update*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentIntentBatchUpdateCall.html), [*agent intents create*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentIntentCreateCall.html), [*agent intents delete*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentIntentDeleteCall.html), [*agent intents get*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentIntentGetCall.html), [*agent intents list*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentIntentListCall.html), [*agent intents patch*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentIntentPatchCall.html), [*agent restore*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentRestoreCall.html), [*agent search*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSearchCall.html), [*agent sessions contexts create*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionContextCreateCall.html), [*agent sessions contexts delete*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionContextDeleteCall.html), [*agent sessions contexts get*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionContextGetCall.html), [*agent sessions contexts list*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionContextListCall.html), [*agent sessions contexts patch*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionContextPatchCall.html), [*agent sessions delete contexts*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionDeleteContextCall.html), [*agent sessions detect intent*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionDetectIntentCall.html), [*agent sessions entity types create*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionEntityTypeCreateCall.html), [*agent sessions entity types delete*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionEntityTypeDeleteCall.html), [*agent sessions entity types get*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionEntityTypeGetCall.html), [*agent sessions entity types list*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionEntityTypeListCall.html), [*agent sessions entity types patch*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentSessionEntityTypePatchCall.html), [*agent train*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectAgentTrainCall.html), [*get agent*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectGetAgentCall.html) and [*operations get*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.ProjectOperationGetCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/struct.Dialogflow.html)** +* **[Hub](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/struct.Dialogflow.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.Part.html)** + * **[Parts](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -50,10 +50,10 @@ Or specifically ... let r = hub.projects().agent_restore(...).doit() let r = hub.projects().agent_intents_batch_delete(...).doit() let r = hub.projects().agent_entity_types_batch_delete(...).doit() -let r = hub.projects().agent_train(...).doit() +let r = hub.projects().agent_import(...).doit() let r = hub.projects().agent_export(...).doit() let r = hub.projects().agent_entity_types_batch_update(...).doit() -let r = hub.projects().agent_import(...).doit() +let r = hub.projects().agent_train(...).doit() let r = hub.projects().agent_intents_batch_update(...).doit() let r = hub.projects().agent_entity_types_entities_batch_update(...).doit() let r = hub.projects().agent_entity_types_entities_batch_delete(...).doit() @@ -141,17 +141,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -161,29 +161,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-dialogflow2/1.0.8+20181009/google_dialogflow2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dialogflow2/1.0.8+20190402/google_dialogflow2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dialogflow2/src/lib.rs b/gen/dialogflow2/src/lib.rs index 9ebb3472f5..ebf60baa3e 100644 --- a/gen/dialogflow2/src/lib.rs +++ b/gen/dialogflow2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Dialogflow* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *dialogflow:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Dialogflow* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *dialogflow:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Dialogflow* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/dialogflow-enterprise/). @@ -50,10 +50,10 @@ //! let r = hub.projects().agent_restore(...).doit() //! let r = hub.projects().agent_intents_batch_delete(...).doit() //! let r = hub.projects().agent_entity_types_batch_delete(...).doit() -//! let r = hub.projects().agent_train(...).doit() +//! let r = hub.projects().agent_import(...).doit() //! let r = hub.projects().agent_export(...).doit() //! let r = hub.projects().agent_entity_types_batch_update(...).doit() -//! let r = hub.projects().agent_import(...).doit() +//! let r = hub.projects().agent_train(...).doit() //! let r = hub.projects().agent_intents_batch_update(...).doit() //! let r = hub.projects().agent_entity_types_entities_batch_update(...).doit() //! let r = hub.projects().agent_entity_types_entities_batch_delete(...).doit() @@ -242,6 +242,9 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { + /// View, manage and query your Dialogflow agents + Full, + /// View and manage your data across Google Cloud Platform services CloudPlatform, } @@ -249,6 +252,7 @@ pub enum Scope { impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { + Scope::Full => "https://www.googleapis.com/auth/dialogflow", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", } } @@ -256,7 +260,7 @@ impl AsRef for Scope { impl Default for Scope { fn default() -> Scope { - Scope::CloudPlatform + Scope::Full } } @@ -397,6 +401,11 @@ pub struct GoogleCloudDialogflowV2DetectIntentRequest { /// A single request can contain up to 1 minute of speech audio data. #[serde(rename="inputAudio")] pub input_audio: Option, + /// Optional. Instructs the speech synthesizer how to generate the output + /// audio. If this field is not set and agent-level speech synthesizer is not + /// configured, no output audio is generated. + #[serde(rename="outputAudioConfig")] + pub output_audio_config: Option, /// Required. The input specification. It can be set to: /// /// 1. an audio config @@ -475,61 +484,72 @@ pub struct GoogleCloudDialogflowV2IntentMessageSimpleResponses { impl Part for GoogleCloudDialogflowV2IntentMessageSimpleResponses {} -/// The request message for EntityTypes.BatchUpdateEntityTypes. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent entity types batch update projects](struct.ProjectAgentEntityTypeBatchUpdateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2BatchUpdateEntityTypesRequest { - /// Optional. The language of entity synonyms defined in `entity_types`. If not - /// specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. - #[serde(rename="languageCode")] - pub language_code: Option, - /// Optional. The mask to control which fields get updated. - #[serde(rename="updateMask")] - pub update_mask: Option, - /// The URI to a Google Cloud Storage file containing entity types to update - /// or create. The file format can either be a serialized proto (of - /// EntityBatch type) or a JSON object. Note: The URI must start with - /// "gs://". - #[serde(rename="entityTypeBatchUri")] - pub entity_type_batch_uri: Option, - /// The collection of entity types to update or create. - #[serde(rename="entityTypeBatchInline")] - pub entity_type_batch_inline: Option, -} - -impl RequestValue for GoogleCloudDialogflowV2BatchUpdateEntityTypesRequest {} - - /// Represents the natural language text to be processed. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudDialogflowV2TextInput { - /// Required. The UTF-8 encoded natural language text to be processed. - /// Text length must not exceed 256 bytes. - pub text: Option, /// Required. The language of this conversational query. See [Language - /// Support](https://dialogflow.com/docs/languages) for a list of the - /// currently supported language codes. Note that queries in the same session - /// do not necessarily need to specify the same language. + /// Support](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// for a list of the currently supported language codes. Note that queries in + /// the same session do not necessarily need to specify the same language. #[serde(rename="languageCode")] pub language_code: Option, + /// Required. The UTF-8 encoded natural language text to be processed. + /// Text length must not exceed 256 characters. + pub text: Option, } impl Part for GoogleCloudDialogflowV2TextInput {} +/// Represents the query input. It can contain either: +/// +/// 1. An audio config which +/// instructs the speech recognizer how to process the speech audio. +/// +/// 2. A conversational query in the form of text,. +/// +/// 3. An event that specifies which intent to trigger. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2QueryInput { + /// The natural language text to be processed. + pub text: Option, + /// The event to be processed. + pub event: Option, + /// Instructs the speech recognizer how to process the speech audio. + #[serde(rename="audioConfig")] + pub audio_config: Option, +} + +impl Part for GoogleCloudDialogflowV2QueryInput {} + + +/// Description of which voice to use for speech synthesis. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2VoiceSelectionParams { + /// Optional. The preferred gender of the voice. If not set, the service will + /// choose a voice based on the other parameters such as language_code and + /// name. Note that this is only a preference, not requirement. If a + /// voice of the appropriate gender is not available, the synthesizer should + /// substitute a voice with a different gender rather than failing the request. + #[serde(rename="ssmlGender")] + pub ssml_gender: Option, + /// Optional. The name of the voice. If not set, the service will choose a + /// voice based on the other parameters such as language_code and gender. + pub name: Option, +} + +impl Part for GoogleCloudDialogflowV2VoiceSelectionParams {} + + /// The button object that appears at the bottom of a card. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -554,20 +574,20 @@ impl Part for GoogleCloudDialogflowV2IntentMessageBasicCardButton {} pub struct GoogleCloudDialogflowV2IntentTrainingPhrasePart { /// Optional. The parameter name for the value extracted from the /// annotated part of the example. + /// This field is required for annotated parts of the training phrase. pub alias: Option, - /// Optional. The entity type name prefixed with `@`. This field is - /// required for the annotated part of the text and applies only to - /// examples. + /// Optional. The entity type name prefixed with `@`. + /// This field is required for annotated parts of the training phrase. #[serde(rename="entityType")] pub entity_type: Option, - /// Optional. Indicates whether the text was manually annotated by the - /// developer. + /// Required. The text for this part. + pub text: Option, + /// Optional. Indicates whether the text was manually annotated. + /// This field is set to true when the Dialogflow Console is used to + /// manually annotate the part. When creating an annotated part with the + /// API, you must set this to true. #[serde(rename="userDefined")] pub user_defined: Option, - /// Required. The text corresponding to the example or template, - /// if there are no annotations. For - /// annotated examples, it is the text for one of the example's parts. - pub text: Option, } impl Part for GoogleCloudDialogflowV2IntentTrainingPhrasePart {} @@ -617,9 +637,9 @@ pub struct GoogleCloudDialogflowV2Intent { /// Required. The name of this intent. #[serde(rename="displayName")] pub display_name: Option, - /// Required for all methods except `create` (`create` populates the name - /// automatically. /// The unique identifier of this intent. + /// Required for Intents.UpdateIntent and Intents.BatchUpdateIntents + /// methods. /// Format: `projects//agent/intents/`. pub name: Option, /// Optional. The collection of parameters associated with the intent. @@ -637,7 +657,7 @@ pub struct GoogleCloudDialogflowV2Intent { /// a direct or indirect parent. We populate this field only in the output. #[serde(rename="followupIntentInfo")] pub followup_intent_info: Option>, - /// Optional. The collection of examples/templates that the agent is + /// Optional. The collection of examples that the agent is /// trained on. #[serde(rename="trainingPhrases")] pub training_phrases: Option>, @@ -645,7 +665,10 @@ pub struct GoogleCloudDialogflowV2Intent { /// `Response` field in the Dialogflow console. pub messages: Option>, /// Optional. The priority of this intent. Higher numbers represent higher - /// priorities. Zero or negative numbers mean that the intent is disabled. + /// priorities. If this is zero or unspecified, we use the default + /// priority 500000. + /// + /// Negative numbers mean that the intent is disabled. pub priority: Option, /// Read-only. The unique identifier of the root intent in the chain of /// followup intents. It identifies the correct followup intents chain for @@ -688,9 +711,10 @@ pub struct GoogleCloudDialogflowV2BatchCreateEntitiesRequest { pub entities: Option>, /// Optional. The language of entity synonyms defined in `entities`. If not /// specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. #[serde(rename="languageCode")] pub language_code: Option, } @@ -724,17 +748,17 @@ pub struct GoogleCloudDialogflowV2IntentMessageCarouselSelect { impl Part for GoogleCloudDialogflowV2IntentMessageCarouselSelect {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -795,21 +819,32 @@ pub struct GoogleRpcStatus { impl Part for GoogleRpcStatus {} -/// Optional. Represents an entity. +/// An **entity entry** for an associated entity type. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudDialogflowV2EntityTypeEntity { - /// Required. A collection of synonyms. For `KIND_LIST` entity types this - /// must contain exactly one synonym equal to `value`. - pub synonyms: Option>, - /// Required. - /// For `KIND_MAP` entity types: - /// A canonical name to be used in place of synonyms. + /// Required. A collection of value synonyms. For example, if the entity type + /// is *vegetable*, and `value` is *scallions*, a synonym could be *green + /// onions*. + /// /// For `KIND_LIST` entity types: - /// A string that can contain references to other entity types (with or - /// without aliases). + /// + /// * This collection must contain exactly one synonym equal to `value`. + pub synonyms: Option>, + /// Required. The primary value associated with this entity entry. + /// For example, if the entity type is *vegetable*, the value could be + /// *scallions*. + /// + /// For `KIND_MAP` entity types: + /// + /// * A canonical value to be used in place of synonyms. + /// + /// For `KIND_LIST` entity types: + /// + /// * A string that can contain references to other entity types (with or + /// without aliases). pub value: Option, } @@ -932,18 +967,28 @@ impl Part for GoogleCloudDialogflowV2IntentMessageCarouselSelectItem {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudDialogflowV2DetectIntentResponse { - /// The selected results of the conversational query or event processing. - /// See `alternative_query_results` for additional potential results. - #[serde(rename="queryResult")] - pub query_result: Option, - /// Specifies the status of the webhook request. `webhook_status` - /// is never populated in webhook requests. + /// The audio data bytes encoded as specified in the request. + /// Note: The output audio is generated based on the values of default platform + /// text responses found in the `query_result.fulfillment_messages` field. If + /// multiple default text responses exist, they will be concatenated when + /// generating audio. If no default platform text responses exist, the + /// generated audio content will be empty. + #[serde(rename="outputAudio")] + pub output_audio: Option, + /// The config used by the speech synthesizer to generate the output audio. + #[serde(rename="outputAudioConfig")] + pub output_audio_config: Option, + /// Specifies the status of the webhook request. #[serde(rename="webhookStatus")] pub webhook_status: Option, /// The unique identifier of the response. It can be used to /// locate a response in the training example set or for reporting issues. #[serde(rename="responseId")] pub response_id: Option, + /// The selected results of the conversational query or event processing. + /// See `alternative_query_results` for additional potential results. + #[serde(rename="queryResult")] + pub query_result: Option, } impl ResponseResult for GoogleCloudDialogflowV2DetectIntentResponse {} @@ -962,9 +1007,10 @@ impl ResponseResult for GoogleCloudDialogflowV2DetectIntentResponse {} pub struct GoogleCloudDialogflowV2BatchDeleteEntitiesRequest { /// Optional. The language of entity synonyms defined in `entities`. If not /// specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. #[serde(rename="languageCode")] pub language_code: Option, /// Required. The canonical `values` of the entities to delete. Note that @@ -993,6 +1039,80 @@ pub struct GoogleCloudDialogflowV2IntentMessageCardButton { impl Part for GoogleCloudDialogflowV2IntentMessageCardButton {} +/// Configuration of how speech should be synthesized. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2SynthesizeSpeechConfig { + /// Optional. An identifier which selects 'audio effects' profiles that are + /// applied on (post synthesized) text to speech. Effects are applied on top of + /// each other in the order they are given. + #[serde(rename="effectsProfileId")] + pub effects_profile_id: Option>, + /// Optional. The desired voice of the synthesized audio. + pub voice: Option, + /// Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal + /// native speed supported by the specific voice. 2.0 is twice as fast, and + /// 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any + /// other values < 0.25 or > 4.0 will return an error. + #[serde(rename="speakingRate")] + pub speaking_rate: Option, + /// Optional. Volume gain (in dB) of the normal native volume supported by the + /// specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of + /// 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) + /// will play at approximately half the amplitude of the normal native signal + /// amplitude. A value of +6.0 (dB) will play at approximately twice the + /// amplitude of the normal native signal amplitude. We strongly recommend not + /// to exceed +10 (dB) as there's usually no effective increase in loudness for + /// any value greater than that. + #[serde(rename="volumeGainDb")] + pub volume_gain_db: Option, + /// Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 + /// semitones from the original pitch. -20 means decrease 20 semitones from the + /// original pitch. + pub pitch: Option, +} + +impl Part for GoogleCloudDialogflowV2SynthesizeSpeechConfig {} + + +/// The request message for EntityTypes.BatchUpdateEntityTypes. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent entity types batch update projects](struct.ProjectAgentEntityTypeBatchUpdateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2BatchUpdateEntityTypesRequest { + /// Optional. The language of entity synonyms defined in `entity_types`. If not + /// specified, the agent's default language is used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. + #[serde(rename="languageCode")] + pub language_code: Option, + /// The URI to a Google Cloud Storage file containing entity types to update + /// or create. The file format can either be a serialized proto (of + /// EntityBatch type) or a JSON object. Note: The URI must start with + /// "gs://". + #[serde(rename="entityTypeBatchUri")] + pub entity_type_batch_uri: Option, + /// The collection of entity types to update or create. + #[serde(rename="entityTypeBatchInline")] + pub entity_type_batch_inline: Option, + /// Optional. The mask to control which fields get updated. + #[serde(rename="updateMask")] + pub update_mask: Option, +} + +impl RequestValue for GoogleCloudDialogflowV2BatchUpdateEntityTypesRequest {} + + /// The request message for Agents.ImportAgent. /// /// # Activities @@ -1044,14 +1164,18 @@ impl RequestValue for GoogleCloudDialogflowV2ImportAgentRequest {} pub struct GoogleCloudDialogflowV2Context { /// Required. The unique identifier of the context. Format: /// `projects//agent/sessions//contexts/`. + /// + /// The `Context ID` is always converted to lowercase, may only contain + /// characters in [a-zA-Z0-9_-%] and may be at most 250 bytes long. pub name: Option, /// Optional. The collection of parameters associated with this context. - /// Refer to [this doc](https://dialogflow.com/docs/actions-and-parameters) for - /// syntax. + /// Refer to [this + /// doc](https://cloud.google.com/dialogflow-enterprise/docs/intents-actions-parameters) + /// for syntax. pub parameters: Option>, /// Optional. The number of conversational query requests after which the /// context expires. If set to `0` (the default) the context expires - /// immediately. Contexts expire automatically after 20 minutes even if there + /// immediately. Contexts expire automatically after 20 minutes if there /// are no matching queries. #[serde(rename="lifespanCount")] pub lifespan_count: Option, @@ -1079,9 +1203,10 @@ pub struct GoogleCloudDialogflowV2BatchUpdateEntitiesRequest { pub update_mask: Option, /// Optional. The language of entity synonyms defined in `entities`. If not /// specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. #[serde(rename="languageCode")] pub language_code: Option, } @@ -1196,9 +1321,10 @@ impl ResponseResult for GoogleCloudDialogflowV2SessionEntityType {} pub struct GoogleCloudDialogflowV2BatchUpdateIntentsRequest { /// Optional. The language of training phrases, parameters and rich messages /// defined in `intents`. If not specified, the agent's default language is - /// used. [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. + /// used. [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. #[serde(rename="languageCode")] pub language_code: Option, /// The URI to a Google Cloud Storage file containing intents to update or @@ -1234,6 +1360,22 @@ pub struct GoogleCloudDialogflowV2IntentMessageSuggestion { impl Part for GoogleCloudDialogflowV2IntentMessageSuggestion {} +/// Configures the types of sentiment analysis to perform. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2SentimentAnalysisRequestConfig { + /// Optional. Instructs the service to perform sentiment analysis on + /// `query_text`. If not provided, sentiment analysis is not performed on + /// `query_text`. + #[serde(rename="analyzeQueryTextSentiment")] + pub analyze_query_text_sentiment: Option, +} + +impl Part for GoogleCloudDialogflowV2SentimentAnalysisRequestConfig {} + + /// The response message for EntityTypes.ListEntityTypes. /// /// # Activities @@ -1258,59 +1400,44 @@ pub struct GoogleCloudDialogflowV2ListEntityTypesResponse { impl ResponseResult for GoogleCloudDialogflowV2ListEntityTypesResponse {} -/// This message is a wrapper around a collection of entity types. +/// The response message for SessionEntityTypes.ListSessionEntityTypes. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent sessions entity types list projects](struct.ProjectAgentSessionEntityTypeListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2EntityTypeBatch { - /// A collection of entity types. - #[serde(rename="entityTypes")] - pub entity_types: Option>, +pub struct GoogleCloudDialogflowV2ListSessionEntityTypesResponse { + /// Token to retrieve the next page of results, or empty if there are no + /// more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of session entity types. There will be a maximum number of items + /// returned based on the page_size field in the request. + #[serde(rename="sessionEntityTypes")] + pub session_entity_types: Option>, } -impl Part for GoogleCloudDialogflowV2EntityTypeBatch {} - - -/// Represents the query input. It can contain either: -/// -/// 1. An audio config which -/// instructs the speech recognizer how to process the speech audio. -/// -/// 2. A conversational query in the form of text,. -/// -/// 3. An event that specifies which intent to trigger. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2QueryInput { - /// The natural language text to be processed. - pub text: Option, - /// The event to be processed. - pub event: Option, - /// Instructs the speech recognizer how to process the speech audio. - #[serde(rename="audioConfig")] - pub audio_config: Option, -} - -impl Part for GoogleCloudDialogflowV2QueryInput {} +impl ResponseResult for GoogleCloudDialogflowV2ListSessionEntityTypesResponse {} /// Events allow for matching intents by event name instead of the natural -/// language input. For instance, input `` can trigger a personalized welcome response. +/// language input. For instance, input `` can trigger a personalized welcome response. /// The parameter `name` may be used by the agent in the response: -/// `“Hello #welcome_event.name! What can I do for you today?”`. +/// `"Hello #welcome_event.name! What can I do for you today?"`. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudDialogflowV2EventInput { /// Required. The language of this query. See [Language - /// Support](https://dialogflow.com/docs/languages) for a list of the - /// currently supported language codes. Note that queries in the same session - /// do not necessarily need to specify the same language. + /// Support](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// for a list of the currently supported language codes. Note that queries in + /// the same session do not necessarily need to specify the same language. #[serde(rename="languageCode")] pub language_code: Option, /// Required. The unique identifier of the event. @@ -1333,13 +1460,13 @@ impl Part for GoogleCloudDialogflowV2EventInput {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudDialogflowV2ListContextsResponse { + /// The list of contexts. There will be a maximum number of items + /// returned based on the page_size field in the request. + pub contexts: Option>, /// Token to retrieve the next page of results, or empty if there are no /// more results in the list. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The list of contexts. There will be a maximum number of items - /// returned based on the page_size field in the request. - pub contexts: Option>, } impl ResponseResult for GoogleCloudDialogflowV2ListContextsResponse {} @@ -1353,13 +1480,13 @@ impl ResponseResult for GoogleCloudDialogflowV2ListContextsResponse {} pub struct GoogleCloudDialogflowV2IntentMessageCard { /// Optional. The collection of card buttons. pub buttons: Option>, - /// Optional. The title of the card. - pub title: Option, - /// Optional. The subtitle of the card. - pub subtitle: Option, /// Optional. The public URI to an image file for the card. #[serde(rename="imageUri")] pub image_uri: Option, + /// Optional. The subtitle of the card. + pub subtitle: Option, + /// Optional. The title of the card. + pub title: Option, } impl Part for GoogleCloudDialogflowV2IntentMessageCard {} @@ -1403,6 +1530,30 @@ pub struct GoogleCloudDialogflowV2TrainAgentRequest { _never_set: Option } impl RequestValue for GoogleCloudDialogflowV2TrainAgentRequest {} +/// Instructs the speech synthesizer how to generate the output audio content. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2OutputAudioConfig { + /// Required. Audio encoding of the synthesized audio content. + #[serde(rename="audioEncoding")] + pub audio_encoding: Option, + /// Optional. The synthesis sample rate (in hertz) for this audio. If not + /// provided, then the synthesizer will use the default sample rate based on + /// the audio encoding. If this is different from the voice's natural sample + /// rate, then the synthesizer will honor this request by converting to the + /// desired sample rate (which might result in worse audio quality). + #[serde(rename="sampleRateHertz")] + pub sample_rate_hertz: Option, + /// Optional. Configuration of how speech should be synthesized. + #[serde(rename="synthesizeSpeechConfig")] + pub synthesize_speech_config: Option, +} + +impl Part for GoogleCloudDialogflowV2OutputAudioConfig {} + + /// The suggestion chip message that allows the user to jump out to the app /// or website associated with this agent. /// @@ -1440,17 +1591,17 @@ pub struct GoogleCloudDialogflowV2EntityType { /// expanded. #[serde(rename="autoExpansionMode")] pub auto_expansion_mode: Option, - /// Optional. The collection of entities associated with the entity type. + /// Optional. The collection of entity entries associated with the entity type. pub entities: Option>, /// Required. Indicates the kind of entity type. pub kind: Option, /// Required. The name of the entity type. #[serde(rename="displayName")] pub display_name: Option, - /// Required for all methods except `create` (`create` populates the name - /// automatically. - /// The unique identifier of the entity type. Format: - /// `projects//agent/entityTypes/`. + /// The unique identifier of the entity type. + /// Required for EntityTypes.UpdateEntityType and + /// EntityTypes.BatchUpdateEntityTypes methods. + /// Format: `projects//agent/entityTypes/`. pub name: Option, } @@ -1497,11 +1648,14 @@ pub struct GoogleCloudDialogflowV2InputAudioConfig { pub phrase_hints: Option>, /// Required. The language of the supplied audio. Dialogflow does not do /// translations. See [Language - /// Support](https://dialogflow.com/docs/languages) for a list of the - /// currently supported language codes. Note that queries in the same session - /// do not necessarily need to specify the same language. + /// Support](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// for a list of the currently supported language codes. Note that queries in + /// the same session do not necessarily need to specify the same language. #[serde(rename="languageCode")] pub language_code: Option, + /// Required. Audio encoding of the audio content to process. + #[serde(rename="audioEncoding")] + pub audio_encoding: Option, /// Required. Sample rate (in Hertz) of the audio content sent in the query. /// Refer to /// [Cloud Speech API @@ -1509,93 +1663,39 @@ pub struct GoogleCloudDialogflowV2InputAudioConfig { /// more details. #[serde(rename="sampleRateHertz")] pub sample_rate_hertz: Option, - /// Required. Audio encoding of the audio content to process. - #[serde(rename="audioEncoding")] - pub audio_encoding: Option, } impl Part for GoogleCloudDialogflowV2InputAudioConfig {} -/// Represents the result of conversational query or event processing. +/// The result of sentiment analysis as configured by +/// `sentiment_analysis_request_config`. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2QueryResult { - /// The language that was triggered during intent detection. - /// See [Language Support](https://dialogflow.com/docs/reference/language) - /// for a list of the currently supported language codes. - #[serde(rename="languageCode")] - pub language_code: Option, - /// The text to be pronounced to the user or shown on the screen. - #[serde(rename="fulfillmentText")] - pub fulfillment_text: Option, - /// This field is set to: - /// - `false` if the matched intent has required parameters and not all of - /// the required parameter values have been collected. - /// - `true` if all required parameter values have been collected, or if the - /// matched intent doesn't contain any required parameters. - #[serde(rename="allRequiredParamsPresent")] - pub all_required_params_present: Option, - /// The collection of extracted parameters. - pub parameters: Option>, - /// The collection of rich messages to present to the user. - #[serde(rename="fulfillmentMessages")] - pub fulfillment_messages: Option>, - /// The Speech recognition confidence between 0.0 and 1.0. A higher number - /// indicates an estimated greater likelihood that the recognized words are - /// correct. The default of 0.0 is a sentinel value indicating that confidence - /// was not set. - /// - /// This field is not guaranteed to be accurate or set. In particular this - /// field isn't set for StreamingDetectIntent since the streaming endpoint has - /// separate confidence estimates per portion of the audio in - /// StreamingRecognitionResult. - #[serde(rename="speechRecognitionConfidence")] - pub speech_recognition_confidence: Option, - /// The intent detection confidence. Values range from 0.0 - /// (completely uncertain) to 1.0 (completely certain). - /// If there are `multiple knowledge_answers` messages, this value is set to - /// the greatest `knowledgeAnswers.match_confidence` value in the list. - #[serde(rename="intentDetectionConfidence")] - pub intent_detection_confidence: Option, - /// The original conversational query text: - /// - If natural language text was provided as input, `query_text` contains - /// a copy of the input. - /// - If natural language speech audio was provided as input, `query_text` - /// contains the speech recognition result. If speech recognizer produced - /// multiple alternatives, a particular one is picked. - /// - If an event was provided as input, `query_text` is not set. - #[serde(rename="queryText")] - pub query_text: Option, - /// The intent that matched the conversational query. Some, not - /// all fields are filled in this message, including but not limited to: - /// `name`, `display_name` and `webhook_state`. - pub intent: Option, - /// The free-form diagnostic info. For example, this field - /// could contain webhook call latency. - #[serde(rename="diagnosticInfo")] - pub diagnostic_info: Option>, - /// The action name from the matched intent. - pub action: Option, - /// If the query was fulfilled by a webhook call, this field is set to the - /// value of the `source` field returned in the webhook response. - #[serde(rename="webhookSource")] - pub webhook_source: Option, - /// The collection of output contexts. If applicable, - /// `output_contexts.parameters` contains entries with name - /// `.original` containing the original parameter values - /// before the query. - #[serde(rename="outputContexts")] - pub output_contexts: Option>, - /// If the query was fulfilled by a webhook call, this field is set to the - /// value of the `payload` field returned in the webhook response. - #[serde(rename="webhookPayload")] - pub webhook_payload: Option>, +pub struct GoogleCloudDialogflowV2SentimentAnalysisResult { + /// The sentiment analysis result for `query_text`. + #[serde(rename="queryTextSentiment")] + pub query_text_sentiment: Option, } -impl Part for GoogleCloudDialogflowV2QueryResult {} +impl Part for GoogleCloudDialogflowV2SentimentAnalysisResult {} + + +/// The card for presenting a list of options to select from. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2IntentMessageListSelect { + /// Required. List items. + pub items: Option>, + /// Optional. The overall title of the list. + pub title: Option, +} + +impl Part for GoogleCloudDialogflowV2IntentMessageListSelect {} /// Additional info about the select item for when it is triggered in a @@ -1616,28 +1716,22 @@ pub struct GoogleCloudDialogflowV2IntentMessageSelectItemInfo { impl Part for GoogleCloudDialogflowV2IntentMessageSelectItemInfo {} -/// The response message for SessionEntityTypes.ListSessionEntityTypes. +/// The sentiment, such as positive/negative feeling or association, for a unit +/// of analysis, such as the query text. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent sessions entity types list projects](struct.ProjectAgentSessionEntityTypeListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2ListSessionEntityTypesResponse { - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of session entity types. There will be a maximum number of items - /// returned based on the page_size field in the request. - #[serde(rename="sessionEntityTypes")] - pub session_entity_types: Option>, +pub struct GoogleCloudDialogflowV2Sentiment { + /// A non-negative number in the [0, +inf) range, which represents the absolute + /// magnitude of sentiment, regardless of score (positive or negative). + pub magnitude: Option, + /// Sentiment score between -1.0 (negative sentiment) and 1.0 (positive + /// sentiment). + pub score: Option, } -impl ResponseResult for GoogleCloudDialogflowV2ListSessionEntityTypesResponse {} +impl Part for GoogleCloudDialogflowV2Sentiment {} /// The quick replies response message. @@ -1656,19 +1750,92 @@ pub struct GoogleCloudDialogflowV2IntentMessageQuickReplies { impl Part for GoogleCloudDialogflowV2IntentMessageQuickReplies {} -/// The card for presenting a list of options to select from. +/// Represents the result of conversational query or event processing. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2IntentMessageListSelect { - /// Required. List items. - pub items: Option>, - /// Optional. The overall title of the list. - pub title: Option, +pub struct GoogleCloudDialogflowV2QueryResult { + /// The collection of rich messages to present to the user. + #[serde(rename="fulfillmentMessages")] + pub fulfillment_messages: Option>, + /// The text to be pronounced to the user or shown on the screen. + /// Note: This is a legacy field, `fulfillment_messages` should be preferred. + #[serde(rename="fulfillmentText")] + pub fulfillment_text: Option, + /// This field is set to: + /// - `false` if the matched intent has required parameters and not all of + /// the required parameter values have been collected. + /// - `true` if all required parameter values have been collected, or if the + /// matched intent doesn't contain any required parameters. + #[serde(rename="allRequiredParamsPresent")] + pub all_required_params_present: Option, + /// The collection of extracted parameters. + pub parameters: Option>, + /// The language that was triggered during intent detection. + /// See [Language + /// Support](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// for a list of the currently supported language codes. + #[serde(rename="languageCode")] + pub language_code: Option, + /// The Speech recognition confidence between 0.0 and 1.0. A higher number + /// indicates an estimated greater likelihood that the recognized words are + /// correct. The default of 0.0 is a sentinel value indicating that confidence + /// was not set. + /// + /// This field is not guaranteed to be accurate or set. In particular this + /// field isn't set for StreamingDetectIntent since the streaming endpoint has + /// separate confidence estimates per portion of the audio in + /// StreamingRecognitionResult. + #[serde(rename="speechRecognitionConfidence")] + pub speech_recognition_confidence: Option, + /// The intent detection confidence. Values range from 0.0 + /// (completely uncertain) to 1.0 (completely certain). + /// If there are `multiple knowledge_answers` messages, this value is set to + /// the greatest `knowledgeAnswers.match_confidence` value in the list. + #[serde(rename="intentDetectionConfidence")] + pub intent_detection_confidence: Option, + /// The action name from the matched intent. + pub action: Option, + /// The intent that matched the conversational query. Some, not + /// all fields are filled in this message, including but not limited to: + /// `name`, `display_name` and `webhook_state`. + pub intent: Option, + /// The sentiment analysis result, which depends on the + /// `sentiment_analysis_request_config` specified in the request. + #[serde(rename="sentimentAnalysisResult")] + pub sentiment_analysis_result: Option, + /// The free-form diagnostic info. For example, this field could contain + /// webhook call latency. The string keys of the Struct's fields map can change + /// without notice. + #[serde(rename="diagnosticInfo")] + pub diagnostic_info: Option>, + /// The original conversational query text: + /// - If natural language text was provided as input, `query_text` contains + /// a copy of the input. + /// - If natural language speech audio was provided as input, `query_text` + /// contains the speech recognition result. If speech recognizer produced + /// multiple alternatives, a particular one is picked. + /// - If an event was provided as input, `query_text` is not set. + #[serde(rename="queryText")] + pub query_text: Option, + /// The collection of output contexts. If applicable, + /// `output_contexts.parameters` contains entries with name + /// `.original` containing the original parameter values + /// before the query. + #[serde(rename="outputContexts")] + pub output_contexts: Option>, + /// If the query was fulfilled by a webhook call, this field is set to the + /// value of the `source` field returned in the webhook response. + #[serde(rename="webhookSource")] + pub webhook_source: Option, + /// If the query was fulfilled by a webhook call, this field is set to the + /// value of the `payload` field returned in the webhook response. + #[serde(rename="webhookPayload")] + pub webhook_payload: Option>, } -impl Part for GoogleCloudDialogflowV2IntentMessageListSelect {} +impl Part for GoogleCloudDialogflowV2QueryResult {} /// The basic card message. Useful for displaying information. @@ -1693,22 +1860,38 @@ pub struct GoogleCloudDialogflowV2IntentMessageBasicCard { impl Part for GoogleCloudDialogflowV2IntentMessageBasicCard {} -/// Represents an example or template that the agent is trained on. +/// Represents an example that the agent is trained on. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudDialogflowV2IntentTrainingPhrase { - /// Required. The collection of training phrase parts (can be annotated). - /// Fields: `entity_type`, `alias` and `user_defined` should be populated - /// only for the annotated parts of the training phrase. + /// Required. The ordered list of training phrase parts. + /// The parts are concatenated in order to form the training phrase. + /// + /// Note: The API does not automatically annotate training phrases like the + /// Dialogflow Console does. + /// + /// Note: Do not forget to include whitespace at part boundaries, + /// so the training phrase is well formatted when the parts are concatenated. + /// + /// If the training phrase does not need to be annotated with parameters, + /// you just need a single part with only the Part.text field set. + /// + /// If you want to annotate the training phrase, you must create multiple + /// parts, where the fields of each part are populated in one of two ways: + /// + /// - `Part.text` is set to a part of the phrase that has no parameters. + /// - `Part.text` is set to a part of the phrase that you want to annotate, + /// and the `entity_type`, `alias`, and `user_defined` fields are all + /// set. pub parts: Option>, /// Required. The type of the training phrase. #[serde(rename="type")] pub type_: Option, /// Output only. The unique identifier of this training phrase. pub name: Option, - /// Optional. Indicates how many times this example or template was added to + /// Optional. Indicates how many times this example was added to /// the intent. Each time a developer adds an existing sample by editing an /// intent or training, this counter is increased. #[serde(rename="timesAddedCount")] @@ -1795,6 +1978,10 @@ pub struct GoogleCloudDialogflowV2QueryParameters { /// Optional. The collection of contexts to be activated before this query is /// executed. pub contexts: Option>, + /// Optional. Configures the type of sentiment analysis to perform. If not + /// provided, sentiment analysis is not performed. + #[serde(rename="sentimentAnalysisRequestConfig")] + pub sentiment_analysis_request_config: Option, /// Optional. The time zone of this conversational query from the /// [time zone database](https://www.iana.org/time-zones), e.g., /// America/New_York, Europe/Paris. If not provided, the time zone specified in @@ -1840,6 +2027,19 @@ pub struct GoogleCloudDialogflowV2IntentMessageSimpleResponse { impl Part for GoogleCloudDialogflowV2IntentMessageSimpleResponse {} +/// The collection of suggestions. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2IntentMessageSuggestions { + /// Required. The list of suggested replies. + pub suggestions: Option>, +} + +impl Part for GoogleCloudDialogflowV2IntentMessageSuggestions {} + + /// Opens the given URI. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1864,10 +2064,10 @@ impl Part for GoogleCloudDialogflowV2IntentMessageBasicCardButtonOpenUriAction { /// * [agent restore projects](struct.ProjectAgentRestoreCall.html) (response) /// * [agent intents batch delete projects](struct.ProjectAgentIntentBatchDeleteCall.html) (response) /// * [agent entity types batch delete projects](struct.ProjectAgentEntityTypeBatchDeleteCall.html) (response) -/// * [agent train projects](struct.ProjectAgentTrainCall.html) (response) +/// * [agent import projects](struct.ProjectAgentImportCall.html) (response) /// * [agent export projects](struct.ProjectAgentExportCall.html) (response) /// * [agent entity types batch update projects](struct.ProjectAgentEntityTypeBatchUpdateCall.html) (response) -/// * [agent import projects](struct.ProjectAgentImportCall.html) (response) +/// * [agent train projects](struct.ProjectAgentTrainCall.html) (response) /// * [agent intents batch update projects](struct.ProjectAgentIntentBatchUpdateCall.html) (response) /// * [agent entity types entities batch update projects](struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html) (response) /// * [agent entity types entities batch delete projects](struct.ProjectAgentEntityTypeEntityBatchDeleteCall.html) (response) @@ -1918,7 +2118,9 @@ impl ResponseResult for GoogleLongrunningOperation {} pub struct GoogleCloudDialogflowV2Agent { /// Optional. The URI of the agent's avatar. /// Avatars are used throughout the Dialogflow console and in the self-hosted - /// [Web Demo](https://dialogflow.com/docs/integrations/web-demo) integration. + /// [Web + /// Demo](https://cloud.google.com/dialogflow-enterprise/docs/integrations/web-demo) + /// integration. #[serde(rename="avatarUri")] pub avatar_uri: Option, /// Required. The name of this agent. @@ -1930,15 +2132,16 @@ pub struct GoogleCloudDialogflowV2Agent { /// Required. The project of this agent. /// Format: `projects/`. pub parent: Option, + /// Required. The default language of the agent as a language tag. See + /// [Language + /// Support](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// for a list of the currently supported language codes. This field cannot be + /// set by the `Update` method. + #[serde(rename="defaultLanguageCode")] + pub default_language_code: Option, /// Optional. Determines whether this agent should log conversation queries. #[serde(rename="enableLogging")] pub enable_logging: Option, - /// Required. The default language of the agent as a language tag. See - /// [Language Support](https://dialogflow.com/docs/reference/language) for a - /// list of the currently supported language codes. - /// This field cannot be set by the `Update` method. - #[serde(rename="defaultLanguageCode")] - pub default_language_code: Option, /// Optional. Determines how intents are detected from user queries. #[serde(rename="matchMode")] pub match_mode: Option, @@ -1954,7 +2157,7 @@ pub struct GoogleCloudDialogflowV2Agent { /// Optional. To filter out false positive results and still get variety in /// matched natural language inputs for your agent, you can tune the machine /// learning classification threshold. If the returned score value is less than - /// the threshold value, then a fallback intent is be triggered or, if there + /// the threshold value, then a fallback intent will be triggered or, if there /// are no fallback intents defined, no intent will be triggered. The score /// values range from 0.0 (completely uncertain) to 1.0 (completely certain). /// If set to 0.0, the default of 0.3 is used. @@ -1965,17 +2168,18 @@ pub struct GoogleCloudDialogflowV2Agent { impl ResponseResult for GoogleCloudDialogflowV2Agent {} -/// The collection of suggestions. +/// This message is a wrapper around a collection of entity types. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2IntentMessageSuggestions { - /// Required. The list of suggested replies. - pub suggestions: Option>, +pub struct GoogleCloudDialogflowV2EntityTypeBatch { + /// A collection of entity types. + #[serde(rename="entityTypes")] + pub entity_types: Option>, } -impl Part for GoogleCloudDialogflowV2IntentMessageSuggestions {} +impl Part for GoogleCloudDialogflowV2EntityTypeBatch {} /// An item in the list. @@ -2119,8 +2323,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// Updates/Creates multiple entity types in the specified agent. /// - /// Operation + /// Operation /// /// # Arguments /// @@ -2142,8 +2345,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// Trains the specified agent. /// - /// Operation + /// Operation /// /// # Arguments /// @@ -2212,8 +2414,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Replaces the current agent version with a new one. All the intents and /// entity types in the older version are deleted. /// - /// Operation + /// Operation /// /// # Arguments /// @@ -2261,8 +2462,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// Deletes entity types in the specified agent. /// - /// Operation + /// Operation /// /// # Arguments /// @@ -2288,8 +2488,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Intents and entity types with the same name are replaced with the new /// versions from ImportAgentRequest. /// - /// Operation + /// Operation /// /// # Arguments /// @@ -2335,8 +2534,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// method does not affect entities in the entity type that aren't explicitly /// specified in the request. /// - /// Operation + /// Operation /// /// # Arguments /// @@ -2489,10 +2687,10 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `name` - Required for all methods except `create` (`create` populates the name - /// automatically. - /// The unique identifier of the entity type. Format: - /// `projects//agent/entityTypes/`. + /// * `name` - The unique identifier of the entity type. + /// Required for EntityTypes.UpdateEntityType and + /// EntityTypes.BatchUpdateEntityTypes methods. + /// Format: `projects//agent/entityTypes/`. pub fn agent_entity_types_patch(&self, request: GoogleCloudDialogflowV2EntityType, name: &str) -> ProjectAgentEntityTypePatchCall<'a, C, A> { ProjectAgentEntityTypePatchCall { hub: self.hub, @@ -2587,8 +2785,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// Deletes entities in the specified entity type. /// - /// Operation + /// Operation /// /// # Arguments /// @@ -2615,6 +2812,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `request` - No description provided. /// * `name` - Required. The unique identifier of the context. Format: /// `projects//agent/sessions//contexts/`. + /// The `Context ID` is always converted to lowercase, may only contain + /// characters in [a-zA-Z0-9_-%] and may be at most 250 bytes long. pub fn agent_sessions_contexts_patch(&self, request: GoogleCloudDialogflowV2Context, name: &str) -> ProjectAgentSessionContextPatchCall<'a, C, A> { ProjectAgentSessionContextPatchCall { hub: self.hub, @@ -2724,8 +2923,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// Exports the specified agent to a ZIP file. /// - /// Operation + /// Operation /// /// # Arguments /// @@ -2750,9 +2948,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `name` - Required for all methods except `create` (`create` populates the name - /// automatically. - /// The unique identifier of this intent. + /// * `name` - The unique identifier of this intent. + /// Required for Intents.UpdateIntent and Intents.BatchUpdateIntents + /// methods. /// Format: `projects//agent/intents/`. pub fn agent_intents_patch(&self, request: GoogleCloudDialogflowV2Intent, name: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { ProjectAgentIntentPatchCall { @@ -2949,7 +3147,7 @@ impl<'a, C, A> ProjectAgentSessionDeleteContextCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2965,10 +3163,7 @@ impl<'a, C, A> ProjectAgentSessionDeleteContextCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2988,7 +3183,7 @@ impl<'a, C, A> ProjectAgentSessionDeleteContextCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3067,7 +3262,7 @@ impl<'a, C, A> ProjectAgentSessionDeleteContextCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3075,12 +3270,12 @@ impl<'a, C, A> ProjectAgentSessionDeleteContextCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionDeleteContextCall<'a, C, A> @@ -3213,7 +3408,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3229,10 +3424,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3264,7 +3456,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3366,7 +3558,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3374,12 +3566,12 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> @@ -3416,8 +3608,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM /// Updates/Creates multiple entity types in the specified agent. /// -/// Operation +/// Operation /// /// A builder for the *agent.entityTypes.batchUpdate* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3510,7 +3701,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3526,10 +3717,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3561,7 +3749,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3652,7 +3840,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3660,12 +3848,12 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> @@ -3702,8 +3890,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu /// Trains the specified agent. /// -/// Operation +/// Operation /// /// A builder for the *agent.train* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3796,7 +3983,7 @@ impl<'a, C, A> ProjectAgentTrainCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3812,10 +3999,7 @@ impl<'a, C, A> ProjectAgentTrainCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3847,7 +4031,7 @@ impl<'a, C, A> ProjectAgentTrainCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3938,7 +4122,7 @@ impl<'a, C, A> ProjectAgentTrainCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3946,12 +4130,12 @@ impl<'a, C, A> ProjectAgentTrainCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentTrainCall<'a, C, A> @@ -4081,7 +4265,7 @@ impl<'a, C, A> ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4132,7 +4313,7 @@ impl<'a, C, A> ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentIntentBatchUpdateCall<'a, C, A> @@ -4366,7 +4547,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4382,10 +4563,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4417,7 +4595,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4508,7 +4686,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4516,12 +4694,12 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> @@ -4561,8 +4739,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo /// Replaces the current agent version with a new one. All the intents and /// entity types in the older version are deleted. /// -/// Operation +/// Operation /// /// A builder for the *agent.restore* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -4655,7 +4832,7 @@ impl<'a, C, A> ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4706,7 +4880,7 @@ impl<'a, C, A> ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentRestoreCall<'a, C, A> @@ -4941,7 +5115,7 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4957,10 +5131,7 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4992,7 +5163,7 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5086,7 +5257,7 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5094,12 +5265,12 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionDetectIntentCall<'a, C, A> @@ -5136,8 +5307,7 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< /// Deletes entity types in the specified agent. /// -/// Operation +/// Operation /// /// A builder for the *agent.entityTypes.batchDelete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -5230,7 +5400,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5246,10 +5416,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5281,7 +5448,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5372,7 +5539,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5380,12 +5547,12 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> @@ -5426,8 +5593,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> where C: BorrowMu /// Intents and entity types with the same name are replaced with the new /// versions from ImportAgentRequest. /// -/// Operation +/// Operation /// /// A builder for the *agent.import* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -5520,7 +5686,7 @@ impl<'a, C, A> ProjectAgentImportCall<'a, C, A> where C: BorrowMut ProjectAgentImportCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5571,7 +5734,7 @@ impl<'a, C, A> ProjectAgentImportCall<'a, C, A> where C: BorrowMut ProjectAgentImportCall<'a, C, A> where C: BorrowMut ProjectAgentImportCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentImportCall<'a, C, A> @@ -5816,7 +5979,7 @@ impl<'a, C, A> ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5855,7 +6015,7 @@ impl<'a, C, A> ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut ProjectAgentIntentListCall<'a, C, A> { @@ -5967,7 +6128,7 @@ impl<'a, C, A> ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentIntentListCall<'a, C, A> @@ -6019,8 +6180,7 @@ impl<'a, C, A> ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut +/// Operation /// /// A builder for the *agent.entityTypes.entities.batchUpdate* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -6113,7 +6273,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6129,10 +6289,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6164,7 +6321,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6255,7 +6412,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6263,12 +6420,12 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> where C: Bo /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> @@ -6399,7 +6556,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6415,10 +6572,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6450,7 +6604,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6541,7 +6695,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6549,12 +6703,12 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> @@ -6684,7 +6838,7 @@ impl<'a, C, A> ProjectAgentSessionContextCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6700,10 +6854,7 @@ impl<'a, C, A> ProjectAgentSessionContextCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6735,7 +6886,7 @@ impl<'a, C, A> ProjectAgentSessionContextCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6826,7 +6977,7 @@ impl<'a, C, A> ProjectAgentSessionContextCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6834,12 +6985,12 @@ impl<'a, C, A> ProjectAgentSessionContextCreateCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextCreateCall<'a, C, A> @@ -6970,7 +7121,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeListCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6986,10 +7137,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeListCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7009,7 +7157,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeListCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7103,7 +7251,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeListCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7111,12 +7259,12 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeListCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> @@ -7247,7 +7395,7 @@ impl<'a, C, A> ProjectAgentSessionContextListCall<'a, C, A> where C: BorrowMut ProjectAgentSessionContextListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7286,7 +7431,7 @@ impl<'a, C, A> ProjectAgentSessionContextListCall<'a, C, A> where C: BorrowMut ProjectAgentSessionContextListCall<'a, C, A> where C: BorrowMut ProjectAgentSessionContextListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentSessionContextListCall<'a, C, A> @@ -7529,7 +7674,7 @@ impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7568,7 +7710,7 @@ impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeListCall<'a, C, A> { @@ -7673,7 +7816,7 @@ impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentEntityTypeListCall<'a, C, A> @@ -7816,7 +7959,7 @@ impl<'a, C, A> ProjectAgentIntentBatchDeleteCall<'a, C, A> where C: BorrowMut ProjectAgentIntentBatchDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7867,7 +8007,7 @@ impl<'a, C, A> ProjectAgentIntentBatchDeleteCall<'a, C, A> where C: BorrowMut ProjectAgentIntentBatchDeleteCall<'a, C, A> where C: BorrowMut ProjectAgentIntentBatchDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> @@ -8109,7 +8249,7 @@ impl<'a, C, A> ProjectAgentEntityTypePatchCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8160,7 +8297,7 @@ impl<'a, C, A> ProjectAgentEntityTypePatchCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypePatchCall<'a, C, A> where C: BorrowMut/agent/entityTypes/`. + /// The unique identifier of the entity type. + /// Required for EntityTypes.UpdateEntityType and + /// EntityTypes.BatchUpdateEntityTypes methods. + /// Format: `projects//agent/entityTypes/`. /// /// Sets the *name* path property to the given value. /// @@ -8247,9 +8384,10 @@ impl<'a, C, A> ProjectAgentEntityTypePatchCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypePatchCall<'a, C, A> { @@ -8271,7 +8409,7 @@ impl<'a, C, A> ProjectAgentEntityTypePatchCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypePatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentEntityTypePatchCall<'a, C, A> @@ -8405,7 +8543,7 @@ impl<'a, C, A> ProjectAgentEntityTypeDeleteCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8444,7 +8579,7 @@ impl<'a, C, A> ProjectAgentEntityTypeDeleteCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeDeleteCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> @@ -8657,7 +8792,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8673,10 +8808,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8696,7 +8828,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8776,7 +8908,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8784,12 +8916,12 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypeGetCall<'a, C, A> @@ -8922,7 +9054,7 @@ impl<'a, C, A> ProjectAgentEntityTypeCreateCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8973,7 +9102,7 @@ impl<'a, C, A> ProjectAgentEntityTypeCreateCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeCreateCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeCreateCall<'a, C, A> { @@ -9075,7 +9205,7 @@ impl<'a, C, A> ProjectAgentEntityTypeCreateCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentEntityTypeCreateCall<'a, C, A> @@ -9214,7 +9344,7 @@ impl<'a, C, A> ProjectAgentEntityTypeGetCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9253,7 +9380,7 @@ impl<'a, C, A> ProjectAgentEntityTypeGetCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeGetCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeGetCall<'a, C, A> { @@ -9343,7 +9471,7 @@ impl<'a, C, A> ProjectAgentEntityTypeGetCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentEntityTypeGetCall<'a, C, A> @@ -9393,8 +9521,7 @@ impl<'a, C, A> ProjectAgentEntityTypeGetCall<'a, C, A> where C: BorrowMut +/// Operation /// /// A builder for the *agent.entityTypes.entities.batchDelete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -9487,7 +9614,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9503,10 +9630,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9538,7 +9662,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9629,7 +9753,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9637,12 +9761,12 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> where C: Bo /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> @@ -9775,7 +9899,7 @@ impl<'a, C, A> ProjectAgentSessionContextPatchCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9791,10 +9915,7 @@ impl<'a, C, A> ProjectAgentSessionContextPatchCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9826,7 +9947,7 @@ impl<'a, C, A> ProjectAgentSessionContextPatchCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9893,6 +10014,9 @@ impl<'a, C, A> ProjectAgentSessionContextPatchCall<'a, C, A> where C: BorrowMut< } /// Required. The unique identifier of the context. Format: /// `projects//agent/sessions//contexts/`. + /// + /// The `Context ID` is always converted to lowercase, may only contain + /// characters in [a-zA-Z0-9_-%] and may be at most 250 bytes long. /// /// Sets the *name* path property to the given value. /// @@ -9924,7 +10048,7 @@ impl<'a, C, A> ProjectAgentSessionContextPatchCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9932,12 +10056,12 @@ impl<'a, C, A> ProjectAgentSessionContextPatchCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextPatchCall<'a, C, A> @@ -10058,7 +10182,7 @@ impl<'a, C, A> ProjectAgentSessionContextGetCall<'a, C, A> where C: BorrowMut ProjectAgentSessionContextGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10097,7 +10218,7 @@ impl<'a, C, A> ProjectAgentSessionContextGetCall<'a, C, A> where C: BorrowMut ProjectAgentSessionContextGetCall<'a, C, A> where C: BorrowMut ProjectAgentSessionContextGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentSessionContextGetCall<'a, C, A> @@ -10312,7 +10433,7 @@ impl<'a, C, A> ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10351,7 +10469,7 @@ impl<'a, C, A> ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectOperationGetCall<'a, C, A> @@ -10573,7 +10691,7 @@ impl<'a, C, A> ProjectAgentIntentGetCall<'a, C, A> where C: BorrowMut ProjectAgentIntentGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10612,7 +10727,7 @@ impl<'a, C, A> ProjectAgentIntentGetCall<'a, C, A> where C: BorrowMut ProjectAgentIntentGetCall<'a, C, A> where C: BorrowMut ProjectAgentIntentGetCall<'a, C, A> { @@ -10709,7 +10825,7 @@ impl<'a, C, A> ProjectAgentIntentGetCall<'a, C, A> where C: BorrowMut ProjectAgentIntentGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentIntentGetCall<'a, C, A> @@ -10843,7 +10959,7 @@ impl<'a, C, A> ProjectGetAgentCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10859,10 +10975,7 @@ impl<'a, C, A> ProjectGetAgentCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10882,7 +10995,7 @@ impl<'a, C, A> ProjectGetAgentCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10961,7 +11074,7 @@ impl<'a, C, A> ProjectGetAgentCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10969,12 +11082,12 @@ impl<'a, C, A> ProjectGetAgentCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectGetAgentCall<'a, C, A> @@ -11095,7 +11208,7 @@ impl<'a, C, A> ProjectAgentSessionContextDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11111,10 +11224,7 @@ impl<'a, C, A> ProjectAgentSessionContextDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11134,7 +11244,7 @@ impl<'a, C, A> ProjectAgentSessionContextDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11213,7 +11323,7 @@ impl<'a, C, A> ProjectAgentSessionContextDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11221,12 +11331,12 @@ impl<'a, C, A> ProjectAgentSessionContextDeleteCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextDeleteCall<'a, C, A> @@ -11263,8 +11373,7 @@ impl<'a, C, A> ProjectAgentSessionContextDeleteCall<'a, C, A> where C: BorrowMut /// Exports the specified agent to a ZIP file. /// -/// Operation +/// Operation /// /// A builder for the *agent.export* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -11357,7 +11466,7 @@ impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut ProjectAgentExportCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11408,7 +11514,7 @@ impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut ProjectAgentExportCall<'a, C, A> where C: BorrowMut ProjectAgentExportCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentExportCall<'a, C, A> @@ -11655,7 +11761,7 @@ impl<'a, C, A> ProjectAgentIntentPatchCall<'a, C, A> where C: BorrowMut ProjectAgentIntentPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11706,7 +11809,7 @@ impl<'a, C, A> ProjectAgentIntentPatchCall<'a, C, A> where C: BorrowMut ProjectAgentIntentPatchCall<'a, C, A> where C: BorrowMut/agent/intents/`. /// /// Sets the *name* path property to the given value. @@ -11793,9 +11896,10 @@ impl<'a, C, A> ProjectAgentIntentPatchCall<'a, C, A> where C: BorrowMut ProjectAgentIntentPatchCall<'a, C, A> { @@ -11824,7 +11928,7 @@ impl<'a, C, A> ProjectAgentIntentPatchCall<'a, C, A> where C: BorrowMut ProjectAgentIntentPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentIntentPatchCall<'a, C, A> @@ -11958,7 +12062,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11974,10 +12078,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11997,7 +12098,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12077,7 +12178,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12085,12 +12186,12 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> @@ -12227,7 +12328,7 @@ impl<'a, C, A> ProjectAgentSearchCall<'a, C, A> where C: BorrowMut ProjectAgentSearchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12266,7 +12364,7 @@ impl<'a, C, A> ProjectAgentSearchCall<'a, C, A> where C: BorrowMut ProjectAgentSearchCall<'a, C, A> where C: BorrowMut ProjectAgentSearchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentSearchCall<'a, C, A> @@ -12494,7 +12592,7 @@ impl<'a, C, A> ProjectAgentIntentDeleteCall<'a, C, A> where C: BorrowMut ProjectAgentIntentDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12533,7 +12628,7 @@ impl<'a, C, A> ProjectAgentIntentDeleteCall<'a, C, A> where C: BorrowMut ProjectAgentIntentDeleteCall<'a, C, A> where C: BorrowMut/agent/intents/`. /// /// Sets the *name* path property to the given value. @@ -12614,7 +12708,7 @@ impl<'a, C, A> ProjectAgentIntentDeleteCall<'a, C, A> where C: BorrowMut ProjectAgentIntentDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentIntentDeleteCall<'a, C, A> @@ -12765,7 +12859,7 @@ impl<'a, C, A> ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12816,7 +12907,7 @@ impl<'a, C, A> ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentCreateCall<'a, C, A> { @@ -12925,7 +13017,7 @@ impl<'a, C, A> ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentIntentCreateCall<'a, C, A> diff --git a/gen/dialogflow2_beta1-cli/Cargo.toml b/gen/dialogflow2_beta1-cli/Cargo.toml index eb0e12debd..a4305f7ec9 100644 --- a/gen/dialogflow2_beta1-cli/Cargo.toml +++ b/gen/dialogflow2_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dialogflow2_beta1-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with Dialogflow (protocol v2beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dialogflow2_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-dialogflow2_beta1] path = "../dialogflow2_beta1" -version = "1.0.8+20181009" +version = "1.0.8+20190402" diff --git a/gen/dialogflow2_beta1-cli/README.md b/gen/dialogflow2_beta1-cli/README.md index 7a3c88cfb7..a22ac12819 100644 --- a/gen/dialogflow2_beta1-cli/README.md +++ b/gen/dialogflow2_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Dialogflow* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *Dialogflow* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash dialogflow2-beta1 [options] @@ -67,8 +67,11 @@ dialogflow2-beta1 [options] agent-knowledge-bases-documents-delete [-p ]... [-o ] agent-knowledge-bases-documents-get [-p ]... [-o ] agent-knowledge-bases-documents-list [-p ]... [-o ] + agent-knowledge-bases-documents-patch (-r )... [-p ]... [-o ] + agent-knowledge-bases-documents-reload (-r )... [-p ]... [-o ] agent-knowledge-bases-get [-p ]... [-o ] agent-knowledge-bases-list [-p ]... [-o ] + agent-knowledge-bases-patch (-r )... [-p ]... [-o ] agent-restore (-r )... [-p ]... [-o ] agent-search [-p ]... [-o ] agent-sessions-contexts-create (-r )... [-p ]... [-o ] @@ -84,54 +87,19 @@ dialogflow2-beta1 [options] agent-sessions-entity-types-list [-p ]... [-o ] agent-sessions-entity-types-patch (-r )... [-p ]... [-o ] agent-train (-r )... [-p ]... [-o ] - conversation-profiles-create (-r )... [-p ]... [-o ] - conversation-profiles-delete [-p ]... [-o ] - conversation-profiles-get [-p ]... [-o ] - conversation-profiles-list [-p ]... [-o ] - conversation-profiles-patch (-r )... [-p ]... [-o ] - conversations-add-conversation-phone-number (-r )... [-p ]... [-o ] - conversations-complete (-r )... [-p ]... [-o ] - conversations-create (-r )... [-p ]... [-o ] - conversations-get [-p ]... [-o ] - conversations-list [-p ]... [-o ] - conversations-messages-list [-p ]... [-o ] - conversations-participants-analyze-content (-r )... [-p ]... [-o ] - conversations-participants-create (-r )... [-p ]... [-o ] - conversations-participants-get [-p ]... [-o ] - conversations-participants-list [-p ]... [-o ] - conversations-participants-streaming-analyze-content (-r )... [-p ]... [-o ] - conversations-participants-suggestions-list [-p ]... [-o ] - environments-users-conversations-contexts-create (-r )... [-p ]... [-o ] - environments-users-conversations-contexts-delete [-p ]... [-o ] - environments-users-conversations-contexts-get [-p ]... [-o ] - environments-users-conversations-contexts-list [-p ]... [-o ] - environments-users-conversations-contexts-patch (-r )... [-p ]... [-o ] - environments-users-conversations-delete-contexts [-p ]... [-o ] get-agent [-p ]... [-o ] - human-agent-assistants-compile-suggestions (-r )... [-p ]... [-o ] - human-agent-assistants-create (-r )... [-p ]... [-o ] - human-agent-assistants-delete [-p ]... [-o ] - human-agent-assistants-get [-p ]... [-o ] - human-agent-assistants-list [-p ]... [-o ] - human-agent-assistants-patch (-r )... [-p ]... [-o ] knowledge-bases-create (-r )... [-p ]... [-o ] knowledge-bases-delete [-p ]... [-o ] knowledge-bases-documents-create (-r )... [-p ]... [-o ] knowledge-bases-documents-delete [-p ]... [-o ] knowledge-bases-documents-get [-p ]... [-o ] knowledge-bases-documents-list [-p ]... [-o ] + knowledge-bases-documents-patch (-r )... [-p ]... [-o ] + knowledge-bases-documents-reload (-r )... [-p ]... [-o ] knowledge-bases-get [-p ]... [-o ] knowledge-bases-list [-p ]... [-o ] + knowledge-bases-patch (-r )... [-p ]... [-o ] operations-get [-p ]... [-o ] - phone-number-orders-cancel (-r )... [-p ]... [-o ] - phone-number-orders-create (-r )... [-p ]... [-o ] - phone-number-orders-get [-p ]... [-o ] - phone-number-orders-list [-p ]... [-o ] - phone-number-orders-patch (-r )... [-p ]... [-o ] - phone-numbers-delete [-p ]... [-o ] - phone-numbers-list [-p ]... [-o ] - phone-numbers-patch (-r )... [-p ]... [-o ] - phone-numbers-undelete (-r )... [-p ]... [-o ] dialogflow2-beta1 --help Configuration: diff --git a/gen/dialogflow2_beta1-cli/mkdocs.yml b/gen/dialogflow2_beta1-cli/mkdocs.yml index 63d09ac804..901e0ceb7a 100644 --- a/gen/dialogflow2_beta1-cli/mkdocs.yml +++ b/gen/dialogflow2_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Dialogflow v1.0.8+20181009 +site_name: Dialogflow v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-dialogflow2_beta1-cli site_description: A complete library to interact with Dialogflow (protocol v2beta1) @@ -46,8 +46,11 @@ pages: - ['projects_agent-knowledge-bases-documents-delete.md', 'Projects', 'Agent Knowledge Bases Documents Delete'] - ['projects_agent-knowledge-bases-documents-get.md', 'Projects', 'Agent Knowledge Bases Documents Get'] - ['projects_agent-knowledge-bases-documents-list.md', 'Projects', 'Agent Knowledge Bases Documents List'] +- ['projects_agent-knowledge-bases-documents-patch.md', 'Projects', 'Agent Knowledge Bases Documents Patch'] +- ['projects_agent-knowledge-bases-documents-reload.md', 'Projects', 'Agent Knowledge Bases Documents Reload'] - ['projects_agent-knowledge-bases-get.md', 'Projects', 'Agent Knowledge Bases Get'] - ['projects_agent-knowledge-bases-list.md', 'Projects', 'Agent Knowledge Bases List'] +- ['projects_agent-knowledge-bases-patch.md', 'Projects', 'Agent Knowledge Bases Patch'] - ['projects_agent-restore.md', 'Projects', 'Agent Restore'] - ['projects_agent-search.md', 'Projects', 'Agent Search'] - ['projects_agent-sessions-contexts-create.md', 'Projects', 'Agent Sessions Contexts Create'] @@ -63,54 +66,19 @@ pages: - ['projects_agent-sessions-entity-types-list.md', 'Projects', 'Agent Sessions Entity Types List'] - ['projects_agent-sessions-entity-types-patch.md', 'Projects', 'Agent Sessions Entity Types Patch'] - ['projects_agent-train.md', 'Projects', 'Agent Train'] -- ['projects_conversation-profiles-create.md', 'Projects', 'Conversation Profiles Create'] -- ['projects_conversation-profiles-delete.md', 'Projects', 'Conversation Profiles Delete'] -- ['projects_conversation-profiles-get.md', 'Projects', 'Conversation Profiles Get'] -- ['projects_conversation-profiles-list.md', 'Projects', 'Conversation Profiles List'] -- ['projects_conversation-profiles-patch.md', 'Projects', 'Conversation Profiles Patch'] -- ['projects_conversations-add-conversation-phone-number.md', 'Projects', 'Conversations Add Conversation Phone Number'] -- ['projects_conversations-complete.md', 'Projects', 'Conversations Complete'] -- ['projects_conversations-create.md', 'Projects', 'Conversations Create'] -- ['projects_conversations-get.md', 'Projects', 'Conversations Get'] -- ['projects_conversations-list.md', 'Projects', 'Conversations List'] -- ['projects_conversations-messages-list.md', 'Projects', 'Conversations Messages List'] -- ['projects_conversations-participants-analyze-content.md', 'Projects', 'Conversations Participants Analyze Content'] -- ['projects_conversations-participants-create.md', 'Projects', 'Conversations Participants Create'] -- ['projects_conversations-participants-get.md', 'Projects', 'Conversations Participants Get'] -- ['projects_conversations-participants-list.md', 'Projects', 'Conversations Participants List'] -- ['projects_conversations-participants-streaming-analyze-content.md', 'Projects', 'Conversations Participants Streaming Analyze Content'] -- ['projects_conversations-participants-suggestions-list.md', 'Projects', 'Conversations Participants Suggestions List'] -- ['projects_environments-users-conversations-contexts-create.md', 'Projects', 'Environments Users Conversations Contexts Create'] -- ['projects_environments-users-conversations-contexts-delete.md', 'Projects', 'Environments Users Conversations Contexts Delete'] -- ['projects_environments-users-conversations-contexts-get.md', 'Projects', 'Environments Users Conversations Contexts Get'] -- ['projects_environments-users-conversations-contexts-list.md', 'Projects', 'Environments Users Conversations Contexts List'] -- ['projects_environments-users-conversations-contexts-patch.md', 'Projects', 'Environments Users Conversations Contexts Patch'] -- ['projects_environments-users-conversations-delete-contexts.md', 'Projects', 'Environments Users Conversations Delete Contexts'] - ['projects_get-agent.md', 'Projects', 'Get Agent'] -- ['projects_human-agent-assistants-compile-suggestions.md', 'Projects', 'Human Agent Assistants Compile Suggestions'] -- ['projects_human-agent-assistants-create.md', 'Projects', 'Human Agent Assistants Create'] -- ['projects_human-agent-assistants-delete.md', 'Projects', 'Human Agent Assistants Delete'] -- ['projects_human-agent-assistants-get.md', 'Projects', 'Human Agent Assistants Get'] -- ['projects_human-agent-assistants-list.md', 'Projects', 'Human Agent Assistants List'] -- ['projects_human-agent-assistants-patch.md', 'Projects', 'Human Agent Assistants Patch'] - ['projects_knowledge-bases-create.md', 'Projects', 'Knowledge Bases Create'] - ['projects_knowledge-bases-delete.md', 'Projects', 'Knowledge Bases Delete'] - ['projects_knowledge-bases-documents-create.md', 'Projects', 'Knowledge Bases Documents Create'] - ['projects_knowledge-bases-documents-delete.md', 'Projects', 'Knowledge Bases Documents Delete'] - ['projects_knowledge-bases-documents-get.md', 'Projects', 'Knowledge Bases Documents Get'] - ['projects_knowledge-bases-documents-list.md', 'Projects', 'Knowledge Bases Documents List'] +- ['projects_knowledge-bases-documents-patch.md', 'Projects', 'Knowledge Bases Documents Patch'] +- ['projects_knowledge-bases-documents-reload.md', 'Projects', 'Knowledge Bases Documents Reload'] - ['projects_knowledge-bases-get.md', 'Projects', 'Knowledge Bases Get'] - ['projects_knowledge-bases-list.md', 'Projects', 'Knowledge Bases List'] +- ['projects_knowledge-bases-patch.md', 'Projects', 'Knowledge Bases Patch'] - ['projects_operations-get.md', 'Projects', 'Operations Get'] -- ['projects_phone-number-orders-cancel.md', 'Projects', 'Phone Number Orders Cancel'] -- ['projects_phone-number-orders-create.md', 'Projects', 'Phone Number Orders Create'] -- ['projects_phone-number-orders-get.md', 'Projects', 'Phone Number Orders Get'] -- ['projects_phone-number-orders-list.md', 'Projects', 'Phone Number Orders List'] -- ['projects_phone-number-orders-patch.md', 'Projects', 'Phone Number Orders Patch'] -- ['projects_phone-numbers-delete.md', 'Projects', 'Phone Numbers Delete'] -- ['projects_phone-numbers-list.md', 'Projects', 'Phone Numbers List'] -- ['projects_phone-numbers-patch.md', 'Projects', 'Phone Numbers Patch'] -- ['projects_phone-numbers-undelete.md', 'Projects', 'Phone Numbers Undelete'] theme: readthedocs diff --git a/gen/dialogflow2_beta1-cli/src/main.rs b/gen/dialogflow2_beta1-cli/src/main.rs index 4bb016d43c..b191d08da9 100644 --- a/gen/dialogflow2_beta1-cli/src/main.rs +++ b/gen/dialogflow2_beta1-cli/src/main.rs @@ -155,8 +155,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "language-code" => Some(("languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entity-type-batch-uri" => Some(("entityTypeBatchUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["entity-type-batch-uri", "language-code", "update-mask"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1246,6 +1246,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "input-audio" => Some(("inputAudio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "output-audio-config.sample-rate-hertz" => Some(("outputAudioConfig.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "output-audio-config.audio-encoding" => Some(("outputAudioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "output-audio-config.synthesize-speech-config.effects-profile-id" => Some(("outputAudioConfig.synthesizeSpeechConfig.effectsProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1254,7 +1255,6 @@ impl<'n> Engine<'n> { "output-audio-config.synthesize-speech-config.speaking-rate" => Some(("outputAudioConfig.synthesizeSpeechConfig.speakingRate", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "output-audio-config.synthesize-speech-config.volume-gain-db" => Some(("outputAudioConfig.synthesizeSpeechConfig.volumeGainDb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "output-audio-config.synthesize-speech-config.pitch" => Some(("outputAudioConfig.synthesizeSpeechConfig.pitch", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "input-audio" => Some(("inputAudio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.text.language-code" => Some(("queryInput.text.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.text.text" => Some(("queryInput.text.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.event.language-code" => Some(("queryInput.event.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1262,8 +1262,8 @@ impl<'n> Engine<'n> { "query-input.audio-config.phrase-hints" => Some(("queryInput.audioConfig.phraseHints", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "query-input.audio-config.language-code" => Some(("queryInput.audioConfig.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.audio-config.model" => Some(("queryInput.audioConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "query-input.audio-config.audio-encoding" => Some(("queryInput.audioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.audio-config.sample-rate-hertz" => Some(("queryInput.audioConfig.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "query-input.audio-config.audio-encoding" => Some(("queryInput.audioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-params.sentiment-analysis-request-config.analyze-query-text-sentiment" => Some(("queryParams.sentimentAnalysisRequestConfig.analyzeQueryTextSentiment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "query-params.geo-location.latitude" => Some(("queryParams.geoLocation.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "query-params.geo-location.longitude" => Some(("queryParams.geoLocation.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -2571,11 +2571,11 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-uri" => Some(("contentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "knowledge-types" => Some(("knowledgeTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "raw-content" => Some(("rawContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "content-uri" => Some(("contentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "content-uri", "display-name", "knowledge-types", "mime-type", "name", "raw-content"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -2800,6 +2800,185 @@ impl<'n> Engine<'n> { } } + fn _projects_agent_knowledge_bases_documents_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-uri" => Some(("contentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "knowledge-types" => Some(("knowledgeTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "raw-content" => Some(("rawContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "content-uri", "display-name", "knowledge-types", "mime-type", "name", "raw-content"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudDialogflowV2beta1Document = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().agent_knowledge_bases_documents_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_agent_knowledge_bases_documents_reload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudDialogflowV2beta1ReloadDocumentRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().agent_knowledge_bases_documents_reload(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_agent_knowledge_bases_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().agent_knowledge_bases_get(opt.value_of("name").unwrap_or("")); @@ -2911,6 +3090,96 @@ impl<'n> Engine<'n> { } } + fn _projects_agent_knowledge_bases_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-name", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudDialogflowV2beta1KnowledgeBase = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().agent_knowledge_bases_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_agent_restore(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -3470,6 +3739,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "input-audio" => Some(("inputAudio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "output-audio-config.sample-rate-hertz" => Some(("outputAudioConfig.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "output-audio-config.audio-encoding" => Some(("outputAudioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "output-audio-config.synthesize-speech-config.effects-profile-id" => Some(("outputAudioConfig.synthesizeSpeechConfig.effectsProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -3478,7 +3748,6 @@ impl<'n> Engine<'n> { "output-audio-config.synthesize-speech-config.speaking-rate" => Some(("outputAudioConfig.synthesizeSpeechConfig.speakingRate", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "output-audio-config.synthesize-speech-config.volume-gain-db" => Some(("outputAudioConfig.synthesizeSpeechConfig.volumeGainDb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "output-audio-config.synthesize-speech-config.pitch" => Some(("outputAudioConfig.synthesizeSpeechConfig.pitch", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "input-audio" => Some(("inputAudio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.text.language-code" => Some(("queryInput.text.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.text.text" => Some(("queryInput.text.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.event.language-code" => Some(("queryInput.event.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3486,8 +3755,8 @@ impl<'n> Engine<'n> { "query-input.audio-config.phrase-hints" => Some(("queryInput.audioConfig.phraseHints", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "query-input.audio-config.language-code" => Some(("queryInput.audioConfig.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.audio-config.model" => Some(("queryInput.audioConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "query-input.audio-config.audio-encoding" => Some(("queryInput.audioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-input.audio-config.sample-rate-hertz" => Some(("queryInput.audioConfig.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "query-input.audio-config.audio-encoding" => Some(("queryInput.audioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query-params.sentiment-analysis-request-config.analyze-query-text-sentiment" => Some(("queryParams.sentimentAnalysisRequestConfig.analyzeQueryTextSentiment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "query-params.geo-location.latitude" => Some(("queryParams.geoLocation.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "query-params.geo-location.longitude" => Some(("queryParams.geoLocation.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -3978,1631 +4247,6 @@ impl<'n> Engine<'n> { } } - fn _projects_conversation_profiles_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "human-agent-assistant-config.notification-config.topic" => Some(("humanAgentAssistantConfig.notificationConfig.topic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "human-agent-assistant-config.name" => Some(("humanAgentAssistantConfig.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "automated-agent-config.agent" => Some(("automatedAgentConfig.agent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "notification-config.topic" => Some(("notificationConfig.topic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["agent", "automated-agent-config", "display-name", "human-agent-assistant-config", "name", "notification-config", "topic"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1ConversationProfile = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().conversation_profiles_create(request, opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversation_profiles_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().conversation_profiles_delete(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversation_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().conversation_profiles_get(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversation_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().conversation_profiles_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversation_profiles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "human-agent-assistant-config.notification-config.topic" => Some(("humanAgentAssistantConfig.notificationConfig.topic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "human-agent-assistant-config.name" => Some(("humanAgentAssistantConfig.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "automated-agent-config.agent" => Some(("automatedAgentConfig.agent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "notification-config.topic" => Some(("notificationConfig.topic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["agent", "automated-agent-config", "display-name", "human-agent-assistant-config", "name", "notification-config", "topic"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1ConversationProfile = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().conversation_profiles_patch(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_add_conversation_phone_number(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1AddConversationPhoneNumberRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().conversations_add_conversation_phone_number(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_complete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1CompleteConversationRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().conversations_complete(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "conversation-profile" => Some(("conversationProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "phone-number.phone-number" => Some(("phoneNumber.phoneNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["conversation-profile", "end-time", "lifecycle-state", "name", "phone-number", "start-time"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1Conversation = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().conversations_create(request, opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().conversations_get(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().conversations_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - "filter" => { - call = call.filter(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_messages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().conversations_messages_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_participants_analyze_content(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "reply-audio-config.sample-rate-hertz" => Some(("replyAudioConfig.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "reply-audio-config.audio-encoding" => Some(("replyAudioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reply-audio-config.synthesize-speech-config.effects-profile-id" => Some(("replyAudioConfig.synthesizeSpeechConfig.effectsProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "reply-audio-config.synthesize-speech-config.voice.ssml-gender" => Some(("replyAudioConfig.synthesizeSpeechConfig.voice.ssmlGender", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reply-audio-config.synthesize-speech-config.voice.name" => Some(("replyAudioConfig.synthesizeSpeechConfig.voice.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reply-audio-config.synthesize-speech-config.speaking-rate" => Some(("replyAudioConfig.synthesizeSpeechConfig.speakingRate", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "reply-audio-config.synthesize-speech-config.volume-gain-db" => Some(("replyAudioConfig.synthesizeSpeechConfig.volumeGainDb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "reply-audio-config.synthesize-speech-config.pitch" => Some(("replyAudioConfig.synthesizeSpeechConfig.pitch", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "text.text" => Some(("text.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "text.language-code" => Some(("text.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "audio.audio" => Some(("audio.audio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "audio.config.phrase-hints" => Some(("audio.config.phraseHints", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "audio.config.language-code" => Some(("audio.config.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "audio.config.model" => Some(("audio.config.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "audio.config.audio-encoding" => Some(("audio.config.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "audio.config.sample-rate-hertz" => Some(("audio.config.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["audio", "audio-encoding", "config", "effects-profile-id", "language-code", "model", "name", "phrase-hints", "pitch", "reply-audio-config", "sample-rate-hertz", "speaking-rate", "ssml-gender", "synthesize-speech-config", "text", "voice", "volume-gain-db"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1AnalyzeContentRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().conversations_participants_analyze_content(request, opt.value_of("participant").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_participants_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "role" => Some(("role", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["name", "role"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1Participant = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().conversations_participants_create(request, opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_participants_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().conversations_participants_get(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_participants_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().conversations_participants_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_participants_streaming_analyze_content(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "input-text" => Some(("inputText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reply-audio-config.sample-rate-hertz" => Some(("replyAudioConfig.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "reply-audio-config.audio-encoding" => Some(("replyAudioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reply-audio-config.synthesize-speech-config.effects-profile-id" => Some(("replyAudioConfig.synthesizeSpeechConfig.effectsProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "reply-audio-config.synthesize-speech-config.voice.ssml-gender" => Some(("replyAudioConfig.synthesizeSpeechConfig.voice.ssmlGender", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reply-audio-config.synthesize-speech-config.voice.name" => Some(("replyAudioConfig.synthesizeSpeechConfig.voice.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reply-audio-config.synthesize-speech-config.speaking-rate" => Some(("replyAudioConfig.synthesizeSpeechConfig.speakingRate", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "reply-audio-config.synthesize-speech-config.volume-gain-db" => Some(("replyAudioConfig.synthesizeSpeechConfig.volumeGainDb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "reply-audio-config.synthesize-speech-config.pitch" => Some(("replyAudioConfig.synthesizeSpeechConfig.pitch", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "input-audio" => Some(("inputAudio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "text-config.language-code" => Some(("textConfig.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "audio-config.phrase-hints" => Some(("audioConfig.phraseHints", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "audio-config.language-code" => Some(("audioConfig.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "audio-config.model" => Some(("audioConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "audio-config.audio-encoding" => Some(("audioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "audio-config.sample-rate-hertz" => Some(("audioConfig.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["audio-config", "audio-encoding", "effects-profile-id", "input-audio", "input-text", "language-code", "model", "name", "phrase-hints", "pitch", "reply-audio-config", "sample-rate-hertz", "speaking-rate", "ssml-gender", "synthesize-speech-config", "text-config", "voice", "volume-gain-db"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1StreamingAnalyzeContentRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().conversations_participants_streaming_analyze_content(request, opt.value_of("participant").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_conversations_participants_suggestions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().conversations_participants_suggestions_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_environments_users_conversations_contexts_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifespan-count" => Some(("lifespanCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["lifespan-count", "name"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1Context = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().environments_users_conversations_contexts_create(request, opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_environments_users_conversations_contexts_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().environments_users_conversations_contexts_delete(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_environments_users_conversations_contexts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().environments_users_conversations_contexts_get(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_environments_users_conversations_contexts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().environments_users_conversations_contexts_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_environments_users_conversations_contexts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifespan-count" => Some(("lifespanCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["lifespan-count", "name"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1Context = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().environments_users_conversations_contexts_patch(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_environments_users_conversations_delete_contexts(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().environments_users_conversations_delete_contexts(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _projects_get_agent(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().get_agent(opt.value_of("parent").unwrap_or("")); @@ -5655,433 +4299,6 @@ impl<'n> Engine<'n> { } } - fn _projects_human_agent_assistants_compile_suggestions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1CompileSuggestionsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().human_agent_assistants_compile_suggestions(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_human_agent_assistants_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "faq-answers-config.max-results" => Some(("faqAnswersConfig.maxResults", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "faq-answers-config.knowledge-base-name" => Some(("faqAnswersConfig.knowledgeBaseName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "article-suggestion-config.knowledge-base-name" => Some(("articleSuggestionConfig.knowledgeBaseName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["article-suggestion-config", "faq-answers-config", "knowledge-base-name", "max-results", "name"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1HumanAgentAssistant = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().human_agent_assistants_create(request, opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_human_agent_assistants_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().human_agent_assistants_delete(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_human_agent_assistants_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().human_agent_assistants_get(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_human_agent_assistants_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().human_agent_assistants_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_human_agent_assistants_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "faq-answers-config.max-results" => Some(("faqAnswersConfig.maxResults", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "faq-answers-config.knowledge-base-name" => Some(("faqAnswersConfig.knowledgeBaseName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "article-suggestion-config.knowledge-base-name" => Some(("articleSuggestionConfig.knowledgeBaseName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["article-suggestion-config", "faq-answers-config", "knowledge-base-name", "max-results", "name"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1HumanAgentAssistant = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().human_agent_assistants_patch(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _projects_knowledge_bases_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -6249,11 +4466,11 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-uri" => Some(("contentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "knowledge-types" => Some(("knowledgeTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "raw-content" => Some(("rawContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "content-uri" => Some(("contentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "content-uri", "display-name", "knowledge-types", "mime-type", "name", "raw-content"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -6478,6 +4695,185 @@ impl<'n> Engine<'n> { } } + fn _projects_knowledge_bases_documents_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-uri" => Some(("contentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "knowledge-types" => Some(("knowledgeTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "raw-content" => Some(("rawContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "content-uri", "display-name", "knowledge-types", "mime-type", "name", "raw-content"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudDialogflowV2beta1Document = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().knowledge_bases_documents_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_knowledge_bases_documents_reload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudDialogflowV2beta1ReloadDocumentRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().knowledge_bases_documents_reload(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_knowledge_bases_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().knowledge_bases_get(opt.value_of("name").unwrap_or("")); @@ -6589,6 +4985,96 @@ impl<'n> Engine<'n> { } } + fn _projects_knowledge_bases_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-name", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleCloudDialogflowV2beta1KnowledgeBase = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().knowledge_bases_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().operations_get(opt.value_of("name").unwrap_or("")); @@ -6641,679 +5127,6 @@ impl<'n> Engine<'n> { } } - fn _projects_phone_number_orders_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1CancelPhoneNumberOrderRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().phone_number_orders_cancel(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_phone_number_orders_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "phone-number-spec.preferred-area-codes" => Some(("phoneNumberSpec.preferredAreaCodes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "phone-number-spec.count" => Some(("phoneNumberSpec.count", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "phone-numbers" => Some(("phoneNumbers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["count", "create-time", "description", "lifecycle-state", "name", "phone-number-spec", "phone-numbers", "preferred-area-codes", "update-time"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1PhoneNumberOrder = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().phone_number_orders_create(request, opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_phone_number_orders_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().phone_number_orders_get(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_phone_number_orders_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().phone_number_orders_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_phone_number_orders_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "phone-number-spec.preferred-area-codes" => Some(("phoneNumberSpec.preferredAreaCodes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "phone-number-spec.count" => Some(("phoneNumberSpec.count", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "phone-numbers" => Some(("phoneNumbers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["count", "create-time", "description", "lifecycle-state", "name", "phone-number-spec", "phone-numbers", "preferred-area-codes", "update-time"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1PhoneNumberOrder = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().phone_number_orders_patch(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_phone_numbers_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().phone_numbers_delete(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_phone_numbers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().phone_numbers_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "show-deleted" => { - call = call.show_deleted(arg_from_str(value.unwrap_or("false"), err, "show-deleted", "boolean")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["show-deleted", "page-size", "page-token"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_phone_numbers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "conversation-profile" => Some(("conversationProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "phone-number" => Some(("phoneNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "lifecycle-state" => Some(("lifecycleState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["conversation-profile", "lifecycle-state", "name", "phone-number"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1PhoneNumber = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().phone_numbers_patch(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_phone_numbers_undelete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GoogleCloudDialogflowV2beta1UndeletePhoneNumberRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().phone_numbers_undelete(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); @@ -7432,12 +5245,21 @@ impl<'n> Engine<'n> { ("agent-knowledge-bases-documents-list", Some(opt)) => { call_result = self._projects_agent_knowledge_bases_documents_list(opt, dry_run, &mut err); }, + ("agent-knowledge-bases-documents-patch", Some(opt)) => { + call_result = self._projects_agent_knowledge_bases_documents_patch(opt, dry_run, &mut err); + }, + ("agent-knowledge-bases-documents-reload", Some(opt)) => { + call_result = self._projects_agent_knowledge_bases_documents_reload(opt, dry_run, &mut err); + }, ("agent-knowledge-bases-get", Some(opt)) => { call_result = self._projects_agent_knowledge_bases_get(opt, dry_run, &mut err); }, ("agent-knowledge-bases-list", Some(opt)) => { call_result = self._projects_agent_knowledge_bases_list(opt, dry_run, &mut err); }, + ("agent-knowledge-bases-patch", Some(opt)) => { + call_result = self._projects_agent_knowledge_bases_patch(opt, dry_run, &mut err); + }, ("agent-restore", Some(opt)) => { call_result = self._projects_agent_restore(opt, dry_run, &mut err); }, @@ -7483,96 +5305,9 @@ impl<'n> Engine<'n> { ("agent-train", Some(opt)) => { call_result = self._projects_agent_train(opt, dry_run, &mut err); }, - ("conversation-profiles-create", Some(opt)) => { - call_result = self._projects_conversation_profiles_create(opt, dry_run, &mut err); - }, - ("conversation-profiles-delete", Some(opt)) => { - call_result = self._projects_conversation_profiles_delete(opt, dry_run, &mut err); - }, - ("conversation-profiles-get", Some(opt)) => { - call_result = self._projects_conversation_profiles_get(opt, dry_run, &mut err); - }, - ("conversation-profiles-list", Some(opt)) => { - call_result = self._projects_conversation_profiles_list(opt, dry_run, &mut err); - }, - ("conversation-profiles-patch", Some(opt)) => { - call_result = self._projects_conversation_profiles_patch(opt, dry_run, &mut err); - }, - ("conversations-add-conversation-phone-number", Some(opt)) => { - call_result = self._projects_conversations_add_conversation_phone_number(opt, dry_run, &mut err); - }, - ("conversations-complete", Some(opt)) => { - call_result = self._projects_conversations_complete(opt, dry_run, &mut err); - }, - ("conversations-create", Some(opt)) => { - call_result = self._projects_conversations_create(opt, dry_run, &mut err); - }, - ("conversations-get", Some(opt)) => { - call_result = self._projects_conversations_get(opt, dry_run, &mut err); - }, - ("conversations-list", Some(opt)) => { - call_result = self._projects_conversations_list(opt, dry_run, &mut err); - }, - ("conversations-messages-list", Some(opt)) => { - call_result = self._projects_conversations_messages_list(opt, dry_run, &mut err); - }, - ("conversations-participants-analyze-content", Some(opt)) => { - call_result = self._projects_conversations_participants_analyze_content(opt, dry_run, &mut err); - }, - ("conversations-participants-create", Some(opt)) => { - call_result = self._projects_conversations_participants_create(opt, dry_run, &mut err); - }, - ("conversations-participants-get", Some(opt)) => { - call_result = self._projects_conversations_participants_get(opt, dry_run, &mut err); - }, - ("conversations-participants-list", Some(opt)) => { - call_result = self._projects_conversations_participants_list(opt, dry_run, &mut err); - }, - ("conversations-participants-streaming-analyze-content", Some(opt)) => { - call_result = self._projects_conversations_participants_streaming_analyze_content(opt, dry_run, &mut err); - }, - ("conversations-participants-suggestions-list", Some(opt)) => { - call_result = self._projects_conversations_participants_suggestions_list(opt, dry_run, &mut err); - }, - ("environments-users-conversations-contexts-create", Some(opt)) => { - call_result = self._projects_environments_users_conversations_contexts_create(opt, dry_run, &mut err); - }, - ("environments-users-conversations-contexts-delete", Some(opt)) => { - call_result = self._projects_environments_users_conversations_contexts_delete(opt, dry_run, &mut err); - }, - ("environments-users-conversations-contexts-get", Some(opt)) => { - call_result = self._projects_environments_users_conversations_contexts_get(opt, dry_run, &mut err); - }, - ("environments-users-conversations-contexts-list", Some(opt)) => { - call_result = self._projects_environments_users_conversations_contexts_list(opt, dry_run, &mut err); - }, - ("environments-users-conversations-contexts-patch", Some(opt)) => { - call_result = self._projects_environments_users_conversations_contexts_patch(opt, dry_run, &mut err); - }, - ("environments-users-conversations-delete-contexts", Some(opt)) => { - call_result = self._projects_environments_users_conversations_delete_contexts(opt, dry_run, &mut err); - }, ("get-agent", Some(opt)) => { call_result = self._projects_get_agent(opt, dry_run, &mut err); }, - ("human-agent-assistants-compile-suggestions", Some(opt)) => { - call_result = self._projects_human_agent_assistants_compile_suggestions(opt, dry_run, &mut err); - }, - ("human-agent-assistants-create", Some(opt)) => { - call_result = self._projects_human_agent_assistants_create(opt, dry_run, &mut err); - }, - ("human-agent-assistants-delete", Some(opt)) => { - call_result = self._projects_human_agent_assistants_delete(opt, dry_run, &mut err); - }, - ("human-agent-assistants-get", Some(opt)) => { - call_result = self._projects_human_agent_assistants_get(opt, dry_run, &mut err); - }, - ("human-agent-assistants-list", Some(opt)) => { - call_result = self._projects_human_agent_assistants_list(opt, dry_run, &mut err); - }, - ("human-agent-assistants-patch", Some(opt)) => { - call_result = self._projects_human_agent_assistants_patch(opt, dry_run, &mut err); - }, ("knowledge-bases-create", Some(opt)) => { call_result = self._projects_knowledge_bases_create(opt, dry_run, &mut err); }, @@ -7591,42 +5326,24 @@ impl<'n> Engine<'n> { ("knowledge-bases-documents-list", Some(opt)) => { call_result = self._projects_knowledge_bases_documents_list(opt, dry_run, &mut err); }, + ("knowledge-bases-documents-patch", Some(opt)) => { + call_result = self._projects_knowledge_bases_documents_patch(opt, dry_run, &mut err); + }, + ("knowledge-bases-documents-reload", Some(opt)) => { + call_result = self._projects_knowledge_bases_documents_reload(opt, dry_run, &mut err); + }, ("knowledge-bases-get", Some(opt)) => { call_result = self._projects_knowledge_bases_get(opt, dry_run, &mut err); }, ("knowledge-bases-list", Some(opt)) => { call_result = self._projects_knowledge_bases_list(opt, dry_run, &mut err); }, + ("knowledge-bases-patch", Some(opt)) => { + call_result = self._projects_knowledge_bases_patch(opt, dry_run, &mut err); + }, ("operations-get", Some(opt)) => { call_result = self._projects_operations_get(opt, dry_run, &mut err); }, - ("phone-number-orders-cancel", Some(opt)) => { - call_result = self._projects_phone_number_orders_cancel(opt, dry_run, &mut err); - }, - ("phone-number-orders-create", Some(opt)) => { - call_result = self._projects_phone_number_orders_create(opt, dry_run, &mut err); - }, - ("phone-number-orders-get", Some(opt)) => { - call_result = self._projects_phone_number_orders_get(opt, dry_run, &mut err); - }, - ("phone-number-orders-list", Some(opt)) => { - call_result = self._projects_phone_number_orders_list(opt, dry_run, &mut err); - }, - ("phone-number-orders-patch", Some(opt)) => { - call_result = self._projects_phone_number_orders_patch(opt, dry_run, &mut err); - }, - ("phone-numbers-delete", Some(opt)) => { - call_result = self._projects_phone_numbers_delete(opt, dry_run, &mut err); - }, - ("phone-numbers-list", Some(opt)) => { - call_result = self._projects_phone_numbers_list(opt, dry_run, &mut err); - }, - ("phone-numbers-patch", Some(opt)) => { - call_result = self._projects_phone_numbers_patch(opt, dry_run, &mut err); - }, - ("phone-numbers-undelete", Some(opt)) => { - call_result = self._projects_phone_numbers_undelete(opt, dry_run, &mut err); - }, _ => { err.issues.push(CLIError::MissingMethodError("projects".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -7718,12 +5435,11 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'agent-entity-types-batch-delete', 'agent-entity-types-batch-update', 'agent-entity-types-create', 'agent-entity-types-delete', 'agent-entity-types-entities-batch-create', 'agent-entity-types-entities-batch-delete', 'agent-entity-types-entities-batch-update', 'agent-entity-types-get', 'agent-entity-types-list', 'agent-entity-types-patch', 'agent-environments-users-sessions-contexts-create', 'agent-environments-users-sessions-contexts-delete', 'agent-environments-users-sessions-contexts-get', 'agent-environments-users-sessions-contexts-list', 'agent-environments-users-sessions-contexts-patch', 'agent-environments-users-sessions-delete-contexts', 'agent-environments-users-sessions-detect-intent', 'agent-environments-users-sessions-entity-types-create', 'agent-environments-users-sessions-entity-types-delete', 'agent-environments-users-sessions-entity-types-get', 'agent-environments-users-sessions-entity-types-list', 'agent-environments-users-sessions-entity-types-patch', 'agent-export', 'agent-import', 'agent-intents-batch-delete', 'agent-intents-batch-update', 'agent-intents-create', 'agent-intents-delete', 'agent-intents-get', 'agent-intents-list', 'agent-intents-patch', 'agent-knowledge-bases-create', 'agent-knowledge-bases-delete', 'agent-knowledge-bases-documents-create', 'agent-knowledge-bases-documents-delete', 'agent-knowledge-bases-documents-get', 'agent-knowledge-bases-documents-list', 'agent-knowledge-bases-get', 'agent-knowledge-bases-list', 'agent-restore', 'agent-search', 'agent-sessions-contexts-create', 'agent-sessions-contexts-delete', 'agent-sessions-contexts-get', 'agent-sessions-contexts-list', 'agent-sessions-contexts-patch', 'agent-sessions-delete-contexts', 'agent-sessions-detect-intent', 'agent-sessions-entity-types-create', 'agent-sessions-entity-types-delete', 'agent-sessions-entity-types-get', 'agent-sessions-entity-types-list', 'agent-sessions-entity-types-patch', 'agent-train', 'conversation-profiles-create', 'conversation-profiles-delete', 'conversation-profiles-get', 'conversation-profiles-list', 'conversation-profiles-patch', 'conversations-add-conversation-phone-number', 'conversations-complete', 'conversations-create', 'conversations-get', 'conversations-list', 'conversations-messages-list', 'conversations-participants-analyze-content', 'conversations-participants-create', 'conversations-participants-get', 'conversations-participants-list', 'conversations-participants-streaming-analyze-content', 'conversations-participants-suggestions-list', 'environments-users-conversations-contexts-create', 'environments-users-conversations-contexts-delete', 'environments-users-conversations-contexts-get', 'environments-users-conversations-contexts-list', 'environments-users-conversations-contexts-patch', 'environments-users-conversations-delete-contexts', 'get-agent', 'human-agent-assistants-compile-suggestions', 'human-agent-assistants-create', 'human-agent-assistants-delete', 'human-agent-assistants-get', 'human-agent-assistants-list', 'human-agent-assistants-patch', 'knowledge-bases-create', 'knowledge-bases-delete', 'knowledge-bases-documents-create', 'knowledge-bases-documents-delete', 'knowledge-bases-documents-get', 'knowledge-bases-documents-list', 'knowledge-bases-get', 'knowledge-bases-list', 'operations-get', 'phone-number-orders-cancel', 'phone-number-orders-create', 'phone-number-orders-get', 'phone-number-orders-list', 'phone-number-orders-patch', 'phone-numbers-delete', 'phone-numbers-list', 'phone-numbers-patch' and 'phone-numbers-undelete'", vec![ + ("projects", "methods: 'agent-entity-types-batch-delete', 'agent-entity-types-batch-update', 'agent-entity-types-create', 'agent-entity-types-delete', 'agent-entity-types-entities-batch-create', 'agent-entity-types-entities-batch-delete', 'agent-entity-types-entities-batch-update', 'agent-entity-types-get', 'agent-entity-types-list', 'agent-entity-types-patch', 'agent-environments-users-sessions-contexts-create', 'agent-environments-users-sessions-contexts-delete', 'agent-environments-users-sessions-contexts-get', 'agent-environments-users-sessions-contexts-list', 'agent-environments-users-sessions-contexts-patch', 'agent-environments-users-sessions-delete-contexts', 'agent-environments-users-sessions-detect-intent', 'agent-environments-users-sessions-entity-types-create', 'agent-environments-users-sessions-entity-types-delete', 'agent-environments-users-sessions-entity-types-get', 'agent-environments-users-sessions-entity-types-list', 'agent-environments-users-sessions-entity-types-patch', 'agent-export', 'agent-import', 'agent-intents-batch-delete', 'agent-intents-batch-update', 'agent-intents-create', 'agent-intents-delete', 'agent-intents-get', 'agent-intents-list', 'agent-intents-patch', 'agent-knowledge-bases-create', 'agent-knowledge-bases-delete', 'agent-knowledge-bases-documents-create', 'agent-knowledge-bases-documents-delete', 'agent-knowledge-bases-documents-get', 'agent-knowledge-bases-documents-list', 'agent-knowledge-bases-documents-patch', 'agent-knowledge-bases-documents-reload', 'agent-knowledge-bases-get', 'agent-knowledge-bases-list', 'agent-knowledge-bases-patch', 'agent-restore', 'agent-search', 'agent-sessions-contexts-create', 'agent-sessions-contexts-delete', 'agent-sessions-contexts-get', 'agent-sessions-contexts-list', 'agent-sessions-contexts-patch', 'agent-sessions-delete-contexts', 'agent-sessions-detect-intent', 'agent-sessions-entity-types-create', 'agent-sessions-entity-types-delete', 'agent-sessions-entity-types-get', 'agent-sessions-entity-types-list', 'agent-sessions-entity-types-patch', 'agent-train', 'get-agent', 'knowledge-bases-create', 'knowledge-bases-delete', 'knowledge-bases-documents-create', 'knowledge-bases-documents-delete', 'knowledge-bases-documents-get', 'knowledge-bases-documents-list', 'knowledge-bases-documents-patch', 'knowledge-bases-documents-reload', 'knowledge-bases-get', 'knowledge-bases-list', 'knowledge-bases-patch' and 'operations-get'", vec![ ("agent-entity-types-batch-delete", Some(r##"Deletes entity types in the specified agent. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-entity-types-batch-delete", vec![ (Some(r##"parent"##), @@ -7754,8 +5470,7 @@ fn main() { ("agent-entity-types-batch-update", Some(r##"Updates/Creates multiple entity types in the specified agent. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-entity-types-batch-update", vec![ (Some(r##"parent"##), @@ -7869,8 +5584,7 @@ fn main() { ("agent-entity-types-entities-batch-delete", Some(r##"Deletes entities in the specified entity type. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-entity-types-entities-batch-delete", vec![ (Some(r##"parent"##), @@ -7903,8 +5617,7 @@ fn main() { method does not affect entities in the entity type that aren't explicitly specified in the request. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-entity-types-entities-batch-update", vec![ (Some(r##"parent"##), @@ -7984,10 +5697,10 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"Required for all methods except `create` (`create` populates the name - automatically. - The unique identifier of the entity type. Format: - `projects//agent/entityTypes/`."##), + Some(r##"The unique identifier of the entity type. + Required for EntityTypes.UpdateEntityType and + EntityTypes.BatchUpdateEntityTypes methods. + Format: `projects//agent/entityTypes/`."##), Some(true), Some(false)), @@ -8134,10 +5847,13 @@ fn main() { Some(r##"Required. The unique identifier of the context. Format: `projects//agent/sessions//contexts/`, or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is - always converted to lowercase. If `Environment ID` is not specified, we - assume default 'draft' environment. If `User ID` is not specified, we - assume default '-' user."##), + ID>/sessions//contexts/`. + + The `Context ID` is always converted to lowercase, may only contain + characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + + If `Environment ID` is not specified, we assume default 'draft' + environment. If `User ID` is not specified, we assume default '-' user."##), Some(true), Some(false)), @@ -8382,8 +6098,7 @@ fn main() { Some(r##"Exports the specified agent to a ZIP file. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-export", vec![ (Some(r##"parent"##), @@ -8419,8 +6134,7 @@ fn main() { versions from ImportAgentRequest. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-import", vec![ (Some(r##"parent"##), @@ -8616,9 +6330,9 @@ fn main() { vec![ (Some(r##"name"##), None, - Some(r##"Required for all methods except `create` (`create` populates the name - automatically. - The unique identifier of this intent. + Some(r##"The unique identifier of this intent. + Required for Intents.UpdateIntent and Intents.BatchUpdateIntents + methods. Format: `projects//agent/intents/`."##), Some(true), Some(false)), @@ -8793,6 +6507,74 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("agent-knowledge-bases-documents-patch", + Some(r##"Updates the specified document. + Operation "##), + "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-knowledge-bases-documents-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The document resource name. + The name must be empty when creating a document. + Format: `projects//knowledgeBases//documents/`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("agent-knowledge-bases-documents-reload", + Some(r##"Reloads the specified document from its specified source, content_uri or + content. The previously loaded content of the document will be deleted. + Note: Even when the content of the document has not changed, there still + may be side effects because of internal implementation changes. + Operation "##), + "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-knowledge-bases-documents-reload", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the document to reload. + Format: `projects//knowledgeBases//documents/`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -8839,6 +6621,36 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("agent-knowledge-bases-patch", + Some(r##"Updates the specified knowledge base."##), + "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-knowledge-bases-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The knowledge base resource name. + The name must be empty when creating a knowledge base. + Format: `projects//knowledgeBases/`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -8852,8 +6664,7 @@ fn main() { entity types in the older version are deleted. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-restore", vec![ (Some(r##"parent"##), @@ -9035,10 +6846,13 @@ fn main() { Some(r##"Required. The unique identifier of the context. Format: `projects//agent/sessions//contexts/`, or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is - always converted to lowercase. If `Environment ID` is not specified, we - assume default 'draft' environment. If `User ID` is not specified, we - assume default '-' user."##), + ID>/sessions//contexts/`. + + The `Context ID` is always converted to lowercase, may only contain + characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + + If `Environment ID` is not specified, we assume default 'draft' + environment. If `User ID` is not specified, we assume default '-' user."##), Some(true), Some(false)), @@ -9283,8 +7097,7 @@ fn main() { Some(r##"Trains the specified agent. - Operation "##), + Operation "##), "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_agent-train", vec![ (Some(r##"parent"##), @@ -9306,650 +7119,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversation-profiles-create", - Some(r##"Creates a conversation profile in the specified project."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversation-profiles-create", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The project to create a conversation profile for. - Format: `projects/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversation-profiles-delete", - Some(r##"Deletes the specified conversation profile."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversation-profiles-delete", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The name of the conversation profile to delete. - Format: `projects//conversationProfiles/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversation-profiles-get", - Some(r##"Retrieves the specified conversation profile."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversation-profiles-get", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The resource name of the conversation profile. - Format: `projects//conversationProfiles/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversation-profiles-list", - Some(r##"Returns the list of all conversation profiles in the specified project."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversation-profiles-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The project to list all conversation profiles from. - Format: `projects/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversation-profiles-patch", - Some(r##"Updates the specified conversation profile."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversation-profiles-patch", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required for all methods except `create` (`create` populates the name - automatically). - The unique identifier of this conversation profile. - Format: `projects//conversationProfiles/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-add-conversation-phone-number", - Some(r##"Sets a phone number for this converstion to connect to."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-add-conversation-phone-number", - vec![ - (Some(r##"name"##), - None, - Some(r##"The name of this conversation. - Format: `projects//conversations/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-complete", - Some(r##"Completes the specified conversation. Finished conversations are purged - from the database after 30 days."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-complete", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. Resource identifier of the conversation to close. - Format: `projects//conversations/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-create", - Some(r##"Creates a new conversation. Conversation are auto-completed after 24 hours."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-create", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. Resource identifier of the project creating the conversation. - Format: `projects/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-get", - Some(r##"Retrieves the specific conversation."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-get", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The name of the conversation. Format: - `projects//conversations/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-list", - Some(r##"Returns the list of all conversations in the specified project."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The project from which to list all conversation. - Format: `projects/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-messages-list", - Some(r##"Lists messages that belong to a given conversation."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-messages-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The name of the conversation to list messages for. - Format: `projects//conversations/`"##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-participants-analyze-content", - Some(r##"Adds a text (chat, for example), or audio (phone recording, for example) - message from a participan into the conversation."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-participants-analyze-content", - vec![ - (Some(r##"participant"##), - None, - Some(r##"Required. The name of the participant this text comes from. - Format: `projects//conversations//participants/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-participants-create", - Some(r##"Creates a new participant in a conversation."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-participants-create", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. Resource identifier of the conversation adding the participant. - Format: `projects//conversations/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-participants-get", - Some(r##"Retrieves a conversation participant."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-participants-get", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The name of the participant. Format: - `projects//conversations//participants/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-participants-list", - Some(r##"Returns the list of all participants in the specified conversation."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-participants-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The conversation to list all contexts from. - Format: `projects//conversations/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-participants-streaming-analyze-content", - Some(r##"Adds a text (chat, for example), or audio (phone recording, for example) - message from a participan into the conversation. - Note: This method is only available through the gRPC API (not REST). - - The top-level message sent to the client by the server is - `StreamingAnalyzeContentResponse`. Multiple response messages can be - returned in order. The first one or more messages contain the - `recognition_result` field. Each result represents a more complete - transcript of what the user said. The next message contains the - `reply_text` field and potentially the `reply_audio` field. The message can - also contain the `automated_agent_reply` field."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-participants-streaming-analyze-content", - vec![ - (Some(r##"participant"##), - None, - Some(r##"Required. The name of the participant this text comes from. - Format: `projects//conversations//participants/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("conversations-participants-suggestions-list", - Some(r##"Retrieves suggestions for live agents. - - This method should be used by human agent client software to fetch - suggestions in real-time, while the conversation with an end user is in - progress. The functionality is implemented in terms of the - [list pagination](/apis/design/design_patterns#list_pagination) - design pattern. The client app should use the `next_page_token` field - to fetch the next batch of suggestions."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_conversations-participants-suggestions-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The name of the conversation participant for whom to fetch - suggestions. - Format: `projects//conversations//participants/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("environments-users-conversations-contexts-create", - Some(r##"Creates a context. - - If the specified context already exists, overrides the context."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_environments-users-conversations-contexts-create", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The session to create a context for. - Format: `projects//agent/sessions/` or - `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - default 'draft' environment. If `User ID` is not specified, we assume - default '-' user."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("environments-users-conversations-contexts-delete", - Some(r##"Deletes the specified context."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_environments-users-conversations-contexts-delete", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The name of the context to delete. Format: - `projects//agent/sessions//contexts/` - or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - not specified, we assume default 'draft' environment. If `User ID` is not - specified, we assume default '-' user."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("environments-users-conversations-contexts-get", - Some(r##"Retrieves the specified context."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_environments-users-conversations-contexts-get", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The name of the context. Format: - `projects//agent/sessions//contexts/` - or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - not specified, we assume default 'draft' environment. If `User ID` is not - specified, we assume default '-' user."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("environments-users-conversations-contexts-list", - Some(r##"Returns the list of all contexts in the specified session."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_environments-users-conversations-contexts-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The session to list all contexts from. - Format: `projects//agent/sessions/` or - `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - default 'draft' environment. If `User ID` is not specified, we assume - default '-' user."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("environments-users-conversations-contexts-patch", - Some(r##"Updates the specified context."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_environments-users-conversations-contexts-patch", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The unique identifier of the context. Format: - `projects//agent/sessions//contexts/`, - or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is - always converted to lowercase. If `Environment ID` is not specified, we - assume default 'draft' environment. If `User ID` is not specified, we - assume default '-' user."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("environments-users-conversations-delete-contexts", - Some(r##"Deletes all active contexts in the specified session."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_environments-users-conversations-delete-contexts", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The name of the session to delete all contexts from. Format: - `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' - environment. If `User ID` is not specified, we assume default '-' user."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -9973,169 +7142,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("human-agent-assistants-compile-suggestions", - Some(r##"Uses the specified human agent assistant to come up with suggestions - (relevant articles and FAQs) on how to respond to a given conversation."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_human-agent-assistants-compile-suggestions", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The resource name of the agent assistant. - Format: `projects//humanAgentAssistants/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("human-agent-assistants-create", - Some(r##"Creates a human agent assistant."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_human-agent-assistants-create", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The project to create a agent assistant for. - Format: `projects/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("human-agent-assistants-delete", - Some(r##"Deletes the specified human agent assistant."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_human-agent-assistants-delete", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The resource name of the agent assistant. - Format: `projects//humanAgentAssistants/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("human-agent-assistants-get", - Some(r##"Retrieves a human agent assistant."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_human-agent-assistants-get", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The resource name of the agent assistant. - Format: `projects//humanAgentAssistants/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("human-agent-assistants-list", - Some(r##"Returns the list of all human agent assistants."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_human-agent-assistants-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The project to list all agent assistants from. - Format: `projects/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("human-agent-assistants-patch", - Some(r##"Updates the specified human agent assistant."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_human-agent-assistants-patch", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required for all methods except `create` (`create` populates the name - automatically). - The unique identifier of human agent assistant. - Format: `projects//humanAgentAssistants/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -10294,6 +7300,74 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("knowledge-bases-documents-patch", + Some(r##"Updates the specified document. + Operation "##), + "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_knowledge-bases-documents-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The document resource name. + The name must be empty when creating a document. + Format: `projects//knowledgeBases//documents/`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("knowledge-bases-documents-reload", + Some(r##"Reloads the specified document from its specified source, content_uri or + content. The previously loaded content of the document will be deleted. + Note: Even when the content of the document has not changed, there still + may be side effects because of internal implementation changes. + Operation "##), + "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_knowledge-bases-documents-reload", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the document to reload. + Format: `projects//knowledgeBases//documents/`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -10340,6 +7414,36 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("knowledge-bases-patch", + Some(r##"Updates the specified knowledge base."##), + "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_knowledge-bases-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The knowledge base resource name. + The name must be empty when creating a knowledge base. + Format: `projects//knowledgeBases/`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -10364,257 +7468,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("phone-number-orders-cancel", - Some(r##"Cancels an `PhoneNumberOrder`. - Returns an error if the order is in state - IN_PROGRESS or - COMPLETED."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_phone-number-orders-cancel", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The unique identifier of the order to delete. - Format: `projects//phoneNumberOrders/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("phone-number-orders-create", - Some(r##"Creates an order to request phone numbers be added to a project. - The initial `LifecycleState` of a newly created order is - PENDING."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_phone-number-orders-create", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. Resource identifier of the project requesting the orders. - Format: `projects/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("phone-number-orders-get", - Some(r##"Returns a specific `PhoneNumberOrder`."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_phone-number-orders-get", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The unique identifier of the order to retrieve. - Format: `projects//phoneNumberOrders/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("phone-number-orders-list", - Some(r##"Lists of all `PhoneNumberOrder` resources in the specified project."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_phone-number-orders-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The project to list all orders from. - Format: `projects/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("phone-number-orders-patch", - Some(r##"Updates the specified `PhoneNumberOrder` resource. - Returns an error if the order is in state - IN_PROGRESS or - COMPLETED."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_phone-number-orders-patch", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The unique identifier of this order. - Format: `projects//phoneNumberOrders/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("phone-numbers-delete", - Some(r##"Requests deletion of a `PhoneNumber`. The `PhoneNumber` is moved into the - DELETE_REQUESTED state - immediately, and is deleted approximately 30 days later. This method may - only be called on a `PhoneNumber` in the - ACTIVE state."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_phone-numbers-delete", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The unique identifier of the `PhoneNumber` to delete. - Format: `projects//phoneNumbers/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("phone-numbers-list", - Some(r##"Returns the list of all phone numbers in the specified project."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_phone-numbers-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The project to list all `PhoneNumber` resources from. - Format: `projects/`."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("phone-numbers-patch", - Some(r##"Updates the specified `PhoneNumber`."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_phone-numbers-patch", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The unique identifier of this phone number. - Format: `projects//phoneNumbers/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("phone-numbers-undelete", - Some(r##"Cancels the deletion request for a `PhoneNumber`. This method may only be - called on a `PhoneNumber` in the - DELETE_REQUESTED state."##), - "Details at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli/projects_phone-numbers-undelete", - vec![ - (Some(r##"name"##), - None, - Some(r##"Required. The unique identifier of the `PhoneNumber` to delete. - Format: `projects//phoneNumbers/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -10627,8 +7480,8 @@ fn main() { let mut app = App::new("dialogflow2-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181009") - .about("An end-to-end development suite for conversational interfaces (e.g., chatbots, voice-powered apps and devices).") + .version("1.0.8+20190402") + .about("Builds conversational interfaces (for example, chatbots, and voice-powered apps and devices).") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dialogflow2_beta1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/dialogflow2_beta1/Cargo.toml b/gen/dialogflow2_beta1/Cargo.toml index 4719bd65ec..91f9453aac 100644 --- a/gen/dialogflow2_beta1/Cargo.toml +++ b/gen/dialogflow2_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dialogflow2_beta1" -version = "1.0.8+20181009" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with Dialogflow (protocol v2beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dialogflow2_beta1" homepage = "https://cloud.google.com/dialogflow-enterprise/" -documentation = "https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009" +documentation = "https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402" license = "MIT" keywords = ["dialogflow", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/dialogflow2_beta1/README.md b/gen/dialogflow2_beta1/README.md index 9b491e7b7f..1300b39484 100644 --- a/gen/dialogflow2_beta1/README.md +++ b/gen/dialogflow2_beta1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-dialogflow2_beta1` library allows access to all features of the *Google Dialogflow* service. -This documentation was generated from *Dialogflow* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *dialogflow:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Dialogflow* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *dialogflow:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Dialogflow* *v2_beta1* API can be found at the [official documentation site](https://cloud.google.com/dialogflow-enterprise/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.Dialogflow.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.Dialogflow.html) ... * projects - * [*agent entity types batch delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeBatchDeleteCall.html), [*agent entity types batch update*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeBatchUpdateCall.html), [*agent entity types create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeCreateCall.html), [*agent entity types delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeDeleteCall.html), [*agent entity types entities batch create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeEntityBatchCreateCall.html), [*agent entity types entities batch delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeEntityBatchDeleteCall.html), [*agent entity types entities batch update*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html), [*agent entity types get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeGetCall.html), [*agent entity types list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeListCall.html), [*agent entity types patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEntityTypePatchCall.html), [*agent environments users sessions contexts create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionContextCreateCall.html), [*agent environments users sessions contexts delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionContextDeleteCall.html), [*agent environments users sessions contexts get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionContextGetCall.html), [*agent environments users sessions contexts list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionContextListCall.html), [*agent environments users sessions contexts patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionContextPatchCall.html), [*agent environments users sessions delete contexts*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionDeleteContextCall.html), [*agent environments users sessions detect intent*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionDetectIntentCall.html), [*agent environments users sessions entity types create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionEntityTypeCreateCall.html), [*agent environments users sessions entity types delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall.html), [*agent environments users sessions entity types get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionEntityTypeGetCall.html), [*agent environments users sessions entity types list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionEntityTypeListCall.html), [*agent environments users sessions entity types patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionEntityTypePatchCall.html), [*agent export*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentExportCall.html), [*agent import*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentImportCall.html), [*agent intents batch delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentIntentBatchDeleteCall.html), [*agent intents batch update*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentIntentBatchUpdateCall.html), [*agent intents create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentIntentCreateCall.html), [*agent intents delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentIntentDeleteCall.html), [*agent intents get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentIntentGetCall.html), [*agent intents list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentIntentListCall.html), [*agent intents patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentIntentPatchCall.html), [*agent knowledge bases create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseCreateCall.html), [*agent knowledge bases delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDeleteCall.html), [*agent knowledge bases documents create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDocumentCreateCall.html), [*agent knowledge bases documents delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDocumentDeleteCall.html), [*agent knowledge bases documents get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDocumentGetCall.html), [*agent knowledge bases documents list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDocumentListCall.html), [*agent knowledge bases get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseGetCall.html), [*agent knowledge bases list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseListCall.html), [*agent restore*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentRestoreCall.html), [*agent search*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSearchCall.html), [*agent sessions contexts create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionContextCreateCall.html), [*agent sessions contexts delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionContextDeleteCall.html), [*agent sessions contexts get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionContextGetCall.html), [*agent sessions contexts list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionContextListCall.html), [*agent sessions contexts patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionContextPatchCall.html), [*agent sessions delete contexts*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionDeleteContextCall.html), [*agent sessions detect intent*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionDetectIntentCall.html), [*agent sessions entity types create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionEntityTypeCreateCall.html), [*agent sessions entity types delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionEntityTypeDeleteCall.html), [*agent sessions entity types get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionEntityTypeGetCall.html), [*agent sessions entity types list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionEntityTypeListCall.html), [*agent sessions entity types patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentSessionEntityTypePatchCall.html), [*agent train*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectAgentTrainCall.html), [*conversation profiles create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationProfileCreateCall.html), [*conversation profiles delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationProfileDeleteCall.html), [*conversation profiles get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationProfileGetCall.html), [*conversation profiles list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationProfileListCall.html), [*conversation profiles patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationProfilePatchCall.html), [*conversations add conversation phone number*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationAddConversationPhoneNumberCall.html), [*conversations complete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationCompleteCall.html), [*conversations create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationCreateCall.html), [*conversations get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationGetCall.html), [*conversations list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationListCall.html), [*conversations messages list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationMessageListCall.html), [*conversations participants analyze content*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationParticipantAnalyzeContentCall.html), [*conversations participants create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationParticipantCreateCall.html), [*conversations participants get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationParticipantGetCall.html), [*conversations participants list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationParticipantListCall.html), [*conversations participants streaming analyze content*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationParticipantStreamingAnalyzeContentCall.html), [*conversations participants suggestions list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectConversationParticipantSuggestionListCall.html), [*environments users conversations contexts create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectEnvironmentUserConversationContextCreateCall.html), [*environments users conversations contexts delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectEnvironmentUserConversationContextDeleteCall.html), [*environments users conversations contexts get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectEnvironmentUserConversationContextGetCall.html), [*environments users conversations contexts list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectEnvironmentUserConversationContextListCall.html), [*environments users conversations contexts patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectEnvironmentUserConversationContextPatchCall.html), [*environments users conversations delete contexts*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectEnvironmentUserConversationDeleteContextCall.html), [*get agent*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectGetAgentCall.html), [*human agent assistants compile suggestions*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectHumanAgentAssistantCompileSuggestionCall.html), [*human agent assistants create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectHumanAgentAssistantCreateCall.html), [*human agent assistants delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectHumanAgentAssistantDeleteCall.html), [*human agent assistants get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectHumanAgentAssistantGetCall.html), [*human agent assistants list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectHumanAgentAssistantListCall.html), [*human agent assistants patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectHumanAgentAssistantPatchCall.html), [*knowledge bases create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseCreateCall.html), [*knowledge bases delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDeleteCall.html), [*knowledge bases documents create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDocumentCreateCall.html), [*knowledge bases documents delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDocumentDeleteCall.html), [*knowledge bases documents get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDocumentGetCall.html), [*knowledge bases documents list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDocumentListCall.html), [*knowledge bases get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseGetCall.html), [*knowledge bases list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseListCall.html), [*operations get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectOperationGetCall.html), [*phone number orders cancel*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectPhoneNumberOrderCancelCall.html), [*phone number orders create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectPhoneNumberOrderCreateCall.html), [*phone number orders get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectPhoneNumberOrderGetCall.html), [*phone number orders list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectPhoneNumberOrderListCall.html), [*phone number orders patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectPhoneNumberOrderPatchCall.html), [*phone numbers delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectPhoneNumberDeleteCall.html), [*phone numbers list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectPhoneNumberListCall.html), [*phone numbers patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectPhoneNumberPatchCall.html) and [*phone numbers undelete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.ProjectPhoneNumberUndeleteCall.html) + * [*agent entity types batch delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeBatchDeleteCall.html), [*agent entity types batch update*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeBatchUpdateCall.html), [*agent entity types create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeCreateCall.html), [*agent entity types delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeDeleteCall.html), [*agent entity types entities batch create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeEntityBatchCreateCall.html), [*agent entity types entities batch delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeEntityBatchDeleteCall.html), [*agent entity types entities batch update*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html), [*agent entity types get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeGetCall.html), [*agent entity types list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEntityTypeListCall.html), [*agent entity types patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEntityTypePatchCall.html), [*agent environments users sessions contexts create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionContextCreateCall.html), [*agent environments users sessions contexts delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionContextDeleteCall.html), [*agent environments users sessions contexts get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionContextGetCall.html), [*agent environments users sessions contexts list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionContextListCall.html), [*agent environments users sessions contexts patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionContextPatchCall.html), [*agent environments users sessions delete contexts*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionDeleteContextCall.html), [*agent environments users sessions detect intent*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionDetectIntentCall.html), [*agent environments users sessions entity types create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionEntityTypeCreateCall.html), [*agent environments users sessions entity types delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall.html), [*agent environments users sessions entity types get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionEntityTypeGetCall.html), [*agent environments users sessions entity types list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionEntityTypeListCall.html), [*agent environments users sessions entity types patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentEnvironmentUserSessionEntityTypePatchCall.html), [*agent export*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentExportCall.html), [*agent import*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentImportCall.html), [*agent intents batch delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentIntentBatchDeleteCall.html), [*agent intents batch update*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentIntentBatchUpdateCall.html), [*agent intents create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentIntentCreateCall.html), [*agent intents delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentIntentDeleteCall.html), [*agent intents get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentIntentGetCall.html), [*agent intents list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentIntentListCall.html), [*agent intents patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentIntentPatchCall.html), [*agent knowledge bases create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseCreateCall.html), [*agent knowledge bases delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDeleteCall.html), [*agent knowledge bases documents create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDocumentCreateCall.html), [*agent knowledge bases documents delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDocumentDeleteCall.html), [*agent knowledge bases documents get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDocumentGetCall.html), [*agent knowledge bases documents list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDocumentListCall.html), [*agent knowledge bases documents patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDocumentPatchCall.html), [*agent knowledge bases documents reload*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseDocumentReloadCall.html), [*agent knowledge bases get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseGetCall.html), [*agent knowledge bases list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBaseListCall.html), [*agent knowledge bases patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentKnowledgeBasePatchCall.html), [*agent restore*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentRestoreCall.html), [*agent search*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSearchCall.html), [*agent sessions contexts create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionContextCreateCall.html), [*agent sessions contexts delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionContextDeleteCall.html), [*agent sessions contexts get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionContextGetCall.html), [*agent sessions contexts list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionContextListCall.html), [*agent sessions contexts patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionContextPatchCall.html), [*agent sessions delete contexts*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionDeleteContextCall.html), [*agent sessions detect intent*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionDetectIntentCall.html), [*agent sessions entity types create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionEntityTypeCreateCall.html), [*agent sessions entity types delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionEntityTypeDeleteCall.html), [*agent sessions entity types get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionEntityTypeGetCall.html), [*agent sessions entity types list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionEntityTypeListCall.html), [*agent sessions entity types patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentSessionEntityTypePatchCall.html), [*agent train*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectAgentTrainCall.html), [*get agent*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectGetAgentCall.html), [*knowledge bases create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseCreateCall.html), [*knowledge bases delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDeleteCall.html), [*knowledge bases documents create*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDocumentCreateCall.html), [*knowledge bases documents delete*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDocumentDeleteCall.html), [*knowledge bases documents get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDocumentGetCall.html), [*knowledge bases documents list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDocumentListCall.html), [*knowledge bases documents patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDocumentPatchCall.html), [*knowledge bases documents reload*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseDocumentReloadCall.html), [*knowledge bases get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseGetCall.html), [*knowledge bases list*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBaseListCall.html), [*knowledge bases patch*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectKnowledgeBasePatchCall.html) and [*operations get*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.ProjectOperationGetCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/struct.Dialogflow.html)** +* **[Hub](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/struct.Dialogflow.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -48,18 +48,22 @@ Or specifically ... ```ignore let r = hub.projects().agent_restore(...).doit() +let r = hub.projects().agent_train(...).doit() +let r = hub.projects().agent_knowledge_bases_documents_patch(...).doit() let r = hub.projects().agent_intents_batch_delete(...).doit() let r = hub.projects().knowledge_bases_documents_create(...).doit() +let r = hub.projects().knowledge_bases_documents_patch(...).doit() let r = hub.projects().knowledge_bases_documents_delete(...).doit() -let r = hub.projects().agent_entity_types_batch_delete(...).doit() -let r = hub.projects().agent_train(...).doit() -let r = hub.projects().agent_knowledge_bases_documents_delete(...).doit() -let r = hub.projects().agent_import(...).doit() -let r = hub.projects().agent_entity_types_batch_update(...).doit() let r = hub.projects().agent_export(...).doit() +let r = hub.projects().agent_entity_types_batch_delete(...).doit() +let r = hub.projects().agent_import(...).doit() +let r = hub.projects().agent_knowledge_bases_documents_delete(...).doit() +let r = hub.projects().agent_entity_types_batch_update(...).doit() let r = hub.projects().agent_knowledge_bases_documents_create(...).doit() +let r = hub.projects().agent_knowledge_bases_documents_reload(...).doit() let r = hub.projects().agent_intents_batch_update(...).doit() let r = hub.projects().agent_entity_types_entities_batch_update(...).doit() +let r = hub.projects().knowledge_bases_documents_reload(...).doit() let r = hub.projects().agent_entity_types_entities_batch_delete(...).doit() let r = hub.projects().operations_get(...).doit() let r = hub.projects().agent_entity_types_entities_batch_create(...).doit() @@ -96,7 +100,7 @@ extern crate hyper; extern crate hyper_rustls; extern crate yup_oauth2 as oauth2; extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -use dialogflow2_beta1::GoogleCloudDialogflowV2beta1RestoreAgentRequest; +use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Document; use dialogflow2_beta1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -117,12 +121,13 @@ let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsCon // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! -let mut req = GoogleCloudDialogflowV2beta1RestoreAgentRequest::default(); +let mut req = GoogleCloudDialogflowV2beta1Document::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.projects().agent_restore(req, "parent") +let result = hub.projects().agent_knowledge_bases_documents_patch(req, "name") + .update_mask("sit") .doit(); match result { @@ -145,17 +150,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -165,29 +170,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-dialogflow2_beta1/1.0.8+20181009/google_dialogflow2_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dialogflow2_beta1/1.0.8+20190402/google_dialogflow2_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dialogflow2_beta1/src/lib.rs b/gen/dialogflow2_beta1/src/lib.rs index 739d0ed928..359bba2592 100644 --- a/gen/dialogflow2_beta1/src/lib.rs +++ b/gen/dialogflow2_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Dialogflow* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *dialogflow:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Dialogflow* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *dialogflow:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Dialogflow* *v2_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/dialogflow-enterprise/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Dialogflow.html) ... //! //! * projects -//! * [*agent entity types batch delete*](struct.ProjectAgentEntityTypeBatchDeleteCall.html), [*agent entity types batch update*](struct.ProjectAgentEntityTypeBatchUpdateCall.html), [*agent entity types create*](struct.ProjectAgentEntityTypeCreateCall.html), [*agent entity types delete*](struct.ProjectAgentEntityTypeDeleteCall.html), [*agent entity types entities batch create*](struct.ProjectAgentEntityTypeEntityBatchCreateCall.html), [*agent entity types entities batch delete*](struct.ProjectAgentEntityTypeEntityBatchDeleteCall.html), [*agent entity types entities batch update*](struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html), [*agent entity types get*](struct.ProjectAgentEntityTypeGetCall.html), [*agent entity types list*](struct.ProjectAgentEntityTypeListCall.html), [*agent entity types patch*](struct.ProjectAgentEntityTypePatchCall.html), [*agent environments users sessions contexts create*](struct.ProjectAgentEnvironmentUserSessionContextCreateCall.html), [*agent environments users sessions contexts delete*](struct.ProjectAgentEnvironmentUserSessionContextDeleteCall.html), [*agent environments users sessions contexts get*](struct.ProjectAgentEnvironmentUserSessionContextGetCall.html), [*agent environments users sessions contexts list*](struct.ProjectAgentEnvironmentUserSessionContextListCall.html), [*agent environments users sessions contexts patch*](struct.ProjectAgentEnvironmentUserSessionContextPatchCall.html), [*agent environments users sessions delete contexts*](struct.ProjectAgentEnvironmentUserSessionDeleteContextCall.html), [*agent environments users sessions detect intent*](struct.ProjectAgentEnvironmentUserSessionDetectIntentCall.html), [*agent environments users sessions entity types create*](struct.ProjectAgentEnvironmentUserSessionEntityTypeCreateCall.html), [*agent environments users sessions entity types delete*](struct.ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall.html), [*agent environments users sessions entity types get*](struct.ProjectAgentEnvironmentUserSessionEntityTypeGetCall.html), [*agent environments users sessions entity types list*](struct.ProjectAgentEnvironmentUserSessionEntityTypeListCall.html), [*agent environments users sessions entity types patch*](struct.ProjectAgentEnvironmentUserSessionEntityTypePatchCall.html), [*agent export*](struct.ProjectAgentExportCall.html), [*agent import*](struct.ProjectAgentImportCall.html), [*agent intents batch delete*](struct.ProjectAgentIntentBatchDeleteCall.html), [*agent intents batch update*](struct.ProjectAgentIntentBatchUpdateCall.html), [*agent intents create*](struct.ProjectAgentIntentCreateCall.html), [*agent intents delete*](struct.ProjectAgentIntentDeleteCall.html), [*agent intents get*](struct.ProjectAgentIntentGetCall.html), [*agent intents list*](struct.ProjectAgentIntentListCall.html), [*agent intents patch*](struct.ProjectAgentIntentPatchCall.html), [*agent knowledge bases create*](struct.ProjectAgentKnowledgeBaseCreateCall.html), [*agent knowledge bases delete*](struct.ProjectAgentKnowledgeBaseDeleteCall.html), [*agent knowledge bases documents create*](struct.ProjectAgentKnowledgeBaseDocumentCreateCall.html), [*agent knowledge bases documents delete*](struct.ProjectAgentKnowledgeBaseDocumentDeleteCall.html), [*agent knowledge bases documents get*](struct.ProjectAgentKnowledgeBaseDocumentGetCall.html), [*agent knowledge bases documents list*](struct.ProjectAgentKnowledgeBaseDocumentListCall.html), [*agent knowledge bases get*](struct.ProjectAgentKnowledgeBaseGetCall.html), [*agent knowledge bases list*](struct.ProjectAgentKnowledgeBaseListCall.html), [*agent restore*](struct.ProjectAgentRestoreCall.html), [*agent search*](struct.ProjectAgentSearchCall.html), [*agent sessions contexts create*](struct.ProjectAgentSessionContextCreateCall.html), [*agent sessions contexts delete*](struct.ProjectAgentSessionContextDeleteCall.html), [*agent sessions contexts get*](struct.ProjectAgentSessionContextGetCall.html), [*agent sessions contexts list*](struct.ProjectAgentSessionContextListCall.html), [*agent sessions contexts patch*](struct.ProjectAgentSessionContextPatchCall.html), [*agent sessions delete contexts*](struct.ProjectAgentSessionDeleteContextCall.html), [*agent sessions detect intent*](struct.ProjectAgentSessionDetectIntentCall.html), [*agent sessions entity types create*](struct.ProjectAgentSessionEntityTypeCreateCall.html), [*agent sessions entity types delete*](struct.ProjectAgentSessionEntityTypeDeleteCall.html), [*agent sessions entity types get*](struct.ProjectAgentSessionEntityTypeGetCall.html), [*agent sessions entity types list*](struct.ProjectAgentSessionEntityTypeListCall.html), [*agent sessions entity types patch*](struct.ProjectAgentSessionEntityTypePatchCall.html), [*agent train*](struct.ProjectAgentTrainCall.html), [*conversation profiles create*](struct.ProjectConversationProfileCreateCall.html), [*conversation profiles delete*](struct.ProjectConversationProfileDeleteCall.html), [*conversation profiles get*](struct.ProjectConversationProfileGetCall.html), [*conversation profiles list*](struct.ProjectConversationProfileListCall.html), [*conversation profiles patch*](struct.ProjectConversationProfilePatchCall.html), [*conversations add conversation phone number*](struct.ProjectConversationAddConversationPhoneNumberCall.html), [*conversations complete*](struct.ProjectConversationCompleteCall.html), [*conversations create*](struct.ProjectConversationCreateCall.html), [*conversations get*](struct.ProjectConversationGetCall.html), [*conversations list*](struct.ProjectConversationListCall.html), [*conversations messages list*](struct.ProjectConversationMessageListCall.html), [*conversations participants analyze content*](struct.ProjectConversationParticipantAnalyzeContentCall.html), [*conversations participants create*](struct.ProjectConversationParticipantCreateCall.html), [*conversations participants get*](struct.ProjectConversationParticipantGetCall.html), [*conversations participants list*](struct.ProjectConversationParticipantListCall.html), [*conversations participants streaming analyze content*](struct.ProjectConversationParticipantStreamingAnalyzeContentCall.html), [*conversations participants suggestions list*](struct.ProjectConversationParticipantSuggestionListCall.html), [*environments users conversations contexts create*](struct.ProjectEnvironmentUserConversationContextCreateCall.html), [*environments users conversations contexts delete*](struct.ProjectEnvironmentUserConversationContextDeleteCall.html), [*environments users conversations contexts get*](struct.ProjectEnvironmentUserConversationContextGetCall.html), [*environments users conversations contexts list*](struct.ProjectEnvironmentUserConversationContextListCall.html), [*environments users conversations contexts patch*](struct.ProjectEnvironmentUserConversationContextPatchCall.html), [*environments users conversations delete contexts*](struct.ProjectEnvironmentUserConversationDeleteContextCall.html), [*get agent*](struct.ProjectGetAgentCall.html), [*human agent assistants compile suggestions*](struct.ProjectHumanAgentAssistantCompileSuggestionCall.html), [*human agent assistants create*](struct.ProjectHumanAgentAssistantCreateCall.html), [*human agent assistants delete*](struct.ProjectHumanAgentAssistantDeleteCall.html), [*human agent assistants get*](struct.ProjectHumanAgentAssistantGetCall.html), [*human agent assistants list*](struct.ProjectHumanAgentAssistantListCall.html), [*human agent assistants patch*](struct.ProjectHumanAgentAssistantPatchCall.html), [*knowledge bases create*](struct.ProjectKnowledgeBaseCreateCall.html), [*knowledge bases delete*](struct.ProjectKnowledgeBaseDeleteCall.html), [*knowledge bases documents create*](struct.ProjectKnowledgeBaseDocumentCreateCall.html), [*knowledge bases documents delete*](struct.ProjectKnowledgeBaseDocumentDeleteCall.html), [*knowledge bases documents get*](struct.ProjectKnowledgeBaseDocumentGetCall.html), [*knowledge bases documents list*](struct.ProjectKnowledgeBaseDocumentListCall.html), [*knowledge bases get*](struct.ProjectKnowledgeBaseGetCall.html), [*knowledge bases list*](struct.ProjectKnowledgeBaseListCall.html), [*operations get*](struct.ProjectOperationGetCall.html), [*phone number orders cancel*](struct.ProjectPhoneNumberOrderCancelCall.html), [*phone number orders create*](struct.ProjectPhoneNumberOrderCreateCall.html), [*phone number orders get*](struct.ProjectPhoneNumberOrderGetCall.html), [*phone number orders list*](struct.ProjectPhoneNumberOrderListCall.html), [*phone number orders patch*](struct.ProjectPhoneNumberOrderPatchCall.html), [*phone numbers delete*](struct.ProjectPhoneNumberDeleteCall.html), [*phone numbers list*](struct.ProjectPhoneNumberListCall.html), [*phone numbers patch*](struct.ProjectPhoneNumberPatchCall.html) and [*phone numbers undelete*](struct.ProjectPhoneNumberUndeleteCall.html) +//! * [*agent entity types batch delete*](struct.ProjectAgentEntityTypeBatchDeleteCall.html), [*agent entity types batch update*](struct.ProjectAgentEntityTypeBatchUpdateCall.html), [*agent entity types create*](struct.ProjectAgentEntityTypeCreateCall.html), [*agent entity types delete*](struct.ProjectAgentEntityTypeDeleteCall.html), [*agent entity types entities batch create*](struct.ProjectAgentEntityTypeEntityBatchCreateCall.html), [*agent entity types entities batch delete*](struct.ProjectAgentEntityTypeEntityBatchDeleteCall.html), [*agent entity types entities batch update*](struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html), [*agent entity types get*](struct.ProjectAgentEntityTypeGetCall.html), [*agent entity types list*](struct.ProjectAgentEntityTypeListCall.html), [*agent entity types patch*](struct.ProjectAgentEntityTypePatchCall.html), [*agent environments users sessions contexts create*](struct.ProjectAgentEnvironmentUserSessionContextCreateCall.html), [*agent environments users sessions contexts delete*](struct.ProjectAgentEnvironmentUserSessionContextDeleteCall.html), [*agent environments users sessions contexts get*](struct.ProjectAgentEnvironmentUserSessionContextGetCall.html), [*agent environments users sessions contexts list*](struct.ProjectAgentEnvironmentUserSessionContextListCall.html), [*agent environments users sessions contexts patch*](struct.ProjectAgentEnvironmentUserSessionContextPatchCall.html), [*agent environments users sessions delete contexts*](struct.ProjectAgentEnvironmentUserSessionDeleteContextCall.html), [*agent environments users sessions detect intent*](struct.ProjectAgentEnvironmentUserSessionDetectIntentCall.html), [*agent environments users sessions entity types create*](struct.ProjectAgentEnvironmentUserSessionEntityTypeCreateCall.html), [*agent environments users sessions entity types delete*](struct.ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall.html), [*agent environments users sessions entity types get*](struct.ProjectAgentEnvironmentUserSessionEntityTypeGetCall.html), [*agent environments users sessions entity types list*](struct.ProjectAgentEnvironmentUserSessionEntityTypeListCall.html), [*agent environments users sessions entity types patch*](struct.ProjectAgentEnvironmentUserSessionEntityTypePatchCall.html), [*agent export*](struct.ProjectAgentExportCall.html), [*agent import*](struct.ProjectAgentImportCall.html), [*agent intents batch delete*](struct.ProjectAgentIntentBatchDeleteCall.html), [*agent intents batch update*](struct.ProjectAgentIntentBatchUpdateCall.html), [*agent intents create*](struct.ProjectAgentIntentCreateCall.html), [*agent intents delete*](struct.ProjectAgentIntentDeleteCall.html), [*agent intents get*](struct.ProjectAgentIntentGetCall.html), [*agent intents list*](struct.ProjectAgentIntentListCall.html), [*agent intents patch*](struct.ProjectAgentIntentPatchCall.html), [*agent knowledge bases create*](struct.ProjectAgentKnowledgeBaseCreateCall.html), [*agent knowledge bases delete*](struct.ProjectAgentKnowledgeBaseDeleteCall.html), [*agent knowledge bases documents create*](struct.ProjectAgentKnowledgeBaseDocumentCreateCall.html), [*agent knowledge bases documents delete*](struct.ProjectAgentKnowledgeBaseDocumentDeleteCall.html), [*agent knowledge bases documents get*](struct.ProjectAgentKnowledgeBaseDocumentGetCall.html), [*agent knowledge bases documents list*](struct.ProjectAgentKnowledgeBaseDocumentListCall.html), [*agent knowledge bases documents patch*](struct.ProjectAgentKnowledgeBaseDocumentPatchCall.html), [*agent knowledge bases documents reload*](struct.ProjectAgentKnowledgeBaseDocumentReloadCall.html), [*agent knowledge bases get*](struct.ProjectAgentKnowledgeBaseGetCall.html), [*agent knowledge bases list*](struct.ProjectAgentKnowledgeBaseListCall.html), [*agent knowledge bases patch*](struct.ProjectAgentKnowledgeBasePatchCall.html), [*agent restore*](struct.ProjectAgentRestoreCall.html), [*agent search*](struct.ProjectAgentSearchCall.html), [*agent sessions contexts create*](struct.ProjectAgentSessionContextCreateCall.html), [*agent sessions contexts delete*](struct.ProjectAgentSessionContextDeleteCall.html), [*agent sessions contexts get*](struct.ProjectAgentSessionContextGetCall.html), [*agent sessions contexts list*](struct.ProjectAgentSessionContextListCall.html), [*agent sessions contexts patch*](struct.ProjectAgentSessionContextPatchCall.html), [*agent sessions delete contexts*](struct.ProjectAgentSessionDeleteContextCall.html), [*agent sessions detect intent*](struct.ProjectAgentSessionDetectIntentCall.html), [*agent sessions entity types create*](struct.ProjectAgentSessionEntityTypeCreateCall.html), [*agent sessions entity types delete*](struct.ProjectAgentSessionEntityTypeDeleteCall.html), [*agent sessions entity types get*](struct.ProjectAgentSessionEntityTypeGetCall.html), [*agent sessions entity types list*](struct.ProjectAgentSessionEntityTypeListCall.html), [*agent sessions entity types patch*](struct.ProjectAgentSessionEntityTypePatchCall.html), [*agent train*](struct.ProjectAgentTrainCall.html), [*get agent*](struct.ProjectGetAgentCall.html), [*knowledge bases create*](struct.ProjectKnowledgeBaseCreateCall.html), [*knowledge bases delete*](struct.ProjectKnowledgeBaseDeleteCall.html), [*knowledge bases documents create*](struct.ProjectKnowledgeBaseDocumentCreateCall.html), [*knowledge bases documents delete*](struct.ProjectKnowledgeBaseDocumentDeleteCall.html), [*knowledge bases documents get*](struct.ProjectKnowledgeBaseDocumentGetCall.html), [*knowledge bases documents list*](struct.ProjectKnowledgeBaseDocumentListCall.html), [*knowledge bases documents patch*](struct.ProjectKnowledgeBaseDocumentPatchCall.html), [*knowledge bases documents reload*](struct.ProjectKnowledgeBaseDocumentReloadCall.html), [*knowledge bases get*](struct.ProjectKnowledgeBaseGetCall.html), [*knowledge bases list*](struct.ProjectKnowledgeBaseListCall.html), [*knowledge bases patch*](struct.ProjectKnowledgeBasePatchCall.html) and [*operations get*](struct.ProjectOperationGetCall.html) //! //! //! @@ -48,18 +48,22 @@ //! //! ```ignore //! let r = hub.projects().agent_restore(...).doit() +//! let r = hub.projects().agent_train(...).doit() +//! let r = hub.projects().agent_knowledge_bases_documents_patch(...).doit() //! let r = hub.projects().agent_intents_batch_delete(...).doit() //! let r = hub.projects().knowledge_bases_documents_create(...).doit() +//! let r = hub.projects().knowledge_bases_documents_patch(...).doit() //! let r = hub.projects().knowledge_bases_documents_delete(...).doit() -//! let r = hub.projects().agent_entity_types_batch_delete(...).doit() -//! let r = hub.projects().agent_train(...).doit() -//! let r = hub.projects().agent_knowledge_bases_documents_delete(...).doit() -//! let r = hub.projects().agent_import(...).doit() -//! let r = hub.projects().agent_entity_types_batch_update(...).doit() //! let r = hub.projects().agent_export(...).doit() +//! let r = hub.projects().agent_entity_types_batch_delete(...).doit() +//! let r = hub.projects().agent_import(...).doit() +//! let r = hub.projects().agent_knowledge_bases_documents_delete(...).doit() +//! let r = hub.projects().agent_entity_types_batch_update(...).doit() //! let r = hub.projects().agent_knowledge_bases_documents_create(...).doit() +//! let r = hub.projects().agent_knowledge_bases_documents_reload(...).doit() //! let r = hub.projects().agent_intents_batch_update(...).doit() //! let r = hub.projects().agent_entity_types_entities_batch_update(...).doit() +//! let r = hub.projects().knowledge_bases_documents_reload(...).doit() //! let r = hub.projects().agent_entity_types_entities_batch_delete(...).doit() //! let r = hub.projects().operations_get(...).doit() //! let r = hub.projects().agent_entity_types_entities_batch_create(...).doit() @@ -96,7 +100,7 @@ //! extern crate hyper_rustls; //! extern crate yup_oauth2 as oauth2; //! extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -//! use dialogflow2_beta1::GoogleCloudDialogflowV2beta1RestoreAgentRequest; +//! use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Document; //! use dialogflow2_beta1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -118,12 +122,13 @@ //! // As the method needs a request, you would usually fill it with the desired information //! // into the respective structure. Some of the parts shown here might not be applicable ! //! // Values shown here are possibly random and not representative ! -//! let mut req = GoogleCloudDialogflowV2beta1RestoreAgentRequest::default(); +//! let mut req = GoogleCloudDialogflowV2beta1Document::default(); //! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.projects().agent_restore(req, "parent") +//! let result = hub.projects().agent_knowledge_bases_documents_patch(req, "name") +//! .update_mask("sed") //! .doit(); //! //! match result { @@ -246,6 +251,9 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { + /// View, manage and query your Dialogflow agents + Full, + /// View and manage your data across Google Cloud Platform services CloudPlatform, } @@ -253,6 +261,7 @@ pub enum Scope { impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { + Scope::Full => "https://www.googleapis.com/auth/dialogflow", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", } } @@ -260,7 +269,7 @@ impl AsRef for Scope { impl Default for Scope { fn default() -> Scope { - Scope::CloudPlatform + Scope::Full } } @@ -281,7 +290,7 @@ impl Default for Scope { /// extern crate hyper_rustls; /// extern crate yup_oauth2 as oauth2; /// extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1RestoreAgentRequest; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Document; /// use dialogflow2_beta1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -303,12 +312,13 @@ impl Default for Scope { /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1RestoreAgentRequest::default(); +/// let mut req = GoogleCloudDialogflowV2beta1Document::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_restore(req, "parent") +/// let result = hub.projects().agent_knowledge_bases_documents_patch(req, "name") +/// .update_mask("dolores") /// .doit(); /// /// match result { @@ -385,6 +395,94 @@ impl<'a, C, A> Dialogflow // ############ // SCHEMAS ### // ########## +/// Events allow for matching intents by event name instead of the natural +/// language input. For instance, input `` can trigger a personalized welcome response. +/// The parameter `name` may be used by the agent in the response: +/// `"Hello #welcome_event.name! What can I do for you today?"`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1EventInput { + /// Required. The language of this query. See [Language + /// Support](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// for a list of the currently supported language codes. Note that queries in + /// the same session do not necessarily need to specify the same language. + #[serde(rename="languageCode")] + pub language_code: Option, + /// Required. The unique identifier of the event. + pub name: Option, + /// Optional. The collection of parameters associated with the event. + pub parameters: Option>, +} + +impl Part for GoogleCloudDialogflowV2beta1EventInput {} + + +/// Represents a conversational agent. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get agent projects](struct.ProjectGetAgentCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1Agent { + /// Optional. The URI of the agent's avatar. + /// Avatars are used throughout the Dialogflow console and in the self-hosted + /// [Web + /// Demo](https://cloud.google.com/dialogflow-enterprise/docs/integrations/web-demo) + /// integration. + #[serde(rename="avatarUri")] + pub avatar_uri: Option, + /// Required. The name of this agent. + #[serde(rename="displayName")] + pub display_name: Option, + /// Optional. The description of this agent. + /// The maximum length is 500 characters. If exceeded, the request is rejected. + pub description: Option, + /// Required. The project of this agent. + /// Format: `projects/`. + pub parent: Option, + /// Required. The default language of the agent as a language tag. See + /// [Language + /// Support](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// for a list of the currently supported language codes. This field cannot be + /// set by the `Update` method. + #[serde(rename="defaultLanguageCode")] + pub default_language_code: Option, + /// Optional. Determines whether this agent should log conversation queries. + #[serde(rename="enableLogging")] + pub enable_logging: Option, + /// Optional. Determines how intents are detected from user queries. + #[serde(rename="matchMode")] + pub match_mode: Option, + /// Optional. The list of all languages supported by this agent (except for the + /// `default_language_code`). + #[serde(rename="supportedLanguageCodes")] + pub supported_language_codes: Option>, + /// Required. The time zone of this agent from the + /// [time zone database](https://www.iana.org/time-zones), e.g., + /// America/New_York, Europe/Paris. + #[serde(rename="timeZone")] + pub time_zone: Option, + /// Optional. To filter out false positive results and still get variety in + /// matched natural language inputs for your agent, you can tune the machine + /// learning classification threshold. If the returned score value is less than + /// the threshold value, then a fallback intent will be triggered or, if there + /// are no fallback intents defined, no intent will be triggered. The score + /// values range from 0.0 (completely uncertain) to 1.0 (completely certain). + /// If set to 0.0, the default of 0.3 is used. + #[serde(rename="classificationThreshold")] + pub classification_threshold: Option, +} + +impl ResponseResult for GoogleCloudDialogflowV2beta1Agent {} + + /// Plays audio from a file in Telephony Gateway. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -463,6 +561,106 @@ pub struct GoogleCloudDialogflowV2beta1IntentMessage { impl Part for GoogleCloudDialogflowV2beta1IntentMessage {} +/// The result of sentiment analysis as configured by +/// `sentiment_analysis_request_config`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1SentimentAnalysisResult { + /// The sentiment analysis result for `query_text`. + #[serde(rename="queryTextSentiment")] + pub query_text_sentiment: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1SentimentAnalysisResult {} + + +/// The image response message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageImage { + /// A text description of the image to be used for accessibility, + /// e.g., screen readers. Required if image_uri is set for CarouselSelect. + #[serde(rename="accessibilityText")] + pub accessibility_text: Option, + /// Optional. The public URI to an image file. + #[serde(rename="imageUri")] + pub image_uri: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageImage {} + + +/// Represents a part of a training phrase. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentTrainingPhrasePart { + /// Optional. The parameter name for the value extracted from the + /// annotated part of the example. + /// This field is required for annotated parts of the training phrase. + pub alias: Option, + /// Optional. The entity type name prefixed with `@`. + /// This field is required for annotated parts of the training phrase. + #[serde(rename="entityType")] + pub entity_type: Option, + /// Required. The text for this part. + pub text: Option, + /// Optional. Indicates whether the text was manually annotated. + /// This field is set to true when the Dialogflow Console is used to + /// manually annotate the part. When creating an annotated part with the + /// API, you must set this to true. + #[serde(rename="userDefined")] + pub user_defined: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentTrainingPhrasePart {} + + +/// An answer from Knowledge Connector. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1KnowledgeAnswersAnswer { + /// The piece of text from the `source` knowledge base document that answers + /// this conversational query. + pub answer: Option, + /// The system's confidence score that this Knowledge answer is a good match + /// for this conversational query. + /// The range is from 0.0 (completely uncertain) to 1.0 (completely certain). + /// Note: The confidence score is likely to vary somewhat (possibly even for + /// identical requests), as the underlying model is under constant + /// improvement. It may be deprecated in the future. We recommend using + /// `match_confidence_level` which should be generally more stable. + #[serde(rename="matchConfidence")] + pub match_confidence: Option, + /// The system's confidence level that this knowledge answer is a good match + /// for this conversational query. + /// NOTE: The confidence level for a given `` pair may change + /// without notice, as it depends on models that are constantly being + /// improved. However, it will change less frequently than the confidence + /// score below, and should be preferred for referencing the quality of an + /// answer. + #[serde(rename="matchConfidenceLevel")] + pub match_confidence_level: Option, + /// The corresponding FAQ question if the answer was extracted from a FAQ + /// Document, empty otherwise. + #[serde(rename="faqQuestion")] + pub faq_question: Option, + /// Indicates which Knowledge Document this answer was extracted from. + /// Format: `projects//knowledgeBases//documents/`. + pub source: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1KnowledgeAnswersAnswer {} + + /// A document resource. /// /// Note: resource `projects.agent.knowledgeBases.documents` is deprecated, @@ -474,9 +672,11 @@ impl Part for GoogleCloudDialogflowV2beta1IntentMessage {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [agent knowledge bases documents get projects](struct.ProjectAgentKnowledgeBaseDocumentGetCall.html) (response) -/// * [agent knowledge bases documents create projects](struct.ProjectAgentKnowledgeBaseDocumentCreateCall.html) (request) /// * [knowledge bases documents create projects](struct.ProjectKnowledgeBaseDocumentCreateCall.html) (request) +/// * [knowledge bases documents patch projects](struct.ProjectKnowledgeBaseDocumentPatchCall.html) (request) +/// * [agent knowledge bases documents patch projects](struct.ProjectAgentKnowledgeBaseDocumentPatchCall.html) (request) /// * [knowledge bases documents get projects](struct.ProjectKnowledgeBaseDocumentGetCall.html) (response) +/// * [agent knowledge bases documents create projects](struct.ProjectAgentKnowledgeBaseDocumentCreateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudDialogflowV2beta1Document { @@ -492,18 +692,6 @@ pub struct GoogleCloudDialogflowV2beta1Document { /// less; otherwise, the creation request fails. #[serde(rename="displayName")] pub display_name: Option, - /// The document resource name. - /// The name must be empty when creating a document. - /// Format: `projects//knowledgeBases//documents/`. - pub name: Option, - /// Required. The knowledge type of document content. - #[serde(rename="knowledgeTypes")] - pub knowledge_types: Option>, - /// The raw content of the document. This field is only permitted for - /// EXTRACTIVE_QA and FAQ knowledge types. - #[serde(rename="rawContent")] - pub raw_content: Option, /// The URI where the file content is located. /// /// For documents stored in Google Cloud Storage, these URIs must have @@ -515,56 +703,107 @@ pub struct GoogleCloudDialogflowV2beta1Document { /// Instead use the `gs://` format URI described above. #[serde(rename="contentUri")] pub content_uri: Option, + /// Required. The knowledge type of document content. + #[serde(rename="knowledgeTypes")] + pub knowledge_types: Option>, + /// The raw content of the document. This field is only permitted for + /// EXTRACTIVE_QA and FAQ knowledge types. + #[serde(rename="rawContent")] + pub raw_content: Option, + /// The document resource name. + /// The name must be empty when creating a document. + /// Format: `projects//knowledgeBases//documents/`. + pub name: Option, } impl RequestValue for GoogleCloudDialogflowV2beta1Document {} impl ResponseResult for GoogleCloudDialogflowV2beta1Document {} -/// Represents a conversation. -/// A conversation is an interaction between an agent, including live agents -/// and Dialogflow agents, and a support customer. Conversations can -/// include phone calls and text-based chat sessions. +/// The request message for EntityTypes.BatchUpdateEntities. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [conversations get projects](struct.ProjectConversationGetCall.html) (response) -/// * [conversations create projects](struct.ProjectConversationCreateCall.html) (request|response) -/// * [conversations complete projects](struct.ProjectConversationCompleteCall.html) (response) +/// * [agent entity types entities batch update projects](struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1Conversation { - /// Output only. The time the conversation was finished. - #[serde(rename="endTime")] - pub end_time: Option, - /// Output only. Required if the conversation is to be connected over - /// telephony. - #[serde(rename="phoneNumber")] - pub phone_number: Option, - /// The unique identifier of this conversation. - /// Required for all methods except `create` (`create` populates the name - /// automatically). - /// Format: `projects//conversations/`. - pub name: Option, - /// Output only. The time the conversation was started. - #[serde(rename="startTime")] - pub start_time: Option, - /// Required. The Conversation Profile to be used to configure this - /// Conversation. This field cannot be updated. - /// Format: `projects//conversationProfiles/`. - #[serde(rename="conversationProfile")] - pub conversation_profile: Option, - /// Output only. The current state of the Conversation. - #[serde(rename="lifecycleState")] - pub lifecycle_state: Option, +pub struct GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest { + /// Required. The entities to update or create. + pub entities: Option>, + /// Optional. The mask to control which fields get updated. + #[serde(rename="updateMask")] + pub update_mask: Option, + /// Optional. The language of entity synonyms defined in `entities`. If not + /// specified, the agent's default language is used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. + #[serde(rename="languageCode")] + pub language_code: Option, } -impl RequestValue for GoogleCloudDialogflowV2beta1Conversation {} -impl ResponseResult for GoogleCloudDialogflowV2beta1Conversation {} +impl RequestValue for GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest {} + + +/// The response message for Agents.SearchAgents. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent search projects](struct.ProjectAgentSearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1SearchAgentsResponse { + /// Token to retrieve the next page of results, or empty if there are no + /// more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of agents. There will be a maximum number of items returned based + /// on the page_size field in the request. + pub agents: Option>, +} + +impl ResponseResult for GoogleCloudDialogflowV2beta1SearchAgentsResponse {} + + +/// Represents knowledge base resource. +/// +/// Note: resource `projects.agent.knowledgeBases` is deprecated, please use +/// `projects.knowledgeBases` instead. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [knowledge bases get projects](struct.ProjectKnowledgeBaseGetCall.html) (response) +/// * [knowledge bases patch projects](struct.ProjectKnowledgeBasePatchCall.html) (request|response) +/// * [agent knowledge bases patch projects](struct.ProjectAgentKnowledgeBasePatchCall.html) (request|response) +/// * [knowledge bases create projects](struct.ProjectKnowledgeBaseCreateCall.html) (request|response) +/// * [agent knowledge bases create projects](struct.ProjectAgentKnowledgeBaseCreateCall.html) (request|response) +/// * [agent knowledge bases get projects](struct.ProjectAgentKnowledgeBaseGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1KnowledgeBase { + /// Required. The display name of the knowledge base. The name must be 1024 + /// bytes or less; otherwise, the creation request fails. + #[serde(rename="displayName")] + pub display_name: Option, + /// The knowledge base resource name. + /// The name must be empty when creating a knowledge base. + /// Format: `projects//knowledgeBases/`. + pub name: Option, +} + +impl RequestValue for GoogleCloudDialogflowV2beta1KnowledgeBase {} +impl ResponseResult for GoogleCloudDialogflowV2beta1KnowledgeBase {} /// Represents intent parameters. @@ -611,6 +850,29 @@ pub struct GoogleCloudDialogflowV2beta1IntentParameter { impl Part for GoogleCloudDialogflowV2beta1IntentParameter {} +/// Response message for Documents.ListDocuments. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent knowledge bases documents list projects](struct.ProjectAgentKnowledgeBaseDocumentListCall.html) (response) +/// * [knowledge bases documents list projects](struct.ProjectKnowledgeBaseDocumentListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1ListDocumentsResponse { + /// Token to retrieve the next page of results, or empty if there are no + /// more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of documents. + pub documents: Option>, +} + +impl ResponseResult for GoogleCloudDialogflowV2beta1ListDocumentsResponse {} + + /// Instructs the speech synthesizer how to generate the output audio content. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -635,26 +897,46 @@ pub struct GoogleCloudDialogflowV2beta1OutputAudioConfig { impl Part for GoogleCloudDialogflowV2beta1OutputAudioConfig {} -/// The response message for [Conversations.ListSuggestions] +/// This message is a wrapper around a collection of intents. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversations participants suggestions list projects](struct.ProjectConversationParticipantSuggestionListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListSuggestionsResponse { - /// Optional. Token to retrieve the next page of results or empty if there are - /// no more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Required. - pub suggestions: Option>, +pub struct GoogleCloudDialogflowV2beta1IntentBatch { + /// A collection of intents. + pub intents: Option>, } -impl ResponseResult for GoogleCloudDialogflowV2beta1ListSuggestionsResponse {} +impl Part for GoogleCloudDialogflowV2beta1IntentBatch {} + + +/// The collection of suggestions. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageSuggestions { + /// Required. The list of suggested replies. + pub suggestions: Option>, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageSuggestions {} + + +/// Configures the types of sentiment analysis to perform. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1SentimentAnalysisRequestConfig { + /// Optional. Instructs the service to perform sentiment analysis on + /// `query_text`. If not provided, sentiment analysis is not performed on + /// `query_text`. + #[serde(rename="analyzeQueryTextSentiment")] + pub analyze_query_text_sentiment: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1SentimentAnalysisRequestConfig {} /// Represents the parameters of the conversational query. @@ -703,84 +985,129 @@ pub struct GoogleCloudDialogflowV2beta1QueryParameters { impl Part for GoogleCloudDialogflowV2beta1QueryParameters {} -/// The response message for Conversations.ListConversations. +/// Represents the natural language text to be processed. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversations list projects](struct.ProjectConversationListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListConversationsResponse { - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of conversations. There will be a maximum number of items - /// returned based on the page_size field in the request. - pub conversations: Option>, +pub struct GoogleCloudDialogflowV2beta1TextInput { + /// Required. The language of this conversational query. See [Language + /// Support](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// for a list of the currently supported language codes. Note that queries in + /// the same session do not necessarily need to specify the same language. + #[serde(rename="languageCode")] + pub language_code: Option, + /// Required. The UTF-8 encoded natural language text to be processed. + /// Text length must not exceed 256 characters. + pub text: Option, } -impl ResponseResult for GoogleCloudDialogflowV2beta1ListConversationsResponse {} +impl Part for GoogleCloudDialogflowV2beta1TextInput {} -/// The response message for HumanAgentAssistants.ListHumanAgentAssistants. +/// Represents an entity type. +/// Entity types serve as a tool for extracting parameter values from natural +/// language queries. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [human agent assistants list projects](struct.ProjectHumanAgentAssistantListCall.html) (response) +/// * [agent entity types get projects](struct.ProjectAgentEntityTypeGetCall.html) (response) +/// * [agent entity types patch projects](struct.ProjectAgentEntityTypePatchCall.html) (request|response) +/// * [agent entity types create projects](struct.ProjectAgentEntityTypeCreateCall.html) (request|response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListHumanAgentAssistantsResponse { - /// Token to retrieve the next page of results or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of project agent assistants. There is a maximum number of - /// items returned based on the page_size field in the request. - #[serde(rename="humanAgentAssistants")] - pub human_agent_assistants: Option>, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1ListHumanAgentAssistantsResponse {} - - -/// Represents a human agent assistant that provides suggestions to help -/// human agents to resolve customer issues. This defines the types of content -/// that the human agent assistant can present to a human agent. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [human agent assistants create projects](struct.ProjectHumanAgentAssistantCreateCall.html) (request|response) -/// * [human agent assistants get projects](struct.ProjectHumanAgentAssistantGetCall.html) (response) -/// * [human agent assistants patch projects](struct.ProjectHumanAgentAssistantPatchCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1HumanAgentAssistant { - /// Optional. Settings for knowledge service. - #[serde(rename="faqAnswersConfig")] - pub faq_answers_config: Option, - /// Required for all methods except `create` (`create` populates the name - /// automatically). - /// The unique identifier of human agent assistant. - /// Format: `projects//humanAgentAssistants/`. +pub struct GoogleCloudDialogflowV2beta1EntityType { + /// Optional. Indicates whether the entity type can be automatically + /// expanded. + #[serde(rename="autoExpansionMode")] + pub auto_expansion_mode: Option, + /// Optional. The collection of entity entries associated with the entity type. + pub entities: Option>, + /// Required. Indicates the kind of entity type. + pub kind: Option, + /// Required. The name of the entity type. + #[serde(rename="displayName")] + pub display_name: Option, + /// The unique identifier of the entity type. + /// Required for EntityTypes.UpdateEntityType and + /// EntityTypes.BatchUpdateEntityTypes methods. + /// Format: `projects//agent/entityTypes/`. pub name: Option, - /// Optional. Settings for article suggestion. - #[serde(rename="articleSuggestionConfig")] - pub article_suggestion_config: Option, } -impl RequestValue for GoogleCloudDialogflowV2beta1HumanAgentAssistant {} -impl ResponseResult for GoogleCloudDialogflowV2beta1HumanAgentAssistant {} +impl RequestValue for GoogleCloudDialogflowV2beta1EntityType {} +impl ResponseResult for GoogleCloudDialogflowV2beta1EntityType {} + + +/// Transfers the call in Telephony Gateway. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageTelephonyTransferCall { + /// Required. The phone number to transfer the call to + /// in [E.164 format](https://en.wikipedia.org/wiki/E.164). + /// + /// We currently only allow transferring to US numbers (+1xxxyyyzzzz). + #[serde(rename="phoneNumber")] + pub phone_number: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageTelephonyTransferCall {} + + +/// The message returned from the DetectIntent method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent environments users sessions detect intent projects](struct.ProjectAgentEnvironmentUserSessionDetectIntentCall.html) (response) +/// * [agent sessions detect intent projects](struct.ProjectAgentSessionDetectIntentCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1DetectIntentResponse { + /// Instructs the speech synthesizer how to generate the output audio. This + /// field is populated from the agent-level speech synthesizer configuration, + /// if enabled. + #[serde(rename="outputAudioConfig")] + pub output_audio_config: Option, + /// The audio data bytes encoded as specified in the request. + /// Note: The output audio is generated based on the values of default platform + /// text responses found in the `query_result.fulfillment_messages` field. If + /// multiple default text responses exist, they will be concatenated when + /// generating audio. If no default platform text responses exist, the + /// generated audio content will be empty. + #[serde(rename="outputAudio")] + pub output_audio: Option, + /// The selected results of the conversational query or event processing. + /// See `alternative_query_results` for additional potential results. + #[serde(rename="queryResult")] + pub query_result: Option, + /// If Knowledge Connectors are enabled, there could be more than one result + /// returned for a given query or event, and this field will contain all + /// results except for the top one, which is captured in query_result. The + /// alternative results are ordered by decreasing + /// `QueryResult.intent_detection_confidence`. If Knowledge Connectors are + /// disabled, this field will be empty until multiple responses for regular + /// intents are supported, at which point those additional results will be + /// surfaced here. + #[serde(rename="alternativeQueryResults")] + pub alternative_query_results: Option>, + /// Specifies the status of the webhook request. + #[serde(rename="webhookStatus")] + pub webhook_status: Option, + /// The unique identifier of the response. It can be used to + /// locate a response in the training example set or for reporting issues. + #[serde(rename="responseId")] + pub response_id: Option, +} + +impl ResponseResult for GoogleCloudDialogflowV2beta1DetectIntentResponse {} /// The request message for Agents.TrainAgent. @@ -798,42 +1125,57 @@ pub struct GoogleCloudDialogflowV2beta1TrainAgentRequest { _never_set: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1AutomatedAgentReply {} - - -/// The response message for PhoneNumbers.ListPhoneNumbers. +/// Request message for Documents.ReloadDocument. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [phone numbers list projects](struct.ProjectPhoneNumberListCall.html) (response) +/// * [knowledge bases documents reload projects](struct.ProjectKnowledgeBaseDocumentReloadCall.html) (request) +/// * [agent knowledge bases documents reload projects](struct.ProjectAgentKnowledgeBaseDocumentReloadCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListPhoneNumbersResponse { - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of `PhoneNumber` resources. There is a maximum number of items - /// returned based on the page_size field in the request. - #[serde(rename="phoneNumbers")] - pub phone_numbers: Option>, +pub struct GoogleCloudDialogflowV2beta1ReloadDocumentRequest { _never_set: Option } + +impl RequestValue for GoogleCloudDialogflowV2beta1ReloadDocumentRequest {} + + +/// The basic card message. Useful for displaying information. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageBasicCard { + /// Optional. The collection of card buttons. + pub buttons: Option>, + /// Required, unless image is present. The body text of the card. + #[serde(rename="formattedText")] + pub formatted_text: Option, + /// Optional. The image for the card. + pub image: Option, + /// Optional. The subtitle of the card. + pub subtitle: Option, + /// Optional. The title of the card. + pub title: Option, } -impl ResponseResult for GoogleCloudDialogflowV2beta1ListPhoneNumbersResponse {} +impl Part for GoogleCloudDialogflowV2beta1IntentMessageBasicCard {} + + +/// The card for presenting a list of options to select from. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageListSelect { + /// Required. List items. + pub items: Option>, + /// Optional. The overall title of the list. + pub title: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageListSelect {} /// Represents an intent. @@ -898,21 +1240,13 @@ pub struct GoogleCloudDialogflowV2beta1Intent { /// Required. The name of this intent. #[serde(rename="displayName")] pub display_name: Option, - /// Required for all methods except `create` (`create` populates the name - /// automatically. /// The unique identifier of this intent. + /// Required for Intents.UpdateIntent and Intents.BatchUpdateIntents + /// methods. /// Format: `projects//agent/intents/`. pub name: Option, /// Optional. The collection of parameters associated with the intent. pub parameters: Option>, - /// Optional. The collection of examples/templates that the agent is - /// trained on. - #[serde(rename="trainingPhrases")] - pub training_phrases: Option>, - /// Read-only. Information about all followup intents that have this intent as - /// a direct or indirect parent. We populate this field only in the output. - #[serde(rename="followupIntentInfo")] - pub followup_intent_info: Option>, /// Read-only after creation. The unique identifier of the parent intent in the /// chain of followup intents. You can set this field when creating an intent, /// for example with CreateIntent or BatchUpdateIntents, in order to @@ -922,11 +1256,22 @@ pub struct GoogleCloudDialogflowV2beta1Intent { /// Format: `projects//agent/intents/`. #[serde(rename="parentFollowupIntentName")] pub parent_followup_intent_name: Option, + /// Read-only. Information about all followup intents that have this intent as + /// a direct or indirect parent. We populate this field only in the output. + #[serde(rename="followupIntentInfo")] + pub followup_intent_info: Option>, + /// Optional. The collection of examples that the agent is + /// trained on. + #[serde(rename="trainingPhrases")] + pub training_phrases: Option>, /// Optional. The collection of rich messages corresponding to the /// `Response` field in the Dialogflow console. pub messages: Option>, /// Optional. The priority of this intent. Higher numbers represent higher - /// priorities. Zero or negative numbers mean that the intent is disabled. + /// priorities. If this is zero or unspecified, we use the default + /// priority 500000. + /// + /// Negative numbers mean that the intent is disabled. pub priority: Option, /// Read-only. The unique identifier of the root intent in the chain of /// followup intents. It identifies the correct followup intents chain for @@ -969,9 +1314,10 @@ pub struct GoogleCloudDialogflowV2beta1BatchCreateEntitiesRequest { pub entities: Option>, /// Optional. The language of entity synonyms defined in `entities`. If not /// specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. #[serde(rename="languageCode")] pub language_code: Option, } @@ -979,22 +1325,76 @@ pub struct GoogleCloudDialogflowV2beta1BatchCreateEntitiesRequest { impl RequestValue for GoogleCloudDialogflowV2beta1BatchCreateEntitiesRequest {} -/// Represents an example or template that the agent is trained on. +/// The request message for Intents.BatchUpdateIntents. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent intents batch update projects](struct.ProjectAgentIntentBatchUpdateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1BatchUpdateIntentsRequest { + /// Optional. The language of training phrases, parameters and rich messages + /// defined in `intents`. If not specified, the agent's default language is + /// used. [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. + #[serde(rename="languageCode")] + pub language_code: Option, + /// The URI to a Google Cloud Storage file containing intents to update or + /// create. The file format can either be a serialized proto (of IntentBatch + /// type) or JSON object. Note: The URI must start with "gs://". + #[serde(rename="intentBatchUri")] + pub intent_batch_uri: Option, + /// The collection of intents to update or create. + #[serde(rename="intentBatchInline")] + pub intent_batch_inline: Option, + /// Optional. The mask to control which fields get updated. + #[serde(rename="updateMask")] + pub update_mask: Option, + /// Optional. The resource view to apply to the returned intent. + #[serde(rename="intentView")] + pub intent_view: Option, +} + +impl RequestValue for GoogleCloudDialogflowV2beta1BatchUpdateIntentsRequest {} + + +/// Represents an example that the agent is trained on. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudDialogflowV2beta1IntentTrainingPhrase { - /// Required. The collection of training phrase parts (can be annotated). - /// Fields: `entity_type`, `alias` and `user_defined` should be populated - /// only for the annotated parts of the training phrase. + /// Required. The ordered list of training phrase parts. + /// The parts are concatenated in order to form the training phrase. + /// + /// Note: The API does not automatically annotate training phrases like the + /// Dialogflow Console does. + /// + /// Note: Do not forget to include whitespace at part boundaries, + /// so the training phrase is well formatted when the parts are concatenated. + /// + /// If the training phrase does not need to be annotated with parameters, + /// you just need a single part with only the Part.text field set. + /// + /// If you want to annotate the training phrase, you must create multiple + /// parts, where the fields of each part are populated in one of two ways: + /// + /// - `Part.text` is set to a part of the phrase that has no parameters. + /// - `Part.text` is set to a part of the phrase that you want to annotate, + /// and the `entity_type`, `alias`, and `user_defined` fields are all + /// set. pub parts: Option>, /// Required. The type of the training phrase. #[serde(rename="type")] pub type_: Option, /// Output only. The unique identifier of this training phrase. pub name: Option, - /// Optional. Indicates how many times this example or template was added to + /// Optional. Indicates how many times this example was added to /// the intent. Each time a developer adds an existing sample by editing an /// intent or training, this counter is increased. #[serde(rename="timesAddedCount")] @@ -1023,27 +1423,160 @@ pub struct GoogleTypeLatLng { impl Part for GoogleTypeLatLng {} -/// The response message for Conversations.ListParticipants. +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleRpcStatus { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for GoogleRpcStatus {} + + +/// The suggestion chip message that the user can tap to quickly post a reply +/// to the conversation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageSuggestion { + /// Required. The text shown the in the suggestion chip. + pub title: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageSuggestion {} + + +/// The request message for EntityTypes.BatchUpdateEntityTypes. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [conversations participants list projects](struct.ProjectConversationParticipantListCall.html) (response) +/// * [agent entity types batch update projects](struct.ProjectAgentEntityTypeBatchUpdateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListParticipantsResponse { - /// Token to retrieve the next page of results or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of participants. There is a maximum number of items - /// returned based on the page_size field in the request. - pub participants: Option>, +pub struct GoogleCloudDialogflowV2beta1BatchUpdateEntityTypesRequest { + /// Optional. The language of entity synonyms defined in `entity_types`. If not + /// specified, the agent's default language is used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. + #[serde(rename="languageCode")] + pub language_code: Option, + /// The URI to a Google Cloud Storage file containing entity types to update + /// or create. The file format can either be a serialized proto (of + /// EntityBatch type) or a JSON object. Note: The URI must start with + /// "gs://". + #[serde(rename="entityTypeBatchUri")] + pub entity_type_batch_uri: Option, + /// The collection of entity types to update or create. + #[serde(rename="entityTypeBatchInline")] + pub entity_type_batch_inline: Option, + /// Optional. The mask to control which fields get updated. + #[serde(rename="updateMask")] + pub update_mask: Option, } -impl ResponseResult for GoogleCloudDialogflowV2beta1ListParticipantsResponse {} +impl RequestValue for GoogleCloudDialogflowV2beta1BatchUpdateEntityTypesRequest {} + + +/// The sentiment, such as positive/negative feeling or association, for a unit +/// of analysis, such as the query text. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1Sentiment { + /// A non-negative number in the [0, +inf) range, which represents the absolute + /// magnitude of sentiment, regardless of score (positive or negative). + pub magnitude: Option, + /// Sentiment score between -1.0 (negative sentiment) and 1.0 (positive + /// sentiment). + pub score: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1Sentiment {} + + +/// The collection of simple response candidates. +/// This message in `QueryResult.fulfillment_messages` and +/// `WebhookResponse.fulfillment_messages` should contain only one +/// `SimpleResponse`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageSimpleResponses { + /// Required. The list of simple responses. + #[serde(rename="simpleResponses")] + pub simple_responses: Option>, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageSimpleResponses {} /// This message is a wrapper around a collection of entity types. @@ -1072,16 +1605,16 @@ impl Part for GoogleCloudDialogflowV2beta1EntityTypeBatch {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudDialogflowV2beta1DetectIntentRequest { - /// Optional. Instructs the speech synthesizer how to generate the output - /// audio. If this field is not set and agent-level speech synthesizer is not - /// configured, no output audio is generated. - #[serde(rename="outputAudioConfig")] - pub output_audio_config: Option, /// Optional. The natural language speech audio to be processed. This field /// should be populated iff `query_input` is set to an input audio config. /// A single request can contain up to 1 minute of speech audio data. #[serde(rename="inputAudio")] pub input_audio: Option, + /// Optional. Instructs the speech synthesizer how to generate the output + /// audio. If this field is not set and agent-level speech synthesizer is not + /// configured, no output audio is generated. + #[serde(rename="outputAudioConfig")] + pub output_audio_config: Option, /// Required. The input specification. It can be set to: /// /// 1. an audio config @@ -1100,140 +1633,283 @@ pub struct GoogleCloudDialogflowV2beta1DetectIntentRequest { impl RequestValue for GoogleCloudDialogflowV2beta1DetectIntentRequest {} -/// Defines logging behavior for conversation lifecycle events. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1LoggingConfig { _never_set: Option } - -impl Part for GoogleCloudDialogflowV2beta1LoggingConfig {} - - -/// The request message for PhoneNumbers.UndeletePhoneNumber. +/// The response message for Intents.ListIntents. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [phone numbers undelete projects](struct.ProjectPhoneNumberUndeleteCall.html) (request) +/// * [agent intents list projects](struct.ProjectAgentIntentListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1UndeletePhoneNumberRequest { _never_set: Option } - -impl RequestValue for GoogleCloudDialogflowV2beta1UndeletePhoneNumberRequest {} - - -/// Represents a suggestion for a human agent. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1Suggestion { - /// Output only. Articles ordered by score in descending order. - pub articles: Option>, - /// Optional. Answers extracted from FAQ documents. - #[serde(rename="faqAnswers")] - pub faq_answers: Option>, - /// Output only. The name of this suggestion. Format: - /// `projects//conversations//participants/*/suggestions/`. - pub name: Option, - /// Output only. The time the suggestion was created. - #[serde(rename="createTime")] - pub create_time: Option, +pub struct GoogleCloudDialogflowV2beta1ListIntentsResponse { + /// Token to retrieve the next page of results, or empty if there are no + /// more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of agent intents. There will be a maximum number of items + /// returned based on the page_size field in the request. + pub intents: Option>, } -impl Part for GoogleCloudDialogflowV2beta1Suggestion {} +impl ResponseResult for GoogleCloudDialogflowV2beta1ListIntentsResponse {} -/// Contains a speech recognition result corresponding to a portion of the audio -/// that is currently being processed or an indication that this is the end -/// of the single requested utterance. -/// -/// Example: -/// -/// 1. transcript: "tube" -/// -/// 2. transcript: "to be a" -/// -/// 3. transcript: "to be" -/// -/// 4. transcript: "to be or not to be" -/// is_final: true -/// -/// 5. transcript: " that's" -/// -/// 6. transcript: " that is" -/// -/// 7. recognition_event_type: `RECOGNITION_EVENT_END_OF_SINGLE_UTTERANCE` -/// -/// 8. transcript: " that is the question" -/// is_final: true -/// -/// Only two of the responses contain final results (#4 and #8 indicated by -/// `is_final: true`). Concatenating these generates the full transcript: "to be -/// or not to be that is the question". -/// -/// In each response we populate: -/// -/// * for `MESSAGE_TYPE_TRANSCRIPT`: `transcript` and possibly `is_final`. -/// -/// * for `MESSAGE_TYPE_END_OF_SINGLE_UTTERANCE`: only `event_type`. +/// The simple response message containing speech or text. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1StreamingRecognitionResult { - /// The Speech confidence between 0.0 and 1.0 for the current portion of audio. - /// A higher number indicates an estimated greater likelihood that the - /// recognized words are correct. The default of 0.0 is a sentinel value - /// indicating that confidence was not set. +pub struct GoogleCloudDialogflowV2beta1IntentMessageSimpleResponse { + /// One of text_to_speech or ssml must be provided. Structured spoken + /// response to the user in the SSML format. Mutually exclusive with + /// text_to_speech. + pub ssml: Option, + /// One of text_to_speech or ssml must be provided. The plain text of the + /// speech output. Mutually exclusive with ssml. + #[serde(rename="textToSpeech")] + pub text_to_speech: Option, + /// Optional. The text to display. + #[serde(rename="displayText")] + pub display_text: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageSimpleResponse {} + + +/// An item in the list. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageListSelectItem { + /// Required. Additional information about this option. + pub info: Option, + /// Optional. The image to display. + pub image: Option, + /// Optional. The main text describing the item. + pub description: Option, + /// Required. The title of the list item. + pub title: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageListSelectItem {} + + +/// The request message for Agents.RestoreAgent. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent restore projects](struct.ProjectAgentRestoreCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1RestoreAgentRequest { + /// The URI to a Google Cloud Storage file containing the agent to restore. + /// Note: The URI must start with "gs://". + #[serde(rename="agentUri")] + pub agent_uri: Option, + /// The agent to restore. /// - /// This field is typically only provided if `is_final` is true and you should - /// not rely on it being accurate or even set. - pub confidence: Option, - /// Transcript text representing the words that the user spoke. - /// Populated if and only if `event_type` = `RECOGNITION_EVENT_TRANSCRIPT`. - pub transcript: Option, - /// Type of the result message. - #[serde(rename="messageType")] - pub message_type: Option, - /// The default of 0.0 is a sentinel value indicating `confidence` was not set. - /// If `false`, the `StreamingRecognitionResult` represents an - /// interim result that may change. If `true`, the recognizer will not return - /// any further hypotheses about this piece of the audio. May only be populated - /// for `event_type` = `RECOGNITION_EVENT_TRANSCRIPT`. - #[serde(rename="isFinal")] - pub is_final: Option, + /// Example for how to restore an agent via the command line: + ///
curl \
+    ///   'https://dialogflow.googleapis.com/v2beta1/projects/<project_name>/agent:restore\
+    ///    -X POST \
+    ///    -H 'Authorization: Bearer '$(gcloud auth application-default
+    ///    print-access-token) \
+    ///    -H 'Accept: application/json' \
+    ///    -H 'Content-Type: application/json' \
+    ///    --compressed \
+    ///    --data-binary "{
+    ///        'agentContent': '$(cat <agent zip file> | base64 -w 0)'
+    ///    }"
+ #[serde(rename="agentContent")] + pub agent_content: Option, } -impl Part for GoogleCloudDialogflowV2beta1StreamingRecognitionResult {} +impl RequestValue for GoogleCloudDialogflowV2beta1RestoreAgentRequest {} -/// Represents a single side of the conversation. +/// Response message for KnowledgeBases.ListKnowledgeBases. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [conversations participants get projects](struct.ProjectConversationParticipantGetCall.html) (response) -/// * [conversations participants create projects](struct.ProjectConversationParticipantCreateCall.html) (request|response) +/// * [agent knowledge bases list projects](struct.ProjectAgentKnowledgeBaseListCall.html) (response) +/// * [knowledge bases list projects](struct.ProjectKnowledgeBaseListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1Participant { - /// Required. The role this participant plays in the conversation. - pub role: Option, - /// Required. The unique identifier of this participant. - /// Format: `projects//conversations//participants/`. - pub name: Option, +pub struct GoogleCloudDialogflowV2beta1ListKnowledgeBasesResponse { + /// Token to retrieve the next page of results, or empty if there are no + /// more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of knowledge bases. + #[serde(rename="knowledgeBases")] + pub knowledge_bases: Option>, } -impl RequestValue for GoogleCloudDialogflowV2beta1Participant {} -impl ResponseResult for GoogleCloudDialogflowV2beta1Participant {} +impl ResponseResult for GoogleCloudDialogflowV2beta1ListKnowledgeBasesResponse {} + + +/// Synthesizes speech and plays back the synthesized audio to the caller in +/// Telephony Gateway. +/// +/// Telephony Gateway takes the synthesizer settings from +/// `DetectIntentResponse.output_audio_config` which can either be set +/// at request-level or can come from the agent-level synthesizer config. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageTelephonySynthesizeSpeech { + /// The SSML to be synthesized. For more information, see + /// [SSML](https://developers.google.com/actions/reference/ssml). + pub ssml: Option, + /// The raw text to be synthesized. + pub text: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageTelephonySynthesizeSpeech {} + + +/// The response message for SessionEntityTypes.ListSessionEntityTypes. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent environments users sessions entity types list projects](struct.ProjectAgentEnvironmentUserSessionEntityTypeListCall.html) (response) +/// * [agent sessions entity types list projects](struct.ProjectAgentSessionEntityTypeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1ListSessionEntityTypesResponse { + /// Token to retrieve the next page of results, or empty if there are no + /// more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of session entity types. There will be a maximum number of items + /// returned based on the page_size field in the request. + #[serde(rename="sessionEntityTypes")] + pub session_entity_types: Option>, +} + +impl ResponseResult for GoogleCloudDialogflowV2beta1ListSessionEntityTypesResponse {} + + +/// Instructs the speech recognizer how to process the audio content. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1InputAudioConfig { + /// Optional. The collection of phrase hints which are used to boost accuracy + /// of speech recognition. + /// Refer to + /// [Cloud Speech API + /// documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + /// for more details. + #[serde(rename="phraseHints")] + pub phrase_hints: Option>, + /// Required. The language of the supplied audio. Dialogflow does not do + /// translations. See [Language + /// Support](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// for a list of the currently supported language codes. Note that queries in + /// the same session do not necessarily need to specify the same language. + #[serde(rename="languageCode")] + pub language_code: Option, + /// Optional. Which Speech model to select for the given request. Select the + /// model best suited to your domain to get best results. If a model is not + /// explicitly specified, then we auto-select a model based on the parameters + /// in the InputAudioConfig. + /// If enhanced speech model is enabled for the agent and an enhanced + /// version of the specified model for the language does not exist, then the + /// speech is recognized using the standard version of the specified model. + /// Refer to + /// [Cloud Speech API + /// documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + /// for more details. + pub model: Option, + /// Required. Audio encoding of the audio content to process. + #[serde(rename="audioEncoding")] + pub audio_encoding: Option, + /// Required. Sample rate (in Hertz) of the audio content sent in the query. + /// Refer to + /// [Cloud Speech API + /// documentation](https://cloud.google.com/speech-to-text/docs/basics) for + /// more details. + #[serde(rename="sampleRateHertz")] + pub sample_rate_hertz: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1InputAudioConfig {} + + +/// The suggestion chip message that allows the user to jump out to the app +/// or website associated with this agent. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageLinkOutSuggestion { + /// Required. The URI of the app or site to open when the user taps the + /// suggestion chip. + pub uri: Option, + /// Required. The name of the app or site this chip is linking to. + #[serde(rename="destinationName")] + pub destination_name: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageLinkOutSuggestion {} + + +/// The request message for Intents.BatchDeleteIntents. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent intents batch delete projects](struct.ProjectAgentIntentBatchDeleteCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest { + /// Required. The collection of intents to delete. Only intent `name` must be + /// filled in. + pub intents: Option>, +} + +impl RequestValue for GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest {} + + +/// The response message for Contexts.ListContexts. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent environments users sessions contexts list projects](struct.ProjectAgentEnvironmentUserSessionContextListCall.html) (response) +/// * [agent sessions contexts list projects](struct.ProjectAgentSessionContextListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1ListContextsResponse { + /// The list of contexts. There will be a maximum number of items + /// returned based on the page_size field in the request. + pub contexts: Option>, + /// Token to retrieve the next page of results, or empty if there are no + /// more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} + +impl ResponseResult for GoogleCloudDialogflowV2beta1ListContextsResponse {} /// The card response message. @@ -1256,40 +1932,6 @@ pub struct GoogleCloudDialogflowV2beta1IntentMessageCard { impl Part for GoogleCloudDialogflowV2beta1IntentMessageCard {} -/// The response message for -/// HumanAgentAssistants.RequestCompileSuggestions -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [human agent assistants compile suggestions projects](struct.ProjectHumanAgentAssistantCompileSuggestionCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1CompileSuggestionsResponse { - /// Required. - pub suggestions: Option>, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1CompileSuggestionsResponse {} - - -/// Defines article suggestions that a human agent assistant can provide. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ArticleSuggestionConfig { - /// Required. Settings for knowledge base, Format: - /// `projects//knowledgeBases/`. - #[serde(rename="knowledgeBaseName")] - pub knowledge_base_name: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1ArticleSuggestionConfig {} - - /// The card for presenting a carousel of options to select from. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1321,30 +1963,6 @@ pub struct GoogleCloudDialogflowV2beta1IntentMessageSelectItemInfo { impl Part for GoogleCloudDialogflowV2beta1IntentMessageSelectItemInfo {} -/// The response message for ConversationProfiles.ListConversationProfiles. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversation profiles list projects](struct.ProjectConversationProfileListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListConversationProfilesResponse { - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of project conversation profiles. There is a maximum number - /// of items returned based on the page_size field in the request. - #[serde(rename="conversationProfiles")] - pub conversation_profiles: Option>, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1ListConversationProfilesResponse {} - - /// The request message for Agents.ExportAgent. /// /// # Activities @@ -1368,97 +1986,112 @@ pub struct GoogleCloudDialogflowV2beta1ExportAgentRequest { impl RequestValue for GoogleCloudDialogflowV2beta1ExportAgentRequest {} -/// Defines the Automated Agent to connect to a conversation. +/// Represents the result of conversational query or event processing. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1AutomatedAgentConfig { - /// Required. ID of the Dialogflow agent environment to use. +pub struct GoogleCloudDialogflowV2beta1QueryResult { + /// The language that was triggered during intent detection. + /// See [Language + /// Support](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// for a list of the currently supported language codes. + #[serde(rename="languageCode")] + pub language_code: Option, + /// The text to be pronounced to the user or shown on the screen. + /// Note: This is a legacy field, `fulfillment_messages` should be preferred. + #[serde(rename="fulfillmentText")] + pub fulfillment_text: Option, + /// This field is set to: + /// - `false` if the matched intent has required parameters and not all of + /// the required parameter values have been collected. + /// - `true` if all required parameter values have been collected, or if the + /// matched intent doesn't contain any required parameters. + #[serde(rename="allRequiredParamsPresent")] + pub all_required_params_present: Option, + /// The collection of rich messages to present to the user. + #[serde(rename="fulfillmentMessages")] + pub fulfillment_messages: Option>, + /// The action name from the matched intent. + pub action: Option, + /// The intent that matched the conversational query. Some, not + /// all fields are filled in this message, including but not limited to: + /// `name`, `display_name` and `webhook_state`. + pub intent: Option, + /// The free-form diagnostic info. For example, this field could contain + /// webhook call latency. The string keys of the Struct's fields map can change + /// without notice. + #[serde(rename="diagnosticInfo")] + pub diagnostic_info: Option>, + /// The collection of output contexts. If applicable, + /// `output_contexts.parameters` contains entries with name + /// `.original` containing the original parameter values + /// before the query. + #[serde(rename="outputContexts")] + pub output_contexts: Option>, + /// The result from Knowledge Connector (if any), ordered by decreasing + /// `KnowledgeAnswers.match_confidence`. + #[serde(rename="knowledgeAnswers")] + pub knowledge_answers: Option, + /// The sentiment analysis result, which depends on the + /// `sentiment_analysis_request_config` specified in the request. + #[serde(rename="sentimentAnalysisResult")] + pub sentiment_analysis_result: Option, + /// If the query was fulfilled by a webhook call, this field is set to the + /// value of the `payload` field returned in the webhook response. + #[serde(rename="webhookPayload")] + pub webhook_payload: Option>, + /// The collection of extracted parameters. + pub parameters: Option>, + /// The Speech recognition confidence between 0.0 and 1.0. A higher number + /// indicates an estimated greater likelihood that the recognized words are + /// correct. The default of 0.0 is a sentinel value indicating that confidence + /// was not set. /// - /// This project needs to either be the same project as the conversation or you - /// need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API - /// Service Agent` role in this project. - /// - /// Format: `projects//agent/environments/` - /// If environment is not specified, the default `draft` environment is - /// used. Refer to - /// [DetectIntentRequest](/dialogflow-enterprise/docs/reference/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.DetectIntentRequest) - /// for more details. - pub agent: Option, + /// This field is not guaranteed to be accurate or set. In particular this + /// field isn't set for StreamingDetectIntent since the streaming endpoint has + /// separate confidence estimates per portion of the audio in + /// StreamingRecognitionResult. + #[serde(rename="speechRecognitionConfidence")] + pub speech_recognition_confidence: Option, + /// The intent detection confidence. Values range from 0.0 + /// (completely uncertain) to 1.0 (completely certain). + /// If there are `multiple knowledge_answers` messages, this value is set to + /// the greatest `knowledgeAnswers.match_confidence` value in the list. + #[serde(rename="intentDetectionConfidence")] + pub intent_detection_confidence: Option, + /// The original conversational query text: + /// - If natural language text was provided as input, `query_text` contains + /// a copy of the input. + /// - If natural language speech audio was provided as input, `query_text` + /// contains the speech recognition result. If speech recognizer produced + /// multiple alternatives, a particular one is picked. + /// - If an event was provided as input, `query_text` is not set. + #[serde(rename="queryText")] + pub query_text: Option, + /// If the query was fulfilled by a webhook call, this field is set to the + /// value of the `source` field returned in the webhook response. + #[serde(rename="webhookSource")] + pub webhook_source: Option, } -impl Part for GoogleCloudDialogflowV2beta1AutomatedAgentConfig {} +impl Part for GoogleCloudDialogflowV2beta1QueryResult {} -/// The request message for Conversations.AnalyzeContent. +/// Optional. Contains information about a button. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversations participants analyze content projects](struct.ProjectConversationParticipantAnalyzeContentCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1AnalyzeContentRequest { - /// Optional. Instructs the speech synthesizer how to generate the output - /// audio. - #[serde(rename="replyAudioConfig")] - pub reply_audio_config: Option, - /// The natural language text to be processed. - pub text: Option, - /// The natural language speech audio to be processed. - pub audio: Option, +pub struct GoogleCloudDialogflowV2beta1IntentMessageCardButton { + /// Optional. The text to show on the button. + pub text: Option, + /// Optional. The text to send back to the Dialogflow API or a URI to + /// open. + pub postback: Option, } -impl RequestValue for GoogleCloudDialogflowV2beta1AnalyzeContentRequest {} - - -/// The top-level message returned from the `StreamingAnalyzeContent` method. -/// -/// Multiple response messages can be returned in order: -/// -/// 1. If the input was set to streaming audio, the first one or more messages -/// contain `recognition_result`. Each `recognition_result` represents a more -/// complete transcript of what the user said. The last `recognition_result` -/// has `is_final` set to `true`. -/// -/// 2. The next message contains `reply_text` and optionally `reply_audio` -/// returned by an agent. This message may also contain -/// `automated_agent_reply`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversations participants streaming analyze content projects](struct.ProjectConversationParticipantStreamingAnalyzeContentCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1StreamingAnalyzeContentResponse { - /// Optional. The output text content. - /// This field is set if an automated agent responded with a text for the user. - #[serde(rename="replyText")] - pub reply_text: Option, - /// Optional. The audio data bytes encoded as specified in the request. - /// This field is set if: - /// - The `reply_audio_config` field is specified in the request. - /// - The automated agent, which this output comes from, responded with audio. - /// In such case, the `reply_audio.config` field contains settings used to - /// synthesize the speech. - #[serde(rename="replyAudio")] - pub reply_audio: Option, - /// The result of speech recognition. - #[serde(rename="recognitionResult")] - pub recognition_result: Option, - /// Optional. Only set if a Dialogflow automated agent has responded. - #[serde(rename="automatedAgentReply")] - pub automated_agent_reply: Option, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1StreamingAnalyzeContentResponse {} +impl Part for GoogleCloudDialogflowV2beta1IntentMessageCardButton {} /// The response message for EntityTypes.ListEntityTypes. @@ -1505,22 +2138,36 @@ pub struct GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest { impl RequestValue for GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest {} -/// Defines FAQ responses that a human agent assistant can provide. +/// An **entity entry** for an associated entity type. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1FaqAnswersConfig { - /// Optional. Maximum number of results to return. If unset, defaults to 10. - #[serde(rename="maxResults")] - pub max_results: Option, - /// Required. Settings for knowledge base, Format: - /// `projects//knowledgeBases/`. - #[serde(rename="knowledgeBaseName")] - pub knowledge_base_name: Option, +pub struct GoogleCloudDialogflowV2beta1EntityTypeEntity { + /// Required. A collection of value synonyms. For example, if the entity type + /// is *vegetable*, and `value` is *scallions*, a synonym could be *green + /// onions*. + /// + /// For `KIND_LIST` entity types: + /// + /// * This collection must contain exactly one synonym equal to `value`. + pub synonyms: Option>, + /// Required. The primary value associated with this entity entry. + /// For example, if the entity type is *vegetable*, the value could be + /// *scallions*. + /// + /// For `KIND_MAP` entity types: + /// + /// * A canonical value to be used in place of synonyms. + /// + /// For `KIND_LIST` entity types: + /// + /// * A string that can contain references to other entity types (with or + /// without aliases). + pub value: Option, } -impl Part for GoogleCloudDialogflowV2beta1FaqAnswersConfig {} +impl Part for GoogleCloudDialogflowV2beta1EntityTypeEntity {} /// Opens the given URI. @@ -1536,19 +2183,20 @@ pub struct GoogleCloudDialogflowV2beta1IntentMessageBasicCardButtonOpenUriAction impl Part for GoogleCloudDialogflowV2beta1IntentMessageBasicCardButtonOpenUriAction {} -/// The request message for Conversations.AddConversationPhoneNumber. +/// The button object that appears at the bottom of a card. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversations add conversation phone number projects](struct.ProjectConversationAddConversationPhoneNumberCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1AddConversationPhoneNumberRequest { _never_set: Option } +pub struct GoogleCloudDialogflowV2beta1IntentMessageBasicCardButton { + /// Required. Action to take when a user taps on the button. + #[serde(rename="openUriAction")] + pub open_uri_action: Option, + /// Required. The title of the button. + pub title: Option, +} -impl RequestValue for GoogleCloudDialogflowV2beta1AddConversationPhoneNumberRequest {} +impl Part for GoogleCloudDialogflowV2beta1IntentMessageBasicCardButton {} /// Represents the query input. It can contain either: @@ -1576,34 +2224,17 @@ pub struct GoogleCloudDialogflowV2beta1QueryInput { impl Part for GoogleCloudDialogflowV2beta1QueryInput {} -/// Represents a message posted into a conversation. +/// The text response message. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1Message { - /// Required. The message content. - pub content: Option, - /// Required. The message language. - /// This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) - /// language tag. Example: "en-US". - #[serde(rename="languageCode")] - pub language_code: Option, - /// Required. The participant that said this message. - pub participant: Option, - /// Required. The unique identifier of the message. - /// Format: `projects//conversations//messages/`. - pub name: Option, - /// Optional. The role of the participant. - #[serde(rename="participantRole")] - pub participant_role: Option, - /// Optional. The time when the message was sent. - #[serde(rename="createTime")] - pub create_time: Option, +pub struct GoogleCloudDialogflowV2beta1IntentMessageText { + /// Optional. The collection of the agent's responses. + pub text: Option>, } -impl Part for GoogleCloudDialogflowV2beta1Message {} +impl Part for GoogleCloudDialogflowV2beta1IntentMessageText {} /// The request message for Agents.ImportAgent. @@ -1642,24 +2273,80 @@ pub struct GoogleCloudDialogflowV2beta1ImportAgentRequest { impl RequestValue for GoogleCloudDialogflowV2beta1ImportAgentRequest {} -/// Represents a phone number for telephony integration. It allows for connecting -/// a particular conversation over telephony. +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [conversations add conversation phone number projects](struct.ProjectConversationAddConversationPhoneNumberCall.html) (response) +/// * [agent environments users sessions contexts delete projects](struct.ProjectAgentEnvironmentUserSessionContextDeleteCall.html) (response) +/// * [agent environments users sessions entity types delete projects](struct.ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall.html) (response) +/// * [agent sessions delete contexts projects](struct.ProjectAgentSessionDeleteContextCall.html) (response) +/// * [agent knowledge bases delete projects](struct.ProjectAgentKnowledgeBaseDeleteCall.html) (response) +/// * [agent entity types delete projects](struct.ProjectAgentEntityTypeDeleteCall.html) (response) +/// * [agent sessions contexts delete projects](struct.ProjectAgentSessionContextDeleteCall.html) (response) +/// * [knowledge bases delete projects](struct.ProjectKnowledgeBaseDeleteCall.html) (response) +/// * [agent sessions entity types delete projects](struct.ProjectAgentSessionEntityTypeDeleteCall.html) (response) +/// * [agent environments users sessions delete contexts projects](struct.ProjectAgentEnvironmentUserSessionDeleteContextCall.html) (response) +/// * [agent intents delete projects](struct.ProjectAgentIntentDeleteCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ConversationPhoneNumber { - /// Output only. The phone number to connect to this conversation. - #[serde(rename="phoneNumber")] - pub phone_number: Option, +pub struct GoogleProtobufEmpty { _never_set: Option } + +impl ResponseResult for GoogleProtobufEmpty {} + + +/// Represents a context. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent sessions contexts get projects](struct.ProjectAgentSessionContextGetCall.html) (response) +/// * [agent environments users sessions contexts patch projects](struct.ProjectAgentEnvironmentUserSessionContextPatchCall.html) (request|response) +/// * [agent environments users sessions contexts create projects](struct.ProjectAgentEnvironmentUserSessionContextCreateCall.html) (request|response) +/// * [agent environments users sessions contexts get projects](struct.ProjectAgentEnvironmentUserSessionContextGetCall.html) (response) +/// * [agent sessions contexts create projects](struct.ProjectAgentSessionContextCreateCall.html) (request|response) +/// * [agent sessions contexts patch projects](struct.ProjectAgentSessionContextPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1Context { + /// Required. The unique identifier of the context. Format: + /// `projects//agent/sessions//contexts/`, + /// or `projects//agent/environments//users//sessions//contexts/`. + /// + /// The `Context ID` is always converted to lowercase, may only contain + /// characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + /// + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + pub name: Option, + /// Optional. The collection of parameters associated with this context. + /// Refer to [this + /// doc](https://cloud.google.com/dialogflow-enterprise/docs/intents-actions-parameters) + /// for syntax. + pub parameters: Option>, + /// Optional. The number of conversational query requests after which the + /// context expires. If set to `0` (the default) the context expires + /// immediately. Contexts expire automatically after 20 minutes if there + /// are no matching queries. + #[serde(rename="lifespanCount")] + pub lifespan_count: Option, } -impl ResponseResult for GoogleCloudDialogflowV2beta1ConversationPhoneNumber {} +impl RequestValue for GoogleCloudDialogflowV2beta1Context {} +impl ResponseResult for GoogleCloudDialogflowV2beta1Context {} /// Configuration of how speech should be synthesized. @@ -1700,31 +2387,64 @@ pub struct GoogleCloudDialogflowV2beta1SynthesizeSpeechConfig { impl Part for GoogleCloudDialogflowV2beta1SynthesizeSpeechConfig {} -/// Defines notification behavior for conversation lifecycle events. +/// This resource represents a long-running operation that is the result of a +/// network API call. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [agent restore projects](struct.ProjectAgentRestoreCall.html) (response) +/// * [agent train projects](struct.ProjectAgentTrainCall.html) (response) +/// * [agent knowledge bases documents patch projects](struct.ProjectAgentKnowledgeBaseDocumentPatchCall.html) (response) +/// * [agent intents batch delete projects](struct.ProjectAgentIntentBatchDeleteCall.html) (response) +/// * [knowledge bases documents create projects](struct.ProjectKnowledgeBaseDocumentCreateCall.html) (response) +/// * [knowledge bases documents patch projects](struct.ProjectKnowledgeBaseDocumentPatchCall.html) (response) +/// * [knowledge bases documents delete projects](struct.ProjectKnowledgeBaseDocumentDeleteCall.html) (response) +/// * [agent export projects](struct.ProjectAgentExportCall.html) (response) +/// * [agent entity types batch delete projects](struct.ProjectAgentEntityTypeBatchDeleteCall.html) (response) +/// * [agent import projects](struct.ProjectAgentImportCall.html) (response) +/// * [agent knowledge bases documents delete projects](struct.ProjectAgentKnowledgeBaseDocumentDeleteCall.html) (response) +/// * [agent entity types batch update projects](struct.ProjectAgentEntityTypeBatchUpdateCall.html) (response) +/// * [agent knowledge bases documents create projects](struct.ProjectAgentKnowledgeBaseDocumentCreateCall.html) (response) +/// * [agent knowledge bases documents reload projects](struct.ProjectAgentKnowledgeBaseDocumentReloadCall.html) (response) +/// * [agent intents batch update projects](struct.ProjectAgentIntentBatchUpdateCall.html) (response) +/// * [agent entity types entities batch update projects](struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html) (response) +/// * [knowledge bases documents reload projects](struct.ProjectKnowledgeBaseDocumentReloadCall.html) (response) +/// * [agent entity types entities batch delete projects](struct.ProjectAgentEntityTypeEntityBatchDeleteCall.html) (response) +/// * [operations get projects](struct.ProjectOperationGetCall.html) (response) +/// * [agent entity types entities batch create projects](struct.ProjectAgentEntityTypeEntityBatchCreateCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1NotificationConfig { - /// Optional. Name of the Cloud Pub/Sub topic to publish conversation - /// events like - /// CONVERSATION_STARTED as - /// serialized ConversationEvent protos. - /// - /// If enable_notifications is - /// `true` and no topic is supplied, a new topic is created and listed - /// here. - /// - /// Notification works for phone calls, if this topic either is in the same - /// project as the conversation or you grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow Service - /// Agent` role in the topic project. - /// - /// Format: `projects//topics/`. - pub topic: Option, +pub struct GoogleLongrunningOperation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, } -impl Part for GoogleCloudDialogflowV2beta1NotificationConfig {} +impl ResponseResult for GoogleLongrunningOperation {} /// Represents the result of querying a Knowledge base. @@ -1805,42 +2525,41 @@ pub struct GoogleCloudDialogflowV2beta1IntentMessageCarouselSelectItem { impl Part for GoogleCloudDialogflowV2beta1IntentMessageCarouselSelectItem {} -/// Represents a phone number. -/// `PhoneNumber` resources enable phone calls to be answered by Dialogflow -/// services and are added to a project through a `PhoneNumberOrder`. +/// Description of which voice to use for speech synthesis. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [phone numbers patch projects](struct.ProjectPhoneNumberPatchCall.html) (request|response) -/// * [phone numbers delete projects](struct.ProjectPhoneNumberDeleteCall.html) (response) -/// * [phone numbers undelete projects](struct.ProjectPhoneNumberUndeleteCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1PhoneNumber { - /// Optional. The conversation profile calls to this `PhoneNumber` should use. - /// Format: `projects//conversationProfiles/`. - #[serde(rename="conversationProfile")] - pub conversation_profile: Option, - /// Output only. Phone number in [E.164](https://en.wikipedia.org/wiki/E.164) - /// format. An example of a correctly formatted phone number: +15556767888. - #[serde(rename="phoneNumber")] - pub phone_number: Option, - /// Output only. The state of the `PhoneNumber`. Defaults to `ACTIVE`. - /// `PhoneNumber` objects set to `DELETE_REQUESTED` always decline incoming - /// calls and can be removed completely within 30 days. - #[serde(rename="lifecycleState")] - pub lifecycle_state: Option, - /// Required. The unique identifier of this phone number. - /// Format: `projects//phoneNumbers/`. +pub struct GoogleCloudDialogflowV2beta1VoiceSelectionParams { + /// Optional. The preferred gender of the voice. If not set, the service will + /// choose a voice based on the other parameters such as language_code and + /// name. Note that this is only a preference, not requirement. If a + /// voice of the appropriate gender is not available, the synthesizer should + /// substitute a voice with a different gender rather than failing the request. + #[serde(rename="ssmlGender")] + pub ssml_gender: Option, + /// Optional. The name of the voice. If not set, the service will choose a + /// voice based on the other parameters such as language_code and gender. pub name: Option, } -impl RequestValue for GoogleCloudDialogflowV2beta1PhoneNumber {} -impl ResponseResult for GoogleCloudDialogflowV2beta1PhoneNumber {} +impl Part for GoogleCloudDialogflowV2beta1VoiceSelectionParams {} + + +/// The quick replies response message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudDialogflowV2beta1IntentMessageQuickReplies { + /// Optional. The collection of quick replies. + #[serde(rename="quickReplies")] + pub quick_replies: Option>, + /// Optional. The title of the collection of quick replies. + pub title: Option, +} + +impl Part for GoogleCloudDialogflowV2beta1IntentMessageQuickReplies {} /// The request message for EntityTypes.BatchDeleteEntities. @@ -1856,9 +2575,10 @@ impl ResponseResult for GoogleCloudDialogflowV2beta1PhoneNumber {} pub struct GoogleCloudDialogflowV2beta1BatchDeleteEntitiesRequest { /// Optional. The language of entity synonyms defined in `entities`. If not /// specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. #[serde(rename="languageCode")] pub language_code: Option, /// Required. The canonical `values` of the entities to delete. Note that @@ -1890,1715 +2610,6 @@ pub struct GoogleCloudDialogflowV2beta1IntentFollowupIntentInfo { impl Part for GoogleCloudDialogflowV2beta1IntentFollowupIntentInfo {} -/// Events allow for matching intents by event name instead of the natural -/// language input. For instance, input `` can trigger a personalized welcome response. -/// The parameter `name` may be used by the agent in the response: -/// `“Hello #welcome_event.name! What can I do for you today?”`. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1EventInput { - /// Required. The language of this query. See [Language - /// Support](https://dialogflow.com/docs/languages) for a list of the - /// currently supported language codes. Note that queries in the same session - /// do not necessarily need to specify the same language. - #[serde(rename="languageCode")] - pub language_code: Option, - /// Required. The unique identifier of the event. - pub name: Option, - /// Optional. The collection of parameters associated with the event. - pub parameters: Option>, -} - -impl Part for GoogleCloudDialogflowV2beta1EventInput {} - - -/// Represents a conversational agent. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get agent projects](struct.ProjectGetAgentCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1Agent { - /// Optional. The URI of the agent's avatar. - /// Avatars are used throughout the Dialogflow console and in the self-hosted - /// [Web Demo](https://dialogflow.com/docs/integrations/web-demo) integration. - #[serde(rename="avatarUri")] - pub avatar_uri: Option, - /// Required. The name of this agent. - #[serde(rename="displayName")] - pub display_name: Option, - /// Optional. The description of this agent. - /// The maximum length is 500 characters. If exceeded, the request is rejected. - pub description: Option, - /// Required. The project of this agent. - /// Format: `projects/`. - pub parent: Option, - /// Required. The default language of the agent as a language tag. See - /// [Language Support](https://dialogflow.com/docs/reference/language) for a - /// list of the currently supported language codes. - /// This field cannot be set by the `Update` method. - #[serde(rename="defaultLanguageCode")] - pub default_language_code: Option, - /// Optional. Determines whether this agent should log conversation queries. - #[serde(rename="enableLogging")] - pub enable_logging: Option, - /// Optional. Determines how intents are detected from user queries. - #[serde(rename="matchMode")] - pub match_mode: Option, - /// Optional. The list of all languages supported by this agent (except for the - /// `default_language_code`). - #[serde(rename="supportedLanguageCodes")] - pub supported_language_codes: Option>, - /// Required. The time zone of this agent from the - /// [time zone database](https://www.iana.org/time-zones), e.g., - /// America/New_York, Europe/Paris. - #[serde(rename="timeZone")] - pub time_zone: Option, - /// Optional. To filter out false positive results and still get variety in - /// matched natural language inputs for your agent, you can tune the machine - /// learning classification threshold. If the returned score value is less than - /// the threshold value, then a fallback intent is be triggered or, if there - /// are no fallback intents defined, no intent will be triggered. The score - /// values range from 0.0 (completely uncertain) to 1.0 (completely certain). - /// If set to 0.0, the default of 0.3 is used. - #[serde(rename="classificationThreshold")] - pub classification_threshold: Option, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1Agent {} - - -/// The response message for Conversations.ListMessages. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversations messages list projects](struct.ProjectConversationMessageListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListMessagesResponse { - /// Optional. Token to retrieve the next page of results, or empty if there are - /// no more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Required. The list of messages. There will be a maximum number of items - /// returned based on the page_size field in the request. - pub messages: Option>, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1ListMessagesResponse {} - - -/// The top-level message sent by the client to the `StreamingAnalyzeContent` -/// method. -/// -/// Multiple request messages must be sent in the following order: -/// -/// 1. The first message must contain `participant` and `config` fields. To -/// receive an audio response, the first message must also contain the -/// `reply_audio_config` field. The first message must not contain `input`. -/// -/// 2. All subsequent messages must contain only input data. Specifically: -/// - If the `config` in the first message was set to `audio_config`, then -/// all subsequent messages must contain only `input_audio`. It is a good -/// practice to split the input audio into short chunks and deliver each -/// chunk in a separate message. -/// - If the `config` in the first message was set to `text_config`, then -/// the second message must contain only `input_text`. Moreover, the -/// `input_text` field can be only sent once. -/// After all input is delivered, the client must half-close, or abort the -/// request stream. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversations participants streaming analyze content projects](struct.ProjectConversationParticipantStreamingAnalyzeContentCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1StreamingAnalyzeContentRequest { - /// The UTF-8 encoded natural language text to be processed. Must be sent if - /// `text_config` is set in the first message. Text length must not exceed - /// 256 bytes. The `input_text` field can be only sent once. - #[serde(rename="inputText")] - pub input_text: Option, - /// Optional. Instructs the speech synthesizer how to generate the output - /// audio. - #[serde(rename="replyAudioConfig")] - pub reply_audio_config: Option, - /// The input audio content to be recognized. Must be sent if `audio_config` - /// is set in the first message. The complete audio over all streaming - /// messages must not exceed 1 minute. - #[serde(rename="inputAudio")] - pub input_audio: Option, - /// The natural language text to be processed. - #[serde(rename="textConfig")] - pub text_config: Option, - /// Instructs the speech recognizer how to process the speech audio. - #[serde(rename="audioConfig")] - pub audio_config: Option, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1StreamingAnalyzeContentRequest {} - - -/// The result of sentiment analysis as configured by -/// `sentiment_analysis_request_config`. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1SentimentAnalysisResult { - /// The sentiment analysis result for `query_text`. - #[serde(rename="queryTextSentiment")] - pub query_text_sentiment: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1SentimentAnalysisResult {} - - -/// Represents the natural language text to be processed. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1InputText { - /// Required. The UTF-8 encoded natural language text to be processed. - /// Text length must not exceed 256 bytes. - pub text: Option, - /// Required. The language of this conversational query. See [Language - /// Support](https://dialogflow.com/docs/languages) for a list of the - /// currently supported language codes. - #[serde(rename="languageCode")] - pub language_code: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1InputText {} - - -/// The image response message. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageImage { - /// A text description of the image to be used for accessibility, - /// e.g., screen readers. Required if image_uri is set for CarouselSelect. - #[serde(rename="accessibilityText")] - pub accessibility_text: Option, - /// Optional. The public URI to an image file. - #[serde(rename="imageUri")] - pub image_uri: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageImage {} - - -/// The request message for EntityTypes.BatchUpdateEntityTypes. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent entity types batch update projects](struct.ProjectAgentEntityTypeBatchUpdateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1BatchUpdateEntityTypesRequest { - /// Optional. The language of entity synonyms defined in `entity_types`. If not - /// specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. - #[serde(rename="languageCode")] - pub language_code: Option, - /// Optional. The mask to control which fields get updated. - #[serde(rename="updateMask")] - pub update_mask: Option, - /// The URI to a Google Cloud Storage file containing entity types to update - /// or create. The file format can either be a serialized proto (of - /// EntityBatch type) or a JSON object. Note: The URI must start with - /// "gs://". - #[serde(rename="entityTypeBatchUri")] - pub entity_type_batch_uri: Option, - /// The collection of entity types to update or create. - #[serde(rename="entityTypeBatchInline")] - pub entity_type_batch_inline: Option, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1BatchUpdateEntityTypesRequest {} - - -/// An answer from Knowledge Connector. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1KnowledgeAnswersAnswer { - /// The piece of text from the `source` knowledge base document that answers - /// this conversational query. - pub answer: Option, - /// Indicates which Knowledge Document this answer was extracted from. - /// Format: `projects//knowledgeBases//documents/`. - pub source: Option, - /// The system's confidence level that this knowledge answer is a good match - /// for this conversational query. - /// NOTE: The confidence level for a given `` pair may change - /// without notice, as it depends on models that are constantly being - /// improved. However, it will change less frequently than the confidence - /// score below, and should be preferred for referencing the quality of an - /// answer. - #[serde(rename="matchConfidenceLevel")] - pub match_confidence_level: Option, - /// The system's confidence score that this Knowledge answer is a good match - /// for this converstational query, range from 0.0 (completely uncertain) - /// to 1.0 (completely certain). - /// Note: The confidence score is likely to vary somewhat (possibly even for - /// identical requests), as the underlying model is under constant - /// improvement, we may deprecate it in the future. We recommend using - /// `match_confidence_level` which should be generally more stable. - #[serde(rename="matchConfidence")] - pub match_confidence: Option, - /// The corresponding FAQ question if the answer was extracted from a FAQ - /// Document, empty otherwise. - #[serde(rename="faqQuestion")] - pub faq_question: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1KnowledgeAnswersAnswer {} - - -/// Represents knowledge base resource. -/// -/// Note: resource `projects.agent.knowledgeBases` is deprecated, please use -/// `projects.knowledgeBases` instead. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent knowledge bases create projects](struct.ProjectAgentKnowledgeBaseCreateCall.html) (request|response) -/// * [knowledge bases create projects](struct.ProjectKnowledgeBaseCreateCall.html) (request|response) -/// * [knowledge bases get projects](struct.ProjectKnowledgeBaseGetCall.html) (response) -/// * [agent knowledge bases get projects](struct.ProjectAgentKnowledgeBaseGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1KnowledgeBase { - /// Required. The display name of the knowledge base. The name must be 1024 - /// bytes or less; otherwise, the creation request fails. - #[serde(rename="displayName")] - pub display_name: Option, - /// The knowledge base resource name. - /// The name must be empty when creating a knowledge base. - /// Format: `projects//knowledgeBases/`. - pub name: Option, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1KnowledgeBase {} -impl ResponseResult for GoogleCloudDialogflowV2beta1KnowledgeBase {} - - -/// Response message for Documents.ListDocuments. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent knowledge bases documents list projects](struct.ProjectAgentKnowledgeBaseDocumentListCall.html) (response) -/// * [knowledge bases documents list projects](struct.ProjectKnowledgeBaseDocumentListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListDocumentsResponse { - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of documents. - pub documents: Option>, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1ListDocumentsResponse {} - - -/// Defines the Human Agent Assistant to connect to a conversation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1HumanAgentAssistantConfig { - /// Optional. Pub/Sub topic on which to publish new agent assistant events. - #[serde(rename="notificationConfig")] - pub notification_config: Option, - /// Required. ID of the agent assistant to use. - /// Format: `projects//humanAgentAssistants/`. - pub name: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1HumanAgentAssistantConfig {} - - -/// This message is a wrapper around a collection of intents. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentBatch { - /// A collection of intents. - pub intents: Option>, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentBatch {} - - -/// The collection of suggestions. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageSuggestions { - /// Required. The list of suggested replies. - pub suggestions: Option>, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageSuggestions {} - - -/// Configures the types of sentiment analysis to perform. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1SentimentAnalysisRequestConfig { - /// Optional. Instructs the service to perform sentiment analysis on - /// `query_text`. If not provided, sentiment analysis is not performed on - /// `query_text`. - #[serde(rename="analyzeQueryTextSentiment")] - pub analyze_query_text_sentiment: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1SentimentAnalysisRequestConfig {} - - -/// Synthesizes speech and plays back the synthesized audio to the caller in -/// Telephony Gateway. -/// -/// Telephony Gateway takes the synthesizer settings from -/// `DetectIntentResponse.output_audio_config` which can either be set -/// at request-level or can come from the agent-level synthesizer config. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageTelephonySynthesizeSpeech { - /// The raw text to be synthesized. - pub text: Option, - /// The SSML to be synthesized. For more information, see - /// [SSML](https://developers.google.com/actions/reference/ssml). - pub ssml: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageTelephonySynthesizeSpeech {} - - -/// Represents the natural language text to be processed. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1TextInput { - /// Required. The language of this conversational query. See [Language - /// Support](https://dialogflow.com/docs/languages) for a list of the - /// currently supported language codes. Note that queries in the same session - /// do not necessarily need to specify the same language. - #[serde(rename="languageCode")] - pub language_code: Option, - /// Required. The UTF-8 encoded natural language text to be processed. - /// Text length must not exceed 256 bytes. - pub text: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1TextInput {} - - -/// Represents an entity type. -/// Entity types serve as a tool for extracting parameter values from natural -/// language queries. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent entity types get projects](struct.ProjectAgentEntityTypeGetCall.html) (response) -/// * [agent entity types patch projects](struct.ProjectAgentEntityTypePatchCall.html) (request|response) -/// * [agent entity types create projects](struct.ProjectAgentEntityTypeCreateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1EntityType { - /// Optional. Indicates whether the entity type can be automatically - /// expanded. - #[serde(rename="autoExpansionMode")] - pub auto_expansion_mode: Option, - /// Optional. The collection of entities associated with the entity type. - pub entities: Option>, - /// Required. Indicates the kind of entity type. - pub kind: Option, - /// Required. The name of the entity type. - #[serde(rename="displayName")] - pub display_name: Option, - /// Required for all methods except `create` (`create` populates the name - /// automatically. - /// The unique identifier of the entity type. Format: - /// `projects//agent/entityTypes/`. - pub name: Option, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1EntityType {} -impl ResponseResult for GoogleCloudDialogflowV2beta1EntityType {} - - -/// Transfers the call in Telephony Gateway. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageTelephonyTransferCall { - /// Required. The phone number to transfer the call to - /// in [E.164 format](https://en.wikipedia.org/wiki/E.164). - /// - /// We currently only allow transferring to US numbers (+1xxxyyyzzzz). - #[serde(rename="phoneNumber")] - pub phone_number: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageTelephonyTransferCall {} - - -/// Optional. Represents an entity. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1EntityTypeEntity { - /// Required. A collection of synonyms. For `KIND_LIST` entity types this - /// must contain exactly one synonym equal to `value`. - pub synonyms: Option>, - /// Required. - /// For `KIND_MAP` entity types: - /// A canonical name to be used in place of synonyms. - /// For `KIND_LIST` entity types: - /// A string that can contain references to other entity types (with or - /// without aliases). - pub value: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1EntityTypeEntity {} - - -/// The basic card message. Useful for displaying information. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageBasicCard { - /// Optional. The collection of card buttons. - pub buttons: Option>, - /// Required, unless image is present. The body text of the card. - #[serde(rename="formattedText")] - pub formatted_text: Option, - /// Optional. The image for the card. - pub image: Option, - /// Optional. The subtitle of the card. - pub subtitle: Option, - /// Optional. The title of the card. - pub title: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageBasicCard {} - - -/// The card for presenting a list of options to select from. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageListSelect { - /// Required. List items. - pub items: Option>, - /// Optional. The overall title of the list. - pub title: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageListSelect {} - - -/// The request message for Intents.BatchUpdateIntents. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent intents batch update projects](struct.ProjectAgentIntentBatchUpdateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1BatchUpdateIntentsRequest { - /// Optional. The language of training phrases, parameters and rich messages - /// defined in `intents`. If not specified, the agent's default language is - /// used. [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. - #[serde(rename="languageCode")] - pub language_code: Option, - /// The URI to a Google Cloud Storage file containing intents to update or - /// create. The file format can either be a serialized proto (of IntentBatch - /// type) or JSON object. Note: The URI must start with "gs://". - #[serde(rename="intentBatchUri")] - pub intent_batch_uri: Option, - /// The collection of intents to update or create. - #[serde(rename="intentBatchInline")] - pub intent_batch_inline: Option, - /// Optional. The mask to control which fields get updated. - #[serde(rename="updateMask")] - pub update_mask: Option, - /// Optional. The resource view to apply to the returned intent. - #[serde(rename="intentView")] - pub intent_view: Option, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1BatchUpdateIntentsRequest {} - - -/// The request message for EntityTypes.BatchUpdateEntities. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent entity types entities batch update projects](struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest { - /// Optional. The language of entity synonyms defined in `entities`. If not - /// specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. - #[serde(rename="languageCode")] - pub language_code: Option, - /// Optional. The mask to control which fields get updated. - #[serde(rename="updateMask")] - pub update_mask: Option, - /// Required. The entities to update or create. - pub entities: Option>, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest {} - - -/// Request for new numbers fitting a set of parameters. -/// The country code for newly requested numbers defaults to 1 (US) until the -/// service is available in other regions. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1PhoneNumberSpec { - /// Optional. Area codes to use. An empty list means 'any code'. Each value - /// is treated as equally preferred. Each entry has a limit of 10 bytes. - /// "area code" corresponds to "National Destination Code" described in - /// [E.164](https://en.wikipedia.org/wiki/E.164) standard. - #[serde(rename="preferredAreaCodes")] - pub preferred_area_codes: Option>, - /// Required. Total numbers requested, between 1 and 10 inclusive. - pub count: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1PhoneNumberSpec {} - - -/// The response message for PhoneNumberOrders.ListPhoneNumberOrders. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [phone number orders list projects](struct.ProjectPhoneNumberOrderListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListPhoneNumberOrdersResponse { - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of orders. There is a maximum number of items returned based - /// on the page_size field in the request. - #[serde(rename="phoneNumberOrders")] - pub phone_number_orders: Option>, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1ListPhoneNumberOrdersResponse {} - - -/// The response message for Agents.SearchAgents. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent search projects](struct.ProjectAgentSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1SearchAgentsResponse { - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of agents. There will be a maximum number of items returned based - /// on the page_size field in the request. - pub agents: Option>, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1SearchAgentsResponse {} - - -/// The sentiment, such as positive/negative feeling or association, for a unit -/// of analysis, such as the query text. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1Sentiment { - /// Sentiment score between -1.0 (negative sentiment) and 1.0 (positive - /// sentiment). - pub score: Option, - /// A non-negative number in the [0, +inf) range, which represents the absolute - /// magnitude of sentiment, regardless of score (positive or negative). - pub magnitude: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1Sentiment {} - - -/// The collection of simple response candidates. -/// This message in `QueryResult.fulfillment_messages` and -/// `WebhookResponse.fulfillment_messages` should contain only one -/// `SimpleResponse`. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageSimpleResponses { - /// Required. The list of simple responses. - #[serde(rename="simpleResponses")] - pub simple_responses: Option>, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageSimpleResponses {} - - -/// Optional. Contains information about a button. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageCardButton { - /// Optional. The text to show on the button. - pub text: Option, - /// Optional. The text to send back to the Dialogflow API or a URI to - /// open. - pub postback: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageCardButton {} - - -/// The response message for Intents.ListIntents. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent intents list projects](struct.ProjectAgentIntentListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListIntentsResponse { - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of agent intents. There will be a maximum number of items - /// returned based on the page_size field in the request. - pub intents: Option>, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1ListIntentsResponse {} - - -/// The simple response message containing speech or text. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageSimpleResponse { - /// One of text_to_speech or ssml must be provided. Structured spoken - /// response to the user in the SSML format. Mutually exclusive with - /// text_to_speech. - pub ssml: Option, - /// One of text_to_speech or ssml must be provided. The plain text of the - /// speech output. Mutually exclusive with ssml. - #[serde(rename="textToSpeech")] - pub text_to_speech: Option, - /// Optional. The text to display. - #[serde(rename="displayText")] - pub display_text: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageSimpleResponse {} - - -/// An item in the list. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageListSelectItem { - /// Required. Additional information about this option. - pub info: Option, - /// Optional. The image to display. - pub image: Option, - /// Optional. The main text describing the item. - pub description: Option, - /// Required. The title of the list item. - pub title: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageListSelectItem {} - - -/// Response message for KnowledgeBases.ListKnowledgeBases. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent knowledge bases list projects](struct.ProjectAgentKnowledgeBaseListCall.html) (response) -/// * [knowledge bases list projects](struct.ProjectKnowledgeBaseListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListKnowledgeBasesResponse { - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of knowledge bases. - #[serde(rename="knowledgeBases")] - pub knowledge_bases: Option>, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1ListKnowledgeBasesResponse {} - - -/// The request message for Intents.BatchDeleteIntents. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent intents batch delete projects](struct.ProjectAgentIntentBatchDeleteCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest { - /// Required. The collection of intents to delete. Only intent `name` must be - /// filled in. - pub intents: Option>, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest {} - - -/// The request message for PhoneNumberOrders.CancelPhoneNumberOrder. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [phone number orders cancel projects](struct.ProjectPhoneNumberOrderCancelCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1CancelPhoneNumberOrderRequest { _never_set: Option } - -impl RequestValue for GoogleCloudDialogflowV2beta1CancelPhoneNumberOrderRequest {} - - -/// The response message for SessionEntityTypes.ListSessionEntityTypes. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent environments users sessions entity types list projects](struct.ProjectAgentEnvironmentUserSessionEntityTypeListCall.html) (response) -/// * [agent sessions entity types list projects](struct.ProjectAgentSessionEntityTypeListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListSessionEntityTypesResponse { - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of session entity types. There will be a maximum number of items - /// returned based on the page_size field in the request. - #[serde(rename="sessionEntityTypes")] - pub session_entity_types: Option>, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1ListSessionEntityTypesResponse {} - - -/// The request message for Conversations.CompleteConversation. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversations complete projects](struct.ProjectConversationCompleteCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1CompleteConversationRequest { _never_set: Option } - -impl RequestValue for GoogleCloudDialogflowV2beta1CompleteConversationRequest {} - - -/// Represents suggested answer from "frequently asked questions". -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1SuggestionFaqAnswer { - /// Output only. The piece of text from the `source` knowledge base document. - pub answer: Option, - /// Output only. Indicates which Knowledge Document this answer was extracted - /// from. - /// Format: `projects//agent/knowledgeBases//documents/`. - pub source: Option, - /// The system's confidence score that this Knowledge answer is a good match - /// for this conversational query, range from 0.0 (completely uncertain) - /// to 1.0 (completely certain). - pub confidence: Option, - /// Output only. The corresponding FAQ question. - pub question: Option, - /// Output only. A map that contains metadata about the answer and the - /// document from which it originates. - pub metadata: Option>, -} - -impl Part for GoogleCloudDialogflowV2beta1SuggestionFaqAnswer {} - - -/// The suggestion chip message that the user can tap to quickly post a reply -/// to the conversation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageSuggestion { - /// Required. The text shown the in the suggestion chip. - pub title: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageSuggestion {} - - -/// Instructs the speech recognizer how to process the audio content. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1InputAudioConfig { - /// Optional. The collection of phrase hints which are used to boost accuracy - /// of speech recognition. - /// Refer to - /// [Cloud Speech API - /// documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) - /// for more details. - #[serde(rename="phraseHints")] - pub phrase_hints: Option>, - /// Required. The language of the supplied audio. Dialogflow does not do - /// translations. See [Language - /// Support](https://dialogflow.com/docs/languages) for a list of the - /// currently supported language codes. Note that queries in the same session - /// do not necessarily need to specify the same language. - #[serde(rename="languageCode")] - pub language_code: Option, - /// Optional. Which Speech model to select for the given request. Select the - /// model best suited to your domain to get best results. If a model is not - /// explicitly specified, then we auto-select a model based on the parameters - /// in the InputAudioConfig. - /// If enhanced speech model is enabled for the agent and an enhanced - /// version of the specified model for the language does not exist, then the - /// speech is recognized using the standard version of the specified model. - /// Refer to - /// [Cloud Speech API - /// documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) - /// for more details. - pub model: Option, - /// Required. Sample rate (in Hertz) of the audio content sent in the query. - /// Refer to - /// [Cloud Speech API - /// documentation](https://cloud.google.com/speech-to-text/docs/basics) for - /// more details. - #[serde(rename="sampleRateHertz")] - pub sample_rate_hertz: Option, - /// Required. Audio encoding of the audio content to process. - #[serde(rename="audioEncoding")] - pub audio_encoding: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1InputAudioConfig {} - - -/// The suggestion chip message that allows the user to jump out to the app -/// or website associated with this agent. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageLinkOutSuggestion { - /// Required. The URI of the app or site to open when the user taps the - /// suggestion chip. - pub uri: Option, - /// Required. The name of the app or site this chip is linking to. - #[serde(rename="destinationName")] - pub destination_name: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageLinkOutSuggestion {} - - -/// Represents the natural language speech audio to be played to the end user. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1OutputAudio { - /// Required. The natural language speech audio. - pub audio: Option, - /// Required. Instructs the speech synthesizer how to generate the speech - /// audio. - pub config: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1OutputAudio {} - - -/// The response message for Contexts.ListContexts. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [environments users conversations contexts list projects](struct.ProjectEnvironmentUserConversationContextListCall.html) (response) -/// * [agent environments users sessions contexts list projects](struct.ProjectAgentEnvironmentUserSessionContextListCall.html) (response) -/// * [agent sessions contexts list projects](struct.ProjectAgentSessionContextListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ListContextsResponse { - /// The list of contexts. There will be a maximum number of items - /// returned based on the page_size field in the request. - pub contexts: Option>, - /// Token to retrieve the next page of results, or empty if there are no - /// more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1ListContextsResponse {} - - -/// Defines the language used in the input text. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1InputTextConfig { - /// Required. The language of this conversational query. See [Language - /// Support](https://dialogflow.com/docs/languages) for a list of the - /// currently supported language codes. - #[serde(rename="languageCode")] - pub language_code: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1InputTextConfig {} - - -/// Represents the natural language speech audio to be processed. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1InputAudio { - /// Required. The natural language speech audio to be processed. - /// A single request can contain up to 1 minute of speech audio data. - /// The transcribed text cannot contain more than 256 bytes. - pub audio: Option, - /// Required. Instructs the speech recognizer how to process the speech audio. - pub config: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1InputAudio {} - - -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [phone number orders cancel projects](struct.ProjectPhoneNumberOrderCancelCall.html) (response) -/// * [agent environments users sessions contexts delete projects](struct.ProjectAgentEnvironmentUserSessionContextDeleteCall.html) (response) -/// * [human agent assistants delete projects](struct.ProjectHumanAgentAssistantDeleteCall.html) (response) -/// * [agent environments users sessions entity types delete projects](struct.ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall.html) (response) -/// * [agent sessions delete contexts projects](struct.ProjectAgentSessionDeleteContextCall.html) (response) -/// * [agent knowledge bases delete projects](struct.ProjectAgentKnowledgeBaseDeleteCall.html) (response) -/// * [knowledge bases delete projects](struct.ProjectKnowledgeBaseDeleteCall.html) (response) -/// * [agent entity types delete projects](struct.ProjectAgentEntityTypeDeleteCall.html) (response) -/// * [agent sessions contexts delete projects](struct.ProjectAgentSessionContextDeleteCall.html) (response) -/// * [environments users conversations contexts delete projects](struct.ProjectEnvironmentUserConversationContextDeleteCall.html) (response) -/// * [agent sessions entity types delete projects](struct.ProjectAgentSessionEntityTypeDeleteCall.html) (response) -/// * [agent environments users sessions delete contexts projects](struct.ProjectAgentEnvironmentUserSessionDeleteContextCall.html) (response) -/// * [environments users conversations delete contexts projects](struct.ProjectEnvironmentUserConversationDeleteContextCall.html) (response) -/// * [agent intents delete projects](struct.ProjectAgentIntentDeleteCall.html) (response) -/// * [conversation profiles delete projects](struct.ProjectConversationProfileDeleteCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleProtobufEmpty { _never_set: Option } - -impl ResponseResult for GoogleProtobufEmpty {} - - -/// Represents a part of a training phrase. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentTrainingPhrasePart { - /// Optional. The parameter name for the value extracted from the - /// annotated part of the example. - pub alias: Option, - /// Optional. The entity type name prefixed with `@`. This field is - /// required for the annotated part of the text and applies only to - /// examples. - #[serde(rename="entityType")] - pub entity_type: Option, - /// Optional. Indicates whether the text was manually annotated by the - /// developer. - #[serde(rename="userDefined")] - pub user_defined: Option, - /// Required. The text corresponding to the example or template, - /// if there are no annotations. For - /// annotated examples, it is the text for one of the example's parts. - pub text: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentTrainingPhrasePart {} - - -/// Defines the services to connect to incoming Dialogflow conversations. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversation profiles create projects](struct.ProjectConversationProfileCreateCall.html) (request|response) -/// * [conversation profiles get projects](struct.ProjectConversationProfileGetCall.html) (response) -/// * [conversation profiles patch projects](struct.ProjectConversationProfilePatchCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1ConversationProfile { - /// Optional. Configuration for agent assistance to use with this profile. - #[serde(rename="humanAgentAssistantConfig")] - pub human_agent_assistant_config: Option, - /// Optional. Configuration for logging conversation lifecycle events. - #[serde(rename="loggingConfig")] - pub logging_config: Option, - /// Required for all methods except `create` (`create` populates the name - /// automatically). - /// The unique identifier of this conversation profile. - /// Format: `projects//conversationProfiles/`. - pub name: Option, - /// Required. Human readable name for this profile. Max length 1024 bytes. - #[serde(rename="displayName")] - pub display_name: Option, - /// Optional. Configuration for an automated agent to use with this profile. - #[serde(rename="automatedAgentConfig")] - pub automated_agent_config: Option, - /// Optional. Configuration for publishing conversation lifecycle events. - #[serde(rename="notificationConfig")] - pub notification_config: Option, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1ConversationProfile {} -impl ResponseResult for GoogleCloudDialogflowV2beta1ConversationProfile {} - - -/// Represents the result of conversational query or event processing. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1QueryResult { - /// The language that was triggered during intent detection. - /// See [Language Support](https://dialogflow.com/docs/reference/language) - /// for a list of the currently supported language codes. - #[serde(rename="languageCode")] - pub language_code: Option, - /// The text to be pronounced to the user or shown on the screen. - #[serde(rename="fulfillmentText")] - pub fulfillment_text: Option, - /// This field is set to: - /// - `false` if the matched intent has required parameters and not all of - /// the required parameter values have been collected. - /// - `true` if all required parameter values have been collected, or if the - /// matched intent doesn't contain any required parameters. - #[serde(rename="allRequiredParamsPresent")] - pub all_required_params_present: Option, - /// The collection of rich messages to present to the user. - #[serde(rename="fulfillmentMessages")] - pub fulfillment_messages: Option>, - /// The action name from the matched intent. - pub action: Option, - /// The intent that matched the conversational query. Some, not - /// all fields are filled in this message, including but not limited to: - /// `name`, `display_name` and `webhook_state`. - pub intent: Option, - /// The free-form diagnostic info. For example, this field - /// could contain webhook call latency. - #[serde(rename="diagnosticInfo")] - pub diagnostic_info: Option>, - /// The collection of output contexts. If applicable, - /// `output_contexts.parameters` contains entries with name - /// `.original` containing the original parameter values - /// before the query. - #[serde(rename="outputContexts")] - pub output_contexts: Option>, - /// The result from Knowledge Connector (if any), ordered by decreasing - /// `KnowledgeAnswers.match_confidence`. - #[serde(rename="knowledgeAnswers")] - pub knowledge_answers: Option, - /// The sentiment analysis result, which depends on the - /// `sentiment_analysis_request_config` specified in the request. - #[serde(rename="sentimentAnalysisResult")] - pub sentiment_analysis_result: Option, - /// If the query was fulfilled by a webhook call, this field is set to the - /// value of the `payload` field returned in the webhook response. - #[serde(rename="webhookPayload")] - pub webhook_payload: Option>, - /// The collection of extracted parameters. - pub parameters: Option>, - /// The Speech recognition confidence between 0.0 and 1.0. A higher number - /// indicates an estimated greater likelihood that the recognized words are - /// correct. The default of 0.0 is a sentinel value indicating that confidence - /// was not set. - /// - /// This field is not guaranteed to be accurate or set. In particular this - /// field isn't set for StreamingDetectIntent since the streaming endpoint has - /// separate confidence estimates per portion of the audio in - /// StreamingRecognitionResult. - #[serde(rename="speechRecognitionConfidence")] - pub speech_recognition_confidence: Option, - /// The intent detection confidence. Values range from 0.0 - /// (completely uncertain) to 1.0 (completely certain). - /// If there are `multiple knowledge_answers` messages, this value is set to - /// the greatest `knowledgeAnswers.match_confidence` value in the list. - #[serde(rename="intentDetectionConfidence")] - pub intent_detection_confidence: Option, - /// The original conversational query text: - /// - If natural language text was provided as input, `query_text` contains - /// a copy of the input. - /// - If natural language speech audio was provided as input, `query_text` - /// contains the speech recognition result. If speech recognizer produced - /// multiple alternatives, a particular one is picked. - /// - If an event was provided as input, `query_text` is not set. - #[serde(rename="queryText")] - pub query_text: Option, - /// If the query was fulfilled by a webhook call, this field is set to the - /// value of the `source` field returned in the webhook response. - #[serde(rename="webhookSource")] - pub webhook_source: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1QueryResult {} - - -/// The message returned from the DetectIntent method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent environments users sessions detect intent projects](struct.ProjectAgentEnvironmentUserSessionDetectIntentCall.html) (response) -/// * [agent sessions detect intent projects](struct.ProjectAgentSessionDetectIntentCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1DetectIntentResponse { - /// Instructs the speech synthesizer how to generate the output audio. This - /// field is populated from the agent-level speech synthesizer configuration, - /// if enabled. - #[serde(rename="outputAudioConfig")] - pub output_audio_config: Option, - /// The audio data bytes encoded as specified in the request. - #[serde(rename="outputAudio")] - pub output_audio: Option, - /// The selected results of the conversational query or event processing. - /// See `alternative_query_results` for additional potential results. - #[serde(rename="queryResult")] - pub query_result: Option, - /// If Knowledge Connectors are enabled, there could be more than one result - /// returned for a given query or event, and this field will contain all - /// results except for the top one, which is captured in query_result. The - /// alternative results are ordered by decreasing - /// `QueryResult.intent_detection_confidence`. If Knowledge Connectors are - /// disabled, this field will be empty until multiple responses for regular - /// intents are supported, at which point those additional results will be - /// surfaced here. - #[serde(rename="alternativeQueryResults")] - pub alternative_query_results: Option>, - /// Specifies the status of the webhook request. `webhook_status` - /// is never populated in webhook requests. - #[serde(rename="webhookStatus")] - pub webhook_status: Option, - /// The unique identifier of the response. It can be used to - /// locate a response in the training example set or for reporting issues. - #[serde(rename="responseId")] - pub response_id: Option, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1DetectIntentResponse {} - - -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: -/// -/// - Simple to use and understand for most users -/// - Flexible enough to meet unexpected needs -/// -/// # Overview -/// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of -/// google.rpc.Code, but it may accept additional error codes if needed. The -/// error message should be a developer-facing English message that helps -/// developers *understand* and *resolve* the error. If a localized user-facing -/// error message is needed, put the localized message in the error details or -/// localize it in the client. The optional error details may contain arbitrary -/// information about the error. There is a predefined set of error detail types -/// in the package `google.rpc` that can be used for common error conditions. -/// -/// # Language mapping -/// -/// The `Status` message is the logical representation of the error model, but it -/// is not necessarily the actual wire format. When the `Status` message is -/// exposed in different client libraries and different wire protocols, it can be -/// mapped differently. For example, it will likely be mapped to some exceptions -/// in Java, but more likely mapped to some error codes in C. -/// -/// # Other uses -/// -/// The error model and the `Status` message can be used in a variety of -/// environments, either with or without APIs, to provide a -/// consistent developer experience across different environments. -/// -/// Example uses of this error model include: -/// -/// - Partial errors. If a service needs to return partial errors to the client, -/// it may embed the `Status` in the normal response to indicate the partial -/// errors. -/// -/// - Workflow errors. A typical workflow has multiple steps. Each step may -/// have a `Status` message for error reporting. -/// -/// - Batch operations. If a client uses batch request and batch response, the -/// `Status` message should be used directly inside batch response, one for -/// each error sub-response. -/// -/// - Asynchronous operations. If an API call embeds asynchronous operation -/// results in its response, the status of those operations should be -/// represented directly using the `Status` message. -/// -/// - Logging. If some API errors are stored in logs, the message `Status` could -/// be used directly after any stripping needed for security/privacy reasons. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleRpcStatus { - /// A developer-facing error message, which should be in English. Any - /// user-facing error message should be localized and sent in the - /// google.rpc.Status.details field, or localized by the client. - pub message: Option, - /// The status code, which should be an enum value of google.rpc.Code. - pub code: Option, - /// A list of messages that carry the error details. There is a common set of - /// message types for APIs to use. - pub details: Option>>, -} - -impl Part for GoogleRpcStatus {} - - -/// Description of which voice to use for speech synthesis. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1VoiceSelectionParams { - /// Optional. The preferred gender of the voice. If not set, the service will - /// choose a voice based on the other parameters such as language_code and - /// name. Note that this is only a preference, not requirement. If a - /// voice of the appropriate gender is not available, the synthesizer should - /// substitute a voice with a different gender rather than failing the request. - #[serde(rename="ssmlGender")] - pub ssml_gender: Option, - /// Optional. The name of the voice. If not set, the service will choose a - /// voice based on the other parameters such as language_code and gender. - pub name: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1VoiceSelectionParams {} - - -/// The response message for Conversations.AnalyzeContent. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [conversations participants analyze content projects](struct.ProjectConversationParticipantAnalyzeContentCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1AnalyzeContentResponse { - /// Optional. Only set if a Dialogflow automated agent has responded. - #[serde(rename="automatedAgentReply")] - pub automated_agent_reply: Option, - /// Output only. The output text content. - /// This field is set if the automated agent responded with text to show to - /// the user. - #[serde(rename="replyText")] - pub reply_text: Option, - /// Optional. The audio data bytes encoded as specified in the request. - /// This field is set if: - /// - `reply_audio_config` was specified in the request, or - /// - The automated agent responded with audio to play to the user. In such - /// case, `reply_audio.config` contains settings used to synthesize the - /// speech. - #[serde(rename="replyAudio")] - pub reply_audio: Option, -} - -impl ResponseResult for GoogleCloudDialogflowV2beta1AnalyzeContentResponse {} - - -/// Represents a phone number order. -/// Orders can assign phone numbers to projects. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [phone number orders create projects](struct.ProjectPhoneNumberOrderCreateCall.html) (request|response) -/// * [phone number orders patch projects](struct.ProjectPhoneNumberOrderPatchCall.html) (request|response) -/// * [phone number orders get projects](struct.ProjectPhoneNumberOrderGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1PhoneNumberOrder { - /// Output only. The time this order was last updated. - #[serde(rename="updateTime")] - pub update_time: Option, - /// Required. The unique identifier of this order. - /// Format: `projects//phoneNumberOrders/`. - pub name: Option, - /// Output only. A map of ordered numbers filled so far, keyed by their - /// resource name. Key format: - /// `projects//phoneNumbers/`. - /// Value format: E.164 phone number. Output only. - #[serde(rename="phoneNumbers")] - pub phone_numbers: Option>, - /// Optional. A description of the order, limit is 1024 bytes. - pub description: Option, - /// Order is for new numbers. - #[serde(rename="phoneNumberSpec")] - pub phone_number_spec: Option, - /// Output only. The time this order was created. - #[serde(rename="createTime")] - pub create_time: Option, - /// Output only. The current status of the order. - #[serde(rename="lifecycleState")] - pub lifecycle_state: Option, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1PhoneNumberOrder {} -impl ResponseResult for GoogleCloudDialogflowV2beta1PhoneNumberOrder {} - - -/// The button object that appears at the bottom of a card. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageBasicCardButton { - /// Required. Action to take when a user taps on the button. - #[serde(rename="openUriAction")] - pub open_uri_action: Option, - /// Required. The title of the button. - pub title: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageBasicCardButton {} - - -/// The text response message. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageText { - /// Optional. The collection of the agent's responses. - pub text: Option>, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageText {} - - -/// Represents a context. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent sessions contexts get projects](struct.ProjectAgentSessionContextGetCall.html) (response) -/// * [agent environments users sessions contexts patch projects](struct.ProjectAgentEnvironmentUserSessionContextPatchCall.html) (request|response) -/// * [agent environments users sessions contexts create projects](struct.ProjectAgentEnvironmentUserSessionContextCreateCall.html) (request|response) -/// * [agent environments users sessions contexts get projects](struct.ProjectAgentEnvironmentUserSessionContextGetCall.html) (response) -/// * [agent sessions contexts patch projects](struct.ProjectAgentSessionContextPatchCall.html) (request|response) -/// * [environments users conversations contexts create projects](struct.ProjectEnvironmentUserConversationContextCreateCall.html) (request|response) -/// * [environments users conversations contexts patch projects](struct.ProjectEnvironmentUserConversationContextPatchCall.html) (request|response) -/// * [agent sessions contexts create projects](struct.ProjectAgentSessionContextCreateCall.html) (request|response) -/// * [environments users conversations contexts get projects](struct.ProjectEnvironmentUserConversationContextGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1Context { - /// Required. The unique identifier of the context. Format: - /// `projects//agent/sessions//contexts/`, - /// or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is - /// always converted to lowercase. If `Environment ID` is not specified, we - /// assume default 'draft' environment. If `User ID` is not specified, we - /// assume default '-' user. - pub name: Option, - /// Optional. The collection of parameters associated with this context. - /// Refer to [this doc](https://dialogflow.com/docs/actions-and-parameters) for - /// syntax. - pub parameters: Option>, - /// Optional. The number of conversational query requests after which the - /// context expires. If set to `0` (the default) the context expires - /// immediately. Contexts expire automatically after 10 minutes even if there - /// are no matching queries. - #[serde(rename="lifespanCount")] - pub lifespan_count: Option, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1Context {} -impl ResponseResult for GoogleCloudDialogflowV2beta1Context {} - - -/// This resource represents a long-running operation that is the result of a -/// network API call. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent restore projects](struct.ProjectAgentRestoreCall.html) (response) -/// * [agent intents batch delete projects](struct.ProjectAgentIntentBatchDeleteCall.html) (response) -/// * [knowledge bases documents create projects](struct.ProjectKnowledgeBaseDocumentCreateCall.html) (response) -/// * [knowledge bases documents delete projects](struct.ProjectKnowledgeBaseDocumentDeleteCall.html) (response) -/// * [agent entity types batch delete projects](struct.ProjectAgentEntityTypeBatchDeleteCall.html) (response) -/// * [agent train projects](struct.ProjectAgentTrainCall.html) (response) -/// * [agent knowledge bases documents delete projects](struct.ProjectAgentKnowledgeBaseDocumentDeleteCall.html) (response) -/// * [agent import projects](struct.ProjectAgentImportCall.html) (response) -/// * [agent entity types batch update projects](struct.ProjectAgentEntityTypeBatchUpdateCall.html) (response) -/// * [agent export projects](struct.ProjectAgentExportCall.html) (response) -/// * [agent knowledge bases documents create projects](struct.ProjectAgentKnowledgeBaseDocumentCreateCall.html) (response) -/// * [agent intents batch update projects](struct.ProjectAgentIntentBatchUpdateCall.html) (response) -/// * [agent entity types entities batch update projects](struct.ProjectAgentEntityTypeEntityBatchUpdateCall.html) (response) -/// * [agent entity types entities batch delete projects](struct.ProjectAgentEntityTypeEntityBatchDeleteCall.html) (response) -/// * [operations get projects](struct.ProjectOperationGetCall.html) (response) -/// * [agent entity types entities batch create projects](struct.ProjectAgentEntityTypeEntityBatchCreateCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleLongrunningOperation { - /// The error result of the operation in case of failure or cancellation. - pub error: Option, - /// If the value is `false`, it means the operation is still in progress. - /// If `true`, the operation is completed, and either `error` or `response` is - /// available. - pub done: Option, - /// The normal response of the operation in case of success. If the original - /// method returns no data on success, such as `Delete`, the response is - /// `google.protobuf.Empty`. If the original method is standard - /// `Get`/`Create`/`Update`, the response should be the resource. For other - /// methods, the response should have the type `XxxResponse`, where `Xxx` - /// is the original method name. For example, if the original method name - /// is `TakeSnapshot()`, the inferred response type is - /// `TakeSnapshotResponse`. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that - /// originally returns it. If you use the default HTTP mapping, the - /// `name` should have the format of `operations/some/unique/name`. - pub name: Option, - /// Service-specific metadata associated with the operation. It typically - /// contains progress information and common metadata such as create time. - /// Some services might not provide such metadata. Any method that returns a - /// long-running operation should document the metadata type, if any. - pub metadata: Option>, -} - -impl ResponseResult for GoogleLongrunningOperation {} - - -/// The request message for Agents.RestoreAgent. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [agent restore projects](struct.ProjectAgentRestoreCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1RestoreAgentRequest { - /// The URI to a Google Cloud Storage file containing the agent to restore. - /// Note: The URI must start with "gs://". - #[serde(rename="agentUri")] - pub agent_uri: Option, - /// The agent to restore. - /// - /// Example for how to restore an agent via the command line: - ///
curl \
-    ///   'https://dialogflow.googleapis.com/v2beta1/projects/<project_name>/agent:restore\
-    ///    -X POST \
-    ///    -H 'Authorization: Bearer '$(gcloud auth application-default
-    ///    print-access-token) \
-    ///    -H 'Accept: application/json' \
-    ///    -H 'Content-Type: application/json' \
-    ///    --compressed \
-    ///    --data-binary "{
-    ///        'agentContent': '$(cat <agent zip file> | base64 -w 0)'
-    ///    }"
- #[serde(rename="agentContent")] - pub agent_content: Option, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1RestoreAgentRequest {} - - -/// The quick replies response message. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1IntentMessageQuickReplies { - /// Optional. The collection of quick replies. - #[serde(rename="quickReplies")] - pub quick_replies: Option>, - /// Optional. The title of the collection of quick replies. - pub title: Option, -} - -impl Part for GoogleCloudDialogflowV2beta1IntentMessageQuickReplies {} - - -/// The request message for -/// HumanAgentAssistants.RequestCompileSuggestions. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [human agent assistants compile suggestions projects](struct.ProjectHumanAgentAssistantCompileSuggestionCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1CompileSuggestionsRequest { - /// Required. List of messages in a conversation in chronological order. - pub messages: Option>, -} - -impl RequestValue for GoogleCloudDialogflowV2beta1CompileSuggestionsRequest {} - - -/// Represents suggested article. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudDialogflowV2beta1SuggestionArticle { - /// Output only. The article title. - pub title: Option, - /// Output only. The article URI. - pub uri: Option, - /// Output only. Article snippets. - pub snippets: Option>, - /// Output only. A map that contains metadata about the answer and the - /// document from which it originates. - pub metadata: Option>, -} - -impl Part for GoogleCloudDialogflowV2beta1SuggestionArticle {} - - // ################### // MethodBuilders ### @@ -3628,7 +2639,7 @@ impl Part for GoogleCloudDialogflowV2beta1SuggestionArticle {} /// ::default(), None); /// let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `agent_entity_types_batch_delete(...)`, `agent_entity_types_batch_update(...)`, `agent_entity_types_create(...)`, `agent_entity_types_delete(...)`, `agent_entity_types_entities_batch_create(...)`, `agent_entity_types_entities_batch_delete(...)`, `agent_entity_types_entities_batch_update(...)`, `agent_entity_types_get(...)`, `agent_entity_types_list(...)`, `agent_entity_types_patch(...)`, `agent_environments_users_sessions_contexts_create(...)`, `agent_environments_users_sessions_contexts_delete(...)`, `agent_environments_users_sessions_contexts_get(...)`, `agent_environments_users_sessions_contexts_list(...)`, `agent_environments_users_sessions_contexts_patch(...)`, `agent_environments_users_sessions_delete_contexts(...)`, `agent_environments_users_sessions_detect_intent(...)`, `agent_environments_users_sessions_entity_types_create(...)`, `agent_environments_users_sessions_entity_types_delete(...)`, `agent_environments_users_sessions_entity_types_get(...)`, `agent_environments_users_sessions_entity_types_list(...)`, `agent_environments_users_sessions_entity_types_patch(...)`, `agent_export(...)`, `agent_import(...)`, `agent_intents_batch_delete(...)`, `agent_intents_batch_update(...)`, `agent_intents_create(...)`, `agent_intents_delete(...)`, `agent_intents_get(...)`, `agent_intents_list(...)`, `agent_intents_patch(...)`, `agent_knowledge_bases_create(...)`, `agent_knowledge_bases_delete(...)`, `agent_knowledge_bases_documents_create(...)`, `agent_knowledge_bases_documents_delete(...)`, `agent_knowledge_bases_documents_get(...)`, `agent_knowledge_bases_documents_list(...)`, `agent_knowledge_bases_get(...)`, `agent_knowledge_bases_list(...)`, `agent_restore(...)`, `agent_search(...)`, `agent_sessions_contexts_create(...)`, `agent_sessions_contexts_delete(...)`, `agent_sessions_contexts_get(...)`, `agent_sessions_contexts_list(...)`, `agent_sessions_contexts_patch(...)`, `agent_sessions_delete_contexts(...)`, `agent_sessions_detect_intent(...)`, `agent_sessions_entity_types_create(...)`, `agent_sessions_entity_types_delete(...)`, `agent_sessions_entity_types_get(...)`, `agent_sessions_entity_types_list(...)`, `agent_sessions_entity_types_patch(...)`, `agent_train(...)`, `conversation_profiles_create(...)`, `conversation_profiles_delete(...)`, `conversation_profiles_get(...)`, `conversation_profiles_list(...)`, `conversation_profiles_patch(...)`, `conversations_add_conversation_phone_number(...)`, `conversations_complete(...)`, `conversations_create(...)`, `conversations_get(...)`, `conversations_list(...)`, `conversations_messages_list(...)`, `conversations_participants_analyze_content(...)`, `conversations_participants_create(...)`, `conversations_participants_get(...)`, `conversations_participants_list(...)`, `conversations_participants_streaming_analyze_content(...)`, `conversations_participants_suggestions_list(...)`, `environments_users_conversations_contexts_create(...)`, `environments_users_conversations_contexts_delete(...)`, `environments_users_conversations_contexts_get(...)`, `environments_users_conversations_contexts_list(...)`, `environments_users_conversations_contexts_patch(...)`, `environments_users_conversations_delete_contexts(...)`, `get_agent(...)`, `human_agent_assistants_compile_suggestions(...)`, `human_agent_assistants_create(...)`, `human_agent_assistants_delete(...)`, `human_agent_assistants_get(...)`, `human_agent_assistants_list(...)`, `human_agent_assistants_patch(...)`, `knowledge_bases_create(...)`, `knowledge_bases_delete(...)`, `knowledge_bases_documents_create(...)`, `knowledge_bases_documents_delete(...)`, `knowledge_bases_documents_get(...)`, `knowledge_bases_documents_list(...)`, `knowledge_bases_get(...)`, `knowledge_bases_list(...)`, `operations_get(...)`, `phone_number_orders_cancel(...)`, `phone_number_orders_create(...)`, `phone_number_orders_get(...)`, `phone_number_orders_list(...)`, `phone_number_orders_patch(...)`, `phone_numbers_delete(...)`, `phone_numbers_list(...)`, `phone_numbers_patch(...)` and `phone_numbers_undelete(...)` +/// // like `agent_entity_types_batch_delete(...)`, `agent_entity_types_batch_update(...)`, `agent_entity_types_create(...)`, `agent_entity_types_delete(...)`, `agent_entity_types_entities_batch_create(...)`, `agent_entity_types_entities_batch_delete(...)`, `agent_entity_types_entities_batch_update(...)`, `agent_entity_types_get(...)`, `agent_entity_types_list(...)`, `agent_entity_types_patch(...)`, `agent_environments_users_sessions_contexts_create(...)`, `agent_environments_users_sessions_contexts_delete(...)`, `agent_environments_users_sessions_contexts_get(...)`, `agent_environments_users_sessions_contexts_list(...)`, `agent_environments_users_sessions_contexts_patch(...)`, `agent_environments_users_sessions_delete_contexts(...)`, `agent_environments_users_sessions_detect_intent(...)`, `agent_environments_users_sessions_entity_types_create(...)`, `agent_environments_users_sessions_entity_types_delete(...)`, `agent_environments_users_sessions_entity_types_get(...)`, `agent_environments_users_sessions_entity_types_list(...)`, `agent_environments_users_sessions_entity_types_patch(...)`, `agent_export(...)`, `agent_import(...)`, `agent_intents_batch_delete(...)`, `agent_intents_batch_update(...)`, `agent_intents_create(...)`, `agent_intents_delete(...)`, `agent_intents_get(...)`, `agent_intents_list(...)`, `agent_intents_patch(...)`, `agent_knowledge_bases_create(...)`, `agent_knowledge_bases_delete(...)`, `agent_knowledge_bases_documents_create(...)`, `agent_knowledge_bases_documents_delete(...)`, `agent_knowledge_bases_documents_get(...)`, `agent_knowledge_bases_documents_list(...)`, `agent_knowledge_bases_documents_patch(...)`, `agent_knowledge_bases_documents_reload(...)`, `agent_knowledge_bases_get(...)`, `agent_knowledge_bases_list(...)`, `agent_knowledge_bases_patch(...)`, `agent_restore(...)`, `agent_search(...)`, `agent_sessions_contexts_create(...)`, `agent_sessions_contexts_delete(...)`, `agent_sessions_contexts_get(...)`, `agent_sessions_contexts_list(...)`, `agent_sessions_contexts_patch(...)`, `agent_sessions_delete_contexts(...)`, `agent_sessions_detect_intent(...)`, `agent_sessions_entity_types_create(...)`, `agent_sessions_entity_types_delete(...)`, `agent_sessions_entity_types_get(...)`, `agent_sessions_entity_types_list(...)`, `agent_sessions_entity_types_patch(...)`, `agent_train(...)`, `get_agent(...)`, `knowledge_bases_create(...)`, `knowledge_bases_delete(...)`, `knowledge_bases_documents_create(...)`, `knowledge_bases_documents_delete(...)`, `knowledge_bases_documents_get(...)`, `knowledge_bases_documents_list(...)`, `knowledge_bases_documents_patch(...)`, `knowledge_bases_documents_reload(...)`, `knowledge_bases_get(...)`, `knowledge_bases_list(...)`, `knowledge_bases_patch(...)` and `operations_get(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -3643,583 +2654,6 @@ impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} impl<'a, C, A> ProjectMethods<'a, C, A> { - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified session entity type. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the session entity type. Format: - /// `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - pub fn agent_environments_users_sessions_entity_types_get(&self, name: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> { - ProjectAgentEnvironmentUserSessionEntityTypeGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified context. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the context. Format: - /// `projects//agent/sessions//contexts/` - /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - /// not specified, we assume default 'draft' environment. If `User ID` is not - /// specified, we assume default '-' user. - pub fn agent_environments_users_sessions_contexts_get(&self, name: &str) -> ProjectAgentEnvironmentUserSessionContextGetCall<'a, C, A> { - ProjectAgentEnvironmentUserSessionContextGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates/Creates multiple entity types in the specified agent. - /// - /// Operation - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The name of the agent to update or create entity types in. - /// Format: `projects//agent`. - pub fn agent_entity_types_batch_update(&self, request: GoogleCloudDialogflowV2beta1BatchUpdateEntityTypesRequest, parent: &str) -> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> { - ProjectAgentEntityTypeBatchUpdateCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a knowledge base. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The project to create a knowledge base for. - /// Format: `projects/`. - pub fn agent_knowledge_bases_create(&self, request: GoogleCloudDialogflowV2beta1KnowledgeBase, parent: &str) -> ProjectAgentKnowledgeBaseCreateCall<'a, C, A> { - ProjectAgentKnowledgeBaseCreateCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates/Creates multiple intents in the specified agent. - /// - /// Operation - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The name of the agent to update or create intents in. - /// Format: `projects//agent`. - pub fn agent_intents_batch_update(&self, request: GoogleCloudDialogflowV2beta1BatchUpdateIntentsRequest, parent: &str) -> ProjectAgentIntentBatchUpdateCall<'a, C, A> { - ProjectAgentIntentBatchUpdateCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the specified conversation profile. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the conversation profile to delete. - /// Format: `projects//conversationProfiles/`. - pub fn conversation_profiles_delete(&self, name: &str) -> ProjectConversationProfileDeleteCall<'a, C, A> { - ProjectConversationProfileDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified knowledge base. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the knowledge base to retrieve. - /// Format `projects//knowledgeBases/`. - pub fn agent_knowledge_bases_get(&self, name: &str) -> ProjectAgentKnowledgeBaseGetCall<'a, C, A> { - ProjectAgentKnowledgeBaseGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Restores the specified agent from a ZIP file. - /// - /// Replaces the current agent version with a new one. All the intents and - /// entity types in the older version are deleted. - /// - /// - /// Operation - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The project that the agent to restore is associated with. - /// Format: `projects/`. - pub fn agent_restore(&self, request: GoogleCloudDialogflowV2beta1RestoreAgentRequest, parent: &str) -> ProjectAgentRestoreCall<'a, C, A> { - ProjectAgentRestoreCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates the specified context. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required. The unique identifier of the context. Format: - /// `projects//agent/sessions//contexts/`, - /// or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is - /// always converted to lowercase. If `Environment ID` is not specified, we - /// assume default 'draft' environment. If `User ID` is not specified, we - /// assume default '-' user. - pub fn agent_environments_users_sessions_contexts_patch(&self, request: GoogleCloudDialogflowV2beta1Context, name: &str) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> { - ProjectAgentEnvironmentUserSessionContextPatchCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates the specified session entity type. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required. The unique identifier of this session entity type. Format: - /// `projects//agent/sessions//entityTypes/`, or - /// `projects//agent/environments//users//sessions//entityTypes/`. - /// If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - /// `` must be the display name of an existing entity - /// type in the same agent that will be overridden or supplemented. - pub fn agent_environments_users_sessions_entity_types_patch(&self, request: GoogleCloudDialogflowV2beta1SessionEntityType, name: &str) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> { - ProjectAgentEnvironmentUserSessionEntityTypePatchCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a conversation profile in the specified project. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The project to create a conversation profile for. - /// Format: `projects/`. - pub fn conversation_profiles_create(&self, request: GoogleCloudDialogflowV2beta1ConversationProfile, parent: &str) -> ProjectConversationProfileCreateCall<'a, C, A> { - ProjectConversationProfileCreateCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the specified context. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the context to delete. Format: - /// `projects//agent/sessions//contexts/` - /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - /// not specified, we assume default 'draft' environment. If `User ID` is not - /// specified, we assume default '-' user. - pub fn environments_users_conversations_contexts_delete(&self, name: &str) -> ProjectEnvironmentUserConversationContextDeleteCall<'a, C, A> { - ProjectEnvironmentUserConversationContextDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified intent. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the intent. - /// Format: `projects//agent/intents/`. - pub fn agent_intents_get(&self, name: &str) -> ProjectAgentIntentGetCall<'a, C, A> { - ProjectAgentIntentGetCall { - hub: self.hub, - _name: name.to_string(), - _language_code: Default::default(), - _intent_view: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all session entity types in the specified session. - /// - /// # Arguments - /// - /// * `parent` - Required. The session to list all session entity types from. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users// - /// sessions/`. - /// If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - pub fn agent_environments_users_sessions_entity_types_list(&self, parent: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> { - ProjectAgentEnvironmentUserSessionEntityTypeListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves a human agent assistant. - /// - /// # Arguments - /// - /// * `name` - Required. The resource name of the agent assistant. - /// Format: `projects//humanAgentAssistants/`. - pub fn human_agent_assistants_get(&self, name: &str) -> ProjectHumanAgentAssistantGetCall<'a, C, A> { - ProjectHumanAgentAssistantGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all contexts in the specified session. - /// - /// # Arguments - /// - /// * `parent` - Required. The session to list all contexts from. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - pub fn agent_environments_users_sessions_contexts_list(&self, parent: &str) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> { - ProjectAgentEnvironmentUserSessionContextListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates the specified conversation profile. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required for all methods except `create` (`create` populates the name - /// automatically). - /// The unique identifier of this conversation profile. - /// Format: `projects//conversationProfiles/`. - pub fn conversation_profiles_patch(&self, request: GoogleCloudDialogflowV2beta1ConversationProfile, name: &str) -> ProjectConversationProfilePatchCall<'a, C, A> { - ProjectConversationProfilePatchCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all contexts in the specified session. - /// - /// # Arguments - /// - /// * `parent` - Required. The session to list all contexts from. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - pub fn agent_sessions_contexts_list(&self, parent: &str) -> ProjectAgentSessionContextListCall<'a, C, A> { - ProjectAgentSessionContextListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified entity type. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the entity type. - /// Format: `projects//agent/entityTypes/`. - pub fn agent_entity_types_get(&self, name: &str) -> ProjectAgentEntityTypeGetCall<'a, C, A> { - ProjectAgentEntityTypeGetCall { - hub: self.hub, - _name: name.to_string(), - _language_code: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all documents of the knowledge base. - /// - /// # Arguments - /// - /// * `parent` - Required. The knowledge base to list all documents for. - /// Format: `projects//knowledgeBases/`. - pub fn knowledge_bases_documents_list(&self, parent: &str) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> { - ProjectKnowledgeBaseDocumentListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the specified document. - /// - /// Operation - /// - /// # Arguments - /// - /// * `name` - The name of the document to delete. - /// Format: `projects//knowledgeBases//documents/`. - pub fn knowledge_bases_documents_delete(&self, name: &str) -> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> { - ProjectKnowledgeBaseDocumentDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of agents. - /// - /// Since there is at most one conversational agent per project, this method is - /// useful primarily for listing all agents across projects the caller has - /// access to. One can achieve that with a wildcard project collection id "-". - /// Refer to [List - /// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). - /// - /// # Arguments - /// - /// * `parent` - Required. The project to list agents from. - /// Format: `projects/`. - pub fn agent_search(&self, parent: &str) -> ProjectAgentSearchCall<'a, C, A> { - ProjectAgentSearchCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates the specified intent. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required for all methods except `create` (`create` populates the name - /// automatically. - /// The unique identifier of this intent. - /// Format: `projects//agent/intents/`. - pub fn agent_intents_patch(&self, request: GoogleCloudDialogflowV2beta1Intent, name: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { - ProjectAgentIntentPatchCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), - _language_code: Default::default(), - _intent_view: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the specified human agent assistant. - /// - /// # Arguments - /// - /// * `name` - Required. The resource name of the agent assistant. - /// Format: `projects//humanAgentAssistants/`. - pub fn human_agent_assistants_delete(&self, name: &str) -> ProjectHumanAgentAssistantDeleteCall<'a, C, A> { - ProjectHumanAgentAssistantDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes all active contexts in the specified session. - /// - /// # Arguments - /// - /// * `parent` - Required. The name of the session to delete all contexts from. Format: - /// `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - pub fn agent_environments_users_sessions_delete_contexts(&self, parent: &str) -> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> { - ProjectAgentEnvironmentUserSessionDeleteContextCall { - hub: self.hub, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates the specified `PhoneNumber`. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required. The unique identifier of this phone number. - /// Format: `projects//phoneNumbers/`. - pub fn phone_numbers_patch(&self, request: GoogleCloudDialogflowV2beta1PhoneNumber, name: &str) -> ProjectPhoneNumberPatchCall<'a, C, A> { - ProjectPhoneNumberPatchCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Returns the list of all knowledge bases of the specified agent. @@ -4240,561 +2674,6 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Deletes all active contexts in the specified session. - /// - /// # Arguments - /// - /// * `parent` - Required. The name of the session to delete all contexts from. Format: - /// `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - pub fn agent_sessions_delete_contexts(&self, parent: &str) -> ProjectAgentSessionDeleteContextCall<'a, C, A> { - ProjectAgentSessionDeleteContextCall { - hub: self.hub, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the specified document. - /// - /// Operation - /// - /// # Arguments - /// - /// * `name` - The name of the document to delete. - /// Format: `projects//knowledgeBases//documents/`. - pub fn agent_knowledge_bases_documents_delete(&self, name: &str) -> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> { - ProjectAgentKnowledgeBaseDocumentDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes entity types in the specified agent. - /// - /// Operation - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The name of the agent to delete all entities types for. Format: - /// `projects//agent`. - pub fn agent_entity_types_batch_delete(&self, request: GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest, parent: &str) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> { - ProjectAgentEntityTypeBatchDeleteCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Imports the specified agent from a ZIP file. - /// - /// Uploads new intents and entity types without deleting the existing ones. - /// Intents and entity types with the same name are replaced with the new - /// versions from ImportAgentRequest. - /// - /// - /// Operation - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The project that the agent to import is associated with. - /// Format: `projects/`. - pub fn agent_import(&self, request: GoogleCloudDialogflowV2beta1ImportAgentRequest, parent: &str) -> ProjectAgentImportCall<'a, C, A> { - ProjectAgentImportCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a context. - /// - /// If the specified context already exists, overrides the context. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The session to create a context for. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - pub fn environments_users_conversations_contexts_create(&self, request: GoogleCloudDialogflowV2beta1Context, parent: &str) -> ProjectEnvironmentUserConversationContextCreateCall<'a, C, A> { - ProjectEnvironmentUserConversationContextCreateCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates the specified context. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required. The unique identifier of the context. Format: - /// `projects//agent/sessions//contexts/`, - /// or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is - /// always converted to lowercase. If `Environment ID` is not specified, we - /// assume default 'draft' environment. If `User ID` is not specified, we - /// assume default '-' user. - pub fn environments_users_conversations_contexts_patch(&self, request: GoogleCloudDialogflowV2beta1Context, name: &str) -> ProjectEnvironmentUserConversationContextPatchCall<'a, C, A> { - ProjectEnvironmentUserConversationContextPatchCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all knowledge bases of the specified agent. - /// - /// # Arguments - /// - /// * `parent` - Required. The project to list of knowledge bases for. - /// Format: `projects/`. - pub fn agent_knowledge_bases_list(&self, parent: &str) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> { - ProjectAgentKnowledgeBaseListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates or creates multiple entities in the specified entity type. This - /// method does not affect entities in the entity type that aren't explicitly - /// specified in the request. - /// - /// Operation - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The name of the entity type to update or create entities in. - /// Format: `projects//agent/entityTypes/`. - pub fn agent_entity_types_entities_batch_update(&self, request: GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest, parent: &str) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> { - ProjectAgentEntityTypeEntityBatchUpdateCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a context. - /// - /// If the specified context already exists, overrides the context. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The session to create a context for. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - pub fn agent_sessions_contexts_create(&self, request: GoogleCloudDialogflowV2beta1Context, parent: &str) -> ProjectAgentSessionContextCreateCall<'a, C, A> { - ProjectAgentSessionContextCreateCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all session entity types in the specified session. - /// - /// # Arguments - /// - /// * `parent` - Required. The session to list all session entity types from. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users// - /// sessions/`. - /// If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - pub fn agent_sessions_entity_types_list(&self, parent: &str) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> { - ProjectAgentSessionEntityTypeListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Cancels an `PhoneNumberOrder`. - /// Returns an error if the order is in state - /// IN_PROGRESS or - /// COMPLETED. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required. The unique identifier of the order to delete. - /// Format: `projects//phoneNumberOrders/`. - pub fn phone_number_orders_cancel(&self, request: GoogleCloudDialogflowV2beta1CancelPhoneNumberOrderRequest, name: &str) -> ProjectPhoneNumberOrderCancelCall<'a, C, A> { - ProjectPhoneNumberOrderCancelCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified knowledge base. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the knowledge base to retrieve. - /// Format `projects//knowledgeBases/`. - pub fn knowledge_bases_get(&self, name: &str) -> ProjectKnowledgeBaseGetCall<'a, C, A> { - ProjectKnowledgeBaseGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates the specified human agent assistant. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required for all methods except `create` (`create` populates the name - /// automatically). - /// The unique identifier of human agent assistant. - /// Format: `projects//humanAgentAssistants/`. - pub fn human_agent_assistants_patch(&self, request: GoogleCloudDialogflowV2beta1HumanAgentAssistant, name: &str) -> ProjectHumanAgentAssistantPatchCall<'a, C, A> { - ProjectHumanAgentAssistantPatchCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Processes a natural language query and returns structured, actionable data - /// as a result. This method is not idempotent, because it may cause contexts - /// and session entity types to be updated, which in turn might affect - /// results of future queries. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `session` - Required. The name of the session this query is sent to. Format: - /// `projects//agent/sessions/`, or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we are using - /// "-". It’s up to the API caller to choose an appropriate `Session ID` and - /// `User Id`. They can be a random numbers or some type of user and session - /// identifiers (preferably hashed). The length of the `Session ID` and - /// `User ID` must not exceed 36 characters. - pub fn agent_environments_users_sessions_detect_intent(&self, request: GoogleCloudDialogflowV2beta1DetectIntentRequest, session: &str) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> { - ProjectAgentEnvironmentUserSessionDetectIntentCall { - hub: self.hub, - _request: request, - _session: session.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Requests deletion of a `PhoneNumber`. The `PhoneNumber` is moved into the - /// DELETE_REQUESTED state - /// immediately, and is deleted approximately 30 days later. This method may - /// only be called on a `PhoneNumber` in the - /// ACTIVE state. - /// - /// # Arguments - /// - /// * `name` - Required. The unique identifier of the `PhoneNumber` to delete. - /// Format: `projects//phoneNumbers/`. - pub fn phone_numbers_delete(&self, name: &str) -> ProjectPhoneNumberDeleteCall<'a, C, A> { - ProjectPhoneNumberDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the specified entity type. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the entity type to delete. - /// Format: `projects//agent/entityTypes/`. - pub fn agent_entity_types_delete(&self, name: &str) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> { - ProjectAgentEntityTypeDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates the specified context. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required. The unique identifier of the context. Format: - /// `projects//agent/sessions//contexts/`, - /// or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is - /// always converted to lowercase. If `Environment ID` is not specified, we - /// assume default 'draft' environment. If `User ID` is not specified, we - /// assume default '-' user. - pub fn agent_sessions_contexts_patch(&self, request: GoogleCloudDialogflowV2beta1Context, name: &str) -> ProjectAgentSessionContextPatchCall<'a, C, A> { - ProjectAgentSessionContextPatchCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified context. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the context. Format: - /// `projects//agent/sessions//contexts/` - /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - /// not specified, we assume default 'draft' environment. If `User ID` is not - /// specified, we assume default '-' user. - pub fn agent_sessions_contexts_get(&self, name: &str) -> ProjectAgentSessionContextGetCall<'a, C, A> { - ProjectAgentSessionContextGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves a conversation participant. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the participant. Format: - /// `projects//conversations//participants/`. - pub fn conversations_participants_get(&self, name: &str) -> ProjectConversationParticipantGetCall<'a, C, A> { - ProjectConversationParticipantGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Trains the specified agent. - /// - /// - /// Operation - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The project that the agent to train is associated with. - /// Format: `projects/`. - pub fn agent_train(&self, request: GoogleCloudDialogflowV2beta1TrainAgentRequest, parent: &str) -> ProjectAgentTrainCall<'a, C, A> { - ProjectAgentTrainCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the specified context. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the context to delete. Format: - /// `projects//agent/sessions//contexts/` - /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - /// not specified, we assume default 'draft' environment. If `User ID` is not - /// specified, we assume default '-' user. - pub fn agent_sessions_contexts_delete(&self, name: &str) -> ProjectAgentSessionContextDeleteCall<'a, C, A> { - ProjectAgentSessionContextDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all contexts in the specified session. - /// - /// # Arguments - /// - /// * `parent` - Required. The session to list all contexts from. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - pub fn environments_users_conversations_contexts_list(&self, parent: &str) -> ProjectEnvironmentUserConversationContextListCall<'a, C, A> { - ProjectEnvironmentUserConversationContextListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified context. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the context. Format: - /// `projects//agent/sessions//contexts/` - /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - /// not specified, we assume default 'draft' environment. If `User ID` is not - /// specified, we assume default '-' user. - pub fn environments_users_conversations_contexts_get(&self, name: &str) -> ProjectEnvironmentUserConversationContextGetCall<'a, C, A> { - ProjectEnvironmentUserConversationContextGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all participants in the specified conversation. - /// - /// # Arguments - /// - /// * `parent` - Required. The conversation to list all contexts from. - /// Format: `projects//conversations/`. - pub fn conversations_participants_list(&self, parent: &str) -> ProjectConversationParticipantListCall<'a, C, A> { - ProjectConversationParticipantListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Deletes the specified context. @@ -4841,17 +2720,151 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates an order to request phone numbers be added to a project. - /// The initial `LifecycleState` of a newly created order is - /// PENDING. + /// Updates the specified knowledge base. /// /// # Arguments /// /// * `request` - No description provided. - /// * `parent` - Required. Resource identifier of the project requesting the orders. - /// Format: `projects/`. - pub fn phone_number_orders_create(&self, request: GoogleCloudDialogflowV2beta1PhoneNumberOrder, parent: &str) -> ProjectPhoneNumberOrderCreateCall<'a, C, A> { - ProjectPhoneNumberOrderCreateCall { + /// * `name` - The knowledge base resource name. + /// The name must be empty when creating a knowledge base. + /// Format: `projects//knowledgeBases/`. + pub fn agent_knowledge_bases_patch(&self, request: GoogleCloudDialogflowV2beta1KnowledgeBase, name: &str) -> ProjectAgentKnowledgeBasePatchCall<'a, C, A> { + ProjectAgentKnowledgeBasePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates an entity type in the specified agent. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The agent to create a entity type for. + /// Format: `projects//agent`. + pub fn agent_entity_types_create(&self, request: GoogleCloudDialogflowV2beta1EntityType, parent: &str) -> ProjectAgentEntityTypeCreateCall<'a, C, A> { + ProjectAgentEntityTypeCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _language_code: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the specified context. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the context. Format: + /// `projects//agent/sessions//contexts/` + /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is + /// not specified, we assume default 'draft' environment. If `User ID` is not + /// specified, we assume default '-' user. + pub fn agent_environments_users_sessions_contexts_get(&self, name: &str) -> ProjectAgentEnvironmentUserSessionContextGetCall<'a, C, A> { + ProjectAgentEnvironmentUserSessionContextGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified knowledge base. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the knowledge base to delete. + /// Format: `projects//knowledgeBases/`. + pub fn agent_knowledge_bases_delete(&self, name: &str) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> { + ProjectAgentKnowledgeBaseDeleteCall { + hub: self.hub, + _name: name.to_string(), + _force: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified document. + /// + /// Operation + /// + /// # Arguments + /// + /// * `name` - The name of the document to delete. + /// Format: `projects//knowledgeBases//documents/`. + pub fn agent_knowledge_bases_documents_delete(&self, name: &str) -> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> { + ProjectAgentKnowledgeBaseDocumentDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the specified session entity type. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The unique identifier of this session entity type. Format: + /// `projects//agent/sessions//entityTypes/`, or + /// `projects//agent/environments//users//sessions//entityTypes/`. + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// `` must be the display name of an existing entity + /// type in the same agent that will be overridden or supplemented. + pub fn agent_sessions_entity_types_patch(&self, request: GoogleCloudDialogflowV2beta1SessionEntityType, name: &str) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> { + ProjectAgentSessionEntityTypePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates/Creates multiple entity types in the specified agent. + /// + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The name of the agent to update or create entity types in. + /// Format: `projects//agent`. + pub fn agent_entity_types_batch_update(&self, request: GoogleCloudDialogflowV2beta1BatchUpdateEntityTypesRequest, parent: &str) -> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> { + ProjectAgentEntityTypeBatchUpdateCall { hub: self.hub, _request: request, _parent: parent.to_string(), @@ -4863,18 +2876,158 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists of all `PhoneNumberOrder` resources in the specified project. + /// Creates a knowledge base. /// /// # Arguments /// - /// * `parent` - Required. The project to list all orders from. + /// * `request` - No description provided. + /// * `parent` - Required. The project to create a knowledge base for. /// Format: `projects/`. - pub fn phone_number_orders_list(&self, parent: &str) -> ProjectPhoneNumberOrderListCall<'a, C, A> { - ProjectPhoneNumberOrderListCall { + pub fn agent_knowledge_bases_create(&self, request: GoogleCloudDialogflowV2beta1KnowledgeBase, parent: &str) -> ProjectAgentKnowledgeBaseCreateCall<'a, C, A> { + ProjectAgentKnowledgeBaseCreateCall { hub: self.hub, + _request: request, _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Imports the specified agent from a ZIP file. + /// + /// Uploads new intents and entity types without deleting the existing ones. + /// Intents and entity types with the same name are replaced with the new + /// versions from ImportAgentRequest. + /// + /// + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The project that the agent to import is associated with. + /// Format: `projects/`. + pub fn agent_import(&self, request: GoogleCloudDialogflowV2beta1ImportAgentRequest, parent: &str) -> ProjectAgentImportCall<'a, C, A> { + ProjectAgentImportCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates/Creates multiple intents in the specified agent. + /// + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The name of the agent to update or create intents in. + /// Format: `projects//agent`. + pub fn agent_intents_batch_update(&self, request: GoogleCloudDialogflowV2beta1BatchUpdateIntentsRequest, parent: &str) -> ProjectAgentIntentBatchUpdateCall<'a, C, A> { + ProjectAgentIntentBatchUpdateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes intents in the specified agent. + /// + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The name of the agent to delete all entities types for. Format: + /// `projects//agent`. + pub fn agent_intents_batch_delete(&self, request: GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest, parent: &str) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> { + ProjectAgentIntentBatchDeleteCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the specified knowledge base. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the knowledge base to retrieve. + /// Format `projects//knowledgeBases/`. + pub fn agent_knowledge_bases_get(&self, name: &str) -> ProjectAgentKnowledgeBaseGetCall<'a, C, A> { + ProjectAgentKnowledgeBaseGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Restores the specified agent from a ZIP file. + /// + /// Replaces the current agent version with a new one. All the intents and + /// entity types in the older version are deleted. + /// + /// + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The project that the agent to restore is associated with. + /// Format: `projects/`. + pub fn agent_restore(&self, request: GoogleCloudDialogflowV2beta1RestoreAgentRequest, parent: &str) -> ProjectAgentRestoreCall<'a, C, A> { + ProjectAgentRestoreCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the specified document. + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The document resource name. + /// The name must be empty when creating a document. + /// Format: `projects//knowledgeBases//documents/`. + pub fn agent_knowledge_bases_documents_patch(&self, request: GoogleCloudDialogflowV2beta1Document, name: &str) -> ProjectAgentKnowledgeBaseDocumentPatchCall<'a, C, A> { + ProjectAgentKnowledgeBaseDocumentPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -4936,14 +3089,18 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the specific conversation. + /// Deletes the specified context. /// /// # Arguments /// - /// * `name` - Required. The name of the conversation. Format: - /// `projects//conversations/`. - pub fn conversations_get(&self, name: &str) -> ProjectConversationGetCall<'a, C, A> { - ProjectConversationGetCall { + /// * `name` - Required. The name of the context to delete. Format: + /// `projects//agent/sessions//contexts/` + /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is + /// not specified, we assume default 'draft' environment. If `User ID` is not + /// specified, we assume default '-' user. + pub fn agent_sessions_contexts_delete(&self, name: &str) -> ProjectAgentSessionContextDeleteCall<'a, C, A> { + ProjectAgentSessionContextDeleteCall { hub: self.hub, _name: name.to_string(), _delegate: Default::default(), @@ -4952,6 +3109,101 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Updates the specified context. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The unique identifier of the context. Format: + /// `projects//agent/sessions//contexts/`, + /// or `projects//agent/environments//users//sessions//contexts/`. + /// The `Context ID` is always converted to lowercase, may only contain + /// characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + pub fn agent_environments_users_sessions_contexts_patch(&self, request: GoogleCloudDialogflowV2beta1Context, name: &str) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> { + ProjectAgentEnvironmentUserSessionContextPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the specified agent. + /// + /// # Arguments + /// + /// * `parent` - Required. The project that the agent to fetch is associated with. + /// Format: `projects/`. + pub fn get_agent(&self, parent: &str) -> ProjectGetAgentCall<'a, C, A> { + ProjectGetAgentCall { + hub: self.hub, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the specified session entity type. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The unique identifier of this session entity type. Format: + /// `projects//agent/sessions//entityTypes/`, or + /// `projects//agent/environments//users//sessions//entityTypes/`. + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// `` must be the display name of an existing entity + /// type in the same agent that will be overridden or supplemented. + pub fn agent_environments_users_sessions_entity_types_patch(&self, request: GoogleCloudDialogflowV2beta1SessionEntityType, name: &str) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> { + ProjectAgentEnvironmentUserSessionEntityTypePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes entity types in the specified agent. + /// + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The name of the agent to delete all entities types for. Format: + /// `projects//agent`. + pub fn agent_entity_types_batch_delete(&self, request: GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest, parent: &str) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> { + ProjectAgentEntityTypeBatchDeleteCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Deletes the specified knowledge base. @@ -4973,22 +3225,18 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the specified `PhoneNumberOrder` resource. - /// Returns an error if the order is in state - /// IN_PROGRESS or - /// COMPLETED. + /// Returns the list of all knowledge bases of the specified agent. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `name` - Required. The unique identifier of this order. - /// Format: `projects//phoneNumberOrders/`. - pub fn phone_number_orders_patch(&self, request: GoogleCloudDialogflowV2beta1PhoneNumberOrder, name: &str) -> ProjectPhoneNumberOrderPatchCall<'a, C, A> { - ProjectPhoneNumberOrderPatchCall { + /// * `parent` - Required. The project to list of knowledge bases for. + /// Format: `projects/`. + pub fn agent_knowledge_bases_list(&self, parent: &str) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> { + ProjectAgentKnowledgeBaseListCall { hub: self.hub, - _request: request, - _name: name.to_string(), - _update_mask: Default::default(), + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -4997,18 +3245,119 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes all active contexts in the specified session. + /// Exports the specified agent to a ZIP file. + /// + /// + /// Operation /// /// # Arguments /// - /// * `parent` - Required. The name of the session to delete all contexts from. Format: - /// `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - pub fn environments_users_conversations_delete_contexts(&self, parent: &str) -> ProjectEnvironmentUserConversationDeleteContextCall<'a, C, A> { - ProjectEnvironmentUserConversationDeleteContextCall { + /// * `request` - No description provided. + /// * `parent` - Required. The project that the agent to export is associated with. + /// Format: `projects/`. + pub fn agent_export(&self, request: GoogleCloudDialogflowV2beta1ExportAgentRequest, parent: &str) -> ProjectAgentExportCall<'a, C, A> { + ProjectAgentExportCall { hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Reloads the specified document from its specified source, content_uri or + /// content. The previously loaded content of the document will be deleted. + /// Note: Even when the content of the document has not changed, there still + /// may be side effects because of internal implementation changes. + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the document to reload. + /// Format: `projects//knowledgeBases//documents/` + pub fn agent_knowledge_bases_documents_reload(&self, request: GoogleCloudDialogflowV2beta1ReloadDocumentRequest, name: &str) -> ProjectAgentKnowledgeBaseDocumentReloadCall<'a, C, A> { + ProjectAgentKnowledgeBaseDocumentReloadCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the list of all intents in the specified agent. + /// + /// # Arguments + /// + /// * `parent` - Required. The agent to list all intents from. + /// Format: `projects//agent`. + pub fn agent_intents_list(&self, parent: &str) -> ProjectAgentIntentListCall<'a, C, A> { + ProjectAgentIntentListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _language_code: Default::default(), + _intent_view: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates or creates multiple entities in the specified entity type. This + /// method does not affect entities in the entity type that aren't explicitly + /// specified in the request. + /// + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The name of the entity type to update or create entities in. + /// Format: `projects//agent/entityTypes/`. + pub fn agent_entity_types_entities_batch_update(&self, request: GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest, parent: &str) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> { + ProjectAgentEntityTypeEntityBatchUpdateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a session entity type. + /// + /// If the specified session entity type already exists, overrides the + /// session entity type. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The session to create a session entity type for. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users// + /// sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we assume + /// default '-' user. + pub fn agent_sessions_entity_types_create(&self, request: GoogleCloudDialogflowV2beta1SessionEntityType, parent: &str) -> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> { + ProjectAgentSessionEntityTypeCreateCall { + hub: self.hub, + _request: request, _parent: parent.to_string(), _delegate: Default::default(), _scopes: Default::default(), @@ -5037,15 +3386,38 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a new participant in a conversation. + /// Deletes all active contexts in the specified session. + /// + /// # Arguments + /// + /// * `parent` - Required. The name of the session to delete all contexts from. Format: + /// `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + pub fn agent_environments_users_sessions_delete_contexts(&self, parent: &str) -> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> { + ProjectAgentEnvironmentUserSessionDeleteContextCall { + hub: self.hub, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates multiple new entities in the specified entity type. + /// + /// Operation /// /// # Arguments /// /// * `request` - No description provided. - /// * `parent` - Required. Resource identifier of the conversation adding the participant. - /// Format: `projects//conversations/`. - pub fn conversations_participants_create(&self, request: GoogleCloudDialogflowV2beta1Participant, parent: &str) -> ProjectConversationParticipantCreateCall<'a, C, A> { - ProjectConversationParticipantCreateCall { + /// * `parent` - Required. The name of the entity type to create entities in. Format: + /// `projects//agent/entityTypes/`. + pub fn agent_entity_types_entities_batch_create(&self, request: GoogleCloudDialogflowV2beta1BatchCreateEntitiesRequest, parent: &str) -> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> { + ProjectAgentEntityTypeEntityBatchCreateCall { hub: self.hub, _request: request, _parent: parent.to_string(), @@ -5057,17 +3429,37 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets a phone number for this converstion to connect to. + /// Returns the list of all entity types in the specified agent. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `name` - The name of this conversation. - /// Format: `projects//conversations/`. - pub fn conversations_add_conversation_phone_number(&self, request: GoogleCloudDialogflowV2beta1AddConversationPhoneNumberRequest, name: &str) -> ProjectConversationAddConversationPhoneNumberCall<'a, C, A> { - ProjectConversationAddConversationPhoneNumberCall { + /// * `parent` - Required. The agent to list all entity types from. + /// Format: `projects//agent`. + pub fn agent_entity_types_list(&self, parent: &str) -> ProjectAgentEntityTypeListCall<'a, C, A> { + ProjectAgentEntityTypeListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _language_code: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the specified document. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the document to retrieve. + /// Format `projects//knowledgeBases//documents/`. + pub fn agent_knowledge_bases_documents_get(&self, name: &str) -> ProjectAgentKnowledgeBaseDocumentGetCall<'a, C, A> { + ProjectAgentKnowledgeBaseDocumentGetCall { hub: self.hub, - _request: request, _name: name.to_string(), _delegate: Default::default(), _scopes: Default::default(), @@ -5077,18 +3469,16 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns the list of all conversation profiles in the specified project. + /// Retrieves the specified knowledge base. /// /// # Arguments /// - /// * `parent` - Required. The project to list all conversation profiles from. - /// Format: `projects/`. - pub fn conversation_profiles_list(&self, parent: &str) -> ProjectConversationProfileListCall<'a, C, A> { - ProjectConversationProfileListCall { + /// * `name` - Required. The name of the knowledge base to retrieve. + /// Format `projects//knowledgeBases/`. + pub fn knowledge_bases_get(&self, name: &str) -> ProjectKnowledgeBaseGetCall<'a, C, A> { + ProjectKnowledgeBaseGetCall { hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), + _name: name.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5122,6 +3512,60 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Returns the list of all session entity types in the specified session. + /// + /// # Arguments + /// + /// * `parent` - Required. The session to list all session entity types from. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users// + /// sessions/`. + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + pub fn agent_environments_users_sessions_entity_types_list(&self, parent: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> { + ProjectAgentEnvironmentUserSessionEntityTypeListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Processes a natural language query and returns structured, actionable data + /// as a result. This method is not idempotent, because it may cause contexts + /// and session entity types to be updated, which in turn might affect + /// results of future queries. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `session` - Required. The name of the session this query is sent to. Format: + /// `projects//agent/sessions/`, or + /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we are using + /// "-". It’s up to the API caller to choose an appropriate `Session ID` and + /// `User Id`. They can be a random numbers or some type of user and session + /// identifiers (preferably hashed). The length of the `Session ID` and + /// `User ID` must not exceed 36 characters. + pub fn agent_environments_users_sessions_detect_intent(&self, request: GoogleCloudDialogflowV2beta1DetectIntentRequest, session: &str) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> { + ProjectAgentEnvironmentUserSessionDetectIntentCall { + hub: self.hub, + _request: request, + _session: session.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates a context. @@ -5150,18 +3594,21 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates an entity type in the specified agent. + /// Updates the specified entity type. /// /// # Arguments /// /// * `request` - No description provided. - /// * `parent` - Required. The agent to create a entity type for. - /// Format: `projects//agent`. - pub fn agent_entity_types_create(&self, request: GoogleCloudDialogflowV2beta1EntityType, parent: &str) -> ProjectAgentEntityTypeCreateCall<'a, C, A> { - ProjectAgentEntityTypeCreateCall { + /// * `name` - The unique identifier of the entity type. + /// Required for EntityTypes.UpdateEntityType and + /// EntityTypes.BatchUpdateEntityTypes methods. + /// Format: `projects//agent/entityTypes/`. + pub fn agent_entity_types_patch(&self, request: GoogleCloudDialogflowV2beta1EntityType, name: &str) -> ProjectAgentEntityTypePatchCall<'a, C, A> { + ProjectAgentEntityTypePatchCall { hub: self.hub, _request: request, - _parent: parent.to_string(), + _name: name.to_string(), + _update_mask: Default::default(), _language_code: Default::default(), _delegate: Default::default(), _scopes: Default::default(), @@ -5171,29 +3618,120 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Adds a text (chat, for example), or audio (phone recording, for example) - /// message from a participan into the conversation. - /// Note: This method is only available through the gRPC API (not REST). - /// - /// The top-level message sent to the client by the server is - /// `StreamingAnalyzeContentResponse`. Multiple response messages can be - /// returned in order. The first one or more messages contain the - /// `recognition_result` field. Each result represents a more complete - /// transcript of what the user said. The next message contains the - /// `reply_text` field and potentially the `reply_audio` field. The message can - /// also contain the `automated_agent_reply` field. + /// Returns the list of all contexts in the specified session. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `participant` - Required. The name of the participant this text comes from. - /// Format: `projects//conversations//participants/`. - pub fn conversations_participants_streaming_analyze_content(&self, request: GoogleCloudDialogflowV2beta1StreamingAnalyzeContentRequest, participant: &str) -> ProjectConversationParticipantStreamingAnalyzeContentCall<'a, C, A> { - ProjectConversationParticipantStreamingAnalyzeContentCall { + /// * `parent` - Required. The session to list all contexts from. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we assume + /// default '-' user. + pub fn agent_environments_users_sessions_contexts_list(&self, parent: &str) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> { + ProjectAgentEnvironmentUserSessionContextListCall { hub: self.hub, - _request: request, - _participant: participant.to_string(), + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified entity type. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the entity type to delete. + /// Format: `projects//agent/entityTypes/`. + pub fn agent_entity_types_delete(&self, name: &str) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> { + ProjectAgentEntityTypeDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the specified session entity type. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the session entity type. Format: + /// `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + pub fn agent_sessions_entity_types_get(&self, name: &str) -> ProjectAgentSessionEntityTypeGetCall<'a, C, A> { + ProjectAgentSessionEntityTypeGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the specified document. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the document to retrieve. + /// Format `projects//knowledgeBases//documents/`. + pub fn knowledge_bases_documents_get(&self, name: &str) -> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> { + ProjectKnowledgeBaseDocumentGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the specified intent. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the intent. + /// Format: `projects//agent/intents/`. + pub fn agent_intents_get(&self, name: &str) -> ProjectAgentIntentGetCall<'a, C, A> { + ProjectAgentIntentGetCall { + hub: self.hub, + _name: name.to_string(), + _language_code: Default::default(), + _intent_view: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the specified entity type. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the entity type. + /// Format: `projects//agent/entityTypes/`. + pub fn agent_entity_types_get(&self, name: &str) -> ProjectAgentEntityTypeGetCall<'a, C, A> { + ProjectAgentEntityTypeGetCall { + hub: self.hub, + _name: name.to_string(), + _language_code: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5204,8 +3742,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// Deletes entities in the specified entity type. /// - /// Operation + /// Operation /// /// # Arguments /// @@ -5223,6 +3760,33 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Updates the specified context. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The unique identifier of the context. Format: + /// `projects//agent/sessions//contexts/`, + /// or `projects//agent/environments//users//sessions//contexts/`. + /// The `Context ID` is always converted to lowercase, may only contain + /// characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + pub fn agent_sessions_contexts_patch(&self, request: GoogleCloudDialogflowV2beta1Context, name: &str) -> ProjectAgentSessionContextPatchCall<'a, C, A> { + ProjectAgentSessionContextPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates a new document. @@ -5248,22 +3812,20 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the specified entity type. + /// Retrieves the specified context. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `name` - Required for all methods except `create` (`create` populates the name - /// automatically. - /// The unique identifier of the entity type. Format: - /// `projects//agent/entityTypes/`. - pub fn agent_entity_types_patch(&self, request: GoogleCloudDialogflowV2beta1EntityType, name: &str) -> ProjectAgentEntityTypePatchCall<'a, C, A> { - ProjectAgentEntityTypePatchCall { + /// * `name` - Required. The name of the context. Format: + /// `projects//agent/sessions//contexts/` + /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is + /// not specified, we assume default 'draft' environment. If `User ID` is not + /// specified, we assume default '-' user. + pub fn agent_sessions_contexts_get(&self, name: &str) -> ProjectAgentSessionContextGetCall<'a, C, A> { + ProjectAgentSessionContextGetCall { hub: self.hub, - _request: request, _name: name.to_string(), - _update_mask: Default::default(), - _language_code: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5272,23 +3834,60 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves suggestions for live agents. - /// - /// This method should be used by human agent client software to fetch - /// suggestions in real-time, while the conversation with an end user is in - /// progress. The functionality is implemented in terms of the - /// [list pagination](/apis/design/design_patterns#list_pagination) - /// design pattern. The client app should use the `next_page_token` field - /// to fetch the next batch of suggestions. + /// Deletes all active contexts in the specified session. /// /// # Arguments /// - /// * `parent` - Required. The name of the conversation participant for whom to fetch - /// suggestions. - /// Format: `projects//conversations//participants/`. - pub fn conversations_participants_suggestions_list(&self, parent: &str) -> ProjectConversationParticipantSuggestionListCall<'a, C, A> { - ProjectConversationParticipantSuggestionListCall { + /// * `parent` - Required. The name of the session to delete all contexts from. Format: + /// `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + pub fn agent_sessions_delete_contexts(&self, parent: &str) -> ProjectAgentSessionDeleteContextCall<'a, C, A> { + ProjectAgentSessionDeleteContextCall { + hub: self.hub, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the specified document. + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The document resource name. + /// The name must be empty when creating a document. + /// Format: `projects//knowledgeBases//documents/`. + pub fn knowledge_bases_documents_patch(&self, request: GoogleCloudDialogflowV2beta1Document, name: &str) -> ProjectKnowledgeBaseDocumentPatchCall<'a, C, A> { + ProjectKnowledgeBaseDocumentPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the list of all documents of the knowledge base. + /// + /// # Arguments + /// + /// * `parent` - Required. The knowledge base to list all documents for. + /// Format: `projects//knowledgeBases/`. + pub fn knowledge_bases_documents_list(&self, parent: &str) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> { + ProjectKnowledgeBaseDocumentListCall { hub: self.hub, _parent: parent.to_string(), _page_token: Default::default(), @@ -5301,16 +3900,137 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the specified agent. + /// Deletes the specified document. + /// + /// Operation /// /// # Arguments /// - /// * `parent` - Required. The project that the agent to fetch is associated with. + /// * `name` - The name of the document to delete. + /// Format: `projects//knowledgeBases//documents/`. + pub fn knowledge_bases_documents_delete(&self, name: &str) -> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> { + ProjectKnowledgeBaseDocumentDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a context. + /// + /// If the specified context already exists, overrides the context. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The session to create a context for. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we assume + /// default '-' user. + pub fn agent_sessions_contexts_create(&self, request: GoogleCloudDialogflowV2beta1Context, parent: &str) -> ProjectAgentSessionContextCreateCall<'a, C, A> { + ProjectAgentSessionContextCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Trains the specified agent. + /// + /// + /// Operation + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Required. The project that the agent to train is associated with. /// Format: `projects/`. - pub fn get_agent(&self, parent: &str) -> ProjectGetAgentCall<'a, C, A> { - ProjectGetAgentCall { + pub fn agent_train(&self, request: GoogleCloudDialogflowV2beta1TrainAgentRequest, parent: &str) -> ProjectAgentTrainCall<'a, C, A> { + ProjectAgentTrainCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the list of all session entity types in the specified session. + /// + /// # Arguments + /// + /// * `parent` - Required. The session to list all session entity types from. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users// + /// sessions/`. + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + pub fn agent_sessions_entity_types_list(&self, parent: &str) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> { + ProjectAgentSessionEntityTypeListCall { hub: self.hub, _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the specified session entity type. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the session entity type. Format: + /// `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + pub fn agent_environments_users_sessions_entity_types_get(&self, name: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> { + ProjectAgentEnvironmentUserSessionEntityTypeGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the specified knowledge base. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The knowledge base resource name. + /// The name must be empty when creating a knowledge base. + /// Format: `projects//knowledgeBases/`. + pub fn knowledge_bases_patch(&self, request: GoogleCloudDialogflowV2beta1KnowledgeBase, name: &str) -> ProjectKnowledgeBasePatchCall<'a, C, A> { + ProjectKnowledgeBasePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5359,488 +4079,23 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Completes the specified conversation. Finished conversations are purged - /// from the database after 30 days. + /// Updates the specified intent. /// /// # Arguments /// /// * `request` - No description provided. - /// * `name` - Required. Resource identifier of the conversation to close. - /// Format: `projects//conversations/`. - pub fn conversations_complete(&self, request: GoogleCloudDialogflowV2beta1CompleteConversationRequest, name: &str) -> ProjectConversationCompleteCall<'a, C, A> { - ProjectConversationCompleteCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the specified intent and its direct or indirect followup intents. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the intent to delete. If this intent has direct or - /// indirect followup intents, we also delete them. + /// * `name` - The unique identifier of this intent. + /// Required for Intents.UpdateIntent and Intents.BatchUpdateIntents + /// methods. /// Format: `projects//agent/intents/`. - pub fn agent_intents_delete(&self, name: &str) -> ProjectAgentIntentDeleteCall<'a, C, A> { - ProjectAgentIntentDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists messages that belong to a given conversation. - /// - /// # Arguments - /// - /// * `parent` - Required. The name of the conversation to list messages for. - /// Format: `projects//conversations/` - pub fn conversations_messages_list(&self, parent: &str) -> ProjectConversationMessageListCall<'a, C, A> { - ProjectConversationMessageListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the specified knowledge base. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the knowledge base to delete. - /// Format: `projects//knowledgeBases/`. - pub fn agent_knowledge_bases_delete(&self, name: &str) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> { - ProjectAgentKnowledgeBaseDeleteCall { - hub: self.hub, - _name: name.to_string(), - _force: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified conversation profile. - /// - /// # Arguments - /// - /// * `name` - Required. The resource name of the conversation profile. - /// Format: `projects//conversationProfiles/`. - pub fn conversation_profiles_get(&self, name: &str) -> ProjectConversationProfileGetCall<'a, C, A> { - ProjectConversationProfileGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new conversation. Conversation are auto-completed after 24 hours. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. Resource identifier of the project creating the conversation. - /// Format: `projects/`. - pub fn conversations_create(&self, request: GoogleCloudDialogflowV2beta1Conversation, parent: &str) -> ProjectConversationCreateCall<'a, C, A> { - ProjectConversationCreateCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all conversations in the specified project. - /// - /// # Arguments - /// - /// * `parent` - Required. The project from which to list all conversation. - /// Format: `projects/`. - pub fn conversations_list(&self, parent: &str) -> ProjectConversationListCall<'a, C, A> { - ProjectConversationListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _filter: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all phone numbers in the specified project. - /// - /// # Arguments - /// - /// * `parent` - Required. The project to list all `PhoneNumber` resources from. - /// Format: `projects/`. - pub fn phone_numbers_list(&self, parent: &str) -> ProjectPhoneNumberListCall<'a, C, A> { - ProjectPhoneNumberListCall { - hub: self.hub, - _parent: parent.to_string(), - _show_deleted: Default::default(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all human agent assistants. - /// - /// # Arguments - /// - /// * `parent` - Required. The project to list all agent assistants from. - /// Format: `projects/`. - pub fn human_agent_assistants_list(&self, parent: &str) -> ProjectHumanAgentAssistantListCall<'a, C, A> { - ProjectHumanAgentAssistantListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all intents in the specified agent. - /// - /// # Arguments - /// - /// * `parent` - Required. The agent to list all intents from. - /// Format: `projects//agent`. - pub fn agent_intents_list(&self, parent: &str) -> ProjectAgentIntentListCall<'a, C, A> { - ProjectAgentIntentListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _language_code: Default::default(), - _intent_view: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Adds a text (chat, for example), or audio (phone recording, for example) - /// message from a participan into the conversation. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `participant` - Required. The name of the participant this text comes from. - /// Format: `projects//conversations//participants/`. - pub fn conversations_participants_analyze_content(&self, request: GoogleCloudDialogflowV2beta1AnalyzeContentRequest, participant: &str) -> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> { - ProjectConversationParticipantAnalyzeContentCall { - hub: self.hub, - _request: request, - _participant: participant.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a session entity type. - /// - /// If the specified session entity type already exists, overrides the - /// session entity type. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The session to create a session entity type for. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users// - /// sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - pub fn agent_sessions_entity_types_create(&self, request: GoogleCloudDialogflowV2beta1SessionEntityType, parent: &str) -> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> { - ProjectAgentSessionEntityTypeCreateCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns a specific `PhoneNumberOrder`. - /// - /// # Arguments - /// - /// * `name` - Required. The unique identifier of the order to retrieve. - /// Format: `projects//phoneNumberOrders/`. - pub fn phone_number_orders_get(&self, name: &str) -> ProjectPhoneNumberOrderGetCall<'a, C, A> { - ProjectPhoneNumberOrderGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates multiple new entities in the specified entity type. - /// - /// Operation - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The name of the entity type to create entities in. Format: - /// `projects//agent/entityTypes/`. - pub fn agent_entity_types_entities_batch_create(&self, request: GoogleCloudDialogflowV2beta1BatchCreateEntitiesRequest, parent: &str) -> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> { - ProjectAgentEntityTypeEntityBatchCreateCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified document. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the document to retrieve. - /// Format `projects//knowledgeBases//documents/`. - pub fn agent_knowledge_bases_documents_get(&self, name: &str) -> ProjectAgentKnowledgeBaseDocumentGetCall<'a, C, A> { - ProjectAgentKnowledgeBaseDocumentGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes intents in the specified agent. - /// - /// Operation - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The name of the agent to delete all entities types for. Format: - /// `projects//agent`. - pub fn agent_intents_batch_delete(&self, request: GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest, parent: &str) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> { - ProjectAgentIntentBatchDeleteCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Cancels the deletion request for a `PhoneNumber`. This method may only be - /// called on a `PhoneNumber` in the - /// DELETE_REQUESTED state. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required. The unique identifier of the `PhoneNumber` to delete. - /// Format: `projects//phoneNumbers/`. - pub fn phone_numbers_undelete(&self, request: GoogleCloudDialogflowV2beta1UndeletePhoneNumberRequest, name: &str) -> ProjectPhoneNumberUndeleteCall<'a, C, A> { - ProjectPhoneNumberUndeleteCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified document. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the document to retrieve. - /// Format `projects//knowledgeBases//documents/`. - pub fn knowledge_bases_documents_get(&self, name: &str) -> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> { - ProjectKnowledgeBaseDocumentGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates the specified session entity type. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required. The unique identifier of this session entity type. Format: - /// `projects//agent/sessions//entityTypes/`, or - /// `projects//agent/environments//users//sessions//entityTypes/`. - /// If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - /// `` must be the display name of an existing entity - /// type in the same agent that will be overridden or supplemented. - pub fn agent_sessions_entity_types_patch(&self, request: GoogleCloudDialogflowV2beta1SessionEntityType, name: &str) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> { - ProjectAgentSessionEntityTypePatchCall { + pub fn agent_intents_patch(&self, request: GoogleCloudDialogflowV2beta1Intent, name: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { + ProjectAgentIntentPatchCall { hub: self.hub, _request: request, _name: name.to_string(), _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Uses the specified human agent assistant to come up with suggestions - /// (relevant articles and FAQs) on how to respond to a given conversation. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `name` - Required. The resource name of the agent assistant. - /// Format: `projects//humanAgentAssistants/`. - pub fn human_agent_assistants_compile_suggestions(&self, request: GoogleCloudDialogflowV2beta1CompileSuggestionsRequest, name: &str) -> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> { - ProjectHumanAgentAssistantCompileSuggestionCall { - hub: self.hub, - _request: request, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves the specified session entity type. - /// - /// # Arguments - /// - /// * `name` - Required. The name of the session entity type. Format: - /// `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - pub fn agent_sessions_entity_types_get(&self, name: &str) -> ProjectAgentSessionEntityTypeGetCall<'a, C, A> { - ProjectAgentSessionEntityTypeGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Exports the specified agent to a ZIP file. - /// - /// - /// Operation - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `parent` - Required. The project that the agent to export is associated with. - /// Format: `projects/`. - pub fn agent_export(&self, request: GoogleCloudDialogflowV2beta1ExportAgentRequest, parent: &str) -> ProjectAgentExportCall<'a, C, A> { - ProjectAgentExportCall { - hub: self.hub, - _request: request, - _parent: parent.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the list of all entity types in the specified agent. - /// - /// # Arguments - /// - /// * `parent` - Required. The agent to list all entity types from. - /// Format: `projects//agent`. - pub fn agent_entity_types_list(&self, parent: &str) -> ProjectAgentEntityTypeListCall<'a, C, A> { - ProjectAgentEntityTypeListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), _language_code: Default::default(), + _intent_view: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5871,18 +4126,69 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a human agent assistant. + /// Returns the list of agents. + /// + /// Since there is at most one conversational agent per project, this method is + /// useful primarily for listing all agents across projects the caller has + /// access to. One can achieve that with a wildcard project collection id "-". + /// Refer to [List + /// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). + /// + /// # Arguments + /// + /// * `parent` - Required. The project to list agents from. + /// Format: `projects/`. + pub fn agent_search(&self, parent: &str) -> ProjectAgentSearchCall<'a, C, A> { + ProjectAgentSearchCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified intent and its direct or indirect followup intents. + /// + /// # Arguments + /// + /// * `name` - Required. The name of the intent to delete. If this intent has direct or + /// indirect followup intents, we also delete them. + /// Format: `projects//agent/intents/`. + pub fn agent_intents_delete(&self, name: &str) -> ProjectAgentIntentDeleteCall<'a, C, A> { + ProjectAgentIntentDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Reloads the specified document from its specified source, content_uri or + /// content. The previously loaded content of the document will be deleted. + /// Note: Even when the content of the document has not changed, there still + /// may be side effects because of internal implementation changes. + /// Operation /// /// # Arguments /// /// * `request` - No description provided. - /// * `parent` - Required. The project to create a agent assistant for. - /// Format: `projects/`. - pub fn human_agent_assistants_create(&self, request: GoogleCloudDialogflowV2beta1HumanAgentAssistant, parent: &str) -> ProjectHumanAgentAssistantCreateCall<'a, C, A> { - ProjectHumanAgentAssistantCreateCall { + /// * `name` - The name of the document to reload. + /// Format: `projects//knowledgeBases//documents/` + pub fn knowledge_bases_documents_reload(&self, request: GoogleCloudDialogflowV2beta1ReloadDocumentRequest, name: &str) -> ProjectKnowledgeBaseDocumentReloadCall<'a, C, A> { + ProjectKnowledgeBaseDocumentReloadCall { hub: self.hub, _request: request, - _parent: parent.to_string(), + _name: name.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5910,6 +4216,30 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Returns the list of all contexts in the specified session. + /// + /// # Arguments + /// + /// * `parent` - Required. The session to list all contexts from. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we assume + /// default '-' user. + pub fn agent_sessions_contexts_list(&self, parent: &str) -> ProjectAgentSessionContextListCall<'a, C, A> { + ProjectAgentSessionContextListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -5920,9 +4250,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Retrieves the specified session entity type. +/// Returns the list of all knowledge bases of the specified agent. /// -/// A builder for the *agent.environments.users.sessions.entityTypes.get* method supported by a *project* resource. +/// A builder for the *knowledgeBases.list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -5947,27 +4277,31 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_entity_types_get("name") +/// let result = hub.projects().knowledge_bases_list("parent") +/// .page_token("accusam") +/// .page_size(-8) /// .doit(); /// # } /// ``` -pub struct ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> +pub struct ProjectKnowledgeBaseListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, - _name: String, + _parent: String, + _page_token: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseListCall<'a, C, A> {} -impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectKnowledgeBaseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1SessionEntityType)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListKnowledgeBasesResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -5976,11 +4310,17 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> whe Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.entityTypes.get", + dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5992,12 +4332,12 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> whe params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/knowledgeBases"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+name}", "name")].iter() { + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { let mut replace_with = String::new(); for &(name, ref value) in params.iter() { if name == param_name { @@ -6006,13 +4346,13 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> whe } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { + for param_name in ["parent"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -6022,10 +4362,7 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> whe } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6045,7 +4382,7 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> whe let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6098,19 +4435,30 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> whe } - /// Required. The name of the session entity type. Format: - /// `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. + /// Required. The project to list of knowledge bases for. + /// Format: `projects/`. /// - /// Sets the *name* path property to the given value. + /// Sets the *parent* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> { - self._name = new_value.to_string(); + pub fn parent(mut self, new_value: &str) -> ProjectKnowledgeBaseListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. The next_page_token value returned from a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectKnowledgeBaseListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of items to return in a single page. By + /// default 10 and at most 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectKnowledgeBaseListCall<'a, C, A> { + self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -6119,7 +4467,7 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> whe /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -6128,7 +4476,7 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> whe /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6136,15 +4484,15 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> whe /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -6164,7 +4512,1105 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> whe /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified context. +/// +/// A builder for the *agent.environments.users.sessions.contexts.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_environments_users_sessions_contexts_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.contexts.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the context to delete. Format: + /// `projects//agent/sessions//contexts/` + /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is + /// not specified, we assume default 'draft' environment. If `User ID` is not + /// specified, we assume default '-' user. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified session entity type. +/// +/// A builder for the *agent.environments.users.sessions.entityTypes.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_environments_users_sessions_entity_types_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.entityTypes.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the entity type to delete. Format: + /// `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified knowledge base. +/// +/// A builder for the *agent.knowledgeBases.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1KnowledgeBase; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1KnowledgeBase::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_knowledge_bases_patch(req, "name") +/// .update_mask("labore") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentKnowledgeBasePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1KnowledgeBase, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBasePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentKnowledgeBasePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1KnowledgeBase)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1KnowledgeBase) -> ProjectAgentKnowledgeBasePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The knowledge base resource name. + /// The name must be empty when creating a knowledge base. + /// Format: `projects//knowledgeBases/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentKnowledgeBasePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. Not specified means `update all`. + /// Currently, only `display_name` can be updated, an InvalidArgument will be + /// returned for attempting to update other fields. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectAgentKnowledgeBasePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBasePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBasePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBasePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates an entity type in the specified agent. +/// +/// A builder for the *agent.entityTypes.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1EntityType; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1EntityType::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_entity_types_create(req, "parent") +/// .language_code("nonumy") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEntityTypeCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1EntityType, + _parent: String, + _language_code: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEntityTypeCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1EntityType)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._language_code { + params.push(("languageCode", value.to_string())); + } + for &field in ["alt", "parent", "languageCode"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1EntityType) -> ProjectAgentEntityTypeCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The agent to create a entity type for. + /// Format: `projects//agent`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentEntityTypeCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. The language of entity synonyms defined in `entity_type`. If not + /// specified, the agent's default language is used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. + /// + /// Sets the *language code* query property to the given value. + pub fn language_code(mut self, new_value: &str) -> ProjectAgentEntityTypeCreateCall<'a, C, A> { + self._language_code = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeCreateCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -6262,7 +5708,7 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextGetCall<'a, C, A> where } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6278,10 +5724,7 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextGetCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6301,7 +5744,7 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextGetCall<'a, C, A> where let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6384,7 +5827,7 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextGetCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6392,12 +5835,12 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextGetCall<'a, C, A> where /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionContextGetCall<'a, C, A> @@ -6432,10 +5875,824 @@ impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextGetCall<'a, C, A> where } +/// Deletes the specified knowledge base. +/// +/// A builder for the *agent.knowledgeBases.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_knowledge_bases_delete("name") +/// .force(false) +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _force: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._force { + params.push(("force", value.to_string())); + } + for &field in ["alt", "name", "force"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the knowledge base to delete. + /// Format: `projects//knowledgeBases/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. Force deletes the knowledge base. When set to true, any documents + /// in the knowledge base are also deleted. + /// + /// Sets the *force* query property to the given value. + pub fn force(mut self, new_value: bool) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> { + self._force = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified document. +/// +/// Operation +/// +/// A builder for the *agent.knowledgeBases.documents.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_knowledge_bases_documents_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.documents.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the document to delete. + /// Format: `projects//knowledgeBases//documents/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified session entity type. +/// +/// A builder for the *agent.sessions.entityTypes.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1SessionEntityType; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1SessionEntityType::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_sessions_entity_types_patch(req, "name") +/// .update_mask("no") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentSessionEntityTypePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1SessionEntityType, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentSessionEntityTypePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1SessionEntityType)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.entityTypes.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1SessionEntityType) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The unique identifier of this session entity type. Format: + /// `projects//agent/sessions//entityTypes/`, or + /// `projects//agent/environments//users//sessions//entityTypes/`. + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// + /// `` must be the display name of an existing entity + /// type in the same agent that will be overridden or supplemented. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. The mask to control which fields get updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates/Creates multiple entity types in the specified agent. /// -/// Operation +/// Operation /// /// A builder for the *agent.entityTypes.batchUpdate* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -6528,7 +6785,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6544,10 +6801,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6579,7 +6833,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6670,7 +6924,7 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6678,12 +6932,12 @@ impl<'a, C, A> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeBatchUpdateCall<'a, C, A> @@ -6811,7 +7065,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseCreateCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6827,10 +7081,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseCreateCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6862,7 +7113,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseCreateCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6953,7 +7204,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseCreateCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6961,12 +7212,12 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseCreateCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseCreateCall<'a, C, A> @@ -7001,6 +7252,293 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseCreateCall<'a, C, A> where C: BorrowMut< } +/// Imports the specified agent from a ZIP file. +/// +/// Uploads new intents and entity types without deleting the existing ones. +/// Intents and entity types with the same name are replaced with the new +/// versions from ImportAgentRequest. +/// +/// +/// Operation +/// +/// A builder for the *agent.import* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1ImportAgentRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1ImportAgentRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_import(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentImportCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1ImportAgentRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentImportCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentImportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.import", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/agent:import"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1ImportAgentRequest) -> ProjectAgentImportCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The project that the agent to import is associated with. + /// Format: `projects/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentImportCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentImportCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentImportCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentImportCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates/Creates multiple intents in the specified agent. /// /// Operation @@ -7096,7 +7634,7 @@ impl<'a, C, A> ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7147,7 +7682,7 @@ impl<'a, C, A> ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentIntentBatchUpdateCall<'a, C, A> @@ -7286,9 +7821,11 @@ impl<'a, C, A> ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut /// -/// A builder for the *conversationProfiles.delete* method supported by a *project* resource. +/// A builder for the *agent.intents.batchDelete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -7300,6 +7837,7 @@ impl<'a, C, A> ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentBatchUpdateCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversation_profiles_delete("name") +/// let result = hub.projects().agent_intents_batch_delete(req, "parent") /// .doit(); /// # } /// ``` -pub struct ProjectConversationProfileDeleteCall<'a, C, A> +pub struct ProjectAgentIntentBatchDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, - _name: String, + _request: GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest, + _parent: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectConversationProfileDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentIntentBatchDeleteCall<'a, C, A> {} -impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentIntentBatchDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -7342,11 +7886,11 @@ impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversationProfiles.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.intents.batchDelete", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -7358,12 +7902,12 @@ impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/intents:batchDelete"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+name}", "name")].iter() { + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { let mut replace_with = String::new(); for &(name, ref value) in params.iter() { if name == param_name { @@ -7372,13 +7916,13 @@ impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { + for param_name in ["parent"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -7388,11 +7932,19 @@ impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -7409,11 +7961,15 @@ impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut } }; let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -7464,16 +8020,24 @@ impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut } - /// Required. The name of the conversation profile to delete. - /// Format: `projects//conversationProfiles/`. /// - /// Sets the *name* path property to the given value. + /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectConversationProfileDeleteCall<'a, C, A> { - self._name = new_value.to_string(); + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The name of the agent to delete all entities types for. Format: + /// `projects//agent`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> { + self._parent = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -7482,7 +8046,7 @@ impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationProfileDeleteCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -7491,7 +8055,7 @@ impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7499,15 +8063,15 @@ impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationProfileDeleteCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -7527,7 +8091,7 @@ impl<'a, C, A> ProjectConversationProfileDeleteCall<'a, C, A> where C: BorrowMut /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationProfileDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -7625,7 +8189,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseGetCall<'a, C, A> where C: BorrowMut ProjectAgentKnowledgeBaseGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7664,7 +8225,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseGetCall<'a, C, A> where C: BorrowMut ProjectAgentKnowledgeBaseGetCall<'a, C, A> where C: BorrowMut ProjectAgentKnowledgeBaseGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseGetCall<'a, C, A> @@ -7797,8 +8358,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseGetCall<'a, C, A> where C: BorrowMut +/// Operation /// /// A builder for the *agent.restore* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -7891,7 +8451,7 @@ impl<'a, C, A> ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7942,7 +8499,7 @@ impl<'a, C, A> ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentRestoreCall<'a, C, A> @@ -8081,3373 +8638,11 @@ impl<'a, C, A> ProjectAgentRestoreCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1Context::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_contexts_patch(req, "name") -/// .update_mask("labore") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1Context, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.contexts.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Context) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The unique identifier of the context. Format: - /// `projects//agent/sessions//contexts/`, - /// or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is - /// always converted to lowercase. If `Environment ID` is not specified, we - /// assume default 'draft' environment. If `User ID` is not specified, we - /// assume default '-' user. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The mask to control which fields get updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates the specified session entity type. -/// -/// A builder for the *agent.environments.users.sessions.entityTypes.patch* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1SessionEntityType; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1SessionEntityType::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_entity_types_patch(req, "name") -/// .update_mask("nonumy") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1SessionEntityType, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1SessionEntityType)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.entityTypes.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1SessionEntityType) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The unique identifier of this session entity type. Format: - /// `projects//agent/sessions//entityTypes/`, or - /// `projects//agent/environments//users//sessions//entityTypes/`. - /// If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - /// - /// `` must be the display name of an existing entity - /// type in the same agent that will be overridden or supplemented. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The mask to control which fields get updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a conversation profile in the specified project. -/// -/// A builder for the *conversationProfiles.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1ConversationProfile; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1ConversationProfile::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversation_profiles_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationProfileCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1ConversationProfile, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationProfileCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationProfileCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ConversationProfile)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversationProfiles.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/conversationProfiles"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1ConversationProfile) -> ProjectConversationProfileCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The project to create a conversation profile for. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectConversationProfileCreateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationProfileCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationProfileCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationProfileCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified context. -/// -/// A builder for the *environments.users.conversations.contexts.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().environments_users_conversations_contexts_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectEnvironmentUserConversationContextDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectEnvironmentUserConversationContextDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectEnvironmentUserConversationContextDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.environments.users.conversations.contexts.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the context to delete. Format: - /// `projects//agent/sessions//contexts/` - /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - /// not specified, we assume default 'draft' environment. If `User ID` is not - /// specified, we assume default '-' user. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectEnvironmentUserConversationContextDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectEnvironmentUserConversationContextDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectEnvironmentUserConversationContextDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectEnvironmentUserConversationContextDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves the specified intent. -/// -/// A builder for the *agent.intents.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_intents_get("name") -/// .language_code("aliquyam") -/// .intent_view("ea") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentIntentGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _language_code: Option, - _intent_view: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentIntentGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentIntentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Intent)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.intents.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._language_code { - params.push(("languageCode", value.to_string())); - } - if let Some(value) = self._intent_view { - params.push(("intentView", value.to_string())); - } - for &field in ["alt", "name", "languageCode", "intentView"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the intent. - /// Format: `projects//agent/intents/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentIntentGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The language to retrieve training phrases, parameters and rich - /// messages for. If not specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. - /// - /// Sets the *language code* query property to the given value. - pub fn language_code(mut self, new_value: &str) -> ProjectAgentIntentGetCall<'a, C, A> { - self._language_code = Some(new_value.to_string()); - self - } - /// Optional. The resource view to apply to the returned intent. - /// - /// Sets the *intent view* query property to the given value. - pub fn intent_view(mut self, new_value: &str) -> ProjectAgentIntentGetCall<'a, C, A> { - self._intent_view = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentIntentGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentIntentGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentIntentGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all session entity types in the specified session. -/// -/// A builder for the *agent.environments.users.sessions.entityTypes.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_entity_types_list("parent") -/// .page_token("justo") -/// .page_size(-21) -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListSessionEntityTypesResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.entityTypes.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The session to list all session entity types from. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users// - /// sessions/`. - /// If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves a human agent assistant. -/// -/// A builder for the *humanAgentAssistants.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().human_agent_assistants_get("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectHumanAgentAssistantGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectHumanAgentAssistantGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectHumanAgentAssistantGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1HumanAgentAssistant)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.humanAgentAssistants.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name of the agent assistant. - /// Format: `projects//humanAgentAssistants/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectHumanAgentAssistantGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectHumanAgentAssistantGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectHumanAgentAssistantGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectHumanAgentAssistantGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all contexts in the specified session. -/// -/// A builder for the *agent.environments.users.sessions.contexts.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_contexts_list("parent") -/// .page_token("diam") -/// .page_size(-55) -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListContextsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.contexts.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The session to list all contexts from. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates the specified conversation profile. -/// -/// A builder for the *conversationProfiles.patch* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1ConversationProfile; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1ConversationProfile::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversation_profiles_patch(req, "name") -/// .update_mask("et") -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationProfilePatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1ConversationProfile, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationProfilePatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationProfilePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ConversationProfile)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversationProfiles.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1ConversationProfile) -> ProjectConversationProfilePatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required for all methods except `create` (`create` populates the name - /// automatically). - /// The unique identifier of this conversation profile. - /// Format: `projects//conversationProfiles/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectConversationProfilePatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Required. The mask to control which fields to update. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectConversationProfilePatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationProfilePatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationProfilePatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationProfilePatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all contexts in the specified session. -/// -/// A builder for the *agent.sessions.contexts.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_sessions_contexts_list("parent") -/// .page_token("aliquyam") -/// .page_size(-9) -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentSessionContextListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentSessionContextListCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentSessionContextListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListContextsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.contexts.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The session to list all contexts from. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentSessionContextListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectAgentSessionContextListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectAgentSessionContextListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionContextListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionContextListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves the specified entity type. -/// -/// A builder for the *agent.entityTypes.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_entity_types_get("name") -/// .language_code("eos") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEntityTypeGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _language_code: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEntityTypeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1EntityType)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._language_code { - params.push(("languageCode", value.to_string())); - } - for &field in ["alt", "name", "languageCode"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the entity type. - /// Format: `projects//agent/entityTypes/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentEntityTypeGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The language to retrieve entity synonyms for. If not specified, - /// the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. - /// - /// Sets the *language code* query property to the given value. - pub fn language_code(mut self, new_value: &str) -> ProjectAgentEntityTypeGetCall<'a, C, A> { - self._language_code = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all documents of the knowledge base. -/// -/// A builder for the *knowledgeBases.documents.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().knowledge_bases_documents_list("parent") -/// .page_token("sadipscing") -/// .page_size(-48) -/// .doit(); -/// # } -/// ``` -pub struct ProjectKnowledgeBaseDocumentListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseDocumentListCall<'a, C, A> {} - -impl<'a, C, A> ProjectKnowledgeBaseDocumentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListDocumentsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.documents.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/documents"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The knowledge base to list all documents for. - /// Format: `projects//knowledgeBases/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 10 and at most 100. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified document. -/// -/// Operation /// -/// A builder for the *knowledgeBases.documents.delete* method supported by a *project* resource. +/// A builder for the *agent.knowledgeBases.documents.patch* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -11459,6 +8654,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentListCall<'a, C, A> where C: BorrowMut /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Document; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -11469,26 +8665,34 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentListCall<'a, C, A> where C: BorrowMut /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1Document::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().knowledge_bases_documents_delete("name") +/// let result = hub.projects().agent_knowledge_bases_documents_patch(req, "name") +/// .update_mask("duo") /// .doit(); /// # } /// ``` -pub struct ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> +pub struct ProjectAgentKnowledgeBaseDocumentPatchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1Document, _name: String, + _update_mask: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseDocumentPatchCall<'a, C, A> {} -impl<'a, C, A> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -11501,11 +8705,14 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> where C: BorrowM Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.documents.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.documents.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -11531,7 +8738,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11547,11 +8754,19 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -11568,11 +8783,15 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> where C: BorrowM } }; let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -11623,7 +8842,17 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> where C: BorrowM } - /// The name of the document to delete. + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Document) -> ProjectAgentKnowledgeBaseDocumentPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The document resource name. + /// The name must be empty when creating a document. /// Format: `projects//knowledgeBases//documents/`. /// @@ -11631,1418 +8860,16 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> where C: BorrowM /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentPatchCall<'a, C, A> { self._name = new_value.to_string(); self } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of agents. -/// -/// Since there is at most one conversational agent per project, this method is -/// useful primarily for listing all agents across projects the caller has -/// access to. One can achieve that with a wildcard project collection id "-". -/// Refer to [List -/// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). -/// -/// A builder for the *agent.search* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_search("parent") -/// .page_token("amet") -/// .page_size(-60) -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentSearchCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1SearchAgentsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.search", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/agent:search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The project to list agents from. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentSearchCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectAgentSearchCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectAgentSearchCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates the specified intent. -/// -/// A builder for the *agent.intents.patch* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Intent; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1Intent::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_intents_patch(req, "name") -/// .update_mask("eirmod") -/// .language_code("dolore") -/// .intent_view("invidunt") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentIntentPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1Intent, - _name: String, - _update_mask: Option, - _language_code: Option, - _intent_view: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentIntentPatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentIntentPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Intent)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.intents.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - if let Some(value) = self._language_code { - params.push(("languageCode", value.to_string())); - } - if let Some(value) = self._intent_view { - params.push(("intentView", value.to_string())); - } - for &field in ["alt", "name", "updateMask", "languageCode", "intentView"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Intent) -> ProjectAgentIntentPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required for all methods except `create` (`create` populates the name - /// automatically. - /// The unique identifier of this intent. - /// Format: `projects//agent/intents/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The mask to control which fields get updated. + /// Optional. Not specified means `update all`. + /// Currently, only `display_name` can be updated, an InvalidArgument will be + /// returned for attempting to update other fields. /// /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// Optional. The language of training phrases, parameters and rich messages - /// defined in `intent`. If not specified, the agent's default language is - /// used. [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. - /// - /// Sets the *language code* query property to the given value. - pub fn language_code(mut self, new_value: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { - self._language_code = Some(new_value.to_string()); - self - } - /// Optional. The resource view to apply to the returned intent. - /// - /// Sets the *intent view* query property to the given value. - pub fn intent_view(mut self, new_value: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { - self._intent_view = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentIntentPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentIntentPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentIntentPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified human agent assistant. -/// -/// A builder for the *humanAgentAssistants.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().human_agent_assistants_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectHumanAgentAssistantDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectHumanAgentAssistantDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectHumanAgentAssistantDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.humanAgentAssistants.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name of the agent assistant. - /// Format: `projects//humanAgentAssistants/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectHumanAgentAssistantDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectHumanAgentAssistantDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectHumanAgentAssistantDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectHumanAgentAssistantDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes all active contexts in the specified session. -/// -/// A builder for the *agent.environments.users.sessions.deleteContexts* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_delete_contexts("parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.deleteContexts", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the session to delete all contexts from. Format: - /// `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates the specified `PhoneNumber`. -/// -/// A builder for the *phoneNumbers.patch* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1PhoneNumber; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1PhoneNumber::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().phone_numbers_patch(req, "name") -/// .update_mask("sea") -/// .doit(); -/// # } -/// ``` -pub struct ProjectPhoneNumberPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1PhoneNumber, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectPhoneNumberPatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectPhoneNumberPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1PhoneNumber)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.phoneNumbers.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1PhoneNumber) -> ProjectPhoneNumberPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The unique identifier of this phone number. - /// Format: `projects//phoneNumbers/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectPhoneNumberPatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The mask to control which fields get updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectPhoneNumberPatchCall<'a, C, A> { + pub fn update_mask(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentPatchCall<'a, C, A> { self._update_mask = Some(new_value.to_string()); self } @@ -13052,7 +8879,7 @@ impl<'a, C, A> ProjectPhoneNumberPatchCall<'a, C, A> where C: BorrowMut ProjectPhoneNumberPatchCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseDocumentPatchCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -13061,7 +8888,7 @@ impl<'a, C, A> ProjectPhoneNumberPatchCall<'a, C, A> where C: BorrowMut ProjectPhoneNumberPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectPhoneNumberPatchCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDocumentPatchCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -13097,7973 +8924,7 @@ impl<'a, C, A> ProjectPhoneNumberPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectPhoneNumberPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all knowledge bases of the specified agent. -/// -/// A builder for the *knowledgeBases.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().knowledge_bases_list("parent") -/// .page_token("duo") -/// .page_size(-21) -/// .doit(); -/// # } -/// ``` -pub struct ProjectKnowledgeBaseListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseListCall<'a, C, A> {} - -impl<'a, C, A> ProjectKnowledgeBaseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListKnowledgeBasesResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/knowledgeBases"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The project to list of knowledge bases for. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectKnowledgeBaseListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectKnowledgeBaseListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 10 and at most 100. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectKnowledgeBaseListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes all active contexts in the specified session. -/// -/// A builder for the *agent.sessions.deleteContexts* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_sessions_delete_contexts("parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentSessionDeleteContextCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentSessionDeleteContextCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentSessionDeleteContextCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.deleteContexts", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the session to delete all contexts from. Format: - /// `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentSessionDeleteContextCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionDeleteContextCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionDeleteContextCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionDeleteContextCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified document. -/// -/// Operation -/// -/// A builder for the *agent.knowledgeBases.documents.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_knowledge_bases_documents_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.documents.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The name of the document to delete. - /// Format: `projects//knowledgeBases//documents/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseDocumentDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes entity types in the specified agent. -/// -/// Operation -/// -/// A builder for the *agent.entityTypes.batchDelete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_entity_types_batch_delete(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.batchDelete", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes:batchDelete"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The name of the agent to delete all entities types for. Format: - /// `projects//agent`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Imports the specified agent from a ZIP file. -/// -/// Uploads new intents and entity types without deleting the existing ones. -/// Intents and entity types with the same name are replaced with the new -/// versions from ImportAgentRequest. -/// -/// -/// Operation -/// -/// A builder for the *agent.import* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1ImportAgentRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1ImportAgentRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_import(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentImportCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1ImportAgentRequest, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentImportCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentImportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.import", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/agent:import"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1ImportAgentRequest) -> ProjectAgentImportCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The project that the agent to import is associated with. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentImportCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentImportCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentImportCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentImportCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a context. -/// -/// If the specified context already exists, overrides the context. -/// -/// A builder for the *environments.users.conversations.contexts.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Context; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1Context::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().environments_users_conversations_contexts_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectEnvironmentUserConversationContextCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1Context, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectEnvironmentUserConversationContextCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectEnvironmentUserConversationContextCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.environments.users.conversations.contexts.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Context) -> ProjectEnvironmentUserConversationContextCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The session to create a context for. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectEnvironmentUserConversationContextCreateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectEnvironmentUserConversationContextCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectEnvironmentUserConversationContextCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectEnvironmentUserConversationContextCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates the specified context. -/// -/// A builder for the *environments.users.conversations.contexts.patch* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Context; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1Context::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().environments_users_conversations_contexts_patch(req, "name") -/// .update_mask("ut") -/// .doit(); -/// # } -/// ``` -pub struct ProjectEnvironmentUserConversationContextPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1Context, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectEnvironmentUserConversationContextPatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectEnvironmentUserConversationContextPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.environments.users.conversations.contexts.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Context) -> ProjectEnvironmentUserConversationContextPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The unique identifier of the context. Format: - /// `projects//agent/sessions//contexts/`, - /// or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is - /// always converted to lowercase. If `Environment ID` is not specified, we - /// assume default 'draft' environment. If `User ID` is not specified, we - /// assume default '-' user. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectEnvironmentUserConversationContextPatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The mask to control which fields get updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectEnvironmentUserConversationContextPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectEnvironmentUserConversationContextPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectEnvironmentUserConversationContextPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectEnvironmentUserConversationContextPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all knowledge bases of the specified agent. -/// -/// A builder for the *agent.knowledgeBases.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_knowledge_bases_list("parent") -/// .page_token("sed") -/// .page_size(-3) -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentKnowledgeBaseListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseListCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentKnowledgeBaseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListKnowledgeBasesResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/knowledgeBases"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The project to list of knowledge bases for. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 10 and at most 100. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates or creates multiple entities in the specified entity type. This -/// method does not affect entities in the entity type that aren't explicitly -/// specified in the request. -/// -/// Operation -/// -/// A builder for the *agent.entityTypes.entities.batchUpdate* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_entity_types_entities_batch_update(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.entities.batchUpdate", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entities:batchUpdate"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The name of the entity type to update or create entities in. - /// Format: `projects//agent/entityTypes/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a context. -/// -/// If the specified context already exists, overrides the context. -/// -/// A builder for the *agent.sessions.contexts.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Context; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1Context::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_sessions_contexts_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentSessionContextCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1Context, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentSessionContextCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentSessionContextCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.contexts.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Context) -> ProjectAgentSessionContextCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The session to create a context for. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentSessionContextCreateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionContextCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionContextCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all session entity types in the specified session. -/// -/// A builder for the *agent.sessions.entityTypes.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_sessions_entity_types_list("parent") -/// .page_token("consetetur") -/// .page_size(-52) -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentSessionEntityTypeListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentSessionEntityTypeListCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentSessionEntityTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListSessionEntityTypesResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.entityTypes.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The session to list all session entity types from. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users// - /// sessions/`. - /// If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Cancels an `PhoneNumberOrder`. -/// Returns an error if the order is in state -/// IN_PROGRESS or -/// COMPLETED. -/// -/// A builder for the *phoneNumberOrders.cancel* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1CancelPhoneNumberOrderRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1CancelPhoneNumberOrderRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().phone_number_orders_cancel(req, "name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectPhoneNumberOrderCancelCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1CancelPhoneNumberOrderRequest, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectPhoneNumberOrderCancelCall<'a, C, A> {} - -impl<'a, C, A> ProjectPhoneNumberOrderCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.phoneNumberOrders.cancel", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}:cancel"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1CancelPhoneNumberOrderRequest) -> ProjectPhoneNumberOrderCancelCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The unique identifier of the order to delete. - /// Format: `projects//phoneNumberOrders/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectPhoneNumberOrderCancelCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectPhoneNumberOrderCancelCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectPhoneNumberOrderCancelCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectPhoneNumberOrderCancelCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves the specified knowledge base. -/// -/// A builder for the *knowledgeBases.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().knowledge_bases_get("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectKnowledgeBaseGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectKnowledgeBaseGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1KnowledgeBase)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the knowledge base to retrieve. - /// Format `projects//knowledgeBases/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectKnowledgeBaseGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates the specified human agent assistant. -/// -/// A builder for the *humanAgentAssistants.patch* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1HumanAgentAssistant; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1HumanAgentAssistant::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().human_agent_assistants_patch(req, "name") -/// .update_mask("justo") -/// .doit(); -/// # } -/// ``` -pub struct ProjectHumanAgentAssistantPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1HumanAgentAssistant, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectHumanAgentAssistantPatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectHumanAgentAssistantPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1HumanAgentAssistant)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.humanAgentAssistants.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1HumanAgentAssistant) -> ProjectHumanAgentAssistantPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required for all methods except `create` (`create` populates the name - /// automatically). - /// The unique identifier of human agent assistant. - /// Format: `projects//humanAgentAssistants/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectHumanAgentAssistantPatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The mask to specify which fields to update. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectHumanAgentAssistantPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectHumanAgentAssistantPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectHumanAgentAssistantPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectHumanAgentAssistantPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Processes a natural language query and returns structured, actionable data -/// as a result. This method is not idempotent, because it may cause contexts -/// and session entity types to be updated, which in turn might affect -/// results of future queries. -/// -/// A builder for the *agent.environments.users.sessions.detectIntent* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1DetectIntentRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1DetectIntentRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_detect_intent(req, "session") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1DetectIntentRequest, - _session: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1DetectIntentResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.detectIntent", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("session", self._session.to_string())); - for &field in ["alt", "session"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+session}:detectIntent"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+session}", "session")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["session"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1DetectIntentRequest) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The name of the session this query is sent to. Format: - /// `projects//agent/sessions/`, or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we are using - /// "-". It’s up to the API caller to choose an appropriate `Session ID` and - /// `User Id`. They can be a random numbers or some type of user and session - /// identifiers (preferably hashed). The length of the `Session ID` and - /// `User ID` must not exceed 36 characters. - /// - /// Sets the *session* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn session(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> { - self._session = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Requests deletion of a `PhoneNumber`. The `PhoneNumber` is moved into the -/// DELETE_REQUESTED state -/// immediately, and is deleted approximately 30 days later. This method may -/// only be called on a `PhoneNumber` in the -/// ACTIVE state. -/// -/// A builder for the *phoneNumbers.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().phone_numbers_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectPhoneNumberDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectPhoneNumberDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectPhoneNumberDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1PhoneNumber)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.phoneNumbers.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The unique identifier of the `PhoneNumber` to delete. - /// Format: `projects//phoneNumbers/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectPhoneNumberDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectPhoneNumberDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectPhoneNumberDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectPhoneNumberDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified entity type. -/// -/// A builder for the *agent.entityTypes.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_entity_types_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEntityTypeDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEntityTypeDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the entity type to delete. - /// Format: `projects//agent/entityTypes/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates the specified context. -/// -/// A builder for the *agent.sessions.contexts.patch* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Context; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1Context::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_sessions_contexts_patch(req, "name") -/// .update_mask("consetetur") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentSessionContextPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1Context, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentSessionContextPatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentSessionContextPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.contexts.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Context) -> ProjectAgentSessionContextPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The unique identifier of the context. Format: - /// `projects//agent/sessions//contexts/`, - /// or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is - /// always converted to lowercase. If `Environment ID` is not specified, we - /// assume default 'draft' environment. If `User ID` is not specified, we - /// assume default '-' user. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentSessionContextPatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The mask to control which fields get updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectAgentSessionContextPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionContextPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionContextPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves the specified context. -/// -/// A builder for the *agent.sessions.contexts.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_sessions_contexts_get("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentSessionContextGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentSessionContextGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentSessionContextGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.contexts.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the context. Format: - /// `projects//agent/sessions//contexts/` - /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - /// not specified, we assume default 'draft' environment. If `User ID` is not - /// specified, we assume default '-' user. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentSessionContextGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionContextGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionContextGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves a conversation participant. -/// -/// A builder for the *conversations.participants.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_participants_get("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationParticipantGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationParticipantGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationParticipantGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Participant)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.participants.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the participant. Format: - /// `projects//conversations//participants/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectConversationParticipantGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationParticipantGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationParticipantGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationParticipantGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Trains the specified agent. -/// -/// -/// Operation -/// -/// A builder for the *agent.train* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1TrainAgentRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1TrainAgentRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_train(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentTrainCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1TrainAgentRequest, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentTrainCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentTrainCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.train", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/agent:train"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1TrainAgentRequest) -> ProjectAgentTrainCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The project that the agent to train is associated with. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentTrainCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentTrainCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentTrainCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentTrainCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified context. -/// -/// A builder for the *agent.sessions.contexts.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_sessions_contexts_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentSessionContextDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentSessionContextDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentSessionContextDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.contexts.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the context to delete. Format: - /// `projects//agent/sessions//contexts/` - /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - /// not specified, we assume default 'draft' environment. If `User ID` is not - /// specified, we assume default '-' user. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentSessionContextDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionContextDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionContextDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all contexts in the specified session. -/// -/// A builder for the *environments.users.conversations.contexts.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().environments_users_conversations_contexts_list("parent") -/// .page_token("dolore") -/// .page_size(-19) -/// .doit(); -/// # } -/// ``` -pub struct ProjectEnvironmentUserConversationContextListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectEnvironmentUserConversationContextListCall<'a, C, A> {} - -impl<'a, C, A> ProjectEnvironmentUserConversationContextListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListContextsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.environments.users.conversations.contexts.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The session to list all contexts from. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectEnvironmentUserConversationContextListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectEnvironmentUserConversationContextListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectEnvironmentUserConversationContextListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectEnvironmentUserConversationContextListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectEnvironmentUserConversationContextListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectEnvironmentUserConversationContextListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves the specified context. -/// -/// A builder for the *environments.users.conversations.contexts.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().environments_users_conversations_contexts_get("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectEnvironmentUserConversationContextGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectEnvironmentUserConversationContextGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectEnvironmentUserConversationContextGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.environments.users.conversations.contexts.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the context. Format: - /// `projects//agent/sessions//contexts/` - /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - /// not specified, we assume default 'draft' environment. If `User ID` is not - /// specified, we assume default '-' user. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectEnvironmentUserConversationContextGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectEnvironmentUserConversationContextGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectEnvironmentUserConversationContextGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectEnvironmentUserConversationContextGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all participants in the specified conversation. -/// -/// A builder for the *conversations.participants.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_participants_list("parent") -/// .page_token("et") -/// .page_size(-13) -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationParticipantListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationParticipantListCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationParticipantListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListParticipantsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.participants.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/participants"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The conversation to list all contexts from. - /// Format: `projects//conversations/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectConversationParticipantListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectConversationParticipantListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectConversationParticipantListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationParticipantListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationParticipantListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationParticipantListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified context. -/// -/// A builder for the *agent.environments.users.sessions.contexts.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_contexts_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.contexts.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the context to delete. Format: - /// `projects//agent/sessions//contexts/` - /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is - /// not specified, we assume default 'draft' environment. If `User ID` is not - /// specified, we assume default '-' user. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionContextDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified session entity type. -/// -/// A builder for the *agent.environments.users.sessions.entityTypes.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_entity_types_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.entityTypes.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the entity type to delete. Format: - /// `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionEntityTypeDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates an order to request phone numbers be added to a project. -/// The initial `LifecycleState` of a newly created order is -/// PENDING. -/// -/// A builder for the *phoneNumberOrders.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1PhoneNumberOrder; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1PhoneNumberOrder::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().phone_number_orders_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectPhoneNumberOrderCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1PhoneNumberOrder, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectPhoneNumberOrderCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectPhoneNumberOrderCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1PhoneNumberOrder)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.phoneNumberOrders.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/phoneNumberOrders"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1PhoneNumberOrder) -> ProjectPhoneNumberOrderCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. Resource identifier of the project requesting the orders. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectPhoneNumberOrderCreateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectPhoneNumberOrderCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectPhoneNumberOrderCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectPhoneNumberOrderCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists of all `PhoneNumberOrder` resources in the specified project. -/// -/// A builder for the *phoneNumberOrders.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().phone_number_orders_list("parent") -/// .page_token("sanctus") -/// .page_size(-58) -/// .doit(); -/// # } -/// ``` -pub struct ProjectPhoneNumberOrderListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectPhoneNumberOrderListCall<'a, C, A> {} - -impl<'a, C, A> ProjectPhoneNumberOrderListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListPhoneNumberOrdersResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.phoneNumberOrders.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/phoneNumberOrders"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The project to list all orders from. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectPhoneNumberOrderListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectPhoneNumberOrderListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. - /// The default value is 100. The maximum value is 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectPhoneNumberOrderListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectPhoneNumberOrderListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectPhoneNumberOrderListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectPhoneNumberOrderListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseDocumentPatchCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -21171,7 +9032,7 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -21187,10 +9048,7 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21222,7 +9080,7 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21320,7 +9178,7 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21328,12 +9186,12 @@ impl<'a, C, A> ProjectAgentSessionDetectIntentCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionDetectIntentCall<'a, C, A> @@ -21464,7 +9322,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentCreateCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -21480,10 +9338,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentCreateCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21515,7 +9370,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentCreateCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21606,7 +9461,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentCreateCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21614,12 +9469,12 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentCreateCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseDocumentCreateCall<'a, C, A> @@ -21654,9 +9509,9 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentCreateCall<'a, C, A> where C: BorrowM } -/// Retrieves the specific conversation. +/// Deletes the specified context. /// -/// A builder for the *conversations.get* method supported by a *project* resource. +/// A builder for the *agent.sessions.contexts.delete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -21681,11 +9536,11 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentCreateCall<'a, C, A> where C: BorrowM /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_get("name") +/// let result = hub.projects().agent_sessions_contexts_delete("name") /// .doit(); /// # } /// ``` -pub struct ProjectConversationGetCall<'a, C, A> +pub struct ProjectAgentSessionContextDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, @@ -21695,13 +9550,13 @@ pub struct ProjectConversationGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectConversationGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentSessionContextDeleteCall<'a, C, A> {} -impl<'a, C, A> ProjectConversationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentSessionContextDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Conversation)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -21710,8 +9565,8 @@ impl<'a, C, A> ProjectConversationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.get", - http_method: hyper::method::Method::Get }); + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.contexts.delete", + http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); for &field in ["alt", "name"].iter() { @@ -21740,7 +9595,7 @@ impl<'a, C, A> ProjectConversationGetCall<'a, C, A> where C: BorrowMut ProjectConversationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21779,7 +9631,7 @@ impl<'a, C, A> ProjectConversationGetCall<'a, C, A> where C: BorrowMut ProjectConversationGetCall<'a, C, A> where C: BorrowMut/conversations/`. + /// Required. The name of the context to delete. Format: + /// `projects//agent/sessions//contexts/` + /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is + /// not specified, we assume default 'draft' environment. If `User ID` is not + /// specified, we assume default '-' user. /// /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectConversationGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectAgentSessionContextDeleteCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -21849,7 +9705,7 @@ impl<'a, C, A> ProjectConversationGetCall<'a, C, A> where C: BorrowMut ProjectConversationGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionContextDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -21858,7 +9714,7 @@ impl<'a, C, A> ProjectConversationGetCall<'a, C, A> where C: BorrowMut ProjectConversationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectConversationGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -21894,7 +9750,1138 @@ impl<'a, C, A> ProjectConversationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectConversationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionContextDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified context. +/// +/// A builder for the *agent.environments.users.sessions.contexts.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Context; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1Context::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_environments_users_sessions_contexts_patch(req, "name") +/// .update_mask("erat") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1Context, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.contexts.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Context) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The unique identifier of the context. Format: + /// `projects//agent/sessions//contexts/`, + /// or `projects//agent/environments//users//sessions//contexts/`. + /// + /// The `Context ID` is always converted to lowercase, may only contain + /// characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + /// + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. The mask to control which fields get updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionContextPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the specified agent. +/// +/// A builder for the *getAgent* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().get_agent("parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectGetAgentCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectGetAgentCall<'a, C, A> {} + +impl<'a, C, A> ProjectGetAgentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Agent)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.getAgent", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/agent"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The project that the agent to fetch is associated with. + /// Format: `projects/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectGetAgentCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetAgentCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectGetAgentCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectGetAgentCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified session entity type. +/// +/// A builder for the *agent.environments.users.sessions.entityTypes.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1SessionEntityType; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1SessionEntityType::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_environments_users_sessions_entity_types_patch(req, "name") +/// .update_mask("eirmod") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1SessionEntityType, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1SessionEntityType)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.entityTypes.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1SessionEntityType) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The unique identifier of this session entity type. Format: + /// `projects//agent/sessions//entityTypes/`, or + /// `projects//agent/environments//users//sessions//entityTypes/`. + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// + /// `` must be the display name of an existing entity + /// type in the same agent that will be overridden or supplemented. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. The mask to control which fields get updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionEntityTypePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes entity types in the specified agent. +/// +/// Operation +/// +/// A builder for the *agent.entityTypes.batchDelete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_entity_types_batch_delete(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.batchDelete", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes:batchDelete"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1BatchDeleteEntityTypesRequest) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The name of the agent to delete all entities types for. Format: + /// `projects//agent`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeBatchDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -21997,7 +10984,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDeleteCall<'a, C, A> where C: BorrowMut ProjectKnowledgeBaseDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22036,7 +11020,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDeleteCall<'a, C, A> where C: BorrowMut ProjectKnowledgeBaseDeleteCall<'a, C, A> where C: BorrowMut ProjectKnowledgeBaseDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectKnowledgeBaseDeleteCall<'a, C, A> @@ -22171,307 +11155,9 @@ impl<'a, C, A> ProjectKnowledgeBaseDeleteCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1PhoneNumberOrder::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().phone_number_orders_patch(req, "name") -/// .update_mask("dolore") -/// .doit(); -/// # } -/// ``` -pub struct ProjectPhoneNumberOrderPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1PhoneNumberOrder, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectPhoneNumberOrderPatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectPhoneNumberOrderPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1PhoneNumberOrder)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.phoneNumberOrders.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1PhoneNumberOrder) -> ProjectPhoneNumberOrderPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The unique identifier of this order. - /// Format: `projects//phoneNumberOrders/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectPhoneNumberOrderPatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The mask to control which fields get updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectPhoneNumberOrderPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectPhoneNumberOrderPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectPhoneNumberOrderPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectPhoneNumberOrderPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes all active contexts in the specified session. -/// -/// A builder for the *environments.users.conversations.deleteContexts* method supported by a *project* resource. +/// A builder for the *agent.knowledgeBases.list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -22496,1087 +11182,13 @@ impl<'a, C, A> ProjectPhoneNumberOrderPatchCall<'a, C, A> where C: BorrowMut - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectEnvironmentUserConversationDeleteContextCall<'a, C, A> {} - -impl<'a, C, A> ProjectEnvironmentUserConversationDeleteContextCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.environments.users.conversations.deleteContexts", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the session to delete all contexts from. Format: - /// `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectEnvironmentUserConversationDeleteContextCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectEnvironmentUserConversationDeleteContextCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectEnvironmentUserConversationDeleteContextCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectEnvironmentUserConversationDeleteContextCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets the latest state of a long-running operation. Clients can use this -/// method to poll the operation result at intervals as recommended by the API -/// service. -/// -/// A builder for the *operations.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().operations_get("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectOperationGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectOperationGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.operations.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The name of the operation resource. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectOperationGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOperationGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectOperationGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectOperationGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a new participant in a conversation. -/// -/// A builder for the *conversations.participants.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Participant; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1Participant::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_participants_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationParticipantCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1Participant, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationParticipantCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationParticipantCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Participant)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.participants.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/participants"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Participant) -> ProjectConversationParticipantCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. Resource identifier of the conversation adding the participant. - /// Format: `projects//conversations/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectConversationParticipantCreateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationParticipantCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationParticipantCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationParticipantCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Sets a phone number for this converstion to connect to. -/// -/// A builder for the *conversations.addConversationPhoneNumber* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1AddConversationPhoneNumberRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1AddConversationPhoneNumberRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_add_conversation_phone_number(req, "name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationAddConversationPhoneNumberCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1AddConversationPhoneNumberRequest, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationAddConversationPhoneNumberCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationAddConversationPhoneNumberCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ConversationPhoneNumber)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.addConversationPhoneNumber", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}:addConversationPhoneNumber"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1AddConversationPhoneNumberRequest) -> ProjectConversationAddConversationPhoneNumberCall<'a, C, A> { - self._request = new_value; - self - } - /// The name of this conversation. - /// Format: `projects//conversations/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectConversationAddConversationPhoneNumberCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationAddConversationPhoneNumberCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationAddConversationPhoneNumberCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationAddConversationPhoneNumberCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all conversation profiles in the specified project. -/// -/// A builder for the *conversationProfiles.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversation_profiles_list("parent") -/// .page_token("consetetur") -/// .page_size(-85) -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationProfileListCall<'a, C, A> +pub struct ProjectAgentKnowledgeBaseListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, @@ -23588,13 +11200,13 @@ pub struct ProjectConversationProfileListCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectConversationProfileListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseListCall<'a, C, A> {} -impl<'a, C, A> ProjectConversationProfileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentKnowledgeBaseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListConversationProfilesResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListKnowledgeBasesResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -23603,7 +11215,7 @@ impl<'a, C, A> ProjectConversationProfileListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversationProfiles.list", + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); @@ -23625,2875 +11237,6 @@ impl<'a, C, A> ProjectConversationProfileListCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The project to list all conversation profiles from. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectConversationProfileListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectConversationProfileListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectConversationProfileListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationProfileListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationProfileListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationProfileListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a session entity type. -/// -/// If the specified session entity type already exists, overrides the -/// session entity type. -/// -/// A builder for the *agent.environments.users.sessions.entityTypes.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1SessionEntityType; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1SessionEntityType::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_entity_types_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1SessionEntityType, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1SessionEntityType)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.entityTypes.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1SessionEntityType) -> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The session to create a session entity type for. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users// - /// sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a context. -/// -/// If the specified context already exists, overrides the context. -/// -/// A builder for the *agent.environments.users.sessions.contexts.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Context; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1Context::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_environments_users_sessions_contexts_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1Context, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.contexts.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Context) -> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The session to create a context for. - /// Format: `projects//agent/sessions/` or - /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume - /// default 'draft' environment. If `User ID` is not specified, we assume - /// default '-' user. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates an entity type in the specified agent. -/// -/// A builder for the *agent.entityTypes.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1EntityType; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1EntityType::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_entity_types_create(req, "parent") -/// .language_code("aliquyam") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEntityTypeCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1EntityType, - _parent: String, - _language_code: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEntityTypeCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1EntityType)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._language_code { - params.push(("languageCode", value.to_string())); - } - for &field in ["alt", "parent", "languageCode"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1EntityType) -> ProjectAgentEntityTypeCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The agent to create a entity type for. - /// Format: `projects//agent`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentEntityTypeCreateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The language of entity synonyms defined in `entity_type`. If not - /// specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. - /// - /// Sets the *language code* query property to the given value. - pub fn language_code(mut self, new_value: &str) -> ProjectAgentEntityTypeCreateCall<'a, C, A> { - self._language_code = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Adds a text (chat, for example), or audio (phone recording, for example) -/// message from a participan into the conversation. -/// Note: This method is only available through the gRPC API (not REST). -/// -/// The top-level message sent to the client by the server is -/// `StreamingAnalyzeContentResponse`. Multiple response messages can be -/// returned in order. The first one or more messages contain the -/// `recognition_result` field. Each result represents a more complete -/// transcript of what the user said. The next message contains the -/// `reply_text` field and potentially the `reply_audio` field. The message can -/// also contain the `automated_agent_reply` field. -/// -/// A builder for the *conversations.participants.streamingAnalyzeContent* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1StreamingAnalyzeContentRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1StreamingAnalyzeContentRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_participants_streaming_analyze_content(req, "participant") -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationParticipantStreamingAnalyzeContentCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1StreamingAnalyzeContentRequest, - _participant: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationParticipantStreamingAnalyzeContentCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationParticipantStreamingAnalyzeContentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1StreamingAnalyzeContentResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.participants.streamingAnalyzeContent", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("participant", self._participant.to_string())); - for &field in ["alt", "participant"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+participant}:streamingAnalyzeContent"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+participant}", "participant")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["participant"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1StreamingAnalyzeContentRequest) -> ProjectConversationParticipantStreamingAnalyzeContentCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The name of the participant this text comes from. - /// Format: `projects//conversations//participants/`. - /// - /// Sets the *participant* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn participant(mut self, new_value: &str) -> ProjectConversationParticipantStreamingAnalyzeContentCall<'a, C, A> { - self._participant = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationParticipantStreamingAnalyzeContentCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationParticipantStreamingAnalyzeContentCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationParticipantStreamingAnalyzeContentCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes entities in the specified entity type. -/// -/// Operation -/// -/// A builder for the *agent.entityTypes.entities.batchDelete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1BatchDeleteEntitiesRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1BatchDeleteEntitiesRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_entity_types_entities_batch_delete(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1BatchDeleteEntitiesRequest, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.entities.batchDelete", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entities:batchDelete"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1BatchDeleteEntitiesRequest) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The name of the entity type to delete entries for. Format: - /// `projects//agent/entityTypes/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a new document. -/// -/// Operation -/// -/// A builder for the *agent.knowledgeBases.documents.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Document; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1Document::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_knowledge_bases_documents_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1Document, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.documents.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/documents"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Document) -> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The knoweldge base to create a document for. - /// Format: `projects//knowledgeBases/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates the specified entity type. -/// -/// A builder for the *agent.entityTypes.patch* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1EntityType; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1EntityType::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_entity_types_patch(req, "name") -/// .update_mask("ipsum") -/// .language_code("aliquyam") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentEntityTypePatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1EntityType, - _name: String, - _update_mask: Option, - _language_code: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentEntityTypePatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentEntityTypePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1EntityType)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - if let Some(value) = self._language_code { - params.push(("languageCode", value.to_string())); - } - for &field in ["alt", "name", "updateMask", "languageCode"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1EntityType) -> ProjectAgentEntityTypePatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required for all methods except `create` (`create` populates the name - /// automatically. - /// The unique identifier of the entity type. Format: - /// `projects//agent/entityTypes/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentEntityTypePatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. The mask to control which fields get updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectAgentEntityTypePatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// Optional. The language of entity synonyms defined in `entity_type`. If not - /// specified, the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. - /// - /// Sets the *language code* query property to the given value. - pub fn language_code(mut self, new_value: &str) -> ProjectAgentEntityTypePatchCall<'a, C, A> { - self._language_code = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypePatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypePatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypePatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves suggestions for live agents. -/// -/// This method should be used by human agent client software to fetch -/// suggestions in real-time, while the conversation with an end user is in -/// progress. The functionality is implemented in terms of the -/// [list pagination](/apis/design/design_patterns#list_pagination) -/// design pattern. The client app should use the `next_page_token` field -/// to fetch the next batch of suggestions. -/// -/// A builder for the *conversations.participants.suggestions.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_participants_suggestions_list("parent") -/// .page_token("sit") -/// .page_size(-41) -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationParticipantSuggestionListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationParticipantSuggestionListCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationParticipantSuggestionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListSuggestionsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.participants.suggestions.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/suggestions"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the conversation participant for whom to fetch - /// suggestions. - /// Format: `projects//conversations//participants/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectConversationParticipantSuggestionListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectConversationParticipantSuggestionListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. The - /// default value is 100; the maximum value is 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectConversationParticipantSuggestionListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationParticipantSuggestionListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationParticipantSuggestionListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationParticipantSuggestionListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves the specified agent. -/// -/// A builder for the *getAgent* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().get_agent("parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectGetAgentCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectGetAgentCall<'a, C, A> {} - -impl<'a, C, A> ProjectGetAgentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Agent)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.getAgent", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/agent"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The project that the agent to fetch is associated with. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectGetAgentCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectGetAgentCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectGetAgentCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectGetAgentCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a knowledge base. -/// -/// A builder for the *knowledgeBases.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1KnowledgeBase; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1KnowledgeBase::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().knowledge_bases_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectKnowledgeBaseCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1KnowledgeBase, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseCreateCall<'a, C, A> {} - -impl<'a, C, A> ProjectKnowledgeBaseCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1KnowledgeBase)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/knowledgeBases"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); @@ -26508,7 +11251,7 @@ impl<'a, C, A> ProjectKnowledgeBaseCreateCall<'a, C, A> where C: BorrowMut ProjectKnowledgeBaseCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1KnowledgeBase) -> ProjectKnowledgeBaseCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The project to create a knowledge base for. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectKnowledgeBaseCreateCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all documents of the knowledge base. -/// -/// A builder for the *agent.knowledgeBases.documents.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_knowledge_bases_documents_list("parent") -/// .page_token("amet") -/// .page_size(-23) -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListDocumentsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.documents.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/documents"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26833,7 +11287,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26886,21 +11340,21 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: Borr } - /// Required. The knowledge base to list all documents for. - /// Format: `projects//knowledgeBases/`. + /// Required. The project to list of knowledge bases for. + /// Format: `projects/`. /// /// Sets the *parent* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> { self._parent = new_value.to_string(); self } /// Optional. The next_page_token value returned from a previous list request. /// /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> { + pub fn page_token(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } @@ -26908,7 +11362,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: Borr /// default 10 and at most 100. /// /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> { + pub fn page_size(mut self, new_value: i32) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> { self._page_size = Some(new_value); self } @@ -26918,7 +11372,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: Borr /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -26927,7 +11381,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -26935,15 +11389,15 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: Borr /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -26963,7 +11417,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: Borr /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -26975,10 +11429,12 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: Borr } -/// Completes the specified conversation. Finished conversations are purged -/// from the database after 30 days. +/// Exports the specified agent to a ZIP file. +/// +/// +/// Operation /// -/// A builder for the *conversations.complete* method supported by a *project* resource. +/// A builder for the *agent.export* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -26990,7 +11446,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: Borr /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1CompleteConversationRequest; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1ExportAgentRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -27004,1365 +11460,33 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: Borr /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1CompleteConversationRequest::default(); +/// let mut req = GoogleCloudDialogflowV2beta1ExportAgentRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_complete(req, "name") +/// let result = hub.projects().agent_export(req, "parent") /// .doit(); /// # } /// ``` -pub struct ProjectConversationCompleteCall<'a, C, A> +pub struct ProjectAgentExportCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1CompleteConversationRequest, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationCompleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationCompleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Conversation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.complete", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}:complete"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1CompleteConversationRequest) -> ProjectConversationCompleteCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. Resource identifier of the conversation to close. - /// Format: `projects//conversations/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectConversationCompleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationCompleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationCompleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationCompleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified intent and its direct or indirect followup intents. -/// -/// A builder for the *agent.intents.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_intents_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentIntentDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentIntentDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentIntentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.intents.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the intent to delete. If this intent has direct or - /// indirect followup intents, we also delete them. - /// - /// Format: `projects//agent/intents/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentIntentDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentIntentDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentIntentDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentIntentDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists messages that belong to a given conversation. -/// -/// A builder for the *conversations.messages.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_messages_list("parent") -/// .page_token("est") -/// .page_size(-63) -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationMessageListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationMessageListCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationMessageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListMessagesResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.messages.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/messages"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the conversation to list messages for. - /// Format: `projects//conversations/` - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectConversationMessageListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectConversationMessageListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectConversationMessageListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationMessageListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationMessageListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationMessageListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes the specified knowledge base. -/// -/// A builder for the *agent.knowledgeBases.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_knowledge_bases_delete("name") -/// .force(false) -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _force: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._force { - params.push(("force", value.to_string())); - } - for &field in ["alt", "name", "force"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the knowledge base to delete. - /// Format: `projects//knowledgeBases/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. Force deletes the knowledge base. When set to true, any documents - /// in the knowledge base are also deleted. - /// - /// Sets the *force* query property to the given value. - pub fn force(mut self, new_value: bool) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> { - self._force = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves the specified conversation profile. -/// -/// A builder for the *conversationProfiles.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversation_profiles_get("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationProfileGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectConversationProfileGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectConversationProfileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ConversationProfile)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversationProfiles.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name of the conversation profile. - /// Format: `projects//conversationProfiles/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectConversationProfileGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationProfileGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationProfileGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationProfileGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a new conversation. Conversation are auto-completed after 24 hours. -/// -/// A builder for the *conversations.create* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Conversation; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1Conversation::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_create(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectConversationCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1Conversation, + _request: GoogleCloudDialogflowV2beta1ExportAgentRequest, _parent: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectConversationCreateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentExportCall<'a, C, A> {} -impl<'a, C, A> ProjectConversationCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Conversation)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -28371,7 +11495,7 @@ impl<'a, C, A> ProjectConversationCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.create", + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.export", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); @@ -28387,7 +11511,7 @@ impl<'a, C, A> ProjectConversationCreateCall<'a, C, A> where C: BorrowMut ProjectConversationCreateCall<'a, C, A> where C: BorrowMut ProjectConversationCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -28452,7 +11573,7 @@ impl<'a, C, A> ProjectConversationCreateCall<'a, C, A> where C: BorrowMut ProjectConversationCreateCall<'a, C, A> where C: BorrowMut ProjectConversationCreateCall<'a, C, A> { + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1ExportAgentRequest) -> ProjectAgentExportCall<'a, C, A> { self._request = new_value; self } - /// Required. Resource identifier of the project creating the conversation. + /// Required. The project that the agent to export is associated with. /// Format: `projects/`. /// /// Sets the *parent* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectConversationCreateCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> ProjectAgentExportCall<'a, C, A> { self._parent = new_value.to_string(); self } @@ -28534,7 +11655,7 @@ impl<'a, C, A> ProjectConversationCreateCall<'a, C, A> where C: BorrowMut ProjectConversationCreateCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentExportCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -28543,7 +11664,7 @@ impl<'a, C, A> ProjectConversationCreateCall<'a, C, A> where C: BorrowMut ProjectConversationCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectConversationCreateCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentExportCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -28579,7 +11700,7 @@ impl<'a, C, A> ProjectConversationCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectConversationCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentExportCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -28591,9 +11712,14 @@ impl<'a, C, A> ProjectConversationCreateCall<'a, C, A> where C: BorrowMut /// -/// A builder for the *conversations.list* method supported by a *project* resource. +/// A builder for the *agent.knowledgeBases.documents.reload* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -28605,6 +11731,7 @@ impl<'a, C, A> ProjectConversationCreateCall<'a, C, A> where C: BorrowMut ProjectConversationCreateCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1ReloadDocumentRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().conversations_list("parent") -/// .page_token("duo") -/// .page_size(-93) -/// .filter("aliquyam") +/// let result = hub.projects().agent_knowledge_bases_documents_reload(req, "name") /// .doit(); /// # } /// ``` -pub struct ProjectConversationListCall<'a, C, A> +pub struct ProjectAgentKnowledgeBaseDocumentReloadCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _filter: Option, + _request: GoogleCloudDialogflowV2beta1ReloadDocumentRequest, + _name: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectConversationListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseDocumentReloadCall<'a, C, A> {} -impl<'a, C, A> ProjectConversationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentReloadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListConversationsResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -28653,20 +11780,11 @@ impl<'a, C, A> ProjectConversationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.documents.reload", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -28678,12 +11796,12 @@ impl<'a, C, A> ProjectConversationListCall<'a, C, A> where C: BorrowMut ProjectConversationListCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["parent"].iter() { + for param_name in ["name"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -28708,11 +11826,19 @@ impl<'a, C, A> ProjectConversationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -28729,11 +11855,15 @@ impl<'a, C, A> ProjectConversationListCall<'a, C, A> where C: BorrowMut ProjectConversationListCall<'a, C, A> where C: BorrowMut`. /// - /// Sets the *parent* path property to the given value. + /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectConversationListCall<'a, C, A> { - self._parent = new_value.to_string(); + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1ReloadDocumentRequest) -> ProjectAgentKnowledgeBaseDocumentReloadCall<'a, C, A> { + self._request = new_value; self } - /// Optional. The next_page_token value returned from a previous list request. + /// The name of the document to reload. + /// Format: `projects//knowledgeBases//documents/` /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectConversationListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. + /// Sets the *name* path property to the given value. /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectConversationListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// A filter expression that filters conversations listed in the response. In - /// general, the expression must specify the field name, a comparison operator, - /// and the value to use for filtering: - ///
    - ///
  • The value must be a string, a number, or a boolean.
  • - ///
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • - ///
  • To filter on multiple expressions, separate the - /// expressions with `AND` or `OR` (omitting both implies `AND`).
  • - ///
  • For clarity, expressions can be enclosed in parentheses.
  • - ///
- /// Only `lifecycle_state` can be filtered on in this way. For example, - /// the following expression only returns `FINISHED` conversations: - /// - /// `lifecycle_state = "FINISHED"` - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> ProjectConversationListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentReloadCall<'a, C, A> { + self._name = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -28836,7 +11941,7 @@ impl<'a, C, A> ProjectConversationListCall<'a, C, A> where C: BorrowMut ProjectConversationListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseDocumentReloadCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -28845,7 +11950,7 @@ impl<'a, C, A> ProjectConversationListCall<'a, C, A> where C: BorrowMut ProjectConversationListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectConversationListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDocumentReloadCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -28881,575 +11986,7 @@ impl<'a, C, A> ProjectConversationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectConversationListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all phone numbers in the specified project. -/// -/// A builder for the *phoneNumbers.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().phone_numbers_list("parent") -/// .show_deleted(true) -/// .page_token("et") -/// .page_size(-48) -/// .doit(); -/// # } -/// ``` -pub struct ProjectPhoneNumberListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _show_deleted: Option, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectPhoneNumberListCall<'a, C, A> {} - -impl<'a, C, A> ProjectPhoneNumberListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListPhoneNumbersResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.phoneNumbers.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._show_deleted { - params.push(("showDeleted", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/phoneNumbers"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The project to list all `PhoneNumber` resources from. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectPhoneNumberListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. Controls whether `PhoneNumber` resources in the - /// DELETE_REQUESTED - /// state should be returned. Defaults to false. - /// - /// Sets the *show deleted* query property to the given value. - pub fn show_deleted(mut self, new_value: bool) -> ProjectPhoneNumberListCall<'a, C, A> { - self._show_deleted = Some(new_value); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectPhoneNumberListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. - /// The default value is 100. The maximum value is 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectPhoneNumberListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectPhoneNumberListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectPhoneNumberListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectPhoneNumberListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the list of all human agent assistants. -/// -/// A builder for the *humanAgentAssistants.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().human_agent_assistants_list("parent") -/// .page_token("kasd") -/// .page_size(-87) -/// .doit(); -/// # } -/// ``` -pub struct ProjectHumanAgentAssistantListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectHumanAgentAssistantListCall<'a, C, A> {} - -impl<'a, C, A> ProjectHumanAgentAssistantListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListHumanAgentAssistantsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.humanAgentAssistants.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/humanAgentAssistants"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The project to list all agent assistants from. - /// Format: `projects/`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectHumanAgentAssistantListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectHumanAgentAssistantListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. - /// The default value is 100; the maximum value is 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectHumanAgentAssistantListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectHumanAgentAssistantListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectHumanAgentAssistantListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectHumanAgentAssistantListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseDocumentReloadCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -29490,9 +12027,9 @@ impl<'a, C, A> ProjectHumanAgentAssistantListCall<'a, C, A> where C: BorrowMut ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -29606,7 +12140,7 @@ impl<'a, C, A> ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut ProjectAgentIntentListCall<'a, C, A> { @@ -29718,7 +12253,7 @@ impl<'a, C, A> ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentIntentListCall<'a, C, A> @@ -29766,10 +12301,13 @@ impl<'a, C, A> ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut /// -/// A builder for the *conversations.participants.analyzeContent* method supported by a *project* resource. +/// A builder for the *agent.entityTypes.entities.batchUpdate* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -29781,7 +12319,7 @@ impl<'a, C, A> ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut ProjectAgentIntentListCall<'a, C, A> where C: BorrowMut +pub struct ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1AnalyzeContentRequest, - _participant: String, + _request: GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest, + _parent: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectConversationParticipantAnalyzeContentCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> {} -impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1AnalyzeContentResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -29830,11 +12368,11 @@ impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.conversations.participants.analyzeContent", + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.entities.batchUpdate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("participant", self._participant.to_string())); - for &field in ["alt", "participant"].iter() { + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -29846,12 +12384,12 @@ impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v2beta1/{+participant}:analyzeContent"; + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entities:batchUpdate"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+participant}", "participant")].iter() { + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { let mut replace_with = String::new(); for &(name, ref value) in params.iter() { if name == param_name { @@ -29860,13 +12398,13 @@ impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["participant"].iter() { + for param_name in ["parent"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -29876,10 +12414,7 @@ impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -29911,7 +12446,7 @@ impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -29972,20 +12507,19 @@ impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1AnalyzeContentRequest) -> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> { + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1BatchUpdateEntitiesRequest) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> { self._request = new_value; self } - /// Required. The name of the participant this text comes from. - /// Format: `projects//conversations//participants/`. + /// Required. The name of the entity type to update or create entities in. + /// Format: `projects//agent/entityTypes/`. /// - /// Sets the *participant* path property to the given value. + /// Sets the *parent* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn participant(mut self, new_value: &str) -> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> { - self._participant = new_value.to_string(); + pub fn parent(mut self, new_value: &str) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> { + self._parent = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -29994,7 +12528,7 @@ impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -30003,7 +12537,7 @@ impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -30011,15 +12545,15 @@ impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -30039,7 +12573,7 @@ impl<'a, C, A> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> where /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectConversationParticipantAnalyzeContentCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeEntityBatchUpdateCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -30147,7 +12681,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -30163,10 +12697,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30198,7 +12729,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -30293,7 +12824,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -30301,12 +12832,12 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> @@ -30341,9 +12872,11 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow } -/// Returns a specific `PhoneNumberOrder`. +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. /// -/// A builder for the *phoneNumberOrders.get* method supported by a *project* resource. +/// A builder for the *operations.get* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -30368,11 +12901,11 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeCreateCall<'a, C, A> where C: Borrow /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().phone_number_orders_get("name") +/// let result = hub.projects().operations_get("name") /// .doit(); /// # } /// ``` -pub struct ProjectPhoneNumberOrderGetCall<'a, C, A> +pub struct ProjectOperationGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, @@ -30382,13 +12915,13 @@ pub struct ProjectPhoneNumberOrderGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectPhoneNumberOrderGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectOperationGetCall<'a, C, A> {} -impl<'a, C, A> ProjectPhoneNumberOrderGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1PhoneNumberOrder)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -30397,7 +12930,7 @@ impl<'a, C, A> ProjectPhoneNumberOrderGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.phoneNumberOrders.get", + dlg.begin(MethodInfo { id: "dialogflow.projects.operations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); @@ -30427,7 +12960,7 @@ impl<'a, C, A> ProjectPhoneNumberOrderGetCall<'a, C, A> where C: BorrowMut ProjectPhoneNumberOrderGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -30466,7 +12996,7 @@ impl<'a, C, A> ProjectPhoneNumberOrderGetCall<'a, C, A> where C: BorrowMut ProjectPhoneNumberOrderGetCall<'a, C, A> where C: BorrowMut/phoneNumberOrders/`. + /// The name of the operation resource. /// /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectPhoneNumberOrderGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectOperationGetCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -30536,7 +13065,7 @@ impl<'a, C, A> ProjectPhoneNumberOrderGetCall<'a, C, A> where C: BorrowMut ProjectPhoneNumberOrderGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOperationGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -30545,7 +13074,7 @@ impl<'a, C, A> ProjectPhoneNumberOrderGetCall<'a, C, A> where C: BorrowMut ProjectPhoneNumberOrderGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectPhoneNumberOrderGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectOperationGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -30581,7 +13110,259 @@ impl<'a, C, A> ProjectPhoneNumberOrderGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectPhoneNumberOrderGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectOperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes all active contexts in the specified session. +/// +/// A builder for the *agent.environments.users.sessions.deleteContexts* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_environments_users_sessions_delete_contexts("parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.deleteContexts", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the session to delete all contexts from. Format: + /// `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionDeleteContextCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -30688,7 +13469,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -30704,10 +13485,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -30739,7 +13517,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -30830,7 +13608,7 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -30838,12 +13616,12 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> @@ -30878,6 +13656,297 @@ impl<'a, C, A> ProjectAgentEntityTypeEntityBatchCreateCall<'a, C, A> where C: Bo } +/// Returns the list of all entity types in the specified agent. +/// +/// A builder for the *agent.entityTypes.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_entity_types_list("parent") +/// .page_token("consetetur") +/// .page_size(-36) +/// .language_code("ea") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEntityTypeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _parent: String, + _page_token: Option, + _page_size: Option, + _language_code: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeListCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListEntityTypesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._language_code { + params.push(("languageCode", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "languageCode"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The agent to list all entity types from. + /// Format: `projects//agent`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentEntityTypeListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. The next_page_token value returned from a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectAgentEntityTypeListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of items to return in a single page. By + /// default 100 and at most 1000. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectAgentEntityTypeListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Optional. The language to list entity synonyms for. If not specified, + /// the agent's default language is used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. + /// + /// Sets the *language code* query property to the given value. + pub fn language_code(mut self, new_value: &str) -> ProjectAgentEntityTypeListCall<'a, C, A> { + self._language_code = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves the specified document. /// /// A builder for the *agent.knowledgeBases.documents.get* method supported by a *project* resource. @@ -30964,7 +14033,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentGetCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -30980,10 +14049,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentGetCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31003,7 +14069,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentGetCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31083,7 +14149,7 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentGetCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31091,12 +14157,12 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentGetCall<'a, C, A> where C: Borro /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDocumentGetCall<'a, C, A> @@ -31131,579 +14197,9 @@ impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentGetCall<'a, C, A> where C: Borro } -/// Deletes intents in the specified agent. -/// -/// Operation +/// Retrieves the specified knowledge base. /// -/// A builder for the *agent.intents.batchDelete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_intents_batch_delete(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAgentIntentBatchDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAgentIntentBatchDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectAgentIntentBatchDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.intents.batchDelete", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/intents:batchDelete"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1BatchDeleteIntentsRequest) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The name of the agent to delete all entities types for. Format: - /// `projects//agent`. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentIntentBatchDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Cancels the deletion request for a `PhoneNumber`. This method may only be -/// called on a `PhoneNumber` in the -/// DELETE_REQUESTED state. -/// -/// A builder for the *phoneNumbers.undelete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1UndeletePhoneNumberRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use dialogflow2_beta1::Dialogflow; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1UndeletePhoneNumberRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().phone_numbers_undelete(req, "name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectPhoneNumberUndeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1UndeletePhoneNumberRequest, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectPhoneNumberUndeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectPhoneNumberUndeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1PhoneNumber)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "dialogflow.projects.phoneNumbers.undelete", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}:undelete"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1UndeletePhoneNumberRequest) -> ProjectPhoneNumberUndeleteCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The unique identifier of the `PhoneNumber` to delete. - /// Format: `projects//phoneNumbers/`. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectPhoneNumberUndeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectPhoneNumberUndeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectPhoneNumberUndeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectPhoneNumberUndeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves the specified document. -/// -/// A builder for the *knowledgeBases.documents.get* method supported by a *project* resource. +/// A builder for the *knowledgeBases.get* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -31728,11 +14224,11 @@ impl<'a, C, A> ProjectPhoneNumberUndeleteCall<'a, C, A> where C: BorrowMut +pub struct ProjectKnowledgeBaseGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, @@ -31742,13 +14238,13 @@ pub struct ProjectKnowledgeBaseDocumentGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseDocumentGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseGetCall<'a, C, A> {} -impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectKnowledgeBaseGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Document)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1KnowledgeBase)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -31757,7 +14253,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.documents.get", + dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); @@ -31787,7 +14283,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -31803,10 +14299,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -31826,7 +14319,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31879,15 +14372,14 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< } - /// Required. The name of the document to retrieve. - /// Format `projects//knowledgeBases//documents/`. + /// Required. The name of the knowledge base to retrieve. + /// Format `projects//knowledgeBases/`. /// /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectKnowledgeBaseGetCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -31897,7 +14389,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -31906,7 +14398,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -31914,15 +14406,15 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -31942,7 +14434,7 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -31954,9 +14446,12 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< } -/// Updates the specified session entity type. +/// Creates a session entity type. +/// +/// If the specified session entity type already exists, overrides the +/// session entity type. /// -/// A builder for the *agent.sessions.entityTypes.patch* method supported by a *project* resource. +/// A builder for the *agent.environments.users.sessions.entityTypes.create* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -31987,26 +14482,24 @@ impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut< /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_sessions_entity_types_patch(req, "name") -/// .update_mask("Lorem") +/// let result = hub.projects().agent_environments_users_sessions_entity_types_create(req, "parent") /// .doit(); /// # } /// ``` -pub struct ProjectAgentSessionEntityTypePatchCall<'a, C, A> +pub struct ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, _request: GoogleCloudDialogflowV2beta1SessionEntityType, - _name: String, - _update_mask: Option, + _parent: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectAgentSessionEntityTypePatchCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> {} -impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -32019,14 +14512,1159 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.entityTypes.patch", - http_method: hyper::method::Method::Patch }); + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.entityTypes.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1SessionEntityType) -> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The session to create a session entity type for. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users// + /// sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we assume + /// default '-' user. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionEntityTypeCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the list of all session entity types in the specified session. +/// +/// A builder for the *agent.environments.users.sessions.entityTypes.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_environments_users_sessions_entity_types_list("parent") +/// .page_token("et") +/// .page_size(-96) +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListSessionEntityTypesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.entityTypes.list", + http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The session to list all session entity types from. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users// + /// sessions/`. + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. The next_page_token value returned from a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of items to return in a single page. By + /// default 100 and at most 1000. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionEntityTypeListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Processes a natural language query and returns structured, actionable data +/// as a result. This method is not idempotent, because it may cause contexts +/// and session entity types to be updated, which in turn might affect +/// results of future queries. +/// +/// A builder for the *agent.environments.users.sessions.detectIntent* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1DetectIntentRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1DetectIntentRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_environments_users_sessions_detect_intent(req, "session") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1DetectIntentRequest, + _session: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1DetectIntentResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.detectIntent", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("session", self._session.to_string())); + for &field in ["alt", "session"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+session}:detectIntent"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+session}", "session")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["session"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1DetectIntentRequest) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The name of the session this query is sent to. Format: + /// `projects//agent/sessions/`, or + /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we are using + /// "-". It’s up to the API caller to choose an appropriate `Session ID` and + /// `User Id`. They can be a random numbers or some type of user and session + /// identifiers (preferably hashed). The length of the `Session ID` and + /// `User ID` must not exceed 36 characters. + /// + /// Sets the *session* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn session(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> { + self._session = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionDetectIntentCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a context. +/// +/// If the specified context already exists, overrides the context. +/// +/// A builder for the *agent.environments.users.sessions.contexts.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Context; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1Context::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_environments_users_sessions_contexts_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1Context, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.contexts.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Context) -> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The session to create a context for. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we assume + /// default '-' user. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionContextCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified entity type. +/// +/// A builder for the *agent.entityTypes.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1EntityType; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1EntityType::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_entity_types_patch(req, "name") +/// .update_mask("gubergren") +/// .language_code("justo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEntityTypePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1EntityType, + _name: String, + _update_mask: Option, + _language_code: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEntityTypePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEntityTypePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1EntityType)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); params.push(("name", self._name.to_string())); if let Some(value) = self._update_mask { params.push(("updateMask", value.to_string())); } - for &field in ["alt", "name", "updateMask"].iter() { + if let Some(value) = self._language_code { + params.push(("languageCode", value.to_string())); + } + for &field in ["alt", "name", "updateMask", "languageCode"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -32052,7 +15690,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -32068,10 +15706,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32103,7 +15738,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -32164,43 +15799,49 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1SessionEntityType) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> { + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1EntityType) -> ProjectAgentEntityTypePatchCall<'a, C, A> { self._request = new_value; self } - /// Required. The unique identifier of this session entity type. Format: - /// `projects//agent/sessions//entityTypes/`, or - /// `projects//agent/environments//users//sessions//entityTypes/`. - /// If `Environment ID` is not specified, we assume default 'draft' - /// environment. If `User ID` is not specified, we assume default '-' user. - /// - /// `` must be the display name of an existing entity - /// type in the same agent that will be overridden or supplemented. + /// The unique identifier of the entity type. + /// Required for EntityTypes.UpdateEntityType and + /// EntityTypes.BatchUpdateEntityTypes methods. + /// Format: `projects//agent/entityTypes/`. /// /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectAgentEntityTypePatchCall<'a, C, A> { self._name = new_value.to_string(); self } /// Optional. The mask to control which fields get updated. /// /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> { + pub fn update_mask(mut self, new_value: &str) -> ProjectAgentEntityTypePatchCall<'a, C, A> { self._update_mask = Some(new_value.to_string()); self } + /// Optional. The language of entity synonyms defined in `entity_type`. If not + /// specified, the agent's default language is used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. + /// + /// Sets the *language code* query property to the given value. + pub fn language_code(mut self, new_value: &str) -> ProjectAgentEntityTypePatchCall<'a, C, A> { + self._language_code = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypePatchCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -32209,7 +15850,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32217,15 +15858,15 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypePatchCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -32245,7 +15886,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionEntityTypePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypePatchCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -32257,10 +15898,9 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM } -/// Uses the specified human agent assistant to come up with suggestions -/// (relevant articles and FAQs) on how to respond to a given conversation. +/// Returns the list of all contexts in the specified session. /// -/// A builder for the *humanAgentAssistants.compileSuggestions* method supported by a *project* resource. +/// A builder for the *agent.environments.users.sessions.contexts.list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -32272,7 +15912,6 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1CompileSuggestionsRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -32283,36 +15922,34 @@ impl<'a, C, A> ProjectAgentSessionEntityTypePatchCall<'a, C, A> where C: BorrowM /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1CompileSuggestionsRequest::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().human_agent_assistants_compile_suggestions(req, "name") +/// let result = hub.projects().agent_environments_users_sessions_contexts_list("parent") +/// .page_token("vero") +/// .page_size(-28) /// .doit(); /// # } /// ``` -pub struct ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> +pub struct ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1CompileSuggestionsRequest, - _name: String, + _parent: String, + _page_token: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> {} -impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1CompileSuggestionsResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListContextsResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -32321,9 +15958,283 @@ impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.humanAgentAssistants.compileSuggestions", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.contexts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The session to list all contexts from. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we assume + /// default '-' user. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. The next_page_token value returned from a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of items to return in a single page. By + /// default 100 and at most 1000. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionContextListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified entity type. +/// +/// A builder for the *agent.entityTypes.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_entity_types_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEntityTypeDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEntityTypeDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); for &field in ["alt", "name"].iter() { if self._additional_params.contains_key(field) { @@ -32337,7 +16248,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v2beta1/{+name}:compileSuggestions"; + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -32351,7 +16262,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -32367,22 +16278,8 @@ impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -32399,15 +16296,11 @@ impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C } }; let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -32458,24 +16351,14 @@ impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C } - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1CompileSuggestionsRequest) -> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The resource name of the agent assistant. - /// Format: `projects//humanAgentAssistants/`. + /// Required. The name of the entity type to delete. + /// Format: `projects//agent/entityTypes/`. /// /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -32485,7 +16368,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -32494,7 +16377,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32502,15 +16385,15 @@ impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -32530,7 +16413,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> where C /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectHumanAgentAssistantCompileSuggestionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -32628,7 +16511,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -32644,10 +16527,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -32667,7 +16547,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -32750,7 +16630,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -32758,12 +16638,12 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypeGetCall<'a, C, A> @@ -32798,13 +16678,9 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut } -/// Exports the specified agent to a ZIP file. -/// -/// -/// Operation +/// Retrieves the specified document. /// -/// A builder for the *agent.export* method supported by a *project* resource. +/// A builder for the *knowledgeBases.documents.get* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -32816,7 +16692,803 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1ExportAgentRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().knowledge_bases_documents_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectKnowledgeBaseDocumentGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseDocumentGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Document)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.documents.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the document to retrieve. + /// Format `projects//knowledgeBases//documents/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseDocumentGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the specified intent. +/// +/// A builder for the *agent.intents.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_intents_get("name") +/// .language_code("sadipscing") +/// .intent_view("invidunt") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentIntentGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _language_code: Option, + _intent_view: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentIntentGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentIntentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Intent)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.intents.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._language_code { + params.push(("languageCode", value.to_string())); + } + if let Some(value) = self._intent_view { + params.push(("intentView", value.to_string())); + } + for &field in ["alt", "name", "languageCode", "intentView"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the intent. + /// Format: `projects//agent/intents/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentIntentGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. The language to retrieve training phrases, parameters and rich + /// messages for. If not specified, the agent's default language is used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. + /// + /// Sets the *language code* query property to the given value. + pub fn language_code(mut self, new_value: &str) -> ProjectAgentIntentGetCall<'a, C, A> { + self._language_code = Some(new_value.to_string()); + self + } + /// Optional. The resource view to apply to the returned intent. + /// + /// Sets the *intent view* query property to the given value. + pub fn intent_view(mut self, new_value: &str) -> ProjectAgentIntentGetCall<'a, C, A> { + self._intent_view = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentIntentGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentIntentGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentIntentGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the specified entity type. +/// +/// A builder for the *agent.entityTypes.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_entity_types_get("name") +/// .language_code("dolore") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEntityTypeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _language_code: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEntityTypeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1EntityType)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._language_code { + params.push(("languageCode", value.to_string())); + } + for &field in ["alt", "name", "languageCode"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the entity type. + /// Format: `projects//agent/entityTypes/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentEntityTypeGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. The language to retrieve entity synonyms for. If not specified, + /// the agent's default language is used. + /// [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. + /// + /// Sets the *language code* query property to the given value. + pub fn language_code(mut self, new_value: &str) -> ProjectAgentEntityTypeGetCall<'a, C, A> { + self._language_code = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes entities in the specified entity type. +/// +/// Operation +/// +/// A builder for the *agent.entityTypes.entities.batchDelete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1BatchDeleteEntitiesRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -32830,29 +17502,29 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1ExportAgentRequest::default(); +/// let mut req = GoogleCloudDialogflowV2beta1BatchDeleteEntitiesRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().agent_export(req, "parent") +/// let result = hub.projects().agent_entity_types_entities_batch_delete(req, "parent") /// .doit(); /// # } /// ``` -pub struct ProjectAgentExportCall<'a, C, A> +pub struct ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1ExportAgentRequest, + _request: GoogleCloudDialogflowV2beta1BatchDeleteEntitiesRequest, _parent: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectAgentExportCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> {} -impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -32865,7 +17537,7 @@ impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.export", + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.entities.batchDelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); @@ -32881,7 +17553,7 @@ impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut ProjectAgentExportCall<'a, C, A> where C: BorrowMut ProjectAgentExportCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -32946,7 +17615,7 @@ impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut ProjectAgentExportCall<'a, C, A> where C: BorrowMut ProjectAgentExportCall<'a, C, A> { + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1BatchDeleteEntitiesRequest) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> { self._request = new_value; self } - /// Required. The project that the agent to export is associated with. - /// Format: `projects/`. + /// Required. The name of the entity type to delete entries for. Format: + /// `projects//agent/entityTypes/`. /// /// Sets the *parent* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentExportCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> { self._parent = new_value.to_string(); self } @@ -33028,7 +17697,7 @@ impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut ProjectAgentExportCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -33037,7 +17706,7 @@ impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut ProjectAgentExportCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentExportCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -33073,7 +17742,7 @@ impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectAgentExportCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentEntityTypeEntityBatchDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -33085,9 +17754,592 @@ impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1Context::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_sessions_contexts_patch(req, "name") +/// .update_mask("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentSessionContextPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1Context, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentSessionContextPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentSessionContextPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.contexts.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Context) -> ProjectAgentSessionContextPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The unique identifier of the context. Format: + /// `projects//agent/sessions//contexts/`, + /// or `projects//agent/environments//users//sessions//contexts/`. + /// + /// The `Context ID` is always converted to lowercase, may only contain + /// characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + /// + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentSessionContextPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. The mask to control which fields get updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectAgentSessionContextPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionContextPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionContextPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new document. +/// +/// Operation +/// +/// A builder for the *agent.knowledgeBases.documents.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Document; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1Document::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_knowledge_bases_documents_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1Document, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.documents.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/documents"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Document) -> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The knoweldge base to create a document for. + /// Format: `projects//knowledgeBases/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseDocumentCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the specified context. +/// +/// A builder for the *agent.sessions.contexts.get* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -33112,33 +18364,27 @@ impl<'a, C, A> ProjectAgentExportCall<'a, C, A> where C: BorrowMut +pub struct ProjectAgentSessionContextGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, - _parent: String, - _page_token: Option, - _page_size: Option, - _language_code: Option, + _name: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectAgentEntityTypeListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentSessionContextGetCall<'a, C, A> {} -impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentSessionContextGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListEntityTypesResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -33147,20 +18393,11 @@ impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.agent.entityTypes.list", + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.contexts.get", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if let Some(value) = self._language_code { - params.push(("languageCode", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize", "languageCode"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -33172,12 +18409,12 @@ impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["parent"].iter() { + for param_name in ["name"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -33202,10 +18439,7 @@ impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33225,7 +18459,7 @@ impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut/agent`. + /// Required. The name of the context. Format: + /// `projects//agent/sessions//contexts/` + /// or `projects//agent/environments//users//sessions//contexts/`. If `Environment ID` is + /// not specified, we assume default 'draft' environment. If `User ID` is not + /// specified, we assume default '-' user. /// - /// Sets the *parent* path property to the given value. + /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectAgentEntityTypeListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. The next_page_token value returned from a previous list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectAgentEntityTypeListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of items to return in a single page. By - /// default 100 and at most 1000. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectAgentEntityTypeListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// Optional. The language to list entity synonyms for. If not specified, - /// the agent's default language is used. - /// [More than a dozen - /// languages](https://dialogflow.com/docs/reference/language) are supported. - /// Note: languages must be enabled in the agent, before they can be used. - /// - /// Sets the *language code* query property to the given value. - pub fn language_code(mut self, new_value: &str) -> ProjectAgentEntityTypeListCall<'a, C, A> { - self._language_code = Some(new_value.to_string()); + pub fn name(mut self, new_value: &str) -> ProjectAgentSessionContextGetCall<'a, C, A> { + self._name = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -33321,7 +18533,7 @@ impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionContextGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -33330,7 +18542,7 @@ impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentEntityTypeListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -33366,7 +18578,3356 @@ impl<'a, C, A> ProjectAgentEntityTypeListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectAgentEntityTypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionContextGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes all active contexts in the specified session. +/// +/// A builder for the *agent.sessions.deleteContexts* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_sessions_delete_contexts("parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentSessionDeleteContextCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentSessionDeleteContextCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentSessionDeleteContextCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.deleteContexts", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the session to delete all contexts from. Format: + /// `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentSessionDeleteContextCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionDeleteContextCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionDeleteContextCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionDeleteContextCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified document. +/// Operation +/// +/// A builder for the *knowledgeBases.documents.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Document; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1Document::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().knowledge_bases_documents_patch(req, "name") +/// .update_mask("nonumy") +/// .doit(); +/// # } +/// ``` +pub struct ProjectKnowledgeBaseDocumentPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1Document, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseDocumentPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectKnowledgeBaseDocumentPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.documents.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Document) -> ProjectKnowledgeBaseDocumentPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The document resource name. + /// The name must be empty when creating a document. + /// Format: `projects//knowledgeBases//documents/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. Not specified means `update all`. + /// Currently, only `display_name` can be updated, an InvalidArgument will be + /// returned for attempting to update other fields. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseDocumentPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseDocumentPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseDocumentPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the list of all documents of the knowledge base. +/// +/// A builder for the *knowledgeBases.documents.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().knowledge_bases_documents_list("parent") +/// .page_token("sanctus") +/// .page_size(-58) +/// .doit(); +/// # } +/// ``` +pub struct ProjectKnowledgeBaseDocumentListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseDocumentListCall<'a, C, A> {} + +impl<'a, C, A> ProjectKnowledgeBaseDocumentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListDocumentsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.documents.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/documents"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The knowledge base to list all documents for. + /// Format: `projects//knowledgeBases/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. The next_page_token value returned from a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of items to return in a single page. By + /// default 10 and at most 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseDocumentListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified document. +/// +/// Operation +/// +/// A builder for the *knowledgeBases.documents.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().knowledge_bases_documents_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.documents.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the document to delete. + /// Format: `projects//knowledgeBases//documents/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseDocumentDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a context. +/// +/// If the specified context already exists, overrides the context. +/// +/// A builder for the *agent.sessions.contexts.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Context; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1Context::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_sessions_contexts_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentSessionContextCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1Context, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentSessionContextCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentSessionContextCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Context)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.contexts.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Context) -> ProjectAgentSessionContextCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The session to create a context for. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we assume + /// default '-' user. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentSessionContextCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionContextCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionContextCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Trains the specified agent. +/// +/// +/// Operation +/// +/// A builder for the *agent.train* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1TrainAgentRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1TrainAgentRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_train(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentTrainCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1TrainAgentRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentTrainCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentTrainCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.train", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/agent:train"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1TrainAgentRequest) -> ProjectAgentTrainCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The project that the agent to train is associated with. + /// Format: `projects/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentTrainCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentTrainCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentTrainCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentTrainCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the list of all session entity types in the specified session. +/// +/// A builder for the *agent.sessions.entityTypes.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_sessions_entity_types_list("parent") +/// .page_token("sadipscing") +/// .page_size(-66) +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentSessionEntityTypeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentSessionEntityTypeListCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentSessionEntityTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListSessionEntityTypesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.entityTypes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/entityTypes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The session to list all session entity types from. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users// + /// sessions/`. + /// If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. The next_page_token value returned from a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of items to return in a single page. By + /// default 100 and at most 1000. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionEntityTypeListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves the specified session entity type. +/// +/// A builder for the *agent.environments.users.sessions.entityTypes.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_environments_users_sessions_entity_types_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1SessionEntityType)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.environments.users.sessions.entityTypes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the session entity type. Format: + /// `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + /// environment. If `User ID` is not specified, we assume default '-' user. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentEnvironmentUserSessionEntityTypeGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified knowledge base. +/// +/// A builder for the *knowledgeBases.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1KnowledgeBase; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1KnowledgeBase::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().knowledge_bases_patch(req, "name") +/// .update_mask("sed") +/// .doit(); +/// # } +/// ``` +pub struct ProjectKnowledgeBasePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1KnowledgeBase, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectKnowledgeBasePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectKnowledgeBasePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1KnowledgeBase)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1KnowledgeBase) -> ProjectKnowledgeBasePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The knowledge base resource name. + /// The name must be empty when creating a knowledge base. + /// Format: `projects//knowledgeBases/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectKnowledgeBasePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. Not specified means `update all`. + /// Currently, only `display_name` can be updated, an InvalidArgument will be + /// returned for attempting to update other fields. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectKnowledgeBasePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBasePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBasePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBasePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a knowledge base. +/// +/// A builder for the *knowledgeBases.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1KnowledgeBase; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1KnowledgeBase::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().knowledge_bases_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectKnowledgeBaseCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1KnowledgeBase, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectKnowledgeBaseCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1KnowledgeBase)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/knowledgeBases"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1KnowledgeBase) -> ProjectKnowledgeBaseCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The project to create a knowledge base for. + /// Format: `projects/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectKnowledgeBaseCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the list of all documents of the knowledge base. +/// +/// A builder for the *agent.knowledgeBases.documents.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_knowledge_bases_documents_list("parent") +/// .page_token("eirmod") +/// .page_size(-46) +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListDocumentsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.knowledgeBases.documents.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/documents"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The knowledge base to list all documents for. + /// Format: `projects//knowledgeBases/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. The next_page_token value returned from a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of items to return in a single page. By + /// default 10 and at most 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentKnowledgeBaseDocumentListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified intent. +/// +/// A builder for the *agent.intents.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1Intent; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1Intent::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_intents_patch(req, "name") +/// .update_mask("sed") +/// .language_code("ea") +/// .intent_view("gubergren") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentIntentPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1Intent, + _name: String, + _update_mask: Option, + _language_code: Option, + _intent_view: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentIntentPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentIntentPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1Intent)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.intents.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + if let Some(value) = self._language_code { + params.push(("languageCode", value.to_string())); + } + if let Some(value) = self._intent_view { + params.push(("intentView", value.to_string())); + } + for &field in ["alt", "name", "updateMask", "languageCode", "intentView"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1Intent) -> ProjectAgentIntentPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique identifier of this intent. + /// Required for Intents.UpdateIntent and Intents.BatchUpdateIntents + /// methods. + /// Format: `projects//agent/intents/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional. The mask to control which fields get updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// Optional. The language of training phrases, parameters and rich messages + /// defined in `intent`. If not specified, the agent's default language is + /// used. [Many + /// languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) + /// are supported. Note: languages must be enabled in the agent before they can + /// be used. + /// + /// Sets the *language code* query property to the given value. + pub fn language_code(mut self, new_value: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { + self._language_code = Some(new_value.to_string()); + self + } + /// Optional. The resource view to apply to the returned intent. + /// + /// Sets the *intent view* query property to the given value. + pub fn intent_view(mut self, new_value: &str) -> ProjectAgentIntentPatchCall<'a, C, A> { + self._intent_view = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentIntentPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentIntentPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentIntentPatchCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -33464,7 +22025,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -33480,10 +22041,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -33503,7 +22061,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -33586,7 +22144,7 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33594,12 +22152,12 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> @@ -33634,9 +22192,15 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow } -/// Creates a human agent assistant. +/// Returns the list of agents. +/// +/// Since there is at most one conversational agent per project, this method is +/// useful primarily for listing all agents across projects the caller has +/// access to. One can achieve that with a wildcard project collection id "-". +/// Refer to [List +/// Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). /// -/// A builder for the *humanAgentAssistants.create* method supported by a *project* resource. +/// A builder for the *agent.search* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -33648,7 +22212,6 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; -/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1HumanAgentAssistant; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -33659,36 +22222,34 @@ impl<'a, C, A> ProjectAgentSessionEntityTypeDeleteCall<'a, C, A> where C: Borrow /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleCloudDialogflowV2beta1HumanAgentAssistant::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().human_agent_assistants_create(req, "parent") +/// let result = hub.projects().agent_search("parent") +/// .page_token("tempor") +/// .page_size(-59) /// .doit(); /// # } /// ``` -pub struct ProjectHumanAgentAssistantCreateCall<'a, C, A> +pub struct ProjectAgentSearchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Dialogflow, - _request: GoogleCloudDialogflowV2beta1HumanAgentAssistant, _parent: String, + _page_token: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectHumanAgentAssistantCreateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAgentSearchCall<'a, C, A> {} -impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAgentSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1HumanAgentAssistant)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1SearchAgentsResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -33697,11 +22258,17 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dialogflow.projects.humanAgentAssistants.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -33713,7 +22280,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/humanAgentAssistants"; + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/agent:search"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -33727,7 +22294,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -33743,10 +22310,534 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } } + } + + + /// Required. The project to list agents from. + /// Format: `projects/`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentSearchCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. The next_page_token value returned from a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectAgentSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of items to return in a single page. By + /// default 100 and at most 1000. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectAgentSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified intent and its direct or indirect followup intents. +/// +/// A builder for the *agent.intents.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_intents_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentIntentDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentIntentDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentIntentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.intents.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the intent to delete. If this intent has direct or + /// indirect followup intents, we also delete them. + /// + /// Format: `projects//agent/intents/`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectAgentIntentDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentIntentDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentIntentDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentIntentDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Reloads the specified document from its specified source, content_uri or +/// content. The previously loaded content of the document will be deleted. +/// Note: Even when the content of the document has not changed, there still +/// may be side effects because of internal implementation changes. +/// Operation +/// +/// A builder for the *knowledgeBases.documents.reload* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dialogflow2_beta1 as dialogflow2_beta1; +/// use dialogflow2_beta1::GoogleCloudDialogflowV2beta1ReloadDocumentRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dialogflow2_beta1::Dialogflow; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleCloudDialogflowV2beta1ReloadDocumentRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().knowledge_bases_documents_reload(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectKnowledgeBaseDocumentReloadCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _request: GoogleCloudDialogflowV2beta1ReloadDocumentRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectKnowledgeBaseDocumentReloadCall<'a, C, A> {} + +impl<'a, C, A> ProjectKnowledgeBaseDocumentReloadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.knowledgeBases.documents.reload", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+name}:reload"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -33778,7 +22869,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -33839,19 +22930,20 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1HumanAgentAssistant) -> ProjectHumanAgentAssistantCreateCall<'a, C, A> { + pub fn request(mut self, new_value: GoogleCloudDialogflowV2beta1ReloadDocumentRequest) -> ProjectKnowledgeBaseDocumentReloadCall<'a, C, A> { self._request = new_value; self } - /// Required. The project to create a agent assistant for. - /// Format: `projects/`. + /// The name of the document to reload. + /// Format: `projects//knowledgeBases//documents/` /// - /// Sets the *parent* path property to the given value. + /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectHumanAgentAssistantCreateCall<'a, C, A> { - self._parent = new_value.to_string(); + pub fn name(mut self, new_value: &str) -> ProjectKnowledgeBaseDocumentReloadCall<'a, C, A> { + self._name = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -33860,7 +22952,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectHumanAgentAssistantCreateCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectKnowledgeBaseDocumentReloadCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -33869,7 +22961,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -33877,15 +22969,15 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectHumanAgentAssistantCreateCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectKnowledgeBaseDocumentReloadCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -33905,7 +22997,7 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectHumanAgentAssistantCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectKnowledgeBaseDocumentReloadCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -33951,8 +23043,8 @@ impl<'a, C, A> ProjectHumanAgentAssistantCreateCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().agent_intents_create(req, "parent") -/// .language_code("eirmod") -/// .intent_view("sanctus") +/// .language_code("dolores") +/// .intent_view("sit") /// .doit(); /// # } /// ``` @@ -34020,7 +23112,7 @@ impl<'a, C, A> ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -34071,7 +23160,7 @@ impl<'a, C, A> ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentCreateCall<'a, C, A> { @@ -34180,7 +23270,7 @@ impl<'a, C, A> ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAgentIntentCreateCall<'a, C, A> @@ -34228,3 +23318,281 @@ impl<'a, C, A> ProjectAgentIntentCreateCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Dialogflow::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().agent_sessions_contexts_list("parent") +/// .page_token("ut") +/// .page_size(-70) +/// .doit(); +/// # } +/// ``` +pub struct ProjectAgentSessionContextListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dialogflow, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectAgentSessionContextListCall<'a, C, A> {} + +impl<'a, C, A> ProjectAgentSessionContextListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleCloudDialogflowV2beta1ListContextsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dialogflow.projects.agent.sessions.contexts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/contexts"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The session to list all contexts from. + /// Format: `projects//agent/sessions/` or + /// `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + /// default 'draft' environment. If `User ID` is not specified, we assume + /// default '-' user. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectAgentSessionContextListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. The next_page_token value returned from a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectAgentSessionContextListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of items to return in a single page. By + /// default 100 and at most 1000. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectAgentSessionContextListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAgentSessionContextListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectAgentSessionContextListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectAgentSessionContextListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/digitalassetlinks1-cli/Cargo.toml b/gen/digitalassetlinks1-cli/Cargo.toml index a03df13b82..4357b5c1e0 100644 --- a/gen/digitalassetlinks1-cli/Cargo.toml +++ b/gen/digitalassetlinks1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-digitalassetlinks1-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with digitalassetlinks (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/digitalassetlinks1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-digitalassetlinks1] path = "../digitalassetlinks1" -version = "1.0.8+20181009" +version = "1.0.8+20190323" diff --git a/gen/digitalassetlinks1-cli/README.md b/gen/digitalassetlinks1-cli/README.md index 226cc7998a..fd5ff8233e 100644 --- a/gen/digitalassetlinks1-cli/README.md +++ b/gen/digitalassetlinks1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *digitalassetlinks* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *digitalassetlinks* API at revision *20190323*. The CLI is at version *1.0.8*. ```bash digitalassetlinks1 [options] diff --git a/gen/digitalassetlinks1-cli/mkdocs.yml b/gen/digitalassetlinks1-cli/mkdocs.yml index 4859265dab..2904089824 100644 --- a/gen/digitalassetlinks1-cli/mkdocs.yml +++ b/gen/digitalassetlinks1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: digitalassetlinks v1.0.8+20181009 +site_name: digitalassetlinks v1.0.8+20190323 site_url: http://byron.github.io/google-apis-rs/google-digitalassetlinks1-cli site_description: A complete library to interact with digitalassetlinks (protocol v1) diff --git a/gen/digitalassetlinks1-cli/src/main.rs b/gen/digitalassetlinks1-cli/src/main.rs index 017a4997bd..2f0a8630c9 100644 --- a/gen/digitalassetlinks1-cli/src/main.rs +++ b/gen/digitalassetlinks1-cli/src/main.rs @@ -370,8 +370,8 @@ fn main() { let mut app = App::new("digitalassetlinks1") .author("Sebastian Thiel ") - .version("1.0.8+20181009") - .about("API for discovering relationships between online assets such as web sites or mobile apps.") + .version("1.0.8+20190323") + .about("Discovers relationships between online assets such as websites or mobile apps.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_digitalassetlinks1_cli") .arg(Arg::with_name("folder") .long("config-dir") diff --git a/gen/digitalassetlinks1/Cargo.toml b/gen/digitalassetlinks1/Cargo.toml index 0338f65443..de4f071509 100644 --- a/gen/digitalassetlinks1/Cargo.toml +++ b/gen/digitalassetlinks1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-digitalassetlinks1" -version = "1.0.8+20181009" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with digitalassetlinks (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/digitalassetlinks1" homepage = "https://developers.google.com/digital-asset-links/" -documentation = "https://docs.rs/google-digitalassetlinks1/1.0.8+20181009" +documentation = "https://docs.rs/google-digitalassetlinks1/1.0.8+20190323" license = "MIT" keywords = ["digitalassetlinks", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/digitalassetlinks1/README.md b/gen/digitalassetlinks1/README.md index 57c10fdb0a..ce3933e7b6 100644 --- a/gen/digitalassetlinks1/README.md +++ b/gen/digitalassetlinks1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-digitalassetlinks1` library allows access to all features of the *Google digitalassetlinks* service. -This documentation was generated from *digitalassetlinks* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *digitalassetlinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *digitalassetlinks* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *digitalassetlinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *digitalassetlinks* *v1* API can be found at the [official documentation site](https://developers.google.com/digital-asset-links/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/struct.Digitalassetlinks.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/struct.Digitalassetlinks.html) ... * assetlinks - * [*check*](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/struct.AssetlinkCheckCall.html) -* [statements](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/struct.Statement.html) - * [*list*](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/struct.StatementListCall.html) + * [*check*](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/struct.AssetlinkCheckCall.html) +* [statements](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/struct.Statement.html) + * [*list*](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/struct.StatementListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/struct.Digitalassetlinks.html)** +* **[Hub](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/struct.Digitalassetlinks.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.Part.html)** + * **[Parts](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-digitalassetlinks1/1.0.8+20181009/google_digitalassetlinks1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-digitalassetlinks1/1.0.8+20190323/google_digitalassetlinks1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/digitalassetlinks1/src/lib.rs b/gen/digitalassetlinks1/src/lib.rs index 6416264186..6269610ac1 100644 --- a/gen/digitalassetlinks1/src/lib.rs +++ b/gen/digitalassetlinks1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *digitalassetlinks* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *digitalassetlinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *digitalassetlinks* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *digitalassetlinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *digitalassetlinks* *v1* API can be found at the //! [official documentation site](https://developers.google.com/digital-asset-links/). @@ -374,9 +374,6 @@ pub struct CheckResponse { /// REQUIRED #[serde(rename="maxAge")] pub max_age: Option, - /// Set to true if the assets specified in the request are linked by the - /// relation specified in the request. - pub linked: Option, /// Human-readable message containing information intended to help end users /// understand, reproduce and debug the result. /// @@ -390,6 +387,9 @@ pub struct CheckResponse { /// programmatic access, use the error_code field below. #[serde(rename="debugString")] pub debug_string: Option, + /// Set to true if the assets specified in the request are linked by the + /// relation specified in the request. + pub linked: Option, } impl ResponseResult for CheckResponse {} @@ -915,17 +915,14 @@ impl<'a, C, A> AssetlinkCheckCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1166,7 +1163,7 @@ impl<'a, C, A> AssetlinkCheckCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1174,12 +1171,12 @@ impl<'a, C, A> AssetlinkCheckCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> AssetlinkCheckCall<'a, C, A> @@ -1310,17 +1307,14 @@ impl<'a, C, A> StatementListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1483,7 +1477,7 @@ impl<'a, C, A> StatementListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1491,12 +1485,12 @@ impl<'a, C, A> StatementListCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> StatementListCall<'a, C, A> diff --git a/gen/discovery1-cli/Cargo.toml b/gen/discovery1-cli/Cargo.toml index 6fc89ec76f..4efd8bf23f 100644 --- a/gen/discovery1-cli/Cargo.toml +++ b/gen/discovery1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-discovery1-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with discovery (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/discovery1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-discovery1] path = "../discovery1" -version = "1.0.8+20181009" +version = "1.0.8+20190326" diff --git a/gen/discovery1-cli/README.md b/gen/discovery1-cli/README.md index a4603426d8..4acb61d9fe 100644 --- a/gen/discovery1-cli/README.md +++ b/gen/discovery1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *discovery* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *discovery* API at revision *20190326*. The CLI is at version *1.0.8*. ```bash discovery1 [options] diff --git a/gen/discovery1-cli/mkdocs.yml b/gen/discovery1-cli/mkdocs.yml index 365a221dbe..b578da7773 100644 --- a/gen/discovery1-cli/mkdocs.yml +++ b/gen/discovery1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: discovery v1.0.8+20181009 +site_name: discovery v1.0.8+20190326 site_url: http://byron.github.io/google-apis-rs/google-discovery1-cli site_description: A complete library to interact with discovery (protocol v1) diff --git a/gen/discovery1-cli/src/main.rs b/gen/discovery1-cli/src/main.rs index 1d6512b9ba..d7e2c45b78 100644 --- a/gen/discovery1-cli/src/main.rs +++ b/gen/discovery1-cli/src/main.rs @@ -303,7 +303,7 @@ fn main() { let mut app = App::new("discovery1") .author("Sebastian Thiel ") - .version("1.0.8+20181009") + .version("1.0.8+20190326") .about("Provides information about other Google APIs, such as what APIs are available, the resource, and method details for each API.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_discovery1_cli") .arg(Arg::with_name("folder") diff --git a/gen/discovery1/Cargo.toml b/gen/discovery1/Cargo.toml index caae9d50cc..5cf620b069 100644 --- a/gen/discovery1/Cargo.toml +++ b/gen/discovery1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-discovery1" -version = "1.0.8+20181009" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with discovery (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/discovery1" homepage = "https://developers.google.com/discovery/" -documentation = "https://docs.rs/google-discovery1/1.0.8+20181009" +documentation = "https://docs.rs/google-discovery1/1.0.8+20190326" license = "MIT" keywords = ["discovery", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/discovery1/README.md b/gen/discovery1/README.md index 63486c5681..9b49a6c317 100644 --- a/gen/discovery1/README.md +++ b/gen/discovery1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-discovery1` library allows access to all features of the *Google discovery* service. -This documentation was generated from *discovery* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *discovery* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *discovery* *v1* API can be found at the [official documentation site](https://developers.google.com/discovery/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/struct.Discovery.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/struct.Discovery.html) ... * apis - * [*get rest*](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/struct.ApiGetRestCall.html) and [*list*](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/struct.ApiListCall.html) + * [*get rest*](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/struct.ApiGetRestCall.html) and [*list*](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/struct.ApiListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/struct.Discovery.html)** +* **[Hub](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/struct.Discovery.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.Part.html)** + * **[Parts](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -124,17 +124,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -144,29 +144,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-discovery1/1.0.8+20181009/google_discovery1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-discovery1/1.0.8+20190326/google_discovery1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/discovery1/src/lib.rs b/gen/discovery1/src/lib.rs index db71bdbb4d..ca5aff6a0b 100644 --- a/gen/discovery1/src/lib.rs +++ b/gen/discovery1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *discovery* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *discovery* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *discovery* *v1* API can be found at the //! [official documentation site](https://developers.google.com/discovery/). @@ -1008,17 +1008,14 @@ impl<'a, C, A> ApiGetRestCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1105,7 +1102,7 @@ impl<'a, C, A> ApiGetRestCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1207,17 +1204,14 @@ impl<'a, C, A> ApiListCall<'a, C, A> where C: BorrowMut, A: oauth let mut url = self.hub._base_url.clone() + "apis"; - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1298,7 +1292,7 @@ impl<'a, C, A> ApiListCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/dlp2-cli/Cargo.toml b/gen/dlp2-cli/Cargo.toml index 9e07dc705c..d9886c410c 100644 --- a/gen/dlp2-cli/Cargo.toml +++ b/gen/dlp2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dlp2-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with DLP (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dlp2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-dlp2] path = "../dlp2" -version = "1.0.8+20181009" +version = "1.0.8+20190402" diff --git a/gen/dlp2-cli/README.md b/gen/dlp2-cli/README.md index a6afa1e88b..8d0179ae52 100644 --- a/gen/dlp2-cli/README.md +++ b/gen/dlp2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *DLP* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *DLP* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash dlp2 [options] @@ -67,6 +67,7 @@ dlp2 [options] inspect-templates-get [-p ]... [-o ] inspect-templates-list [-p ]... [-o ] inspect-templates-patch (-r )... [-p ]... [-o ] + job-triggers-activate (-r )... [-p ]... [-o ] job-triggers-create (-r )... [-p ]... [-o ] job-triggers-delete [-p ]... [-o ] job-triggers-get [-p ]... [-o ] diff --git a/gen/dlp2-cli/mkdocs.yml b/gen/dlp2-cli/mkdocs.yml index 611bce542b..a98bf514d6 100644 --- a/gen/dlp2-cli/mkdocs.yml +++ b/gen/dlp2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: DLP v1.0.8+20181009 +site_name: DLP v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-dlp2-cli site_description: A complete library to interact with DLP (protocol v2) @@ -44,6 +44,7 @@ pages: - ['projects_inspect-templates-get.md', 'Projects', 'Inspect Templates Get'] - ['projects_inspect-templates-list.md', 'Projects', 'Inspect Templates List'] - ['projects_inspect-templates-patch.md', 'Projects', 'Inspect Templates Patch'] +- ['projects_job-triggers-activate.md', 'Projects', 'Job Triggers Activate'] - ['projects_job-triggers-create.md', 'Projects', 'Job Triggers Create'] - ['projects_job-triggers-delete.md', 'Projects', 'Job Triggers Delete'] - ['projects_job-triggers-get.md', 'Projects', 'Job Triggers Get'] diff --git a/gen/dlp2-cli/src/main.rs b/gen/dlp2-cli/src/main.rs index 7f37bcc5ae..cecd8e94a8 100644 --- a/gen/dlp2-cli/src/main.rs +++ b/gen/dlp2-cli/src/main.rs @@ -736,7 +736,6 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-template.update-time" => Some(("inspectTemplate.updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-template.display-name" => Some(("inspectTemplate.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-template.description" => Some(("inspectTemplate.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -748,6 +747,7 @@ impl<'n> Engine<'n> { "inspect-template.inspect-config.min-likelihood" => Some(("inspectTemplate.inspectConfig.minLikelihood", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-template.create-time" => Some(("inspectTemplate.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-template.name" => Some(("inspectTemplate.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content-options", "create-time", "description", "display-name", "exclude-info-types", "include-quote", "inspect-config", "inspect-template", "limits", "max-findings-per-item", "max-findings-per-request", "min-likelihood", "name", "update-mask", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -836,11 +836,11 @@ impl<'n> Engine<'n> { "config.display-name" => Some(("config.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.description" => Some(("config.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.output-path.path" => Some(("config.largeCustomDictionary.outputPath.path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.large-custom-dictionary.cloud-storage-file-set.url" => Some(("config.largeCustomDictionary.cloudStorageFileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.field.name" => Some(("config.largeCustomDictionary.bigQueryField.field.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.project-id" => Some(("config.largeCustomDictionary.bigQueryField.table.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.table-id" => Some(("config.largeCustomDictionary.bigQueryField.table.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.dataset-id" => Some(("config.largeCustomDictionary.bigQueryField.table.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.large-custom-dictionary.cloud-storage-file-set.url" => Some(("config.largeCustomDictionary.cloudStorageFileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["big-query-field", "cloud-storage-file-set", "config", "dataset-id", "description", "display-name", "field", "large-custom-dictionary", "name", "output-path", "path", "project-id", "stored-info-type-id", "table", "table-id", "url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1094,11 +1094,11 @@ impl<'n> Engine<'n> { "config.display-name" => Some(("config.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.description" => Some(("config.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.output-path.path" => Some(("config.largeCustomDictionary.outputPath.path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.large-custom-dictionary.cloud-storage-file-set.url" => Some(("config.largeCustomDictionary.cloudStorageFileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.field.name" => Some(("config.largeCustomDictionary.bigQueryField.field.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.project-id" => Some(("config.largeCustomDictionary.bigQueryField.table.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.table-id" => Some(("config.largeCustomDictionary.bigQueryField.table.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.dataset-id" => Some(("config.largeCustomDictionary.bigQueryField.table.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.large-custom-dictionary.cloud-storage-file-set.url" => Some(("config.largeCustomDictionary.cloudStorageFileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["big-query-field", "cloud-storage-file-set", "config", "dataset-id", "description", "display-name", "field", "large-custom-dictionary", "name", "output-path", "path", "project-id", "table", "table-id", "update-mask", "url"]); @@ -1901,33 +1901,34 @@ impl<'n> Engine<'n> { "risk-job.privacy-metric.numerical-stats-config.field.name" => Some(("riskJob.privacyMetric.numericalStatsConfig.field.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "risk-job.privacy-metric.k-map-estimation-config.region-code" => Some(("riskJob.privacyMetric.kMapEstimationConfig.regionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "risk-job.privacy-metric.l-diversity-config.sensitive-attribute.name" => Some(("riskJob.privacyMetric.lDiversityConfig.sensitiveAttribute.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "risk-job.privacy-metric.delta-presence-estimation-config.region-code" => Some(("riskJob.privacyMetric.deltaPresenceEstimationConfig.regionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "risk-job.privacy-metric.categorical-stats-config.field.name" => Some(("riskJob.privacyMetric.categoricalStatsConfig.field.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "risk-job.privacy-metric.k-anonymity-config.entity-id.field.name" => Some(("riskJob.privacyMetric.kAnonymityConfig.entityId.field.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "risk-job.privacy-metric.categorical-stats-config.field.name" => Some(("riskJob.privacyMetric.categoricalStatsConfig.field.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "risk-job.privacy-metric.delta-presence-estimation-config.region-code" => Some(("riskJob.privacyMetric.deltaPresenceEstimationConfig.regionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "risk-job.source-table.project-id" => Some(("riskJob.sourceTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "risk-job.source-table.table-id" => Some(("riskJob.sourceTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "risk-job.source-table.dataset-id" => Some(("riskJob.sourceTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job-id" => Some(("jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.timespan-config.timestamp-field.name" => Some(("inspectJob.storageConfig.timespanConfig.timestampField.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.timespan-config.end-time" => Some(("inspectJob.storageConfig.timespanConfig.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.timespan-config.start-time" => Some(("inspectJob.storageConfig.timespanConfig.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.timespan-config.enable-auto-population-of-timespan-config" => Some(("inspectJob.storageConfig.timespanConfig.enableAutoPopulationOfTimespanConfig", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "inspect-job.storage-config.big-query-options.rows-limit" => Some(("inspectJob.storageConfig.bigQueryOptions.rowsLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.big-query-options.sample-method" => Some(("inspectJob.storageConfig.bigQueryOptions.sampleMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "inspect-job.storage-config.big-query-options.rows-limit-percent" => Some(("inspectJob.storageConfig.bigQueryOptions.rowsLimitPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "inspect-job.storage-config.big-query-options.rows-limit" => Some(("inspectJob.storageConfig.bigQueryOptions.rowsLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.big-query-options.table-reference.project-id" => Some(("inspectJob.storageConfig.bigQueryOptions.tableReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.big-query-options.table-reference.table-id" => Some(("inspectJob.storageConfig.bigQueryOptions.tableReference.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.big-query-options.table-reference.dataset-id" => Some(("inspectJob.storageConfig.bigQueryOptions.tableReference.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "inspect-job.storage-config.big-query-options.rows-limit-percent" => Some(("inspectJob.storageConfig.bigQueryOptions.rowsLimitPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "inspect-job.storage-config.datastore-options.kind.name" => Some(("inspectJob.storageConfig.datastoreOptions.kind.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.datastore-options.partition-id.project-id" => Some(("inspectJob.storageConfig.datastoreOptions.partitionId.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.datastore-options.partition-id.namespace-id" => Some(("inspectJob.storageConfig.datastoreOptions.partitionId.namespaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "inspect-job.storage-config.datastore-options.kind.name" => Some(("inspectJob.storageConfig.datastoreOptions.kind.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.cloud-storage-options.bytes-limit-per-file" => Some(("inspectJob.storageConfig.cloudStorageOptions.bytesLimitPerFile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.cloud-storage-options.sample-method" => Some(("inspectJob.storageConfig.cloudStorageOptions.sampleMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.cloud-storage-options.file-set.url" => Some(("inspectJob.storageConfig.cloudStorageOptions.fileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.cloud-storage-options.file-set.regex-file-set.exclude-regex" => Some(("inspectJob.storageConfig.cloudStorageOptions.fileSet.regexFileSet.excludeRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "inspect-job.storage-config.cloud-storage-options.file-set.regex-file-set.bucket-name" => Some(("inspectJob.storageConfig.cloudStorageOptions.fileSet.regexFileSet.bucketName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.storage-config.cloud-storage-options.file-set.regex-file-set.include-regex" => Some(("inspectJob.storageConfig.cloudStorageOptions.fileSet.regexFileSet.includeRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "inspect-job.storage-config.cloud-storage-options.bytes-limit-per-file-percent" => Some(("inspectJob.storageConfig.cloudStorageOptions.bytesLimitPerFilePercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "inspect-job.storage-config.cloud-storage-options.files-limit-percent" => Some(("inspectJob.storageConfig.cloudStorageOptions.filesLimitPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "inspect-job.storage-config.cloud-storage-options.bytes-limit-per-file-percent" => Some(("inspectJob.storageConfig.cloudStorageOptions.bytesLimitPerFilePercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "inspect-job.storage-config.cloud-storage-options.file-types" => Some(("inspectJob.storageConfig.cloudStorageOptions.fileTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "inspect-job.inspect-config.exclude-info-types" => Some(("inspectJob.inspectConfig.excludeInfoTypes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "inspect-job.inspect-config.content-options" => Some(("inspectJob.inspectConfig.contentOptions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1936,7 +1937,6 @@ impl<'n> Engine<'n> { "inspect-job.inspect-config.limits.max-findings-per-item" => Some(("inspectJob.inspectConfig.limits.maxFindingsPerItem", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "inspect-job.inspect-config.min-likelihood" => Some(("inspectJob.inspectConfig.minLikelihood", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-job.inspect-template-name" => Some(("inspectJob.inspectTemplateName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job-id" => Some(("jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["big-query-options", "bucket-name", "bytes-limit-per-file", "bytes-limit-per-file-percent", "categorical-stats-config", "cloud-storage-options", "content-options", "dataset-id", "datastore-options", "delta-presence-estimation-config", "enable-auto-population-of-timespan-config", "end-time", "entity-id", "exclude-info-types", "exclude-regex", "field", "file-set", "file-types", "files-limit-percent", "include-quote", "include-regex", "inspect-config", "inspect-job", "inspect-template-name", "job-id", "k-anonymity-config", "k-map-estimation-config", "kind", "l-diversity-config", "limits", "max-findings-per-item", "max-findings-per-request", "min-likelihood", "name", "namespace-id", "numerical-stats-config", "partition-id", "privacy-metric", "project-id", "regex-file-set", "region-code", "risk-job", "rows-limit", "rows-limit-percent", "sample-method", "sensitive-attribute", "source-table", "start-time", "storage-config", "table-id", "table-reference", "timespan-config", "timestamp-field", "url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -2548,7 +2548,6 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-template.update-time" => Some(("inspectTemplate.updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-template.display-name" => Some(("inspectTemplate.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-template.description" => Some(("inspectTemplate.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2560,6 +2559,7 @@ impl<'n> Engine<'n> { "inspect-template.inspect-config.min-likelihood" => Some(("inspectTemplate.inspectConfig.minLikelihood", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-template.create-time" => Some(("inspectTemplate.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "inspect-template.name" => Some(("inspectTemplate.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content-options", "create-time", "description", "display-name", "exclude-info-types", "include-quote", "inspect-config", "inspect-template", "limits", "max-findings-per-item", "max-findings-per-request", "min-likelihood", "name", "update-mask", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -2621,6 +2621,90 @@ impl<'n> Engine<'n> { } } + fn _projects_job_triggers_activate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GooglePrivacyDlpV2ActivateJobTriggerRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().job_triggers_activate(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_job_triggers_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -2653,23 +2737,23 @@ impl<'n> Engine<'n> { "job-trigger.inspect-job.storage-config.timespan-config.end-time" => Some(("jobTrigger.inspectJob.storageConfig.timespanConfig.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.timespan-config.start-time" => Some(("jobTrigger.inspectJob.storageConfig.timespanConfig.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.timespan-config.enable-auto-population-of-timespan-config" => Some(("jobTrigger.inspectJob.storageConfig.timespanConfig.enableAutoPopulationOfTimespanConfig", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "job-trigger.inspect-job.storage-config.big-query-options.rows-limit" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.rowsLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.big-query-options.sample-method" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.sampleMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job-trigger.inspect-job.storage-config.big-query-options.rows-limit-percent" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.rowsLimitPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-trigger.inspect-job.storage-config.big-query-options.rows-limit" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.rowsLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.big-query-options.table-reference.project-id" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.tableReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.big-query-options.table-reference.table-id" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.tableReference.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.big-query-options.table-reference.dataset-id" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.tableReference.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job-trigger.inspect-job.storage-config.big-query-options.rows-limit-percent" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.rowsLimitPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-trigger.inspect-job.storage-config.datastore-options.kind.name" => Some(("jobTrigger.inspectJob.storageConfig.datastoreOptions.kind.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.datastore-options.partition-id.project-id" => Some(("jobTrigger.inspectJob.storageConfig.datastoreOptions.partitionId.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.datastore-options.partition-id.namespace-id" => Some(("jobTrigger.inspectJob.storageConfig.datastoreOptions.partitionId.namespaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job-trigger.inspect-job.storage-config.datastore-options.kind.name" => Some(("jobTrigger.inspectJob.storageConfig.datastoreOptions.kind.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.bytes-limit-per-file" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.bytesLimitPerFile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.sample-method" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.sampleMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.file-set.url" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.fileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.file-set.regex-file-set.exclude-regex" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.fileSet.regexFileSet.excludeRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job-trigger.inspect-job.storage-config.cloud-storage-options.file-set.regex-file-set.bucket-name" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.fileSet.regexFileSet.bucketName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.file-set.regex-file-set.include-regex" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.fileSet.regexFileSet.includeRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job-trigger.inspect-job.storage-config.cloud-storage-options.bytes-limit-per-file-percent" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.bytesLimitPerFilePercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.files-limit-percent" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.filesLimitPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-trigger.inspect-job.storage-config.cloud-storage-options.bytes-limit-per-file-percent" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.bytesLimitPerFilePercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.file-types" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.fileTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job-trigger.inspect-job.inspect-config.exclude-info-types" => Some(("jobTrigger.inspectJob.inspectConfig.excludeInfoTypes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "job-trigger.inspect-job.inspect-config.content-options" => Some(("jobTrigger.inspectJob.inspectConfig.contentOptions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2861,6 +2945,9 @@ impl<'n> Engine<'n> { "order-by" => { call = call.order_by(value.unwrap_or("")); }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -2874,7 +2961,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["order-by", "page-token", "page-size"].iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "page-size"].iter().map(|v|*v)); v } )); } } @@ -2939,23 +3026,23 @@ impl<'n> Engine<'n> { "job-trigger.inspect-job.storage-config.timespan-config.end-time" => Some(("jobTrigger.inspectJob.storageConfig.timespanConfig.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.timespan-config.start-time" => Some(("jobTrigger.inspectJob.storageConfig.timespanConfig.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.timespan-config.enable-auto-population-of-timespan-config" => Some(("jobTrigger.inspectJob.storageConfig.timespanConfig.enableAutoPopulationOfTimespanConfig", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "job-trigger.inspect-job.storage-config.big-query-options.rows-limit" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.rowsLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.big-query-options.sample-method" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.sampleMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job-trigger.inspect-job.storage-config.big-query-options.rows-limit-percent" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.rowsLimitPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-trigger.inspect-job.storage-config.big-query-options.rows-limit" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.rowsLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.big-query-options.table-reference.project-id" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.tableReference.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.big-query-options.table-reference.table-id" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.tableReference.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.big-query-options.table-reference.dataset-id" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.tableReference.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job-trigger.inspect-job.storage-config.big-query-options.rows-limit-percent" => Some(("jobTrigger.inspectJob.storageConfig.bigQueryOptions.rowsLimitPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-trigger.inspect-job.storage-config.datastore-options.kind.name" => Some(("jobTrigger.inspectJob.storageConfig.datastoreOptions.kind.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.datastore-options.partition-id.project-id" => Some(("jobTrigger.inspectJob.storageConfig.datastoreOptions.partitionId.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.datastore-options.partition-id.namespace-id" => Some(("jobTrigger.inspectJob.storageConfig.datastoreOptions.partitionId.namespaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job-trigger.inspect-job.storage-config.datastore-options.kind.name" => Some(("jobTrigger.inspectJob.storageConfig.datastoreOptions.kind.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.bytes-limit-per-file" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.bytesLimitPerFile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.sample-method" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.sampleMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.file-set.url" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.fileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.file-set.regex-file-set.exclude-regex" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.fileSet.regexFileSet.excludeRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job-trigger.inspect-job.storage-config.cloud-storage-options.file-set.regex-file-set.bucket-name" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.fileSet.regexFileSet.bucketName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.file-set.regex-file-set.include-regex" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.fileSet.regexFileSet.includeRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job-trigger.inspect-job.storage-config.cloud-storage-options.bytes-limit-per-file-percent" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.bytesLimitPerFilePercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.files-limit-percent" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.filesLimitPercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-trigger.inspect-job.storage-config.cloud-storage-options.bytes-limit-per-file-percent" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.bytesLimitPerFilePercent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job-trigger.inspect-job.storage-config.cloud-storage-options.file-types" => Some(("jobTrigger.inspectJob.storageConfig.cloudStorageOptions.fileTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job-trigger.inspect-job.inspect-config.exclude-info-types" => Some(("jobTrigger.inspectJob.inspectConfig.excludeInfoTypes", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "job-trigger.inspect-job.inspect-config.content-options" => Some(("jobTrigger.inspectJob.inspectConfig.contentOptions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -3056,11 +3143,11 @@ impl<'n> Engine<'n> { "config.display-name" => Some(("config.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.description" => Some(("config.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.output-path.path" => Some(("config.largeCustomDictionary.outputPath.path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.large-custom-dictionary.cloud-storage-file-set.url" => Some(("config.largeCustomDictionary.cloudStorageFileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.field.name" => Some(("config.largeCustomDictionary.bigQueryField.field.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.project-id" => Some(("config.largeCustomDictionary.bigQueryField.table.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.table-id" => Some(("config.largeCustomDictionary.bigQueryField.table.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.dataset-id" => Some(("config.largeCustomDictionary.bigQueryField.table.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.large-custom-dictionary.cloud-storage-file-set.url" => Some(("config.largeCustomDictionary.cloudStorageFileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["big-query-field", "cloud-storage-file-set", "config", "dataset-id", "description", "display-name", "field", "large-custom-dictionary", "name", "output-path", "path", "project-id", "stored-info-type-id", "table", "table-id", "url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -3314,11 +3401,11 @@ impl<'n> Engine<'n> { "config.display-name" => Some(("config.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.description" => Some(("config.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.output-path.path" => Some(("config.largeCustomDictionary.outputPath.path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.large-custom-dictionary.cloud-storage-file-set.url" => Some(("config.largeCustomDictionary.cloudStorageFileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.field.name" => Some(("config.largeCustomDictionary.bigQueryField.field.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.project-id" => Some(("config.largeCustomDictionary.bigQueryField.table.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.table-id" => Some(("config.largeCustomDictionary.bigQueryField.table.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.large-custom-dictionary.big-query-field.table.dataset-id" => Some(("config.largeCustomDictionary.bigQueryField.table.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "config.large-custom-dictionary.cloud-storage-file-set.url" => Some(("config.largeCustomDictionary.cloudStorageFileSet.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["big-query-field", "cloud-storage-file-set", "config", "dataset-id", "description", "display-name", "field", "large-custom-dictionary", "name", "output-path", "path", "project-id", "table", "table-id", "update-mask", "url"]); @@ -3509,6 +3596,9 @@ impl<'n> Engine<'n> { ("inspect-templates-patch", Some(opt)) => { call_result = self._projects_inspect_templates_patch(opt, dry_run, &mut err); }, + ("job-triggers-activate", Some(opt)) => { + call_result = self._projects_job_triggers_activate(opt, dry_run, &mut err); + }, ("job-triggers-create", Some(opt)) => { call_result = self._projects_job_triggers_create(opt, dry_run, &mut err); }, @@ -4072,7 +4162,7 @@ fn main() { ]), ]), - ("projects", "methods: 'content-deidentify', 'content-inspect', 'content-reidentify', 'deidentify-templates-create', 'deidentify-templates-delete', 'deidentify-templates-get', 'deidentify-templates-list', 'deidentify-templates-patch', 'dlp-jobs-cancel', 'dlp-jobs-create', 'dlp-jobs-delete', 'dlp-jobs-get', 'dlp-jobs-list', 'image-redact', 'inspect-templates-create', 'inspect-templates-delete', 'inspect-templates-get', 'inspect-templates-list', 'inspect-templates-patch', 'job-triggers-create', 'job-triggers-delete', 'job-triggers-get', 'job-triggers-list', 'job-triggers-patch', 'stored-info-types-create', 'stored-info-types-delete', 'stored-info-types-get', 'stored-info-types-list' and 'stored-info-types-patch'", vec![ + ("projects", "methods: 'content-deidentify', 'content-inspect', 'content-reidentify', 'deidentify-templates-create', 'deidentify-templates-delete', 'deidentify-templates-get', 'deidentify-templates-list', 'deidentify-templates-patch', 'dlp-jobs-cancel', 'dlp-jobs-create', 'dlp-jobs-delete', 'dlp-jobs-get', 'dlp-jobs-list', 'image-redact', 'inspect-templates-create', 'inspect-templates-delete', 'inspect-templates-get', 'inspect-templates-list', 'inspect-templates-patch', 'job-triggers-activate', 'job-triggers-create', 'job-triggers-delete', 'job-triggers-get', 'job-triggers-list', 'job-triggers-patch', 'stored-info-types-create', 'stored-info-types-delete', 'stored-info-types-get', 'stored-info-types-list' and 'stored-info-types-patch'", vec![ ("content-deidentify", Some(r##"De-identifies potentially sensitive info from a ContentItem. This method has limits on input size and output size. @@ -4621,6 +4711,36 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("job-triggers-activate", + Some(r##"Activate a job trigger. Causes the immediate execute of a trigger + instead of waiting on the trigger event to occur."##), + "Details at http://byron.github.io/google-apis-rs/google_dlp2_cli/projects_job-triggers-activate", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name of the trigger to activate, for example + `projects/dlp-test-project/jobTriggers/53234423`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -4905,7 +5025,7 @@ fn main() { let mut app = App::new("dlp2") .author("Sebastian Thiel ") - .version("1.0.8+20181009") + .version("1.0.8+20190402") .about("Provides methods for detection, risk analysis, and de-identification of privacy-sensitive fragments in text, images, and Google Cloud Platform storage repositories.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dlp2_cli") .arg(Arg::with_name("url") diff --git a/gen/dlp2/Cargo.toml b/gen/dlp2/Cargo.toml index 5733730d9f..04f7c8168f 100644 --- a/gen/dlp2/Cargo.toml +++ b/gen/dlp2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dlp2" -version = "1.0.8+20181009" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with DLP (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dlp2" homepage = "https://cloud.google.com/dlp/docs/" -documentation = "https://docs.rs/google-dlp2/1.0.8+20181009" +documentation = "https://docs.rs/google-dlp2/1.0.8+20190402" license = "MIT" keywords = ["dlp", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/dlp2/README.md b/gen/dlp2/README.md index 597014e934..55ee98826d 100644 --- a/gen/dlp2/README.md +++ b/gen/dlp2/README.md @@ -5,20 +5,20 @@ DO NOT EDIT ! --> The `google-dlp2` library allows access to all features of the *Google DLP* service. -This documentation was generated from *DLP* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *dlp:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *DLP* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *dlp:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *DLP* *v2* API can be found at the [official documentation site](https://cloud.google.com/dlp/docs/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.DLP.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.DLP.html) ... * info types - * [*list*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.InfoTypeListCall.html) + * [*list*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.InfoTypeListCall.html) * organizations - * [*deidentify templates create*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationDeidentifyTemplateCreateCall.html), [*deidentify templates delete*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationDeidentifyTemplateDeleteCall.html), [*deidentify templates get*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationDeidentifyTemplateGetCall.html), [*deidentify templates list*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationDeidentifyTemplateListCall.html), [*deidentify templates patch*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationDeidentifyTemplatePatchCall.html), [*inspect templates create*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationInspectTemplateCreateCall.html), [*inspect templates delete*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationInspectTemplateDeleteCall.html), [*inspect templates get*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationInspectTemplateGetCall.html), [*inspect templates list*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationInspectTemplateListCall.html), [*inspect templates patch*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationInspectTemplatePatchCall.html), [*stored info types create*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationStoredInfoTypeCreateCall.html), [*stored info types delete*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationStoredInfoTypeDeleteCall.html), [*stored info types get*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationStoredInfoTypeGetCall.html), [*stored info types list*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationStoredInfoTypeListCall.html) and [*stored info types patch*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.OrganizationStoredInfoTypePatchCall.html) + * [*deidentify templates create*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationDeidentifyTemplateCreateCall.html), [*deidentify templates delete*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationDeidentifyTemplateDeleteCall.html), [*deidentify templates get*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationDeidentifyTemplateGetCall.html), [*deidentify templates list*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationDeidentifyTemplateListCall.html), [*deidentify templates patch*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationDeidentifyTemplatePatchCall.html), [*inspect templates create*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationInspectTemplateCreateCall.html), [*inspect templates delete*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationInspectTemplateDeleteCall.html), [*inspect templates get*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationInspectTemplateGetCall.html), [*inspect templates list*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationInspectTemplateListCall.html), [*inspect templates patch*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationInspectTemplatePatchCall.html), [*stored info types create*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationStoredInfoTypeCreateCall.html), [*stored info types delete*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationStoredInfoTypeDeleteCall.html), [*stored info types get*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationStoredInfoTypeGetCall.html), [*stored info types list*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationStoredInfoTypeListCall.html) and [*stored info types patch*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.OrganizationStoredInfoTypePatchCall.html) * projects - * [*content deidentify*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectContentDeidentifyCall.html), [*content inspect*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectContentInspectCall.html), [*content reidentify*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectContentReidentifyCall.html), [*deidentify templates create*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectDeidentifyTemplateCreateCall.html), [*deidentify templates delete*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectDeidentifyTemplateDeleteCall.html), [*deidentify templates get*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectDeidentifyTemplateGetCall.html), [*deidentify templates list*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectDeidentifyTemplateListCall.html), [*deidentify templates patch*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectDeidentifyTemplatePatchCall.html), [*dlp jobs cancel*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectDlpJobCancelCall.html), [*dlp jobs create*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectDlpJobCreateCall.html), [*dlp jobs delete*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectDlpJobDeleteCall.html), [*dlp jobs get*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectDlpJobGetCall.html), [*dlp jobs list*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectDlpJobListCall.html), [*image redact*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectImageRedactCall.html), [*inspect templates create*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectInspectTemplateCreateCall.html), [*inspect templates delete*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectInspectTemplateDeleteCall.html), [*inspect templates get*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectInspectTemplateGetCall.html), [*inspect templates list*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectInspectTemplateListCall.html), [*inspect templates patch*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectInspectTemplatePatchCall.html), [*job triggers create*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectJobTriggerCreateCall.html), [*job triggers delete*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectJobTriggerDeleteCall.html), [*job triggers get*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectJobTriggerGetCall.html), [*job triggers list*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectJobTriggerListCall.html), [*job triggers patch*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectJobTriggerPatchCall.html), [*stored info types create*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectStoredInfoTypeCreateCall.html), [*stored info types delete*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectStoredInfoTypeDeleteCall.html), [*stored info types get*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectStoredInfoTypeGetCall.html), [*stored info types list*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectStoredInfoTypeListCall.html) and [*stored info types patch*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.ProjectStoredInfoTypePatchCall.html) + * [*content deidentify*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectContentDeidentifyCall.html), [*content inspect*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectContentInspectCall.html), [*content reidentify*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectContentReidentifyCall.html), [*deidentify templates create*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectDeidentifyTemplateCreateCall.html), [*deidentify templates delete*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectDeidentifyTemplateDeleteCall.html), [*deidentify templates get*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectDeidentifyTemplateGetCall.html), [*deidentify templates list*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectDeidentifyTemplateListCall.html), [*deidentify templates patch*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectDeidentifyTemplatePatchCall.html), [*dlp jobs cancel*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectDlpJobCancelCall.html), [*dlp jobs create*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectDlpJobCreateCall.html), [*dlp jobs delete*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectDlpJobDeleteCall.html), [*dlp jobs get*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectDlpJobGetCall.html), [*dlp jobs list*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectDlpJobListCall.html), [*image redact*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectImageRedactCall.html), [*inspect templates create*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectInspectTemplateCreateCall.html), [*inspect templates delete*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectInspectTemplateDeleteCall.html), [*inspect templates get*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectInspectTemplateGetCall.html), [*inspect templates list*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectInspectTemplateListCall.html), [*inspect templates patch*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectInspectTemplatePatchCall.html), [*job triggers activate*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectJobTriggerActivateCall.html), [*job triggers create*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectJobTriggerCreateCall.html), [*job triggers delete*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectJobTriggerDeleteCall.html), [*job triggers get*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectJobTriggerGetCall.html), [*job triggers list*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectJobTriggerListCall.html), [*job triggers patch*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectJobTriggerPatchCall.html), [*stored info types create*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectStoredInfoTypeCreateCall.html), [*stored info types delete*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectStoredInfoTypeDeleteCall.html), [*stored info types get*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectStoredInfoTypeGetCall.html), [*stored info types list*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectStoredInfoTypeListCall.html) and [*stored info types patch*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.ProjectStoredInfoTypePatchCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/struct.DLP.html)** +* **[Hub](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/struct.DLP.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.Part.html)** + * **[Parts](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -142,17 +142,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -162,29 +162,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-dlp2/1.0.8+20181009/google_dlp2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dlp2/1.0.8+20190402/google_dlp2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dlp2/src/lib.rs b/gen/dlp2/src/lib.rs index 4bc910da5f..6c2cb43f75 100644 --- a/gen/dlp2/src/lib.rs +++ b/gen/dlp2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *DLP* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *dlp:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *DLP* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *dlp:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *DLP* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/dlp/docs/). @@ -16,7 +16,7 @@ //! * organizations //! * [*deidentify templates create*](struct.OrganizationDeidentifyTemplateCreateCall.html), [*deidentify templates delete*](struct.OrganizationDeidentifyTemplateDeleteCall.html), [*deidentify templates get*](struct.OrganizationDeidentifyTemplateGetCall.html), [*deidentify templates list*](struct.OrganizationDeidentifyTemplateListCall.html), [*deidentify templates patch*](struct.OrganizationDeidentifyTemplatePatchCall.html), [*inspect templates create*](struct.OrganizationInspectTemplateCreateCall.html), [*inspect templates delete*](struct.OrganizationInspectTemplateDeleteCall.html), [*inspect templates get*](struct.OrganizationInspectTemplateGetCall.html), [*inspect templates list*](struct.OrganizationInspectTemplateListCall.html), [*inspect templates patch*](struct.OrganizationInspectTemplatePatchCall.html), [*stored info types create*](struct.OrganizationStoredInfoTypeCreateCall.html), [*stored info types delete*](struct.OrganizationStoredInfoTypeDeleteCall.html), [*stored info types get*](struct.OrganizationStoredInfoTypeGetCall.html), [*stored info types list*](struct.OrganizationStoredInfoTypeListCall.html) and [*stored info types patch*](struct.OrganizationStoredInfoTypePatchCall.html) //! * projects -//! * [*content deidentify*](struct.ProjectContentDeidentifyCall.html), [*content inspect*](struct.ProjectContentInspectCall.html), [*content reidentify*](struct.ProjectContentReidentifyCall.html), [*deidentify templates create*](struct.ProjectDeidentifyTemplateCreateCall.html), [*deidentify templates delete*](struct.ProjectDeidentifyTemplateDeleteCall.html), [*deidentify templates get*](struct.ProjectDeidentifyTemplateGetCall.html), [*deidentify templates list*](struct.ProjectDeidentifyTemplateListCall.html), [*deidentify templates patch*](struct.ProjectDeidentifyTemplatePatchCall.html), [*dlp jobs cancel*](struct.ProjectDlpJobCancelCall.html), [*dlp jobs create*](struct.ProjectDlpJobCreateCall.html), [*dlp jobs delete*](struct.ProjectDlpJobDeleteCall.html), [*dlp jobs get*](struct.ProjectDlpJobGetCall.html), [*dlp jobs list*](struct.ProjectDlpJobListCall.html), [*image redact*](struct.ProjectImageRedactCall.html), [*inspect templates create*](struct.ProjectInspectTemplateCreateCall.html), [*inspect templates delete*](struct.ProjectInspectTemplateDeleteCall.html), [*inspect templates get*](struct.ProjectInspectTemplateGetCall.html), [*inspect templates list*](struct.ProjectInspectTemplateListCall.html), [*inspect templates patch*](struct.ProjectInspectTemplatePatchCall.html), [*job triggers create*](struct.ProjectJobTriggerCreateCall.html), [*job triggers delete*](struct.ProjectJobTriggerDeleteCall.html), [*job triggers get*](struct.ProjectJobTriggerGetCall.html), [*job triggers list*](struct.ProjectJobTriggerListCall.html), [*job triggers patch*](struct.ProjectJobTriggerPatchCall.html), [*stored info types create*](struct.ProjectStoredInfoTypeCreateCall.html), [*stored info types delete*](struct.ProjectStoredInfoTypeDeleteCall.html), [*stored info types get*](struct.ProjectStoredInfoTypeGetCall.html), [*stored info types list*](struct.ProjectStoredInfoTypeListCall.html) and [*stored info types patch*](struct.ProjectStoredInfoTypePatchCall.html) +//! * [*content deidentify*](struct.ProjectContentDeidentifyCall.html), [*content inspect*](struct.ProjectContentInspectCall.html), [*content reidentify*](struct.ProjectContentReidentifyCall.html), [*deidentify templates create*](struct.ProjectDeidentifyTemplateCreateCall.html), [*deidentify templates delete*](struct.ProjectDeidentifyTemplateDeleteCall.html), [*deidentify templates get*](struct.ProjectDeidentifyTemplateGetCall.html), [*deidentify templates list*](struct.ProjectDeidentifyTemplateListCall.html), [*deidentify templates patch*](struct.ProjectDeidentifyTemplatePatchCall.html), [*dlp jobs cancel*](struct.ProjectDlpJobCancelCall.html), [*dlp jobs create*](struct.ProjectDlpJobCreateCall.html), [*dlp jobs delete*](struct.ProjectDlpJobDeleteCall.html), [*dlp jobs get*](struct.ProjectDlpJobGetCall.html), [*dlp jobs list*](struct.ProjectDlpJobListCall.html), [*image redact*](struct.ProjectImageRedactCall.html), [*inspect templates create*](struct.ProjectInspectTemplateCreateCall.html), [*inspect templates delete*](struct.ProjectInspectTemplateDeleteCall.html), [*inspect templates get*](struct.ProjectInspectTemplateGetCall.html), [*inspect templates list*](struct.ProjectInspectTemplateListCall.html), [*inspect templates patch*](struct.ProjectInspectTemplatePatchCall.html), [*job triggers activate*](struct.ProjectJobTriggerActivateCall.html), [*job triggers create*](struct.ProjectJobTriggerCreateCall.html), [*job triggers delete*](struct.ProjectJobTriggerDeleteCall.html), [*job triggers get*](struct.ProjectJobTriggerGetCall.html), [*job triggers list*](struct.ProjectJobTriggerListCall.html), [*job triggers patch*](struct.ProjectJobTriggerPatchCall.html), [*stored info types create*](struct.ProjectStoredInfoTypeCreateCall.html), [*stored info types delete*](struct.ProjectStoredInfoTypeDeleteCall.html), [*stored info types get*](struct.ProjectStoredInfoTypeGetCall.html), [*stored info types list*](struct.ProjectStoredInfoTypeListCall.html) and [*stored info types patch*](struct.ProjectStoredInfoTypePatchCall.html) //! //! //! @@ -429,15 +429,15 @@ pub struct GooglePrivacyDlpV2CreateDlpJobRequest { /// no description provided #[serde(rename="riskJob")] pub risk_job: Option, - /// The job id can contain uppercase and lowercase letters, - /// numbers, and hyphens; that is, it must match the regular - /// expression: `[a-zA-Z\\d-]+`. The maximum length is 100 - /// characters. Can be empty to allow the system to generate one. - #[serde(rename="jobId")] - pub job_id: Option, /// no description provided #[serde(rename="inspectJob")] pub inspect_job: Option, + /// The job id can contain uppercase and lowercase letters, + /// numbers, and hyphens; that is, it must match the regular + /// expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 + /// characters. Can be empty to allow the system to generate one. + #[serde(rename="jobId")] + pub job_id: Option, } impl RequestValue for GooglePrivacyDlpV2CreateDlpJobRequest {} @@ -473,24 +473,24 @@ pub struct GooglePrivacyDlpV2RedactImageRequest { impl RequestValue for GooglePrivacyDlpV2RedactImageRequest {} -/// Container structure for the content to inspect. +/// The configuration that controls how the data will change. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2ContentItem { - /// Structured content for inspection. See - /// https://cloud.google.com/dlp/docs/inspecting-text#inspecting_a_table to - /// learn more. - pub table: Option, - /// Content data to inspect or redact. Replaces `type` and `data`. - #[serde(rename="byteItem")] - pub byte_item: Option, - /// String data to inspect or redact. - pub value: Option, +pub struct GooglePrivacyDlpV2DeidentifyConfig { + /// Treat the dataset as free-form text and apply the same free text + /// transformation everywhere. + #[serde(rename="infoTypeTransformations")] + pub info_type_transformations: Option, + /// Treat the dataset as structured. Transformations can be applied to + /// specific locations within structured datasets, such as transforming + /// a column within a table. + #[serde(rename="recordTransformations")] + pub record_transformations: Option, } -impl Part for GooglePrivacyDlpV2ContentItem {} +impl Part for GooglePrivacyDlpV2DeidentifyConfig {} /// Message for specifying a window around a finding to apply a detection @@ -500,12 +500,12 @@ impl Part for GooglePrivacyDlpV2ContentItem {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2Proximity { - /// Number of characters before the finding to consider. - #[serde(rename="windowBefore")] - pub window_before: Option, /// Number of characters after the finding to consider. #[serde(rename="windowAfter")] pub window_after: Option, + /// Number of characters before the finding to consider. + #[serde(rename="windowBefore")] + pub window_before: Option, } impl Part for GooglePrivacyDlpV2Proximity {} @@ -532,54 +532,110 @@ pub struct GooglePrivacyDlpV2InfoTypeLimit { impl Part for GooglePrivacyDlpV2InfoTypeLimit {} -/// Summary of a single tranformation. -/// Only one of 'transformation', 'field_transformation', or 'record_suppress' -/// will be set. +/// A single inspection rule to be applied to infoTypes, specified in +/// `InspectionRuleSet`. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2TransformationSummary { - /// Set if the transformation was limited to a specific FieldId. - pub field: Option, - /// The field transformation that was applied. - /// If multiple field transformations are requested for a single field, - /// this list will contain all of them; otherwise, only one is supplied. - #[serde(rename="fieldTransformations")] - pub field_transformations: Option>, - /// Set if the transformation was limited to a specific info_type. - #[serde(rename="infoType")] - pub info_type: Option, - /// Total size in bytes that were transformed in some way. - #[serde(rename="transformedBytes")] - pub transformed_bytes: Option, - /// The specific suppression option these stats apply to. - #[serde(rename="recordSuppress")] - pub record_suppress: Option, +pub struct GooglePrivacyDlpV2InspectionRule { + /// Hotword-based detection rule. + #[serde(rename="hotwordRule")] + pub hotword_rule: Option, + /// Exclusion rule. + #[serde(rename="exclusionRule")] + pub exclusion_rule: Option, +} + +impl Part for GooglePrivacyDlpV2InspectionRule {} + + +/// Replaces an identifier with a surrogate using Format Preserving Encryption +/// (FPE) with the FFX mode of operation; however when used in the +/// `ReidentifyContent` API method, it serves the opposite function by reversing +/// the surrogate back into the original identifier. The identifier must be +/// encoded as ASCII. For a given crypto key and context, the same identifier +/// will be replaced with the same surrogate. Identifiers must be at least two +/// characters long. In the case that the identifier is the empty string, it will +/// be skipped. See https://cloud.google.com/dlp/docs/pseudonymization to learn +/// more. +/// +/// Note: We recommend using CryptoDeterministicConfig for all use cases which +/// do not require preserving the input alphabet space and size, plus warrant +/// referential integrity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GooglePrivacyDlpV2CryptoReplaceFfxFpeConfig { + /// The key used by the encryption algorithm. [required] + #[serde(rename="cryptoKey")] + pub crypto_key: Option, + /// This is supported by mapping these to the alphanumeric characters + /// that the FFX mode natively supports. This happens before/after + /// encryption/decryption. + /// Each character listed must appear only once. + /// Number of characters must be in the range [2, 62]. + /// This must be encoded as ASCII. + /// The order of characters does not matter. + #[serde(rename="customAlphabet")] + pub custom_alphabet: Option, + /// The native way to select the alphabet. Must be in the range [2, 62]. + pub radix: Option, + /// The 'tweak', a context may be used for higher security since the same + /// identifier in two different contexts won't be given the same surrogate. If + /// the context is not set, a default tweak will be used. + /// + /// If the context is set but: + /// + /// 1. there is no record present when transforming a given value or + /// 1. the field is not present when transforming a given value, + /// + /// a default tweak will be used. + /// + /// Note that case (1) is expected when an `InfoTypeTransformation` is + /// applied to both structured and non-structured `ContentItem`s. + /// Currently, the referenced field may be of value type integer or string. + /// + /// The tweak is constructed as a sequence of bytes in big endian byte order + /// such that: + /// + /// - a 64 bit integer is encoded followed by a single byte of value 1 + /// - a string is encoded in UTF-8 format followed by a single byte of value 2 + pub context: Option, + /// The custom infoType to annotate the surrogate with. + /// This annotation will be applied to the surrogate by prefixing it with + /// the name of the custom infoType followed by the number of + /// characters comprising the surrogate. The following scheme defines the + /// format: info_type_name(surrogate_character_count):surrogate + /// + /// For example, if the name of custom infoType is 'MY_TOKEN_INFO_TYPE' and + /// the surrogate is 'abc', the full replacement value + /// will be: 'MY_TOKEN_INFO_TYPE(3):abc' + /// + /// This annotation identifies the surrogate when inspecting content using the + /// custom infoType + /// [`SurrogateType`](/dlp/docs/reference/rest/v2/InspectConfig#surrogatetype). + /// This facilitates reversal of the surrogate when it occurs in free text. + /// + /// In order for inspection to work properly, the name of this infoType must + /// not occur naturally anywhere in your data; otherwise, inspection may + /// find a surrogate that does not correspond to an actual identifier. + /// Therefore, choose your custom infoType name carefully after considering + /// what your data looks like. One way to select a name that has a high chance + /// of yielding reliable detection is to include one or more unicode characters + /// that are highly improbable to exist in your data. + /// For example, assuming your data is entered from a regular ASCII keyboard, + /// the symbol with the hex code point 29DD might be used like so: + /// ⧝MY_TOKEN_TYPE + #[serde(rename="surrogateInfoType")] + pub surrogate_info_type: Option, /// no description provided - pub results: Option>, - /// The specific transformation these stats apply to. - pub transformation: Option, + #[serde(rename="commonAlphabet")] + pub common_alphabet: Option, } -impl Part for GooglePrivacyDlpV2TransformationSummary {} - - -/// Options defining a data set within Google Cloud Datastore. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2DatastoreOptions { - /// A partition ID identifies a grouping of entities. The grouping is always - /// by project and namespace, however the namespace ID may be empty. - #[serde(rename="partitionId")] - pub partition_id: Option, - /// The kind to process. - pub kind: Option, -} - -impl Part for GooglePrivacyDlpV2DatastoreOptions {} +impl Part for GooglePrivacyDlpV2CryptoReplaceFfxFpeConfig {} /// A column with a semantic tag attached. @@ -658,12 +714,12 @@ impl Part for GooglePrivacyDlpV2TimespanConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2UpdateInspectTemplateRequest { - /// Mask to control which fields get updated. - #[serde(rename="updateMask")] - pub update_mask: Option, /// New InspectTemplate value. #[serde(rename="inspectTemplate")] pub inspect_template: Option, + /// Mask to control which fields get updated. + #[serde(rename="updateMask")] + pub update_mask: Option, } impl RequestValue for GooglePrivacyDlpV2UpdateInspectTemplateRequest {} @@ -686,49 +742,112 @@ pub struct GooglePrivacyDlpV2KMapEstimationQuasiIdValues { impl Part for GooglePrivacyDlpV2KMapEstimationQuasiIdValues {} -/// The configuration that controls how the data will change. +/// Container structure for the content to inspect. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2DeidentifyConfig { - /// Treat the dataset as free-form text and apply the same free text - /// transformation everywhere. - #[serde(rename="infoTypeTransformations")] - pub info_type_transformations: Option, - /// Treat the dataset as structured. Transformations can be applied to - /// specific locations within structured datasets, such as transforming - /// a column within a table. - #[serde(rename="recordTransformations")] - pub record_transformations: Option, +pub struct GooglePrivacyDlpV2ContentItem { + /// Structured content for inspection. See + /// https://cloud.google.com/dlp/docs/inspecting-text#inspecting_a_table to + /// learn more. + pub table: Option, + /// Content data to inspect or redact. Replaces `type` and `data`. + #[serde(rename="byteItem")] + pub byte_item: Option, + /// String data to inspect or redact. + pub value: Option, } -impl Part for GooglePrivacyDlpV2DeidentifyConfig {} +impl Part for GooglePrivacyDlpV2ContentItem {} -/// Configuration for determining how redaction of images should occur. +/// Pseudonymization method that generates deterministic encryption for the given +/// input. Outputs a base64 encoded representation of the encrypted output. +/// Uses AES-SIV based on the RFC https://tools.ietf.org/html/rfc5297. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2ImageRedactionConfig { - /// If true, all text found in the image, regardless whether it matches an - /// info_type, is redacted. Only one should be provided. - #[serde(rename="redactAllText")] - pub redact_all_text: Option, - /// Only one per info_type should be provided per request. If not - /// specified, and redact_all_text is false, the DLP API will redact all - /// text that it matches against all info_types that are found, but not - /// specified in another ImageRedactionConfig. - #[serde(rename="infoType")] - pub info_type: Option, - /// The color to use when redacting content from an image. If not specified, - /// the default is black. - #[serde(rename="redactionColor")] - pub redaction_color: Option, +pub struct GooglePrivacyDlpV2CryptoDeterministicConfig { + /// The key used by the encryption function. + #[serde(rename="cryptoKey")] + pub crypto_key: Option, + /// Optional. A context may be used for higher security and maintaining + /// referential integrity such that the same identifier in two different + /// contexts will be given a distinct surrogate. The context is appended to + /// plaintext value being encrypted. On decryption the provided context is + /// validated against the value used during encryption. If a context was + /// provided during encryption, same context must be provided during decryption + /// as well. + /// + /// If the context is not set, plaintext would be used as is for encryption. + /// If the context is set but: + /// + /// 1. there is no record present when transforming a given value or + /// 2. the field is not present when transforming a given value, + /// + /// plaintext would be used as is for encryption. + /// + /// Note that case (1) is expected when an `InfoTypeTransformation` is + /// applied to both structured and non-structured `ContentItem`s. + pub context: Option, + /// The custom info type to annotate the surrogate with. + /// This annotation will be applied to the surrogate by prefixing it with + /// the name of the custom info type followed by the number of + /// characters comprising the surrogate. The following scheme defines the + /// format: (): + /// + /// For example, if the name of custom info type is 'MY_TOKEN_INFO_TYPE' and + /// the surrogate is 'abc', the full replacement value + /// will be: 'MY_TOKEN_INFO_TYPE(3):abc' + /// + /// This annotation identifies the surrogate when inspecting content using the + /// custom info type 'Surrogate'. This facilitates reversal of the + /// surrogate when it occurs in free text. + /// + /// In order for inspection to work properly, the name of this info type must + /// not occur naturally anywhere in your data; otherwise, inspection may either + /// + /// - reverse a surrogate that does not correspond to an actual identifier + /// - be unable to parse the surrogate and result in an error + /// + /// Therefore, choose your custom info type name carefully after considering + /// what your data looks like. One way to select a name that has a high chance + /// of yielding reliable detection is to include one or more unicode characters + /// that are highly improbable to exist in your data. + /// For example, assuming your data is entered from a regular ASCII keyboard, + /// the symbol with the hex code point 29DD might be used like so: + /// ⧝MY_TOKEN_TYPE + #[serde(rename="surrogateInfoType")] + pub surrogate_info_type: Option, } -impl Part for GooglePrivacyDlpV2ImageRedactionConfig {} +impl Part for GooglePrivacyDlpV2CryptoDeterministicConfig {} + + +/// Response message for ListInspectTemplates. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [inspect templates list projects](struct.ProjectInspectTemplateListCall.html) (response) +/// * [inspect templates list organizations](struct.OrganizationInspectTemplateListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GooglePrivacyDlpV2ListInspectTemplatesResponse { + /// If the next page is available then the next page token to be used + /// in following ListInspectTemplates request. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of inspectTemplates, up to page_size in ListInspectTemplatesRequest. + #[serde(rename="inspectTemplates")] + pub inspect_templates: Option>, +} + +impl ResponseResult for GooglePrivacyDlpV2ListInspectTemplatesResponse {} /// Message for a unique key indicating a record that contains a finding. @@ -740,6 +859,10 @@ pub struct GooglePrivacyDlpV2RecordKey { /// no description provided #[serde(rename="bigQueryKey")] pub big_query_key: Option, + /// Values of identifying columns in the given row. Order of values matches + /// the order of field identifiers specified in the scanning request. + #[serde(rename="idValues")] + pub id_values: Option>, /// no description provided #[serde(rename="datastoreKey")] pub datastore_key: Option, @@ -762,14 +885,14 @@ impl Part for GooglePrivacyDlpV2RecordKey {} pub struct GooglePrivacyDlpV2AuxiliaryTable { /// Auxiliary table location. [required] pub table: Option, - /// Quasi-identifier columns. [required] - #[serde(rename="quasiIds")] - pub quasi_ids: Option>, /// The relative frequency column must contain a floating-point number /// between 0 and 1 (inclusive). Null values are assumed to be zero. /// [required] #[serde(rename="relativeFrequency")] pub relative_frequency: Option, + /// Quasi-identifier columns. [required] + #[serde(rename="quasiIds")] + pub quasi_ids: Option>, } impl Part for GooglePrivacyDlpV2AuxiliaryTable {} @@ -790,43 +913,19 @@ pub struct GooglePrivacyDlpV2ValueFrequency { impl Part for GooglePrivacyDlpV2ValueFrequency {} -/// Options defining a file or a set of files within a Google Cloud Storage -/// bucket. +/// Request message for ActivateJobTrigger. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [job triggers activate projects](struct.ProjectJobTriggerActivateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2CloudStorageOptions { - /// Max number of bytes to scan from a file. If a scanned file's size is bigger - /// than this value then the rest of the bytes are omitted. Only one - /// of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. - #[serde(rename="bytesLimitPerFile")] - pub bytes_limit_per_file: Option, - /// Limits the number of files to scan to this percentage of the input FileSet. - /// Number of files scanned is rounded down. Must be between 0 and 100, - /// inclusively. Both 0 and 100 means no limit. Defaults to 0. - #[serde(rename="filesLimitPercent")] - pub files_limit_percent: Option, - /// Max percentage of bytes to scan from a file. The rest are omitted. The - /// number of bytes scanned is rounded down. Must be between 0 and 100, - /// inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one - /// of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. - #[serde(rename="bytesLimitPerFilePercent")] - pub bytes_limit_per_file_percent: Option, - /// no description provided - #[serde(rename="sampleMethod")] - pub sample_method: Option, - /// List of file type groups to include in the scan. - /// If empty, all files are scanned and available data format processors - /// are applied. - #[serde(rename="fileTypes")] - pub file_types: Option>, - /// The set of one or more files to scan. - #[serde(rename="fileSet")] - pub file_set: Option, -} +pub struct GooglePrivacyDlpV2ActivateJobTriggerRequest { _never_set: Option } -impl Part for GooglePrivacyDlpV2CloudStorageOptions {} +impl RequestValue for GooglePrivacyDlpV2ActivateJobTriggerRequest {} /// Publish the results of a DlpJob to a pub sub channel. @@ -895,12 +994,12 @@ impl ResponseResult for GooglePrivacyDlpV2ListStoredInfoTypesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2RecordLocation { - /// Location within a `ContentItem.Table`. - #[serde(rename="tableLocation")] - pub table_location: Option, /// Field id of the field containing the finding. #[serde(rename="fieldId")] pub field_id: Option, + /// Location within a `ContentItem.Table`. + #[serde(rename="tableLocation")] + pub table_location: Option, /// Key of the finding. #[serde(rename="recordKey")] pub record_key: Option, @@ -923,22 +1022,23 @@ pub struct GooglePrivacyDlpV2KAnonymityResult { impl Part for GooglePrivacyDlpV2KAnonymityResult {} -/// There is no detailed description. +/// Bounding box encompassing detected text within an image. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2RequestedOptions { - /// If run with an InspectTemplate, a snapshot of its state at the time of - /// this run. - #[serde(rename="snapshotInspectTemplate")] - pub snapshot_inspect_template: Option, - /// no description provided - #[serde(rename="jobConfig")] - pub job_config: Option, +pub struct GooglePrivacyDlpV2BoundingBox { + /// Width of the bounding box in pixels. + pub width: Option, + /// Top coordinate of the bounding box. (0,0) is upper left. + pub top: Option, + /// Height of the bounding box in pixels. + pub height: Option, + /// Left coordinate of the bounding box. (0,0) is upper left. + pub left: Option, } -impl Part for GooglePrivacyDlpV2RequestedOptions {} +impl Part for GooglePrivacyDlpV2BoundingBox {} /// Result of the reidentifiability analysis. Note that these results are an @@ -963,28 +1063,29 @@ pub struct GooglePrivacyDlpV2KMapEstimationResult { impl Part for GooglePrivacyDlpV2KMapEstimationResult {} -/// Response message for ListInspectTemplates. +/// Configuration for determining how redaction of images should occur. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [inspect templates list projects](struct.ProjectInspectTemplateListCall.html) (response) -/// * [inspect templates list organizations](struct.OrganizationInspectTemplateListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2ListInspectTemplatesResponse { - /// If the next page is available then the next page token to be used - /// in following ListInspectTemplates request. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// List of inspectTemplates, up to page_size in ListInspectTemplatesRequest. - #[serde(rename="inspectTemplates")] - pub inspect_templates: Option>, +pub struct GooglePrivacyDlpV2ImageRedactionConfig { + /// Only one per info_type should be provided per request. If not + /// specified, and redact_all_text is false, the DLP API will redact all + /// text that it matches against all info_types that are found, but not + /// specified in another ImageRedactionConfig. + #[serde(rename="infoType")] + pub info_type: Option, + /// If true, all text found in the image, regardless whether it matches an + /// info_type, is redacted. Only one should be provided. + #[serde(rename="redactAllText")] + pub redact_all_text: Option, + /// The color to use when redacting content from an image. If not specified, + /// the default is black. + #[serde(rename="redactionColor")] + pub redaction_color: Option, } -impl ResponseResult for GooglePrivacyDlpV2ListInspectTemplatesResponse {} +impl Part for GooglePrivacyDlpV2ImageRedactionConfig {} /// There is no detailed description. @@ -1000,15 +1101,15 @@ pub struct GooglePrivacyDlpV2CategoricalStatsHistogramBucket { /// Total number of distinct values in this bucket. #[serde(rename="bucketValueCount")] pub bucket_value_count: Option, - /// Upper bound on the value frequency of the values in this bucket. - #[serde(rename="valueFrequencyUpperBound")] - pub value_frequency_upper_bound: Option, - /// Lower bound on the value frequency of the values in this bucket. - #[serde(rename="valueFrequencyLowerBound")] - pub value_frequency_lower_bound: Option, /// Total number of values in this bucket. #[serde(rename="bucketSize")] pub bucket_size: Option, + /// Lower bound on the value frequency of the values in this bucket. + #[serde(rename="valueFrequencyLowerBound")] + pub value_frequency_lower_bound: Option, + /// Upper bound on the value frequency of the values in this bucket. + #[serde(rename="valueFrequencyUpperBound")] + pub value_frequency_upper_bound: Option, } impl Part for GooglePrivacyDlpV2CategoricalStatsHistogramBucket {} @@ -1030,75 +1131,39 @@ pub struct GooglePrivacyDlpV2ByteContentItem { impl Part for GooglePrivacyDlpV2ByteContentItem {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The field type of `value` and `field` do not need to match to be +/// considered equal, but not all comparisons are possible. +/// EQUAL_TO and NOT_EQUAL_TO attempt to compare even with incompatible types, +/// but all other comparisons are invalid with incompatible types. +/// A `value` of type: /// -/// - Simple to use and understand for most users -/// - Flexible enough to meet unexpected needs +/// - `string` can be compared against all other types +/// - `boolean` can only be compared against other booleans +/// - `integer` can be compared against doubles or a string if the string value +/// can be parsed as an integer. +/// - `double` can be compared against integers or a string if the string can +/// be parsed as a double. +/// - `Timestamp` can be compared against strings in RFC 3339 date string +/// format. +/// - `TimeOfDay` can be compared against timestamps and strings in the format +/// of 'HH:mm:ss'. /// -/// # Overview -/// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of -/// google.rpc.Code, but it may accept additional error codes if needed. The -/// error message should be a developer-facing English message that helps -/// developers *understand* and *resolve* the error. If a localized user-facing -/// error message is needed, put the localized message in the error details or -/// localize it in the client. The optional error details may contain arbitrary -/// information about the error. There is a predefined set of error detail types -/// in the package `google.rpc` that can be used for common error conditions. -/// -/// # Language mapping -/// -/// The `Status` message is the logical representation of the error model, but it -/// is not necessarily the actual wire format. When the `Status` message is -/// exposed in different client libraries and different wire protocols, it can be -/// mapped differently. For example, it will likely be mapped to some exceptions -/// in Java, but more likely mapped to some error codes in C. -/// -/// # Other uses -/// -/// The error model and the `Status` message can be used in a variety of -/// environments, either with or without APIs, to provide a -/// consistent developer experience across different environments. -/// -/// Example uses of this error model include: -/// -/// - Partial errors. If a service needs to return partial errors to the client, -/// it may embed the `Status` in the normal response to indicate the partial -/// errors. -/// -/// - Workflow errors. A typical workflow has multiple steps. Each step may -/// have a `Status` message for error reporting. -/// -/// - Batch operations. If a client uses batch request and batch response, the -/// `Status` message should be used directly inside batch response, one for -/// each error sub-response. -/// -/// - Asynchronous operations. If an API call embeds asynchronous operation -/// results in its response, the status of those operations should be -/// represented directly using the `Status` message. -/// -/// - Logging. If some API errors are stored in logs, the message `Status` could -/// be used directly after any stripping needed for security/privacy reasons. +/// If we fail to compare do to type mismatch, a warning will be given and +/// the condition will evaluate to false. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleRpcStatus { - /// A developer-facing error message, which should be in English. Any - /// user-facing error message should be localized and sent in the - /// google.rpc.Status.details field, or localized by the client. - pub message: Option, - /// The status code, which should be an enum value of google.rpc.Code. - pub code: Option, - /// A list of messages that carry the error details. There is a common set of - /// message types for APIs to use. - pub details: Option>>, +pub struct GooglePrivacyDlpV2Condition { + /// Operator used to compare the field or infoType to the value. [required] + pub operator: Option, + /// Field within the record this condition is evaluated against. [required] + pub field: Option, + /// Value to compare against. [Required, except for `EXISTS` tests.] + pub value: Option, } -impl Part for GoogleRpcStatus {} +impl Part for GooglePrivacyDlpV2Condition {} /// An entity in a dataset is a field or set of fields that correspond to a @@ -1118,27 +1183,31 @@ pub struct GooglePrivacyDlpV2EntityId { impl Part for GooglePrivacyDlpV2EntityId {} -/// Request message for UpdateDeidentifyTemplate. +/// Results of redacting an image. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [deidentify templates patch organizations](struct.OrganizationDeidentifyTemplatePatchCall.html) (request) -/// * [deidentify templates patch projects](struct.ProjectDeidentifyTemplatePatchCall.html) (request) +/// * [image redact projects](struct.ProjectImageRedactCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2UpdateDeidentifyTemplateRequest { - /// New DeidentifyTemplate value. - #[serde(rename="deidentifyTemplate")] - pub deidentify_template: Option, - /// Mask to control which fields get updated. - #[serde(rename="updateMask")] - pub update_mask: Option, +pub struct GooglePrivacyDlpV2RedactImageResponse { + /// If an image was being inspected and the InspectConfig's include_quote was + /// set to true, then this field will include all text, if any, that was found + /// in the image. + #[serde(rename="extractedText")] + pub extracted_text: Option, + /// The findings. Populated when include_findings in the request is true. + #[serde(rename="inspectResult")] + pub inspect_result: Option, + /// The redacted image. The type will be the same as the original image. + #[serde(rename="redactedImage")] + pub redacted_image: Option, } -impl RequestValue for GooglePrivacyDlpV2UpdateDeidentifyTemplateRequest {} +impl ResponseResult for GooglePrivacyDlpV2RedactImageResponse {} /// The inspectTemplate contains a configuration (set of types of sensitive data @@ -1283,7 +1352,7 @@ impl Part for GooglePrivacyDlpV2QuasiIdentifierField {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2UnwrappedCryptoKey { - /// The AES 128/192/256 bit key. [required] + /// A 128/192/256 bit key. [required] pub key: Option, } @@ -1331,11 +1400,11 @@ pub struct GooglePrivacyDlpV2DeidentifyContentRequest { pub deidentify_template_name: Option, /// The item to de-identify. Will be treated as text. pub item: Option, - /// Configuration for the inspector. + /// Configuration for the de-identification of the content item. /// Items specified here will override the template referenced by the - /// inspect_template_name argument. - #[serde(rename="inspectConfig")] - pub inspect_config: Option, + /// deidentify_template_name argument. + #[serde(rename="deidentifyConfig")] + pub deidentify_config: Option, /// Optional template to use. Any configuration directly specified in /// inspect_config will override those set in the template. Singular fields /// that are set in this request will replace their corresponding fields in the @@ -1343,11 +1412,11 @@ pub struct GooglePrivacyDlpV2DeidentifyContentRequest { /// are recursively merged. #[serde(rename="inspectTemplateName")] pub inspect_template_name: Option, - /// Configuration for the de-identification of the content item. + /// Configuration for the inspector. /// Items specified here will override the template referenced by the - /// deidentify_template_name argument. - #[serde(rename="deidentifyConfig")] - pub deidentify_config: Option, + /// inspect_template_name argument. + #[serde(rename="inspectConfig")] + pub inspect_config: Option, } impl RequestValue for GooglePrivacyDlpV2DeidentifyContentRequest {} @@ -1399,24 +1468,31 @@ pub struct GooglePrivacyDlpV2Conditions { impl Part for GooglePrivacyDlpV2Conditions {} -/// Include to use an existing data crypto key wrapped by KMS. -/// Authorization requires the following IAM permissions when sending a request -/// to perform a crypto transformation using a kms-wrapped crypto key: -/// dlp.kms.encrypt +/// An auxiliary table containing statistical information on the relative +/// frequency of different quasi-identifiers values. It has one or several +/// quasi-identifiers columns, and one column that indicates the relative +/// frequency of each quasi-identifier tuple. +/// If a tuple is present in the data but not in the auxiliary table, the +/// corresponding relative frequency is assumed to be zero (and thus, the +/// tuple is highly reidentifiable). /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2KmsWrappedCryptoKey { - /// The resource name of the KMS CryptoKey to use for unwrapping. [required] - #[serde(rename="cryptoKeyName")] - pub crypto_key_name: Option, - /// The wrapped data crypto key. [required] - #[serde(rename="wrappedKey")] - pub wrapped_key: Option, +pub struct GooglePrivacyDlpV2StatisticalTable { + /// Auxiliary table location. [required] + pub table: Option, + /// The relative frequency column must contain a floating-point number + /// between 0 and 1 (inclusive). Null values are assumed to be zero. + /// [required] + #[serde(rename="relativeFrequency")] + pub relative_frequency: Option, + /// Quasi-identifier columns. [required] + #[serde(rename="quasiIds")] + pub quasi_ids: Option>, } -impl Part for GooglePrivacyDlpV2KmsWrappedCryptoKey {} +impl Part for GooglePrivacyDlpV2StatisticalTable {} /// Privacy metric to compute for reidentification risk analysis. @@ -1432,8 +1508,8 @@ pub struct GooglePrivacyDlpV2PrivacyMetric { #[serde(rename="kMapEstimationConfig")] pub k_map_estimation_config: Option, /// no description provided - #[serde(rename="kAnonymityConfig")] - pub k_anonymity_config: Option, + #[serde(rename="deltaPresenceEstimationConfig")] + pub delta_presence_estimation_config: Option, /// no description provided #[serde(rename="categoricalStatsConfig")] pub categorical_stats_config: Option, @@ -1441,8 +1517,8 @@ pub struct GooglePrivacyDlpV2PrivacyMetric { #[serde(rename="lDiversityConfig")] pub l_diversity_config: Option, /// no description provided - #[serde(rename="deltaPresenceEstimationConfig")] - pub delta_presence_estimation_config: Option, + #[serde(rename="kAnonymityConfig")] + pub k_anonymity_config: Option, } impl Part for GooglePrivacyDlpV2PrivacyMetric {} @@ -1463,19 +1539,21 @@ pub struct GooglePrivacyDlpV2BigQueryField { impl Part for GooglePrivacyDlpV2BigQueryField {} -/// Generic half-open interval [start, end) +/// Type of information detected by the API. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2Range { - /// Index of the first character of the range (inclusive). - pub start: Option, - /// Index of the last character of the range (exclusive). - pub end: Option, +pub struct GooglePrivacyDlpV2InfoType { + /// Name of the information type. Either a name of your choosing when + /// creating a CustomInfoType, or one of the names listed + /// at https://cloud.google.com/dlp/docs/infotypes-reference when specifying + /// a built-in type. InfoType names should conform to the pattern + /// [a-zA-Z0-9_]{1,64}. + pub name: Option, } -impl Part for GooglePrivacyDlpV2Range {} +impl Part for GooglePrivacyDlpV2InfoType {} /// Result of the numerical stats computation. @@ -1660,22 +1738,37 @@ pub struct GooglePrivacyDlpV2ExclusionRule { impl Part for GooglePrivacyDlpV2ExclusionRule {} -/// A single inspection rule to be applied to infoTypes, specified in -/// `InspectionRuleSet`. +/// Summary of a single transformation. +/// Only one of 'transformation', 'field_transformation', or 'record_suppress' +/// will be set. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2InspectionRule { - /// Hotword-based detection rule. - #[serde(rename="hotwordRule")] - pub hotword_rule: Option, - /// Exclusion rule. - #[serde(rename="exclusionRule")] - pub exclusion_rule: Option, +pub struct GooglePrivacyDlpV2TransformationSummary { + /// Set if the transformation was limited to a specific FieldId. + pub field: Option, + /// The field transformation that was applied. + /// If multiple field transformations are requested for a single field, + /// this list will contain all of them; otherwise, only one is supplied. + #[serde(rename="fieldTransformations")] + pub field_transformations: Option>, + /// Set if the transformation was limited to a specific InfoType. + #[serde(rename="infoType")] + pub info_type: Option, + /// Total size in bytes that were transformed in some way. + #[serde(rename="transformedBytes")] + pub transformed_bytes: Option, + /// The specific suppression option these stats apply to. + #[serde(rename="recordSuppress")] + pub record_suppress: Option, + /// no description provided + pub results: Option>, + /// The specific transformation these stats apply to. + pub transformation: Option, } -impl Part for GooglePrivacyDlpV2InspectionRule {} +impl Part for GooglePrivacyDlpV2TransformationSummary {} /// Shifts dates by random number of days, with option to be consistent for the @@ -1745,124 +1838,54 @@ pub struct GooglePrivacyDlpV2CryptoKey { impl Part for GooglePrivacyDlpV2CryptoKey {} -/// Bounding box encompassing detected text within an image. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2BoundingBox { - /// Width of the bounding box in pixels. - pub width: Option, - /// Top coordinate of the bounding box. (0,0) is upper left. - pub top: Option, - /// Left coordinate of the bounding box. (0,0) is upper left. - pub left: Option, - /// Height of the bounding box in pixels. - pub height: Option, -} - -impl Part for GooglePrivacyDlpV2BoundingBox {} - - -/// Replaces an identifier with a surrogate using FPE with the FFX -/// mode of operation; however when used in the `ReidentifyContent` API method, -/// it serves the opposite function by reversing the surrogate back into -/// the original identifier. -/// The identifier must be encoded as ASCII. -/// For a given crypto key and context, the same identifier will be -/// replaced with the same surrogate. -/// Identifiers must be at least two characters long. -/// In the case that the identifier is the empty string, it will be skipped. -/// See https://cloud.google.com/dlp/docs/pseudonymization to learn more. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2CryptoReplaceFfxFpeConfig { - /// The key used by the encryption algorithm. [required] - #[serde(rename="cryptoKey")] - pub crypto_key: Option, - /// This is supported by mapping these to the alphanumeric characters - /// that the FFX mode natively supports. This happens before/after - /// encryption/decryption. - /// Each character listed must appear only once. - /// Number of characters must be in the range [2, 62]. - /// This must be encoded as ASCII. - /// The order of characters does not matter. - #[serde(rename="customAlphabet")] - pub custom_alphabet: Option, - /// The native way to select the alphabet. Must be in the range [2, 62]. - pub radix: Option, - /// The 'tweak', a context may be used for higher security since the same - /// identifier in two different contexts won't be given the same surrogate. If - /// the context is not set, a default tweak will be used. - /// - /// If the context is set but: - /// - /// 1. there is no record present when transforming a given value or - /// 1. the field is not present when transforming a given value, - /// - /// a default tweak will be used. - /// - /// Note that case (1) is expected when an `InfoTypeTransformation` is - /// applied to both structured and non-structured `ContentItem`s. - /// Currently, the referenced field may be of value type integer or string. - /// - /// The tweak is constructed as a sequence of bytes in big endian byte order - /// such that: - /// - /// - a 64 bit integer is encoded followed by a single byte of value 1 - /// - a string is encoded in UTF-8 format followed by a single byte of value 2 - pub context: Option, - /// The custom infoType to annotate the surrogate with. - /// This annotation will be applied to the surrogate by prefixing it with - /// the name of the custom infoType followed by the number of - /// characters comprising the surrogate. The following scheme defines the - /// format: info_type_name(surrogate_character_count):surrogate - /// - /// For example, if the name of custom infoType is 'MY_TOKEN_INFO_TYPE' and - /// the surrogate is 'abc', the full replacement value - /// will be: 'MY_TOKEN_INFO_TYPE(3):abc' - /// - /// This annotation identifies the surrogate when inspecting content using the - /// custom infoType - /// [`SurrogateType`](/dlp/docs/reference/rest/v2/InspectConfig#surrogatetype). - /// This facilitates reversal of the surrogate when it occurs in free text. - /// - /// In order for inspection to work properly, the name of this infoType must - /// not occur naturally anywhere in your data; otherwise, inspection may - /// find a surrogate that does not correspond to an actual identifier. - /// Therefore, choose your custom infoType name carefully after considering - /// what your data looks like. One way to select a name that has a high chance - /// of yielding reliable detection is to include one or more unicode characters - /// that are highly improbable to exist in your data. - /// For example, assuming your data is entered from a regular ASCII keyboard, - /// the symbol with the hex code point 29DD might be used like so: - /// ⧝MY_TOKEN_TYPE - #[serde(rename="surrogateInfoType")] - pub surrogate_info_type: Option, +pub struct GooglePrivacyDlpV2RequestedOptions { + /// If run with an InspectTemplate, a snapshot of its state at the time of + /// this run. + #[serde(rename="snapshotInspectTemplate")] + pub snapshot_inspect_template: Option, /// no description provided - #[serde(rename="commonAlphabet")] - pub common_alphabet: Option, + #[serde(rename="jobConfig")] + pub job_config: Option, } -impl Part for GooglePrivacyDlpV2CryptoReplaceFfxFpeConfig {} +impl Part for GooglePrivacyDlpV2RequestedOptions {} -/// Type of information detected by the API. +/// Options defining a data set within Google Cloud Datastore. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2InfoType { - /// Name of the information type. Either a name of your choosing when - /// creating a CustomInfoType, or one of the names listed - /// at https://cloud.google.com/dlp/docs/infotypes-reference when specifying - /// a built-in type. - pub name: Option, +pub struct GooglePrivacyDlpV2DatastoreOptions { + /// The kind to process. + pub kind: Option, + /// A partition ID identifies a grouping of entities. The grouping is always + /// by project and namespace, however the namespace ID may be empty. + #[serde(rename="partitionId")] + pub partition_id: Option, } -impl Part for GooglePrivacyDlpV2InfoType {} +impl Part for GooglePrivacyDlpV2DatastoreOptions {} + + +/// Generic half-open interval [start, end) +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GooglePrivacyDlpV2Range { + /// Index of the first character of the range (inclusive). + pub start: Option, + /// Index of the last character of the range (exclusive). + pub end: Option, +} + +impl Part for GooglePrivacyDlpV2Range {} /// A rule for transforming a value. @@ -1875,32 +1898,35 @@ pub struct GooglePrivacyDlpV2PrimitiveTransformation { #[serde(rename="characterMaskConfig")] pub character_mask_config: Option, /// no description provided - #[serde(rename="redactConfig")] - pub redact_config: Option, + #[serde(rename="cryptoDeterministicConfig")] + pub crypto_deterministic_config: Option, /// no description provided #[serde(rename="bucketingConfig")] pub bucketing_config: Option, /// no description provided + #[serde(rename="redactConfig")] + pub redact_config: Option, + /// no description provided #[serde(rename="fixedSizeBucketingConfig")] pub fixed_size_bucketing_config: Option, /// no description provided #[serde(rename="timePartConfig")] pub time_part_config: Option, /// no description provided + #[serde(rename="cryptoHashConfig")] + pub crypto_hash_config: Option, + /// no description provided #[serde(rename="dateShiftConfig")] pub date_shift_config: Option, /// no description provided - #[serde(rename="replaceConfig")] - pub replace_config: Option, - /// no description provided #[serde(rename="replaceWithInfoTypeConfig")] pub replace_with_info_type_config: Option, /// no description provided #[serde(rename="cryptoReplaceFfxFpeConfig")] pub crypto_replace_ffx_fpe_config: Option, /// no description provided - #[serde(rename="cryptoHashConfig")] - pub crypto_hash_config: Option, + #[serde(rename="replaceConfig")] + pub replace_config: Option, } impl Part for GooglePrivacyDlpV2PrimitiveTransformation {} @@ -1915,11 +1941,14 @@ pub struct GooglePrivacyDlpV2InfoTypeDescription { /// Human readable form of the infoType name. #[serde(rename="displayName")] pub display_name: Option, - /// Internal name of the infoType. - pub name: Option, + /// Description of the infotype. Translated when language is provided in the + /// request. + pub description: Option, /// Which parts of the API supports this InfoType. #[serde(rename="supportedBy")] pub supported_by: Option>, + /// Internal name of the infoType. + pub name: Option, } impl Part for GooglePrivacyDlpV2InfoTypeDescription {} @@ -1967,6 +1996,16 @@ impl ResponseResult for GooglePrivacyDlpV2ListJobTriggersResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2BigQueryOptions { + /// References to fields excluded from scanning. This allows you to skip + /// inspection of entire columns which you know have no findings. + #[serde(rename="excludedFields")] + pub excluded_fields: Option>, + /// Max number of rows to scan. If the table has more rows than this value, the + /// rest of the rows are omitted. If not set, or if set to 0, all rows will be + /// scanned. Only one of rows_limit and rows_limit_percent can be specified. + /// Cannot be used in conjunction with TimespanConfig. + #[serde(rename="rowsLimit")] + pub rows_limit: Option, /// no description provided #[serde(rename="sampleMethod")] pub sample_method: Option, @@ -1974,6 +2013,9 @@ pub struct GooglePrivacyDlpV2BigQueryOptions { /// Nested fields in the format, like `person.birthdate.year`, are allowed. #[serde(rename="identifyingFields")] pub identifying_fields: Option>, + /// Complete BigQuery table reference. + #[serde(rename="tableReference")] + pub table_reference: Option, /// Max percentage of rows to scan. The rest are omitted. The number of rows /// scanned is rounded down. Must be between 0 and 100, inclusively. Both 0 and /// 100 means no limit. Defaults to 0. Only one of rows_limit and @@ -1981,15 +2023,6 @@ pub struct GooglePrivacyDlpV2BigQueryOptions { /// TimespanConfig. #[serde(rename="rowsLimitPercent")] pub rows_limit_percent: Option, - /// Complete BigQuery table reference. - #[serde(rename="tableReference")] - pub table_reference: Option, - /// Max number of rows to scan. If the table has more rows than this value, the - /// rest of the rows are omitted. If not set, or if set to 0, all rows will be - /// scanned. Only one of rows_limit and rows_limit_percent can be specified. - /// Cannot be used in conjunction with TimespanConfig. - #[serde(rename="rowsLimit")] - pub rows_limit: Option, } impl Part for GooglePrivacyDlpV2BigQueryOptions {} @@ -2052,7 +2085,7 @@ pub struct GooglePrivacyDlpV2CreateInspectTemplateRequest { pub inspect_template: Option, /// The template id can contain uppercase and lowercase letters, /// numbers, and hyphens; that is, it must match the regular - /// expression: `[a-zA-Z\\d-]+`. The maximum length is 100 + /// expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 /// characters. Can be empty to allow the system to generate one. #[serde(rename="templateId")] pub template_id: Option, @@ -2227,22 +2260,23 @@ impl Part for GooglePrivacyDlpV2InspectResult {} /// Message for a date time object. +/// e.g. 2018-01-01, 5th August. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2DateTime { - /// no description provided - #[serde(rename="dayOfWeek")] - pub day_of_week: Option, - /// no description provided - #[serde(rename="timeZone")] - pub time_zone: Option, /// One or more of the following must be set. All fields are optional, but /// when set must be valid date or time values. pub date: Option, /// no description provided + #[serde(rename="dayOfWeek")] + pub day_of_week: Option, + /// no description provided pub time: Option, + /// no description provided + #[serde(rename="timeZone")] + pub time_zone: Option, } impl Part for GooglePrivacyDlpV2DateTime {} @@ -2275,6 +2309,10 @@ pub struct GooglePrivacyDlpV2Action { /// Save resulting findings in a provided location. #[serde(rename="saveFindings")] pub save_findings: Option, + /// Enable email notification to project owners and editors on job's + /// completion/failure. + #[serde(rename="jobNotificationEmails")] + pub job_notification_emails: Option, /// Publish summary to Cloud Security Command Center (Alpha). #[serde(rename="publishSummaryToCscc")] pub publish_summary_to_cscc: Option, @@ -2329,31 +2367,27 @@ pub struct GooglePrivacyDlpV2BigQueryTable { impl Part for GooglePrivacyDlpV2BigQueryTable {} -/// Results of redacting an image. +/// Request message for UpdateDeidentifyTemplate. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [image redact projects](struct.ProjectImageRedactCall.html) (response) +/// * [deidentify templates patch organizations](struct.OrganizationDeidentifyTemplatePatchCall.html) (request) +/// * [deidentify templates patch projects](struct.ProjectDeidentifyTemplatePatchCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2RedactImageResponse { - /// If an image was being inspected and the InspectConfig's include_quote was - /// set to true, then this field will include all text, if any, that was found - /// in the image. - #[serde(rename="extractedText")] - pub extracted_text: Option, - /// The findings. Populated when include_findings in the request is true. - #[serde(rename="inspectResult")] - pub inspect_result: Option, - /// The redacted image. The type will be the same as the original image. - #[serde(rename="redactedImage")] - pub redacted_image: Option, +pub struct GooglePrivacyDlpV2UpdateDeidentifyTemplateRequest { + /// New DeidentifyTemplate value. + #[serde(rename="deidentifyTemplate")] + pub deidentify_template: Option, + /// Mask to control which fields get updated. + #[serde(rename="updateMask")] + pub update_mask: Option, } -impl ResponseResult for GooglePrivacyDlpV2RedactImageResponse {} +impl RequestValue for GooglePrivacyDlpV2UpdateDeidentifyTemplateRequest {} /// Generalization function that buckets values based on ranges. The ranges and @@ -2506,7 +2540,7 @@ impl Part for GooglePrivacyDlpV2AnalyzeDataSourceRiskDetails {} pub struct GooglePrivacyDlpV2CreateJobTriggerRequest { /// The trigger id can contain uppercase and lowercase letters, /// numbers, and hyphens; that is, it must match the regular - /// expression: `[a-zA-Z\\d-]+`. The maximum length is 100 + /// expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 /// characters. Can be empty to allow the system to generate one. #[serde(rename="triggerId")] pub trigger_id: Option, @@ -2578,10 +2612,10 @@ impl Part for GooglePrivacyDlpV2KMapEstimationHistogramBucket {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2ReidentifyContentResponse { - /// An overview of the changes that were made to the `item`. - pub overview: Option, /// The re-identified item. pub item: Option, + /// An overview of the changes that were made to the `item`. + pub overview: Option, } impl ResponseResult for GooglePrivacyDlpV2ReidentifyContentResponse {} @@ -2687,8 +2721,15 @@ impl Part for GooglePrivacyDlpV2CloudStoragePath {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2FileSet { /// The Cloud Storage url of the file(s) to scan, in the format - /// `gs:///`. Trailing wildcard in the path is allowed. Exactly - /// one of `url` or `regex_file_set` must be set. + /// `gs:///`. Trailing wildcard in the path is allowed. + /// + /// If the url ends in a trailing slash, the bucket or directory represented + /// by the url will be scanned non-recursively (content in sub-directories + /// will not be scanned). This means that `gs://mybucket/` is equivalent to + /// `gs://mybucket/*`, and `gs://mybucket/directory/` is equivalent to + /// `gs://mybucket/directory/*`. + /// + /// Exactly one of `url` or `regex_file_set` must be set. pub url: Option, /// The regex-filtered set of files to scan. Exactly one of `url` or /// `regex_file_set` must be set. @@ -2799,7 +2840,7 @@ impl Part for GooglePrivacyDlpV2Table {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2QuoteInfo { - /// no description provided + /// The date time indicated by the quote. #[serde(rename="dateTime")] pub date_time: Option, } @@ -2856,8 +2897,9 @@ pub struct GooglePrivacyDlpV2OutputStorageConfig { /// from the predefined schema that are missing will be added. No columns in /// the existing table will be deleted. /// - /// If unspecified, then all available columns will be used for a new table, - /// and no changes will be made to an existing table. + /// If unspecified, then all available columns will be used for a new table or + /// an (existing) table with no schema, and no changes will be made to an + /// existing table that has a schema. #[serde(rename="outputSchema")] pub output_schema: Option, } @@ -2873,8 +2915,8 @@ impl Part for GooglePrivacyDlpV2OutputStorageConfig {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [job triggers get projects](struct.ProjectJobTriggerGetCall.html) (response) /// * [job triggers create projects](struct.ProjectJobTriggerCreateCall.html) (response) +/// * [job triggers get projects](struct.ProjectJobTriggerGetCall.html) (response) /// * [job triggers patch projects](struct.ProjectJobTriggerPatchCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -2885,7 +2927,7 @@ pub struct GooglePrivacyDlpV2JobTrigger { #[serde(rename="updateTime")] pub update_time: Option, /// A stream of errors encountered when the trigger was activated. Repeated - /// errors may result in the JobTrigger automaticaly being paused. + /// errors may result in the JobTrigger automatically being paused. /// Will return the last 100 errors. Whenever the JobTrigger is modified /// this list will be cleared. Output only field. pub errors: Option>, @@ -2894,13 +2936,13 @@ pub struct GooglePrivacyDlpV2JobTrigger { pub display_name: Option, /// User provided description (max 256 chars) pub description: Option, + /// no description provided + #[serde(rename="inspectJob")] + pub inspect_job: Option, /// A list of triggers which will be OR'ed together. Only one in the list /// needs to trigger for a job to be started. The list may contain only /// a single Schedule trigger and must have at least one object. pub triggers: Option>, - /// no description provided - #[serde(rename="inspectJob")] - pub inspect_job: Option, /// The timestamp of the last time this trigger executed, output only field. #[serde(rename="lastRunTime")] pub last_run_time: Option, @@ -2961,55 +3003,45 @@ impl Part for GooglePrivacyDlpV2Schedule {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2LDiversityHistogramBucket { - /// Sample of equivalence classes in this bucket. The total number of - /// classes returned per bucket is capped at 20. - #[serde(rename="bucketValues")] - pub bucket_values: Option>, - /// Total number of distinct equivalence classes in this bucket. - #[serde(rename="bucketValueCount")] - pub bucket_value_count: Option, - /// Total number of equivalence classes in this bucket. - #[serde(rename="bucketSize")] - pub bucket_size: Option, - /// Upper bound on the sensitive value frequencies of the equivalence - /// classes in this bucket. - #[serde(rename="sensitiveValueFrequencyUpperBound")] - pub sensitive_value_frequency_upper_bound: Option, - /// Lower bound on the sensitive value frequencies of the equivalence - /// classes in this bucket. - #[serde(rename="sensitiveValueFrequencyLowerBound")] - pub sensitive_value_frequency_lower_bound: Option, +pub struct GooglePrivacyDlpV2FindingLimits { + /// Max number of findings that will be returned per request/job. + /// When set within `InspectContentRequest`, the maximum returned is 2000 + /// regardless if this is set higher. + #[serde(rename="maxFindingsPerRequest")] + pub max_findings_per_request: Option, + /// Configuration of findings limit given for specified infoTypes. + #[serde(rename="maxFindingsPerInfoType")] + pub max_findings_per_info_type: Option>, + /// Max number of findings that will be returned for each item scanned. + /// When set within `InspectDataSourceRequest`, + /// the maximum returned is 2000 regardless if this is set higher. + /// When set within `InspectContentRequest`, this field is ignored. + #[serde(rename="maxFindingsPerItem")] + pub max_findings_per_item: Option, } -impl Part for GooglePrivacyDlpV2LDiversityHistogramBucket {} +impl Part for GooglePrivacyDlpV2FindingLimits {} -/// An auxiliary table containing statistical information on the relative -/// frequency of different quasi-identifiers values. It has one or several -/// quasi-identifiers columns, and one column that indicates the relative -/// frequency of each quasi-identifier tuple. -/// If a tuple is present in the data but not in the auxiliary table, the -/// corresponding relative frequency is assumed to be zero (and thus, the -/// tuple is highly reidentifiable). +/// Include to use an existing data crypto key wrapped by KMS. +/// The wrapped key must be a 128/192/256 bit key. +/// Authorization requires the following IAM permissions when sending a request +/// to perform a crypto transformation using a kms-wrapped crypto key: +/// dlp.kms.encrypt /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2StatisticalTable { - /// Auxiliary table location. [required] - pub table: Option, - /// Quasi-identifier columns. [required] - #[serde(rename="quasiIds")] - pub quasi_ids: Option>, - /// The relative frequency column must contain a floating-point number - /// between 0 and 1 (inclusive). Null values are assumed to be zero. - /// [required] - #[serde(rename="relativeFrequency")] - pub relative_frequency: Option, +pub struct GooglePrivacyDlpV2KmsWrappedCryptoKey { + /// The resource name of the KMS CryptoKey to use for unwrapping. [required] + #[serde(rename="cryptoKeyName")] + pub crypto_key_name: Option, + /// The wrapped data crypto key. [required] + #[serde(rename="wrappedKey")] + pub wrapped_key: Option, } -impl Part for GooglePrivacyDlpV2StatisticalTable {} +impl Part for GooglePrivacyDlpV2KmsWrappedCryptoKey {} /// Location of the finding within an image. @@ -3072,9 +3104,10 @@ impl Part for GooglePrivacyDlpV2TimeZone {} /// Pseudonymization method that generates surrogates via cryptographic hashing. /// Uses SHA-256. /// The key size must be either 32 or 64 bytes. -/// Outputs a 32 byte digest as an uppercase hex string -/// (for example, 41D1567F7F99F1DC2A5FAB886DEE5BEE). +/// Outputs a base64 encoded representation of the hashed output +/// (for example, L7k0BHmF1ha5U3NfGykjro4xWi1MPVQPjhMAZbSV9mM=). /// Currently, only string and integer values can be hashed. +/// See https://cloud.google.com/dlp/docs/pseudonymization to learn more. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -3121,16 +3154,16 @@ impl ResponseResult for GooglePrivacyDlpV2ListDeidentifyTemplatesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleTypeTimeOfDay { - /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may - /// allow the value 60 if it allows leap-seconds. - pub seconds: Option, /// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose /// to allow the value "24:00:00" for scenarios like business closing time. pub hours: Option, - /// Minutes of hour of day. Must be from 0 to 59. - pub minutes: Option, /// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. pub nanos: Option, + /// Minutes of hour of day. Must be from 0 to 59. + pub minutes: Option, + /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may + /// allow the value 60 if it allows leap-seconds. + pub seconds: Option, } impl Part for GoogleTypeTimeOfDay {} @@ -3146,6 +3179,10 @@ pub struct GooglePrivacyDlpV2Regex { /// (https://github.com/google/re2/wiki/Syntax) can be found under the /// google/re2 repository on GitHub. pub pattern: Option, + /// The index of the submatch to extract as findings. When not + /// specified, the entire match is returned. No more than 3 may be included. + #[serde(rename="groupIndexes")] + pub group_indexes: Option>, } impl Part for GooglePrivacyDlpV2Regex {} @@ -3157,10 +3194,8 @@ impl Part for GooglePrivacyDlpV2Regex {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2FieldTransformation { - /// Treat the contents of the field as free text, and selectively - /// transform content that matches an `InfoType`. - #[serde(rename="infoTypeTransformations")] - pub info_type_transformations: Option, + /// Input field(s) to apply the transformation to. [required] + pub fields: Option>, /// Apply the transformation to the entire field. #[serde(rename="primitiveTransformation")] pub primitive_transformation: Option, @@ -3174,8 +3209,10 @@ pub struct GooglePrivacyDlpV2FieldTransformation { /// column for the same record is within a specific range. /// - Redact a field if the date of birth field is greater than 85. pub condition: Option, - /// Input field(s) to apply the transformation to. [required] - pub fields: Option>, + /// Treat the contents of the field as free text, and selectively + /// transform content that matches an `InfoType`. + #[serde(rename="infoTypeTransformations")] + pub info_type_transformations: Option, } impl Part for GooglePrivacyDlpV2FieldTransformation {} @@ -3216,15 +3253,15 @@ pub struct GooglePrivacyDlpV2DeltaPresenceEstimationHistogramBucket { /// Total number of distinct quasi-identifier tuple values in this bucket. #[serde(rename="bucketValueCount")] pub bucket_value_count: Option, - /// Between 0 and 1. - #[serde(rename="minProbability")] - pub min_probability: Option, - /// Always greater than or equal to min_probability. - #[serde(rename="maxProbability")] - pub max_probability: Option, /// Number of records within these probability bounds. #[serde(rename="bucketSize")] pub bucket_size: Option, + /// Always greater than or equal to min_probability. + #[serde(rename="maxProbability")] + pub max_probability: Option, + /// Between 0 and 1. + #[serde(rename="minProbability")] + pub min_probability: Option, } impl Part for GooglePrivacyDlpV2DeltaPresenceEstimationHistogramBucket {} @@ -3236,11 +3273,6 @@ impl Part for GooglePrivacyDlpV2DeltaPresenceEstimationHistogramBucket {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2Location { - /// Unicode character offsets delimiting the finding. - /// These are relative to the finding's containing element. - /// Provided when the content is text. - #[serde(rename="codepointRange")] - pub codepoint_range: Option, /// Zero-based byte offsets delimiting the finding. /// These are relative to the finding's containing element. /// Note that when the content is not textual, this references @@ -3248,6 +3280,11 @@ pub struct GooglePrivacyDlpV2Location { /// Omitted if content is an image. #[serde(rename="byteRange")] pub byte_range: Option, + /// Unicode character offsets delimiting the finding. + /// These are relative to the finding's containing element. + /// Provided when the content is text. + #[serde(rename="codepointRange")] + pub codepoint_range: Option, /// List of nested objects pointing to the precise location of the finding /// within the file or record. #[serde(rename="contentLocations")] @@ -3310,17 +3347,8 @@ impl Part for GooglePrivacyDlpV2ContentLocation {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2ReidentifyContentRequest { - /// Configuration for the re-identification of the content item. - /// This field shares the same proto message type that is used for - /// de-identification, however its usage here is for the reversal of the - /// previous de-identification. Re-identification is performed by examining - /// the transformations used to de-identify the items and executing the - /// reverse. This requires that only reversible transformations - /// be provided here. The reversible transformations are: - /// - /// - `CryptoReplaceFfxFpeConfig` - #[serde(rename="reidentifyConfig")] - pub reidentify_config: Option, + /// The item to re-identify. Will be treated as text. + pub item: Option, /// Optional template to use. References an instance of `DeidentifyTemplate`. /// Any configuration directly specified in `reidentify_config` or /// `inspect_config` will override those set in the template. Singular fields @@ -3339,8 +3367,17 @@ pub struct GooglePrivacyDlpV2ReidentifyContentRequest { /// are recursively merged. #[serde(rename="inspectTemplateName")] pub inspect_template_name: Option, - /// The item to re-identify. Will be treated as text. - pub item: Option, + /// Configuration for the re-identification of the content item. + /// This field shares the same proto message type that is used for + /// de-identification, however its usage here is for the reversal of the + /// previous de-identification. Re-identification is performed by examining + /// the transformations used to de-identify the items and executing the + /// reverse. This requires that only reversible transformations + /// be provided here. The reversible transformations are: + /// + /// - `CryptoReplaceFfxFpeConfig` + #[serde(rename="reidentifyConfig")] + pub reidentify_config: Option, } impl RequestValue for GooglePrivacyDlpV2ReidentifyContentRequest {} @@ -3367,7 +3404,7 @@ impl Part for GooglePrivacyDlpV2KindExpression {} pub struct GooglePrivacyDlpV2KAnonymityConfig { /// Optional message indicating that multiple rows might be associated to a /// single individual. If the same entity_id is associated to multiple - /// quasi-identifier tuples over distict rows, we consider the entire + /// quasi-identifier tuples over distinct rows, we consider the entire /// collection of tuples as the composite quasi-identifier. This collection /// is a multiset: the order in which the different tuples appear in the /// dataset is ignored, but their frequency is taken into account. @@ -3506,10 +3543,10 @@ impl Part for GooglePrivacyDlpV2KMapEstimationConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2DeidentifyContentResponse { - /// An overview of the changes that were made on the `item`. - pub overview: Option, /// The de-identified item. pub item: Option, + /// An overview of the changes that were made on the `item`. + pub overview: Option, } impl ResponseResult for GooglePrivacyDlpV2DeidentifyContentResponse {} @@ -3527,8 +3564,8 @@ impl ResponseResult for GooglePrivacyDlpV2DeidentifyContentResponse {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GooglePrivacyDlpV2Value { /// no description provided - #[serde(rename="floatValue")] - pub float_value: Option, + #[serde(rename="timeValue")] + pub time_value: Option, /// no description provided #[serde(rename="timestampValue")] pub timestamp_value: Option, @@ -3536,8 +3573,8 @@ pub struct GooglePrivacyDlpV2Value { #[serde(rename="dayOfWeekValue")] pub day_of_week_value: Option, /// no description provided - #[serde(rename="timeValue")] - pub time_value: Option, + #[serde(rename="floatValue")] + pub float_value: Option, /// no description provided #[serde(rename="dateValue")] pub date_value: Option, @@ -3633,7 +3670,7 @@ pub struct GooglePrivacyDlpV2CreateDeidentifyTemplateRequest { pub deidentify_template: Option, /// The template id can contain uppercase and lowercase letters, /// numbers, and hyphens; that is, it must match the regular - /// expression: `[a-zA-Z\\d-]+`. The maximum length is 100 + /// expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 /// characters. Can be empty to allow the system to generate one. #[serde(rename="templateId")] pub template_id: Option, @@ -3656,7 +3693,7 @@ impl RequestValue for GooglePrivacyDlpV2CreateDeidentifyTemplateRequest {} pub struct GooglePrivacyDlpV2CreateStoredInfoTypeRequest { /// The storedInfoType ID can contain uppercase and lowercase letters, /// numbers, and hyphens; that is, it must match the regular - /// expression: `[a-zA-Z\\d-]+`. The maximum length is 100 + /// expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 /// characters. Can be empty to allow the system to generate one. #[serde(rename="storedInfoTypeId")] pub stored_info_type_id: Option, @@ -3684,19 +3721,44 @@ pub struct GooglePrivacyDlpV2Expressions { impl Part for GooglePrivacyDlpV2Expressions {} -/// Compute numerical stats over an individual column, including -/// min, max, and quantiles. +/// Options defining a file or a set of files within a Google Cloud Storage +/// bucket. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2NumericalStatsConfig { - /// Field to compute numerical stats on. Supported types are - /// integer, float, date, datetime, timestamp, time. - pub field: Option, +pub struct GooglePrivacyDlpV2CloudStorageOptions { + /// Max number of bytes to scan from a file. If a scanned file's size is bigger + /// than this value then the rest of the bytes are omitted. Only one + /// of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. + #[serde(rename="bytesLimitPerFile")] + pub bytes_limit_per_file: Option, + /// Max percentage of bytes to scan from a file. The rest are omitted. The + /// number of bytes scanned is rounded down. Must be between 0 and 100, + /// inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one + /// of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. + #[serde(rename="bytesLimitPerFilePercent")] + pub bytes_limit_per_file_percent: Option, + /// Limits the number of files to scan to this percentage of the input FileSet. + /// Number of files scanned is rounded down. Must be between 0 and 100, + /// inclusively. Both 0 and 100 means no limit. Defaults to 0. + #[serde(rename="filesLimitPercent")] + pub files_limit_percent: Option, + /// no description provided + #[serde(rename="sampleMethod")] + pub sample_method: Option, + /// List of file type groups to include in the scan. + /// If empty, all files are scanned and available data format processors + /// are applied. In addition, the binary content of the selected files + /// is always scanned as well. + #[serde(rename="fileTypes")] + pub file_types: Option>, + /// The set of one or more files to scan. + #[serde(rename="fileSet")] + pub file_set: Option, } -impl Part for GooglePrivacyDlpV2NumericalStatsConfig {} +impl Part for GooglePrivacyDlpV2CloudStorageOptions {} /// Message representing a set of files in a Cloud Storage bucket. Regular @@ -3846,49 +3908,86 @@ pub struct GooglePrivacyDlpV2LargeCustomDictionaryConfig { /// longer be used. #[serde(rename="outputPath")] pub output_path: Option, - /// Set of files containing newline-delimited lists of dictionary phrases. - #[serde(rename="cloudStorageFileSet")] - pub cloud_storage_file_set: Option, /// Field in a BigQuery table where each cell represents a dictionary phrase. #[serde(rename="bigQueryField")] pub big_query_field: Option, + /// Set of files containing newline-delimited lists of dictionary phrases. + #[serde(rename="cloudStorageFileSet")] + pub cloud_storage_file_set: Option, } impl Part for GooglePrivacyDlpV2LargeCustomDictionaryConfig {} -/// The field type of `value` and `field` do not need to match to be -/// considered equal, but not all comparisons are possible. +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// -/// A `value` of type: +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs /// -/// - `string` can be compared against all other types -/// - `boolean` can only be compared against other booleans -/// - `integer` can be compared against doubles or a string if the string value -/// can be parsed as an integer. -/// - `double` can be compared against integers or a string if the string can -/// be parsed as a double. -/// - `Timestamp` can be compared against strings in RFC 3339 date string -/// format. -/// - `TimeOfDay` can be compared against timestamps and strings in the format -/// of 'HH:mm:ss'. +/// # Overview /// -/// If we fail to compare do to type mismatch, a warning will be given and -/// the condition will evaluate to false. +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2Condition { - /// Operator used to compare the field or infoType to the value. [required] - pub operator: Option, - /// Field within the record this condition is evaluated against. [required] - pub field: Option, - /// Value to compare against. [Required, except for `EXISTS` tests.] - pub value: Option, +pub struct GoogleRpcStatus { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, } -impl Part for GooglePrivacyDlpV2Condition {} +impl Part for GoogleRpcStatus {} /// Configuration for a risk analysis job. See @@ -3919,6 +4018,7 @@ impl Part for GooglePrivacyDlpV2RiskAnalysisJobConfig {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// +/// * [job triggers activate projects](struct.ProjectJobTriggerActivateCall.html) (response) /// * [dlp jobs get projects](struct.ProjectDlpJobGetCall.html) (response) /// * [dlp jobs create projects](struct.ProjectDlpJobCreateCall.html) (response) /// @@ -4064,7 +4164,7 @@ pub struct GooglePrivacyDlpV2CancelDlpJobRequest { _never_set: Option } impl RequestValue for GooglePrivacyDlpV2CancelDlpJobRequest {} -/// There is no detailed description. +/// All result fields mentioned below are updated while the job is processing. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -4182,6 +4282,20 @@ pub struct GoogleProtobufEmpty { _never_set: Option } impl ResponseResult for GoogleProtobufEmpty {} +/// Result of the l-diversity computation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GooglePrivacyDlpV2LDiversityResult { + /// Histogram of l-diversity equivalence class sensitive value frequencies. + #[serde(rename="sensitiveValueFrequencyHistogramBuckets")] + pub sensitive_value_frequency_histogram_buckets: Option>, +} + +impl Part for GooglePrivacyDlpV2LDiversityResult {} + + /// Represents a whole or partial calendar date, e.g. a birthday. The time of day /// and time zone are either specified elsewhere or are not significant. The date /// is relative to the Proleptic Gregorian Calendar. This can represent: @@ -4197,16 +4311,16 @@ impl ResponseResult for GoogleProtobufEmpty {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleTypeDate { - /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without - /// a year. - pub year: Option, + /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a + /// month and day. + pub month: Option, /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0 /// if specifying a year by itself or a year and month where the day is not /// significant. pub day: Option, - /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a - /// month and day. - pub month: Option, + /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without + /// a year. + pub year: Option, } impl Part for GoogleTypeDate {} @@ -4217,24 +4331,28 @@ impl Part for GoogleTypeDate {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2FindingLimits { - /// Max number of findings that will be returned per request/job. - /// When set within `InspectContentRequest`, the maximum returned is 1000 - /// regardless if this is set higher. - #[serde(rename="maxFindingsPerRequest")] - pub max_findings_per_request: Option, - /// Configuration of findings limit given for specified infoTypes. - #[serde(rename="maxFindingsPerInfoType")] - pub max_findings_per_info_type: Option>, - /// Max number of findings that will be returned for each item scanned. - /// When set within `InspectDataSourceRequest`, - /// the maximum returned is 1000 regardless if this is set higher. - /// When set within `InspectContentRequest`, this field is ignored. - #[serde(rename="maxFindingsPerItem")] - pub max_findings_per_item: Option, +pub struct GooglePrivacyDlpV2LDiversityHistogramBucket { + /// Sample of equivalence classes in this bucket. The total number of + /// classes returned per bucket is capped at 20. + #[serde(rename="bucketValues")] + pub bucket_values: Option>, + /// Total number of distinct equivalence classes in this bucket. + #[serde(rename="bucketValueCount")] + pub bucket_value_count: Option, + /// Total number of equivalence classes in this bucket. + #[serde(rename="bucketSize")] + pub bucket_size: Option, + /// Upper bound on the sensitive value frequencies of the equivalence + /// classes in this bucket. + #[serde(rename="sensitiveValueFrequencyUpperBound")] + pub sensitive_value_frequency_upper_bound: Option, + /// Lower bound on the sensitive value frequencies of the equivalence + /// classes in this bucket. + #[serde(rename="sensitiveValueFrequencyLowerBound")] + pub sensitive_value_frequency_lower_bound: Option, } -impl Part for GooglePrivacyDlpV2FindingLimits {} +impl Part for GooglePrivacyDlpV2LDiversityHistogramBucket {} /// Configuration for a StoredInfoType. @@ -4281,8 +4399,8 @@ impl Part for GooglePrivacyDlpV2CategoricalStatsConfig {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [deidentify templates patch projects](struct.ProjectDeidentifyTemplatePatchCall.html) (response) /// * [deidentify templates get projects](struct.ProjectDeidentifyTemplateGetCall.html) (response) +/// * [deidentify templates patch projects](struct.ProjectDeidentifyTemplatePatchCall.html) (response) /// * [deidentify templates create projects](struct.ProjectDeidentifyTemplateCreateCall.html) (response) /// * [deidentify templates get organizations](struct.OrganizationDeidentifyTemplateGetCall.html) (response) /// * [deidentify templates create organizations](struct.OrganizationDeidentifyTemplateCreateCall.html) (response) @@ -4366,6 +4484,17 @@ pub struct GooglePrivacyDlpV2Key { impl Part for GooglePrivacyDlpV2Key {} +/// Enable email notification to project owners and editors on jobs's +/// completion/failure. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GooglePrivacyDlpV2JobNotificationEmails { _never_set: Option } + +impl Part for GooglePrivacyDlpV2JobNotificationEmails {} + + /// A (kind, ID/name) pair used to construct a key path. /// /// If either name or ID is set, the element is complete. @@ -4380,15 +4509,15 @@ pub struct GooglePrivacyDlpV2PathElement { /// A kind must not contain more than 1500 bytes when UTF-8 encoded. /// Cannot be `""`. pub kind: Option, + /// The auto-allocated ID of the entity. + /// Never equal to zero. Values less than zero are discouraged and may not + /// be supported in the future. + pub id: Option, /// The name of the entity. /// A name matching regex `__.*__` is reserved/read-only. /// A name must not be more than 1500 bytes when UTF-8 encoded. /// Cannot be `""`. pub name: Option, - /// The auto-allocated ID of the entity. - /// Never equal to zero. Values less than zero are discouraged and may not - /// be supported in the future. - pub id: Option, } impl Part for GooglePrivacyDlpV2PathElement {} @@ -4439,18 +4568,19 @@ pub struct GooglePrivacyDlpV2CustomInfoType { impl Part for GooglePrivacyDlpV2CustomInfoType {} -/// Result of the l-diversity computation. +/// Compute numerical stats over an individual column, including +/// min, max, and quantiles. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GooglePrivacyDlpV2LDiversityResult { - /// Histogram of l-diversity equivalence class sensitive value frequencies. - #[serde(rename="sensitiveValueFrequencyHistogramBuckets")] - pub sensitive_value_frequency_histogram_buckets: Option>, +pub struct GooglePrivacyDlpV2NumericalStatsConfig { + /// Field to compute numerical stats on. Supported types are + /// integer, float, date, datetime, timestamp, time. + pub field: Option, } -impl Part for GooglePrivacyDlpV2LDiversityResult {} +impl Part for GooglePrivacyDlpV2NumericalStatsConfig {} /// Request to search for potentially sensitive info in a ContentItem. @@ -4939,7 +5069,7 @@ impl<'a, C, A> InfoTypeMethods<'a, C, A> { /// ::default(), None); /// let mut hub = DLP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `content_deidentify(...)`, `content_inspect(...)`, `content_reidentify(...)`, `deidentify_templates_create(...)`, `deidentify_templates_delete(...)`, `deidentify_templates_get(...)`, `deidentify_templates_list(...)`, `deidentify_templates_patch(...)`, `dlp_jobs_cancel(...)`, `dlp_jobs_create(...)`, `dlp_jobs_delete(...)`, `dlp_jobs_get(...)`, `dlp_jobs_list(...)`, `image_redact(...)`, `inspect_templates_create(...)`, `inspect_templates_delete(...)`, `inspect_templates_get(...)`, `inspect_templates_list(...)`, `inspect_templates_patch(...)`, `job_triggers_create(...)`, `job_triggers_delete(...)`, `job_triggers_get(...)`, `job_triggers_list(...)`, `job_triggers_patch(...)`, `stored_info_types_create(...)`, `stored_info_types_delete(...)`, `stored_info_types_get(...)`, `stored_info_types_list(...)` and `stored_info_types_patch(...)` +/// // like `content_deidentify(...)`, `content_inspect(...)`, `content_reidentify(...)`, `deidentify_templates_create(...)`, `deidentify_templates_delete(...)`, `deidentify_templates_get(...)`, `deidentify_templates_list(...)`, `deidentify_templates_patch(...)`, `dlp_jobs_cancel(...)`, `dlp_jobs_create(...)`, `dlp_jobs_delete(...)`, `dlp_jobs_get(...)`, `dlp_jobs_list(...)`, `image_redact(...)`, `inspect_templates_create(...)`, `inspect_templates_delete(...)`, `inspect_templates_get(...)`, `inspect_templates_list(...)`, `inspect_templates_patch(...)`, `job_triggers_activate(...)`, `job_triggers_create(...)`, `job_triggers_delete(...)`, `job_triggers_get(...)`, `job_triggers_list(...)`, `job_triggers_patch(...)`, `stored_info_types_create(...)`, `stored_info_types_delete(...)`, `stored_info_types_get(...)`, `stored_info_types_list(...)` and `stored_info_types_patch(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -5040,16 +5170,18 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a job trigger. + /// Updates a job trigger. /// See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. /// /// # Arguments /// + /// * `request` - No description provided. /// * `name` - Resource name of the project and the triggeredJob, for example /// `projects/dlp-test-project/jobTriggers/53234423`. - pub fn job_triggers_get(&self, name: &str) -> ProjectJobTriggerGetCall<'a, C, A> { - ProjectJobTriggerGetCall { + pub fn job_triggers_patch(&self, request: GooglePrivacyDlpV2UpdateJobTriggerRequest, name: &str) -> ProjectJobTriggerPatchCall<'a, C, A> { + ProjectJobTriggerPatchCall { hub: self.hub, + _request: request, _name: name.to_string(), _delegate: Default::default(), _scopes: Default::default(), @@ -5129,18 +5261,16 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a job trigger. + /// Gets a job trigger. /// See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. /// /// # Arguments /// - /// * `request` - No description provided. /// * `name` - Resource name of the project and the triggeredJob, for example /// `projects/dlp-test-project/jobTriggers/53234423`. - pub fn job_triggers_patch(&self, request: GooglePrivacyDlpV2UpdateJobTriggerRequest, name: &str) -> ProjectJobTriggerPatchCall<'a, C, A> { - ProjectJobTriggerPatchCall { + pub fn job_triggers_get(&self, name: &str) -> ProjectJobTriggerGetCall<'a, C, A> { + ProjectJobTriggerGetCall { hub: self.hub, - _request: request, _name: name.to_string(), _delegate: Default::default(), _scopes: Default::default(), @@ -5421,6 +5551,27 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Activate a job trigger. Causes the immediate execute of a trigger + /// instead of waiting on the trigger event to occur. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Resource name of the trigger to activate, for example + /// `projects/dlp-test-project/jobTriggers/53234423`. + pub fn job_triggers_activate(&self, request: GooglePrivacyDlpV2ActivateJobTriggerRequest, name: &str) -> ProjectJobTriggerActivateCall<'a, C, A> { + ProjectJobTriggerActivateCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Deletes a DeidentifyTemplate. @@ -5520,6 +5671,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { _page_token: Default::default(), _page_size: Default::default(), _order_by: Default::default(), + _filter: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5692,7 +5844,7 @@ impl<'a, C, A> OrganizationInspectTemplateGetCall<'a, C, A> where C: BorrowMut OrganizationInspectTemplateGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5731,7 +5880,7 @@ impl<'a, C, A> OrganizationInspectTemplateGetCall<'a, C, A> where C: BorrowMut OrganizationInspectTemplateGetCall<'a, C, A> where C: BorrowMut OrganizationInspectTemplateGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationInspectTemplateGetCall<'a, C, A> @@ -5947,7 +6096,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateDeleteCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5963,10 +6112,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateDeleteCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5986,7 +6132,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateDeleteCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6066,7 +6212,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateDeleteCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6074,12 +6220,12 @@ impl<'a, C, A> OrganizationDeidentifyTemplateDeleteCall<'a, C, A> where C: Borro /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationDeidentifyTemplateDeleteCall<'a, C, A> @@ -6210,7 +6356,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateCreateCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6226,10 +6372,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateCreateCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6261,7 +6404,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateCreateCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6352,7 +6495,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateCreateCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6360,12 +6503,12 @@ impl<'a, C, A> OrganizationDeidentifyTemplateCreateCall<'a, C, A> where C: Borro /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationDeidentifyTemplateCreateCall<'a, C, A> @@ -6495,7 +6638,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplatePatchCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6511,10 +6654,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplatePatchCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6546,7 +6686,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplatePatchCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6638,7 +6778,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplatePatchCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6646,12 +6786,12 @@ impl<'a, C, A> OrganizationDeidentifyTemplatePatchCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationDeidentifyTemplatePatchCall<'a, C, A> @@ -6781,7 +6921,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6797,10 +6937,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6832,7 +6969,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6923,7 +7060,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6931,12 +7068,12 @@ impl<'a, C, A> OrganizationStoredInfoTypeCreateCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationStoredInfoTypeCreateCall<'a, C, A> @@ -7059,7 +7196,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeGetCall<'a, C, A> where C: BorrowMut OrganizationStoredInfoTypeGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7098,7 +7232,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeGetCall<'a, C, A> where C: BorrowMut OrganizationStoredInfoTypeGetCall<'a, C, A> where C: BorrowMut OrganizationStoredInfoTypeGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationStoredInfoTypeGetCall<'a, C, A> @@ -7313,7 +7447,7 @@ impl<'a, C, A> OrganizationInspectTemplateDeleteCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7329,10 +7463,7 @@ impl<'a, C, A> OrganizationInspectTemplateDeleteCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7352,7 +7483,7 @@ impl<'a, C, A> OrganizationInspectTemplateDeleteCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7432,7 +7563,7 @@ impl<'a, C, A> OrganizationInspectTemplateDeleteCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7440,12 +7571,12 @@ impl<'a, C, A> OrganizationInspectTemplateDeleteCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationInspectTemplateDeleteCall<'a, C, A> @@ -7575,7 +7706,7 @@ impl<'a, C, A> OrganizationInspectTemplateCreateCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7591,10 +7722,7 @@ impl<'a, C, A> OrganizationInspectTemplateCreateCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7626,7 +7754,7 @@ impl<'a, C, A> OrganizationInspectTemplateCreateCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7717,7 +7845,7 @@ impl<'a, C, A> OrganizationInspectTemplateCreateCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7725,12 +7853,12 @@ impl<'a, C, A> OrganizationInspectTemplateCreateCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationInspectTemplateCreateCall<'a, C, A> @@ -7859,7 +7987,7 @@ impl<'a, C, A> OrganizationInspectTemplatePatchCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7875,10 +8003,7 @@ impl<'a, C, A> OrganizationInspectTemplatePatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7910,7 +8035,7 @@ impl<'a, C, A> OrganizationInspectTemplatePatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8002,7 +8127,7 @@ impl<'a, C, A> OrganizationInspectTemplatePatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8010,12 +8135,12 @@ impl<'a, C, A> OrganizationInspectTemplatePatchCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationInspectTemplatePatchCall<'a, C, A> @@ -8152,7 +8277,7 @@ impl<'a, C, A> OrganizationInspectTemplateListCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8168,10 +8293,7 @@ impl<'a, C, A> OrganizationInspectTemplateListCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8191,7 +8313,7 @@ impl<'a, C, A> OrganizationInspectTemplateListCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8305,7 +8427,7 @@ impl<'a, C, A> OrganizationInspectTemplateListCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8313,12 +8435,12 @@ impl<'a, C, A> OrganizationInspectTemplateListCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationInspectTemplateListCall<'a, C, A> @@ -8456,7 +8578,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeListCall<'a, C, A> where C: BorrowMut OrganizationStoredInfoTypeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8495,7 +8614,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeListCall<'a, C, A> where C: BorrowMut OrganizationStoredInfoTypeListCall<'a, C, A> where C: BorrowMut OrganizationStoredInfoTypeListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationStoredInfoTypeListCall<'a, C, A> @@ -8746,7 +8865,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8762,10 +8881,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8785,7 +8901,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8865,7 +8981,7 @@ impl<'a, C, A> OrganizationStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8873,12 +8989,12 @@ impl<'a, C, A> OrganizationStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationStoredInfoTypeDeleteCall<'a, C, A> @@ -9001,7 +9117,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateGetCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9017,10 +9133,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateGetCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9040,7 +9153,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateGetCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9120,7 +9233,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateGetCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9128,12 +9241,12 @@ impl<'a, C, A> OrganizationDeidentifyTemplateGetCall<'a, C, A> where C: BorrowMu /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationDeidentifyTemplateGetCall<'a, C, A> @@ -9264,7 +9377,7 @@ impl<'a, C, A> OrganizationStoredInfoTypePatchCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9280,10 +9393,7 @@ impl<'a, C, A> OrganizationStoredInfoTypePatchCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9315,7 +9425,7 @@ impl<'a, C, A> OrganizationStoredInfoTypePatchCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9407,7 +9517,7 @@ impl<'a, C, A> OrganizationStoredInfoTypePatchCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9415,12 +9525,12 @@ impl<'a, C, A> OrganizationStoredInfoTypePatchCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationStoredInfoTypePatchCall<'a, C, A> @@ -9558,7 +9668,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateListCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9574,10 +9684,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateListCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9597,7 +9704,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateListCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9711,7 +9818,7 @@ impl<'a, C, A> OrganizationDeidentifyTemplateListCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9719,12 +9826,12 @@ impl<'a, C, A> OrganizationDeidentifyTemplateListCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OrganizationDeidentifyTemplateListCall<'a, C, A> @@ -9846,10 +9953,7 @@ impl<'a, C, A> InfoTypeListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9869,7 +9973,7 @@ impl<'a, C, A> InfoTypeListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9954,7 +10058,7 @@ impl<'a, C, A> InfoTypeListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9962,12 +10066,12 @@ impl<'a, C, A> InfoTypeListCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> InfoTypeListCall<'a, C, A> @@ -10089,7 +10193,7 @@ impl<'a, C, A> ProjectInspectTemplateGetCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10128,7 +10229,7 @@ impl<'a, C, A> ProjectInspectTemplateGetCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateGetCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectInspectTemplateGetCall<'a, C, A> @@ -10344,7 +10445,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateGetCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplateGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10383,7 +10481,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateGetCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplateGetCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplateGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDeidentifyTemplateGetCall<'a, C, A> @@ -10605,7 +10703,7 @@ impl<'a, C, A> ProjectInspectTemplatePatchCall<'a, C, A> where C: BorrowMut ProjectInspectTemplatePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10656,7 +10751,7 @@ impl<'a, C, A> ProjectInspectTemplatePatchCall<'a, C, A> where C: BorrowMut ProjectInspectTemplatePatchCall<'a, C, A> where C: BorrowMut ProjectInspectTemplatePatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectInspectTemplatePatchCall<'a, C, A> @@ -10884,7 +10979,7 @@ impl<'a, C, A> ProjectStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10923,7 +11015,7 @@ impl<'a, C, A> ProjectStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectStoredInfoTypeDeleteCall<'a, C, A> @@ -11051,10 +11143,10 @@ impl<'a, C, A> ProjectStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeDeleteCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = DLP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GooglePrivacyDlpV2UpdateJobTriggerRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().job_triggers_get("name") +/// let result = hub.projects().job_triggers_patch(req, "name") /// .doit(); /// # } /// ``` -pub struct ProjectJobTriggerGetCall<'a, C, A> +pub struct ProjectJobTriggerPatchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a DLP, + _request: GooglePrivacyDlpV2UpdateJobTriggerRequest, _name: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectJobTriggerGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectJobTriggerPatchCall<'a, C, A> {} -impl<'a, C, A> ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -11108,9 +11207,9 @@ impl<'a, C, A> ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dlp.projects.jobTriggers.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "dlp.projects.jobTriggers.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("name", self._name.to_string())); for &field in ["alt", "name"].iter() { if self._additional_params.contains_key(field) { @@ -11138,7 +11237,7 @@ impl<'a, C, A> ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -11175,11 +11282,15 @@ impl<'a, C, A> ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut ProjectJobTriggerPatchCall<'a, C, A> { + self._request = new_value; + self + } /// Resource name of the project and the triggeredJob, for example /// `projects/dlp-test-project/jobTriggers/53234423`. /// @@ -11237,7 +11357,7 @@ impl<'a, C, A> ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut ProjectJobTriggerGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectJobTriggerPatchCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -11247,7 +11367,7 @@ impl<'a, C, A> ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut ProjectJobTriggerGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobTriggerPatchCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -11256,7 +11376,7 @@ impl<'a, C, A> ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectJobTriggerGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectJobTriggerPatchCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -11292,7 +11412,7 @@ impl<'a, C, A> ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectJobTriggerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectJobTriggerPatchCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -11405,7 +11525,7 @@ impl<'a, C, A> ProjectContentInspectCall<'a, C, A> where C: BorrowMut ProjectContentInspectCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11456,7 +11573,7 @@ impl<'a, C, A> ProjectContentInspectCall<'a, C, A> where C: BorrowMut ProjectContentInspectCall<'a, C, A> where C: BorrowMut ProjectContentInspectCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectContentInspectCall<'a, C, A> @@ -11681,7 +11798,7 @@ impl<'a, C, A> ProjectInspectTemplateDeleteCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11720,7 +11834,7 @@ impl<'a, C, A> ProjectInspectTemplateDeleteCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateDeleteCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectInspectTemplateDeleteCall<'a, C, A> @@ -11943,7 +12057,7 @@ impl<'a, C, A> ProjectDeidentifyTemplatePatchCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplatePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11994,7 +12105,7 @@ impl<'a, C, A> ProjectDeidentifyTemplatePatchCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplatePatchCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplatePatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDeidentifyTemplatePatchCall<'a, C, A> @@ -12134,10 +12245,10 @@ impl<'a, C, A> ProjectDeidentifyTemplatePatchCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplatePatchCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplatePatchCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = DLP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GooglePrivacyDlpV2UpdateJobTriggerRequest::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().job_triggers_patch(req, "name") +/// let result = hub.projects().job_triggers_get("name") /// .doit(); /// # } /// ``` -pub struct ProjectJobTriggerPatchCall<'a, C, A> +pub struct ProjectJobTriggerGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a DLP, - _request: GooglePrivacyDlpV2UpdateJobTriggerRequest, _name: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectJobTriggerPatchCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectJobTriggerGetCall<'a, C, A> {} -impl<'a, C, A> ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectJobTriggerGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -12198,9 +12302,9 @@ impl<'a, C, A> ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dlp.projects.jobTriggers.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "dlp.projects.jobTriggers.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); for &field in ["alt", "name"].iter() { if self._additional_params.contains_key(field) { @@ -12228,7 +12332,7 @@ impl<'a, C, A> ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -12276,15 +12366,11 @@ impl<'a, C, A> ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut ProjectJobTriggerPatchCall<'a, C, A> { - self._request = new_value; - self - } /// Resource name of the project and the triggeredJob, for example /// `projects/dlp-test-project/jobTriggers/53234423`. /// @@ -12351,7 +12428,7 @@ impl<'a, C, A> ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut ProjectJobTriggerPatchCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectJobTriggerGetCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -12361,7 +12438,7 @@ impl<'a, C, A> ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut ProjectJobTriggerPatchCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobTriggerGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -12370,7 +12447,7 @@ impl<'a, C, A> ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectJobTriggerPatchCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectJobTriggerGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -12406,7 +12483,7 @@ impl<'a, C, A> ProjectJobTriggerPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectJobTriggerPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectJobTriggerGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -12506,7 +12583,7 @@ impl<'a, C, A> ProjectStoredInfoTypeGetCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12545,7 +12619,7 @@ impl<'a, C, A> ProjectStoredInfoTypeGetCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeGetCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectStoredInfoTypeGetCall<'a, C, A> @@ -12768,7 +12842,7 @@ impl<'a, C, A> ProjectInspectTemplateCreateCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12819,7 +12890,7 @@ impl<'a, C, A> ProjectInspectTemplateCreateCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateCreateCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectInspectTemplateCreateCall<'a, C, A> @@ -13053,7 +13124,7 @@ impl<'a, C, A> ProjectJobTriggerCreateCall<'a, C, A> where C: BorrowMut ProjectJobTriggerCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13104,7 +13172,7 @@ impl<'a, C, A> ProjectJobTriggerCreateCall<'a, C, A> where C: BorrowMut ProjectJobTriggerCreateCall<'a, C, A> where C: BorrowMut ProjectJobTriggerCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectJobTriggerCreateCall<'a, C, A> @@ -13341,7 +13409,7 @@ impl<'a, C, A> ProjectDlpJobCreateCall<'a, C, A> where C: BorrowMut ProjectDlpJobCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13392,7 +13457,7 @@ impl<'a, C, A> ProjectDlpJobCreateCall<'a, C, A> where C: BorrowMut ProjectDlpJobCreateCall<'a, C, A> where C: BorrowMut ProjectDlpJobCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDlpJobCreateCall<'a, C, A> @@ -13626,7 +13691,7 @@ impl<'a, C, A> ProjectStoredInfoTypePatchCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13677,7 +13739,7 @@ impl<'a, C, A> ProjectStoredInfoTypePatchCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypePatchCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypePatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectStoredInfoTypePatchCall<'a, C, A> @@ -13913,7 +13975,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateCreateCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -13929,10 +13991,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateCreateCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13964,7 +14023,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateCreateCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14055,7 +14114,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateCreateCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14063,12 +14122,12 @@ impl<'a, C, A> ProjectDeidentifyTemplateCreateCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectDeidentifyTemplateCreateCall<'a, C, A> @@ -14216,7 +14275,7 @@ impl<'a, C, A> ProjectDlpJobListCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -14232,10 +14291,7 @@ impl<'a, C, A> ProjectDlpJobListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14255,7 +14311,7 @@ impl<'a, C, A> ProjectDlpJobListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14402,7 +14458,7 @@ impl<'a, C, A> ProjectDlpJobListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14410,12 +14466,12 @@ impl<'a, C, A> ProjectDlpJobListCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectDlpJobListCall<'a, C, A> @@ -14553,7 +14609,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateListCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplateListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14592,7 +14645,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateListCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplateListCall<'a, C, A> where C: BorrowMut ProjectDeidentifyTemplateListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDeidentifyTemplateListCall<'a, C, A> @@ -14851,7 +14904,7 @@ impl<'a, C, A> ProjectDlpJobCancelCall<'a, C, A> where C: BorrowMut ProjectDlpJobCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14902,7 +14952,7 @@ impl<'a, C, A> ProjectDlpJobCancelCall<'a, C, A> where C: BorrowMut ProjectDlpJobCancelCall<'a, C, A> where C: BorrowMut ProjectDlpJobCancelCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDlpJobCancelCall<'a, C, A> @@ -15142,7 +15192,7 @@ impl<'a, C, A> ProjectInspectTemplateListCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15181,7 +15228,7 @@ impl<'a, C, A> ProjectInspectTemplateListCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateListCall<'a, C, A> where C: BorrowMut ProjectInspectTemplateListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectInspectTemplateListCall<'a, C, A> @@ -15431,7 +15478,7 @@ impl<'a, C, A> ProjectDlpJobGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -15447,10 +15494,7 @@ impl<'a, C, A> ProjectDlpJobGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15470,7 +15514,7 @@ impl<'a, C, A> ProjectDlpJobGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15548,7 +15592,7 @@ impl<'a, C, A> ProjectDlpJobGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15556,12 +15600,12 @@ impl<'a, C, A> ProjectDlpJobGetCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectDlpJobGetCall<'a, C, A> @@ -15696,7 +15740,7 @@ impl<'a, C, A> ProjectContentDeidentifyCall<'a, C, A> where C: BorrowMut ProjectContentDeidentifyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15747,7 +15788,7 @@ impl<'a, C, A> ProjectContentDeidentifyCall<'a, C, A> where C: BorrowMut ProjectContentDeidentifyCall<'a, C, A> where C: BorrowMut ProjectContentDeidentifyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectContentDeidentifyCall<'a, C, A> @@ -15885,6 +15926,287 @@ impl<'a, C, A> ProjectContentDeidentifyCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = DLP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GooglePrivacyDlpV2ActivateJobTriggerRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().job_triggers_activate(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectJobTriggerActivateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a DLP, + _request: GooglePrivacyDlpV2ActivateJobTriggerRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectJobTriggerActivateCall<'a, C, A> {} + +impl<'a, C, A> ProjectJobTriggerActivateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GooglePrivacyDlpV2DlpJob)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dlp.projects.jobTriggers.activate", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:activate"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GooglePrivacyDlpV2ActivateJobTriggerRequest) -> ProjectJobTriggerActivateCall<'a, C, A> { + self._request = new_value; + self + } + /// Resource name of the trigger to activate, for example + /// `projects/dlp-test-project/jobTriggers/53234423`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectJobTriggerActivateCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobTriggerActivateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectJobTriggerActivateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectJobTriggerActivateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Deletes a DeidentifyTemplate. /// See https://cloud.google.com/dlp/docs/creating-templates-deid to learn /// more. @@ -15973,7 +16295,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateDeleteCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -15989,10 +16311,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateDeleteCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16012,7 +16331,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateDeleteCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16092,7 +16411,7 @@ impl<'a, C, A> ProjectDeidentifyTemplateDeleteCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16100,12 +16419,12 @@ impl<'a, C, A> ProjectDeidentifyTemplateDeleteCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectDeidentifyTemplateDeleteCall<'a, C, A> @@ -16235,7 +16554,7 @@ impl<'a, C, A> ProjectStoredInfoTypeCreateCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16286,7 +16602,7 @@ impl<'a, C, A> ProjectStoredInfoTypeCreateCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeCreateCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectStoredInfoTypeCreateCall<'a, C, A> @@ -16512,7 +16828,7 @@ impl<'a, C, A> ProjectJobTriggerDeleteCall<'a, C, A> where C: BorrowMut ProjectJobTriggerDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16551,7 +16864,7 @@ impl<'a, C, A> ProjectJobTriggerDeleteCall<'a, C, A> where C: BorrowMut ProjectJobTriggerDeleteCall<'a, C, A> where C: BorrowMut ProjectJobTriggerDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectJobTriggerDeleteCall<'a, C, A> @@ -16774,7 +17087,7 @@ impl<'a, C, A> ProjectContentReidentifyCall<'a, C, A> where C: BorrowMut ProjectContentReidentifyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16825,7 +17135,7 @@ impl<'a, C, A> ProjectContentReidentifyCall<'a, C, A> where C: BorrowMut ProjectContentReidentifyCall<'a, C, A> where C: BorrowMut ProjectContentReidentifyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectContentReidentifyCall<'a, C, A> @@ -16992,9 +17302,10 @@ impl<'a, C, A> ProjectContentReidentifyCall<'a, C, A> where C: BorrowMut _page_token: Option, _page_size: Option, _order_by: Option, + _filter: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -17028,7 +17340,7 @@ impl<'a, C, A> ProjectJobTriggerListCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(6 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -17039,7 +17351,10 @@ impl<'a, C, A> ProjectJobTriggerListCall<'a, C, A> where C: BorrowMut ProjectJobTriggerListCall<'a, C, A> where C: BorrowMut ProjectJobTriggerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17104,7 +17416,7 @@ impl<'a, C, A> ProjectJobTriggerListCall<'a, C, A> where C: BorrowMut ProjectJobTriggerListCall<'a, C, A> where C: BorrowMut ProjectJobTriggerListCall<'a, C, A> where C: BorrowMut `. + /// * Supported fields/values for inspect jobs: + /// - `status` - HEALTHY|PAUSED|CANCELLED + /// - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + /// - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by + /// quotation marks. Nanoseconds are ignored. + /// - 'error_count' - Number of errors that have occurred while running. + /// * The operator must be `=` or `!=` for status and inspected_storage. + /// + /// Examples: + /// + /// * inspected_storage = cloud_storage AND status = HEALTHY + /// * inspected_storage = cloud_storage OR inspected_storage = bigquery + /// * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) + /// * last_run_time > \"2017-12-12T00:00:00+00:00\" + /// + /// The length of this field should be no more than 500 characters. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectJobTriggerListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -17218,7 +17561,7 @@ impl<'a, C, A> ProjectJobTriggerListCall<'a, C, A> where C: BorrowMut ProjectJobTriggerListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectJobTriggerListCall<'a, C, A> @@ -17356,7 +17699,7 @@ impl<'a, C, A> ProjectDlpJobDeleteCall<'a, C, A> where C: BorrowMut ProjectDlpJobDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17395,7 +17735,7 @@ impl<'a, C, A> ProjectDlpJobDeleteCall<'a, C, A> where C: BorrowMut ProjectDlpJobDeleteCall<'a, C, A> where C: BorrowMut ProjectDlpJobDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDlpJobDeleteCall<'a, C, A> @@ -17621,7 +17961,7 @@ impl<'a, C, A> ProjectImageRedactCall<'a, C, A> where C: BorrowMut ProjectImageRedactCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17672,7 +18009,7 @@ impl<'a, C, A> ProjectImageRedactCall<'a, C, A> where C: BorrowMut ProjectImageRedactCall<'a, C, A> where C: BorrowMut ProjectImageRedactCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectImageRedactCall<'a, C, A> @@ -17840,9 +18177,9 @@ impl<'a, C, A> ProjectImageRedactCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeListCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17952,7 +18286,7 @@ impl<'a, C, A> ProjectStoredInfoTypeListCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeListCall<'a, C, A> where C: BorrowMut ProjectStoredInfoTypeListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectStoredInfoTypeListCall<'a, C, A> diff --git a/gen/dlp2_beta1/Cargo.toml b/gen/dlp2_beta1/Cargo.toml index b4bee93b0e..ce09c377e7 100644 --- a/gen/dlp2_beta1/Cargo.toml +++ b/gen/dlp2_beta1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/dlp2_beta1/src/lib.rs b/gen/dlp2_beta1/src/lib.rs index 1bc1240424..82cd03f207 100644 --- a/gen/dlp2_beta1/src/lib.rs +++ b/gen/dlp2_beta1/src/lib.rs @@ -3166,10 +3166,7 @@ impl<'a, C, A> ContentRedactCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3201,7 +3198,7 @@ impl<'a, C, A> ContentRedactCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3281,7 +3278,7 @@ impl<'a, C, A> ContentRedactCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3414,10 +3411,7 @@ impl<'a, C, A> ContentDeidentifyCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3449,7 +3443,7 @@ impl<'a, C, A> ContentDeidentifyCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3529,7 +3523,7 @@ impl<'a, C, A> ContentDeidentifyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3662,10 +3656,7 @@ impl<'a, C, A> ContentInspectCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3697,7 +3688,7 @@ impl<'a, C, A> ContentInspectCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3777,7 +3768,7 @@ impl<'a, C, A> ContentInspectCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3918,7 +3909,7 @@ impl<'a, C, A> RootCategoryInfoTypeListCall<'a, C, A> where C: BorrowMut RootCategoryInfoTypeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3957,7 +3945,7 @@ impl<'a, C, A> RootCategoryInfoTypeListCall<'a, C, A> where C: BorrowMut RootCategoryInfoTypeListCall<'a, C, A> where C: BorrowMut RootCategoryListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4197,7 +4182,7 @@ impl<'a, C, A> RootCategoryListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4274,7 +4259,7 @@ impl<'a, C, A> RootCategoryListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4407,10 +4392,7 @@ impl<'a, C, A> InspectOperationCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4442,7 +4424,7 @@ impl<'a, C, A> InspectOperationCreateCall<'a, C, A> where C: BorrowMut InspectOperationCreateCall<'a, C, A> where C: BorrowMut InspectOperationListCall<'a, C, A> where C: BorrowMut InspectOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4712,7 +4691,7 @@ impl<'a, C, A> InspectOperationListCall<'a, C, A> where C: BorrowMut InspectOperationListCall<'a, C, A> where C: BorrowMut InspectOperationGetCall<'a, C, A> where C: BorrowMut InspectOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4988,7 +4964,7 @@ impl<'a, C, A> InspectOperationGetCall<'a, C, A> where C: BorrowMut InspectOperationGetCall<'a, C, A> where C: BorrowMut InspectOperationCancelCall<'a, C, A> where C: BorrowMut InspectOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5260,7 +5233,7 @@ impl<'a, C, A> InspectOperationCancelCall<'a, C, A> where C: BorrowMut InspectOperationCancelCall<'a, C, A> where C: BorrowMut InspectOperationDeleteCall<'a, C, A> where C: BorrowMut InspectOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5525,7 +5495,7 @@ impl<'a, C, A> InspectOperationDeleteCall<'a, C, A> where C: BorrowMut InspectOperationDeleteCall<'a, C, A> where C: BorrowMut InspectResultFindingListCall<'a, C, A> where C: BorrowMut InspectResultFindingListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5793,7 +5760,7 @@ impl<'a, C, A> InspectResultFindingListCall<'a, C, A> where C: BorrowMut InspectResultFindingListCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationDeleteCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6080,7 +6044,7 @@ impl<'a, C, A> RiskAnalysiOperationDeleteCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationDeleteCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationListCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6348,7 +6309,7 @@ impl<'a, C, A> RiskAnalysiOperationListCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationListCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationGetCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6624,7 +6582,7 @@ impl<'a, C, A> RiskAnalysiOperationGetCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationGetCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationCancelCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6896,7 +6851,7 @@ impl<'a, C, A> RiskAnalysiOperationCancelCall<'a, C, A> where C: BorrowMut RiskAnalysiOperationCancelCall<'a, C, A> where C: BorrowMut DataSourceAnalyzeCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7154,7 +7106,7 @@ impl<'a, C, A> DataSourceAnalyzeCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7234,7 +7186,7 @@ impl<'a, C, A> DataSourceAnalyzeCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/dns1-cli/Cargo.toml b/gen/dns1-cli/Cargo.toml index 3dbb5b2a2f..2effa1470c 100644 --- a/gen/dns1-cli/Cargo.toml +++ b/gen/dns1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dns1-cli" -version = "1.0.8+20180826" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with dns (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dns1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-dns1] path = "../dns1" -version = "1.0.8+20180826" +version = "1.0.8+20190328" diff --git a/gen/dns1-cli/README.md b/gen/dns1-cli/README.md index 975763a41b..d8ec35cfbb 100644 --- a/gen/dns1-cli/README.md +++ b/gen/dns1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dns* API at revision *20180826*. The CLI is at version *1.0.8*. +This documentation was generated from the *dns* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash dns1 [options] diff --git a/gen/dns1-cli/mkdocs.yml b/gen/dns1-cli/mkdocs.yml index c64c27c281..b2dcffd273 100644 --- a/gen/dns1-cli/mkdocs.yml +++ b/gen/dns1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dns v1.0.8+20180826 +site_name: dns v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-dns1-cli site_description: A complete library to interact with dns (protocol v1) diff --git a/gen/dns1-cli/src/main.rs b/gen/dns1-cli/src/main.rs index dd87ff0df3..9c1643501e 100644 --- a/gen/dns1-cli/src/main.rs +++ b/gen/dns1-cli/src/main.rs @@ -527,7 +527,9 @@ impl<'n> Engine<'n> { "name-servers" => Some(("nameServers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "visibility" => Some(("visibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name-server-set" => Some(("nameServerSet", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "private-visibility-config.kind" => Some(("privateVisibilityConfig.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dns-name" => Some(("dnsName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dnssec-config.kind" => Some(("dnssecConfig.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dnssec-config.state" => Some(("dnssecConfig.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -535,7 +537,7 @@ impl<'n> Engine<'n> { "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-time", "description", "dns-name", "dnssec-config", "id", "kind", "labels", "name", "name-server-set", "name-servers", "non-existence", "state"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-time", "description", "dns-name", "dnssec-config", "id", "kind", "labels", "name", "name-server-set", "name-servers", "non-existence", "private-visibility-config", "state", "visibility"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -793,7 +795,9 @@ impl<'n> Engine<'n> { "name-servers" => Some(("nameServers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "visibility" => Some(("visibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name-server-set" => Some(("nameServerSet", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "private-visibility-config.kind" => Some(("privateVisibilityConfig.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dns-name" => Some(("dnsName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dnssec-config.kind" => Some(("dnssecConfig.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dnssec-config.state" => Some(("dnssecConfig.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -801,7 +805,7 @@ impl<'n> Engine<'n> { "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-time", "description", "dns-name", "dnssec-config", "id", "kind", "labels", "name", "name-server-set", "name-servers", "non-existence", "state"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-time", "description", "dns-name", "dnssec-config", "id", "kind", "labels", "name", "name-server-set", "name-servers", "non-existence", "private-visibility-config", "state", "visibility"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -893,7 +897,9 @@ impl<'n> Engine<'n> { "name-servers" => Some(("nameServers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "visibility" => Some(("visibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name-server-set" => Some(("nameServerSet", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "private-visibility-config.kind" => Some(("privateVisibilityConfig.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dns-name" => Some(("dnsName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dnssec-config.kind" => Some(("dnssecConfig.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dnssec-config.state" => Some(("dnssecConfig.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -901,7 +907,7 @@ impl<'n> Engine<'n> { "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-time", "description", "dns-name", "dnssec-config", "id", "kind", "labels", "name", "name-server-set", "name-servers", "non-existence", "state"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-time", "description", "dns-name", "dnssec-config", "id", "kind", "labels", "name", "name-server-set", "name-servers", "non-existence", "private-visibility-config", "state", "visibility"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1268,18 +1274,18 @@ fn main() { let arg_data = [ ("changes", "methods: 'create', 'get' and 'list'", vec![ ("create", - Some(r##"Atomically update the ResourceRecordSet collection."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/changes_create", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request. Can be the managed zone name or id."##), + None, Some(true), Some(false)), @@ -1302,24 +1308,24 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Fetch the representation of an existing Change."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/changes_get", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request. Can be the managed zone name or id."##), + None, Some(true), Some(false)), (Some(r##"change-id"##), None, - Some(r##"The identifier of the requested change, from a previous ResourceRecordSetsChangeResponse."##), + None, Some(true), Some(false)), @@ -1336,18 +1342,18 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Enumerate Changes to a ResourceRecordSet collection."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/changes_list", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request. Can be the managed zone name or id."##), + None, Some(true), Some(false)), @@ -1367,24 +1373,24 @@ fn main() { ("dns-keys", "methods: 'get' and 'list'", vec![ ("get", - Some(r##"Fetch the representation of an existing DnsKey."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/dns-keys_get", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request. Can be the managed zone name or id."##), + None, Some(true), Some(false)), (Some(r##"dns-key-id"##), None, - Some(r##"The identifier of the requested DnsKey."##), + None, Some(true), Some(false)), @@ -1401,18 +1407,18 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Enumerate DnsKeys to a ResourceRecordSet collection."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/dns-keys_list", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request. Can be the managed zone name or id."##), + None, Some(true), Some(false)), @@ -1432,24 +1438,24 @@ fn main() { ("managed-zone-operations", "methods: 'get' and 'list'", vec![ ("get", - Some(r##"Fetch the representation of an existing Operation."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zone-operations_get", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"operation"##), None, - Some(r##"Identifies the operation addressed by this request."##), + None, Some(true), Some(false)), @@ -1466,18 +1472,18 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Enumerate Operations for the given ManagedZone."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zone-operations_list", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request."##), + None, Some(true), Some(false)), @@ -1497,12 +1503,12 @@ fn main() { ("managed-zones", "methods: 'create', 'delete', 'get', 'list', 'patch' and 'update'", vec![ ("create", - Some(r##"Create a new ManagedZone."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zones_create", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), @@ -1525,18 +1531,18 @@ fn main() { Some(false)), ]), ("delete", - Some(r##"Delete a previously created ManagedZone."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zones_delete", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request. Can be the managed zone name or id."##), + None, Some(true), Some(false)), @@ -1547,18 +1553,18 @@ fn main() { Some(true)), ]), ("get", - Some(r##"Fetch the representation of an existing ManagedZone."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zones_get", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request. Can be the managed zone name or id."##), + None, Some(true), Some(false)), @@ -1575,12 +1581,12 @@ fn main() { Some(false)), ]), ("list", - Some(r##"Enumerate ManagedZones that have been created but not yet deleted."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zones_list", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), @@ -1597,18 +1603,18 @@ fn main() { Some(false)), ]), ("patch", - Some(r##"Apply a partial update to an existing ManagedZone."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zones_patch", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request. Can be the managed zone name or id."##), + None, Some(true), Some(false)), @@ -1631,18 +1637,18 @@ fn main() { Some(false)), ]), ("update", - Some(r##"Update an existing ManagedZone."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zones_update", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request. Can be the managed zone name or id."##), + None, Some(true), Some(false)), @@ -1668,12 +1674,12 @@ fn main() { ("projects", "methods: 'get'", vec![ ("get", - Some(r##"Fetch the representation of an existing Project."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/projects_get", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), @@ -1693,18 +1699,18 @@ fn main() { ("resource-record-sets", "methods: 'list'", vec![ ("list", - Some(r##"Enumerate ResourceRecordSets that have been created but not yet deleted."##), + Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/resource-record-sets_list", vec![ (Some(r##"project"##), None, - Some(r##"Identifies the project addressed by this request."##), + None, Some(true), Some(false)), (Some(r##"managed-zone"##), None, - Some(r##"Identifies the managed zone addressed by this request. Can be the managed zone name or id."##), + None, Some(true), Some(false)), @@ -1726,7 +1732,7 @@ fn main() { let mut app = App::new("dns1") .author("Sebastian Thiel ") - .version("1.0.8+20180826") + .version("1.0.8+20190328") .about("Configures and serves authoritative DNS records.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dns1_cli") .arg(Arg::with_name("url") diff --git a/gen/dns1/Cargo.toml b/gen/dns1/Cargo.toml index 478088c3b1..4a02f3a1f9 100644 --- a/gen/dns1/Cargo.toml +++ b/gen/dns1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dns1" -version = "1.0.8+20180826" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with dns (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dns1" homepage = "https://developers.google.com/cloud-dns" -documentation = "https://docs.rs/google-dns1/1.0.8+20180826" +documentation = "https://docs.rs/google-dns1/1.0.8+20190328" license = "MIT" keywords = ["dns", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/dns1/README.md b/gen/dns1/README.md index 666ce49968..d605102d5a 100644 --- a/gen/dns1/README.md +++ b/gen/dns1/README.md @@ -5,26 +5,26 @@ DO NOT EDIT ! --> The `google-dns1` library allows access to all features of the *Google dns* service. -This documentation was generated from *dns* crate version *1.0.8+20180826*, where *20180826* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *dns* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *dns* *v1* API can be found at the [official documentation site](https://developers.google.com/cloud-dns). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.Dns.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.Dns.html) ... -* [changes](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.Change.html) - * [*create*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ChangeCreateCall.html), [*get*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ChangeGetCall.html) and [*list*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ChangeListCall.html) -* [dns keys](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.DnsKey.html) - * [*get*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.DnsKeyGetCall.html) and [*list*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.DnsKeyListCall.html) +* [changes](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.Change.html) + * [*create*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ChangeCreateCall.html), [*get*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ChangeGetCall.html) and [*list*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ChangeListCall.html) +* [dns keys](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.DnsKey.html) + * [*get*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.DnsKeyGetCall.html) and [*list*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.DnsKeyListCall.html) * managed zone operations - * [*get*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ManagedZoneOperationGetCall.html) and [*list*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ManagedZoneOperationListCall.html) -* [managed zones](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ManagedZone.html) - * [*create*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ManagedZoneCreateCall.html), [*delete*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ManagedZoneDeleteCall.html), [*get*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ManagedZoneGetCall.html), [*list*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ManagedZoneListCall.html), [*patch*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ManagedZonePatchCall.html) and [*update*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ManagedZoneUpdateCall.html) -* [projects](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.Project.html) - * [*get*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ProjectGetCall.html) -* [resource record sets](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ResourceRecordSet.html) - * [*list*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.ResourceRecordSetListCall.html) + * [*get*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ManagedZoneOperationGetCall.html) and [*list*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ManagedZoneOperationListCall.html) +* [managed zones](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ManagedZone.html) + * [*create*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ManagedZoneCreateCall.html), [*delete*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ManagedZoneDeleteCall.html), [*get*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ManagedZoneGetCall.html), [*list*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ManagedZoneListCall.html), [*patch*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ManagedZonePatchCall.html) and [*update*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ManagedZoneUpdateCall.html) +* [projects](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.Project.html) + * [*get*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ProjectGetCall.html) +* [resource record sets](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ResourceRecordSet.html) + * [*list*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.ResourceRecordSetListCall.html) @@ -33,17 +33,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/struct.Dns.html)** +* **[Hub](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/struct.Dns.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.Part.html)** + * **[Parts](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -146,17 +146,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -166,29 +166,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-dns1/1.0.8+20180826/google_dns1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dns1/1.0.8+20190328/google_dns1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dns1/src/lib.rs b/gen/dns1/src/lib.rs index c07615881f..075f15b42c 100644 --- a/gen/dns1/src/lib.rs +++ b/gen/dns1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *dns* crate version *1.0.8+20180826*, where *20180826* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *dns* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *dns* *v1* API can be found at the //! [official documentation site](https://developers.google.com/cloud-dns). @@ -414,28 +414,44 @@ impl<'a, C, A> Dns // ############ // SCHEMAS ### // ########## -/// Parameters for DnsKey key generation. Used for generating initial keys for a new ManagedZone and as default when adding a new DnsKey. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DnsKeySpec { - /// One of "KEY_SIGNING" or "ZONE_SIGNING". Keys of type KEY_SIGNING have the Secure Entry Point flag set and, when active, will be used to sign only resource record sets of type DNSKEY. Otherwise, the Secure Entry Point flag will be cleared and this key will be used to sign only resource record sets of other types. + /// no description provided #[serde(rename="keyType")] pub key_type: Option, - /// Length of the keys in bits. + /// no description provided #[serde(rename="keyLength")] pub key_length: Option, /// Identifies what kind of resource this is. Value: the fixed string "dns#dnsKeySpec". pub kind: Option, - /// String mnemonic specifying the DNSSEC algorithm of this key. + /// no description provided pub algorithm: Option, } impl Part for DnsKeySpec {} -/// A unit of data that will be returned by the DNS servers. +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZonePrivateVisibilityConfigNetwork { + /// Identifies what kind of resource this is. Value: the fixed string "dns#managedZonePrivateVisibilityConfigNetwork". + pub kind: Option, + /// no description provided + #[serde(rename="networkUrl")] + pub network_url: Option, +} + +impl Part for ManagedZonePrivateVisibilityConfigNetwork {} + + +/// There is no detailed description. /// /// # Activities /// @@ -446,18 +462,18 @@ impl Part for DnsKeySpec {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceRecordSet { - /// As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1). + /// no description provided pub rrdatas: Option>, /// Identifies what kind of resource this is. Value: the fixed string "dns#resourceRecordSet". pub kind: Option, - /// For example, www.example.com. + /// no description provided pub name: Option, - /// Number of seconds that this ResourceRecordSet can be cached by resolvers. + /// no description provided pub ttl: Option, - /// The identifier of a supported record type, for example, A, AAAA, MX, TXT, and so on. + /// no description provided #[serde(rename="type")] pub type_: Option, - /// As defined in RFC 4034 (section 3.2). + /// no description provided #[serde(rename="signatureRrdatas")] pub signature_rrdatas: Option>, } @@ -465,7 +481,7 @@ pub struct ResourceRecordSet { impl Resource for ResourceRecordSet {} -/// A zone is a subtree of the DNS namespace under one administrative responsibility. A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service. +/// There is no detailed description. /// /// # Activities /// @@ -483,28 +499,33 @@ impl Resource for ResourceRecordSet {} pub struct ManagedZone { /// Identifies what kind of resource this is. Value: the fixed string "dns#managedZone". pub kind: Option, - /// A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the managed zone's function. + /// no description provided pub description: Option, - /// Delegate your managed_zone to these virtual name servers; defined by the server (output only) + /// no description provided #[serde(rename="nameServers")] pub name_servers: Option>, - /// User labels. + /// no description provided pub labels: Option>, - /// The time that this resource was created on the server. This is in RFC3339 text format. Output only. + /// no description provided #[serde(rename="creationTime")] pub creation_time: Option, - /// Unique identifier for the resource; defined by the server (output only) + /// no description provided + pub visibility: Option, + /// no description provided pub id: Option, - /// The DNS name of this managed zone, for instance "example.com.". + /// no description provided + #[serde(rename="privateVisibilityConfig")] + pub private_visibility_config: Option, + /// no description provided #[serde(rename="dnsName")] pub dns_name: Option, - /// DNSSEC configuration. + /// no description provided #[serde(rename="dnssecConfig")] pub dnssec_config: Option, - /// Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset. + /// no description provided #[serde(rename="nameServerSet")] pub name_server_set: Option, - /// User assigned name for this resource. Must be unique within the project. The name must be 1-63 characters long, must begin with a letter, end with a letter or digit, and only contain lowercase letters, digits or dashes. + /// no description provided pub name: Option, } @@ -524,16 +545,14 @@ impl ResponseResult for ManagedZone {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManagedZoneOperationsListResponse { - /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token. - /// - /// In this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size. + /// no description provided #[serde(rename="nextPageToken")] pub next_page_token: Option, /// no description provided pub header: Option, /// Type of resource. pub kind: Option, - /// The operation resources. + /// no description provided pub operations: Option>, } @@ -546,10 +565,10 @@ impl ResponseResult for ManagedZoneOperationsListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationDnsKeyContext { - /// The post-operation DnsKey resource. + /// no description provided #[serde(rename="newValue")] pub new_value: Option, - /// The pre-operation DnsKey resource. + /// no description provided #[serde(rename="oldValue")] pub old_value: Option, } @@ -557,7 +576,7 @@ pub struct OperationDnsKeyContext { impl Part for OperationDnsKeyContext {} -/// The response to a request to enumerate DnsKeys in a ManagedZone. +/// There is no detailed description. /// /// # Activities /// @@ -568,14 +587,12 @@ impl Part for OperationDnsKeyContext {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DnsKeysListResponse { - /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token. - /// - /// In this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a "snapshot" of collections larger than the maximum page size. + /// no description provided #[serde(rename="nextPageToken")] pub next_page_token: Option, /// no description provided pub header: Option, - /// The requested resources. + /// no description provided #[serde(rename="dnsKeys")] pub dns_keys: Option>, /// Type of resource. @@ -585,7 +602,7 @@ pub struct DnsKeysListResponse { impl ResponseResult for DnsKeysListResponse {} -/// A project resource. The project is a top level container for resources including Cloud DNS ManagedZones. Projects can be created only in the APIs console. +/// There is no detailed description. /// /// # Activities /// @@ -596,13 +613,13 @@ impl ResponseResult for DnsKeysListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Project { - /// Quotas assigned to this project (output only). + /// no description provided pub quota: Option, /// Identifies what kind of resource this is. Value: the fixed string "dns#project". pub kind: Option, - /// User assigned unique identifier for the resource (output only). + /// no description provided pub id: Option, - /// Unique numeric identifier for the resource; defined by the server (output only). + /// no description provided pub number: Option, } @@ -610,7 +627,7 @@ impl Resource for Project {} impl ResponseResult for Project {} -/// A DNSSEC key pair. +/// There is no detailed description. /// /// # Activities /// @@ -622,32 +639,32 @@ impl ResponseResult for Project {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DnsKey { - /// The key tag is a non-cryptographic hash of the a DNSKEY resource record associated with this DnsKey. The key tag can be used to identify a DNSKEY more quickly (but it is not a unique identifier). In particular, the key tag is used in a parent zone's DS record to point at the DNSKEY in this child ManagedZone. The key tag is a number in the range [0, 65535] and the algorithm to calculate it is specified in RFC4034 Appendix B. Output only. + /// no description provided #[serde(rename="keyTag")] pub key_tag: Option, /// Identifies what kind of resource this is. Value: the fixed string "dns#dnsKey". pub kind: Option, - /// A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the resource's function. + /// no description provided pub description: Option, - /// String mnemonic specifying the DNSSEC algorithm of this key. Immutable after creation time. + /// no description provided pub algorithm: Option, - /// Length of the key in bits. Specified at creation time then immutable. + /// no description provided #[serde(rename="keyLength")] pub key_length: Option, - /// The time that this resource was created in the control plane. This is in RFC3339 text format. Output only. + /// no description provided #[serde(rename="creationTime")] pub creation_time: Option, - /// Cryptographic hashes of the DNSKEY resource record associated with this DnsKey. These digests are needed to construct a DS record that points at this DNS key. Output only. + /// no description provided pub digests: Option>, - /// Base64 encoded public half of this key. Output only. + /// no description provided #[serde(rename="publicKey")] pub public_key: Option, - /// One of "KEY_SIGNING" or "ZONE_SIGNING". Keys of type KEY_SIGNING have the Secure Entry Point flag set and, when active, will be used to sign only resource record sets of type DNSKEY. Otherwise, the Secure Entry Point flag will be cleared and this key will be used to sign only resource record sets of other types. Immutable after creation time. + /// no description provided #[serde(rename="type")] pub type_: Option, - /// Unique identifier for the resource; defined by the server (output only). + /// no description provided pub id: Option, - /// Active keys will be used to sign subsequent changes to the ManagedZone. Inactive keys will still be present as DNSKEY Resource Records for the use of resolvers validating existing signatures. + /// no description provided #[serde(rename="isActive")] pub is_active: Option, } @@ -667,16 +684,14 @@ impl ResponseResult for DnsKey {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManagedZonesListResponse { - /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token. - /// - /// In this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size. + /// no description provided #[serde(rename="nextPageToken")] pub next_page_token: Option, /// no description provided pub header: Option, /// Type of resource. pub kind: Option, - /// The managed zone resources. + /// no description provided #[serde(rename="managedZones")] pub managed_zones: Option>, } @@ -695,16 +710,14 @@ impl ResponseResult for ManagedZonesListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceRecordSetsListResponse { - /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token. - /// - /// In this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size. + /// no description provided #[serde(rename="nextPageToken")] pub next_page_token: Option, /// no description provided pub header: Option, /// Type of resource. pub kind: Option, - /// The resource record set resources. + /// no description provided pub rrsets: Option>, } @@ -719,12 +732,12 @@ impl ResponseResult for ResourceRecordSetsListResponse {} pub struct ManagedZoneDnsSecConfig { /// Identifies what kind of resource this is. Value: the fixed string "dns#managedZoneDnsSecConfig". pub kind: Option, - /// Specifies parameters that will be used for generating initial DnsKeys for this ManagedZone. Output only while state is not OFF. + /// no description provided #[serde(rename="defaultKeySpecs")] pub default_key_specs: Option>, - /// Specifies whether DNSSEC is enabled, and what mode it is in. + /// no description provided pub state: Option, - /// Specifies the mechanism used to provide authenticated denial-of-existence responses. Output only while state is not OFF. + /// no description provided #[serde(rename="nonExistence")] pub non_existence: Option, } @@ -738,10 +751,10 @@ impl Part for ManagedZoneDnsSecConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationManagedZoneContext { - /// The post-operation ManagedZone resource. + /// no description provided #[serde(rename="newValue")] pub new_value: Option, - /// The pre-operation ManagedZone resource. + /// no description provided #[serde(rename="oldValue")] pub old_value: Option, } @@ -749,7 +762,22 @@ pub struct OperationManagedZoneContext { impl Part for OperationManagedZoneContext {} -/// Limits associated with a Project. +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZonePrivateVisibilityConfig { + /// Identifies what kind of resource this is. Value: the fixed string "dns#managedZonePrivateVisibilityConfig". + pub kind: Option, + /// no description provided + pub networks: Option>, +} + +impl Part for ManagedZonePrivateVisibilityConfig {} + + +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -757,30 +785,36 @@ impl Part for OperationManagedZoneContext {} pub struct Quota { /// Identifies what kind of resource this is. Value: the fixed string "dns#quota". pub kind: Option, - /// Maximum allowed number of ResourceRecordSets to add per ChangesCreateRequest. - #[serde(rename="rrsetAdditionsPerChange")] - pub rrset_additions_per_change: Option, - /// Maximum allowed size for total rrdata in one ChangesCreateRequest in bytes. + /// no description provided + #[serde(rename="managedZonesPerNetwork")] + pub managed_zones_per_network: Option, + /// no description provided #[serde(rename="totalRrdataSizePerChange")] pub total_rrdata_size_per_change: Option, - /// Maximum allowed number of ResourceRecords per ResourceRecordSet. + /// no description provided #[serde(rename="resourceRecordsPerRrset")] pub resource_records_per_rrset: Option, - /// Maximum allowed number of DnsKeys per ManagedZone. + /// no description provided #[serde(rename="dnsKeysPerManagedZone")] pub dns_keys_per_managed_zone: Option, - /// Maximum allowed number of ResourceRecordSets per zone in the project. + /// no description provided #[serde(rename="rrsetsPerManagedZone")] pub rrsets_per_managed_zone: Option, - /// DNSSEC algorithm and key length types that can be used for DnsKeys. + /// no description provided + #[serde(rename="rrsetAdditionsPerChange")] + pub rrset_additions_per_change: Option, + /// no description provided #[serde(rename="whitelistedKeySpecs")] pub whitelisted_key_specs: Option>, - /// Maximum allowed number of ResourceRecordSets to delete per ChangesCreateRequest. + /// no description provided #[serde(rename="rrsetDeletionsPerChange")] pub rrset_deletions_per_change: Option, - /// Maximum allowed number of managed zones in the project. + /// no description provided #[serde(rename="managedZones")] pub managed_zones: Option, + /// no description provided + #[serde(rename="networksPerManagedZone")] + pub networks_per_managed_zone: Option, } impl Part for Quota {} @@ -792,17 +826,17 @@ impl Part for Quota {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DnsKeyDigest { - /// Specifies the algorithm used to calculate this digest. + /// no description provided #[serde(rename="type")] pub type_: Option, - /// The base-16 encoded bytes of this digest. Suitable for use in a DS resource record. + /// no description provided pub digest: Option, } impl Part for DnsKeyDigest {} -/// The response to a request to enumerate Changes to a ResourceRecordSets collection. +/// There is no detailed description. /// /// # Activities /// @@ -813,29 +847,27 @@ impl Part for DnsKeyDigest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ChangesListResponse { - /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token. - /// - /// In this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a "snapshot" of collections larger than the maximum page size. + /// no description provided #[serde(rename="nextPageToken")] pub next_page_token: Option, /// no description provided pub header: Option, /// Type of resource. pub kind: Option, - /// The requested changes. + /// no description provided pub changes: Option>, } impl ResponseResult for ChangesListResponse {} -/// Elements common to every response. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResponseHeader { - /// For mutating operation requests that completed successfully. This is the client_operation_id if the client specified it, otherwise it is generated by the server (output only). + /// no description provided #[serde(rename="operationId")] pub operation_id: Option, } @@ -843,7 +875,7 @@ pub struct ResponseHeader { impl Part for ResponseHeader {} -/// An operation represents a successful mutation performed on a Cloud DNS resource. Operations provide: - An audit log of server resource mutations. - A way to recover/retry API calls in the case where the response is never received by the caller. Use the caller specified client_operation_id. +/// There is no detailed description. /// /// # Activities /// @@ -856,32 +888,32 @@ impl Part for ResponseHeader {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Operation { - /// Status of the operation. Can be one of the following: "PENDING" or "DONE" (output only). + /// no description provided pub status: Option, /// Identifies what kind of resource this is. Value: the fixed string "dns#operation". pub kind: Option, - /// Only populated if the operation targeted a DnsKey (output only). + /// no description provided #[serde(rename="dnsKeyContext")] pub dns_key_context: Option, - /// Only populated if the operation targeted a ManagedZone (output only). + /// no description provided #[serde(rename="zoneContext")] pub zone_context: Option, - /// User who requested the operation, for example: user@example.com. cloud-dns-system for operations automatically done by the system. (output only) + /// no description provided pub user: Option, - /// The time that this operation was started by the server. This is in RFC3339 text format (output only). + /// no description provided #[serde(rename="startTime")] pub start_time: Option, - /// Type of the operation. Operations include insert, update, and delete (output only). + /// no description provided #[serde(rename="type")] pub type_: Option, - /// Unique identifier for the resource. This is the client_operation_id if the client specified it when the mutation was initiated, otherwise, it is generated by the server. The name must be 1-63 characters long and match the regular expression [-a-z0-9]? (output only) + /// no description provided pub id: Option, } impl ResponseResult for Operation {} -/// An atomic update to a collection of ResourceRecordSets. +/// There is no detailed description. /// /// # Activities /// @@ -894,21 +926,21 @@ impl ResponseResult for Operation {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Change { - /// Which ResourceRecordSets to remove? Must match existing data exactly. + /// no description provided pub deletions: Option>, - /// Status of the operation (output only). + /// no description provided pub status: Option, /// Identifies what kind of resource this is. Value: the fixed string "dns#change". pub kind: Option, - /// If the DNS queries for the zone will be served. + /// no description provided #[serde(rename="isServing")] pub is_serving: Option, - /// The time that this operation was started by the server (output only). This is in RFC3339 text format. + /// no description provided #[serde(rename="startTime")] pub start_time: Option, - /// Which ResourceRecordSets to add? + /// no description provided pub additions: Option>, - /// Unique identifier for the resource; defined by the server (output only). + /// no description provided pub id: Option, } @@ -963,13 +995,13 @@ impl<'a, C, A> DnsKeyMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Fetch the representation of an existing DnsKey. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or id. - /// * `dnsKeyId` - The identifier of the requested DnsKey. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. + /// * `dnsKeyId` - No description provided. pub fn get(&self, project: &str, managed_zone: &str, dns_key_id: &str) -> DnsKeyGetCall<'a, C, A> { DnsKeyGetCall { hub: self.hub, @@ -986,12 +1018,12 @@ impl<'a, C, A> DnsKeyMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Enumerate DnsKeys to a ResourceRecordSet collection. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or id. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. pub fn list(&self, project: &str, managed_zone: &str) -> DnsKeyListCall<'a, C, A> { DnsKeyListCall { hub: self.hub, @@ -1050,12 +1082,12 @@ impl<'a, C, A> ManagedZoneOperationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Enumerate Operations for the given ManagedZone. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. pub fn list(&self, project: &str, managed_zone: &str) -> ManagedZoneOperationListCall<'a, C, A> { ManagedZoneOperationListCall { hub: self.hub, @@ -1072,13 +1104,13 @@ impl<'a, C, A> ManagedZoneOperationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Fetch the representation of an existing Operation. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. - /// * `operation` - Identifies the operation addressed by this request. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. + /// * `operation` - No description provided. pub fn get(&self, project: &str, managed_zone: &str, operation: &str) -> ManagedZoneOperationGetCall<'a, C, A> { ManagedZoneOperationGetCall { hub: self.hub, @@ -1136,13 +1168,13 @@ impl<'a, C, A> ManagedZoneMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Update an existing ManagedZone. + /// /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or id. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. pub fn update(&self, request: ManagedZone, project: &str, managed_zone: &str) -> ManagedZoneUpdateCall<'a, C, A> { ManagedZoneUpdateCall { hub: self.hub, @@ -1158,13 +1190,13 @@ impl<'a, C, A> ManagedZoneMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Apply a partial update to an existing ManagedZone. + /// /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or id. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. pub fn patch(&self, request: ManagedZone, project: &str, managed_zone: &str) -> ManagedZonePatchCall<'a, C, A> { ManagedZonePatchCall { hub: self.hub, @@ -1180,12 +1212,12 @@ impl<'a, C, A> ManagedZoneMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Create a new ManagedZone. + /// /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Identifies the project addressed by this request. + /// * `project` - No description provided. pub fn create(&self, request: ManagedZone, project: &str) -> ManagedZoneCreateCall<'a, C, A> { ManagedZoneCreateCall { hub: self.hub, @@ -1200,12 +1232,12 @@ impl<'a, C, A> ManagedZoneMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Delete a previously created ManagedZone. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or id. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. pub fn delete(&self, project: &str, managed_zone: &str) -> ManagedZoneDeleteCall<'a, C, A> { ManagedZoneDeleteCall { hub: self.hub, @@ -1220,12 +1252,12 @@ impl<'a, C, A> ManagedZoneMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Fetch the representation of an existing ManagedZone. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or id. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. pub fn get(&self, project: &str, managed_zone: &str) -> ManagedZoneGetCall<'a, C, A> { ManagedZoneGetCall { hub: self.hub, @@ -1240,11 +1272,11 @@ impl<'a, C, A> ManagedZoneMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Enumerate ManagedZones that have been created but not yet deleted. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. + /// * `project` - No description provided. pub fn list(&self, project: &str) -> ManagedZoneListCall<'a, C, A> { ManagedZoneListCall { hub: self.hub, @@ -1302,12 +1334,12 @@ impl<'a, C, A> ResourceRecordSetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Enumerate ResourceRecordSets that have been created but not yet deleted. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or id. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. pub fn list(&self, project: &str, managed_zone: &str) -> ResourceRecordSetListCall<'a, C, A> { ResourceRecordSetListCall { hub: self.hub, @@ -1367,13 +1399,13 @@ impl<'a, C, A> ChangeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Atomically update the ResourceRecordSet collection. + /// /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or id. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. pub fn create(&self, request: Change, project: &str, managed_zone: &str) -> ChangeCreateCall<'a, C, A> { ChangeCreateCall { hub: self.hub, @@ -1389,12 +1421,12 @@ impl<'a, C, A> ChangeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Enumerate Changes to a ResourceRecordSet collection. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or id. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. pub fn list(&self, project: &str, managed_zone: &str) -> ChangeListCall<'a, C, A> { ChangeListCall { hub: self.hub, @@ -1412,13 +1444,13 @@ impl<'a, C, A> ChangeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Fetch the representation of an existing Change. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. - /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or id. - /// * `changeId` - The identifier of the requested change, from a previous ResourceRecordSetsChangeResponse. + /// * `project` - No description provided. + /// * `managedZone` - No description provided. + /// * `changeId` - No description provided. pub fn get(&self, project: &str, managed_zone: &str, change_id: &str) -> ChangeGetCall<'a, C, A> { ChangeGetCall { hub: self.hub, @@ -1476,11 +1508,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Fetch the representation of an existing Project. + /// /// /// # Arguments /// - /// * `project` - Identifies the project addressed by this request. + /// * `project` - No description provided. pub fn get(&self, project: &str) -> ProjectGetCall<'a, C, A> { ProjectGetCall { hub: self.hub, @@ -1501,7 +1533,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Fetch the representation of an existing DnsKey. +/// /// /// A builder for the *get* method supported by a *dnsKey* resource. /// It is not used directly, but through a `DnsKeyMethods` instance. @@ -1613,10 +1645,7 @@ impl<'a, C, A> DnsKeyGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1636,7 +1665,7 @@ impl<'a, C, A> DnsKeyGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1689,7 +1718,6 @@ impl<'a, C, A> DnsKeyGetCall<'a, C, A> where C: BorrowMut, A: oau } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -1699,7 +1727,6 @@ impl<'a, C, A> DnsKeyGetCall<'a, C, A> where C: BorrowMut, A: oau self._project = new_value.to_string(); self } - /// Identifies the managed zone addressed by this request. Can be the managed zone name or id. /// /// Sets the *managed zone* path property to the given value. /// @@ -1709,7 +1736,6 @@ impl<'a, C, A> DnsKeyGetCall<'a, C, A> where C: BorrowMut, A: oau self._managed_zone = new_value.to_string(); self } - /// The identifier of the requested DnsKey. /// /// Sets the *dns key id* path property to the given value. /// @@ -1719,14 +1745,12 @@ impl<'a, C, A> DnsKeyGetCall<'a, C, A> where C: BorrowMut, A: oau self._dns_key_id = new_value.to_string(); self } - /// An optional comma-separated list of digest types to compute and display for key signing keys. If omitted, the recommended digest type will be computed and displayed. /// /// Sets the *digest type* query property to the given value. pub fn digest_type(mut self, new_value: &str) -> DnsKeyGetCall<'a, C, A> { self._digest_type = Some(new_value.to_string()); self } - /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. /// /// Sets the *client operation id* query property to the given value. pub fn client_operation_id(mut self, new_value: &str) -> DnsKeyGetCall<'a, C, A> { @@ -1748,7 +1772,7 @@ impl<'a, C, A> DnsKeyGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1792,7 +1816,7 @@ impl<'a, C, A> DnsKeyGetCall<'a, C, A> where C: BorrowMut, A: oau } -/// Enumerate DnsKeys to a ResourceRecordSet collection. +/// /// /// A builder for the *list* method supported by a *dnsKey* resource. /// It is not used directly, but through a `DnsKeyMethods` instance. @@ -1907,10 +1931,7 @@ impl<'a, C, A> DnsKeyListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1930,7 +1951,7 @@ impl<'a, C, A> DnsKeyListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1983,7 +2004,6 @@ impl<'a, C, A> DnsKeyListCall<'a, C, A> where C: BorrowMut, A: oa } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -1993,7 +2013,6 @@ impl<'a, C, A> DnsKeyListCall<'a, C, A> where C: BorrowMut, A: oa self._project = new_value.to_string(); self } - /// Identifies the managed zone addressed by this request. Can be the managed zone name or id. /// /// Sets the *managed zone* path property to the given value. /// @@ -2003,21 +2022,18 @@ impl<'a, C, A> DnsKeyListCall<'a, C, A> where C: BorrowMut, A: oa self._managed_zone = new_value.to_string(); self } - /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> DnsKeyListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: i32) -> DnsKeyListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// An optional comma-separated list of digest types to compute and display for key signing keys. If omitted, the recommended digest type will be computed and displayed. /// /// Sets the *digest type* query property to the given value. pub fn digest_type(mut self, new_value: &str) -> DnsKeyListCall<'a, C, A> { @@ -2039,7 +2055,7 @@ impl<'a, C, A> DnsKeyListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2083,7 +2099,7 @@ impl<'a, C, A> DnsKeyListCall<'a, C, A> where C: BorrowMut, A: oa } -/// Enumerate Operations for the given ManagedZone. +/// /// /// A builder for the *list* method supported by a *managedZoneOperation* resource. /// It is not used directly, but through a `ManagedZoneOperationMethods` instance. @@ -2198,10 +2214,7 @@ impl<'a, C, A> ManagedZoneOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2221,7 +2234,7 @@ impl<'a, C, A> ManagedZoneOperationListCall<'a, C, A> where C: BorrowMut ManagedZoneOperationListCall<'a, C, A> where C: BorrowMut ManagedZoneOperationListCall<'a, C, A> where C: BorrowMut ManagedZoneOperationListCall<'a, C, A> where C: BorrowMut ManagedZoneOperationListCall<'a, C, A> { self._sort_by = Some(new_value.to_string()); self } - /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ManagedZoneOperationListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: i32) -> ManagedZoneOperationListCall<'a, C, A> { @@ -2330,7 +2338,7 @@ impl<'a, C, A> ManagedZoneOperationListCall<'a, C, A> where C: BorrowMut ManagedZoneOperationListCall<'a, C, A> where C: BorrowMut ManagedZoneOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2504,7 +2509,7 @@ impl<'a, C, A> ManagedZoneOperationGetCall<'a, C, A> where C: BorrowMut ManagedZoneOperationGetCall<'a, C, A> where C: BorrowMut ManagedZoneOperationGetCall<'a, C, A> where C: BorrowMut ManagedZoneOperationGetCall<'a, C, A> where C: BorrowMut ManagedZoneOperationGetCall<'a, C, A> where C: BorrowMut ManagedZoneOperationGetCall<'a, C, A> { @@ -2609,7 +2610,7 @@ impl<'a, C, A> ManagedZoneOperationGetCall<'a, C, A> where C: BorrowMut ManagedZoneOperationGetCall<'a, C, A> where C: BorrowMut ManagedZoneUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2800,7 +2798,7 @@ impl<'a, C, A> ManagedZoneUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2865,7 +2863,6 @@ impl<'a, C, A> ManagedZoneUpdateCall<'a, C, A> where C: BorrowMut self._request = new_value; self } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -2875,7 +2872,6 @@ impl<'a, C, A> ManagedZoneUpdateCall<'a, C, A> where C: BorrowMut self._project = new_value.to_string(); self } - /// Identifies the managed zone addressed by this request. Can be the managed zone name or id. /// /// Sets the *managed zone* path property to the given value. /// @@ -2885,7 +2881,6 @@ impl<'a, C, A> ManagedZoneUpdateCall<'a, C, A> where C: BorrowMut self._managed_zone = new_value.to_string(); self } - /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. /// /// Sets the *client operation id* query property to the given value. pub fn client_operation_id(mut self, new_value: &str) -> ManagedZoneUpdateCall<'a, C, A> { @@ -2907,7 +2902,7 @@ impl<'a, C, A> ManagedZoneUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2951,7 +2946,7 @@ impl<'a, C, A> ManagedZoneUpdateCall<'a, C, A> where C: BorrowMut } -/// Apply a partial update to an existing ManagedZone. +/// /// /// A builder for the *patch* method supported by a *managedZone* resource. /// It is not used directly, but through a `ManagedZoneMethods` instance. @@ -3063,10 +3058,7 @@ impl<'a, C, A> ManagedZonePatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3098,7 +3090,7 @@ impl<'a, C, A> ManagedZonePatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3163,7 +3155,6 @@ impl<'a, C, A> ManagedZonePatchCall<'a, C, A> where C: BorrowMut, self._request = new_value; self } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -3173,7 +3164,6 @@ impl<'a, C, A> ManagedZonePatchCall<'a, C, A> where C: BorrowMut, self._project = new_value.to_string(); self } - /// Identifies the managed zone addressed by this request. Can be the managed zone name or id. /// /// Sets the *managed zone* path property to the given value. /// @@ -3183,7 +3173,6 @@ impl<'a, C, A> ManagedZonePatchCall<'a, C, A> where C: BorrowMut, self._managed_zone = new_value.to_string(); self } - /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. /// /// Sets the *client operation id* query property to the given value. pub fn client_operation_id(mut self, new_value: &str) -> ManagedZonePatchCall<'a, C, A> { @@ -3205,7 +3194,7 @@ impl<'a, C, A> ManagedZonePatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3249,7 +3238,7 @@ impl<'a, C, A> ManagedZonePatchCall<'a, C, A> where C: BorrowMut, } -/// Create a new ManagedZone. +/// /// /// A builder for the *create* method supported by a *managedZone* resource. /// It is not used directly, but through a `ManagedZoneMethods` instance. @@ -3359,10 +3348,7 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3394,7 +3380,7 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3459,7 +3445,6 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut self._request = new_value; self } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -3469,7 +3454,6 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut self._project = new_value.to_string(); self } - /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. /// /// Sets the *client operation id* query property to the given value. pub fn client_operation_id(mut self, new_value: &str) -> ManagedZoneCreateCall<'a, C, A> { @@ -3491,7 +3475,7 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3535,7 +3519,7 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut } -/// Delete a previously created ManagedZone. +/// /// /// A builder for the *delete* method supported by a *managedZone* resource. /// It is not used directly, but through a `ManagedZoneMethods` instance. @@ -3639,10 +3623,7 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3662,7 +3643,7 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3705,7 +3686,6 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -3715,7 +3695,6 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut self._project = new_value.to_string(); self } - /// Identifies the managed zone addressed by this request. Can be the managed zone name or id. /// /// Sets the *managed zone* path property to the given value. /// @@ -3725,7 +3704,6 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut self._managed_zone = new_value.to_string(); self } - /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. /// /// Sets the *client operation id* query property to the given value. pub fn client_operation_id(mut self, new_value: &str) -> ManagedZoneDeleteCall<'a, C, A> { @@ -3747,7 +3725,7 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3791,7 +3769,7 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut } -/// Fetch the representation of an existing ManagedZone. +/// /// /// A builder for the *get* method supported by a *managedZone* resource. /// It is not used directly, but through a `ManagedZoneMethods` instance. @@ -3896,10 +3874,7 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3919,7 +3894,7 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3972,7 +3947,6 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -3982,7 +3956,6 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A self._project = new_value.to_string(); self } - /// Identifies the managed zone addressed by this request. Can be the managed zone name or id. /// /// Sets the *managed zone* path property to the given value. /// @@ -3992,7 +3965,6 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A self._managed_zone = new_value.to_string(); self } - /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. /// /// Sets the *client operation id* query property to the given value. pub fn client_operation_id(mut self, new_value: &str) -> ManagedZoneGetCall<'a, C, A> { @@ -4014,7 +3986,7 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4058,7 +4030,7 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A } -/// Enumerate ManagedZones that have been created but not yet deleted. +/// /// /// A builder for the *list* method supported by a *managedZone* resource. /// It is not used directly, but through a `ManagedZoneMethods` instance. @@ -4171,10 +4143,7 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4194,7 +4163,7 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4247,7 +4216,6 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -4257,21 +4225,18 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, self._project = new_value.to_string(); self } - /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ManagedZoneListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: i32) -> ManagedZoneListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Restricts the list to return only zones with this domain name. /// /// Sets the *dns name* query property to the given value. pub fn dns_name(mut self, new_value: &str) -> ManagedZoneListCall<'a, C, A> { @@ -4293,7 +4258,7 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4337,7 +4302,7 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, } -/// Enumerate ResourceRecordSets that have been created but not yet deleted. +/// /// /// A builder for the *list* method supported by a *resourceRecordSet* resource. /// It is not used directly, but through a `ResourceRecordSetMethods` instance. @@ -4457,10 +4422,7 @@ impl<'a, C, A> ResourceRecordSetListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4480,7 +4442,7 @@ impl<'a, C, A> ResourceRecordSetListCall<'a, C, A> where C: BorrowMut ResourceRecordSetListCall<'a, C, A> where C: BorrowMut ResourceRecordSetListCall<'a, C, A> where C: BorrowMut ResourceRecordSetListCall<'a, C, A> where C: BorrowMut ResourceRecordSetListCall<'a, C, A> { self._type_ = Some(new_value.to_string()); self } - /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ResourceRecordSetListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Restricts the list to return only records with this fully qualified domain name. /// /// Sets the *name* query property to the given value. pub fn name(mut self, new_value: &str) -> ResourceRecordSetListCall<'a, C, A> { self._name = Some(new_value.to_string()); self } - /// Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: i32) -> ResourceRecordSetListCall<'a, C, A> { @@ -4596,7 +4552,7 @@ impl<'a, C, A> ResourceRecordSetListCall<'a, C, A> where C: BorrowMut ResourceRecordSetListCall<'a, C, A> where C: BorrowMut ChangeCreateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4787,7 +4740,7 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4852,7 +4805,6 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: self._request = new_value; self } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -4862,7 +4814,6 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: self._project = new_value.to_string(); self } - /// Identifies the managed zone addressed by this request. Can be the managed zone name or id. /// /// Sets the *managed zone* path property to the given value. /// @@ -4872,7 +4823,6 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: self._managed_zone = new_value.to_string(); self } - /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. /// /// Sets the *client operation id* query property to the given value. pub fn client_operation_id(mut self, new_value: &str) -> ChangeCreateCall<'a, C, A> { @@ -4894,7 +4844,7 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4938,7 +4888,7 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: } -/// Enumerate Changes to a ResourceRecordSet collection. +/// /// /// A builder for the *list* method supported by a *change* resource. /// It is not used directly, but through a `ChangeMethods` instance. @@ -5058,10 +5008,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5081,7 +5028,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5134,7 +5081,6 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -5144,7 +5090,6 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa self._project = new_value.to_string(); self } - /// Identifies the managed zone addressed by this request. Can be the managed zone name or id. /// /// Sets the *managed zone* path property to the given value. /// @@ -5154,28 +5099,24 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa self._managed_zone = new_value.to_string(); self } - /// Sorting order direction: 'ascending' or 'descending'. /// /// Sets the *sort order* query property to the given value. pub fn sort_order(mut self, new_value: &str) -> ChangeListCall<'a, C, A> { self._sort_order = Some(new_value.to_string()); self } - /// Sorting criterion. The only supported value is change sequence. /// /// Sets the *sort by* query property to the given value. pub fn sort_by(mut self, new_value: &str) -> ChangeListCall<'a, C, A> { self._sort_by = Some(new_value.to_string()); self } - /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ChangeListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: i32) -> ChangeListCall<'a, C, A> { @@ -5197,7 +5138,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5241,7 +5182,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa } -/// Fetch the representation of an existing Change. +/// /// /// A builder for the *get* method supported by a *change* resource. /// It is not used directly, but through a `ChangeMethods` instance. @@ -5348,10 +5289,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5371,7 +5309,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5424,7 +5362,6 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -5434,7 +5371,6 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau self._project = new_value.to_string(); self } - /// Identifies the managed zone addressed by this request. Can be the managed zone name or id. /// /// Sets the *managed zone* path property to the given value. /// @@ -5444,7 +5380,6 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau self._managed_zone = new_value.to_string(); self } - /// The identifier of the requested change, from a previous ResourceRecordSetsChangeResponse. /// /// Sets the *change id* path property to the given value. /// @@ -5454,7 +5389,6 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau self._change_id = new_value.to_string(); self } - /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. /// /// Sets the *client operation id* query property to the given value. pub fn client_operation_id(mut self, new_value: &str) -> ChangeGetCall<'a, C, A> { @@ -5476,7 +5410,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5520,7 +5454,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau } -/// Fetch the representation of an existing Project. +/// /// /// A builder for the *get* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -5623,10 +5557,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5646,7 +5577,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5699,7 +5630,6 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } - /// Identifies the project addressed by this request. /// /// Sets the *project* path property to the given value. /// @@ -5709,7 +5639,6 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa self._project = new_value.to_string(); self } - /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. /// /// Sets the *client operation id* query property to the given value. pub fn client_operation_id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { @@ -5731,7 +5660,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/docs1-cli/Cargo.toml b/gen/docs1-cli/Cargo.toml new file mode 100644 index 0000000000..5de3a300e3 --- /dev/null +++ b/gen/docs1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-docs1-cli" +version = "1.0.8+20190330" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Docs (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/docs1-cli" +homepage = "https://developers.google.com/docs/" +documentation = "http://byron.github.io/google-apis-rs/google_docs1_cli" +license = "MIT" +keywords = ["docs", "google", "cli"] +autobins = false + +[[bin]] +name = "docs1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-docs1] +path = "../docs1" +version = "1.0.8+20190330" diff --git a/gen/docs1-cli/LICENSE.md b/gen/docs1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/docs1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/docs1-cli/README.md b/gen/docs1-cli/README.md new file mode 100644 index 0000000000..c356729714 --- /dev/null +++ b/gen/docs1-cli/README.md @@ -0,0 +1,116 @@ + +The `docs1` command-line interface *(CLI)* allows to use most features of the *Google Docs* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Docs* API can be found at the +[official documentation site](https://developers.google.com/docs/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-docs1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/docs1-cli). + +# Usage + +This documentation was generated from the *Docs* API at revision *20190330*. The CLI is at version *1.0.8*. + +```bash +docs1 [options] + documents + batch-update (-r )... [-p ]... [-o ] + create (-r )... [-p ]... [-o ] + get [-p ]... [-o ] + docs1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `docs1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/docs1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/docs1-secret.json`, assuming that the required *docs* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `docs1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/docs1-cli/mkdocs.yml b/gen/docs1-cli/mkdocs.yml new file mode 100644 index 0000000000..8482e8cfe5 --- /dev/null +++ b/gen/docs1-cli/mkdocs.yml @@ -0,0 +1,19 @@ +site_name: Docs v1.0.8+20190330 +site_url: http://byron.github.io/google-apis-rs/google-docs1-cli +site_description: A complete library to interact with Docs (protocol v1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/docs1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['documents_batch-update.md', 'Documents', 'Batch Update'] +- ['documents_create.md', 'Documents', 'Create'] +- ['documents_get.md', 'Documents', 'Get'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/docs1-cli/src/cmn.rs b/gen/docs1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/docs1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/docs1-cli/src/main.rs b/gen/docs1-cli/src/main.rs new file mode 100644 index 0000000000..4cb48cc1e9 --- /dev/null +++ b/gen/docs1-cli/src/main.rs @@ -0,0 +1,605 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_docs1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Docs>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _documents_batch_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "write-control.required-revision-id" => Some(("writeControl.requiredRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "write-control.target-revision-id" => Some(("writeControl.targetRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["required-revision-id", "target-revision-id", "write-control"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BatchUpdateDocumentRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.documents().batch_update(request, opt.value_of("document-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _documents_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "suggestions-view-mode" => Some(("suggestionsViewMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.default-footer-id" => Some(("documentStyle.defaultFooterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.even-page-footer-id" => Some(("documentStyle.evenPageFooterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.first-page-footer-id" => Some(("documentStyle.firstPageFooterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.page-size.width.magnitude" => Some(("documentStyle.pageSize.width.magnitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "document-style.page-size.width.unit" => Some(("documentStyle.pageSize.width.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.page-size.height.magnitude" => Some(("documentStyle.pageSize.height.magnitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "document-style.page-size.height.unit" => Some(("documentStyle.pageSize.height.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.default-header-id" => Some(("documentStyle.defaultHeaderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.margin-bottom.magnitude" => Some(("documentStyle.marginBottom.magnitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "document-style.margin-bottom.unit" => Some(("documentStyle.marginBottom.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.first-page-header-id" => Some(("documentStyle.firstPageHeaderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.even-page-header-id" => Some(("documentStyle.evenPageHeaderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.use-first-page-header-footer" => Some(("documentStyle.useFirstPageHeaderFooter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "document-style.margin-left.magnitude" => Some(("documentStyle.marginLeft.magnitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "document-style.margin-left.unit" => Some(("documentStyle.marginLeft.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.use-even-page-header-footer" => Some(("documentStyle.useEvenPageHeaderFooter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "document-style.background.color.color.rgb-color.blue" => Some(("documentStyle.background.color.color.rgbColor.blue", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "document-style.background.color.color.rgb-color.green" => Some(("documentStyle.background.color.color.rgbColor.green", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "document-style.background.color.color.rgb-color.red" => Some(("documentStyle.background.color.color.rgbColor.red", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "document-style.margin-right.magnitude" => Some(("documentStyle.marginRight.magnitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "document-style.margin-right.unit" => Some(("documentStyle.marginRight.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-style.page-number-start" => Some(("documentStyle.pageNumberStart", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "document-style.margin-top.magnitude" => Some(("documentStyle.marginTop.magnitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "document-style.margin-top.unit" => Some(("documentStyle.marginTop.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "revision-id" => Some(("revisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "document-id" => Some(("documentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["background", "blue", "color", "default-footer-id", "default-header-id", "document-id", "document-style", "even-page-footer-id", "even-page-header-id", "first-page-footer-id", "first-page-header-id", "green", "height", "magnitude", "margin-bottom", "margin-left", "margin-right", "margin-top", "page-number-start", "page-size", "red", "revision-id", "rgb-color", "suggestions-view-mode", "title", "unit", "use-even-page-header-footer", "use-first-page-header-footer", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Document = json::value::from_value(object).unwrap(); + let mut call = self.hub.documents().create(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _documents_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.documents().get(opt.value_of("document-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "suggestions-view-mode" => { + call = call.suggestions_view_mode(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["suggestions-view-mode"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("documents", Some(opt)) => { + match opt.subcommand() { + ("batch-update", Some(opt)) => { + call_result = self._documents_batch_update(opt, dry_run, &mut err); + }, + ("create", Some(opt)) => { + call_result = self._documents_create(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._documents_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("documents".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "docs1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "docs1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::Docs::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("documents", "methods: 'batch-update', 'create' and 'get'", vec![ + ("batch-update", + Some(r##"Applies one or more updates to the document. + + Each request is validated before + being applied. If any request is not valid, then the entire request will + fail and nothing will be applied. + + Some requests have replies to + give you some information about how they are applied. Other requests do + not need to return information; these each return an empty reply. + The order of replies matches that of the requests. + + For example, suppose you call batchUpdate with four updates, and only the + third one returns information. The response would have two empty replies, + the reply to the third request, and another empty reply, in that order. + + Because other users may be editing the document, the document + might not exactly reflect your changes: your changes may + be altered with respect to collaborator changes. If there are no + collaborators, the document should reflect your changes. In any case, + the updates in your request are guaranteed to be applied together + atomically."##), + "Details at http://byron.github.io/google-apis-rs/google_docs1_cli/documents_batch-update", + vec![ + (Some(r##"document-id"##), + None, + Some(r##"The ID of the document to update."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("create", + Some(r##"Creates a blank document using the title given in the request. Other fields + in the request, including any provided content, are ignored. + + Returns the created document."##), + "Details at http://byron.github.io/google-apis-rs/google_docs1_cli/documents_create", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets the latest version of the specified document."##), + "Details at http://byron.github.io/google-apis-rs/google_docs1_cli/documents_get", + vec![ + (Some(r##"document-id"##), + None, + Some(r##"The ID of the document to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("docs1") + .author("Sebastian Thiel ") + .version("1.0.8+20190330") + .about("Reads and writes Google Docs documents.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_docs1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/docs1/Cargo.toml b/gen/docs1/Cargo.toml new file mode 100644 index 0000000000..f8e7441437 --- /dev/null +++ b/gen/docs1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-docs1" +version = "1.0.8+20190330" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Docs (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/docs1" +homepage = "https://developers.google.com/docs/" +documentation = "https://docs.rs/google-docs1/1.0.8+20190330" +license = "MIT" +keywords = ["docs", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/docs1/LICENSE.md b/gen/docs1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/docs1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/docs1/README.md b/gen/docs1/README.md new file mode 100644 index 0000000000..304feae53b --- /dev/null +++ b/gen/docs1/README.md @@ -0,0 +1,185 @@ + +The `google-docs1` library allows access to all features of the *Google Docs* service. + +This documentation was generated from *Docs* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *docs:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Docs* *v1* API can be found at the +[official documentation site](https://developers.google.com/docs/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/struct.Docs.html) ... + +* [documents](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/struct.Document.html) + * [*batch update*](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/struct.DocumentBatchUpdateCall.html), [*create*](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/struct.DocumentCreateCall.html) and [*get*](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/struct.DocumentGetCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/struct.Docs.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.documents().create(...).doit() +let r = hub.documents().get(...).doit() +let r = hub.documents().batch_update(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-docs1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_docs1 as docs1; +use docs1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use docs1::Docs; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = Docs::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.documents().get("documentId") + .suggestions_view_mode("sit") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-docs1/1.0.8+20190330/google_docs1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **docs1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/docs1/src/cmn.rs b/gen/docs1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/docs1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/docs1/src/lib.rs b/gen/docs1/src/lib.rs new file mode 100644 index 0000000000..36772ae2dc --- /dev/null +++ b/gen/docs1/src/lib.rs @@ -0,0 +1,4839 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Docs* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *docs:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Docs* *v1* API can be found at the +//! [official documentation site](https://developers.google.com/docs/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/docs1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Docs.html) ... +//! +//! * [documents](struct.Document.html) +//! * [*batch update*](struct.DocumentBatchUpdateCall.html), [*create*](struct.DocumentCreateCall.html) and [*get*](struct.DocumentGetCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Docs.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.documents().create(...).doit() +//! let r = hub.documents().get(...).doit() +//! let r = hub.documents().batch_update(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-docs1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_docs1 as docs1; +//! use docs1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use docs1::Docs; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = Docs::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.documents().get("documentId") +//! .suggestions_view_mode("sed") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// See, edit, create, and delete all of your Google Drive files + Drive, + + /// View your Google Docs documents + DocumentReadonly, + + /// View and manage Google Drive files and folders that you have opened or created with this app + DriveFile, + + /// View and manage your Google Docs documents + Document, + + /// See and download all your Google Drive files + DriveReadonly, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::Drive => "https://www.googleapis.com/auth/drive", + Scope::DocumentReadonly => "https://www.googleapis.com/auth/documents.readonly", + Scope::DriveFile => "https://www.googleapis.com/auth/drive.file", + Scope::Document => "https://www.googleapis.com/auth/documents", + Scope::DriveReadonly => "https://www.googleapis.com/auth/drive.readonly", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::DocumentReadonly + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Docs related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_docs1 as docs1; +/// use docs1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use docs1::Docs; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Docs::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.documents().get("documentId") +/// .suggestions_view_mode("dolores") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Docs { + client: RefCell, + auth: RefCell
, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for Docs {} + +impl<'a, C, A> Docs + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Docs { + Docs { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://docs.googleapis.com/".to_string(), + _root_url: "https://docs.googleapis.com/".to_string(), + } + } + + pub fn documents(&'a self) -> DocumentMethods<'a, C, A> { + DocumentMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://docs.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://docs.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// A mask that indicates which of the fields on the base CropProperties have been changed in this suggestion. +/// For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CropPropertiesSuggestionState { + /// Indicates if there was a suggested change to offset_bottom. + #[serde(rename="offsetBottomSuggested")] + pub offset_bottom_suggested: Option, + /// Indicates if there was a suggested change to offset_left. + #[serde(rename="offsetLeftSuggested")] + pub offset_left_suggested: Option, + /// Indicates if there was a suggested change to offset_right. + #[serde(rename="offsetRightSuggested")] + pub offset_right_suggested: Option, + /// Indicates if there was a suggested change to angle. + #[serde(rename="angleSuggested")] + pub angle_suggested: Option, + /// Indicates if there was a suggested change to offset_top. + #[serde(rename="offsetTopSuggested")] + pub offset_top_suggested: Option, +} + +impl Part for CropPropertiesSuggestionState {} + + +/// A mask that indicates which of the fields on the base +/// EmbeddedDrawingProperties +/// have been changed in this suggestion. For any field set to true, there is a +/// new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EmbeddedDrawingPropertiesSuggestionState { _never_set: Option } + +impl Part for EmbeddedDrawingPropertiesSuggestionState {} + + +/// A single update to apply to a document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Request { + /// Inserts text at the specified location. + #[serde(rename="insertText")] + pub insert_text: Option, + /// Creates bullets for paragraphs. + #[serde(rename="createParagraphBullets")] + pub create_paragraph_bullets: Option, + /// Updates the paragraph style at the specified range. + #[serde(rename="updateParagraphStyle")] + pub update_paragraph_style: Option, + /// Replaces all instances of the specified text. + #[serde(rename="replaceAllText")] + pub replace_all_text: Option, + /// Deletes a row from a table. + #[serde(rename="deleteTableRow")] + pub delete_table_row: Option, + /// Inserts a page break at the specified location. + #[serde(rename="insertPageBreak")] + pub insert_page_break: Option, + /// Creates a named range. + #[serde(rename="createNamedRange")] + pub create_named_range: Option, + /// Deletes content from the document. + #[serde(rename="deleteContentRange")] + pub delete_content_range: Option, + /// Deletes bullets from paragraphs. + #[serde(rename="deleteParagraphBullets")] + pub delete_paragraph_bullets: Option, + /// Deletes a named range. + #[serde(rename="deleteNamedRange")] + pub delete_named_range: Option, + /// Inserts a table at the specified location. + #[serde(rename="insertTable")] + pub insert_table: Option, + /// Inserts an empty row into a table. + #[serde(rename="insertTableRow")] + pub insert_table_row: Option, + /// Updates the text style at the specified range. + #[serde(rename="updateTextStyle")] + pub update_text_style: Option, + /// Deletes a positioned object from the document. + #[serde(rename="deletePositionedObject")] + pub delete_positioned_object: Option, + /// Deletes a column from a table. + #[serde(rename="deleteTableColumn")] + pub delete_table_column: Option, + /// Inserts an inline image at the specified location. + #[serde(rename="insertInlineImage")] + pub insert_inline_image: Option, +} + +impl Part for Request {} + + +/// Deletes content from the document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteContentRangeRequest { + /// The range of content to delete. + /// + /// Deleting text that crosses a paragraph boundary may result in changes + /// to paragraph styles, lists, positioned objects and bookmarks as the two + /// paragraphs are merged. + /// + /// Attempting to delete certain ranges can result in an invalid document + /// structure in which case a 400 bad request error is returned. + /// + /// Some examples of invalid delete requests include: + /// + /// * Deleting one code unit of a surrogate pair. + /// * Deleting the last newline character of a Body, Header, + /// Footer, Footnote, TableCell or TableOfContents. + /// * Deleting the start or end of a Table, + /// TableOfContents or Equation without deleting the entire element. + /// * Deleting the newline character before a + /// Table, + /// TableOfContents or + /// SectionBreak without deleting the + /// element. + /// * Deleting individual rows or cells of a table. Deleting the content within + /// a table cell is allowed. + pub range: Option, +} + +impl Part for DeleteContentRangeRequest {} + + +/// A border around an EmbeddedObject. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EmbeddedObjectBorder { + /// The color of the border. + pub color: Option, + /// The width of the border. + pub width: Option, + /// The dash style of the border. + #[serde(rename="dashStyle")] + pub dash_style: Option, + /// The property state of the border property. + #[serde(rename="propertyState")] + pub property_state: Option, +} + +impl Part for EmbeddedObjectBorder {} + + +/// Represents a font family and weight of text. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WeightedFontFamily { + /// The font family of the text. + /// + /// The font family can be any font from the Font menu in Docs or from + /// [Google Fonts] (https://fonts.google.com/). If the font name is + /// unrecognized, the text is rendered in `Arial`. + #[serde(rename="fontFamily")] + pub font_family: Option, + /// The weight of the font. This field can have any value that is a multiple of + /// `100` between `100` and `900`, inclusive. This range corresponds to the + /// numerical values described in the CSS 2.1 Specification, + /// [section 15.6](https://www.w3.org/TR/CSS21/fonts.html#font-boldness), with + /// non-numerical values disallowed. + /// + /// The default value is `400` ("normal"). + /// + /// The font weight makes up just one component of the rendered font weight. + /// The rendered weight is determined by a combination of the `weight` and the + /// text style's resolved `bold` value, after accounting for inheritance: + /// + /// * If the text is bold and the weight is less than `400`, the rendered + /// weight is 400. + /// * If the text is bold and the weight is greater than or equal to `400` but + /// is less than `700`, the rendered weight is `700`. + /// * If the weight is greater than or equal to `700`, the rendered weight is + /// equal to the weight. + /// * If the text is not bold, the rendered weight is equal to the weight. + pub weight: Option, +} + +impl Part for WeightedFontFamily {} + + +/// A ParagraphElement representing a +/// column break. A column break makes the subsequent text start at the top of +/// the next column. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ColumnBreak { + /// The text style of this ColumnBreak. + /// + /// Similar to text content, like text runs and footnote references, the text + /// style of a column break can affect content layout as well as the styling of + /// text inserted adjacent to it. + #[serde(rename="textStyle")] + pub text_style: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested text style changes to this ColumnBreak, keyed by suggestion + /// ID. + #[serde(rename="suggestedTextStyleChanges")] + pub suggested_text_style_changes: Option>, + /// The suggested insertion IDs. A ColumnBreak may have multiple insertion IDs if it is + /// a nested suggested change. If empty, then this is not a suggested + /// insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for ColumnBreak {} + + +/// A mask that indicates which of the fields on the base EmbeddedObjectBorder have been changed in this +/// suggestion. For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EmbeddedObjectBorderSuggestionState { + /// Indicates if there was a suggested change to color. + #[serde(rename="colorSuggested")] + pub color_suggested: Option, + /// Indicates if there was a suggested change to dash_style. + #[serde(rename="dashStyleSuggested")] + pub dash_style_suggested: Option, + /// Indicates if there was a suggested change to width. + #[serde(rename="widthSuggested")] + pub width_suggested: Option, + /// Indicates if there was a suggested change to property_state. + #[serde(rename="propertyStateSuggested")] + pub property_state_suggested: Option, +} + +impl Part for EmbeddedObjectBorderSuggestionState {} + + +/// Replaces all instances of text matching a criteria with replace text. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReplaceAllTextRequest { + /// Finds text in the document matching this substring. + #[serde(rename="containsText")] + pub contains_text: Option, + /// The text that will replace the matched text. + #[serde(rename="replaceText")] + pub replace_text: Option, +} + +impl Part for ReplaceAllTextRequest {} + + +/// A StructuralElement representing +/// a table of contents. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableOfContents { + /// The content of the table of contents. + pub content: Option>, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested insertion IDs. A TableOfContents may have multiple insertion IDs if it + /// is a nested suggested change. If empty, then this is not a suggested + /// insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for TableOfContents {} + + +/// The crop properties of an image. +/// +/// The crop rectangle is represented using fractional offsets from the original +/// content's four edges. +/// +/// - If the offset is in the interval (0, 1), the corresponding edge of crop +/// rectangle is positioned inside of the image's original bounding rectangle. +/// - If the offset is negative or greater than 1, the corresponding edge of crop +/// rectangle is positioned outside of the image's original bounding rectangle. +/// - If all offsets and rotation angle are 0, the image is not cropped. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CropProperties { + /// The offset specifies how far inwards the bottom edge of the crop rectangle + /// is from the bottom edge of the original content as a fraction of the + /// original content's height. + #[serde(rename="offsetBottom")] + pub offset_bottom: Option, + /// The clockwise rotation angle of the crop rectangle around its center, in + /// radians. Rotation is applied after the offsets. + pub angle: Option, + /// The offset specifies how far inwards the left edge of the crop rectangle is + /// from the left edge of the original content as a fraction of the original + /// content's width. + #[serde(rename="offsetLeft")] + pub offset_left: Option, + /// The offset specifies how far inwards the right edge of the crop rectangle + /// is from the right edge of the original content as a fraction of the + /// original content's width. + #[serde(rename="offsetRight")] + pub offset_right: Option, + /// The offset specifies how far inwards the top edge of the crop rectangle is + /// from the top edge of the original content as a fraction of the original + /// content's height. + #[serde(rename="offsetTop")] + pub offset_top: Option, +} + +impl Part for CropProperties {} + + +/// Inserts an InlineObject containing an +/// image at the given location. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InsertInlineImageRequest { + /// The size that the image should appear as in the document. This property is + /// optional and the final size of the image in the document is determined by + /// the following rules: + /// * If neither width nor height is specified, then a default size of the + /// image is calculated based on its resolution. + /// * If one dimension is specified then the other dimension is calculated to + /// preserve the aspect ratio of the image. + /// * If both width and height are specified, the image is scaled to fit + /// within the provided dimensions while maintaining its aspect ratio. + #[serde(rename="objectSize")] + pub object_size: Option, + /// Inserts the text at the end of a header, footer or the document body. + /// + /// Inline images cannot be inserted inside a footnote. + #[serde(rename="endOfSegmentLocation")] + pub end_of_segment_location: Option, + /// Inserts the image at a specific index in the document. + /// + /// The image must be inserted inside the bounds of an existing + /// Paragraph. For instance, it cannot be + /// inserted at a table's start index (i.e. between the table and its + /// preceding paragraph). + /// + /// Inline images cannot be inserted inside a footnote or equation. + pub location: Option, + /// The image URI. + /// + /// The image is fetched once at insertion time and a copy is stored for + /// display inside the document. Images must be less than 50MB in size, cannot + /// exceed 25 megapixels, and must be in one of PNG, JPEG, or GIF format. + /// + /// The provided URI can be at most 2 kB in length. The URI itself is saved + /// with the image, and exposed via the ImageProperties.content_uri field. + pub uri: Option, +} + +impl Part for InsertInlineImageRequest {} + + +/// A Google Docs document. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [create documents](struct.DocumentCreateCall.html) (request|response) +/// * [get documents](struct.DocumentGetCall.html) (response) +/// * [batch update documents](struct.DocumentBatchUpdateCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Document { + /// The main body of the document. + pub body: Option, + /// The style of the document. + #[serde(rename="documentStyle")] + pub document_style: Option, + /// The suggested changes to the style of the document, keyed by suggestion ID. + #[serde(rename="suggestedDocumentStyleChanges")] + pub suggested_document_style_changes: Option>, + /// The suggested changes to the named styles of the document, keyed by + /// suggestion ID. + #[serde(rename="suggestedNamedStylesChanges")] + pub suggested_named_styles_changes: Option>, + /// The lists in the document, keyed by list ID. + pub lists: Option>, + /// The footers in the document, keyed by footer ID. + pub footers: Option>, + /// The suggestions view mode applied to the document. + /// + /// Note: When editing a document, changes must be based on a document with + /// SUGGESTIONS_INLINE. + #[serde(rename="suggestionsViewMode")] + pub suggestions_view_mode: Option, + /// The positioned objects in the document, keyed by object ID. + #[serde(rename="positionedObjects")] + pub positioned_objects: Option>, + /// The named ranges in the document, keyed by name. + #[serde(rename="namedRanges")] + pub named_ranges: Option>, + /// The ID of the document. + #[serde(rename="documentId")] + pub document_id: Option, + /// The title of the document. + pub title: Option, + /// The revision ID of the document. Can be used in update requests to specify + /// which revision of a document to apply updates to and how the request should + /// behave if the document has been edited since that revision. Only populated + /// if the user has edit access to the document. + /// + /// The format of the revision ID may change over time, so it should be treated + /// opaquely. A returned revision ID is only guaranteed to be valid for 24 + /// hours after it has been returned and cannot be shared across users. If the + /// revision ID is unchanged between calls, then the document has not changed. + /// Conversely, a changed ID (for the same document and user) usually means the + /// document has been updated; however, a changed ID can also be due to + /// internal factors such as ID format changes. + #[serde(rename="revisionId")] + pub revision_id: Option, + /// The headers in the document, keyed by header ID. + pub headers: Option>, + /// The footnotes in the document, keyed by footnote ID. + pub footnotes: Option>, + /// The inline objects in the document, keyed by object ID. + #[serde(rename="inlineObjects")] + pub inline_objects: Option>, + /// The named styles of the document. + #[serde(rename="namedStyles")] + pub named_styles: Option, +} + +impl RequestValue for Document {} +impl Resource for Document {} +impl ResponseResult for Document {} + + +/// A suggestion state of a NamedStyle message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NamedStyleSuggestionState { + /// A mask that indicates which of the fields in paragraph style have been changed in this + /// suggestion. + #[serde(rename="paragraphStyleSuggestionState")] + pub paragraph_style_suggestion_state: Option, + /// A mask that indicates which of the fields in text style have been changed in this + /// suggestion. + #[serde(rename="textStyleSuggestionState")] + pub text_style_suggestion_state: Option, + /// The named style type that this suggestion state corresponds to. + /// + /// This field is provided as a convenience for matching the + /// NamedStyleSuggestionState with its corresponding NamedStyle. + #[serde(rename="namedStyleType")] + pub named_style_type: Option, +} + +impl Part for NamedStyleSuggestionState {} + + +/// A ParagraphElement representing a +/// footnote reference. A footnote reference is the inline content rendered with +/// a number and is used to identify the footnote. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FootnoteReference { + /// The text style of this FootnoteReference. + #[serde(rename="textStyle")] + pub text_style: Option, + /// The ID of the footnote that + /// contains the content of this footnote reference. + #[serde(rename="footnoteId")] + pub footnote_id: Option, + /// The rendered number of this footnote. + #[serde(rename="footnoteNumber")] + pub footnote_number: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested text style changes to this FootnoteReference, keyed by + /// suggestion ID. + #[serde(rename="suggestedTextStyleChanges")] + pub suggested_text_style_changes: Option>, + /// The suggested insertion IDs. A FootnoteReference may have multiple insertion IDs if + /// it is a nested suggested change. If empty, then this is not a suggested + /// insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for FootnoteReference {} + + +/// A mask that indicates which of the fields on the base TableCellStyle have been changed in this suggestion. +/// For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableCellStyleSuggestionState { + /// Indicates if there was a suggested change to border_bottom. + #[serde(rename="borderBottomSuggested")] + pub border_bottom_suggested: Option, + /// Indicates if there was a suggested change to border_right. + #[serde(rename="borderRightSuggested")] + pub border_right_suggested: Option, + /// Indicates if there was a suggested change to padding_bottom. + #[serde(rename="paddingBottomSuggested")] + pub padding_bottom_suggested: Option, + /// Indicates if there was a suggested change to content_alignment. + #[serde(rename="contentAlignmentSuggested")] + pub content_alignment_suggested: Option, + /// Indicates if there was a suggested change to padding_left. + #[serde(rename="paddingLeftSuggested")] + pub padding_left_suggested: Option, + /// Indicates if there was a suggested change to border_left. + #[serde(rename="borderLeftSuggested")] + pub border_left_suggested: Option, + /// Indicates if there was a suggested change to border_top. + #[serde(rename="borderTopSuggested")] + pub border_top_suggested: Option, + /// Indicates if there was a suggested change to column_span. + #[serde(rename="columnSpanSuggested")] + pub column_span_suggested: Option, + /// Indicates if there was a suggested change to padding_right. + #[serde(rename="paddingRightSuggested")] + pub padding_right_suggested: Option, + /// Indicates if there was a suggested change to background_color. + #[serde(rename="backgroundColorSuggested")] + pub background_color_suggested: Option, + /// Indicates if there was a suggested change to row_span. + #[serde(rename="rowSpanSuggested")] + pub row_span_suggested: Option, + /// Indicates if there was a suggested change to padding_top. + #[serde(rename="paddingTopSuggested")] + pub padding_top_suggested: Option, +} + +impl Part for TableCellStyleSuggestionState {} + + +/// The document body. +/// +/// The body typically contains the full document contents except for +/// headers, footers +/// and footnotes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Body { + /// The contents of the body. + /// + /// The indexes for the body's content begin at zero. + pub content: Option>, +} + +impl Part for Body {} + + +/// Request message for BatchUpdateDocument. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batch update documents](struct.DocumentBatchUpdateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchUpdateDocumentRequest { + /// A list of updates to apply to the document. + pub requests: Option>, + /// Provides control over how write requests are executed. + #[serde(rename="writeControl")] + pub write_control: Option, +} + +impl RequestValue for BatchUpdateDocumentRequest {} + + +/// A single response from an update. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Response { + /// The result of creating a named range. + #[serde(rename="createNamedRange")] + pub create_named_range: Option, + /// The result of inserting an inline Google Sheets chart. + #[serde(rename="insertInlineSheetsChart")] + pub insert_inline_sheets_chart: Option, + /// The result of replacing text. + #[serde(rename="replaceAllText")] + pub replace_all_text: Option, + /// The result of inserting an inline image. + #[serde(rename="insertInlineImage")] + pub insert_inline_image: Option, +} + +impl Part for Response {} + + +/// A mask that indicates which of the fields on the base DocumentStyle have been changed in this suggestion. +/// For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DocumentStyleSuggestionState { + /// Indicates if there was a suggested change to margin_bottom. + #[serde(rename="marginBottomSuggested")] + pub margin_bottom_suggested: Option, + /// Indicates if there was a suggested change to even_page_header_id. + #[serde(rename="evenPageHeaderIdSuggested")] + pub even_page_header_id_suggested: Option, + /// Indicates if there was a suggested change to first_page_header_id. + #[serde(rename="firstPageHeaderIdSuggested")] + pub first_page_header_id_suggested: Option, + /// Indicates if there was a suggested change to margin_right. + #[serde(rename="marginRightSuggested")] + pub margin_right_suggested: Option, + /// Indicates if there was a suggested change to page_number_start. + #[serde(rename="pageNumberStartSuggested")] + pub page_number_start_suggested: Option, + /// Indicates if there was a suggested change to default_header_id. + #[serde(rename="defaultHeaderIdSuggested")] + pub default_header_id_suggested: Option, + /// Indicates if there was a suggested change to default_footer_id. + #[serde(rename="defaultFooterIdSuggested")] + pub default_footer_id_suggested: Option, + /// Indicates if there was a suggested change to margin_left. + #[serde(rename="marginLeftSuggested")] + pub margin_left_suggested: Option, + /// Indicates if there was a suggested change to margin_top. + #[serde(rename="marginTopSuggested")] + pub margin_top_suggested: Option, + /// Indicates if there was a suggested change to first_page_footer_id. + #[serde(rename="firstPageFooterIdSuggested")] + pub first_page_footer_id_suggested: Option, + /// A mask that indicates which of the fields in size have been changed in this + /// suggestion. + #[serde(rename="pageSizeSuggestionState")] + pub page_size_suggestion_state: Option, + /// Indicates if there was a suggested change to use_first_page_header_footer. + #[serde(rename="useFirstPageHeaderFooterSuggested")] + pub use_first_page_header_footer_suggested: Option, + /// Indicates if there was a suggested change to even_page_footer_id. + #[serde(rename="evenPageFooterIdSuggested")] + pub even_page_footer_id_suggested: Option, + /// A mask that indicates which of the fields in background have been changed in this + /// suggestion. + #[serde(rename="backgroundSuggestionState")] + pub background_suggestion_state: Option, + /// Indicates if there was a suggested change to use_even_page_header_footer. + #[serde(rename="useEvenPageHeaderFooterSuggested")] + pub use_even_page_header_footer_suggested: Option, +} + +impl Part for DocumentStyleSuggestionState {} + + +/// A mask that indicates which of the fields on the base SheetsChartReference have been changed in this +/// suggestion. For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SheetsChartReferenceSuggestionState { + /// Indicates if there was a suggested change to spreadsheet_id. + #[serde(rename="spreadsheetIdSuggested")] + pub spreadsheet_id_suggested: Option, + /// Indicates if there was a suggested change to chart_id. + #[serde(rename="chartIdSuggested")] + pub chart_id_suggested: Option, +} + +impl Part for SheetsChartReferenceSuggestionState {} + + +/// Styles that apply to a table row. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableRowStyle { + /// The minimum height of the row. The row will be rendered in the Docs editor + /// at a height equal to or greater than this value in order to show all the + /// content in the row's cells. + #[serde(rename="minRowHeight")] + pub min_row_height: Option, +} + +impl Part for TableRowStyle {} + + +/// A border around a paragraph. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ParagraphBorder { + /// The color of the border. + pub color: Option, + /// The padding of the border. + pub padding: Option, + /// The dash style of the border. + #[serde(rename="dashStyle")] + pub dash_style: Option, + /// The width of the border. + pub width: Option, +} + +impl Part for ParagraphBorder {} + + +/// The result of inserting an embedded Google Sheets chart. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InsertInlineSheetsChartResponse { + /// The object ID of the inserted chart. + #[serde(rename="objectId")] + pub object_id: Option, +} + +impl Part for InsertInlineSheetsChartResponse {} + + +/// The positioning of a PositionedObject. The positioned object is positioned +/// relative to the beginning of the Paragraph +/// it is tethered to. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PositionedObjectPositioning { + /// The offset of the left edge of the positioned object relative to the + /// beginning of the Paragraph it is tethered + /// to. The exact positioning of the object can depend on other content in the + /// document and the document's styling. + #[serde(rename="leftOffset")] + pub left_offset: Option, + /// The offset of the top edge of the positioned object relative to the + /// beginning of the Paragraph it is tethered + /// to. The exact positioning of the object can depend on other content in the + /// document and the document's styling. + #[serde(rename="topOffset")] + pub top_offset: Option, + /// The layout of this positioned object. + pub layout: Option, +} + +impl Part for PositionedObjectPositioning {} + + +/// The style of a TableCell. +/// +/// Inherited table cell styles are represented as unset fields in this message. +/// A table cell style can inherit from the table's style. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableCellStyle { + /// The bottom padding of the cell. + #[serde(rename="paddingBottom")] + pub padding_bottom: Option, + /// The bottom border of the cell. + #[serde(rename="borderBottom")] + pub border_bottom: Option, + /// The top padding of the cell. + #[serde(rename="paddingTop")] + pub padding_top: Option, + /// The row span of the cell. This property is read-only. + #[serde(rename="rowSpan")] + pub row_span: Option, + /// The column span of the cell. This property is read-only. + #[serde(rename="columnSpan")] + pub column_span: Option, + /// The background color of the cell. + #[serde(rename="backgroundColor")] + pub background_color: Option, + /// The right border of the cell. + #[serde(rename="borderRight")] + pub border_right: Option, + /// The left padding of the cell. + #[serde(rename="paddingLeft")] + pub padding_left: Option, + /// The top border of the cell. + #[serde(rename="borderTop")] + pub border_top: Option, + /// The right padding of the cell. + #[serde(rename="paddingRight")] + pub padding_right: Option, + /// The left border of the cell. + #[serde(rename="borderLeft")] + pub border_left: Option, + /// The alignment of the content in the table cell. The default alignment + /// matches the alignment for newly created table cells in the Docs editor. + #[serde(rename="contentAlignment")] + pub content_alignment: Option, +} + +impl Part for TableCellStyle {} + + +/// A ParagraphElement representing a +/// horizontal line. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HorizontalRule { + /// The text style of this HorizontalRule. + /// + /// Similar to text content, like text runs and footnote references, the text + /// style of a horizontal rule can affect content layout as well as the styling + /// of text inserted adjacent to it. + #[serde(rename="textStyle")] + pub text_style: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested text style changes to this HorizontalRule, keyed by + /// suggestion ID. + #[serde(rename="suggestedTextStyleChanges")] + pub suggested_text_style_changes: Option>, + /// The suggested insertion IDs. A HorizontalRule may have multiple insertion IDs if it + /// is a nested suggested change. If empty, then this is not a suggested + /// insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for HorizontalRule {} + + +/// Deletes a column from a table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteTableColumnRequest { + /// The reference table cell location from which the column will be deleted. + /// + /// The column this cell spans will be deleted. If this is a merged cell that + /// spans multiple columns, all columns that the cell spans will be deleted. If + /// no columns remain in the table after this deletion, the whole table is + /// deleted. + #[serde(rename="tableCellLocation")] + pub table_cell_location: Option, +} + +impl Part for DeleteTableColumnRequest {} + + +/// The shading of a paragraph. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Shading { + /// The background color of this paragraph shading. + #[serde(rename="backgroundColor")] + pub background_color: Option, +} + +impl Part for Shading {} + + +/// A StructuralElement describes content that provides structure to the +/// document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StructuralElement { + /// The zero-based end index of this structural element, exclusive, in UTF-16 + /// code units. + #[serde(rename="endIndex")] + pub end_index: Option, + /// A section break type of structural element. + #[serde(rename="sectionBreak")] + pub section_break: Option, + /// A paragraph type of structural element. + pub paragraph: Option, + /// A table type of structural element. + pub table: Option
, + /// The zero-based start index of this structural element, in UTF-16 code + /// units. + #[serde(rename="startIndex")] + pub start_index: Option, + /// A table of contents type of structural element. + #[serde(rename="tableOfContents")] + pub table_of_contents: Option, +} + +impl Part for StructuralElement {} + + +/// Inserts an empty row into a table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InsertTableRowRequest { + /// The reference table cell location from which rows will be inserted. + /// + /// A new row will be inserted above (or below) the row where the reference + /// cell is. If the reference cell is a merged cell, a new row will be + /// inserted above (or below) the merged cell. + #[serde(rename="tableCellLocation")] + pub table_cell_location: Option, + /// Whether to insert new row below the reference cell location. + /// + /// - `True`: insert below the cell. + /// - `False`: insert above the cell. + #[serde(rename="insertBelow")] + pub insert_below: Option, +} + +impl Part for InsertTableRowRequest {} + + +/// A collection of all the NamedRanges in the +/// document that share a given name. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NamedRanges { + /// The NamedRanges that share the same name. + #[serde(rename="namedRanges")] + pub named_ranges: Option>, + /// The name that all the named ranges share. + pub name: Option, +} + +impl Part for NamedRanges {} + + +/// A suggested change to a TableCellStyle. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuggestedTableCellStyle { + /// A TableCellStyle that only includes + /// the changes made in this suggestion. This can be used along with the + /// table_cell_style_suggestion_state + /// to see which fields have changed and their new values. + #[serde(rename="tableCellStyle")] + pub table_cell_style: Option, + /// A mask that indicates which of the fields on the base TableCellStyle have been changed in this suggestion. + #[serde(rename="tableCellStyleSuggestionState")] + pub table_cell_style_suggestion_state: Option, +} + +impl Part for SuggestedTableCellStyle {} + + +/// A ParagraphElement representing a +/// page break. A page break makes the subsequent text start at the top of the +/// next page. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PageBreak { + /// The text style of this PageBreak. + /// + /// Similar to text content, like text runs and footnote references, the text + /// style of a page break can affect content layout as well as the styling of + /// text inserted adjacent to it. + #[serde(rename="textStyle")] + pub text_style: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested text style changes to this PageBreak, keyed by suggestion ID. + #[serde(rename="suggestedTextStyleChanges")] + pub suggested_text_style_changes: Option>, + /// The suggested insertion IDs. A PageBreak + /// may have multiple insertion IDs if it is a nested suggested change. If + /// empty, then this is not a suggested insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for PageBreak {} + + +/// A mask that indicates which of the fields on the base ListProperties have been changed in this suggestion. +/// For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListPropertiesSuggestionState { + /// A mask that indicates which of the fields on the corresponding + /// NestingLevel in nesting_levels have been changed in + /// this suggestion. + /// + /// The nesting level suggestion states are returned in ascending order of the + /// nesting level with the least nested returned first. + #[serde(rename="nestingLevelsSuggestionStates")] + pub nesting_levels_suggestion_states: Option>, +} + +impl Part for ListPropertiesSuggestionState {} + + +/// A StructuralElement representing a +/// section break. A section is a range of content which has the same +/// SectionStyle. A section break represents +/// the start of a new section, and the section style applies to the section +/// after the section break. +/// +/// The document body always begins with a section break. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SectionBreak { + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The style of the section after this section break. + #[serde(rename="sectionStyle")] + pub section_style: Option, + /// The suggested insertion IDs. A SectionBreak may have multiple insertion IDs if it is + /// a nested suggested change. If empty, then this is not a suggested + /// insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for SectionBreak {} + + +/// Represents the background of a document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Background { + /// The background color. + pub color: Option, +} + +impl Part for Background {} + + +/// Describes the bullet of a paragraph. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Bullet { + /// The nesting level of this paragraph in the list. + #[serde(rename="nestingLevel")] + pub nesting_level: Option, + /// The ID of the list this paragraph belongs to. + #[serde(rename="listId")] + pub list_id: Option, + /// The paragraph specific text style applied to this bullet. + #[serde(rename="textStyle")] + pub text_style: Option, +} + +impl Part for Bullet {} + + +/// A document footer. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Footer { + /// The contents of the footer. + /// + /// The indexes for a footer's content begin at zero. + pub content: Option>, + /// The ID of the footer. + #[serde(rename="footerId")] + pub footer_id: Option, +} + +impl Part for Footer {} + + +/// Deletes a NamedRange. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteNamedRangeRequest { + /// The ID of the named range to delete. + #[serde(rename="namedRangeId")] + pub named_range_id: Option, + /// The name of the range(s) to delete. All named ranges with the given + /// name will be deleted. + pub name: Option, +} + +impl Part for DeleteNamedRangeRequest {} + + +/// An object that appears inline with text. An InlineObject contains +/// an EmbeddedObject such as an image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InlineObject { + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The properties of this inline object. + #[serde(rename="inlineObjectProperties")] + pub inline_object_properties: Option, + /// The suggested changes to the inline object properties, keyed by suggestion + /// ID. + #[serde(rename="suggestedInlineObjectPropertiesChanges")] + pub suggested_inline_object_properties_changes: Option>, + /// The ID of this inline object. + #[serde(rename="objectId")] + pub object_id: Option, + /// The suggested insertion ID. If empty, then this is not a suggested + /// insertion. + #[serde(rename="suggestedInsertionId")] + pub suggested_insertion_id: Option, +} + +impl Part for InlineObject {} + + +/// A mask that indicates which of the fields on the base NestingLevel have been changed in this suggestion. For +/// any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NestingLevelSuggestionState { + /// A mask that indicates which of the fields in text style have been changed in this + /// suggestion. + #[serde(rename="textStyleSuggestionState")] + pub text_style_suggestion_state: Option, + /// Indicates if there was a suggested change to + /// glyph_format. + #[serde(rename="glyphFormatSuggested")] + pub glyph_format_suggested: Option, + /// Indicates if there was a suggested change to + /// indent_start. + #[serde(rename="indentStartSuggested")] + pub indent_start_suggested: Option, + /// Indicates if there was a suggested change to + /// start_number. + #[serde(rename="startNumberSuggested")] + pub start_number_suggested: Option, + /// Indicates if there was a suggested change to + /// glyph_type. + #[serde(rename="glyphTypeSuggested")] + pub glyph_type_suggested: Option, + /// Indicates if there was a suggested change to + /// indent_first_line. + #[serde(rename="indentFirstLineSuggested")] + pub indent_first_line_suggested: Option, + /// Indicates if there was a suggested change to + /// glyph_symbol. + #[serde(rename="glyphSymbolSuggested")] + pub glyph_symbol_suggested: Option, + /// Indicates if there was a suggested change to + /// bullet_alignment. + #[serde(rename="bulletAlignmentSuggested")] + pub bullet_alignment_suggested: Option, +} + +impl Part for NestingLevelSuggestionState {} + + +/// A suggested change to a +/// ParagraphStyle. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuggestedParagraphStyle { + /// A mask that indicates which of the fields on the base ParagraphStyle have been changed in this suggestion. + #[serde(rename="paragraphStyleSuggestionState")] + pub paragraph_style_suggestion_state: Option, + /// A ParagraphStyle that only includes + /// the changes made in this suggestion. This can be used along with the + /// paragraph_suggestion_state + /// to see which fields have changed and their new values. + #[serde(rename="paragraphStyle")] + pub paragraph_style: Option, +} + +impl Part for SuggestedParagraphStyle {} + + +/// A StructuralElement representing a +/// paragraph. A paragraph is a range of content that is terminated with a +/// newline character. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Paragraph { + /// The content of the paragraph broken down into its component parts. + pub elements: Option>, + /// The IDs of the positioned objects that are suggested to be attached to this + /// paragraph, keyed by suggestion ID. + #[serde(rename="suggestedPositionedObjectIds")] + pub suggested_positioned_object_ids: Option>, + /// The bullet for this paragraph. If not present, the paragraph does not + /// belong to a list. + pub bullet: Option, + /// The suggested changes to this paragraph's bullet. + #[serde(rename="suggestedBulletChanges")] + pub suggested_bullet_changes: Option>, + /// The IDs of the positioned objects tethered to this paragraph. + #[serde(rename="positionedObjectIds")] + pub positioned_object_ids: Option>, + /// The suggested paragraph style changes to this paragraph, keyed by + /// suggestion ID. + #[serde(rename="suggestedParagraphStyleChanges")] + pub suggested_paragraph_style_changes: Option>, + /// The style of this paragraph. + #[serde(rename="paragraphStyle")] + pub paragraph_style: Option, +} + +impl Part for Paragraph {} + + +/// A named style. Paragraphs in the document can inherit their +/// TextStyle and +/// ParagraphStyle from this named style +/// when they have the same named style type. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NamedStyle { + /// The text style of this named style. + #[serde(rename="textStyle")] + pub text_style: Option, + /// The type of this named style. + #[serde(rename="namedStyleType")] + pub named_style_type: Option, + /// The paragraph style of this named style. + #[serde(rename="paragraphStyle")] + pub paragraph_style: Option, +} + +impl Part for NamedStyle {} + + +/// A mask that indicates which of the fields on the base TableRowStyle have been changed in this suggestion. +/// For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableRowStyleSuggestionState { + /// Indicates if there was a suggested change to min_row_height. + #[serde(rename="minRowHeightSuggested")] + pub min_row_height_suggested: Option, +} + +impl Part for TableRowStyleSuggestionState {} + + +/// A reference to the external linked source content. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LinkedContentReference { + /// A reference to the linked chart. + #[serde(rename="sheetsChartReference")] + pub sheets_chart_reference: Option, +} + +impl Part for LinkedContentReference {} + + +/// Location of a single cell within a table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableCellLocation { + /// The zero-based row index. For example, the second row in the table has a + /// row index of 1. + #[serde(rename="rowIndex")] + pub row_index: Option, + /// The zero-based column index. For example, the second column in the table + /// has a column index of 1. + #[serde(rename="columnIndex")] + pub column_index: Option, + /// The location where the table starts in the document. + #[serde(rename="tableStartLocation")] + pub table_start_location: Option, +} + +impl Part for TableCellLocation {} + + +/// A collection of Ranges with the same named range +/// ID. +/// +/// Named ranges allow developers to associate parts of a document with an +/// arbitrary user-defined label so their contents can be programmatically read +/// or edited at a later time. A document can contain multiple named ranges with +/// the same name, but every named range has a unique ID. +/// +/// A named range is created with a single Range, +/// and content inserted inside a named range generally expands that range. +/// However, certain document changes can cause the range to be split into +/// multiple ranges. +/// +/// Named ranges are not private. All applications and collaborators that have +/// access to the document can see its named ranges. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NamedRange { + /// The ranges that belong to this named range. + pub ranges: Option>, + /// The ID of the named range. + #[serde(rename="namedRangeId")] + pub named_range_id: Option, + /// The name of the named range. + pub name: Option, +} + +impl Part for NamedRange {} + + +/// The named styles. Paragraphs in the document can inherit their +/// TextStyle and +/// ParagraphStyle from these named styles. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NamedStyles { + /// The named styles. + /// + /// There is an entry for each of the possible named style types. + pub styles: Option>, +} + +impl Part for NamedStyles {} + + +/// The styling that applies to a section. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SectionStyle { + /// The style of column separators. + /// + /// This style can be set even when there is one column in the section. + #[serde(rename="columnSeparatorStyle")] + pub column_separator_style: Option, + /// The section's columns properties. + /// + /// If empty, the section contains one column with the default properties in + /// the Docs editor. + #[serde(rename="columnProperties")] + pub column_properties: Option>, + /// The content direction of this section. If unset, the value defaults to + /// LEFT_TO_RIGHT. + #[serde(rename="contentDirection")] + pub content_direction: Option, +} + +impl Part for SectionStyle {} + + +/// A mask that indicates which of the fields on the base +/// Bullet have been changed in this suggestion. +/// For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BulletSuggestionState { + /// Indicates if there was a suggested change to the + /// nesting_level. + #[serde(rename="nestingLevelSuggested")] + pub nesting_level_suggested: Option, + /// A mask that indicates which of the fields in text style have been changed in this + /// suggestion. + #[serde(rename="textStyleSuggestionState")] + pub text_style_suggestion_state: Option, + /// Indicates if there was a suggested change to the + /// list_id. + #[serde(rename="listIdSuggested")] + pub list_id_suggested: Option, +} + +impl Part for BulletSuggestionState {} + + +/// The properties of an embedded drawing. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EmbeddedDrawingProperties { _never_set: Option } + +impl Part for EmbeddedDrawingProperties {} + + +/// A mask that indicates which of the fields on the base EmbeddedObject have been changed in this suggestion. +/// For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EmbeddedObjectSuggestionState { + /// A mask that indicates which of the fields in linked_content_reference have been + /// changed in this suggestion. + #[serde(rename="linkedContentReferenceSuggestionState")] + pub linked_content_reference_suggestion_state: Option, + /// A mask that indicates which of the fields in size have been changed in this + /// suggestion. + #[serde(rename="sizeSuggestionState")] + pub size_suggestion_state: Option, + /// A mask that indicates which of the fields in embedded_drawing_properties have been + /// changed in this suggestion. + #[serde(rename="embeddedDrawingPropertiesSuggestionState")] + pub embedded_drawing_properties_suggestion_state: Option, + /// Indicates if there was a suggested change to margin_right. + #[serde(rename="marginRightSuggested")] + pub margin_right_suggested: Option, + /// A mask that indicates which of the fields in image_properties have been changed in + /// this suggestion. + #[serde(rename="imagePropertiesSuggestionState")] + pub image_properties_suggestion_state: Option, + /// Indicates if there was a suggested change to description. + #[serde(rename="descriptionSuggested")] + pub description_suggested: Option, + /// Indicates if there was a suggested change to margin_left. + #[serde(rename="marginLeftSuggested")] + pub margin_left_suggested: Option, + /// Indicates if there was a suggested change to margin_top. + #[serde(rename="marginTopSuggested")] + pub margin_top_suggested: Option, + /// Indicates if there was a suggested change to margin_bottom. + #[serde(rename="marginBottomSuggested")] + pub margin_bottom_suggested: Option, + /// Indicates if there was a suggested change to title. + #[serde(rename="titleSuggested")] + pub title_suggested: Option, + /// A mask that indicates which of the fields in embedded_object_border have been + /// changed in this suggestion. + #[serde(rename="embeddedObjectBorderSuggestionState")] + pub embedded_object_border_suggestion_state: Option, +} + +impl Part for EmbeddedObjectSuggestionState {} + + +/// The result of replacing text. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReplaceAllTextResponse { + /// The number of occurrences changed by replacing all text. + #[serde(rename="occurrencesChanged")] + pub occurrences_changed: Option, +} + +impl Part for ReplaceAllTextResponse {} + + +/// A document footnote. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Footnote { + /// The contents of the footnote. + /// + /// The indexes for a footnote's content begin at zero. + pub content: Option>, + /// The ID of the footnote. + #[serde(rename="footnoteId")] + pub footnote_id: Option, +} + +impl Part for Footnote {} + + +/// Inserts a table at the specified location. +/// +/// A newline character will be inserted before the inserted table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InsertTableRequest { + /// Inserts the table at the end of the given header, footer or document + /// body. A newline character will be inserted before the inserted table. + /// + /// Tables cannot be inserted inside a footnote. + #[serde(rename="endOfSegmentLocation")] + pub end_of_segment_location: Option, + /// The number of rows in the table. + pub rows: Option, + /// Inserts the table at a specific model index. + /// + /// A newline character will be inserted before the inserted table, therefore + /// the table start index will be at the specified location index + 1. + /// + /// The table must be inserted inside the bounds of an existing + /// Paragraph. For instance, it cannot be + /// inserted at a table's start index (i.e. between an existing table and its + /// preceding paragraph). + /// + /// Tables cannot be inserted inside a footnote or equation. + pub location: Option, + /// The number of columns in the table. + pub columns: Option, +} + +impl Part for InsertTableRequest {} + + +/// A solid color. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Color { + /// The RGB color value. + #[serde(rename="rgbColor")] + pub rgb_color: Option, +} + +impl Part for Color {} + + +/// The style of the document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DocumentStyle { + /// The ID of the default footer. If not set, there is no default footer. + #[serde(rename="defaultFooterId")] + pub default_footer_id: Option, + /// The ID of the footer used only for even pages. The value of + /// use_even_page_header_footer determines + /// whether to use the default_footer_id or this value for the + /// footer on even pages. If not set, there is no even page footer. + #[serde(rename="evenPageFooterId")] + pub even_page_footer_id: Option, + /// The ID of the footer used only for the first page. If not set then + /// a unique footer for the first page does not exist. The value of + /// use_first_page_header_footer determines + /// whether to use the default_footer_id or this value for the + /// footer on the first page. If not set, there is no first page footer. + #[serde(rename="firstPageFooterId")] + pub first_page_footer_id: Option, + /// The size of a page in the document. + #[serde(rename="pageSize")] + pub page_size: Option, + /// The ID of the default header. If not set, there is no default header. + #[serde(rename="defaultHeaderId")] + pub default_header_id: Option, + /// The bottom page margin. + #[serde(rename="marginBottom")] + pub margin_bottom: Option, + /// The ID of the header used only for the first page. If not set then + /// a unique header for the first page does not exist. + /// The value of use_first_page_header_footer determines + /// whether to use the default_header_id or this value for the + /// header on the first page. If not set, there is no first page header. + #[serde(rename="firstPageHeaderId")] + pub first_page_header_id: Option, + /// The ID of the header used only for even pages. The value of + /// use_even_page_header_footer determines + /// whether to use the default_header_id or this value for the + /// header on even pages. If not set, there is no even page header. + #[serde(rename="evenPageHeaderId")] + pub even_page_header_id: Option, + /// Indicates whether to use the first page header / footer IDs for the first + /// page. + #[serde(rename="useFirstPageHeaderFooter")] + pub use_first_page_header_footer: Option, + /// The left page margin. + #[serde(rename="marginLeft")] + pub margin_left: Option, + /// Indicates whether to use the even page header / footer IDs for the even + /// pages. + #[serde(rename="useEvenPageHeaderFooter")] + pub use_even_page_header_footer: Option, + /// The background of the document. + pub background: Option, + /// The right page margin. + #[serde(rename="marginRight")] + pub margin_right: Option, + /// The page number from which to start counting the number of pages. + #[serde(rename="pageNumberStart")] + pub page_number_start: Option, + /// The top page margin. + #[serde(rename="marginTop")] + pub margin_top: Option, +} + +impl Part for DocumentStyle {} + + +/// A ParagraphElement representing a +/// spot in the text that is dynamically replaced with content that can change +/// over time, like a page number. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AutoText { + /// The text style of this AutoText. + #[serde(rename="textStyle")] + pub text_style: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested text style changes to this AutoText, keyed by suggestion ID. + #[serde(rename="suggestedTextStyleChanges")] + pub suggested_text_style_changes: Option>, + /// The type of this auto text. + #[serde(rename="type")] + pub type_: Option, + /// The suggested insertion IDs. An AutoText + /// may have multiple insertion IDs if it is a nested suggested change. If + /// empty, then this is not a suggested insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for AutoText {} + + +/// Properties of a PositionedObject. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PositionedObjectProperties { + /// The positioning of this positioned object relative to the newline of the + /// Paragraph that references this positioned + /// object. + pub positioning: Option, + /// The embedded object of this positioned object. + #[serde(rename="embeddedObject")] + pub embedded_object: Option, +} + +impl Part for PositionedObjectProperties {} + + +/// Styles that apply to a whole paragraph. +/// +/// Inherited paragraph styles are represented as unset fields in this message. +/// A paragraph style's parent depends on where the paragraph style is defined: +/// +/// * The ParagraphStyle on a Paragraph +/// inherits from the paragraph's corresponding named style type. +/// * The ParagraphStyle on a named style +/// inherits from the normal text named style. +/// * The ParagraphStyle of the normal text named style inherits +/// from the default paragraph style in the Docs editor. +/// * The ParagraphStyle on a Paragraph +/// element that is contained in a table may inherit its paragraph style from +/// the table style. +/// +/// If the paragraph style does not inherit from a parent, unsetting fields will +/// revert the style to a value matching the defaults in the Docs editor. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ParagraphStyle { + /// The spacing mode for the paragraph. + #[serde(rename="spacingMode")] + pub spacing_mode: Option, + /// The text direction of this paragraph. If unset, the value defaults to + /// LEFT_TO_RIGHT since + /// paragraph direction is not inherited. + pub direction: Option, + /// Whether at least a part of this paragraph should be laid out on the same + /// page or column as the next paragraph if possible. If unset, the value is + /// inherited from the parent. + #[serde(rename="keepWithNext")] + pub keep_with_next: Option, + /// The amount of space between lines, as a percentage of normal, where normal + /// is represented as 100.0. If unset, the value is inherited from the parent. + #[serde(rename="lineSpacing")] + pub line_spacing: Option, + /// The amount of indentation for the paragraph on the side that corresponds to + /// the start of the text, based on the current paragraph direction. If unset, + /// the value is inherited from the parent. + #[serde(rename="indentStart")] + pub indent_start: Option, + /// The border at the bottom of this paragraph. If unset, the value is + /// inherited from the parent. + /// + /// The bottom border is rendered when the paragraph below has different border + /// and indent properties. + /// + /// Paragraph borders cannot be partially updated. When making + /// changes to a paragraph border the new border must be specified in + /// its entirety. + #[serde(rename="borderBottom")] + pub border_bottom: Option, + /// The border to the right of this paragraph. If unset, the value is inherited + /// from the parent. + /// + /// Paragraph borders cannot be partially updated. When making + /// changes to a paragraph border the new border must be specified in + /// its entirety. + #[serde(rename="borderRight")] + pub border_right: Option, + /// The border to the left of this paragraph. If unset, the value is inherited + /// from the parent. + /// + /// Paragraph borders cannot be partially updated. When making + /// changes to a paragraph border the new border must be specified in + /// its entirety. + #[serde(rename="borderLeft")] + pub border_left: Option, + /// The heading ID of the paragraph. If empty, then this paragraph is not a + /// heading. This property is read-only. + #[serde(rename="headingId")] + pub heading_id: Option, + /// The shading of the paragraph. If unset, the value is inherited from the + /// parent. + pub shading: Option, + /// The border at the top of this paragraph. If unset, the value is inherited + /// from the parent. + /// + /// The top border is rendered when the paragraph above has different border + /// and indent properties. + /// + /// Paragraph borders cannot be partially updated. When making + /// changes to a paragraph border the new border must be specified in + /// its entirety. + #[serde(rename="borderTop")] + pub border_top: Option, + /// A list of the tab stops for this paragraph. The list of tab stops is not + /// inherited. This property is read-only. + #[serde(rename="tabStops")] + pub tab_stops: Option>, + /// The amount of indentation for the first line of the paragraph. If unset, + /// the value is inherited from the parent. + #[serde(rename="indentFirstLine")] + pub indent_first_line: Option, + /// The text alignment for this paragraph. + pub alignment: Option, + /// The amount of extra space below the paragraph. If unset, the value is + /// inherited from the parent. + #[serde(rename="spaceBelow")] + pub space_below: Option, + /// Whether to avoid widows and orphans for the paragraph. If unset, the value + /// is inherited from the parent. + #[serde(rename="avoidWidowAndOrphan")] + pub avoid_widow_and_orphan: Option, + /// The border between this paragraph and the next and previous paragraphs. + /// If unset, the value is inherited from the parent. + /// + /// The between border is rendered when the adjacent paragraph has the same + /// border and indent properties. + /// + /// Paragraph borders cannot be partially updated. When making + /// changes to a paragraph border the new border must be specified in + /// its entirety. + #[serde(rename="borderBetween")] + pub border_between: Option, + /// The amount of extra space above the paragraph. If unset, the value is + /// inherited from the parent. + #[serde(rename="spaceAbove")] + pub space_above: Option, + /// The amount of indentation for the paragraph on the side that corresponds to + /// the end of the text, based on the current paragraph direction. If unset, + /// the value is inherited from the parent. + #[serde(rename="indentEnd")] + pub indent_end: Option, + /// The named style type of the paragraph. + /// + /// Since updating the named style type affects other properties within + /// ParagraphStyle, the named style type is applied before the other properties + /// are updated. + #[serde(rename="namedStyleType")] + pub named_style_type: Option, + /// Whether all lines of the paragraph should be laid out on the same page or + /// column if possible. If unset, the value is inherited from the parent. + #[serde(rename="keepLinesTogether")] + pub keep_lines_together: Option, +} + +impl Part for ParagraphStyle {} + + +/// A ParagraphElement that contains +/// an InlineObject. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InlineObjectElement { + /// The text style of this InlineObjectElement. + /// + /// Similar to text content, like text runs and footnote references, the text + /// style of an inline object element can affect content layout as well as the + /// styling of text inserted adjacent to it. + #[serde(rename="textStyle")] + pub text_style: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The ID of the InlineObject this + /// element contains. + #[serde(rename="inlineObjectId")] + pub inline_object_id: Option, + /// The suggested text style changes to this InlineObject, keyed by suggestion + /// ID. + #[serde(rename="suggestedTextStyleChanges")] + pub suggested_text_style_changes: Option>, + /// The suggested insertion IDs. An InlineObjectElement may have multiple insertion IDs + /// if it is a nested suggested change. If empty, then this is not a suggested + /// insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for InlineObjectElement {} + + +/// A mask that indicates which of the fields on the base Background have been changed in this suggestion. +/// For any field set to true, the Backgound has a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BackgroundSuggestionState { + /// Indicates whether the current background color has been modified in this + /// suggestion. + #[serde(rename="backgroundColorSuggested")] + pub background_color_suggested: Option, +} + +impl Part for BackgroundSuggestionState {} + + +/// A mask that indicates which of the fields on the base Shading have been changed in this +/// suggested change. For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ShadingSuggestionState { + /// Indicates if there was a suggested change to the Shading. + #[serde(rename="backgroundColorSuggested")] + pub background_color_suggested: Option, +} + +impl Part for ShadingSuggestionState {} + + +/// Inserts text at the specified location. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InsertTextRequest { + /// The text to be inserted. + /// + /// Inserting a newline character will implicitly create a new + /// Paragraph at that index. + /// The paragraph style of the new paragraph will be copied from the paragraph + /// at the current insertion index, including lists and bullets. + /// + /// Text styles for inserted text will be determined automatically, generally + /// preserving the styling of neighboring text. In most cases, the text style + /// for the inserted text will match the text immediately before the insertion + /// index. + /// + /// Some control characters (U+0000-U+0008, U+000C-U+001F) and characters + /// from the Unicode Basic Multilingual Plane Private Use Area (U+E000-U+F8FF) + /// will be stripped out of the inserted text. + pub text: Option, + /// Inserts the text at the end of a header, footer, footnote or + /// the document body. + #[serde(rename="endOfSegmentLocation")] + pub end_of_segment_location: Option, + /// Inserts the text at a specific index in the document. + /// + /// Text must be inserted inside the bounds of an existing + /// Paragraph. For instance, text cannot be + /// inserted at a table's start index (i.e. between the table and its + /// preceding paragraph). The text must be inserted in the preceding + /// paragraph. + pub location: Option, +} + +impl Part for InsertTextRequest {} + + +/// Represents the styling that can be applied to text. +/// +/// Inherited text styles are represented as unset fields in this message. A +/// text style's parent depends on where the text style is defined: +/// +/// * The TextStyle of text in a Paragraph +/// inherits from the paragraph's corresponding named style type. +/// * The TextStyle on a named style +/// inherits from the normal text named style. +/// * The TextStyle of the normal text named style inherits +/// from the default text style in the Docs editor. +/// * The TextStyle on a Paragraph element +/// that is contained in a table may inherit its text style from the table +/// style. +/// +/// If the text style does not inherit from a parent, unsetting fields will +/// revert the style to a value matching the defaults in the Docs editor. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TextStyle { + /// The foreground color of the text. If set, the color is either an RGB color + /// or transparent, depending on the `color` field. + #[serde(rename="foregroundColor")] + pub foreground_color: Option, + /// Whether or not the text is rendered as bold. + pub bold: Option, + /// The text's vertical offset from its normal position. + /// + /// Text with `SUPERSCRIPT` or `SUBSCRIPT` baseline offsets is automatically + /// rendered in a smaller font size, computed based on the `font_size` field. + /// The `font_size` itself is not affected by changes in this field. + #[serde(rename="baselineOffset")] + pub baseline_offset: Option, + /// Whether or not the text is struck through. + pub strikethrough: Option, + /// The font family and rendered weight of the text. + /// + /// If an update request specifies values for both `weighted_font_family` and + /// `bold`, the `weighted_font_family` is applied first, then `bold`. + /// + /// If `weighted_font_family#weight` is not set, it defaults to `400`. + /// + /// If `weighted_font_family` is set, then `weighted_font_family#font_family` + /// must also be set with a non-empty value. Otherwise, a 400 bad request error + /// is returned. + #[serde(rename="weightedFontFamily")] + pub weighted_font_family: Option, + /// Whether or not the text is in small capital letters. + #[serde(rename="smallCaps")] + pub small_caps: Option, + /// The size of the text's font. + #[serde(rename="fontSize")] + pub font_size: Option, + /// Whether or not the text is italicized. + pub italic: Option, + /// The hyperlink destination of the text. If unset, there is no link. Links + /// are not inherited from parent text. + /// + /// Changing the link in an update request causes some other changes to the + /// text style of the range: + /// + /// * When setting a link, the text foreground color will be updated to the + /// default link color and the text will be underlined. If these fields are + /// modified in the same request, those values will be used instead of the + /// link defaults. + /// * Setting a link on a text range that overlaps with an existing link will + /// also update the existing link to point to the new URL. + /// * Links are not settable on newline characters. As a result, setting a link + /// on a text range that crosses a paragraph boundary, such as `"ABC\n123"`, + /// will separate the newline character(s) into their own text runs. The + /// link will be applied separately to the runs before and after the newline. + /// * Removing a link will update the text style of the range to match the + /// style of the preceding text (or the default text styles if the preceding + /// text is another link) unless different styles are being set in the same + /// request. + pub link: Option, + /// Whether or not the text is underlined. + pub underline: Option, + /// The background color of the text. If set, the color is either an RGB color + /// or transparent, depending on the `color` field. + #[serde(rename="backgroundColor")] + pub background_color: Option, +} + +impl Part for TextStyle {} + + +/// The properties of a column in a table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableColumnProperties { + /// The width of the column. Set when the column's `width_type` is + /// FIXED_WIDTH. + pub width: Option, + /// The width type of the column. + #[serde(rename="widthType")] + pub width_type: Option, +} + +impl Part for TableColumnProperties {} + + +/// A mask that indicates which of the fields on the base Size have been changed in this suggestion. +/// For any field set to true, the Size has +/// a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SizeSuggestionState { + /// Indicates if there was a suggested change to width. + #[serde(rename="widthSuggested")] + pub width_suggested: Option, + /// Indicates if there was a suggested change to height. + #[serde(rename="heightSuggested")] + pub height_suggested: Option, +} + +impl Part for SizeSuggestionState {} + + +/// Creates a NamedRange referencing the given +/// range. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateNamedRangeRequest { + /// The range to apply the name to. + pub range: Option, + /// The name of the NamedRange. Names do not need to be unique. + /// + /// Names must be at least 1 character and no more than 256 characters, + /// measured in UTF-16 code units. + pub name: Option, +} + +impl Part for CreateNamedRangeRequest {} + + +/// A collection of object IDs. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ObjectReferences { + /// The object IDs. + #[serde(rename="objectIds")] + pub object_ids: Option>, +} + +impl Part for ObjectReferences {} + + +/// Properties of an InlineObject. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InlineObjectProperties { + /// The embedded object of this inline object. + #[serde(rename="embeddedObject")] + pub embedded_object: Option, +} + +impl Part for InlineObjectProperties {} + + +/// Inserts a page break followed by a newline at the specified location. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InsertPageBreakRequest { + /// Inserts the page break at the end of the document body. + /// + /// Page breaks cannot be inserted inside a footnote, header or footer. + /// Since page breaks can only be inserted inside the body, the segment ID field must be + /// empty. + #[serde(rename="endOfSegmentLocation")] + pub end_of_segment_location: Option, + /// Inserts the page break at a specific index in the document. + /// + /// The page break must be inserted inside the bounds of an existing + /// Paragraph. For instance, it cannot be + /// inserted at a table's start index (i.e. between the table and its + /// preceding paragraph). + /// + /// Page breaks cannot be inserted inside a table, equation, footnote, header + /// or footer. Since page breaks can only be inserted inside the body, the + /// segment ID field must be + /// empty. + pub location: Option, +} + +impl Part for InsertPageBreakRequest {} + + +/// Properties that apply to a section's column. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SectionColumnProperties { + /// The width of the column. + pub width: Option, + /// The padding at the end of the column. + #[serde(rename="paddingEnd")] + pub padding_end: Option, +} + +impl Part for SectionColumnProperties {} + + +/// A particular location in the document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Location { + /// The zero-based index, in UTF-16 code units. + /// + /// The index is relative to the beginning of the segment specified by + /// segment_id. + pub index: Option, + /// The ID of the header, footer or footnote the location is in. An empty + /// segment ID signifies the document's body. + #[serde(rename="segmentId")] + pub segment_id: Option, +} + +impl Part for Location {} + + +/// A criteria that matches a specific string of text in the document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SubstringMatchCriteria { + /// The text to search for in the document. + pub text: Option, + /// Indicates whether the search should respect case: + /// + /// - `True`: the search is case sensitive. + /// - `False`: the search is case insensitive. + #[serde(rename="matchCase")] + pub match_case: Option, +} + +impl Part for SubstringMatchCriteria {} + + +/// Provides control over how write requests are executed. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WriteControl { + /// The revision ID of the + /// document that the write request will be applied to. If this is not the + /// latest revision of the document, the request will not be processed and + /// will return a 400 bad request error. + /// + /// When a required revision ID is returned in a response, it indicates the + /// revision ID of the document after the request was applied. + #[serde(rename="requiredRevisionId")] + pub required_revision_id: Option, + /// The target revision ID of the + /// document that the write request will be applied to. + /// + /// If collaborator changes have occurred after the document was read using + /// the API, the changes produced by this write request will be transformed + /// against the collaborator changes. This results in a new revision of the + /// document which incorporates both the changes in the request and the + /// collaborator changes, and the Docs server will resolve conflicting + /// changes. When using `target_revision_id`, the API client can be thought + /// of as another collaborator of the document. + /// + /// The target revision ID may only be used to write to recent versions of a + /// document. If the target revision is too far behind the latest revision, + /// the request will not be processed and will return a 400 bad request error + /// and the request should be retried after reading the latest version of the + /// document. In most cases a `revision_id` will remain valid for use as a + /// target revision for several minutes after it is read, but for + /// frequently-edited documents this window may be shorter. + #[serde(rename="targetRevisionId")] + pub target_revision_id: Option, +} + +impl Part for WriteControl {} + + +/// The contents and style of a cell in a Table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableCell { + /// The content of the cell. + pub content: Option>, + /// The zero-based end index of this cell, exclusive, in UTF-16 code units. + #[serde(rename="endIndex")] + pub end_index: Option, + /// The zero-based start index of this cell, in UTF-16 code units. + #[serde(rename="startIndex")] + pub start_index: Option, + /// The style of the cell. + #[serde(rename="tableCellStyle")] + pub table_cell_style: Option, + /// The suggested changes to the table cell style, keyed by suggestion ID. + #[serde(rename="suggestedTableCellStyleChanges")] + pub suggested_table_cell_style_changes: Option>, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested insertion IDs. A TableCell + /// may have multiple insertion IDs if it is a nested suggested change. If + /// empty, then this is not a suggested insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for TableCell {} + + +/// The properties of an image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImageProperties { + /// The transparency effect of the image. The value should be in the interval + /// [0.0, 1.0], where 0 means no effect and 1 means completely transparent. + pub transparency: Option, + /// The clockwise rotation angle of the image, in radians. + pub angle: Option, + /// A URI to the image with a default lifetime of 30 minutes. + /// This URI is tagged with the account of the requester. Anyone with the URI + /// effectively accesses the image as the original requester. Access to the + /// image may be lost if the document's sharing settings change. + #[serde(rename="contentUri")] + pub content_uri: Option, + /// The source URI is the URI used to insert the image. The source URI can be + /// empty. + #[serde(rename="sourceUri")] + pub source_uri: Option, + /// The brightness effect of the image. The value should be in the interval + /// [-1.0, 1.0], where 0 means no effect. + pub brightness: Option, + /// The crop properties of the image. + /// + /// After cropping, the image will be stretched to fit in its container. + #[serde(rename="cropProperties")] + pub crop_properties: Option, + /// The contrast effect of the image. The value should be in the interval + /// [-1.0, 1.0], where 0 means no effect. + pub contrast: Option, +} + +impl Part for ImageProperties {} + + +/// A document header. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Header { + /// The contents of the header. + /// + /// The indexes for a header's content begin at zero. + pub content: Option>, + /// The ID of the header. + #[serde(rename="headerId")] + pub header_id: Option, +} + +impl Part for Header {} + + +/// A mask that indicates which of the fields on the base ParagraphStyle have been changed in this suggestion. +/// For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ParagraphStyleSuggestionState { + /// Indicates if there was a suggested change to avoid_widow_and_orphan. + #[serde(rename="avoidWidowAndOrphanSuggested")] + pub avoid_widow_and_orphan_suggested: Option, + /// Indicates if there was a suggested change to border_bottom. + #[serde(rename="borderBottomSuggested")] + pub border_bottom_suggested: Option, + /// Indicates if there was a suggested change to named_style_type. + #[serde(rename="namedStyleTypeSuggested")] + pub named_style_type_suggested: Option, + /// Indicates if there was a suggested change to border_between. + #[serde(rename="borderBetweenSuggested")] + pub border_between_suggested: Option, + /// Indicates if there was a suggested change to border_top. + #[serde(rename="borderTopSuggested")] + pub border_top_suggested: Option, + /// Indicates if there was a suggested change to keep_with_next. + #[serde(rename="keepWithNextSuggested")] + pub keep_with_next_suggested: Option, + /// Indicates if there was a suggested change to space_above. + #[serde(rename="spaceAboveSuggested")] + pub space_above_suggested: Option, + /// Indicates if there was a suggested change to alignment. + #[serde(rename="alignmentSuggested")] + pub alignment_suggested: Option, + /// Indicates if there was a suggested change to indent_end. + #[serde(rename="indentEndSuggested")] + pub indent_end_suggested: Option, + /// Indicates if there was a suggested change to direction. + #[serde(rename="directionSuggested")] + pub direction_suggested: Option, + /// Indicates if there was a suggested change to border_right. + #[serde(rename="borderRightSuggested")] + pub border_right_suggested: Option, + /// A mask that indicates which of the fields in shading have been changed in + /// this suggestion. + #[serde(rename="shadingSuggestionState")] + pub shading_suggestion_state: Option, + /// Indicates if there was a suggested change to keep_lines_together. + #[serde(rename="keepLinesTogetherSuggested")] + pub keep_lines_together_suggested: Option, + /// Indicates if there was a suggested change to line_spacing. + #[serde(rename="lineSpacingSuggested")] + pub line_spacing_suggested: Option, + /// Indicates if there was a suggested change to spacing_mode. + #[serde(rename="spacingModeSuggested")] + pub spacing_mode_suggested: Option, + /// Indicates if there was a suggested change to indent_start. + #[serde(rename="indentStartSuggested")] + pub indent_start_suggested: Option, + /// Indicates if there was a suggested change to space_below. + #[serde(rename="spaceBelowSuggested")] + pub space_below_suggested: Option, + /// Indicates if there was a suggested change to border_left. + #[serde(rename="borderLeftSuggested")] + pub border_left_suggested: Option, + /// Indicates if there was a suggested change to indent_first_line. + #[serde(rename="indentFirstLineSuggested")] + pub indent_first_line_suggested: Option, + /// Indicates if there was a suggested change to heading_id. + #[serde(rename="headingIdSuggested")] + pub heading_id_suggested: Option, +} + +impl Part for ParagraphStyleSuggestionState {} + + +/// A tab stop within a paragraph. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TabStop { + /// The alignment of this tab stop. If unset, the value defaults to START. + pub alignment: Option, + /// The offset between this tab stop and the start margin. + pub offset: Option, +} + +impl Part for TabStop {} + + +/// Deletes bullets from all of the paragraphs that overlap with the given range. +/// +/// The nesting level of each paragraph will be visually preserved by adding +/// indent to the start of the corresponding paragraph. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteParagraphBulletsRequest { + /// The range to delete bullets from. + pub range: Option, +} + +impl Part for DeleteParagraphBulletsRequest {} + + +/// The result of creating a named range. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateNamedRangeResponse { + /// The ID of the created named range. + #[serde(rename="namedRangeId")] + pub named_range_id: Option, +} + +impl Part for CreateNamedRangeResponse {} + + +/// A reference to another portion of a document or an external URL resource. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Link { + /// The ID of a heading in this document. + #[serde(rename="headingId")] + pub heading_id: Option, + /// An external URL. + pub url: Option, + /// The ID of a bookmark in this document. + #[serde(rename="bookmarkId")] + pub bookmark_id: Option, +} + +impl Part for Link {} + + +/// A suggested change to a Bullet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuggestedBullet { + /// A Bullet that only includes the changes made + /// in this suggestion. This can be used along with the + /// bullet_suggestion_state to see which + /// fields have changed and their new values. + pub bullet: Option, + /// A mask that indicates which of the fields on the base + /// Bullet have been changed in this suggestion. + #[serde(rename="bulletSuggestionState")] + pub bullet_suggestion_state: Option, +} + +impl Part for SuggestedBullet {} + + +/// A ParagraphElement that represents a +/// run of text that all has the same styling. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TextRun { + /// The text of this run. + /// + /// Any non-text elements in the run are replaced with the Unicode character + /// U+E907. + pub content: Option, + /// The text style of this run. + #[serde(rename="textStyle")] + pub text_style: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested text style changes to this run, keyed by suggestion ID. + #[serde(rename="suggestedTextStyleChanges")] + pub suggested_text_style_changes: Option>, + /// The suggested insertion IDs. A TextRun may + /// have multiple insertion IDs if it is a nested suggested change. If empty, + /// then this is not a suggested insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for TextRun {} + + +/// A suggested change to a TextStyle. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuggestedTextStyle { + /// A TextStyle that only includes + /// the changes made in this suggestion. This can be used along with the + /// text_style_suggestion_state + /// to see which fields have changed and their new values. + #[serde(rename="textStyle")] + pub text_style: Option, + /// A mask that indicates which of the fields on the base TextStyle have been changed in this suggestion. + #[serde(rename="textStyleSuggestionState")] + pub text_style_suggestion_state: Option, +} + +impl Part for SuggestedTextStyle {} + + +/// A mask that indicates which of the fields on the base +/// PositionedObjectProperties +/// have been changed in this suggestion. For any field set to true, there is a +/// new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PositionedObjectPropertiesSuggestionState { + /// A mask that indicates which of the fields in positioning have been + /// changed in this suggestion. + #[serde(rename="positioningSuggestionState")] + pub positioning_suggestion_state: Option, + /// A mask that indicates which of the fields in embedded_object have been + /// changed in this suggestion. + #[serde(rename="embeddedObjectSuggestionState")] + pub embedded_object_suggestion_state: Option, +} + +impl Part for PositionedObjectPropertiesSuggestionState {} + + +/// A mask that indicates which of the fields on the base +/// PositionedObjectPositioning have been changed in this +/// suggestion. For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PositionedObjectPositioningSuggestionState { + /// Indicates if there was a suggested change to layout. + #[serde(rename="layoutSuggested")] + pub layout_suggested: Option, + /// Indicates if there was a suggested change to top_offset. + #[serde(rename="topOffsetSuggested")] + pub top_offset_suggested: Option, + /// Indicates if there was a suggested change to left_offset. + #[serde(rename="leftOffsetSuggested")] + pub left_offset_suggested: Option, +} + +impl Part for PositionedObjectPositioningSuggestionState {} + + +/// A color that can either be fully opaque or fully transparent. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OptionalColor { + /// If set, this will be used as an opaque color. If unset, this represents + /// a transparent color. + pub color: Option, +} + +impl Part for OptionalColor {} + + +/// A border around a table cell. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableCellBorder { + /// The color of the border. + pub color: Option, + /// The width of the border. + pub width: Option, + /// The dash style of the border. + #[serde(rename="dashStyle")] + pub dash_style: Option, +} + +impl Part for TableCellBorder {} + + +/// Update the styling of text. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UpdateTextStyleRequest { + /// The fields that should be updated. + /// + /// At least one field must be specified. The root `text_style` is implied and + /// should not be specified. A single `"*"` can be used as short-hand for + /// listing every field. + /// + /// For example, to update the text style to bold, set `fields` to `"bold"`. + /// + /// To reset a property to its default value, include its field name in the + /// field mask but leave the field itself unset. + pub fields: Option, + /// The range of text to style. + /// + /// The range may be extended to include adjacent newlines. + /// + /// If the range fully contains a paragraph belonging to a list, the + /// paragraph's bullet is also updated with the matching text style. + pub range: Option, + /// The styles to set on the text. + /// + /// If the value for a particular style matches that of the parent, that style + /// will be set to inherit. + /// + /// Certain text style changes may cause other changes in order to to mirror + /// the behavior of the Docs editor. See the documentation of + /// TextStyle for more information. + #[serde(rename="textStyle")] + pub text_style: Option, +} + +impl Part for UpdateTextStyleRequest {} + + +/// Contains properties describing the look and feel of a list bullet at a given +/// level of nesting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NestingLevel { + /// The text style of bullets at this level of nesting. + #[serde(rename="textStyle")] + pub text_style: Option, + /// The amount of indentation for paragraphs at this level of nesting. Applied + /// to the side that corresponds to the start of the text, based on the + /// paragraph's content direction. + #[serde(rename="indentStart")] + pub indent_start: Option, + /// The type of glyph used by bullets when paragraphs at this level of + /// nesting are ordered. + /// + /// The glyph type determines the type of glyph used to replace placeholders + /// within the glyph_format + /// when paragraphs at this level of nesting are ordered. For example, if the + /// nesting level is 0, the glyph_format is `%0.` and the glyph + /// type is DECIMAL, + /// then the rendered glyph would replace the placeholder `%0` in the glyph + /// format with a number corresponding to list item's order within the list. + #[serde(rename="glyphType")] + pub glyph_type: Option, + /// The format string used by bullets at this level of nesting. + /// + /// The glyph format contains one or more placeholders, and these placeholder + /// are replaced with the appropriate values depending on the glyph_type or glyph_symbol. The placeholders follow + /// the pattern `%[nesting_level]`. Furthermore, placeholders can have prefixes + /// and suffixes. Thus, the glyph format follows the pattern + /// `%[nesting_level]`. Note that the prefix and suffix are + /// optional and can be arbitrary strings. + /// + /// For example, the glyph format `%0.` indicates that the rendered glyph will + /// replace the placeholder with the corresponding glyph for nesting level 0 + /// followed by a period as the suffix. So a list with a glyph type of + /// UPPER_ALPHA and + /// glyph format `%0.` at nesting level 0 will result in a list with rendered + /// glyphs + ///

`A.` + ///

`B.` + ///

`C.` + /// + /// The glyph format can contain placeholders for the current nesting level as + /// well as placeholders for parent nesting levels. For example, a + /// list can have a glyph format of `%0.` at nesting level 0 and a + /// glyph format of `%0.%1.` at nesting level 1. Assuming both nesting levels + /// have DECIMAL glyph + /// types, this would result in a list with rendered glyphs + ///

`1.` + ///

`2.` + ///

` 2.1.` + ///

` 2.2.` + ///

`3.` + /// + /// For nesting levels that are ordered, the string that replaces a placeholder + /// in the glyph format for a particular paragraph depends on the paragraph's + /// order within the list. + #[serde(rename="glyphFormat")] + pub glyph_format: Option, + /// A custom glyph symbol used by bullets when paragraphs at this level of + /// nesting are unordered. + /// + /// The glyph symbol replaces placeholders within the glyph_format. For example, if the + /// glyph_symbol is the solid circle corresponding to Unicode U+25cf code + /// point and the glyph_format is `%0`, the rendered + /// glyph would be the solid circle. + #[serde(rename="glyphSymbol")] + pub glyph_symbol: Option, + /// The alignment of the bullet within the space allotted for rendering the + /// bullet. + #[serde(rename="bulletAlignment")] + pub bullet_alignment: Option, + /// The number of the first list item at this nesting level. + /// + /// A value of 0 is treated as a value of 1 for lettered lists and roman + /// numeraled lists, i.e. for values of both 0 and 1, lettered and roman + /// numeraled lists will begin at `a` and `i` respectively. + /// + /// This value is ignored for nesting levels with unordered glyphs. + #[serde(rename="startNumber")] + pub start_number: Option, + /// The amount of indentation for the first line of paragraphs at this level of + /// nesting. + #[serde(rename="indentFirstLine")] + pub indent_first_line: Option, +} + +impl Part for NestingLevel {} + + +/// A suggested change to PositionedObjectProperties. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuggestedPositionedObjectProperties { + /// A PositionedObjectProperties that only includes the + /// changes made in this suggestion. This can be used along with the + /// positioned_object_properties_suggestion_state + /// to see which fields have changed and their new values. + #[serde(rename="positionedObjectProperties")] + pub positioned_object_properties: Option, + /// A mask that indicates which of the fields on the base + /// PositionedObjectProperties have been changed in this + /// suggestion. + #[serde(rename="positionedObjectPropertiesSuggestionState")] + pub positioned_object_properties_suggestion_state: Option, +} + +impl Part for SuggestedPositionedObjectProperties {} + + +/// A mask that indicates which of the fields on the base ImageProperties have been changed in this suggestion. +/// For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImagePropertiesSuggestionState { + /// A mask that indicates which of the fields in crop_properties have been changed in + /// this suggestion. + #[serde(rename="cropPropertiesSuggestionState")] + pub crop_properties_suggestion_state: Option, + /// Indicates if there was a suggested change to contrast. + #[serde(rename="contrastSuggested")] + pub contrast_suggested: Option, + /// Indicates if there was a suggested change to angle. + #[serde(rename="angleSuggested")] + pub angle_suggested: Option, + /// Indicates if there was a suggested change to brightness. + #[serde(rename="brightnessSuggested")] + pub brightness_suggested: Option, + /// Indicates if there was a suggested change to transparency. + #[serde(rename="transparencySuggested")] + pub transparency_suggested: Option, + /// Indicates if there was a suggested change to source_uri. + #[serde(rename="sourceUriSuggested")] + pub source_uri_suggested: Option, + /// Indicates if there was a suggested change to + /// content_uri. + #[serde(rename="contentUriSuggested")] + pub content_uri_suggested: Option, +} + +impl Part for ImagePropertiesSuggestionState {} + + +/// A ParagraphElement representing an +/// equation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Equation { + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested insertion IDs. A Equation + /// may have multiple insertion IDs if it is a nested suggested change. If + /// empty, then this is not a suggested insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for Equation {} + + +/// A List represents the list attributes for a group of paragraphs that all +/// belong to the same list. A paragraph that is part of a list has a reference +/// to the list's ID in its bullet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct List { + /// The properties of the list. + #[serde(rename="listProperties")] + pub list_properties: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this list. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested changes to the list properties, keyed by suggestion + /// ID. + #[serde(rename="suggestedListPropertiesChanges")] + pub suggested_list_properties_changes: Option>, + /// The suggested insertion ID. If empty, then this is not a suggested + /// insertion. + #[serde(rename="suggestedInsertionId")] + pub suggested_insertion_id: Option, +} + +impl Part for List {} + + +/// The properties of a list which describe the look +/// and feel of bullets belonging to paragraphs associated with a list. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListProperties { + /// Describes the properties of the bullets at the associated level. + /// + /// A list has at most nine levels of nesting with nesting level 0 + /// corresponding to the top-most level and nesting level 8 corresponding to + /// the most nested level. The nesting levels are returned in ascending order + /// with the least nested returned first. + #[serde(rename="nestingLevels")] + pub nesting_levels: Option>, +} + +impl Part for ListProperties {} + + +/// Location at the end of a body, header, footer or footnote. The location is +/// immediately before the last newline in the document segment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EndOfSegmentLocation { + /// The ID of the header, footer or footnote the location is in. An empty + /// segment ID signifies the document's body. + #[serde(rename="segmentId")] + pub segment_id: Option, +} + +impl Part for EndOfSegmentLocation {} + + +/// A mask that indicates which of the fields on the base TextStyle have been changed in this suggestion. +/// For any field set to true, there is a new suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TextStyleSuggestionState { + /// Indicates if there was a suggested change to font_size. + #[serde(rename="fontSizeSuggested")] + pub font_size_suggested: Option, + /// Indicates if there was a suggested change to strikethrough. + #[serde(rename="strikethroughSuggested")] + pub strikethrough_suggested: Option, + /// Indicates if there was a suggested change to weighted_font_family. + #[serde(rename="weightedFontFamilySuggested")] + pub weighted_font_family_suggested: Option, + /// Indicates if there was a suggested change to underline. + #[serde(rename="underlineSuggested")] + pub underline_suggested: Option, + /// Indicates if there was a suggested change to small_caps. + #[serde(rename="smallCapsSuggested")] + pub small_caps_suggested: Option, + /// Indicates if there was a suggested change to link. + #[serde(rename="linkSuggested")] + pub link_suggested: Option, + /// Indicates if there was a suggested change to italic. + #[serde(rename="italicSuggested")] + pub italic_suggested: Option, + /// Indicates if there was a suggested change to bold. + #[serde(rename="boldSuggested")] + pub bold_suggested: Option, + /// Indicates if there was a suggested change to baseline_offset. + #[serde(rename="baselineOffsetSuggested")] + pub baseline_offset_suggested: Option, + /// Indicates if there was a suggested change to foreground_color. + #[serde(rename="foregroundColorSuggested")] + pub foreground_color_suggested: Option, + /// Indicates if there was a suggested change to background_color. + #[serde(rename="backgroundColorSuggested")] + pub background_color_suggested: Option, +} + +impl Part for TextStyleSuggestionState {} + + +/// An embedded object in the document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EmbeddedObject { + /// The properties of an image. + #[serde(rename="imageProperties")] + pub image_properties: Option, + /// The description of the embedded object. The `title` and `description` are + /// both combined to display alt text. + pub description: Option, + /// The title of the embedded object. The `title` and `description` are both + /// combined to display alt text. + pub title: Option, + /// The properties of an embedded drawing. + #[serde(rename="embeddedDrawingProperties")] + pub embedded_drawing_properties: Option, + /// The bottom margin of the embedded object. + #[serde(rename="marginBottom")] + pub margin_bottom: Option, + /// The border of the embedded object. + #[serde(rename="embeddedObjectBorder")] + pub embedded_object_border: Option, + /// A reference to the external linked source content. For example, it contains + /// a reference to the source Sheets chart when the embedded object is a linked + /// chart. + /// + /// If unset, then the embedded object is not linked. + #[serde(rename="linkedContentReference")] + pub linked_content_reference: Option, + /// The left margin of the embedded object. + #[serde(rename="marginLeft")] + pub margin_left: Option, + /// The right margin of the embedded object. + #[serde(rename="marginRight")] + pub margin_right: Option, + /// The top margin of the embedded object. + #[serde(rename="marginTop")] + pub margin_top: Option, + /// The size of the embedded object. + pub size: Option, +} + +impl Part for EmbeddedObject {} + + +/// A suggested change to the NamedStyles. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuggestedNamedStyles { + /// A mask that indicates which of the fields on the base NamedStyles have been changed in this suggestion. + #[serde(rename="namedStylesSuggestionState")] + pub named_styles_suggestion_state: Option, + /// A NamedStyles that only includes the + /// changes made in this suggestion. This can be used along with the + /// named_styles_suggestion_state to + /// see which fields have changed and their new values. + #[serde(rename="namedStyles")] + pub named_styles: Option, +} + +impl Part for SuggestedNamedStyles {} + + +/// The result of inserting an inline image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InsertInlineImageResponse { + /// The ID of the created InlineObject. + #[serde(rename="objectId")] + pub object_id: Option, +} + +impl Part for InsertInlineImageResponse {} + + +/// A suggested change to ListProperties. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuggestedListProperties { + /// A ListProperties that only includes + /// the changes made in this suggestion. This can be used along with the + /// list_properties_suggestion_state + /// to see which fields have changed and their new values. + #[serde(rename="listProperties")] + pub list_properties: Option, + /// A mask that indicates which of the fields on the base ListProperties have been changed in this suggestion. + #[serde(rename="listPropertiesSuggestionState")] + pub list_properties_suggestion_state: Option, +} + +impl Part for SuggestedListProperties {} + + +/// A magnitude in a single direction in the specified units. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Dimension { + /// The magnitude. + pub magnitude: Option, + /// The units for magnitude. + pub unit: Option, +} + +impl Part for Dimension {} + + +/// A suggested change to InlineObjectProperties. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuggestedInlineObjectProperties { + /// An InlineObjectProperties + /// that only includes the changes made in this suggestion. This can be used + /// along with the inline_object_properties_suggestion_state + /// to see which fields have changed and their new values. + #[serde(rename="inlineObjectProperties")] + pub inline_object_properties: Option, + /// A mask that indicates which of the fields on the base + /// InlineObjectProperties have + /// been changed in this suggestion. + #[serde(rename="inlineObjectPropertiesSuggestionState")] + pub inline_object_properties_suggestion_state: Option, +} + +impl Part for SuggestedInlineObjectProperties {} + + +/// A mask that indicates which of the fields on the base +/// LinkedContentReference have +/// been changed in this suggestion. For any field set to true, there is a new +/// suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LinkedContentReferenceSuggestionState { + /// A mask that indicates which of the fields in sheets_chart_reference have + /// been changed in this suggestion. + #[serde(rename="sheetsChartReferenceSuggestionState")] + pub sheets_chart_reference_suggestion_state: Option, +} + +impl Part for LinkedContentReferenceSuggestionState {} + + +/// A ParagraphElement describes content within a +/// Paragraph. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ParagraphElement { + /// The zero-base end index of this paragraph element, exclusive, in UTF-16 + /// code units. + #[serde(rename="endIndex")] + pub end_index: Option, + /// An equation paragraph element. + pub equation: Option, + /// A column break paragraph element. + #[serde(rename="columnBreak")] + pub column_break: Option, + /// The zero-based start index of this paragraph element, in UTF-16 code units. + #[serde(rename="startIndex")] + pub start_index: Option, + /// A page break paragraph element. + #[serde(rename="pageBreak")] + pub page_break: Option, + /// A horizontal rule paragraph element. + #[serde(rename="horizontalRule")] + pub horizontal_rule: Option, + /// A text run paragraph element. + #[serde(rename="textRun")] + pub text_run: Option, + /// An auto text paragraph element. + #[serde(rename="autoText")] + pub auto_text: Option, + /// An inline object paragraph element. + #[serde(rename="inlineObjectElement")] + pub inline_object_element: Option, + /// A footnote reference paragraph element. + #[serde(rename="footnoteReference")] + pub footnote_reference: Option, +} + +impl Part for ParagraphElement {} + + +/// An object that is tethered to a Paragraph +/// and positioned relative to the beginning of the paragraph. A PositionedObject +/// contains an EmbeddedObject such as an +/// image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PositionedObject { + /// The properties of this positioned object. + #[serde(rename="positionedObjectProperties")] + pub positioned_object_properties: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The ID of this positioned object. + #[serde(rename="objectId")] + pub object_id: Option, + /// The suggested changes to the positioned object properties, keyed by + /// suggestion ID. + #[serde(rename="suggestedPositionedObjectPropertiesChanges")] + pub suggested_positioned_object_properties_changes: Option>, + /// The suggested insertion ID. If empty, then this is not a suggested + /// insertion. + #[serde(rename="suggestedInsertionId")] + pub suggested_insertion_id: Option, +} + +impl Part for PositionedObject {} + + +/// Deletes a PositionedObject from the +/// document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeletePositionedObjectRequest { + /// The ID of the positioned object to delete. + #[serde(rename="objectId")] + pub object_id: Option, +} + +impl Part for DeletePositionedObjectRequest {} + + +/// A mask that indicates which of the fields on the base +/// InlineObjectProperties have +/// been changed in this suggestion. For any field set to true, there is a new +/// suggested value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InlineObjectPropertiesSuggestionState { + /// A mask that indicates which of the fields in embedded_object have been + /// changed in this suggestion. + #[serde(rename="embeddedObjectSuggestionState")] + pub embedded_object_suggestion_state: Option, +} + +impl Part for InlineObjectPropertiesSuggestionState {} + + +/// A suggested change to the DocumentStyle. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuggestedDocumentStyle { + /// A DocumentStyle that only includes + /// the changes made in this suggestion. This can be used along with the + /// document_style_suggestion_state + /// to see which fields have changed and their new values. + #[serde(rename="documentStyle")] + pub document_style: Option, + /// A mask that indicates which of the fields on the base DocumentStyle have been changed in this suggestion. + #[serde(rename="documentStyleSuggestionState")] + pub document_style_suggestion_state: Option, +} + +impl Part for SuggestedDocumentStyle {} + + +/// The contents and style of a row in a Table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableRow { + /// The contents and style of each cell in this row. + /// + /// It is possible for a table to be non-rectangular, so some rows may have a + /// different number of cells than other rows in the same table. + #[serde(rename="tableCells")] + pub table_cells: Option>, + /// The zero-based start index of this row, in UTF-16 code units. + #[serde(rename="startIndex")] + pub start_index: Option, + /// The zero-based end index of this row, exclusive, in UTF-16 code units. + #[serde(rename="endIndex")] + pub end_index: Option, + /// The style of the table row. + #[serde(rename="tableRowStyle")] + pub table_row_style: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The suggested style changes to this row, keyed by suggestion ID. + #[serde(rename="suggestedTableRowStyleChanges")] + pub suggested_table_row_style_changes: Option>, + /// The suggested insertion IDs. A TableRow + /// may have multiple insertion IDs if it is a nested suggested change. If + /// empty, then this is not a suggested insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for TableRow {} + + +/// Styles that apply to a table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TableStyle { + /// The properties of each column. + /// + /// Note that in Docs, tables contain rows and rows contain cells, similar to + /// HTML. So the properties for a row can be found on the row's + /// table_row_style. + #[serde(rename="tableColumnProperties")] + pub table_column_properties: Option>, +} + +impl Part for TableStyle {} + + +/// The suggestion state of a NamedStyles +/// message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NamedStylesSuggestionState { + /// A mask that indicates which of the fields on the corresponding NamedStyle in styles have been changed in this + /// suggestion. + /// + /// The order of these named style suggestion states match the order of the + /// corresponding named style within the named styles suggestion. + #[serde(rename="stylesSuggestionStates")] + pub styles_suggestion_states: Option>, +} + +impl Part for NamedStylesSuggestionState {} + + +/// Specifies a contiguous range of text. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Range { + /// The zero-based end index of this range, exclusive, in UTF-16 code units. + /// + /// In all current uses, an end index must be provided. This field is an + /// Int32Value in order to accommodate future use cases with open-ended ranges. + #[serde(rename="endIndex")] + pub end_index: Option, + /// The zero-based start index of this range, in UTF-16 code units. + /// + /// In all current uses, a start index must be provided. This field is an + /// Int32Value in order to accommodate future use cases with open-ended ranges. + #[serde(rename="startIndex")] + pub start_index: Option, + /// The ID of the header, footer or footnote that this range is contained in. + /// An empty segment ID signifies the document's body. + #[serde(rename="segmentId")] + pub segment_id: Option, +} + +impl Part for Range {} + + +/// An RGB color. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RgbColor { + /// The blue component of the color, from 0.0 to 1.0. + pub blue: Option, + /// The green component of the color, from 0.0 to 1.0. + pub green: Option, + /// The red component of the color, from 0.0 to 1.0. + pub red: Option, +} + +impl Part for RgbColor {} + + +/// Deletes a row from a table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteTableRowRequest { + /// The reference table cell location from which the row will be deleted. + /// + /// The row this cell spans will be deleted. If this is a merged cell that + /// spans multiple rows, all rows that the cell spans will be deleted. If no + /// rows remain in the table after this deletion, the whole table is deleted. + #[serde(rename="tableCellLocation")] + pub table_cell_location: Option, +} + +impl Part for DeleteTableRowRequest {} + + +/// Update the styling of all paragraphs that overlap with the given range. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UpdateParagraphStyleRequest { + /// The fields that should be updated. + /// + /// At least one field must be specified. The root `paragraph_style` is implied + /// and should not be specified. + /// + /// For example, to update the paragraph style's alignment property, set + /// `fields` to `"alignment"`. + /// + /// To reset a property to its default value, include its field name in the + /// field mask but leave the field itself unset. + pub fields: Option, + /// The range overlapping the paragraphs to style. + pub range: Option, + /// The styles to set on the paragraphs. + /// + /// Certain paragraph style changes may cause other changes in order to mirror + /// the behavior of the Docs editor. See the documentation of ParagraphStyle for more information. + #[serde(rename="paragraphStyle")] + pub paragraph_style: Option, +} + +impl Part for UpdateParagraphStyleRequest {} + + +/// A reference to a linked chart embedded from Google Sheets. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SheetsChartReference { + /// The ID of the specific chart in the Google Sheets spreadsheet that is + /// embedded. + #[serde(rename="chartId")] + pub chart_id: Option, + /// The ID of the Google Sheets spreadsheet that contains the source chart. + #[serde(rename="spreadsheetId")] + pub spreadsheet_id: Option, +} + +impl Part for SheetsChartReference {} + + +/// Creates bullets for all of the paragraphs that overlap with the given range. +/// +/// The nesting level of each paragraph will be determined by counting leading +/// tabs in front of each paragraph. To avoid excess space between the bullet and +/// the corresponding paragraph, these leading tabs are removed by this request. +/// This may change the indices of parts of the text. +/// +/// If the paragraph immediately before paragraphs being updated is in a list +/// with a matching preset, the paragraphs being updated are added to that +/// preceding list. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateParagraphBulletsRequest { + /// The kinds of bullet glyphs to be used. + #[serde(rename="bulletPreset")] + pub bullet_preset: Option, + /// The range to apply the bullet preset to. + pub range: Option, +} + +impl Part for CreateParagraphBulletsRequest {} + + +/// A StructuralElement representing a +/// table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Table { + /// Number of rows in the table. + pub rows: Option, + /// The suggested deletion IDs. If empty, then there are no suggested deletions + /// of this content. + #[serde(rename="suggestedDeletionIds")] + pub suggested_deletion_ids: Option>, + /// The style of the table. + #[serde(rename="tableStyle")] + pub table_style: Option, + /// The contents and style of each row. + #[serde(rename="tableRows")] + pub table_rows: Option>, + /// Number of columns in the table. + /// + /// It is possible for a table to be non-rectangular, so some rows may have a + /// different number of cells. + pub columns: Option, + /// The suggested insertion IDs. A Table may have + /// multiple insertion IDs if it is a nested suggested change. If empty, then + /// this is not a suggested insertion. + #[serde(rename="suggestedInsertionIds")] + pub suggested_insertion_ids: Option>, +} + +impl Part for Table {} + + +/// A suggested change to a +/// TableRowStyle. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuggestedTableRowStyle { + /// A TableRowStyle that only includes + /// the changes made in this suggestion. This can be used along with the + /// table_row_style_suggestion_state + /// to see which fields have changed and their new values. + #[serde(rename="tableRowStyle")] + pub table_row_style: Option, + /// A mask that indicates which of the fields on the base TableRowStyle have been changed in this suggestion. + #[serde(rename="tableRowStyleSuggestionState")] + pub table_row_style_suggestion_state: Option, +} + +impl Part for SuggestedTableRowStyle {} + + +/// A width and height. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Size { + /// The width of the object. + pub width: Option, + /// The height of the object. + pub height: Option, +} + +impl Part for Size {} + + +/// Response message from a BatchUpdateDocument request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batch update documents](struct.DocumentBatchUpdateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchUpdateDocumentResponse { + /// The updated write control after applying the request. + #[serde(rename="writeControl")] + pub write_control: Option, + /// The ID of the document to which the updates were applied to. + #[serde(rename="documentId")] + pub document_id: Option, + /// The reply of the updates. This maps 1:1 with the updates, although replies + /// to some requests may be empty. + pub replies: Option>, +} + +impl ResponseResult for BatchUpdateDocumentResponse {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *document* resources. +/// It is not used directly, but through the `Docs` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_docs1 as docs1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use docs1::Docs; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Docs::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `batch_update(...)`, `create(...)` and `get(...)` +/// // to build up your call. +/// let rb = hub.documents(); +/// # } +/// ``` +pub struct DocumentMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Docs, +} + +impl<'a, C, A> MethodsBuilder for DocumentMethods<'a, C, A> {} + +impl<'a, C, A> DocumentMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a blank document using the title given in the request. Other fields + /// in the request, including any provided content, are ignored. + /// + /// Returns the created document. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn create(&self, request: Document) -> DocumentCreateCall<'a, C, A> { + DocumentCreateCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest version of the specified document. + /// + /// # Arguments + /// + /// * `documentId` - The ID of the document to retrieve. + pub fn get(&self, document_id: &str) -> DocumentGetCall<'a, C, A> { + DocumentGetCall { + hub: self.hub, + _document_id: document_id.to_string(), + _suggestions_view_mode: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Applies one or more updates to the document. + /// + /// Each request is validated before + /// being applied. If any request is not valid, then the entire request will + /// fail and nothing will be applied. + /// + /// Some requests have replies to + /// give you some information about how they are applied. Other requests do + /// not need to return information; these each return an empty reply. + /// The order of replies matches that of the requests. + /// + /// For example, suppose you call batchUpdate with four updates, and only the + /// third one returns information. The response would have two empty replies, + /// the reply to the third request, and another empty reply, in that order. + /// + /// Because other users may be editing the document, the document + /// might not exactly reflect your changes: your changes may + /// be altered with respect to collaborator changes. If there are no + /// collaborators, the document should reflect your changes. In any case, + /// the updates in your request are guaranteed to be applied together + /// atomically. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `documentId` - The ID of the document to update. + pub fn batch_update(&self, request: BatchUpdateDocumentRequest, document_id: &str) -> DocumentBatchUpdateCall<'a, C, A> { + DocumentBatchUpdateCall { + hub: self.hub, + _request: request, + _document_id: document_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Creates a blank document using the title given in the request. Other fields +/// in the request, including any provided content, are ignored. +/// +/// Returns the created document. +/// +/// A builder for the *create* method supported by a *document* resource. +/// It is not used directly, but through a `DocumentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_docs1 as docs1; +/// use docs1::Document; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use docs1::Docs; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Docs::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Document::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.documents().create(req) +/// .doit(); +/// # } +/// ``` +pub struct DocumentCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Docs, + _request: Document, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DocumentCreateCall<'a, C, A> {} + +impl<'a, C, A> DocumentCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Document)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "docs.documents.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/documents"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Document.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Document) -> DocumentCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DocumentCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> DocumentCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Document`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DocumentCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the latest version of the specified document. +/// +/// A builder for the *get* method supported by a *document* resource. +/// It is not used directly, but through a `DocumentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_docs1 as docs1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use docs1::Docs; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Docs::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.documents().get("documentId") +/// .suggestions_view_mode("accusam") +/// .doit(); +/// # } +/// ``` +pub struct DocumentGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Docs, + _document_id: String, + _suggestions_view_mode: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DocumentGetCall<'a, C, A> {} + +impl<'a, C, A> DocumentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Document)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "docs.documents.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("documentId", self._document_id.to_string())); + if let Some(value) = self._suggestions_view_mode { + params.push(("suggestionsViewMode", value.to_string())); + } + for &field in ["alt", "documentId", "suggestionsViewMode"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/documents/{documentId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DocumentReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{documentId}", "documentId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["documentId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the document to retrieve. + /// + /// Sets the *document id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn document_id(mut self, new_value: &str) -> DocumentGetCall<'a, C, A> { + self._document_id = new_value.to_string(); + self + } + /// The suggestions view mode to apply to the document. This allows viewing the + /// document with all suggestions inline, accepted or rejected. If one is not + /// specified, DEFAULT_FOR_CURRENT_ACCESS is + /// used. + /// + /// Sets the *suggestions view mode* query property to the given value. + pub fn suggestions_view_mode(mut self, new_value: &str) -> DocumentGetCall<'a, C, A> { + self._suggestions_view_mode = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DocumentGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> DocumentGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DocumentReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DocumentGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Applies one or more updates to the document. +/// +/// Each request is validated before +/// being applied. If any request is not valid, then the entire request will +/// fail and nothing will be applied. +/// +/// Some requests have replies to +/// give you some information about how they are applied. Other requests do +/// not need to return information; these each return an empty reply. +/// The order of replies matches that of the requests. +/// +/// For example, suppose you call batchUpdate with four updates, and only the +/// third one returns information. The response would have two empty replies, +/// the reply to the third request, and another empty reply, in that order. +/// +/// Because other users may be editing the document, the document +/// might not exactly reflect your changes: your changes may +/// be altered with respect to collaborator changes. If there are no +/// collaborators, the document should reflect your changes. In any case, +/// the updates in your request are guaranteed to be applied together +/// atomically. +/// +/// A builder for the *batchUpdate* method supported by a *document* resource. +/// It is not used directly, but through a `DocumentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_docs1 as docs1; +/// use docs1::BatchUpdateDocumentRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use docs1::Docs; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Docs::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BatchUpdateDocumentRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.documents().batch_update(req, "documentId") +/// .doit(); +/// # } +/// ``` +pub struct DocumentBatchUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Docs, + _request: BatchUpdateDocumentRequest, + _document_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DocumentBatchUpdateCall<'a, C, A> {} + +impl<'a, C, A> DocumentBatchUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BatchUpdateDocumentResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "docs.documents.batchUpdate", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("documentId", self._document_id.to_string())); + for &field in ["alt", "documentId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/documents/{documentId}:batchUpdate"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Document.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{documentId}", "documentId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["documentId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BatchUpdateDocumentRequest) -> DocumentBatchUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the document to update. + /// + /// Sets the *document id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn document_id(mut self, new_value: &str) -> DocumentBatchUpdateCall<'a, C, A> { + self._document_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DocumentBatchUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> DocumentBatchUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Document`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> DocumentBatchUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/doubleclickbidmanager1-cli/Cargo.toml b/gen/doubleclickbidmanager1-cli/Cargo.toml index 9b0d4cfbdc..d0006bae15 100644 --- a/gen/doubleclickbidmanager1-cli/Cargo.toml +++ b/gen/doubleclickbidmanager1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclickbidmanager1-cli" -version = "1.0.8+20180821" +version = "1.0.8+20190125" authors = ["Sebastian Thiel "] description = "A complete library to interact with DoubleClick Bid Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclickbidmanager1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-doubleclickbidmanager1] path = "../doubleclickbidmanager1" -version = "1.0.8+20180821" +version = "1.0.8+20190125" diff --git a/gen/doubleclickbidmanager1-cli/README.md b/gen/doubleclickbidmanager1-cli/README.md index cc120a788e..367a156e99 100644 --- a/gen/doubleclickbidmanager1-cli/README.md +++ b/gen/doubleclickbidmanager1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *DoubleClick Bid Manager* API at revision *20180821*. The CLI is at version *1.0.8*. +This documentation was generated from the *DoubleClick Bid Manager* API at revision *20190125*. The CLI is at version *1.0.8*. ```bash doubleclickbidmanager1 [options] diff --git a/gen/doubleclickbidmanager1-cli/mkdocs.yml b/gen/doubleclickbidmanager1-cli/mkdocs.yml index 02e521902e..d4dd1da149 100644 --- a/gen/doubleclickbidmanager1-cli/mkdocs.yml +++ b/gen/doubleclickbidmanager1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: DoubleClick Bid Manager v1.0.8+20180821 +site_name: DoubleClick Bid Manager v1.0.8+20190125 site_url: http://byron.github.io/google-apis-rs/google-doubleclickbidmanager1-cli site_description: A complete library to interact with DoubleClick Bid Manager (protocol v1) diff --git a/gen/doubleclickbidmanager1-cli/src/main.rs b/gen/doubleclickbidmanager1-cli/src/main.rs index 282c43ec8e..52c4781762 100644 --- a/gen/doubleclickbidmanager1-cli/src/main.rs +++ b/gen/doubleclickbidmanager1-cli/src/main.rs @@ -1045,7 +1045,7 @@ fn main() { let mut app = App::new("doubleclickbidmanager1") .author("Sebastian Thiel ") - .version("1.0.8+20180821") + .version("1.0.8+20190125") .about("API for viewing and managing your reports in DoubleClick Bid Manager.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli") .arg(Arg::with_name("url") diff --git a/gen/doubleclickbidmanager1/Cargo.toml b/gen/doubleclickbidmanager1/Cargo.toml index 108d267b2e..43e2d28fbc 100644 --- a/gen/doubleclickbidmanager1/Cargo.toml +++ b/gen/doubleclickbidmanager1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-doubleclickbidmanager1" -version = "1.0.8+20180821" +version = "1.0.8+20190125" authors = ["Sebastian Thiel "] description = "A complete library to interact with DoubleClick Bid Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclickbidmanager1" homepage = "https://developers.google.com/bid-manager/" -documentation = "https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821" +documentation = "https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125" license = "MIT" keywords = ["doubleclickbidmanage", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/doubleclickbidmanager1/README.md b/gen/doubleclickbidmanager1/README.md index a40144e038..76d1cf8847 100644 --- a/gen/doubleclickbidmanager1/README.md +++ b/gen/doubleclickbidmanager1/README.md @@ -5,22 +5,22 @@ DO NOT EDIT ! --> The `google-doubleclickbidmanager1` library allows access to all features of the *Google DoubleClick Bid Manager* service. -This documentation was generated from *DoubleClick Bid Manager* crate version *1.0.8+20180821*, where *20180821* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *DoubleClick Bid Manager* crate version *1.0.8+20190125*, where *20190125* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *DoubleClick Bid Manager* *v1* API can be found at the [official documentation site](https://developers.google.com/bid-manager/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.DoubleClickBidManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.DoubleClickBidManager.html) ... * lineitems - * [*downloadlineitems*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.LineitemDownloadlineitemCall.html) and [*uploadlineitems*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.LineitemUploadlineitemCall.html) -* [queries](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.Query.html) - * [*createquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.QueryCreatequeryCall.html), [*deletequery*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.QueryDeletequeryCall.html), [*getquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.QueryGetqueryCall.html), [*listqueries*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.QueryListqueryCall.html) and [*runquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.QueryRunqueryCall.html) -* [reports](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.Report.html) - * [*listreports*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.ReportListreportCall.html) + * [*downloadlineitems*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.LineitemDownloadlineitemCall.html) and [*uploadlineitems*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.LineitemUploadlineitemCall.html) +* [queries](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.Query.html) + * [*createquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.QueryCreatequeryCall.html), [*deletequery*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.QueryDeletequeryCall.html), [*getquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.QueryGetqueryCall.html), [*listqueries*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.QueryListqueryCall.html) and [*runquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.QueryRunqueryCall.html) +* [reports](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.Report.html) + * [*listreports*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.ReportListreportCall.html) * sdf - * [*download*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.SdfDownloadCall.html) + * [*download*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.SdfDownloadCall.html) @@ -29,17 +29,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/struct.DoubleClickBidManager.html)** +* **[Hub](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/struct.DoubleClickBidManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.Part.html)** + * **[Parts](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -131,17 +131,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -151,29 +151,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20180821/google_doubleclickbidmanager1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-doubleclickbidmanager1/1.0.8+20190125/google_doubleclickbidmanager1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/doubleclickbidmanager1/src/lib.rs b/gen/doubleclickbidmanager1/src/lib.rs index 2c674238ca..6653f466d7 100644 --- a/gen/doubleclickbidmanager1/src/lib.rs +++ b/gen/doubleclickbidmanager1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *DoubleClick Bid Manager* crate version *1.0.8+20180821*, where *20180821* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *DoubleClick Bid Manager* crate version *1.0.8+20190125*, where *20190125* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *DoubleClick Bid Manager* *v1* API can be found at the //! [official documentation site](https://developers.google.com/bid-manager/). @@ -673,7 +673,7 @@ pub struct ListReportsResponse { impl ResponseResult for ListReportsResponse {} -/// Request to fetch stored campaigns, insertion orders, line items, TrueView ad groups and ads. +/// Request to fetch stored inventory sources, campaigns, insertion orders, line items, TrueView ad groups and ads. /// /// # Activities /// @@ -691,7 +691,8 @@ pub struct DownloadRequest { /// - "AD_GROUP" /// - "CAMPAIGN" /// - "INSERTION_ORDER" - /// - "LINE_ITEM" + /// - "LINE_ITEM" + /// - "INVENTORY_SOURCE" #[serde(rename="fileTypes")] pub file_types: Option>, /// SDF Version (column names, types, order) in which the entities will be returned. Default to 3.1. @@ -857,17 +858,20 @@ impl Part for UploadStatus {} pub struct DownloadResponse { /// Retrieved campaigns in SDF format. pub campaigns: Option, + /// no description provided + #[serde(rename="inventorySources")] + pub inventory_sources: Option, /// Retrieved insertion orders in SDF format. #[serde(rename="insertionOrders")] pub insertion_orders: Option, - /// Retrieved line items in SDF format. - #[serde(rename="lineItems")] - pub line_items: Option, /// Retrieved ads in SDF format. pub ads: Option, /// Retrieved ad groups in SDF format. #[serde(rename="adGroups")] pub ad_groups: Option, + /// Retrieved line items in SDF format. + #[serde(rename="lineItems")] + pub line_items: Option, } impl ResponseResult for DownloadResponse {} @@ -1284,10 +1288,7 @@ impl<'a, C, A> SdfDownloadCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1319,7 +1320,7 @@ impl<'a, C, A> SdfDownloadCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1399,7 +1400,7 @@ impl<'a, C, A> SdfDownloadCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1525,10 +1526,7 @@ impl<'a, C, A> LineitemUploadlineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1560,7 +1558,7 @@ impl<'a, C, A> LineitemUploadlineitemCall<'a, C, A> where C: BorrowMut LineitemUploadlineitemCall<'a, C, A> where C: BorrowMut LineitemDownloadlineitemCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1801,7 +1796,7 @@ impl<'a, C, A> LineitemDownloadlineitemCall<'a, C, A> where C: BorrowMut LineitemDownloadlineitemCall<'a, C, A> where C: BorrowMut ReportListreportCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2046,7 +2038,7 @@ impl<'a, C, A> ReportListreportCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2124,7 +2116,7 @@ impl<'a, C, A> ReportListreportCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2243,10 +2235,7 @@ impl<'a, C, A> QueryListqueryCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2266,7 +2255,7 @@ impl<'a, C, A> QueryListqueryCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2334,7 +2323,7 @@ impl<'a, C, A> QueryListqueryCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2476,10 +2465,7 @@ impl<'a, C, A> QueryGetqueryCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2499,7 +2485,7 @@ impl<'a, C, A> QueryGetqueryCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2577,7 +2563,7 @@ impl<'a, C, A> QueryGetqueryCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2703,10 +2689,7 @@ impl<'a, C, A> QueryCreatequeryCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2738,7 +2721,7 @@ impl<'a, C, A> QueryCreatequeryCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2818,7 +2801,7 @@ impl<'a, C, A> QueryCreatequeryCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2959,10 +2942,7 @@ impl<'a, C, A> QueryDeletequeryCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2982,7 +2962,7 @@ impl<'a, C, A> QueryDeletequeryCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3050,7 +3030,7 @@ impl<'a, C, A> QueryDeletequeryCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3198,10 +3178,7 @@ impl<'a, C, A> QueryRunqueryCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3233,7 +3210,7 @@ impl<'a, C, A> QueryRunqueryCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3313,7 +3290,7 @@ impl<'a, C, A> QueryRunqueryCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/doubleclicksearch2-cli/Cargo.toml b/gen/doubleclicksearch2-cli/Cargo.toml index a3ddb012f0..87be195d1b 100644 --- a/gen/doubleclicksearch2-cli/Cargo.toml +++ b/gen/doubleclicksearch2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclicksearch2-cli" -version = "1.0.8+20181010" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with doubleclicksearch (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclicksearch2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-doubleclicksearch2] path = "../doubleclicksearch2" -version = "1.0.8+20181010" +version = "1.0.8+20190326" diff --git a/gen/doubleclicksearch2-cli/README.md b/gen/doubleclicksearch2-cli/README.md index cd4a57d34c..a8366906f9 100644 --- a/gen/doubleclicksearch2-cli/README.md +++ b/gen/doubleclicksearch2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *doubleclicksearch* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *doubleclicksearch* API at revision *20190326*. The CLI is at version *1.0.8*. ```bash doubleclicksearch2 [options] diff --git a/gen/doubleclicksearch2-cli/mkdocs.yml b/gen/doubleclicksearch2-cli/mkdocs.yml index 93c36b8947..7360132ecc 100644 --- a/gen/doubleclicksearch2-cli/mkdocs.yml +++ b/gen/doubleclicksearch2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: doubleclicksearch v1.0.8+20181010 +site_name: doubleclicksearch v1.0.8+20190326 site_url: http://byron.github.io/google-apis-rs/google-doubleclicksearch2-cli site_description: A complete library to interact with doubleclicksearch (protocol v2) diff --git a/gen/doubleclicksearch2-cli/src/main.rs b/gen/doubleclicksearch2-cli/src/main.rs index 4a326c9084..2686f4913e 100644 --- a/gen/doubleclicksearch2-cli/src/main.rs +++ b/gen/doubleclicksearch2-cli/src/main.rs @@ -1292,7 +1292,7 @@ fn main() { let mut app = App::new("doubleclicksearch2") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190326") .about("Reports and modifies your advertising data in DoubleClick Search (for example, campaigns, ad groups, keywords, and conversions).") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli") .arg(Arg::with_name("url") diff --git a/gen/doubleclicksearch2/Cargo.toml b/gen/doubleclicksearch2/Cargo.toml index 51717bbafe..13e55b10b8 100644 --- a/gen/doubleclicksearch2/Cargo.toml +++ b/gen/doubleclicksearch2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-doubleclicksearch2" -version = "1.0.8+20181010" +version = "1.0.8+20190326" authors = ["Sebastian Thiel "] description = "A complete library to interact with doubleclicksearch (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclicksearch2" homepage = "https://developers.google.com/doubleclick-search/" -documentation = "https://docs.rs/google-doubleclicksearch2/1.0.8+20181010" +documentation = "https://docs.rs/google-doubleclicksearch2/1.0.8+20190326" license = "MIT" keywords = ["doubleclicksearch", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/doubleclicksearch2/README.md b/gen/doubleclicksearch2/README.md index acabb08e74..cdaa22b36a 100644 --- a/gen/doubleclicksearch2/README.md +++ b/gen/doubleclicksearch2/README.md @@ -5,25 +5,25 @@ DO NOT EDIT ! --> The `google-doubleclicksearch2` library allows access to all features of the *Google doubleclicksearch* service. -This documentation was generated from *doubleclicksearch* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *doubleclicksearch* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *doubleclicksearch* *v2* API can be found at the [official documentation site](https://developers.google.com/doubleclick-search/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.Doubleclicksearch.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.Doubleclicksearch.html) ... -* [conversion](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.Conversion.html) - * [*get*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.ConversionGetCall.html), [*insert*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.ConversionInsertCall.html), [*patch*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.ConversionPatchCall.html), [*update*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.ConversionUpdateCall.html) and [*update availability*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.ConversionUpdateAvailabilityCall.html) -* [reports](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.Report.html) - * [*generate*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.ReportGenerateCall.html), [*get*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.ReportGetCall.html), [*get file*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.ReportGetFileCall.html) and [*request*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.ReportRequestCall.html) -* [saved columns](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.SavedColumn.html) - * [*list*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.SavedColumnListCall.html) +* [conversion](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.Conversion.html) + * [*get*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.ConversionGetCall.html), [*insert*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.ConversionInsertCall.html), [*patch*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.ConversionPatchCall.html), [*update*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.ConversionUpdateCall.html) and [*update availability*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.ConversionUpdateAvailabilityCall.html) +* [reports](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.Report.html) + * [*generate*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.ReportGenerateCall.html), [*get*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.ReportGetCall.html), [*get file*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.ReportGetFileCall.html) and [*request*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.ReportRequestCall.html) +* [saved columns](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.SavedColumn.html) + * [*list*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.SavedColumnListCall.html) Download supported by ... -* [*get file reports*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.ReportGetFileCall.html) +* [*get file reports*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.ReportGetFileCall.html) @@ -31,17 +31,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/struct.Doubleclicksearch.html)** +* **[Hub](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/struct.Doubleclicksearch.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.Part.html)** + * **[Parts](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -135,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -155,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-doubleclicksearch2/1.0.8+20181010/google_doubleclicksearch2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-doubleclicksearch2/1.0.8+20190326/google_doubleclicksearch2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/doubleclicksearch2/src/lib.rs b/gen/doubleclicksearch2/src/lib.rs index 3df1a5543a..6cfa6ffd7e 100644 --- a/gen/doubleclicksearch2/src/lib.rs +++ b/gen/doubleclicksearch2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *doubleclicksearch* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *doubleclicksearch* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *doubleclicksearch* *v2* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-search/). @@ -718,7 +718,7 @@ pub struct ReportRequest { /// Synchronous report only. Zero-based index of the first row to return. Acceptable values are 0 to 50000, inclusive. Defaults to 0. #[serde(rename="startRow")] pub start_row: Option, - /// Synchronous report only. The maxinum number of rows to return; additional rows are dropped. Acceptable values are 0 to 10000, inclusive. Defaults to 10000. + /// Synchronous report only. The maximum number of rows to return; additional rows are dropped. Acceptable values are 0 to 10000, inclusive. Defaults to 10000. #[serde(rename="rowCount")] pub row_count: Option, /// Determines the type of rows that are returned in the report. For example, if you specify reportType: keyword, each row in the report will contain data about a keyword. See the Types of Reports reference for the columns that are available for each type. @@ -1340,10 +1340,7 @@ impl<'a, C, A> ConversionInsertCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1375,7 +1372,7 @@ impl<'a, C, A> ConversionInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1455,7 +1452,7 @@ impl<'a, C, A> ConversionInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1629,10 +1626,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1652,7 +1646,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1818,7 +1812,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1944,10 +1938,7 @@ impl<'a, C, A> ConversionUpdateAvailabilityCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1979,7 +1970,7 @@ impl<'a, C, A> ConversionUpdateAvailabilityCall<'a, C, A> where C: BorrowMut ConversionUpdateAvailabilityCall<'a, C, A> where C: BorrowMut ConversionPatchCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2234,7 +2222,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2384,7 +2372,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2510,10 +2498,7 @@ impl<'a, C, A> ConversionUpdateCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2545,7 +2530,7 @@ impl<'a, C, A> ConversionUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2625,7 +2610,7 @@ impl<'a, C, A> ConversionUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2769,10 +2754,7 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2792,7 +2774,7 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2880,7 +2862,7 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3026,10 +3008,7 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3049,7 +3028,7 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3127,7 +3106,7 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3253,10 +3232,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3288,7 +3264,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3368,7 +3344,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3510,10 +3486,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3533,7 +3506,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3611,7 +3584,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3737,10 +3710,7 @@ impl<'a, C, A> ReportRequestCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3772,7 +3742,7 @@ impl<'a, C, A> ReportRequestCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3852,7 +3822,7 @@ impl<'a, C, A> ReportRequestCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/drive2-cli/Cargo.toml b/gen/drive2-cli/Cargo.toml index d1b7ee1af2..2b5f00c2f4 100644 --- a/gen/drive2-cli/Cargo.toml +++ b/gen/drive2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive2-cli" -version = "1.0.8+20181004" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-drive2] path = "../drive2" -version = "1.0.8+20181004" +version = "1.0.8+20190328" diff --git a/gen/drive2-cli/README.md b/gen/drive2-cli/README.md index 0ca773e39b..d2743bf47e 100644 --- a/gen/drive2-cli/README.md +++ b/gen/drive2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *drive* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *drive* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash drive2 [options] diff --git a/gen/drive2-cli/mkdocs.yml b/gen/drive2-cli/mkdocs.yml index d910a1d806..76c0c90688 100644 --- a/gen/drive2-cli/mkdocs.yml +++ b/gen/drive2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: drive v1.0.8+20181004 +site_name: drive v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-drive2-cli site_description: A complete library to interact with drive (protocol v2) diff --git a/gen/drive2-cli/src/main.rs b/gen/drive2-cli/src/main.rs index 716d441e02..154601bc25 100644 --- a/gen/drive2-cli/src/main.rs +++ b/gen/drive2-cli/src/main.rs @@ -7552,7 +7552,7 @@ fn main() { ("revisions", "methods: 'delete', 'get', 'list', 'patch' and 'update'", vec![ ("delete", - Some(r##"Removes a revision."##), + Some(r##"Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/revisions_delete", vec![ (Some(r##"file-id"##), @@ -7810,7 +7810,7 @@ fn main() { let mut app = App::new("drive2") .author("Sebastian Thiel ") - .version("1.0.8+20181004") + .version("1.0.8+20190328") .about("Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_drive2_cli") .arg(Arg::with_name("url") diff --git a/gen/drive2/Cargo.toml b/gen/drive2/Cargo.toml index 3ced3743b4..215554bdcf 100644 --- a/gen/drive2/Cargo.toml +++ b/gen/drive2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-drive2" -version = "1.0.8+20181004" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive2" homepage = "https://developers.google.com/drive/" -documentation = "https://docs.rs/google-drive2/1.0.8+20181004" +documentation = "https://docs.rs/google-drive2/1.0.8+20190328" license = "MIT" keywords = ["drive", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/drive2/README.md b/gen/drive2/README.md index e30e4ff23d..76f689da35 100644 --- a/gen/drive2/README.md +++ b/gen/drive2/README.md @@ -5,64 +5,64 @@ DO NOT EDIT ! --> The `google-drive2` library allows access to all features of the *Google drive* service. -This documentation was generated from *drive* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *drive* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *drive* *v2* API can be found at the [official documentation site](https://developers.google.com/drive/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.Drive.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.Drive.html) ... -* [about](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.About.html) - * [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.AboutGetCall.html) -* [apps](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.App.html) - * [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.AppGetCall.html) and [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.AppListCall.html) -* [changes](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.Change.html) - * [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChangeGetCall.html), [*get start page token*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChangeGetStartPageTokenCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChangeListCall.html) and [*watch*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChangeWatchCall.html) -* [channels](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.Channel.html) - * [*stop*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChannelStopCall.html) +* [about](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.About.html) + * [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.AboutGetCall.html) +* [apps](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.App.html) + * [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.AppGetCall.html) and [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.AppListCall.html) +* [changes](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.Change.html) + * [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChangeGetCall.html), [*get start page token*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChangeGetStartPageTokenCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChangeListCall.html) and [*watch*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChangeWatchCall.html) +* [channels](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.Channel.html) + * [*stop*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChannelStopCall.html) * children - * [*delete*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChildrenDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChildrenGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChildrenInsertCall.html) and [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChildrenListCall.html) -* [comments](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.Comment.html) - * [*delete*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.CommentDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.CommentGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.CommentInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.CommentListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.CommentPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.CommentUpdateCall.html) -* [files](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.File.html) - * [*copy*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileCopyCall.html), [*delete*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileDeleteCall.html), [*empty trash*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileEmptyTrashCall.html), [*export*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileExportCall.html), [*generate ids*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileGenerateIdCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FilePatchCall.html), [*touch*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileTouchCall.html), [*trash*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileTrashCall.html), [*untrash*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileUntrashCall.html), [*update*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileUpdateCall.html) and [*watch*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileWatchCall.html) + * [*delete*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChildrenDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChildrenGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChildrenInsertCall.html) and [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChildrenListCall.html) +* [comments](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.Comment.html) + * [*delete*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.CommentDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.CommentGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.CommentInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.CommentListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.CommentPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.CommentUpdateCall.html) +* [files](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.File.html) + * [*copy*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileCopyCall.html), [*delete*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileDeleteCall.html), [*empty trash*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileEmptyTrashCall.html), [*export*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileExportCall.html), [*generate ids*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileGenerateIdCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FilePatchCall.html), [*touch*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileTouchCall.html), [*trash*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileTrashCall.html), [*untrash*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileUntrashCall.html), [*update*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileUpdateCall.html) and [*watch*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileWatchCall.html) * parents - * [*delete*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ParentDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ParentGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ParentInsertCall.html) and [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ParentListCall.html) -* [permissions](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.Permission.html) - * [*delete*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PermissionDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PermissionGetCall.html), [*get id for email*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PermissionGetIdForEmailCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PermissionInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PermissionListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PermissionPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PermissionUpdateCall.html) -* [properties](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.Property.html) - * [*delete*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PropertyDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PropertyGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PropertyInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PropertyListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PropertyPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.PropertyUpdateCall.html) + * [*delete*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ParentDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ParentGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ParentInsertCall.html) and [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ParentListCall.html) +* [permissions](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.Permission.html) + * [*delete*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PermissionDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PermissionGetCall.html), [*get id for email*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PermissionGetIdForEmailCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PermissionInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PermissionListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PermissionPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PermissionUpdateCall.html) +* [properties](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.Property.html) + * [*delete*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PropertyDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PropertyGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PropertyInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PropertyListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PropertyPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.PropertyUpdateCall.html) * realtime - * [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.RealtimeGetCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.RealtimeUpdateCall.html) + * [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.RealtimeGetCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.RealtimeUpdateCall.html) * replies - * [*delete*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ReplyDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ReplyGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ReplyInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ReplyListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ReplyPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ReplyUpdateCall.html) -* [revisions](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.Revision.html) - * [*delete*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.RevisionDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.RevisionGetCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.RevisionListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.RevisionPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.RevisionUpdateCall.html) + * [*delete*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ReplyDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ReplyGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ReplyInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ReplyListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ReplyPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ReplyUpdateCall.html) +* [revisions](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.Revision.html) + * [*delete*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.RevisionDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.RevisionGetCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.RevisionListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.RevisionPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.RevisionUpdateCall.html) * teamdrives - * [*delete*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.TeamdriveDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.TeamdriveGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.TeamdriveInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.TeamdriveListCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.TeamdriveUpdateCall.html) + * [*delete*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.TeamdriveDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.TeamdriveGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.TeamdriveInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.TeamdriveListCall.html) and [*update*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.TeamdriveUpdateCall.html) Upload supported by ... -* [*update files*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileUpdateCall.html) -* [*insert files*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileInsertCall.html) -* [*update realtime*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.RealtimeUpdateCall.html) +* [*update files*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileUpdateCall.html) +* [*insert files*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileInsertCall.html) +* [*update realtime*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.RealtimeUpdateCall.html) Download supported by ... -* [*watch files*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileWatchCall.html) -* [*get realtime*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.RealtimeGetCall.html) -* [*get files*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileGetCall.html) -* [*export files*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileExportCall.html) +* [*watch files*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileWatchCall.html) +* [*get realtime*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.RealtimeGetCall.html) +* [*get files*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileGetCall.html) +* [*export files*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileExportCall.html) Subscription supported by ... -* [*watch files*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileWatchCall.html) -* [*insert files*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileInsertCall.html) -* [*get files*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.FileGetCall.html) -* [*watch changes*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChangeWatchCall.html) -* [*list changes*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.ChangeListCall.html) +* [*watch files*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileWatchCall.html) +* [*insert files*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileInsertCall.html) +* [*get files*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.FileGetCall.html) +* [*watch changes*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChangeWatchCall.html) +* [*list changes*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.ChangeListCall.html) @@ -70,17 +70,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/struct.Drive.html)** +* **[Hub](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/struct.Drive.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.Part.html)** + * **[Parts](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -204,17 +204,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -224,29 +224,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-drive2/1.0.8+20181004/google_drive2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-drive2/1.0.8+20190328/google_drive2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/drive2/src/lib.rs b/gen/drive2/src/lib.rs index 248fa3e50a..45cada384e 100644 --- a/gen/drive2/src/lib.rs +++ b/gen/drive2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *drive* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *drive* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *drive* *v2* API can be found at the //! [official documentation site](https://developers.google.com/drive/). @@ -305,7 +305,7 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// View and manage the files in your Google Drive + /// See, edit, create, and delete all of your Google Drive files Full, /// View your Google Drive apps @@ -326,7 +326,7 @@ pub enum Scope { /// Modify your Google Apps Script scripts' behavior Script, - /// View the files in your Google Drive + /// See and download all your Google Drive files Readonly, /// View and manage its own configuration data in your Google Drive @@ -2246,7 +2246,7 @@ pub struct File { /// A link for opening the file in a relevant Google editor or viewer. #[serde(rename="alternateLink")] pub alternate_link: Option, - /// no description provided + /// Short lived download URL for the file. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files. #[serde(rename="downloadUrl")] pub download_url: Option, /// The permissions for the authenticated user on this file. @@ -4290,7 +4290,7 @@ impl<'a, C, A> RevisionMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Removes a revision. + /// Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted. /// /// # Arguments /// @@ -4507,10 +4507,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4542,7 +4539,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4667,7 +4664,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4848,10 +4845,7 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4912,7 +4906,7 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut, A: oa _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -5130,7 +5124,7 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5277,10 +5271,7 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5300,7 +5291,7 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5385,7 +5376,7 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5574,10 +5565,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5609,7 +5597,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5755,7 +5743,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5902,10 +5890,7 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5925,7 +5910,7 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6010,7 +5995,7 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6156,10 +6141,7 @@ impl<'a, C, A> FileExportCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6179,7 +6161,7 @@ impl<'a, C, A> FileExportCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6257,7 +6239,7 @@ impl<'a, C, A> FileExportCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6375,10 +6357,7 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6398,7 +6377,7 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6456,7 +6435,7 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6630,10 +6609,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6653,7 +6629,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6798,7 +6774,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6945,10 +6921,7 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6968,7 +6941,7 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7053,7 +7026,7 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7182,10 +7155,7 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7205,7 +7175,7 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7287,7 +7257,7 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7516,10 +7486,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7580,7 +7547,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -7843,7 +7810,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7989,10 +7956,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8012,7 +7976,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8087,7 +8051,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8306,10 +8270,7 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8341,7 +8302,7 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8529,7 +8490,7 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8717,10 +8678,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8740,7 +8698,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8853,7 +8811,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8981,10 +8939,7 @@ impl<'a, C, A> TeamdriveInsertCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9016,7 +8971,7 @@ impl<'a, C, A> TeamdriveInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9106,7 +9061,7 @@ impl<'a, C, A> TeamdriveInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9253,10 +9208,7 @@ impl<'a, C, A> TeamdriveGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9276,7 +9228,7 @@ impl<'a, C, A> TeamdriveGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9361,7 +9313,7 @@ impl<'a, C, A> TeamdriveGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9500,10 +9452,7 @@ impl<'a, C, A> TeamdriveListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9523,7 +9472,7 @@ impl<'a, C, A> TeamdriveListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9619,7 +9568,7 @@ impl<'a, C, A> TeamdriveListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9760,10 +9709,7 @@ impl<'a, C, A> TeamdriveDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9783,7 +9729,7 @@ impl<'a, C, A> TeamdriveDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9851,7 +9797,7 @@ impl<'a, C, A> TeamdriveDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10005,10 +9951,7 @@ impl<'a, C, A> TeamdriveUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10040,7 +9983,7 @@ impl<'a, C, A> TeamdriveUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10137,7 +10080,7 @@ impl<'a, C, A> TeamdriveUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10293,10 +10236,7 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -10329,7 +10269,7 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -10490,7 +10430,7 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10639,10 +10579,7 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10662,7 +10599,7 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10737,7 +10674,7 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10879,10 +10816,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10902,7 +10836,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10980,7 +10914,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11114,10 +11048,7 @@ impl<'a, C, A> AppListCall<'a, C, A> where C: BorrowMut, A: oauth } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11137,7 +11068,7 @@ impl<'a, C, A> AppListCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11226,7 +11157,7 @@ impl<'a, C, A> AppListCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11360,10 +11291,7 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11383,7 +11311,7 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11472,7 +11400,7 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11615,10 +11543,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11638,7 +11563,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11716,7 +11641,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11865,10 +11790,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11888,7 +11810,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11983,7 +11905,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12132,10 +12054,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12167,7 +12086,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12257,7 +12176,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12408,10 +12327,7 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12443,7 +12359,7 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12543,7 +12459,7 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12694,10 +12610,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12729,7 +12642,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12829,7 +12742,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12991,10 +12904,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13014,7 +12924,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13120,7 +13030,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13282,10 +13192,7 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13305,7 +13212,7 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13411,7 +13318,7 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13555,10 +13462,7 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13578,7 +13482,7 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13666,7 +13570,7 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13809,10 +13713,7 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13832,7 +13733,7 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13910,7 +13811,7 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14064,10 +13965,7 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14099,7 +13997,7 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14196,7 +14094,7 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14321,10 +14219,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14356,7 +14251,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14426,7 +14321,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14568,10 +14463,7 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14591,7 +14483,7 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14669,7 +14561,7 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14812,10 +14704,7 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14835,7 +14724,7 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14913,7 +14802,7 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15067,10 +14956,7 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15102,7 +14988,7 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15199,7 +15085,7 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15343,10 +15229,7 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15366,7 +15249,7 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15454,7 +15337,7 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15607,10 +15490,7 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15642,7 +15522,7 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15752,7 +15632,7 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15911,10 +15791,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15934,7 +15811,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16043,7 +15920,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16194,10 +16071,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16217,7 +16091,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16322,7 +16196,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16473,10 +16347,7 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16508,7 +16379,7 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16608,7 +16479,7 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16753,10 +16624,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16776,7 +16644,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16864,7 +16732,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17017,10 +16885,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17052,7 +16917,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17162,7 +17027,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17315,10 +17180,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17338,7 +17200,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17430,7 +17292,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17599,10 +17461,7 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17634,7 +17493,7 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17752,7 +17611,7 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17923,10 +17782,7 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17958,7 +17814,7 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18086,7 +17942,7 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18248,10 +18104,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18271,7 +18124,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18377,7 +18230,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18548,10 +18401,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18583,7 +18433,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18711,7 +18561,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18865,10 +18715,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18888,7 +18735,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18990,7 +18837,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19132,10 +18979,7 @@ impl<'a, C, A> PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19155,7 +18999,7 @@ impl<'a, C, A> PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut ChangeGetStartPageTokenCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19385,7 +19226,7 @@ impl<'a, C, A> ChangeGetStartPageTokenCall<'a, C, A> where C: BorrowMut ChangeGetStartPageTokenCall<'a, C, A> where C: BorrowMut ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19678,7 +19516,7 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -19828,7 +19666,7 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19997,10 +19835,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20020,7 +19855,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20158,7 +19993,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20310,10 +20145,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20333,7 +20165,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20425,7 +20257,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20581,10 +20413,7 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20616,7 +20445,7 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20723,7 +20552,7 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20871,10 +20700,7 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20894,7 +20720,7 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20979,7 +20805,7 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21128,10 +20954,7 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21163,7 +20986,7 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21253,7 +21076,7 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21395,10 +21218,7 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21418,7 +21238,7 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21496,7 +21316,7 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21652,10 +21472,7 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21687,7 +21504,7 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21794,7 +21611,7 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21943,10 +21760,7 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21966,7 +21780,7 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22061,7 +21875,7 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22205,10 +22019,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22228,7 +22039,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22316,7 +22127,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22467,10 +22278,7 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22502,7 +22310,7 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -22602,7 +22410,7 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22646,7 +22454,7 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: } -/// Removes a revision. +/// Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted. /// /// A builder for the *delete* method supported by a *revision* resource. /// It is not used directly, but through a `RevisionMethods` instance. @@ -22745,10 +22553,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22768,7 +22573,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22846,7 +22651,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22997,10 +22802,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -23032,7 +22834,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -23132,7 +22934,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23284,10 +23086,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23307,7 +23106,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23399,7 +23198,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/drive3-cli/Cargo.toml b/gen/drive3-cli/Cargo.toml index 0d97a328f2..1d5fe33dae 100644 --- a/gen/drive3-cli/Cargo.toml +++ b/gen/drive3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive3-cli" -version = "1.0.8+20181004" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive3-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-drive3] path = "../drive3" -version = "1.0.8+20181004" +version = "1.0.8+20190328" diff --git a/gen/drive3-cli/README.md b/gen/drive3-cli/README.md index afeacc8138..a44900236e 100644 --- a/gen/drive3-cli/README.md +++ b/gen/drive3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *drive* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *drive* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash drive3 [options] diff --git a/gen/drive3-cli/mkdocs.yml b/gen/drive3-cli/mkdocs.yml index b20ae90ff7..e956f10fd2 100644 --- a/gen/drive3-cli/mkdocs.yml +++ b/gen/drive3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: drive v1.0.8+20181004 +site_name: drive v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-drive3-cli site_description: A complete library to interact with drive (protocol v3) diff --git a/gen/drive3-cli/src/main.rs b/gen/drive3-cli/src/main.rs index bdc4d98f7c..c94863ece4 100644 --- a/gen/drive3-cli/src/main.rs +++ b/gen/drive3-cli/src/main.rs @@ -887,6 +887,7 @@ impl<'n> Engine<'n> { "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "parents" => Some(("parents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "shared-with-me-time" => Some(("sharedWithMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "export-links" => Some(("exportLinks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "shared" => Some(("shared", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "copy-requires-writer-permission" => Some(("copyRequiresWriterPermission", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "full-file-extension" => Some(("fullFileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -945,7 +946,7 @@ impl<'n> Engine<'n> { "starred" => Some(("starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "head-revision-id" => Some(("headRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-add-children", "can-change-copy-requires-writer-permission", "can-change-viewers-can-copy-content", "can-comment", "can-copy", "can-delete", "can-delete-children", "can-download", "can-edit", "can-list-children", "can-move-children-out-of-team-drive", "can-move-children-within-team-drive", "can-move-item-into-team-drive", "can-move-item-out-of-team-drive", "can-move-item-within-team-drive", "can-move-team-drive-item", "can-read-revisions", "can-read-team-drive", "can-remove-children", "can-rename", "can-share", "can-trash", "can-trash-children", "can-untrash", "capabilities", "color-space", "content-hints", "copy-requires-writer-permission", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-augmented-permissions", "has-thumbnail", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "permission-ids", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "team-drive-id", "thumbnail", "thumbnail-link", "thumbnail-version", "time", "trashed", "trashed-time", "trashing-user", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-add-children", "can-change-copy-requires-writer-permission", "can-change-viewers-can-copy-content", "can-comment", "can-copy", "can-delete", "can-delete-children", "can-download", "can-edit", "can-list-children", "can-move-children-out-of-team-drive", "can-move-children-within-team-drive", "can-move-item-into-team-drive", "can-move-item-out-of-team-drive", "can-move-item-within-team-drive", "can-move-team-drive-item", "can-read-revisions", "can-read-team-drive", "can-remove-children", "can-rename", "can-share", "can-trash", "can-trash-children", "can-untrash", "capabilities", "color-space", "content-hints", "copy-requires-writer-permission", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-augmented-permissions", "has-thumbnail", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "permission-ids", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "team-drive-id", "thumbnail", "thumbnail-link", "thumbnail-version", "time", "trashed", "trashed-time", "trashing-user", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1099,6 +1100,7 @@ impl<'n> Engine<'n> { "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "parents" => Some(("parents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "shared-with-me-time" => Some(("sharedWithMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "export-links" => Some(("exportLinks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "shared" => Some(("shared", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "copy-requires-writer-permission" => Some(("copyRequiresWriterPermission", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "full-file-extension" => Some(("fullFileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1157,7 +1159,7 @@ impl<'n> Engine<'n> { "starred" => Some(("starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "head-revision-id" => Some(("headRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-add-children", "can-change-copy-requires-writer-permission", "can-change-viewers-can-copy-content", "can-comment", "can-copy", "can-delete", "can-delete-children", "can-download", "can-edit", "can-list-children", "can-move-children-out-of-team-drive", "can-move-children-within-team-drive", "can-move-item-into-team-drive", "can-move-item-out-of-team-drive", "can-move-item-within-team-drive", "can-move-team-drive-item", "can-read-revisions", "can-read-team-drive", "can-remove-children", "can-rename", "can-share", "can-trash", "can-trash-children", "can-untrash", "capabilities", "color-space", "content-hints", "copy-requires-writer-permission", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-augmented-permissions", "has-thumbnail", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "permission-ids", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "team-drive-id", "thumbnail", "thumbnail-link", "thumbnail-version", "time", "trashed", "trashed-time", "trashing-user", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-add-children", "can-change-copy-requires-writer-permission", "can-change-viewers-can-copy-content", "can-comment", "can-copy", "can-delete", "can-delete-children", "can-download", "can-edit", "can-list-children", "can-move-children-out-of-team-drive", "can-move-children-within-team-drive", "can-move-item-into-team-drive", "can-move-item-out-of-team-drive", "can-move-item-within-team-drive", "can-move-team-drive-item", "can-read-revisions", "can-read-team-drive", "can-remove-children", "can-rename", "can-share", "can-trash", "can-trash-children", "can-untrash", "capabilities", "color-space", "content-hints", "copy-requires-writer-permission", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-augmented-permissions", "has-thumbnail", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "permission-ids", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "team-drive-id", "thumbnail", "thumbnail-link", "thumbnail-version", "time", "trashed", "trashed-time", "trashing-user", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1677,6 +1679,7 @@ impl<'n> Engine<'n> { "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "parents" => Some(("parents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "shared-with-me-time" => Some(("sharedWithMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "export-links" => Some(("exportLinks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "shared" => Some(("shared", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "copy-requires-writer-permission" => Some(("copyRequiresWriterPermission", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "full-file-extension" => Some(("fullFileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1735,7 +1738,7 @@ impl<'n> Engine<'n> { "starred" => Some(("starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "head-revision-id" => Some(("headRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-add-children", "can-change-copy-requires-writer-permission", "can-change-viewers-can-copy-content", "can-comment", "can-copy", "can-delete", "can-delete-children", "can-download", "can-edit", "can-list-children", "can-move-children-out-of-team-drive", "can-move-children-within-team-drive", "can-move-item-into-team-drive", "can-move-item-out-of-team-drive", "can-move-item-within-team-drive", "can-move-team-drive-item", "can-read-revisions", "can-read-team-drive", "can-remove-children", "can-rename", "can-share", "can-trash", "can-trash-children", "can-untrash", "capabilities", "color-space", "content-hints", "copy-requires-writer-permission", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-augmented-permissions", "has-thumbnail", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "permission-ids", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "team-drive-id", "thumbnail", "thumbnail-link", "thumbnail-version", "time", "trashed", "trashed-time", "trashing-user", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-add-children", "can-change-copy-requires-writer-permission", "can-change-viewers-can-copy-content", "can-comment", "can-copy", "can-delete", "can-delete-children", "can-download", "can-edit", "can-list-children", "can-move-children-out-of-team-drive", "can-move-children-within-team-drive", "can-move-item-into-team-drive", "can-move-item-out-of-team-drive", "can-move-item-within-team-drive", "can-move-team-drive-item", "can-read-revisions", "can-read-team-drive", "can-remove-children", "can-rename", "can-share", "can-trash", "can-trash-children", "can-untrash", "capabilities", "color-space", "content-hints", "copy-requires-writer-permission", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "export-links", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "has-augmented-permissions", "has-thumbnail", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "is-app-authorized", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "permission-ids", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "team-drive-id", "thumbnail", "thumbnail-link", "thumbnail-version", "time", "trashed", "trashed-time", "trashing-user", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2883,13 +2886,14 @@ impl<'n> Engine<'n> { "keep-forever" => Some(("keepForever", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "publish-auto" => Some(("publishAuto", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "original-filename" => Some(("originalFilename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "export-links" => Some(("exportLinks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "published" => Some(("published", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "size" => Some(("size", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "md5-checksum" => Some(("md5Checksum", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "published-outside-domain" => Some(("publishedOutsideDomain", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["display-name", "email-address", "id", "keep-forever", "kind", "last-modifying-user", "md5-checksum", "me", "mime-type", "modified-time", "original-filename", "permission-id", "photo-link", "publish-auto", "published", "published-outside-domain", "size"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-name", "email-address", "export-links", "id", "keep-forever", "kind", "last-modifying-user", "md5-checksum", "me", "mime-type", "modified-time", "original-filename", "permission-id", "photo-link", "publish-auto", "published", "published-outside-domain", "size"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4410,7 +4414,7 @@ fn main() { ("revisions", "methods: 'delete', 'get', 'list' and 'update'", vec![ ("delete", - Some(r##"Permanently deletes a revision. This method is only applicable to files with binary content in Drive."##), + Some(r##"Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted."##), "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/revisions_delete", vec![ (Some(r##"file-id"##), @@ -4634,7 +4638,7 @@ fn main() { let mut app = App::new("drive3") .author("Sebastian Thiel ") - .version("1.0.8+20181004") + .version("1.0.8+20190328") .about("Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_drive3_cli") .arg(Arg::with_name("url") diff --git a/gen/drive3/Cargo.toml b/gen/drive3/Cargo.toml index 23e91edc19..c6fbb34a44 100644 --- a/gen/drive3/Cargo.toml +++ b/gen/drive3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-drive3" -version = "1.0.8+20181004" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive3" homepage = "https://developers.google.com/drive/" -documentation = "https://docs.rs/google-drive3/1.0.8+20181004" +documentation = "https://docs.rs/google-drive3/1.0.8+20190328" license = "MIT" keywords = ["drive", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/drive3/README.md b/gen/drive3/README.md index 724753fb0f..93c7d04b5d 100644 --- a/gen/drive3/README.md +++ b/gen/drive3/README.md @@ -5,53 +5,53 @@ DO NOT EDIT ! --> The `google-drive3` library allows access to all features of the *Google drive* service. -This documentation was generated from *drive* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *drive* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *drive* *v3* API can be found at the [official documentation site](https://developers.google.com/drive/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.Drive.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.Drive.html) ... -* [about](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.About.html) - * [*get*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.AboutGetCall.html) -* [changes](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.Change.html) - * [*get start page token*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ChangeGetStartPageTokenCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ChangeListCall.html) and [*watch*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ChangeWatchCall.html) -* [channels](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.Channel.html) - * [*stop*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ChannelStopCall.html) -* [comments](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.Comment.html) - * [*create*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.CommentCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.CommentDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.CommentGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.CommentListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.CommentUpdateCall.html) -* [files](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.File.html) - * [*copy*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileCopyCall.html), [*create*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileDeleteCall.html), [*empty trash*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileEmptyTrashCall.html), [*export*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileExportCall.html), [*generate ids*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileGenerateIdCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileListCall.html), [*update*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileUpdateCall.html) and [*watch*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileWatchCall.html) -* [permissions](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.Permission.html) - * [*create*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.PermissionCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.PermissionDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.PermissionGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.PermissionListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.PermissionUpdateCall.html) -* [replies](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.Reply.html) - * [*create*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ReplyCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ReplyDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ReplyGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ReplyListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ReplyUpdateCall.html) -* [revisions](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.Revision.html) - * [*delete*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.RevisionDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.RevisionGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.RevisionListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.RevisionUpdateCall.html) +* [about](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.About.html) + * [*get*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.AboutGetCall.html) +* [changes](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.Change.html) + * [*get start page token*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ChangeGetStartPageTokenCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ChangeListCall.html) and [*watch*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ChangeWatchCall.html) +* [channels](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.Channel.html) + * [*stop*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ChannelStopCall.html) +* [comments](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.Comment.html) + * [*create*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.CommentCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.CommentDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.CommentGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.CommentListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.CommentUpdateCall.html) +* [files](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.File.html) + * [*copy*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileCopyCall.html), [*create*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileDeleteCall.html), [*empty trash*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileEmptyTrashCall.html), [*export*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileExportCall.html), [*generate ids*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileGenerateIdCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileListCall.html), [*update*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileUpdateCall.html) and [*watch*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileWatchCall.html) +* [permissions](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.Permission.html) + * [*create*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.PermissionCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.PermissionDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.PermissionGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.PermissionListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.PermissionUpdateCall.html) +* [replies](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.Reply.html) + * [*create*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ReplyCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ReplyDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ReplyGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ReplyListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ReplyUpdateCall.html) +* [revisions](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.Revision.html) + * [*delete*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.RevisionDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.RevisionGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.RevisionListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.RevisionUpdateCall.html) * teamdrives - * [*create*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.TeamdriveCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.TeamdriveDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.TeamdriveGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.TeamdriveListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.TeamdriveUpdateCall.html) + * [*create*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.TeamdriveCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.TeamdriveDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.TeamdriveGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.TeamdriveListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.TeamdriveUpdateCall.html) Upload supported by ... -* [*update files*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileUpdateCall.html) -* [*create files*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileCreateCall.html) +* [*update files*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileUpdateCall.html) +* [*create files*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileCreateCall.html) Download supported by ... -* [*watch files*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileWatchCall.html) -* [*export files*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileExportCall.html) -* [*get revisions*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.RevisionGetCall.html) -* [*get files*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileGetCall.html) +* [*watch files*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileWatchCall.html) +* [*export files*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileExportCall.html) +* [*get revisions*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.RevisionGetCall.html) +* [*get files*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileGetCall.html) Subscription supported by ... -* [*watch files*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileWatchCall.html) -* [*watch changes*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ChangeWatchCall.html) -* [*list changes*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.ChangeListCall.html) -* [*create files*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileCreateCall.html) -* [*get files*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.FileGetCall.html) +* [*watch files*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileWatchCall.html) +* [*watch changes*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ChangeWatchCall.html) +* [*list changes*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.ChangeListCall.html) +* [*create files*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileCreateCall.html) +* [*get files*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.FileGetCall.html) @@ -59,17 +59,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/struct.Drive.html)** +* **[Hub](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/struct.Drive.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.Part.html)** + * **[Parts](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -179,17 +179,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -199,29 +199,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-drive3/1.0.8+20181004/google_drive3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-drive3/1.0.8+20190328/google_drive3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/drive3/src/lib.rs b/gen/drive3/src/lib.rs index 16da1c0237..cc1d813533 100644 --- a/gen/drive3/src/lib.rs +++ b/gen/drive3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *drive* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *drive* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *drive* *v3* API can be found at the //! [official documentation site](https://developers.google.com/drive/). @@ -280,7 +280,7 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// View and manage the files in your Google Drive + /// See, edit, create, and delete all of your Google Drive files Full, /// View the photos, videos and albums in your Google Photos @@ -298,7 +298,7 @@ pub enum Scope { /// Modify your Google Apps Script scripts' behavior Script, - /// View the files in your Google Drive + /// See and download all your Google Drive files Readonly, /// View and manage its own configuration data in your Google Drive @@ -1043,12 +1043,15 @@ pub struct Revision { /// Whether subsequent revisions will be automatically republished. This is only applicable to Google Docs. #[serde(rename="publishAuto")] pub publish_auto: Option, - /// The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive. - #[serde(rename="md5Checksum")] - pub md5_checksum: Option, /// Whether this revision is published outside the domain. This is only applicable to Google Docs. #[serde(rename="publishedOutsideDomain")] pub published_outside_domain: Option, + /// The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive. + #[serde(rename="md5Checksum")] + pub md5_checksum: Option, + /// Links for exporting Google Docs to specific formats. + #[serde(rename="exportLinks")] + pub export_links: Option>, /// Whether this revision is published. This is only applicable to Google Docs. pub published: Option, /// The ID of the revision. @@ -1506,6 +1509,9 @@ pub struct File { /// The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive. #[serde(rename="md5Checksum")] pub md5_checksum: Option, + /// Links for exporting Google Docs to specific formats. + #[serde(rename="exportLinks")] + pub export_links: Option>, /// Whether the file has been shared. Not populated for Team Drive files. pub shared: Option, /// Whether the options to copy, print, or download this file, should be disabled for readers and commenters. @@ -2564,7 +2570,7 @@ impl<'a, C, A> RevisionMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Permanently deletes a revision. This method is only applicable to files with binary content in Drive. + /// Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted. /// /// # Arguments /// @@ -3007,10 +3013,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3042,7 +3045,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3146,7 +3149,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3335,10 +3338,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3399,7 +3399,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -3606,7 +3606,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3752,10 +3752,7 @@ impl<'a, C, A> FileExportCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3775,7 +3772,7 @@ impl<'a, C, A> FileExportCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3853,7 +3850,7 @@ impl<'a, C, A> FileExportCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4022,10 +4019,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4057,7 +4051,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4175,7 +4169,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4293,10 +4287,7 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4316,7 +4307,7 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4374,7 +4365,7 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4543,10 +4534,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4566,7 +4554,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4704,7 +4692,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4833,10 +4821,7 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4856,7 +4841,7 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4938,7 +4923,7 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5099,10 +5084,7 @@ impl<'a, C, A> FileCreateCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5163,7 +5145,7 @@ impl<'a, C, A> FileCreateCall<'a, C, A> where C: BorrowMut, A: oa _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -5353,7 +5335,7 @@ impl<'a, C, A> FileCreateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5499,10 +5481,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5522,7 +5501,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5597,7 +5576,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5770,10 +5749,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5793,7 +5769,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5885,7 +5861,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6032,10 +6008,7 @@ impl<'a, C, A> TeamdriveGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6055,7 +6028,7 @@ impl<'a, C, A> TeamdriveGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6140,7 +6113,7 @@ impl<'a, C, A> TeamdriveGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6268,10 +6241,7 @@ impl<'a, C, A> TeamdriveCreateCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6303,7 +6273,7 @@ impl<'a, C, A> TeamdriveCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6393,7 +6363,7 @@ impl<'a, C, A> TeamdriveCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6532,10 +6502,7 @@ impl<'a, C, A> TeamdriveListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6555,7 +6522,7 @@ impl<'a, C, A> TeamdriveListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6651,7 +6618,7 @@ impl<'a, C, A> TeamdriveListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6792,10 +6759,7 @@ impl<'a, C, A> TeamdriveDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6815,7 +6779,7 @@ impl<'a, C, A> TeamdriveDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6883,7 +6847,7 @@ impl<'a, C, A> TeamdriveDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7037,10 +7001,7 @@ impl<'a, C, A> TeamdriveUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7072,7 +7033,7 @@ impl<'a, C, A> TeamdriveUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7169,7 +7130,7 @@ impl<'a, C, A> TeamdriveUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7288,10 +7249,7 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7311,7 +7269,7 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7379,7 +7337,7 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7522,10 +7480,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7545,7 +7500,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7623,7 +7578,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7772,10 +7727,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7795,7 +7747,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7890,7 +7842,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8041,10 +7993,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8076,7 +8025,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8176,7 +8125,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8325,10 +8274,7 @@ impl<'a, C, A> CommentCreateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8360,7 +8306,7 @@ impl<'a, C, A> CommentCreateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8450,7 +8396,7 @@ impl<'a, C, A> CommentCreateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8612,10 +8558,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8635,7 +8578,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8741,7 +8684,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8866,10 +8809,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8901,7 +8841,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8971,7 +8911,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9122,10 +9062,7 @@ impl<'a, C, A> ReplyCreateCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9157,7 +9094,7 @@ impl<'a, C, A> ReplyCreateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9257,7 +9194,7 @@ impl<'a, C, A> ReplyCreateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9416,10 +9353,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9439,7 +9373,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9548,7 +9482,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9699,10 +9633,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9722,7 +9653,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9827,7 +9758,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9972,10 +9903,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9995,7 +9923,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10083,7 +10011,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10236,10 +10164,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10271,7 +10196,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10381,7 +10306,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10532,10 +10457,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10567,7 +10489,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10667,7 +10589,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10837,10 +10759,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10860,7 +10779,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10955,7 +10874,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10999,7 +10918,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o } -/// Permanently deletes a revision. This method is only applicable to files with binary content in Drive. +/// Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted. /// /// A builder for the *delete* method supported by a *revision* resource. /// It is not used directly, but through a `RevisionMethods` instance. @@ -11098,10 +11017,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11121,7 +11037,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11199,7 +11115,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11351,10 +11267,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11374,7 +11287,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11466,7 +11379,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11627,10 +11540,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11650,7 +11560,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11784,7 +11694,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11913,10 +11823,7 @@ impl<'a, C, A> ChangeGetStartPageTokenCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11936,7 +11843,7 @@ impl<'a, C, A> ChangeGetStartPageTokenCall<'a, C, A> where C: BorrowMut ChangeGetStartPageTokenCall<'a, C, A> where C: BorrowMut ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12221,7 +12125,7 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12367,7 +12271,7 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12520,10 +12424,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12543,7 +12444,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12635,7 +12536,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12806,10 +12707,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12841,7 +12739,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12969,7 +12867,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13131,10 +13029,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13154,7 +13049,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13260,7 +13155,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13414,10 +13309,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13437,7 +13329,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13539,7 +13431,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13713,10 +13605,7 @@ impl<'a, C, A> PermissionCreateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13748,7 +13637,7 @@ impl<'a, C, A> PermissionCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13873,7 +13762,7 @@ impl<'a, C, A> PermissionCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/driveactivity2-cli/Cargo.toml b/gen/driveactivity2-cli/Cargo.toml new file mode 100644 index 0000000000..d056c41bc5 --- /dev/null +++ b/gen/driveactivity2-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-driveactivity2-cli" +version = "1.0.8+20190402" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Drive Activity (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/driveactivity2-cli" +homepage = "https://developers.google.com/drive/activity/" +documentation = "http://byron.github.io/google-apis-rs/google_driveactivity2_cli" +license = "MIT" +keywords = ["driveactivity", "google", "cli"] +autobins = false + +[[bin]] +name = "driveactivity2" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-driveactivity2] +path = "../driveactivity2" +version = "1.0.8+20190402" diff --git a/gen/driveactivity2-cli/LICENSE.md b/gen/driveactivity2-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/driveactivity2-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/driveactivity2-cli/README.md b/gen/driveactivity2-cli/README.md new file mode 100644 index 0000000000..4870bdf9d6 --- /dev/null +++ b/gen/driveactivity2-cli/README.md @@ -0,0 +1,114 @@ + +The `driveactivity2` command-line interface *(CLI)* allows to use most features of the *Google Drive Activity* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Drive Activity* API can be found at the +[official documentation site](https://developers.google.com/drive/activity/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-driveactivity2-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/driveactivity2-cli). + +# Usage + +This documentation was generated from the *Drive Activity* API at revision *20190402*. The CLI is at version *1.0.8*. + +```bash +driveactivity2 [options] + activity + query (-r )... [-p ]... [-o ] + driveactivity2 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `driveactivity2-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/driveactivity2-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/driveactivity2-secret.json`, assuming that the required *driveactivity* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `driveactivity2 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/driveactivity2-cli/mkdocs.yml b/gen/driveactivity2-cli/mkdocs.yml new file mode 100644 index 0000000000..a38f76a19a --- /dev/null +++ b/gen/driveactivity2-cli/mkdocs.yml @@ -0,0 +1,17 @@ +site_name: Drive Activity v1.0.8+20190402 +site_url: http://byron.github.io/google-apis-rs/google-driveactivity2-cli +site_description: A complete library to interact with Drive Activity (protocol v2) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/driveactivity2-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['activity_query.md', 'Activity', 'Query'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/driveactivity2-cli/src/cmn.rs b/gen/driveactivity2-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/driveactivity2-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/driveactivity2-cli/src/main.rs b/gen/driveactivity2-cli/src/main.rs new file mode 100644 index 0000000000..43be2e99e5 --- /dev/null +++ b/gen/driveactivity2-cli/src/main.rs @@ -0,0 +1,361 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_driveactivity2 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::DriveActivityHub>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _activity_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ancestor-name" => Some(("ancestorName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "item-name" => Some(("itemName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["ancestor-name", "filter", "item-name", "page-size", "page-token"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::QueryDriveActivityRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.activity().query(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("activity", Some(opt)) => { + match opt.subcommand() { + ("query", Some(opt)) => { + call_result = self._activity_query(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("activity".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "driveactivity2-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "driveactivity2", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::DriveActivityHub::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("activity", "methods: 'query'", vec![ + ("query", + Some(r##"Query past activity in Google Drive."##), + "Details at http://byron.github.io/google-apis-rs/google_driveactivity2_cli/activity_query", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("driveactivity2") + .author("Sebastian Thiel ") + .version("1.0.8+20190402") + .about("Provides a historical view of activity in Google Drive.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_driveactivity2_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/driveactivity2/Cargo.toml b/gen/driveactivity2/Cargo.toml new file mode 100644 index 0000000000..d7afb40828 --- /dev/null +++ b/gen/driveactivity2/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-driveactivity2" +version = "1.0.8+20190402" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Drive Activity (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/driveactivity2" +homepage = "https://developers.google.com/drive/activity/" +documentation = "https://docs.rs/google-driveactivity2/1.0.8+20190402" +license = "MIT" +keywords = ["driveactivity", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/driveactivity2/LICENSE.md b/gen/driveactivity2/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/driveactivity2/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/driveactivity2/README.md b/gen/driveactivity2/README.md new file mode 100644 index 0000000000..8bddad96b1 --- /dev/null +++ b/gen/driveactivity2/README.md @@ -0,0 +1,188 @@ + +The `google-driveactivity2` library allows access to all features of the *Google Drive Activity* service. + +This documentation was generated from *Drive Activity* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *driveactivity:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Drive Activity* *v2* API can be found at the +[official documentation site](https://developers.google.com/drive/activity/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/struct.DriveActivityHub.html) ... + +* activity + * [*query*](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/struct.ActivityQueryCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/struct.DriveActivityHub.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.activity().query(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-driveactivity2 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_driveactivity2 as driveactivity2; +use driveactivity2::QueryDriveActivityRequest; +use driveactivity2::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use driveactivity2::DriveActivityHub; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = DriveActivityHub::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = QueryDriveActivityRequest::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.activity().query(req) + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-driveactivity2/1.0.8+20190402/google_driveactivity2/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **driveactivity2** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/driveactivity2/src/cmn.rs b/gen/driveactivity2/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/driveactivity2/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/driveactivity2/src/lib.rs b/gen/driveactivity2/src/lib.rs new file mode 100644 index 0000000000..dffe1270d0 --- /dev/null +++ b/gen/driveactivity2/src/lib.rs @@ -0,0 +1,1565 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Drive Activity* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *driveactivity:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Drive Activity* *v2* API can be found at the +//! [official documentation site](https://developers.google.com/drive/activity/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/driveactivity2). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.DriveActivityHub.html) ... +//! +//! * activity +//! * [*query*](struct.ActivityQueryCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.DriveActivityHub.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.activity().query(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-driveactivity2 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_driveactivity2 as driveactivity2; +//! use driveactivity2::QueryDriveActivityRequest; +//! use driveactivity2::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use driveactivity2::DriveActivityHub; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = DriveActivityHub::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = QueryDriveActivityRequest::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.activity().query(req) +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and add to the activity record of files in your Google Drive + DriveActivity, + + /// View the activity record of files in your Google Drive + DriveActivityReadonly, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::DriveActivity => "https://www.googleapis.com/auth/drive.activity", + Scope::DriveActivityReadonly => "https://www.googleapis.com/auth/drive.activity.readonly", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::DriveActivityReadonly + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all DriveActivityHub related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_driveactivity2 as driveactivity2; +/// use driveactivity2::QueryDriveActivityRequest; +/// use driveactivity2::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use driveactivity2::DriveActivityHub; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = DriveActivityHub::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = QueryDriveActivityRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.activity().query(req) +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct DriveActivityHub { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for DriveActivityHub {} + +impl<'a, C, A> DriveActivityHub + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> DriveActivityHub { + DriveActivityHub { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://driveactivity.googleapis.com/".to_string(), + _root_url: "https://driveactivity.googleapis.com/".to_string(), + } + } + + pub fn activity(&'a self) -> ActivityMethods<'a, C, A> { + ActivityMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://driveactivity.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://driveactivity.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Information about an impersonation, where an admin acts on behalf of an end +/// user. Information about the acting admin is not currently available. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Impersonation { + /// The impersonated user. + #[serde(rename="impersonatedUser")] + pub impersonated_user: Option, +} + +impl Part for Impersonation {} + + +/// Information about a group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Group { + /// The email address of the group. + pub email: Option, + /// The title of the group. + pub title: Option, +} + +impl Part for Group {} + + +/// A change of the permission setting on an item. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PermissionChange { + /// The set of permissions removed by this change. + #[serde(rename="removedPermissions")] + pub removed_permissions: Option>, + /// The set of permissions added by this change. + #[serde(rename="addedPermissions")] + pub added_permissions: Option>, +} + +impl Part for PermissionChange {} + + +/// An object was created. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Create { + /// If present, indicates the object was newly created (e.g. as a blank + /// document), not derived from a Drive object or external object. + pub new: Option, + /// If present, indicates the object was created by copying an existing Drive + /// object. + pub copy: Option, + /// If present, indicates the object originated externally and was uploaded + /// to Drive. + pub upload: Option, +} + +impl Part for Create {} + + +/// Information about time ranges. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TimeRange { + /// The end of the time range. + #[serde(rename="endTime")] + pub end_time: Option, + /// The start of the time range. + #[serde(rename="startTime")] + pub start_time: Option, +} + +impl Part for TimeRange {} + + +/// Activity in applications other than Drive. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ApplicationReference { + /// The reference type corresponding to this event. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for ApplicationReference {} + + +/// The actor of a Drive activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Actor { + /// An account acting on behalf of another. + pub impersonation: Option, + /// An administrator. + pub administrator: Option, + /// A non-user actor (i.e. system triggered). + pub system: Option, + /// An anonymous user. + pub anonymous: Option, + /// An end user. + pub user: Option, +} + +impl Part for Actor {} + + +/// Information about restriction policy changes to a feature. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RestrictionChange { + /// The feature which had a change in restriction policy. + pub feature: Option, + /// The restriction in place after the change. + #[serde(rename="newRestriction")] + pub new_restriction: Option, +} + +impl Part for RestrictionChange {} + + +/// Represents any user (including a logged out user). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Anyone { _never_set: Option } + +impl Part for Anyone {} + + +/// A user about whom nothing is currently known. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UnknownUser { _never_set: Option } + +impl Part for UnknownUser {} + + +/// An object was created from scratch. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct New { _never_set: Option } + +impl Part for New {} + + +/// A Drive item which is a folder. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Folder { + /// The type of Drive folder. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for Folder {} + + +/// A user whose account has since been deleted. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeletedUser { _never_set: Option } + +impl Part for DeletedUser {} + + +/// Information about a Team Drive. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TeamDrive { + /// The root of this Team Drive. + pub root: Option, + /// The resource name of the Team Drive. The format is + /// "teamDrives/TEAM_DRIVE_ID". + pub name: Option, + /// The title of the Team Drive. + pub title: Option, +} + +impl Part for TeamDrive {} + + +/// Empty message representing an administrator. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Administrator { _never_set: Option } + +impl Part for Administrator {} + + +/// The permission setting of an object. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Permission { + /// If set, this permission applies to anyone, even logged out users. + pub anyone: Option, + /// The domain to whom this permission applies. + pub domain: Option, + /// The group to whom this permission applies. + pub group: Option, + /// If true, the item can be discovered (e.g. in the user's "Shared with me" + /// collection) without needing a link to the item. + #[serde(rename="allowDiscovery")] + pub allow_discovery: Option, + /// Indicates the + /// Google Drive permissions + /// role. The role determines a user's ability to read, write, and + /// comment on items. + pub role: Option, + /// The user to whom this permission applies. + pub user: Option, +} + +impl Part for Permission {} + + +/// A comment with an assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Assignment { + /// The sub-type of this event. + pub subtype: Option, +} + +impl Part for Assignment {} + + +/// Event triggered by system operations instead of end users. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SystemEvent { + /// The type of the system event that may triggered activity. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for SystemEvent {} + + +/// Empty message representing an anonymous user or indicating the authenticated +/// user should be anonymized. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AnonymousUser { _never_set: Option } + +impl Part for AnonymousUser {} + + +/// Data describing the type and additional information of an action. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ActionDetail { + /// A change about comments was made. + pub comment: Option, + /// A change happened in data leak prevention status. + #[serde(rename="dlpChange")] + pub dlp_change: Option, + /// An object was referenced in an application outside of Drive/Docs. + pub reference: Option, + /// The permission on an object was changed. + #[serde(rename="permissionChange")] + pub permission_change: Option, + /// An object was edited. + pub edit: Option, + /// Settings were changed. + #[serde(rename="settingsChange")] + pub settings_change: Option, + /// An object was created. + pub create: Option, + /// An object was moved. + #[serde(rename="move")] + pub move_: Option, + /// An object was renamed. + pub rename: Option, + /// A deleted object was restored. + pub restore: Option, + /// An object was deleted. + pub delete: Option, +} + +impl Part for ActionDetail {} + + +/// A Drive item, such as a file or folder. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DriveItem { + /// The MIME type of the Drive item. See + /// https://developers.google.com/drive/v3/web/mime-types. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// The target Drive item. The format is "items/ITEM_ID". + pub name: Option, + /// The Drive item is a file. + pub file: Option, + /// The title of the Drive item. + pub title: Option, + /// Information about the owner of this Drive item. + pub owner: Option, + /// The Drive item is a folder. + pub folder: Option, +} + +impl Part for DriveItem {} + + +/// A regular posted comment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Post { + /// The sub-type of this event. + pub subtype: Option, +} + +impl Part for Post {} + + +/// An object was created by copying an existing object. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Copy { + /// The the original object. + #[serde(rename="originalObject")] + pub original_object: Option, +} + +impl Part for Copy {} + + +/// A lightweight reference to a Drive item, such as a file or folder. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DriveItemReference { + /// The Drive item is a folder. + pub folder: Option, + /// The target Drive item. The format is "items/ITEM_ID". + pub name: Option, + /// The Drive item is a file. + pub file: Option, + /// The title of the Drive item. + pub title: Option, +} + +impl Part for DriveItemReference {} + + +/// A change in the object's data leak prevention status. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DataLeakPreventionChange { + /// The type of Data Leak Prevention (DLP) change. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for DataLeakPreventionChange {} + + +/// A change about comments on an object. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Comment { + /// A change on an assignment. + pub assignment: Option, + /// A change on a regular posted comment. + pub post: Option, + /// Users who are mentioned in this comment. + #[serde(rename="mentionedUsers")] + pub mentioned_users: Option>, + /// A change on a suggestion. + pub suggestion: Option, +} + +impl Part for Comment {} + + +/// Information about the target of activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Target { + /// The target is a Team Drive. + #[serde(rename="teamDrive")] + pub team_drive: Option, + /// The target is a comment on a Drive file. + #[serde(rename="fileComment")] + pub file_comment: Option, + /// The target is a Drive item. + #[serde(rename="driveItem")] + pub drive_item: Option, +} + +impl Part for Target {} + + +/// An empty message indicating an object was edited. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Edit { _never_set: Option } + +impl Part for Edit {} + + +/// A strategy which does no consolidation of individual activities. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NoConsolidation { _never_set: Option } + +impl Part for NoConsolidation {} + + +/// A lightweight reference to the target of activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetReference { + /// The target is a Team Drive. + #[serde(rename="teamDrive")] + pub team_drive: Option, + /// The target is a Drive item. + #[serde(rename="driveItem")] + pub drive_item: Option, +} + +impl Part for TargetReference {} + + +/// An object was uploaded into Drive. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Upload { _never_set: Option } + +impl Part for Upload {} + + +/// A comment on a file. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileComment { + /// The comment in the discussion thread. This identifier is an opaque string + /// compatible with the Drive API; see + /// https://developers.google.com/drive/v3/reference/comments/get + #[serde(rename="legacyCommentId")] + pub legacy_comment_id: Option, + /// The discussion thread to which the comment was added. This identifier is an + /// opaque string compatible with the Drive API and references the first + /// comment in a discussion; see + /// https://developers.google.com/drive/v3/reference/comments/get + #[serde(rename="legacyDiscussionId")] + pub legacy_discussion_id: Option, + /// The Drive item containing this comment. + pub parent: Option, + /// The link to the discussion thread containing this comment, for example, + /// "https://docs.google.com/DOCUMENT_ID/edit?disco=THREAD_ID". + #[serde(rename="linkToDiscussion")] + pub link_to_discussion: Option, +} + +impl Part for FileComment {} + + +/// A suggestion. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Suggestion { + /// The sub-type of this event. + pub subtype: Option, +} + +impl Part for Suggestion {} + + +/// Information about the action. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Action { + /// The action occurred at this specific time. + pub timestamp: Option, + /// The action occurred over this time range. + #[serde(rename="timeRange")] + pub time_range: Option, + /// The type and detailed information about the action. + pub detail: Option, + /// The actor responsible for this action (or empty if all actors are + /// responsible). + pub actor: Option, + /// The target this action affects (or empty if affecting all targets). This + /// represents the state of the target immediately after this action occurred. + pub target: Option, +} + +impl Part for Action {} + + +/// A single Drive activity comprising one or more Actions by one or more +/// Actors on one or more Targets. Some Action groupings occur spontaneously, +/// such as moving an item into a shared folder triggering a permission change. +/// Other groupings of related Actions, such as multiple Actors editing one item +/// or moving multiple files into a new folder, are controlled by the selection +/// of a ConsolidationStrategy in the QueryDriveActivityRequest. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DriveActivity { + /// Key information about the primary action for this activity. This is either + /// representative, or the most important, of all actions in the activity, + /// according to the ConsolidationStrategy in the request. + #[serde(rename="primaryActionDetail")] + pub primary_action_detail: Option, + /// The activity occurred at this specific time. + pub timestamp: Option, + /// The activity occurred over this time range. + #[serde(rename="timeRange")] + pub time_range: Option, + /// All actor(s) responsible for the activity. + pub actors: Option>, + /// Details on all actions in this activity. + pub actions: Option>, + /// All Drive objects this activity is about (e.g. file, folder, Team Drive). + /// This represents the state of the target immediately after the actions + /// occurred. + pub targets: Option>, +} + +impl Part for DriveActivity {} + + +/// An object was deleted. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Delete { + /// The type of delete action taken. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for Delete {} + + +/// An object was renamed. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Rename { + /// The new title of the drive object. + #[serde(rename="newTitle")] + pub new_title: Option, + /// The previous title of the drive object. + #[serde(rename="oldTitle")] + pub old_title: Option, +} + +impl Part for Rename {} + + +/// A deleted object was restored. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Restore { + /// The type of restore action taken. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for Restore {} + + +/// Information about a domain. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Domain { + /// The name of the domain, e.g. "google.com". + pub name: Option, + /// An opaque string used to identify this domain. + #[serde(rename="legacyId")] + pub legacy_id: Option, +} + +impl Part for Domain {} + + +/// The request message for querying Drive activity. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query activity](struct.ActivityQueryCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryDriveActivityRequest { + /// The filtering for items returned from this query request. The format of the + /// filter string is a sequence of expressions, joined by an optional "AND", + /// where each expression is of the form "field operator value". + /// + /// Supported fields: + /// + /// - time: Uses numerical operators on date values either in + /// terms of milliseconds since Jan 1, 1970 or in RFC 3339 format. + /// Examples: + /// - time > 1452409200000 AND time <= 1492812924310 + /// - time >= "2016-01-10T01:02:03-05:00" + /// + /// - detail.action_detail_case: Uses the "has" operator (:) and + /// either a singular value or a list of allowed action types enclosed in + /// parentheses. + /// Examples: + /// - detail.action_detail_case: RENAME + /// - detail.action_detail_case:(CREATE UPLOAD) + /// - -detail.action_detail_case:MOVE + pub filter: Option, + /// The next_page_token value returned from a previous QueryDriveActivity + /// request, if any. + #[serde(rename="pageToken")] + pub page_token: Option, + /// Details on how to consolidate related actions that make up the activity. If + /// not set, then related actions will not be consolidated. + #[serde(rename="consolidationStrategy")] + pub consolidation_strategy: Option, + /// The requested number of activity to return. If not set, a default value + /// will be used. + #[serde(rename="pageSize")] + pub page_size: Option, + /// Return activities for this Drive folder and all children and descendants. + /// The format is "items/ITEM_ID". + #[serde(rename="ancestorName")] + pub ancestor_name: Option, + /// Return activities for this Drive item. The format is + /// "items/ITEM_ID". + #[serde(rename="itemName")] + pub item_name: Option, +} + +impl RequestValue for QueryDriveActivityRequest {} + + +/// A known user. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct KnownUser { + /// The identifier for this user that can be used with the People API to get + /// more information. The format is "people/ACCOUNT_ID". See + /// https://developers.google.com/people/. + #[serde(rename="personName")] + pub person_name: Option, + /// True if this is the user making the request. + #[serde(rename="isCurrentUser")] + pub is_current_user: Option, +} + +impl Part for KnownUser {} + + +/// An object was moved. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Move { + /// The removed parent object(s). + #[serde(rename="removedParents")] + pub removed_parents: Option>, + /// The added parent object(s). + #[serde(rename="addedParents")] + pub added_parents: Option>, +} + +impl Part for Move {} + + +/// A lightweight reference to a Team Drive. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TeamDriveReference { + /// The resource name of the Team Drive. The format is + /// "teamDrives/TEAM_DRIVE_ID". + pub name: Option, + /// The title of the Team Drive. + pub title: Option, +} + +impl Part for TeamDriveReference {} + + +/// How the individual activities are consolidated. A set of activities may be +/// consolidated into one combined activity if they are related in some way, such +/// as one actor performing the same action on multiple targets, or multiple +/// actors performing the same action on a single target. The strategy defines +/// the rules for which activities are related. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConsolidationStrategy { + /// The individual activities are not consolidated. + pub none: Option, + /// The individual activities are consolidated using the legacy strategy. + pub legacy: Option, +} + +impl Part for ConsolidationStrategy {} + + +/// A strategy which consolidates activities using the grouping rules from the +/// legacy V1 Activity API. Similar actions occurring within a window of time +/// can be grouped across multiple targets (such as moving a set of files at +/// once) or multiple actors (such as several users editing the same item). +/// Grouping rules for this strategy are specific to each type of action. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Legacy { _never_set: Option } + +impl Part for Legacy {} + + +/// Response message for querying Drive activity. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query activity](struct.ActivityQueryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryDriveActivityResponse { + /// Token to retrieve the next page of results, or + /// empty if there are no more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of activity requested. + pub activities: Option>, +} + +impl ResponseResult for QueryDriveActivityResponse {} + + +/// Information about an end user. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct User { + /// A user about whom nothing is currently known. + #[serde(rename="unknownUser")] + pub unknown_user: Option, + /// A user whose account has since been deleted. + #[serde(rename="deletedUser")] + pub deleted_user: Option, + /// A known user. + #[serde(rename="knownUser")] + pub known_user: Option, +} + +impl Part for User {} + + +/// A Drive item which is a file. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct File { _never_set: Option } + +impl Part for File {} + + +/// Information about settings changes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SettingsChange { + /// The set of changes made to restrictions. + #[serde(rename="restrictionChanges")] + pub restriction_changes: Option>, +} + +impl Part for SettingsChange {} + + +/// Information about the owner of a Drive item. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Owner { + /// The Team Drive that owns the Drive item. + #[serde(rename="teamDrive")] + pub team_drive: Option, + /// The domain of the Drive item owner. + pub domain: Option, + /// The user that owns the Drive item. + pub user: Option, +} + +impl Part for Owner {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *activity* resources. +/// It is not used directly, but through the `DriveActivityHub` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_driveactivity2 as driveactivity2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use driveactivity2::DriveActivityHub; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = DriveActivityHub::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `query(...)` +/// // to build up your call. +/// let rb = hub.activity(); +/// # } +/// ``` +pub struct ActivityMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a DriveActivityHub, +} + +impl<'a, C, A> MethodsBuilder for ActivityMethods<'a, C, A> {} + +impl<'a, C, A> ActivityMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Query past activity in Google Drive. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn query(&self, request: QueryDriveActivityRequest) -> ActivityQueryCall<'a, C, A> { + ActivityQueryCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Query past activity in Google Drive. +/// +/// A builder for the *query* method supported by a *activity* resource. +/// It is not used directly, but through a `ActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_driveactivity2 as driveactivity2; +/// use driveactivity2::QueryDriveActivityRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use driveactivity2::DriveActivityHub; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = DriveActivityHub::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = QueryDriveActivityRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.activity().query(req) +/// .doit(); +/// # } +/// ``` +pub struct ActivityQueryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a DriveActivityHub, + _request: QueryDriveActivityRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ActivityQueryCall<'a, C, A> {} + +impl<'a, C, A> ActivityQueryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, QueryDriveActivityResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "driveactivity.activity.query", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/activity:query"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DriveActivity.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: QueryDriveActivityRequest) -> ActivityQueryCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ActivityQueryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ActivityQueryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DriveActivity`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ActivityQueryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/factchecktools1_alpha1-cli/Cargo.toml b/gen/factchecktools1_alpha1-cli/Cargo.toml new file mode 100644 index 0000000000..69cd31858f --- /dev/null +++ b/gen/factchecktools1_alpha1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-factchecktools1_alpha1-cli" +version = "1.0.8+20190402" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Fact Check Tools (protocol v1alpha1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/factchecktools1_alpha1-cli" +homepage = "https://developers.google.com/fact-check/tools/api/" +documentation = "http://byron.github.io/google-apis-rs/google_factchecktools1_alpha1_cli" +license = "MIT" +keywords = ["factchecktools", "google", "cli"] +autobins = false + +[[bin]] +name = "factchecktools1-alpha1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-factchecktools1_alpha1] +path = "../factchecktools1_alpha1" +version = "1.0.8+20190402" diff --git a/gen/factchecktools1_alpha1-cli/LICENSE.md b/gen/factchecktools1_alpha1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/factchecktools1_alpha1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/factchecktools1_alpha1-cli/README.md b/gen/factchecktools1_alpha1-cli/README.md new file mode 100644 index 0000000000..b884e8a056 --- /dev/null +++ b/gen/factchecktools1_alpha1-cli/README.md @@ -0,0 +1,120 @@ + +The `factchecktools1-alpha1` command-line interface *(CLI)* allows to use most features of the *Google Fact Check Tools* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Fact Check Tools* API can be found at the +[official documentation site](https://developers.google.com/fact-check/tools/api/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-factchecktools1_alpha1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/factchecktools1_alpha1-cli). + +# Usage + +This documentation was generated from the *Fact Check Tools* API at revision *20190402*. The CLI is at version *1.0.8*. + +```bash +factchecktools1-alpha1 [options] + claims + search [-p ]... [-o ] + pages + create (-r )... [-p ]... [-o ] + delete [-p ]... [-o ] + get [-p ]... [-o ] + list [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + factchecktools1-alpha1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `factchecktools1-alpha1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/factchecktools1-alpha1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/factchecktools1-alpha1-secret.json`, assuming that the required *factchecktools* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `factchecktools1-alpha1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/factchecktools1_alpha1-cli/mkdocs.yml b/gen/factchecktools1_alpha1-cli/mkdocs.yml new file mode 100644 index 0000000000..8ba4e5d285 --- /dev/null +++ b/gen/factchecktools1_alpha1-cli/mkdocs.yml @@ -0,0 +1,22 @@ +site_name: Fact Check Tools v1.0.8+20190402 +site_url: http://byron.github.io/google-apis-rs/google-factchecktools1_alpha1-cli +site_description: A complete library to interact with Fact Check Tools (protocol v1alpha1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/factchecktools1_alpha1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['claims_search.md', 'Claims', 'Search'] +- ['pages_create.md', 'Pages', 'Create'] +- ['pages_delete.md', 'Pages', 'Delete'] +- ['pages_get.md', 'Pages', 'Get'] +- ['pages_list.md', 'Pages', 'List'] +- ['pages_update.md', 'Pages', 'Update'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/factchecktools1_alpha1-cli/src/cmn.rs b/gen/factchecktools1_alpha1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/factchecktools1_alpha1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/factchecktools1_alpha1-cli/src/main.rs b/gen/factchecktools1_alpha1-cli/src/main.rs new file mode 100644 index 0000000000..b430a9e817 --- /dev/null +++ b/gen/factchecktools1_alpha1-cli/src/main.rs @@ -0,0 +1,833 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_factchecktools1_alpha1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::FactCheckTools>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _claims_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.claims().search(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "review-publisher-site-filter" => { + call = call.review_publisher_site_filter(value.unwrap_or("")); + }, + "query" => { + call = call.query(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "offset" => { + call = call.offset(arg_from_str(value.unwrap_or("-0"), err, "offset", "integer")); + }, + "max-age-days" => { + call = call.max_age_days(arg_from_str(value.unwrap_or("-0"), err, "max-age-days", "integer")); + }, + "language-code" => { + call = call.language_code(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["max-age-days", "language-code", "page-size", "page-token", "review-publisher-site-filter", "offset", "query"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _pages_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "claim-review-author.image-url" => Some(("claimReviewAuthor.imageUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "claim-review-author.name" => Some(("claimReviewAuthor.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version-id" => Some(("versionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-url" => Some(("pageUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "publish-date" => Some(("publishDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["claim-review-author", "image-url", "name", "page-url", "publish-date", "version-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.pages().create(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _pages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.pages().delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _pages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.pages().get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _pages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.pages().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "url" => { + call = call.url(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "organization" => { + call = call.organization(value.unwrap_or("")); + }, + "offset" => { + call = call.offset(arg_from_str(value.unwrap_or("-0"), err, "offset", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["url", "page-token", "offset", "page-size", "organization"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _pages_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "claim-review-author.image-url" => Some(("claimReviewAuthor.imageUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "claim-review-author.name" => Some(("claimReviewAuthor.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version-id" => Some(("versionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-url" => Some(("pageUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "publish-date" => Some(("publishDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["claim-review-author", "image-url", "name", "page-url", "publish-date", "version-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.pages().update(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("claims", Some(opt)) => { + match opt.subcommand() { + ("search", Some(opt)) => { + call_result = self._claims_search(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("claims".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("pages", Some(opt)) => { + match opt.subcommand() { + ("create", Some(opt)) => { + call_result = self._pages_create(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._pages_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._pages_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._pages_list(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._pages_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("pages".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "factchecktools1-alpha1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "factchecktools1-alpha1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::FactCheckTools::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("claims", "methods: 'search'", vec![ + ("search", + Some(r##"Search through fact-checked claims."##), + "Details at http://byron.github.io/google-apis-rs/google_factchecktools1_alpha1_cli/claims_search", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("pages", "methods: 'create', 'delete', 'get', 'list' and 'update'", vec![ + ("create", + Some(r##"Create `ClaimReview` markup on a page."##), + "Details at http://byron.github.io/google-apis-rs/google_factchecktools1_alpha1_cli/pages_create", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Delete all `ClaimReview` markup on a page."##), + "Details at http://byron.github.io/google-apis-rs/google_factchecktools1_alpha1_cli/pages_delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the resource to delete, in the form of `pages/{page_id}`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Get all `ClaimReview` markup on a page."##), + "Details at http://byron.github.io/google-apis-rs/google_factchecktools1_alpha1_cli/pages_get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the resource to get, in the form of `pages/{page_id}`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"List the `ClaimReview` markup pages for a specific URL or for an + organization."##), + "Details at http://byron.github.io/google-apis-rs/google_factchecktools1_alpha1_cli/pages_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Update for all `ClaimReview` markup on a page + + Note that this is a full update. To retain the existing `ClaimReview` + markup on a page, first perform a Get operation, then modify the returned + markup, and finally call Update with the entire `ClaimReview` markup as the + body."##), + "Details at http://byron.github.io/google-apis-rs/google_factchecktools1_alpha1_cli/pages_update", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of this `ClaimReview` markup page resource, in the form of + `pages/{page_id}`. Except for update requests, this field is output-only + and should not be set by the user."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("factchecktools1-alpha1") + .author("Sebastian Thiel ") + .version("1.0.8+20190402") + .about("") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_factchecktools1_alpha1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/factchecktools1_alpha1/Cargo.toml b/gen/factchecktools1_alpha1/Cargo.toml new file mode 100644 index 0000000000..88d0fc577c --- /dev/null +++ b/gen/factchecktools1_alpha1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-factchecktools1_alpha1" +version = "1.0.8+20190402" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Fact Check Tools (protocol v1alpha1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/factchecktools1_alpha1" +homepage = "https://developers.google.com/fact-check/tools/api/" +documentation = "https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402" +license = "MIT" +keywords = ["factchecktools", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/factchecktools1_alpha1/LICENSE.md b/gen/factchecktools1_alpha1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/factchecktools1_alpha1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/factchecktools1_alpha1/README.md b/gen/factchecktools1_alpha1/README.md new file mode 100644 index 0000000000..a4a9f1967a --- /dev/null +++ b/gen/factchecktools1_alpha1/README.md @@ -0,0 +1,192 @@ + +The `google-factchecktools1_alpha1` library allows access to all features of the *Google Fact Check Tools* service. + +This documentation was generated from *Fact Check Tools* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *factchecktools:v1alpha1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Fact Check Tools* *v1_alpha1* API can be found at the +[official documentation site](https://developers.google.com/fact-check/tools/api/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/struct.FactCheckTools.html) ... + +* claims + * [*search*](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/struct.ClaimSearchCall.html) +* pages + * [*create*](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/struct.PageCreateCall.html), [*delete*](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/struct.PageDeleteCall.html), [*get*](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/struct.PageGetCall.html), [*list*](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/struct.PageListCall.html) and [*update*](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/struct.PageUpdateCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/struct.FactCheckTools.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.pages().create(...).doit() +let r = hub.pages().update(...).doit() +let r = hub.pages().get(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-factchecktools1_alpha1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +use factchecktools1_alpha1::GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage; +use factchecktools1_alpha1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use factchecktools1_alpha1::FactCheckTools; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.pages().update(req, "name") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-factchecktools1_alpha1/1.0.8+20190402/google_factchecktools1_alpha1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **factchecktools1_alpha1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/factchecktools1_alpha1/src/cmn.rs b/gen/factchecktools1_alpha1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/factchecktools1_alpha1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/factchecktools1_alpha1/src/lib.rs b/gen/factchecktools1_alpha1/src/lib.rs new file mode 100644 index 0000000000..107c718dfb --- /dev/null +++ b/gen/factchecktools1_alpha1/src/lib.rs @@ -0,0 +1,2471 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Fact Check Tools* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *factchecktools:v1alpha1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Fact Check Tools* *v1_alpha1* API can be found at the +//! [official documentation site](https://developers.google.com/fact-check/tools/api/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/factchecktools1_alpha1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.FactCheckTools.html) ... +//! +//! * claims +//! * [*search*](struct.ClaimSearchCall.html) +//! * pages +//! * [*create*](struct.PageCreateCall.html), [*delete*](struct.PageDeleteCall.html), [*get*](struct.PageGetCall.html), [*list*](struct.PageListCall.html) and [*update*](struct.PageUpdateCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.FactCheckTools.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.pages().create(...).doit() +//! let r = hub.pages().update(...).doit() +//! let r = hub.pages().get(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-factchecktools1_alpha1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +//! use factchecktools1_alpha1::GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage; +//! use factchecktools1_alpha1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use factchecktools1_alpha1::FactCheckTools; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.pages().update(req, "name") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View your email address + UserinfoEmail, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::UserinfoEmail => "https://www.googleapis.com/auth/userinfo.email", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::UserinfoEmail + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all FactCheckTools related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +/// use factchecktools1_alpha1::GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage; +/// use factchecktools1_alpha1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use factchecktools1_alpha1::FactCheckTools; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.pages().update(req, "name") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct FactCheckTools { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for FactCheckTools {} + +impl<'a, C, A> FactCheckTools + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> FactCheckTools { + FactCheckTools { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://factchecktools.googleapis.com/".to_string(), + _root_url: "https://factchecktools.googleapis.com/".to_string(), + } + } + + pub fn claims(&'a self) -> ClaimMethods<'a, C, A> { + ClaimMethods { hub: &self } + } + pub fn pages(&'a self) -> PageMethods<'a, C, A> { + PageMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://factchecktools.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://factchecktools.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Information about a claim review. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFactcheckingFactchecktoolsV1alpha1ClaimReview { + /// The language this review was written in. For instance, "en" or "de". + #[serde(rename="languageCode")] + pub language_code: Option, + /// Textual rating. For instance, "Mostly false". + #[serde(rename="textualRating")] + pub textual_rating: Option, + /// The publisher of this claim review. + pub publisher: Option, + /// The URL of this claim review. + pub url: Option, + /// The date the claim was reviewed. + #[serde(rename="reviewDate")] + pub review_date: Option, + /// The title of this claim review, if it can be determined. + pub title: Option, +} + +impl Part for GoogleFactcheckingFactchecktoolsV1alpha1ClaimReview {} + + +/// Information about the claim review author. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewAuthor { + /// Corresponds to `ClaimReview.author.image`. + #[serde(rename="imageUrl")] + pub image_url: Option, + /// Name of the organization that is publishing the fact check.
+ /// Corresponds to `ClaimReview.author.name`. + pub name: Option, +} + +impl Part for GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewAuthor {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete pages](struct.PageDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleProtobufEmpty { _never_set: Option } + +impl ResponseResult for GoogleProtobufEmpty {} + + +/// Response from listing `ClaimReview` markup. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list pages](struct.PageListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFactcheckingFactchecktoolsV1alpha1ListClaimReviewMarkupPagesResponse { + /// The next pagination token in the Search response. It should be used as the + /// `page_token` for the following request. An empty value means no more + /// results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The result list of pages of `ClaimReview` markup. + #[serde(rename="claimReviewMarkupPages")] + pub claim_review_markup_pages: Option>, +} + +impl ResponseResult for GoogleFactcheckingFactchecktoolsV1alpha1ListClaimReviewMarkupPagesResponse {} + + +/// Information about the claim. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFactcheckingFactchecktoolsV1alpha1Claim { + /// A person or organization stating the claim. For instance, "John Doe". + pub claimant: Option, + /// The date that the claim was made. + #[serde(rename="claimDate")] + pub claim_date: Option, + /// One or more reviews of this claim (namely, a fact-checking article). + #[serde(rename="claimReview")] + pub claim_review: Option>, + /// The claim text. For instance, "Crime has doubled in the last 2 years." + pub text: Option, +} + +impl Part for GoogleFactcheckingFactchecktoolsV1alpha1Claim {} + + +/// Holds one or more instances of `ClaimReview` markup for a webpage. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [create pages](struct.PageCreateCall.html) (request|response) +/// * [update pages](struct.PageUpdateCall.html) (request|response) +/// * [get pages](struct.PageGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage { + /// Info about the author of this claim review. + /// Similar to the above, semantically these are page-level fields, and each + /// `ClaimReview` on this page will contain the same values. + #[serde(rename="claimReviewAuthor")] + pub claim_review_author: Option, + /// The version ID for this markup. Except for update requests, this field is + /// output-only and should not be set by the user. + #[serde(rename="versionId")] + pub version_id: Option, + /// The URL of the page associated with this `ClaimReview` markup. + /// While every individual `ClaimReview` has its own URL field, semantically + /// this is a page-level field, and each `ClaimReview` on this page will use + /// this value unless individually overridden.
+ /// Corresponds to `ClaimReview.url` + #[serde(rename="pageUrl")] + pub page_url: Option, + /// A list of individual claim reviews for this page. + /// Each item in the list corresponds to one `ClaimReview` element. + #[serde(rename="claimReviewMarkups")] + pub claim_review_markups: Option>, + /// The date when the fact check was published. + /// Similar to the URL, semantically this is a page-level field, and each + /// `ClaimReview` on this page will contain the same value.
+ /// Corresponds to `ClaimReview.datePublished` + #[serde(rename="publishDate")] + pub publish_date: Option, + /// The name of this `ClaimReview` markup page resource, in the form of + /// `pages/{page_id}`. Except for update requests, this field is output-only + /// and should not be set by the user. + pub name: Option, +} + +impl RequestValue for GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage {} +impl ResponseResult for GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage {} + + +/// Information about the claim author. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFactcheckingFactchecktoolsV1alpha1ClaimAuthor { + /// Corresponds to `ClaimReview.itemReviewed.author.sameAs`. + #[serde(rename="sameAs")] + pub same_as: Option, + /// Corresponds to `ClaimReview.itemReviewed.author.jobTitle`. + #[serde(rename="jobTitle")] + pub job_title: Option, + /// Corresponds to `ClaimReview.itemReviewed.author.image`. + #[serde(rename="imageUrl")] + pub image_url: Option, + /// A person or organization stating the claim. For instance, "John Doe".
+ /// Corresponds to `ClaimReview.itemReviewed.author.name`. + pub name: Option, +} + +impl Part for GoogleFactcheckingFactchecktoolsV1alpha1ClaimAuthor {} + + +/// Response from searching fact-checked claims. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search claims](struct.ClaimSearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimSearchResponse { + /// The next pagination token in the Search response. It should be used as the + /// `page_token` for the following request. An empty value means no more + /// results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of claims and all of their associated information. + pub claims: Option>, +} + +impl ResponseResult for GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimSearchResponse {} + + +/// Information about the claim rating. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFactcheckingFactchecktoolsV1alpha1ClaimRating { + /// For numeric ratings, the best value possible in the scale from worst to + /// best.
+ /// Corresponds to `ClaimReview.reviewRating.bestRating`. + #[serde(rename="bestRating")] + pub best_rating: Option, + /// Corresponds to `ClaimReview.reviewRating.image`. + #[serde(rename="imageUrl")] + pub image_url: Option, + /// The truthfulness rating as a human-readible short word or phrase.
+ /// Corresponds to `ClaimReview.reviewRating.alternateName`. + #[serde(rename="textualRating")] + pub textual_rating: Option, + /// A numeric rating of this claim, in the range worstRating — bestRating + /// inclusive.
+ /// Corresponds to `ClaimReview.reviewRating.ratingValue`. + #[serde(rename="ratingValue")] + pub rating_value: Option, + /// For numeric ratings, the worst value possible in the scale from worst to + /// best.
+ /// Corresponds to `ClaimReview.reviewRating.worstRating`. + #[serde(rename="worstRating")] + pub worst_rating: Option, +} + +impl Part for GoogleFactcheckingFactchecktoolsV1alpha1ClaimRating {} + + +/// Information about the publisher. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFactcheckingFactchecktoolsV1alpha1Publisher { + /// The name of this publisher. For instance, "Awesome Fact Checks". + pub name: Option, + /// Host-level site name, without the protocol or "www" prefix. For instance, + /// "awesomefactchecks.com". This value of this field is based purely on the + /// claim review URL. + pub site: Option, +} + +impl Part for GoogleFactcheckingFactchecktoolsV1alpha1Publisher {} + + +/// Fields for an individual `ClaimReview` element. +/// Except for sub-messages that group fields together, each of these fields +/// correspond those in https://schema.org/ClaimReview. We list the precise +/// mapping for each field. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkup { + /// Info about the rating of this claim review. + pub rating: Option, + /// The location where this claim was made.
+ /// Corresponds to `ClaimReview.itemReviewed.name`. + #[serde(rename="claimLocation")] + pub claim_location: Option, + /// A list of links to works in which this claim appears, aside from the one + /// specified in `claim_first_appearance`.
+ /// Corresponds to `ClaimReview.itemReviewed[@type=Claim].appearance.url`. + #[serde(rename="claimAppearances")] + pub claim_appearances: Option>, + /// A short summary of the claim being evaluated.
+ /// Corresponds to `ClaimReview.claimReviewed`. + #[serde(rename="claimReviewed")] + pub claim_reviewed: Option, + /// This field is optional, and will default to the page URL. We provide this + /// field to allow you the override the default value, but the only permitted + /// override is the page URL plus an optional anchor link ("page jump").
+ /// Corresponds to `ClaimReview.url` + pub url: Option, + /// The date when the claim was made or entered public discourse.
+ /// Corresponds to `ClaimReview.itemReviewed.datePublished`. + #[serde(rename="claimDate")] + pub claim_date: Option, + /// Info about the author of this claim. + #[serde(rename="claimAuthor")] + pub claim_author: Option, + /// A link to a work in which this claim first appears.
+ /// Corresponds to `ClaimReview.itemReviewed[@type=Claim].firstAppearance.url`. + #[serde(rename="claimFirstAppearance")] + pub claim_first_appearance: Option, +} + +impl Part for GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkup {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *claim* resources. +/// It is not used directly, but through the `FactCheckTools` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use factchecktools1_alpha1::FactCheckTools; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `search(...)` +/// // to build up your call. +/// let rb = hub.claims(); +/// # } +/// ``` +pub struct ClaimMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FactCheckTools, +} + +impl<'a, C, A> MethodsBuilder for ClaimMethods<'a, C, A> {} + +impl<'a, C, A> ClaimMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Search through fact-checked claims. + pub fn search(&self) -> ClaimSearchCall<'a, C, A> { + ClaimSearchCall { + hub: self.hub, + _review_publisher_site_filter: Default::default(), + _query: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _offset: Default::default(), + _max_age_days: Default::default(), + _language_code: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *page* resources. +/// It is not used directly, but through the `FactCheckTools` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use factchecktools1_alpha1::FactCheckTools; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.pages(); +/// # } +/// ``` +pub struct PageMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FactCheckTools, +} + +impl<'a, C, A> MethodsBuilder for PageMethods<'a, C, A> {} + +impl<'a, C, A> PageMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Create `ClaimReview` markup on a page. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn create(&self, request: GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage) -> PageCreateCall<'a, C, A> { + PageCreateCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Update for all `ClaimReview` markup on a page + /// + /// Note that this is a full update. To retain the existing `ClaimReview` + /// markup on a page, first perform a Get operation, then modify the returned + /// markup, and finally call Update with the entire `ClaimReview` markup as the + /// body. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of this `ClaimReview` markup page resource, in the form of + /// `pages/{page_id}`. Except for update requests, this field is output-only + /// and should not be set by the user. + pub fn update(&self, request: GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage, name: &str) -> PageUpdateCall<'a, C, A> { + PageUpdateCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// List the `ClaimReview` markup pages for a specific URL or for an + /// organization. + pub fn list(&self) -> PageListCall<'a, C, A> { + PageListCall { + hub: self.hub, + _url: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _organization: Default::default(), + _offset: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Delete all `ClaimReview` markup on a page. + /// + /// # Arguments + /// + /// * `name` - The name of the resource to delete, in the form of `pages/{page_id}`. + pub fn delete(&self, name: &str) -> PageDeleteCall<'a, C, A> { + PageDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Get all `ClaimReview` markup on a page. + /// + /// # Arguments + /// + /// * `name` - The name of the resource to get, in the form of `pages/{page_id}`. + pub fn get(&self, name: &str) -> PageGetCall<'a, C, A> { + PageGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Search through fact-checked claims. +/// +/// A builder for the *search* method supported by a *claim* resource. +/// It is not used directly, but through a `ClaimMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use factchecktools1_alpha1::FactCheckTools; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.claims().search() +/// .review_publisher_site_filter("sed") +/// .query("et") +/// .page_token("dolores") +/// .page_size(-63) +/// .offset(-22) +/// .max_age_days(-8) +/// .language_code("justo") +/// .doit(); +/// # } +/// ``` +pub struct ClaimSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FactCheckTools, + _review_publisher_site_filter: Option, + _query: Option, + _page_token: Option, + _page_size: Option, + _offset: Option, + _max_age_days: Option, + _language_code: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, +} + +impl<'a, C, A> CallBuilder for ClaimSearchCall<'a, C, A> {} + +impl<'a, C, A> ClaimSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimSearchResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "factchecktools.claims.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); + if let Some(value) = self._review_publisher_site_filter { + params.push(("reviewPublisherSiteFilter", value.to_string())); + } + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._offset { + params.push(("offset", value.to_string())); + } + if let Some(value) = self._max_age_days { + params.push(("maxAgeDays", value.to_string())); + } + if let Some(value) = self._language_code { + params.push(("languageCode", value.to_string())); + } + for &field in ["alt", "reviewPublisherSiteFilter", "query", "pageToken", "pageSize", "offset", "maxAgeDays", "languageCode"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1alpha1/claims:search"; + + let mut key = self.hub.auth.borrow_mut().api_key(); + if key.is_none() { + key = dlg.api_key(); + } + match key { + Some(value) => params.push(("key", value)), + None => { + dlg.finished(false); + return Err(Error::MissingAPIKey) + } + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The review publisher site to filter results by, e.g. nytimes.com. + /// + /// Sets the *review publisher site filter* query property to the given value. + pub fn review_publisher_site_filter(mut self, new_value: &str) -> ClaimSearchCall<'a, C, A> { + self._review_publisher_site_filter = Some(new_value.to_string()); + self + } + /// Textual query string. Required unless `review_publisher_site_filter` is + /// specified. + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> ClaimSearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// The pagination token. You may provide the `next_page_token` returned from a + /// previous List request, if any, in order to get the next page. All other + /// fields must have the same values as in the previous request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ClaimSearchCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The pagination size. We will return up to that many results. Defaults to + /// 10 if not set. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ClaimSearchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// An integer that specifies the current offset (that is, starting result + /// location) in search results. This field is only considered if `page_token` + /// is unset. For example, 0 means to return results starting from the first + /// matching result, and 10 means to return from the 11th result. + /// + /// Sets the *offset* query property to the given value. + pub fn offset(mut self, new_value: i32) -> ClaimSearchCall<'a, C, A> { + self._offset = Some(new_value); + self + } + /// The maximum age of the returned search results, in days. + /// Age is determined by either claim date or review date, whichever is newer. + /// + /// Sets the *max age days* query property to the given value. + pub fn max_age_days(mut self, new_value: i32) -> ClaimSearchCall<'a, C, A> { + self._max_age_days = Some(new_value); + self + } + /// The BCP-47 language code, such as "en-US" or "sr-Latn". Can be used to + /// restrict results by language, though we do not currently consider the + /// region. + /// + /// Sets the *language code* query property to the given value. + pub fn language_code(mut self, new_value: &str) -> ClaimSearchCall<'a, C, A> { + self._language_code = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ClaimSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ClaimSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + +} + + +/// Create `ClaimReview` markup on a page. +/// +/// A builder for the *create* method supported by a *page* resource. +/// It is not used directly, but through a `PageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +/// use factchecktools1_alpha1::GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use factchecktools1_alpha1::FactCheckTools; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.pages().create(req) +/// .doit(); +/// # } +/// ``` +pub struct PageCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FactCheckTools, + _request: GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PageCreateCall<'a, C, A> {} + +impl<'a, C, A> PageCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "factchecktools.pages.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1alpha1/pages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::UserinfoEmail.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage) -> PageCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PageCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> PageCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::UserinfoEmail`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PageCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Update for all `ClaimReview` markup on a page +/// +/// Note that this is a full update. To retain the existing `ClaimReview` +/// markup on a page, first perform a Get operation, then modify the returned +/// markup, and finally call Update with the entire `ClaimReview` markup as the +/// body. +/// +/// A builder for the *update* method supported by a *page* resource. +/// It is not used directly, but through a `PageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +/// use factchecktools1_alpha1::GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use factchecktools1_alpha1::FactCheckTools; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.pages().update(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct PageUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FactCheckTools, + _request: GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PageUpdateCall<'a, C, A> {} + +impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "factchecktools.pages.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1alpha1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::UserinfoEmail.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage) -> PageUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of this `ClaimReview` markup page resource, in the form of + /// `pages/{page_id}`. Except for update requests, this field is output-only + /// and should not be set by the user. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> PageUpdateCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PageUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> PageUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::UserinfoEmail`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PageUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// List the `ClaimReview` markup pages for a specific URL or for an +/// organization. +/// +/// A builder for the *list* method supported by a *page* resource. +/// It is not used directly, but through a `PageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use factchecktools1_alpha1::FactCheckTools; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.pages().list() +/// .url("erat") +/// .page_token("labore") +/// .page_size(-9) +/// .organization("nonumy") +/// .offset(-19) +/// .doit(); +/// # } +/// ``` +pub struct PageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FactCheckTools, + _url: Option, + _page_token: Option, + _page_size: Option, + _organization: Option, + _offset: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PageListCall<'a, C, A> {} + +impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleFactcheckingFactchecktoolsV1alpha1ListClaimReviewMarkupPagesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "factchecktools.pages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + if let Some(value) = self._url { + params.push(("url", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._organization { + params.push(("organization", value.to_string())); + } + if let Some(value) = self._offset { + params.push(("offset", value.to_string())); + } + for &field in ["alt", "url", "pageToken", "pageSize", "organization", "offset"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1alpha1/pages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::UserinfoEmail.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The URL from which to get `ClaimReview` markup. There will be at most one + /// result. If markup is associated with a more canonical version of the URL + /// provided, we will return that URL instead. Cannot be specified along with + /// an organization. + /// + /// Sets the *url* query property to the given value. + pub fn url(mut self, new_value: &str) -> PageListCall<'a, C, A> { + self._url = Some(new_value.to_string()); + self + } + /// The pagination token. You may provide the `next_page_token` returned from a + /// previous List request, if any, in order to get the next page. All other + /// fields must have the same values as in the previous request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PageListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The pagination size. We will return up to that many results. Defaults to + /// 10 if not set. Has no effect if a URL is requested. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> PageListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The organization for which we want to fetch markups for. For instance, + /// "site.com". Cannot be specified along with an URL. + /// + /// Sets the *organization* query property to the given value. + pub fn organization(mut self, new_value: &str) -> PageListCall<'a, C, A> { + self._organization = Some(new_value.to_string()); + self + } + /// An integer that specifies the current offset (that is, starting result + /// location) in search results. This field is only considered if `page_token` + /// is unset, and if the request is not for a specific URL. For example, 0 + /// means to return results starting from the first matching result, and 10 + /// means to return from the 11th result. + /// + /// Sets the *offset* query property to the given value. + pub fn offset(mut self, new_value: i32) -> PageListCall<'a, C, A> { + self._offset = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> PageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::UserinfoEmail`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PageListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Delete all `ClaimReview` markup on a page. +/// +/// A builder for the *delete* method supported by a *page* resource. +/// It is not used directly, but through a `PageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use factchecktools1_alpha1::FactCheckTools; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.pages().delete("name") +/// .doit(); +/// # } +/// ``` +pub struct PageDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FactCheckTools, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PageDeleteCall<'a, C, A> {} + +impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleProtobufEmpty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "factchecktools.pages.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1alpha1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::UserinfoEmail.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the resource to delete, in the form of `pages/{page_id}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> PageDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PageDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> PageDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::UserinfoEmail`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PageDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Get all `ClaimReview` markup on a page. +/// +/// A builder for the *get* method supported by a *page* resource. +/// It is not used directly, but through a `PageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_factchecktools1_alpha1 as factchecktools1_alpha1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use factchecktools1_alpha1::FactCheckTools; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = FactCheckTools::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.pages().get("name") +/// .doit(); +/// # } +/// ``` +pub struct PageGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FactCheckTools, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PageGetCall<'a, C, A> {} + +impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "factchecktools.pages.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1alpha1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::UserinfoEmail.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the resource to get, in the form of `pages/{page_id}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> PageGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PageGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> PageGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::UserinfoEmail`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> PageGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/file1-cli/Cargo.toml b/gen/file1-cli/Cargo.toml new file mode 100644 index 0000000000..56406a937d --- /dev/null +++ b/gen/file1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-file1-cli" +version = "1.0.8+20190312" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Filestore (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/file1-cli" +homepage = "https://cloud.google.com/filestore/" +documentation = "http://byron.github.io/google-apis-rs/google_file1_cli" +license = "MIT" +keywords = ["file", "google", "cli"] +autobins = false + +[[bin]] +name = "file1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-file1] +path = "../file1" +version = "1.0.8+20190312" diff --git a/gen/file1-cli/LICENSE.md b/gen/file1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/file1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/file1-cli/README.md b/gen/file1-cli/README.md new file mode 100644 index 0000000000..67846d03c2 --- /dev/null +++ b/gen/file1-cli/README.md @@ -0,0 +1,124 @@ + +The `file1` command-line interface *(CLI)* allows to use most features of the *Google Cloud Filestore* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud Filestore* API can be found at the +[official documentation site](https://cloud.google.com/filestore/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-file1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/file1-cli). + +# Usage + +This documentation was generated from the *Cloud Filestore* API at revision *20190312*. The CLI is at version *1.0.8*. + +```bash +file1 [options] + projects + locations-get [-p ]... [-o ] + locations-instances-create (-r )... [-p ]... [-o ] + locations-instances-delete [-p ]... [-o ] + locations-instances-get [-p ]... [-o ] + locations-instances-list [-p ]... [-o ] + locations-instances-patch (-r )... [-p ]... [-o ] + locations-list [-p ]... [-o ] + locations-operations-cancel (-r )... [-p ]... [-o ] + locations-operations-delete [-p ]... [-o ] + locations-operations-get [-p ]... [-o ] + locations-operations-list [-p ]... [-o ] + file1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `file1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/file1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/file1-secret.json`, assuming that the required *file* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `file1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/file1-cli/mkdocs.yml b/gen/file1-cli/mkdocs.yml new file mode 100644 index 0000000000..5b47ca1918 --- /dev/null +++ b/gen/file1-cli/mkdocs.yml @@ -0,0 +1,27 @@ +site_name: Cloud Filestore v1.0.8+20190312 +site_url: http://byron.github.io/google-apis-rs/google-file1-cli +site_description: A complete library to interact with Cloud Filestore (protocol v1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/file1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['projects_locations-get.md', 'Projects', 'Locations Get'] +- ['projects_locations-instances-create.md', 'Projects', 'Locations Instances Create'] +- ['projects_locations-instances-delete.md', 'Projects', 'Locations Instances Delete'] +- ['projects_locations-instances-get.md', 'Projects', 'Locations Instances Get'] +- ['projects_locations-instances-list.md', 'Projects', 'Locations Instances List'] +- ['projects_locations-instances-patch.md', 'Projects', 'Locations Instances Patch'] +- ['projects_locations-list.md', 'Projects', 'Locations List'] +- ['projects_locations-operations-cancel.md', 'Projects', 'Locations Operations Cancel'] +- ['projects_locations-operations-delete.md', 'Projects', 'Locations Operations Delete'] +- ['projects_locations-operations-get.md', 'Projects', 'Locations Operations Get'] +- ['projects_locations-operations-list.md', 'Projects', 'Locations Operations List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/file1-cli/src/cmn.rs b/gen/file1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/file1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/file1-cli/src/main.rs b/gen/file1-cli/src/main.rs new file mode 100644 index 0000000000..a256240019 --- /dev/null +++ b/gen/file1-cli/src/main.rs @@ -0,0 +1,1299 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_file1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudFilestore>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _projects_locations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_instances_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tier" => Some(("tier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status-message" => Some(("statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "etag", "labels", "name", "state", "status-message", "tier"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Instance = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_instances_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "instance-id" => { + call = call.instance_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["instance-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_instances_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_instances_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_instances_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_instances_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_instances_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_instances_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_instances_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tier" => Some(("tier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status-message" => Some(("statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "etag", "labels", "name", "state", "status-message", "tier"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Instance = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_instances_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CancelOperationRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_operations_cancel(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_operations_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_operations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_operations_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("projects", Some(opt)) => { + match opt.subcommand() { + ("locations-get", Some(opt)) => { + call_result = self._projects_locations_get(opt, dry_run, &mut err); + }, + ("locations-instances-create", Some(opt)) => { + call_result = self._projects_locations_instances_create(opt, dry_run, &mut err); + }, + ("locations-instances-delete", Some(opt)) => { + call_result = self._projects_locations_instances_delete(opt, dry_run, &mut err); + }, + ("locations-instances-get", Some(opt)) => { + call_result = self._projects_locations_instances_get(opt, dry_run, &mut err); + }, + ("locations-instances-list", Some(opt)) => { + call_result = self._projects_locations_instances_list(opt, dry_run, &mut err); + }, + ("locations-instances-patch", Some(opt)) => { + call_result = self._projects_locations_instances_patch(opt, dry_run, &mut err); + }, + ("locations-list", Some(opt)) => { + call_result = self._projects_locations_list(opt, dry_run, &mut err); + }, + ("locations-operations-cancel", Some(opt)) => { + call_result = self._projects_locations_operations_cancel(opt, dry_run, &mut err); + }, + ("locations-operations-delete", Some(opt)) => { + call_result = self._projects_locations_operations_delete(opt, dry_run, &mut err); + }, + ("locations-operations-get", Some(opt)) => { + call_result = self._projects_locations_operations_get(opt, dry_run, &mut err); + }, + ("locations-operations-list", Some(opt)) => { + call_result = self._projects_locations_operations_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "file1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "file1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::CloudFilestore::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("projects", "methods: 'locations-get', 'locations-instances-create', 'locations-instances-delete', 'locations-instances-get', 'locations-instances-list', 'locations-instances-patch', 'locations-list', 'locations-operations-cancel', 'locations-operations-delete', 'locations-operations-get' and 'locations-operations-list'", vec![ + ("locations-get", + Some(r##"Gets information about a location."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name for the location."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-instances-create", + Some(r##"Creates an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-instances-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The instance's project and location, in the format + projects/{project_id}/locations/{location}. In Cloud Filestore, + locations map to GCP zones, for example **us-west1-b**."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-instances-delete", + Some(r##"Deletes an instance."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-instances-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The instance resource name, in the format + projects/{project_id}/locations/{location}/instances/{instance_id}"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-instances-get", + Some(r##"Gets the details of a specific instance."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-instances-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The instance resource name, in the format + projects/{project_id}/locations/{location}/instances/{instance_id}."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-instances-list", + Some(r##"Lists all instances in a project for either a specified location + or for all locations."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-instances-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The project and location for which to retrieve instance information, + in the format projects/{project_id}/locations/{location}. In Cloud + Filestore, locations map to GCP zones, for example **us-west1-b**. To + retrieve instance information for all locations, use "-" for the {location} + value."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-instances-patch", + Some(r##"Updates the settings of a specific instance."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-instances-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Output only. + The resource name of the instance, in the format + projects/{project_id}/locations/{location_id}/instances/{instance_id}."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-list", + Some(r##"Lists information about the supported locations for this service."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource that owns the locations collection, if applicable."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-operations-cancel", + Some(r##"Starts asynchronous cancellation on a long-running operation. The server + makes a best effort to cancel the operation, but success is not + guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. Clients can use + Operations.GetOperation or + other methods to check whether the cancellation succeeded or whether the + operation completed despite cancellation. On successful cancellation, + the operation is not deleted; instead, it becomes an operation with + an Operation.error value with a google.rpc.Status.code of 1, + corresponding to `Code.CANCELLED`."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-operations-cancel", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be cancelled."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-operations-delete", + Some(r##"Deletes a long-running operation. This method indicates that the client is + no longer interested in the operation result. It does not cancel the + operation. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-operations-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be deleted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-operations-get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-operations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-operations-list", + Some(r##"Lists operations that match the specified filter in the request. If the + server doesn't support this method, it returns `UNIMPLEMENTED`. + + NOTE: the `name` binding allows API services to override the binding + to use different resource name schemes, such as `users/*/operations`. To + override the binding, API services can add a binding such as + `"/v1/{name=users/*}/operations"` to their service configuration. + For backwards compatibility, the default name includes the operations + collection id, however overriding users must ensure the name binding + is the parent resource, without the operations collection id."##), + "Details at http://byron.github.io/google-apis-rs/google_file1_cli/projects_locations-operations-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation's parent resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("file1") + .author("Sebastian Thiel ") + .version("1.0.8+20190312") + .about("The Cloud Filestore API is used for creating and managing cloud file servers.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_file1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/file1/Cargo.toml b/gen/file1/Cargo.toml new file mode 100644 index 0000000000..fd4ebdddb0 --- /dev/null +++ b/gen/file1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-file1" +version = "1.0.8+20190312" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Filestore (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/file1" +homepage = "https://cloud.google.com/filestore/" +documentation = "https://docs.rs/google-file1/1.0.8+20190312" +license = "MIT" +keywords = ["file", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/file1/LICENSE.md b/gen/file1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/file1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/file1/README.md b/gen/file1/README.md new file mode 100644 index 0000000000..61b8e91b32 --- /dev/null +++ b/gen/file1/README.md @@ -0,0 +1,192 @@ + +The `google-file1` library allows access to all features of the *Google Cloud Filestore* service. + +This documentation was generated from *Cloud Filestore* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *file:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Cloud Filestore* *v1* API can be found at the +[official documentation site](https://cloud.google.com/filestore/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.CloudFilestore.html) ... + +* projects + * [*locations get*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationGetCall.html), [*locations instances create*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationInstanceCreateCall.html), [*locations instances delete*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationInstanceDeleteCall.html), [*locations instances get*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationInstanceGetCall.html), [*locations instances list*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationInstanceListCall.html), [*locations instances patch*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationInstancePatchCall.html), [*locations list*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationListCall.html), [*locations operations cancel*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.ProjectLocationOperationListCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-file1/1.0.8+20190312/google_file1/struct.CloudFilestore.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.projects().locations_operations_get(...).doit() +let r = hub.projects().locations_instances_create(...).doit() +let r = hub.projects().locations_instances_delete(...).doit() +let r = hub.projects().locations_instances_patch(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-file1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_file1 as file1; +use file1::Instance; +use file1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use file1::CloudFilestore; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = Instance::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.projects().locations_instances_create(req, "parent") + .instance_id("sit") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-file1/1.0.8+20190312/google_file1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-file1/1.0.8+20190312/google_file1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-file1/1.0.8+20190312/google_file1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **file1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/file1/src/cmn.rs b/gen/file1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/file1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/file1/src/lib.rs b/gen/file1/src/lib.rs new file mode 100644 index 0000000000..40d81249be --- /dev/null +++ b/gen/file1/src/lib.rs @@ -0,0 +1,4030 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud Filestore* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *file:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Cloud Filestore* *v1* API can be found at the +//! [official documentation site](https://cloud.google.com/filestore/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/file1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.CloudFilestore.html) ... +//! +//! * projects +//! * [*locations get*](struct.ProjectLocationGetCall.html), [*locations instances create*](struct.ProjectLocationInstanceCreateCall.html), [*locations instances delete*](struct.ProjectLocationInstanceDeleteCall.html), [*locations instances get*](struct.ProjectLocationInstanceGetCall.html), [*locations instances list*](struct.ProjectLocationInstanceListCall.html), [*locations instances patch*](struct.ProjectLocationInstancePatchCall.html), [*locations list*](struct.ProjectLocationListCall.html), [*locations operations cancel*](struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](struct.ProjectLocationOperationListCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudFilestore.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().locations_operations_get(...).doit() +//! let r = hub.projects().locations_instances_create(...).doit() +//! let r = hub.projects().locations_instances_delete(...).doit() +//! let r = hub.projects().locations_instances_patch(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-file1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_file1 as file1; +//! use file1::Instance; +//! use file1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use file1::CloudFilestore; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = Instance::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.projects().locations_instances_create(req, "parent") +//! .instance_id("sed") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudFilestore related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_file1 as file1; +/// use file1::Instance; +/// use file1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use file1::CloudFilestore; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Instance::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_instances_create(req, "parent") +/// .instance_id("dolores") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudFilestore { + client: RefCell, + auth: RefCell
, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for CloudFilestore {} + +impl<'a, C, A> CloudFilestore + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudFilestore { + CloudFilestore { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://file.googleapis.com/".to_string(), + _root_url: "https://file.googleapis.com/".to_string(), + } + } + + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://file.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://file.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// ListInstancesResponse is the result of ListInstancesRequest. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations instances list projects](struct.ProjectLocationInstanceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListInstancesResponse { + /// The token you can use to retrieve the next page of results. Not returned + /// if there are no more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of instances in the project for the specified location. + /// + /// If the {location} value in the request is "-", the response contains a list + /// of instances from all locations. If any location is unreachable, the + /// response will only return instances in reachable locations and the + /// "unreachable" field will be populated with a list of unreachable locations. + pub instances: Option>, + /// Locations that could not be reached. + pub unreachable: Option>, +} + +impl ResponseResult for ListInstancesResponse {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations operations list projects](struct.ProjectLocationOperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for ListOperationsResponse {} + + +/// Network configuration for the instance. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkConfig { + /// A /29 CIDR block in one of the + /// [internal IP address ranges](https://www.arin.net/knowledge/address_filters.html) + /// that identifies the range of IP addresses reserved for this + /// instance. For example, 10.0.0.0/29 or 192.168.0.0/29. The range you specify + /// can't overlap with either existing subnets or assigned IP address ranges + /// for other Cloud Filestore instances in the selected VPC network. + #[serde(rename="reservedIpRange")] + pub reserved_ip_range: Option, + /// Internet protocol versions for which the instance has IP addresses + /// assigned. For this version, only MODE_IPV4 is supported. + pub modes: Option>, + /// Output only. + /// IPv4 addresses in the format + /// {octet 1}.{octet 2}.{octet 3}.{octet 4} or IPv6 addresses in the format + /// {block 1}:{block 2}:{block 3}:{block 4}:{block 5}:{block 6}:{block 7}:{block 8}. + #[serde(rename="ipAddresses")] + pub ip_addresses: Option>, + /// The name of the Google Compute Engine + /// [VPC network](/compute/docs/networks-and-firewalls#networks) to which the + /// instance is connected. + pub network: Option, +} + +impl Part for NetworkConfig {} + + +/// A Cloud Filestore instance. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations instances create projects](struct.ProjectLocationInstanceCreateCall.html) (request) +/// * [locations instances patch projects](struct.ProjectLocationInstancePatchCall.html) (request) +/// * [locations instances get projects](struct.ProjectLocationInstanceGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Instance { + /// Output only. + /// The resource name of the instance, in the format + /// projects/{project_id}/locations/{location_id}/instances/{instance_id}. + pub name: Option, + /// Resource labels to represent user provided metadata. + pub labels: Option>, + /// Output only. + /// The time when the instance was created. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. + /// The instance state. + pub state: Option, + /// Server-specified ETag for the instance resource to prevent simultaneous + /// updates from overwriting each other. + pub etag: Option, + /// File system shares on the instance. + /// For this version, only a single file share is supported. + #[serde(rename="fileShares")] + pub file_shares: Option>, + /// The service tier of the instance. + pub tier: Option, + /// VPC networks to which the instance is connected. + /// For this version, only a single network is supported. + pub networks: Option>, + /// Output only. + /// Additional information about the instance state, if available. + #[serde(rename="statusMessage")] + pub status_message: Option, + /// Optional. A description of the instance (2048 characters or less). + pub description: Option, +} + +impl RequestValue for Instance {} +impl ResponseResult for Instance {} + + +/// The response message for Locations.ListLocations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations list projects](struct.ProjectLocationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLocationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of locations that matches the specified filter in the request. + pub locations: Option>, +} + +impl ResponseResult for ListLocationsResponse {} + + +/// A resource that represents Google Cloud Platform location. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Location { + /// The friendly name for this location, typically a nearby city name. + /// For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, + /// Resource name for the location, which may vary between implementations. + /// For example: `"projects/example-project/locations/us-east1"` + pub name: Option, + /// Service-specific metadata. For example the available capacity at the given + /// location. + pub metadata: Option>, +} + +impl ResponseResult for Location {} + + +/// The request message for Operations.CancelOperation. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations operations cancel projects](struct.ProjectLocationOperationCancelCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CancelOperationRequest { _never_set: Option } + +impl RequestValue for CancelOperationRequest {} + + +/// File share configuration for the instance. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileShareConfig { + /// File share capacity in gigabytes (GB). + /// Cloud Filestore defines 1 GB as 1024^3 bytes. + #[serde(rename="capacityGb")] + pub capacity_gb: Option, + /// The name of the file share (must be 16 characters or less). + pub name: Option, +} + +impl Part for FileShareConfig {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations operations get projects](struct.ProjectLocationOperationGetCall.html) (response) +/// * [locations instances create projects](struct.ProjectLocationInstanceCreateCall.html) (response) +/// * [locations instances delete projects](struct.ProjectLocationInstanceDeleteCall.html) (response) +/// * [locations instances patch projects](struct.ProjectLocationInstancePatchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl ResponseResult for Operation {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations operations delete projects](struct.ProjectLocationOperationDeleteCall.html) (response) +/// * [locations operations cancel projects](struct.ProjectLocationOperationCancelCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `CloudFilestore` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_file1 as file1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use file1::CloudFilestore; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `locations_get(...)`, `locations_instances_create(...)`, `locations_instances_delete(...)`, `locations_instances_get(...)`, `locations_instances_list(...)`, `locations_instances_patch(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists operations that match the specified filter in the request. If the + /// server doesn't support this method, it returns `UNIMPLEMENTED`. + /// + /// NOTE: the `name` binding allows API services to override the binding + /// to use different resource name schemes, such as `users/*/operations`. To + /// override the binding, API services can add a binding such as + /// `"/v1/{name=users/*}/operations"` to their service configuration. + /// For backwards compatibility, the default name includes the operations + /// collection id, however overriding users must ensure the name binding + /// is the parent resource, without the operations collection id. + /// + /// # Arguments + /// + /// * `name` - The name of the operation's parent resource. + pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C, A> { + ProjectLocationOperationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a long-running operation. This method indicates that the client is + /// no longer interested in the operation result. It does not cancel the + /// operation. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource to be deleted. + pub fn locations_operations_delete(&self, name: &str) -> ProjectLocationOperationDeleteCall<'a, C, A> { + ProjectLocationOperationDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an instance. + /// + /// # Arguments + /// + /// * `name` - The instance resource name, in the format + /// projects/{project_id}/locations/{location}/instances/{instance_id} + pub fn locations_instances_delete(&self, name: &str) -> ProjectLocationInstanceDeleteCall<'a, C, A> { + ProjectLocationInstanceDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists information about the supported locations for this service. + /// + /// # Arguments + /// + /// * `name` - The resource that owns the locations collection, if applicable. + pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C, A> { + ProjectLocationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Starts asynchronous cancellation on a long-running operation. The server + /// makes a best effort to cancel the operation, but success is not + /// guaranteed. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use + /// Operations.GetOperation or + /// other methods to check whether the cancellation succeeded or whether the + /// operation completed despite cancellation. On successful cancellation, + /// the operation is not deleted; instead, it becomes an operation with + /// an Operation.error value with a google.rpc.Status.code of 1, + /// corresponding to `Code.CANCELLED`. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the operation resource to be cancelled. + pub fn locations_operations_cancel(&self, request: CancelOperationRequest, name: &str) -> ProjectLocationOperationCancelCall<'a, C, A> { + ProjectLocationOperationCancelCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the details of a specific instance. + /// + /// # Arguments + /// + /// * `name` - The instance resource name, in the format + /// projects/{project_id}/locations/{location}/instances/{instance_id}. + pub fn locations_instances_get(&self, name: &str) -> ProjectLocationInstanceGetCall<'a, C, A> { + ProjectLocationInstanceGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C, A> { + ProjectLocationOperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a location. + /// + /// # Arguments + /// + /// * `name` - Resource name for the location. + pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C, A> { + ProjectLocationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the settings of a specific instance. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Output only. + /// The resource name of the instance, in the format + /// projects/{project_id}/locations/{location_id}/instances/{instance_id}. + pub fn locations_instances_patch(&self, request: Instance, name: &str) -> ProjectLocationInstancePatchCall<'a, C, A> { + ProjectLocationInstancePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates an instance. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The instance's project and location, in the format + /// projects/{project_id}/locations/{location}. In Cloud Filestore, + /// locations map to GCP zones, for example **us-west1-b**. + pub fn locations_instances_create(&self, request: Instance, parent: &str) -> ProjectLocationInstanceCreateCall<'a, C, A> { + ProjectLocationInstanceCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _instance_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all instances in a project for either a specified location + /// or for all locations. + /// + /// # Arguments + /// + /// * `parent` - The project and location for which to retrieve instance information, + /// in the format projects/{project_id}/locations/{location}. In Cloud + /// Filestore, locations map to GCP zones, for example **us-west1-b**. To + /// retrieve instance information for all locations, use "-" for the {location} + /// value. + pub fn locations_instances_list(&self, parent: &str) -> ProjectLocationInstanceListCall<'a, C, A> { + ProjectLocationInstanceListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _order_by: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Lists operations that match the specified filter in the request. If the +/// server doesn't support this method, it returns `UNIMPLEMENTED`. +/// +/// NOTE: the `name` binding allows API services to override the binding +/// to use different resource name schemes, such as `users/*/operations`. To +/// override the binding, API services can add a binding such as +/// `"/v1/{name=users/*}/operations"` to their service configuration. +/// For backwards compatibility, the default name includes the operations +/// collection id, however overriding users must ensure the name binding +/// is the parent resource, without the operations collection id. +/// +/// A builder for the *locations.operations.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_operations_list("name") +/// .page_token("accusam") +/// .page_size(-8) +/// .filter("justo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationOperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationOperationListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}/operations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation's parent resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationOperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationOperationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a long-running operation. This method indicates that the client is +/// no longer interested in the operation result. It does not cancel the +/// operation. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. +/// +/// A builder for the *locations.operations.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_operations_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationOperationDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationOperationDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.operations.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource to be deleted. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationOperationDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationOperationDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an instance. +/// +/// A builder for the *locations.instances.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_instances_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationInstanceDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationInstanceDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationInstanceDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.instances.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The instance resource name, in the format + /// projects/{project_id}/locations/{location}/instances/{instance_id} + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationInstanceDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationInstanceDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationInstanceDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists information about the supported locations for this service. +/// +/// A builder for the *locations.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_list("name") +/// .page_token("sea") +/// .page_size(-90) +/// .filter("dolores") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLocationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}/locations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource that owns the locations collection, if applicable. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Starts asynchronous cancellation on a long-running operation. The server +/// makes a best effort to cancel the operation, but success is not +/// guaranteed. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. Clients can use +/// Operations.GetOperation or +/// other methods to check whether the cancellation succeeded or whether the +/// operation completed despite cancellation. On successful cancellation, +/// the operation is not deleted; instead, it becomes an operation with +/// an Operation.error value with a google.rpc.Status.code of 1, +/// corresponding to `Code.CANCELLED`. +/// +/// A builder for the *locations.operations.cancel* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// use file1::CancelOperationRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CancelOperationRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_operations_cancel(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationOperationCancelCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _request: CancelOperationRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationOperationCancelCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.operations.cancel", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CancelOperationRequest) -> ProjectLocationOperationCancelCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the operation resource to be cancelled. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationOperationCancelCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationOperationCancelCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the details of a specific instance. +/// +/// A builder for the *locations.instances.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_instances_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationInstanceGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationInstanceGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Instance)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.instances.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The instance resource name, in the format + /// projects/{project_id}/locations/{location}/instances/{instance_id}. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationInstanceGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationInstanceGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationInstanceGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *locations.operations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_operations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationOperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationOperationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationOperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationOperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information about a location. +/// +/// A builder for the *locations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name for the location. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the settings of a specific instance. +/// +/// A builder for the *locations.instances.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// use file1::Instance; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Instance::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_instances_patch(req, "name") +/// .update_mask("justo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationInstancePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _request: Instance, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationInstancePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.instances.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Instance) -> ProjectLocationInstancePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Output only. + /// The resource name of the instance, in the format + /// projects/{project_id}/locations/{location_id}/instances/{instance_id}. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationInstancePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Mask of fields to update. At least one path must be supplied in this + /// field. The elements of the repeated paths field may only include these + /// fields: + /// "description" + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectLocationInstancePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationInstancePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationInstancePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationInstancePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates an instance. +/// +/// A builder for the *locations.instances.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// use file1::Instance; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Instance::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_instances_create(req, "parent") +/// .instance_id("et") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationInstanceCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _request: Instance, + _parent: String, + _instance_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationInstanceCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationInstanceCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.instances.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._instance_id { + params.push(("instanceId", value.to_string())); + } + for &field in ["alt", "parent", "instanceId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/instances"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Instance) -> ProjectLocationInstanceCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The instance's project and location, in the format + /// projects/{project_id}/locations/{location}. In Cloud Filestore, + /// locations map to GCP zones, for example **us-west1-b**. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The name of the instance to create. + /// The name must be unique for the specified project and location. + /// + /// Sets the *instance id* query property to the given value. + pub fn instance_id(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C, A> { + self._instance_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationInstanceCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationInstanceCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationInstanceCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all instances in a project for either a specified location +/// or for all locations. +/// +/// A builder for the *locations.instances.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_file1 as file1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use file1::CloudFilestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudFilestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_instances_list("parent") +/// .page_token("diam") +/// .page_size(-55) +/// .order_by("Lorem") +/// .filter("et") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationInstanceListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudFilestore, + _parent: String, + _page_token: Option, + _page_size: Option, + _order_by: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationInstanceListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationInstanceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListInstancesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "file.projects.locations.instances.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "orderBy", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/instances"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The project and location for which to retrieve instance information, + /// in the format projects/{project_id}/locations/{location}. In Cloud + /// Filestore, locations map to GCP zones, for example **us-west1-b**. To + /// retrieve instance information for all locations, use "-" for the {location} + /// value. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The next_page_token value to use if there are additional + /// results to retrieve for this list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of items to return. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Sort results. Supported values are "name", "name desc" or "" (unsorted). + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// List filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationInstanceListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationInstanceListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationInstanceListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/file1_beta1-cli/Cargo.toml b/gen/file1_beta1-cli/Cargo.toml index 9c88940e91..f54bb54e8e 100644 --- a/gen/file1_beta1-cli/Cargo.toml +++ b/gen/file1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-file1_beta1-cli" -version = "1.0.8+20180925" +version = "1.0.8+20190312" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Filestore (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/file1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-file1_beta1] path = "../file1_beta1" -version = "1.0.8+20180925" +version = "1.0.8+20190312" diff --git a/gen/file1_beta1-cli/README.md b/gen/file1_beta1-cli/README.md index f4e81acf20..2f3be4aa1d 100644 --- a/gen/file1_beta1-cli/README.md +++ b/gen/file1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Filestore* API at revision *20180925*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Filestore* API at revision *20190312*. The CLI is at version *1.0.8*. ```bash file1-beta1 [options] diff --git a/gen/file1_beta1-cli/mkdocs.yml b/gen/file1_beta1-cli/mkdocs.yml index 4ce3df6c1c..16534d19b3 100644 --- a/gen/file1_beta1-cli/mkdocs.yml +++ b/gen/file1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Filestore v1.0.8+20180925 +site_name: Cloud Filestore v1.0.8+20190312 site_url: http://byron.github.io/google-apis-rs/google-file1_beta1-cli site_description: A complete library to interact with Cloud Filestore (protocol v1beta1) diff --git a/gen/file1_beta1-cli/src/main.rs b/gen/file1_beta1-cli/src/main.rs index 62a19e0bc0..8a498bd909 100644 --- a/gen/file1_beta1-cli/src/main.rs +++ b/gen/file1_beta1-cli/src/main.rs @@ -1203,7 +1203,7 @@ fn main() { let mut app = App::new("file1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20180925") + .version("1.0.8+20190312") .about("The Cloud Filestore API is used for creating and managing cloud file servers.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_file1_beta1_cli") .arg(Arg::with_name("url") diff --git a/gen/file1_beta1/Cargo.toml b/gen/file1_beta1/Cargo.toml index 51fa899437..261c8e384b 100644 --- a/gen/file1_beta1/Cargo.toml +++ b/gen/file1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-file1_beta1" -version = "1.0.8+20180925" +version = "1.0.8+20190312" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Filestore (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/file1_beta1" homepage = "https://cloud.google.com/filestore/" -documentation = "https://docs.rs/google-file1_beta1/1.0.8+20180925" +documentation = "https://docs.rs/google-file1_beta1/1.0.8+20190312" license = "MIT" keywords = ["file", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/file1_beta1/README.md b/gen/file1_beta1/README.md index 18b6b3bad2..6d5a9d4f4d 100644 --- a/gen/file1_beta1/README.md +++ b/gen/file1_beta1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-file1_beta1` library allows access to all features of the *Google Cloud Filestore* service. -This documentation was generated from *Cloud Filestore* crate version *1.0.8+20180925*, where *20180925* is the exact revision of the *file:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Filestore* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *file:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Filestore* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/filestore/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.CloudFilestore.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.CloudFilestore.html) ... * projects - * [*locations get*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationGetCall.html), [*locations instances create*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationInstanceCreateCall.html), [*locations instances delete*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationInstanceDeleteCall.html), [*locations instances get*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationInstanceGetCall.html), [*locations instances list*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationInstanceListCall.html), [*locations instances patch*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationInstancePatchCall.html), [*locations list*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationListCall.html), [*locations operations cancel*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.ProjectLocationOperationListCall.html) + * [*locations get*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationGetCall.html), [*locations instances create*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationInstanceCreateCall.html), [*locations instances delete*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationInstanceDeleteCall.html), [*locations instances get*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationInstanceGetCall.html), [*locations instances list*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationInstanceListCall.html), [*locations instances patch*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationInstancePatchCall.html), [*locations list*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationListCall.html), [*locations operations cancel*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.ProjectLocationOperationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/struct.CloudFilestore.html)** +* **[Hub](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/struct.CloudFilestore.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -134,17 +134,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -154,29 +154,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-file1_beta1/1.0.8+20180925/google_file1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-file1_beta1/1.0.8+20190312/google_file1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/file1_beta1/src/lib.rs b/gen/file1_beta1/src/lib.rs index 56adaa9c97..311c0bf74b 100644 --- a/gen/file1_beta1/src/lib.rs +++ b/gen/file1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Filestore* crate version *1.0.8+20180925*, where *20180925* is the exact revision of the *file:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Filestore* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *file:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Filestore* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/filestore/). @@ -375,17 +375,46 @@ impl<'a, C, A> CloudFilestore // ############ // SCHEMAS ### // ########## -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// ListInstancesResponse is the result of ListInstancesRequest. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations instances list projects](struct.ProjectLocationInstanceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListInstancesResponse { + /// The token you can use to retrieve the next page of results. Not returned + /// if there are no more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of instances in the project for the specified location. + /// + /// If the {location} value in the request is "-", the response contains a list + /// of instances from all locations. If any location is unreachable, the + /// response will only return instances in reachable locations and the + /// "unreachable" field will be populated with a list of unreachable locations. + pub instances: Option>, + /// Locations that could not be reached. + pub unreachable: Option>, +} + +impl ResponseResult for ListInstancesResponse {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -446,35 +475,6 @@ pub struct Status { impl Part for Status {} -/// ListInstancesResponse is the result of ListInstancesRequest. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations instances list projects](struct.ProjectLocationInstanceListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListInstancesResponse { - /// The token you can use to retrieve the next page of results. Not returned - /// if there are no more results in the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Locations that could not be reached. - pub unreachable: Option>, - /// A list of instances in the project for the specified location. - /// - /// If the {location} value in the request is "-", the response contains a list - /// of instances from all locations. If any location is unreachable, the - /// response will only return instances in reachable locations and the - /// "unreachable" field will be populated with a list of unreachable locations. - pub instances: Option>, -} - -impl ResponseResult for ListInstancesResponse {} - - /// The response message for Operations.ListOperations. /// /// # Activities @@ -547,9 +547,10 @@ pub struct Instance { pub name: Option, /// Resource labels to represent user provided metadata. pub labels: Option>, - /// VPC networks to which the instance is connected. - /// For this version, only a single network is supported. - pub networks: Option>, + /// Output only. + /// The time when the instance was created. + #[serde(rename="createTime")] + pub create_time: Option, /// Output only. /// The instance state. pub state: Option, @@ -562,10 +563,9 @@ pub struct Instance { pub file_shares: Option>, /// The service tier of the instance. pub tier: Option, - /// Output only. - /// The time when the instance was created. - #[serde(rename="createTime")] - pub create_time: Option, + /// VPC networks to which the instance is connected. + /// For this version, only a single network is supported. + pub networks: Option>, /// Output only. /// Additional information about the instance state, if available. #[serde(rename="statusMessage")] @@ -610,17 +610,17 @@ impl ResponseResult for ListLocationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { - /// The canonical id for this location. For example: `"us-east1"`. - #[serde(rename="locationId")] - pub location_id: Option, - /// Cross-service attributes for the location. For example - /// - /// {"cloud.googleapis.com/region": "us-east1"} - pub labels: Option>, /// The friendly name for this location, typically a nearby city name. /// For example, "Tokyo". #[serde(rename="displayName")] pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, /// Resource name for the location, which may vary between implementations. /// For example: `"projects/example-project/locations/us-east1"` pub name: Option, @@ -1134,7 +1134,7 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1173,7 +1170,7 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1448,7 +1442,7 @@ impl<'a, C, A> ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1699,7 +1690,7 @@ impl<'a, C, A> ProjectLocationInstanceDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1966,7 +1954,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2266,7 +2251,7 @@ impl<'a, C, A> ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2529,7 +2511,7 @@ impl<'a, C, A> ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2783,7 +2762,7 @@ impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3034,7 +3010,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3309,7 +3282,7 @@ impl<'a, C, A> ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceCreateCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3608,7 +3578,7 @@ impl<'a, C, A> ProjectLocationInstanceCreateCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceCreateCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceListCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3902,7 +3869,7 @@ impl<'a, C, A> ProjectLocationInstanceListCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceListCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Firebase Dynamic Links (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firebasedynamiclinks1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-firebasedynamiclinks1] path = "../firebasedynamiclinks1" -version = "1.0.8+20181008" +version = "1.0.8+20190403" diff --git a/gen/firebasedynamiclinks1-cli/README.md b/gen/firebasedynamiclinks1-cli/README.md index e4d1d1f884..00fcf40f56 100644 --- a/gen/firebasedynamiclinks1-cli/README.md +++ b/gen/firebasedynamiclinks1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Firebase Dynamic Links* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Firebase Dynamic Links* API at revision *20190403*. The CLI is at version *1.0.8*. ```bash firebasedynamiclinks1 [options] diff --git a/gen/firebasedynamiclinks1-cli/mkdocs.yml b/gen/firebasedynamiclinks1-cli/mkdocs.yml index 6ef1711069..593b9d09d2 100644 --- a/gen/firebasedynamiclinks1-cli/mkdocs.yml +++ b/gen/firebasedynamiclinks1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Firebase Dynamic Links v1.0.8+20181008 +site_name: Firebase Dynamic Links v1.0.8+20190403 site_url: http://byron.github.io/google-apis-rs/google-firebasedynamiclinks1-cli site_description: A complete library to interact with Firebase Dynamic Links (protocol v1) diff --git a/gen/firebasedynamiclinks1-cli/src/main.rs b/gen/firebasedynamiclinks1-cli/src/main.rs index 2407284e5b..18929fddde 100644 --- a/gen/firebasedynamiclinks1-cli/src/main.rs +++ b/gen/firebasedynamiclinks1-cli/src/main.rs @@ -83,11 +83,12 @@ impl<'n> Engine<'n> { "dynamic-link-info.ios-info.ios-custom-scheme" => Some(("dynamicLinkInfo.iosInfo.iosCustomScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.ios-info.ios-fallback-link" => Some(("dynamicLinkInfo.iosInfo.iosFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.ios-info.ios-bundle-id" => Some(("dynamicLinkInfo.iosInfo.iosBundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.ios-info.ios-minimum-version" => Some(("dynamicLinkInfo.iosInfo.iosMinimumVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.ios-info.ios-ipad-bundle-id" => Some(("dynamicLinkInfo.iosInfo.iosIpadBundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.ios-info.ios-app-store-id" => Some(("dynamicLinkInfo.iosInfo.iosAppStoreId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.ios-info.ios-ipad-fallback-link" => Some(("dynamicLinkInfo.iosInfo.iosIpadFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dynamic-link-info.android-info.android-package-name" => Some(("dynamicLinkInfo.androidInfo.androidPackageName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.android-info.android-fallback-link" => Some(("dynamicLinkInfo.androidInfo.androidFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.android-info.android-package-name" => Some(("dynamicLinkInfo.androidInfo.androidPackageName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.android-info.android-link" => Some(("dynamicLinkInfo.androidInfo.androidLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.android-info.android-min-package-version-code" => Some(("dynamicLinkInfo.androidInfo.androidMinPackageVersionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.social-meta-tag-info.social-title" => Some(("dynamicLinkInfo.socialMetaTagInfo.socialTitle", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -97,13 +98,13 @@ impl<'n> Engine<'n> { "dynamic-link-info.link" => Some(("dynamicLinkInfo.link", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.desktop-info.desktop-fallback-link" => Some(("dynamicLinkInfo.desktopInfo.desktopFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.dynamic-link-domain" => Some(("dynamicLinkInfo.dynamicLinkDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "sdk-version" => Some(("sdkVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "long-dynamic-link" => Some(("longDynamicLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "suffix.option" => Some(("suffix.option", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "suffix.custom-suffix" => Some(("suffix.customSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sdk-version" => Some(("sdkVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["analytics-info", "android-fallback-link", "android-info", "android-link", "android-min-package-version-code", "android-package-name", "at", "ct", "custom-suffix", "desktop-fallback-link", "desktop-info", "domain-uri-prefix", "dynamic-link-domain", "dynamic-link-info", "enable-forced-redirect", "gclid", "google-play-analytics", "ios-app-store-id", "ios-bundle-id", "ios-custom-scheme", "ios-fallback-link", "ios-info", "ios-ipad-bundle-id", "ios-ipad-fallback-link", "itunes-connect-analytics", "link", "long-dynamic-link", "mt", "name", "navigation-info", "option", "pt", "sdk-version", "social-description", "social-image-link", "social-meta-tag-info", "social-title", "suffix", "utm-campaign", "utm-content", "utm-medium", "utm-source", "utm-term"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["analytics-info", "android-fallback-link", "android-info", "android-link", "android-min-package-version-code", "android-package-name", "at", "ct", "custom-suffix", "desktop-fallback-link", "desktop-info", "domain-uri-prefix", "dynamic-link-domain", "dynamic-link-info", "enable-forced-redirect", "gclid", "google-play-analytics", "ios-app-store-id", "ios-bundle-id", "ios-custom-scheme", "ios-fallback-link", "ios-info", "ios-ipad-bundle-id", "ios-ipad-fallback-link", "ios-minimum-version", "itunes-connect-analytics", "link", "long-dynamic-link", "mt", "name", "navigation-info", "option", "pt", "sdk-version", "social-description", "social-image-link", "social-meta-tag-info", "social-title", "suffix", "utm-campaign", "utm-content", "utm-medium", "utm-source", "utm-term"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -249,6 +250,7 @@ impl<'n> Engine<'n> { "sdk-version" => Some(("sdkVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "app-installation-time" => Some(("appInstallationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "unique-match-link-to-check" => Some(("uniqueMatchLinkToCheck", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "retrieval-method" => Some(("retrievalMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device.language-code" => Some(("device.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device.language-code-raw" => Some(("device.languageCodeRaw", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device.device-model-name" => Some(("device.deviceModelName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -256,9 +258,8 @@ impl<'n> Engine<'n> { "device.screen-resolution-height" => Some(("device.screenResolutionHeight", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device.timezone" => Some(("device.timezone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device.screen-resolution-width" => Some(("device.screenResolutionWidth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "retrieval-method" => Some(("retrievalMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ios-version" => Some(("iosVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "bundle-id" => Some(("bundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ios-version" => Some(("iosVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["app-installation-time", "bundle-id", "device", "device-model-name", "ios-version", "language-code", "language-code-from-webview", "language-code-raw", "retrieval-method", "screen-resolution-height", "screen-resolution-width", "sdk-version", "timezone", "unique-match-link-to-check", "visual-style"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -444,11 +445,12 @@ impl<'n> Engine<'n> { "dynamic-link-info.ios-info.ios-custom-scheme" => Some(("dynamicLinkInfo.iosInfo.iosCustomScheme", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.ios-info.ios-fallback-link" => Some(("dynamicLinkInfo.iosInfo.iosFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.ios-info.ios-bundle-id" => Some(("dynamicLinkInfo.iosInfo.iosBundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.ios-info.ios-minimum-version" => Some(("dynamicLinkInfo.iosInfo.iosMinimumVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.ios-info.ios-ipad-bundle-id" => Some(("dynamicLinkInfo.iosInfo.iosIpadBundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.ios-info.ios-app-store-id" => Some(("dynamicLinkInfo.iosInfo.iosAppStoreId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.ios-info.ios-ipad-fallback-link" => Some(("dynamicLinkInfo.iosInfo.iosIpadFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dynamic-link-info.android-info.android-package-name" => Some(("dynamicLinkInfo.androidInfo.androidPackageName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.android-info.android-fallback-link" => Some(("dynamicLinkInfo.androidInfo.androidFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-link-info.android-info.android-package-name" => Some(("dynamicLinkInfo.androidInfo.androidPackageName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.android-info.android-link" => Some(("dynamicLinkInfo.androidInfo.androidLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.android-info.android-min-package-version-code" => Some(("dynamicLinkInfo.androidInfo.androidMinPackageVersionCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.social-meta-tag-info.social-title" => Some(("dynamicLinkInfo.socialMetaTagInfo.socialTitle", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -458,12 +460,12 @@ impl<'n> Engine<'n> { "dynamic-link-info.link" => Some(("dynamicLinkInfo.link", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.desktop-info.desktop-fallback-link" => Some(("dynamicLinkInfo.desktopInfo.desktopFallbackLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dynamic-link-info.dynamic-link-domain" => Some(("dynamicLinkInfo.dynamicLinkDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "sdk-version" => Some(("sdkVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "long-dynamic-link" => Some(("longDynamicLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sdk-version" => Some(("sdkVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "suffix.option" => Some(("suffix.option", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "suffix.custom-suffix" => Some(("suffix.customSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["analytics-info", "android-fallback-link", "android-info", "android-link", "android-min-package-version-code", "android-package-name", "at", "ct", "custom-suffix", "desktop-fallback-link", "desktop-info", "domain-uri-prefix", "dynamic-link-domain", "dynamic-link-info", "enable-forced-redirect", "gclid", "google-play-analytics", "ios-app-store-id", "ios-bundle-id", "ios-custom-scheme", "ios-fallback-link", "ios-info", "ios-ipad-bundle-id", "ios-ipad-fallback-link", "itunes-connect-analytics", "link", "long-dynamic-link", "mt", "navigation-info", "option", "pt", "sdk-version", "social-description", "social-image-link", "social-meta-tag-info", "social-title", "suffix", "utm-campaign", "utm-content", "utm-medium", "utm-source", "utm-term"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["analytics-info", "android-fallback-link", "android-info", "android-link", "android-min-package-version-code", "android-package-name", "at", "ct", "custom-suffix", "desktop-fallback-link", "desktop-info", "domain-uri-prefix", "dynamic-link-domain", "dynamic-link-info", "enable-forced-redirect", "gclid", "google-play-analytics", "ios-app-store-id", "ios-bundle-id", "ios-custom-scheme", "ios-fallback-link", "ios-info", "ios-ipad-bundle-id", "ios-ipad-fallback-link", "ios-minimum-version", "itunes-connect-analytics", "link", "long-dynamic-link", "mt", "navigation-info", "option", "pt", "sdk-version", "social-description", "social-image-link", "social-meta-tag-info", "social-title", "suffix", "utm-campaign", "utm-content", "utm-medium", "utm-source", "utm-term"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -797,7 +799,7 @@ fn main() { let mut app = App::new("firebasedynamiclinks1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190403") .about("Programmatically creates and manages Firebase Dynamic Links.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1_cli") .arg(Arg::with_name("url") diff --git a/gen/firebasedynamiclinks1/Cargo.toml b/gen/firebasedynamiclinks1/Cargo.toml index b90291bac1..3d682d4a1f 100644 --- a/gen/firebasedynamiclinks1/Cargo.toml +++ b/gen/firebasedynamiclinks1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-firebasedynamiclinks1" -version = "1.0.8+20181008" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with Firebase Dynamic Links (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firebasedynamiclinks1" homepage = "https://firebase.google.com/docs/dynamic-links/" -documentation = "https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008" +documentation = "https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403" license = "MIT" keywords = ["firebasedynamiclinks", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/firebasedynamiclinks1/README.md b/gen/firebasedynamiclinks1/README.md index e1432f8c57..8897e4f75e 100644 --- a/gen/firebasedynamiclinks1/README.md +++ b/gen/firebasedynamiclinks1/README.md @@ -5,24 +5,24 @@ DO NOT EDIT ! --> The `google-firebasedynamiclinks1` library allows access to all features of the *Google Firebase Dynamic Links* service. -This documentation was generated from *Firebase Dynamic Links* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *firebasedynamiclinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Firebase Dynamic Links* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *firebasedynamiclinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Firebase Dynamic Links* *v1* API can be found at the [official documentation site](https://firebase.google.com/docs/dynamic-links/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/struct.FirebaseDynamicLinks.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/struct.FirebaseDynamicLinks.html) ... -* [managed short links](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/struct.ManagedShortLink.html) - * [*create*](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/struct.ManagedShortLinkCreateCall.html) +* [managed short links](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/struct.ManagedShortLink.html) + * [*create*](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/struct.ManagedShortLinkCreateCall.html) * short links - * [*create*](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/struct.ShortLinkCreateCall.html) + * [*create*](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/struct.ShortLinkCreateCall.html) Other activities are ... -* [get link stats](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/struct.MethodGetLinkStatCall.html) -* [install attribution](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/struct.MethodInstallAttributionCall.html) -* [reopen attribution](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/struct.MethodReopenAttributionCall.html) +* [get link stats](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/struct.MethodGetLinkStatCall.html) +* [install attribution](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/struct.MethodInstallAttributionCall.html) +* [reopen attribution](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/struct.MethodReopenAttributionCall.html) @@ -30,17 +30,17 @@ Other activities are ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/struct.FirebaseDynamicLinks.html)** +* **[Hub](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/struct.FirebaseDynamicLinks.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.Part.html)** + * **[Parts](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -137,17 +137,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -157,29 +157,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20181008/google_firebasedynamiclinks1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-firebasedynamiclinks1/1.0.8+20190403/google_firebasedynamiclinks1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/firebasedynamiclinks1/src/lib.rs b/gen/firebasedynamiclinks1/src/lib.rs index f141e8fc6f..493c286e00 100644 --- a/gen/firebasedynamiclinks1/src/lib.rs +++ b/gen/firebasedynamiclinks1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Firebase Dynamic Links* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *firebasedynamiclinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Firebase Dynamic Links* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *firebasedynamiclinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Firebase Dynamic Links* *v1* API can be found at the //! [official documentation site](https://firebase.google.com/docs/dynamic-links/). @@ -422,6 +422,11 @@ pub struct GetIosPostInstallAttributionResponse { /// The confidence of the returned attribution. #[serde(rename="attributionConfidence")] pub attribution_confidence: Option, + /// Instruction for iSDK to attemmpt to perform strong match. For instance, + /// if browser does not support/allow cookie or outside of support browsers, + /// this will be false. + #[serde(rename="isStrongMatchExecutable")] + pub is_strong_match_executable: Option, /// User-agent specific custom-scheme URIs for iSDK to open. This will be set /// according to the user-agent tha the click was originally made in. There is /// no Safari-equivalent custom-scheme open URLs. @@ -430,11 +435,6 @@ pub struct GetIosPostInstallAttributionResponse { /// ie: opera-http://example.com #[serde(rename="externalBrowserDestinationLink")] pub external_browser_destination_link: Option, - /// Instruction for iSDK to attemmpt to perform strong match. For instance, - /// if browser does not support/allow cookie or outside of support browsers, - /// this will be false. - #[serde(rename="isStrongMatchExecutable")] - pub is_strong_match_executable: Option, /// Which IP version the request was made from. #[serde(rename="requestIpVersion")] pub request_ip_version: Option, @@ -481,12 +481,12 @@ impl ResponseResult for GetIosPostInstallAttributionResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AndroidInfo { - /// Android package name of the app. - #[serde(rename="androidPackageName")] - pub android_package_name: Option, /// Link to open on Android if the app is not installed. #[serde(rename="androidFallbackLink")] pub android_fallback_link: Option, + /// Android package name of the app. + #[serde(rename="androidPackageName")] + pub android_package_name: Option, /// If specified, this overrides the ‘link’ parameter on Android. #[serde(rename="androidLink")] pub android_link: Option, @@ -514,15 +514,15 @@ pub struct CreateShortDynamicLinkRequest { /// [Learn more](https://firebase.google.com/docs/reference/dynamic-links/link-shortener). #[serde(rename="dynamicLinkInfo")] pub dynamic_link_info: Option, - /// Google SDK version. Version takes the form "$major.$minor.$patch" - #[serde(rename="sdkVersion")] - pub sdk_version: Option, /// Full long Dynamic Link URL with desired query parameters specified. /// For example, /// "https://sample.app.goo.gl/?link=http://www.google.com&apn=com.sample", /// [Learn more](https://firebase.google.com/docs/reference/dynamic-links/link-shortener). #[serde(rename="longDynamicLink")] pub long_dynamic_link: Option, + /// Google SDK version. Version takes the form "$major.$minor.$patch" + #[serde(rename="sdkVersion")] + pub sdk_version: Option, /// Short Dynamic Link suffix. Optional. pub suffix: Option, } @@ -576,20 +576,20 @@ pub struct GetIosPostInstallAttributionRequest { /// If link is long server need to vslidate the link. #[serde(rename="uniqueMatchLinkToCheck")] pub unique_match_link_to_check: Option, + /// Device information. + pub device: Option, /// App post install attribution retrieval information. Disambiguates /// mechanism (iSDK or developer invoked) to retrieve payload from /// clicked link. #[serde(rename="retrievalMethod")] pub retrieval_method: Option, - /// Device information. - pub device: Option, - /// APP bundle ID. - #[serde(rename="bundleId")] - pub bundle_id: Option, /// iOS version, ie: 9.3.5. /// Consider adding "build". #[serde(rename="iosVersion")] pub ios_version: Option, + /// APP bundle ID. + #[serde(rename="bundleId")] + pub bundle_id: Option, } impl RequestValue for GetIosPostInstallAttributionRequest {} @@ -623,6 +623,8 @@ pub struct DynamicLinkInfo { /// E.g. https://maps.app.goo.gl, https://maps.page.link, https://g.co/maps /// More examples can be found in description of getNormalizedUriPrefix in /// j/c/g/firebase/dynamiclinks/uri/DdlDomain.java + /// + /// Will fallback to dynamic_link_domain is this field is missing #[serde(rename="domainUriPrefix")] pub domain_uri_prefix: Option, /// The link your app will open, You can specify any URL your app can handle. @@ -637,10 +639,11 @@ pub struct DynamicLinkInfo { #[serde(rename="desktopInfo")] pub desktop_info: Option, /// Dynamic Links domain that the project owns, e.g. abcd.app.goo.gl - /// [Learn more](https://firebase.google.com/docs/dynamic-links/android/receive) - /// on how to set up Dynamic Link domain associated with your Firebase project. + /// [Learn + /// more](https://firebase.google.com/docs/dynamic-links/android/receive) on + /// how to set up Dynamic Link domain associated with your Firebase project. /// - /// Required. + /// Required if missing domain_uri_prefix. #[serde(rename="dynamicLinkDomain")] pub dynamic_link_domain: Option, } @@ -730,12 +733,12 @@ impl Part for Suffix {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DynamicLinkWarning { - /// The document describing the warning, and helps resolve. - #[serde(rename="warningDocumentLink")] - pub warning_document_link: Option, /// The warning code. #[serde(rename="warningCode")] pub warning_code: Option, + /// The document describing the warning, and helps resolve. + #[serde(rename="warningDocumentLink")] + pub warning_document_link: Option, /// The warning message to help developers improve their requests. #[serde(rename="warningMessage")] pub warning_message: Option, @@ -764,6 +767,9 @@ pub struct IosInfo { /// If specified, this overrides the ios_fallback_link value on iPads. #[serde(rename="iosIpadFallbackLink")] pub ios_ipad_fallback_link: Option, + /// iOS minimum version. + #[serde(rename="iosMinimumVersion")] + pub ios_minimum_version: Option, /// iPad bundle ID of the app. #[serde(rename="iosIpadBundleId")] pub ios_ipad_bundle_id: Option, @@ -867,22 +873,22 @@ pub struct CreateManagedShortLinkRequest { /// [Learn more](https://firebase.google.com/docs/reference/dynamic-links/link-shortener). #[serde(rename="dynamicLinkInfo")] pub dynamic_link_info: Option, - /// Google SDK version. Version takes the form "$major.$minor.$patch" - #[serde(rename="sdkVersion")] - pub sdk_version: Option, /// Full long Dynamic Link URL with desired query parameters specified. /// For example, /// "https://sample.app.goo.gl/?link=http://www.google.com&apn=com.sample", /// [Learn more](https://firebase.google.com/docs/reference/dynamic-links/link-shortener). #[serde(rename="longDynamicLink")] pub long_dynamic_link: Option, - /// Short Dynamic Link suffix. Optional. - pub suffix: Option, + /// Google SDK version. Version takes the form "$major.$minor.$patch" + #[serde(rename="sdkVersion")] + pub sdk_version: Option, /// Link name to associate with the link. It's used for marketer to identify /// manually-created links in the Firebase console /// (https://console.firebase.google.com/). /// Links must be named to be tracked. pub name: Option, + /// Short Dynamic Link suffix. Optional. + pub suffix: Option, } impl RequestValue for CreateManagedShortLinkRequest {} @@ -903,6 +909,10 @@ pub struct GetIosReopenAttributionResponse { /// Scion medium value to be propagated by iSDK to Scion at app-reopen. #[serde(rename="utmMedium")] pub utm_medium: Option, + /// FDL input value of the "&imv=" parameter, minimum app version to be + /// returned to Google Firebase SDK running on iOS-9. + #[serde(rename="iosMinAppVersion")] + pub ios_min_app_version: Option, /// Scion source value to be propagated by iSDK to Scion at app-reopen. #[serde(rename="utmSource")] pub utm_source: Option, @@ -926,7 +936,8 @@ impl ResponseResult for GetIosReopenAttributionResponse {} /// Parameters for Google Play Campaign Measurements. -/// [Learn more](https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#campaign-params) +/// [Learn +/// more](https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#campaign-params) /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -943,9 +954,10 @@ pub struct GooglePlayAnalytics { /// source. #[serde(rename="utmSource")] pub utm_source: Option, - /// [AdWords autotagging parameter](https://support.google.com/analytics/answer/1033981?hl=en); - /// used to measure Google AdWords ads. This value is generated dynamically - /// and should never be modified. + /// [AdWords autotagging + /// parameter](https://support.google.com/analytics/answer/1033981?hl=en); used + /// to measure Google AdWords ads. This value is generated dynamically and + /// should never be modified. pub gclid: Option, /// Campaign name; used for keyword analysis to identify a specific product /// promotion or strategic campaign. @@ -976,8 +988,9 @@ pub struct ManagedShortLink { /// /// Required. pub link: Option, - /// Visibility status of link. - pub visibility: Option, + /// Attributes that have been flagged about this short url. + #[serde(rename="flaggedAttribute")] + pub flagged_attribute: Option>, /// Link name defined by the creator. /// /// Required. @@ -986,9 +999,8 @@ pub struct ManagedShortLink { /// Creation timestamp of the short link. #[serde(rename="creationTime")] pub creation_time: Option, - /// Attributes that have been flagged about this short url. - #[serde(rename="flaggedAttribute")] - pub flagged_attribute: Option>, + /// Visibility status of link. + pub visibility: Option, } impl Resource for ManagedShortLink {} @@ -1019,14 +1031,14 @@ impl Part for DesktopInfo {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreateShortDynamicLinkResponse { - /// Short Dynamic Link value. e.g. https://abcd.app.goo.gl/wxyz - #[serde(rename="shortLink")] - pub short_link: Option, - /// Information about potential warnings on link creation. - pub warning: Option>, /// Preview link to show the link flow chart. (debug info.) #[serde(rename="previewLink")] pub preview_link: Option, + /// Information about potential warnings on link creation. + pub warning: Option>, + /// Short Dynamic Link value. e.g. https://abcd.app.goo.gl/wxyz + #[serde(rename="shortLink")] + pub short_link: Option, } impl ResponseResult for CreateShortDynamicLinkResponse {} @@ -1401,10 +1413,7 @@ impl<'a, C, A> ShortLinkCreateCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1436,7 +1445,7 @@ impl<'a, C, A> ShortLinkCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1516,7 +1525,7 @@ impl<'a, C, A> ShortLinkCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1524,12 +1533,12 @@ impl<'a, C, A> ShortLinkCreateCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ShortLinkCreateCall<'a, C, A> @@ -1674,10 +1683,7 @@ impl<'a, C, A> MethodGetLinkStatCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1697,7 +1703,7 @@ impl<'a, C, A> MethodGetLinkStatCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1789,7 +1795,7 @@ impl<'a, C, A> MethodGetLinkStatCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1797,12 +1803,12 @@ impl<'a, C, A> MethodGetLinkStatCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> MethodGetLinkStatCall<'a, C, A> @@ -1919,10 +1925,7 @@ impl<'a, C, A> MethodInstallAttributionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1954,7 +1957,7 @@ impl<'a, C, A> MethodInstallAttributionCall<'a, C, A> where C: BorrowMut MethodInstallAttributionCall<'a, C, A> where C: BorrowMut MethodInstallAttributionCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> MethodInstallAttributionCall<'a, C, A> @@ -2164,10 +2167,7 @@ impl<'a, C, A> MethodReopenAttributionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2199,7 +2199,7 @@ impl<'a, C, A> MethodReopenAttributionCall<'a, C, A> where C: BorrowMut MethodReopenAttributionCall<'a, C, A> where C: BorrowMut MethodReopenAttributionCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> MethodReopenAttributionCall<'a, C, A> @@ -2421,10 +2421,7 @@ impl<'a, C, A> ManagedShortLinkCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2456,7 +2453,7 @@ impl<'a, C, A> ManagedShortLinkCreateCall<'a, C, A> where C: BorrowMut ManagedShortLinkCreateCall<'a, C, A> where C: BorrowMut ManagedShortLinkCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ManagedShortLinkCreateCall<'a, C, A> diff --git a/gen/firebasehosting1_beta1-cli/Cargo.toml b/gen/firebasehosting1_beta1-cli/Cargo.toml index 5c3bb9b1b9..d6bf4c05c0 100644 --- a/gen/firebasehosting1_beta1-cli/Cargo.toml +++ b/gen/firebasehosting1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-firebasehosting1_beta1-cli" -version = "1.0.8+20181011" +version = "1.0.8+20190318" authors = ["Sebastian Thiel "] description = "A complete library to interact with Firebase Hosting (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firebasehosting1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-firebasehosting1_beta1] path = "../firebasehosting1_beta1" -version = "1.0.8+20181011" +version = "1.0.8+20190318" diff --git a/gen/firebasehosting1_beta1-cli/README.md b/gen/firebasehosting1_beta1-cli/README.md index a90db47ebc..b2040663ad 100644 --- a/gen/firebasehosting1_beta1-cli/README.md +++ b/gen/firebasehosting1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Firebase Hosting* API at revision *20181011*. The CLI is at version *1.0.8*. +This documentation was generated from the *Firebase Hosting* API at revision *20190318*. The CLI is at version *1.0.8*. ```bash firebasehosting1-beta1 [options] @@ -35,8 +35,10 @@ firebasehosting1-beta1 [options] domains-get [-p ]... [-o ] domains-list [-p ]... [-o ] domains-update (-r )... [-p ]... [-o ] + get-config [-p ]... [-o ] releases-create (-r )... [-p ]... [-o ] releases-list [-p ]... [-o ] + update-config (-r )... [-p ]... [-o ] versions-create (-r )... [-p ]... [-o ] versions-delete [-p ]... [-o ] versions-files-list [-p ]... [-o ] diff --git a/gen/firebasehosting1_beta1-cli/mkdocs.yml b/gen/firebasehosting1_beta1-cli/mkdocs.yml index e240c94496..b5577cd258 100644 --- a/gen/firebasehosting1_beta1-cli/mkdocs.yml +++ b/gen/firebasehosting1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Firebase Hosting v1.0.8+20181011 +site_name: Firebase Hosting v1.0.8+20190318 site_url: http://byron.github.io/google-apis-rs/google-firebasehosting1_beta1-cli site_description: A complete library to interact with Firebase Hosting (protocol v1beta1) @@ -14,8 +14,10 @@ pages: - ['sites_domains-get.md', 'Sites', 'Domains Get'] - ['sites_domains-list.md', 'Sites', 'Domains List'] - ['sites_domains-update.md', 'Sites', 'Domains Update'] +- ['sites_get-config.md', 'Sites', 'Get Config'] - ['sites_releases-create.md', 'Sites', 'Releases Create'] - ['sites_releases-list.md', 'Sites', 'Releases List'] +- ['sites_update-config.md', 'Sites', 'Update Config'] - ['sites_versions-create.md', 'Sites', 'Versions Create'] - ['sites_versions-delete.md', 'Sites', 'Versions Delete'] - ['sites_versions-files-list.md', 'Sites', 'Versions Files List'] diff --git a/gen/firebasehosting1_beta1-cli/src/main.rs b/gen/firebasehosting1_beta1-cli/src/main.rs index 4f4dcb7e51..addc516d88 100644 --- a/gen/firebasehosting1_beta1-cli/src/main.rs +++ b/gen/firebasehosting1_beta1-cli/src/main.rs @@ -409,6 +409,58 @@ impl<'n> Engine<'n> { } } + fn _sites_get_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sites().get_config(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _sites_releases_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -579,6 +631,95 @@ impl<'n> Engine<'n> { } } + fn _sites_update_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "max-versions" => Some(("maxVersions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["max-versions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SiteConfig = json::value::from_value(object).unwrap(); + let mut call = self.hub.sites().update_config(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _sites_versions_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -1013,12 +1154,18 @@ impl<'n> Engine<'n> { ("domains-update", Some(opt)) => { call_result = self._sites_domains_update(opt, dry_run, &mut err); }, + ("get-config", Some(opt)) => { + call_result = self._sites_get_config(opt, dry_run, &mut err); + }, ("releases-create", Some(opt)) => { call_result = self._sites_releases_create(opt, dry_run, &mut err); }, ("releases-list", Some(opt)) => { call_result = self._sites_releases_list(opt, dry_run, &mut err); }, + ("update-config", Some(opt)) => { + call_result = self._sites_update_config(opt, dry_run, &mut err); + }, ("versions-create", Some(opt)) => { call_result = self._sites_versions_create(opt, dry_run, &mut err); }, @@ -1125,7 +1272,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("sites", "methods: 'domains-create', 'domains-delete', 'domains-get', 'domains-list', 'domains-update', 'releases-create', 'releases-list', 'versions-create', 'versions-delete', 'versions-files-list', 'versions-patch' and 'versions-populate-files'", vec![ + ("sites", "methods: 'domains-create', 'domains-delete', 'domains-get', 'domains-list', 'domains-update', 'get-config', 'releases-create', 'releases-list', 'update-config', 'versions-create', 'versions-delete', 'versions-files-list', 'versions-patch' and 'versions-populate-files'", vec![ ("domains-create", Some(r##"Creates a domain mapping on the specified site."##), "Details at http://byron.github.io/google-apis-rs/google_firebasehosting1_beta1_cli/sites_domains-create", @@ -1246,6 +1393,29 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-config", + Some(r##"Gets the Hosting metadata for a specific site."##), + "Details at http://byron.github.io/google-apis-rs/google_firebasehosting1_beta1_cli/sites_get-config", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The site for which to get the SiteConfig, in the format: + sites/site-name/config"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1299,6 +1469,35 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update-config", + Some(r##"Sets the Hosting metadata for a specific site."##), + "Details at http://byron.github.io/google-apis-rs/google_firebasehosting1_beta1_cli/sites_update-config", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The site for which to update the SiteConfig, in the format: + sites/site-name/config"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1451,8 +1650,8 @@ fn main() { let mut app = App::new("firebasehosting1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181011") - .about("") + .version("1.0.8+20190318") + .about("The Firebase Hosting REST API enables programmatic and customizable deployments to your Firebase-hosted sites. Use this REST API to deploy new or updated hosting configurations and content files.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_firebasehosting1_beta1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/firebasehosting1_beta1/Cargo.toml b/gen/firebasehosting1_beta1/Cargo.toml index 1486a3cc25..108aeecc65 100644 --- a/gen/firebasehosting1_beta1/Cargo.toml +++ b/gen/firebasehosting1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-firebasehosting1_beta1" -version = "1.0.8+20181011" +version = "1.0.8+20190318" authors = ["Sebastian Thiel "] description = "A complete library to interact with Firebase Hosting (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firebasehosting1_beta1" homepage = "https://firebase.google.com/docs/hosting/" -documentation = "https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011" +documentation = "https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318" license = "MIT" keywords = ["firebasehosting", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/firebasehosting1_beta1/README.md b/gen/firebasehosting1_beta1/README.md index 3250219b1c..b19c13dee3 100644 --- a/gen/firebasehosting1_beta1/README.md +++ b/gen/firebasehosting1_beta1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-firebasehosting1_beta1` library allows access to all features of the *Google Firebase Hosting* service. -This documentation was generated from *Firebase Hosting* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *firebasehosting:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Firebase Hosting* crate version *1.0.8+20190318*, where *20190318* is the exact revision of the *firebasehosting:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Firebase Hosting* *v1_beta1* API can be found at the [official documentation site](https://firebase.google.com/docs/hosting/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.FirebaseHosting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.FirebaseHosting.html) ... * sites - * [*domains create*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteDomainCreateCall.html), [*domains delete*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteDomainDeleteCall.html), [*domains get*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteDomainGetCall.html), [*domains list*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteDomainListCall.html), [*domains update*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteDomainUpdateCall.html), [*releases create*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteReleaseCreateCall.html), [*releases list*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteReleaseListCall.html), [*versions create*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteVersionCreateCall.html), [*versions delete*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteVersionDeleteCall.html), [*versions files list*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteVersionFileListCall.html), [*versions patch*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteVersionPatchCall.html) and [*versions populate files*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.SiteVersionPopulateFileCall.html) + * [*domains create*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteDomainCreateCall.html), [*domains delete*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteDomainDeleteCall.html), [*domains get*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteDomainGetCall.html), [*domains list*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteDomainListCall.html), [*domains update*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteDomainUpdateCall.html), [*get config*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteGetConfigCall.html), [*releases create*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteReleaseCreateCall.html), [*releases list*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteReleaseListCall.html), [*update config*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteUpdateConfigCall.html), [*versions create*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteVersionCreateCall.html), [*versions delete*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteVersionDeleteCall.html), [*versions files list*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteVersionFileListCall.html), [*versions patch*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteVersionPatchCall.html) and [*versions populate files*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.SiteVersionPopulateFileCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/struct.FirebaseHosting.html)** +* **[Hub](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/struct.FirebaseHosting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20181011/google_firebasehosting1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-firebasehosting1_beta1/1.0.8+20190318/google_firebasehosting1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/firebasehosting1_beta1/src/lib.rs b/gen/firebasehosting1_beta1/src/lib.rs index ebeb0c4f73..de46e8518e 100644 --- a/gen/firebasehosting1_beta1/src/lib.rs +++ b/gen/firebasehosting1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Firebase Hosting* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *firebasehosting:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Firebase Hosting* crate version *1.0.8+20190318*, where *20190318* is the exact revision of the *firebasehosting:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Firebase Hosting* *v1_beta1* API can be found at the //! [official documentation site](https://firebase.google.com/docs/hosting/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.FirebaseHosting.html) ... //! //! * sites -//! * [*domains create*](struct.SiteDomainCreateCall.html), [*domains delete*](struct.SiteDomainDeleteCall.html), [*domains get*](struct.SiteDomainGetCall.html), [*domains list*](struct.SiteDomainListCall.html), [*domains update*](struct.SiteDomainUpdateCall.html), [*releases create*](struct.SiteReleaseCreateCall.html), [*releases list*](struct.SiteReleaseListCall.html), [*versions create*](struct.SiteVersionCreateCall.html), [*versions delete*](struct.SiteVersionDeleteCall.html), [*versions files list*](struct.SiteVersionFileListCall.html), [*versions patch*](struct.SiteVersionPatchCall.html) and [*versions populate files*](struct.SiteVersionPopulateFileCall.html) +//! * [*domains create*](struct.SiteDomainCreateCall.html), [*domains delete*](struct.SiteDomainDeleteCall.html), [*domains get*](struct.SiteDomainGetCall.html), [*domains list*](struct.SiteDomainListCall.html), [*domains update*](struct.SiteDomainUpdateCall.html), [*get config*](struct.SiteGetConfigCall.html), [*releases create*](struct.SiteReleaseCreateCall.html), [*releases list*](struct.SiteReleaseListCall.html), [*update config*](struct.SiteUpdateConfigCall.html), [*versions create*](struct.SiteVersionCreateCall.html), [*versions delete*](struct.SiteVersionDeleteCall.html), [*versions files list*](struct.SiteVersionFileListCall.html), [*versions patch*](struct.SiteVersionPatchCall.html) and [*versions populate files*](struct.SiteVersionPopulateFileCall.html) //! //! //! @@ -384,20 +384,21 @@ impl<'a, C, A> FirebaseHosting // ############ // SCHEMAS ### // ########## -/// A `Redirect` represents the configuration for returning an HTTP redirect -/// response given a matching request URL path. +/// A [`redirect`](/docs/hosting/full-config#redirects) represents the +/// configuration for returning an HTTP redirect response given a matching +/// request URL path. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Redirect { /// Required. The user-supplied - /// [glob pattern](/docs/hosting/full-config#section-glob) to match against - /// the request URL path. + /// [glob pattern](/docs/hosting/full-config#glob_pattern_matching) to match + /// against the request URL path. pub glob: Option, /// Required. The value to put in the HTTP location header of the response. - ///
The location can contain capture group values from the pattern using a - /// `":"` prefix to identify the segment and an optional `"*"` to capture the + ///
The location can contain capture group values from the pattern using + /// a `:` prefix to identify the segment and an optional `*` to capture the /// rest of the URL. /// For example: /// "glob": "/:capture*", @@ -470,23 +471,170 @@ pub struct CertDnsChallenge { impl Part for CertDnsChallenge {} -/// Defines the behavior of a domain-level redirect. Domain redirects preserve -/// the path of the redirect but replace the requested domain with the one -/// specified in the redirect configuration. +/// The intended behavior and status information of a domain. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [domains get sites](struct.SiteDomainGetCall.html) (response) +/// * [domains update sites](struct.SiteDomainUpdateCall.html) (request|response) +/// * [domains create sites](struct.SiteDomainCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Domain { + /// Output only. Additional status of the domain association. + pub status: Option, + /// If set, the domain should redirect with the provided parameters. + #[serde(rename="domainRedirect")] + pub domain_redirect: Option, + /// Required. The domain name of the association. + #[serde(rename="domainName")] + pub domain_name: Option, + /// Required. The site name of the association. + pub site: Option, + /// Output only. The time at which the domain was last updated. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Output only. Information about the provisioning of certificates and the + /// health of the DNS resolution for the domain. + pub provisioning: Option, +} + +impl RequestValue for Domain {} +impl ResponseResult for Domain {} + + +/// A configured rewrite that will direct any requests to a Cloud Run service. If +/// the Cloud Run service does not exist when setting or updating your Firebase +/// Hosting configuration then the request will fail. Any errors from the Cloud +/// Run service (including when the service has been deleted) will be passed back +/// down to the end user. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DomainRedirect { - /// Required. The redirect status code. - #[serde(rename="type")] - pub type_: Option, - /// Required. The domain name to redirect to. - #[serde(rename="domainName")] - pub domain_name: Option, +pub struct CloudRunRewrite { + /// Optional. The region where the Cloud Run service is hosted. Defaults to + /// `us-central1` if not supplied. + pub region: Option, + /// Required. User supplied ID of the Cloud Run service. + #[serde(rename="serviceId")] + pub service_id: Option, } -impl Part for DomainRedirect {} +impl Part for CloudRunRewrite {} + + +/// Represents an HTTP certificate challenge. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CertHttpChallenge { + /// The URL path on which to serve the specified token to satisfy the + /// certificate challenge. + pub path: Option, + /// The token to serve at the specified URL path to satisfy the certificate + /// challenge. + pub token: Option, +} + +impl Part for CertHttpChallenge {} + + +/// The configuration for how incoming requests to a site should be routed and +/// processed before serving content. The patterns are matched and applied +/// according to a specific +/// [priority order](/docs/hosting/full-config#hosting_priority_order). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ServingConfig { + /// Defines whether to drop the file extension from uploaded files. + #[serde(rename="cleanUrls")] + pub clean_urls: Option, + /// A list of custom response headers that are added to the content if the + /// request URL path matches the glob. + pub headers: Option>, + /// A list of globs that will cause the response to redirect to another + /// location. + pub redirects: Option>, + /// How to handle well known App Association files. + #[serde(rename="appAssociation")] + pub app_association: Option, + /// Defines how to handle a trailing slash in the URL path. + #[serde(rename="trailingSlashBehavior")] + pub trailing_slash_behavior: Option, + /// A list of rewrites that will act as if the service were given the + /// destination URL. + pub rewrites: Option>, +} + +impl Part for ServingConfig {} + + +/// A `Release` is a particular +/// [collection of configurations and files](sites.versions) +/// that is set to be public at a particular time. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [releases create sites](struct.SiteReleaseCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Release { + /// Output only. The configuration and content that was released. + pub version: Option, + /// Output only. The unique identifier for the release, in the format: + /// sites/site-name/releases/releaseID + /// This name is provided in the response body when you call the + /// [`CreateRelease`](sites.releases/create) endpoint. + pub name: Option, + /// The deploy description when the release was created. The value can be up to + /// 512 characters. + pub message: Option, + /// Output only. The time at which the version is set to be public. + #[serde(rename="releaseTime")] + pub release_time: Option, + /// Explains the reason for the release. + ///
Specify a value for this field only when creating a `SITE_DISABLE` + /// type release. + #[serde(rename="type")] + pub type_: Option, + /// Output only. Identifies the user who created the release. + #[serde(rename="releaseUser")] + pub release_user: Option, +} + +impl RequestValue for Release {} +impl ResponseResult for Release {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [domains list sites](struct.SiteDomainListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListDomainsResponse { + /// The list of domains, if any exist. + pub domains: Option>, + /// The pagination token, if more results exist. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} + +impl ResponseResult for ListDomainsResponse {} /// Contains metadata about the user who performed an action, such as creating @@ -507,21 +655,206 @@ pub struct ActingUser { impl Part for ActingUser {} -/// Represents an HTTP certificate challenge. +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [domains delete sites](struct.SiteDomainDeleteCall.html) (response) +/// * [versions delete sites](struct.SiteVersionDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// Defines the behavior of a domain-level redirect. Domain redirects preserve +/// the path of the redirect but replace the requested domain with the one +/// specified in the redirect configuration. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CertHttpChallenge { - /// The URL path on which to serve the specified token to satisfy the - /// certificate challenge. - pub path: Option, - /// The token to serve at the specified URL path to satisfy the certificate - /// challenge. - pub token: Option, +pub struct DomainRedirect { + /// Required. The redirect status code. + #[serde(rename="type")] + pub type_: Option, + /// Required. The domain name to redirect to. + #[serde(rename="domainName")] + pub domain_name: Option, } -impl Part for CertHttpChallenge {} +impl Part for DomainRedirect {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [releases list sites](struct.SiteReleaseListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListReleasesResponse { + /// If there are additional releases remaining beyond the ones in this + /// response, then supply this token in the next + /// [`list`](../sites.versions.files/list) call to continue with the next set + /// of releases. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of hashes of files that still need to be uploaded, if any exist. + pub releases: Option>, +} + +impl ResponseResult for ListReleasesResponse {} + + +/// The current certificate provisioning status information for a domain. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DomainProvisioning { + /// The HTTP challenge for generating a certificate. + #[serde(rename="certChallengeHttp")] + pub cert_challenge_http: Option, + /// The list of IPs to which the domain is expected to resolve. + #[serde(rename="expectedIps")] + pub expected_ips: Option>, + /// The TXT records (for the certificate challenge) that were found at the last + /// DNS fetch. + #[serde(rename="certChallengeDiscoveredTxt")] + pub cert_challenge_discovered_txt: Option>, + /// The time at which the last DNS fetch occurred. + #[serde(rename="dnsFetchTime")] + pub dns_fetch_time: Option, + /// The IPs found at the last DNS fetch. + #[serde(rename="discoveredIps")] + pub discovered_ips: Option>, + /// The DNS challenge for generating a certificate. + #[serde(rename="certChallengeDns")] + pub cert_challenge_dns: Option, + /// The DNS record match status as of the last DNS fetch. + #[serde(rename="dnsStatus")] + pub dns_status: Option, + /// The certificate provisioning status; updated when Firebase Hosting + /// provisions an SSL certificate for the domain. + #[serde(rename="certStatus")] + pub cert_status: Option, +} + +impl Part for DomainProvisioning {} + + +/// A [`rewrite`](/docs/hosting/full-config#rewrites) represents an internal +/// content rewrite on the version. If the pattern matches, the request will be +/// handled as if it were to the destination path specified in the +/// configuration. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Rewrite { + /// The function to proxy requests to. Must match the exported function + /// name exactly. + pub function: Option, + /// The URL path to rewrite the request to. + pub path: Option, + /// The request will be forwarded to Firebase Dynamic Links. + #[serde(rename="dynamicLinks")] + pub dynamic_links: Option, + /// The request will be forwarded to Cloud Run. + pub run: Option, + /// Required. The user-supplied + /// [glob pattern](/docs/hosting/full-config#glob_pattern_matching) to match + /// against the request URL path. + pub glob: Option, +} + +impl Part for Rewrite {} + + +/// A `SiteConfig` contains metadata associated with a specific site that +/// controls Firebase Hosting serving behavior +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update config sites](struct.SiteUpdateConfigCall.html) (request|response) +/// * [get config sites](struct.SiteGetConfigCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteConfig { + /// The number of FINALIZED versions that will be held for a site before + /// automatic deletion. When a new version is deployed, content for versions + /// in storage in excess of this number will be deleted, and will no longer be + /// billed for storage usage. Oldest versions will be deleted first; sites are + /// created with an unlimited number of max_versions by default. + #[serde(rename="maxVersions")] + pub max_versions: Option, +} + +impl RequestValue for SiteConfig {} +impl ResponseResult for SiteConfig {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [versions populate files sites](struct.SiteVersionPopulateFileCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PopulateVersionFilesResponse { + /// The content hashes of the specified files that need to be uploaded to the + /// specified endpoint. + #[serde(rename="uploadRequiredHashes")] + pub upload_required_hashes: Option>, + /// The URL to which the files should be uploaded, in the format: + ///
"https://upload-firebasehosting.googleapis.com/upload/sites/site-name/versions/versionID/files". + ///
Perform a multipart `POST` of the Gzipped file contents to the URL + /// using a forward slash and the hash of the file appended to the end. + #[serde(rename="uploadUrl")] + pub upload_url: Option, +} + +impl ResponseResult for PopulateVersionFilesResponse {} + + +/// A [`header`](/docs/hosting/full-config#headers) defines custom headers to +/// add to a response should the request URL path match the pattern. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Header { + /// Required. The additional headers to add to the response. + pub headers: Option>, + /// Required. The user-supplied + /// [glob pattern](/docs/hosting/full-config#glob_pattern_matching) to match + /// against the request URL path. + pub glob: Option, +} + +impl Part for Header {} /// A `Version` is the collection of configuration and @@ -594,288 +927,6 @@ impl RequestValue for Version {} impl ResponseResult for Version {} -/// A `Release` is a particular -/// [collection of configurations and files](sites.versions) -/// that is set to be public at a particular time. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [releases create sites](struct.SiteReleaseCreateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Release { - /// Output only. The configuration and content that was released. - pub version: Option, - /// Output only. The unique identifier for the release, in the format: - /// sites/site-name/releases/releaseID - /// This name is provided in the response body when you call the - /// [`CreateRelease`](sites.releases/create) endpoint. - pub name: Option, - /// The deploy description when the release was created. The value can be up to - /// 512 characters. - pub message: Option, - /// Output only. The time at which the version is set to be public. - #[serde(rename="releaseTime")] - pub release_time: Option, - /// Explains the reason for the release. - ///
Specify a value for this field only when creating a `SITE_DISABLE` - /// type release. - #[serde(rename="type")] - pub type_: Option, - /// Output only. Identifies the user who created the release. - #[serde(rename="releaseUser")] - pub release_user: Option, -} - -impl RequestValue for Release {} -impl ResponseResult for Release {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [domains list sites](struct.SiteDomainListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListDomainsResponse { - /// The pagination token, if more results exist. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of domains, if any exist. - pub domains: Option>, -} - -impl ResponseResult for ListDomainsResponse {} - - -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [domains delete sites](struct.SiteDomainDeleteCall.html) (response) -/// * [versions delete sites](struct.SiteVersionDeleteCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - -/// The intended behavior and status information of a domain. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [domains get sites](struct.SiteDomainGetCall.html) (response) -/// * [domains update sites](struct.SiteDomainUpdateCall.html) (request|response) -/// * [domains create sites](struct.SiteDomainCreateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Domain { - /// Output only. Additional status of the domain association. - pub status: Option, - /// If set, the domain should redirect with the provided parameters. - #[serde(rename="domainRedirect")] - pub domain_redirect: Option, - /// Required. The domain name of the association. - #[serde(rename="domainName")] - pub domain_name: Option, - /// Required. The site name of the association. - pub site: Option, - /// Output only. The time at which the domain was last updated. - #[serde(rename="updateTime")] - pub update_time: Option, - /// Output only. Information about the provisioning of certificates and the - /// health of the DNS resolution for the domain. - pub provisioning: Option, -} - -impl RequestValue for Domain {} -impl ResponseResult for Domain {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [releases list sites](struct.SiteReleaseListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListReleasesResponse { - /// If there are additional releases remaining beyond the ones in this - /// response, then supply this token in the next - /// [`list`](../sites.versions.files/list) call to continue with the next set - /// of releases. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of hashes of files that still need to be uploaded, if any exist. - pub releases: Option>, -} - -impl ResponseResult for ListReleasesResponse {} - - -/// The current certificate provisioning status information for a domain. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DomainProvisioning { - /// The HTTP challenge for generating a certificate. - #[serde(rename="certChallengeHttp")] - pub cert_challenge_http: Option, - /// The list of IPs to which the domain is expected to resolve. - #[serde(rename="expectedIps")] - pub expected_ips: Option>, - /// The TXT records (for the certificate challenge) that were found at the last - /// DNS fetch. - #[serde(rename="certChallengeDiscoveredTxt")] - pub cert_challenge_discovered_txt: Option>, - /// The time at which the last DNS fetch occurred. - #[serde(rename="dnsFetchTime")] - pub dns_fetch_time: Option, - /// The IPs found at the last DNS fetch. - #[serde(rename="discoveredIps")] - pub discovered_ips: Option>, - /// The DNS challenge for generating a certificate. - #[serde(rename="certChallengeDns")] - pub cert_challenge_dns: Option, - /// The DNS record match status as of the last DNS fetch. - #[serde(rename="dnsStatus")] - pub dns_status: Option, - /// The certificate provisioning status; updated when Firebase Hosting - /// provisions an SSL certificate for the domain. - #[serde(rename="certStatus")] - pub cert_status: Option, -} - -impl Part for DomainProvisioning {} - - -/// A `Rewrite` represents an internal content rewrite on the version. If the -/// pattern matches, the request will be handled as if it were to the -/// destination path specified in the configuration. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Rewrite { - /// The function to proxy requests to. Must match the exported function - /// name exactly. - pub function: Option, - /// The URL path to rewrite the request to. - pub path: Option, - /// The request will be forwarded to Firebase Dynamic Links. - #[serde(rename="dynamicLinks")] - pub dynamic_links: Option, - /// Required. The user-supplied - /// [glob pattern](/docs/hosting/full-config#section-glob) to match against - /// the request URL path. - pub glob: Option, -} - -impl Part for Rewrite {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [versions populate files sites](struct.SiteVersionPopulateFileCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PopulateVersionFilesResponse { - /// The content hashes of the specified files that need to be uploaded to the - /// specified endpoint. - #[serde(rename="uploadRequiredHashes")] - pub upload_required_hashes: Option>, - /// The URL to which the files should be uploaded, in the format: - ///
"https://upload-firebasehosting.googleapis.com/upload/sites/site-name/versions/versionID/files". - ///
Perform a multipart `POST` of the Gzipped file contents to the URL - /// using a forward slash and the hash of the file appended to the end. - #[serde(rename="uploadUrl")] - pub upload_url: Option, -} - -impl ResponseResult for PopulateVersionFilesResponse {} - - -/// A `Header` defines custom headers to add to a response should the request -/// URL path match the pattern. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Header { - /// Required. The additional headers to add to the response. - pub headers: Option>, - /// Required. The user-supplied - /// [glob pattern](/docs/hosting/full-config#section-glob) to match against - /// the request URL path. - pub glob: Option, -} - -impl Part for Header {} - - -/// The configuration for how incoming requests to a site should be routed and -/// processed before serving content. The patterns are matched and applied -/// according to a specific -/// [priority order](/docs/hosting/url-redirects-rewrites#section-priorities). -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ServingConfig { - /// Defines whether to drop the file extension from uploaded files. - #[serde(rename="cleanUrls")] - pub clean_urls: Option, - /// A list of custom response headers that are added to the content if the - /// request URL path matches the glob. - pub headers: Option>, - /// A list of globs that will cause the response to redirect to another - /// location. - pub redirects: Option>, - /// How to handle well known App Association files. - #[serde(rename="appAssociation")] - pub app_association: Option, - /// Defines how to handle a trailing slash in the URL path. - #[serde(rename="trailingSlashBehavior")] - pub trailing_slash_behavior: Option, - /// A list of rewrites that will act as if the service were given the - /// destination URL. - pub rewrites: Option>, -} - -impl Part for ServingConfig {} - - /// There is no detailed description. /// /// # Activities @@ -926,7 +977,7 @@ impl ResponseResult for ListVersionFilesResponse {} /// ::default(), None); /// let mut hub = FirebaseHosting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `domains_create(...)`, `domains_delete(...)`, `domains_get(...)`, `domains_list(...)`, `domains_update(...)`, `releases_create(...)`, `releases_list(...)`, `versions_create(...)`, `versions_delete(...)`, `versions_files_list(...)`, `versions_patch(...)` and `versions_populate_files(...)` +/// // like `domains_create(...)`, `domains_delete(...)`, `domains_get(...)`, `domains_list(...)`, `domains_update(...)`, `get_config(...)`, `releases_create(...)`, `releases_list(...)`, `update_config(...)`, `versions_create(...)`, `versions_delete(...)`, `versions_files_list(...)`, `versions_patch(...)` and `versions_populate_files(...)` /// // to build up your call. /// let rb = hub.sites(); /// # } @@ -1111,6 +1162,27 @@ impl<'a, C, A> SiteMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Sets the Hosting metadata for a specific site. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The site for which to update the SiteConfig, in the format: + /// sites/site-name/config + pub fn update_config(&self, request: SiteConfig, name: &str) -> SiteUpdateConfigCall<'a, C, A> { + SiteUpdateConfigCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Adds content files to a version. @@ -1131,6 +1203,24 @@ impl<'a, C, A> SiteMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets the Hosting metadata for a specific site. + /// + /// # Arguments + /// + /// * `name` - Required. The site for which to get the SiteConfig, in the format: + /// sites/site-name/config + pub fn get_config(&self, name: &str) -> SiteGetConfigCall<'a, C, A> { + SiteGetConfigCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Gets a domain mapping on the specified site. @@ -1297,7 +1387,7 @@ impl<'a, C, A> SiteVersionFileListCall<'a, C, A> where C: BorrowMut SiteVersionFileListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1336,7 +1423,7 @@ impl<'a, C, A> SiteVersionFileListCall<'a, C, A> where C: BorrowMut SiteVersionFileListCall<'a, C, A> where C: BorrowMut SiteDomainDeleteCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1587,10 +1674,7 @@ impl<'a, C, A> SiteDomainDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1610,7 +1694,7 @@ impl<'a, C, A> SiteDomainDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1688,7 +1772,7 @@ impl<'a, C, A> SiteDomainDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1832,7 +1916,7 @@ impl<'a, C, A> SiteReleaseListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1848,10 +1932,7 @@ impl<'a, C, A> SiteReleaseListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1871,7 +1952,7 @@ impl<'a, C, A> SiteReleaseListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1964,7 +2045,7 @@ impl<'a, C, A> SiteReleaseListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2111,7 +2192,7 @@ impl<'a, C, A> SiteReleaseCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2127,10 +2208,7 @@ impl<'a, C, A> SiteReleaseCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2162,7 +2240,7 @@ impl<'a, C, A> SiteReleaseCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2266,7 +2344,7 @@ impl<'a, C, A> SiteReleaseCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2407,7 +2485,7 @@ impl<'a, C, A> SiteDomainCreateCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2423,10 +2501,7 @@ impl<'a, C, A> SiteDomainCreateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2458,7 +2533,7 @@ impl<'a, C, A> SiteDomainCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2549,7 +2624,7 @@ impl<'a, C, A> SiteDomainCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2693,7 +2768,7 @@ impl<'a, C, A> SiteDomainListCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2709,10 +2784,7 @@ impl<'a, C, A> SiteDomainListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2732,7 +2804,7 @@ impl<'a, C, A> SiteDomainListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2825,7 +2897,7 @@ impl<'a, C, A> SiteDomainListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2976,7 +3048,7 @@ impl<'a, C, A> SiteVersionCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2992,10 +3064,7 @@ impl<'a, C, A> SiteVersionCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3027,7 +3096,7 @@ impl<'a, C, A> SiteVersionCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3134,7 +3203,7 @@ impl<'a, C, A> SiteVersionCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3285,7 +3354,7 @@ impl<'a, C, A> SiteVersionPatchCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3301,10 +3370,7 @@ impl<'a, C, A> SiteVersionPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3336,7 +3402,7 @@ impl<'a, C, A> SiteVersionPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3440,7 +3506,7 @@ impl<'a, C, A> SiteVersionPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3488,6 +3554,302 @@ impl<'a, C, A> SiteVersionPatchCall<'a, C, A> where C: BorrowMut, } +/// Sets the Hosting metadata for a specific site. +/// +/// A builder for the *updateConfig* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firebasehosting1_beta1 as firebasehosting1_beta1; +/// use firebasehosting1_beta1::SiteConfig; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firebasehosting1_beta1::FirebaseHosting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = FirebaseHosting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SiteConfig::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().update_config(req, "name") +/// .update_mask("et") +/// .doit(); +/// # } +/// ``` +pub struct SiteUpdateConfigCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FirebaseHosting, + _request: SiteConfig, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteUpdateConfigCall<'a, C, A> {} + +impl<'a, C, A> SiteUpdateConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SiteConfig)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firebasehosting.sites.updateConfig", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SiteConfig) -> SiteUpdateConfigCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The site for which to update the SiteConfig, in the format: + /// sites/site-name/config + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> SiteUpdateConfigCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// A set of field names from your [site configuration](../sites.SiteConfig) + /// that you want to update. + ///
A field will be overwritten if, and only if, it's in the mask. + ///
If a mask is not provided then a default mask of only + /// [`max_versions`](../sites.SiteConfig.max_versions) will be used. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> SiteUpdateConfigCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SiteUpdateConfigCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> SiteUpdateConfigCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SiteUpdateConfigCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Adds content files to a version. /// /// A builder for the *versions.populateFiles* method supported by a *site* resource. @@ -3581,7 +3943,7 @@ impl<'a, C, A> SiteVersionPopulateFileCall<'a, C, A> where C: BorrowMut SiteVersionPopulateFileCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3632,7 +3991,7 @@ impl<'a, C, A> SiteVersionPopulateFileCall<'a, C, A> where C: BorrowMut SiteVersionPopulateFileCall<'a, C, A> where C: BorrowMut SiteVersionPopulateFileCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = FirebaseHosting::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.sites().get_config("name") +/// .doit(); +/// # } +/// ``` +pub struct SiteGetConfigCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a FirebaseHosting, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteGetConfigCall<'a, C, A> {} + +impl<'a, C, A> SiteGetConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SiteConfig)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firebasehosting.sites.getConfig", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::FirebaseReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The site for which to get the SiteConfig, in the format: + /// sites/site-name/config + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> SiteGetConfigCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SiteGetConfigCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> SiteGetConfigCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::FirebaseReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SiteGetConfigCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Gets a domain mapping on the specified site. /// /// A builder for the *domains.get* method supported by a *site* resource. @@ -3857,7 +4465,7 @@ impl<'a, C, A> SiteDomainGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3873,10 +4481,7 @@ impl<'a, C, A> SiteDomainGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3896,7 +4501,7 @@ impl<'a, C, A> SiteDomainGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3974,7 +4579,7 @@ impl<'a, C, A> SiteDomainGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4108,7 +4713,7 @@ impl<'a, C, A> SiteVersionDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4124,10 +4729,7 @@ impl<'a, C, A> SiteVersionDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4147,7 +4749,7 @@ impl<'a, C, A> SiteVersionDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4226,7 +4828,7 @@ impl<'a, C, A> SiteVersionDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4368,7 +4970,7 @@ impl<'a, C, A> SiteDomainUpdateCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4384,10 +4986,7 @@ impl<'a, C, A> SiteDomainUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4419,7 +5018,7 @@ impl<'a, C, A> SiteDomainUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4510,7 +5109,7 @@ impl<'a, C, A> SiteDomainUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/firebaseremoteconfig1/Cargo.toml b/gen/firebaseremoteconfig1/Cargo.toml index a54fb34858..4c1d162cef 100644 --- a/gen/firebaseremoteconfig1/Cargo.toml +++ b/gen/firebaseremoteconfig1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/firebaseremoteconfig1/src/lib.rs b/gen/firebaseremoteconfig1/src/lib.rs index 2e53b98380..f02cac6858 100644 --- a/gen/firebaseremoteconfig1/src/lib.rs +++ b/gen/firebaseremoteconfig1/src/lib.rs @@ -686,7 +686,7 @@ impl<'a, C, A> ProjectGetRemoteConfigCall<'a, C, A> where C: BorrowMut ProjectGetRemoteConfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -790,7 +787,7 @@ impl<'a, C, A> ProjectGetRemoteConfigCall<'a, C, A> where C: BorrowMut ProjectUpdateRemoteConfigCall<'a, C, A> where C: BorrowMut ProjectUpdateRemoteConfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -978,7 +972,7 @@ impl<'a, C, A> ProjectUpdateRemoteConfigCall<'a, C, A> where C: BorrowMut ProjectUpdateRemoteConfigCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Firestore (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firestore1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-firestore1] path = "../firestore1" -version = "1.0.8+20181002" +version = "1.0.8+20190105" diff --git a/gen/firestore1-cli/README.md b/gen/firestore1-cli/README.md index 2d81d42dc9..43b686d68d 100644 --- a/gen/firestore1-cli/README.md +++ b/gen/firestore1-cli/README.md @@ -25,11 +25,33 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Firestore* API at revision *20181002*. The CLI is at version *1.0.8*. +This documentation was generated from the *Firestore* API at revision *20190105*. The CLI is at version *1.0.8*. ```bash firestore1 [options] projects + databases-collection-groups-fields-get [-p ]... [-o ] + databases-collection-groups-fields-list [-p ]... [-o ] + databases-collection-groups-fields-patch (-r )... [-p ]... [-o ] + databases-collection-groups-indexes-create (-r )... [-p ]... [-o ] + databases-collection-groups-indexes-delete [-p ]... [-o ] + databases-collection-groups-indexes-get [-p ]... [-o ] + databases-collection-groups-indexes-list [-p ]... [-o ] + databases-documents-batch-get (-r )... [-p ]... [-o ] + databases-documents-begin-transaction (-r )... [-p ]... [-o ] + databases-documents-commit (-r )... [-p ]... [-o ] + databases-documents-create-document (-r )... [-p ]... [-o ] + databases-documents-delete [-p ]... [-o ] + databases-documents-get [-p ]... [-o ] + databases-documents-list [-p ]... [-o ] + databases-documents-list-collection-ids (-r )... [-p ]... [-o ] + databases-documents-listen (-r )... [-p ]... [-o ] + databases-documents-patch (-r )... [-p ]... [-o ] + databases-documents-rollback (-r )... [-p ]... [-o ] + databases-documents-run-query (-r )... [-p ]... [-o ] + databases-documents-write (-r )... [-p ]... [-o ] + databases-export-documents (-r )... [-p ]... [-o ] + databases-import-documents (-r )... [-p ]... [-o ] databases-operations-cancel (-r )... [-p ]... [-o ] databases-operations-delete [-p ]... [-o ] databases-operations-get [-p ]... [-o ] diff --git a/gen/firestore1-cli/mkdocs.yml b/gen/firestore1-cli/mkdocs.yml index 4a6820536d..480286a91a 100644 --- a/gen/firestore1-cli/mkdocs.yml +++ b/gen/firestore1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Firestore v1.0.8+20181002 +site_name: Firestore v1.0.8+20190105 site_url: http://byron.github.io/google-apis-rs/google-firestore1-cli site_description: A complete library to interact with Firestore (protocol v1) @@ -9,6 +9,28 @@ site_dir: build_html pages: - ['index.md', 'Home'] +- ['projects_databases-collection-groups-fields-get.md', 'Projects', 'Databases Collection Groups Fields Get'] +- ['projects_databases-collection-groups-fields-list.md', 'Projects', 'Databases Collection Groups Fields List'] +- ['projects_databases-collection-groups-fields-patch.md', 'Projects', 'Databases Collection Groups Fields Patch'] +- ['projects_databases-collection-groups-indexes-create.md', 'Projects', 'Databases Collection Groups Indexes Create'] +- ['projects_databases-collection-groups-indexes-delete.md', 'Projects', 'Databases Collection Groups Indexes Delete'] +- ['projects_databases-collection-groups-indexes-get.md', 'Projects', 'Databases Collection Groups Indexes Get'] +- ['projects_databases-collection-groups-indexes-list.md', 'Projects', 'Databases Collection Groups Indexes List'] +- ['projects_databases-documents-batch-get.md', 'Projects', 'Databases Documents Batch Get'] +- ['projects_databases-documents-begin-transaction.md', 'Projects', 'Databases Documents Begin Transaction'] +- ['projects_databases-documents-commit.md', 'Projects', 'Databases Documents Commit'] +- ['projects_databases-documents-create-document.md', 'Projects', 'Databases Documents Create Document'] +- ['projects_databases-documents-delete.md', 'Projects', 'Databases Documents Delete'] +- ['projects_databases-documents-get.md', 'Projects', 'Databases Documents Get'] +- ['projects_databases-documents-list.md', 'Projects', 'Databases Documents List'] +- ['projects_databases-documents-list-collection-ids.md', 'Projects', 'Databases Documents List Collection Ids'] +- ['projects_databases-documents-listen.md', 'Projects', 'Databases Documents Listen'] +- ['projects_databases-documents-patch.md', 'Projects', 'Databases Documents Patch'] +- ['projects_databases-documents-rollback.md', 'Projects', 'Databases Documents Rollback'] +- ['projects_databases-documents-run-query.md', 'Projects', 'Databases Documents Run Query'] +- ['projects_databases-documents-write.md', 'Projects', 'Databases Documents Write'] +- ['projects_databases-export-documents.md', 'Projects', 'Databases Export Documents'] +- ['projects_databases-import-documents.md', 'Projects', 'Databases Import Documents'] - ['projects_databases-operations-cancel.md', 'Projects', 'Databases Operations Cancel'] - ['projects_databases-operations-delete.md', 'Projects', 'Databases Operations Delete'] - ['projects_databases-operations-get.md', 'Projects', 'Databases Operations Get'] diff --git a/gen/firestore1-cli/src/main.rs b/gen/firestore1-cli/src/main.rs index bd6faf0ab2..27fe1758f4 100644 --- a/gen/firestore1-cli/src/main.rs +++ b/gen/firestore1-cli/src/main.rs @@ -46,6 +46,1763 @@ struct Engine<'n> { impl<'n> Engine<'n> { + fn _projects_databases_collection_groups_fields_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().databases_collection_groups_fields_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_collection_groups_fields_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().databases_collection_groups_fields_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_collection_groups_fields_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "index-config.uses-ancestor-config" => Some(("indexConfig.usesAncestorConfig", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "index-config.ancestor-field" => Some(("indexConfig.ancestorField", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "index-config.reverting" => Some(("indexConfig.reverting", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["ancestor-field", "index-config", "name", "reverting", "uses-ancestor-config"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleFirestoreAdminV1Field = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_collection_groups_fields_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_collection_groups_indexes_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "query-scope" => Some(("queryScope", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["name", "query-scope", "state"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleFirestoreAdminV1Index = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_collection_groups_indexes_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_collection_groups_indexes_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().databases_collection_groups_indexes_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_collection_groups_indexes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().databases_collection_groups_indexes_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_collection_groups_indexes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().databases_collection_groups_indexes_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_batch_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "new-transaction.read-write.retry-transaction" => Some(("newTransaction.readWrite.retryTransaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "new-transaction.read-only.read-time" => Some(("newTransaction.readOnly.readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction" => Some(("transaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "mask.field-paths" => Some(("mask.fieldPaths", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "documents" => Some(("documents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "read-time" => Some(("readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["documents", "field-paths", "mask", "new-transaction", "read-only", "read-time", "read-write", "retry-transaction", "transaction"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BatchGetDocumentsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_documents_batch_get(request, opt.value_of("database").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_begin_transaction(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "options.read-write.retry-transaction" => Some(("options.readWrite.retryTransaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "options.read-only.read-time" => Some(("options.readOnly.readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["options", "read-only", "read-time", "read-write", "retry-transaction"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BeginTransactionRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_documents_begin_transaction(request, opt.value_of("database").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_commit(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "transaction" => Some(("transaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["transaction"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CommitRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_documents_commit(request, opt.value_of("database").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_create_document(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "name", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Document = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_documents_create_document(request, opt.value_of("parent").unwrap_or(""), opt.value_of("collection-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "mask-field-paths" => { + call = call.add_mask_field_paths(value.unwrap_or("")); + }, + "document-id" => { + call = call.document_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["mask-field-paths", "document-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().databases_documents_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "current-document-update-time" => { + call = call.current_document_update_time(value.unwrap_or("")); + }, + "current-document-exists" => { + call = call.current_document_exists(arg_from_str(value.unwrap_or("false"), err, "current-document-exists", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["current-document-update-time", "current-document-exists"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().databases_documents_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "transaction" => { + call = call.transaction(value.unwrap_or("")); + }, + "read-time" => { + call = call.read_time(value.unwrap_or("")); + }, + "mask-field-paths" => { + call = call.add_mask_field_paths(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["mask-field-paths", "transaction", "read-time"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().databases_documents_list(opt.value_of("parent").unwrap_or(""), opt.value_of("collection-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "transaction" => { + call = call.transaction(value.unwrap_or("")); + }, + "show-missing" => { + call = call.show_missing(arg_from_str(value.unwrap_or("false"), err, "show-missing", "boolean")); + }, + "read-time" => { + call = call.read_time(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, + "mask-field-paths" => { + call = call.add_mask_field_paths(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-by", "show-missing", "transaction", "page-size", "mask-field-paths", "page-token", "read-time"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_list_collection_ids(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["page-size", "page-token"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ListCollectionIdsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_documents_list_collection_ids(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_listen(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "add-target.documents.documents" => Some(("addTarget.documents.documents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "add-target.resume-token" => Some(("addTarget.resumeToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.target-id" => Some(("addTarget.targetId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "add-target.query.structured-query.limit" => Some(("addTarget.query.structuredQuery.limit", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.composite-filter.op" => Some(("addTarget.query.structuredQuery.where.compositeFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.field.field-path" => Some(("addTarget.query.structuredQuery.where.fieldFilter.field.fieldPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.value.bytes-value" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.bytesValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.value.timestamp-value" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.timestampValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.value.null-value" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.nullValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.value.reference-value" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.referenceValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.value.double-value" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.doubleValue", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.value.string-value" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.stringValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.value.boolean-value" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.booleanValue", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.value.integer-value" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.integerValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.value.geo-point-value.latitude" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.geoPointValue.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.value.geo-point-value.longitude" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.geoPointValue.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.field-filter.op" => Some(("addTarget.query.structuredQuery.where.fieldFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.unary-filter.field.field-path" => Some(("addTarget.query.structuredQuery.where.unaryFilter.field.fieldPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.unary-filter.op" => Some(("addTarget.query.structuredQuery.where.unaryFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.start-at.before" => Some(("addTarget.query.structuredQuery.startAt.before", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "add-target.query.structured-query.end-at.before" => Some(("addTarget.query.structuredQuery.endAt.before", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "add-target.query.structured-query.offset" => Some(("addTarget.query.structuredQuery.offset", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "add-target.query.parent" => Some(("addTarget.query.parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.once" => Some(("addTarget.once", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "add-target.read-time" => Some(("addTarget.readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remove-target" => Some(("removeTarget", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["add-target", "before", "boolean-value", "bytes-value", "composite-filter", "documents", "double-value", "end-at", "field", "field-filter", "field-path", "geo-point-value", "integer-value", "labels", "latitude", "limit", "longitude", "null-value", "offset", "once", "op", "parent", "query", "read-time", "reference-value", "remove-target", "resume-token", "start-at", "string-value", "structured-query", "target-id", "timestamp-value", "unary-filter", "value", "where"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ListenRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_documents_listen(request, opt.value_of("database").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "name", "update-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Document = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_documents_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask-field-paths" => { + call = call.add_update_mask_field_paths(value.unwrap_or("")); + }, + "mask-field-paths" => { + call = call.add_mask_field_paths(value.unwrap_or("")); + }, + "current-document-update-time" => { + call = call.current_document_update_time(value.unwrap_or("")); + }, + "current-document-exists" => { + call = call.current_document_exists(arg_from_str(value.unwrap_or("false"), err, "current-document-exists", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["current-document-update-time", "mask-field-paths", "update-mask-field-paths", "current-document-exists"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_rollback(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "transaction" => Some(("transaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["transaction"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RollbackRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_documents_rollback(request, opt.value_of("database").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_run_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "new-transaction.read-write.retry-transaction" => Some(("newTransaction.readWrite.retryTransaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "new-transaction.read-only.read-time" => Some(("newTransaction.readOnly.readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction" => Some(("transaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.limit" => Some(("structuredQuery.limit", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "structured-query.where.composite-filter.op" => Some(("structuredQuery.where.compositeFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.field.field-path" => Some(("structuredQuery.where.fieldFilter.field.fieldPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.value.bytes-value" => Some(("structuredQuery.where.fieldFilter.value.bytesValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.value.timestamp-value" => Some(("structuredQuery.where.fieldFilter.value.timestampValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.value.null-value" => Some(("structuredQuery.where.fieldFilter.value.nullValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.value.reference-value" => Some(("structuredQuery.where.fieldFilter.value.referenceValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.value.double-value" => Some(("structuredQuery.where.fieldFilter.value.doubleValue", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.value.string-value" => Some(("structuredQuery.where.fieldFilter.value.stringValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.value.boolean-value" => Some(("structuredQuery.where.fieldFilter.value.booleanValue", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.value.integer-value" => Some(("structuredQuery.where.fieldFilter.value.integerValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.value.geo-point-value.latitude" => Some(("structuredQuery.where.fieldFilter.value.geoPointValue.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.value.geo-point-value.longitude" => Some(("structuredQuery.where.fieldFilter.value.geoPointValue.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "structured-query.where.field-filter.op" => Some(("structuredQuery.where.fieldFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.unary-filter.field.field-path" => Some(("structuredQuery.where.unaryFilter.field.fieldPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.unary-filter.op" => Some(("structuredQuery.where.unaryFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.start-at.before" => Some(("structuredQuery.startAt.before", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "structured-query.end-at.before" => Some(("structuredQuery.endAt.before", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "structured-query.offset" => Some(("structuredQuery.offset", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "read-time" => Some(("readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["before", "boolean-value", "bytes-value", "composite-filter", "double-value", "end-at", "field", "field-filter", "field-path", "geo-point-value", "integer-value", "latitude", "limit", "longitude", "new-transaction", "null-value", "offset", "op", "read-only", "read-time", "read-write", "reference-value", "retry-transaction", "start-at", "string-value", "structured-query", "timestamp-value", "transaction", "unary-filter", "value", "where"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RunQueryRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_documents_run_query(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_documents_write(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "stream-token" => Some(("streamToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "stream-id" => Some(("streamId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["labels", "stream-id", "stream-token"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::WriteRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_documents_write(request, opt.value_of("database").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_export_documents(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "output-uri-prefix" => Some(("outputUriPrefix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "collection-ids" => Some(("collectionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["collection-ids", "output-uri-prefix"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleFirestoreAdminV1ExportDocumentsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_export_documents(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_databases_import_documents(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "input-uri-prefix" => Some(("inputUriPrefix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "collection-ids" => Some(("collectionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["collection-ids", "input-uri-prefix"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GoogleFirestoreAdminV1ImportDocumentsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().databases_import_documents(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_databases_operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -417,6 +2174,72 @@ impl<'n> Engine<'n> { match self.opt.subcommand() { ("projects", Some(opt)) => { match opt.subcommand() { + ("databases-collection-groups-fields-get", Some(opt)) => { + call_result = self._projects_databases_collection_groups_fields_get(opt, dry_run, &mut err); + }, + ("databases-collection-groups-fields-list", Some(opt)) => { + call_result = self._projects_databases_collection_groups_fields_list(opt, dry_run, &mut err); + }, + ("databases-collection-groups-fields-patch", Some(opt)) => { + call_result = self._projects_databases_collection_groups_fields_patch(opt, dry_run, &mut err); + }, + ("databases-collection-groups-indexes-create", Some(opt)) => { + call_result = self._projects_databases_collection_groups_indexes_create(opt, dry_run, &mut err); + }, + ("databases-collection-groups-indexes-delete", Some(opt)) => { + call_result = self._projects_databases_collection_groups_indexes_delete(opt, dry_run, &mut err); + }, + ("databases-collection-groups-indexes-get", Some(opt)) => { + call_result = self._projects_databases_collection_groups_indexes_get(opt, dry_run, &mut err); + }, + ("databases-collection-groups-indexes-list", Some(opt)) => { + call_result = self._projects_databases_collection_groups_indexes_list(opt, dry_run, &mut err); + }, + ("databases-documents-batch-get", Some(opt)) => { + call_result = self._projects_databases_documents_batch_get(opt, dry_run, &mut err); + }, + ("databases-documents-begin-transaction", Some(opt)) => { + call_result = self._projects_databases_documents_begin_transaction(opt, dry_run, &mut err); + }, + ("databases-documents-commit", Some(opt)) => { + call_result = self._projects_databases_documents_commit(opt, dry_run, &mut err); + }, + ("databases-documents-create-document", Some(opt)) => { + call_result = self._projects_databases_documents_create_document(opt, dry_run, &mut err); + }, + ("databases-documents-delete", Some(opt)) => { + call_result = self._projects_databases_documents_delete(opt, dry_run, &mut err); + }, + ("databases-documents-get", Some(opt)) => { + call_result = self._projects_databases_documents_get(opt, dry_run, &mut err); + }, + ("databases-documents-list", Some(opt)) => { + call_result = self._projects_databases_documents_list(opt, dry_run, &mut err); + }, + ("databases-documents-list-collection-ids", Some(opt)) => { + call_result = self._projects_databases_documents_list_collection_ids(opt, dry_run, &mut err); + }, + ("databases-documents-listen", Some(opt)) => { + call_result = self._projects_databases_documents_listen(opt, dry_run, &mut err); + }, + ("databases-documents-patch", Some(opt)) => { + call_result = self._projects_databases_documents_patch(opt, dry_run, &mut err); + }, + ("databases-documents-rollback", Some(opt)) => { + call_result = self._projects_databases_documents_rollback(opt, dry_run, &mut err); + }, + ("databases-documents-run-query", Some(opt)) => { + call_result = self._projects_databases_documents_run_query(opt, dry_run, &mut err); + }, + ("databases-documents-write", Some(opt)) => { + call_result = self._projects_databases_documents_write(opt, dry_run, &mut err); + }, + ("databases-export-documents", Some(opt)) => { + call_result = self._projects_databases_export_documents(opt, dry_run, &mut err); + }, + ("databases-import-documents", Some(opt)) => { + call_result = self._projects_databases_import_documents(opt, dry_run, &mut err); + }, ("databases-operations-cancel", Some(opt)) => { call_result = self._projects_databases_operations_cancel(opt, dry_run, &mut err); }, @@ -526,7 +2349,679 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'databases-operations-cancel', 'databases-operations-delete', 'databases-operations-get', 'databases-operations-list', 'locations-get' and 'locations-list'", vec![ + ("projects", "methods: 'databases-collection-groups-fields-get', 'databases-collection-groups-fields-list', 'databases-collection-groups-fields-patch', 'databases-collection-groups-indexes-create', 'databases-collection-groups-indexes-delete', 'databases-collection-groups-indexes-get', 'databases-collection-groups-indexes-list', 'databases-documents-batch-get', 'databases-documents-begin-transaction', 'databases-documents-commit', 'databases-documents-create-document', 'databases-documents-delete', 'databases-documents-get', 'databases-documents-list', 'databases-documents-list-collection-ids', 'databases-documents-listen', 'databases-documents-patch', 'databases-documents-rollback', 'databases-documents-run-query', 'databases-documents-write', 'databases-export-documents', 'databases-import-documents', 'databases-operations-cancel', 'databases-operations-delete', 'databases-operations-get', 'databases-operations-list', 'locations-get' and 'locations-list'", vec![ + ("databases-collection-groups-fields-get", + Some(r##"Gets the metadata and configuration for a Field."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-collection-groups-fields-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"A name of the form + `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-collection-groups-fields-list", + Some(r##"Lists the field configuration and metadata for this database. + + Currently, FirestoreAdmin.ListFields only supports listing fields + that have been explicitly overridden. To issue this query, call + FirestoreAdmin.ListFields with the filter set to + `indexConfig.usesAncestorConfig:false`."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-collection-groups-fields-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"A parent name of the form + `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-collection-groups-fields-patch", + Some(r##"Updates a field configuration. Currently, field updates apply only to + single field index configuration. However, calls to + FirestoreAdmin.UpdateField should provide a field mask to avoid + changing any configuration that the caller isn't aware of. The field mask + should be specified as: `{ paths: "index_config" }`. + + This call returns a google.longrunning.Operation which may be used to + track the status of the field update. The metadata for + the operation will be the type FieldOperationMetadata. + + To configure the default field settings for the database, use + the special `Field` with resource name: + `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-collection-groups-fields-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"A field name of the form + `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}` + + A field path may be a simple field name, e.g. `address` or a path to fields + within map_value , e.g. `address.city`, + or a special field path. The only valid special field is `*`, which + represents any field. + + Field paths may be quoted using ` (backtick). The only character that needs + to be escaped within a quoted field path is the backtick character itself, + escaped using a backslash. Special characters in field paths that + must be quoted include: `*`, `.`, + ``` (backtick), `[`, `]`, as well as any ascii symbolic characters. + + Examples: + (Note: Comments here are written in markdown syntax, so there is an + additional layer of backticks to represent a code block) + `\`address.city\`` represents a field named `address.city`, not the map key + `city` in the field `address`. + `\`*\`` represents a field named `*`, not any field. + + A special `Field` contains the default indexing settings for all fields. + This field's resource name is: + `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*` + Indexes defined on this `Field` will be applied to all fields which do not + have their own `Field` index configuration."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-collection-groups-indexes-create", + Some(r##"Creates a composite index. This returns a google.longrunning.Operation + which may be used to track the status of the creation. The metadata for + the operation will be the type IndexOperationMetadata."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-collection-groups-indexes-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"A parent name of the form + `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-collection-groups-indexes-delete", + Some(r##"Deletes a composite index."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-collection-groups-indexes-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"A name of the form + `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-collection-groups-indexes-get", + Some(r##"Gets a composite index."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-collection-groups-indexes-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"A name of the form + `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-collection-groups-indexes-list", + Some(r##"Lists composite indexes."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-collection-groups-indexes-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"A parent name of the form + `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-batch-get", + Some(r##"Gets multiple documents. + + Documents returned by this method are not guaranteed to be returned in the + same order that they were requested."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-batch-get", + vec![ + (Some(r##"database"##), + None, + Some(r##"The database name. In the format: + `projects/{project_id}/databases/{database_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-begin-transaction", + Some(r##"Starts a new transaction."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-begin-transaction", + vec![ + (Some(r##"database"##), + None, + Some(r##"The database name. In the format: + `projects/{project_id}/databases/{database_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-commit", + Some(r##"Commits a transaction, while optionally updating documents."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-commit", + vec![ + (Some(r##"database"##), + None, + Some(r##"The database name. In the format: + `projects/{project_id}/databases/{database_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-create-document", + Some(r##"Creates a new document."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-create-document", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The parent resource. For example: + `projects/{project_id}/databases/{database_id}/documents` or + `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`"##), + Some(true), + Some(false)), + + (Some(r##"collection-id"##), + None, + Some(r##"The collection ID, relative to `parent`, to list. For example: `chatrooms`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-delete", + Some(r##"Deletes a document."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the Document to delete. In the format: + `projects/{project_id}/databases/{database_id}/documents/{document_path}`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-get", + Some(r##"Gets a single document."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the Document to get. In the format: + `projects/{project_id}/databases/{database_id}/documents/{document_path}`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-list", + Some(r##"Lists documents."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The parent resource name. In the format: + `projects/{project_id}/databases/{database_id}/documents` or + `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + For example: + `projects/my-project/databases/my-database/documents` or + `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`"##), + Some(true), + Some(false)), + + (Some(r##"collection-id"##), + None, + Some(r##"The collection ID, relative to `parent`, to list. For example: `chatrooms` + or `messages`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-list-collection-ids", + Some(r##"Lists all the collection IDs underneath a document."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-list-collection-ids", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The parent document. In the format: + `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + For example: + `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-listen", + Some(r##"Listens to changes."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-listen", + vec![ + (Some(r##"database"##), + None, + Some(r##"The database name. In the format: + `projects/{project_id}/databases/{database_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-patch", + Some(r##"Updates or inserts a document."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the document, for example + `projects/{project_id}/databases/{database_id}/documents/{document_path}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-rollback", + Some(r##"Rolls back a transaction."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-rollback", + vec![ + (Some(r##"database"##), + None, + Some(r##"The database name. In the format: + `projects/{project_id}/databases/{database_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-run-query", + Some(r##"Runs a query."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-run-query", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The parent resource name. In the format: + `projects/{project_id}/databases/{database_id}/documents` or + `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + For example: + `projects/my-project/databases/my-database/documents` or + `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-documents-write", + Some(r##"Streams batches of document updates and deletes, in order."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-documents-write", + vec![ + (Some(r##"database"##), + None, + Some(r##"The database name. In the format: + `projects/{project_id}/databases/{database_id}`. + This is only required in the first message."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-export-documents", + Some(r##"Exports a copy of all or a subset of documents from Google Cloud Firestore + to another storage system, such as Google Cloud Storage. Recent updates to + documents may not be reflected in the export. The export occurs in the + background and its progress can be monitored and managed via the + Operation resource that is created. The output of an export may only be + used once the associated operation is done. If an export operation is + cancelled before completion it may leave partial data behind in Google + Cloud Storage."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-export-documents", + vec![ + (Some(r##"name"##), + None, + Some(r##"Database to export. Should be of the form: + `projects/{project_id}/databases/{database_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("databases-import-documents", + Some(r##"Imports documents into Google Cloud Firestore. Existing documents with the + same name are overwritten. The import occurs in the background and its + progress can be monitored and managed via the Operation resource that is + created. If an ImportDocuments operation is cancelled, it is possible + that a subset of the data has already been imported to Cloud Firestore."##), + "Details at http://byron.github.io/google-apis-rs/google_firestore1_cli/projects_databases-import-documents", + vec![ + (Some(r##"name"##), + None, + Some(r##"Database to import into. Should be of the form: + `projects/{project_id}/databases/{database_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), ("databases-operations-cancel", Some(r##"Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not @@ -694,7 +3189,7 @@ fn main() { let mut app = App::new("firestore1") .author("Sebastian Thiel ") - .version("1.0.8+20181002") + .version("1.0.8+20190105") .about("Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_firestore1_cli") diff --git a/gen/firestore1/Cargo.toml b/gen/firestore1/Cargo.toml index add086f534..734aaba621 100644 --- a/gen/firestore1/Cargo.toml +++ b/gen/firestore1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-firestore1" -version = "1.0.8+20181002" +version = "1.0.8+20190105" authors = ["Sebastian Thiel "] description = "A complete library to interact with Firestore (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firestore1" homepage = "https://cloud.google.com/firestore" -documentation = "https://docs.rs/google-firestore1/1.0.8+20181002" +documentation = "https://docs.rs/google-firestore1/1.0.8+20190105" license = "MIT" keywords = ["firestore", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/firestore1/README.md b/gen/firestore1/README.md index 5e6bc5af95..f8c7f63212 100644 --- a/gen/firestore1/README.md +++ b/gen/firestore1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-firestore1` library allows access to all features of the *Google Firestore* service. -This documentation was generated from *Firestore* crate version *1.0.8+20181002*, where *20181002* is the exact revision of the *firestore:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Firestore* crate version *1.0.8+20190105*, where *20190105* is the exact revision of the *firestore:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Firestore* *v1* API can be found at the [official documentation site](https://cloud.google.com/firestore). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/struct.Firestore.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.Firestore.html) ... * projects - * [*databases operations cancel*](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/struct.ProjectDatabaseOperationCancelCall.html), [*databases operations delete*](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/struct.ProjectDatabaseOperationDeleteCall.html), [*databases operations get*](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/struct.ProjectDatabaseOperationGetCall.html), [*databases operations list*](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/struct.ProjectDatabaseOperationListCall.html), [*locations get*](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/struct.ProjectLocationGetCall.html) and [*locations list*](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/struct.ProjectLocationListCall.html) + * [*databases collection groups fields get*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseCollectionGroupFieldGetCall.html), [*databases collection groups fields list*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseCollectionGroupFieldListCall.html), [*databases collection groups fields patch*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseCollectionGroupFieldPatchCall.html), [*databases collection groups indexes create*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseCollectionGroupIndexeCreateCall.html), [*databases collection groups indexes delete*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseCollectionGroupIndexeDeleteCall.html), [*databases collection groups indexes get*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseCollectionGroupIndexeGetCall.html), [*databases collection groups indexes list*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseCollectionGroupIndexeListCall.html), [*databases documents batch get*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentBatchGetCall.html), [*databases documents begin transaction*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentBeginTransactionCall.html), [*databases documents commit*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentCommitCall.html), [*databases documents create document*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentCreateDocumentCall.html), [*databases documents delete*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentDeleteCall.html), [*databases documents get*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentGetCall.html), [*databases documents list*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentListCall.html), [*databases documents list collection ids*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentListCollectionIdCall.html), [*databases documents listen*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentListenCall.html), [*databases documents patch*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentPatchCall.html), [*databases documents rollback*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentRollbackCall.html), [*databases documents run query*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentRunQueryCall.html), [*databases documents write*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseDocumentWriteCall.html), [*databases export documents*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseExportDocumentCall.html), [*databases import documents*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseImportDocumentCall.html), [*databases operations cancel*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseOperationCancelCall.html), [*databases operations delete*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseOperationDeleteCall.html), [*databases operations get*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseOperationGetCall.html), [*databases operations list*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectDatabaseOperationListCall.html), [*locations get*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectLocationGetCall.html) and [*locations list*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.ProjectLocationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/struct.Firestore.html)** +* **[Hub](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/struct.Firestore.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.Part.html)** + * **[Parts](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -47,8 +47,11 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.projects().databases_operations_cancel(...).doit() -let r = hub.projects().databases_operations_delete(...).doit() +let r = hub.projects().databases_import_documents(...).doit() +let r = hub.projects().databases_operations_get(...).doit() +let r = hub.projects().databases_export_documents(...).doit() +let r = hub.projects().databases_collection_groups_fields_patch(...).doit() +let r = hub.projects().databases_collection_groups_indexes_create(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -82,7 +85,7 @@ extern crate hyper; extern crate hyper_rustls; extern crate yup_oauth2 as oauth2; extern crate google_firestore1 as firestore1; -use firestore1::GoogleLongrunningCancelOperationRequest; +use firestore1::GoogleFirestoreAdminV1Field; use firestore1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -103,12 +106,13 @@ let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConn // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! -let mut req = GoogleLongrunningCancelOperationRequest::default(); +let mut req = GoogleFirestoreAdminV1Field::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.projects().databases_operations_cancel(req, "name") +let result = hub.projects().databases_collection_groups_fields_patch(req, "name") + .update_mask("sit") .doit(); match result { @@ -131,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -151,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-firestore1/1.0.8+20181002/google_firestore1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-firestore1/1.0.8+20190105/google_firestore1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/firestore1/src/lib.rs b/gen/firestore1/src/lib.rs index cb487f76af..9513711a55 100644 --- a/gen/firestore1/src/lib.rs +++ b/gen/firestore1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Firestore* crate version *1.0.8+20181002*, where *20181002* is the exact revision of the *firestore:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Firestore* crate version *1.0.8+20190105*, where *20190105* is the exact revision of the *firestore:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Firestore* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/firestore). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Firestore.html) ... //! //! * projects -//! * [*databases operations cancel*](struct.ProjectDatabaseOperationCancelCall.html), [*databases operations delete*](struct.ProjectDatabaseOperationDeleteCall.html), [*databases operations get*](struct.ProjectDatabaseOperationGetCall.html), [*databases operations list*](struct.ProjectDatabaseOperationListCall.html), [*locations get*](struct.ProjectLocationGetCall.html) and [*locations list*](struct.ProjectLocationListCall.html) +//! * [*databases collection groups fields get*](struct.ProjectDatabaseCollectionGroupFieldGetCall.html), [*databases collection groups fields list*](struct.ProjectDatabaseCollectionGroupFieldListCall.html), [*databases collection groups fields patch*](struct.ProjectDatabaseCollectionGroupFieldPatchCall.html), [*databases collection groups indexes create*](struct.ProjectDatabaseCollectionGroupIndexeCreateCall.html), [*databases collection groups indexes delete*](struct.ProjectDatabaseCollectionGroupIndexeDeleteCall.html), [*databases collection groups indexes get*](struct.ProjectDatabaseCollectionGroupIndexeGetCall.html), [*databases collection groups indexes list*](struct.ProjectDatabaseCollectionGroupIndexeListCall.html), [*databases documents batch get*](struct.ProjectDatabaseDocumentBatchGetCall.html), [*databases documents begin transaction*](struct.ProjectDatabaseDocumentBeginTransactionCall.html), [*databases documents commit*](struct.ProjectDatabaseDocumentCommitCall.html), [*databases documents create document*](struct.ProjectDatabaseDocumentCreateDocumentCall.html), [*databases documents delete*](struct.ProjectDatabaseDocumentDeleteCall.html), [*databases documents get*](struct.ProjectDatabaseDocumentGetCall.html), [*databases documents list*](struct.ProjectDatabaseDocumentListCall.html), [*databases documents list collection ids*](struct.ProjectDatabaseDocumentListCollectionIdCall.html), [*databases documents listen*](struct.ProjectDatabaseDocumentListenCall.html), [*databases documents patch*](struct.ProjectDatabaseDocumentPatchCall.html), [*databases documents rollback*](struct.ProjectDatabaseDocumentRollbackCall.html), [*databases documents run query*](struct.ProjectDatabaseDocumentRunQueryCall.html), [*databases documents write*](struct.ProjectDatabaseDocumentWriteCall.html), [*databases export documents*](struct.ProjectDatabaseExportDocumentCall.html), [*databases import documents*](struct.ProjectDatabaseImportDocumentCall.html), [*databases operations cancel*](struct.ProjectDatabaseOperationCancelCall.html), [*databases operations delete*](struct.ProjectDatabaseOperationDeleteCall.html), [*databases operations get*](struct.ProjectDatabaseOperationGetCall.html), [*databases operations list*](struct.ProjectDatabaseOperationListCall.html), [*locations get*](struct.ProjectLocationGetCall.html) and [*locations list*](struct.ProjectLocationListCall.html) //! //! //! @@ -47,8 +47,11 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.projects().databases_operations_cancel(...).doit() -//! let r = hub.projects().databases_operations_delete(...).doit() +//! let r = hub.projects().databases_import_documents(...).doit() +//! let r = hub.projects().databases_operations_get(...).doit() +//! let r = hub.projects().databases_export_documents(...).doit() +//! let r = hub.projects().databases_collection_groups_fields_patch(...).doit() +//! let r = hub.projects().databases_collection_groups_indexes_create(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -82,7 +85,7 @@ //! extern crate hyper_rustls; //! extern crate yup_oauth2 as oauth2; //! extern crate google_firestore1 as firestore1; -//! use firestore1::GoogleLongrunningCancelOperationRequest; +//! use firestore1::GoogleFirestoreAdminV1Field; //! use firestore1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -104,12 +107,13 @@ //! // As the method needs a request, you would usually fill it with the desired information //! // into the respective structure. Some of the parts shown here might not be applicable ! //! // Values shown here are possibly random and not representative ! -//! let mut req = GoogleLongrunningCancelOperationRequest::default(); +//! let mut req = GoogleFirestoreAdminV1Field::default(); //! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.projects().databases_operations_cancel(req, "name") +//! let result = hub.projects().databases_collection_groups_fields_patch(req, "name") +//! .update_mask("sed") //! .doit(); //! //! match result { @@ -271,7 +275,7 @@ impl Default for Scope { /// extern crate hyper_rustls; /// extern crate yup_oauth2 as oauth2; /// extern crate google_firestore1 as firestore1; -/// use firestore1::GoogleLongrunningCancelOperationRequest; +/// use firestore1::GoogleFirestoreAdminV1Field; /// use firestore1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -293,12 +297,13 @@ impl Default for Scope { /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = GoogleLongrunningCancelOperationRequest::default(); +/// let mut req = GoogleFirestoreAdminV1Field::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().databases_operations_cancel(req, "name") +/// let result = hub.projects().databases_collection_groups_fields_patch(req, "name") +/// .update_mask("dolores") /// .doit(); /// /// match result { @@ -375,6 +380,1117 @@ impl<'a, C, A> Firestore // ############ // SCHEMAS ### // ########## +/// The response for Firestore.Listen. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents listen projects](struct.ProjectDatabaseDocumentListenCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListenResponse { + /// A filter to apply to the set of documents previously returned for the + /// given target. + /// + /// Returned when documents may have been removed from the given target, but + /// the exact documents are unknown. + pub filter: Option, + /// A Document has been deleted. + #[serde(rename="documentDelete")] + pub document_delete: Option, + /// A Document has changed. + #[serde(rename="documentChange")] + pub document_change: Option, + /// A Document has been removed from a target (because it is no longer + /// relevant to that target). + #[serde(rename="documentRemove")] + pub document_remove: Option, + /// Targets have changed. + #[serde(rename="targetChange")] + pub target_change: Option, +} + +impl ResponseResult for ListenResponse {} + + +/// Cloud Firestore indexes enable simple and complex queries against +/// documents in a database. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases collection groups indexes get projects](struct.ProjectDatabaseCollectionGroupIndexeGetCall.html) (response) +/// * [databases collection groups indexes create projects](struct.ProjectDatabaseCollectionGroupIndexeCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFirestoreAdminV1Index { + /// The fields supported by this index. + /// + /// For composite indexes, this is always 2 or more fields. + /// The last field entry is always for the field path `__name__`. If, on + /// creation, `__name__` was not specified as the last field, it will be added + /// automatically with the same direction as that of the last field defined. If + /// the final field in a composite index is not directional, the `__name__` + /// will be ordered ASCENDING (unless explicitly specified). + /// + /// For single field indexes, this will always be exactly one entry with a + /// field path equal to the field path of the associated field. + pub fields: Option>, + /// Indexes with a collection query scope specified allow queries + /// against a collection that is the child of a specific document, specified at + /// query time, and that has the same collection id. + /// + /// Indexes with a collection group query scope specified allow queries against + /// all collections descended from a specific document, specified at query + /// time, and that have the same collection id as this index. + #[serde(rename="queryScope")] + pub query_scope: Option, + /// Output only. + /// A server defined name for this index. + /// The form of this name for composite indexes will be: + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}` + /// For single field indexes, this field will be empty. + pub name: Option, + /// Output only. + /// The serving state of the index. + pub state: Option, +} + +impl RequestValue for GoogleFirestoreAdminV1Index {} +impl ResponseResult for GoogleFirestoreAdminV1Index {} + + +/// A filter on a specific field. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FieldFilter { + /// The field to filter by. + pub field: Option, + /// The value to compare to. + pub value: Option, + /// The operator to filter by. + pub op: Option, +} + +impl Part for FieldFilter {} + + +/// A Firestore document. +/// +/// Must not exceed 1 MiB - 4 bytes. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents get projects](struct.ProjectDatabaseDocumentGetCall.html) (response) +/// * [databases documents create document projects](struct.ProjectDatabaseDocumentCreateDocumentCall.html) (request|response) +/// * [databases documents patch projects](struct.ProjectDatabaseDocumentPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Document { + /// The document's fields. + /// + /// The map keys represent field names. + /// + /// A simple field name contains only characters `a` to `z`, `A` to `Z`, + /// `0` to `9`, or `_`, and must not start with `0` to `9`. For example, + /// `foo_bar_17`. + /// + /// Field names matching the regular expression `__.*__` are reserved. Reserved + /// field names are forbidden except in certain documented contexts. The map + /// keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be + /// empty. + /// + /// Field paths may be used in other contexts to refer to structured fields + /// defined here. For `map_value`, the field path is represented by the simple + /// or quoted field names of the containing fields, delimited by `.`. For + /// example, the structured field + /// `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be + /// represented by the field path `foo.x&y`. + /// + /// Within a field path, a quoted field name starts and ends with `` ` `` and + /// may contain any character. Some characters, including `` ` ``, must be + /// escaped using a `\`. For example, `` `x&y` `` represents `x&y` and + /// `` `bak\`tik` `` represents `` bak`tik ``. + pub fields: Option>, + /// Output only. The time at which the document was last changed. + /// + /// This value is initially set to the `create_time` then increases + /// monotonically with each change to the document. It can also be + /// compared to values from other documents and the `read_time` of a query. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Output only. The time at which the document was created. + /// + /// This value increases monotonically when a document is deleted then + /// recreated. It can also be compared to values from other documents and + /// the `read_time` of a query. + #[serde(rename="createTime")] + pub create_time: Option, + /// The resource name of the document, for example + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + pub name: Option, +} + +impl RequestValue for Document {} +impl ResponseResult for Document {} + + +/// An array value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ArrayValue { + /// Values in the array. + pub values: Option>, +} + +impl Part for ArrayValue {} + + +/// The streamed response for Firestore.BatchGetDocuments. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents batch get projects](struct.ProjectDatabaseDocumentBatchGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchGetDocumentsResponse { + /// A document that was requested. + pub found: Option, + /// The transaction that was started as part of this request. + /// Will only be set in the first response, and only if + /// BatchGetDocumentsRequest.new_transaction was set in the request. + pub transaction: Option, + /// A document name that was requested but does not exist. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + pub missing: Option, + /// The time at which the document was read. + /// This may be monotically increasing, in this case the previous documents in + /// the result stream are guaranteed not to have changed between their + /// read_time and this one. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl ResponseResult for BatchGetDocumentsResponse {} + + +/// Options for creating a new transaction. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TransactionOptions { + /// The transaction can be used for both read and write operations. + #[serde(rename="readWrite")] + pub read_write: Option, + /// The transaction can only be used for read operations. + #[serde(rename="readOnly")] + pub read_only: Option, +} + +impl Part for TransactionOptions {} + + +/// A filter with a single operand. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UnaryFilter { + /// The field to which to apply the operator. + pub field: Option, + /// The unary operator to apply. + pub op: Option, +} + +impl Part for UnaryFilter {} + + +/// A set of field paths on a document. +/// Used to restrict a get or update operation on a document to a subset of its +/// fields. +/// This is different from standard field masks, as this is always scoped to a +/// Document, and takes in account the dynamic nature of Value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DocumentMask { + /// The list of field paths in the mask. See Document.fields for a field + /// path syntax reference. + #[serde(rename="fieldPaths")] + pub field_paths: Option>, +} + +impl Part for DocumentMask {} + + +/// The request for Firestore.ListCollectionIds. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents list collection ids projects](struct.ProjectDatabaseDocumentListCollectionIdCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListCollectionIdsRequest { + /// A page token. Must be a value from + /// ListCollectionIdsResponse. + #[serde(rename="pageToken")] + pub page_token: Option, + /// The maximum number of results to return. + #[serde(rename="pageSize")] + pub page_size: Option, +} + +impl RequestValue for ListCollectionIdsRequest {} + + +/// The request message for Operations.CancelOperation. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases operations cancel projects](struct.ProjectDatabaseOperationCancelCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleLongrunningCancelOperationRequest { _never_set: Option } + +impl RequestValue for GoogleLongrunningCancelOperationRequest {} + + +/// The response for Firestore.Write. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents write projects](struct.ProjectDatabaseDocumentWriteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WriteResponse { + /// The result of applying the writes. + /// + /// This i-th write result corresponds to the i-th write in the + /// request. + #[serde(rename="writeResults")] + pub write_results: Option>, + /// A token that represents the position of this response in the stream. + /// This can be used by a client to resume the stream at this point. + /// + /// This field is always set. + #[serde(rename="streamToken")] + pub stream_token: Option, + /// The time at which the commit occurred. + #[serde(rename="commitTime")] + pub commit_time: Option, + /// The ID of the stream. + /// Only set on the first message, when a new stream was created. + #[serde(rename="streamId")] + pub stream_id: Option, +} + +impl ResponseResult for WriteResponse {} + + +/// A target specified by a set of documents names. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DocumentsTarget { + /// The names of the documents to retrieve. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// The request will fail if any of the document is not a child resource of + /// the given `database`. Duplicate names will be elided. + pub documents: Option>, +} + +impl Part for DocumentsTarget {} + + +/// The response from Firestore.ListCollectionIds. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents list collection ids projects](struct.ProjectDatabaseDocumentListCollectionIdCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListCollectionIdsResponse { + /// A page token that may be used to continue the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The collection ids. + #[serde(rename="collectionIds")] + pub collection_ids: Option>, +} + +impl ResponseResult for ListCollectionIdsResponse {} + + +/// A message that can hold any of the supported value types. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Value { + /// A bytes value. + /// + /// Must not exceed 1 MiB - 89 bytes. + /// Only the first 1,500 bytes are considered by queries. + #[serde(rename="bytesValue")] + pub bytes_value: Option, + /// A timestamp value. + /// + /// Precise only to microseconds. When stored, any additional precision is + /// rounded down. + #[serde(rename="timestampValue")] + pub timestamp_value: Option, + /// A geo point value representing a point on the surface of Earth. + #[serde(rename="geoPointValue")] + pub geo_point_value: Option, + /// A reference to a document. For example: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + #[serde(rename="referenceValue")] + pub reference_value: Option, + /// A double value. + #[serde(rename="doubleValue")] + pub double_value: Option, + /// A map value. + #[serde(rename="mapValue")] + pub map_value: Option, + /// A string value. + /// + /// The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes. + /// Only the first 1,500 bytes of the UTF-8 representation are considered by + /// queries. + #[serde(rename="stringValue")] + pub string_value: Option, + /// A boolean value. + #[serde(rename="booleanValue")] + pub boolean_value: Option, + /// An array value. + /// + /// Cannot directly contain another array value, though can contain an + /// map which contains another array. + #[serde(rename="arrayValue")] + pub array_value: Option, + /// An integer value. + #[serde(rename="integerValue")] + pub integer_value: Option, + /// A null value. + #[serde(rename="nullValue")] + pub null_value: Option, +} + +impl Part for Value {} + + +/// A filter. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Filter { + /// A composite filter. + #[serde(rename="compositeFilter")] + pub composite_filter: Option, + /// A filter on a document field. + #[serde(rename="fieldFilter")] + pub field_filter: Option, + /// A filter that takes exactly one argument. + #[serde(rename="unaryFilter")] + pub unary_filter: Option, +} + +impl Part for Filter {} + + +/// A transformation of a field of the document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FieldTransform { + /// The path of the field. See Document.fields for the field path syntax + /// reference. + #[serde(rename="fieldPath")] + pub field_path: Option, + /// Sets the field to the minimum of its current value and the given value. + /// + /// This must be an integer or a double value. + /// If the field is not an integer or double, or if the field does not yet + /// exist, the transformation will set the field to the input value. + /// If a minimum operation is applied where the field and the input value + /// are of mixed types (that is - one is an integer and one is a double) + /// the field takes on the type of the smaller operand. If the operands are + /// equivalent (e.g. 3 and 3.0), the field does not change. + /// 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and + /// zero input value is always the stored value. + /// The minimum of any numeric value x and NaN is NaN. + pub minimum: Option, + /// Append the given elements in order if they are not already present in + /// the current field value. + /// If the field is not an array, or if the field does not yet exist, it is + /// first set to the empty array. + /// + /// Equivalent numbers of different types (e.g. 3L and 3.0) are + /// considered equal when checking if a value is missing. + /// NaN is equal to NaN, and Null is equal to Null. + /// If the input contains multiple equivalent values, only the first will + /// be considered. + /// + /// The corresponding transform_result will be the null value. + #[serde(rename="appendMissingElements")] + pub append_missing_elements: Option, + /// Adds the given value to the field's current value. + /// + /// This must be an integer or a double value. + /// If the field is not an integer or double, or if the field does not yet + /// exist, the transformation will set the field to the given value. + /// If either of the given value or the current field value are doubles, + /// both values will be interpreted as doubles. Double arithmetic and + /// representation of double values follow IEEE 754 semantics. + /// If there is positive/negative integer overflow, the field is resolved + /// to the largest magnitude positive/negative integer. + pub increment: Option, + /// Sets the field to the maximum of its current value and the given value. + /// + /// This must be an integer or a double value. + /// If the field is not an integer or double, or if the field does not yet + /// exist, the transformation will set the field to the given value. + /// If a maximum operation is applied where the field and the input value + /// are of mixed types (that is - one is an integer and one is a double) + /// the field takes on the type of the larger operand. If the operands are + /// equivalent (e.g. 3 and 3.0), the field does not change. + /// 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and + /// zero input value is always the stored value. + /// The maximum of any numeric value x and NaN is NaN. + pub maximum: Option, + /// Remove all of the given elements from the array in the field. + /// If the field is not an array, or if the field does not yet exist, it is + /// set to the empty array. + /// + /// Equivalent numbers of the different types (e.g. 3L and 3.0) are + /// considered equal when deciding whether an element should be removed. + /// NaN is equal to NaN, and Null is equal to Null. + /// This will remove all equivalent values if there are duplicates. + /// + /// The corresponding transform_result will be the null value. + #[serde(rename="removeAllFromArray")] + pub remove_all_from_array: Option, + /// Sets the field to the given server value. + #[serde(rename="setToServerValue")] + pub set_to_server_value: Option, +} + +impl Part for FieldTransform {} + + +/// The request for FirestoreAdmin.ExportDocuments. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases export documents projects](struct.ProjectDatabaseExportDocumentCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFirestoreAdminV1ExportDocumentsRequest { + /// The output URI. Currently only supports Google Cloud Storage URIs of the + /// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name + /// of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional + /// Google Cloud Storage namespace path. When + /// choosing a name, be sure to consider Google Cloud Storage naming + /// guidelines: https://cloud.google.com/storage/docs/naming. + /// If the URI is a bucket (without a namespace path), a prefix will be + /// generated based on the start time. + #[serde(rename="outputUriPrefix")] + pub output_uri_prefix: Option, + /// Which collection ids to export. Unspecified means all collections. + #[serde(rename="collectionIds")] + pub collection_ids: Option>, +} + +impl RequestValue for GoogleFirestoreAdminV1ExportDocumentsRequest {} + + +/// The response for Firestore.RunQuery. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents run query projects](struct.ProjectDatabaseDocumentRunQueryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RunQueryResponse { + /// The number of results that have been skipped due to an offset between + /// the last response and the current response. + #[serde(rename="skippedResults")] + pub skipped_results: Option, + /// The transaction that was started as part of this request. + /// Can only be set in the first response, and only if + /// RunQueryRequest.new_transaction was set in the request. + /// If set, no other fields will be set in this response. + pub transaction: Option, + /// A query result. + /// Not set when reporting partial progress. + pub document: Option, + /// The time at which the document was read. This may be monotonically + /// increasing; in this case, the previous documents in the result stream are + /// guaranteed not to have changed between their `read_time` and this one. + /// + /// If the query returns no results, a response with `read_time` and no + /// `document` will be sent, and this represents the time at which the query + /// was run. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl ResponseResult for RunQueryResponse {} + + +/// A precondition on a document, used for conditional operations. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Precondition { + /// When set, the target document must exist and have been last updated at + /// that time. + #[serde(rename="updateTime")] + pub update_time: Option, + /// When set to `true`, the target document must exist. + /// When set to `false`, the target document must not exist. + pub exists: Option, +} + +impl Part for Precondition {} + + +/// The projection of document's fields to return. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Projection { + /// The fields to return. + /// + /// If empty, all fields are returned. To only return the name + /// of the document, use `['__name__']`. + pub fields: Option>, +} + +impl Part for Projection {} + + +/// Options for a transaction that can be used to read and write documents. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReadWrite { + /// An optional transaction to retry. + #[serde(rename="retryTransaction")] + pub retry_transaction: Option, +} + +impl Part for ReadWrite {} + + +/// A Document has changed. +/// +/// May be the result of multiple writes, including deletes, that +/// ultimately resulted in a new value for the Document. +/// +/// Multiple DocumentChange messages may be returned for the same logical +/// change, if multiple targets are affected. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DocumentChange { + /// A set of target IDs for targets that no longer match this document. + #[serde(rename="removedTargetIds")] + pub removed_target_ids: Option>, + /// The new state of the Document. + /// + /// If `mask` is set, contains only fields that were updated or added. + pub document: Option, + /// A set of target IDs of targets that match this document. + #[serde(rename="targetIds")] + pub target_ids: Option>, +} + +impl Part for DocumentChange {} + + +/// A Document has been removed from the view of the targets. +/// +/// Sent if the document is no longer relevant to a target and is out of view. +/// Can be sent instead of a DocumentDelete or a DocumentChange if the server +/// can not send the new value of the document. +/// +/// Multiple DocumentRemove messages may be returned for the same logical +/// write or delete, if multiple targets are affected. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DocumentRemove { + /// The resource name of the Document that has gone out of view. + pub document: Option, + /// A set of target IDs for targets that previously matched this document. + #[serde(rename="removedTargetIds")] + pub removed_target_ids: Option>, + /// The read timestamp at which the remove was observed. + /// + /// Greater or equal to the `commit_time` of the change/delete/remove. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl Part for DocumentRemove {} + + +/// The request for Firestore.Rollback. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents rollback projects](struct.ProjectDatabaseDocumentRollbackCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RollbackRequest { + /// The transaction to roll back. + pub transaction: Option, +} + +impl RequestValue for RollbackRequest {} + + +/// Options for a transaction that can only be used to read documents. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReadOnly { + /// Reads documents at the given time. + /// This may not be older than 60 seconds. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl Part for ReadOnly {} + + +/// A transformation of a document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DocumentTransform { + /// The name of the document to transform. + pub document: Option, + /// The list of transformations to apply to the fields of the document, in + /// order. + /// This must not be empty. + #[serde(rename="fieldTransforms")] + pub field_transforms: Option>, +} + +impl Part for DocumentTransform {} + + +/// A position in a query result set. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Cursor { + /// The values that represent a position, in the order they appear in + /// the order by clause of a query. + /// + /// Can contain fewer values than specified in the order by clause. + pub values: Option>, + /// If the position is just before or just after the given values, relative + /// to the sort order defined by the query. + pub before: Option, +} + +impl Part for Cursor {} + + +/// The response for Firestore.BeginTransaction. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents begin transaction projects](struct.ProjectDatabaseDocumentBeginTransactionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BeginTransactionResponse { + /// The transaction that was started. + pub transaction: Option, +} + +impl ResponseResult for BeginTransactionResponse {} + + +/// A write on a document. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Write { + /// A document name to delete. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + pub delete: Option, + /// An optional precondition on the document. + /// + /// The write will fail if this is set and not met by the target document. + #[serde(rename="currentDocument")] + pub current_document: Option, + /// The fields to update in this write. + /// + /// This field can be set only when the operation is `update`. + /// If the mask is not set for an `update` and the document exists, any + /// existing data will be overwritten. + /// If the mask is set and the document on the server has fields not covered by + /// the mask, they are left unchanged. + /// Fields referenced in the mask, but not present in the input document, are + /// deleted from the document on the server. + /// The field paths in this mask must not contain a reserved field name. + #[serde(rename="updateMask")] + pub update_mask: Option, + /// Applies a tranformation to a document. + /// At most one `transform` per document is allowed in a given request. + /// An `update` cannot follow a `transform` on the same document in a given + /// request. + pub transform: Option, + /// A document to write. + pub update: Option, +} + +impl Part for Write {} + + +/// The response message for Locations.ListLocations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations list projects](struct.ProjectLocationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLocationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of locations that matches the specified filter in the request. + pub locations: Option>, +} + +impl ResponseResult for ListLocationsResponse {} + + +/// A resource that represents Google Cloud Platform location. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Location { + /// The friendly name for this location, typically a nearby city name. + /// For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, + /// Resource name for the location, which may vary between implementations. + /// For example: `"projects/example-project/locations/us-east1"` + pub name: Option, + /// Service-specific metadata. For example the available capacity at the given + /// location. + pub metadata: Option>, +} + +impl ResponseResult for Location {} + + +/// A field in an index. +/// The field_path describes which field is indexed, the value_mode describes +/// how the field value is indexed. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFirestoreAdminV1IndexField { + /// Can be __name__. + /// For single field indexes, this must match the name of the field or may + /// be omitted. + #[serde(rename="fieldPath")] + pub field_path: Option, + /// Indicates that this field supports ordering by the specified order or + /// comparing using =, <, <=, >, >=. + pub order: Option, + /// Indicates that this field supports operations on `array_value`s. + #[serde(rename="arrayConfig")] + pub array_config: Option, +} + +impl Part for GoogleFirestoreAdminV1IndexField {} + + +/// The response for Firestore.Commit. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents commit projects](struct.ProjectDatabaseDocumentCommitCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CommitResponse { + /// The result of applying the writes. + /// + /// This i-th write result corresponds to the i-th write in the + /// request. + #[serde(rename="writeResults")] + pub write_results: Option>, + /// The time at which the commit occurred. + #[serde(rename="commitTime")] + pub commit_time: Option, +} + +impl ResponseResult for CommitResponse {} + + +/// A request for Firestore.Listen +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents listen projects](struct.ProjectDatabaseDocumentListenCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListenRequest { + /// A target to add to this stream. + #[serde(rename="addTarget")] + pub add_target: Option, + /// Labels associated with this target change. + pub labels: Option>, + /// The ID of a target to remove from this stream. + #[serde(rename="removeTarget")] + pub remove_target: Option, +} + +impl RequestValue for ListenRequest {} + + +/// A reference to a field, such as `max(messages.time) as max_time`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FieldReference { + /// no description provided + #[serde(rename="fieldPath")] + pub field_path: Option, +} + +impl Part for FieldReference {} + + +/// The result of applying a write. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WriteResult { + /// The last update time of the document after applying the write. Not set + /// after a `delete`. + /// + /// If the write did not actually change the document, this will be the + /// previous update_time. + #[serde(rename="updateTime")] + pub update_time: Option, + /// The results of applying each DocumentTransform.FieldTransform, in the + /// same order. + #[serde(rename="transformResults")] + pub transform_results: Option>, +} + +impl Part for WriteResult {} + + +/// The response for FirestoreAdmin.ListIndexes. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases collection groups indexes list projects](struct.ProjectDatabaseCollectionGroupIndexeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFirestoreAdminV1ListIndexesResponse { + /// A page token that may be used to request another page of results. If blank, + /// this is the last page. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The requested indexes. + pub indexes: Option>, +} + +impl ResponseResult for GoogleFirestoreAdminV1ListIndexesResponse {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents delete projects](struct.ProjectDatabaseDocumentDeleteCall.html) (response) +/// * [databases operations cancel projects](struct.ProjectDatabaseOperationCancelCall.html) (response) +/// * [databases operations delete projects](struct.ProjectDatabaseOperationDeleteCall.html) (response) +/// * [databases collection groups indexes delete projects](struct.ProjectDatabaseCollectionGroupIndexeDeleteCall.html) (response) +/// * [databases documents rollback projects](struct.ProjectDatabaseDocumentRollbackCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// A digest of all the documents that match a given target. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExistenceFilter { + /// The total count of documents that match target_id. + /// + /// If different from the count of documents in the client that match, the + /// client must manually determine which documents no longer match the target. + pub count: Option, + /// The target ID to which this filter applies. + #[serde(rename="targetId")] + pub target_id: Option, +} + +impl Part for ExistenceFilter {} + + +/// A map value. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MapValue { + /// The map's fields. + /// + /// The map keys represent field names. Field names matching the regular + /// expression `__.*__` are reserved. Reserved field names are forbidden except + /// in certain documented contexts. The map keys, represented as UTF-8, must + /// not exceed 1,500 bytes and cannot be empty. + pub fields: Option>, +} + +impl Part for MapValue {} + + +/// The request for Firestore.BatchGetDocuments. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents batch get projects](struct.ProjectDatabaseDocumentBatchGetCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchGetDocumentsRequest { + /// Starts a new transaction and reads the documents. + /// Defaults to a read-only transaction. + /// The new transaction ID will be returned as the first response in the + /// stream. + #[serde(rename="newTransaction")] + pub new_transaction: Option, + /// Reads documents in a transaction. + pub transaction: Option, + /// The fields to return. If not set, returns all fields. + /// + /// If a document has a field that is not present in this mask, that field will + /// not be returned in the response. + pub mask: Option, + /// The names of the documents to retrieve. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// The request will fail if any of the document is not a child resource of the + /// given `database`. Duplicate names will be elided. + pub documents: Option>, + /// Reads documents as they were at the given time. + /// This may not be older than 60 seconds. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl RequestValue for BatchGetDocumentsRequest {} + + /// The `Status` type defines a logical error model that is suitable for different /// programming environments, including REST APIs and RPC APIs. It is used by /// [gRPC](https://github.com/grpc). The error model is designed to be: @@ -446,73 +1562,368 @@ pub struct Status { impl Part for Status {} -/// The response message for Locations.ListLocations. +/// A specification of a set of documents to listen to. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Target { + /// A target specified by a set of document names. + pub documents: Option, + /// If the target should be removed once it is current and consistent. + pub once: Option, + /// A target specified by a query. + pub query: Option, + /// A resume token from a prior TargetChange for an identical target. + /// + /// Using a resume token with a different target is unsupported and may fail. + #[serde(rename="resumeToken")] + pub resume_token: Option, + /// A client provided target ID. + /// + /// If not set, the server will assign an ID for the target. + /// + /// Used for resuming a target without changing IDs. The IDs can either be + /// client-assigned or be server-assigned in a previous stream. All targets + /// with client provided IDs must be added before adding a target that needs + /// a server-assigned id. + #[serde(rename="targetId")] + pub target_id: Option, + /// Start listening after a specific `read_time`. + /// + /// The client must know the state of matching documents at this time. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl Part for Target {} + + +/// A filter that merges multiple other filters using the given operator. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompositeFilter { + /// The list of filters to combine. + /// Must contain at least one filter. + pub filters: Option>, + /// The operator for combining multiple filters. + pub op: Option, +} + +impl Part for CompositeFilter {} + + +/// A selection of a collection, such as `messages as m1`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CollectionSelector { + /// When false, selects only collections that are immediate children of + /// the `parent` specified in the containing `RunQueryRequest`. + /// When true, selects all descendant collections. + #[serde(rename="allDescendants")] + pub all_descendants: Option, + /// The collection ID. + /// When set, selects only collections with this ID. + #[serde(rename="collectionId")] + pub collection_id: Option, +} + +impl Part for CollectionSelector {} + + +/// A Firestore query. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StructuredQuery { + /// The order to apply to the query results. + /// + /// Firestore guarantees a stable ordering through the following rules: + /// + /// * Any field required to appear in `order_by`, that is not already + /// specified in `order_by`, is appended to the order in field name order + /// by default. + /// * If an order on `__name__` is not specified, it is appended by default. + /// + /// Fields are appended with the same sort direction as the last order + /// specified, or 'ASCENDING' if no order was specified. For example: + /// + /// * `SELECT * FROM Foo ORDER BY A` becomes + /// `SELECT * FROM Foo ORDER BY A, __name__` + /// * `SELECT * FROM Foo ORDER BY A DESC` becomes + /// `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC` + /// * `SELECT * FROM Foo WHERE A > 1` becomes + /// `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__` + #[serde(rename="orderBy")] + pub order_by: Option>, + /// A starting point for the query results. + #[serde(rename="startAt")] + pub start_at: Option, + /// A end point for the query results. + #[serde(rename="endAt")] + pub end_at: Option, + /// The maximum number of results to return. + /// + /// Applies after all other constraints. + /// Must be >= 0 if specified. + pub limit: Option, + /// The number of results to skip. + /// + /// Applies before limit, but after all other constraints. Must be >= 0 if + /// specified. + pub offset: Option, + /// The collections to query. + pub from: Option>, + /// The filter to apply. + #[serde(rename="where")] + pub where_: Option, + /// The projection to return. + pub select: Option, +} + +impl Part for StructuredQuery {} + + +/// Represents a single field in the database. +/// +/// Fields are grouped by their "Collection Group", which represent all +/// collections in the database with the same id. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations list projects](struct.ProjectLocationListCall.html) (response) +/// * [databases collection groups fields get projects](struct.ProjectDatabaseCollectionGroupFieldGetCall.html) (response) +/// * [databases collection groups fields patch projects](struct.ProjectDatabaseCollectionGroupFieldPatchCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListLocationsResponse { - /// The standard List next-page token. +pub struct GoogleFirestoreAdminV1Field { + /// The index configuration for this field. If unset, field indexing will + /// revert to the configuration defined by the `ancestor_field`. To + /// explicitly remove all indexes for this field, specify an index config + /// with an empty list of indexes. + #[serde(rename="indexConfig")] + pub index_config: Option, + /// A field name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}` + /// + /// A field path may be a simple field name, e.g. `address` or a path to fields + /// within map_value , e.g. `address.city`, + /// or a special field path. The only valid special field is `*`, which + /// represents any field. + /// + /// Field paths may be quoted using ` (backtick). The only character that needs + /// to be escaped within a quoted field path is the backtick character itself, + /// escaped using a backslash. Special characters in field paths that + /// must be quoted include: `*`, `.`, + /// ``` (backtick), `[`, `]`, as well as any ascii symbolic characters. + /// + /// Examples: + /// (Note: Comments here are written in markdown syntax, so there is an + /// additional layer of backticks to represent a code block) + /// `\`address.city\`` represents a field named `address.city`, not the map key + /// `city` in the field `address`. + /// `\`*\`` represents a field named `*`, not any field. + /// + /// A special `Field` contains the default indexing settings for all fields. + /// This field's resource name is: + /// `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*` + /// Indexes defined on this `Field` will be applied to all fields which do not + /// have their own `Field` index configuration. + pub name: Option, +} + +impl RequestValue for GoogleFirestoreAdminV1Field {} +impl ResponseResult for GoogleFirestoreAdminV1Field {} + + +/// The request for Firestore.RunQuery. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents run query projects](struct.ProjectDatabaseDocumentRunQueryCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RunQueryRequest { + /// Starts a new transaction and reads the documents. + /// Defaults to a read-only transaction. + /// The new transaction ID will be returned as the first response in the + /// stream. + #[serde(rename="newTransaction")] + pub new_transaction: Option, + /// Reads documents in a transaction. + pub transaction: Option, + /// A structured query. + #[serde(rename="structuredQuery")] + pub structured_query: Option, + /// Reads documents as they were at the given time. + /// This may not be older than 60 seconds. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl RequestValue for RunQueryRequest {} + + +/// An order on a field. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Order { + /// The field to order by. + pub field: Option, + /// The direction to order by. Defaults to `ASCENDING`. + pub direction: Option, +} + +impl Part for Order {} + + +/// Targets being watched have changed. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetChange { + /// The type of change that occurred. + #[serde(rename="targetChangeType")] + pub target_change_type: Option, + /// A token that can be used to resume the stream for the given `target_ids`, + /// or all targets if `target_ids` is empty. + /// + /// Not set on every target change. + #[serde(rename="resumeToken")] + pub resume_token: Option, + /// The error that resulted in this change, if applicable. + pub cause: Option, + /// The target IDs of targets that have changed. + /// + /// If empty, the change applies to all targets. + /// + /// For `target_change_type=ADD`, the order of the target IDs matches the order + /// of the requests to add the targets. This allows clients to unambiguously + /// associate server-assigned target IDs with added targets. + /// + /// For other states, the order of the target IDs is not defined. + #[serde(rename="targetIds")] + pub target_ids: Option>, + /// The consistent `read_time` for the given `target_ids` (omitted when the + /// target_ids are not at a consistent snapshot). + /// + /// The stream is guaranteed to send a `read_time` with `target_ids` empty + /// whenever the entire stream reaches a new consistent snapshot. ADD, + /// CURRENT, and RESET messages are guaranteed to (eventually) result in a + /// new consistent snapshot (while NO_CHANGE and REMOVE messages are not). + /// + /// For a given stream, `read_time` is guaranteed to be monotonically + /// increasing. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl Part for TargetChange {} + + +/// The request for FirestoreAdmin.ImportDocuments. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases import documents projects](struct.ProjectDatabaseImportDocumentCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFirestoreAdminV1ImportDocumentsRequest { + /// Location of the exported files. + /// This must match the output_uri_prefix of an ExportDocumentsResponse from + /// an export that has completed successfully. + /// See: + /// google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix. + #[serde(rename="inputUriPrefix")] + pub input_uri_prefix: Option, + /// Which collection ids to import. Unspecified means all collections included + /// in the import. + #[serde(rename="collectionIds")] + pub collection_ids: Option>, +} + +impl RequestValue for GoogleFirestoreAdminV1ImportDocumentsRequest {} + + +/// The response for FirestoreAdmin.ListFields. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases collection groups fields list projects](struct.ProjectDatabaseCollectionGroupFieldListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFirestoreAdminV1ListFieldsResponse { + /// A page token that may be used to request another page of results. If blank, + /// this is the last page. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// A list of locations that matches the specified filter in the request. - pub locations: Option>, + /// The requested fields. + pub fields: Option>, } -impl ResponseResult for ListLocationsResponse {} +impl ResponseResult for GoogleFirestoreAdminV1ListFieldsResponse {} -/// A resource that represents Google Cloud Platform location. +/// The request for Firestore.Commit. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) +/// * [databases documents commit projects](struct.ProjectDatabaseDocumentCommitCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Location { - /// The canonical id for this location. For example: `"us-east1"`. - #[serde(rename="locationId")] - pub location_id: Option, - /// Cross-service attributes for the location. For example +pub struct CommitRequest { + /// The writes to apply. /// - /// {"cloud.googleapis.com/region": "us-east1"} - pub labels: Option>, - /// The friendly name for this location, typically a nearby city name. - /// For example, "Tokyo". - #[serde(rename="displayName")] - pub display_name: Option, - /// Resource name for the location, which may vary between implementations. - /// For example: `"projects/example-project/locations/us-east1"` - pub name: Option, - /// Service-specific metadata. For example the available capacity at the given - /// location. - pub metadata: Option>, + /// Always executed atomically and in order. + pub writes: Option>, + /// If set, applies all writes in this transaction, and commits it. + pub transaction: Option, } -impl ResponseResult for Location {} +impl RequestValue for CommitRequest {} -/// The request message for Operations.CancelOperation. +/// The response for Firestore.ListDocuments. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [databases operations cancel projects](struct.ProjectDatabaseOperationCancelCall.html) (request) +/// * [databases documents list projects](struct.ProjectDatabaseDocumentListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleLongrunningCancelOperationRequest { _never_set: Option } +pub struct ListDocumentsResponse { + /// The next page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The Documents found. + pub documents: Option>, +} -impl RequestValue for GoogleLongrunningCancelOperationRequest {} +impl ResponseResult for ListDocumentsResponse {} /// This resource represents a long-running operation that is the result of a @@ -523,7 +1934,11 @@ impl RequestValue for GoogleLongrunningCancelOperationRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// +/// * [databases import documents projects](struct.ProjectDatabaseImportDocumentCall.html) (response) /// * [databases operations get projects](struct.ProjectDatabaseOperationGetCall.html) (response) +/// * [databases export documents projects](struct.ProjectDatabaseExportDocumentCall.html) (response) +/// * [databases collection groups fields patch projects](struct.ProjectDatabaseCollectionGroupFieldPatchCall.html) (response) +/// * [databases collection groups indexes create projects](struct.ProjectDatabaseCollectionGroupIndexeCreateCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleLongrunningOperation { @@ -556,6 +1971,179 @@ pub struct GoogleLongrunningOperation { impl ResponseResult for GoogleLongrunningOperation {} +/// An object representing a latitude/longitude pair. This is expressed as a pair +/// of doubles representing degrees latitude and degrees longitude. Unless +/// specified otherwise, this must conform to the +///
WGS84 +/// standard. Values must be within normalized ranges. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LatLng { + /// The latitude in degrees. It must be in the range [-90.0, +90.0]. + pub latitude: Option, + /// The longitude in degrees. It must be in the range [-180.0, +180.0]. + pub longitude: Option, +} + +impl Part for LatLng {} + + +/// The index configuration for this field. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFirestoreAdminV1IndexConfig { + /// Output only. + /// When true, the `Field`'s index configuration is set from the + /// configuration specified by the `ancestor_field`. + /// When false, the `Field`'s index configuration is defined explicitly. + #[serde(rename="usesAncestorConfig")] + pub uses_ancestor_config: Option, + /// Output only. + /// Specifies the resource name of the `Field` from which this field's + /// index configuration is set (when `uses_ancestor_config` is true), + /// or from which it *would* be set if this field had no index configuration + /// (when `uses_ancestor_config` is false). + #[serde(rename="ancestorField")] + pub ancestor_field: Option, + /// The indexes supported for this field. + pub indexes: Option>, + /// Output only + /// When true, the `Field`'s index configuration is in the process of being + /// reverted. Once complete, the index config will transition to the same + /// state as the field specified by `ancestor_field`, at which point + /// `uses_ancestor_config` will be `true` and `reverting` will be `false`. + pub reverting: Option, +} + +impl Part for GoogleFirestoreAdminV1IndexConfig {} + + +/// The request for Firestore.BeginTransaction. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents begin transaction projects](struct.ProjectDatabaseDocumentBeginTransactionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BeginTransactionRequest { + /// The options for the transaction. + /// Defaults to a read-write transaction. + pub options: Option, +} + +impl RequestValue for BeginTransactionRequest {} + + +/// A Document has been deleted. +/// +/// May be the result of multiple writes, including updates, the +/// last of which deleted the Document. +/// +/// Multiple DocumentDelete messages may be returned for the same logical +/// delete, if multiple targets are affected. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DocumentDelete { + /// The resource name of the Document that was deleted. + pub document: Option, + /// A set of target IDs for targets that previously matched this entity. + #[serde(rename="removedTargetIds")] + pub removed_target_ids: Option>, + /// The read timestamp at which the delete was observed. + /// + /// Greater or equal to the `commit_time` of the delete. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl Part for DocumentDelete {} + + +/// A target specified by a query. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryTarget { + /// A structured query. + #[serde(rename="structuredQuery")] + pub structured_query: Option, + /// The parent resource name. In the format: + /// `projects/{project_id}/databases/{database_id}/documents` or + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// For example: + /// `projects/my-project/databases/my-database/documents` or + /// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + pub parent: Option, +} + +impl Part for QueryTarget {} + + +/// The request for Firestore.Write. +/// +/// The first request creates a stream, or resumes an existing one from a token. +/// +/// When creating a new stream, the server replies with a response containing +/// only an ID and a token, to use in the next request. +/// +/// When resuming a stream, the server first streams any responses later than the +/// given token, then a response containing only an up-to-date token, to use in +/// the next request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents write projects](struct.ProjectDatabaseDocumentWriteCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WriteRequest { + /// The writes to apply. + /// + /// Always executed atomically and in order. + /// This must be empty on the first request. + /// This may be empty on the last request. + /// This must not be empty on all other requests. + pub writes: Option>, + /// Labels associated with this write request. + pub labels: Option>, + /// A stream token that was previously sent by the server. + /// + /// The client should set this field to the token from the most recent + /// WriteResponse it has received. This acknowledges that the client has + /// received responses up to this token. After sending this token, earlier + /// tokens may not be used anymore. + /// + /// The server may close the stream if there are too many unacknowledged + /// responses. + /// + /// Leave this field unset when creating a new stream. To resume a stream at + /// a specific point, set this field and the `stream_id` field. + /// + /// Leave this field unset when creating a new stream. + #[serde(rename="streamToken")] + pub stream_token: Option, + /// The ID of the write stream to resume. + /// This may only be set in the first message. When left empty, a new write + /// stream will be created. + #[serde(rename="streamId")] + pub stream_id: Option, +} + +impl RequestValue for WriteRequest {} + + /// The response message for Operations.ListOperations. /// /// # Activities @@ -577,30 +2165,6 @@ pub struct GoogleLongrunningListOperationsResponse { impl ResponseResult for GoogleLongrunningListOperationsResponse {} -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [databases operations cancel projects](struct.ProjectDatabaseOperationCancelCall.html) (response) -/// * [databases operations delete projects](struct.ProjectDatabaseOperationDeleteCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - // ################### // MethodBuilders ### @@ -630,7 +2194,7 @@ impl ResponseResult for Empty {} /// ::default(), None); /// let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `databases_operations_cancel(...)`, `databases_operations_delete(...)`, `databases_operations_get(...)`, `databases_operations_list(...)`, `locations_get(...)` and `locations_list(...)` +/// // like `databases_collection_groups_fields_get(...)`, `databases_collection_groups_fields_list(...)`, `databases_collection_groups_fields_patch(...)`, `databases_collection_groups_indexes_create(...)`, `databases_collection_groups_indexes_delete(...)`, `databases_collection_groups_indexes_get(...)`, `databases_collection_groups_indexes_list(...)`, `databases_documents_batch_get(...)`, `databases_documents_begin_transaction(...)`, `databases_documents_commit(...)`, `databases_documents_create_document(...)`, `databases_documents_delete(...)`, `databases_documents_get(...)`, `databases_documents_list(...)`, `databases_documents_list_collection_ids(...)`, `databases_documents_listen(...)`, `databases_documents_patch(...)`, `databases_documents_rollback(...)`, `databases_documents_run_query(...)`, `databases_documents_write(...)`, `databases_export_documents(...)`, `databases_import_documents(...)`, `databases_operations_cancel(...)`, `databases_operations_delete(...)`, `databases_operations_get(...)`, `databases_operations_list(...)`, `locations_get(...)` and `locations_list(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -645,6 +2209,101 @@ impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} impl<'a, C, A> ProjectMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Listens to changes. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `database` - The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + pub fn databases_documents_listen(&self, request: ListenRequest, database: &str) -> ProjectDatabaseDocumentListenCall<'a, C, A> { + ProjectDatabaseDocumentListenCall { + hub: self.hub, + _request: request, + _database: database.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Rolls back a transaction. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `database` - The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + pub fn databases_documents_rollback(&self, request: RollbackRequest, database: &str) -> ProjectDatabaseDocumentRollbackCall<'a, C, A> { + ProjectDatabaseDocumentRollbackCall { + hub: self.hub, + _request: request, + _database: database.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Commits a transaction, while optionally updating documents. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `database` - The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + pub fn databases_documents_commit(&self, request: CommitRequest, database: &str) -> ProjectDatabaseDocumentCommitCall<'a, C, A> { + ProjectDatabaseDocumentCommitCall { + hub: self.hub, + _request: request, + _database: database.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a location. + /// + /// # Arguments + /// + /// * `name` - Resource name for the location. + pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C, A> { + ProjectLocationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a composite index. + /// + /// # Arguments + /// + /// * `name` - A name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + pub fn databases_collection_groups_indexes_get(&self, name: &str) -> ProjectDatabaseCollectionGroupIndexeGetCall<'a, C, A> { + ProjectDatabaseCollectionGroupIndexeGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Lists information about the supported locations for this service. @@ -693,6 +2352,228 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets a single document. + /// + /// # Arguments + /// + /// * `name` - The resource name of the Document to get. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + pub fn databases_documents_get(&self, name: &str) -> ProjectDatabaseDocumentGetCall<'a, C, A> { + ProjectDatabaseDocumentGetCall { + hub: self.hub, + _name: name.to_string(), + _transaction: Default::default(), + _read_time: Default::default(), + _mask_field_paths: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Runs a query. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The parent resource name. In the format: + /// `projects/{project_id}/databases/{database_id}/documents` or + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// For example: + /// `projects/my-project/databases/my-database/documents` or + /// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + pub fn databases_documents_run_query(&self, request: RunQueryRequest, parent: &str) -> ProjectDatabaseDocumentRunQueryCall<'a, C, A> { + ProjectDatabaseDocumentRunQueryCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets multiple documents. + /// + /// Documents returned by this method are not guaranteed to be returned in the + /// same order that they were requested. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `database` - The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + pub fn databases_documents_batch_get(&self, request: BatchGetDocumentsRequest, database: &str) -> ProjectDatabaseDocumentBatchGetCall<'a, C, A> { + ProjectDatabaseDocumentBatchGetCall { + hub: self.hub, + _request: request, + _database: database.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Starts a new transaction. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `database` - The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + pub fn databases_documents_begin_transaction(&self, request: BeginTransactionRequest, database: &str) -> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> { + ProjectDatabaseDocumentBeginTransactionCall { + hub: self.hub, + _request: request, + _database: database.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all the collection IDs underneath a document. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The parent document. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// For example: + /// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + pub fn databases_documents_list_collection_ids(&self, request: ListCollectionIdsRequest, parent: &str) -> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> { + ProjectDatabaseDocumentListCollectionIdCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a field configuration. Currently, field updates apply only to + /// single field index configuration. However, calls to + /// FirestoreAdmin.UpdateField should provide a field mask to avoid + /// changing any configuration that the caller isn't aware of. The field mask + /// should be specified as: `{ paths: "index_config" }`. + /// + /// This call returns a google.longrunning.Operation which may be used to + /// track the status of the field update. The metadata for + /// the operation will be the type FieldOperationMetadata. + /// + /// To configure the default field settings for the database, use + /// the special `Field` with resource name: + /// `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - A field name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}` + /// A field path may be a simple field name, e.g. `address` or a path to fields + /// within map_value , e.g. `address.city`, + /// or a special field path. The only valid special field is `*`, which + /// represents any field. + /// Field paths may be quoted using ` (backtick). The only character that needs + /// to be escaped within a quoted field path is the backtick character itself, + /// escaped using a backslash. Special characters in field paths that + /// must be quoted include: `*`, `.`, + /// ``` (backtick), `[`, `]`, as well as any ascii symbolic characters. + /// Examples: + /// (Note: Comments here are written in markdown syntax, so there is an + /// additional layer of backticks to represent a code block) + /// `\`address.city\`` represents a field named `address.city`, not the map key + /// `city` in the field `address`. + /// `\`*\`` represents a field named `*`, not any field. + /// A special `Field` contains the default indexing settings for all fields. + /// This field's resource name is: + /// `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*` + /// Indexes defined on this `Field` will be applied to all fields which do not + /// have their own `Field` index configuration. + pub fn databases_collection_groups_fields_patch(&self, request: GoogleFirestoreAdminV1Field, name: &str) -> ProjectDatabaseCollectionGroupFieldPatchCall<'a, C, A> { + ProjectDatabaseCollectionGroupFieldPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists composite indexes. + /// + /// # Arguments + /// + /// * `parent` - A parent name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + pub fn databases_collection_groups_indexes_list(&self, parent: &str) -> ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> { + ProjectDatabaseCollectionGroupIndexeListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a document. + /// + /// # Arguments + /// + /// * `name` - The resource name of the Document to delete. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + pub fn databases_documents_delete(&self, name: &str) -> ProjectDatabaseDocumentDeleteCall<'a, C, A> { + ProjectDatabaseDocumentDeleteCall { + hub: self.hub, + _name: name.to_string(), + _current_document_update_time: Default::default(), + _current_document_exists: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the metadata and configuration for a Field. + /// + /// # Arguments + /// + /// * `name` - A name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}` + pub fn databases_collection_groups_fields_get(&self, name: &str) -> ProjectDatabaseCollectionGroupFieldGetCall<'a, C, A> { + ProjectDatabaseCollectionGroupFieldGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Deletes a long-running operation. This method indicates that the client is @@ -713,6 +2594,48 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Imports documents into Google Cloud Firestore. Existing documents with the + /// same name are overwritten. The import occurs in the background and its + /// progress can be monitored and managed via the Operation resource that is + /// created. If an ImportDocuments operation is cancelled, it is possible + /// that a subset of the data has already been imported to Cloud Firestore. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Database to import into. Should be of the form: + /// `projects/{project_id}/databases/{database_id}`. + pub fn databases_import_documents(&self, request: GoogleFirestoreAdminV1ImportDocumentsRequest, name: &str) -> ProjectDatabaseImportDocumentCall<'a, C, A> { + ProjectDatabaseImportDocumentCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a composite index. + /// + /// # Arguments + /// + /// * `name` - A name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + pub fn databases_collection_groups_indexes_delete(&self, name: &str) -> ProjectDatabaseCollectionGroupIndexeDeleteCall<'a, C, A> { + ProjectDatabaseCollectionGroupIndexeDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Gets the latest state of a long-running operation. Clients can use this @@ -734,14 +2657,24 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets information about a location. + /// Exports a copy of all or a subset of documents from Google Cloud Firestore + /// to another storage system, such as Google Cloud Storage. Recent updates to + /// documents may not be reflected in the export. The export occurs in the + /// background and its progress can be monitored and managed via the + /// Operation resource that is created. The output of an export may only be + /// used once the associated operation is done. If an export operation is + /// cancelled before completion it may leave partial data behind in Google + /// Cloud Storage. /// /// # Arguments /// - /// * `name` - Resource name for the location. - pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C, A> { - ProjectLocationGetCall { + /// * `request` - No description provided. + /// * `name` - Database to export. Should be of the form: + /// `projects/{project_id}/databases/{database_id}`. + pub fn databases_export_documents(&self, request: GoogleFirestoreAdminV1ExportDocumentsRequest, name: &str) -> ProjectDatabaseExportDocumentCall<'a, C, A> { + ProjectDatabaseExportDocumentCall { hub: self.hub, + _request: request, _name: name.to_string(), _delegate: Default::default(), _scopes: Default::default(), @@ -749,6 +2682,156 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Lists the field configuration and metadata for this database. + /// + /// Currently, FirestoreAdmin.ListFields only supports listing fields + /// that have been explicitly overridden. To issue this query, call + /// FirestoreAdmin.ListFields with the filter set to + /// `indexConfig.usesAncestorConfig:false`. + /// + /// # Arguments + /// + /// * `parent` - A parent name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + pub fn databases_collection_groups_fields_list(&self, parent: &str) -> ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> { + ProjectDatabaseCollectionGroupFieldListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a composite index. This returns a google.longrunning.Operation + /// which may be used to track the status of the creation. The metadata for + /// the operation will be the type IndexOperationMetadata. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - A parent name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + pub fn databases_collection_groups_indexes_create(&self, request: GoogleFirestoreAdminV1Index, parent: &str) -> ProjectDatabaseCollectionGroupIndexeCreateCall<'a, C, A> { + ProjectDatabaseCollectionGroupIndexeCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new document. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The parent resource. For example: + /// `projects/{project_id}/databases/{database_id}/documents` or + /// `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}` + /// * `collectionId` - The collection ID, relative to `parent`, to list. For example: `chatrooms`. + pub fn databases_documents_create_document(&self, request: Document, parent: &str, collection_id: &str) -> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> { + ProjectDatabaseDocumentCreateDocumentCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _collection_id: collection_id.to_string(), + _mask_field_paths: Default::default(), + _document_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists documents. + /// + /// # Arguments + /// + /// * `parent` - The parent resource name. In the format: + /// `projects/{project_id}/databases/{database_id}/documents` or + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// For example: + /// `projects/my-project/databases/my-database/documents` or + /// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + /// * `collectionId` - The collection ID, relative to `parent`, to list. For example: `chatrooms` + /// or `messages`. + pub fn databases_documents_list(&self, parent: &str, collection_id: &str) -> ProjectDatabaseDocumentListCall<'a, C, A> { + ProjectDatabaseDocumentListCall { + hub: self.hub, + _parent: parent.to_string(), + _collection_id: collection_id.to_string(), + _transaction: Default::default(), + _show_missing: Default::default(), + _read_time: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _order_by: Default::default(), + _mask_field_paths: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Streams batches of document updates and deletes, in order. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `database` - The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + /// This is only required in the first message. + pub fn databases_documents_write(&self, request: WriteRequest, database: &str) -> ProjectDatabaseDocumentWriteCall<'a, C, A> { + ProjectDatabaseDocumentWriteCall { + hub: self.hub, + _request: request, + _database: database.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates or inserts a document. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the document, for example + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + pub fn databases_documents_patch(&self, request: Document, name: &str) -> ProjectDatabaseDocumentPatchCall<'a, C, A> { + ProjectDatabaseDocumentPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask_field_paths: Default::default(), + _mask_field_paths: Default::default(), + _current_document_update_time: Default::default(), + _current_document_exists: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Lists operations that match the specified filter in the request. If the @@ -787,6 +2870,1343 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# +/// Listens to changes. +/// +/// A builder for the *databases.documents.listen* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::ListenRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ListenRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_listen(req, "database") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentListenCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: ListenRequest, + _database: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentListenCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentListenCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListenResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.listen", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("database", self._database.to_string())); + for &field in ["alt", "database"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+database}/documents:listen"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+database}", "database")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["database"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ListenRequest) -> ProjectDatabaseDocumentListenCall<'a, C, A> { + self._request = new_value; + self + } + /// The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + /// + /// Sets the *database* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn database(mut self, new_value: &str) -> ProjectDatabaseDocumentListenCall<'a, C, A> { + self._database = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentListenCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentListenCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentListenCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Rolls back a transaction. +/// +/// A builder for the *databases.documents.rollback* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::RollbackRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RollbackRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_rollback(req, "database") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentRollbackCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: RollbackRequest, + _database: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentRollbackCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentRollbackCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.rollback", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("database", self._database.to_string())); + for &field in ["alt", "database"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+database}/documents:rollback"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+database}", "database")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["database"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RollbackRequest) -> ProjectDatabaseDocumentRollbackCall<'a, C, A> { + self._request = new_value; + self + } + /// The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + /// + /// Sets the *database* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn database(mut self, new_value: &str) -> ProjectDatabaseDocumentRollbackCall<'a, C, A> { + self._database = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentRollbackCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentRollbackCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentRollbackCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Commits a transaction, while optionally updating documents. +/// +/// A builder for the *databases.documents.commit* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::CommitRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CommitRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_commit(req, "database") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentCommitCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: CommitRequest, + _database: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentCommitCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentCommitCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CommitResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.commit", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("database", self._database.to_string())); + for &field in ["alt", "database"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+database}/documents:commit"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+database}", "database")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["database"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CommitRequest) -> ProjectDatabaseDocumentCommitCall<'a, C, A> { + self._request = new_value; + self + } + /// The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + /// + /// Sets the *database* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn database(mut self, new_value: &str) -> ProjectDatabaseDocumentCommitCall<'a, C, A> { + self._database = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentCommitCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentCommitCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentCommitCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information about a location. +/// +/// A builder for the *locations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.locations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name for the location. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a composite index. +/// +/// A builder for the *databases.collectionGroups.indexes.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_collection_groups_indexes_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseCollectionGroupIndexeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseCollectionGroupIndexeGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseCollectionGroupIndexeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleFirestoreAdminV1Index)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.collectionGroups.indexes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// A name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupIndexeGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseCollectionGroupIndexeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseCollectionGroupIndexeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseCollectionGroupIndexeGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Lists information about the supported locations for this service. /// /// A builder for the *locations.list* method supported by a *project* resource. @@ -815,9 +4235,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().locations_list("name") -/// .page_token("et") -/// .page_size(-18) -/// .filter("kasd") +/// .page_token("labore") +/// .page_size(-9) +/// .filter("nonumy") /// .doit(); /// # } /// ``` @@ -888,7 +4308,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -927,7 +4344,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C, A> @@ -1176,7 +4593,7 @@ impl<'a, C, A> ProjectDatabaseOperationCancelCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1227,7 +4641,7 @@ impl<'a, C, A> ProjectDatabaseOperationCancelCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationCancelCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationCancelCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDatabaseOperationCancelCall<'a, C, A> @@ -1365,6 +4779,2565 @@ impl<'a, C, A> ProjectDatabaseOperationCancelCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_get("name") +/// .transaction("sadipscing") +/// .read_time("aliquyam") +/// .add_mask_field_paths("ea") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _name: String, + _transaction: Option, + _read_time: Option, + _mask_field_paths: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Document)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._transaction { + params.push(("transaction", value.to_string())); + } + if let Some(value) = self._read_time { + params.push(("readTime", value.to_string())); + } + if self._mask_field_paths.len() > 0 { + for f in self._mask_field_paths.iter() { + params.push(("mask.fieldPaths", f.to_string())); + } + } + for &field in ["alt", "name", "transaction", "readTime", "mask.fieldPaths"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the Document to get. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectDatabaseDocumentGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Reads the document in a transaction. + /// + /// Sets the *transaction* query property to the given value. + pub fn transaction(mut self, new_value: &str) -> ProjectDatabaseDocumentGetCall<'a, C, A> { + self._transaction = Some(new_value.to_string()); + self + } + /// Reads the version of the document at the given time. + /// This may not be older than 60 seconds. + /// + /// Sets the *read time* query property to the given value. + pub fn read_time(mut self, new_value: &str) -> ProjectDatabaseDocumentGetCall<'a, C, A> { + self._read_time = Some(new_value.to_string()); + self + } + /// The list of field paths in the mask. See Document.fields for a field + /// path syntax reference. + /// + /// Append the given value to the *mask.field paths* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_mask_field_paths(mut self, new_value: &str) -> ProjectDatabaseDocumentGetCall<'a, C, A> { + self._mask_field_paths.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Runs a query. +/// +/// A builder for the *databases.documents.runQuery* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::RunQueryRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RunQueryRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_run_query(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentRunQueryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: RunQueryRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentRunQueryCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentRunQueryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RunQueryResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.runQuery", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}:runQuery"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RunQueryRequest) -> ProjectDatabaseDocumentRunQueryCall<'a, C, A> { + self._request = new_value; + self + } + /// The parent resource name. In the format: + /// `projects/{project_id}/databases/{database_id}/documents` or + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// For example: + /// `projects/my-project/databases/my-database/documents` or + /// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectDatabaseDocumentRunQueryCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentRunQueryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentRunQueryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentRunQueryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets multiple documents. +/// +/// Documents returned by this method are not guaranteed to be returned in the +/// same order that they were requested. +/// +/// A builder for the *databases.documents.batchGet* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::BatchGetDocumentsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BatchGetDocumentsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_batch_get(req, "database") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentBatchGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: BatchGetDocumentsRequest, + _database: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentBatchGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentBatchGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BatchGetDocumentsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.batchGet", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("database", self._database.to_string())); + for &field in ["alt", "database"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+database}/documents:batchGet"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+database}", "database")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["database"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BatchGetDocumentsRequest) -> ProjectDatabaseDocumentBatchGetCall<'a, C, A> { + self._request = new_value; + self + } + /// The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + /// + /// Sets the *database* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn database(mut self, new_value: &str) -> ProjectDatabaseDocumentBatchGetCall<'a, C, A> { + self._database = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentBatchGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentBatchGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentBatchGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Starts a new transaction. +/// +/// A builder for the *databases.documents.beginTransaction* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::BeginTransactionRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BeginTransactionRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_begin_transaction(req, "database") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: BeginTransactionRequest, + _database: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BeginTransactionResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.beginTransaction", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("database", self._database.to_string())); + for &field in ["alt", "database"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+database}/documents:beginTransaction"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+database}", "database")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["database"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BeginTransactionRequest) -> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> { + self._request = new_value; + self + } + /// The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + /// + /// Sets the *database* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn database(mut self, new_value: &str) -> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> { + self._database = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all the collection IDs underneath a document. +/// +/// A builder for the *databases.documents.listCollectionIds* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::ListCollectionIdsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ListCollectionIdsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_list_collection_ids(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: ListCollectionIdsRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListCollectionIdsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.listCollectionIds", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}:listCollectionIds"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ListCollectionIdsRequest) -> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> { + self._request = new_value; + self + } + /// The parent document. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// For example: + /// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a field configuration. Currently, field updates apply only to +/// single field index configuration. However, calls to +/// FirestoreAdmin.UpdateField should provide a field mask to avoid +/// changing any configuration that the caller isn't aware of. The field mask +/// should be specified as: `{ paths: "index_config" }`. +/// +/// This call returns a google.longrunning.Operation which may be used to +/// track the status of the field update. The metadata for +/// the operation will be the type FieldOperationMetadata. +/// +/// To configure the default field settings for the database, use +/// the special `Field` with resource name: +/// `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. +/// +/// A builder for the *databases.collectionGroups.fields.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::GoogleFirestoreAdminV1Field; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleFirestoreAdminV1Field::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_collection_groups_fields_patch(req, "name") +/// .update_mask("diam") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseCollectionGroupFieldPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: GoogleFirestoreAdminV1Field, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseCollectionGroupFieldPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseCollectionGroupFieldPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.collectionGroups.fields.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleFirestoreAdminV1Field) -> ProjectDatabaseCollectionGroupFieldPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// A field name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}` + /// + /// A field path may be a simple field name, e.g. `address` or a path to fields + /// within map_value , e.g. `address.city`, + /// or a special field path. The only valid special field is `*`, which + /// represents any field. + /// + /// Field paths may be quoted using ` (backtick). The only character that needs + /// to be escaped within a quoted field path is the backtick character itself, + /// escaped using a backslash. Special characters in field paths that + /// must be quoted include: `*`, `.`, + /// ``` (backtick), `[`, `]`, as well as any ascii symbolic characters. + /// + /// Examples: + /// (Note: Comments here are written in markdown syntax, so there is an + /// additional layer of backticks to represent a code block) + /// `\`address.city\`` represents a field named `address.city`, not the map key + /// `city` in the field `address`. + /// `\`*\`` represents a field named `*`, not any field. + /// + /// A special `Field` contains the default indexing settings for all fields. + /// This field's resource name is: + /// `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*` + /// Indexes defined on this `Field` will be applied to all fields which do not + /// have their own `Field` index configuration. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupFieldPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// A mask, relative to the field. If specified, only configuration specified + /// by this field_mask will be updated in the field. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupFieldPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseCollectionGroupFieldPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseCollectionGroupFieldPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseCollectionGroupFieldPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists composite indexes. +/// +/// A builder for the *databases.collectionGroups.indexes.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_collection_groups_indexes_list("parent") +/// .page_token("Lorem") +/// .page_size(-21) +/// .filter("duo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleFirestoreAdminV1ListIndexesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.collectionGroups.indexes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/indexes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// A parent name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A page token, returned from a previous call to + /// FirestoreAdmin.ListIndexes, that may be used to get the next + /// page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The number of results to return. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The filter to apply to list results. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseCollectionGroupIndexeListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a document. +/// +/// A builder for the *databases.documents.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_delete("name") +/// .current_document_update_time("sea") +/// .current_document_exists(false) +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _name: String, + _current_document_update_time: Option, + _current_document_exists: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._current_document_update_time { + params.push(("currentDocument.updateTime", value.to_string())); + } + if let Some(value) = self._current_document_exists { + params.push(("currentDocument.exists", value.to_string())); + } + for &field in ["alt", "name", "currentDocument.updateTime", "currentDocument.exists"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the Document to delete. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectDatabaseDocumentDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// When set, the target document must exist and have been last updated at + /// that time. + /// + /// Sets the *current document.update time* query property to the given value. + pub fn current_document_update_time(mut self, new_value: &str) -> ProjectDatabaseDocumentDeleteCall<'a, C, A> { + self._current_document_update_time = Some(new_value.to_string()); + self + } + /// When set to `true`, the target document must exist. + /// When set to `false`, the target document must not exist. + /// + /// Sets the *current document.exists* query property to the given value. + pub fn current_document_exists(mut self, new_value: bool) -> ProjectDatabaseDocumentDeleteCall<'a, C, A> { + self._current_document_exists = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the metadata and configuration for a Field. +/// +/// A builder for the *databases.collectionGroups.fields.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_collection_groups_fields_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseCollectionGroupFieldGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseCollectionGroupFieldGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseCollectionGroupFieldGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleFirestoreAdminV1Field)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.collectionGroups.fields.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// A name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupFieldGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseCollectionGroupFieldGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseCollectionGroupFieldGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseCollectionGroupFieldGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Deletes a long-running operation. This method indicates that the client is /// no longer interested in the operation result. It does not cancel the /// operation. If the server doesn't support this method, it returns @@ -1454,7 +7427,7 @@ impl<'a, C, A> ProjectDatabaseOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1493,7 +7463,7 @@ impl<'a, C, A> ProjectDatabaseOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDatabaseOperationDeleteCall<'a, C, A> @@ -1619,6 +7589,539 @@ impl<'a, C, A> ProjectDatabaseOperationDeleteCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleFirestoreAdminV1ImportDocumentsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_import_documents(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseImportDocumentCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: GoogleFirestoreAdminV1ImportDocumentsRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseImportDocumentCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseImportDocumentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.importDocuments", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:importDocuments"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleFirestoreAdminV1ImportDocumentsRequest) -> ProjectDatabaseImportDocumentCall<'a, C, A> { + self._request = new_value; + self + } + /// Database to import into. Should be of the form: + /// `projects/{project_id}/databases/{database_id}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectDatabaseImportDocumentCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseImportDocumentCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseImportDocumentCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseImportDocumentCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a composite index. +/// +/// A builder for the *databases.collectionGroups.indexes.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_collection_groups_indexes_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseCollectionGroupIndexeDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseCollectionGroupIndexeDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseCollectionGroupIndexeDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.collectionGroups.indexes.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// A name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupIndexeDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseCollectionGroupIndexeDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseCollectionGroupIndexeDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseCollectionGroupIndexeDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Gets the latest state of a long-running operation. Clients can use this /// method to poll the operation result at intervals as recommended by the API /// service. @@ -1707,7 +8210,7 @@ impl<'a, C, A> ProjectDatabaseOperationGetCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1746,7 +8246,7 @@ impl<'a, C, A> ProjectDatabaseOperationGetCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationGetCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDatabaseOperationGetCall<'a, C, A> @@ -1872,9 +8372,301 @@ impl<'a, C, A> ProjectDatabaseOperationGetCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleFirestoreAdminV1ExportDocumentsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_export_documents(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseExportDocumentCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: GoogleFirestoreAdminV1ExportDocumentsRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseExportDocumentCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseExportDocumentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.exportDocuments", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:exportDocuments"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleFirestoreAdminV1ExportDocumentsRequest) -> ProjectDatabaseExportDocumentCall<'a, C, A> { + self._request = new_value; + self + } + /// Database to export. Should be of the form: + /// `projects/{project_id}/databases/{database_id}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectDatabaseExportDocumentCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseExportDocumentCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseExportDocumentCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseExportDocumentCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists the field configuration and metadata for this database. +/// +/// Currently, FirestoreAdmin.ListFields only supports listing fields +/// that have been explicitly overridden. To issue this query, call +/// FirestoreAdmin.ListFields with the filter set to +/// `indexConfig.usesAncestorConfig:false`. +/// +/// A builder for the *databases.collectionGroups.fields.list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -1899,27 +8691,33 @@ impl<'a, C, A> ProjectDatabaseOperationGetCall<'a, C, A> where C: BorrowMut +pub struct ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Firestore, - _name: String, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectLocationGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> {} -impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleFirestoreAdminV1ListFieldsResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -1928,11 +8726,20 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "firestore.projects.locations.get", + dlg.begin(MethodInfo { id: "firestore.projects.databases.collectionGroups.fields.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1944,12 +8751,12 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["name"].iter() { + for param_name in ["parent"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -1974,10 +8781,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1997,7 +8801,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> { - self._name = new_value.to_string(); + pub fn parent(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A page token, returned from a previous call to + /// FirestoreAdmin.ListFields, that may be used to get the next + /// page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The number of results to return. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The filter to apply to list results. Currently, + /// FirestoreAdmin.ListFields only supports listing fields + /// that have been explicitly overridden. To issue this query, call + /// FirestoreAdmin.ListFields with the filter set to + /// `indexConfig.usesAncestorConfig:false`. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -2066,7 +8898,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -2075,7 +8907,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -2111,7 +8943,1592 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLocationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseCollectionGroupFieldListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a composite index. This returns a google.longrunning.Operation +/// which may be used to track the status of the creation. The metadata for +/// the operation will be the type IndexOperationMetadata. +/// +/// A builder for the *databases.collectionGroups.indexes.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::GoogleFirestoreAdminV1Index; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GoogleFirestoreAdminV1Index::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_collection_groups_indexes_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseCollectionGroupIndexeCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: GoogleFirestoreAdminV1Index, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseCollectionGroupIndexeCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseCollectionGroupIndexeCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.collectionGroups.indexes.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/indexes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GoogleFirestoreAdminV1Index) -> ProjectDatabaseCollectionGroupIndexeCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// A parent name of the form + /// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectDatabaseCollectionGroupIndexeCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseCollectionGroupIndexeCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseCollectionGroupIndexeCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseCollectionGroupIndexeCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new document. +/// +/// A builder for the *databases.documents.createDocument* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::Document; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Document::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_create_document(req, "parent", "collectionId") +/// .add_mask_field_paths("accusam") +/// .document_id("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: Document, + _parent: String, + _collection_id: String, + _mask_field_paths: Vec, + _document_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Document)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.createDocument", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("collectionId", self._collection_id.to_string())); + if self._mask_field_paths.len() > 0 { + for f in self._mask_field_paths.iter() { + params.push(("mask.fieldPaths", f.to_string())); + } + } + if let Some(value) = self._document_id { + params.push(("documentId", value.to_string())); + } + for &field in ["alt", "parent", "collectionId", "mask.fieldPaths", "documentId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/{collectionId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{collectionId}", "collectionId")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["collectionId", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Document) -> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> { + self._request = new_value; + self + } + /// The parent resource. For example: + /// `projects/{project_id}/databases/{database_id}/documents` or + /// `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The collection ID, relative to `parent`, to list. For example: `chatrooms`. + /// + /// Sets the *collection id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn collection_id(mut self, new_value: &str) -> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> { + self._collection_id = new_value.to_string(); + self + } + /// The list of field paths in the mask. See Document.fields for a field + /// path syntax reference. + /// + /// Append the given value to the *mask.field paths* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_mask_field_paths(mut self, new_value: &str) -> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> { + self._mask_field_paths.push(new_value.to_string()); + self + } + /// The client-assigned document ID to use for this document. + /// + /// Optional. If not specified, an ID will be assigned by the service. + /// + /// Sets the *document id* query property to the given value. + pub fn document_id(mut self, new_value: &str) -> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> { + self._document_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists documents. +/// +/// A builder for the *databases.documents.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_list("parent", "collectionId") +/// .transaction("duo") +/// .show_missing(true) +/// .read_time("eirmod") +/// .page_token("sanctus") +/// .page_size(-22) +/// .order_by("amet") +/// .add_mask_field_paths("et") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _parent: String, + _collection_id: String, + _transaction: Option, + _show_missing: Option, + _read_time: Option, + _page_token: Option, + _page_size: Option, + _order_by: Option, + _mask_field_paths: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentListCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListDocumentsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(11 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("collectionId", self._collection_id.to_string())); + if let Some(value) = self._transaction { + params.push(("transaction", value.to_string())); + } + if let Some(value) = self._show_missing { + params.push(("showMissing", value.to_string())); + } + if let Some(value) = self._read_time { + params.push(("readTime", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if self._mask_field_paths.len() > 0 { + for f in self._mask_field_paths.iter() { + params.push(("mask.fieldPaths", f.to_string())); + } + } + for &field in ["alt", "parent", "collectionId", "transaction", "showMissing", "readTime", "pageToken", "pageSize", "orderBy", "mask.fieldPaths"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/{collectionId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{collectionId}", "collectionId")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["collectionId", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The parent resource name. In the format: + /// `projects/{project_id}/databases/{database_id}/documents` or + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// For example: + /// `projects/my-project/databases/my-database/documents` or + /// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectDatabaseDocumentListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The collection ID, relative to `parent`, to list. For example: `chatrooms` + /// or `messages`. + /// + /// Sets the *collection id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn collection_id(mut self, new_value: &str) -> ProjectDatabaseDocumentListCall<'a, C, A> { + self._collection_id = new_value.to_string(); + self + } + /// Reads documents in a transaction. + /// + /// Sets the *transaction* query property to the given value. + pub fn transaction(mut self, new_value: &str) -> ProjectDatabaseDocumentListCall<'a, C, A> { + self._transaction = Some(new_value.to_string()); + self + } + /// If the list should show missing documents. A missing document is a + /// document that does not exist but has sub-documents. These documents will + /// be returned with a key but will not have fields, Document.create_time, + /// or Document.update_time set. + /// + /// Requests with `show_missing` may not specify `where` or + /// `order_by`. + /// + /// Sets the *show missing* query property to the given value. + pub fn show_missing(mut self, new_value: bool) -> ProjectDatabaseDocumentListCall<'a, C, A> { + self._show_missing = Some(new_value); + self + } + /// Reads documents as they were at the given time. + /// This may not be older than 60 seconds. + /// + /// Sets the *read time* query property to the given value. + pub fn read_time(mut self, new_value: &str) -> ProjectDatabaseDocumentListCall<'a, C, A> { + self._read_time = Some(new_value.to_string()); + self + } + /// The `next_page_token` value returned from a previous List request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectDatabaseDocumentListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of documents to return. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectDatabaseDocumentListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The order to sort results by. For example: `priority desc, name`. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> ProjectDatabaseDocumentListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The list of field paths in the mask. See Document.fields for a field + /// path syntax reference. + /// + /// Append the given value to the *mask.field paths* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_mask_field_paths(mut self, new_value: &str) -> ProjectDatabaseDocumentListCall<'a, C, A> { + self._mask_field_paths.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Streams batches of document updates and deletes, in order. +/// +/// A builder for the *databases.documents.write* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::WriteRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = WriteRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_write(req, "database") +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentWriteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: WriteRequest, + _database: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentWriteCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentWriteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, WriteResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.write", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("database", self._database.to_string())); + for &field in ["alt", "database"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+database}/documents:write"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+database}", "database")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["database"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: WriteRequest) -> ProjectDatabaseDocumentWriteCall<'a, C, A> { + self._request = new_value; + self + } + /// The database name. In the format: + /// `projects/{project_id}/databases/{database_id}`. + /// This is only required in the first message. + /// + /// Sets the *database* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn database(mut self, new_value: &str) -> ProjectDatabaseDocumentWriteCall<'a, C, A> { + self._database = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentWriteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentWriteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentWriteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates or inserts a document. +/// +/// A builder for the *databases.documents.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_firestore1 as firestore1; +/// use firestore1::Document; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use firestore1::Firestore; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Firestore::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Document::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().databases_documents_patch(req, "name") +/// .add_update_mask_field_paths("ea") +/// .add_mask_field_paths("sed") +/// .current_document_update_time("dolor") +/// .current_document_exists(true) +/// .doit(); +/// # } +/// ``` +pub struct ProjectDatabaseDocumentPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Firestore, + _request: Document, + _name: String, + _update_mask_field_paths: Vec, + _mask_field_paths: Vec, + _current_document_update_time: Option, + _current_document_exists: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectDatabaseDocumentPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectDatabaseDocumentPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Document)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "firestore.projects.databases.documents.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if self._update_mask_field_paths.len() > 0 { + for f in self._update_mask_field_paths.iter() { + params.push(("updateMask.fieldPaths", f.to_string())); + } + } + if self._mask_field_paths.len() > 0 { + for f in self._mask_field_paths.iter() { + params.push(("mask.fieldPaths", f.to_string())); + } + } + if let Some(value) = self._current_document_update_time { + params.push(("currentDocument.updateTime", value.to_string())); + } + if let Some(value) = self._current_document_exists { + params.push(("currentDocument.exists", value.to_string())); + } + for &field in ["alt", "name", "updateMask.fieldPaths", "mask.fieldPaths", "currentDocument.updateTime", "currentDocument.exists"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Document) -> ProjectDatabaseDocumentPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the document, for example + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectDatabaseDocumentPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The list of field paths in the mask. See Document.fields for a field + /// path syntax reference. + /// + /// Append the given value to the *update mask.field paths* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_update_mask_field_paths(mut self, new_value: &str) -> ProjectDatabaseDocumentPatchCall<'a, C, A> { + self._update_mask_field_paths.push(new_value.to_string()); + self + } + /// The list of field paths in the mask. See Document.fields for a field + /// path syntax reference. + /// + /// Append the given value to the *mask.field paths* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_mask_field_paths(mut self, new_value: &str) -> ProjectDatabaseDocumentPatchCall<'a, C, A> { + self._mask_field_paths.push(new_value.to_string()); + self + } + /// When set, the target document must exist and have been last updated at + /// that time. + /// + /// Sets the *current document.update time* query property to the given value. + pub fn current_document_update_time(mut self, new_value: &str) -> ProjectDatabaseDocumentPatchCall<'a, C, A> { + self._current_document_update_time = Some(new_value.to_string()); + self + } + /// When set to `true`, the target document must exist. + /// When set to `false`, the target document must not exist. + /// + /// Sets the *current document.exists* query property to the given value. + pub fn current_document_exists(mut self, new_value: bool) -> ProjectDatabaseDocumentPatchCall<'a, C, A> { + self._current_document_exists = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectDatabaseDocumentPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectDatabaseDocumentPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectDatabaseDocumentPatchCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -2160,9 +10577,9 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationListCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2272,7 +10686,7 @@ impl<'a, C, A> ProjectDatabaseOperationListCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationListCall<'a, C, A> where C: BorrowMut ProjectDatabaseOperationListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectDatabaseOperationListCall<'a, C, A> diff --git a/gen/firestore1_beta1-cli/Cargo.toml b/gen/firestore1_beta1-cli/Cargo.toml index e63c66b2a0..59203ff4cf 100644 --- a/gen/firestore1_beta1-cli/Cargo.toml +++ b/gen/firestore1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-firestore1_beta1-cli" -version = "1.0.8+20181001" +version = "1.0.8+20190105" authors = ["Sebastian Thiel "] description = "A complete library to interact with Firestore (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firestore1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-firestore1_beta1] path = "../firestore1_beta1" -version = "1.0.8+20181001" +version = "1.0.8+20190105" diff --git a/gen/firestore1_beta1-cli/README.md b/gen/firestore1_beta1-cli/README.md index ad6bcbd17d..7e0882f95a 100644 --- a/gen/firestore1_beta1-cli/README.md +++ b/gen/firestore1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Firestore* API at revision *20181001*. The CLI is at version *1.0.8*. +This documentation was generated from the *Firestore* API at revision *20190105*. The CLI is at version *1.0.8*. ```bash firestore1-beta1 [options] diff --git a/gen/firestore1_beta1-cli/mkdocs.yml b/gen/firestore1_beta1-cli/mkdocs.yml index 35992223d9..ed74c56a57 100644 --- a/gen/firestore1_beta1-cli/mkdocs.yml +++ b/gen/firestore1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Firestore v1.0.8+20181001 +site_name: Firestore v1.0.8+20190105 site_url: http://byron.github.io/google-apis-rs/google-firestore1_beta1-cli site_description: A complete library to interact with Firestore (protocol v1beta1) diff --git a/gen/firestore1_beta1-cli/src/main.rs b/gen/firestore1_beta1-cli/src/main.rs index 337bda5d30..e03a60f279 100644 --- a/gen/firestore1_beta1-cli/src/main.rs +++ b/gen/firestore1_beta1-cli/src/main.rs @@ -705,12 +705,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "add-target.documents.documents" => Some(("addTarget.documents.documents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "add-target.resume-token" => Some(("addTarget.resumeToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "add-target.target-id" => Some(("addTarget.targetId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "add-target.query.structured-query.limit" => Some(("addTarget.query.structuredQuery.limit", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "add-target.query.structured-query.where.unary-filter.field.field-path" => Some(("addTarget.query.structuredQuery.where.unaryFilter.field.fieldPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "add-target.query.structured-query.where.unary-filter.op" => Some(("addTarget.query.structuredQuery.where.unaryFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.composite-filter.op" => Some(("addTarget.query.structuredQuery.where.compositeFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "add-target.query.structured-query.where.field-filter.field.field-path" => Some(("addTarget.query.structuredQuery.where.fieldFilter.field.fieldPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "add-target.query.structured-query.where.field-filter.value.bytes-value" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.bytesValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "add-target.query.structured-query.where.field-filter.value.timestamp-value" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.timestampValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -723,14 +723,14 @@ impl<'n> Engine<'n> { "add-target.query.structured-query.where.field-filter.value.geo-point-value.latitude" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.geoPointValue.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "add-target.query.structured-query.where.field-filter.value.geo-point-value.longitude" => Some(("addTarget.query.structuredQuery.where.fieldFilter.value.geoPointValue.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "add-target.query.structured-query.where.field-filter.op" => Some(("addTarget.query.structuredQuery.where.fieldFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "add-target.query.structured-query.where.composite-filter.op" => Some(("addTarget.query.structuredQuery.where.compositeFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.unary-filter.field.field-path" => Some(("addTarget.query.structuredQuery.where.unaryFilter.field.fieldPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "add-target.query.structured-query.where.unary-filter.op" => Some(("addTarget.query.structuredQuery.where.unaryFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "add-target.query.structured-query.start-at.before" => Some(("addTarget.query.structuredQuery.startAt.before", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "add-target.query.structured-query.end-at.before" => Some(("addTarget.query.structuredQuery.endAt.before", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "add-target.query.structured-query.offset" => Some(("addTarget.query.structuredQuery.offset", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "add-target.query.parent" => Some(("addTarget.query.parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "add-target.once" => Some(("addTarget.once", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "add-target.read-time" => Some(("addTarget.readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "remove-target" => Some(("removeTarget", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["add-target", "before", "boolean-value", "bytes-value", "composite-filter", "documents", "double-value", "end-at", "field", "field-filter", "field-path", "geo-point-value", "integer-value", "labels", "latitude", "limit", "longitude", "null-value", "offset", "once", "op", "parent", "query", "read-time", "reference-value", "remove-target", "resume-token", "start-at", "string-value", "structured-query", "target-id", "timestamp-value", "unary-filter", "value", "where"]); @@ -1005,8 +1005,7 @@ impl<'n> Engine<'n> { "new-transaction.read-only.read-time" => Some(("newTransaction.readOnly.readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transaction" => Some(("transaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "structured-query.limit" => Some(("structuredQuery.limit", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "structured-query.where.unary-filter.field.field-path" => Some(("structuredQuery.where.unaryFilter.field.fieldPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "structured-query.where.unary-filter.op" => Some(("structuredQuery.where.unaryFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.composite-filter.op" => Some(("structuredQuery.where.compositeFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "structured-query.where.field-filter.field.field-path" => Some(("structuredQuery.where.fieldFilter.field.fieldPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "structured-query.where.field-filter.value.bytes-value" => Some(("structuredQuery.where.fieldFilter.value.bytesValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "structured-query.where.field-filter.value.timestamp-value" => Some(("structuredQuery.where.fieldFilter.value.timestampValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1019,7 +1018,8 @@ impl<'n> Engine<'n> { "structured-query.where.field-filter.value.geo-point-value.latitude" => Some(("structuredQuery.where.fieldFilter.value.geoPointValue.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "structured-query.where.field-filter.value.geo-point-value.longitude" => Some(("structuredQuery.where.fieldFilter.value.geoPointValue.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "structured-query.where.field-filter.op" => Some(("structuredQuery.where.fieldFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "structured-query.where.composite-filter.op" => Some(("structuredQuery.where.compositeFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.unary-filter.field.field-path" => Some(("structuredQuery.where.unaryFilter.field.fieldPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "structured-query.where.unary-filter.op" => Some(("structuredQuery.where.unaryFilter.op", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "structured-query.start-at.before" => Some(("structuredQuery.startAt.before", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "structured-query.end-at.before" => Some(("structuredQuery.endAt.before", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "structured-query.offset" => Some(("structuredQuery.offset", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2325,7 +2325,7 @@ fn main() { let mut app = App::new("firestore1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181001") + .version("1.0.8+20190105") .about("Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_firestore1_beta1_cli") diff --git a/gen/firestore1_beta1/Cargo.toml b/gen/firestore1_beta1/Cargo.toml index fa40528524..2fedddc8cb 100644 --- a/gen/firestore1_beta1/Cargo.toml +++ b/gen/firestore1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-firestore1_beta1" -version = "1.0.8+20181001" +version = "1.0.8+20190105" authors = ["Sebastian Thiel "] description = "A complete library to interact with Firestore (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firestore1_beta1" homepage = "https://cloud.google.com/firestore" -documentation = "https://docs.rs/google-firestore1_beta1/1.0.8+20181001" +documentation = "https://docs.rs/google-firestore1_beta1/1.0.8+20190105" license = "MIT" keywords = ["firestore", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/firestore1_beta1/README.md b/gen/firestore1_beta1/README.md index 6a14a8a61e..80d53c3edb 100644 --- a/gen/firestore1_beta1/README.md +++ b/gen/firestore1_beta1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-firestore1_beta1` library allows access to all features of the *Google Firestore* service. -This documentation was generated from *Firestore* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *firestore:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Firestore* crate version *1.0.8+20190105*, where *20190105* is the exact revision of the *firestore:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Firestore* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/firestore). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.Firestore.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.Firestore.html) ... * projects - * [*databases documents batch get*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentBatchGetCall.html), [*databases documents begin transaction*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentBeginTransactionCall.html), [*databases documents commit*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentCommitCall.html), [*databases documents create document*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentCreateDocumentCall.html), [*databases documents delete*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentDeleteCall.html), [*databases documents get*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentGetCall.html), [*databases documents list*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentListCall.html), [*databases documents list collection ids*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentListCollectionIdCall.html), [*databases documents listen*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentListenCall.html), [*databases documents patch*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentPatchCall.html), [*databases documents rollback*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentRollbackCall.html), [*databases documents run query*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentRunQueryCall.html), [*databases documents write*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseDocumentWriteCall.html), [*databases export documents*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseExportDocumentCall.html), [*databases import documents*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseImportDocumentCall.html), [*databases indexes create*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseIndexeCreateCall.html), [*databases indexes delete*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseIndexeDeleteCall.html), [*databases indexes get*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseIndexeGetCall.html) and [*databases indexes list*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.ProjectDatabaseIndexeListCall.html) + * [*databases documents batch get*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentBatchGetCall.html), [*databases documents begin transaction*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentBeginTransactionCall.html), [*databases documents commit*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentCommitCall.html), [*databases documents create document*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentCreateDocumentCall.html), [*databases documents delete*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentDeleteCall.html), [*databases documents get*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentGetCall.html), [*databases documents list*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentListCall.html), [*databases documents list collection ids*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentListCollectionIdCall.html), [*databases documents listen*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentListenCall.html), [*databases documents patch*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentPatchCall.html), [*databases documents rollback*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentRollbackCall.html), [*databases documents run query*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentRunQueryCall.html), [*databases documents write*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseDocumentWriteCall.html), [*databases export documents*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseExportDocumentCall.html), [*databases import documents*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseImportDocumentCall.html), [*databases indexes create*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseIndexeCreateCall.html), [*databases indexes delete*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseIndexeDeleteCall.html), [*databases indexes get*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseIndexeGetCall.html) and [*databases indexes list*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.ProjectDatabaseIndexeListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/struct.Firestore.html)** +* **[Hub](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/struct.Firestore.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-firestore1_beta1/1.0.8+20181001/google_firestore1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-firestore1_beta1/1.0.8+20190105/google_firestore1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/firestore1_beta1/src/lib.rs b/gen/firestore1_beta1/src/lib.rs index 251a308bac..6f6b06a82a 100644 --- a/gen/firestore1_beta1/src/lib.rs +++ b/gen/firestore1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Firestore* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *firestore:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Firestore* crate version *1.0.8+20190105*, where *20190105* is the exact revision of the *firestore:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Firestore* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/firestore). @@ -412,9 +412,6 @@ pub struct ListenResponse { /// Returned when documents may have been removed from the given target, but /// the exact documents are unknown. pub filter: Option, - /// Targets have changed. - #[serde(rename="targetChange")] - pub target_change: Option, /// A Document has been deleted. #[serde(rename="documentDelete")] pub document_delete: Option, @@ -425,6 +422,9 @@ pub struct ListenResponse { /// relevant to that target). #[serde(rename="documentRemove")] pub document_remove: Option, + /// Targets have changed. + #[serde(rename="targetChange")] + pub target_change: Option, } impl ResponseResult for ListenResponse {} @@ -448,42 +448,41 @@ pub struct BeginTransactionResponse { impl ResponseResult for BeginTransactionResponse {} -/// A write on a document. +/// The response for Firestore.RunQuery. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents run query projects](struct.ProjectDatabaseDocumentRunQueryCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Write { - /// A document name to delete. In the format: - /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. - pub delete: Option, - /// An optional precondition on the document. +pub struct RunQueryResponse { + /// The number of results that have been skipped due to an offset between + /// the last response and the current response. + #[serde(rename="skippedResults")] + pub skipped_results: Option, + /// The transaction that was started as part of this request. + /// Can only be set in the first response, and only if + /// RunQueryRequest.new_transaction was set in the request. + /// If set, no other fields will be set in this response. + pub transaction: Option, + /// A query result. + /// Not set when reporting partial progress. + pub document: Option, + /// The time at which the document was read. This may be monotonically + /// increasing; in this case, the previous documents in the result stream are + /// guaranteed not to have changed between their `read_time` and this one. /// - /// The write will fail if this is set and not met by the target document. - #[serde(rename="currentDocument")] - pub current_document: Option, - /// A document to write. - pub update: Option, - /// Applies a tranformation to a document. - /// At most one `transform` per document is allowed in a given request. - /// An `update` cannot follow a `transform` on the same document in a given - /// request. - pub transform: Option, - /// The fields to update in this write. - /// - /// This field can be set only when the operation is `update`. - /// If the mask is not set for an `update` and the document exists, any - /// existing data will be overwritten. - /// If the mask is set and the document on the server has fields not covered by - /// the mask, they are left unchanged. - /// Fields referenced in the mask, but not present in the input document, are - /// deleted from the document on the server. - /// The field paths in this mask must not contain a reserved field name. - #[serde(rename="updateMask")] - pub update_mask: Option, + /// If the query returns no results, a response with `read_time` and no + /// `document` will be sent, and this represents the time at which the query + /// was run. + #[serde(rename="readTime")] + pub read_time: Option, } -impl Part for Write {} +impl ResponseResult for RunQueryResponse {} /// A filter on a specific field. @@ -593,25 +592,17 @@ impl RequestValue for Document {} impl ResponseResult for Document {} -/// The response for FirestoreAdmin.ListIndexes. +/// An array value. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [databases indexes list projects](struct.ProjectDatabaseIndexeListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleFirestoreAdminV1beta1ListIndexesResponse { - /// The standard List next-page token. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The indexes. - pub indexes: Option>, +pub struct ArrayValue { + /// Values in the array. + pub values: Option>, } -impl ResponseResult for GoogleFirestoreAdminV1beta1ListIndexesResponse {} +impl Part for ArrayValue {} /// The streamed response for Firestore.BatchGetDocuments. @@ -631,15 +622,15 @@ pub struct BatchGetDocumentsResponse { /// Will only be set in the first response, and only if /// BatchGetDocumentsRequest.new_transaction was set in the request. pub transaction: Option, + /// A document name that was requested but does not exist. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + pub missing: Option, /// The time at which the document was read. /// This may be monotically increasing, in this case the previous documents in /// the result stream are guaranteed not to have changed between their /// read_time and this one. #[serde(rename="readTime")] pub read_time: Option, - /// A document name that was requested but does not exist. In the format: - /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. - pub missing: Option, } impl ResponseResult for BatchGetDocumentsResponse {} @@ -727,11 +718,11 @@ impl Part for Status {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListenRequest { - /// Labels associated with this target change. - pub labels: Option>, /// A target to add to this stream. #[serde(rename="addTarget")] pub add_target: Option, + /// Labels associated with this target change. + pub labels: Option>, /// The ID of a target to remove from this stream. #[serde(rename="removeTarget")] pub remove_target: Option, @@ -740,35 +731,33 @@ pub struct ListenRequest { impl RequestValue for ListenRequest {} -/// The request for Firestore.RunQuery. +/// The request for FirestoreAdmin.ExportDocuments. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [databases documents run query projects](struct.ProjectDatabaseDocumentRunQueryCall.html) (request) +/// * [databases export documents projects](struct.ProjectDatabaseExportDocumentCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RunQueryRequest { - /// Starts a new transaction and reads the documents. - /// Defaults to a read-only transaction. - /// The new transaction ID will be returned as the first response in the - /// stream. - #[serde(rename="newTransaction")] - pub new_transaction: Option, - /// Reads documents in a transaction. - pub transaction: Option, - /// A structured query. - #[serde(rename="structuredQuery")] - pub structured_query: Option, - /// Reads documents as they were at the given time. - /// This may not be older than 60 seconds. - #[serde(rename="readTime")] - pub read_time: Option, +pub struct GoogleFirestoreAdminV1beta1ExportDocumentsRequest { + /// The output URI. Currently only supports Google Cloud Storage URIs of the + /// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name + /// of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional + /// Google Cloud Storage namespace path. When + /// choosing a name, be sure to consider Google Cloud Storage naming + /// guidelines: https://cloud.google.com/storage/docs/naming. + /// If the URI is a bucket (without a namespace path), a prefix will be + /// generated based on the start time. + #[serde(rename="outputUriPrefix")] + pub output_uri_prefix: Option, + /// Which collection ids to export. Unspecified means all collections. + #[serde(rename="collectionIds")] + pub collection_ids: Option>, } -impl RequestValue for RunQueryRequest {} +impl RequestValue for GoogleFirestoreAdminV1beta1ExportDocumentsRequest {} /// A reference to a field, such as `max(messages.time) as max_time`. @@ -800,17 +789,25 @@ pub struct UnaryFilter { impl Part for UnaryFilter {} -/// An array value. +/// The response for FirestoreAdmin.ListIndexes. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases indexes list projects](struct.ProjectDatabaseIndexeListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ArrayValue { - /// Values in the array. - pub values: Option>, +pub struct GoogleFirestoreAdminV1beta1ListIndexesResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The indexes. + pub indexes: Option>, } -impl Part for ArrayValue {} +impl ResponseResult for GoogleFirestoreAdminV1beta1ListIndexesResponse {} /// A set of field paths on a document. @@ -879,15 +876,15 @@ impl ResponseResult for Empty {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Filter { - /// A filter that takes exactly one argument. - #[serde(rename="unaryFilter")] - pub unary_filter: Option, - /// A filter on a document field. - #[serde(rename="fieldFilter")] - pub field_filter: Option, /// A composite filter. #[serde(rename="compositeFilter")] pub composite_filter: Option, + /// A filter on a document field. + #[serde(rename="fieldFilter")] + pub field_filter: Option, + /// A filter that takes exactly one argument. + #[serde(rename="unaryFilter")] + pub unary_filter: Option, } impl Part for Filter {} @@ -951,42 +948,32 @@ pub struct ListCollectionIdsRequest { impl RequestValue for ListCollectionIdsRequest {} -/// The request for Firestore.BatchGetDocuments. +/// A Document has been removed from the view of the targets. /// -/// # Activities +/// Sent if the document is no longer relevant to a target and is out of view. +/// Can be sent instead of a DocumentDelete or a DocumentChange if the server +/// can not send the new value of the document. /// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// Multiple DocumentRemove messages may be returned for the same logical +/// write or delete, if multiple targets are affected. /// -/// * [databases documents batch get projects](struct.ProjectDatabaseDocumentBatchGetCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchGetDocumentsRequest { - /// Starts a new transaction and reads the documents. - /// Defaults to a read-only transaction. - /// The new transaction ID will be returned as the first response in the - /// stream. - #[serde(rename="newTransaction")] - pub new_transaction: Option, - /// Reads documents in a transaction. - pub transaction: Option, - /// The fields to return. If not set, returns all fields. +pub struct DocumentRemove { + /// The resource name of the Document that has gone out of view. + pub document: Option, + /// A set of target IDs for targets that previously matched this document. + #[serde(rename="removedTargetIds")] + pub removed_target_ids: Option>, + /// The read timestamp at which the remove was observed. /// - /// If a document has a field that is not present in this mask, that field will - /// not be returned in the response. - pub mask: Option, - /// The names of the documents to retrieve. In the format: - /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. - /// The request will fail if any of the document is not a child resource of the - /// given `database`. Duplicate names will be elided. - pub documents: Option>, - /// Reads documents as they were at the given time. - /// This may not be older than 60 seconds. + /// Greater or equal to the `commit_time` of the change/delete/remove. #[serde(rename="readTime")] pub read_time: Option, } -impl RequestValue for BatchGetDocumentsRequest {} +impl Part for DocumentRemove {} /// A map value. @@ -1121,22 +1108,26 @@ pub struct DocumentsTarget { impl Part for DocumentsTarget {} -/// A precondition on a document, used for conditional operations. +/// The response from Firestore.ListCollectionIds. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases documents list collection ids projects](struct.ProjectDatabaseDocumentListCollectionIdCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Precondition { - /// When set, the target document must exist and have been last updated at - /// that time. - #[serde(rename="updateTime")] - pub update_time: Option, - /// When set to `true`, the target document must exist. - /// When set to `false`, the target document must not exist. - pub exists: Option, +pub struct ListCollectionIdsResponse { + /// A page token that may be used to continue the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The collection ids. + #[serde(rename="collectionIds")] + pub collection_ids: Option>, } -impl Part for Precondition {} +impl ResponseResult for ListCollectionIdsResponse {} /// A message that can hold any of the supported value types. @@ -1236,87 +1227,47 @@ pub struct CollectionSelector { impl Part for CollectionSelector {} -/// An index definition. +/// The request for Firestore.Commit. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [databases indexes create projects](struct.ProjectDatabaseIndexeCreateCall.html) (request) -/// * [databases indexes get projects](struct.ProjectDatabaseIndexeGetCall.html) (response) +/// * [databases documents commit projects](struct.ProjectDatabaseDocumentCommitCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleFirestoreAdminV1beta1Index { - /// The fields to index. - pub fields: Option>, - /// The state of the index. - /// Output only. - pub state: Option, - /// The resource name of the index. - /// Output only. - pub name: Option, - /// The collection ID to which this index applies. Required. - #[serde(rename="collectionId")] - pub collection_id: Option, +pub struct CommitRequest { + /// The writes to apply. + /// + /// Always executed atomically and in order. + pub writes: Option>, + /// If set, applies all writes in this transaction, and commits it. + pub transaction: Option, } -impl RequestValue for GoogleFirestoreAdminV1beta1Index {} -impl ResponseResult for GoogleFirestoreAdminV1beta1Index {} +impl RequestValue for CommitRequest {} -/// A Firestore query. +/// A target specified by a query. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StructuredQuery { - /// The order to apply to the query results. - /// - /// Firestore guarantees a stable ordering through the following rules: - /// - /// * Any field required to appear in `order_by`, that is not already - /// specified in `order_by`, is appended to the order in field name order - /// by default. - /// * If an order on `__name__` is not specified, it is appended by default. - /// - /// Fields are appended with the same sort direction as the last order - /// specified, or 'ASCENDING' if no order was specified. For example: - /// - /// * `SELECT * FROM Foo ORDER BY A` becomes - /// `SELECT * FROM Foo ORDER BY A, __name__` - /// * `SELECT * FROM Foo ORDER BY A DESC` becomes - /// `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC` - /// * `SELECT * FROM Foo WHERE A > 1` becomes - /// `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__` - #[serde(rename="orderBy")] - pub order_by: Option>, - /// A starting point for the query results. - #[serde(rename="startAt")] - pub start_at: Option, - /// A end point for the query results. - #[serde(rename="endAt")] - pub end_at: Option, - /// The maximum number of results to return. - /// - /// Applies after all other constraints. - /// Must be >= 0 if specified. - pub limit: Option, - /// The number of results to skip. - /// - /// Applies before limit, but after all other constraints. Must be >= 0 if - /// specified. - pub offset: Option, - /// The collections to query. - pub from: Option>, - /// The filter to apply. - #[serde(rename="where")] - pub where_: Option, - /// The projection to return. - pub select: Option, +pub struct QueryTarget { + /// A structured query. + #[serde(rename="structuredQuery")] + pub structured_query: Option, + /// The parent resource name. In the format: + /// `projects/{project_id}/databases/{database_id}/documents` or + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// For example: + /// `projects/my-project/databases/my-database/documents` or + /// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` + pub parent: Option, } -impl Part for StructuredQuery {} +impl Part for QueryTarget {} /// A transformation of a field of the document. @@ -1329,6 +1280,19 @@ pub struct FieldTransform { /// reference. #[serde(rename="fieldPath")] pub field_path: Option, + /// Sets the field to the minimum of its current value and the given value. + /// + /// This must be an integer or a double value. + /// If the field is not an integer or double, or if the field does not yet + /// exist, the transformation will set the field to the input value. + /// If a minimum operation is applied where the field and the input value + /// are of mixed types (that is - one is an integer and one is a double) + /// the field takes on the type of the smaller operand. If the operands are + /// equivalent (e.g. 3 and 3.0), the field does not change. + /// 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and + /// zero input value is always the stored value. + /// The minimum of any numeric value x and NaN is NaN. + pub minimum: Option, /// Append the given elements in order if they are not already present in /// the current field value. /// If the field is not an array, or if the field does not yet exist, it is @@ -1343,9 +1307,30 @@ pub struct FieldTransform { /// The corresponding transform_result will be the null value. #[serde(rename="appendMissingElements")] pub append_missing_elements: Option, - /// Sets the field to the given server value. - #[serde(rename="setToServerValue")] - pub set_to_server_value: Option, + /// Adds the given value to the field's current value. + /// + /// This must be an integer or a double value. + /// If the field is not an integer or double, or if the field does not yet + /// exist, the transformation will set the field to the given value. + /// If either of the given value or the current field value are doubles, + /// both values will be interpreted as doubles. Double arithmetic and + /// representation of double values follow IEEE 754 semantics. + /// If there is positive/negative integer overflow, the field is resolved + /// to the largest magnitude positive/negative integer. + pub increment: Option, + /// Sets the field to the maximum of its current value and the given value. + /// + /// This must be an integer or a double value. + /// If the field is not an integer or double, or if the field does not yet + /// exist, the transformation will set the field to the given value. + /// If a maximum operation is applied where the field and the input value + /// are of mixed types (that is - one is an integer and one is a double) + /// the field takes on the type of the larger operand. If the operands are + /// equivalent (e.g. 3 and 3.0), the field does not change. + /// 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and + /// zero input value is always the stored value. + /// The maximum of any numeric value x and NaN is NaN. + pub maximum: Option, /// Remove all of the given elements from the array in the field. /// If the field is not an array, or if the field does not yet exist, it is /// set to the empty array. @@ -1358,6 +1343,9 @@ pub struct FieldTransform { /// The corresponding transform_result will be the null value. #[serde(rename="removeAllFromArray")] pub remove_all_from_array: Option, + /// Sets the field to the given server value. + #[serde(rename="setToServerValue")] + pub set_to_server_value: Option, } impl Part for FieldTransform {} @@ -1375,11 +1363,11 @@ impl Part for FieldTransform {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DocumentDelete { + /// The resource name of the Document that was deleted. + pub document: Option, /// A set of target IDs for targets that previously matched this entity. #[serde(rename="removedTargetIds")] pub removed_target_ids: Option>, - /// The resource name of the Document that was deleted. - pub document: Option, /// The read timestamp at which the delete was observed. /// /// Greater or equal to the `commit_time` of the delete. @@ -1390,33 +1378,35 @@ pub struct DocumentDelete { impl Part for DocumentDelete {} -/// The request for FirestoreAdmin.ExportDocuments. +/// The request for Firestore.RunQuery. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [databases export documents projects](struct.ProjectDatabaseExportDocumentCall.html) (request) +/// * [databases documents run query projects](struct.ProjectDatabaseDocumentRunQueryCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleFirestoreAdminV1beta1ExportDocumentsRequest { - /// The output URI. Currently only supports Google Cloud Storage URIs of the - /// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name - /// of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional - /// Google Cloud Storage namespace path. When - /// choosing a name, be sure to consider Google Cloud Storage naming - /// guidelines: https://cloud.google.com/storage/docs/naming. - /// If the URI is a bucket (without a namespace path), a prefix will be - /// generated based on the start time. - #[serde(rename="outputUriPrefix")] - pub output_uri_prefix: Option, - /// Which collection ids to export. Unspecified means all collections. - #[serde(rename="collectionIds")] - pub collection_ids: Option>, +pub struct RunQueryRequest { + /// Starts a new transaction and reads the documents. + /// Defaults to a read-only transaction. + /// The new transaction ID will be returned as the first response in the + /// stream. + #[serde(rename="newTransaction")] + pub new_transaction: Option, + /// Reads documents in a transaction. + pub transaction: Option, + /// A structured query. + #[serde(rename="structuredQuery")] + pub structured_query: Option, + /// Reads documents as they were at the given time. + /// This may not be older than 60 seconds. + #[serde(rename="readTime")] + pub read_time: Option, } -impl RequestValue for GoogleFirestoreAdminV1beta1ExportDocumentsRequest {} +impl RequestValue for RunQueryRequest {} /// An order on a field. @@ -1440,15 +1430,15 @@ impl Part for Order {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetChange { + /// The type of change that occurred. + #[serde(rename="targetChangeType")] + pub target_change_type: Option, /// A token that can be used to resume the stream for the given `target_ids`, /// or all targets if `target_ids` is empty. /// /// Not set on every target change. #[serde(rename="resumeToken")] pub resume_token: Option, - /// The type of change that occurred. - #[serde(rename="targetChangeType")] - pub target_change_type: Option, /// The error that resulted in this change, if applicable. pub cause: Option, /// The target IDs of targets that have changed. @@ -1479,85 +1469,89 @@ pub struct TargetChange { impl Part for TargetChange {} -/// The response for Firestore.RunQuery. +/// A write on a document. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [databases documents run query projects](struct.ProjectDatabaseDocumentRunQueryCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RunQueryResponse { - /// The number of results that have been skipped due to an offset between - /// the last response and the current response. - #[serde(rename="skippedResults")] - pub skipped_results: Option, - /// The transaction that was started as part of this request. - /// Can only be set in the first response, and only if - /// RunQueryRequest.new_transaction was set in the request. - /// If set, no other fields will be set in this response. - pub transaction: Option, - /// A query result. - /// Not set when reporting partial progress. - pub document: Option, - /// The time at which the document was read. This may be monotonically - /// increasing; in this case, the previous documents in the result stream are - /// guaranteed not to have changed between their `read_time` and this one. +pub struct Write { + /// A document name to delete. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + pub delete: Option, + /// An optional precondition on the document. /// - /// If the query returns no results, a response with `read_time` and no - /// `document` will be sent, and this represents the time at which the query - /// was run. - #[serde(rename="readTime")] - pub read_time: Option, -} - -impl ResponseResult for RunQueryResponse {} - - -/// The response from Firestore.ListCollectionIds. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [databases documents list collection ids projects](struct.ProjectDatabaseDocumentListCollectionIdCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListCollectionIdsResponse { - /// A page token that may be used to continue the list. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The collection ids. - #[serde(rename="collectionIds")] - pub collection_ids: Option>, -} - -impl ResponseResult for ListCollectionIdsResponse {} - - -/// The request for Firestore.Commit. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [databases documents commit projects](struct.ProjectDatabaseDocumentCommitCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CommitRequest { - /// The writes to apply. + /// The write will fail if this is set and not met by the target document. + #[serde(rename="currentDocument")] + pub current_document: Option, + /// The fields to update in this write. /// - /// Always executed atomically and in order. - pub writes: Option>, - /// If set, applies all writes in this transaction, and commits it. - pub transaction: Option, + /// This field can be set only when the operation is `update`. + /// If the mask is not set for an `update` and the document exists, any + /// existing data will be overwritten. + /// If the mask is set and the document on the server has fields not covered by + /// the mask, they are left unchanged. + /// Fields referenced in the mask, but not present in the input document, are + /// deleted from the document on the server. + /// The field paths in this mask must not contain a reserved field name. + #[serde(rename="updateMask")] + pub update_mask: Option, + /// Applies a tranformation to a document. + /// At most one `transform` per document is allowed in a given request. + /// An `update` cannot follow a `transform` on the same document in a given + /// request. + pub transform: Option, + /// A document to write. + pub update: Option, } -impl RequestValue for CommitRequest {} +impl Part for Write {} + + +/// A precondition on a document, used for conditional operations. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Precondition { + /// When set, the target document must exist and have been last updated at + /// that time. + #[serde(rename="updateTime")] + pub update_time: Option, + /// When set to `true`, the target document must exist. + /// When set to `false`, the target document must not exist. + pub exists: Option, +} + +impl Part for Precondition {} + + +/// An index definition. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [databases indexes create projects](struct.ProjectDatabaseIndexeCreateCall.html) (request) +/// * [databases indexes get projects](struct.ProjectDatabaseIndexeGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleFirestoreAdminV1beta1Index { + /// The fields to index. + pub fields: Option>, + /// The state of the index. + /// Output only. + pub state: Option, + /// The resource name of the index. + /// Output only. + pub name: Option, + /// The collection ID to which this index applies. Required. + #[serde(rename="collectionId")] + pub collection_id: Option, +} + +impl RequestValue for GoogleFirestoreAdminV1beta1Index {} +impl ResponseResult for GoogleFirestoreAdminV1beta1Index {} /// The projection of document's fields to return. @@ -1700,32 +1694,42 @@ pub struct DocumentChange { impl Part for DocumentChange {} -/// A Document has been removed from the view of the targets. +/// The request for Firestore.BatchGetDocuments. /// -/// Sent if the document is no longer relevant to a target and is out of view. -/// Can be sent instead of a DocumentDelete or a DocumentChange if the server -/// can not send the new value of the document. +/// # Activities /// -/// Multiple DocumentRemove messages may be returned for the same logical -/// write or delete, if multiple targets are affected. +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// * [databases documents batch get projects](struct.ProjectDatabaseDocumentBatchGetCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DocumentRemove { - /// A set of target IDs for targets that previously matched this document. - #[serde(rename="removedTargetIds")] - pub removed_target_ids: Option>, - /// The resource name of the Document that has gone out of view. - pub document: Option, - /// The read timestamp at which the remove was observed. +pub struct BatchGetDocumentsRequest { + /// Starts a new transaction and reads the documents. + /// Defaults to a read-only transaction. + /// The new transaction ID will be returned as the first response in the + /// stream. + #[serde(rename="newTransaction")] + pub new_transaction: Option, + /// Reads documents in a transaction. + pub transaction: Option, + /// The fields to return. If not set, returns all fields. /// - /// Greater or equal to the `commit_time` of the change/delete/remove. + /// If a document has a field that is not present in this mask, that field will + /// not be returned in the response. + pub mask: Option, + /// The names of the documents to retrieve. In the format: + /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. + /// The request will fail if any of the document is not a child resource of the + /// given `database`. Duplicate names will be elided. + pub documents: Option>, + /// Reads documents as they were at the given time. + /// This may not be older than 60 seconds. #[serde(rename="readTime")] pub read_time: Option, } -impl Part for DocumentRemove {} +impl RequestValue for BatchGetDocumentsRequest {} /// The request for Firestore.Rollback. @@ -1820,25 +1824,58 @@ pub struct WriteResult { impl Part for WriteResult {} -/// A target specified by a query. +/// A Firestore query. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct QueryTarget { - /// A structured query. - #[serde(rename="structuredQuery")] - pub structured_query: Option, - /// The parent resource name. In the format: - /// `projects/{project_id}/databases/{database_id}/documents` or - /// `projects/{project_id}/databases/{database_id}/documents/{document_path}`. - /// For example: - /// `projects/my-project/databases/my-database/documents` or - /// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom` - pub parent: Option, +pub struct StructuredQuery { + /// The order to apply to the query results. + /// + /// Firestore guarantees a stable ordering through the following rules: + /// + /// * Any field required to appear in `order_by`, that is not already + /// specified in `order_by`, is appended to the order in field name order + /// by default. + /// * If an order on `__name__` is not specified, it is appended by default. + /// + /// Fields are appended with the same sort direction as the last order + /// specified, or 'ASCENDING' if no order was specified. For example: + /// + /// * `SELECT * FROM Foo ORDER BY A` becomes + /// `SELECT * FROM Foo ORDER BY A, __name__` + /// * `SELECT * FROM Foo ORDER BY A DESC` becomes + /// `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC` + /// * `SELECT * FROM Foo WHERE A > 1` becomes + /// `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__` + #[serde(rename="orderBy")] + pub order_by: Option>, + /// A starting point for the query results. + #[serde(rename="startAt")] + pub start_at: Option, + /// A end point for the query results. + #[serde(rename="endAt")] + pub end_at: Option, + /// The maximum number of results to return. + /// + /// Applies after all other constraints. + /// Must be >= 0 if specified. + pub limit: Option, + /// The number of results to skip. + /// + /// Applies before limit, but after all other constraints. Must be >= 0 if + /// specified. + pub offset: Option, + /// The collections to query. + pub from: Option>, + /// The filter to apply. + #[serde(rename="where")] + pub where_: Option, + /// The projection to return. + pub select: Option, } -impl Part for QueryTarget {} +impl Part for StructuredQuery {} /// The request for Firestore.Write. @@ -2482,7 +2519,7 @@ impl<'a, C, A> ProjectDatabaseIndexeListCall<'a, C, A> where C: BorrowMut ProjectDatabaseIndexeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2521,7 +2555,7 @@ impl<'a, C, A> ProjectDatabaseIndexeListCall<'a, C, A> where C: BorrowMut ProjectDatabaseIndexeListCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2791,10 +2825,7 @@ impl<'a, C, A> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2826,7 +2857,7 @@ impl<'a, C, A> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2946,7 +2977,7 @@ impl<'a, C, A> ProjectDatabaseDocumentCreateDocumentCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3099,7 +3130,7 @@ impl<'a, C, A> ProjectDatabaseIndexeCreateCall<'a, C, A> where C: BorrowMut ProjectDatabaseIndexeCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3150,7 +3178,7 @@ impl<'a, C, A> ProjectDatabaseIndexeCreateCall<'a, C, A> where C: BorrowMut ProjectDatabaseIndexeCreateCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentRollbackCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3398,10 +3426,7 @@ impl<'a, C, A> ProjectDatabaseDocumentRollbackCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3433,7 +3458,7 @@ impl<'a, C, A> ProjectDatabaseDocumentRollbackCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3524,7 +3549,7 @@ impl<'a, C, A> ProjectDatabaseDocumentRollbackCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3697,7 +3722,7 @@ impl<'a, C, A> ProjectDatabaseDocumentListCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3736,7 +3758,7 @@ impl<'a, C, A> ProjectDatabaseDocumentListCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentListCall<'a, C, A> where C: BorrowMut ProjectDatabaseIndexeGetCall<'a, C, A> where C: BorrowMut ProjectDatabaseIndexeGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4061,7 +4080,7 @@ impl<'a, C, A> ProjectDatabaseIndexeGetCall<'a, C, A> where C: BorrowMut ProjectDatabaseIndexeGetCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentGetCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4330,7 +4346,7 @@ impl<'a, C, A> ProjectDatabaseDocumentGetCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentGetCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentWriteCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentWriteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4625,7 +4638,7 @@ impl<'a, C, A> ProjectDatabaseDocumentWriteCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentWriteCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentRunQueryCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4874,10 +4887,7 @@ impl<'a, C, A> ProjectDatabaseDocumentRunQueryCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4909,7 +4919,7 @@ impl<'a, C, A> ProjectDatabaseDocumentRunQueryCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5004,7 +5014,7 @@ impl<'a, C, A> ProjectDatabaseDocumentRunQueryCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5149,7 +5159,7 @@ impl<'a, C, A> ProjectDatabaseImportDocumentCall<'a, C, A> where C: BorrowMut ProjectDatabaseImportDocumentCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5200,7 +5207,7 @@ impl<'a, C, A> ProjectDatabaseImportDocumentCall<'a, C, A> where C: BorrowMut ProjectDatabaseImportDocumentCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentPatchCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5507,7 +5511,7 @@ impl<'a, C, A> ProjectDatabaseDocumentPatchCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentPatchCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentBatchGetCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5792,10 +5796,7 @@ impl<'a, C, A> ProjectDatabaseDocumentBatchGetCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5827,7 +5828,7 @@ impl<'a, C, A> ProjectDatabaseDocumentBatchGetCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5918,7 +5919,7 @@ impl<'a, C, A> ProjectDatabaseDocumentBatchGetCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6059,7 +6060,7 @@ impl<'a, C, A> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6075,10 +6076,7 @@ impl<'a, C, A> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6110,7 +6108,7 @@ impl<'a, C, A> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6201,7 +6199,7 @@ impl<'a, C, A> ProjectDatabaseDocumentBeginTransactionCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6342,7 +6340,7 @@ impl<'a, C, A> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6358,10 +6356,7 @@ impl<'a, C, A> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6393,7 +6388,7 @@ impl<'a, C, A> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6486,7 +6481,7 @@ impl<'a, C, A> ProjectDatabaseDocumentListCollectionIdCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6634,7 +6629,7 @@ impl<'a, C, A> ProjectDatabaseExportDocumentCall<'a, C, A> where C: BorrowMut ProjectDatabaseExportDocumentCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6685,7 +6677,7 @@ impl<'a, C, A> ProjectDatabaseExportDocumentCall<'a, C, A> where C: BorrowMut ProjectDatabaseExportDocumentCall<'a, C, A> where C: BorrowMut ProjectDatabaseIndexeDeleteCall<'a, C, A> where C: BorrowMut ProjectDatabaseIndexeDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6949,7 +6938,7 @@ impl<'a, C, A> ProjectDatabaseIndexeDeleteCall<'a, C, A> where C: BorrowMut ProjectDatabaseIndexeDeleteCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentDeleteCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7211,7 +7197,7 @@ impl<'a, C, A> ProjectDatabaseDocumentDeleteCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentDeleteCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentCommitCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentCommitCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7498,7 +7481,7 @@ impl<'a, C, A> ProjectDatabaseDocumentCommitCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentCommitCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentListenCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentListenCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7781,7 +7761,7 @@ impl<'a, C, A> ProjectDatabaseDocumentListenCall<'a, C, A> where C: BorrowMut ProjectDatabaseDocumentListenCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with fitness (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/fitness1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-fitness1] path = "../fitness1" -version = "1.0.8+20170922" +version = "1.0.8+20190403" diff --git a/gen/fitness1-cli/README.md b/gen/fitness1-cli/README.md index aee1b40323..ce0edd1e8e 100644 --- a/gen/fitness1-cli/README.md +++ b/gen/fitness1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *fitness* API at revision *20170922*. The CLI is at version *1.0.8*. +This documentation was generated from the *fitness* API at revision *20190403*. The CLI is at version *1.0.8*. ```bash fitness1 [options] @@ -38,7 +38,6 @@ fitness1 [options] data-sources-delete [-p ]... [-o ] data-sources-get [-p ]... [-o ] data-sources-list [-p ]... [-o ] - data-sources-patch (-r )... [-p ]... [-o ] data-sources-update (-r )... [-p ]... [-o ] dataset-aggregate (-r )... [-p ]... [-o ] sessions-delete [-p ]... diff --git a/gen/fitness1-cli/mkdocs.yml b/gen/fitness1-cli/mkdocs.yml index aaa656a4bb..955e1483df 100644 --- a/gen/fitness1-cli/mkdocs.yml +++ b/gen/fitness1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: fitness v1.0.8+20170922 +site_name: fitness v1.0.8+20190403 site_url: http://byron.github.io/google-apis-rs/google-fitness1-cli site_description: A complete library to interact with fitness (protocol v1) @@ -17,7 +17,6 @@ pages: - ['users_data-sources-delete.md', 'Users', 'Data Sources Delete'] - ['users_data-sources-get.md', 'Users', 'Data Sources Get'] - ['users_data-sources-list.md', 'Users', 'Data Sources List'] -- ['users_data-sources-patch.md', 'Users', 'Data Sources Patch'] - ['users_data-sources-update.md', 'Users', 'Data Sources Update'] - ['users_dataset-aggregate.md', 'Users', 'Dataset Aggregate'] - ['users_sessions-delete.md', 'Users', 'Sessions Delete'] diff --git a/gen/fitness1-cli/src/main.rs b/gen/fitness1-cli/src/main.rs index 4f2f8ea60e..a9b6c16423 100644 --- a/gen/fitness1-cli/src/main.rs +++ b/gen/fitness1-cli/src/main.rs @@ -566,105 +566,6 @@ impl<'n> Engine<'n> { } } - fn _users_data_sources_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "data-stream-name" => Some(("dataStreamName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "data-type.name" => Some(("dataType.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "data-quality-standard" => Some(("dataQualityStandard", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "application.package-name" => Some(("application.packageName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "application.version" => Some(("application.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "application.name" => Some(("application.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "application.details-url" => Some(("application.detailsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "device.model" => Some(("device.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "device.version" => Some(("device.version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "device.type" => Some(("device.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "device.uid" => Some(("device.uid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "device.manufacturer" => Some(("device.manufacturer", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "data-stream-id" => Some(("dataStreamId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["application", "data-quality-standard", "data-stream-id", "data-stream-name", "data-type", "details-url", "device", "manufacturer", "model", "name", "package-name", "type", "uid", "version"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::DataSource = json::value::from_value(object).unwrap(); - let mut call = self.hub.users().data_sources_patch(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("data-source-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _users_data_sources_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -1104,9 +1005,6 @@ impl<'n> Engine<'n> { ("data-sources-list", Some(opt)) => { call_result = self._users_data_sources_list(opt, dry_run, &mut err); }, - ("data-sources-patch", Some(opt)) => { - call_result = self._users_data_sources_patch(opt, dry_run, &mut err); - }, ("data-sources-update", Some(opt)) => { call_result = self._users_data_sources_update(opt, dry_run, &mut err); }, @@ -1210,7 +1108,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("users", "methods: 'data-sources-create', 'data-sources-data-point-changes-list', 'data-sources-datasets-delete', 'data-sources-datasets-get', 'data-sources-datasets-patch', 'data-sources-delete', 'data-sources-get', 'data-sources-list', 'data-sources-patch', 'data-sources-update', 'dataset-aggregate', 'sessions-delete', 'sessions-list' and 'sessions-update'", vec![ + ("users", "methods: 'data-sources-create', 'data-sources-data-point-changes-list', 'data-sources-datasets-delete', 'data-sources-datasets-get', 'data-sources-datasets-patch', 'data-sources-delete', 'data-sources-get', 'data-sources-list', 'data-sources-update', 'dataset-aggregate', 'sessions-delete', 'sessions-list' and 'sessions-update'", vec![ ("data-sources-create", Some(r##"Creates a new data source that is unique across all data sources belonging to this user. The data stream ID field can be omitted and will be generated by the server with the correct format. The data stream ID is an ordered combination of some fields from the data source. In addition to the data source fields reflected into the data source ID, the developer project number that is authenticated when creating the data source is included. This developer project number is obfuscated when read by any other developer reading public data types."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_data-sources-create", @@ -1441,42 +1339,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("data-sources-patch", - Some(r##"Updates the specified data source. The dataStreamId, dataType, type, dataStreamName, and device properties with the exception of version, cannot be modified. - - Data sources are identified by their dataStreamId. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_data-sources-patch", - vec![ - (Some(r##"user-id"##), - None, - Some(r##"Update the data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time."##), - Some(true), - Some(false)), - - (Some(r##"data-source-id"##), - None, - Some(r##"The data stream ID of the data source to update."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1631,7 +1493,7 @@ fn main() { let mut app = App::new("fitness1") .author("Sebastian Thiel ") - .version("1.0.8+20170922") + .version("1.0.8+20190403") .about("Stores and accesses user data in the fitness store from apps on any platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_fitness1_cli") .arg(Arg::with_name("url") diff --git a/gen/fitness1/Cargo.toml b/gen/fitness1/Cargo.toml index b76d093040..1ffbbf9567 100644 --- a/gen/fitness1/Cargo.toml +++ b/gen/fitness1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-fitness1" -version = "1.0.8+20170922" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with fitness (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/fitness1" homepage = "https://developers.google.com/fit/rest/" -documentation = "https://docs.rs/google-fitness1/1.0.8+20170922" +documentation = "https://docs.rs/google-fitness1/1.0.8+20190403" license = "MIT" keywords = ["fitness", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/fitness1/README.md b/gen/fitness1/README.md index 1e7e6207e2..5bb3eecec7 100644 --- a/gen/fitness1/README.md +++ b/gen/fitness1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-fitness1` library allows access to all features of the *Google fitness* service. -This documentation was generated from *fitness* crate version *1.0.8+20170922*, where *20170922* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *fitness* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *fitness* *v1* API can be found at the [official documentation site](https://developers.google.com/fit/rest/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.Fitness.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.Fitness.html) ... * users - * [*data sources create*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDataSourceCreateCall.html), [*data sources data point changes list*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDataSourceDataPointChangeListCall.html), [*data sources datasets delete*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDataSourceDatasetDeleteCall.html), [*data sources datasets get*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDataSourceDatasetGetCall.html), [*data sources datasets patch*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDataSourceDatasetPatchCall.html), [*data sources delete*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDataSourceDeleteCall.html), [*data sources get*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDataSourceGetCall.html), [*data sources list*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDataSourceListCall.html), [*data sources patch*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDataSourcePatchCall.html), [*data sources update*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDataSourceUpdateCall.html), [*dataset aggregate*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserDatasetAggregateCall.html), [*sessions delete*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserSessionDeleteCall.html), [*sessions list*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserSessionListCall.html) and [*sessions update*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.UserSessionUpdateCall.html) + * [*data sources create*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserDataSourceCreateCall.html), [*data sources data point changes list*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserDataSourceDataPointChangeListCall.html), [*data sources datasets delete*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserDataSourceDatasetDeleteCall.html), [*data sources datasets get*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserDataSourceDatasetGetCall.html), [*data sources datasets patch*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserDataSourceDatasetPatchCall.html), [*data sources delete*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserDataSourceDeleteCall.html), [*data sources get*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserDataSourceGetCall.html), [*data sources list*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserDataSourceListCall.html), [*data sources update*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserDataSourceUpdateCall.html), [*dataset aggregate*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserDatasetAggregateCall.html), [*sessions delete*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserSessionDeleteCall.html), [*sessions list*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserSessionListCall.html) and [*sessions update*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.UserSessionUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/struct.Fitness.html)** +* **[Hub](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/struct.Fitness.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.Part.html)** + * **[Parts](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -47,11 +47,10 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.users().data_sources_get(...).doit() +let r = hub.users().data_sources_delete(...).doit() let r = hub.users().data_sources_update(...).doit() let r = hub.users().data_sources_create(...).doit() -let r = hub.users().data_sources_patch(...).doit() -let r = hub.users().data_sources_delete(...).doit() +let r = hub.users().data_sources_get(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -134,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -154,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-fitness1/1.0.8+20170922/google_fitness1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-fitness1/1.0.8+20190403/google_fitness1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/fitness1/src/lib.rs b/gen/fitness1/src/lib.rs index 77d382027e..f922d95dcd 100644 --- a/gen/fitness1/src/lib.rs +++ b/gen/fitness1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *fitness* crate version *1.0.8+20170922*, where *20170922* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *fitness* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *fitness* *v1* API can be found at the //! [official documentation site](https://developers.google.com/fit/rest/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Fitness.html) ... //! //! * users -//! * [*data sources create*](struct.UserDataSourceCreateCall.html), [*data sources data point changes list*](struct.UserDataSourceDataPointChangeListCall.html), [*data sources datasets delete*](struct.UserDataSourceDatasetDeleteCall.html), [*data sources datasets get*](struct.UserDataSourceDatasetGetCall.html), [*data sources datasets patch*](struct.UserDataSourceDatasetPatchCall.html), [*data sources delete*](struct.UserDataSourceDeleteCall.html), [*data sources get*](struct.UserDataSourceGetCall.html), [*data sources list*](struct.UserDataSourceListCall.html), [*data sources patch*](struct.UserDataSourcePatchCall.html), [*data sources update*](struct.UserDataSourceUpdateCall.html), [*dataset aggregate*](struct.UserDatasetAggregateCall.html), [*sessions delete*](struct.UserSessionDeleteCall.html), [*sessions list*](struct.UserSessionListCall.html) and [*sessions update*](struct.UserSessionUpdateCall.html) +//! * [*data sources create*](struct.UserDataSourceCreateCall.html), [*data sources data point changes list*](struct.UserDataSourceDataPointChangeListCall.html), [*data sources datasets delete*](struct.UserDataSourceDatasetDeleteCall.html), [*data sources datasets get*](struct.UserDataSourceDatasetGetCall.html), [*data sources datasets patch*](struct.UserDataSourceDatasetPatchCall.html), [*data sources delete*](struct.UserDataSourceDeleteCall.html), [*data sources get*](struct.UserDataSourceGetCall.html), [*data sources list*](struct.UserDataSourceListCall.html), [*data sources update*](struct.UserDataSourceUpdateCall.html), [*dataset aggregate*](struct.UserDatasetAggregateCall.html), [*sessions delete*](struct.UserSessionDeleteCall.html), [*sessions list*](struct.UserSessionListCall.html) and [*sessions update*](struct.UserSessionUpdateCall.html) //! //! //! @@ -47,11 +47,10 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.users().data_sources_get(...).doit() +//! let r = hub.users().data_sources_delete(...).doit() //! let r = hub.users().data_sources_update(...).doit() //! let r = hub.users().data_sources_create(...).doit() -//! let r = hub.users().data_sources_patch(...).doit() -//! let r = hub.users().data_sources_delete(...).doit() +//! let r = hub.users().data_sources_get(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -536,7 +535,7 @@ impl Part for Application {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DataPoint { - /// Used for version checking during transformation; that is, a datapoint can only replace another datapoint that has an older computation time stamp. + /// DO NOT USE THIS FIELD. It is ignored, and not stored. #[serde(rename="computationTimeMillis")] pub computation_time_millis: Option, /// Indicates the last time this data point was modified. Useful only in contexts where we are listing the data changes, rather than representing the current state of the data. @@ -556,6 +555,8 @@ pub struct DataPoint { #[serde(rename="endTimeNanos")] pub end_time_nanos: Option, /// If the data point is contained in a dataset for a derived data source, this field will be populated with the data source stream ID that created the data point originally. + /// + /// WARNING: do not rely on this field for anything other than debugging. The value of this field, if it is set at all, is an implementation detail and is not guaranteed to remain consistent. #[serde(rename="originDataSourceId")] pub origin_data_source_id: Option, /// The raw timestamp from the original SensorEvent. @@ -663,7 +664,7 @@ pub struct AggregateRequest { /// The start of a window of time. Data that intersects with this time window will be aggregated. The time is in milliseconds since epoch, inclusive. #[serde(rename="startTimeMillis")] pub start_time_millis: Option, - /// A list of acceptable data quality standards. Only data points which conform to at least one of the specified data quality standards will be returned. If the list is empty, all data points are returned. + /// DO NOT POPULATE THIS FIELD. As data quality standards are deprecated, filling it in will result in no data sources being returned. It will be removed in a future version entirely. #[serde(rename="filteredDataQualityStandard")] pub filtered_data_quality_standard: Option>, /// Specifies that data be aggregated by a single time interval. Mutually exclusive of other bucketing specifications. @@ -725,7 +726,7 @@ pub struct Dataset { /// This token will be set when a dataset is received in response to a GET request and the dataset is too large to be included in a single response. Provide this value in a subsequent GET request to return the next page of data points within this dataset. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The largest end time of all data points in this possibly partial representation of the dataset. Time is in nanoseconds from epoch. This should also match the first part of the dataset identifier. + /// The largest end time of all data points in this possibly partial representation of the dataset. Time is in nanoseconds from epoch. This should also match the second part of the dataset identifier. #[serde(rename="maxEndTimeNs")] pub max_end_time_ns: Option, /// The data stream ID of the data source that created the points in this dataset. @@ -945,17 +946,16 @@ impl Part for BucketByTime {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [data sources get users](struct.UserDataSourceGetCall.html) (response) +/// * [data sources delete users](struct.UserDataSourceDeleteCall.html) (response) /// * [data sources update users](struct.UserDataSourceUpdateCall.html) (request|response) /// * [data sources create users](struct.UserDataSourceCreateCall.html) (request|response) -/// * [data sources patch users](struct.UserDataSourcePatchCall.html) (request|response) -/// * [data sources delete users](struct.UserDataSourceDeleteCall.html) (response) +/// * [data sources get users](struct.UserDataSourceGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DataSource { /// An end-user visible name for this data source. pub name: Option, - /// + /// DO NOT POPULATE THIS FIELD. It is never populated in responses from the platform, and is ignored in queries. It will be removed in a future version entirely. #[serde(rename="dataQualityStandard")] pub data_quality_standard: Option>, /// The data type defines the schema for a stream of data being collected by, inserted into, or queried from the Fitness API. @@ -1023,7 +1023,7 @@ impl ResponseResult for DataSource {} /// ::default(), None); /// let mut hub = Fitness::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `data_sources_create(...)`, `data_sources_data_point_changes_list(...)`, `data_sources_datasets_delete(...)`, `data_sources_datasets_get(...)`, `data_sources_datasets_patch(...)`, `data_sources_delete(...)`, `data_sources_get(...)`, `data_sources_list(...)`, `data_sources_patch(...)`, `data_sources_update(...)`, `dataset_aggregate(...)`, `sessions_delete(...)`, `sessions_list(...)` and `sessions_update(...)` +/// // like `data_sources_create(...)`, `data_sources_data_point_changes_list(...)`, `data_sources_datasets_delete(...)`, `data_sources_datasets_get(...)`, `data_sources_datasets_patch(...)`, `data_sources_delete(...)`, `data_sources_get(...)`, `data_sources_list(...)`, `data_sources_update(...)`, `dataset_aggregate(...)`, `sessions_delete(...)`, `sessions_list(...)` and `sessions_update(...)` /// // to build up your call. /// let rb = hub.users(); /// # } @@ -1291,29 +1291,6 @@ impl<'a, C, A> UserMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Updates the specified data source. The dataStreamId, dataType, type, dataStreamName, and device properties with the exception of version, cannot be modified. - /// - /// Data sources are identified by their dataStreamId. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `userId` - Update the data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time. - /// * `dataSourceId` - The data stream ID of the data source to update. - pub fn data_sources_patch(&self, request: DataSource, user_id: &str, data_source_id: &str) -> UserDataSourcePatchCall<'a, C, A> { - UserDataSourcePatchCall { - hub: self.hub, - _request: request, - _user_id: user_id.to_string(), - _data_source_id: data_source_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Lists all data sources that are visible to the developer, using the OAuth scopes provided. The list is not exhaustive; the user may have private data sources that are only visible to other developers, or calls using other scopes. @@ -1446,10 +1423,7 @@ impl<'a, C, A> UserDatasetAggregateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1481,7 +1455,7 @@ impl<'a, C, A> UserDatasetAggregateCall<'a, C, A> where C: BorrowMut UserDatasetAggregateCall<'a, C, A> where C: BorrowMut UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1738,7 +1709,7 @@ impl<'a, C, A> UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2005,7 +1973,7 @@ impl<'a, C, A> UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut UserDataSourceCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2301,7 +2266,7 @@ impl<'a, C, A> UserDataSourceCreateCall<'a, C, A> where C: BorrowMut UserDataSourceCreateCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2569,7 +2531,7 @@ impl<'a, C, A> UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2864,7 +2823,7 @@ impl<'a, C, A> UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut UserSessionDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3152,7 +3108,7 @@ impl<'a, C, A> UserSessionDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3237,7 +3193,7 @@ impl<'a, C, A> UserSessionDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3381,10 +3337,7 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3404,7 +3357,7 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3492,7 +3445,7 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3645,10 +3598,7 @@ impl<'a, C, A> UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3680,7 +3630,7 @@ impl<'a, C, A> UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut UserSessionListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3965,7 +3912,7 @@ impl<'a, C, A> UserSessionListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4035,7 +3982,7 @@ impl<'a, C, A> UserSessionListCall<'a, C, A> where C: BorrowMut, self._start_time = Some(new_value.to_string()); self } - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. + /// The continuation token, which is used for incremental syncing. To get the next batch of changes, set this parameter to the value of nextPageToken from the previous response. This token is treated as a timestamp (in millis since epoch). If specified, the API returns sessions modified since this time. The page token is ignored if either start or end time is specified. If none of start time, end time, and the page token is specified, sessions modified in the last 30 days are returned. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> UserSessionListCall<'a, C, A> { @@ -4071,7 +4018,7 @@ impl<'a, C, A> UserSessionListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4227,10 +4174,7 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4262,7 +4206,7 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4369,7 +4313,7 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4523,10 +4467,7 @@ impl<'a, C, A> UserDataSourceDataPointChangeListCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4546,7 +4487,7 @@ impl<'a, C, A> UserDataSourceDataPointChangeListCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4648,7 +4589,7 @@ impl<'a, C, A> UserDataSourceDataPointChangeListCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4692,294 +4633,6 @@ impl<'a, C, A> UserDataSourceDataPointChangeListCall<'a, C, A> where C: BorrowMu } -/// Updates the specified data source. The dataStreamId, dataType, type, dataStreamName, and device properties with the exception of version, cannot be modified. -/// -/// Data sources are identified by their dataStreamId. This method supports patch semantics. -/// -/// A builder for the *dataSources.patch* method supported by a *user* resource. -/// It is not used directly, but through a `UserMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_fitness1 as fitness1; -/// use fitness1::DataSource; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use fitness1::Fitness; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Fitness::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = DataSource::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.users().data_sources_patch(req, "userId", "dataSourceId") -/// .doit(); -/// # } -/// ``` -pub struct UserDataSourcePatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Fitness, - _request: DataSource, - _user_id: String, - _data_source_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for UserDataSourcePatchCall<'a, C, A> {} - -impl<'a, C, A> UserDataSourcePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, DataSource)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "fitness.users.dataSources.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("userId", self._user_id.to_string())); - params.push(("dataSourceId", self._data_source_id.to_string())); - for &field in ["alt", "userId", "dataSourceId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{userId}/dataSources/{dataSourceId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ActivityWrite.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userId}", "userId"), ("{dataSourceId}", "dataSourceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["dataSourceId", "userId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: DataSource) -> UserDataSourcePatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Update the data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time. - /// - /// Sets the *user id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_id(mut self, new_value: &str) -> UserDataSourcePatchCall<'a, C, A> { - self._user_id = new_value.to_string(); - self - } - /// The data stream ID of the data source to update. - /// - /// Sets the *data source id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn data_source_id(mut self, new_value: &str) -> UserDataSourcePatchCall<'a, C, A> { - self._data_source_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserDataSourcePatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> UserDataSourcePatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ActivityWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> UserDataSourcePatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Lists all data sources that are visible to the developer, using the OAuth scopes provided. The list is not exhaustive; the user may have private data sources that are only visible to other developers, or calls using other scopes. /// /// A builder for the *dataSources.list* method supported by a *user* resource. @@ -5008,7 +4661,7 @@ impl<'a, C, A> UserDataSourcePatchCall<'a, C, A> where C: BorrowMut UserDataSourceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5108,7 +4758,7 @@ impl<'a, C, A> UserDataSourceListCall<'a, C, A> where C: BorrowMut UserDataSourceListCall<'a, C, A> where C: BorrowMut StyleListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2035,7 +2032,7 @@ impl<'a, C, A> StyleListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2127,7 +2124,7 @@ impl<'a, C, A> StyleListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2278,10 +2275,7 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2313,7 +2307,7 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2413,7 +2407,7 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2562,10 +2556,7 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2597,7 +2588,7 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2687,7 +2678,7 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2831,10 +2822,7 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2854,7 +2842,7 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2942,7 +2930,7 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3085,10 +3073,7 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3108,7 +3093,7 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3186,7 +3171,7 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3337,10 +3322,7 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3372,7 +3354,7 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3472,7 +3454,7 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3629,10 +3611,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3652,7 +3631,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3751,7 +3730,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3894,10 +3873,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3917,7 +3893,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3995,7 +3971,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4139,10 +4115,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4162,7 +4135,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4250,7 +4223,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4399,10 +4372,7 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4434,7 +4404,7 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4524,7 +4494,7 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4675,10 +4645,7 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4710,7 +4677,7 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4810,7 +4777,7 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4962,10 +4929,7 @@ impl<'a, C, A> ColumnListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4985,7 +4949,7 @@ impl<'a, C, A> ColumnListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5077,7 +5041,7 @@ impl<'a, C, A> ColumnListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5228,10 +5192,7 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5263,7 +5224,7 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5363,7 +5324,7 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5506,10 +5467,7 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5529,7 +5487,7 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5607,7 +5565,7 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5751,10 +5709,7 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5774,7 +5729,7 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5862,7 +5817,7 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6013,10 +5968,7 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6048,7 +6000,7 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6148,7 +6100,7 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6300,10 +6252,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6323,7 +6272,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6415,7 +6364,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6558,10 +6507,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6581,7 +6527,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6659,7 +6605,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6808,10 +6754,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6843,7 +6786,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6933,7 +6876,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7084,10 +7027,7 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7119,7 +7059,7 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7219,7 +7159,7 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7363,10 +7303,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7386,7 +7323,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7474,7 +7411,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7629,10 +7566,7 @@ impl<'a, C, A> QuerySqlGetCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7652,7 +7586,7 @@ impl<'a, C, A> QuerySqlGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7747,7 +7681,7 @@ impl<'a, C, A> QuerySqlGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7906,10 +7840,7 @@ impl<'a, C, A> QuerySqlCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7929,7 +7860,7 @@ impl<'a, C, A> QuerySqlCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8028,7 +7959,7 @@ impl<'a, C, A> QuerySqlCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8182,10 +8113,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8217,7 +8145,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8314,7 +8242,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8456,10 +8384,7 @@ impl<'a, C, A> TableRefetchSheetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8479,7 +8404,7 @@ impl<'a, C, A> TableRefetchSheetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8557,7 +8482,7 @@ impl<'a, C, A> TableRefetchSheetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8734,10 +8659,7 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -8770,7 +8692,7 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -8969,7 +8891,7 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9123,10 +9045,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9158,7 +9077,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9255,7 +9174,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9396,10 +9315,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9419,7 +9335,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9487,7 +9403,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9613,10 +9529,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9648,7 +9561,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9728,7 +9641,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9870,10 +9783,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9893,7 +9803,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9971,7 +9881,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10100,10 +10010,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10123,7 +10030,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10205,7 +10112,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10382,10 +10289,7 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -10418,7 +10322,7 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -10617,7 +10521,7 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10758,10 +10662,7 @@ impl<'a, C, A> TableImportTableCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -10794,7 +10695,7 @@ impl<'a, C, A> TableImportTableCall<'a, C, A> where C: BorrowMut, }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -10972,7 +10873,7 @@ impl<'a, C, A> TableImportTableCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11119,10 +11020,7 @@ impl<'a, C, A> TableCopyCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11142,7 +11040,7 @@ impl<'a, C, A> TableCopyCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11227,7 +11125,7 @@ impl<'a, C, A> TableCopyCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/games1-cli/Cargo.toml b/gen/games1-cli/Cargo.toml index f5b57d0b66..48a7fb0ee3 100644 --- a/gen/games1-cli/Cargo.toml +++ b/gen/games1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-games1-cli" -version = "1.0.8+20181004" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/games1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-games1] path = "../games1" -version = "1.0.8+20181004" +version = "1.0.8+20190328" diff --git a/gen/games1-cli/README.md b/gen/games1-cli/README.md index b2a9a53de1..8525ab1195 100644 --- a/gen/games1-cli/README.md +++ b/gen/games1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Games* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *Games* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash games1 [options] diff --git a/gen/games1-cli/mkdocs.yml b/gen/games1-cli/mkdocs.yml index 7674ccab4d..b13ea3f795 100644 --- a/gen/games1-cli/mkdocs.yml +++ b/gen/games1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games v1.0.8+20181004 +site_name: Games v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-games1-cli site_description: A complete library to interact with Games (protocol v1) diff --git a/gen/games1-cli/src/main.rs b/gen/games1-cli/src/main.rs index 9e79702aa7..7618ae0758 100644 --- a/gen/games1-cli/src/main.rs +++ b/gen/games1-cli/src/main.rs @@ -5099,7 +5099,7 @@ fn main() { let mut app = App::new("games1") .author("Sebastian Thiel ") - .version("1.0.8+20181004") + .version("1.0.8+20190328") .about("The API for Google Play Game Services.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_games1_cli") .arg(Arg::with_name("url") diff --git a/gen/games1/Cargo.toml b/gen/games1/Cargo.toml index 2498c37240..4071923b09 100644 --- a/gen/games1/Cargo.toml +++ b/gen/games1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-games1" -version = "1.0.8+20181004" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/games1" homepage = "https://developers.google.com/games/services/" -documentation = "https://docs.rs/google-games1/1.0.8+20181004" +documentation = "https://docs.rs/google-games1/1.0.8+20190328" license = "MIT" keywords = ["games", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/games1/README.md b/gen/games1/README.md index 67661dd13b..4d1bcd5e64 100644 --- a/gen/games1/README.md +++ b/gen/games1/README.md @@ -5,44 +5,44 @@ DO NOT EDIT ! --> The `google-games1` library allows access to all features of the *Google Games* service. -This documentation was generated from *Games* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Games* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Games* *v1* API can be found at the [official documentation site](https://developers.google.com/games/services/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.Games.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.Games.html) ... -* [achievement definitions](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.AchievementDefinition.html) - * [*list*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.AchievementDefinitionListCall.html) +* [achievement definitions](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.AchievementDefinition.html) + * [*list*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.AchievementDefinitionListCall.html) * achievements - * [*increment*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.AchievementIncrementCall.html), [*list*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.AchievementListCall.html), [*reveal*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.AchievementRevealCall.html), [*set steps at least*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.AchievementSetStepsAtLeastCall.html), [*unlock*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.AchievementUnlockCall.html) and [*update multiple*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.AchievementUpdateMultipleCall.html) -* [applications](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.Application.html) - * [*get*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.ApplicationGetCall.html), [*played*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.ApplicationPlayedCall.html) and [*verify*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.ApplicationVerifyCall.html) + * [*increment*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.AchievementIncrementCall.html), [*list*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.AchievementListCall.html), [*reveal*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.AchievementRevealCall.html), [*set steps at least*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.AchievementSetStepsAtLeastCall.html), [*unlock*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.AchievementUnlockCall.html) and [*update multiple*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.AchievementUpdateMultipleCall.html) +* [applications](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.Application.html) + * [*get*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.ApplicationGetCall.html), [*played*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.ApplicationPlayedCall.html) and [*verify*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.ApplicationVerifyCall.html) * events - * [*list by player*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.EventListByPlayerCall.html), [*list definitions*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.EventListDefinitionCall.html) and [*record*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.EventRecordCall.html) -* [leaderboards](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.Leaderboard.html) - * [*get*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.LeaderboardGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.LeaderboardListCall.html) + * [*list by player*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.EventListByPlayerCall.html), [*list definitions*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.EventListDefinitionCall.html) and [*record*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.EventRecordCall.html) +* [leaderboards](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.Leaderboard.html) + * [*get*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.LeaderboardGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.LeaderboardListCall.html) * metagame - * [*get metagame config*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.MetagameGetMetagameConfigCall.html) and [*list categories by player*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.MetagameListCategoriesByPlayerCall.html) -* [players](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.Player.html) - * [*get*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.PlayerGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.PlayerListCall.html) + * [*get metagame config*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.MetagameGetMetagameConfigCall.html) and [*list categories by player*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.MetagameListCategoriesByPlayerCall.html) +* [players](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.Player.html) + * [*get*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.PlayerGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.PlayerListCall.html) * pushtokens - * [*remove*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.PushtokenRemoveCall.html) and [*update*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.PushtokenUpdateCall.html) -* [quest milestones](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.QuestMilestone.html) - * [*claim*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.QuestMilestoneClaimCall.html) -* [quests](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.Quest.html) - * [*accept*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.QuestAcceptCall.html) and [*list*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.QuestListCall.html) + * [*remove*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.PushtokenRemoveCall.html) and [*update*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.PushtokenUpdateCall.html) +* [quest milestones](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.QuestMilestone.html) + * [*claim*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.QuestMilestoneClaimCall.html) +* [quests](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.Quest.html) + * [*accept*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.QuestAcceptCall.html) and [*list*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.QuestListCall.html) * revisions - * [*check*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.RevisionCheckCall.html) -* [rooms](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.Room.html) - * [*create*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.RoomCreateCall.html), [*decline*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.RoomDeclineCall.html), [*dismiss*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.RoomDismisCall.html), [*get*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.RoomGetCall.html), [*join*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.RoomJoinCall.html), [*leave*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.RoomLeaveCall.html), [*list*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.RoomListCall.html) and [*report status*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.RoomReportStatuCall.html) + * [*check*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.RevisionCheckCall.html) +* [rooms](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.Room.html) + * [*create*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.RoomCreateCall.html), [*decline*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.RoomDeclineCall.html), [*dismiss*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.RoomDismisCall.html), [*get*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.RoomGetCall.html), [*join*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.RoomJoinCall.html), [*leave*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.RoomLeaveCall.html), [*list*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.RoomListCall.html) and [*report status*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.RoomReportStatuCall.html) * scores - * [*get*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.ScoreGetCall.html), [*list*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.ScoreListCall.html), [*list window*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.ScoreListWindowCall.html), [*submit*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.ScoreSubmitCall.html) and [*submit multiple*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.ScoreSubmitMultipleCall.html) -* [snapshots](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.Snapshot.html) - * [*get*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.SnapshotGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.SnapshotListCall.html) + * [*get*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.ScoreGetCall.html), [*list*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.ScoreListCall.html), [*list window*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.ScoreListWindowCall.html), [*submit*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.ScoreSubmitCall.html) and [*submit multiple*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.ScoreSubmitMultipleCall.html) +* [snapshots](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.Snapshot.html) + * [*get*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.SnapshotGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.SnapshotListCall.html) * turn based matches - * [*cancel*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheCancelCall.html), [*create*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheCreateCall.html), [*decline*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheDeclineCall.html), [*dismiss*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheDismisCall.html), [*finish*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheFinishCall.html), [*get*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheGetCall.html), [*join*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheJoinCall.html), [*leave*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheLeaveCall.html), [*leave turn*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheLeaveTurnCall.html), [*list*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheListCall.html), [*rematch*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheRematchCall.html), [*sync*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheSyncCall.html) and [*take turn*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.TurnBasedMatcheTakeTurnCall.html) + * [*cancel*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheCancelCall.html), [*create*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheCreateCall.html), [*decline*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheDeclineCall.html), [*dismiss*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheDismisCall.html), [*finish*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheFinishCall.html), [*get*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheGetCall.html), [*join*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheJoinCall.html), [*leave*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheLeaveCall.html), [*leave turn*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheLeaveTurnCall.html), [*list*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheListCall.html), [*rematch*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheRematchCall.html), [*sync*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheSyncCall.html) and [*take turn*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.TurnBasedMatcheTakeTurnCall.html) @@ -51,17 +51,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-games1/1.0.8+20181004/google_games1/struct.Games.html)** +* **[Hub](https://docs.rs/google-games1/1.0.8+20190328/google_games1/struct.Games.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.Part.html)** + * **[Parts](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -161,17 +161,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-games1/1.0.8+20181004/google_games1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-games1/1.0.8+20190328/google_games1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-games1/1.0.8+20181004/google_games1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-games1/1.0.8+20190328/google_games1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -181,29 +181,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-games1/1.0.8+20181004/google_games1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-games1/1.0.8+20190328/google_games1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/games1/src/lib.rs b/gen/games1/src/lib.rs index be3126d03b..bfb2be5df7 100644 --- a/gen/games1/src/lib.rs +++ b/gen/games1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Games* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Games* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Games* *v1* API can be found at the //! [official documentation site](https://developers.google.com/games/services/). @@ -262,12 +262,12 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// Know the list of people in your circles, your age range, and language - PluLogin, - - /// Share your Google+ profile information and view and manage your game activity + /// Create, edit, and delete your Google Play Games activity Full, + /// Know who you are on Google + PluMe, + /// View and manage its own configuration data in your Google Drive DriveAppdata, } @@ -275,8 +275,8 @@ pub enum Scope { impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { - Scope::PluLogin => "https://www.googleapis.com/auth/plus.login", Scope::Full => "https://www.googleapis.com/auth/games", + Scope::PluMe => "https://www.googleapis.com/auth/plus.me", Scope::DriveAppdata => "https://www.googleapis.com/auth/drive.appdata", } } @@ -4933,10 +4933,7 @@ impl<'a, C, A> AchievementListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4956,7 +4953,7 @@ impl<'a, C, A> AchievementListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5062,7 +5059,7 @@ impl<'a, C, A> AchievementListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5211,10 +5208,7 @@ impl<'a, C, A> AchievementIncrementCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5234,7 +5228,7 @@ impl<'a, C, A> AchievementIncrementCall<'a, C, A> where C: BorrowMut AchievementIncrementCall<'a, C, A> where C: BorrowMut AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5496,7 +5487,7 @@ impl<'a, C, A> AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut AchievementUpdateMultipleCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5750,7 +5738,7 @@ impl<'a, C, A> AchievementUpdateMultipleCall<'a, C, A> where C: BorrowMut AchievementUpdateMultipleCall<'a, C, A> where C: BorrowMut AchievementRevealCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6002,7 +5987,7 @@ impl<'a, C, A> AchievementRevealCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6080,7 +6065,7 @@ impl<'a, C, A> AchievementRevealCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6227,10 +6212,7 @@ impl<'a, C, A> AchievementUnlockCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6250,7 +6232,7 @@ impl<'a, C, A> AchievementUnlockCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6335,7 +6317,7 @@ impl<'a, C, A> AchievementUnlockCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6482,10 +6464,7 @@ impl<'a, C, A> LeaderboardGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6505,7 +6484,7 @@ impl<'a, C, A> LeaderboardGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6590,7 +6569,7 @@ impl<'a, C, A> LeaderboardGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6724,10 +6703,7 @@ impl<'a, C, A> LeaderboardListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6747,7 +6723,7 @@ impl<'a, C, A> LeaderboardListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6836,7 +6812,7 @@ impl<'a, C, A> LeaderboardListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6995,10 +6971,7 @@ impl<'a, C, A> MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7018,7 +6991,7 @@ impl<'a, C, A> MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut MetagameGetMetagameConfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7269,7 +7239,7 @@ impl<'a, C, A> MetagameGetMetagameConfigCall<'a, C, A> where C: BorrowMut MetagameGetMetagameConfigCall<'a, C, A> where C: BorrowMut PlayerListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7517,7 +7484,7 @@ impl<'a, C, A> PlayerListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7616,7 +7583,7 @@ impl<'a, C, A> PlayerListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7763,10 +7730,7 @@ impl<'a, C, A> PlayerGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7786,7 +7750,7 @@ impl<'a, C, A> PlayerGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7871,7 +7835,7 @@ impl<'a, C, A> PlayerGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8018,10 +7982,7 @@ impl<'a, C, A> QuestAcceptCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8041,7 +8002,7 @@ impl<'a, C, A> QuestAcceptCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8126,7 +8087,7 @@ impl<'a, C, A> QuestAcceptCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8283,10 +8244,7 @@ impl<'a, C, A> QuestListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8306,7 +8264,7 @@ impl<'a, C, A> QuestListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8405,7 +8363,7 @@ impl<'a, C, A> QuestListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8552,10 +8510,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8575,7 +8530,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8660,7 +8615,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8817,10 +8772,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8840,7 +8792,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8939,7 +8891,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9080,10 +9032,7 @@ impl<'a, C, A> TurnBasedMatcheDismisCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9103,7 +9052,7 @@ impl<'a, C, A> TurnBasedMatcheDismisCall<'a, C, A> where C: BorrowMut TurnBasedMatcheDismisCall<'a, C, A> where C: BorrowMut TurnBasedMatcheSyncCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9338,7 +9284,7 @@ impl<'a, C, A> TurnBasedMatcheSyncCall<'a, C, A> where C: BorrowMut TurnBasedMatcheSyncCall<'a, C, A> where C: BorrowMut TurnBasedMatcheDeclineCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9611,7 +9554,7 @@ impl<'a, C, A> TurnBasedMatcheDeclineCall<'a, C, A> where C: BorrowMut TurnBasedMatcheDeclineCall<'a, C, A> where C: BorrowMut TurnBasedMatcheGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9871,7 +9811,7 @@ impl<'a, C, A> TurnBasedMatcheGetCall<'a, C, A> where C: BorrowMut TurnBasedMatcheGetCall<'a, C, A> where C: BorrowMut TurnBasedMatcheCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10129,7 +10066,7 @@ impl<'a, C, A> TurnBasedMatcheCreateCall<'a, C, A> where C: BorrowMut TurnBasedMatcheCreateCall<'a, C, A> where C: BorrowMut TurnBasedMatcheJoinCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10386,7 +10320,7 @@ impl<'a, C, A> TurnBasedMatcheJoinCall<'a, C, A> where C: BorrowMut TurnBasedMatcheJoinCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10648,7 +10579,7 @@ impl<'a, C, A> TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10914,7 +10842,7 @@ impl<'a, C, A> TurnBasedMatcheCancelCall<'a, C, A> where C: BorrowMut TurnBasedMatcheCancelCall<'a, C, A> where C: BorrowMut TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11171,7 +11096,7 @@ impl<'a, C, A> TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11438,7 +11360,7 @@ impl<'a, C, A> TurnBasedMatcheLeaveCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveCall<'a, C, A> where C: BorrowMut TurnBasedMatcheListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11690,7 +11609,7 @@ impl<'a, C, A> TurnBasedMatcheListCall<'a, C, A> where C: BorrowMut TurnBasedMatcheListCall<'a, C, A> where C: BorrowMut TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11982,7 +11898,7 @@ impl<'a, C, A> TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12254,7 +12167,7 @@ impl<'a, C, A> TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut ApplicationVerifyCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12511,7 +12421,7 @@ impl<'a, C, A> ApplicationVerifyCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12589,7 +12499,7 @@ impl<'a, C, A> ApplicationVerifyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12741,10 +12651,7 @@ impl<'a, C, A> ApplicationGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12764,7 +12671,7 @@ impl<'a, C, A> ApplicationGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12856,7 +12763,7 @@ impl<'a, C, A> ApplicationGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12979,10 +12886,7 @@ impl<'a, C, A> ApplicationPlayedCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13002,7 +12906,7 @@ impl<'a, C, A> ApplicationPlayedCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13067,7 +12971,7 @@ impl<'a, C, A> ApplicationPlayedCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13214,10 +13118,7 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13237,7 +13138,7 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13322,7 +13223,7 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13476,10 +13377,7 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13511,7 +13409,7 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13608,7 +13506,7 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13742,10 +13640,7 @@ impl<'a, C, A> RoomListCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13765,7 +13660,7 @@ impl<'a, C, A> RoomListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13854,7 +13749,7 @@ impl<'a, C, A> RoomListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14008,10 +13903,7 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14043,7 +13935,7 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14140,7 +14032,7 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14271,10 +14163,7 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14306,7 +14195,7 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14393,7 +14282,7 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14540,10 +14429,7 @@ impl<'a, C, A> RoomDeclineCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14563,7 +14449,7 @@ impl<'a, C, A> RoomDeclineCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14648,7 +14534,7 @@ impl<'a, C, A> RoomDeclineCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14789,10 +14675,7 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14812,7 +14695,7 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14880,7 +14763,7 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15034,10 +14917,7 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15069,7 +14949,7 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15166,7 +15046,7 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15320,10 +15200,7 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15343,7 +15220,7 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15445,7 +15322,7 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15606,10 +15483,7 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15629,7 +15503,7 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15748,7 +15622,7 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15915,10 +15789,7 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15938,7 +15809,7 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16064,7 +15935,7 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16195,10 +16066,7 @@ impl<'a, C, A> ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16230,7 +16098,7 @@ impl<'a, C, A> ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut ScoreListWindowCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16511,7 +16376,7 @@ impl<'a, C, A> ScoreListWindowCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16644,7 +16509,7 @@ impl<'a, C, A> ScoreListWindowCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16769,10 +16634,7 @@ impl<'a, C, A> PushtokenRemoveCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16804,7 +16666,7 @@ impl<'a, C, A> PushtokenRemoveCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16874,7 +16736,7 @@ impl<'a, C, A> PushtokenRemoveCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16999,10 +16861,7 @@ impl<'a, C, A> PushtokenUpdateCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17034,7 +16893,7 @@ impl<'a, C, A> PushtokenUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17104,7 +16963,7 @@ impl<'a, C, A> PushtokenUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17225,10 +17084,7 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17248,7 +17104,7 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17331,7 +17187,7 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17465,10 +17321,7 @@ impl<'a, C, A> EventListDefinitionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17488,7 +17341,7 @@ impl<'a, C, A> EventListDefinitionCall<'a, C, A> where C: BorrowMut EventListDefinitionCall<'a, C, A> where C: BorrowMut EventRecordCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17743,7 +17593,7 @@ impl<'a, C, A> EventRecordCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17830,7 +17680,7 @@ impl<'a, C, A> EventRecordCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17964,10 +17814,7 @@ impl<'a, C, A> EventListByPlayerCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17987,7 +17834,7 @@ impl<'a, C, A> EventListByPlayerCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18076,7 +17923,7 @@ impl<'a, C, A> EventListByPlayerCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18221,10 +18068,7 @@ impl<'a, C, A> QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18244,7 +18088,7 @@ impl<'a, C, A> QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut AchievementDefinitionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18489,7 +18330,7 @@ impl<'a, C, A> AchievementDefinitionListCall<'a, C, A> where C: BorrowMut AchievementDefinitionListCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Games Configuration (protocol v1configuration)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesconfiguration1_configuration-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-gamesconfiguration1_configuration] path = "../gamesconfiguration1_configuration" -version = "1.0.8+20181004" +version = "1.0.8+20190328" diff --git a/gen/gamesconfiguration1_configuration-cli/README.md b/gen/gamesconfiguration1_configuration-cli/README.md index 99a777ae53..116908c35e 100644 --- a/gen/gamesconfiguration1_configuration-cli/README.md +++ b/gen/gamesconfiguration1_configuration-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Games Configuration* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *Games Configuration* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash gamesconfiguration1-configuration [options] diff --git a/gen/gamesconfiguration1_configuration-cli/mkdocs.yml b/gen/gamesconfiguration1_configuration-cli/mkdocs.yml index 191e9b0a49..b7ee3e06ce 100644 --- a/gen/gamesconfiguration1_configuration-cli/mkdocs.yml +++ b/gen/gamesconfiguration1_configuration-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games Configuration v1.0.8+20181004 +site_name: Games Configuration v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-gamesconfiguration1_configuration-cli site_description: A complete library to interact with Games Configuration (protocol v1configuration) diff --git a/gen/gamesconfiguration1_configuration-cli/src/main.rs b/gen/gamesconfiguration1_configuration-cli/src/main.rs index 739c419c67..accc96143f 100644 --- a/gen/gamesconfiguration1_configuration-cli/src/main.rs +++ b/gen/gamesconfiguration1_configuration-cli/src/main.rs @@ -1552,7 +1552,7 @@ fn main() { let mut app = App::new("gamesconfiguration1-configuration") .author("Sebastian Thiel ") - .version("1.0.8+20181004") + .version("1.0.8+20190328") .about("The Publishing API for Google Play Game Services.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli") .arg(Arg::with_name("url") diff --git a/gen/gamesconfiguration1_configuration/Cargo.toml b/gen/gamesconfiguration1_configuration/Cargo.toml index 6921300318..33a8c88757 100644 --- a/gen/gamesconfiguration1_configuration/Cargo.toml +++ b/gen/gamesconfiguration1_configuration/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-gamesconfiguration1_configuration" -version = "1.0.8+20181004" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games Configuration (protocol v1configuration)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesconfiguration1_configuration" homepage = "https://developers.google.com/games/services" -documentation = "https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004" +documentation = "https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328" license = "MIT" keywords = ["gamesConfiguration", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/gamesconfiguration1_configuration/README.md b/gen/gamesconfiguration1_configuration/README.md index 6e37c81eca..77d45e545b 100644 --- a/gen/gamesconfiguration1_configuration/README.md +++ b/gen/gamesconfiguration1_configuration/README.md @@ -5,25 +5,25 @@ DO NOT EDIT ! --> The `google-gamesconfiguration1_configuration` library allows access to all features of the *Google Games Configuration* service. -This documentation was generated from *Games Configuration* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Games Configuration* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Games Configuration* *v1_configuration* API can be found at the [official documentation site](https://developers.google.com/games/services). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.GamesConfiguration.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.GamesConfiguration.html) ... -* [achievement configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.AchievementConfiguration.html) - * [*delete*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.AchievementConfigurationDeleteCall.html), [*get*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.AchievementConfigurationGetCall.html), [*insert*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.AchievementConfigurationInsertCall.html), [*list*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.AchievementConfigurationListCall.html), [*patch*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.AchievementConfigurationPatchCall.html) and [*update*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.AchievementConfigurationUpdateCall.html) -* [image configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.ImageConfiguration.html) - * [*upload*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.ImageConfigurationUploadCall.html) -* [leaderboard configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.LeaderboardConfiguration.html) - * [*delete*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationDeleteCall.html), [*get*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationGetCall.html), [*insert*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationInsertCall.html), [*list*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationListCall.html), [*patch*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationPatchCall.html) and [*update*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationUpdateCall.html) +* [achievement configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.AchievementConfiguration.html) + * [*delete*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.AchievementConfigurationDeleteCall.html), [*get*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.AchievementConfigurationGetCall.html), [*insert*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.AchievementConfigurationInsertCall.html), [*list*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.AchievementConfigurationListCall.html), [*patch*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.AchievementConfigurationPatchCall.html) and [*update*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.AchievementConfigurationUpdateCall.html) +* [image configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.ImageConfiguration.html) + * [*upload*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.ImageConfigurationUploadCall.html) +* [leaderboard configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.LeaderboardConfiguration.html) + * [*delete*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationDeleteCall.html), [*get*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationGetCall.html), [*insert*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationInsertCall.html), [*list*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationListCall.html), [*patch*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationPatchCall.html) and [*update*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationUpdateCall.html) Upload supported by ... -* [*upload image configurations*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.ImageConfigurationUploadCall.html) +* [*upload image configurations*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.ImageConfigurationUploadCall.html) @@ -31,17 +31,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/struct.GamesConfiguration.html)** +* **[Hub](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/struct.GamesConfiguration.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.Part.html)** + * **[Parts](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -139,17 +139,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -159,29 +159,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.RequestValue.html) and -[decodable](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.RequestValue.html) and +[decodable](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20181004/google_gamesconfiguration1_configuration/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-gamesconfiguration1_configuration/1.0.8+20190328/google_gamesconfiguration1_configuration/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/gamesconfiguration1_configuration/src/lib.rs b/gen/gamesconfiguration1_configuration/src/lib.rs index 344f66fac9..d465c697c8 100644 --- a/gen/gamesconfiguration1_configuration/src/lib.rs +++ b/gen/gamesconfiguration1_configuration/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Games Configuration* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Games Configuration* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Games Configuration* *v1_configuration* API can be found at the //! [official documentation site](https://developers.google.com/games/services). @@ -1165,10 +1165,7 @@ impl<'a, C, A> ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -1201,7 +1198,7 @@ impl<'a, C, A> ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut AchievementConfigurationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1550,7 +1544,7 @@ impl<'a, C, A> AchievementConfigurationListCall<'a, C, A> where C: BorrowMut AchievementConfigurationListCall<'a, C, A> where C: BorrowMut AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1826,7 +1817,7 @@ impl<'a, C, A> AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2100,7 +2088,7 @@ impl<'a, C, A> AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut AchievementConfigurationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2355,7 +2340,7 @@ impl<'a, C, A> AchievementConfigurationGetCall<'a, C, A> where C: BorrowMut AchievementConfigurationGetCall<'a, C, A> where C: BorrowMut AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2617,7 +2599,7 @@ impl<'a, C, A> AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut AchievementConfigurationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2871,7 +2850,7 @@ impl<'a, C, A> AchievementConfigurationDeleteCall<'a, C, A> where C: BorrowMut AchievementConfigurationDeleteCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3123,7 +3099,7 @@ impl<'a, C, A> LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3378,7 +3351,7 @@ impl<'a, C, A> LeaderboardConfigurationGetCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationGetCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3640,7 +3610,7 @@ impl<'a, C, A> LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3914,7 +3881,7 @@ impl<'a, C, A> LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4179,7 +4143,7 @@ impl<'a, C, A> LeaderboardConfigurationListCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationListCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4435,7 +4396,7 @@ impl<'a, C, A> LeaderboardConfigurationDeleteCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationDeleteCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Games Management (protocol v1management)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesmanagement1_management-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-gamesmanagement1_management] path = "../gamesmanagement1_management" -version = "1.0.8+20181004" +version = "1.0.8+20190328" diff --git a/gen/gamesmanagement1_management-cli/README.md b/gen/gamesmanagement1_management-cli/README.md index 5bbb71b96d..4edfb0bf00 100644 --- a/gen/gamesmanagement1_management-cli/README.md +++ b/gen/gamesmanagement1_management-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Games Management* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *Games Management* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash gamesmanagement1-management [options] diff --git a/gen/gamesmanagement1_management-cli/mkdocs.yml b/gen/gamesmanagement1_management-cli/mkdocs.yml index 39b792e250..9e2475d73e 100644 --- a/gen/gamesmanagement1_management-cli/mkdocs.yml +++ b/gen/gamesmanagement1_management-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games Management v1.0.8+20181004 +site_name: Games Management v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-gamesmanagement1_management-cli site_description: A complete library to interact with Games Management (protocol v1management) diff --git a/gen/gamesmanagement1_management-cli/src/main.rs b/gen/gamesmanagement1_management-cli/src/main.rs index 5bc7b16f82..5093e78fa1 100644 --- a/gen/gamesmanagement1_management-cli/src/main.rs +++ b/gen/gamesmanagement1_management-cli/src/main.rs @@ -2079,7 +2079,7 @@ fn main() { let mut app = App::new("gamesmanagement1-management") .author("Sebastian Thiel ") - .version("1.0.8+20181004") + .version("1.0.8+20190328") .about("The Management API for Google Play Game Services.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli") .arg(Arg::with_name("url") diff --git a/gen/gamesmanagement1_management/Cargo.toml b/gen/gamesmanagement1_management/Cargo.toml index a447ec3fd1..33680583d3 100644 --- a/gen/gamesmanagement1_management/Cargo.toml +++ b/gen/gamesmanagement1_management/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-gamesmanagement1_management" -version = "1.0.8+20181004" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games Management (protocol v1management)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesmanagement1_management" homepage = "https://developers.google.com/games/services" -documentation = "https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004" +documentation = "https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328" license = "MIT" keywords = ["gamesManagement", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/gamesmanagement1_management/README.md b/gen/gamesmanagement1_management/README.md index 4a636f050a..b3e4ce5075 100644 --- a/gen/gamesmanagement1_management/README.md +++ b/gen/gamesmanagement1_management/README.md @@ -5,30 +5,30 @@ DO NOT EDIT ! --> The `google-gamesmanagement1_management` library allows access to all features of the *Google Games Management* service. -This documentation was generated from *Games Management* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Games Management* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Games Management* *v1_management* API can be found at the [official documentation site](https://developers.google.com/games/services). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.GamesManagement.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.GamesManagement.html) ... * achievements - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.AchievementResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.AchievementResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.AchievementResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.AchievementResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.AchievementResetMultipleForAllPlayerCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.AchievementResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.AchievementResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.AchievementResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.AchievementResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.AchievementResetMultipleForAllPlayerCall.html) * applications - * [*list hidden*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.ApplicationListHiddenCall.html) + * [*list hidden*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.ApplicationListHiddenCall.html) * events - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.EventResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.EventResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.EventResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.EventResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.EventResetMultipleForAllPlayerCall.html) -* [players](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.Player.html) - * [*hide*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.PlayerHideCall.html) and [*unhide*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.PlayerUnhideCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.EventResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.EventResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.EventResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.EventResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.EventResetMultipleForAllPlayerCall.html) +* [players](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.Player.html) + * [*hide*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.PlayerHideCall.html) and [*unhide*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.PlayerUnhideCall.html) * quests - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.QuestResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.QuestResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.QuestResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.QuestResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.QuestResetMultipleForAllPlayerCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.QuestResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.QuestResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.QuestResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.QuestResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.QuestResetMultipleForAllPlayerCall.html) * rooms - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.RoomResetCall.html) and [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.RoomResetForAllPlayerCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.RoomResetCall.html) and [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.RoomResetForAllPlayerCall.html) * scores - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.ScoreResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.ScoreResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.ScoreResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.ScoreResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.ScoreResetMultipleForAllPlayerCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.ScoreResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.ScoreResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.ScoreResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.ScoreResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.ScoreResetMultipleForAllPlayerCall.html) * turn based matches - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.TurnBasedMatcheResetCall.html) and [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.TurnBasedMatcheResetForAllPlayerCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.TurnBasedMatcheResetCall.html) and [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.TurnBasedMatcheResetForAllPlayerCall.html) @@ -37,17 +37,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/struct.GamesManagement.html)** +* **[Hub](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/struct.GamesManagement.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.Part.html)** + * **[Parts](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -139,17 +139,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -159,29 +159,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.RequestValue.html) and -[decodable](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.RequestValue.html) and +[decodable](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-gamesmanagement1_management/1.0.8+20181004/google_gamesmanagement1_management/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-gamesmanagement1_management/1.0.8+20190328/google_gamesmanagement1_management/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/gamesmanagement1_management/src/lib.rs b/gen/gamesmanagement1_management/src/lib.rs index b56a3561f3..cbbaa35951 100644 --- a/gen/gamesmanagement1_management/src/lib.rs +++ b/gen/gamesmanagement1_management/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Games Management* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Games Management* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Games Management* *v1_management* API can be found at the //! [official documentation site](https://developers.google.com/games/services). @@ -240,17 +240,13 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// Know the list of people in your circles, your age range, and language - PluLogin, - - /// Share your Google+ profile information and view and manage your game activity + /// Create, edit, and delete your Google Play Games activity Game, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { - Scope::PluLogin => "https://www.googleapis.com/auth/plus.login", Scope::Game => "https://www.googleapis.com/auth/games", } } @@ -1587,10 +1583,7 @@ impl<'a, C, A> AchievementResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut< } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1610,7 +1603,7 @@ impl<'a, C, A> AchievementResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1668,7 +1661,7 @@ impl<'a, C, A> AchievementResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1809,10 +1802,7 @@ impl<'a, C, A> AchievementResetForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1832,7 +1822,7 @@ impl<'a, C, A> AchievementResetForAllPlayerCall<'a, C, A> where C: BorrowMut AchievementResetForAllPlayerCall<'a, C, A> where C: BorrowMut AchievementResetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2065,7 +2052,7 @@ impl<'a, C, A> AchievementResetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2143,7 +2130,7 @@ impl<'a, C, A> AchievementResetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2268,10 +2255,7 @@ impl<'a, C, A> AchievementResetMultipleForAllPlayerCall<'a, C, A> where C: Borro } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2303,7 +2287,7 @@ impl<'a, C, A> AchievementResetMultipleForAllPlayerCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2373,7 +2357,7 @@ impl<'a, C, A> AchievementResetMultipleForAllPlayerCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2492,10 +2476,7 @@ impl<'a, C, A> AchievementResetAllCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2515,7 +2496,7 @@ impl<'a, C, A> AchievementResetAllCall<'a, C, A> where C: BorrowMut AchievementResetAllCall<'a, C, A> where C: BorrowMut PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2749,7 +2727,7 @@ impl<'a, C, A> PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2827,7 +2805,7 @@ impl<'a, C, A> PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2970,10 +2948,7 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2993,7 +2968,7 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3071,7 +3046,7 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3196,10 +3171,7 @@ impl<'a, C, A> ScoreResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3231,7 +3203,7 @@ impl<'a, C, A> ScoreResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3442,7 +3411,7 @@ impl<'a, C, A> ScoreResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetAllCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3642,7 +3608,7 @@ impl<'a, C, A> ScoreResetAllCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3710,7 +3676,7 @@ impl<'a, C, A> ScoreResetAllCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3851,10 +3817,7 @@ impl<'a, C, A> ScoreResetForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3874,7 +3837,7 @@ impl<'a, C, A> ScoreResetForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4107,7 +4067,7 @@ impl<'a, C, A> ScoreResetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4185,7 +4145,7 @@ impl<'a, C, A> ScoreResetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4303,10 +4263,7 @@ impl<'a, C, A> TurnBasedMatcheResetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4326,7 +4283,7 @@ impl<'a, C, A> TurnBasedMatcheResetCall<'a, C, A> where C: BorrowMut TurnBasedMatcheResetCall<'a, C, A> where C: BorrowMut TurnBasedMatcheResetForAllPlayerCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4525,7 +4479,7 @@ impl<'a, C, A> TurnBasedMatcheResetForAllPlayerCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4583,7 +4537,7 @@ impl<'a, C, A> TurnBasedMatcheResetForAllPlayerCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4735,10 +4689,7 @@ impl<'a, C, A> ApplicationListHiddenCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4758,7 +4709,7 @@ impl<'a, C, A> ApplicationListHiddenCall<'a, C, A> where C: BorrowMut ApplicationListHiddenCall<'a, C, A> where C: BorrowMut RoomResetForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4991,7 +4939,7 @@ impl<'a, C, A> RoomResetForAllPlayerCall<'a, C, A> where C: BorrowMut RoomResetForAllPlayerCall<'a, C, A> where C: BorrowMut RoomResetCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5190,7 +5135,7 @@ impl<'a, C, A> RoomResetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5248,7 +5193,7 @@ impl<'a, C, A> RoomResetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5366,10 +5311,7 @@ impl<'a, C, A> QuestResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5389,7 +5331,7 @@ impl<'a, C, A> QuestResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5607,7 +5546,7 @@ impl<'a, C, A> QuestResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetAllCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5818,7 +5754,7 @@ impl<'a, C, A> QuestResetAllCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5876,7 +5812,7 @@ impl<'a, C, A> QuestResetAllCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6017,10 +5953,7 @@ impl<'a, C, A> QuestResetForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6040,7 +5973,7 @@ impl<'a, C, A> QuestResetForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6272,7 +6202,7 @@ impl<'a, C, A> QuestResetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6340,7 +6270,7 @@ impl<'a, C, A> QuestResetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6458,10 +6388,7 @@ impl<'a, C, A> EventResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6481,7 +6408,7 @@ impl<'a, C, A> EventResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6703,7 +6627,7 @@ impl<'a, C, A> EventResetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6771,7 +6695,7 @@ impl<'a, C, A> EventResetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6889,10 +6813,7 @@ impl<'a, C, A> EventResetAllCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6912,7 +6833,7 @@ impl<'a, C, A> EventResetAllCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6970,7 +6891,7 @@ impl<'a, C, A> EventResetAllCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7095,10 +7016,7 @@ impl<'a, C, A> EventResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7130,7 +7048,7 @@ impl<'a, C, A> EventResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7364,7 +7279,7 @@ impl<'a, C, A> EventResetForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetForAllPlayerCall<'a, C, A> where C: BorrowMut PublisherListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1944,7 +1941,7 @@ impl<'a, C, A> PublisherListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2078,17 +2075,14 @@ impl<'a, C, A> PublisherGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -2182,7 +2176,7 @@ impl<'a, C, A> PublisherGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2318,10 +2312,7 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2340,7 +2331,7 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -2439,7 +2430,7 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2570,17 +2561,14 @@ impl<'a, C, A> LinkGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -2677,7 +2665,7 @@ impl<'a, C, A> LinkGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2877,17 +2865,14 @@ impl<'a, C, A> LinkListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -3068,7 +3053,7 @@ impl<'a, C, A> LinkListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3262,17 +3247,14 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -3450,7 +3432,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3589,17 +3571,14 @@ impl<'a, C, A> CcOfferListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -3691,7 +3670,7 @@ impl<'a, C, A> CcOfferListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3825,17 +3804,14 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -3929,7 +3905,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4093,17 +4069,14 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -4239,7 +4212,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4448,17 +4421,14 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -4657,7 +4627,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/genomics1-cli/Cargo.toml b/gen/genomics1-cli/Cargo.toml index d75ad32435..18e398c494 100644 --- a/gen/genomics1-cli/Cargo.toml +++ b/gen/genomics1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-genomics1-cli" -version = "1.0.8+20181010" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with genomics (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-genomics1] path = "../genomics1" -version = "1.0.8+20181010" +version = "1.0.8+20190402" diff --git a/gen/genomics1-cli/README.md b/gen/genomics1-cli/README.md index d2287bea34..c279675b32 100644 --- a/gen/genomics1-cli/README.md +++ b/gen/genomics1-cli/README.md @@ -25,75 +25,14 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *genomics* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *genomics* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash genomics1 [options] - annotations - batch-create (-r )... [-p ]... [-o ] - create (-r )... [-p ]... [-o ] - delete [-p ]... [-o ] - get [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - update (-r )... [-p ]... [-o ] - annotationsets - create (-r )... [-p ]... [-o ] - delete [-p ]... [-o ] - get [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - update (-r )... [-p ]... [-o ] - callsets - create (-r )... [-p ]... [-o ] - delete [-p ]... [-o ] - get [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - datasets - create (-r )... [-p ]... [-o ] - delete [-p ]... [-o ] - get [-p ]... [-o ] - get-iam-policy (-r )... [-p ]... [-o ] - list [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - set-iam-policy (-r )... [-p ]... [-o ] - test-iam-permissions (-r )... [-p ]... [-o ] - undelete (-r )... [-p ]... [-o ] operations cancel (-r )... [-p ]... [-o ] get [-p ]... [-o ] list [-p ]... [-o ] - readgroupsets - coveragebuckets-list [-p ]... [-o ] - delete [-p ]... [-o ] - export (-r )... [-p ]... [-o ] - get [-p ]... [-o ] - import (-r )... [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - reads - search (-r )... [-p ]... [-o ] - references - bases-list [-p ]... [-o ] - get [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - referencesets - get [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - variants - create (-r )... [-p ]... [-o ] - delete [-p ]... [-o ] - get [-p ]... [-o ] - import (-r )... [-p ]... [-o ] - merge (-r )... [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - variantsets - create (-r )... [-p ]... [-o ] - delete [-p ]... [-o ] - export (-r )... [-p ]... [-o ] - get [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - search (-r )... [-p ]... [-o ] genomics1 --help Configuration: diff --git a/gen/genomics1-cli/mkdocs.yml b/gen/genomics1-cli/mkdocs.yml index 0cf5e33a23..1a2fb015ea 100644 --- a/gen/genomics1-cli/mkdocs.yml +++ b/gen/genomics1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: genomics v1.0.8+20181010 +site_name: genomics v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-genomics1-cli site_description: A complete library to interact with genomics (protocol v1) @@ -9,60 +9,9 @@ site_dir: build_html pages: - ['index.md', 'Home'] -- ['annotations_batch-create.md', 'Annotations', 'Batch Create'] -- ['annotations_create.md', 'Annotations', 'Create'] -- ['annotations_delete.md', 'Annotations', 'Delete'] -- ['annotations_get.md', 'Annotations', 'Get'] -- ['annotations_search.md', 'Annotations', 'Search'] -- ['annotations_update.md', 'Annotations', 'Update'] -- ['annotationsets_create.md', 'Annotationsets', 'Create'] -- ['annotationsets_delete.md', 'Annotationsets', 'Delete'] -- ['annotationsets_get.md', 'Annotationsets', 'Get'] -- ['annotationsets_search.md', 'Annotationsets', 'Search'] -- ['annotationsets_update.md', 'Annotationsets', 'Update'] -- ['callsets_create.md', 'Callsets', 'Create'] -- ['callsets_delete.md', 'Callsets', 'Delete'] -- ['callsets_get.md', 'Callsets', 'Get'] -- ['callsets_patch.md', 'Callsets', 'Patch'] -- ['callsets_search.md', 'Callsets', 'Search'] -- ['datasets_create.md', 'Datasets', 'Create'] -- ['datasets_delete.md', 'Datasets', 'Delete'] -- ['datasets_get.md', 'Datasets', 'Get'] -- ['datasets_get-iam-policy.md', 'Datasets', 'Get Iam Policy'] -- ['datasets_list.md', 'Datasets', 'List'] -- ['datasets_patch.md', 'Datasets', 'Patch'] -- ['datasets_set-iam-policy.md', 'Datasets', 'Set Iam Policy'] -- ['datasets_test-iam-permissions.md', 'Datasets', 'Test Iam Permissions'] -- ['datasets_undelete.md', 'Datasets', 'Undelete'] - ['operations_cancel.md', 'Operations', 'Cancel'] - ['operations_get.md', 'Operations', 'Get'] - ['operations_list.md', 'Operations', 'List'] -- ['readgroupsets_coveragebuckets-list.md', 'Readgroupsets', 'Coveragebuckets List'] -- ['readgroupsets_delete.md', 'Readgroupsets', 'Delete'] -- ['readgroupsets_export.md', 'Readgroupsets', 'Export'] -- ['readgroupsets_get.md', 'Readgroupsets', 'Get'] -- ['readgroupsets_import.md', 'Readgroupsets', 'Import'] -- ['readgroupsets_patch.md', 'Readgroupsets', 'Patch'] -- ['readgroupsets_search.md', 'Readgroupsets', 'Search'] -- ['reads_search.md', 'Reads', 'Search'] -- ['references_bases-list.md', 'References', 'Bases List'] -- ['references_get.md', 'References', 'Get'] -- ['references_search.md', 'References', 'Search'] -- ['referencesets_get.md', 'Referencesets', 'Get'] -- ['referencesets_search.md', 'Referencesets', 'Search'] -- ['variants_create.md', 'Variants', 'Create'] -- ['variants_delete.md', 'Variants', 'Delete'] -- ['variants_get.md', 'Variants', 'Get'] -- ['variants_import.md', 'Variants', 'Import'] -- ['variants_merge.md', 'Variants', 'Merge'] -- ['variants_patch.md', 'Variants', 'Patch'] -- ['variants_search.md', 'Variants', 'Search'] -- ['variantsets_create.md', 'Variantsets', 'Create'] -- ['variantsets_delete.md', 'Variantsets', 'Delete'] -- ['variantsets_export.md', 'Variantsets', 'Export'] -- ['variantsets_get.md', 'Variantsets', 'Get'] -- ['variantsets_patch.md', 'Variantsets', 'Patch'] -- ['variantsets_search.md', 'Variantsets', 'Search'] theme: readthedocs diff --git a/gen/genomics1-cli/src/main.rs b/gen/genomics1-cli/src/main.rs index b303fec29e..915969fb9c 100644 --- a/gen/genomics1-cli/src/main.rs +++ b/gen/genomics1-cli/src/main.rs @@ -46,1931 +46,6 @@ struct Engine<'n> { impl<'n> Engine<'n> { - fn _annotations_batch_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "request-id" => Some(("requestId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["request-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::BatchCreateAnnotationsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotations().batch_create(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "reference-id" => Some(("referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.effect" => Some(("variant.effect", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.transcript-ids" => Some(("variant.transcriptIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "variant.alternate-bases" => Some(("variant.alternateBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.clinical-significance" => Some(("variant.clinicalSignificance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.type" => Some(("variant.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.gene-id" => Some(("variant.geneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "annotation-set-id" => Some(("annotationSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reverse-strand" => Some(("reverseStrand", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "transcript.coding-sequence.start" => Some(("transcript.codingSequence.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.coding-sequence.end" => Some(("transcript.codingSequence.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.gene-id" => Some(("transcript.geneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-bases", "annotation-set-id", "clinical-significance", "coding-sequence", "effect", "end", "gene-id", "id", "name", "reference-id", "reference-name", "reverse-strand", "start", "transcript", "transcript-ids", "type", "variant"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Annotation = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotations().create(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.annotations().delete(opt.value_of("annotation-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.annotations().get(opt.value_of("annotation-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "reference-id" => Some(("referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "annotation-set-ids" => Some(("annotationSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["annotation-set-ids", "end", "page-size", "page-token", "reference-id", "reference-name", "start"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchAnnotationsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotations().search(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "reference-id" => Some(("referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.effect" => Some(("variant.effect", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.transcript-ids" => Some(("variant.transcriptIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "variant.alternate-bases" => Some(("variant.alternateBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.clinical-significance" => Some(("variant.clinicalSignificance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.type" => Some(("variant.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.gene-id" => Some(("variant.geneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "annotation-set-id" => Some(("annotationSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reverse-strand" => Some(("reverseStrand", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "transcript.coding-sequence.start" => Some(("transcript.codingSequence.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.coding-sequence.end" => Some(("transcript.codingSequence.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.gene-id" => Some(("transcript.geneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-bases", "annotation-set-id", "clinical-significance", "coding-sequence", "effect", "end", "gene-id", "id", "name", "reference-id", "reference-name", "reverse-strand", "start", "transcript", "transcript-ids", "type", "variant"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Annotation = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotations().update(request, opt.value_of("annotation-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _annotationsets_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "source-uri" => Some(("sourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id", "name", "reference-set-id", "source-uri", "type"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::AnnotationSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotationsets().create(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _annotationsets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.annotationsets().delete(opt.value_of("annotation-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _annotationsets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.annotationsets().get(opt.value_of("annotation-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _annotationsets_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "dataset-ids" => Some(("datasetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "types" => Some(("types", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-ids", "name", "page-size", "page-token", "reference-set-id", "types"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchAnnotationSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotationsets().search(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _annotationsets_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "source-uri" => Some(("sourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id", "name", "reference-set-id", "source-uri", "type"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::AnnotationSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotationsets().update(request, opt.value_of("annotation-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _callsets_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "sample-id" => Some(("sampleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant-set-ids" => Some(("variantSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "created" => Some(("created", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["created", "id", "name", "sample-id", "variant-set-ids"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::CallSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.callsets().create(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _callsets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.callsets().delete(opt.value_of("call-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _callsets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.callsets().get(opt.value_of("call-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _callsets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "sample-id" => Some(("sampleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant-set-ids" => Some(("variantSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "created" => Some(("created", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["created", "id", "name", "sample-id", "variant-set-ids"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::CallSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.callsets().patch(request, opt.value_of("call-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _callsets_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant-set-ids" => Some(("variantSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["name", "page-size", "page-token", "variant-set-ids"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchCallSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.callsets().search(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "name", "project-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Dataset = json::value::from_value(object).unwrap(); - let mut call = self.hub.datasets().create(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.datasets().delete(opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.datasets().get(opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.datasets().get_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.datasets().list(); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "project-id" => { - call = call.project_id(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["project-id", "page-size", "page-token"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "id", "name", "project-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Dataset = json::value::from_value(object).unwrap(); - let mut call = self.hub.datasets().patch(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.datasets().set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.datasets().test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_undelete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::UndeleteDatasetRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.datasets().undelete(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -2169,2115 +244,11 @@ impl<'n> Engine<'n> { } } - fn _readgroupsets_coveragebuckets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.readgroupsets().coveragebuckets_list(opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "target-bucket-width" => { - call = call.target_bucket_width(value.unwrap_or("")); - }, - "start" => { - call = call.start(value.unwrap_or("")); - }, - "reference-name" => { - call = call.reference_name(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - "end" => { - call = call.end(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["end", "page-size", "page-token", "start", "target-bucket-width", "reference-name"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.readgroupsets().delete(opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_export(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-names" => Some(("referenceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "export-uri" => Some(("exportUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["export-uri", "project-id", "reference-names"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ExportReadGroupSetRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().export(request, opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.readgroupsets().get(opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_import(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "source-uris" => Some(("sourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "partition-strategy" => Some(("partitionStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "partition-strategy", "reference-set-id", "source-uris"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ImportReadGroupSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().import(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "filename" => Some(("filename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "filename", "id", "name", "reference-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ReadGroupSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().patch(request, opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-ids" => Some(("datasetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-ids", "name", "page-size", "page-token"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchReadGroupSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().search(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _reads_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "read-group-ids" => Some(("readGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "read-group-set-ids" => Some(("readGroupSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["end", "page-size", "page-token", "read-group-ids", "read-group-set-ids", "reference-name", "start"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchReadsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.reads().search(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _references_bases_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.references().bases_list(opt.value_of("reference-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "start" => { - call = call.start(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - "end" => { - call = call.end(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["start", "end", "page-size", "page-token"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _references_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.references().get(opt.value_of("reference-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _references_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "md5checksums" => Some(("md5checksums", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "accessions" => Some(("accessions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["accessions", "md5checksums", "page-size", "page-token", "reference-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchReferencesRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.references().search(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _referencesets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.referencesets().get(opt.value_of("reference-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _referencesets_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "md5checksums" => Some(("md5checksums", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "accessions" => Some(("accessions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "assembly-id" => Some(("assemblyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["accessions", "assembly-id", "md5checksums", "page-size", "page-token"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchReferenceSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.referencesets().search(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variants_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "variant-set-id" => Some(("variantSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "created" => Some(("created", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-bases" => Some(("referenceBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "names" => Some(("names", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "alternate-bases" => Some(("alternateBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "quality" => Some(("quality", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-bases", "created", "end", "filter", "id", "names", "quality", "reference-bases", "reference-name", "start", "variant-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Variant = json::value::from_value(object).unwrap(); - let mut call = self.hub.variants().create(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variants_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.variants().delete(opt.value_of("variant-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variants_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.variants().get(opt.value_of("variant-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variants_import(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "variant-set-id" => Some(("variantSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "source-uris" => Some(("sourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "info-merge-config" => Some(("infoMergeConfig", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "normalize-reference-names" => Some(("normalizeReferenceNames", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["format", "info-merge-config", "normalize-reference-names", "source-uris", "variant-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ImportVariantsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.variants().import(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variants_merge(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "variant-set-id" => Some(("variantSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "info-merge-config" => Some(("infoMergeConfig", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["info-merge-config", "variant-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::MergeVariantsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.variants().merge(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variants_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "variant-set-id" => Some(("variantSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "created" => Some(("created", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-bases" => Some(("referenceBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "names" => Some(("names", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "alternate-bases" => Some(("alternateBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "quality" => Some(("quality", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-bases", "created", "end", "filter", "id", "names", "quality", "reference-bases", "reference-name", "start", "variant-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Variant = json::value::from_value(object).unwrap(); - let mut call = self.hub.variants().patch(request, opt.value_of("variant-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variants_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "max-calls" => Some(("maxCalls", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant-set-ids" => Some(("variantSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "variant-name" => Some(("variantName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "call-set-ids" => Some(("callSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["call-set-ids", "end", "max-calls", "page-size", "page-token", "reference-name", "start", "variant-name", "variant-set-ids"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchVariantsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.variants().search(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "description", "id", "name", "reference-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::VariantSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.variantsets().create(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.variantsets().delete(opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_export(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "bigquery-dataset" => Some(("bigqueryDataset", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "bigquery-table" => Some(("bigqueryTable", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "call-set-ids" => Some(("callSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bigquery-dataset", "bigquery-table", "call-set-ids", "format", "project-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ExportVariantSetRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.variantsets().export(request, opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.variantsets().get(opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "description", "id", "name", "reference-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::VariantSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.variantsets().patch(request, opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "update-mask" => { - call = call.update_mask(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["update-mask"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-ids" => Some(("datasetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-ids", "page-size", "page-token"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchVariantSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.variantsets().search(request); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); let mut err_opt: Option = None; match self.opt.subcommand() { - ("annotations", Some(opt)) => { - match opt.subcommand() { - ("batch-create", Some(opt)) => { - call_result = self._annotations_batch_create(opt, dry_run, &mut err); - }, - ("create", Some(opt)) => { - call_result = self._annotations_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._annotations_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._annotations_get(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._annotations_search(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._annotations_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("annotations".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("annotationsets", Some(opt)) => { - match opt.subcommand() { - ("create", Some(opt)) => { - call_result = self._annotationsets_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._annotationsets_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._annotationsets_get(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._annotationsets_search(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._annotationsets_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("annotationsets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("callsets", Some(opt)) => { - match opt.subcommand() { - ("create", Some(opt)) => { - call_result = self._callsets_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._callsets_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._callsets_get(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._callsets_patch(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._callsets_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("callsets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("datasets", Some(opt)) => { - match opt.subcommand() { - ("create", Some(opt)) => { - call_result = self._datasets_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._datasets_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._datasets_get(opt, dry_run, &mut err); - }, - ("get-iam-policy", Some(opt)) => { - call_result = self._datasets_get_iam_policy(opt, dry_run, &mut err); - }, - ("list", Some(opt)) => { - call_result = self._datasets_list(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._datasets_patch(opt, dry_run, &mut err); - }, - ("set-iam-policy", Some(opt)) => { - call_result = self._datasets_set_iam_policy(opt, dry_run, &mut err); - }, - ("test-iam-permissions", Some(opt)) => { - call_result = self._datasets_test_iam_permissions(opt, dry_run, &mut err); - }, - ("undelete", Some(opt)) => { - call_result = self._datasets_undelete(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("datasets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, ("operations", Some(opt)) => { match opt.subcommand() { ("cancel", Some(opt)) => { @@ -4295,132 +266,6 @@ impl<'n> Engine<'n> { } } }, - ("readgroupsets", Some(opt)) => { - match opt.subcommand() { - ("coveragebuckets-list", Some(opt)) => { - call_result = self._readgroupsets_coveragebuckets_list(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._readgroupsets_delete(opt, dry_run, &mut err); - }, - ("export", Some(opt)) => { - call_result = self._readgroupsets_export(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._readgroupsets_get(opt, dry_run, &mut err); - }, - ("import", Some(opt)) => { - call_result = self._readgroupsets_import(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._readgroupsets_patch(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._readgroupsets_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("readgroupsets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("reads", Some(opt)) => { - match opt.subcommand() { - ("search", Some(opt)) => { - call_result = self._reads_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("reads".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("references", Some(opt)) => { - match opt.subcommand() { - ("bases-list", Some(opt)) => { - call_result = self._references_bases_list(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._references_get(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._references_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("references".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("referencesets", Some(opt)) => { - match opt.subcommand() { - ("get", Some(opt)) => { - call_result = self._referencesets_get(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._referencesets_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("referencesets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("variants", Some(opt)) => { - match opt.subcommand() { - ("create", Some(opt)) => { - call_result = self._variants_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._variants_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._variants_get(opt, dry_run, &mut err); - }, - ("import", Some(opt)) => { - call_result = self._variants_import(opt, dry_run, &mut err); - }, - ("merge", Some(opt)) => { - call_result = self._variants_merge(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._variants_patch(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._variants_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("variants".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("variantsets", Some(opt)) => { - match opt.subcommand() { - ("create", Some(opt)) => { - call_result = self._variantsets_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._variantsets_delete(opt, dry_run, &mut err); - }, - ("export", Some(opt)) => { - call_result = self._variantsets_export(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._variantsets_get(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._variantsets_patch(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._variantsets_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("variantsets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, _ => { err.issues.push(CLIError::MissingCommandError); writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); @@ -4506,697 +351,6 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("annotations", "methods: 'batch-create', 'create', 'delete', 'get', 'search' and 'update'", vec![ - ("batch-create", - Some(r##"Creates one or more new annotations atomically. All annotations must - belong to the same annotation set. Caller must have WRITE - permission for this annotation set. For optimal performance, batch - positionally adjacent annotations together. - - If the request has a systemic issue, such as an attempt to write to - an inaccessible annotation set, the entire RPC will fail accordingly. For - lesser data issues, when possible an error will be isolated to the - corresponding batch entry in the response; the remaining well formed - annotations will be created normally. - - For details on the requirements for each individual annotation resource, - see - CreateAnnotation."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotations_batch-create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("create", - Some(r##"Creates a new annotation. Caller must have WRITE permission - for the associated annotation set. - - The following fields are required: - - * annotationSetId - * referenceName or - referenceId - - ### Transcripts - - For annotations of type TRANSCRIPT, the following fields of - transcript must be provided: - - * exons.start - * exons.end - - All other fields may be optionally specified, unless documented as being - server-generated (for example, the `id` field). The annotated - range must be no longer than 100Mbp (mega base pairs). See the - Annotation resource - for additional restrictions on each field."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotations_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes an annotation. Caller must have WRITE permission for - the associated annotation set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotations_delete", - vec![ - (Some(r##"annotation-id"##), - None, - Some(r##"The ID of the annotation to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets an annotation. Caller must have READ permission - for the associated annotation set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotations_get", - vec![ - (Some(r##"annotation-id"##), - None, - Some(r##"The ID of the annotation to be retrieved."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Searches for annotations that match the given criteria. Results are - ordered by genomic coordinate (by reference sequence, then position). - Annotations with equivalent genomic coordinates are returned in an - unspecified order. This order is consistent, such that two queries for the - same content (regardless of page size) yield annotations in the same order - across their respective streams of paginated responses. Caller must have - READ permission for the queried annotation sets."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotations_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - Some(r##"Updates an annotation. Caller must have - WRITE permission for the associated dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotations_update", - vec![ - (Some(r##"annotation-id"##), - None, - Some(r##"The ID of the annotation to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("annotationsets", "methods: 'create', 'delete', 'get', 'search' and 'update'", vec![ - ("create", - Some(r##"Creates a new annotation set. Caller must have WRITE permission for the - associated dataset. - - The following fields are required: - - * datasetId - * referenceSetId - - All other fields may be optionally specified, unless documented as being - server-generated (for example, the `id` field)."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotationsets_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes an annotation set. Caller must have WRITE permission - for the associated annotation set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotationsets_delete", - vec![ - (Some(r##"annotation-set-id"##), - None, - Some(r##"The ID of the annotation set to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets an annotation set. Caller must have READ permission for - the associated dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotationsets_get", - vec![ - (Some(r##"annotation-set-id"##), - None, - Some(r##"The ID of the annotation set to be retrieved."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Searches for annotation sets that match the given criteria. Annotation sets - are returned in an unspecified order. This order is consistent, such that - two queries for the same content (regardless of page size) yield annotation - sets in the same order across their respective streams of paginated - responses. Caller must have READ permission for the queried datasets."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotationsets_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - Some(r##"Updates an annotation set. The update must respect all mutability - restrictions and other invariants described on the annotation set resource. - Caller must have WRITE permission for the associated dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/annotationsets_update", - vec![ - (Some(r##"annotation-set-id"##), - None, - Some(r##"The ID of the annotation set to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("callsets", "methods: 'create', 'delete', 'get', 'patch' and 'search'", vec![ - ("create", - Some(r##"Creates a new call set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/callsets_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes a call set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/callsets_delete", - vec![ - (Some(r##"call-set-id"##), - None, - Some(r##"The ID of the call set to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets a call set by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/callsets_get", - vec![ - (Some(r##"call-set-id"##), - None, - Some(r##"The ID of the call set."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Updates a call set. - - This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/callsets_patch", - vec![ - (Some(r##"call-set-id"##), - None, - Some(r##"The ID of the call set to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Gets a list of call sets matching the criteria. - - Implements - [GlobalAllianceApi.searchCallSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L178)."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/callsets_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("datasets", "methods: 'create', 'delete', 'get', 'get-iam-policy', 'list', 'patch', 'set-iam-policy', 'test-iam-permissions' and 'undelete'", vec![ - ("create", - Some(r##"Creates a new dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes a dataset and all of its contents (all read group sets, - reference sets, variant sets, call sets, annotation sets, etc.) - This is reversible (up to one week after the deletion) via - the - datasets.undelete - operation."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_delete", - vec![ - (Some(r##"dataset-id"##), - None, - Some(r##"The ID of the dataset to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets a dataset by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_get", - vec![ - (Some(r##"dataset-id"##), - None, - Some(r##"The ID of the dataset."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get-iam-policy", - Some(r##"Gets the access control policy for the dataset. This is empty if the - policy or resource does not exist. - - See Getting a - Policy for more information."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_get-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which policy is being specified. Format is - `datasets/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("list", - Some(r##"Lists datasets within a project."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_list", - vec![ - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Updates a dataset. - - This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_patch", - vec![ - (Some(r##"dataset-id"##), - None, - Some(r##"The ID of the dataset to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("set-iam-policy", - Some(r##"Sets the access control policy on the specified dataset. Replaces any - existing policy. - - See Setting a - Policy for more information."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_set-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which policy is being specified. Format is - `datasets/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("test-iam-permissions", - Some(r##"Returns permissions that a caller has on the specified resource. - See Testing - Permissions for more information."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_test-iam-permissions", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which policy is being specified. Format is - `datasets/`."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("undelete", - Some(r##"Undeletes a dataset by restoring a dataset which was deleted via this API. - - This operation is only possible for a week after the deletion occurred."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_undelete", - vec![ - (Some(r##"dataset-id"##), - None, - Some(r##"The ID of the dataset to be undeleted."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - ("operations", "methods: 'cancel', 'get' and 'list'", vec![ ("cancel", Some(r##"Starts asynchronous cancellation on a long-running operation. @@ -5288,814 +442,12 @@ fn main() { ]), ]), - ("readgroupsets", "methods: 'coveragebuckets-list', 'delete', 'export', 'get', 'import', 'patch' and 'search'", vec![ - ("coveragebuckets-list", - Some(r##"Lists fixed width coverage buckets for a read group set, each of which - correspond to a range of a reference sequence. Each bucket summarizes - coverage information across its corresponding genomic range. - - Coverage is defined as the number of reads which are aligned to a given - base in the reference sequence. Coverage buckets are available at several - precomputed bucket widths, enabling retrieval of various coverage 'zoom - levels'. The caller must have READ permissions for the target read group - set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_coveragebuckets-list", - vec![ - (Some(r##"read-group-set-id"##), - None, - Some(r##"Required. The ID of the read group set over which coverage is requested."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes a read group set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_delete", - vec![ - (Some(r##"read-group-set-id"##), - None, - Some(r##"The ID of the read group set to be deleted. The caller must have WRITE - permissions to the dataset associated with this read group set."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("export", - Some(r##"Exports a read group set to a BAM file in Google Cloud Storage. - - Note that currently there may be some differences between exported BAM - files and the original BAM file at the time of import. See - ImportReadGroupSets - for caveats."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_export", - vec![ - (Some(r##"read-group-set-id"##), - None, - Some(r##"Required. The ID of the read group set to export. The caller must have - READ access to this read group set."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets a read group set by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_get", - vec![ - (Some(r##"read-group-set-id"##), - None, - Some(r##"The ID of the read group set."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("import", - Some(r##"Creates read group sets by asynchronously importing the provided - information. - - The caller must have WRITE permissions to the dataset. - - ## Notes on [BAM](https://samtools.github.io/hts-specs/SAMv1.pdf) import - - - Tags will be converted to strings - tag types are not preserved - - Comments (`@CO`) in the input file header will not be preserved - - Original header order of references (`@SQ`) will not be preserved - - Any reverse stranded unmapped reads will be reverse complemented, and - their qualities (also the "BQ" and "OQ" tags, if any) will be reversed - - Unmapped reads will be stripped of positional information (reference name - and position)"##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_import", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Updates a read group set. - - This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_patch", - vec![ - (Some(r##"read-group-set-id"##), - None, - Some(r##"The ID of the read group set to be updated. The caller must have WRITE - permissions to the dataset associated with this read group set."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Searches for read group sets matching the criteria. - - Implements - [GlobalAllianceApi.searchReadGroupSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L135)."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("reads", "methods: 'search'", vec![ - ("search", - Some(r##"Gets a list of reads for one or more read group sets. - - Reads search operates over a genomic coordinate space of reference sequence - & position defined over the reference sequences to which the requested - read group sets are aligned. - - If a target positional range is specified, search returns all reads whose - alignment to the reference genome overlap the range. A query which - specifies only read group set IDs yields all reads in those read group - sets, including unmapped reads. - - All reads returned (including reads on subsequent pages) are ordered by - genomic coordinate (by reference sequence, then position). Reads with - equivalent genomic coordinates are returned in an unspecified order. This - order is consistent, such that two queries for the same content (regardless - of page size) yield reads in the same order across their respective streams - of paginated responses. - - Implements - [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85)."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/reads_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("references", "methods: 'bases-list', 'get' and 'search'", vec![ - ("bases-list", - Some(r##"Lists the bases in a reference, optionally restricted to a range. - - Implements - [GlobalAllianceApi.getReferenceBases](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L221)."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/references_bases-list", - vec![ - (Some(r##"reference-id"##), - None, - Some(r##"The ID of the reference."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets a reference. - - Implements - [GlobalAllianceApi.getReference](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L158)."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/references_get", - vec![ - (Some(r##"reference-id"##), - None, - Some(r##"The ID of the reference."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Searches for references which match the given criteria. - - Implements - [GlobalAllianceApi.searchReferences](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L146)."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/references_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("referencesets", "methods: 'get' and 'search'", vec![ - ("get", - Some(r##"Gets a reference set. - - Implements - [GlobalAllianceApi.getReferenceSet](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L83)."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/referencesets_get", - vec![ - (Some(r##"reference-set-id"##), - None, - Some(r##"The ID of the reference set."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Searches for reference sets which match the given criteria. - - Implements - [GlobalAllianceApi.searchReferenceSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L71)"##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/referencesets_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("variants", "methods: 'create', 'delete', 'get', 'import', 'merge', 'patch' and 'search'", vec![ - ("create", - Some(r##"Creates a new variant."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes a variant."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_delete", - vec![ - (Some(r##"variant-id"##), - None, - Some(r##"The ID of the variant to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets a variant by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_get", - vec![ - (Some(r##"variant-id"##), - None, - Some(r##"The ID of the variant."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("import", - Some(r##"Creates variant data by asynchronously importing the provided information. - - The variants for import will be merged with any existing variant that - matches its reference sequence, start, end, reference bases, and - alternative bases. If no such variant exists, a new one will be created. - - When variants are merged, the call information from the new variant - is added to the existing variant, and Variant info fields are merged - as specified in - infoMergeConfig. - As a special case, for single-sample VCF files, QUAL and FILTER fields will - be moved to the call level; these are sometimes interpreted in a - call-specific context. - Imported VCF headers are appended to the metadata already in a variant set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_import", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("merge", - Some(r##"Merges the given variants with existing variants. - - Each variant will be - merged with an existing variant that matches its reference sequence, - start, end, reference bases, and alternative bases. If no such variant - exists, a new one will be created. - - When variants are merged, the call information from the new variant - is added to the existing variant. Variant info fields are merged as - specified in the - infoMergeConfig - field of the MergeVariantsRequest. - - Please exercise caution when using this method! It is easy to introduce - mistakes in existing variants and difficult to back out of them. For - example, - suppose you were trying to merge a new variant with an existing one and - both - variants contain calls that belong to callsets with the same callset ID. - - // Existing variant - irrelevant fields trimmed for clarity - { - "variantSetId": "10473108253681171589", - "referenceName": "1", - "start": "10582", - "referenceBases": "G", - "alternateBases": [ - "A" - ], - "calls": [ - { - "callSetId": "10473108253681171589-0", - "callSetName": "CALLSET0", - "genotype": [ - 0, - 1 - ], - } - ] - } - - // New variant with conflicting call information - { - "variantSetId": "10473108253681171589", - "referenceName": "1", - "start": "10582", - "referenceBases": "G", - "alternateBases": [ - "A" - ], - "calls": [ - { - "callSetId": "10473108253681171589-0", - "callSetName": "CALLSET0", - "genotype": [ - 1, - 1 - ], - } - ] - } - - The resulting merged variant would overwrite the existing calls with those - from the new variant: - - { - "variantSetId": "10473108253681171589", - "referenceName": "1", - "start": "10582", - "referenceBases": "G", - "alternateBases": [ - "A" - ], - "calls": [ - { - "callSetId": "10473108253681171589-0", - "callSetName": "CALLSET0", - "genotype": [ - 1, - 1 - ], - } - ] - } - - This may be the desired outcome, but it is up to the user to determine if - if that is indeed the case."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_merge", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Updates a variant. - - This method supports patch semantics. Returns the modified variant without - its calls."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_patch", - vec![ - (Some(r##"variant-id"##), - None, - Some(r##"The ID of the variant to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Gets a list of variants matching the criteria. - - Implements - [GlobalAllianceApi.searchVariants](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L126)."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("variantsets", "methods: 'create', 'delete', 'export', 'get', 'patch' and 'search'", vec![ - ("create", - Some(r##"Creates a new variant set. - - The provided variant set must have a valid `datasetId` set - all other - fields are optional. Note that the `id` field will be ignored, as this is - assigned by the server."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes a variant set including all variants, call sets, and calls within. - This is not reversible."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_delete", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"The ID of the variant set to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("export", - Some(r##"Exports variant set data to an external destination."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_export", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"Required. The ID of the variant set that contains variant data which - should be exported. The caller must have READ access to this variant set."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets a variant set by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_get", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"Required. The ID of the variant set."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Updates a variant set using patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_patch", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"The ID of the variant to be updated (must already exist)."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Returns a list of all variant sets matching search criteria. - - Implements - [GlobalAllianceApi.searchVariantSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L49)."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - ]; let mut app = App::new("genomics1") .author("Sebastian Thiel ") - .version("1.0.8+20181010") - .about("Upload, process, query, and search Genomics data in the cloud.") + .version("1.0.8+20190402") + .about("Uploads, processes, queries, and searches Genomics data in the cloud.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_genomics1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/genomics1/Cargo.toml b/gen/genomics1/Cargo.toml index 0597b90c78..b225cb1ec0 100644 --- a/gen/genomics1/Cargo.toml +++ b/gen/genomics1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-genomics1" -version = "1.0.8+20181010" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with genomics (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1" homepage = "https://cloud.google.com/genomics" -documentation = "https://docs.rs/google-genomics1/1.0.8+20181010" +documentation = "https://docs.rs/google-genomics1/1.0.8+20190402" license = "MIT" keywords = ["genomics", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/genomics1/README.md b/gen/genomics1/README.md index 251137bf42..b1c6147fa3 100644 --- a/gen/genomics1/README.md +++ b/gen/genomics1/README.md @@ -5,36 +5,16 @@ DO NOT EDIT ! --> The `google-genomics1` library allows access to all features of the *Google genomics* service. -This documentation was generated from *genomics* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *genomics* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *genomics* *v1* API can be found at the [official documentation site](https://cloud.google.com/genomics). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.Genomics.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/struct.Genomics.html) ... -* [annotations](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.Annotation.html) - * [*batch create*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationBatchCreateCall.html), [*create*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationGetCall.html), [*search*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationSearchCall.html) and [*update*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationUpdateCall.html) -* annotationsets - * [*create*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationsetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationsetDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationsetGetCall.html), [*search*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationsetSearchCall.html) and [*update*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.AnnotationsetUpdateCall.html) -* callsets - * [*create*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.CallsetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.CallsetDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.CallsetGetCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.CallsetPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.CallsetSearchCall.html) -* [datasets](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.Dataset.html) - * [*create*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.DatasetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.DatasetDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.DatasetGetCall.html), [*get iam policy*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.DatasetGetIamPolicyCall.html), [*list*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.DatasetListCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.DatasetPatchCall.html), [*set iam policy*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.DatasetSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.DatasetTestIamPermissionCall.html) and [*undelete*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.DatasetUndeleteCall.html) -* [operations](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.Operation.html) - * [*cancel*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.OperationCancelCall.html), [*get*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.OperationListCall.html) -* readgroupsets - * [*coveragebuckets list*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReadgroupsetCoveragebucketListCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReadgroupsetDeleteCall.html), [*export*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReadgroupsetExportCall.html), [*get*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReadgroupsetGetCall.html), [*import*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReadgroupsetImportCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReadgroupsetPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReadgroupsetSearchCall.html) -* [reads](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.Read.html) - * [*search*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReadSearchCall.html) -* [references](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.Reference.html) - * [*bases list*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReferenceBaseListCall.html), [*get*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReferenceGetCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReferenceSearchCall.html) -* referencesets - * [*get*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReferencesetGetCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.ReferencesetSearchCall.html) -* [variants](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.Variant.html) - * [*create*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantGetCall.html), [*import*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantImportCall.html), [*merge*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantMergeCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantSearchCall.html) -* variantsets - * [*create*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantsetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantsetDeleteCall.html), [*export*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantsetExportCall.html), [*get*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantsetGetCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantsetPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.VariantsetSearchCall.html) +* [operations](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/struct.Operation.html) + * [*cancel*](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/struct.OperationCancelCall.html), [*get*](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/struct.OperationListCall.html) @@ -43,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/struct.Genomics.html)** +* **[Hub](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/struct.Genomics.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.Part.html)** + * **[Parts](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -67,15 +47,9 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.datasets().set_iam_policy(...).doit() -let r = hub.datasets().delete(...).doit() -let r = hub.datasets().get_iam_policy(...).doit() -let r = hub.datasets().test_iam_permissions(...).doit() -let r = hub.datasets().get(...).doit() -let r = hub.datasets().undelete(...).doit() -let r = hub.datasets().create(...).doit() -let r = hub.datasets().patch(...).doit() -let r = hub.datasets().list(...).doit() +let r = hub.operations().list(...).doit() +let r = hub.operations().get(...).doit() +let r = hub.operations().cancel(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -109,7 +83,6 @@ extern crate hyper; extern crate hyper_rustls; extern crate yup_oauth2 as oauth2; extern crate google_genomics1 as genomics1; -use genomics1::Dataset; use genomics1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -127,16 +100,13 @@ let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), ::default(), None); let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -// As the method needs a request, you would usually fill it with the desired information -// into the respective structure. Some of the parts shown here might not be applicable ! -// Values shown here are possibly random and not representative ! -let mut req = Dataset::default(); - // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.datasets().patch(req, "datasetId") - .update_mask("sit") +let result = hub.operations().list("name") + .page_token("sit") + .page_size(-65) + .filter("sed") .doit(); match result { @@ -159,17 +129,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -179,29 +149,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-genomics1/1.0.8+20181010/google_genomics1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-genomics1/1.0.8+20190402/google_genomics1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/genomics1/src/lib.rs b/gen/genomics1/src/lib.rs index b1e3e57f60..f5c698374e 100644 --- a/gen/genomics1/src/lib.rs +++ b/gen/genomics1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *genomics* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *genomics* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *genomics* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/genomics). @@ -11,28 +11,8 @@ //! //! Handle the following *Resources* with ease from the central [hub](struct.Genomics.html) ... //! -//! * [annotations](struct.Annotation.html) -//! * [*batch create*](struct.AnnotationBatchCreateCall.html), [*create*](struct.AnnotationCreateCall.html), [*delete*](struct.AnnotationDeleteCall.html), [*get*](struct.AnnotationGetCall.html), [*search*](struct.AnnotationSearchCall.html) and [*update*](struct.AnnotationUpdateCall.html) -//! * annotationsets -//! * [*create*](struct.AnnotationsetCreateCall.html), [*delete*](struct.AnnotationsetDeleteCall.html), [*get*](struct.AnnotationsetGetCall.html), [*search*](struct.AnnotationsetSearchCall.html) and [*update*](struct.AnnotationsetUpdateCall.html) -//! * callsets -//! * [*create*](struct.CallsetCreateCall.html), [*delete*](struct.CallsetDeleteCall.html), [*get*](struct.CallsetGetCall.html), [*patch*](struct.CallsetPatchCall.html) and [*search*](struct.CallsetSearchCall.html) -//! * [datasets](struct.Dataset.html) -//! * [*create*](struct.DatasetCreateCall.html), [*delete*](struct.DatasetDeleteCall.html), [*get*](struct.DatasetGetCall.html), [*get iam policy*](struct.DatasetGetIamPolicyCall.html), [*list*](struct.DatasetListCall.html), [*patch*](struct.DatasetPatchCall.html), [*set iam policy*](struct.DatasetSetIamPolicyCall.html), [*test iam permissions*](struct.DatasetTestIamPermissionCall.html) and [*undelete*](struct.DatasetUndeleteCall.html) //! * [operations](struct.Operation.html) //! * [*cancel*](struct.OperationCancelCall.html), [*get*](struct.OperationGetCall.html) and [*list*](struct.OperationListCall.html) -//! * readgroupsets -//! * [*coveragebuckets list*](struct.ReadgroupsetCoveragebucketListCall.html), [*delete*](struct.ReadgroupsetDeleteCall.html), [*export*](struct.ReadgroupsetExportCall.html), [*get*](struct.ReadgroupsetGetCall.html), [*import*](struct.ReadgroupsetImportCall.html), [*patch*](struct.ReadgroupsetPatchCall.html) and [*search*](struct.ReadgroupsetSearchCall.html) -//! * [reads](struct.Read.html) -//! * [*search*](struct.ReadSearchCall.html) -//! * [references](struct.Reference.html) -//! * [*bases list*](struct.ReferenceBaseListCall.html), [*get*](struct.ReferenceGetCall.html) and [*search*](struct.ReferenceSearchCall.html) -//! * referencesets -//! * [*get*](struct.ReferencesetGetCall.html) and [*search*](struct.ReferencesetSearchCall.html) -//! * [variants](struct.Variant.html) -//! * [*create*](struct.VariantCreateCall.html), [*delete*](struct.VariantDeleteCall.html), [*get*](struct.VariantGetCall.html), [*import*](struct.VariantImportCall.html), [*merge*](struct.VariantMergeCall.html), [*patch*](struct.VariantPatchCall.html) and [*search*](struct.VariantSearchCall.html) -//! * variantsets -//! * [*create*](struct.VariantsetCreateCall.html), [*delete*](struct.VariantsetDeleteCall.html), [*export*](struct.VariantsetExportCall.html), [*get*](struct.VariantsetGetCall.html), [*patch*](struct.VariantsetPatchCall.html) and [*search*](struct.VariantsetSearchCall.html) //! //! //! @@ -67,15 +47,9 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.datasets().set_iam_policy(...).doit() -//! let r = hub.datasets().delete(...).doit() -//! let r = hub.datasets().get_iam_policy(...).doit() -//! let r = hub.datasets().test_iam_permissions(...).doit() -//! let r = hub.datasets().get(...).doit() -//! let r = hub.datasets().undelete(...).doit() -//! let r = hub.datasets().create(...).doit() -//! let r = hub.datasets().patch(...).doit() -//! let r = hub.datasets().list(...).doit() +//! let r = hub.operations().list(...).doit() +//! let r = hub.operations().get(...).doit() +//! let r = hub.operations().cancel(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -109,7 +83,6 @@ //! extern crate hyper_rustls; //! extern crate yup_oauth2 as oauth2; //! extern crate google_genomics1 as genomics1; -//! use genomics1::Dataset; //! use genomics1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -128,16 +101,13 @@ //! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), //! ::default(), None); //! let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -//! // As the method needs a request, you would usually fill it with the desired information -//! // into the respective structure. Some of the parts shown here might not be applicable ! -//! // Values shown here are possibly random and not representative ! -//! let mut req = Dataset::default(); -//! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.datasets().patch(req, "datasetId") -//! .update_mask("sed") +//! let result = hub.operations().list("name") +//! .page_token("dolores") +//! .page_size(-63) +//! .filter("accusam") //! .doit(); //! //! match result { @@ -263,34 +233,22 @@ pub enum Scope { /// View and manage Genomics data Full, - /// View Genomics data - Readonly, - /// View and manage your data across Google Cloud Platform services CloudPlatform, - - /// View and manage your data in Google BigQuery - Bigquery, - - /// Manage your data in Google Cloud Storage - DevstorageReadWrite, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { Scope::Full => "https://www.googleapis.com/auth/genomics", - Scope::Readonly => "https://www.googleapis.com/auth/genomics.readonly", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", - Scope::Bigquery => "https://www.googleapis.com/auth/bigquery", - Scope::DevstorageReadWrite => "https://www.googleapis.com/auth/devstorage.read_write", } } } impl Default for Scope { fn default() -> Scope { - Scope::Readonly + Scope::Full } } @@ -311,7 +269,6 @@ impl Default for Scope { /// extern crate hyper_rustls; /// extern crate yup_oauth2 as oauth2; /// extern crate google_genomics1 as genomics1; -/// use genomics1::Dataset; /// use genomics1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -330,16 +287,13 @@ impl Default for Scope { /// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// ::default(), None); /// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Dataset::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.datasets().patch(req, "datasetId") -/// .update_mask("dolores") +/// let result = hub.operations().list("name") +/// .page_token("justo") +/// .page_size(-1) +/// .filter("erat") /// .doit(); /// /// match result { @@ -383,39 +337,9 @@ impl<'a, C, A> Genomics } } - pub fn annotations(&'a self) -> AnnotationMethods<'a, C, A> { - AnnotationMethods { hub: &self } - } - pub fn annotationsets(&'a self) -> AnnotationsetMethods<'a, C, A> { - AnnotationsetMethods { hub: &self } - } - pub fn callsets(&'a self) -> CallsetMethods<'a, C, A> { - CallsetMethods { hub: &self } - } - pub fn datasets(&'a self) -> DatasetMethods<'a, C, A> { - DatasetMethods { hub: &self } - } pub fn operations(&'a self) -> OperationMethods<'a, C, A> { OperationMethods { hub: &self } } - pub fn readgroupsets(&'a self) -> ReadgroupsetMethods<'a, C, A> { - ReadgroupsetMethods { hub: &self } - } - pub fn reads(&'a self) -> ReadMethods<'a, C, A> { - ReadMethods { hub: &self } - } - pub fn references(&'a self) -> ReferenceMethods<'a, C, A> { - ReferenceMethods { hub: &self } - } - pub fn referencesets(&'a self) -> ReferencesetMethods<'a, C, A> { - ReferencesetMethods { hub: &self } - } - pub fn variants(&'a self) -> VariantMethods<'a, C, A> { - VariantMethods { hub: &self } - } - pub fn variantsets(&'a self) -> VariantsetMethods<'a, C, A> { - VariantsetMethods { hub: &self } - } /// Set the user-agent header field to use in all requests to the server. /// It defaults to `google-api-rust-client/1.0.8`. @@ -446,195 +370,6 @@ impl<'a, C, A> Genomics // ############ // SCHEMAS ### // ########## -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ClinicalCondition { - /// The set of external IDs for this condition. - #[serde(rename="externalIds")] - pub external_ids: Option>, - /// The OMIM id for this condition. - /// Search for these IDs at http://omim.org/ - #[serde(rename="omimId")] - pub omim_id: Option, - /// The MedGen concept id associated with this gene. - /// Search for these IDs at http://www.ncbi.nlm.nih.gov/medgen/ - #[serde(rename="conceptId")] - pub concept_id: Option, - /// A set of names for the condition. - pub names: Option>, -} - -impl Part for ClinicalCondition {} - - -/// The search variant sets request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search variantsets](struct.VariantsetSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchVariantSetsRequest { - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// Exactly one dataset ID must be provided here. Only variant sets which - /// belong to this dataset will be returned. - #[serde(rename="datasetIds")] - pub dataset_ids: Option>, - /// The maximum number of results to return in a single page. If unspecified, - /// defaults to 1024. - #[serde(rename="pageSize")] - pub page_size: Option, -} - -impl RequestValue for SearchVariantSetsRequest {} - - -/// The read group set export request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [export readgroupsets](struct.ReadgroupsetExportCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExportReadGroupSetRequest { - /// Required. The Google Cloud project ID that owns this - /// export. The caller must have WRITE access to this project. - #[serde(rename="projectId")] - pub project_id: Option, - /// The reference names to export. If this is not specified, all reference - /// sequences, including unmapped reads, are exported. - /// Use `*` to export only unmapped reads. - #[serde(rename="referenceNames")] - pub reference_names: Option>, - /// Required. A Google Cloud Storage URI for the exported BAM file. - /// The currently authenticated user must have write access to the new file. - /// An error will be returned if the URI already contains data. - #[serde(rename="exportUri")] - pub export_uri: Option, -} - -impl RequestValue for ExportReadGroupSetRequest {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Program { - /// The ID of the program run before this one. - #[serde(rename="prevProgramId")] - pub prev_program_id: Option, - /// The command line used to run this program. - #[serde(rename="commandLine")] - pub command_line: Option, - /// The version of the program run. - pub version: Option, - /// The user specified locally unique ID of the program. Used along with - /// `prevProgramId` to define an ordering between programs. - pub id: Option, - /// The display name of the program. This is typically the colloquial name of - /// the tool used, for example 'bwa' or 'picard'. - pub name: Option, -} - -impl Part for Program {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VariantAnnotation { - /// Google annotation IDs of the transcripts affected by this variant. These - /// should be provided when the variant is created. - #[serde(rename="transcriptIds")] - pub transcript_ids: Option>, - /// The alternate allele for this variant. If multiple alternate alleles - /// exist at this location, create a separate variant for each one, as they - /// may represent distinct conditions. - #[serde(rename="alternateBases")] - pub alternate_bases: Option, - /// Describes the clinical significance of a variant. - /// It is adapted from the ClinVar controlled vocabulary for clinical - /// significance described at: - /// http://www.ncbi.nlm.nih.gov/clinvar/docs/clinsig/ - #[serde(rename="clinicalSignificance")] - pub clinical_significance: Option, - /// The set of conditions associated with this variant. - /// A condition describes the way a variant influences human health. - pub conditions: Option>, - /// Type has been adapted from ClinVar's list of variant types. - #[serde(rename="type")] - pub type_: Option, - /// Effect of the variant on the coding sequence. - pub effect: Option, - /// Google annotation ID of the gene affected by this variant. This should - /// be provided when the variant is created. - #[serde(rename="geneId")] - pub gene_id: Option, -} - -impl Part for VariantAnnotation {} - - -/// The variant data import request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [import variants](struct.VariantImportCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImportVariantsRequest { - /// Required. The variant set to which variant data should be imported. - #[serde(rename="variantSetId")] - pub variant_set_id: Option, - /// Convert reference names to the canonical representation. - /// hg19 haploytypes (those reference names containing "_hap") - /// are not modified in any way. - /// All other reference names are modified according to the following rules: - /// The reference name is capitalized. - /// The "chr" prefix is dropped for all autosomes and sex chromsomes. - /// For example "chr17" becomes "17" and "chrX" becomes "X". - /// All mitochondrial chromosomes ("chrM", "chrMT", etc) become "MT". - #[serde(rename="normalizeReferenceNames")] - pub normalize_reference_names: Option, - /// A list of URIs referencing variant files in Google Cloud Storage. URIs can - /// include wildcards [as described - /// here](https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames). - /// Note that recursive wildcards ('**') are not supported. - #[serde(rename="sourceUris")] - pub source_uris: Option>, - /// A mapping between info field keys and the InfoMergeOperations to - /// be performed on them. This is plumbed down to the MergeVariantRequests - /// generated by the resulting import job. - #[serde(rename="infoMergeConfig")] - pub info_merge_config: Option>, - /// The format of the variant data being imported. If unspecified, defaults to - /// to `VCF`. - pub format: Option, -} - -impl RequestValue for ImportVariantsRequest {} - - /// A generic empty message that you can re-use to avoid defining duplicated /// empty messages in your APIs. A typical example is to use it as the request /// or the response type of an API method. For instance: @@ -650,15 +385,7 @@ impl RequestValue for ImportVariantsRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [delete datasets](struct.DatasetDeleteCall.html) (response) /// * [cancel operations](struct.OperationCancelCall.html) (response) -/// * [delete readgroupsets](struct.ReadgroupsetDeleteCall.html) (response) -/// * [delete annotations](struct.AnnotationDeleteCall.html) (response) -/// * [delete callsets](struct.CallsetDeleteCall.html) (response) -/// * [delete variantsets](struct.VariantsetDeleteCall.html) (response) -/// * [delete variants](struct.VariantDeleteCall.html) (response) -/// * [merge variants](struct.VariantMergeCall.html) (response) -/// * [delete annotationsets](struct.AnnotationsetDeleteCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Empty { _never_set: Option } @@ -666,17 +393,17 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -737,1647 +464,6 @@ pub struct Status { impl Part for Status {} -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [coveragebuckets list readgroupsets](struct.ReadgroupsetCoveragebucketListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListCoverageBucketsResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The coverage buckets. The list of buckets is sparse; a bucket with 0 - /// overlapping reads is not returned. A bucket never crosses more than one - /// reference sequence. Each bucket has width `bucketWidth`, unless - /// its end is the end of the reference sequence. - #[serde(rename="coverageBuckets")] - pub coverage_buckets: Option>, - /// The length of each coverage bucket in base pairs. Note that buckets at the - /// end of a reference sequence may be shorter. This value is omitted if the - /// bucket width is infinity (the default behaviour, with no range or - /// `targetBucketWidth`). - #[serde(rename="bucketWidth")] - pub bucket_width: Option, -} - -impl ResponseResult for ListCoverageBucketsResponse {} - - -/// Response message for `TestIamPermissions` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [test iam permissions datasets](struct.DatasetTestIamPermissionCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TestIamPermissionsResponse { - /// A subset of `TestPermissionsRequest.permissions` that the caller is - /// allowed. - pub permissions: Option>, -} - -impl ResponseResult for TestIamPermissionsResponse {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search annotations](struct.AnnotationSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchAnnotationsResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The matching annotations. - pub annotations: Option>, -} - -impl ResponseResult for SearchAnnotationsResponse {} - - -/// A transcript represents the assertion that a particular region of the -/// reference genome may be transcribed as RNA. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Transcript { - /// The range of the coding sequence for this transcript, if any. To determine - /// the exact ranges of coding sequence, intersect this range with those of the - /// exons, if any. If there are any - /// exons, the - /// codingSequence must start - /// and end within them. - /// - /// Note that in some cases, the reference genome will not exactly match the - /// observed mRNA transcript e.g. due to variance in the source genome from - /// reference. In these cases, - /// exon.frame will not necessarily - /// match the expected reference reading frame and coding exon reference bases - /// cannot necessarily be concatenated to produce the original transcript mRNA. - #[serde(rename="codingSequence")] - pub coding_sequence: Option, - /// The exons that compose - /// this transcript. This field should be unset for genomes where transcript - /// splicing does not occur, for example prokaryotes. - /// - /// Introns are regions of the transcript that are not included in the - /// spliced RNA product. Though not explicitly modeled here, intron ranges can - /// be deduced; all regions of this transcript that are not exons are introns. - /// - /// Exonic sequences do not necessarily code for a translational product - /// (amino acids). Only the regions of exons bounded by the - /// codingSequence correspond - /// to coding DNA sequence. - /// - /// Exons are ordered by start position and may not overlap. - pub exons: Option>, - /// The annotation ID of the gene from which this transcript is transcribed. - #[serde(rename="geneId")] - pub gene_id: Option, -} - -impl Part for Transcript {} - - -/// An annotation describes a region of reference genome. The value of an -/// annotation may be one of several canonical types, supplemented by arbitrary -/// info tags. An annotation is not inherently associated with a specific -/// sample or individual (though a client could choose to use annotations in -/// this way). Example canonical annotation types are `GENE` and -/// `VARIANT`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search annotations](struct.AnnotationSearchCall.html) (none) -/// * [create annotations](struct.AnnotationCreateCall.html) (request|response) -/// * [delete annotations](struct.AnnotationDeleteCall.html) (none) -/// * [update annotations](struct.AnnotationUpdateCall.html) (request|response) -/// * [get annotations](struct.AnnotationGetCall.html) (response) -/// * [batch create annotations](struct.AnnotationBatchCreateCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Annotation { - /// A map of additional read alignment information. This must be of the form - /// map (string key mapping to a list of string values). - pub info: Option>>, - /// The ID of the Google Genomics reference associated with this range. - #[serde(rename="referenceId")] - pub reference_id: Option, - /// The end position of the range on the reference, 0-based exclusive. - pub end: Option, - /// The display name of this annotation. - pub name: Option, - /// A transcript value represents the assertion that a particular region of - /// the reference genome may be transcribed as RNA. An alternative splicing - /// pattern would be represented as a separate transcript object. This field - /// is only set for annotations of type `TRANSCRIPT`. - pub transcript: Option, - /// A variant annotation, which describes the effect of a variant on the - /// genome, the coding sequence, and/or higher level consequences at the - /// organism level e.g. pathogenicity. This field is only set for annotations - /// of type `VARIANT`. - pub variant: Option, - /// The start position of the range on the reference, 0-based inclusive. - pub start: Option, - /// The annotation set to which this annotation belongs. - #[serde(rename="annotationSetId")] - pub annotation_set_id: Option, - /// The display name corresponding to the reference specified by - /// `referenceId`, for example `chr1`, `1`, or `chrX`. - #[serde(rename="referenceName")] - pub reference_name: Option, - /// Whether this range refers to the reverse strand, as opposed to the forward - /// strand. Note that regardless of this field, the start/end position of the - /// range always refer to the forward strand. - #[serde(rename="reverseStrand")] - pub reverse_strand: Option, - /// The data type for this annotation. Must match the containing annotation - /// set's type. - #[serde(rename="type")] - pub type_: Option, - /// The server-generated annotation ID, unique across all annotations. - pub id: Option, -} - -impl RequestValue for Annotation {} -impl Resource for Annotation {} -impl ResponseResult for Annotation {} - - -/// Request message for `GetIamPolicy` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get iam policy datasets](struct.DatasetGetIamPolicyCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetIamPolicyRequest { _never_set: Option } - -impl RequestValue for GetIamPolicyRequest {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [merge variants](struct.VariantMergeCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MergeVariantsRequest { - /// The destination variant set. - #[serde(rename="variantSetId")] - pub variant_set_id: Option, - /// The variants to be merged with existing variants. - pub variants: Option>, - /// A mapping between info field keys and the InfoMergeOperations to - /// be performed on them. - #[serde(rename="infoMergeConfig")] - pub info_merge_config: Option>, -} - -impl RequestValue for MergeVariantsRequest {} - - -/// Metadata describes a single piece of variant call metadata. -/// These data include a top level key and either a single value string (value) -/// or a list of key-value pairs (info.) -/// Value and info are mutually exclusive. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VariantSetMetadata { - /// Remaining structured metadata key-value pairs. This must be of the form - /// map (string key mapping to a list of string values). - pub info: Option>>, - /// A textual description of this metadata. - pub description: Option, - /// The top-level key. - pub key: Option, - /// The type of data. Possible types include: Integer, Float, - /// Flag, Character, and String. - #[serde(rename="type")] - pub type_: Option, - /// The number of values that can be included in a field described by this - /// metadata. - pub number: Option, - /// The value field for simple metadata - pub value: Option, - /// User-provided ID field, not enforced by this API. - /// Two or more pieces of structured metadata with identical - /// id and key fields are considered equivalent. - pub id: Option, -} - -impl Part for VariantSetMetadata {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExternalId { - /// The name of the source of this data. - #[serde(rename="sourceName")] - pub source_name: Option, - /// The id used by the source of this data. - pub id: Option, -} - -impl Part for ExternalId {} - - -/// A call set is a collection of variant calls, typically for one sample. It -/// belongs to a variant set. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [create callsets](struct.CallsetCreateCall.html) (request|response) -/// * [patch callsets](struct.CallsetPatchCall.html) (request|response) -/// * [get callsets](struct.CallsetGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CallSet { - /// A map of additional call set information. This must be of the form - /// map (string key mapping to a list of string values). - pub info: Option>>, - /// The IDs of the variant sets this call set belongs to. This field must - /// have exactly length one, as a call set belongs to a single variant set. - /// This field is repeated for compatibility with the - /// [GA4GH 0.5.1 - /// API](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variants.avdl#L76). - #[serde(rename="variantSetIds")] - pub variant_set_ids: Option>, - /// The call set name. - pub name: Option, - /// The date this call set was created in milliseconds from the epoch. - pub created: Option, - /// The sample ID this call set corresponds to. - #[serde(rename="sampleId")] - pub sample_id: Option, - /// The server-generated call set ID, unique across all call sets. - pub id: Option, -} - -impl RequestValue for CallSet {} -impl Resource for CallSet {} -impl ResponseResult for CallSet {} - - -/// An abstraction for referring to a genomic position, in relation to some -/// already known reference. For now, represents a genomic position as a -/// reference name, a base number on that reference (0-based), and a -/// determination of forward or reverse strand. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Position { - /// The 0-based offset from the start of the forward strand for that reference. - pub position: Option, - /// Whether this position is on the reverse strand, as opposed to the forward - /// strand. - #[serde(rename="reverseStrand")] - pub reverse_strand: Option, - /// The name of the reference in whatever reference set is being used. - #[serde(rename="referenceName")] - pub reference_name: Option, -} - -impl Part for Position {} - - -/// The call set search request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search callsets](struct.CallsetSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchCallSetsRequest { - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// Restrict the query to call sets within the given variant sets. At least one - /// ID must be provided. - #[serde(rename="variantSetIds")] - pub variant_set_ids: Option>, - /// Only return call sets for which a substring of the name matches this - /// string. - pub name: Option, - /// The maximum number of results to return in a single page. If unspecified, - /// defaults to 1024. - #[serde(rename="pageSize")] - pub page_size: Option, -} - -impl RequestValue for SearchCallSetsRequest {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search annotations](struct.AnnotationSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchAnnotationsRequest { - /// The start position of the range on the reference, 0-based inclusive. If - /// specified, - /// referenceId or - /// referenceName - /// must be specified. Defaults to 0. - pub start: Option, - /// The ID of the reference to query. - #[serde(rename="referenceId")] - pub reference_id: Option, - /// The end position of the range on the reference, 0-based exclusive. If - /// referenceId or - /// referenceName - /// must be specified, Defaults to the length of the reference. - pub end: Option, - /// The maximum number of results to return in a single page. If unspecified, - /// defaults to 256. The maximum value is 2048. - #[serde(rename="pageSize")] - pub page_size: Option, - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// The name of the reference to query, within the reference set associated - /// with this query. - #[serde(rename="referenceName")] - pub reference_name: Option, - /// Required. The annotation sets to search within. The caller must have - /// `READ` access to these annotation sets. - /// All queried annotation sets must have the same type. - #[serde(rename="annotationSetIds")] - pub annotation_set_ids: Option>, -} - -impl RequestValue for SearchAnnotationsRequest {} - - -/// The dataset list response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list datasets](struct.DatasetListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListDatasetsResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching Datasets. - pub datasets: Option>, -} - -impl ResponseResult for ListDatasetsResponse {} - - -/// The read group set import request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [import readgroupsets](struct.ReadgroupsetImportCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImportReadGroupSetsRequest { - /// A list of URIs pointing at [BAM - /// files](https://samtools.github.io/hts-specs/SAMv1.pdf) - /// in Google Cloud Storage. - /// Those URIs can include wildcards (*), but do not add or remove - /// matching files before import has completed. - /// - /// Note that Google Cloud Storage object listing is only eventually - /// consistent: files added may be not be immediately visible to - /// everyone. Thus, if using a wildcard it is preferable not to start - /// the import immediately after the files are created. - #[serde(rename="sourceUris")] - pub source_uris: Option>, - /// The reference set to which the imported read group sets are aligned to, if - /// any. The reference names of this reference set must be a superset of those - /// found in the imported file headers. If no reference set id is provided, a - /// best effort is made to associate with a matching reference set. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// The partition strategy describes how read groups are partitioned into read - /// group sets. - #[serde(rename="partitionStrategy")] - pub partition_strategy: Option, - /// Required. The ID of the dataset these read group sets will belong to. The - /// caller must have WRITE permissions to this dataset. - #[serde(rename="datasetId")] - pub dataset_id: Option, -} - -impl RequestValue for ImportReadGroupSetsRequest {} - - -/// A reference is a canonical assembled DNA sequence, intended to act as a -/// reference coordinate space for other genomic annotations. A single reference -/// might represent the human chromosome 1 or mitochandrial DNA, for instance. A -/// reference belongs to one or more reference sets. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [bases list references](struct.ReferenceBaseListCall.html) (none) -/// * [search references](struct.ReferenceSearchCall.html) (none) -/// * [get references](struct.ReferenceGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Reference { - /// The length of this reference's sequence. - pub length: Option, - /// The name of this reference, for example `22`. - pub name: Option, - /// The URI from which the sequence was obtained. Typically specifies a FASTA - /// format file. - #[serde(rename="sourceUri")] - pub source_uri: Option, - /// ID from http://www.ncbi.nlm.nih.gov/taxonomy. For example, 9606 for human. - #[serde(rename="ncbiTaxonId")] - pub ncbi_taxon_id: Option, - /// All known corresponding accession IDs in INSDC (GenBank/ENA/DDBJ) ideally - /// with a version number, for example `GCF_000001405.26`. - #[serde(rename="sourceAccessions")] - pub source_accessions: Option>, - /// The server-generated reference ID, unique across all references. - pub id: Option, - /// MD5 of the upper-case sequence excluding all whitespace characters (this - /// is equivalent to SQ:M5 in SAM). This value is represented in lower case - /// hexadecimal format. - pub md5checksum: Option, -} - -impl Resource for Reference {} -impl ResponseResult for Reference {} - - -/// Associates `members` with a `role`. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Binding { - /// Role that is assigned to `members`. - /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. - pub role: Option, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. - /// `members` can have the following values: - /// - /// * `allUsers`: A special identifier that represents anyone who is - /// on the internet; with or without a Google account. - /// - /// * `allAuthenticatedUsers`: A special identifier that represents anyone - /// who is authenticated with a Google account or a service account. - /// - /// * `user:{emailid}`: An email address that represents a specific Google - /// account. For example, `alice@gmail.com` . - /// - /// - /// * `serviceAccount:{emailid}`: An email address that represents a service - /// account. For example, `my-other-app@appspot.gserviceaccount.com`. - /// - /// * `group:{emailid}`: An email address that represents a Google group. - /// For example, `admins@example.com`. - /// - /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the - /// users of that domain. For example, `google.com` or `example.com`. - /// - /// - pub members: Option>, -} - -impl Part for Binding {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search references](struct.ReferenceSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReferencesRequest { - /// If present, return references for which the - /// md5checksum matches exactly. - pub md5checksums: Option>, - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// If present, return only references which belong to this reference set. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// If present, return references for which a prefix of any of - /// sourceAccessions match - /// any of these strings. Accession numbers typically have a main number and a - /// version, for example `GCF_000001405.26`. - pub accessions: Option>, - /// The maximum number of results to return in a single page. If unspecified, - /// defaults to 1024. The maximum value is 4096. - #[serde(rename="pageSize")] - pub page_size: Option, -} - -impl RequestValue for SearchReferencesRequest {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Experiment { - /// The sequencing center used as part of this experiment. - #[serde(rename="sequencingCenter")] - pub sequencing_center: Option, - /// A client-supplied library identifier; a library is a collection of DNA - /// fragments which have been prepared for sequencing from a sample. This - /// field is important for quality control as error or bias can be introduced - /// during sample preparation. - #[serde(rename="libraryId")] - pub library_id: Option, - /// The instrument model used as part of this experiment. This maps to - /// sequencing technology in the SAM spec. - #[serde(rename="instrumentModel")] - pub instrument_model: Option, - /// The platform unit used as part of this experiment, for example - /// flowcell-barcode.lane for Illumina or slide for SOLiD. Corresponds to the - /// @RG PU field in the SAM spec. - #[serde(rename="platformUnit")] - pub platform_unit: Option, -} - -impl Part for Experiment {} - - -/// A read group is all the data that's processed the same way by the sequencer. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReadGroup { - /// A map of additional read group information. This must be of the form - /// map (string key mapping to a list of string values). - pub info: Option>>, - /// The predicted insert size of this read group. The insert size is the length - /// the sequenced DNA fragment from end-to-end, not including the adapters. - #[serde(rename="predictedInsertSize")] - pub predicted_insert_size: Option, - /// The read group name. This corresponds to the @RG ID field in the SAM spec. - pub name: Option, - /// The programs used to generate this read group. Programs are always - /// identical for all read groups within a read group set. For this reason, - /// only the first read group in a returned set will have this field - /// populated. - pub programs: Option>, - /// A client-supplied sample identifier for the reads in this read group. - #[serde(rename="sampleId")] - pub sample_id: Option, - /// The experiment used to generate this read group. - pub experiment: Option, - /// The reference set the reads in this read group are aligned to. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// The server-generated read group ID, unique for all read groups. - /// Note: This is different than the @RG ID field in the SAM spec. For that - /// value, see name. - pub id: Option, - /// The dataset to which this read group belongs. - #[serde(rename="datasetId")] - pub dataset_id: Option, - /// A free-form text description of this read group. - pub description: Option, -} - -impl Part for ReadGroup {} - - -/// The read search request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search reads](struct.ReadSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReadsRequest { - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// The IDs of the read groups sets within which to search for reads. All - /// specified read group sets must be aligned against a common set of reference - /// sequences; this defines the genomic coordinates for the query. Must specify - /// one of `readGroupSetIds` or `readGroupIds`. - #[serde(rename="readGroupSetIds")] - pub read_group_set_ids: Option>, - /// The IDs of the read groups within which to search for reads. All specified - /// read groups must belong to the same read group sets. Must specify one of - /// `readGroupSetIds` or `readGroupIds`. - #[serde(rename="readGroupIds")] - pub read_group_ids: Option>, - /// The maximum number of results to return in a single page. If unspecified, - /// defaults to 256. The maximum value is 2048. - #[serde(rename="pageSize")] - pub page_size: Option, - /// The start position of the range on the reference, 0-based inclusive. If - /// specified, `referenceName` must also be specified. - pub start: Option, - /// The end position of the range on the reference, 0-based exclusive. If - /// specified, `referenceName` must also be specified. - pub end: Option, - /// The reference sequence name, for example `chr1`, `1`, or `chrX`. If set to - /// `*`, only unmapped reads are returned. If unspecified, all reads (mapped - /// and unmapped) are returned. - #[serde(rename="referenceName")] - pub reference_name: Option, -} - -impl RequestValue for SearchReadsRequest {} - - -/// This resource represents a long-running operation that is the result of a -/// network API call. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [cancel operations](struct.OperationCancelCall.html) (none) -/// * [export variantsets](struct.VariantsetExportCall.html) (response) -/// * [export readgroupsets](struct.ReadgroupsetExportCall.html) (response) -/// * [import variants](struct.VariantImportCall.html) (response) -/// * [import readgroupsets](struct.ReadgroupsetImportCall.html) (response) -/// * [get operations](struct.OperationGetCall.html) (response) -/// * [list operations](struct.OperationListCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// The error result of the operation in case of failure or cancellation. - pub error: Option, - /// If the value is `false`, it means the operation is still in progress. - /// If `true`, the operation is completed, and either `error` or `response` is - /// available. - pub done: Option, - /// If importing ReadGroupSets, an ImportReadGroupSetsResponse is returned. If importing Variants, an ImportVariantsResponse is returned. For pipelines and exports, an Empty response is returned. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that originally returns it. For example: `operations/CJHU7Oi_ChDrveSpBRjfuL-qzoWAgEw` - pub name: Option, - /// An OperationMetadata or Metadata object. This will always be returned with the Operation. - pub metadata: Option>, -} - -impl Resource for Operation {} -impl ResponseResult for Operation {} - - -/// The read group set search request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search readgroupsets](struct.ReadgroupsetSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReadGroupSetsRequest { - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// Restricts this query to read group sets within the given datasets. At least - /// one ID must be provided. - #[serde(rename="datasetIds")] - pub dataset_ids: Option>, - /// Only return read group sets for which a substring of the name matches this - /// string. - pub name: Option, - /// The maximum number of results to return in a single page. If unspecified, - /// defaults to 256. The maximum value is 1024. - #[serde(rename="pageSize")] - pub page_size: Option, -} - -impl RequestValue for SearchReadGroupSetsRequest {} - - -/// Request message for `SetIamPolicy` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [set iam policy datasets](struct.DatasetSetIamPolicyCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SetIamPolicyRequest { - /// REQUIRED: The complete policy to be applied to the `resource`. The size of - /// the policy is limited to a few 10s of KB. An empty policy is a - /// valid policy but certain Cloud Platform services (such as Projects) - /// might reject them. - pub policy: Option, -} - -impl RequestValue for SetIamPolicyRequest {} - - -/// A call represents the determination of genotype with respect to a particular -/// variant. It may include associated information such as quality and phasing. -/// For example, a call might assign a probability of 0.32 to the occurrence of -/// a SNP named rs1234 in a call set with the name NA12345. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VariantCall { - /// A map of additional variant call information. This must be of the form - /// map (string key mapping to a list of string values). - pub info: Option>>, - /// The genotype of this variant call. Each value represents either the value - /// of the `referenceBases` field or a 1-based index into - /// `alternateBases`. If a variant had a `referenceBases` - /// value of `T` and an `alternateBases` - /// value of `["A", "C"]`, and the `genotype` was - /// `[2, 1]`, that would mean the call - /// represented the heterozygous value `CA` for this variant. - /// If the `genotype` was instead `[0, 1]`, the - /// represented value would be `TA`. Ordering of the - /// genotype values is important if the `phaseset` is present. - /// If a genotype is not called (that is, a `.` is present in the - /// GT string) -1 is returned. - pub genotype: Option>, - /// The ID of the call set this variant call belongs to. - #[serde(rename="callSetId")] - pub call_set_id: Option, - /// If this field is present, this variant call's genotype ordering implies - /// the phase of the bases and is consistent with any other variant calls in - /// the same reference sequence which have the same phaseset value. - /// When importing data from VCF, if the genotype data was phased but no - /// phase set was specified this field will be set to `*`. - pub phaseset: Option, - /// The genotype likelihoods for this variant call. Each array entry - /// represents how likely a specific genotype is for this call. The value - /// ordering is defined by the GL tag in the VCF spec. - /// If Phred-scaled genotype likelihood scores (PL) are available and - /// log10(P) genotype likelihood scores (GL) are not, PL scores are converted - /// to GL scores. If both are available, PL scores are stored in `info`. - #[serde(rename="genotypeLikelihood")] - pub genotype_likelihood: Option>, - /// The name of the call set this variant call belongs to. - #[serde(rename="callSetName")] - pub call_set_name: Option, -} - -impl Part for VariantCall {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [bases list references](struct.ReferenceBaseListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListBasesResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The offset position (0-based) of the given `sequence` from the - /// start of this `Reference`. This value will differ for each page - /// in a paginated request. - pub offset: Option, - /// A substring of the bases that make up this reference. - pub sequence: Option, -} - -impl ResponseResult for ListBasesResponse {} - - -/// ReferenceBound records an upper bound for the starting coordinate of -/// variants in a particular reference. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReferenceBound { - /// An upper bound (inclusive) on the starting coordinate of any - /// variant in the reference sequence. - #[serde(rename="upperBound")] - pub upper_bound: Option, - /// The name of the reference associated with this reference bound. - #[serde(rename="referenceName")] - pub reference_name: Option, -} - -impl Part for ReferenceBound {} - - -/// Defines an Identity and Access Management (IAM) policy. It is used to -/// specify access control policies for Cloud Platform resources. -/// -/// -/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of -/// `members` to a `role`, where the members can be user accounts, Google groups, -/// Google domains, and service accounts. A `role` is a named list of permissions -/// defined by IAM. -/// -/// **JSON Example** -/// -/// { -/// "bindings": [ -/// { -/// "role": "roles/owner", -/// "members": [ -/// "user:mike@example.com", -/// "group:admins@example.com", -/// "domain:google.com", -/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" -/// ] -/// }, -/// { -/// "role": "roles/viewer", -/// "members": ["user:sean@example.com"] -/// } -/// ] -/// } -/// -/// **YAML Example** -/// -/// bindings: -/// - members: -/// - user:mike@example.com -/// - group:admins@example.com -/// - domain:google.com -/// - serviceAccount:my-other-app@appspot.gserviceaccount.com -/// role: roles/owner -/// - members: -/// - user:sean@example.com -/// role: roles/viewer -/// -/// -/// For a description of IAM and its features, see the -/// [IAM developer's guide](https://cloud.google.com/iam/docs). -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [set iam policy datasets](struct.DatasetSetIamPolicyCall.html) (response) -/// * [get iam policy datasets](struct.DatasetGetIamPolicyCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Policy { - /// Associates a list of `members` to a `role`. - /// `bindings` with no members will result in an error. - pub bindings: Option>, - /// `etag` is used for optimistic concurrency control as a way to help - /// prevent simultaneous updates of a policy from overwriting each other. - /// It is strongly suggested that systems make use of the `etag` in the - /// read-modify-write cycle to perform policy updates in order to avoid race - /// conditions: An `etag` is returned in the response to `getIamPolicy`, and - /// systems are expected to put that etag in the request to `setIamPolicy` to - /// ensure that their change will be applied to the same version of the policy. - /// - /// If no `etag` is provided in the call to `setIamPolicy`, then the existing - /// policy is overwritten blindly. - pub etag: Option, - /// Deprecated. - pub version: Option, -} - -impl ResponseResult for Policy {} - - -/// The variant search request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search variants](struct.VariantSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchVariantsRequest { - /// The end of the window, 0-based exclusive. If unspecified or 0, defaults to - /// the length of the reference. - pub end: Option, - /// The maximum number of variants to return in a single page. If unspecified, - /// defaults to 5000. The maximum value is 10000. - #[serde(rename="pageSize")] - pub page_size: Option, - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// The maximum number of calls to return in a single page. Note that this - /// limit may be exceeded in the event that a matching variant contains more - /// calls than the requested maximum. If unspecified, defaults to 5000. The - /// maximum value is 10000. - #[serde(rename="maxCalls")] - pub max_calls: Option, - /// The beginning of the window (0-based, inclusive) for which - /// overlapping variants should be returned. If unspecified, defaults to 0. - pub start: Option, - /// At most one variant set ID must be provided. Only variants from this - /// variant set will be returned. If omitted, a call set id must be included in - /// the request. - #[serde(rename="variantSetIds")] - pub variant_set_ids: Option>, - /// Only return variants which have exactly this name. - #[serde(rename="variantName")] - pub variant_name: Option, - /// Required. Only return variants in this reference sequence. - #[serde(rename="referenceName")] - pub reference_name: Option, - /// Only return variant calls which belong to call sets with these ids. - /// Leaving this blank returns all variant calls. If a variant has no - /// calls belonging to any of these call sets, it won't be returned at all. - #[serde(rename="callSetIds")] - pub call_set_ids: Option>, -} - -impl RequestValue for SearchVariantsRequest {} - - -/// A reference set is a set of references which typically comprise a reference -/// assembly for a species, such as `GRCh38` which is representative -/// of the human genome. A reference set defines a common coordinate space for -/// comparing reference-aligned experimental data. A reference set contains 1 or -/// more references. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get referencesets](struct.ReferencesetGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReferenceSet { - /// Free text description of this reference set. - pub description: Option, - /// The URI from which the references were obtained. - #[serde(rename="sourceUri")] - pub source_uri: Option, - /// The IDs of the reference objects that are part of this set. - /// `Reference.md5checksum` must be unique within this set. - #[serde(rename="referenceIds")] - pub reference_ids: Option>, - /// Public id of this reference set, such as `GRCh37`. - #[serde(rename="assemblyId")] - pub assembly_id: Option, - /// All known corresponding accession IDs in INSDC (GenBank/ENA/DDBJ) ideally - /// with a version number, for example `NC_000001.11`. - #[serde(rename="sourceAccessions")] - pub source_accessions: Option>, - /// ID from http://www.ncbi.nlm.nih.gov/taxonomy (for example, 9606 for human) - /// indicating the species which this reference set is intended to model. Note - /// that contained references may specify a different `ncbiTaxonId`, as - /// assemblies may contain reference sequences which do not belong to the - /// modeled species, for example EBV in a human reference genome. - #[serde(rename="ncbiTaxonId")] - pub ncbi_taxon_id: Option, - /// The server-generated reference set ID, unique across all reference sets. - pub id: Option, - /// Order-independent MD5 checksum which identifies this reference set. The - /// checksum is computed by sorting all lower case hexidecimal string - /// `reference.md5checksum` (for all reference in this set) in - /// ascending lexicographic order, concatenating, and taking the MD5 of that - /// value. The resulting value is represented in lower case hexadecimal format. - pub md5checksum: Option, -} - -impl Resource for ReferenceSet {} -impl ResponseResult for ReferenceSet {} - - -/// The variant search response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search variants](struct.VariantSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchVariantsResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching Variants. - pub variants: Option>, -} - -impl ResponseResult for SearchVariantsResponse {} - - -/// A read alignment describes a linear alignment of a string of DNA to a -/// reference sequence, in addition to metadata -/// about the fragment (the molecule of DNA sequenced) and the read (the bases -/// which were read by the sequencer). A read is equivalent to a line in a SAM -/// file. A read belongs to exactly one read group and exactly one -/// read group set. -/// -/// ### Reverse-stranded reads -/// -/// Mapped reads (reads having a non-null `alignment`) can be aligned to either -/// the forward or the reverse strand of their associated reference. Strandedness -/// of a mapped read is encoded by `alignment.position.reverseStrand`. -/// -/// If we consider the reference to be a forward-stranded coordinate space of -/// `[0, reference.length)` with `0` as the left-most position and -/// `reference.length` as the right-most position, reads are always aligned left -/// to right. That is, `alignment.position.position` always refers to the -/// left-most reference coordinate and `alignment.cigar` describes the alignment -/// of this read to the reference from left to right. All per-base fields such as -/// `alignedSequence` and `alignedQuality` share this same left-to-right -/// orientation; this is true of reads which are aligned to either strand. For -/// reverse-stranded reads, this means that `alignedSequence` is the reverse -/// complement of the bases that were originally reported by the sequencing -/// machine. -/// -/// ### Generating a reference-aligned sequence string -/// -/// When interacting with mapped reads, it's often useful to produce a string -/// representing the local alignment of the read to reference. The following -/// pseudocode demonstrates one way of doing this: -/// -/// out = "" -/// offset = 0 -/// for c in read.alignment.cigar { -/// switch c.operation { -/// case "ALIGNMENT_MATCH", "SEQUENCE_MATCH", "SEQUENCE_MISMATCH": -/// out += read.alignedSequence[offset:offset+c.operationLength] -/// offset += c.operationLength -/// break -/// case "CLIP_SOFT", "INSERT": -/// offset += c.operationLength -/// break -/// case "PAD": -/// out += repeat("*", c.operationLength) -/// break -/// case "DELETE": -/// out += repeat("-", c.operationLength) -/// break -/// case "SKIP": -/// out += repeat(" ", c.operationLength) -/// break -/// case "CLIP_HARD": -/// break -/// } -/// } -/// return out -/// -/// ### Converting to SAM's CIGAR string -/// -/// The following pseudocode generates a SAM CIGAR string from the -/// `cigar` field. Note that this is a lossy conversion -/// (`cigar.referenceSequence` is lost). -/// -/// cigarMap = { -/// "ALIGNMENT_MATCH": "M", -/// "INSERT": "I", -/// "DELETE": "D", -/// "SKIP": "N", -/// "CLIP_SOFT": "S", -/// "CLIP_HARD": "H", -/// "PAD": "P", -/// "SEQUENCE_MATCH": "=", -/// "SEQUENCE_MISMATCH": "X", -/// } -/// cigarStr = "" -/// for c in read.alignment.cigar { -/// cigarStr += c.operationLength + cigarMap[c.operation] -/// } -/// return cigarStr -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search reads](struct.ReadSearchCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Read { - /// The ID of the read group set this read belongs to. A read belongs to - /// exactly one read group set. - #[serde(rename="readGroupSetId")] - pub read_group_set_id: Option, - /// Whether this read did not pass filters, such as platform or vendor quality - /// controls (SAM flag 0x200). - #[serde(rename="failedVendorQualityChecks")] - pub failed_vendor_quality_checks: Option, - /// The fragment name. Equivalent to QNAME (query template name) in SAM. - #[serde(rename="fragmentName")] - pub fragment_name: Option, - /// The mapping of the primary alignment of the - /// `(readNumber+1)%numberReads` read in the fragment. It replaces - /// mate position and mate strand in SAM. - #[serde(rename="nextMatePosition")] - pub next_mate_position: Option, - /// Whether this alignment is supplementary. Equivalent to SAM flag 0x800. - /// Supplementary alignments are used in the representation of a chimeric - /// alignment. In a chimeric alignment, a read is split into multiple - /// linear alignments that map to different reference contigs. The first - /// linear alignment in the read will be designated as the representative - /// alignment; the remaining linear alignments will be designated as - /// supplementary alignments. These alignments may have different mapping - /// quality scores. In each linear alignment in a chimeric alignment, the read - /// will be hard clipped. The `alignedSequence` and - /// `alignedQuality` fields in the alignment record will only - /// represent the bases for its respective linear alignment. - #[serde(rename="supplementaryAlignment")] - pub supplementary_alignment: Option, - /// The observed length of the fragment, equivalent to TLEN in SAM. - #[serde(rename="fragmentLength")] - pub fragment_length: Option, - /// The server-generated read ID, unique across all reads. This is different - /// from the `fragmentName`. - pub id: Option, - /// The linear alignment for this alignment record. This field is null for - /// unmapped reads. - pub alignment: Option, - /// A map of additional read alignment information. This must be of the form - /// map (string key mapping to a list of string values). - pub info: Option>>, - /// The fragment is a PCR or optical duplicate (SAM flag 0x400). - #[serde(rename="duplicateFragment")] - pub duplicate_fragment: Option, - /// The quality of the read sequence contained in this alignment record - /// (equivalent to QUAL in SAM). - /// `alignedSequence` and `alignedQuality` may be shorter than the full read - /// sequence and quality. This will occur if the alignment is part of a - /// chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR - /// for this read will begin/end with a hard clip operator that will indicate - /// the length of the excised sequence. - #[serde(rename="alignedQuality")] - pub aligned_quality: Option>, - /// The read number in sequencing. 0-based and less than numberReads. This - /// field replaces SAM flag 0x40 and 0x80. - #[serde(rename="readNumber")] - pub read_number: Option, - /// The orientation and the distance between reads from the fragment are - /// consistent with the sequencing protocol (SAM flag 0x2). - #[serde(rename="properPlacement")] - pub proper_placement: Option, - /// The ID of the read group this read belongs to. A read belongs to exactly - /// one read group. This is a server-generated ID which is distinct from SAM's - /// RG tag (for that value, see - /// ReadGroup.name). - #[serde(rename="readGroupId")] - pub read_group_id: Option, - /// The number of reads in the fragment (extension to SAM flag 0x1). - #[serde(rename="numberReads")] - pub number_reads: Option, - /// The bases of the read sequence contained in this alignment record, - /// **without CIGAR operations applied** (equivalent to SEQ in SAM). - /// `alignedSequence` and `alignedQuality` may be - /// shorter than the full read sequence and quality. This will occur if the - /// alignment is part of a chimeric alignment, or if the read was trimmed. When - /// this occurs, the CIGAR for this read will begin/end with a hard clip - /// operator that will indicate the length of the excised sequence. - #[serde(rename="alignedSequence")] - pub aligned_sequence: Option, - /// Whether this alignment is secondary. Equivalent to SAM flag 0x100. - /// A secondary alignment represents an alternative to the primary alignment - /// for this read. Aligners may return secondary alignments if a read can map - /// ambiguously to multiple coordinates in the genome. By convention, each read - /// has one and only one alignment where both `secondaryAlignment` - /// and `supplementaryAlignment` are false. - #[serde(rename="secondaryAlignment")] - pub secondary_alignment: Option, -} - -impl Resource for Read {} - - -/// A variant represents a change in DNA sequence relative to a reference -/// sequence. For example, a variant could represent a SNP or an insertion. -/// Variants belong to a variant set. -/// -/// Each of the calls on a variant represent a determination of genotype with -/// respect to that variant. For example, a call might assign probability of 0.32 -/// to the occurrence of a SNP named rs1234 in a sample named NA12345. A call -/// belongs to a call set, which contains related calls typically from one -/// sample. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [import variants](struct.VariantImportCall.html) (none) -/// * [delete variants](struct.VariantDeleteCall.html) (none) -/// * [create variants](struct.VariantCreateCall.html) (request|response) -/// * [get variants](struct.VariantGetCall.html) (response) -/// * [patch variants](struct.VariantPatchCall.html) (request|response) -/// * [merge variants](struct.VariantMergeCall.html) (none) -/// * [search variants](struct.VariantSearchCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Variant { - /// A map of additional variant information. This must be of the form - /// map (string key mapping to a list of string values). - pub info: Option>>, - /// The ID of the variant set this variant belongs to. - #[serde(rename="variantSetId")] - pub variant_set_id: Option, - /// The end position (0-based) of this variant. This corresponds to the first - /// base after the last base in the reference allele. So, the length of - /// the reference allele is (end - start). This is useful for variants - /// that don't explicitly give alternate bases, for example large deletions. - pub end: Option, - /// The variant calls for this particular variant. Each one represents the - /// determination of genotype with respect to this variant. - pub calls: Option>, - /// The date this variant was created, in milliseconds from the epoch. - pub created: Option, - /// The server-generated variant ID, unique across all variants. - pub id: Option, - /// A list of filters (normally quality filters) this variant has failed. - /// `PASS` indicates this variant has passed all filters. - pub filter: Option>, - /// The position at which this variant occurs (0-based). - /// This corresponds to the first base of the string of reference bases. - pub start: Option, - /// Names for the variant, for example a RefSNP ID. - pub names: Option>, - /// The bases that appear instead of the reference bases. - #[serde(rename="alternateBases")] - pub alternate_bases: Option>, - /// The reference on which this variant occurs. - /// (such as `chr20` or `X`) - #[serde(rename="referenceName")] - pub reference_name: Option, - /// A measure of how likely this variant is to be real. - /// A higher value is better. - pub quality: Option, - /// The reference bases for this variant. They start at the given - /// position. - #[serde(rename="referenceBases")] - pub reference_bases: Option, -} - -impl RequestValue for Variant {} -impl Resource for Variant {} -impl ResponseResult for Variant {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search annotationsets](struct.AnnotationsetSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchAnnotationSetsResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The matching annotation sets. - #[serde(rename="annotationSets")] - pub annotation_sets: Option>, -} - -impl ResponseResult for SearchAnnotationSetsResponse {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Exon { - /// The start position of the exon on this annotation's reference sequence, - /// 0-based inclusive. Note that this is relative to the reference start, and - /// **not** the containing annotation start. - pub start: Option, - /// The frame of this exon. Contains a value of 0, 1, or 2, which indicates - /// the offset of the first coding base of the exon within the reading frame - /// of the coding DNA sequence, if any. This field is dependent on the - /// strandedness of this annotation (see - /// Annotation.reverse_strand). - /// For forward stranded annotations, this offset is relative to the - /// exon.start. For reverse - /// strand annotations, this offset is relative to the - /// exon.end `- 1`. - /// - /// Unset if this exon does not intersect the coding sequence. Upon creation - /// of a transcript, the frame must be populated for all or none of the - /// coding exons. - pub frame: Option, - /// The end position of the exon on this annotation's reference sequence, - /// 0-based exclusive. Note that this is relative to the reference start, and - /// *not* the containing annotation start. - pub end: Option, -} - -impl Part for Exon {} - - -/// The variant data export request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [export variantsets](struct.VariantsetExportCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExportVariantSetRequest { - /// Required. The BigQuery dataset to export data to. This dataset must already - /// exist. Note that this is distinct from the Genomics concept of "dataset". - #[serde(rename="bigqueryDataset")] - pub bigquery_dataset: Option, - /// The format for the exported data. - pub format: Option, - /// If provided, only variant call information from the specified call sets - /// will be exported. By default all variant calls are exported. - #[serde(rename="callSetIds")] - pub call_set_ids: Option>, - /// Required. The Google Cloud project ID that owns the destination - /// BigQuery dataset. The caller must have WRITE access to this project. This - /// project will also own the resulting export job. - #[serde(rename="projectId")] - pub project_id: Option, - /// Required. The BigQuery table to export data to. - /// If the table doesn't exist, it will be created. If it already exists, it - /// will be overwritten. - #[serde(rename="bigqueryTable")] - pub bigquery_table: Option, -} - -impl RequestValue for ExportVariantSetRequest {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CodingSequence { - /// The start of the coding sequence on this annotation's reference sequence, - /// 0-based inclusive. Note that this position is relative to the reference - /// start, and *not* the containing annotation start. - pub start: Option, - /// The end of the coding sequence on this annotation's reference sequence, - /// 0-based exclusive. Note that this position is relative to the reference - /// start, and *not* the containing annotation start. - pub end: Option, -} - -impl Part for CodingSequence {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [batch create annotations](struct.AnnotationBatchCreateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchCreateAnnotationsRequest { - /// The annotations to be created. At most 4096 can be specified in a single - /// request. - pub annotations: Option>, - /// A unique request ID which enables the server to detect duplicated requests. - /// If provided, duplicated requests will result in the same response; if not - /// provided, duplicated requests may result in duplicated data. For a given - /// annotation set, callers should not reuse `request_id`s when writing - /// different batches of annotations - behavior in this case is undefined. - /// A common approach is to use a UUID. For batch jobs where worker crashes are - /// a possibility, consider using some unique variant of a worker or run ID. - #[serde(rename="requestId")] - pub request_id: Option, -} - -impl RequestValue for BatchCreateAnnotationsRequest {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search referencesets](struct.ReferencesetSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReferenceSetsResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The matching references sets. - #[serde(rename="referenceSets")] - pub reference_sets: Option>, -} - -impl ResponseResult for SearchReferenceSetsResponse {} - - -/// Request message for `TestIamPermissions` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [test iam permissions datasets](struct.DatasetTestIamPermissionCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TestIamPermissionsRequest { - /// REQUIRED: The set of permissions to check for the 'resource'. - /// Permissions with wildcards (such as '*' or 'storage.*') are not allowed. - /// Allowed permissions are: - /// - /// * `genomics.datasets.create` - /// * `genomics.datasets.delete` - /// * `genomics.datasets.get` - /// * `genomics.datasets.list` - /// * `genomics.datasets.update` - /// * `genomics.datasets.getIamPolicy` - /// * `genomics.datasets.setIamPolicy` - pub permissions: Option>, -} - -impl RequestValue for TestIamPermissionsRequest {} - - -/// A variant set is a collection of call sets and variants. It contains summary -/// statistics of those contents. A variant set belongs to a dataset. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [patch variantsets](struct.VariantsetPatchCall.html) (request|response) -/// * [create variantsets](struct.VariantsetCreateCall.html) (request|response) -/// * [get variantsets](struct.VariantsetGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VariantSet { - /// The metadata associated with this variant set. - pub metadata: Option>, - /// User-specified, mutable name. - pub name: Option, - /// A list of all references used by the variants in a variant set - /// with associated coordinate upper bounds for each one. - #[serde(rename="referenceBounds")] - pub reference_bounds: Option>, - /// The reference set to which the variant set is mapped. The reference set - /// describes the alignment provenance of the variant set, while the - /// `referenceBounds` describe the shape of the actual variant data. The - /// reference set's reference names are a superset of those found in the - /// `referenceBounds`. - /// - /// For example, given a variant set that is mapped to the GRCh38 reference set - /// and contains a single variant on reference 'X', `referenceBounds` would - /// contain only an entry for 'X', while the associated reference set - /// enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// The server-generated variant set ID, unique across all variant sets. - pub id: Option, - /// The dataset to which this variant set belongs. - #[serde(rename="datasetId")] - pub dataset_id: Option, - /// A textual description of this variant set. - pub description: Option, -} - -impl RequestValue for VariantSet {} -impl Resource for VariantSet {} -impl ResponseResult for VariantSet {} - - -/// Represents an expression text. Example: -/// -/// title: "User account presence" -/// description: "Determines whether the request has a user account" -/// expression: "size(request.user) > 0" -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, - /// Textual representation of an expression in - /// Common Expression Language syntax. - /// - /// The application context of the containing message determines which - /// well-known feature set of CEL is supported. - pub expression: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, - /// An optional string indicating the location of the expression for error - /// reporting, e.g. a file name and a position in the file. - pub location: Option, -} - -impl Part for Expr {} - - /// The response message for Operations.ListOperations. /// /// # Activities @@ -2389,351 +475,16 @@ impl Part for Expr {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListOperationsResponse { - /// A list of operations that matches the specified filter in the request. - pub operations: Option>, /// The standard List next-page token. #[serde(rename="nextPageToken")] pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, } impl ResponseResult for ListOperationsResponse {} -/// The read group set search response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search readgroupsets](struct.ReadgroupsetSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReadGroupSetsResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching read group sets. - #[serde(rename="readGroupSets")] - pub read_group_sets: Option>, -} - -impl ResponseResult for SearchReadGroupSetsResponse {} - - -/// A 0-based half-open genomic coordinate range for search requests. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Range { - /// The start position of the range on the reference, 0-based inclusive. - pub start: Option, - /// The end position of the range on the reference, 0-based exclusive. - pub end: Option, - /// The reference sequence name, for example `chr1`, - /// `1`, or `chrX`. - #[serde(rename="referenceName")] - pub reference_name: Option, -} - -impl Part for Range {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search annotationsets](struct.AnnotationsetSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchAnnotationSetsRequest { - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// Only return annotations sets for which a substring of the name matches this - /// string (case insensitive). - pub name: Option, - /// The maximum number of results to return in a single page. If unspecified, - /// defaults to 128. The maximum value is 1024. - #[serde(rename="pageSize")] - pub page_size: Option, - /// Required. The dataset IDs to search within. Caller must have `READ` access - /// to these datasets. - #[serde(rename="datasetIds")] - pub dataset_ids: Option>, - /// If specified, only annotation sets associated with the given reference set - /// are returned. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// If specified, only annotation sets that have any of these types are - /// returned. - pub types: Option>, -} - -impl RequestValue for SearchAnnotationSetsRequest {} - - -/// The read search response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search reads](struct.ReadSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReadsResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching alignments sorted by mapped genomic coordinate, - /// if any, ascending in position within the same reference. Unmapped reads, - /// which have no position, are returned contiguously and are sorted in - /// ascending lexicographic order by fragment name. - pub alignments: Option>, -} - -impl ResponseResult for SearchReadsResponse {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Entry { - /// The creation status. - pub status: Option, - /// The created annotation, if creation was successful. - pub annotation: Option, -} - -impl Part for Entry {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search references](struct.ReferenceSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReferencesResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The matching references. - pub references: Option>, -} - -impl ResponseResult for SearchReferencesResponse {} - - -/// A read group set is a logical collection of read groups, which are -/// collections of reads produced by a sequencer. A read group set typically -/// models reads corresponding to one sample, sequenced one way, and aligned one -/// way. -/// -/// * A read group set belongs to one dataset. -/// * A read group belongs to one read group set. -/// * A read belongs to one read group. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get readgroupsets](struct.ReadgroupsetGetCall.html) (response) -/// * [patch readgroupsets](struct.ReadgroupsetPatchCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReadGroupSet { - /// A map of additional read group set information. - pub info: Option>>, - /// The dataset to which this read group set belongs. - #[serde(rename="datasetId")] - pub dataset_id: Option, - /// The read group set name. By default this will be initialized to the sample - /// name of the sequenced data contained in this set. - pub name: Option, - /// The reference set to which the reads in this read group set are aligned. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// The server-generated read group set ID, unique for all read group sets. - pub id: Option, - /// The read groups in this set. There are typically 1-10 read groups in a read - /// group set. - #[serde(rename="readGroups")] - pub read_groups: Option>, - /// The filename of the original source file for this read group set, if any. - pub filename: Option, -} - -impl RequestValue for ReadGroupSet {} -impl Resource for ReadGroupSet {} -impl ResponseResult for ReadGroupSet {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [batch create annotations](struct.AnnotationBatchCreateCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchCreateAnnotationsResponse { - /// The resulting per-annotation entries, ordered consistently with the - /// original request. - pub entries: Option>, -} - -impl ResponseResult for BatchCreateAnnotationsResponse {} - - -/// A linear alignment can be represented by one CIGAR string. Describes the -/// mapped position and local alignment of the read to the reference. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LinearAlignment { - /// The position of this alignment. - pub position: Option, - /// Represents the local alignment of this sequence (alignment matches, indels, - /// etc) against the reference. - pub cigar: Option>, - /// The mapping quality of this alignment. Represents how likely - /// the read maps to this position as opposed to other locations. - /// - /// Specifically, this is -10 log10 Pr(mapping position is wrong), rounded to - /// the nearest integer. - #[serde(rename="mappingQuality")] - pub mapping_quality: Option, -} - -impl Part for LinearAlignment {} - - -/// An annotation set is a logical grouping of annotations that share consistent -/// type information and provenance. Examples of annotation sets include 'all -/// genes from refseq', and 'all variant annotations from ClinVar'. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [update annotationsets](struct.AnnotationsetUpdateCall.html) (request|response) -/// * [get annotationsets](struct.AnnotationsetGetCall.html) (response) -/// * [create annotationsets](struct.AnnotationsetCreateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AnnotationSet { - /// A map of additional read alignment information. This must be of the form - /// map (string key mapping to a list of string values). - pub info: Option>>, - /// The display name for this annotation set. - pub name: Option, - /// The source URI describing the file from which this annotation set was - /// generated, if any. - #[serde(rename="sourceUri")] - pub source_uri: Option, - /// The ID of the reference set that defines the coordinate space for this - /// set's annotations. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// The type of annotations contained within this set. - #[serde(rename="type")] - pub type_: Option, - /// The server-generated annotation set ID, unique across all annotation sets. - pub id: Option, - /// The dataset to which this annotation set belongs. - #[serde(rename="datasetId")] - pub dataset_id: Option, -} - -impl RequestValue for AnnotationSet {} -impl Resource for AnnotationSet {} -impl ResponseResult for AnnotationSet {} - - -/// A single CIGAR operation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CigarUnit { - /// `referenceSequence` is only used at mismatches - /// (`SEQUENCE_MISMATCH`) and deletions (`DELETE`). - /// Filling this field replaces SAM's MD tag. If the relevant information is - /// not available, this field is unset. - #[serde(rename="referenceSequence")] - pub reference_sequence: Option, - /// no description provided - pub operation: Option, - /// The number of genomic bases that the operation runs for. Required. - #[serde(rename="operationLength")] - pub operation_length: Option, -} - -impl Part for CigarUnit {} - - -/// A Dataset is a collection of genomic data. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [set iam policy datasets](struct.DatasetSetIamPolicyCall.html) (none) -/// * [delete datasets](struct.DatasetDeleteCall.html) (none) -/// * [get iam policy datasets](struct.DatasetGetIamPolicyCall.html) (none) -/// * [test iam permissions datasets](struct.DatasetTestIamPermissionCall.html) (none) -/// * [get datasets](struct.DatasetGetCall.html) (response) -/// * [undelete datasets](struct.DatasetUndeleteCall.html) (response) -/// * [create datasets](struct.DatasetCreateCall.html) (request|response) -/// * [patch datasets](struct.DatasetPatchCall.html) (request|response) -/// * [list datasets](struct.DatasetListCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Dataset { - /// The Google Cloud project ID that this dataset belongs to. - #[serde(rename="projectId")] - pub project_id: Option, - /// The server-generated dataset ID, unique across all datasets. - pub id: Option, - /// The dataset name. - pub name: Option, - /// The time this dataset was created, in seconds from the epoch. - #[serde(rename="createTime")] - pub create_time: Option, -} - -impl RequestValue for Dataset {} -impl Resource for Dataset {} -impl ResponseResult for Dataset {} - - /// The request message for Operations.CancelOperation. /// /// # Activities @@ -2749,122 +500,36 @@ pub struct CancelOperationRequest { _never_set: Option } impl RequestValue for CancelOperationRequest {} -/// The search variant sets response. +/// This resource represents a long-running operation that is the result of a +/// network API call. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [search variantsets](struct.VariantsetSearchCall.html) (response) +/// * [list operations](struct.OperationListCall.html) (none) +/// * [get operations](struct.OperationGetCall.html) (response) +/// * [cancel operations](struct.OperationCancelCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchVariantSetsResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The variant sets belonging to the requested dataset. - #[serde(rename="variantSets")] - pub variant_sets: Option>, +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// An Empty object. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that originally returns it. For example: `operations/CJHU7Oi_ChDrveSpBRjfuL-qzoWAgEw` + pub name: Option, + /// An OperationMetadata or Metadata object. This will always be returned with the Operation. + pub metadata: Option>, } -impl ResponseResult for SearchVariantSetsResponse {} - - -/// A bucket over which read coverage has been precomputed. A bucket corresponds -/// to a specific range of the reference sequence. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CoverageBucket { - /// The average number of reads which are aligned to each individual - /// reference base in this bucket. - #[serde(rename="meanCoverage")] - pub mean_coverage: Option, - /// The genomic coordinate range spanned by this bucket. - pub range: Option, -} - -impl Part for CoverageBucket {} - - -/// The call set search response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search callsets](struct.CallsetSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchCallSetsResponse { - /// The continuation token, which is used to page through large result sets. - /// Provide this value in a subsequent request to return the next page of - /// results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching call sets. - #[serde(rename="callSets")] - pub call_sets: Option>, -} - -impl ResponseResult for SearchCallSetsResponse {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search referencesets](struct.ReferencesetSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReferenceSetsRequest { - /// If present, return reference sets for which the - /// md5checksum matches exactly. - pub md5checksums: Option>, - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// If present, return reference sets for which a prefix of any of - /// sourceAccessions - /// match any of these strings. Accession numbers typically have a main number - /// and a version, for example `NC_000001.11`. - pub accessions: Option>, - /// The maximum number of results to return in a single page. If unspecified, - /// defaults to 1024. The maximum value is 4096. - #[serde(rename="pageSize")] - pub page_size: Option, - /// If present, return reference sets for which a substring of their - /// `assemblyId` matches this string (case insensitive). - #[serde(rename="assemblyId")] - pub assembly_id: Option, -} - -impl RequestValue for SearchReferenceSetsRequest {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [undelete datasets](struct.DatasetUndeleteCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UndeleteDatasetRequest { _never_set: Option } - -impl RequestValue for UndeleteDatasetRequest {} +impl Resource for Operation {} +impl ResponseResult for Operation {} @@ -2913,25 +578,21 @@ impl<'a, C, A> OperationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Starts asynchronous cancellation on a long-running operation. - /// The server makes a best effort to cancel the operation, but success is not - /// guaranteed. Clients may use Operations.GetOperation - /// or Operations.ListOperations - /// to check whether the cancellation succeeded or the operation completed - /// despite cancellation. + /// Lists operations that match the specified filter in the request. /// Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission: /// - /// * `genomics.operations.cancel` + /// * `genomics.operations.list` /// /// # Arguments /// - /// * `request` - No description provided. - /// * `name` - The name of the operation resource to be cancelled. - pub fn cancel(&self, request: CancelOperationRequest, name: &str) -> OperationCancelCall<'a, C, A> { - OperationCancelCall { + /// * `name` - The name of the operation's parent resource. + pub fn list(&self, name: &str) -> OperationListCall<'a, C, A> { + OperationListCall { hub: self.hub, - _request: request, _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2962,1618 +623,25 @@ impl<'a, C, A> OperationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists operations that match the specified filter in the request. + /// Starts asynchronous cancellation on a long-running operation. + /// The server makes a best effort to cancel the operation, but success is not + /// guaranteed. Clients may use Operations.GetOperation + /// or Operations.ListOperations + /// to check whether the cancellation succeeded or the operation completed + /// despite cancellation. /// Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission: /// - /// * `genomics.operations.list` + /// * `genomics.operations.cancel` /// /// # Arguments /// - /// * `name` - The name of the operation's parent resource. - pub fn list(&self, name: &str) -> OperationListCall<'a, C, A> { - OperationListCall { + /// * `request` - No description provided. + /// * `name` - The name of the operation resource to be cancelled. + pub fn cancel(&self, request: CancelOperationRequest, name: &str) -> OperationCancelCall<'a, C, A> { + OperationCancelCall { hub: self.hub, + _request: request, _name: name.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _filter: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *dataset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1 as genomics1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `list(...)`, `patch(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)` and `undelete(...)` -/// // to build up your call. -/// let rb = hub.datasets(); -/// # } -/// ``` -pub struct DatasetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for DatasetMethods<'a, C, A> {} - -impl<'a, C, A> DatasetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Creates a new dataset. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: Dataset) -> DatasetCreateCall<'a, C, A> { - DatasetCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a dataset and all of its contents (all read group sets, - /// reference sets, variant sets, call sets, annotation sets, etc.) - /// This is reversible (up to one week after the deletion) via - /// the - /// datasets.undelete - /// operation. - /// - /// # Arguments - /// - /// * `datasetId` - The ID of the dataset to be deleted. - pub fn delete(&self, dataset_id: &str) -> DatasetDeleteCall<'a, C, A> { - DatasetDeleteCall { - hub: self.hub, - _dataset_id: dataset_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Undeletes a dataset by restoring a dataset which was deleted via this API. - /// - /// This operation is only possible for a week after the deletion occurred. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `datasetId` - The ID of the dataset to be undeleted. - pub fn undelete(&self, request: UndeleteDatasetRequest, dataset_id: &str) -> DatasetUndeleteCall<'a, C, A> { - DatasetUndeleteCall { - hub: self.hub, - _request: request, - _dataset_id: dataset_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Sets the access control policy on the specified dataset. Replaces any - /// existing policy. - /// - /// See Setting a - /// Policy for more information. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being specified. Format is - /// `datasets/`. - pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> DatasetSetIamPolicyCall<'a, C, A> { - DatasetSetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns permissions that a caller has on the specified resource. - /// See Testing - /// Permissions for more information. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being specified. Format is - /// `datasets/`. - pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> DatasetTestIamPermissionCall<'a, C, A> { - DatasetTestIamPermissionCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a dataset by ID. - /// - /// # Arguments - /// - /// * `datasetId` - The ID of the dataset. - pub fn get(&self, dataset_id: &str) -> DatasetGetCall<'a, C, A> { - DatasetGetCall { - hub: self.hub, - _dataset_id: dataset_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists datasets within a project. - pub fn list(&self) -> DatasetListCall<'a, C, A> { - DatasetListCall { - hub: self.hub, - _project_id: Default::default(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the access control policy for the dataset. This is empty if the - /// policy or resource does not exist. - /// - /// See Getting a - /// Policy for more information. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being specified. Format is - /// `datasets/`. - pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> DatasetGetIamPolicyCall<'a, C, A> { - DatasetGetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a dataset. - /// - /// This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `datasetId` - The ID of the dataset to be updated. - pub fn patch(&self, request: Dataset, dataset_id: &str) -> DatasetPatchCall<'a, C, A> { - DatasetPatchCall { - hub: self.hub, - _request: request, - _dataset_id: dataset_id.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *referenceset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1 as genomics1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)` and `search(...)` -/// // to build up your call. -/// let rb = hub.referencesets(); -/// # } -/// ``` -pub struct ReferencesetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for ReferencesetMethods<'a, C, A> {} - -impl<'a, C, A> ReferencesetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Searches for reference sets which match the given criteria. - /// - /// Implements - /// [GlobalAllianceApi.searchReferenceSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L71) - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchReferenceSetsRequest) -> ReferencesetSearchCall<'a, C, A> { - ReferencesetSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a reference set. - /// - /// Implements - /// [GlobalAllianceApi.getReferenceSet](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L83). - /// - /// # Arguments - /// - /// * `referenceSetId` - The ID of the reference set. - pub fn get(&self, reference_set_id: &str) -> ReferencesetGetCall<'a, C, A> { - ReferencesetGetCall { - hub: self.hub, - _reference_set_id: reference_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *callset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1 as genomics1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `delete(...)`, `get(...)`, `patch(...)` and `search(...)` -/// // to build up your call. -/// let rb = hub.callsets(); -/// # } -/// ``` -pub struct CallsetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for CallsetMethods<'a, C, A> {} - -impl<'a, C, A> CallsetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Gets a list of call sets matching the criteria. - /// - /// Implements - /// [GlobalAllianceApi.searchCallSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L178). - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchCallSetsRequest) -> CallsetSearchCall<'a, C, A> { - CallsetSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a call set. - /// - /// This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `callSetId` - The ID of the call set to be updated. - pub fn patch(&self, request: CallSet, call_set_id: &str) -> CallsetPatchCall<'a, C, A> { - CallsetPatchCall { - hub: self.hub, - _request: request, - _call_set_id: call_set_id.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new call set. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: CallSet) -> CallsetCreateCall<'a, C, A> { - CallsetCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a call set. - /// - /// # Arguments - /// - /// * `callSetId` - The ID of the call set to be deleted. - pub fn delete(&self, call_set_id: &str) -> CallsetDeleteCall<'a, C, A> { - CallsetDeleteCall { - hub: self.hub, - _call_set_id: call_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a call set by ID. - /// - /// # Arguments - /// - /// * `callSetId` - The ID of the call set. - pub fn get(&self, call_set_id: &str) -> CallsetGetCall<'a, C, A> { - CallsetGetCall { - hub: self.hub, - _call_set_id: call_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *read* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1 as genomics1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `search(...)` -/// // to build up your call. -/// let rb = hub.reads(); -/// # } -/// ``` -pub struct ReadMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for ReadMethods<'a, C, A> {} - -impl<'a, C, A> ReadMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Gets a list of reads for one or more read group sets. - /// - /// Reads search operates over a genomic coordinate space of reference sequence - /// & position defined over the reference sequences to which the requested - /// read group sets are aligned. - /// - /// If a target positional range is specified, search returns all reads whose - /// alignment to the reference genome overlap the range. A query which - /// specifies only read group set IDs yields all reads in those read group - /// sets, including unmapped reads. - /// - /// All reads returned (including reads on subsequent pages) are ordered by - /// genomic coordinate (by reference sequence, then position). Reads with - /// equivalent genomic coordinates are returned in an unspecified order. This - /// order is consistent, such that two queries for the same content (regardless - /// of page size) yield reads in the same order across their respective streams - /// of paginated responses. - /// - /// Implements - /// [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85). - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchReadsRequest) -> ReadSearchCall<'a, C, A> { - ReadSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *readgroupset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1 as genomics1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `coveragebuckets_list(...)`, `delete(...)`, `export(...)`, `get(...)`, `import(...)`, `patch(...)` and `search(...)` -/// // to build up your call. -/// let rb = hub.readgroupsets(); -/// # } -/// ``` -pub struct ReadgroupsetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for ReadgroupsetMethods<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Exports a read group set to a BAM file in Google Cloud Storage. - /// - /// Note that currently there may be some differences between exported BAM - /// files and the original BAM file at the time of import. See - /// ImportReadGroupSets - /// for caveats. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `readGroupSetId` - Required. The ID of the read group set to export. The caller must have - /// READ access to this read group set. - pub fn export(&self, request: ExportReadGroupSetRequest, read_group_set_id: &str) -> ReadgroupsetExportCall<'a, C, A> { - ReadgroupsetExportCall { - hub: self.hub, - _request: request, - _read_group_set_id: read_group_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates read group sets by asynchronously importing the provided - /// information. - /// - /// The caller must have WRITE permissions to the dataset. - /// - /// ## Notes on [BAM](https://samtools.github.io/hts-specs/SAMv1.pdf) import - /// - /// - Tags will be converted to strings - tag types are not preserved - /// - Comments (`@CO`) in the input file header will not be preserved - /// - Original header order of references (`@SQ`) will not be preserved - /// - Any reverse stranded unmapped reads will be reverse complemented, and - /// their qualities (also the "BQ" and "OQ" tags, if any) will be reversed - /// - Unmapped reads will be stripped of positional information (reference name - /// and position) - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn import(&self, request: ImportReadGroupSetsRequest) -> ReadgroupsetImportCall<'a, C, A> { - ReadgroupsetImportCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a read group set. - /// - /// This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `readGroupSetId` - The ID of the read group set to be updated. The caller must have WRITE - /// permissions to the dataset associated with this read group set. - pub fn patch(&self, request: ReadGroupSet, read_group_set_id: &str) -> ReadgroupsetPatchCall<'a, C, A> { - ReadgroupsetPatchCall { - hub: self.hub, - _request: request, - _read_group_set_id: read_group_set_id.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a read group set by ID. - /// - /// # Arguments - /// - /// * `readGroupSetId` - The ID of the read group set. - pub fn get(&self, read_group_set_id: &str) -> ReadgroupsetGetCall<'a, C, A> { - ReadgroupsetGetCall { - hub: self.hub, - _read_group_set_id: read_group_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists fixed width coverage buckets for a read group set, each of which - /// correspond to a range of a reference sequence. Each bucket summarizes - /// coverage information across its corresponding genomic range. - /// - /// Coverage is defined as the number of reads which are aligned to a given - /// base in the reference sequence. Coverage buckets are available at several - /// precomputed bucket widths, enabling retrieval of various coverage 'zoom - /// levels'. The caller must have READ permissions for the target read group - /// set. - /// - /// # Arguments - /// - /// * `readGroupSetId` - Required. The ID of the read group set over which coverage is requested. - pub fn coveragebuckets_list(&self, read_group_set_id: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - ReadgroupsetCoveragebucketListCall { - hub: self.hub, - _read_group_set_id: read_group_set_id.to_string(), - _target_bucket_width: Default::default(), - _start: Default::default(), - _reference_name: Default::default(), - _page_token: Default::default(), - _page_size: Default::default(), - _end: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a read group set. - /// - /// # Arguments - /// - /// * `readGroupSetId` - The ID of the read group set to be deleted. The caller must have WRITE - /// permissions to the dataset associated with this read group set. - pub fn delete(&self, read_group_set_id: &str) -> ReadgroupsetDeleteCall<'a, C, A> { - ReadgroupsetDeleteCall { - hub: self.hub, - _read_group_set_id: read_group_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Searches for read group sets matching the criteria. - /// - /// Implements - /// [GlobalAllianceApi.searchReadGroupSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L135). - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchReadGroupSetsRequest) -> ReadgroupsetSearchCall<'a, C, A> { - ReadgroupsetSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *reference* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1 as genomics1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `bases_list(...)`, `get(...)` and `search(...)` -/// // to build up your call. -/// let rb = hub.references(); -/// # } -/// ``` -pub struct ReferenceMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for ReferenceMethods<'a, C, A> {} - -impl<'a, C, A> ReferenceMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Lists the bases in a reference, optionally restricted to a range. - /// - /// Implements - /// [GlobalAllianceApi.getReferenceBases](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L221). - /// - /// # Arguments - /// - /// * `referenceId` - The ID of the reference. - pub fn bases_list(&self, reference_id: &str) -> ReferenceBaseListCall<'a, C, A> { - ReferenceBaseListCall { - hub: self.hub, - _reference_id: reference_id.to_string(), - _start: Default::default(), - _page_token: Default::default(), - _page_size: Default::default(), - _end: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Searches for references which match the given criteria. - /// - /// Implements - /// [GlobalAllianceApi.searchReferences](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L146). - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchReferencesRequest) -> ReferenceSearchCall<'a, C, A> { - ReferenceSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a reference. - /// - /// Implements - /// [GlobalAllianceApi.getReference](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L158). - /// - /// # Arguments - /// - /// * `referenceId` - The ID of the reference. - pub fn get(&self, reference_id: &str) -> ReferenceGetCall<'a, C, A> { - ReferenceGetCall { - hub: self.hub, - _reference_id: reference_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *variant* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1 as genomics1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `delete(...)`, `get(...)`, `import(...)`, `merge(...)`, `patch(...)` and `search(...)` -/// // to build up your call. -/// let rb = hub.variants(); -/// # } -/// ``` -pub struct VariantMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for VariantMethods<'a, C, A> {} - -impl<'a, C, A> VariantMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Gets a list of variants matching the criteria. - /// - /// Implements - /// [GlobalAllianceApi.searchVariants](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L126). - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchVariantsRequest) -> VariantSearchCall<'a, C, A> { - VariantSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a variant. - /// - /// # Arguments - /// - /// * `variantId` - The ID of the variant to be deleted. - pub fn delete(&self, variant_id: &str) -> VariantDeleteCall<'a, C, A> { - VariantDeleteCall { - hub: self.hub, - _variant_id: variant_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a variant by ID. - /// - /// # Arguments - /// - /// * `variantId` - The ID of the variant. - pub fn get(&self, variant_id: &str) -> VariantGetCall<'a, C, A> { - VariantGetCall { - hub: self.hub, - _variant_id: variant_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Merges the given variants with existing variants. - /// - /// Each variant will be - /// merged with an existing variant that matches its reference sequence, - /// start, end, reference bases, and alternative bases. If no such variant - /// exists, a new one will be created. - /// - /// When variants are merged, the call information from the new variant - /// is added to the existing variant. Variant info fields are merged as - /// specified in the - /// infoMergeConfig - /// field of the MergeVariantsRequest. - /// - /// Please exercise caution when using this method! It is easy to introduce - /// mistakes in existing variants and difficult to back out of them. For - /// example, - /// suppose you were trying to merge a new variant with an existing one and - /// both - /// variants contain calls that belong to callsets with the same callset ID. - /// - /// // Existing variant - irrelevant fields trimmed for clarity - /// { - /// "variantSetId": "10473108253681171589", - /// "referenceName": "1", - /// "start": "10582", - /// "referenceBases": "G", - /// "alternateBases": [ - /// "A" - /// ], - /// "calls": [ - /// { - /// "callSetId": "10473108253681171589-0", - /// "callSetName": "CALLSET0", - /// "genotype": [ - /// 0, - /// 1 - /// ], - /// } - /// ] - /// } - /// - /// // New variant with conflicting call information - /// { - /// "variantSetId": "10473108253681171589", - /// "referenceName": "1", - /// "start": "10582", - /// "referenceBases": "G", - /// "alternateBases": [ - /// "A" - /// ], - /// "calls": [ - /// { - /// "callSetId": "10473108253681171589-0", - /// "callSetName": "CALLSET0", - /// "genotype": [ - /// 1, - /// 1 - /// ], - /// } - /// ] - /// } - /// - /// The resulting merged variant would overwrite the existing calls with those - /// from the new variant: - /// - /// { - /// "variantSetId": "10473108253681171589", - /// "referenceName": "1", - /// "start": "10582", - /// "referenceBases": "G", - /// "alternateBases": [ - /// "A" - /// ], - /// "calls": [ - /// { - /// "callSetId": "10473108253681171589-0", - /// "callSetName": "CALLSET0", - /// "genotype": [ - /// 1, - /// 1 - /// ], - /// } - /// ] - /// } - /// - /// This may be the desired outcome, but it is up to the user to determine if - /// if that is indeed the case. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn merge(&self, request: MergeVariantsRequest) -> VariantMergeCall<'a, C, A> { - VariantMergeCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new variant. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: Variant) -> VariantCreateCall<'a, C, A> { - VariantCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates variant data by asynchronously importing the provided information. - /// - /// The variants for import will be merged with any existing variant that - /// matches its reference sequence, start, end, reference bases, and - /// alternative bases. If no such variant exists, a new one will be created. - /// - /// When variants are merged, the call information from the new variant - /// is added to the existing variant, and Variant info fields are merged - /// as specified in - /// infoMergeConfig. - /// As a special case, for single-sample VCF files, QUAL and FILTER fields will - /// be moved to the call level; these are sometimes interpreted in a - /// call-specific context. - /// Imported VCF headers are appended to the metadata already in a variant set. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn import(&self, request: ImportVariantsRequest) -> VariantImportCall<'a, C, A> { - VariantImportCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a variant. - /// - /// This method supports patch semantics. Returns the modified variant without - /// its calls. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `variantId` - The ID of the variant to be updated. - pub fn patch(&self, request: Variant, variant_id: &str) -> VariantPatchCall<'a, C, A> { - VariantPatchCall { - hub: self.hub, - _request: request, - _variant_id: variant_id.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *annotation* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1 as genomics1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `batch_create(...)`, `create(...)`, `delete(...)`, `get(...)`, `search(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.annotations(); -/// # } -/// ``` -pub struct AnnotationMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for AnnotationMethods<'a, C, A> {} - -impl<'a, C, A> AnnotationMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Updates an annotation. Caller must have - /// WRITE permission for the associated dataset. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `annotationId` - The ID of the annotation to be updated. - pub fn update(&self, request: Annotation, annotation_id: &str) -> AnnotationUpdateCall<'a, C, A> { - AnnotationUpdateCall { - hub: self.hub, - _request: request, - _annotation_id: annotation_id.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets an annotation. Caller must have READ permission - /// for the associated annotation set. - /// - /// # Arguments - /// - /// * `annotationId` - The ID of the annotation to be retrieved. - pub fn get(&self, annotation_id: &str) -> AnnotationGetCall<'a, C, A> { - AnnotationGetCall { - hub: self.hub, - _annotation_id: annotation_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Searches for annotations that match the given criteria. Results are - /// ordered by genomic coordinate (by reference sequence, then position). - /// Annotations with equivalent genomic coordinates are returned in an - /// unspecified order. This order is consistent, such that two queries for the - /// same content (regardless of page size) yield annotations in the same order - /// across their respective streams of paginated responses. Caller must have - /// READ permission for the queried annotation sets. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchAnnotationsRequest) -> AnnotationSearchCall<'a, C, A> { - AnnotationSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes an annotation. Caller must have WRITE permission for - /// the associated annotation set. - /// - /// # Arguments - /// - /// * `annotationId` - The ID of the annotation to be deleted. - pub fn delete(&self, annotation_id: &str) -> AnnotationDeleteCall<'a, C, A> { - AnnotationDeleteCall { - hub: self.hub, - _annotation_id: annotation_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new annotation. Caller must have WRITE permission - /// for the associated annotation set. - /// - /// The following fields are required: - /// - /// * annotationSetId - /// * referenceName or - /// referenceId - /// - /// ### Transcripts - /// - /// For annotations of type TRANSCRIPT, the following fields of - /// transcript must be provided: - /// - /// * exons.start - /// * exons.end - /// - /// All other fields may be optionally specified, unless documented as being - /// server-generated (for example, the `id` field). The annotated - /// range must be no longer than 100Mbp (mega base pairs). See the - /// Annotation resource - /// for additional restrictions on each field. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: Annotation) -> AnnotationCreateCall<'a, C, A> { - AnnotationCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates one or more new annotations atomically. All annotations must - /// belong to the same annotation set. Caller must have WRITE - /// permission for this annotation set. For optimal performance, batch - /// positionally adjacent annotations together. - /// - /// If the request has a systemic issue, such as an attempt to write to - /// an inaccessible annotation set, the entire RPC will fail accordingly. For - /// lesser data issues, when possible an error will be isolated to the - /// corresponding batch entry in the response; the remaining well formed - /// annotations will be created normally. - /// - /// For details on the requirements for each individual annotation resource, - /// see - /// CreateAnnotation. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn batch_create(&self, request: BatchCreateAnnotationsRequest) -> AnnotationBatchCreateCall<'a, C, A> { - AnnotationBatchCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *annotationset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1 as genomics1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `delete(...)`, `get(...)`, `search(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.annotationsets(); -/// # } -/// ``` -pub struct AnnotationsetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for AnnotationsetMethods<'a, C, A> {} - -impl<'a, C, A> AnnotationsetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Updates an annotation set. The update must respect all mutability - /// restrictions and other invariants described on the annotation set resource. - /// Caller must have WRITE permission for the associated dataset. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `annotationSetId` - The ID of the annotation set to be updated. - pub fn update(&self, request: AnnotationSet, annotation_set_id: &str) -> AnnotationsetUpdateCall<'a, C, A> { - AnnotationsetUpdateCall { - hub: self.hub, - _request: request, - _annotation_set_id: annotation_set_id.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Searches for annotation sets that match the given criteria. Annotation sets - /// are returned in an unspecified order. This order is consistent, such that - /// two queries for the same content (regardless of page size) yield annotation - /// sets in the same order across their respective streams of paginated - /// responses. Caller must have READ permission for the queried datasets. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchAnnotationSetsRequest) -> AnnotationsetSearchCall<'a, C, A> { - AnnotationsetSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new annotation set. Caller must have WRITE permission for the - /// associated dataset. - /// - /// The following fields are required: - /// - /// * datasetId - /// * referenceSetId - /// - /// All other fields may be optionally specified, unless documented as being - /// server-generated (for example, the `id` field). - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: AnnotationSet) -> AnnotationsetCreateCall<'a, C, A> { - AnnotationsetCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes an annotation set. Caller must have WRITE permission - /// for the associated annotation set. - /// - /// # Arguments - /// - /// * `annotationSetId` - The ID of the annotation set to be deleted. - pub fn delete(&self, annotation_set_id: &str) -> AnnotationsetDeleteCall<'a, C, A> { - AnnotationsetDeleteCall { - hub: self.hub, - _annotation_set_id: annotation_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets an annotation set. Caller must have READ permission for - /// the associated dataset. - /// - /// # Arguments - /// - /// * `annotationSetId` - The ID of the annotation set to be retrieved. - pub fn get(&self, annotation_set_id: &str) -> AnnotationsetGetCall<'a, C, A> { - AnnotationsetGetCall { - hub: self.hub, - _annotation_set_id: annotation_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *variantset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1 as genomics1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `delete(...)`, `export(...)`, `get(...)`, `patch(...)` and `search(...)` -/// // to build up your call. -/// let rb = hub.variantsets(); -/// # } -/// ``` -pub struct VariantsetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for VariantsetMethods<'a, C, A> {} - -impl<'a, C, A> VariantsetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Creates a new variant set. - /// - /// The provided variant set must have a valid `datasetId` set - all other - /// fields are optional. Note that the `id` field will be ignored, as this is - /// assigned by the server. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: VariantSet) -> VariantsetCreateCall<'a, C, A> { - VariantsetCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a variant set including all variants, call sets, and calls within. - /// This is not reversible. - /// - /// # Arguments - /// - /// * `variantSetId` - The ID of the variant set to be deleted. - pub fn delete(&self, variant_set_id: &str) -> VariantsetDeleteCall<'a, C, A> { - VariantsetDeleteCall { - hub: self.hub, - _variant_set_id: variant_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Exports variant set data to an external destination. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `variantSetId` - Required. The ID of the variant set that contains variant data which - /// should be exported. The caller must have READ access to this variant set. - pub fn export(&self, request: ExportVariantSetRequest, variant_set_id: &str) -> VariantsetExportCall<'a, C, A> { - VariantsetExportCall { - hub: self.hub, - _request: request, - _variant_set_id: variant_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a variant set using patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `variantSetId` - The ID of the variant to be updated (must already exist). - pub fn patch(&self, request: VariantSet, variant_set_id: &str) -> VariantsetPatchCall<'a, C, A> { - VariantsetPatchCall { - hub: self.hub, - _request: request, - _variant_set_id: variant_set_id.to_string(), - _update_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns a list of all variant sets matching search criteria. - /// - /// Implements - /// [GlobalAllianceApi.searchVariantSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L49). - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchVariantSetsRequest) -> VariantsetSearchCall<'a, C, A> { - VariantsetSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a variant set by ID. - /// - /// # Arguments - /// - /// * `variantSetId` - Required. The ID of the variant set. - pub fn get(&self, variant_set_id: &str) -> VariantsetGetCall<'a, C, A> { - VariantsetGetCall { - hub: self.hub, - _variant_set_id: variant_set_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -4589,17 +657,12 @@ impl<'a, C, A> VariantsetMethods<'a, C, A> { // CallBuilders ### // ################# -/// Starts asynchronous cancellation on a long-running operation. -/// The server makes a best effort to cancel the operation, but success is not -/// guaranteed. Clients may use Operations.GetOperation -/// or Operations.ListOperations -/// to check whether the cancellation succeeded or the operation completed -/// despite cancellation. +/// Lists operations that match the specified filter in the request. /// Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission: /// -/// * `genomics.operations.cancel` +/// * `genomics.operations.list` /// -/// A builder for the *cancel* method supported by a *operation* resource. +/// A builder for the *list* method supported by a *operation* resource. /// It is not used directly, but through a `OperationMethods` instance. /// /// # Example @@ -4611,7 +674,6 @@ impl<'a, C, A> VariantsetMethods<'a, C, A> { /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_genomics1 as genomics1; -/// use genomics1::CancelOperationRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -4622,36 +684,36 @@ impl<'a, C, A> VariantsetMethods<'a, C, A> { /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = CancelOperationRequest::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.operations().cancel(req, "name") +/// let result = hub.operations().list("name") +/// .page_token("sea") +/// .page_size(-90) +/// .filter("dolores") /// .doit(); /// # } /// ``` -pub struct OperationCancelCall<'a, C, A> +pub struct OperationListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Genomics, - _request: CancelOperationRequest, _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OperationCancelCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for OperationListCall<'a, C, A> {} -impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -4660,11 +722,20 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.operations.cancel", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "genomics.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -4676,7 +747,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel"; + let mut url = self.hub._base_url.clone() + "v1/{+name}"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -4690,7 +761,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4706,22 +777,8 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -4738,15 +795,11 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } }; let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -4797,32 +850,73 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: CancelOperationRequest) -> OperationCancelCall<'a, C, A> { - self._request = new_value; - self - } - /// The name of the operation resource to be cancelled. + /// The name of the operation's parent resource. /// /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C, A> { self._name = new_value.to_string(); self } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of results to return. The maximum value is 256. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// A string for filtering Operations. + /// In v2alpha1, the following filter fields are supported: + /// + /// * createTime: The time this job was created + /// * events: The set of event (names) that have occurred while running + /// the pipeline. The : operator can be used to determine if a + /// particular event has occurred. + /// * error: If the pipeline is running, this value is NULL. Once the + /// pipeline finishes, the value is the standard Google error code. + /// * labels.key or labels."key with space" where key is a label key. + /// * done: If the pipeline is running, this value is false. Once the + /// pipeline finishes, the value is true. + /// + /// In v1 and v1alpha2, the following filter fields are supported: + /// + /// * projectId: Required. Corresponds to + /// OperationMetadata.projectId. + /// * createTime: The time this job was created, in seconds from the + /// [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `>=` and/or `<=` + /// operators. + /// * status: Can be `RUNNING`, `SUCCESS`, `FAILURE`, or `CANCELED`. Only + /// one status may be specified. + /// * labels.key where key is a label key. + /// + /// Examples: + /// + /// * `projectId = my-project AND createTime >= 1432140000` + /// * `projectId = my-project AND createTime >= 1432140000 AND createTime <= 1432150000 AND status = RUNNING` + /// * `projectId = my-project AND labels.color = *` + /// * `projectId = my-project AND labels.color = red` + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationCancelCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -4831,7 +925,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4839,15 +933,15 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> OperationCancelCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> OperationListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -4867,7 +961,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> OperationCancelCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -4970,7 +1064,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4986,10 +1080,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5009,7 +1100,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5087,7 +1178,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5095,12 +1186,12 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> @@ -5135,12 +1226,17 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } -/// Lists operations that match the specified filter in the request. +/// Starts asynchronous cancellation on a long-running operation. +/// The server makes a best effort to cancel the operation, but success is not +/// guaranteed. Clients may use Operations.GetOperation +/// or Operations.ListOperations +/// to check whether the cancellation succeeded or the operation completed +/// despite cancellation. /// Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission: /// -/// * `genomics.operations.list` +/// * `genomics.operations.cancel` /// -/// A builder for the *list* method supported by a *operation* resource. +/// A builder for the *cancel* method supported by a *operation* resource. /// It is not used directly, but through a `OperationMethods` instance. /// /// # Example @@ -5152,6 +1248,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_genomics1 as genomics1; +/// use genomics1::CancelOperationRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -5162,36 +1259,36 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CancelOperationRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.operations().list("name") -/// .page_token("justo") -/// .page_size(-1) -/// .filter("erat") +/// let result = hub.operations().cancel(req, "name") /// .doit(); /// # } /// ``` -pub struct OperationListCall<'a, C, A> +pub struct OperationCancelCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Genomics, + _request: CancelOperationRequest, _name: String, - _page_token: Option, - _page_size: Option, - _filter: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OperationListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for OperationCancelCall<'a, C, A> {} -impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -5200,20 +1297,11 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.operations.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "genomics.operations.cancel", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("name", self._name.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } - for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + for &field in ["alt", "name"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5225,7 +1313,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/{+name}"; + let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -5239,7 +1327,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5255,11 +1343,19 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -5276,11 +1372,15 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } }; let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -5331,74 +1431,32 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } - /// The name of the operation's parent resource. + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CancelOperationRequest) -> OperationCancelCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the operation resource to be cancelled. /// /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a, C, A> { self._name = new_value.to_string(); self } - /// The standard list page token. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// The maximum number of results to return. If unspecified, defaults to - /// 256. The maximum value is 2048. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// A string for filtering Operations. - /// In v2alpha1, the following filter fields are supported: - /// - /// * createTime: The time this job was created - /// * events: The set of event (names) that have occurred while running - /// the pipeline. The : operator can be used to determine if a - /// particular event has occurred. - /// * error: If the pipeline is running, this value is NULL. Once the - /// pipeline finishes, the value is the standard Google error code. - /// * labels.key or labels."key with space" where key is a label key. - /// * done: If the pipeline is running, this value is false. Once the - /// pipeline finishes, the value is true. - /// - /// In v1 and v1alpha2, the following filter fields are supported: - /// - /// * projectId: Required. Corresponds to - /// OperationMetadata.projectId. - /// * createTime: The time this job was created, in seconds from the - /// [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `>=` and/or `<=` - /// operators. - /// * status: Can be `RUNNING`, `SUCCESS`, `FAILURE`, or `CANCELED`. Only - /// one status may be specified. - /// * labels.key where key is a label key. - /// - /// Examples: - /// - /// * `projectId = my-project AND createTime >= 1432140000` - /// * `projectId = my-project AND createTime >= 1432140000 AND createTime <= 1432150000 AND status = RUNNING` - /// * `projectId = my-project AND labels.color = *` - /// * `projectId = my-project AND labels.color = red` - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationCancelCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -5407,7 +1465,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5415,15 +1473,15 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> OperationListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> OperationCancelCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -5443,13509 +1501,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> OperationListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a new dataset. -/// -/// A builder for the *create* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::Dataset; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Dataset::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.datasets().create(req) -/// .doit(); -/// # } -/// ``` -pub struct DatasetCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Dataset, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetCreateCall<'a, C, A> {} - -impl<'a, C, A> DatasetCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/datasets"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Dataset) -> DatasetCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> DatasetCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> DatasetCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> DatasetCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes a dataset and all of its contents (all read group sets, -/// reference sets, variant sets, call sets, annotation sets, etc.) -/// This is reversible (up to one week after the deletion) via -/// the -/// datasets.undelete -/// operation. -/// -/// A builder for the *delete* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.datasets().delete("datasetId") -/// .doit(); -/// # } -/// ``` -pub struct DatasetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _dataset_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetDeleteCall<'a, C, A> {} - -impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("datasetId", self._dataset_id.to_string())); - for &field in ["alt", "datasetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/datasets/{datasetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{datasetId}", "datasetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["datasetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the dataset to be deleted. - /// - /// Sets the *dataset id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn dataset_id(mut self, new_value: &str) -> DatasetDeleteCall<'a, C, A> { - self._dataset_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> DatasetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> DatasetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> DatasetDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Undeletes a dataset by restoring a dataset which was deleted via this API. -/// -/// This operation is only possible for a week after the deletion occurred. -/// -/// A builder for the *undelete* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::UndeleteDatasetRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = UndeleteDatasetRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.datasets().undelete(req, "datasetId") -/// .doit(); -/// # } -/// ``` -pub struct DatasetUndeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: UndeleteDatasetRequest, - _dataset_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetUndeleteCall<'a, C, A> {} - -impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.undelete", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("datasetId", self._dataset_id.to_string())); - for &field in ["alt", "datasetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/datasets/{datasetId}:undelete"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{datasetId}", "datasetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["datasetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: UndeleteDatasetRequest) -> DatasetUndeleteCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the dataset to be undeleted. - /// - /// Sets the *dataset id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn dataset_id(mut self, new_value: &str) -> DatasetUndeleteCall<'a, C, A> { - self._dataset_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> DatasetUndeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> DatasetUndeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> DatasetUndeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Sets the access control policy on the specified dataset. Replaces any -/// existing policy. -/// -/// See Setting a -/// Policy for more information. -/// -/// A builder for the *setIamPolicy* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::SetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.datasets().set_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct DatasetSetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetSetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> DatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.setIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SetIamPolicyRequest) -> DatasetSetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which policy is being specified. Format is - /// `datasets/`. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> DatasetSetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> DatasetSetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> DatasetSetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> DatasetSetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns permissions that a caller has on the specified resource. -/// See Testing -/// Permissions for more information. -/// -/// A builder for the *testIamPermissions* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::TestIamPermissionsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = TestIamPermissionsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.datasets().test_iam_permissions(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct DatasetTestIamPermissionCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: TestIamPermissionsRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetTestIamPermissionCall<'a, C, A> {} - -impl<'a, C, A> DatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.testIamPermissions", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: TestIamPermissionsRequest) -> DatasetTestIamPermissionCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which policy is being specified. Format is - /// `datasets/`. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> DatasetTestIamPermissionCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> DatasetTestIamPermissionCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> DatasetTestIamPermissionCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> DatasetTestIamPermissionCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a dataset by ID. -/// -/// A builder for the *get* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.datasets().get("datasetId") -/// .doit(); -/// # } -/// ``` -pub struct DatasetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _dataset_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetGetCall<'a, C, A> {} - -impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("datasetId", self._dataset_id.to_string())); - for &field in ["alt", "datasetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/datasets/{datasetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{datasetId}", "datasetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["datasetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the dataset. - /// - /// Sets the *dataset id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn dataset_id(mut self, new_value: &str) -> DatasetGetCall<'a, C, A> { - self._dataset_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> DatasetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> DatasetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> DatasetGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists datasets within a project. -/// -/// A builder for the *list* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.datasets().list() -/// .project_id("sadipscing") -/// .page_token("aliquyam") -/// .page_size(-66) -/// .doit(); -/// # } -/// ``` -pub struct DatasetListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _project_id: Option, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetListCall<'a, C, A> {} - -impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListDatasetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - if let Some(value) = self._project_id { - params.push(("projectId", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "projectId", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/datasets"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The Google Cloud project ID to list datasets for. - /// - /// Sets the *project id* query property to the given value. - pub fn project_id(mut self, new_value: &str) -> DatasetListCall<'a, C, A> { - self._project_id = Some(new_value.to_string()); - self - } - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> DatasetListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// The maximum number of results to return in a single page. If unspecified, - /// defaults to 50. The maximum value is 1024. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> DatasetListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> DatasetListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> DatasetListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> DatasetListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets the access control policy for the dataset. This is empty if the -/// policy or resource does not exist. -/// -/// See Getting a -/// Policy for more information. -/// -/// A builder for the *getIamPolicy* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::GetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.datasets().get_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct DatasetGetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: GetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetGetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.getIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GetIamPolicyRequest) -> DatasetGetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which policy is being specified. Format is - /// `datasets/`. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> DatasetGetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> DatasetGetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> DatasetGetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> DatasetGetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates a dataset. -/// -/// This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::Dataset; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Dataset::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.datasets().patch(req, "datasetId") -/// .update_mask("justo") -/// .doit(); -/// # } -/// ``` -pub struct DatasetPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Dataset, - _dataset_id: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetPatchCall<'a, C, A> {} - -impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("datasetId", self._dataset_id.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "datasetId", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/datasets/{datasetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{datasetId}", "datasetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["datasetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Dataset) -> DatasetPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the dataset to be updated. - /// - /// Sets the *dataset id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn dataset_id(mut self, new_value: &str) -> DatasetPatchCall<'a, C, A> { - self._dataset_id = new_value.to_string(); - self - } - /// An optional mask specifying which fields to update. At this time, the only - /// mutable field is name. The only - /// acceptable value is "name". If unspecified, all mutable fields will be - /// updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> DatasetPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> DatasetPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> DatasetPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> DatasetPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Searches for reference sets which match the given criteria. -/// -/// Implements -/// [GlobalAllianceApi.searchReferenceSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L71) -/// -/// A builder for the *search* method supported by a *referenceset* resource. -/// It is not used directly, but through a `ReferencesetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::SearchReferenceSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchReferenceSetsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.referencesets().search(req) -/// .doit(); -/// # } -/// ``` -pub struct ReferencesetSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchReferenceSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReferencesetSearchCall<'a, C, A> {} - -impl<'a, C, A> ReferencesetSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchReferenceSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.referencesets.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/referencesets/search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchReferenceSetsRequest) -> ReferencesetSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReferencesetSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReferencesetSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReferencesetSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a reference set. -/// -/// Implements -/// [GlobalAllianceApi.getReferenceSet](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L83). -/// -/// A builder for the *get* method supported by a *referenceset* resource. -/// It is not used directly, but through a `ReferencesetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.referencesets().get("referenceSetId") -/// .doit(); -/// # } -/// ``` -pub struct ReferencesetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _reference_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReferencesetGetCall<'a, C, A> {} - -impl<'a, C, A> ReferencesetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ReferenceSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.referencesets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("referenceSetId", self._reference_set_id.to_string())); - for &field in ["alt", "referenceSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/referencesets/{referenceSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{referenceSetId}", "referenceSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["referenceSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the reference set. - /// - /// Sets the *reference set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn reference_set_id(mut self, new_value: &str) -> ReferencesetGetCall<'a, C, A> { - self._reference_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReferencesetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReferencesetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReferencesetGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a list of call sets matching the criteria. -/// -/// Implements -/// [GlobalAllianceApi.searchCallSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L178). -/// -/// A builder for the *search* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::SearchCallSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchCallSetsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.callsets().search(req) -/// .doit(); -/// # } -/// ``` -pub struct CallsetSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchCallSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetSearchCall<'a, C, A> {} - -impl<'a, C, A> CallsetSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchCallSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/callsets/search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchCallSetsRequest) -> CallsetSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CallsetSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> CallsetSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CallsetSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates a call set. -/// -/// This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::CallSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = CallSet::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.callsets().patch(req, "callSetId") -/// .update_mask("diam") -/// .doit(); -/// # } -/// ``` -pub struct CallsetPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: CallSet, - _call_set_id: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetPatchCall<'a, C, A> {} - -impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CallSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("callSetId", self._call_set_id.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "callSetId", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/callsets/{callSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{callSetId}", "callSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["callSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: CallSet) -> CallsetPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the call set to be updated. - /// - /// Sets the *call set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn call_set_id(mut self, new_value: &str) -> CallsetPatchCall<'a, C, A> { - self._call_set_id = new_value.to_string(); - self - } - /// An optional mask specifying which fields to update. At this time, the only - /// mutable field is name. The only - /// acceptable value is "name". If unspecified, all mutable fields will be - /// updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> CallsetPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CallsetPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> CallsetPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CallsetPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a new call set. -/// -/// A builder for the *create* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::CallSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = CallSet::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.callsets().create(req) -/// .doit(); -/// # } -/// ``` -pub struct CallsetCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: CallSet, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetCreateCall<'a, C, A> {} - -impl<'a, C, A> CallsetCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CallSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/callsets"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: CallSet) -> CallsetCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CallsetCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> CallsetCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CallsetCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes a call set. -/// -/// A builder for the *delete* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.callsets().delete("callSetId") -/// .doit(); -/// # } -/// ``` -pub struct CallsetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _call_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetDeleteCall<'a, C, A> {} - -impl<'a, C, A> CallsetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("callSetId", self._call_set_id.to_string())); - for &field in ["alt", "callSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/callsets/{callSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{callSetId}", "callSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["callSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the call set to be deleted. - /// - /// Sets the *call set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn call_set_id(mut self, new_value: &str) -> CallsetDeleteCall<'a, C, A> { - self._call_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CallsetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> CallsetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CallsetDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a call set by ID. -/// -/// A builder for the *get* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.callsets().get("callSetId") -/// .doit(); -/// # } -/// ``` -pub struct CallsetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _call_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetGetCall<'a, C, A> {} - -impl<'a, C, A> CallsetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CallSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("callSetId", self._call_set_id.to_string())); - for &field in ["alt", "callSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/callsets/{callSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{callSetId}", "callSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["callSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the call set. - /// - /// Sets the *call set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn call_set_id(mut self, new_value: &str) -> CallsetGetCall<'a, C, A> { - self._call_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CallsetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> CallsetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CallsetGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a list of reads for one or more read group sets. -/// -/// Reads search operates over a genomic coordinate space of reference sequence -/// & position defined over the reference sequences to which the requested -/// read group sets are aligned. -/// -/// If a target positional range is specified, search returns all reads whose -/// alignment to the reference genome overlap the range. A query which -/// specifies only read group set IDs yields all reads in those read group -/// sets, including unmapped reads. -/// -/// All reads returned (including reads on subsequent pages) are ordered by -/// genomic coordinate (by reference sequence, then position). Reads with -/// equivalent genomic coordinates are returned in an unspecified order. This -/// order is consistent, such that two queries for the same content (regardless -/// of page size) yield reads in the same order across their respective streams -/// of paginated responses. -/// -/// Implements -/// [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85). -/// -/// A builder for the *search* method supported by a *read* resource. -/// It is not used directly, but through a `ReadMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::SearchReadsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchReadsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.reads().search(req) -/// .doit(); -/// # } -/// ``` -pub struct ReadSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchReadsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadSearchCall<'a, C, A> {} - -impl<'a, C, A> ReadSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchReadsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.reads.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/reads/search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchReadsRequest) -> ReadSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReadSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReadSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReadSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Exports a read group set to a BAM file in Google Cloud Storage. -/// -/// Note that currently there may be some differences between exported BAM -/// files and the original BAM file at the time of import. See -/// ImportReadGroupSets -/// for caveats. -/// -/// A builder for the *export* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::ExportReadGroupSetRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ExportReadGroupSetRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.readgroupsets().export(req, "readGroupSetId") -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetExportCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ExportReadGroupSetRequest, - _read_group_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetExportCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetExportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.export", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("readGroupSetId", self._read_group_set_id.to_string())); - for &field in ["alt", "readGroupSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/readgroupsets/{readGroupSetId}:export"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{readGroupSetId}", "readGroupSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["readGroupSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ExportReadGroupSetRequest) -> ReadgroupsetExportCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The ID of the read group set to export. The caller must have - /// READ access to this read group set. - /// - /// Sets the *read group set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetExportCall<'a, C, A> { - self._read_group_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReadgroupsetExportCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetExportCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReadgroupsetExportCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates read group sets by asynchronously importing the provided -/// information. -/// -/// The caller must have WRITE permissions to the dataset. -/// -/// ## Notes on [BAM](https://samtools.github.io/hts-specs/SAMv1.pdf) import -/// -/// - Tags will be converted to strings - tag types are not preserved -/// - Comments (`@CO`) in the input file header will not be preserved -/// - Original header order of references (`@SQ`) will not be preserved -/// - Any reverse stranded unmapped reads will be reverse complemented, and -/// their qualities (also the "BQ" and "OQ" tags, if any) will be reversed -/// - Unmapped reads will be stripped of positional information (reference name -/// and position) -/// -/// A builder for the *import* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::ImportReadGroupSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ImportReadGroupSetsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.readgroupsets().import(req) -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetImportCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ImportReadGroupSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetImportCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetImportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.import", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/readgroupsets:import"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ImportReadGroupSetsRequest) -> ReadgroupsetImportCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReadgroupsetImportCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetImportCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReadgroupsetImportCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates a read group set. -/// -/// This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::ReadGroupSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ReadGroupSet::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.readgroupsets().patch(req, "readGroupSetId") -/// .update_mask("aliquyam") -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ReadGroupSet, - _read_group_set_id: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetPatchCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ReadGroupSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("readGroupSetId", self._read_group_set_id.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "readGroupSetId", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/readgroupsets/{readGroupSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{readGroupSetId}", "readGroupSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["readGroupSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ReadGroupSet) -> ReadgroupsetPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the read group set to be updated. The caller must have WRITE - /// permissions to the dataset associated with this read group set. - /// - /// Sets the *read group set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetPatchCall<'a, C, A> { - self._read_group_set_id = new_value.to_string(); - self - } - /// An optional mask specifying which fields to update. Supported fields: - /// - /// * name. - /// * referenceSetId. - /// - /// Leaving `updateMask` unset is equivalent to specifying all mutable - /// fields. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ReadgroupsetPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReadgroupsetPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReadgroupsetPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a read group set by ID. -/// -/// A builder for the *get* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.readgroupsets().get("readGroupSetId") -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _read_group_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetGetCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ReadGroupSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("readGroupSetId", self._read_group_set_id.to_string())); - for &field in ["alt", "readGroupSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/readgroupsets/{readGroupSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{readGroupSetId}", "readGroupSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["readGroupSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the read group set. - /// - /// Sets the *read group set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetGetCall<'a, C, A> { - self._read_group_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReadgroupsetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReadgroupsetGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists fixed width coverage buckets for a read group set, each of which -/// correspond to a range of a reference sequence. Each bucket summarizes -/// coverage information across its corresponding genomic range. -/// -/// Coverage is defined as the number of reads which are aligned to a given -/// base in the reference sequence. Coverage buckets are available at several -/// precomputed bucket widths, enabling retrieval of various coverage 'zoom -/// levels'. The caller must have READ permissions for the target read group -/// set. -/// -/// A builder for the *coveragebuckets.list* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.readgroupsets().coveragebuckets_list("readGroupSetId") -/// .target_bucket_width("eos") -/// .start("erat") -/// .reference_name("sadipscing") -/// .page_token("dolor") -/// .page_size(-39) -/// .end("elitr") -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetCoveragebucketListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _read_group_set_id: String, - _target_bucket_width: Option, - _start: Option, - _reference_name: Option, - _page_token: Option, - _page_size: Option, - _end: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetCoveragebucketListCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetCoveragebucketListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListCoverageBucketsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.coveragebuckets.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); - params.push(("readGroupSetId", self._read_group_set_id.to_string())); - if let Some(value) = self._target_bucket_width { - params.push(("targetBucketWidth", value.to_string())); - } - if let Some(value) = self._start { - params.push(("start", value.to_string())); - } - if let Some(value) = self._reference_name { - params.push(("referenceName", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if let Some(value) = self._end { - params.push(("end", value.to_string())); - } - for &field in ["alt", "readGroupSetId", "targetBucketWidth", "start", "referenceName", "pageToken", "pageSize", "end"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/readgroupsets/{readGroupSetId}/coveragebuckets"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{readGroupSetId}", "readGroupSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["readGroupSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The ID of the read group set over which coverage is requested. - /// - /// Sets the *read group set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._read_group_set_id = new_value.to_string(); - self - } - /// The desired width of each reported coverage bucket in base pairs. This - /// will be rounded down to the nearest precomputed bucket width; the value - /// of which is returned as `bucketWidth` in the response. Defaults - /// to infinity (each bucket spans an entire reference sequence) or the length - /// of the target range, if specified. The smallest precomputed - /// `bucketWidth` is currently 2048 base pairs; this is subject to - /// change. - /// - /// Sets the *target bucket width* query property to the given value. - pub fn target_bucket_width(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._target_bucket_width = Some(new_value.to_string()); - self - } - /// The start position of the range on the reference, 0-based inclusive. If - /// specified, `referenceName` must also be specified. Defaults to 0. - /// - /// Sets the *start* query property to the given value. - pub fn start(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._start = Some(new_value.to_string()); - self - } - /// The name of the reference to query, within the reference set associated - /// with this query. Optional. - /// - /// Sets the *reference name* query property to the given value. - pub fn reference_name(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._reference_name = Some(new_value.to_string()); - self - } - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// The maximum number of results to return in a single page. If unspecified, - /// defaults to 1024. The maximum value is 2048. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The end position of the range on the reference, 0-based exclusive. If - /// specified, `referenceName` must also be specified. If unset or 0, defaults - /// to the length of the reference. - /// - /// Sets the *end* query property to the given value. - pub fn end(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._end = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetCoveragebucketListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReadgroupsetCoveragebucketListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes a read group set. -/// -/// A builder for the *delete* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.readgroupsets().delete("readGroupSetId") -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _read_group_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetDeleteCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("readGroupSetId", self._read_group_set_id.to_string())); - for &field in ["alt", "readGroupSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/readgroupsets/{readGroupSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{readGroupSetId}", "readGroupSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["readGroupSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the read group set to be deleted. The caller must have WRITE - /// permissions to the dataset associated with this read group set. - /// - /// Sets the *read group set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetDeleteCall<'a, C, A> { - self._read_group_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReadgroupsetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReadgroupsetDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Searches for read group sets matching the criteria. -/// -/// Implements -/// [GlobalAllianceApi.searchReadGroupSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L135). -/// -/// A builder for the *search* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::SearchReadGroupSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchReadGroupSetsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.readgroupsets().search(req) -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchReadGroupSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetSearchCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchReadGroupSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/readgroupsets/search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchReadGroupSetsRequest) -> ReadgroupsetSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReadgroupsetSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReadgroupsetSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists the bases in a reference, optionally restricted to a range. -/// -/// Implements -/// [GlobalAllianceApi.getReferenceBases](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L221). -/// -/// A builder for the *bases.list* method supported by a *reference* resource. -/// It is not used directly, but through a `ReferenceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.references().bases_list("referenceId") -/// .start("labore") -/// .page_token("eirmod") -/// .page_size(-33) -/// .end("invidunt") -/// .doit(); -/// # } -/// ``` -pub struct ReferenceBaseListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _reference_id: String, - _start: Option, - _page_token: Option, - _page_size: Option, - _end: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReferenceBaseListCall<'a, C, A> {} - -impl<'a, C, A> ReferenceBaseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListBasesResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.references.bases.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); - params.push(("referenceId", self._reference_id.to_string())); - if let Some(value) = self._start { - params.push(("start", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if let Some(value) = self._end { - params.push(("end", value.to_string())); - } - for &field in ["alt", "referenceId", "start", "pageToken", "pageSize", "end"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/references/{referenceId}/bases"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{referenceId}", "referenceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["referenceId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the reference. - /// - /// Sets the *reference id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn reference_id(mut self, new_value: &str) -> ReferenceBaseListCall<'a, C, A> { - self._reference_id = new_value.to_string(); - self - } - /// The start position (0-based) of this query. Defaults to 0. - /// - /// Sets the *start* query property to the given value. - pub fn start(mut self, new_value: &str) -> ReferenceBaseListCall<'a, C, A> { - self._start = Some(new_value.to_string()); - self - } - /// The continuation token, which is used to page through large result sets. - /// To get the next page of results, set this parameter to the value of - /// `nextPageToken` from the previous response. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ReferenceBaseListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// The maximum number of bases to return in a single page. If unspecified, - /// defaults to 200Kbp (kilo base pairs). The maximum value is 10Mbp (mega base - /// pairs). - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ReferenceBaseListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The end position (0-based, exclusive) of this query. Defaults to the length - /// of this reference. - /// - /// Sets the *end* query property to the given value. - pub fn end(mut self, new_value: &str) -> ReferenceBaseListCall<'a, C, A> { - self._end = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReferenceBaseListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReferenceBaseListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReferenceBaseListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Searches for references which match the given criteria. -/// -/// Implements -/// [GlobalAllianceApi.searchReferences](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L146). -/// -/// A builder for the *search* method supported by a *reference* resource. -/// It is not used directly, but through a `ReferenceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::SearchReferencesRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchReferencesRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.references().search(req) -/// .doit(); -/// # } -/// ``` -pub struct ReferenceSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchReferencesRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReferenceSearchCall<'a, C, A> {} - -impl<'a, C, A> ReferenceSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchReferencesResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.references.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/references/search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchReferencesRequest) -> ReferenceSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReferenceSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReferenceSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReferenceSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a reference. -/// -/// Implements -/// [GlobalAllianceApi.getReference](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L158). -/// -/// A builder for the *get* method supported by a *reference* resource. -/// It is not used directly, but through a `ReferenceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.references().get("referenceId") -/// .doit(); -/// # } -/// ``` -pub struct ReferenceGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _reference_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReferenceGetCall<'a, C, A> {} - -impl<'a, C, A> ReferenceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Reference)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.references.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("referenceId", self._reference_id.to_string())); - for &field in ["alt", "referenceId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/references/{referenceId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{referenceId}", "referenceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["referenceId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the reference. - /// - /// Sets the *reference id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn reference_id(mut self, new_value: &str) -> ReferenceGetCall<'a, C, A> { - self._reference_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ReferenceGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ReferenceGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ReferenceGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a list of variants matching the criteria. -/// -/// Implements -/// [GlobalAllianceApi.searchVariants](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L126). -/// -/// A builder for the *search* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::SearchVariantsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchVariantsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variants().search(req) -/// .doit(); -/// # } -/// ``` -pub struct VariantSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchVariantsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantSearchCall<'a, C, A> {} - -impl<'a, C, A> VariantSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchVariantsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variants/search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchVariantsRequest) -> VariantSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes a variant. -/// -/// A builder for the *delete* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variants().delete("variantId") -/// .doit(); -/// # } -/// ``` -pub struct VariantDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _variant_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantDeleteCall<'a, C, A> {} - -impl<'a, C, A> VariantDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("variantId", self._variant_id.to_string())); - for &field in ["alt", "variantId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variants/{variantId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantId}", "variantId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the variant to be deleted. - /// - /// Sets the *variant id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_id(mut self, new_value: &str) -> VariantDeleteCall<'a, C, A> { - self._variant_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a variant by ID. -/// -/// A builder for the *get* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variants().get("variantId") -/// .doit(); -/// # } -/// ``` -pub struct VariantGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _variant_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantGetCall<'a, C, A> {} - -impl<'a, C, A> VariantGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Variant)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("variantId", self._variant_id.to_string())); - for &field in ["alt", "variantId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variants/{variantId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantId}", "variantId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the variant. - /// - /// Sets the *variant id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_id(mut self, new_value: &str) -> VariantGetCall<'a, C, A> { - self._variant_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Merges the given variants with existing variants. -/// -/// Each variant will be -/// merged with an existing variant that matches its reference sequence, -/// start, end, reference bases, and alternative bases. If no such variant -/// exists, a new one will be created. -/// -/// When variants are merged, the call information from the new variant -/// is added to the existing variant. Variant info fields are merged as -/// specified in the -/// infoMergeConfig -/// field of the MergeVariantsRequest. -/// -/// Please exercise caution when using this method! It is easy to introduce -/// mistakes in existing variants and difficult to back out of them. For -/// example, -/// suppose you were trying to merge a new variant with an existing one and -/// both -/// variants contain calls that belong to callsets with the same callset ID. -/// -/// // Existing variant - irrelevant fields trimmed for clarity -/// { -/// "variantSetId": "10473108253681171589", -/// "referenceName": "1", -/// "start": "10582", -/// "referenceBases": "G", -/// "alternateBases": [ -/// "A" -/// ], -/// "calls": [ -/// { -/// "callSetId": "10473108253681171589-0", -/// "callSetName": "CALLSET0", -/// "genotype": [ -/// 0, -/// 1 -/// ], -/// } -/// ] -/// } -/// -/// // New variant with conflicting call information -/// { -/// "variantSetId": "10473108253681171589", -/// "referenceName": "1", -/// "start": "10582", -/// "referenceBases": "G", -/// "alternateBases": [ -/// "A" -/// ], -/// "calls": [ -/// { -/// "callSetId": "10473108253681171589-0", -/// "callSetName": "CALLSET0", -/// "genotype": [ -/// 1, -/// 1 -/// ], -/// } -/// ] -/// } -/// -/// The resulting merged variant would overwrite the existing calls with those -/// from the new variant: -/// -/// { -/// "variantSetId": "10473108253681171589", -/// "referenceName": "1", -/// "start": "10582", -/// "referenceBases": "G", -/// "alternateBases": [ -/// "A" -/// ], -/// "calls": [ -/// { -/// "callSetId": "10473108253681171589-0", -/// "callSetName": "CALLSET0", -/// "genotype": [ -/// 1, -/// 1 -/// ], -/// } -/// ] -/// } -/// -/// This may be the desired outcome, but it is up to the user to determine if -/// if that is indeed the case. -/// -/// A builder for the *merge* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::MergeVariantsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = MergeVariantsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variants().merge(req) -/// .doit(); -/// # } -/// ``` -pub struct VariantMergeCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: MergeVariantsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantMergeCall<'a, C, A> {} - -impl<'a, C, A> VariantMergeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.merge", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variants:merge"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: MergeVariantsRequest) -> VariantMergeCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantMergeCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantMergeCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantMergeCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a new variant. -/// -/// A builder for the *create* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::Variant; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Variant::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variants().create(req) -/// .doit(); -/// # } -/// ``` -pub struct VariantCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Variant, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantCreateCall<'a, C, A> {} - -impl<'a, C, A> VariantCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Variant)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variants"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Variant) -> VariantCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates variant data by asynchronously importing the provided information. -/// -/// The variants for import will be merged with any existing variant that -/// matches its reference sequence, start, end, reference bases, and -/// alternative bases. If no such variant exists, a new one will be created. -/// -/// When variants are merged, the call information from the new variant -/// is added to the existing variant, and Variant info fields are merged -/// as specified in -/// infoMergeConfig. -/// As a special case, for single-sample VCF files, QUAL and FILTER fields will -/// be moved to the call level; these are sometimes interpreted in a -/// call-specific context. -/// Imported VCF headers are appended to the metadata already in a variant set. -/// -/// A builder for the *import* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::ImportVariantsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ImportVariantsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variants().import(req) -/// .doit(); -/// # } -/// ``` -pub struct VariantImportCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ImportVariantsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantImportCall<'a, C, A> {} - -impl<'a, C, A> VariantImportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.import", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variants:import"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ImportVariantsRequest) -> VariantImportCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantImportCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantImportCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantImportCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates a variant. -/// -/// This method supports patch semantics. Returns the modified variant without -/// its calls. -/// -/// A builder for the *patch* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::Variant; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Variant::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variants().patch(req, "variantId") -/// .update_mask("et") -/// .doit(); -/// # } -/// ``` -pub struct VariantPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Variant, - _variant_id: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantPatchCall<'a, C, A> {} - -impl<'a, C, A> VariantPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Variant)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("variantId", self._variant_id.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "variantId", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variants/{variantId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantId}", "variantId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Variant) -> VariantPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the variant to be updated. - /// - /// Sets the *variant id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_id(mut self, new_value: &str) -> VariantPatchCall<'a, C, A> { - self._variant_id = new_value.to_string(); - self - } - /// An optional mask specifying which fields to update. At this time, mutable - /// fields are names and - /// info. Acceptable values are "names" and - /// "info". If unspecified, all mutable fields will be updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> VariantPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates an annotation. Caller must have -/// WRITE permission for the associated dataset. -/// -/// A builder for the *update* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::Annotation; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Annotation::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotations().update(req, "annotationId") -/// .update_mask("et") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Annotation, - _annotation_id: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationUpdateCall<'a, C, A> {} - -impl<'a, C, A> AnnotationUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Annotation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("annotationId", self._annotation_id.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "annotationId", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotations/{annotationId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationId}", "annotationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Annotation) -> AnnotationUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the annotation to be updated. - /// - /// Sets the *annotation id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_id(mut self, new_value: &str) -> AnnotationUpdateCall<'a, C, A> { - self._annotation_id = new_value.to_string(); - self - } - /// An optional mask specifying which fields to update. Mutable fields are - /// name, - /// variant, - /// transcript, and - /// info. If unspecified, all mutable - /// fields will be updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> AnnotationUpdateCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationUpdateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets an annotation. Caller must have READ permission -/// for the associated annotation set. -/// -/// A builder for the *get* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotations().get("annotationId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _annotation_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationGetCall<'a, C, A> {} - -impl<'a, C, A> AnnotationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Annotation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("annotationId", self._annotation_id.to_string())); - for &field in ["alt", "annotationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotations/{annotationId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationId}", "annotationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the annotation to be retrieved. - /// - /// Sets the *annotation id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_id(mut self, new_value: &str) -> AnnotationGetCall<'a, C, A> { - self._annotation_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Searches for annotations that match the given criteria. Results are -/// ordered by genomic coordinate (by reference sequence, then position). -/// Annotations with equivalent genomic coordinates are returned in an -/// unspecified order. This order is consistent, such that two queries for the -/// same content (regardless of page size) yield annotations in the same order -/// across their respective streams of paginated responses. Caller must have -/// READ permission for the queried annotation sets. -/// -/// A builder for the *search* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::SearchAnnotationsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchAnnotationsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotations().search(req) -/// .doit(); -/// # } -/// ``` -pub struct AnnotationSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchAnnotationsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationSearchCall<'a, C, A> {} - -impl<'a, C, A> AnnotationSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchAnnotationsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotations/search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchAnnotationsRequest) -> AnnotationSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes an annotation. Caller must have WRITE permission for -/// the associated annotation set. -/// -/// A builder for the *delete* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotations().delete("annotationId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _annotation_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationDeleteCall<'a, C, A> {} - -impl<'a, C, A> AnnotationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("annotationId", self._annotation_id.to_string())); - for &field in ["alt", "annotationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotations/{annotationId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationId}", "annotationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the annotation to be deleted. - /// - /// Sets the *annotation id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_id(mut self, new_value: &str) -> AnnotationDeleteCall<'a, C, A> { - self._annotation_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a new annotation. Caller must have WRITE permission -/// for the associated annotation set. -/// -/// The following fields are required: -/// -/// * annotationSetId -/// * referenceName or -/// referenceId -/// -/// ### Transcripts -/// -/// For annotations of type TRANSCRIPT, the following fields of -/// transcript must be provided: -/// -/// * exons.start -/// * exons.end -/// -/// All other fields may be optionally specified, unless documented as being -/// server-generated (for example, the `id` field). The annotated -/// range must be no longer than 100Mbp (mega base pairs). See the -/// Annotation resource -/// for additional restrictions on each field. -/// -/// A builder for the *create* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::Annotation; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Annotation::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotations().create(req) -/// .doit(); -/// # } -/// ``` -pub struct AnnotationCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Annotation, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationCreateCall<'a, C, A> {} - -impl<'a, C, A> AnnotationCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Annotation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotations"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Annotation) -> AnnotationCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates one or more new annotations atomically. All annotations must -/// belong to the same annotation set. Caller must have WRITE -/// permission for this annotation set. For optimal performance, batch -/// positionally adjacent annotations together. -/// -/// If the request has a systemic issue, such as an attempt to write to -/// an inaccessible annotation set, the entire RPC will fail accordingly. For -/// lesser data issues, when possible an error will be isolated to the -/// corresponding batch entry in the response; the remaining well formed -/// annotations will be created normally. -/// -/// For details on the requirements for each individual annotation resource, -/// see -/// CreateAnnotation. -/// -/// A builder for the *batchCreate* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::BatchCreateAnnotationsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = BatchCreateAnnotationsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotations().batch_create(req) -/// .doit(); -/// # } -/// ``` -pub struct AnnotationBatchCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: BatchCreateAnnotationsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationBatchCreateCall<'a, C, A> {} - -impl<'a, C, A> AnnotationBatchCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, BatchCreateAnnotationsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.batchCreate", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotations:batchCreate"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: BatchCreateAnnotationsRequest) -> AnnotationBatchCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationBatchCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationBatchCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationBatchCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates an annotation set. The update must respect all mutability -/// restrictions and other invariants described on the annotation set resource. -/// Caller must have WRITE permission for the associated dataset. -/// -/// A builder for the *update* method supported by a *annotationset* resource. -/// It is not used directly, but through a `AnnotationsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::AnnotationSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = AnnotationSet::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotationsets().update(req, "annotationSetId") -/// .update_mask("amet") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationsetUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: AnnotationSet, - _annotation_set_id: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationsetUpdateCall<'a, C, A> {} - -impl<'a, C, A> AnnotationsetUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AnnotationSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationsets.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("annotationSetId", self._annotation_set_id.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "annotationSetId", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotationsets/{annotationSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationSetId}", "annotationSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: AnnotationSet) -> AnnotationsetUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the annotation set to be updated. - /// - /// Sets the *annotation set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_set_id(mut self, new_value: &str) -> AnnotationsetUpdateCall<'a, C, A> { - self._annotation_set_id = new_value.to_string(); - self - } - /// An optional mask specifying which fields to update. Mutable fields are - /// name, - /// source_uri, and - /// info. If unspecified, all - /// mutable fields will be updated. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> AnnotationsetUpdateCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationsetUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationsetUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationsetUpdateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Searches for annotation sets that match the given criteria. Annotation sets -/// are returned in an unspecified order. This order is consistent, such that -/// two queries for the same content (regardless of page size) yield annotation -/// sets in the same order across their respective streams of paginated -/// responses. Caller must have READ permission for the queried datasets. -/// -/// A builder for the *search* method supported by a *annotationset* resource. -/// It is not used directly, but through a `AnnotationsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::SearchAnnotationSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchAnnotationSetsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotationsets().search(req) -/// .doit(); -/// # } -/// ``` -pub struct AnnotationsetSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchAnnotationSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationsetSearchCall<'a, C, A> {} - -impl<'a, C, A> AnnotationsetSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchAnnotationSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationsets.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotationsets/search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchAnnotationSetsRequest) -> AnnotationsetSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationsetSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationsetSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationsetSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a new annotation set. Caller must have WRITE permission for the -/// associated dataset. -/// -/// The following fields are required: -/// -/// * datasetId -/// * referenceSetId -/// -/// All other fields may be optionally specified, unless documented as being -/// server-generated (for example, the `id` field). -/// -/// A builder for the *create* method supported by a *annotationset* resource. -/// It is not used directly, but through a `AnnotationsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::AnnotationSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = AnnotationSet::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotationsets().create(req) -/// .doit(); -/// # } -/// ``` -pub struct AnnotationsetCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: AnnotationSet, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationsetCreateCall<'a, C, A> {} - -impl<'a, C, A> AnnotationsetCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AnnotationSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationsets.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotationsets"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: AnnotationSet) -> AnnotationsetCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationsetCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationsetCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationsetCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes an annotation set. Caller must have WRITE permission -/// for the associated annotation set. -/// -/// A builder for the *delete* method supported by a *annotationset* resource. -/// It is not used directly, but through a `AnnotationsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotationsets().delete("annotationSetId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationsetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _annotation_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationsetDeleteCall<'a, C, A> {} - -impl<'a, C, A> AnnotationsetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationsets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("annotationSetId", self._annotation_set_id.to_string())); - for &field in ["alt", "annotationSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotationsets/{annotationSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationSetId}", "annotationSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the annotation set to be deleted. - /// - /// Sets the *annotation set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_set_id(mut self, new_value: &str) -> AnnotationsetDeleteCall<'a, C, A> { - self._annotation_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationsetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationsetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationsetDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets an annotation set. Caller must have READ permission for -/// the associated dataset. -/// -/// A builder for the *get* method supported by a *annotationset* resource. -/// It is not used directly, but through a `AnnotationsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.annotationsets().get("annotationSetId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationsetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _annotation_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationsetGetCall<'a, C, A> {} - -impl<'a, C, A> AnnotationsetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AnnotationSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationsets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("annotationSetId", self._annotation_set_id.to_string())); - for &field in ["alt", "annotationSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/annotationsets/{annotationSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationSetId}", "annotationSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the annotation set to be retrieved. - /// - /// Sets the *annotation set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_set_id(mut self, new_value: &str) -> AnnotationsetGetCall<'a, C, A> { - self._annotation_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AnnotationsetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AnnotationsetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AnnotationsetGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Creates a new variant set. -/// -/// The provided variant set must have a valid `datasetId` set - all other -/// fields are optional. Note that the `id` field will be ignored, as this is -/// assigned by the server. -/// -/// A builder for the *create* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::VariantSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = VariantSet::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variantsets().create(req) -/// .doit(); -/// # } -/// ``` -pub struct VariantsetCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: VariantSet, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetCreateCall<'a, C, A> {} - -impl<'a, C, A> VariantsetCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VariantSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variantsets"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: VariantSet) -> VariantsetCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantsetCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantsetCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantsetCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes a variant set including all variants, call sets, and calls within. -/// This is not reversible. -/// -/// A builder for the *delete* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variantsets().delete("variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetDeleteCall<'a, C, A> {} - -impl<'a, C, A> VariantsetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["alt", "variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variantsets/{variantSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the variant set to be deleted. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetDeleteCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantsetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantsetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantsetDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Exports variant set data to an external destination. -/// -/// A builder for the *export* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::ExportVariantSetRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ExportVariantSetRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variantsets().export(req, "variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetExportCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ExportVariantSetRequest, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetExportCall<'a, C, A> {} - -impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.export", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["alt", "variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variantsets/{variantSetId}:export"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Bigquery.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ExportVariantSetRequest) -> VariantsetExportCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The ID of the variant set that contains variant data which - /// should be exported. The caller must have READ access to this variant set. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetExportCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantsetExportCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantsetExportCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Bigquery`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantsetExportCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates a variant set using patch semantics. -/// -/// A builder for the *patch* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::VariantSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = VariantSet::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variantsets().patch(req, "variantSetId") -/// .update_mask("dolor") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: VariantSet, - _variant_set_id: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetPatchCall<'a, C, A> {} - -impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VariantSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("variantSetId", self._variant_set_id.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "variantSetId", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variantsets/{variantSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: VariantSet) -> VariantsetPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the variant to be updated (must already exist). - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetPatchCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// An optional mask specifying which fields to update. Supported fields: - /// - /// * metadata. - /// * name. - /// * description. - /// - /// Leaving `updateMask` unset is equivalent to specifying all mutable - /// fields. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> VariantsetPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantsetPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantsetPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantsetPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns a list of all variant sets matching search criteria. -/// -/// Implements -/// [GlobalAllianceApi.searchVariantSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L49). -/// -/// A builder for the *search* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// use genomics1::SearchVariantSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchVariantSetsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variantsets().search(req) -/// .doit(); -/// # } -/// ``` -pub struct VariantsetSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchVariantSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetSearchCall<'a, C, A> {} - -impl<'a, C, A> VariantsetSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchVariantSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variantsets/search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchVariantSetsRequest) -> VariantsetSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantsetSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantsetSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantsetSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets a variant set by ID. -/// -/// A builder for the *get* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.variantsets().get("variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetGetCall<'a, C, A> {} - -impl<'a, C, A> VariantsetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VariantSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["alt", "variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/variantsets/{variantSetId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The ID of the variant set. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetGetCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> VariantsetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantsetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> VariantsetGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationCancelCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { diff --git a/gen/groupsmigration1-cli/Cargo.toml b/gen/groupsmigration1-cli/Cargo.toml index 9110f9739b..f54af848ee 100644 --- a/gen/groupsmigration1-cli/Cargo.toml +++ b/gen/groupsmigration1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-groupsmigration1-cli" -version = "1.0.8+20180803" +version = "1.0.8+20181126" authors = ["Sebastian Thiel "] description = "A complete library to interact with Groups Migration (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-groupsmigration1] path = "../groupsmigration1" -version = "1.0.8+20180803" +version = "1.0.8+20181126" diff --git a/gen/groupsmigration1-cli/README.md b/gen/groupsmigration1-cli/README.md index 32d0dd5424..5be866eff8 100644 --- a/gen/groupsmigration1-cli/README.md +++ b/gen/groupsmigration1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Groups Migration* API at revision *20180803*. The CLI is at version *1.0.8*. +This documentation was generated from the *Groups Migration* API at revision *20181126*. The CLI is at version *1.0.8*. ```bash groupsmigration1 [options] diff --git a/gen/groupsmigration1-cli/mkdocs.yml b/gen/groupsmigration1-cli/mkdocs.yml index 109ad19da2..3506a79642 100644 --- a/gen/groupsmigration1-cli/mkdocs.yml +++ b/gen/groupsmigration1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Groups Migration v1.0.8+20180803 +site_name: Groups Migration v1.0.8+20181126 site_url: http://byron.github.io/google-apis-rs/google-groupsmigration1-cli site_description: A complete library to interact with Groups Migration (protocol v1) diff --git a/gen/groupsmigration1-cli/src/main.rs b/gen/groupsmigration1-cli/src/main.rs index d42d0165e5..86cfd403a1 100644 --- a/gen/groupsmigration1-cli/src/main.rs +++ b/gen/groupsmigration1-cli/src/main.rs @@ -236,7 +236,7 @@ fn main() { let mut app = App::new("groupsmigration1") .author("Sebastian Thiel ") - .version("1.0.8+20180803") + .version("1.0.8+20181126") .about("Groups Migration Api.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_groupsmigration1_cli") .arg(Arg::with_name("url") diff --git a/gen/groupsmigration1/Cargo.toml b/gen/groupsmigration1/Cargo.toml index 6c2b62d170..6085066a19 100644 --- a/gen/groupsmigration1/Cargo.toml +++ b/gen/groupsmigration1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-groupsmigration1" -version = "1.0.8+20180803" +version = "1.0.8+20181126" authors = ["Sebastian Thiel "] description = "A complete library to interact with Groups Migration (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1" homepage = "https://developers.google.com/google-apps/groups-migration/" -documentation = "https://docs.rs/google-groupsmigration1/1.0.8+20180803" +documentation = "https://docs.rs/google-groupsmigration1/1.0.8+20181126" license = "MIT" keywords = ["groupsmigration", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/groupsmigration1/README.md b/gen/groupsmigration1/README.md index e2036170ca..042b4cf3e5 100644 --- a/gen/groupsmigration1/README.md +++ b/gen/groupsmigration1/README.md @@ -5,21 +5,21 @@ DO NOT EDIT ! --> The `google-groupsmigration1` library allows access to all features of the *Google Groups Migration* service. -This documentation was generated from *Groups Migration* crate version *1.0.8+20180803*, where *20180803* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Groups Migration* crate version *1.0.8+20181126*, where *20181126* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Groups Migration* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/groups-migration/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/struct.GroupsMigration.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/struct.GroupsMigration.html) ... * archive - * [*insert*](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/struct.ArchiveInsertCall.html) + * [*insert*](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/struct.ArchiveInsertCall.html) Upload supported by ... -* [*insert archive*](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/struct.ArchiveInsertCall.html) +* [*insert archive*](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/struct.ArchiveInsertCall.html) @@ -27,17 +27,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/struct.GroupsMigration.html)** +* **[Hub](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/struct.GroupsMigration.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.Part.html)** + * **[Parts](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -129,17 +129,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -149,29 +149,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-groupsmigration1/1.0.8+20180803/google_groupsmigration1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-groupsmigration1/1.0.8+20181126/google_groupsmigration1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/groupsmigration1/src/lib.rs b/gen/groupsmigration1/src/lib.rs index 6545770fbe..b24d050826 100644 --- a/gen/groupsmigration1/src/lib.rs +++ b/gen/groupsmigration1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Groups Migration* crate version *1.0.8+20180803*, where *20180803* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Groups Migration* crate version *1.0.8+20181126*, where *20181126* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Groups Migration* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/groups-migration/). @@ -563,10 +563,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -599,7 +596,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -763,7 +760,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/groupssettings1-cli/Cargo.toml b/gen/groupssettings1-cli/Cargo.toml index ef8fd2f9f9..ef043db768 100644 --- a/gen/groupssettings1-cli/Cargo.toml +++ b/gen/groupssettings1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-groupssettings1-cli" -version = "1.0.8+20180615" +version = "1.0.8+20190315" authors = ["Sebastian Thiel "] description = "A complete library to interact with groupssettings (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupssettings1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-groupssettings1] path = "../groupssettings1" -version = "1.0.8+20180615" +version = "1.0.8+20190315" diff --git a/gen/groupssettings1-cli/README.md b/gen/groupssettings1-cli/README.md index 6c6ef26d32..2598b1de31 100644 --- a/gen/groupssettings1-cli/README.md +++ b/gen/groupssettings1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *groupssettings* API at revision *20180615*. The CLI is at version *1.0.8*. +This documentation was generated from the *groupssettings* API at revision *20190315*. The CLI is at version *1.0.8*. ```bash groupssettings1 [options] diff --git a/gen/groupssettings1-cli/mkdocs.yml b/gen/groupssettings1-cli/mkdocs.yml index c4f45b8405..6578b1eb1a 100644 --- a/gen/groupssettings1-cli/mkdocs.yml +++ b/gen/groupssettings1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: groupssettings v1.0.8+20180615 +site_name: groupssettings v1.0.8+20190315 site_url: http://byron.github.io/google-apis-rs/google-groupssettings1-cli site_description: A complete library to interact with groupssettings (protocol v1) diff --git a/gen/groupssettings1-cli/src/main.rs b/gen/groupssettings1-cli/src/main.rs index a6545372c5..12fc4ff14a 100644 --- a/gen/groupssettings1-cli/src/main.rs +++ b/gen/groupssettings1-cli/src/main.rs @@ -121,51 +121,69 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "who-can-ban-users" => Some(("whoCanBanUsers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-assist-content" => Some(("whoCanAssistContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "allow-external-members" => Some(("allowExternalMembers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-enter-free-form-tags" => Some(("whoCanEnterFreeFormTags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-approve-messages" => Some(("whoCanApproveMessages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-mark-duplicate" => Some(("whoCanMarkDuplicate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-post-message" => Some(("whoCanPostMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-modify-tags-and-categories" => Some(("whoCanModifyTagsAndCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-mark-no-response-needed" => Some(("whoCanMarkNoResponseNeeded", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "who-can-unmark-favorite-reply-on-any-topic" => Some(("whoCanUnmarkFavoriteReplyOnAnyTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-moderate-content" => Some(("whoCanModerateContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-language" => Some(("primaryLanguage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-mark-favorite-reply-on-own-topic" => Some(("whoCanMarkFavoriteReplyOnOwnTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-view-membership" => Some(("whoCanViewMembership", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "favorite-replies-on-top" => Some(("favoriteRepliesOnTop", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-mark-favorite-reply-on-any-topic" => Some(("whoCanMarkFavoriteReplyOnAnyTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-custom-footer" => Some(("includeCustomFooter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-move-topics-out" => Some(("whoCanMoveTopicsOut", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-assign-topics" => Some(("whoCanAssignTopics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-message-deny-notification-text" => Some(("defaultMessageDenyNotificationText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-in-global-address-list" => Some(("includeInGlobalAddressList", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "archive-only" => Some(("archiveOnly", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-delete-topics" => Some(("whoCanDeleteTopics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-delete-any-post" => Some(("whoCanDeleteAnyPost", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "is-archived" => Some(("isArchived", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "members-can-post-as-the-group" => Some(("membersCanPostAsTheGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "allow-web-posting" => Some(("allowWebPosting", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-make-topics-sticky" => Some(("whoCanMakeTopicsSticky", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-roles-enabled-for-settings-to-be-merged" => Some(("customRolesEnabledForSettingsToBeMerged", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "who-can-assign-topics" => Some(("whoCanAssignTopics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-unmark-favorite-reply-on-any-topic" => Some(("whoCanUnmarkFavoriteReplyOnAnyTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-modify-members" => Some(("whoCanModifyMembers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "send-message-deny-notification" => Some(("sendMessageDenyNotification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-unassign-topic" => Some(("whoCanUnassignTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reply-to" => Some(("replyTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "custom-reply-to" => Some(("customReplyTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "message-moderation-level" => Some(("messageModerationLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enable-collaborative-inbox" => Some(("enableCollaborativeInbox", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-contact-owner" => Some(("whoCanContactOwner", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "message-display-font" => Some(("messageDisplayFont", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-leave-group" => Some(("whoCanLeaveGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-add" => Some(("whoCanAdd", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-join" => Some(("whoCanJoin", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-move-topics-in" => Some(("whoCanMoveTopicsIn", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-take-topics" => Some(("whoCanTakeTopics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-invite" => Some(("whoCanInvite", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "max-message-bytes" => Some(("maxMessageBytes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-approve-members" => Some(("whoCanApproveMembers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "spam-moderation-level" => Some(("spamModerationLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-web-posting" => Some(("allowWebPosting", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-moderate-members" => Some(("whoCanModerateMembers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-add-references" => Some(("whoCanAddReferences", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-view-group" => Some(("whoCanViewGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "show-in-group-directory" => Some(("showInGroupDirectory", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "max-message-bytes" => Some(("maxMessageBytes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "who-can-post-announcements" => Some(("whoCanPostAnnouncements", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-lock-topics" => Some(("whoCanLockTopics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-discover-group" => Some(("whoCanDiscoverGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "custom-footer-text" => Some(("customFooterText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "allow-google-communication" => Some(("allowGoogleCommunication", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-hide-abuse" => Some(("whoCanHideAbuse", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-external-members", "allow-google-communication", "allow-web-posting", "archive-only", "custom-footer-text", "custom-reply-to", "default-message-deny-notification-text", "description", "email", "favorite-replies-on-top", "include-custom-footer", "include-in-global-address-list", "is-archived", "kind", "max-message-bytes", "members-can-post-as-the-group", "message-display-font", "message-moderation-level", "name", "primary-language", "reply-to", "send-message-deny-notification", "show-in-group-directory", "spam-moderation-level", "who-can-add", "who-can-add-references", "who-can-assign-topics", "who-can-contact-owner", "who-can-enter-free-form-tags", "who-can-invite", "who-can-join", "who-can-leave-group", "who-can-mark-duplicate", "who-can-mark-favorite-reply-on-any-topic", "who-can-mark-favorite-reply-on-own-topic", "who-can-mark-no-response-needed", "who-can-modify-tags-and-categories", "who-can-post-message", "who-can-take-topics", "who-can-unassign-topic", "who-can-unmark-favorite-reply-on-any-topic", "who-can-view-group", "who-can-view-membership"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-external-members", "allow-google-communication", "allow-web-posting", "archive-only", "custom-footer-text", "custom-reply-to", "custom-roles-enabled-for-settings-to-be-merged", "default-message-deny-notification-text", "description", "email", "enable-collaborative-inbox", "favorite-replies-on-top", "include-custom-footer", "include-in-global-address-list", "is-archived", "kind", "max-message-bytes", "members-can-post-as-the-group", "message-display-font", "message-moderation-level", "name", "primary-language", "reply-to", "send-message-deny-notification", "show-in-group-directory", "spam-moderation-level", "who-can-add", "who-can-add-references", "who-can-approve-members", "who-can-approve-messages", "who-can-assign-topics", "who-can-assist-content", "who-can-ban-users", "who-can-contact-owner", "who-can-delete-any-post", "who-can-delete-topics", "who-can-discover-group", "who-can-enter-free-form-tags", "who-can-hide-abuse", "who-can-invite", "who-can-join", "who-can-leave-group", "who-can-lock-topics", "who-can-make-topics-sticky", "who-can-mark-duplicate", "who-can-mark-favorite-reply-on-any-topic", "who-can-mark-favorite-reply-on-own-topic", "who-can-mark-no-response-needed", "who-can-moderate-content", "who-can-moderate-members", "who-can-modify-members", "who-can-modify-tags-and-categories", "who-can-move-topics-in", "who-can-move-topics-out", "who-can-post-announcements", "who-can-post-message", "who-can-take-topics", "who-can-unassign-topic", "who-can-unmark-favorite-reply-on-any-topic", "who-can-view-group", "who-can-view-membership"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -248,51 +266,69 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "who-can-ban-users" => Some(("whoCanBanUsers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-assist-content" => Some(("whoCanAssistContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "allow-external-members" => Some(("allowExternalMembers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-enter-free-form-tags" => Some(("whoCanEnterFreeFormTags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-approve-messages" => Some(("whoCanApproveMessages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-mark-duplicate" => Some(("whoCanMarkDuplicate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-post-message" => Some(("whoCanPostMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-modify-tags-and-categories" => Some(("whoCanModifyTagsAndCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-mark-no-response-needed" => Some(("whoCanMarkNoResponseNeeded", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "who-can-unmark-favorite-reply-on-any-topic" => Some(("whoCanUnmarkFavoriteReplyOnAnyTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-moderate-content" => Some(("whoCanModerateContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-language" => Some(("primaryLanguage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-mark-favorite-reply-on-own-topic" => Some(("whoCanMarkFavoriteReplyOnOwnTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-view-membership" => Some(("whoCanViewMembership", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "favorite-replies-on-top" => Some(("favoriteRepliesOnTop", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-mark-favorite-reply-on-any-topic" => Some(("whoCanMarkFavoriteReplyOnAnyTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-custom-footer" => Some(("includeCustomFooter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-move-topics-out" => Some(("whoCanMoveTopicsOut", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-assign-topics" => Some(("whoCanAssignTopics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-message-deny-notification-text" => Some(("defaultMessageDenyNotificationText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-in-global-address-list" => Some(("includeInGlobalAddressList", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "archive-only" => Some(("archiveOnly", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-delete-topics" => Some(("whoCanDeleteTopics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-delete-any-post" => Some(("whoCanDeleteAnyPost", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "is-archived" => Some(("isArchived", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "members-can-post-as-the-group" => Some(("membersCanPostAsTheGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "allow-web-posting" => Some(("allowWebPosting", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-make-topics-sticky" => Some(("whoCanMakeTopicsSticky", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-roles-enabled-for-settings-to-be-merged" => Some(("customRolesEnabledForSettingsToBeMerged", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "who-can-assign-topics" => Some(("whoCanAssignTopics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-unmark-favorite-reply-on-any-topic" => Some(("whoCanUnmarkFavoriteReplyOnAnyTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-modify-members" => Some(("whoCanModifyMembers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "send-message-deny-notification" => Some(("sendMessageDenyNotification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-unassign-topic" => Some(("whoCanUnassignTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reply-to" => Some(("replyTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "custom-reply-to" => Some(("customReplyTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "message-moderation-level" => Some(("messageModerationLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enable-collaborative-inbox" => Some(("enableCollaborativeInbox", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-contact-owner" => Some(("whoCanContactOwner", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "message-display-font" => Some(("messageDisplayFont", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-leave-group" => Some(("whoCanLeaveGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-add" => Some(("whoCanAdd", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-join" => Some(("whoCanJoin", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-move-topics-in" => Some(("whoCanMoveTopicsIn", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-take-topics" => Some(("whoCanTakeTopics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-invite" => Some(("whoCanInvite", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "max-message-bytes" => Some(("maxMessageBytes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-approve-members" => Some(("whoCanApproveMembers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "spam-moderation-level" => Some(("spamModerationLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-web-posting" => Some(("allowWebPosting", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-moderate-members" => Some(("whoCanModerateMembers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-add-references" => Some(("whoCanAddReferences", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-view-group" => Some(("whoCanViewGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "show-in-group-directory" => Some(("showInGroupDirectory", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "max-message-bytes" => Some(("maxMessageBytes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "who-can-post-announcements" => Some(("whoCanPostAnnouncements", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-lock-topics" => Some(("whoCanLockTopics", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-discover-group" => Some(("whoCanDiscoverGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "custom-footer-text" => Some(("customFooterText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "allow-google-communication" => Some(("allowGoogleCommunication", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "who-can-hide-abuse" => Some(("whoCanHideAbuse", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-external-members", "allow-google-communication", "allow-web-posting", "archive-only", "custom-footer-text", "custom-reply-to", "default-message-deny-notification-text", "description", "email", "favorite-replies-on-top", "include-custom-footer", "include-in-global-address-list", "is-archived", "kind", "max-message-bytes", "members-can-post-as-the-group", "message-display-font", "message-moderation-level", "name", "primary-language", "reply-to", "send-message-deny-notification", "show-in-group-directory", "spam-moderation-level", "who-can-add", "who-can-add-references", "who-can-assign-topics", "who-can-contact-owner", "who-can-enter-free-form-tags", "who-can-invite", "who-can-join", "who-can-leave-group", "who-can-mark-duplicate", "who-can-mark-favorite-reply-on-any-topic", "who-can-mark-favorite-reply-on-own-topic", "who-can-mark-no-response-needed", "who-can-modify-tags-and-categories", "who-can-post-message", "who-can-take-topics", "who-can-unassign-topic", "who-can-unmark-favorite-reply-on-any-topic", "who-can-view-group", "who-can-view-membership"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-external-members", "allow-google-communication", "allow-web-posting", "archive-only", "custom-footer-text", "custom-reply-to", "custom-roles-enabled-for-settings-to-be-merged", "default-message-deny-notification-text", "description", "email", "enable-collaborative-inbox", "favorite-replies-on-top", "include-custom-footer", "include-in-global-address-list", "is-archived", "kind", "max-message-bytes", "members-can-post-as-the-group", "message-display-font", "message-moderation-level", "name", "primary-language", "reply-to", "send-message-deny-notification", "show-in-group-directory", "spam-moderation-level", "who-can-add", "who-can-add-references", "who-can-approve-members", "who-can-approve-messages", "who-can-assign-topics", "who-can-assist-content", "who-can-ban-users", "who-can-contact-owner", "who-can-delete-any-post", "who-can-delete-topics", "who-can-discover-group", "who-can-enter-free-form-tags", "who-can-hide-abuse", "who-can-invite", "who-can-join", "who-can-leave-group", "who-can-lock-topics", "who-can-make-topics-sticky", "who-can-mark-duplicate", "who-can-mark-favorite-reply-on-any-topic", "who-can-mark-favorite-reply-on-own-topic", "who-can-mark-no-response-needed", "who-can-moderate-content", "who-can-moderate-members", "who-can-modify-members", "who-can-modify-tags-and-categories", "who-can-move-topics-in", "who-can-move-topics-out", "who-can-post-announcements", "who-can-post-message", "who-can-take-topics", "who-can-unassign-topic", "who-can-unmark-favorite-reply-on-any-topic", "who-can-view-group", "who-can-view-membership"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -541,8 +577,8 @@ fn main() { let mut app = App::new("groupssettings1") .author("Sebastian Thiel ") - .version("1.0.8+20180615") - .about("Lets you manage permission levels and related settings of a group.") + .version("1.0.8+20190315") + .about("Manages permission levels and related settings of a group.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_groupssettings1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/groupssettings1/Cargo.toml b/gen/groupssettings1/Cargo.toml index 92cfe094f9..ef4f3d9057 100644 --- a/gen/groupssettings1/Cargo.toml +++ b/gen/groupssettings1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-groupssettings1" -version = "1.0.8+20180615" +version = "1.0.8+20190315" authors = ["Sebastian Thiel "] description = "A complete library to interact with groupssettings (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupssettings1" homepage = "https://developers.google.com/google-apps/groups-settings/get_started" -documentation = "https://docs.rs/google-groupssettings1/1.0.8+20180615" +documentation = "https://docs.rs/google-groupssettings1/1.0.8+20190315" license = "MIT" keywords = ["groupssettings", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/groupssettings1/README.md b/gen/groupssettings1/README.md index 27e5465b6c..cad4adc14e 100644 --- a/gen/groupssettings1/README.md +++ b/gen/groupssettings1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-groupssettings1` library allows access to all features of the *Google groupssettings* service. -This documentation was generated from *groupssettings* crate version *1.0.8+20180615*, where *20180615* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *groupssettings* crate version *1.0.8+20190315*, where *20190315* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *groupssettings* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/groups-settings/get_started). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/struct.Groupssettings.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/struct.Groupssettings.html) ... * groups - * [*get*](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/struct.GroupGetCall.html), [*patch*](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/struct.GroupPatchCall.html) and [*update*](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/struct.GroupUpdateCall.html) + * [*get*](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/struct.GroupGetCall.html), [*patch*](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/struct.GroupPatchCall.html) and [*update*](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/struct.GroupUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/struct.Groupssettings.html)** +* **[Hub](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/struct.Groupssettings.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.Part.html)** + * **[Parts](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-groupssettings1/1.0.8+20180615/google_groupssettings1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-groupssettings1/1.0.8+20190315/google_groupssettings1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/groupssettings1/src/lib.rs b/gen/groupssettings1/src/lib.rs index b537b9a87b..d667d44ef1 100644 --- a/gen/groupssettings1/src/lib.rs +++ b/gen/groupssettings1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *groupssettings* crate version *1.0.8+20180615*, where *20180615* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *groupssettings* crate version *1.0.8+20190315*, where *20190315* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *groupssettings* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/groups-settings/get_started). @@ -385,12 +385,21 @@ impl<'a, C, A> Groupssettings /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Groups { + /// Permission to ban users. Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanBanUsers")] + pub who_can_ban_users: Option, + /// Permission for content assistants. Possible values are: Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanAssistContent")] + pub who_can_assist_content: Option, /// Are external members allowed to join the group. #[serde(rename="allowExternalMembers")] pub allow_external_members: Option, /// Permission to enter free form tags for topics in a forum. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS #[serde(rename="whoCanEnterFreeFormTags")] pub who_can_enter_free_form_tags: Option, + /// Permission to approve pending messages in the moderation queue. Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanApproveMessages")] + pub who_can_approve_messages: Option, /// Permission to mark a topic as a duplicate of another topic. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS #[serde(rename="whoCanMarkDuplicate")] pub who_can_mark_duplicate: Option, @@ -403,13 +412,19 @@ pub struct Groups { /// Permission to mark a topic as not needing a response. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS #[serde(rename="whoCanMarkNoResponseNeeded")] pub who_can_mark_no_response_needed: Option, + /// Permission to unmark any post from a favorite reply. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanUnmarkFavoriteReplyOnAnyTopic")] + pub who_can_unmark_favorite_reply_on_any_topic: Option, + /// Permission for content moderation. Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanModerateContent")] + pub who_can_moderate_content: Option, /// Primary language for the group. #[serde(rename="primaryLanguage")] pub primary_language: Option, /// Permission to mark a post for a topic they started as a favorite reply. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS #[serde(rename="whoCanMarkFavoriteReplyOnOwnTopic")] pub who_can_mark_favorite_reply_on_own_topic: Option, - /// Permissions to view membership. Possible values are: ALL_IN_DOMAIN_CAN_VIEW ALL_MEMBERS_CAN_VIEW ALL_MANAGERS_CAN_VIEW + /// Permissions to view membership. Possible values are: ALL_IN_DOMAIN_CAN_VIEW ALL_MEMBERS_CAN_VIEW ALL_MANAGERS_CAN_VIEW ALL_OWNERS_CAN_VIEW #[serde(rename="whoCanViewMembership")] pub who_can_view_membership: Option, /// If favorite replies should be displayed above other replies. @@ -421,6 +436,9 @@ pub struct Groups { /// Whether to include custom footer. #[serde(rename="includeCustomFooter")] pub include_custom_footer: Option, + /// Permission to move topics out of the group or forum. Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanMoveTopicsOut")] + pub who_can_move_topics_out: Option, /// Default message deny notification message #[serde(rename="defaultMessageDenyNotificationText")] pub default_message_deny_notification_text: Option, @@ -430,20 +448,32 @@ pub struct Groups { /// If the group is archive only #[serde(rename="archiveOnly")] pub archive_only: Option, + /// Permission to delete topics. Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanDeleteTopics")] + pub who_can_delete_topics: Option, + /// Permission to delete replies to topics. Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanDeleteAnyPost")] + pub who_can_delete_any_post: Option, /// If the contents of the group are archived. #[serde(rename="isArchived")] pub is_archived: Option, /// Can members post using the group email address. #[serde(rename="membersCanPostAsTheGroup")] pub members_can_post_as_the_group: Option, - /// If posting from web is allowed. - #[serde(rename="allowWebPosting")] - pub allow_web_posting: Option, + /// Permission to make topics appear at the top of the topic list. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanMakeTopicsSticky")] + pub who_can_make_topics_sticky: Option, + /// If any of the settings that will be merged have custom roles which is anything other than owners, managers, or group scopes. + #[serde(rename="customRolesEnabledForSettingsToBeMerged")] + pub custom_roles_enabled_for_settings_to_be_merged: Option, /// Email id of the group pub email: Option, - /// Permission to assign topics in a forum to another user. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS - #[serde(rename="whoCanAssignTopics")] - pub who_can_assign_topics: Option, + /// Permission for who can discover the group. Possible values are: ALL_MEMBERS_CAN_DISCOVER ALL_IN_DOMAIN_CAN_DISCOVER ANYONE_CAN_DISCOVER + #[serde(rename="whoCanDiscoverGroup")] + pub who_can_discover_group: Option, + /// Permission to modify members (change member roles). Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanModifyMembers")] + pub who_can_modify_members: Option, /// Moderation level for messages. Possible values are: MODERATE_ALL_MESSAGES MODERATE_NON_MEMBERS MODERATE_NEW_MEMBERS MODERATE_NONE #[serde(rename="messageModerationLevel")] pub message_moderation_level: Option, @@ -461,6 +491,9 @@ pub struct Groups { /// Should the member be notified if his message is denied by owner. #[serde(rename="sendMessageDenyNotification")] pub send_message_deny_notification: Option, + /// If a primary Collab Inbox feature is enabled. + #[serde(rename="enableCollaborativeInbox")] + pub enable_collaborative_inbox: Option, /// Permission to contact owner of the group via web UI. Possible values are: ANYONE_CAN_CONTACT ALL_IN_DOMAIN_CAN_CONTACT ALL_MEMBERS_CAN_CONTACT ALL_MANAGERS_CAN_CONTACT #[serde(rename="whoCanContactOwner")] pub who_can_contact_owner: Option, @@ -476,6 +509,9 @@ pub struct Groups { /// Permissions to post messages to the group. Possible values are: NONE_CAN_POST ALL_MANAGERS_CAN_POST ALL_MEMBERS_CAN_POST ALL_OWNERS_CAN_POST ALL_IN_DOMAIN_CAN_POST ANYONE_CAN_POST #[serde(rename="whoCanPostMessage")] pub who_can_post_message: Option, + /// Permission to move topics into the group or forum. Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanMoveTopicsIn")] + pub who_can_move_topics_in: Option, /// Permission to take topics in a forum. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS #[serde(rename="whoCanTakeTopics")] pub who_can_take_topics: Option, @@ -489,9 +525,18 @@ pub struct Groups { /// Permissions to invite members. Possible values are: ALL_MEMBERS_CAN_INVITE ALL_MANAGERS_CAN_INVITE ALL_OWNERS_CAN_INVITE NONE_CAN_INVITE #[serde(rename="whoCanInvite")] pub who_can_invite: Option, + /// Permission to approve members. Possible values are: ALL_OWNERS_CAN_APPROVE ALL_MANAGERS_CAN_APPROVE ALL_MEMBERS_CAN_APPROVE NONE_CAN_APPROVE + #[serde(rename="whoCanApproveMembers")] + pub who_can_approve_members: Option, /// Moderation level for messages detected as spam. Possible values are: ALLOW MODERATE SILENTLY_MODERATE REJECT #[serde(rename="spamModerationLevel")] pub spam_moderation_level: Option, + /// If posting from web is allowed. + #[serde(rename="allowWebPosting")] + pub allow_web_posting: Option, + /// Permission for membership moderation. Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanModerateMembers")] + pub who_can_moderate_members: Option, /// Permission to add references to a topic. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS #[serde(rename="whoCanAddReferences")] pub who_can_add_references: Option, @@ -501,15 +546,24 @@ pub struct Groups { /// Is the group listed in groups directory #[serde(rename="showInGroupDirectory")] pub show_in_group_directory: Option, - /// Permission to unmark any post from a favorite reply. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS - #[serde(rename="whoCanUnmarkFavoriteReplyOnAnyTopic")] - pub who_can_unmark_favorite_reply_on_any_topic: Option, + /// Permission to post announcements, a special topic type. Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanPostAnnouncements")] + pub who_can_post_announcements: Option, + /// Permission to lock topics. Possible values are: NONE OWNERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanLockTopics")] + pub who_can_lock_topics: Option, + /// Permission to assign topics in a forum to another user. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanAssignTopics")] + pub who_can_assign_topics: Option, /// Custom footer text. #[serde(rename="customFooterText")] pub custom_footer_text: Option, /// Is google allowed to contact admins. #[serde(rename="allowGoogleCommunication")] pub allow_google_communication: Option, + /// Permission to hide posts by reporting them as abuse. Possible values are: NONE OWNERS_ONLY MANAGERS_ONLY OWNERS_AND_MANAGERS ALL_MEMBERS + #[serde(rename="whoCanHideAbuse")] + pub who_can_hide_abuse: Option, } impl RequestValue for Groups {} @@ -729,10 +783,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -764,7 +815,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -854,7 +905,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1003,10 +1054,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1038,7 +1086,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1128,7 +1176,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1270,10 +1318,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1293,7 +1338,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1371,7 +1416,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/healthcare1_beta1-cli/Cargo.toml b/gen/healthcare1_beta1-cli/Cargo.toml new file mode 100644 index 0000000000..791838aa14 --- /dev/null +++ b/gen/healthcare1_beta1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-healthcare1_beta1-cli" +version = "1.0.8+20190401" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Healthcare (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/healthcare1_beta1-cli" +homepage = "https://cloud.google.com/healthcare" +documentation = "http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli" +license = "MIT" +keywords = ["healthcare", "google", "cli"] +autobins = false + +[[bin]] +name = "healthcare1-beta1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-healthcare1_beta1] +path = "../healthcare1_beta1" +version = "1.0.8+20190401" diff --git a/gen/healthcare1_beta1-cli/LICENSE.md b/gen/healthcare1_beta1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/healthcare1_beta1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/healthcare1_beta1-cli/README.md b/gen/healthcare1_beta1-cli/README.md new file mode 100644 index 0000000000..1f55afdfb2 --- /dev/null +++ b/gen/healthcare1_beta1-cli/README.md @@ -0,0 +1,197 @@ + +The `healthcare1-beta1` command-line interface *(CLI)* allows to use most features of the *Google Cloud Healthcare* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud Healthcare* API can be found at the +[official documentation site](https://cloud.google.com/healthcare). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-healthcare1_beta1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/healthcare1_beta1-cli). + +# Usage + +This documentation was generated from the *Cloud Healthcare* API at revision *20190401*. The CLI is at version *1.0.8*. + +```bash +healthcare1-beta1 [options] + projects + locations-datasets-create (-r )... [-p ]... [-o ] + locations-datasets-deidentify (-r )... [-p ]... [-o ] + locations-datasets-delete [-p ]... [-o ] + locations-datasets-dicom-stores-create (-r )... [-p ]... [-o ] + locations-datasets-dicom-stores-delete [-p ]... [-o ] + locations-datasets-dicom-stores-export (-r )... [-p ]... [-o ] + locations-datasets-dicom-stores-get [-p ]... [-o ] + locations-datasets-dicom-stores-get-iam-policy [-p ]... [-o ] + locations-datasets-dicom-stores-import (-r )... [-p ]... [-o ] + locations-datasets-dicom-stores-list [-p ]... [-o ] + locations-datasets-dicom-stores-patch (-r )... [-p ]... [-o ] + locations-datasets-dicom-stores-search-for-instances [-p ]... [-o ] + locations-datasets-dicom-stores-search-for-series [-p ]... [-o ] + locations-datasets-dicom-stores-search-for-studies [-p ]... [-o ] + locations-datasets-dicom-stores-set-iam-policy (-r )... [-p ]... [-o ] + locations-datasets-dicom-stores-store-instances (-r )... [-p ]... [-o ] + locations-datasets-dicom-stores-studies-delete [-p ]... [-o ] + locations-datasets-dicom-stores-studies-retrieve-metadata [-p ]... [-o ] + locations-datasets-dicom-stores-studies-retrieve-study [-p ]... [-o ] + locations-datasets-dicom-stores-studies-search-for-instances [-p ]... [-o ] + locations-datasets-dicom-stores-studies-search-for-series [-p ]... [-o ] + locations-datasets-dicom-stores-studies-series-delete [-p ]... [-o ] + locations-datasets-dicom-stores-studies-series-instances-delete [-p ]... [-o ] + locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-frames [-p ]... [-o ] + locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-rendered [-p ]... [-o ] + locations-datasets-dicom-stores-studies-series-instances-retrieve-instance [-p ]... [-o ] + locations-datasets-dicom-stores-studies-series-instances-retrieve-metadata [-p ]... [-o ] + locations-datasets-dicom-stores-studies-series-instances-retrieve-rendered [-p ]... [-o ] + locations-datasets-dicom-stores-studies-series-retrieve-metadata [-p ]... [-o ] + locations-datasets-dicom-stores-studies-series-retrieve-series [-p ]... [-o ] + locations-datasets-dicom-stores-studies-series-search-for-instances [-p ]... [-o ] + locations-datasets-dicom-stores-studies-store-instances (-r )... [-p ]... [-o ] + locations-datasets-dicom-stores-test-iam-permissions (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-create (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-delete [-p ]... [-o ] + locations-datasets-fhir-stores-execute-bundle (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-export (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-fhir--observation-get$lastn [-p ]... [-o ] + locations-datasets-fhir-stores-fhir--patient-get$everything [-p ]... [-o ] + locations-datasets-fhir-stores-fhir--history-get [-p ]... [-o ] + locations-datasets-fhir-stores-fhir--history-list [-p ]... [-o ] + locations-datasets-fhir-stores-fhir--search (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-conditional-delete-resource [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-conditional-patch-resource (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-conditional-update-resource (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-create-resource (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-delete [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-delete$purge [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-get [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-get-metadata [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-patch (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-search-resources [-p ]... [-o ] + locations-datasets-fhir-stores-fhir-update (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-get [-p ]... [-o ] + locations-datasets-fhir-stores-get-iam-policy [-p ]... [-o ] + locations-datasets-fhir-stores-import (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-list [-p ]... [-o ] + locations-datasets-fhir-stores-patch (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-set-iam-policy (-r )... [-p ]... [-o ] + locations-datasets-fhir-stores-test-iam-permissions (-r )... [-p ]... [-o ] + locations-datasets-get [-p ]... [-o ] + locations-datasets-get-iam-policy [-p ]... [-o ] + locations-datasets-hl7-v2-stores-create (-r )... [-p ]... [-o ] + locations-datasets-hl7-v2-stores-delete [-p ]... [-o ] + locations-datasets-hl7-v2-stores-get [-p ]... [-o ] + locations-datasets-hl7-v2-stores-get-iam-policy [-p ]... [-o ] + locations-datasets-hl7-v2-stores-list [-p ]... [-o ] + locations-datasets-hl7-v2-stores-messages-create (-r )... [-p ]... [-o ] + locations-datasets-hl7-v2-stores-messages-delete [-p ]... [-o ] + locations-datasets-hl7-v2-stores-messages-get [-p ]... [-o ] + locations-datasets-hl7-v2-stores-messages-ingest (-r )... [-p ]... [-o ] + locations-datasets-hl7-v2-stores-messages-list [-p ]... [-o ] + locations-datasets-hl7-v2-stores-messages-patch (-r )... [-p ]... [-o ] + locations-datasets-hl7-v2-stores-patch (-r )... [-p ]... [-o ] + locations-datasets-hl7-v2-stores-set-iam-policy (-r )... [-p ]... [-o ] + locations-datasets-hl7-v2-stores-test-iam-permissions (-r )... [-p ]... [-o ] + locations-datasets-list [-p ]... [-o ] + locations-datasets-operations-get [-p ]... [-o ] + locations-datasets-operations-list [-p ]... [-o ] + locations-datasets-patch (-r )... [-p ]... [-o ] + locations-datasets-set-iam-policy (-r )... [-p ]... [-o ] + locations-datasets-test-iam-permissions (-r )... [-p ]... [-o ] + locations-get [-p ]... [-o ] + locations-list [-p ]... [-o ] + healthcare1-beta1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `healthcare1-beta1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/healthcare1-beta1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/healthcare1-beta1-secret.json`, assuming that the required *healthcare* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `healthcare1-beta1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/healthcare1_beta1-cli/mkdocs.yml b/gen/healthcare1_beta1-cli/mkdocs.yml new file mode 100644 index 0000000000..fb3fc04ebf --- /dev/null +++ b/gen/healthcare1_beta1-cli/mkdocs.yml @@ -0,0 +1,100 @@ +site_name: Cloud Healthcare v1.0.8+20190401 +site_url: http://byron.github.io/google-apis-rs/google-healthcare1_beta1-cli +site_description: A complete library to interact with Cloud Healthcare (protocol v1beta1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/healthcare1_beta1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['projects_locations-datasets-create.md', 'Projects', 'Locations Datasets Create'] +- ['projects_locations-datasets-deidentify.md', 'Projects', 'Locations Datasets Deidentify'] +- ['projects_locations-datasets-delete.md', 'Projects', 'Locations Datasets Delete'] +- ['projects_locations-datasets-dicom-stores-create.md', 'Projects', 'Locations Datasets Dicom Stores Create'] +- ['projects_locations-datasets-dicom-stores-delete.md', 'Projects', 'Locations Datasets Dicom Stores Delete'] +- ['projects_locations-datasets-dicom-stores-export.md', 'Projects', 'Locations Datasets Dicom Stores Export'] +- ['projects_locations-datasets-dicom-stores-get.md', 'Projects', 'Locations Datasets Dicom Stores Get'] +- ['projects_locations-datasets-dicom-stores-get-iam-policy.md', 'Projects', 'Locations Datasets Dicom Stores Get Iam Policy'] +- ['projects_locations-datasets-dicom-stores-import.md', 'Projects', 'Locations Datasets Dicom Stores Import'] +- ['projects_locations-datasets-dicom-stores-list.md', 'Projects', 'Locations Datasets Dicom Stores List'] +- ['projects_locations-datasets-dicom-stores-patch.md', 'Projects', 'Locations Datasets Dicom Stores Patch'] +- ['projects_locations-datasets-dicom-stores-search-for-instances.md', 'Projects', 'Locations Datasets Dicom Stores Search For Instances'] +- ['projects_locations-datasets-dicom-stores-search-for-series.md', 'Projects', 'Locations Datasets Dicom Stores Search For Series'] +- ['projects_locations-datasets-dicom-stores-search-for-studies.md', 'Projects', 'Locations Datasets Dicom Stores Search For Studies'] +- ['projects_locations-datasets-dicom-stores-set-iam-policy.md', 'Projects', 'Locations Datasets Dicom Stores Set Iam Policy'] +- ['projects_locations-datasets-dicom-stores-store-instances.md', 'Projects', 'Locations Datasets Dicom Stores Store Instances'] +- ['projects_locations-datasets-dicom-stores-studies-delete.md', 'Projects', 'Locations Datasets Dicom Stores Studies Delete'] +- ['projects_locations-datasets-dicom-stores-studies-retrieve-metadata.md', 'Projects', 'Locations Datasets Dicom Stores Studies Retrieve Metadata'] +- ['projects_locations-datasets-dicom-stores-studies-retrieve-study.md', 'Projects', 'Locations Datasets Dicom Stores Studies Retrieve Study'] +- ['projects_locations-datasets-dicom-stores-studies-search-for-instances.md', 'Projects', 'Locations Datasets Dicom Stores Studies Search For Instances'] +- ['projects_locations-datasets-dicom-stores-studies-search-for-series.md', 'Projects', 'Locations Datasets Dicom Stores Studies Search For Series'] +- ['projects_locations-datasets-dicom-stores-studies-series-delete.md', 'Projects', 'Locations Datasets Dicom Stores Studies Series Delete'] +- ['projects_locations-datasets-dicom-stores-studies-series-instances-delete.md', 'Projects', 'Locations Datasets Dicom Stores Studies Series Instances Delete'] +- ['projects_locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-frames.md', 'Projects', 'Locations Datasets Dicom Stores Studies Series Instances Frames Retrieve Frames'] +- ['projects_locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-rendered.md', 'Projects', 'Locations Datasets Dicom Stores Studies Series Instances Frames Retrieve Rendered'] +- ['projects_locations-datasets-dicom-stores-studies-series-instances-retrieve-instance.md', 'Projects', 'Locations Datasets Dicom Stores Studies Series Instances Retrieve Instance'] +- ['projects_locations-datasets-dicom-stores-studies-series-instances-retrieve-metadata.md', 'Projects', 'Locations Datasets Dicom Stores Studies Series Instances Retrieve Metadata'] +- ['projects_locations-datasets-dicom-stores-studies-series-instances-retrieve-rendered.md', 'Projects', 'Locations Datasets Dicom Stores Studies Series Instances Retrieve Rendered'] +- ['projects_locations-datasets-dicom-stores-studies-series-retrieve-metadata.md', 'Projects', 'Locations Datasets Dicom Stores Studies Series Retrieve Metadata'] +- ['projects_locations-datasets-dicom-stores-studies-series-retrieve-series.md', 'Projects', 'Locations Datasets Dicom Stores Studies Series Retrieve Series'] +- ['projects_locations-datasets-dicom-stores-studies-series-search-for-instances.md', 'Projects', 'Locations Datasets Dicom Stores Studies Series Search For Instances'] +- ['projects_locations-datasets-dicom-stores-studies-store-instances.md', 'Projects', 'Locations Datasets Dicom Stores Studies Store Instances'] +- ['projects_locations-datasets-dicom-stores-test-iam-permissions.md', 'Projects', 'Locations Datasets Dicom Stores Test Iam Permissions'] +- ['projects_locations-datasets-fhir-stores-create.md', 'Projects', 'Locations Datasets Fhir Stores Create'] +- ['projects_locations-datasets-fhir-stores-delete.md', 'Projects', 'Locations Datasets Fhir Stores Delete'] +- ['projects_locations-datasets-fhir-stores-execute-bundle.md', 'Projects', 'Locations Datasets Fhir Stores Execute Bundle'] +- ['projects_locations-datasets-fhir-stores-export.md', 'Projects', 'Locations Datasets Fhir Stores Export'] +- ['projects_locations-datasets-fhir-stores-fhir--observation-get$lastn.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Observation Get$lastn'] +- ['projects_locations-datasets-fhir-stores-fhir--patient-get$everything.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Patient Get$everything'] +- ['projects_locations-datasets-fhir-stores-fhir--history-get.md', 'Projects', 'Locations Datasets Fhir Stores Fhir History Get'] +- ['projects_locations-datasets-fhir-stores-fhir--history-list.md', 'Projects', 'Locations Datasets Fhir Stores Fhir History List'] +- ['projects_locations-datasets-fhir-stores-fhir--search.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Search'] +- ['projects_locations-datasets-fhir-stores-fhir-conditional-delete-resource.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Conditional Delete Resource'] +- ['projects_locations-datasets-fhir-stores-fhir-conditional-patch-resource.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Conditional Patch Resource'] +- ['projects_locations-datasets-fhir-stores-fhir-conditional-update-resource.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Conditional Update Resource'] +- ['projects_locations-datasets-fhir-stores-fhir-create-resource.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Create Resource'] +- ['projects_locations-datasets-fhir-stores-fhir-delete.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Delete'] +- ['projects_locations-datasets-fhir-stores-fhir-delete$purge.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Delete$purge'] +- ['projects_locations-datasets-fhir-stores-fhir-get.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Get'] +- ['projects_locations-datasets-fhir-stores-fhir-get-metadata.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Get Metadata'] +- ['projects_locations-datasets-fhir-stores-fhir-patch.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Patch'] +- ['projects_locations-datasets-fhir-stores-fhir-search-resources.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Search Resources'] +- ['projects_locations-datasets-fhir-stores-fhir-update.md', 'Projects', 'Locations Datasets Fhir Stores Fhir Update'] +- ['projects_locations-datasets-fhir-stores-get.md', 'Projects', 'Locations Datasets Fhir Stores Get'] +- ['projects_locations-datasets-fhir-stores-get-iam-policy.md', 'Projects', 'Locations Datasets Fhir Stores Get Iam Policy'] +- ['projects_locations-datasets-fhir-stores-import.md', 'Projects', 'Locations Datasets Fhir Stores Import'] +- ['projects_locations-datasets-fhir-stores-list.md', 'Projects', 'Locations Datasets Fhir Stores List'] +- ['projects_locations-datasets-fhir-stores-patch.md', 'Projects', 'Locations Datasets Fhir Stores Patch'] +- ['projects_locations-datasets-fhir-stores-set-iam-policy.md', 'Projects', 'Locations Datasets Fhir Stores Set Iam Policy'] +- ['projects_locations-datasets-fhir-stores-test-iam-permissions.md', 'Projects', 'Locations Datasets Fhir Stores Test Iam Permissions'] +- ['projects_locations-datasets-get.md', 'Projects', 'Locations Datasets Get'] +- ['projects_locations-datasets-get-iam-policy.md', 'Projects', 'Locations Datasets Get Iam Policy'] +- ['projects_locations-datasets-hl7-v2-stores-create.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Create'] +- ['projects_locations-datasets-hl7-v2-stores-delete.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Delete'] +- ['projects_locations-datasets-hl7-v2-stores-get.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Get'] +- ['projects_locations-datasets-hl7-v2-stores-get-iam-policy.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Get Iam Policy'] +- ['projects_locations-datasets-hl7-v2-stores-list.md', 'Projects', 'Locations Datasets Hl7 V2 Stores List'] +- ['projects_locations-datasets-hl7-v2-stores-messages-create.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Messages Create'] +- ['projects_locations-datasets-hl7-v2-stores-messages-delete.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Messages Delete'] +- ['projects_locations-datasets-hl7-v2-stores-messages-get.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Messages Get'] +- ['projects_locations-datasets-hl7-v2-stores-messages-ingest.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Messages Ingest'] +- ['projects_locations-datasets-hl7-v2-stores-messages-list.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Messages List'] +- ['projects_locations-datasets-hl7-v2-stores-messages-patch.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Messages Patch'] +- ['projects_locations-datasets-hl7-v2-stores-patch.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Patch'] +- ['projects_locations-datasets-hl7-v2-stores-set-iam-policy.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Set Iam Policy'] +- ['projects_locations-datasets-hl7-v2-stores-test-iam-permissions.md', 'Projects', 'Locations Datasets Hl7 V2 Stores Test Iam Permissions'] +- ['projects_locations-datasets-list.md', 'Projects', 'Locations Datasets List'] +- ['projects_locations-datasets-operations-get.md', 'Projects', 'Locations Datasets Operations Get'] +- ['projects_locations-datasets-operations-list.md', 'Projects', 'Locations Datasets Operations List'] +- ['projects_locations-datasets-patch.md', 'Projects', 'Locations Datasets Patch'] +- ['projects_locations-datasets-set-iam-policy.md', 'Projects', 'Locations Datasets Set Iam Policy'] +- ['projects_locations-datasets-test-iam-permissions.md', 'Projects', 'Locations Datasets Test Iam Permissions'] +- ['projects_locations-get.md', 'Projects', 'Locations Get'] +- ['projects_locations-list.md', 'Projects', 'Locations List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/healthcare1_beta1-cli/src/cmn.rs b/gen/healthcare1_beta1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/healthcare1_beta1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/healthcare1_beta1-cli/src/main.rs b/gen/healthcare1_beta1-cli/src/main.rs new file mode 100644 index 0000000000..a896fe2c3d --- /dev/null +++ b/gen/healthcare1_beta1-cli/src/main.rs @@ -0,0 +1,8663 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_healthcare1_beta1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudHealthcare>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _projects_locations_datasets_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "time-zone" => Some(("timeZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["name", "time-zone"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Dataset = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "dataset-id" => { + call = call.dataset_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["dataset-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_deidentify(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "destination-dataset" => Some(("destinationDataset", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.dicom.filter-profile" => Some(("config.dicom.filterProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.dicom.remove-list.tags" => Some(("config.dicom.removeList.tags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "config.dicom.keep-list.tags" => Some(("config.dicom.keepList.tags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "config.image.text-redaction-mode" => Some(("config.image.textRedactionMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["config", "destination-dataset", "dicom", "filter-profile", "image", "keep-list", "remove-list", "tags", "text-redaction-mode"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DeidentifyDatasetRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_deidentify(request, opt.value_of("source-dataset").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notification-config.pubsub-topic" => Some(("notificationConfig.pubsubTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["labels", "name", "notification-config", "pubsub-topic"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DicomStore = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_dicom_stores_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "dicom-store-id" => { + call = call.dicom_store_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["dicom-store-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_export(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "bigquery-destination.table-uri" => Some(("bigqueryDestination.tableUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "bigquery-destination.force" => Some(("bigqueryDestination.force", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "gcs-destination.mime-type" => Some(("gcsDestination.mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gcs-destination.uri-prefix" => Some(("gcsDestination.uriPrefix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["bigquery-destination", "force", "gcs-destination", "mime-type", "table-uri", "uri-prefix"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ExportDicomDataRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_dicom_stores_export(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_get_iam_policy(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_import(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "gcs-source.uri" => Some(("gcsSource.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["gcs-source", "uri"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ImportDicomDataRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_dicom_stores_import(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notification-config.pubsub-topic" => Some(("notificationConfig.pubsubTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["labels", "name", "notification-config", "pubsub-topic"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DicomStore = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_dicom_stores_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_search_for_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_search_for_instances(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_search_for_series(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_search_for_series(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_search_for_studies(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_search_for_studies(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_dicom_stores_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_store_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content-type", "data"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::HttpBody = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_dicom_stores_store_instances(request, opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_delete(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_retrieve_metadata(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_retrieve_metadata(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_retrieve_study(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_retrieve_study(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_search_for_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_search_for_instances(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_search_for_series(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_search_for_series(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_series_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_series_delete(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_series_instances_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_series_instances_delete(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_series_retrieve_metadata(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_metadata(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_series_retrieve_series(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_series(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_series_search_for_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_series_search_for_instances(opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_studies_store_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content-type", "data"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::HttpBody = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_dicom_stores_studies_store_instances(request, opt.value_of("parent").unwrap_or(""), opt.value_of("dicom-web-path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_dicom_stores_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_dicom_stores_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "enable-history-import" => Some(("enableHistoryImport", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "enable-update-create" => Some(("enableUpdateCreate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "notification-config.pubsub-topic" => Some(("notificationConfig.pubsubTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disable-referential-integrity" => Some(("disableReferentialIntegrity", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "disable-resource-versioning" => Some(("disableResourceVersioning", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["disable-referential-integrity", "disable-resource-versioning", "enable-history-import", "enable-update-create", "labels", "name", "notification-config", "pubsub-topic"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FhirStore = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "fhir-store-id" => { + call = call.fhir_store_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["fhir-store-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_execute_bundle(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content-type", "data"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::HttpBody = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_execute_bundle(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_export(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "bigquery-destination.dataset-uri" => Some(("bigqueryDestination.datasetUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "bigquery-destination.schema-config.schema-type" => Some(("bigqueryDestination.schemaConfig.schemaType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "bigquery-destination.schema-config.recursive-structure-depth" => Some(("bigqueryDestination.schemaConfig.recursiveStructureDepth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gcs-destination.uri-prefix" => Some(("gcsDestination.uriPrefix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["bigquery-destination", "dataset-uri", "gcs-destination", "recursive-structure-depth", "schema-config", "schema-type", "uri-prefix"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ExportResourcesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_export(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir__observation_get$lastn(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir__observation_getlastn(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir__patient_get$everything(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir__patient_geteverything(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "start" => { + call = call.start(value.unwrap_or("")); + }, + "end" => { + call = call.end(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["start", "end"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir__history_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir__history_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir__history_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir__history_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "since" => { + call = call.since(value.unwrap_or("")); + }, + "page" => { + call = call.page(value.unwrap_or("")); + }, + "count" => { + call = call.count(arg_from_str(value.unwrap_or("-0"), err, "count", "integer")); + }, + "at" => { + call = call.at(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["count", "since", "page", "at"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir__search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "resource-type" => Some(("resourceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["resource-type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SearchResourcesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir__search(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_conditional_delete_resource(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_conditional_delete_resource(opt.value_of("parent").unwrap_or(""), opt.value_of("type").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_conditional_patch_resource(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content-type", "data"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::HttpBody = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_conditional_patch_resource(request, opt.value_of("parent").unwrap_or(""), opt.value_of("type").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_conditional_update_resource(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content-type", "data"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::HttpBody = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_conditional_update_resource(request, opt.value_of("parent").unwrap_or(""), opt.value_of("type").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_create_resource(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content-type", "data"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::HttpBody = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_create_resource(request, opt.value_of("parent").unwrap_or(""), opt.value_of("type").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_delete$purge(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_deletepurge(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_get_metadata(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_get_metadata(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content-type", "data"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::HttpBody = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_search_resources(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_search_resources(opt.value_of("parent").unwrap_or(""), opt.value_of("resource-type").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_fhir_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content-type", "data"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::HttpBody = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_fhir_update(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_get_iam_policy(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_import(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "content-structure" => Some(("contentStructure", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gcs-source.uri" => Some(("gcsSource.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["content-structure", "gcs-source", "uri"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ImportResourcesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_import(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_fhir_stores_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "enable-history-import" => Some(("enableHistoryImport", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "enable-update-create" => Some(("enableUpdateCreate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "notification-config.pubsub-topic" => Some(("notificationConfig.pubsubTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disable-referential-integrity" => Some(("disableReferentialIntegrity", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "disable-resource-versioning" => Some(("disableResourceVersioning", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["disable-referential-integrity", "disable-resource-versioning", "enable-history-import", "enable-update-create", "labels", "name", "notification-config", "pubsub-topic"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FhirStore = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_fhir_stores_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_fhir_stores_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_get_iam_policy(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "parser-config.allow-null-header" => Some(("parserConfig.allowNullHeader", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "parser-config.segment-terminator" => Some(("parserConfig.segmentTerminator", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notification-config.pubsub-topic" => Some(("notificationConfig.pubsubTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-null-header", "labels", "name", "notification-config", "parser-config", "pubsub-topic", "segment-terminator"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Hl7V2Store = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "hl7-v2-store-id" => { + call = call.hl7_v2_store_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["hl7-v2-store-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_get_iam_policy(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_messages_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "message.name" => Some(("message.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "message.labels" => Some(("message.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "message.message-type" => Some(("message.messageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "message.create-time" => Some(("message.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "message.send-time" => Some(("message.sendTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "message.data" => Some(("message.data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "message.send-facility" => Some(("message.sendFacility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "data", "labels", "message", "message-type", "name", "send-facility", "send-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreateMessageRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_messages_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_messages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_messages_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_messages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_messages_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "view" => { + call = call.view(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["view"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_messages_ingest(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "message.name" => Some(("message.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "message.labels" => Some(("message.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "message.message-type" => Some(("message.messageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "message.create-time" => Some(("message.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "message.send-time" => Some(("message.sendTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "message.data" => Some(("message.data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "message.send-facility" => Some(("message.sendFacility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "data", "labels", "message", "message-type", "name", "send-facility", "send-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::IngestMessageRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_messages_ingest(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_messages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_messages_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_messages_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "message-type" => Some(("messageType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "send-time" => Some(("sendTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "send-facility" => Some(("sendFacility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "data", "labels", "message-type", "name", "send-facility", "send-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Message = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_messages_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "parser-config.allow-null-header" => Some(("parserConfig.allowNullHeader", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "parser-config.segment-terminator" => Some(("parserConfig.segmentTerminator", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notification-config.pubsub-topic" => Some(("notificationConfig.pubsubTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-null-header", "labels", "name", "notification-config", "parser-config", "pubsub-topic", "segment-terminator"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Hl7V2Store = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_hl7_v2_stores_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_hl7_v2_stores_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_operations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_datasets_operations_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "time-zone" => Some(("timeZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["name", "time-zone"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Dataset = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_datasets_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_datasets_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("projects", Some(opt)) => { + match opt.subcommand() { + ("locations-datasets-create", Some(opt)) => { + call_result = self._projects_locations_datasets_create(opt, dry_run, &mut err); + }, + ("locations-datasets-deidentify", Some(opt)) => { + call_result = self._projects_locations_datasets_deidentify(opt, dry_run, &mut err); + }, + ("locations-datasets-delete", Some(opt)) => { + call_result = self._projects_locations_datasets_delete(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-create", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_create(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-delete", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_delete(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-export", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_export(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-get", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_get(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-get-iam-policy", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_get_iam_policy(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-import", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_import(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-list", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_list(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-patch", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_patch(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-search-for-instances", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_search_for_instances(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-search-for-series", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_search_for_series(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-search-for-studies", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_search_for_studies(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-set-iam-policy", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_set_iam_policy(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-store-instances", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_store_instances(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-delete", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_delete(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-retrieve-metadata", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_retrieve_metadata(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-retrieve-study", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_retrieve_study(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-search-for-instances", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_search_for_instances(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-search-for-series", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_search_for_series(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-series-delete", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_series_delete(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-series-instances-delete", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_series_instances_delete(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-frames", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-rendered", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-series-instances-retrieve-instance", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-series-instances-retrieve-metadata", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-series-instances-retrieve-rendered", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-series-retrieve-metadata", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_series_retrieve_metadata(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-series-retrieve-series", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_series_retrieve_series(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-series-search-for-instances", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_series_search_for_instances(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-studies-store-instances", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_studies_store_instances(opt, dry_run, &mut err); + }, + ("locations-datasets-dicom-stores-test-iam-permissions", Some(opt)) => { + call_result = self._projects_locations_datasets_dicom_stores_test_iam_permissions(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-create", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_create(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-delete", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_delete(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-execute-bundle", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_execute_bundle(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-export", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_export(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir--observation-get$lastn", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir__observation_get$lastn(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir--patient-get$everything", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir__patient_get$everything(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir--history-get", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir__history_get(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir--history-list", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir__history_list(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir--search", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir__search(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-conditional-delete-resource", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_conditional_delete_resource(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-conditional-patch-resource", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_conditional_patch_resource(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-conditional-update-resource", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_conditional_update_resource(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-create-resource", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_create_resource(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-delete", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_delete(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-delete$purge", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_delete$purge(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-get", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_get(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-get-metadata", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_get_metadata(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-patch", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_patch(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-search-resources", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_search_resources(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-fhir-update", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_fhir_update(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-get", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_get(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-get-iam-policy", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_get_iam_policy(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-import", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_import(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-list", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_list(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-patch", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_patch(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-set-iam-policy", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_set_iam_policy(opt, dry_run, &mut err); + }, + ("locations-datasets-fhir-stores-test-iam-permissions", Some(opt)) => { + call_result = self._projects_locations_datasets_fhir_stores_test_iam_permissions(opt, dry_run, &mut err); + }, + ("locations-datasets-get", Some(opt)) => { + call_result = self._projects_locations_datasets_get(opt, dry_run, &mut err); + }, + ("locations-datasets-get-iam-policy", Some(opt)) => { + call_result = self._projects_locations_datasets_get_iam_policy(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-create", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_create(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-delete", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_delete(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-get", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_get(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-get-iam-policy", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_get_iam_policy(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-list", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_list(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-messages-create", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_messages_create(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-messages-delete", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_messages_delete(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-messages-get", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_messages_get(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-messages-ingest", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_messages_ingest(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-messages-list", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_messages_list(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-messages-patch", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_messages_patch(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-patch", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_patch(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-set-iam-policy", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_set_iam_policy(opt, dry_run, &mut err); + }, + ("locations-datasets-hl7-v2-stores-test-iam-permissions", Some(opt)) => { + call_result = self._projects_locations_datasets_hl7_v2_stores_test_iam_permissions(opt, dry_run, &mut err); + }, + ("locations-datasets-list", Some(opt)) => { + call_result = self._projects_locations_datasets_list(opt, dry_run, &mut err); + }, + ("locations-datasets-operations-get", Some(opt)) => { + call_result = self._projects_locations_datasets_operations_get(opt, dry_run, &mut err); + }, + ("locations-datasets-operations-list", Some(opt)) => { + call_result = self._projects_locations_datasets_operations_list(opt, dry_run, &mut err); + }, + ("locations-datasets-patch", Some(opt)) => { + call_result = self._projects_locations_datasets_patch(opt, dry_run, &mut err); + }, + ("locations-datasets-set-iam-policy", Some(opt)) => { + call_result = self._projects_locations_datasets_set_iam_policy(opt, dry_run, &mut err); + }, + ("locations-datasets-test-iam-permissions", Some(opt)) => { + call_result = self._projects_locations_datasets_test_iam_permissions(opt, dry_run, &mut err); + }, + ("locations-get", Some(opt)) => { + call_result = self._projects_locations_get(opt, dry_run, &mut err); + }, + ("locations-list", Some(opt)) => { + call_result = self._projects_locations_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "healthcare1-beta1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "healthcare1-beta1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::CloudHealthcare::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("projects", "methods: 'locations-datasets-create', 'locations-datasets-deidentify', 'locations-datasets-delete', 'locations-datasets-dicom-stores-create', 'locations-datasets-dicom-stores-delete', 'locations-datasets-dicom-stores-export', 'locations-datasets-dicom-stores-get', 'locations-datasets-dicom-stores-get-iam-policy', 'locations-datasets-dicom-stores-import', 'locations-datasets-dicom-stores-list', 'locations-datasets-dicom-stores-patch', 'locations-datasets-dicom-stores-search-for-instances', 'locations-datasets-dicom-stores-search-for-series', 'locations-datasets-dicom-stores-search-for-studies', 'locations-datasets-dicom-stores-set-iam-policy', 'locations-datasets-dicom-stores-store-instances', 'locations-datasets-dicom-stores-studies-delete', 'locations-datasets-dicom-stores-studies-retrieve-metadata', 'locations-datasets-dicom-stores-studies-retrieve-study', 'locations-datasets-dicom-stores-studies-search-for-instances', 'locations-datasets-dicom-stores-studies-search-for-series', 'locations-datasets-dicom-stores-studies-series-delete', 'locations-datasets-dicom-stores-studies-series-instances-delete', 'locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-frames', 'locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-rendered', 'locations-datasets-dicom-stores-studies-series-instances-retrieve-instance', 'locations-datasets-dicom-stores-studies-series-instances-retrieve-metadata', 'locations-datasets-dicom-stores-studies-series-instances-retrieve-rendered', 'locations-datasets-dicom-stores-studies-series-retrieve-metadata', 'locations-datasets-dicom-stores-studies-series-retrieve-series', 'locations-datasets-dicom-stores-studies-series-search-for-instances', 'locations-datasets-dicom-stores-studies-store-instances', 'locations-datasets-dicom-stores-test-iam-permissions', 'locations-datasets-fhir-stores-create', 'locations-datasets-fhir-stores-delete', 'locations-datasets-fhir-stores-execute-bundle', 'locations-datasets-fhir-stores-export', 'locations-datasets-fhir-stores-fhir--observation-get$lastn', 'locations-datasets-fhir-stores-fhir--patient-get$everything', 'locations-datasets-fhir-stores-fhir--history-get', 'locations-datasets-fhir-stores-fhir--history-list', 'locations-datasets-fhir-stores-fhir--search', 'locations-datasets-fhir-stores-fhir-conditional-delete-resource', 'locations-datasets-fhir-stores-fhir-conditional-patch-resource', 'locations-datasets-fhir-stores-fhir-conditional-update-resource', 'locations-datasets-fhir-stores-fhir-create-resource', 'locations-datasets-fhir-stores-fhir-delete', 'locations-datasets-fhir-stores-fhir-delete$purge', 'locations-datasets-fhir-stores-fhir-get', 'locations-datasets-fhir-stores-fhir-get-metadata', 'locations-datasets-fhir-stores-fhir-patch', 'locations-datasets-fhir-stores-fhir-search-resources', 'locations-datasets-fhir-stores-fhir-update', 'locations-datasets-fhir-stores-get', 'locations-datasets-fhir-stores-get-iam-policy', 'locations-datasets-fhir-stores-import', 'locations-datasets-fhir-stores-list', 'locations-datasets-fhir-stores-patch', 'locations-datasets-fhir-stores-set-iam-policy', 'locations-datasets-fhir-stores-test-iam-permissions', 'locations-datasets-get', 'locations-datasets-get-iam-policy', 'locations-datasets-hl7-v2-stores-create', 'locations-datasets-hl7-v2-stores-delete', 'locations-datasets-hl7-v2-stores-get', 'locations-datasets-hl7-v2-stores-get-iam-policy', 'locations-datasets-hl7-v2-stores-list', 'locations-datasets-hl7-v2-stores-messages-create', 'locations-datasets-hl7-v2-stores-messages-delete', 'locations-datasets-hl7-v2-stores-messages-get', 'locations-datasets-hl7-v2-stores-messages-ingest', 'locations-datasets-hl7-v2-stores-messages-list', 'locations-datasets-hl7-v2-stores-messages-patch', 'locations-datasets-hl7-v2-stores-patch', 'locations-datasets-hl7-v2-stores-set-iam-policy', 'locations-datasets-hl7-v2-stores-test-iam-permissions', 'locations-datasets-list', 'locations-datasets-operations-get', 'locations-datasets-operations-list', 'locations-datasets-patch', 'locations-datasets-set-iam-policy', 'locations-datasets-test-iam-permissions', 'locations-get' and 'locations-list'", vec![ + ("locations-datasets-create", + Some(r##"Creates a new health dataset. Results are returned through the + Operation interface which returns either an + `Operation.response` which contains a Dataset or + `Operation.error`. The metadata + field type is OperationMetadata."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the project in which the dataset should be created (e.g., + `projects/{project_id}/locations/{location_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-deidentify", + Some(r##"Creates a new dataset containing de-identified data from the source + dataset. The metadata field type + is OperationMetadata. + If the request is successful, the + response field type is + DeidentifySummary. + If errors occur, + details field type is + DeidentifyErrorDetails."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-deidentify", + vec![ + (Some(r##"source-dataset"##), + None, + Some(r##"Source dataset resource name. (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-delete", + Some(r##"Deletes the specified health dataset and all data contained in the dataset. + Deleting a dataset does not affect the sources from which the dataset was + imported (if any)."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the dataset to delete (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-create", + Some(r##"Creates a new DICOM store within the parent dataset."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the dataset this DICOM store belongs to."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-delete", + Some(r##"Deletes the specified DICOM store and removes all images that are contained + within it."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the DICOM store to delete."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-export", + Some(r##"Exports data to the specified destination by copying it from the DICOM + store. + The metadata field type is + OperationMetadata."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-export", + vec![ + (Some(r##"name"##), + None, + Some(r##"The DICOM store resource name from which the data should be exported (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-get", + Some(r##"Gets the specified DICOM store."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the DICOM store to get."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-get-iam-policy", + Some(r##"Gets the access control policy for a resource. + Returns an empty policy if the resource exists and does not have a policy + set."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-import", + Some(r##"Imports data into the DICOM store by copying it from the specified source. + For errors, the Operation will be populated with error details (in the form + of ImportDicomDataErrorDetails in error.details), which will hold + finer-grained error information. + The metadata field type is + OperationMetadata."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-import", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the DICOM store resource into which the data is imported (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-list", + Some(r##"Lists the DICOM stores in the given dataset."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the dataset."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-patch", + Some(r##"Updates the specified DICOM store."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Output only. Resource name of the DICOM store, of the form + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-search-for-instances", + Some(r##"SearchForInstances returns a list of matching instances. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7"##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-search-for-instances", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `instances`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-search-for-series", + Some(r##"SearchForSeries returns a list of matching series. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7"##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-search-for-series", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `series`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-search-for-studies", + Some(r##"SearchForStudies returns a list of matching studies. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7"##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-search-for-studies", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `studies`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any + existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-store-instances", + Some(r##"StoreInstances stores DICOM instances associated with study instance unique + identifiers (SUID). See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.6.1."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-store-instances", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., `studies/{study_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-delete", + Some(r##"DeleteStudy deletes all instances within the given study. Delete requests + are equivalent to the GET requests specified in the WADO-RS standard."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-delete", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., `studies/{study_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-retrieve-metadata", + Some(r##"RetrieveStudyMetadata returns instance associated with the given study + presented as metadata with the bulk data removed. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.6."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-retrieve-metadata", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., `studies/{study_id}/metadata`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-retrieve-study", + Some(r##"RetrieveStudy returns all instances within the given study. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.1."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-retrieve-study", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., `studies/{study_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-search-for-instances", + Some(r##"SearchForInstances returns a list of matching instances. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7"##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-search-for-instances", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `instances`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-search-for-series", + Some(r##"SearchForSeries returns a list of matching series. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7"##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-search-for-series", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `series`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-series-delete", + Some(r##"DeleteSeries deletes all instances within the given study and series. + Delete requests are equivalent to the GET requests specified in the WADO-RS + standard."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-series-delete", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., `studies/{study_id}/series/{series_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-series-instances-delete", + Some(r##"DeleteInstance deletes an instance associated with the given study, series, + and SOP Instance UID. Delete requests are equivalent to the GET requests + specified in the WADO-RS standard."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-series-instances-delete", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `studies/{study_id}/series/{series_id}/instances/{instance_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-frames", + Some(r##"RetrieveFrames returns instances associated with the given study, series, + SOP Instance UID and frame numbers. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.4."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-frames", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `studies/{study_id}/series/{series_id}/instance/{instance_id}/frames/{frame_list}`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-rendered", + Some(r##"RetrieveRenderedFrames returns instances associated with the given study, + series, SOP Instance UID and frame numbers in an acceptable Rendered Media + Type. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.8."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-series-instances-frames-retrieve-rendered", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `studies/{study_id}/series/{series_id}/instance/{instance_id}/frames/{frame_list}/rendered`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-series-instances-retrieve-instance", + Some(r##"RetrieveInstance returns instance associated with the given study, series, + and SOP Instance UID. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.3."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-series-instances-retrieve-instance", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `studies/{study_id}/series/{series_id}/instance/{instance_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-series-instances-retrieve-metadata", + Some(r##"RetrieveInstanceMetadata returns instance associated with the given study, + series, and SOP Instance UID presented as metadata with the bulk data + removed. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.6."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-series-instances-retrieve-metadata", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `studies/{study_id}/series/{series_id}/instances/{instance_id}/metadata`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-series-instances-retrieve-rendered", + Some(r##"RetrieveRenderedInstance returns instance associated with the given study, + series, and SOP Instance UID in an acceptable Rendered Media Type. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.8."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-series-instances-retrieve-rendered", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `studies/{study_id}/series/{series_id}/instance/{instance_id}/rendered`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-series-retrieve-metadata", + Some(r##"RetrieveSeriesMetadata returns instance associated with the given study and + series, presented as metadata with the bulk data removed. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.6."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-series-retrieve-metadata", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., `studies/{study_id}/series/{series_id}/metadata`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-series-retrieve-series", + Some(r##"RetrieveSeries returns all instances within the given study and series. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.2."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-series-retrieve-series", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., `studies/{study_id}/series/{series_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-series-search-for-instances", + Some(r##"SearchForInstances returns a list of matching instances. See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7"##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-series-search-for-instances", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., + `instances`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-studies-store-instances", + Some(r##"StoreInstances stores DICOM instances associated with study instance unique + identifiers (SUID). See + http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.6.1."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-studies-store-instances", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the DICOM store that is being accessed (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"dicom-web-path"##), + None, + Some(r##"The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + QIDO-RS standard (e.g., `studies/{study_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-dicom-stores-test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource. + If the resource does not exist, this will return an empty set of + permissions, not a NOT_FOUND error. + + Note: This operation is designed to be used for building permission-aware + UIs and command-line tools, not for authorization checking. This operation + may "fail open" without warning."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-dicom-stores-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-create", + Some(r##"Creates a new FHIR store within the parent dataset."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the dataset this FHIR store belongs to."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-delete", + Some(r##"Deletes the specified FHIR store and removes all resources within it."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the FHIR store to delete."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-execute-bundle", + Some(r##"Executes all the requests in the given Bundle."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-execute-bundle", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the FHIR store in which this bundle will be executed."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-export", + Some(r##"Export resources from the FHIR store to the specified destination. + + This method returns an Operation that can + be used to track the status of the export by calling + GetOperation. + + Immediate fatal errors appear in the + error field. + Otherwise, when the operation finishes, a detailed response of type + ExportResourcesResponse is returned in the + response field. + The metadata field type for this + operation is OperationMetadata."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-export", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the FHIR store to export resource from. The name should be in + the format of + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir--observation-get$lastn", + Some(r##"Get N most recent observations for patient, grouped by code + that match given query parameters. + "##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir--observation-get$lastn", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the FHIR store to retrieve resources from."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir--patient-get$everything", + Some(r##"Gets all the resources in the patient compartment. + "##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir--patient-get$everything", + vec![ + (Some(r##"name"##), + None, + Some(r##"Name of the patient for which the information is required."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir--history-get", + Some(r##"Gets a version (current or historical) of FHIR resource by version id. + "##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir--history-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the resource version to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir--history-list", + Some(r##"Lists all the versions of a resource (including the current version and + deleted versions) from the FHIR store. + "##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir--history-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the resource to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir--search", + Some(r##"Searches resources in the given FHIR store. + + # Search Parameters + + The server's capability statement, retrieved through + GetCapabilityStatement, indicates which search + parameters are supported on each FHIR resource. + + # Search Modifiers + + Modifier | Supported + ----------- | --------- + `:missing` | Yes + `:exact` | Yes + `:contains` | Yes + `:text` | Yes + `:in` | Yes + `:not-in` | Yes + `:above` | Yes + `:below` | Yes + `:[type]` | Yes + `:not` | Yes + `:recurse` | No"##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir--search", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the FHIR store to retrieve resources from."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-conditional-delete-resource", + Some(r##"Deletes FHIR resources matching a search query. + + Note: unless resource versioning is disabled by setting the + disable_resource_versioning flag + on the FHIR store, the deleted resources will be moved to a history + repository that can still be retrieved through GetResourceVersion and + related methods, unless they are removed by the DeleteResourceVersions + method."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-conditional-delete-resource", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the FHIR store this resource belongs to."##), + Some(true), + Some(false)), + + (Some(r##"type"##), + None, + Some(r##"The type of the resource to update."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-conditional-patch-resource", + Some(r##"Updates parts of a resource if the resource exists based on the + search criteria specified via query parameters."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-conditional-patch-resource", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the FHIR store this resource belongs to."##), + Some(true), + Some(false)), + + (Some(r##"type"##), + None, + Some(r##"The type of the resource to update."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-conditional-update-resource", + Some(r##"Updates the entire resource if the resource exists based on the + search criteria specified via query parameters. + "##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-conditional-update-resource", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the FHIR store this resource belongs to."##), + Some(true), + Some(false)), + + (Some(r##"type"##), + None, + Some(r##"The type of the resource to update."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-create-resource", + Some(r##"Creates a FHIR resource. + "##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-create-resource", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the FHIR store this resource belongs to."##), + Some(true), + Some(false)), + + (Some(r##"type"##), + None, + Some(r##"The type of the resource to create."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-delete", + Some(r##"Deletes a FHIR resource. + + Note: unless resource versioning is disabled by setting the + disable_resource_versioning flag + on the FHIR store, the deleted resources will be moved to a history + repository that can still be retrieved through GetResourceVersion and + related methods, unless they are removed by the DeleteResourceVersions + method."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the resource to delete."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-delete$purge", + Some(r##"Deletes all the historical versions of a resource (excluding current + version) from the FHIR store. To remove all versions of a resource, first + delete the current version and call this method."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-delete$purge", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the resource to purge."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-get", + Some(r##"Gets a FHIR resource. + "##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the resource to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-get-metadata", + Some(r##"Gets the FHIR capability statement for the store, which contains a + description of functionality supported by the server. + "##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-get-metadata", + vec![ + (Some(r##"name"##), + None, + Some(r##"Name of the FHIR store to retrieve the capabilities for."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-patch", + Some(r##"Updates part of an existing resource. + "##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the resource to update."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-search-resources", + Some(r##"Searches resources in the given FHIR store. + + # Search Parameters + + The server's capability statement, retrieved through + GetCapabilityStatement, indicates which search + parameters are supported on each FHIR resource. + + # Search Modifiers + + Modifier | Supported + ----------- | --------- + `:missing` | Yes + `:exact` | Yes + `:contains` | Yes + `:text` | Yes + `:in` | Yes + `:not-in` | Yes + `:above` | Yes + `:below` | Yes + `:[type]` | Yes + `:not` | Yes + `:recurse` | No"##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-search-resources", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the FHIR store to retrieve resources from."##), + Some(true), + Some(false)), + + (Some(r##"resource-type"##), + None, + Some(r##"The type of the resource to search."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-fhir-update", + Some(r##"Updates the entire resource or creates a new resource with a client + specified ID if the resource does not exist and the FHIR store has + enable_update_create set. + "##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-fhir-update", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the resource to update."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-get", + Some(r##"Gets the configuration of the specified FHIR store."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the FHIR store to get."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-get-iam-policy", + Some(r##"Gets the access control policy for a resource. + Returns an empty policy if the resource exists and does not have a policy + set."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-import", + Some(r##"Import resources to the FHIR store by loading data from the specified + sources. Each resource must have a client-supplied ID, which is retained + by the server. + + The import operation is idempotent. Upon retry, the most recent data + (matching the client-supplied ID) is overwritten, without creating a new + resource version. If partial failures occur during the import, successful + changes are not rolled back. + + If history imports are enabled + (enable_history_import is set in the + FHIR store's configuration), you can import historical versions of a + resource by supplying a bundle of type `history`. The historical versions + in the bundle must have `lastUpdated` timestamps. If a current or + historical version with the supplied resource ID already exists, the + bundle is rejected. + + This method returns an Operation that can + be used to track the status of the import by calling + GetOperation. + + Immediate fatal errors appear in the + error field. + Otherwise, when the operation finishes, a detailed response of type + ImportResourcesResponse is returned in the + response field. + The metadata field type for this + operation is OperationMetadata."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-import", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the FHIR store to import FHIR resources to. The name should be + in the format of + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-list", + Some(r##"Lists the FHIR stores in the given dataset."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the dataset."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-patch", + Some(r##"Updates the configuration of the specified FHIR store."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Output only. Resource name of the FHIR store, of the form + `projects/{project_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any + existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-fhir-stores-test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource. + If the resource does not exist, this will return an empty set of + permissions, not a NOT_FOUND error. + + Note: This operation is designed to be used for building permission-aware + UIs and command-line tools, not for authorization checking. This operation + may "fail open" without warning."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-fhir-stores-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-get", + Some(r##"Gets any metadata associated with a dataset."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the dataset to read (e.g., + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-get-iam-policy", + Some(r##"Gets the access control policy for a resource. + Returns an empty policy if the resource exists and does not have a policy + set."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-create", + Some(r##"Creates a new HL7v2 store within the parent dataset."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the dataset this HL7v2 store belongs to."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-delete", + Some(r##"Deletes the specified HL7v2 store and removes all messages that are + contained within it."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the HL7v2 store to delete."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-get", + Some(r##"Gets the specified HL7v2 store."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the HL7v2 store to get."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-get-iam-policy", + Some(r##"Gets the access control policy for a resource. + Returns an empty policy if the resource exists and does not have a policy + set."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-list", + Some(r##"Lists the HL7v2 stores in the given dataset."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the dataset."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-messages-create", + Some(r##"Creates a message and sends a notification to the Cloud Pub/Sub topic. If + configured, the MLLP adapter listens to messages created by this method and + sends those back to the hospital. A successful response indicates the + message has been persisted to storage and a Cloud Pub/Sub notification has + been sent. Sending to the hospital by the MLLP adapter happens + asynchronously."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-messages-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the dataset this message belongs to."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-messages-delete", + Some(r##"Deletes an HL7v2 message."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-messages-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the HL7v2 message to delete."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-messages-get", + Some(r##"Gets an HL7v2 message."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-messages-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the HL7v2 message to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-messages-ingest", + Some(r##"Ingests a new HL7v2 message from the hospital and sends a notification to + the Cloud Pub/Sub topic. Return is an HL7v2 ACK message if the message was + successfully stored. Otherwise an error is returned. If an identical + HL7v2 message is created twice only one resource is created on the server + and no error is reported."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-messages-ingest", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the HL7v2 store this message belongs to."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-messages-list", + Some(r##"Lists all the messages in the given HL7v2 store with support for filtering."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-messages-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the HL7v2 store to retrieve messages from."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-messages-patch", + Some(r##"Update the message."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-messages-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name of the Message, of the form + `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7_v2_store_id}/messages/{message_id}`. + Assigned by the server."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-patch", + Some(r##"Updates the HL7v2 store."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Output only. Resource name of the HL7v2 store, of the form + `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any + existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-hl7-v2-stores-test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource. + If the resource does not exist, this will return an empty set of + permissions, not a NOT_FOUND error. + + Note: This operation is designed to be used for building permission-aware + UIs and command-line tools, not for authorization checking. This operation + may "fail open" without warning."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-hl7-v2-stores-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-list", + Some(r##"Lists the health datasets in the current project."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the project whose datasets should be listed (e.g., + `projects/{project_id}/locations/{location_id}`)."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-operations-get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-operations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-operations-list", + Some(r##"Lists operations that match the specified filter in the request. If the + server doesn't support this method, it returns `UNIMPLEMENTED`. + + NOTE: the `name` binding allows API services to override the binding + to use different resource name schemes, such as `users/*/operations`. To + override the binding, API services can add a binding such as + `"/v1/{name=users/*}/operations"` to their service configuration. + For backwards compatibility, the default name includes the operations + collection id, however overriding users must ensure the name binding + is the parent resource, without the operations collection id."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-operations-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation's parent resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-patch", + Some(r##"Updates dataset metadata."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"Output only. Resource name of the dataset, of the form + `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-set-iam-policy", + Some(r##"Sets the access control policy on the specified resource. Replaces any + existing policy."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-datasets-test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource. + If the resource does not exist, this will return an empty set of + permissions, not a NOT_FOUND error. + + Note: This operation is designed to be used for building permission-aware + UIs and command-line tools, not for authorization checking. This operation + may "fail open" without warning."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-datasets-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-get", + Some(r##"Gets information about a location."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name for the location."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-list", + Some(r##"Lists information about the supported locations for this service."##), + "Details at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli/projects_locations-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource that owns the locations collection, if applicable."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("healthcare1-beta1") + .author("Sebastian Thiel ") + .version("1.0.8+20190401") + .about("Manage, store, and access healthcare data in Google Cloud Platform.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_healthcare1_beta1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/healthcare1_beta1/Cargo.toml b/gen/healthcare1_beta1/Cargo.toml new file mode 100644 index 0000000000..9ec6585bdd --- /dev/null +++ b/gen/healthcare1_beta1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-healthcare1_beta1" +version = "1.0.8+20190401" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Healthcare (protocol v1beta1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/healthcare1_beta1" +homepage = "https://cloud.google.com/healthcare" +documentation = "https://docs.rs/google-healthcare1_beta1/1.0.8+20190401" +license = "MIT" +keywords = ["healthcare", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/healthcare1_beta1/LICENSE.md b/gen/healthcare1_beta1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/healthcare1_beta1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/healthcare1_beta1/README.md b/gen/healthcare1_beta1/README.md new file mode 100644 index 0000000000..5c1aeb3f0e --- /dev/null +++ b/gen/healthcare1_beta1/README.md @@ -0,0 +1,217 @@ + +The `google-healthcare1_beta1` library allows access to all features of the *Google Cloud Healthcare* service. + +This documentation was generated from *Cloud Healthcare* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *healthcare:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Cloud Healthcare* *v1_beta1* API can be found at the +[official documentation site](https://cloud.google.com/healthcare). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.CloudHealthcare.html) ... + +* projects + * [*locations datasets create*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetCreateCall.html), [*locations datasets deidentify*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDeidentifyCall.html), [*locations datasets delete*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDeleteCall.html), [*locations datasets dicom stores create*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreCreateCall.html), [*locations datasets dicom stores delete*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreDeleteCall.html), [*locations datasets dicom stores export*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreExportCall.html), [*locations datasets dicom stores get*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreGetCall.html), [*locations datasets dicom stores get iam policy*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreGetIamPolicyCall.html), [*locations datasets dicom stores import*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreImportCall.html), [*locations datasets dicom stores list*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreListCall.html), [*locations datasets dicom stores patch*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStorePatchCall.html), [*locations datasets dicom stores search for instances*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreSearchForInstanceCall.html), [*locations datasets dicom stores search for series*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreSearchForSeryCall.html), [*locations datasets dicom stores search for studies*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreSearchForStudyCall.html), [*locations datasets dicom stores set iam policy*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreSetIamPolicyCall.html), [*locations datasets dicom stores store instances*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStoreInstanceCall.html), [*locations datasets dicom stores studies delete*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudyDeleteCall.html), [*locations datasets dicom stores studies retrieve metadata*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall.html), [*locations datasets dicom stores studies retrieve study*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall.html), [*locations datasets dicom stores studies search for instances*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySearchForInstanceCall.html), [*locations datasets dicom stores studies search for series*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySearchForSeryCall.html), [*locations datasets dicom stores studies series delete*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySeryDeleteCall.html), [*locations datasets dicom stores studies series instances delete*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall.html), [*locations datasets dicom stores studies series instances frames retrieve frames*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall.html), [*locations datasets dicom stores studies series instances frames retrieve rendered*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall.html), [*locations datasets dicom stores studies series instances retrieve instance*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall.html), [*locations datasets dicom stores studies series instances retrieve metadata*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall.html), [*locations datasets dicom stores studies series instances retrieve rendered*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall.html), [*locations datasets dicom stores studies series retrieve metadata*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall.html), [*locations datasets dicom stores studies series retrieve series*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall.html), [*locations datasets dicom stores studies series search for instances*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall.html), [*locations datasets dicom stores studies store instances*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreStudyStoreInstanceCall.html), [*locations datasets dicom stores test iam permissions*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetDicomStoreTestIamPermissionCall.html), [*locations datasets fhir stores create*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreCreateCall.html), [*locations datasets fhir stores delete*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreDeleteCall.html), [*locations datasets fhir stores execute bundle*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreExecuteBundleCall.html), [*locations datasets fhir stores export*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreExportCall.html), [*locations datasets fhir stores fhir observation get$lastn*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall.html), [*locations datasets fhir stores fhir patient get$everything*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall.html), [*locations datasets fhir stores fhir _history get*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirHistoryGetCall.html), [*locations datasets fhir stores fhir _history list*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirHistoryListCall.html), [*locations datasets fhir stores fhir _search*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirSearchCall.html), [*locations datasets fhir stores fhir conditional delete resource*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall.html), [*locations datasets fhir stores fhir conditional patch resource*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall.html), [*locations datasets fhir stores fhir conditional update resource*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall.html), [*locations datasets fhir stores fhir create resource*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirCreateResourceCall.html), [*locations datasets fhir stores fhir delete*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirDeleteCall.html), [*locations datasets fhir stores fhir delete$purge*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirDelete$purgeCall.html), [*locations datasets fhir stores fhir get*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirGetCall.html), [*locations datasets fhir stores fhir get metadata*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirGetMetadataCall.html), [*locations datasets fhir stores fhir patch*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirPatchCall.html), [*locations datasets fhir stores fhir search resources*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirSearchResourceCall.html), [*locations datasets fhir stores fhir update*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreFhirUpdateCall.html), [*locations datasets fhir stores get*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreGetCall.html), [*locations datasets fhir stores get iam policy*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreGetIamPolicyCall.html), [*locations datasets fhir stores import*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreImportCall.html), [*locations datasets fhir stores list*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreListCall.html), [*locations datasets fhir stores patch*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStorePatchCall.html), [*locations datasets fhir stores set iam policy*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreSetIamPolicyCall.html), [*locations datasets fhir stores test iam permissions*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetFhirStoreTestIamPermissionCall.html), [*locations datasets get*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetGetCall.html), [*locations datasets get iam policy*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetGetIamPolicyCall.html), [*locations datasets hl7 v2 stores create*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreCreateCall.html), [*locations datasets hl7 v2 stores delete*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreDeleteCall.html), [*locations datasets hl7 v2 stores get*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreGetCall.html), [*locations datasets hl7 v2 stores get iam policy*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreGetIamPolicyCall.html), [*locations datasets hl7 v2 stores list*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreListCall.html), [*locations datasets hl7 v2 stores messages create*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreMessageCreateCall.html), [*locations datasets hl7 v2 stores messages delete*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreMessageDeleteCall.html), [*locations datasets hl7 v2 stores messages get*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreMessageGetCall.html), [*locations datasets hl7 v2 stores messages ingest*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreMessageIngestCall.html), [*locations datasets hl7 v2 stores messages list*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreMessageListCall.html), [*locations datasets hl7 v2 stores messages patch*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreMessagePatchCall.html), [*locations datasets hl7 v2 stores patch*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StorePatchCall.html), [*locations datasets hl7 v2 stores set iam policy*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreSetIamPolicyCall.html), [*locations datasets hl7 v2 stores test iam permissions*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetHl7V2StoreTestIamPermissionCall.html), [*locations datasets list*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetListCall.html), [*locations datasets operations get*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetOperationGetCall.html), [*locations datasets operations list*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetOperationListCall.html), [*locations datasets patch*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetPatchCall.html), [*locations datasets set iam policy*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetSetIamPolicyCall.html), [*locations datasets test iam permissions*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationDatasetTestIamPermissionCall.html), [*locations get*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationGetCall.html) and [*locations list*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.ProjectLocationListCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/struct.CloudHealthcare.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.projects().locations_datasets_fhir_stores_fhir__search(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir_get_metadata(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_search_for_studies(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir_delete(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir_search_resources(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir_patch(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_series_search_for_instances(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_metadata(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_search_for_series(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir__observation_getlastn(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir_conditional_update_resource(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir_create_resource(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_retrieve_study(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir_update(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_store_instances(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir_conditional_patch_resource(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir__history_list(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir__history_get(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir_get(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_search_for_instances(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_search_for_series(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_search_for_instances(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_retrieve_metadata(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_series(...).doit() +let r = hub.projects().locations_datasets_dicom_stores_store_instances(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_execute_bundle(...).doit() +let r = hub.projects().locations_datasets_fhir_stores_fhir__patient_geteverything(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-healthcare1_beta1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_healthcare1_beta1 as healthcare1_beta1; +use healthcare1_beta1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use healthcare1_beta1::CloudHealthcare; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.projects().locations_datasets_fhir_stores_fhir__history_list("name") + .since("sit") + .page("Stet") + .count(-42) + .at("et") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-healthcare1_beta1/1.0.8+20190401/google_healthcare1_beta1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **healthcare1_beta1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/healthcare1_beta1/src/cmn.rs b/gen/healthcare1_beta1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/healthcare1_beta1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/healthcare1_beta1/src/lib.rs b/gen/healthcare1_beta1/src/lib.rs new file mode 100644 index 0000000000..3ca6b78afe --- /dev/null +++ b/gen/healthcare1_beta1/src/lib.rs @@ -0,0 +1,27117 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud Healthcare* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *healthcare:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Cloud Healthcare* *v1_beta1* API can be found at the +//! [official documentation site](https://cloud.google.com/healthcare). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/healthcare1_beta1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.CloudHealthcare.html) ... +//! +//! * projects +//! * [*locations datasets create*](struct.ProjectLocationDatasetCreateCall.html), [*locations datasets deidentify*](struct.ProjectLocationDatasetDeidentifyCall.html), [*locations datasets delete*](struct.ProjectLocationDatasetDeleteCall.html), [*locations datasets dicom stores create*](struct.ProjectLocationDatasetDicomStoreCreateCall.html), [*locations datasets dicom stores delete*](struct.ProjectLocationDatasetDicomStoreDeleteCall.html), [*locations datasets dicom stores export*](struct.ProjectLocationDatasetDicomStoreExportCall.html), [*locations datasets dicom stores get*](struct.ProjectLocationDatasetDicomStoreGetCall.html), [*locations datasets dicom stores get iam policy*](struct.ProjectLocationDatasetDicomStoreGetIamPolicyCall.html), [*locations datasets dicom stores import*](struct.ProjectLocationDatasetDicomStoreImportCall.html), [*locations datasets dicom stores list*](struct.ProjectLocationDatasetDicomStoreListCall.html), [*locations datasets dicom stores patch*](struct.ProjectLocationDatasetDicomStorePatchCall.html), [*locations datasets dicom stores search for instances*](struct.ProjectLocationDatasetDicomStoreSearchForInstanceCall.html), [*locations datasets dicom stores search for series*](struct.ProjectLocationDatasetDicomStoreSearchForSeryCall.html), [*locations datasets dicom stores search for studies*](struct.ProjectLocationDatasetDicomStoreSearchForStudyCall.html), [*locations datasets dicom stores set iam policy*](struct.ProjectLocationDatasetDicomStoreSetIamPolicyCall.html), [*locations datasets dicom stores store instances*](struct.ProjectLocationDatasetDicomStoreStoreInstanceCall.html), [*locations datasets dicom stores studies delete*](struct.ProjectLocationDatasetDicomStoreStudyDeleteCall.html), [*locations datasets dicom stores studies retrieve metadata*](struct.ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall.html), [*locations datasets dicom stores studies retrieve study*](struct.ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall.html), [*locations datasets dicom stores studies search for instances*](struct.ProjectLocationDatasetDicomStoreStudySearchForInstanceCall.html), [*locations datasets dicom stores studies search for series*](struct.ProjectLocationDatasetDicomStoreStudySearchForSeryCall.html), [*locations datasets dicom stores studies series delete*](struct.ProjectLocationDatasetDicomStoreStudySeryDeleteCall.html), [*locations datasets dicom stores studies series instances delete*](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall.html), [*locations datasets dicom stores studies series instances frames retrieve frames*](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall.html), [*locations datasets dicom stores studies series instances frames retrieve rendered*](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall.html), [*locations datasets dicom stores studies series instances retrieve instance*](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall.html), [*locations datasets dicom stores studies series instances retrieve metadata*](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall.html), [*locations datasets dicom stores studies series instances retrieve rendered*](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall.html), [*locations datasets dicom stores studies series retrieve metadata*](struct.ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall.html), [*locations datasets dicom stores studies series retrieve series*](struct.ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall.html), [*locations datasets dicom stores studies series search for instances*](struct.ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall.html), [*locations datasets dicom stores studies store instances*](struct.ProjectLocationDatasetDicomStoreStudyStoreInstanceCall.html), [*locations datasets dicom stores test iam permissions*](struct.ProjectLocationDatasetDicomStoreTestIamPermissionCall.html), [*locations datasets fhir stores create*](struct.ProjectLocationDatasetFhirStoreCreateCall.html), [*locations datasets fhir stores delete*](struct.ProjectLocationDatasetFhirStoreDeleteCall.html), [*locations datasets fhir stores execute bundle*](struct.ProjectLocationDatasetFhirStoreExecuteBundleCall.html), [*locations datasets fhir stores export*](struct.ProjectLocationDatasetFhirStoreExportCall.html), [*locations datasets fhir stores fhir observation get$lastn*](struct.ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall.html), [*locations datasets fhir stores fhir patient get$everything*](struct.ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall.html), [*locations datasets fhir stores fhir _history get*](struct.ProjectLocationDatasetFhirStoreFhirHistoryGetCall.html), [*locations datasets fhir stores fhir _history list*](struct.ProjectLocationDatasetFhirStoreFhirHistoryListCall.html), [*locations datasets fhir stores fhir _search*](struct.ProjectLocationDatasetFhirStoreFhirSearchCall.html), [*locations datasets fhir stores fhir conditional delete resource*](struct.ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall.html), [*locations datasets fhir stores fhir conditional patch resource*](struct.ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall.html), [*locations datasets fhir stores fhir conditional update resource*](struct.ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall.html), [*locations datasets fhir stores fhir create resource*](struct.ProjectLocationDatasetFhirStoreFhirCreateResourceCall.html), [*locations datasets fhir stores fhir delete*](struct.ProjectLocationDatasetFhirStoreFhirDeleteCall.html), [*locations datasets fhir stores fhir delete$purge*](struct.ProjectLocationDatasetFhirStoreFhirDelete$purgeCall.html), [*locations datasets fhir stores fhir get*](struct.ProjectLocationDatasetFhirStoreFhirGetCall.html), [*locations datasets fhir stores fhir get metadata*](struct.ProjectLocationDatasetFhirStoreFhirGetMetadataCall.html), [*locations datasets fhir stores fhir patch*](struct.ProjectLocationDatasetFhirStoreFhirPatchCall.html), [*locations datasets fhir stores fhir search resources*](struct.ProjectLocationDatasetFhirStoreFhirSearchResourceCall.html), [*locations datasets fhir stores fhir update*](struct.ProjectLocationDatasetFhirStoreFhirUpdateCall.html), [*locations datasets fhir stores get*](struct.ProjectLocationDatasetFhirStoreGetCall.html), [*locations datasets fhir stores get iam policy*](struct.ProjectLocationDatasetFhirStoreGetIamPolicyCall.html), [*locations datasets fhir stores import*](struct.ProjectLocationDatasetFhirStoreImportCall.html), [*locations datasets fhir stores list*](struct.ProjectLocationDatasetFhirStoreListCall.html), [*locations datasets fhir stores patch*](struct.ProjectLocationDatasetFhirStorePatchCall.html), [*locations datasets fhir stores set iam policy*](struct.ProjectLocationDatasetFhirStoreSetIamPolicyCall.html), [*locations datasets fhir stores test iam permissions*](struct.ProjectLocationDatasetFhirStoreTestIamPermissionCall.html), [*locations datasets get*](struct.ProjectLocationDatasetGetCall.html), [*locations datasets get iam policy*](struct.ProjectLocationDatasetGetIamPolicyCall.html), [*locations datasets hl7 v2 stores create*](struct.ProjectLocationDatasetHl7V2StoreCreateCall.html), [*locations datasets hl7 v2 stores delete*](struct.ProjectLocationDatasetHl7V2StoreDeleteCall.html), [*locations datasets hl7 v2 stores get*](struct.ProjectLocationDatasetHl7V2StoreGetCall.html), [*locations datasets hl7 v2 stores get iam policy*](struct.ProjectLocationDatasetHl7V2StoreGetIamPolicyCall.html), [*locations datasets hl7 v2 stores list*](struct.ProjectLocationDatasetHl7V2StoreListCall.html), [*locations datasets hl7 v2 stores messages create*](struct.ProjectLocationDatasetHl7V2StoreMessageCreateCall.html), [*locations datasets hl7 v2 stores messages delete*](struct.ProjectLocationDatasetHl7V2StoreMessageDeleteCall.html), [*locations datasets hl7 v2 stores messages get*](struct.ProjectLocationDatasetHl7V2StoreMessageGetCall.html), [*locations datasets hl7 v2 stores messages ingest*](struct.ProjectLocationDatasetHl7V2StoreMessageIngestCall.html), [*locations datasets hl7 v2 stores messages list*](struct.ProjectLocationDatasetHl7V2StoreMessageListCall.html), [*locations datasets hl7 v2 stores messages patch*](struct.ProjectLocationDatasetHl7V2StoreMessagePatchCall.html), [*locations datasets hl7 v2 stores patch*](struct.ProjectLocationDatasetHl7V2StorePatchCall.html), [*locations datasets hl7 v2 stores set iam policy*](struct.ProjectLocationDatasetHl7V2StoreSetIamPolicyCall.html), [*locations datasets hl7 v2 stores test iam permissions*](struct.ProjectLocationDatasetHl7V2StoreTestIamPermissionCall.html), [*locations datasets list*](struct.ProjectLocationDatasetListCall.html), [*locations datasets operations get*](struct.ProjectLocationDatasetOperationGetCall.html), [*locations datasets operations list*](struct.ProjectLocationDatasetOperationListCall.html), [*locations datasets patch*](struct.ProjectLocationDatasetPatchCall.html), [*locations datasets set iam policy*](struct.ProjectLocationDatasetSetIamPolicyCall.html), [*locations datasets test iam permissions*](struct.ProjectLocationDatasetTestIamPermissionCall.html), [*locations get*](struct.ProjectLocationGetCall.html) and [*locations list*](struct.ProjectLocationListCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudHealthcare.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().locations_datasets_fhir_stores_fhir__search(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir_get_metadata(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_search_for_studies(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir_delete(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir_search_resources(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir_patch(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_series_search_for_instances(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_metadata(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_search_for_series(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir__observation_getlastn(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir_conditional_update_resource(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir_create_resource(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_retrieve_study(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir_update(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_store_instances(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir_conditional_patch_resource(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir__history_list(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir__history_get(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir_get(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_search_for_instances(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_search_for_series(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_search_for_instances(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_retrieve_metadata(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_series(...).doit() +//! let r = hub.projects().locations_datasets_dicom_stores_store_instances(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_execute_bundle(...).doit() +//! let r = hub.projects().locations_datasets_fhir_stores_fhir__patient_geteverything(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-healthcare1_beta1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_healthcare1_beta1 as healthcare1_beta1; +//! use healthcare1_beta1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use healthcare1_beta1::CloudHealthcare; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.projects().locations_datasets_fhir_stores_fhir__history_list("name") +//! .since("kasd") +//! .page("accusam") +//! .count(-8) +//! .at("justo") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudHealthcare related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use healthcare1_beta1::CloudHealthcare; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir__history_list("name") +/// .since("erat") +/// .page("labore") +/// .count(-9) +/// .at("nonumy") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudHealthcare { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for CloudHealthcare {} + +impl<'a, C, A> CloudHealthcare + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudHealthcare { + CloudHealthcare { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://healthcare.googleapis.com/".to_string(), + _root_url: "https://healthcare.googleapis.com/".to_string(), + } + } + + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://healthcare.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://healthcare.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Define how to redact sensitive values. Default behaviour is erase, +/// e.g. "My name is Jake." becomes "My name is ." +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RedactConfig { _never_set: Option } + +impl Part for RedactConfig {} + + +/// Represents a DICOM store. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets dicom stores create projects](struct.ProjectLocationDatasetDicomStoreCreateCall.html) (request|response) +/// * [locations datasets dicom stores patch projects](struct.ProjectLocationDatasetDicomStorePatchCall.html) (request|response) +/// * [locations datasets dicom stores get projects](struct.ProjectLocationDatasetDicomStoreGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DicomStore { + /// User-supplied key-value pairs used to organize DICOM stores. + /// + /// Label keys must be between 1 and 63 characters long, have a UTF-8 encoding + /// of maximum 128 bytes, and must conform to the + /// following PCRE regular expression: + /// \p{Ll}\p{Lo}{0,62} + /// + /// Label values are optional, must be between 1 and 63 characters long, have + /// a UTF-8 encoding of maximum 128 bytes, and must conform to the + /// following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} + /// + /// No more than 64 labels can be associated with a given store. + pub labels: Option>, + /// Output only. Resource name of the DICOM store, of the form + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`. + pub name: Option, + /// Notification destination for new DICOM instances. + /// Supplied by the client. + #[serde(rename="notificationConfig")] + pub notification_config: Option, +} + +impl RequestValue for DicomStore {} +impl ResponseResult for DicomStore {} + + +/// The Cloud Storage location where the output should be written, and the export +/// configuration. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudHealthcareV1beta1DicomGcsDestination { + /// MIME types supported by DICOM spec. + /// Each file will be written in the following format: + /// `.../{study_id}/{series_id}/{instance_id}[/{frame_number}].{extension}` + /// The frame_number component will exist only for multi-frame instances. + /// + /// Refer to the DICOM conformance statement for permissible MIME types: + /// https://cloud.google.com/healthcare/docs/dicom#wado-rs + /// + /// The following extensions will be used for output files: + /// application/dicom -> .dcm + /// image/jpeg -> .jpg + /// image/png -> .png + /// + /// If unspecified, the instances will be exported in their original + /// DICOM format. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// The Cloud Storage destination to export to. + /// + /// URI for a Cloud Storage directory where result files should be written (in + /// the format `gs://{bucket-id}/{path/to/destination/dir}`). If there is no + /// trailing slash, the service will append one when composing the object path. + /// The user is responsible for creating the Cloud Storage bucket referenced in + /// `uri_prefix`. + #[serde(rename="uriPrefix")] + pub uri_prefix: Option, +} + +impl Part for GoogleCloudHealthcareV1beta1DicomGcsDestination {} + + +/// Creates a new message. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets hl7 v2 stores messages create projects](struct.ProjectLocationDatasetHl7V2StoreMessageCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateMessageRequest { + /// HL7v2 message. + pub message: Option, +} + +impl RequestValue for CreateMessageRequest {} + + +/// Imports data into the specified DICOM store. +/// Returns an error if any of the files to import are not DICOM files. This +/// API will accept duplicate DICOM instances, by simply ignoring the newly +/// pushed instance (it will not overwrite). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets dicom stores import projects](struct.ProjectLocationDatasetDicomStoreImportCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImportDicomDataRequest { + /// Cloud Storage source data location and import configuration. + /// + /// The Cloud Storage location requires the `roles/storage.objectViewer` + /// Cloud IAM role. + #[serde(rename="gcsSource")] + pub gcs_source: Option, +} + +impl RequestValue for ImportDicomDataRequest {} + + +/// When using the INSPECT_AND_TRANSFORM action, each match is replaced with +/// the name of the info_type. For example, "My name is Jake" becomes "My name is +/// [PERSON_NAME]." The TRANSFORM action is equivalent to redacting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReplaceWithInfoTypeConfig { _never_set: Option } + +impl Part for ReplaceWithInfoTypeConfig {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets dicom stores studies series delete projects](struct.ProjectLocationDatasetDicomStoreStudySeryDeleteCall.html) (response) +/// * [locations datasets fhir stores fhir delete$purge projects](struct.ProjectLocationDatasetFhirStoreFhirDelete$purgeCall.html) (response) +/// * [locations datasets delete projects](struct.ProjectLocationDatasetDeleteCall.html) (response) +/// * [locations datasets dicom stores studies series instances delete projects](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall.html) (response) +/// * [locations datasets dicom stores studies delete projects](struct.ProjectLocationDatasetDicomStoreStudyDeleteCall.html) (response) +/// * [locations datasets dicom stores delete projects](struct.ProjectLocationDatasetDicomStoreDeleteCall.html) (response) +/// * [locations datasets hl7 v2 stores messages delete projects](struct.ProjectLocationDatasetHl7V2StoreMessageDeleteCall.html) (response) +/// * [locations datasets fhir stores fhir conditional delete resource projects](struct.ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall.html) (response) +/// * [locations datasets fhir stores delete projects](struct.ProjectLocationDatasetFhirStoreDeleteCall.html) (response) +/// * [locations datasets hl7 v2 stores delete projects](struct.ProjectLocationDatasetHl7V2StoreDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets dicom stores test iam permissions projects](struct.ProjectLocationDatasetDicomStoreTestIamPermissionCall.html) (response) +/// * [locations datasets test iam permissions projects](struct.ProjectLocationDatasetTestIamPermissionCall.html) (response) +/// * [locations datasets fhir stores test iam permissions projects](struct.ProjectLocationDatasetFhirStoreTestIamPermissionCall.html) (response) +/// * [locations datasets hl7 v2 stores test iam permissions projects](struct.ProjectLocationDatasetHl7V2StoreTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestIamPermissionsResponse {} + + +/// Lists the HL7v2 stores in the given dataset. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets hl7 v2 stores list projects](struct.ProjectLocationDatasetHl7V2StoreListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListHl7V2StoresResponse { + /// Token to retrieve the next page of results or empty if there are no more + /// results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The returned HL7v2 stores. Won't be more HL7v2 stores than the value of + /// page_size in the request. + #[serde(rename="hl7V2Stores")] + pub hl7_v2_stores: Option>, +} + +impl ResponseResult for ListHl7V2StoresResponse {} + + +/// The BigQuery table where the output should be written. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudHealthcareV1beta1DicomBigQueryDestination { + /// BigQuery URI to a table, up to 2000 characters long, in the format + /// `bq://projectId.bqDatasetId.tableId` + #[serde(rename="tableUri")] + pub table_uri: Option, + /// If the destination table already exists and this flag is `TRUE`, the table + /// will be overwritten by the contents of the DICOM store. If the flag is not + /// set and the destination table already exists, the export call returns an + /// error. + pub force: Option, +} + +impl Part for GoogleCloudHealthcareV1beta1DicomBigQueryDestination {} + + +/// Request to import resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets fhir stores import projects](struct.ProjectLocationDatasetFhirStoreImportCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImportResourcesRequest { + /// The content structure in the source location. The default is + /// BUNDLE. + #[serde(rename="contentStructure")] + pub content_structure: Option, + /// Cloud Storage source data location and import configuration. + /// + /// The Cloud Storage location requires the `roles/storage.objectViewer` + /// Cloud IAM role. + /// + /// Each Cloud Storage object should be a text file that contains newline + /// delimited JSON structures conforming to FHIR standard. + /// + /// To improve performance, use multiple Cloud Storage objects where each + /// object contains a subset of all of the newline-delimited JSON structures. + /// You can select all of the objects using the uri as the + /// prefix. The maximum number of objects is 1,000. + #[serde(rename="gcsSource")] + pub gcs_source: Option, +} + +impl RequestValue for ImportResourcesRequest {} + + +/// Request to search the resources in the specified FHIR store. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets fhir stores fhir _search projects](struct.ProjectLocationDatasetFhirStoreFhirSearchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SearchResourcesRequest { + /// The type of the resource to search. + #[serde(rename="resourceType")] + pub resource_type: Option, +} + +impl RequestValue for SearchResourcesRequest {} + + +/// Specifies where notifications should be sent upon changes to a data store. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NotificationConfig { + /// The [Cloud Pub/Sub](https://cloud.google.com/pubsub/docs/) topic that + /// notifications of changes are published on. Supplied by the client. + /// PubsubMessage.Data will contain the resource name. + /// PubsubMessage.MessageId is the ID of this message. It is guaranteed to be + /// unique within the topic. + /// PubsubMessage.PublishTime is the time at which the message was published. + /// Notifications are only sent if the topic is + /// non-empty. [Topic + /// names](https://cloud.google.com/pubsub/docs/overview#names) must be scoped + /// to a project. cloud-healthcare@system.gserviceaccount.com must have + /// publisher permissions on the given Cloud Pub/Sub topic. Not having adequate + /// permissions will cause the calls that send notifications to fail. + #[serde(rename="pubsubTopic")] + pub pubsub_topic: Option, +} + +impl Part for NotificationConfig {} + + +/// The configuration for the parser. It determines how the server parses the +/// messages. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ParserConfig { + /// Determines whether messages with no header are allowed. + #[serde(rename="allowNullHeader")] + pub allow_null_header: Option, + /// Byte(s) to be used as the segment terminator. If this is unset, '\r' will + /// be used as segment terminator. + #[serde(rename="segmentTerminator")] + pub segment_terminator: Option, +} + +impl Part for ParserConfig {} + + +/// The content of a HL7v2 message in a structured format. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ParsedData { + /// no description provided + pub segments: Option>, +} + +impl Part for ParsedData {} + + +/// Lists the DICOM stores in the given dataset. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets dicom stores list projects](struct.ProjectLocationDatasetDicomStoreListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListDicomStoresResponse { + /// Token to retrieve the next page of results or empty if there are no more + /// results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The returned DICOM stores. Won't be more DICOM stores than the value of + /// page_size in the request. + #[serde(rename="dicomStores")] + pub dicom_stores: Option>, +} + +impl ResponseResult for ListDicomStoresResponse {} + + +/// The configuration for exporting to Cloud Storage. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudHealthcareV1beta1FhirRestGcsDestination { + /// URI for a Cloud Storage directory where result files should be written (in + /// the format `gs://{bucket-id}/{path/to/destination/dir}`). If there is no + /// trailing slash, the service will append one when composing the object path. + /// The user is responsible for creating the Cloud Storage bucket referenced in + /// `uri_prefix`. + #[serde(rename="uriPrefix")] + pub uri_prefix: Option, +} + +impl Part for GoogleCloudHealthcareV1beta1FhirRestGcsDestination {} + + +/// Lists the FHIR stores in the given dataset. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets fhir stores list projects](struct.ProjectLocationDatasetFhirStoreListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListFhirStoresResponse { + /// Token to retrieve the next page of results or empty if there are no more + /// results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The returned FHIR stores. Won't be more FHIR stores than the value of + /// page_size in the request. + #[serde(rename="fhirStores")] + pub fhir_stores: Option>, +} + +impl ResponseResult for ListFhirStoresResponse {} + + +/// Configures de-id options specific to different types of content. +/// Each submessage customizes the handling of an +/// https://tools.ietf.org/html/rfc6838 media type or subtype. Configs are +/// applied in a nested manner at runtime. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeidentifyConfig { + /// Configures de-id of application/DICOM content. + pub dicom: Option, + /// Configures de-identification of image pixels wherever they are found in the + /// source_dataset. + pub image: Option, + /// Configures de-id of application/FHIR content. + pub fhir: Option, + /// Configures de-identification of text wherever it is found in the + /// source_dataset. + pub text: Option, +} + +impl Part for DeidentifyConfig {} + + +/// Exports data from the specified DICOM store. +/// If a given resource (e.g., a DICOM object with the same SOPInstance UID) +/// already exists in the output, it is overwritten with the version +/// in the source dataset. +/// Exported DICOM data will persist when the DICOM store from which it was +/// exported is deleted. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets dicom stores export projects](struct.ProjectLocationDatasetDicomStoreExportCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExportDicomDataRequest { + /// The BigQuery output destination. + /// + /// For now, only exporting to a dataset in the current project is supported + /// + /// The BigQuery location requires two IAM roles: + /// `roles/bigquery.dataEditor` and `roles/bigquery.jobUser`. + #[serde(rename="bigqueryDestination")] + pub bigquery_destination: Option, + /// The Cloud Storage output destination. + /// + /// The Cloud Storage location requires the `roles/storage.objectAdmin` Cloud + /// IAM role. + #[serde(rename="gcsDestination")] + pub gcs_destination: Option, +} + +impl RequestValue for ExportDicomDataRequest {} + + +/// Lists the available datasets. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets list projects](struct.ProjectLocationDatasetListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListDatasetsResponse { + /// Token to retrieve the next page of results, or empty if there are no + /// more results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The first page of datasets. + pub datasets: Option>, +} + +impl ResponseResult for ListDatasetsResponse {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + +/// Specifies how de-identification of a FHIR store should be handled. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FhirConfig { + /// Specifies FHIR paths to match and how to transform them. Any field that + /// is not matched by a FieldMetadata will be passed through to the output + /// dataset unmodified. All extensions are removed in the output. + #[serde(rename="fieldMetadataList")] + pub field_metadata_list: Option>, +} + +impl Part for FhirConfig {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets dicom stores import projects](struct.ProjectLocationDatasetDicomStoreImportCall.html) (response) +/// * [locations datasets dicom stores export projects](struct.ProjectLocationDatasetDicomStoreExportCall.html) (response) +/// * [locations datasets deidentify projects](struct.ProjectLocationDatasetDeidentifyCall.html) (response) +/// * [locations datasets operations get projects](struct.ProjectLocationDatasetOperationGetCall.html) (response) +/// * [locations datasets fhir stores export projects](struct.ProjectLocationDatasetFhirStoreExportCall.html) (response) +/// * [locations datasets fhir stores import projects](struct.ProjectLocationDatasetFhirStoreImportCall.html) (response) +/// * [locations datasets create projects](struct.ProjectLocationDatasetCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl ResponseResult for Operation {} + + +/// Pseudonymization method that generates surrogates via cryptographic hashing. +/// Uses SHA-256. +/// Outputs a base64-encoded representation of the hashed output +/// (for example, `L7k0BHmF1ha5U3NfGykjro4xWi1MPVQPjhMAZbSV9mM=`). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CryptoHashConfig { + /// An AES 128/192/256 bit key. Causes the hash to be computed based on this + /// key. A default key is generated for each DeidentifyDataset operation and is + /// used wherever crypto_key is not specified. + #[serde(rename="cryptoKey")] + pub crypto_key: Option, +} + +impl Part for CryptoHashConfig {} + + +/// Request message for `SetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets set iam policy projects](struct.ProjectLocationDatasetSetIamPolicyCall.html) (request) +/// * [locations datasets dicom stores set iam policy projects](struct.ProjectLocationDatasetDicomStoreSetIamPolicyCall.html) (request) +/// * [locations datasets hl7 v2 stores set iam policy projects](struct.ProjectLocationDatasetHl7V2StoreSetIamPolicyCall.html) (request) +/// * [locations datasets fhir stores set iam policy projects](struct.ProjectLocationDatasetFhirStoreSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetIamPolicyRequest { + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. + pub policy: Option, + /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + /// the fields in the mask will be modified. If no mask is provided, the + /// following default mask is used: + /// paths: "bindings, etag" + /// This field is only used by Cloud IAM. + #[serde(rename="updateMask")] + pub update_mask: Option, +} + +impl RequestValue for SetIamPolicyRequest {} + + +/// Message that represents an arbitrary HTTP body. It should only be used for +/// payload formats that can't be represented as JSON, such as raw binary or +/// an HTML page. +/// +/// +/// This message can be used both in streaming and non-streaming API methods in +/// the request as well as the response. +/// +/// It can be used as a top-level request field, which is convenient if one +/// wants to extract parameters from either the URL or HTTP template into the +/// request fields and also want access to the raw HTTP body. +/// +/// Example: +/// +/// message GetResourceRequest { +/// // A unique request id. +/// string request_id = 1; +/// +/// // The raw HTTP body is bound to this field. +/// google.api.HttpBody http_body = 2; +/// } +/// +/// service ResourceService { +/// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); +/// rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); +/// } +/// +/// Example with streaming methods: +/// +/// service CaldavService { +/// rpc GetCalendar(stream google.api.HttpBody) +/// returns (stream google.api.HttpBody); +/// rpc UpdateCalendar(stream google.api.HttpBody) +/// returns (stream google.api.HttpBody); +/// } +/// +/// Use of this type only changes how the request and response bodies are +/// handled, all other features will continue to work unchanged. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets fhir stores fhir _search projects](struct.ProjectLocationDatasetFhirStoreFhirSearchCall.html) (response) +/// * [locations datasets fhir stores fhir get metadata projects](struct.ProjectLocationDatasetFhirStoreFhirGetMetadataCall.html) (response) +/// * [locations datasets dicom stores search for studies projects](struct.ProjectLocationDatasetDicomStoreSearchForStudyCall.html) (response) +/// * [locations datasets fhir stores fhir delete projects](struct.ProjectLocationDatasetFhirStoreFhirDeleteCall.html) (response) +/// * [locations datasets fhir stores fhir search resources projects](struct.ProjectLocationDatasetFhirStoreFhirSearchResourceCall.html) (response) +/// * [locations datasets fhir stores fhir patch projects](struct.ProjectLocationDatasetFhirStoreFhirPatchCall.html) (request|response) +/// * [locations datasets dicom stores studies series search for instances projects](struct.ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall.html) (response) +/// * [locations datasets dicom stores studies series instances retrieve rendered projects](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall.html) (response) +/// * [locations datasets dicom stores studies series instances frames retrieve rendered projects](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall.html) (response) +/// * [locations datasets dicom stores studies series retrieve metadata projects](struct.ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall.html) (response) +/// * [locations datasets dicom stores studies series instances frames retrieve frames projects](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall.html) (response) +/// * [locations datasets dicom stores search for series projects](struct.ProjectLocationDatasetDicomStoreSearchForSeryCall.html) (response) +/// * [locations datasets fhir stores fhir observation get$lastn projects](struct.ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall.html) (response) +/// * [locations datasets fhir stores fhir conditional update resource projects](struct.ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall.html) (request|response) +/// * [locations datasets fhir stores fhir create resource projects](struct.ProjectLocationDatasetFhirStoreFhirCreateResourceCall.html) (request|response) +/// * [locations datasets dicom stores studies retrieve study projects](struct.ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall.html) (response) +/// * [locations datasets fhir stores fhir update projects](struct.ProjectLocationDatasetFhirStoreFhirUpdateCall.html) (request|response) +/// * [locations datasets dicom stores studies store instances projects](struct.ProjectLocationDatasetDicomStoreStudyStoreInstanceCall.html) (request|response) +/// * [locations datasets fhir stores fhir conditional patch resource projects](struct.ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall.html) (request|response) +/// * [locations datasets fhir stores fhir _history list projects](struct.ProjectLocationDatasetFhirStoreFhirHistoryListCall.html) (response) +/// * [locations datasets fhir stores fhir _history get projects](struct.ProjectLocationDatasetFhirStoreFhirHistoryGetCall.html) (response) +/// * [locations datasets fhir stores fhir get projects](struct.ProjectLocationDatasetFhirStoreFhirGetCall.html) (response) +/// * [locations datasets dicom stores studies search for instances projects](struct.ProjectLocationDatasetDicomStoreStudySearchForInstanceCall.html) (response) +/// * [locations datasets dicom stores studies search for series projects](struct.ProjectLocationDatasetDicomStoreStudySearchForSeryCall.html) (response) +/// * [locations datasets dicom stores studies series instances retrieve metadata projects](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall.html) (response) +/// * [locations datasets dicom stores search for instances projects](struct.ProjectLocationDatasetDicomStoreSearchForInstanceCall.html) (response) +/// * [locations datasets dicom stores studies series instances retrieve instance projects](struct.ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall.html) (response) +/// * [locations datasets dicom stores studies retrieve metadata projects](struct.ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall.html) (response) +/// * [locations datasets dicom stores studies series retrieve series projects](struct.ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall.html) (response) +/// * [locations datasets dicom stores store instances projects](struct.ProjectLocationDatasetDicomStoreStoreInstanceCall.html) (request|response) +/// * [locations datasets fhir stores execute bundle projects](struct.ProjectLocationDatasetFhirStoreExecuteBundleCall.html) (request|response) +/// * [locations datasets fhir stores fhir patient get$everything projects](struct.ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HttpBody { + /// The HTTP Content-Type header value specifying the content type of the body. + #[serde(rename="contentType")] + pub content_type: Option, + /// The HTTP request/response body as raw binary. + pub data: Option, + /// Application specific response metadata. Must be set in the first response + /// for streaming APIs. + pub extensions: Option>>, +} + +impl RequestValue for HttpBody {} +impl ResponseResult for HttpBody {} + + +/// The response message for Locations.ListLocations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations list projects](struct.ProjectLocationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLocationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of locations that matches the specified filter in the request. + pub locations: Option>, +} + +impl ResponseResult for ListLocationsResponse {} + + +/// A resource that represents Google Cloud Platform location. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Location { + /// The friendly name for this location, typically a nearby city name. + /// For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, + /// Resource name for the location, which may vary between implementations. + /// For example: `"projects/example-project/locations/us-east1"` + pub name: Option, + /// Service-specific metadata. For example the available capacity at the given + /// location. + pub metadata: Option>, +} + +impl ResponseResult for Location {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **JSON Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// **YAML Example** +/// +/// bindings: +/// - members: +/// - user:mike@example.com +/// - group:admins@example.com +/// - domain:google.com +/// - serviceAccount:my-other-app@appspot.gserviceaccount.com +/// role: roles/owner +/// - members: +/// - user:sean@example.com +/// role: roles/viewer +/// +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam/docs). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets fhir stores set iam policy projects](struct.ProjectLocationDatasetFhirStoreSetIamPolicyCall.html) (response) +/// * [locations datasets hl7 v2 stores set iam policy projects](struct.ProjectLocationDatasetHl7V2StoreSetIamPolicyCall.html) (response) +/// * [locations datasets dicom stores set iam policy projects](struct.ProjectLocationDatasetDicomStoreSetIamPolicyCall.html) (response) +/// * [locations datasets get iam policy projects](struct.ProjectLocationDatasetGetIamPolicyCall.html) (response) +/// * [locations datasets dicom stores get iam policy projects](struct.ProjectLocationDatasetDicomStoreGetIamPolicyCall.html) (response) +/// * [locations datasets set iam policy projects](struct.ProjectLocationDatasetSetIamPolicyCall.html) (response) +/// * [locations datasets fhir stores get iam policy projects](struct.ProjectLocationDatasetFhirStoreGetIamPolicyCall.html) (response) +/// * [locations datasets hl7 v2 stores get iam policy projects](struct.ProjectLocationDatasetHl7V2StoreGetIamPolicyCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, + /// Deprecated. + pub version: Option, +} + +impl ResponseResult for Policy {} + + +/// Specifies the configuration for importing data from Cloud Storage. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudHealthcareV1beta1DicomGcsSource { + /// Points to a Cloud Storage URI containing file(s) with + /// content only. The URI must be in the following format: + /// `gs://{bucket_id}/{object_id}`. The URI can include wildcards in + /// `object_id` and thus identify multiple files. Supported wildcards: + /// '*' to match 0 or more non-separator characters + /// '**' to match 0 or more characters (including separators). Must be used at + /// the end of a path and with no other wildcards in the + /// path. Can also be used with a file extension (such as .dcm), which + /// imports all files with the extension in the specified directory and + /// its sub-directories. For example, + /// `gs://my-bucket/my-directory/**.dcm` imports all files with .dcm + /// extensions in `my-directory/` and its sub-directories. + /// '?' to match 1 character + /// All other URI formats are invalid. + /// Files matching the wildcard are expected to contain content only, no + /// metadata. + pub uri: Option, +} + +impl Part for GoogleCloudHealthcareV1beta1DicomGcsSource {} + + +/// Specifies FHIR paths to match, and how to handle de-identification of +/// matching fields. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FieldMetadata { + /// Deidentify action for one field. + pub action: Option, + /// List of paths to FHIR fields to be redacted. Each path is a + /// period-separated list where each component is either a field name or + /// FHIR type name, for example: Patient, HumanName. + /// For "choice" types (those defined in the FHIR spec with the form: + /// field[x]) we use two separate components. e.g. "deceasedAge.unit" is + /// matched by "Deceased.Age.unit". + /// Supported types are: AdministrativeGenderCode, Code, Date, DateTime, + /// Decimal, HumanName, Id, LanguageCode, Markdown, MimeTypeCode, Oid, + /// String, Uri, Uuid, Xhtml. + pub paths: Option>, +} + +impl Part for FieldMetadata {} + + +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets dicom stores test iam permissions projects](struct.ProjectLocationDatasetDicomStoreTestIamPermissionCall.html) (request) +/// * [locations datasets test iam permissions projects](struct.ProjectLocationDatasetTestIamPermissionCall.html) (request) +/// * [locations datasets fhir stores test iam permissions projects](struct.ProjectLocationDatasetFhirStoreTestIamPermissionCall.html) (request) +/// * [locations datasets hl7 v2 stores test iam permissions projects](struct.ProjectLocationDatasetHl7V2StoreTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, +} + +impl RequestValue for TestIamPermissionsRequest {} + + +/// Acknowledges that a message has been ingested into the specified +/// HL7v2 store. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets hl7 v2 stores messages ingest projects](struct.ProjectLocationDatasetHl7V2StoreMessageIngestCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IngestMessageResponse { + /// Created message resource. + pub message: Option, + /// HL7v2 ACK message. + #[serde(rename="hl7Ack")] + pub hl7_ack: Option, +} + +impl ResponseResult for IngestMessageResponse {} + + +/// Configuration for the FHIR BigQuery schema. Determines how the server +/// generates the schema. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SchemaConfig { + /// Specifies the output schema type. If unspecified, the default is + /// `LOSSLESS`. + #[serde(rename="schemaType")] + pub schema_type: Option, + /// The depth for all recursive structures in the output analytics + /// schema. For example, `concept` in the CodeSystem resource is a recursive + /// structure; when the depth is 2, the CodeSystem table will have a column + /// called `concept.concept` but not `concept.concept.concept`. If not + /// specified or set to 0, the server will use the default value 2. + #[serde(rename="recursiveStructureDepth")] + pub recursive_structure_depth: Option, +} + +impl Part for SchemaConfig {} + + +/// Ingests a message into the specified HL7v2 store. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets hl7 v2 stores messages ingest projects](struct.ProjectLocationDatasetHl7V2StoreMessageIngestCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IngestMessageRequest { + /// HL7v2 message to ingest. + pub message: Option, +} + +impl RequestValue for IngestMessageRequest {} + + +/// A transformation to apply to text that is identified as a specific +/// info_type. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InfoTypeTransformation { + /// Config for character mask. + #[serde(rename="characterMaskConfig")] + pub character_mask_config: Option, + /// Config for text redaction. + #[serde(rename="redactConfig")] + pub redact_config: Option, + /// Config for crypto hash. + #[serde(rename="cryptoHashConfig")] + pub crypto_hash_config: Option, + /// Config for date shift. + #[serde(rename="dateShiftConfig")] + pub date_shift_config: Option, + /// InfoTypes to apply this transformation to. If this is not specified, the + /// transformation applies to any info_type. + #[serde(rename="infoTypes")] + pub info_types: Option>, + /// Config for replace with InfoType. + #[serde(rename="replaceWithInfoTypeConfig")] + pub replace_with_info_type_config: Option, +} + +impl Part for InfoTypeTransformation {} + + +/// The configuration for exporting to BigQuery. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudHealthcareV1beta1FhirBigQueryDestination { + /// BigQuery URI to a dataset, up to 2000 characters long, in the format + /// `bq://projectId.bqDatasetId` + #[serde(rename="datasetUri")] + pub dataset_uri: Option, + /// The configuration for the exported BigQuery schema. + #[serde(rename="schemaConfig")] + pub schema_config: Option, +} + +impl Part for GoogleCloudHealthcareV1beta1FhirBigQueryDestination {} + + +/// A segment in a structured format. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Segment { + /// A mapping from the positional location to the value. + /// The key string uses zero-based indexes separated by dots to identify + /// Fields, components and sub-components. A bracket notation is also used to + /// identify different instances of a repeated field. + /// Regex for key: (\d+)(\[\d+\])?(.\d+)?(.\d+)? + /// + /// Examples of (key, value) pairs: + /// - (0.1, "foo"): Component 1 of Field 0 has the value "foo". + /// - (1.1.2, "bar"): Sub-component 2 of Component 1 of field 1 has the value + /// "bar". + /// - (1[2].1, "baz"): Component 1 of Instance 2 of Field 1, which is repeated, + /// has the value "baz". + pub fields: Option>, + /// Set ID for segments that can be in a set. This can be empty if it is + /// missing or it is not applicable. + #[serde(rename="setId")] + pub set_id: Option, + /// A string that indicates the type of segment, e.g., EVN, PID. + #[serde(rename="segmentId")] + pub segment_id: Option, +} + +impl Part for Segment {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TextConfig { + /// The transformations to apply to the detected data. + pub transformations: Option>, +} + +impl Part for TextConfig {} + + +/// Provides the configuration for logging a type of permissions. +/// Example: +/// +/// { +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// } +/// ] +/// } +/// +/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting +/// foo@gmail.com from DATA_READ logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditLogConfig { + /// Specifies the identities that do not cause logging for this type of + /// permission. + /// Follows the same format of Binding.members. + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The log type that this config enables. + #[serde(rename="logType")] + pub log_type: Option, +} + +impl Part for AuditLogConfig {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// Specifies the configuration for importing data from Cloud Storage. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudHealthcareV1beta1FhirRestGcsSource { + /// Points to a Cloud Storage URI containing file(s) to import. + /// + /// The URI must be in the following format: `gs://{bucket_id}/{object_id}`. + /// The URI can include wildcards in `object_id` and thus identify multiple + /// files. Supported wildcards: + /// + /// * `*` to match 0 or more non-separator characters + /// * `**` to match 0 or more characters (including separators). Must be used + /// at the end of a path and with no other wildcards in the + /// path. Can also be used with a file extension (such as .ndjson), which + /// imports all files with the extension in the specified directory and + /// its sub-directories. For example, `gs://my-bucket/my-directory/**.ndjson` + /// imports all files with `.ndjson` extensions in `my-directory/` and its + /// sub-directories. + /// * `?` to match 1 character + /// + /// Files matching the wildcard are expected to contain content only, no + /// metadata. + pub uri: Option, +} + +impl Part for GoogleCloudHealthcareV1beta1FhirRestGcsSource {} + + +/// List of tags to be filtered. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TagFilterList { + /// Tags to be filtered. Tags must be DICOM Data Elements, File Meta + /// Elements, or Directory Structuring Elements, as defined at: + /// http://dicom.nema.org/medical/dicom/current/output/html/part06.html#table_6-1,. + /// They may be provided by "Keyword" or "Tag". For example "PatientID", + /// "0010,0010". + pub tags: Option>, +} + +impl Part for TagFilterList {} + + +/// A patient identifier and associated type. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PatientId { + /// ID type, e.g. MRN or NHS. + #[serde(rename="type")] + pub type_: Option, + /// The patient's unique identifier. + pub value: Option, +} + +impl Part for PatientId {} + + +/// Specifies the parameters needed for de-identification of DICOM stores. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DicomConfig { + /// Tag filtering profile that determines which tags to keep/remove. + #[serde(rename="filterProfile")] + pub filter_profile: Option, + /// List of tags to remove. Keep all other tags. + #[serde(rename="removeList")] + pub remove_list: Option, + /// List of tags to keep. Remove all other tags. + #[serde(rename="keepList")] + pub keep_list: Option, +} + +impl Part for DicomConfig {} + + +/// Specifies how de-identification of image pixel should be handled. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImageConfig { + /// Determines how to redact text from image. + #[serde(rename="textRedactionMode")] + pub text_redaction_mode: Option, +} + +impl Part for ImageConfig {} + + +/// Mask a string by replacing its characters with a fixed character. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CharacterMaskConfig { + /// Character to mask the sensitive values. If not supplied, defaults to "*". + #[serde(rename="maskingCharacter")] + pub masking_character: Option, +} + +impl Part for CharacterMaskConfig {} + + +/// Redacts identifying information from the specified dataset. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets deidentify projects](struct.ProjectLocationDatasetDeidentifyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeidentifyDatasetRequest { + /// The name of the dataset resource to create and write the redacted data to + /// (e.g., + /// + /// * The destination dataset must not exist. + /// * The destination dataset must be in the same project as the source + /// dataset. De-identifying data across multiple projects is not supported. + #[serde(rename="destinationDataset")] + pub destination_dataset: Option, + /// Deidentify configuration. + pub config: Option, +} + +impl RequestValue for DeidentifyDatasetRequest {} + + +/// Represents a FHIR store. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets fhir stores create projects](struct.ProjectLocationDatasetFhirStoreCreateCall.html) (request|response) +/// * [locations datasets fhir stores get projects](struct.ProjectLocationDatasetFhirStoreGetCall.html) (response) +/// * [locations datasets fhir stores patch projects](struct.ProjectLocationDatasetFhirStorePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FhirStore { + /// User-supplied key-value pairs used to organize FHIR stores. + /// + /// Label keys must be between 1 and 63 characters long, have a UTF-8 encoding + /// of maximum 128 bytes, and must conform to the + /// following PCRE regular expression: + /// \p{Ll}\p{Lo}{0,62} + /// + /// Label values are optional, must be between 1 and 63 characters long, have + /// a UTF-8 encoding of maximum 128 bytes, and must conform to the + /// following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} + /// + /// No more than 64 labels can be associated with a given store. + pub labels: Option>, + /// Output only. Resource name of the FHIR store, of the form + /// `projects/{project_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`. + pub name: Option, + /// Whether to disable referential integrity in this FHIR store. This field is + /// immutable after FHIR store creation. + /// The default value is false, meaning that the API will enforce referential + /// integrity and fail the requests that will result in inconsistent state in + /// the FHIR store. + /// When this field is set to true, the API will skip referential integrity + /// check. Consequently, operations that rely on references, such as + /// GetPatientEverything, will not return all the results if broken references + /// exist. + #[serde(rename="disableReferentialIntegrity")] + pub disable_referential_integrity: Option, + /// Whether to allow the bulk import API to accept history bundles and directly + /// insert historical resource versions into the FHIR store. Importing resource + /// histories creates resource interactions that appear to have occurred in the + /// past, which clients may not want to allow. If set to false, history bundles + /// within an import will fail with an error. + #[serde(rename="enableHistoryImport")] + pub enable_history_import: Option, + /// Whether this FHIR store has the [updateCreate + /// capability](https://www.hl7.org/fhir/capabilitystatement-definitions.html#CapabilityStatement.rest.resource.updateCreate). + /// This determines if the client can use an Update operation to create a new + /// resource with a client-specified ID. If false, all IDs are server-assigned + /// through the Create operation and attempts to Update a non-existent resource + /// will return errors. Please treat the audit logs with appropriate levels of + /// care if client-specified resource IDs contain sensitive data such as + /// patient identifiers, those IDs will be part of the FHIR resource path + /// recorded in Cloud audit logs and Cloud Pub/Sub notifications. + #[serde(rename="enableUpdateCreate")] + pub enable_update_create: Option, + /// If non-empty, publish all resource modifications of this FHIR store to + /// this destination. The Cloud Pub/Sub message attributes will contain a map + /// with a string describing the action that has triggered the notification, + /// e.g. "action":"CreateResource". + #[serde(rename="notificationConfig")] + pub notification_config: Option, + /// Whether to disable resource versioning for this FHIR store. This field can + /// not be changed after the creation of FHIR store. + /// If set to false, which is the default behavior, all write operations will + /// cause historical versions to be recorded automatically. The historical + /// versions can be fetched through the history APIs, but cannot be updated. + /// If set to true, no historical versions will be kept. The server will send + /// back errors for attempts to read the historical versions. + #[serde(rename="disableResourceVersioning")] + pub disable_resource_versioning: Option, +} + +impl RequestValue for FhirStore {} +impl ResponseResult for FhirStore {} + + +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets operations list projects](struct.ProjectLocationDatasetOperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for ListOperationsResponse {} + + +/// Request to export resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets fhir stores export projects](struct.ProjectLocationDatasetFhirStoreExportCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExportResourcesRequest { + /// The BigQuery output destination. + /// + /// The BigQuery location requires two IAM roles: + /// `roles/bigquery.dataEditor` and `roles/bigquery.jobUser`. + /// + /// The output will be one BigQuery table per resource type. + #[serde(rename="bigqueryDestination")] + pub bigquery_destination: Option, + /// The Cloud Storage output destination. + /// + /// The Cloud Storage location requires the `roles/storage.objectAdmin` Cloud + /// IAM role. + /// + /// The exported outputs are + /// organized by FHIR resource types. The server will create one object per + /// resource type. Each object contains newline delimited JSON, and each line + /// is a FHIR resource. + #[serde(rename="gcsDestination")] + pub gcs_destination: Option, +} + +impl RequestValue for ExportResourcesRequest {} + + +/// A message representing a health dataset. +/// +/// A health dataset represents a collection of healthcare data pertaining to one +/// or more patients. This may include multiple modalities of healthcare data, +/// such as electronic medical records or medical imaging data. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets create projects](struct.ProjectLocationDatasetCreateCall.html) (request) +/// * [locations datasets patch projects](struct.ProjectLocationDatasetPatchCall.html) (request|response) +/// * [locations datasets get projects](struct.ProjectLocationDatasetGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Dataset { + /// The default timezone used by this dataset. Must be a either a valid IANA + /// time zone name such as "America/New_York" or empty, which defaults to UTC. + /// This is used for parsing times in resources (e.g., HL7 messages) where no + /// explicit timezone is specified. + #[serde(rename="timeZone")] + pub time_zone: Option, + /// Output only. Resource name of the dataset, of the form + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`. + pub name: Option, +} + +impl RequestValue for Dataset {} +impl ResponseResult for Dataset {} + + +/// Represents an HL7v2 store. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets hl7 v2 stores create projects](struct.ProjectLocationDatasetHl7V2StoreCreateCall.html) (request|response) +/// * [locations datasets hl7 v2 stores get projects](struct.ProjectLocationDatasetHl7V2StoreGetCall.html) (response) +/// * [locations datasets hl7 v2 stores patch projects](struct.ProjectLocationDatasetHl7V2StorePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Hl7V2Store { + /// User-supplied key-value pairs used to organize HL7v2 stores. + /// + /// Label keys must be between 1 and 63 characters long, have a UTF-8 encoding + /// of maximum 128 bytes, and must conform to the + /// following PCRE regular expression: + /// \p{Ll}\p{Lo}{0,62} + /// + /// Label values are optional, must be between 1 and 63 characters long, have + /// a UTF-8 encoding of maximum 128 bytes, and must conform to the + /// following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} + /// + /// No more than 64 labels can be associated with a given store. + pub labels: Option>, + /// The configuration for the parser. It determines how the server parses the + /// messages. + #[serde(rename="parserConfig")] + pub parser_config: Option, + /// Output only. Resource name of the HL7v2 store, of the form + /// `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`. + pub name: Option, + /// The notification destination all messages (both Ingest & Create) are + /// published on. Only the message name is sent as part of the notification. If + /// this is unset, no notifications will be sent. Supplied by the client. + #[serde(rename="notificationConfig")] + pub notification_config: Option, +} + +impl RequestValue for Hl7V2Store {} +impl ResponseResult for Hl7V2Store {} + + +/// Lists the messages in the specified HL7v2 store. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets hl7 v2 stores messages list projects](struct.ProjectLocationDatasetHl7V2StoreMessageListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListMessagesResponse { + /// Token to retrieve the next page of results or empty if there are no more + /// results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The returned message names. Won't be more values than the value of + /// page_size in the request. + pub messages: Option>, +} + +impl ResponseResult for ListMessagesResponse {} + + +/// Specifies the audit configuration for a service. +/// The configuration determines which permission types are logged, and what +/// identities, if any, are exempted from logging. +/// An AuditConfig must have one or more AuditLogConfigs. +/// +/// If there are AuditConfigs for both `allServices` and a specific service, +/// the union of the two AuditConfigs is used for that service: the log_types +/// specified in each AuditConfig are enabled, and the exempted_members in each +/// AuditLogConfig are exempted. +/// +/// Example Policy with multiple AuditConfigs: +/// +/// { +/// "audit_configs": [ +/// { +/// "service": "allServices" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// }, +/// { +/// "log_type": "ADMIN_READ", +/// } +/// ] +/// }, +/// { +/// "service": "fooservice.googleapis.com" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// "exempted_members": [ +/// "user:bar@gmail.com" +/// ] +/// } +/// ] +/// } +/// ] +/// } +/// +/// For fooservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ +/// logging. It also exempts foo@gmail.com from DATA_READ logging, and +/// bar@gmail.com from DATA_WRITE logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditConfig { + /// The configuration for logging of each type of permission. + #[serde(rename="auditLogConfigs")] + pub audit_log_configs: Option>, + /// Specifies a service that will be enabled for audit logging. + /// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + /// `allServices` is a special value that covers all services. + pub service: Option, +} + +impl Part for AuditConfig {} + + +/// Shift a date forward or backward in time by a random amount which is +/// consistent for a given patient and crypto key combination. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DateShiftConfig { + /// An AES 128/192/256 bit key. Causes the shift to be computed based on this + /// key and the patient ID. A default key is generated for each + /// DeidentifyDataset operation and is used wherever crypto_key is not + /// specified. + #[serde(rename="cryptoKey")] + pub crypto_key: Option, +} + +impl Part for DateShiftConfig {} + + +/// A complete HL7v2 message. +/// See http://www.hl7.org/implement/standards/index.cfm?ref=common for details +/// on the standard. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations datasets hl7 v2 stores messages patch projects](struct.ProjectLocationDatasetHl7V2StoreMessagePatchCall.html) (request|response) +/// * [locations datasets hl7 v2 stores messages get projects](struct.ProjectLocationDatasetHl7V2StoreMessageGetCall.html) (response) +/// * [locations datasets hl7 v2 stores messages create projects](struct.ProjectLocationDatasetHl7V2StoreMessageCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Message { + /// The parsed version of the raw message data. + #[serde(rename="parsedData")] + pub parsed_data: Option, + /// Resource name of the Message, of the form + /// `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7_v2_store_id}/messages/{message_id}`. + /// Assigned by the server. + pub name: Option, + /// User-supplied key-value pairs used to organize HL7v2 stores. + /// + /// Label keys must be between 1 and 63 characters long, have a UTF-8 encoding + /// of maximum 128 bytes, and must conform to the + /// following PCRE regular expression: + /// \p{Ll}\p{Lo}{0,62} + /// + /// Label values are optional, must be between 1 and 63 characters long, have + /// a UTF-8 encoding of maximum 128 bytes, and must conform to the + /// following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} + /// + /// No more than 64 labels can be associated with a given store. + pub labels: Option>, + /// The message type and trigger event for this message. MSH-9. + #[serde(rename="messageType")] + pub message_type: Option, + /// The datetime when the message was created. Set by the server. + #[serde(rename="createTime")] + pub create_time: Option, + /// All patient IDs listed in the PID-2, PID-3, and PID-4 segments of this + /// message. + #[serde(rename="patientIds")] + pub patient_ids: Option>, + /// Raw message bytes. + pub data: Option, + /// The hospital that this message came from. MSH-4. + #[serde(rename="sendFacility")] + pub send_facility: Option, + /// The datetime the sending application sent this message. MSH-7. + #[serde(rename="sendTime")] + pub send_time: Option, +} + +impl RequestValue for Message {} +impl ResponseResult for Message {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `CloudHealthcare` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use healthcare1_beta1::CloudHealthcare; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `locations_datasets_create(...)`, `locations_datasets_deidentify(...)`, `locations_datasets_delete(...)`, `locations_datasets_dicom_stores_create(...)`, `locations_datasets_dicom_stores_delete(...)`, `locations_datasets_dicom_stores_export(...)`, `locations_datasets_dicom_stores_get(...)`, `locations_datasets_dicom_stores_get_iam_policy(...)`, `locations_datasets_dicom_stores_import(...)`, `locations_datasets_dicom_stores_list(...)`, `locations_datasets_dicom_stores_patch(...)`, `locations_datasets_dicom_stores_search_for_instances(...)`, `locations_datasets_dicom_stores_search_for_series(...)`, `locations_datasets_dicom_stores_search_for_studies(...)`, `locations_datasets_dicom_stores_set_iam_policy(...)`, `locations_datasets_dicom_stores_store_instances(...)`, `locations_datasets_dicom_stores_studies_delete(...)`, `locations_datasets_dicom_stores_studies_retrieve_metadata(...)`, `locations_datasets_dicom_stores_studies_retrieve_study(...)`, `locations_datasets_dicom_stores_studies_search_for_instances(...)`, `locations_datasets_dicom_stores_studies_search_for_series(...)`, `locations_datasets_dicom_stores_studies_series_delete(...)`, `locations_datasets_dicom_stores_studies_series_instances_delete(...)`, `locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(...)`, `locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(...)`, `locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(...)`, `locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(...)`, `locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(...)`, `locations_datasets_dicom_stores_studies_series_retrieve_metadata(...)`, `locations_datasets_dicom_stores_studies_series_retrieve_series(...)`, `locations_datasets_dicom_stores_studies_series_search_for_instances(...)`, `locations_datasets_dicom_stores_studies_store_instances(...)`, `locations_datasets_dicom_stores_test_iam_permissions(...)`, `locations_datasets_fhir_stores_create(...)`, `locations_datasets_fhir_stores_delete(...)`, `locations_datasets_fhir_stores_execute_bundle(...)`, `locations_datasets_fhir_stores_export(...)`, `locations_datasets_fhir_stores_fhir__history_get(...)`, `locations_datasets_fhir_stores_fhir__history_list(...)`, `locations_datasets_fhir_stores_fhir__observation_getlastn(...)`, `locations_datasets_fhir_stores_fhir__patient_geteverything(...)`, `locations_datasets_fhir_stores_fhir__search(...)`, `locations_datasets_fhir_stores_fhir_conditional_delete_resource(...)`, `locations_datasets_fhir_stores_fhir_conditional_patch_resource(...)`, `locations_datasets_fhir_stores_fhir_conditional_update_resource(...)`, `locations_datasets_fhir_stores_fhir_create_resource(...)`, `locations_datasets_fhir_stores_fhir_delete(...)`, `locations_datasets_fhir_stores_fhir_deletepurge(...)`, `locations_datasets_fhir_stores_fhir_get(...)`, `locations_datasets_fhir_stores_fhir_get_metadata(...)`, `locations_datasets_fhir_stores_fhir_patch(...)`, `locations_datasets_fhir_stores_fhir_search_resources(...)`, `locations_datasets_fhir_stores_fhir_update(...)`, `locations_datasets_fhir_stores_get(...)`, `locations_datasets_fhir_stores_get_iam_policy(...)`, `locations_datasets_fhir_stores_import(...)`, `locations_datasets_fhir_stores_list(...)`, `locations_datasets_fhir_stores_patch(...)`, `locations_datasets_fhir_stores_set_iam_policy(...)`, `locations_datasets_fhir_stores_test_iam_permissions(...)`, `locations_datasets_get(...)`, `locations_datasets_get_iam_policy(...)`, `locations_datasets_hl7_v2_stores_create(...)`, `locations_datasets_hl7_v2_stores_delete(...)`, `locations_datasets_hl7_v2_stores_get(...)`, `locations_datasets_hl7_v2_stores_get_iam_policy(...)`, `locations_datasets_hl7_v2_stores_list(...)`, `locations_datasets_hl7_v2_stores_messages_create(...)`, `locations_datasets_hl7_v2_stores_messages_delete(...)`, `locations_datasets_hl7_v2_stores_messages_get(...)`, `locations_datasets_hl7_v2_stores_messages_ingest(...)`, `locations_datasets_hl7_v2_stores_messages_list(...)`, `locations_datasets_hl7_v2_stores_messages_patch(...)`, `locations_datasets_hl7_v2_stores_patch(...)`, `locations_datasets_hl7_v2_stores_set_iam_policy(...)`, `locations_datasets_hl7_v2_stores_test_iam_permissions(...)`, `locations_datasets_list(...)`, `locations_datasets_operations_get(...)`, `locations_datasets_operations_list(...)`, `locations_datasets_patch(...)`, `locations_datasets_set_iam_policy(...)`, `locations_datasets_test_iam_permissions(...)`, `locations_get(...)` and `locations_list(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Searches resources in the given FHIR store. + /// + /// # Search Parameters + /// + /// The server's capability statement, retrieved through + /// GetCapabilityStatement, indicates which search + /// parameters are supported on each FHIR resource. + /// + /// # Search Modifiers + /// + /// Modifier | Supported + /// ----------- | --------- + /// `:missing` | Yes + /// `:exact` | Yes + /// `:contains` | Yes + /// `:text` | Yes + /// `:in` | Yes + /// `:not-in` | Yes + /// `:above` | Yes + /// `:below` | Yes + /// `:[type]` | Yes + /// `:not` | Yes + /// `:recurse` | No + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Name of the FHIR store to retrieve resources from. + pub fn locations_datasets_fhir_stores_fhir__search(&self, request: SearchResourcesRequest, parent: &str) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirSearchCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Ingests a new HL7v2 message from the hospital and sends a notification to + /// the Cloud Pub/Sub topic. Return is an HL7v2 ACK message if the message was + /// successfully stored. Otherwise an error is returned. If an identical + /// HL7v2 message is created twice only one resource is created on the server + /// and no error is reported. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the HL7v2 store this message belongs to. + pub fn locations_datasets_hl7_v2_stores_messages_ingest(&self, request: IngestMessageRequest, parent: &str) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreMessageIngestCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an HL7v2 message. + /// + /// # Arguments + /// + /// * `name` - The resource name of the HL7v2 message to delete. + pub fn locations_datasets_hl7_v2_stores_messages_delete(&self, name: &str) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreMessageDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a location. + /// + /// # Arguments + /// + /// * `name` - Resource name for the location. + pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C, A> { + ProjectLocationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// SearchForStudies returns a list of matching studies. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies`). + pub fn locations_datasets_dicom_stores_search_for_studies(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C, A> { + ProjectLocationDatasetDicomStoreSearchForStudyCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a FHIR resource. + /// + /// Note: unless resource versioning is disabled by setting the + /// disable_resource_versioning flag + /// on the FHIR store, the deleted resources will be moved to a history + /// repository that can still be retrieved through GetResourceVersion and + /// related methods, unless they are removed by the DeleteResourceVersions + /// method. + /// + /// # Arguments + /// + /// * `name` - The name of the resource to delete. + pub fn locations_datasets_fhir_stores_fhir_delete(&self, name: &str) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Searches resources in the given FHIR store. + /// + /// # Search Parameters + /// + /// The server's capability statement, retrieved through + /// GetCapabilityStatement, indicates which search + /// parameters are supported on each FHIR resource. + /// + /// # Search Modifiers + /// + /// Modifier | Supported + /// ----------- | --------- + /// `:missing` | Yes + /// `:exact` | Yes + /// `:contains` | Yes + /// `:text` | Yes + /// `:in` | Yes + /// `:not-in` | Yes + /// `:above` | Yes + /// `:below` | Yes + /// `:[type]` | Yes + /// `:not` | Yes + /// `:recurse` | No + /// + /// # Arguments + /// + /// * `parent` - Name of the FHIR store to retrieve resources from. + /// * `resourceType` - The type of the resource to search. + pub fn locations_datasets_fhir_stores_fhir_search_resources(&self, parent: &str, resource_type: &str) -> ProjectLocationDatasetFhirStoreFhirSearchResourceCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirSearchResourceCall { + hub: self.hub, + _parent: parent.to_string(), + _resource_type: resource_type.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates part of an existing resource. + /// + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the resource to update. + pub fn locations_datasets_fhir_stores_fhir_patch(&self, request: HttpBody, name: &str) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Export resources from the FHIR store to the specified destination. + /// + /// This method returns an Operation that can + /// be used to track the status of the export by calling + /// GetOperation. + /// + /// Immediate fatal errors appear in the + /// error field. + /// Otherwise, when the operation finishes, a detailed response of type + /// ExportResourcesResponse is returned in the + /// response field. + /// The metadata field type for this + /// operation is OperationMetadata. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the FHIR store to export resource from. The name should be in + /// the format of + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`. + pub fn locations_datasets_fhir_stores_export(&self, request: ExportResourcesRequest, name: &str) -> ProjectLocationDatasetFhirStoreExportCall<'a, C, A> { + ProjectLocationDatasetFhirStoreExportCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the configuration of the specified FHIR store. + /// + /// # Arguments + /// + /// * `name` - The resource name of the FHIR store to get. + pub fn locations_datasets_fhir_stores_get(&self, name: &str) -> ProjectLocationDatasetFhirStoreGetCall<'a, C, A> { + ProjectLocationDatasetFhirStoreGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// SearchForInstances returns a list of matching instances. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `instances`). + pub fn locations_datasets_dicom_stores_studies_series_search_for_instances(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// RetrieveRenderedInstance returns instance associated with the given study, + /// series, and SOP Instance UID in an acceptable Rendered Media Type. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.8. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instance/{instance_id}/rendered`). + pub fn locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_dicom_stores_get_iam_policy(&self, resource: &str) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C, A> { + ProjectLocationDatasetDicomStoreGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new FHIR store within the parent dataset. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the dataset this FHIR store belongs to. + pub fn locations_datasets_fhir_stores_create(&self, request: FhirStore, parent: &str) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C, A> { + ProjectLocationDatasetFhirStoreCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _fhir_store_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// RetrieveRenderedFrames returns instances associated with the given study, + /// series, SOP Instance UID and frame numbers in an acceptable Rendered Media + /// Type. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.8. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instance/{instance_id}/frames/{frame_list}/rendered`). + pub fn locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified HL7v2 store and removes all messages that are + /// contained within it. + /// + /// # Arguments + /// + /// * `name` - The resource name of the HL7v2 store to delete. + pub fn locations_datasets_hl7_v2_stores_delete(&self, name: &str) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// If the resource does not exist, this will return an empty set of + /// permissions, not a NOT_FOUND error. + /// + /// Note: This operation is designed to be used for building permission-aware + /// UIs and command-line tools, not for authorization checking. This operation + /// may "fail open" without warning. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_fhir_stores_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C, A> { + ProjectLocationDatasetFhirStoreTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the FHIR capability statement for the store, which contains a + /// description of functionality supported by the server. + /// + /// + /// # Arguments + /// + /// * `name` - Name of the FHIR store to retrieve the capabilities for. + pub fn locations_datasets_fhir_stores_fhir_get_metadata(&self, name: &str) -> ProjectLocationDatasetFhirStoreFhirGetMetadataCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirGetMetadataCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets any metadata associated with a dataset. + /// + /// # Arguments + /// + /// * `name` - The name of the dataset to read (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`). + pub fn locations_datasets_get(&self, name: &str) -> ProjectLocationDatasetGetCall<'a, C, A> { + ProjectLocationDatasetGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_fhir_stores_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C, A> { + ProjectLocationDatasetFhirStoreSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// RetrieveSeriesMetadata returns instance associated with the given study and + /// series, presented as metadata with the bulk data removed. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.6. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}/series/{series_id}/metadata`. + pub fn locations_datasets_dicom_stores_studies_series_retrieve_metadata(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the HL7v2 store. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Output only. Resource name of the HL7v2 store, of the form + /// `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`. + pub fn locations_datasets_hl7_v2_stores_patch(&self, request: Hl7V2Store, name: &str) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C, A> { + ProjectLocationDatasetHl7V2StorePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the health datasets in the current project. + /// + /// # Arguments + /// + /// * `parent` - The name of the project whose datasets should be listed (e.g., + /// `projects/{project_id}/locations/{location_id}`). + pub fn locations_datasets_list(&self, parent: &str) -> ProjectLocationDatasetListCall<'a, C, A> { + ProjectLocationDatasetListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new health dataset. Results are returned through the + /// Operation interface which returns either an + /// `Operation.response` which contains a Dataset or + /// `Operation.error`. The metadata + /// field type is OperationMetadata. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the project in which the dataset should be created (e.g., + /// `projects/{project_id}/locations/{location_id}`). + pub fn locations_datasets_create(&self, request: Dataset, parent: &str) -> ProjectLocationDatasetCreateCall<'a, C, A> { + ProjectLocationDatasetCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _dataset_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the DICOM stores in the given dataset. + /// + /// # Arguments + /// + /// * `parent` - Name of the dataset. + pub fn locations_datasets_dicom_stores_list(&self, parent: &str) -> ProjectLocationDatasetDicomStoreListCall<'a, C, A> { + ProjectLocationDatasetDicomStoreListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Get N most recent observations for patient, grouped by code + /// that match given query parameters. + /// + /// + /// # Arguments + /// + /// * `parent` - Name of the FHIR store to retrieve resources from. + pub fn locations_datasets_fhir_stores_fhir__observation_getlastn(&self, parent: &str) -> ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall { + hub: self.hub, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// RetrieveFrames returns instances associated with the given study, series, + /// SOP Instance UID and frame numbers. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.4. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instance/{instance_id}/frames/{frame_list}`). + pub fn locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// SearchForSeries returns a list of matching series. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `series`). + pub fn locations_datasets_dicom_stores_search_for_series(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C, A> { + ProjectLocationDatasetDicomStoreSearchForSeryCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new dataset containing de-identified data from the source + /// dataset. The metadata field type + /// is OperationMetadata. + /// If the request is successful, the + /// response field type is + /// DeidentifySummary. + /// If errors occur, + /// details field type is + /// DeidentifyErrorDetails. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `sourceDataset` - Source dataset resource name. (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`). + pub fn locations_datasets_deidentify(&self, request: DeidentifyDatasetRequest, source_dataset: &str) -> ProjectLocationDatasetDeidentifyCall<'a, C, A> { + ProjectLocationDatasetDeidentifyCall { + hub: self.hub, + _request: request, + _source_dataset: source_dataset.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all the messages in the given HL7v2 store with support for filtering. + /// + /// # Arguments + /// + /// * `parent` - Name of the HL7v2 store to retrieve messages from. + pub fn locations_datasets_hl7_v2_stores_messages_list(&self, parent: &str) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreMessageListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _order_by: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the configuration of the specified FHIR store. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Output only. Resource name of the FHIR store, of the form + /// `projects/{project_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`. + pub fn locations_datasets_fhir_stores_patch(&self, request: FhirStore, name: &str) -> ProjectLocationDatasetFhirStorePatchCall<'a, C, A> { + ProjectLocationDatasetFhirStorePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_fhir_stores_get_iam_policy(&self, resource: &str) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C, A> { + ProjectLocationDatasetFhirStoreGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the entire resource if the resource exists based on the + /// search criteria specified via query parameters. + /// + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the FHIR store this resource belongs to. + /// * `type` - The type of the resource to update. + pub fn locations_datasets_fhir_stores_fhir_conditional_update_resource(&self, request: HttpBody, parent: &str, type_: &str) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _type_: type_.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new HL7v2 store within the parent dataset. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the dataset this HL7v2 store belongs to. + pub fn locations_datasets_hl7_v2_stores_create(&self, request: Hl7V2Store, parent: &str) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _hl7_v2_store_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a FHIR resource. + /// + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the FHIR store this resource belongs to. + /// * `type` - The type of the resource to create. + pub fn locations_datasets_fhir_stores_fhir_create_resource(&self, request: HttpBody, parent: &str, type_: &str) -> ProjectLocationDatasetFhirStoreFhirCreateResourceCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirCreateResourceCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _type_: type_.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// RetrieveStudy returns all instances within the given study. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.1. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}`). + pub fn locations_datasets_dicom_stores_studies_retrieve_study(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the entire resource or creates a new resource with a client + /// specified ID if the resource does not exist and the FHIR store has + /// enable_update_create set. + /// + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the resource to update. + pub fn locations_datasets_fhir_stores_fhir_update(&self, request: HttpBody, name: &str) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirUpdateCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_get_iam_policy(&self, resource: &str) -> ProjectLocationDatasetGetIamPolicyCall<'a, C, A> { + ProjectLocationDatasetGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// StoreInstances stores DICOM instances associated with study instance unique + /// identifiers (SUID). See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.6.1. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}`). + pub fn locations_datasets_dicom_stores_studies_store_instances(&self, request: HttpBody, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudyStoreInstanceCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Update the message. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Resource name of the Message, of the form + /// `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7_v2_store_id}/messages/{message_id}`. + /// Assigned by the server. + pub fn locations_datasets_hl7_v2_stores_messages_patch(&self, request: Message, name: &str) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreMessagePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates parts of a resource if the resource exists based on the + /// search criteria specified via query parameters. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the FHIR store this resource belongs to. + /// * `type` - The type of the resource to update. + pub fn locations_datasets_fhir_stores_fhir_conditional_patch_resource(&self, request: HttpBody, parent: &str, type_: &str) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _type_: type_.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Imports data into the DICOM store by copying it from the specified source. + /// For errors, the Operation will be populated with error details (in the form + /// of ImportDicomDataErrorDetails in error.details), which will hold + /// finer-grained error information. + /// The metadata field type is + /// OperationMetadata. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the DICOM store resource into which the data is imported (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + pub fn locations_datasets_dicom_stores_import(&self, request: ImportDicomDataRequest, name: &str) -> ProjectLocationDatasetDicomStoreImportCall<'a, C, A> { + ProjectLocationDatasetDicomStoreImportCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// DeleteSeries deletes all instances within the given study and series. + /// Delete requests are equivalent to the GET requests specified in the WADO-RS + /// standard. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}/series/{series_id}`). + pub fn locations_datasets_dicom_stores_studies_series_delete(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySeryDeleteCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySeryDeleteCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists operations that match the specified filter in the request. If the + /// server doesn't support this method, it returns `UNIMPLEMENTED`. + /// + /// NOTE: the `name` binding allows API services to override the binding + /// to use different resource name schemes, such as `users/*/operations`. To + /// override the binding, API services can add a binding such as + /// `"/v1/{name=users/*}/operations"` to their service configuration. + /// For backwards compatibility, the default name includes the operations + /// collection id, however overriding users must ensure the name binding + /// is the parent resource, without the operations collection id. + /// + /// # Arguments + /// + /// * `name` - The name of the operation's parent resource. + pub fn locations_datasets_operations_list(&self, name: &str) -> ProjectLocationDatasetOperationListCall<'a, C, A> { + ProjectLocationDatasetOperationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new DICOM store within the parent dataset. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the dataset this DICOM store belongs to. + pub fn locations_datasets_dicom_stores_create(&self, request: DicomStore, parent: &str) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C, A> { + ProjectLocationDatasetDicomStoreCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _dicom_store_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a version (current or historical) of FHIR resource by version id. + /// + /// + /// # Arguments + /// + /// * `name` - The name of the resource version to retrieve. + pub fn locations_datasets_fhir_stores_fhir__history_get(&self, name: &str) -> ProjectLocationDatasetFhirStoreFhirHistoryGetCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirHistoryGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn locations_datasets_operations_get(&self, name: &str) -> ProjectLocationDatasetOperationGetCall<'a, C, A> { + ProjectLocationDatasetOperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a FHIR resource. + /// + /// + /// # Arguments + /// + /// * `name` - The name of the resource to retrieve. + pub fn locations_datasets_fhir_stores_fhir_get(&self, name: &str) -> ProjectLocationDatasetFhirStoreFhirGetCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified health dataset and all data contained in the dataset. + /// Deleting a dataset does not affect the sources from which the dataset was + /// imported (if any). + /// + /// # Arguments + /// + /// * `name` - The name of the dataset to delete (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`). + pub fn locations_datasets_delete(&self, name: &str) -> ProjectLocationDatasetDeleteCall<'a, C, A> { + ProjectLocationDatasetDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// SearchForInstances returns a list of matching instances. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `instances`). + pub fn locations_datasets_dicom_stores_studies_search_for_instances(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySearchForInstanceCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates dataset metadata. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Output only. Resource name of the dataset, of the form + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`. + pub fn locations_datasets_patch(&self, request: Dataset, name: &str) -> ProjectLocationDatasetPatchCall<'a, C, A> { + ProjectLocationDatasetPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// SearchForSeries returns a list of matching series. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `series`). + pub fn locations_datasets_dicom_stores_studies_search_for_series(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySearchForSeryCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// If the resource does not exist, this will return an empty set of + /// permissions, not a NOT_FOUND error. + /// + /// Note: This operation is designed to be used for building permission-aware + /// UIs and command-line tools, not for authorization checking. This operation + /// may "fail open" without warning. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_dicom_stores_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C, A> { + ProjectLocationDatasetDicomStoreTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_dicom_stores_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C, A> { + ProjectLocationDatasetDicomStoreSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes all the historical versions of a resource (excluding current + /// version) from the FHIR store. To remove all versions of a resource, first + /// delete the current version and call this method. + /// + /// # Arguments + /// + /// * `name` - The name of the resource to purge. + pub fn locations_datasets_fhir_stores_fhir_deletepurge(&self, name: &str) -> ProjectLocationDatasetFhirStoreFhirDelete$purgeCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirDelete$purgeCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified DICOM store and removes all images that are contained + /// within it. + /// + /// # Arguments + /// + /// * `name` - The resource name of the DICOM store to delete. + pub fn locations_datasets_dicom_stores_delete(&self, name: &str) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C, A> { + ProjectLocationDatasetDicomStoreDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Import resources to the FHIR store by loading data from the specified + /// sources. Each resource must have a client-supplied ID, which is retained + /// by the server. + /// + /// The import operation is idempotent. Upon retry, the most recent data + /// (matching the client-supplied ID) is overwritten, without creating a new + /// resource version. If partial failures occur during the import, successful + /// changes are not rolled back. + /// + /// If history imports are enabled + /// (enable_history_import is set in the + /// FHIR store's configuration), you can import historical versions of a + /// resource by supplying a bundle of type `history`. The historical versions + /// in the bundle must have `lastUpdated` timestamps. If a current or + /// historical version with the supplied resource ID already exists, the + /// bundle is rejected. + /// + /// This method returns an Operation that can + /// be used to track the status of the import by calling + /// GetOperation. + /// + /// Immediate fatal errors appear in the + /// error field. + /// Otherwise, when the operation finishes, a detailed response of type + /// ImportResourcesResponse is returned in the + /// response field. + /// The metadata field type for this + /// operation is OperationMetadata. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the FHIR store to import FHIR resources to. The name should be + /// in the format of + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`. + pub fn locations_datasets_fhir_stores_import(&self, request: ImportResourcesRequest, name: &str) -> ProjectLocationDatasetFhirStoreImportCall<'a, C, A> { + ProjectLocationDatasetFhirStoreImportCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// RetrieveInstanceMetadata returns instance associated with the given study, + /// series, and SOP Instance UID presented as metadata with the bulk data + /// removed. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.6. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instances/{instance_id}/metadata`). + pub fn locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// SearchForInstances returns a list of matching instances. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `instances`). + pub fn locations_datasets_dicom_stores_search_for_instances(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C, A> { + ProjectLocationDatasetDicomStoreSearchForInstanceCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the specified DICOM store. + /// + /// # Arguments + /// + /// * `name` - The resource name of the DICOM store to get. + pub fn locations_datasets_dicom_stores_get(&self, name: &str) -> ProjectLocationDatasetDicomStoreGetCall<'a, C, A> { + ProjectLocationDatasetDicomStoreGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// If the resource does not exist, this will return an empty set of + /// permissions, not a NOT_FOUND error. + /// + /// Note: This operation is designed to be used for building permission-aware + /// UIs and command-line tools, not for authorization checking. This operation + /// may "fail open" without warning. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectLocationDatasetTestIamPermissionCall<'a, C, A> { + ProjectLocationDatasetTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// RetrieveInstance returns instance associated with the given study, series, + /// and SOP Instance UID. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.3. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instance/{instance_id}`). + pub fn locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// RetrieveStudyMetadata returns instance associated with the given study + /// presented as metadata with the bulk data removed. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.6. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}/metadata`. + pub fn locations_datasets_dicom_stores_studies_retrieve_metadata(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// RetrieveSeries returns all instances within the given study and series. See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.2. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}/series/{series_id}`). + pub fn locations_datasets_dicom_stores_studies_series_retrieve_series(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the specified DICOM store. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Output only. Resource name of the DICOM store, of the form + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`. + pub fn locations_datasets_dicom_stores_patch(&self, request: DicomStore, name: &str) -> ProjectLocationDatasetDicomStorePatchCall<'a, C, A> { + ProjectLocationDatasetDicomStorePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Exports data to the specified destination by copying it from the DICOM + /// store. + /// The metadata field type is + /// OperationMetadata. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The DICOM store resource name from which the data should be exported (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + pub fn locations_datasets_dicom_stores_export(&self, request: ExportDicomDataRequest, name: &str) -> ProjectLocationDatasetDicomStoreExportCall<'a, C, A> { + ProjectLocationDatasetDicomStoreExportCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the specified HL7v2 store. + /// + /// # Arguments + /// + /// * `name` - The resource name of the HL7v2 store to get. + pub fn locations_datasets_hl7_v2_stores_get(&self, name: &str) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the FHIR stores in the given dataset. + /// + /// # Arguments + /// + /// * `parent` - Name of the dataset. + pub fn locations_datasets_fhir_stores_list(&self, parent: &str) -> ProjectLocationDatasetFhirStoreListCall<'a, C, A> { + ProjectLocationDatasetFhirStoreListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists information about the supported locations for this service. + /// + /// # Arguments + /// + /// * `name` - The resource that owns the locations collection, if applicable. + pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C, A> { + ProjectLocationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the HL7v2 stores in the given dataset. + /// + /// # Arguments + /// + /// * `parent` - Name of the dataset. + pub fn locations_datasets_hl7_v2_stores_list(&self, parent: &str) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Executes all the requests in the given Bundle. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Name of the FHIR store in which this bundle will be executed. + pub fn locations_datasets_fhir_stores_execute_bundle(&self, request: HttpBody, parent: &str) -> ProjectLocationDatasetFhirStoreExecuteBundleCall<'a, C, A> { + ProjectLocationDatasetFhirStoreExecuteBundleCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// DeleteInstance deletes an instance associated with the given study, series, + /// and SOP Instance UID. Delete requests are equivalent to the GET requests + /// specified in the WADO-RS standard. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instances/{instance_id}`). + pub fn locations_datasets_dicom_stores_studies_series_instances_delete(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// DeleteStudy deletes all instances within the given study. Delete requests + /// are equivalent to the GET requests specified in the WADO-RS standard. + /// + /// # Arguments + /// + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}`). + pub fn locations_datasets_dicom_stores_studies_delete(&self, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStudyDeleteCall { + hub: self.hub, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified FHIR store and removes all resources within it. + /// + /// # Arguments + /// + /// * `name` - The resource name of the FHIR store to delete. + pub fn locations_datasets_fhir_stores_delete(&self, name: &str) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C, A> { + ProjectLocationDatasetFhirStoreDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_hl7_v2_stores_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all the versions of a resource (including the current version and + /// deleted versions) from the FHIR store. + /// + /// + /// # Arguments + /// + /// * `name` - The name of the resource to retrieve. + pub fn locations_datasets_fhir_stores_fhir__history_list(&self, name: &str) -> ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirHistoryListCall { + hub: self.hub, + _name: name.to_string(), + _since: Default::default(), + _page: Default::default(), + _count: Default::default(), + _at: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// StoreInstances stores DICOM instances associated with study instance unique + /// identifiers (SUID). See + /// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.6.1. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// * `dicomWebPath` - The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}`). + pub fn locations_datasets_dicom_stores_store_instances(&self, request: HttpBody, parent: &str, dicom_web_path: &str) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C, A> { + ProjectLocationDatasetDicomStoreStoreInstanceCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _dicom_web_path: dicom_web_path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes FHIR resources matching a search query. + /// + /// Note: unless resource versioning is disabled by setting the + /// disable_resource_versioning flag + /// on the FHIR store, the deleted resources will be moved to a history + /// repository that can still be retrieved through GetResourceVersion and + /// related methods, unless they are removed by the DeleteResourceVersions + /// method. + /// + /// # Arguments + /// + /// * `parent` - The name of the FHIR store this resource belongs to. + /// * `type` - The type of the resource to update. + pub fn locations_datasets_fhir_stores_fhir_conditional_delete_resource(&self, parent: &str, type_: &str) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall { + hub: self.hub, + _parent: parent.to_string(), + _type_: type_.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectLocationDatasetSetIamPolicyCall<'a, C, A> { + ProjectLocationDatasetSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_hl7_v2_stores_get_iam_policy(&self, resource: &str) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets an HL7v2 message. + /// + /// # Arguments + /// + /// * `name` - The resource name of the HL7v2 message to retrieve. + pub fn locations_datasets_hl7_v2_stores_messages_get(&self, name: &str) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreMessageGetCall { + hub: self.hub, + _name: name.to_string(), + _view: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the specified resource. + /// If the resource does not exist, this will return an empty set of + /// permissions, not a NOT_FOUND error. + /// + /// Note: This operation is designed to be used for building permission-aware + /// UIs and command-line tools, not for authorization checking. This operation + /// may "fail open" without warning. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn locations_datasets_hl7_v2_stores_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets all the resources in the patient compartment. + /// + /// + /// # Arguments + /// + /// * `name` - Name of the patient for which the information is required. + pub fn locations_datasets_fhir_stores_fhir__patient_geteverything(&self, name: &str) -> ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall<'a, C, A> { + ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall { + hub: self.hub, + _name: name.to_string(), + _start: Default::default(), + _end: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a message and sends a notification to the Cloud Pub/Sub topic. If + /// configured, the MLLP adapter listens to messages created by this method and + /// sends those back to the hospital. A successful response indicates the + /// message has been persisted to storage and a Cloud Pub/Sub notification has + /// been sent. Sending to the hospital by the MLLP adapter happens + /// asynchronously. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The name of the dataset this message belongs to. + pub fn locations_datasets_hl7_v2_stores_messages_create(&self, request: CreateMessageRequest, parent: &str) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C, A> { + ProjectLocationDatasetHl7V2StoreMessageCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Searches resources in the given FHIR store. +/// +/// # Search Parameters +/// +/// The server's capability statement, retrieved through +/// GetCapabilityStatement, indicates which search +/// parameters are supported on each FHIR resource. +/// +/// # Search Modifiers +/// +/// Modifier | Supported +/// ----------- | --------- +/// `:missing` | Yes +/// `:exact` | Yes +/// `:contains` | Yes +/// `:text` | Yes +/// `:in` | Yes +/// `:not-in` | Yes +/// `:above` | Yes +/// `:below` | Yes +/// `:[type]` | Yes +/// `:not` | Yes +/// `:recurse` | No +/// +/// A builder for the *locations.datasets.fhirStores.fhir._search* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::SearchResourcesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SearchResourcesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir__search(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: SearchResourcesRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir._search", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fhir/_search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SearchResourcesRequest) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C, A> { + self._request = new_value; + self + } + /// Name of the FHIR store to retrieve resources from. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Ingests a new HL7v2 message from the hospital and sends a notification to +/// the Cloud Pub/Sub topic. Return is an HL7v2 ACK message if the message was +/// successfully stored. Otherwise an error is returned. If an identical +/// HL7v2 message is created twice only one resource is created on the server +/// and no error is reported. +/// +/// A builder for the *locations.datasets.hl7V2Stores.messages.ingest* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::IngestMessageRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = IngestMessageRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_ingest(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: IngestMessageRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, IngestMessageResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.ingest", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/messages:ingest"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: IngestMessageRequest) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the HL7v2 store this message belongs to. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes an HL7v2 message. +/// +/// A builder for the *locations.datasets.hl7V2Stores.messages.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the HL7v2 message to delete. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information about a location. +/// +/// A builder for the *locations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name for the location. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// SearchForStudies returns a list of matching studies. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 +/// +/// A builder for the *locations.datasets.dicomStores.searchForStudies* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_search_for_studies("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.searchForStudies", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a FHIR resource. +/// +/// Note: unless resource versioning is disabled by setting the +/// disable_resource_versioning flag +/// on the FHIR store, the deleted resources will be moved to a history +/// repository that can still be retrieved through GetResourceVersion and +/// related methods, unless they are removed by the DeleteResourceVersions +/// method. +/// +/// A builder for the *locations.datasets.fhirStores.fhir.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the resource to delete. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Searches resources in the given FHIR store. +/// +/// # Search Parameters +/// +/// The server's capability statement, retrieved through +/// GetCapabilityStatement, indicates which search +/// parameters are supported on each FHIR resource. +/// +/// # Search Modifiers +/// +/// Modifier | Supported +/// ----------- | --------- +/// `:missing` | Yes +/// `:exact` | Yes +/// `:contains` | Yes +/// `:text` | Yes +/// `:in` | Yes +/// `:not-in` | Yes +/// `:above` | Yes +/// `:below` | Yes +/// `:[type]` | Yes +/// `:not` | Yes +/// `:recurse` | No +/// +/// A builder for the *locations.datasets.fhirStores.fhir.searchResources* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_search_resources("parent", "resourceType") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirSearchResourceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _resource_type: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirSearchResourceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirSearchResourceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.searchResources", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("resourceType", self._resource_type.to_string())); + for &field in ["alt", "parent", "resourceType"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fhir/{+resourceType}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+resourceType}", "resourceType")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resourceType", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the FHIR store to retrieve resources from. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirSearchResourceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The type of the resource to search. + /// + /// Sets the *resource type* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource_type(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirSearchResourceCall<'a, C, A> { + self._resource_type = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirSearchResourceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirSearchResourceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirSearchResourceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates part of an existing resource. +/// +/// +/// A builder for the *locations.datasets.fhirStores.fhir.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::HttpBody; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = HttpBody::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_patch(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: HttpBody, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: HttpBody) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the resource to update. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Export resources from the FHIR store to the specified destination. +/// +/// This method returns an Operation that can +/// be used to track the status of the export by calling +/// GetOperation. +/// +/// Immediate fatal errors appear in the +/// error field. +/// Otherwise, when the operation finishes, a detailed response of type +/// ExportResourcesResponse is returned in the +/// response field. +/// The metadata field type for this +/// operation is OperationMetadata. +/// +/// A builder for the *locations.datasets.fhirStores.export* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::ExportResourcesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ExportResourcesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_export(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreExportCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: ExportResourcesRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreExportCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreExportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.export", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:export"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ExportResourcesRequest) -> ProjectLocationDatasetFhirStoreExportCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the FHIR store to export resource from. The name should be in + /// the format of + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreExportCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreExportCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreExportCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreExportCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the configuration of the specified FHIR store. +/// +/// A builder for the *locations.datasets.fhirStores.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FhirStore)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the FHIR store to get. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// SearchForInstances returns a list of matching instances. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 +/// +/// A builder for the *locations.datasets.dicomStores.studies.series.searchForInstances* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_search_for_instances("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.searchForInstances", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `instances`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySerySearchForInstanceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// RetrieveRenderedInstance returns instance associated with the given study, +/// series, and SOP Instance UID in an acceptable Rendered Media Type. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.8. +/// +/// A builder for the *locations.datasets.dicomStores.studies.series.instances.retrieveRendered* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.retrieveRendered", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instance/{instance_id}/rendered`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveRenderedCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy for a resource. +/// Returns an empty policy if the resource exists and does not have a policy +/// set. +/// +/// A builder for the *locations.datasets.dicomStores.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new FHIR store within the parent dataset. +/// +/// A builder for the *locations.datasets.fhirStores.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::FhirStore; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FhirStore::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_create(req, "parent") +/// .fhir_store_id("eos") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: FhirStore, + _parent: String, + _fhir_store_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FhirStore)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._fhir_store_id { + params.push(("fhirStoreId", value.to_string())); + } + for &field in ["alt", "parent", "fhirStoreId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fhirStores"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FhirStore) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the dataset this FHIR store belongs to. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The ID of the FHIR store that is being created. + /// The string must match the following regex: `[\p{L}\p{N}_\-\.]{1,256}`. + /// + /// Sets the *fhir store id* query property to the given value. + pub fn fhir_store_id(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C, A> { + self._fhir_store_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// RetrieveRenderedFrames returns instances associated with the given study, +/// series, SOP Instance UID and frame numbers in an acceptable Rendered Media +/// Type. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.8. +/// +/// A builder for the *locations.datasets.dicomStores.studies.series.instances.frames.retrieveRendered* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.frames.retrieveRendered", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instance/{instance_id}/frames/{frame_list}/rendered`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveRenderedCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified HL7v2 store and removes all messages that are +/// contained within it. +/// +/// A builder for the *locations.datasets.hl7V2Stores.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the HL7v2 store to delete. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on the specified resource. +/// If the resource does not exist, this will return an empty set of +/// permissions, not a NOT_FOUND error. +/// +/// Note: This operation is designed to be used for building permission-aware +/// UIs and command-line tools, not for authorization checking. This operation +/// may "fail open" without warning. +/// +/// A builder for the *locations.datasets.fhirStores.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the FHIR capability statement for the store, which contains a +/// description of functionality supported by the server. +/// +/// +/// A builder for the *locations.datasets.fhirStores.fhir.getMetadata* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_get_metadata("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirGetMetadataCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirGetMetadataCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirGetMetadataCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.getMetadata", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/fhir/metadata"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the FHIR store to retrieve the capabilities for. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirGetMetadataCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirGetMetadataCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirGetMetadataCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirGetMetadataCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets any metadata associated with a dataset. +/// +/// A builder for the *locations.datasets.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the dataset to read (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`). + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on the specified resource. Replaces any +/// existing policy. +/// +/// A builder for the *locations.datasets.fhirStores.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// RetrieveSeriesMetadata returns instance associated with the given study and +/// series, presented as metadata with the bulk data removed. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.6. +/// +/// A builder for the *locations.datasets.dicomStores.studies.series.retrieveMetadata* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_metadata("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.retrieveMetadata", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}/series/{series_id}/metadata`. + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveMetadataCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the HL7v2 store. +/// +/// A builder for the *locations.datasets.hl7V2Stores.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::Hl7V2Store; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Hl7V2Store::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_patch(req, "name") +/// .update_mask("invidunt") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StorePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: Hl7V2Store, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StorePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StorePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Hl7V2Store)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Hl7V2Store) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Output only. Resource name of the HL7v2 store, of the form + /// `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The update mask applies to the resource. For the `FieldMask` definition, + /// see + /// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists the health datasets in the current project. +/// +/// A builder for the *locations.datasets.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_list("parent") +/// .page_token("accusam") +/// .page_size(-56) +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListDatasetsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/datasets"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the project whose datasets should be listed (e.g., + /// `projects/{project_id}/locations/{location_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The next_page_token value returned from a previous List request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationDatasetListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of items to return. Capped to 100 if not specified. + /// May not be larger than 1000. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new health dataset. Results are returned through the +/// Operation interface which returns either an +/// `Operation.response` which contains a Dataset or +/// `Operation.error`. The metadata +/// field type is OperationMetadata. +/// +/// A builder for the *locations.datasets.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::Dataset; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Dataset::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_create(req, "parent") +/// .dataset_id("et") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: Dataset, + _parent: String, + _dataset_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._dataset_id { + params.push(("datasetId", value.to_string())); + } + for &field in ["alt", "parent", "datasetId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/datasets"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Dataset) -> ProjectLocationDatasetCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the project in which the dataset should be created (e.g., + /// `projects/{project_id}/locations/{location_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The ID of the dataset that is being created. + /// The string must match the following regex: `[\p{L}\p{N}_\-\.]{1,256}`. + /// + /// Sets the *dataset id* query property to the given value. + pub fn dataset_id(mut self, new_value: &str) -> ProjectLocationDatasetCreateCall<'a, C, A> { + self._dataset_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists the DICOM stores in the given dataset. +/// +/// A builder for the *locations.datasets.dicomStores.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_list("parent") +/// .page_token("et") +/// .page_size(-40) +/// .filter("sanctus") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListDicomStoresResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomStores"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the dataset. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The next_page_token value returned from the previous List request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Limit on the number of DICOM stores to return in a single response. + /// If zero the default page size of 100 is used. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetDicomStoreListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Restricts stores returned to those matching a filter. Syntax: + /// https://cloud.google.com/appengine/docs/standard/python/search/query_strings + /// Only filtering on labels is supported, for example `labels.key=value`. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Get N most recent observations for patient, grouped by code +/// that match given query parameters. +/// +/// +/// A builder for the *locations.datasets.fhirStores.fhir.Observation.get$lastn* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir__observation_getlastn("parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.Observation.get$lastn", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fhir/Observation/$lastn"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the FHIR store to retrieve resources from. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirObservationGet$lastnCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// RetrieveFrames returns instances associated with the given study, series, +/// SOP Instance UID and frame numbers. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.4. +/// +/// A builder for the *locations.datasets.dicomStores.studies.series.instances.frames.retrieveFrames* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.frames.retrieveFrames", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instance/{instance_id}/frames/{frame_list}`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceFrameRetrieveFrameCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// SearchForSeries returns a list of matching series. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 +/// +/// A builder for the *locations.datasets.dicomStores.searchForSeries* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_search_for_series("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.searchForSeries", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `series`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new dataset containing de-identified data from the source +/// dataset. The metadata field type +/// is OperationMetadata. +/// If the request is successful, the +/// response field type is +/// DeidentifySummary. +/// If errors occur, +/// details field type is +/// DeidentifyErrorDetails. +/// +/// A builder for the *locations.datasets.deidentify* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::DeidentifyDatasetRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DeidentifyDatasetRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_deidentify(req, "sourceDataset") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDeidentifyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: DeidentifyDatasetRequest, + _source_dataset: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDeidentifyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDeidentifyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.deidentify", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("sourceDataset", self._source_dataset.to_string())); + for &field in ["alt", "sourceDataset"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+sourceDataset}:deidentify"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sourceDataset}", "sourceDataset")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sourceDataset"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DeidentifyDatasetRequest) -> ProjectLocationDatasetDeidentifyCall<'a, C, A> { + self._request = new_value; + self + } + /// Source dataset resource name. (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`). + /// + /// Sets the *source dataset* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn source_dataset(mut self, new_value: &str) -> ProjectLocationDatasetDeidentifyCall<'a, C, A> { + self._source_dataset = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDeidentifyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDeidentifyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDeidentifyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all the messages in the given HL7v2 store with support for filtering. +/// +/// A builder for the *locations.datasets.hl7V2Stores.messages.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_list("parent") +/// .page_token("dolor") +/// .page_size(-48) +/// .order_by("dolor") +/// .filter("et") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _page_token: Option, + _page_size: Option, + _order_by: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListMessagesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "orderBy", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/messages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the HL7v2 store to retrieve messages from. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The next_page_token value returned from the previous List request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Limit on the number of messages to return in a single response. + /// If zero the default page size of 100 is used. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Orders messages returned by the specified order_by clause. + /// Syntax: https://cloud.google.com/apis/design/design_patterns#sorting_order + /// + /// Fields available for ordering are: + /// + /// * `send_time` + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// Restricts messages returned to those matching a filter. Syntax: + /// https://cloud.google.com/appengine/docs/standard/python/search/query_strings + /// + /// Fields/functions available for filtering are: + /// + /// * `message_type`, from the MSH-9 segment; for example + /// `NOT message_type = "ADT"` + /// * `send_date` or `sendDate`, the YYYY-MM-DD date the message was sent in + /// the dataset's time_zone, from the MSH-7 segment; for example + /// `send_date < "2017-01-02"` + /// * `send_time`, the timestamp of when the message was sent, using the + /// RFC3339 time format for comparisons, from the MSH-7 segment; for example + /// `send_time < "2017-01-02T00:00:00-05:00"` + /// * `send_facility`, the care center that the message came from, from the + /// MSH-4 segment; for example `send_facility = "ABC"` + /// * `HL7RegExp(expr)`, which does regular expression matching of `expr` + /// against the message payload using re2 (http://code.google.com/p/re2/) + /// syntax; for example `HL7RegExp("^.*\|.*\|EMERG")` + /// * `PatientId(value, type)`, which matches if the message lists a patient + /// having an ID of the given value and type in the PID-2, PID-3, or PID-4 + /// segments; for example `PatientId("123456", "MRN")` + /// * `labels.x`, a string value of the label with key `x` as set using the + /// Message.labels + /// map, for example `labels."priority"="high"`. The operator `:*` can be used + /// to assert the existence of a label, for example `labels."priority":*`. + /// + /// Limitations on conjunctions: + /// + /// * Negation on the patient ID function or the labels field is not + /// supported, for example these queries are invalid: + /// `NOT PatientId("123456", "MRN")`, `NOT labels."tag1":*`, + /// `NOT labels."tag2"="val2"`. + /// * Conjunction of multiple patient ID functions is not supported, for + /// example this query is invalid: + /// `PatientId("123456", "MRN") AND PatientId("456789", "MRN")`. + /// * Conjunction of multiple labels fields is also not supported, for + /// example this query is invalid: `labels."tag1":* AND labels."tag2"="val2"`. + /// * Conjunction of one patient ID function, one labels field and conditions + /// on other fields is supported, for example this query is valid: + /// `PatientId("123456", "MRN") AND labels."tag1":* AND message_type = "ADT"`. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the configuration of the specified FHIR store. +/// +/// A builder for the *locations.datasets.fhirStores.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::FhirStore; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FhirStore::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_patch(req, "name") +/// .update_mask("amet.") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStorePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: FhirStore, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStorePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStorePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FhirStore)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FhirStore) -> ProjectLocationDatasetFhirStorePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Output only. Resource name of the FHIR store, of the form + /// `projects/{project_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStorePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The update mask applies to the resource. For the `FieldMask` definition, + /// see + /// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectLocationDatasetFhirStorePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStorePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStorePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStorePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy for a resource. +/// Returns an empty policy if the resource exists and does not have a policy +/// set. +/// +/// A builder for the *locations.datasets.fhirStores.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the entire resource if the resource exists based on the +/// search criteria specified via query parameters. +/// +/// +/// A builder for the *locations.datasets.fhirStores.fhir.conditionalUpdateResource* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::HttpBody; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = HttpBody::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_conditional_update_resource(req, "parent", "type") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: HttpBody, + _parent: String, + _type_: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.conditionalUpdateResource", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("type", self._type_.to_string())); + for &field in ["alt", "parent", "type"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fhir/{+type}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+type}", "type")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["type", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: HttpBody) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the FHIR store this resource belongs to. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The type of the resource to update. + /// + /// Sets the *type* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn type_(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall<'a, C, A> { + self._type_ = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateResourceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new HL7v2 store within the parent dataset. +/// +/// A builder for the *locations.datasets.hl7V2Stores.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::Hl7V2Store; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Hl7V2Store::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_create(req, "parent") +/// .hl7_v2_store_id("sit") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: Hl7V2Store, + _parent: String, + _hl7_v2_store_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Hl7V2Store)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._hl7_v2_store_id { + params.push(("hl7V2StoreId", value.to_string())); + } + for &field in ["alt", "parent", "hl7V2StoreId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/hl7V2Stores"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Hl7V2Store) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the dataset this HL7v2 store belongs to. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The ID of the HL7v2 store that is being created. + /// The string must match the following regex: `[\p{L}\p{N}_\-\.]{1,256}`. + /// + /// Sets the *hl7 v2 store id* query property to the given value. + pub fn hl7_v2_store_id(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C, A> { + self._hl7_v2_store_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a FHIR resource. +/// +/// +/// A builder for the *locations.datasets.fhirStores.fhir.createResource* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::HttpBody; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = HttpBody::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_create_resource(req, "parent", "type") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirCreateResourceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: HttpBody, + _parent: String, + _type_: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirCreateResourceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirCreateResourceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.createResource", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("type", self._type_.to_string())); + for &field in ["alt", "parent", "type"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fhir/{+type}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+type}", "type")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["type", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: HttpBody) -> ProjectLocationDatasetFhirStoreFhirCreateResourceCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the FHIR store this resource belongs to. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirCreateResourceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The type of the resource to create. + /// + /// Sets the *type* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn type_(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirCreateResourceCall<'a, C, A> { + self._type_ = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirCreateResourceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirCreateResourceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirCreateResourceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// RetrieveStudy returns all instances within the given study. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.1. +/// +/// A builder for the *locations.datasets.dicomStores.studies.retrieveStudy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_retrieve_study("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.retrieveStudy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the entire resource or creates a new resource with a client +/// specified ID if the resource does not exist and the FHIR store has +/// enable_update_create set. +/// +/// +/// A builder for the *locations.datasets.fhirStores.fhir.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::HttpBody; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = HttpBody::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_update(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: HttpBody, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: HttpBody) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the resource to update. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy for a resource. +/// Returns an empty policy if the resource exists and does not have a policy +/// set. +/// +/// A builder for the *locations.datasets.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// StoreInstances stores DICOM instances associated with study instance unique +/// identifiers (SUID). See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.6.1. +/// +/// A builder for the *locations.datasets.dicomStores.studies.storeInstances* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::HttpBody; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = HttpBody::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_store_instances(req, "parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: HttpBody, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.storeInstances", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: HttpBody) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Update the message. +/// +/// A builder for the *locations.datasets.hl7V2Stores.messages.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::Message; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Message::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_patch(req, "name") +/// .update_mask("dolore") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: Message, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Message)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Message) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Resource name of the Message, of the form + /// `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7_v2_store_id}/messages/{message_id}`. + /// Assigned by the server. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The update mask applies to the resource. For the `FieldMask` definition, + /// see + /// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + /// Only the `labels` field is allowed to be updated. + /// The labels in the request will be merged with the existing set of labels. + /// Existing labels with the same keys will be updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates parts of a resource if the resource exists based on the +/// search criteria specified via query parameters. +/// +/// A builder for the *locations.datasets.fhirStores.fhir.conditionalPatchResource* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::HttpBody; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = HttpBody::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_conditional_patch_resource(req, "parent", "type") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: HttpBody, + _parent: String, + _type_: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.conditionalPatchResource", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("type", self._type_.to_string())); + for &field in ["alt", "parent", "type"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fhir/{+type}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+type}", "type")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["type", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: HttpBody) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the FHIR store this resource belongs to. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The type of the resource to update. + /// + /// Sets the *type* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn type_(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall<'a, C, A> { + self._type_ = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchResourceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Imports data into the DICOM store by copying it from the specified source. +/// For errors, the Operation will be populated with error details (in the form +/// of ImportDicomDataErrorDetails in error.details), which will hold +/// finer-grained error information. +/// The metadata field type is +/// OperationMetadata. +/// +/// A builder for the *locations.datasets.dicomStores.import* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::ImportDicomDataRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ImportDicomDataRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_import(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreImportCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: ImportDicomDataRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreImportCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreImportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.import", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:import"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ImportDicomDataRequest) -> ProjectLocationDatasetDicomStoreImportCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the DICOM store resource into which the data is imported (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreImportCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreImportCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreImportCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreImportCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// DeleteSeries deletes all instances within the given study and series. +/// Delete requests are equivalent to the GET requests specified in the WADO-RS +/// standard. +/// +/// A builder for the *locations.datasets.dicomStores.studies.series.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_delete("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySeryDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySeryDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySeryDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryDeleteCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}/series/{series_id}`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryDeleteCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySeryDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySeryDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySeryDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists operations that match the specified filter in the request. If the +/// server doesn't support this method, it returns `UNIMPLEMENTED`. +/// +/// NOTE: the `name` binding allows API services to override the binding +/// to use different resource name schemes, such as `users/*/operations`. To +/// override the binding, API services can add a binding such as +/// `"/v1/{name=users/*}/operations"` to their service configuration. +/// For backwards compatibility, the default name includes the operations +/// collection id, however overriding users must ensure the name binding +/// is the parent resource, without the operations collection id. +/// +/// A builder for the *locations.datasets.operations.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_operations_list("name") +/// .page_token("takimata") +/// .page_size(-40) +/// .filter("kasd") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetOperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetOperationListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetOperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/operations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation's parent resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetOperationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationDatasetOperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetOperationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationDatasetOperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetOperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetOperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetOperationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new DICOM store within the parent dataset. +/// +/// A builder for the *locations.datasets.dicomStores.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::DicomStore; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DicomStore::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_create(req, "parent") +/// .dicom_store_id("takimata") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: DicomStore, + _parent: String, + _dicom_store_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DicomStore)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._dicom_store_id { + params.push(("dicomStoreId", value.to_string())); + } + for &field in ["alt", "parent", "dicomStoreId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomStores"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DicomStore) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the dataset this DICOM store belongs to. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The ID of the DICOM store that is being created. + /// Any string value up to 256 characters in length. + /// + /// Sets the *dicom store id* query property to the given value. + pub fn dicom_store_id(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C, A> { + self._dicom_store_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a version (current or historical) of FHIR resource by version id. +/// +/// +/// A builder for the *locations.datasets.fhirStores.fhir._history.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir__history_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirHistoryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirHistoryGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirHistoryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir._history.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the resource version to retrieve. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirHistoryGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirHistoryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirHistoryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirHistoryGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *locations.datasets.operations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_operations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetOperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetOperationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetOperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetOperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetOperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetOperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a FHIR resource. +/// +/// +/// A builder for the *locations.datasets.fhirStores.fhir.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the resource to retrieve. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified health dataset and all data contained in the dataset. +/// Deleting a dataset does not affect the sources from which the dataset was +/// imported (if any). +/// +/// A builder for the *locations.datasets.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the dataset to delete (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`). + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// SearchForInstances returns a list of matching instances. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 +/// +/// A builder for the *locations.datasets.dicomStores.studies.searchForInstances* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_search_for_instances("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.searchForInstances", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `instances`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates dataset metadata. +/// +/// A builder for the *locations.datasets.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::Dataset; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Dataset::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_patch(req, "name") +/// .update_mask("nonumy") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: Dataset, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Dataset) -> ProjectLocationDatasetPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Output only. Resource name of the dataset, of the form + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The update mask applies to the resource. For the `FieldMask` definition, + /// see + /// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectLocationDatasetPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// SearchForSeries returns a list of matching series. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 +/// +/// A builder for the *locations.datasets.dicomStores.studies.searchForSeries* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_search_for_series("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.searchForSeries", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `series`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on the specified resource. +/// If the resource does not exist, this will return an empty set of +/// permissions, not a NOT_FOUND error. +/// +/// Note: This operation is designed to be used for building permission-aware +/// UIs and command-line tools, not for authorization checking. This operation +/// may "fail open" without warning. +/// +/// A builder for the *locations.datasets.dicomStores.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on the specified resource. Replaces any +/// existing policy. +/// +/// A builder for the *locations.datasets.dicomStores.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes all the historical versions of a resource (excluding current +/// version) from the FHIR store. To remove all versions of a resource, first +/// delete the current version and call this method. +/// +/// A builder for the *locations.datasets.fhirStores.fhir.delete$purge* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_deletepurge("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirDelete$purgeCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirDelete$purgeCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirDelete$purgeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.delete$purge", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/$purge"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the resource to purge. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirDelete$purgeCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirDelete$purgeCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirDelete$purgeCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirDelete$purgeCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified DICOM store and removes all images that are contained +/// within it. +/// +/// A builder for the *locations.datasets.dicomStores.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the DICOM store to delete. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Import resources to the FHIR store by loading data from the specified +/// sources. Each resource must have a client-supplied ID, which is retained +/// by the server. +/// +/// The import operation is idempotent. Upon retry, the most recent data +/// (matching the client-supplied ID) is overwritten, without creating a new +/// resource version. If partial failures occur during the import, successful +/// changes are not rolled back. +/// +/// If history imports are enabled +/// (enable_history_import is set in the +/// FHIR store's configuration), you can import historical versions of a +/// resource by supplying a bundle of type `history`. The historical versions +/// in the bundle must have `lastUpdated` timestamps. If a current or +/// historical version with the supplied resource ID already exists, the +/// bundle is rejected. +/// +/// This method returns an Operation that can +/// be used to track the status of the import by calling +/// GetOperation. +/// +/// Immediate fatal errors appear in the +/// error field. +/// Otherwise, when the operation finishes, a detailed response of type +/// ImportResourcesResponse is returned in the +/// response field. +/// The metadata field type for this +/// operation is OperationMetadata. +/// +/// A builder for the *locations.datasets.fhirStores.import* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::ImportResourcesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ImportResourcesRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_import(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreImportCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: ImportResourcesRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreImportCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreImportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.import", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:import"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ImportResourcesRequest) -> ProjectLocationDatasetFhirStoreImportCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the FHIR store to import FHIR resources to. The name should be + /// in the format of + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreImportCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreImportCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreImportCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreImportCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// RetrieveInstanceMetadata returns instance associated with the given study, +/// series, and SOP Instance UID presented as metadata with the bulk data +/// removed. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.6. +/// +/// A builder for the *locations.datasets.dicomStores.studies.series.instances.retrieveMetadata* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.retrieveMetadata", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instances/{instance_id}/metadata`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveMetadataCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// SearchForInstances returns a list of matching instances. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.7 +/// +/// A builder for the *locations.datasets.dicomStores.searchForInstances* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_search_for_instances("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.searchForInstances", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `instances`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the specified DICOM store. +/// +/// A builder for the *locations.datasets.dicomStores.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DicomStore)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the DICOM store to get. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on the specified resource. +/// If the resource does not exist, this will return an empty set of +/// permissions, not a NOT_FOUND error. +/// +/// Note: This operation is designed to be used for building permission-aware +/// UIs and command-line tools, not for authorization checking. This operation +/// may "fail open" without warning. +/// +/// A builder for the *locations.datasets.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectLocationDatasetTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// RetrieveInstance returns instance associated with the given study, series, +/// and SOP Instance UID. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.3. +/// +/// A builder for the *locations.datasets.dicomStores.studies.series.instances.retrieveInstance* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_instance("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.retrieveInstance", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instance/{instance_id}`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceRetrieveInstanceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// RetrieveStudyMetadata returns instance associated with the given study +/// presented as metadata with the bulk data removed. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.6. +/// +/// A builder for the *locations.datasets.dicomStores.studies.retrieveMetadata* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_retrieve_metadata("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.retrieveMetadata", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}/metadata`. + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// RetrieveSeries returns all instances within the given study and series. See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.5.2. +/// +/// A builder for the *locations.datasets.dicomStores.studies.series.retrieveSeries* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_series("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.retrieveSeries", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}/series/{series_id}`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySeryRetrieveSeryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the specified DICOM store. +/// +/// A builder for the *locations.datasets.dicomStores.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::DicomStore; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DicomStore::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_patch(req, "name") +/// .update_mask("justo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStorePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: DicomStore, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStorePatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStorePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DicomStore)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DicomStore) -> ProjectLocationDatasetDicomStorePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Output only. Resource name of the DICOM store, of the form + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDicomStorePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The update mask applies to the resource. For the `FieldMask` definition, + /// see + /// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectLocationDatasetDicomStorePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStorePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStorePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStorePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Exports data to the specified destination by copying it from the DICOM +/// store. +/// The metadata field type is +/// OperationMetadata. +/// +/// A builder for the *locations.datasets.dicomStores.export* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::ExportDicomDataRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ExportDicomDataRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_export(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreExportCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: ExportDicomDataRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreExportCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreExportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.export", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:export"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ExportDicomDataRequest) -> ProjectLocationDatasetDicomStoreExportCall<'a, C, A> { + self._request = new_value; + self + } + /// The DICOM store resource name from which the data should be exported (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreExportCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreExportCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreExportCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreExportCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the specified HL7v2 store. +/// +/// A builder for the *locations.datasets.hl7V2Stores.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Hl7V2Store)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the HL7v2 store to get. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists the FHIR stores in the given dataset. +/// +/// A builder for the *locations.datasets.fhirStores.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_list("parent") +/// .page_token("clita") +/// .page_size(-79) +/// .filter("justo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListFhirStoresResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fhirStores"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the dataset. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The next_page_token value returned from the previous List request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Limit on the number of FHIR stores to return in a single response. If zero + /// the default page size of 100 is used. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetFhirStoreListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Restricts stores returned to those matching a filter. Syntax: + /// https://cloud.google.com/appengine/docs/standard/python/search/query_strings + /// Only filtering on labels is supported, for example `labels.key=value`. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists information about the supported locations for this service. +/// +/// A builder for the *locations.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_list("name") +/// .page_token("clita") +/// .page_size(-37) +/// .filter("ut") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLocationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/locations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource that owns the locations collection, if applicable. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists the HL7v2 stores in the given dataset. +/// +/// A builder for the *locations.datasets.hl7V2Stores.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_list("parent") +/// .page_token("eos") +/// .page_size(-78) +/// .filter("duo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListHl7V2StoresResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/hl7V2Stores"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the dataset. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The next_page_token value returned from the previous List request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Limit on the number of HL7v2 stores to return in a single response. + /// If zero the default page size of 100 is used. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Restricts stores returned to those matching a filter. Syntax: + /// https://cloud.google.com/appengine/docs/standard/python/search/query_strings + /// Only filtering on labels is supported, for example `labels.key=value`. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Executes all the requests in the given Bundle. +/// +/// A builder for the *locations.datasets.fhirStores.executeBundle* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::HttpBody; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = HttpBody::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_execute_bundle(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreExecuteBundleCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: HttpBody, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreExecuteBundleCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreExecuteBundleCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.executeBundle", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fhir"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: HttpBody) -> ProjectLocationDatasetFhirStoreExecuteBundleCall<'a, C, A> { + self._request = new_value; + self + } + /// Name of the FHIR store in which this bundle will be executed. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreExecuteBundleCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreExecuteBundleCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreExecuteBundleCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreExecuteBundleCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// DeleteInstance deletes an instance associated with the given study, series, +/// and SOP Instance UID. Delete requests are equivalent to the GET requests +/// specified in the WADO-RS standard. +/// +/// A builder for the *locations.datasets.dicomStores.studies.series.instances.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_delete("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., + /// `studies/{study_id}/series/{series_id}/instances/{instance_id}`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudySeryInstanceDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// DeleteStudy deletes all instances within the given study. Delete requests +/// are equivalent to the GET requests specified in the WADO-RS standard. +/// +/// A builder for the *locations.datasets.dicomStores.studies.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_studies_delete("parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes the specified FHIR store and removes all resources within it. +/// +/// A builder for the *locations.datasets.fhirStores.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the FHIR store to delete. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on the specified resource. Replaces any +/// existing policy. +/// +/// A builder for the *locations.datasets.hl7V2Stores.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all the versions of a resource (including the current version and +/// deleted versions) from the FHIR store. +/// +/// +/// A builder for the *locations.datasets.fhirStores.fhir._history.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir__history_list("name") +/// .since("invidunt") +/// .page("rebum.") +/// .count(-51) +/// .at("clita") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _since: Option, + _page: Option, + _count: Option, + _at: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir._history.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._since { + params.push(("since", value.to_string())); + } + if let Some(value) = self._page { + params.push(("page", value.to_string())); + } + if let Some(value) = self._count { + params.push(("count", value.to_string())); + } + if let Some(value) = self._at { + params.push(("at", value.to_string())); + } + for &field in ["alt", "name", "since", "page", "count", "at"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/_history"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the resource to retrieve. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Only include resource versions that were created at or after the given + /// instant in time. The instant in time uses the format + /// YYYY-MM-DDThh:mm:ss.sss+zz:zz (for example 2015-02-07T13:28:17.239+02:00 or + /// 2017-01-01T00:00:00Z). The time must be specified to the second and + /// include a time zone. + /// + /// Sets the *since* query property to the given value. + pub fn since(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> { + self._since = Some(new_value.to_string()); + self + } + /// Used to retrieve the first, previous, next, or last page of resource + /// versions when using pagination. Value should be set to the value of the + /// `link.url` field returned in the response to the previous request, where + /// `link.relation` is "first", "previous", "next" or "last". + /// Omit `page` if no previous request has been made. + /// + /// Sets the *page* query property to the given value. + pub fn page(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> { + self._page = Some(new_value.to_string()); + self + } + /// The maximum number of search results on a page. + /// + /// Sets the *count* query property to the given value. + pub fn count(mut self, new_value: i32) -> ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> { + self._count = Some(new_value); + self + } + /// Only include resource versions that were current at some point during the + /// time period specified in the date time value. The date parameter format is + /// yyyy-mm-ddThh:mm:ss[Z|(+|-)hh:mm] + /// Clients may specify any of the following: + /// An entire year: `_at=2019` + /// An entire month: `_at=2019-01` + /// A specific day: `_at=2019-01-20` + /// A specific second: `_at=2018-12-31T23:59:58Z` + /// + /// Sets the *at* query property to the given value. + pub fn at(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> { + self._at = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirHistoryListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// StoreInstances stores DICOM instances associated with study instance unique +/// identifiers (SUID). See +/// http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_6.6.1. +/// +/// A builder for the *locations.datasets.dicomStores.storeInstances* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::HttpBody; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = HttpBody::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_dicom_stores_store_instances(req, "parent", "dicomWebPath") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: HttpBody, + _parent: String, + _dicom_web_path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.storeInstances", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("dicomWebPath", self._dicom_web_path.to_string())); + for &field in ["alt", "parent", "dicomWebPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dicomWeb/{+dicomWebPath}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dicomWebPath", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: HttpBody) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the DICOM store that is being accessed (e.g., + /// `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`). + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The path of the DICOMweb request, as specified in the STOW-RS, WADO-RS, or + /// QIDO-RS standard (e.g., `studies/{study_id}`). + /// + /// Sets the *dicom web path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dicom_web_path(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C, A> { + self._dicom_web_path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes FHIR resources matching a search query. +/// +/// Note: unless resource versioning is disabled by setting the +/// disable_resource_versioning flag +/// on the FHIR store, the deleted resources will be moved to a history +/// repository that can still be retrieved through GetResourceVersion and +/// related methods, unless they are removed by the DeleteResourceVersions +/// method. +/// +/// A builder for the *locations.datasets.fhirStores.fhir.conditionalDeleteResource* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir_conditional_delete_resource("parent", "type") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _parent: String, + _type_: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.conditionalDeleteResource", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("type", self._type_.to_string())); + for &field in ["alt", "parent", "type"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/fhir/{+type}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+type}", "type")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["type", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the FHIR store this resource belongs to. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The type of the resource to update. + /// + /// Sets the *type* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn type_(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall<'a, C, A> { + self._type_ = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteResourceCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on the specified resource. Replaces any +/// existing policy. +/// +/// A builder for the *locations.datasets.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectLocationDatasetSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy for a resource. +/// Returns an empty policy if the resource exists and does not have a policy +/// set. +/// +/// A builder for the *locations.datasets.hl7V2Stores.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.getIamPolicy", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets an HL7v2 message. +/// +/// A builder for the *locations.datasets.hl7V2Stores.messages.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_get("name") +/// .view("takimata") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _view: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Message)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._view { + params.push(("view", value.to_string())); + } + for &field in ["alt", "name", "view"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the HL7v2 message to retrieve. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Specifies which parts of the Message resource should be returned + /// in the response. + /// + /// Sets the *view* query property to the given value. + pub fn view(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C, A> { + self._view = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on the specified resource. +/// If the resource does not exist, this will return an empty set of +/// permissions, not a NOT_FOUND error. +/// +/// Note: This operation is designed to be used for building permission-aware +/// UIs and command-line tools, not for authorization checking. This operation +/// may "fail open" without warning. +/// +/// A builder for the *locations.datasets.hl7V2Stores.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets all the resources in the patient compartment. +/// +/// +/// A builder for the *locations.datasets.fhirStores.fhir.Patient.get$everything* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_fhir_stores_fhir__patient_geteverything("name") +/// .start("rebum.") +/// .end("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _name: String, + _start: Option, + _end: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, HttpBody)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.fhirStores.fhir.Patient.get$everything", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._start { + params.push(("start", value.to_string())); + } + if let Some(value) = self._end { + params.push(("end", value.to_string())); + } + for &field in ["alt", "name", "start", "end"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/$everything"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the patient for which the information is required. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The response includes records subsequent to the start date. If no start + /// date is provided, all records prior to the end date are in scope. + /// + /// Sets the *start* query property to the given value. + pub fn start(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall<'a, C, A> { + self._start = Some(new_value.to_string()); + self + } + /// The response includes records prior to the end date. If no end date is + /// provided, all records subsequent to the start date are in scope. + /// + /// Sets the *end* query property to the given value. + pub fn end(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall<'a, C, A> { + self._end = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetFhirStoreFhirPatientGet$everythingCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a message and sends a notification to the Cloud Pub/Sub topic. If +/// configured, the MLLP adapter listens to messages created by this method and +/// sends those back to the hospital. A successful response indicates the +/// message has been persisted to storage and a Cloud Pub/Sub notification has +/// been sent. Sending to the hospital by the MLLP adapter happens +/// asynchronously. +/// +/// A builder for the *locations.datasets.hl7V2Stores.messages.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_healthcare1_beta1 as healthcare1_beta1; +/// use healthcare1_beta1::CreateMessageRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use healthcare1_beta1::CloudHealthcare; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudHealthcare::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreateMessageRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudHealthcare, + _request: CreateMessageRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Message)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/messages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreateMessageRequest) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the dataset this message belongs to. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/iam1-cli/Cargo.toml b/gen/iam1-cli/Cargo.toml index 44b5338597..80b9474938 100644 --- a/gen/iam1-cli/Cargo.toml +++ b/gen/iam1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-iam1-cli" -version = "1.0.8+20181005" +version = "1.0.8+20190321" authors = ["Sebastian Thiel "] description = "A complete library to interact with iam (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iam1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-iam1] path = "../iam1" -version = "1.0.8+20181005" +version = "1.0.8+20190321" diff --git a/gen/iam1-cli/README.md b/gen/iam1-cli/README.md index 0aca60a81f..ec380e1f53 100644 --- a/gen/iam1-cli/README.md +++ b/gen/iam1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *iam* API at revision *20181005*. The CLI is at version *1.0.8*. +This documentation was generated from the *iam* API at revision *20190321*. The CLI is at version *1.0.8*. ```bash iam1 [options] @@ -50,6 +50,8 @@ iam1 [options] roles-undelete (-r )... [-p ]... [-o ] service-accounts-create (-r )... [-p ]... [-o ] service-accounts-delete [-p ]... [-o ] + service-accounts-disable (-r )... [-p ]... [-o ] + service-accounts-enable (-r )... [-p ]... [-o ] service-accounts-get [-p ]... [-o ] service-accounts-get-iam-policy [-p ]... [-o ] service-accounts-keys-create (-r )... [-p ]... [-o ] @@ -57,10 +59,12 @@ iam1 [options] service-accounts-keys-get [-p ]... [-o ] service-accounts-keys-list [-p ]... [-o ] service-accounts-list [-p ]... [-o ] + service-accounts-patch (-r )... [-p ]... [-o ] service-accounts-set-iam-policy (-r )... [-p ]... [-o ] service-accounts-sign-blob (-r )... [-p ]... [-o ] service-accounts-sign-jwt (-r )... [-p ]... [-o ] service-accounts-test-iam-permissions (-r )... [-p ]... [-o ] + service-accounts-undelete (-r )... [-p ]... [-o ] service-accounts-update (-r )... [-p ]... [-o ] roles get [-p ]... [-o ] diff --git a/gen/iam1-cli/mkdocs.yml b/gen/iam1-cli/mkdocs.yml index fc13689f9a..d3edec7f61 100644 --- a/gen/iam1-cli/mkdocs.yml +++ b/gen/iam1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: iam v1.0.8+20181005 +site_name: iam v1.0.8+20190321 site_url: http://byron.github.io/google-apis-rs/google-iam1-cli site_description: A complete library to interact with iam (protocol v1) @@ -26,6 +26,8 @@ pages: - ['projects_roles-undelete.md', 'Projects', 'Roles Undelete'] - ['projects_service-accounts-create.md', 'Projects', 'Service Accounts Create'] - ['projects_service-accounts-delete.md', 'Projects', 'Service Accounts Delete'] +- ['projects_service-accounts-disable.md', 'Projects', 'Service Accounts Disable'] +- ['projects_service-accounts-enable.md', 'Projects', 'Service Accounts Enable'] - ['projects_service-accounts-get.md', 'Projects', 'Service Accounts Get'] - ['projects_service-accounts-get-iam-policy.md', 'Projects', 'Service Accounts Get Iam Policy'] - ['projects_service-accounts-keys-create.md', 'Projects', 'Service Accounts Keys Create'] @@ -33,10 +35,12 @@ pages: - ['projects_service-accounts-keys-get.md', 'Projects', 'Service Accounts Keys Get'] - ['projects_service-accounts-keys-list.md', 'Projects', 'Service Accounts Keys List'] - ['projects_service-accounts-list.md', 'Projects', 'Service Accounts List'] +- ['projects_service-accounts-patch.md', 'Projects', 'Service Accounts Patch'] - ['projects_service-accounts-set-iam-policy.md', 'Projects', 'Service Accounts Set Iam Policy'] - ['projects_service-accounts-sign-blob.md', 'Projects', 'Service Accounts Sign Blob'] - ['projects_service-accounts-sign-jwt.md', 'Projects', 'Service Accounts Sign Jwt'] - ['projects_service-accounts-test-iam-permissions.md', 'Projects', 'Service Accounts Test Iam Permissions'] +- ['projects_service-accounts-undelete.md', 'Projects', 'Service Accounts Undelete'] - ['projects_service-accounts-update.md', 'Projects', 'Service Accounts Update'] - ['roles_get.md', 'Roles', 'Get'] - ['roles_list.md', 'Roles', 'List'] diff --git a/gen/iam1-cli/src/main.rs b/gen/iam1-cli/src/main.rs index 5dbb441c25..fa9a4e6968 100644 --- a/gen/iam1-cli/src/main.rs +++ b/gen/iam1-cli/src/main.rs @@ -74,14 +74,14 @@ impl<'n> Engine<'n> { "full-resource-name" => Some(("fullResourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "binding.role" => Some(("binding.role", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "binding.members" => Some(("binding.members", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "binding.condition.description" => Some(("binding.condition.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "binding.condition.expression" => Some(("binding.condition.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "binding.condition.location" => Some(("binding.condition.location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "binding.condition.title" => Some(("binding.condition.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "condition.description" => Some(("condition.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "condition.expression" => Some(("condition.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "condition.location" => Some(("condition.location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "binding.condition.expression" => Some(("binding.condition.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "binding.condition.description" => Some(("binding.condition.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "binding.condition.location" => Some(("binding.condition.location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "condition.title" => Some(("condition.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "condition.expression" => Some(("condition.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "condition.description" => Some(("condition.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "condition.location" => Some(("condition.location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["binding", "condition", "description", "etag", "expression", "full-resource-name", "location", "members", "policy", "role", "title", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -252,10 +252,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "role-id" => Some(("roleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "role.name" => Some(("role.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "role.description" => Some(("role.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role.title" => Some(("role.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role.deleted" => Some(("role.deleted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "role.description" => Some(("role.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "role.name" => Some(("role.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role.etag" => Some(("role.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role.included-permissions" => Some(("role.includedPermissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "role.stage" => Some(("role.stage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -516,10 +516,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "deleted" => Some(("deleted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "included-permissions" => Some(("includedPermissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "stage" => Some(("stage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -784,10 +784,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "role-id" => Some(("roleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "role.name" => Some(("role.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "role.description" => Some(("role.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role.title" => Some(("role.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role.deleted" => Some(("role.deleted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "role.description" => Some(("role.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "role.name" => Some(("role.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role.etag" => Some(("role.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role.included-permissions" => Some(("role.includedPermissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "role.stage" => Some(("role.stage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1048,10 +1048,10 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "deleted" => Some(("deleted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "included-permissions" => Some(("includedPermissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "stage" => Some(("stage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1230,14 +1230,16 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "service-account.oauth2-client-id" => Some(("serviceAccount.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "service-account.display-name" => Some(("serviceAccount.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "service-account.name" => Some(("serviceAccount.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.description" => Some(("serviceAccount.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "service-account.project-id" => Some(("serviceAccount.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.disabled" => Some(("serviceAccount.disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "service-account.etag" => Some(("serviceAccount.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "service-account.unique-id" => Some(("serviceAccount.uniqueId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "service-account.email" => Some(("serviceAccount.email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.name" => Some(("serviceAccount.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "display-name", "email", "etag", "name", "oauth2-client-id", "project-id", "service-account", "unique-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "description", "disabled", "display-name", "email", "etag", "name", "oauth2-client-id", "project-id", "service-account", "unique-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1349,6 +1351,174 @@ impl<'n> Engine<'n> { } } + fn _projects_service_accounts_disable(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DisableServiceAccountRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().service_accounts_disable(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_enable(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::EnableServiceAccountRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().service_accounts_enable(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_service_accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().service_accounts_get(opt.value_of("name").unwrap_or("")); @@ -1762,6 +1932,100 @@ impl<'n> Engine<'n> { } } + fn _projects_service_accounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "service-account.oauth2-client-id" => Some(("serviceAccount.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.display-name" => Some(("serviceAccount.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.description" => Some(("serviceAccount.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.project-id" => Some(("serviceAccount.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.disabled" => Some(("serviceAccount.disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "service-account.etag" => Some(("serviceAccount.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.unique-id" => Some(("serviceAccount.uniqueId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.email" => Some(("serviceAccount.email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.name" => Some(("serviceAccount.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "display-name", "email", "etag", "name", "oauth2-client-id", "project-id", "service-account", "unique-id", "update-mask"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PatchServiceAccountRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().service_accounts_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_service_accounts_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -2104,6 +2368,90 @@ impl<'n> Engine<'n> { } } + fn _projects_service_accounts_undelete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UndeleteServiceAccountRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().service_accounts_undelete(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_service_accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -2129,13 +2477,15 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "oauth2-client-id" => Some(("oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "unique-id" => Some(("uniqueId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["display-name", "email", "etag", "name", "oauth2-client-id", "project-id", "unique-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "display-name", "email", "etag", "name", "oauth2-client-id", "project-id", "unique-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2485,6 +2835,12 @@ impl<'n> Engine<'n> { ("service-accounts-delete", Some(opt)) => { call_result = self._projects_service_accounts_delete(opt, dry_run, &mut err); }, + ("service-accounts-disable", Some(opt)) => { + call_result = self._projects_service_accounts_disable(opt, dry_run, &mut err); + }, + ("service-accounts-enable", Some(opt)) => { + call_result = self._projects_service_accounts_enable(opt, dry_run, &mut err); + }, ("service-accounts-get", Some(opt)) => { call_result = self._projects_service_accounts_get(opt, dry_run, &mut err); }, @@ -2506,6 +2862,9 @@ impl<'n> Engine<'n> { ("service-accounts-list", Some(opt)) => { call_result = self._projects_service_accounts_list(opt, dry_run, &mut err); }, + ("service-accounts-patch", Some(opt)) => { + call_result = self._projects_service_accounts_patch(opt, dry_run, &mut err); + }, ("service-accounts-set-iam-policy", Some(opt)) => { call_result = self._projects_service_accounts_set_iam_policy(opt, dry_run, &mut err); }, @@ -2518,6 +2877,9 @@ impl<'n> Engine<'n> { ("service-accounts-test-iam-permissions", Some(opt)) => { call_result = self._projects_service_accounts_test_iam_permissions(opt, dry_run, &mut err); }, + ("service-accounts-undelete", Some(opt)) => { + call_result = self._projects_service_accounts_undelete(opt, dry_run, &mut err); + }, ("service-accounts-update", Some(opt)) => { call_result = self._projects_service_accounts_update(opt, dry_run, &mut err); }, @@ -2900,7 +3262,7 @@ fn main() { ]), ]), - ("projects", "methods: 'roles-create', 'roles-delete', 'roles-get', 'roles-list', 'roles-patch', 'roles-undelete', 'service-accounts-create', 'service-accounts-delete', 'service-accounts-get', 'service-accounts-get-iam-policy', 'service-accounts-keys-create', 'service-accounts-keys-delete', 'service-accounts-keys-get', 'service-accounts-keys-list', 'service-accounts-list', 'service-accounts-set-iam-policy', 'service-accounts-sign-blob', 'service-accounts-sign-jwt', 'service-accounts-test-iam-permissions' and 'service-accounts-update'", vec![ + ("projects", "methods: 'roles-create', 'roles-delete', 'roles-get', 'roles-list', 'roles-patch', 'roles-undelete', 'service-accounts-create', 'service-accounts-delete', 'service-accounts-disable', 'service-accounts-enable', 'service-accounts-get', 'service-accounts-get-iam-policy', 'service-accounts-keys-create', 'service-accounts-keys-delete', 'service-accounts-keys-get', 'service-accounts-keys-list', 'service-accounts-list', 'service-accounts-patch', 'service-accounts-set-iam-policy', 'service-accounts-sign-blob', 'service-accounts-sign-jwt', 'service-accounts-test-iam-permissions', 'service-accounts-undelete' and 'service-accounts-update'", vec![ ("roles-create", Some(r##"Creates a new Role."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_roles-create", @@ -3122,6 +3484,71 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-disable", + Some(r##"Disables a ServiceAccount. + The API is currently in alpha phase."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-disable", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account in the following format: + `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. + Using `-` as a wildcard for the `PROJECT_ID` will infer the project from + the account. The `ACCOUNT` value can be the `email` address or the + `unique_id` of the service account."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-enable", + Some(r##"Enables a ServiceAccount. + The API is currently in alpha phase."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-enable", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account in the following format: + `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}'. + Using `-` as a wildcard for the `PROJECT_ID` will infer the project from + the account."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -3155,8 +3582,21 @@ fn main() { Some(false)), ]), ("service-accounts-get-iam-policy", - Some(r##"Returns the IAM access control policy for a - ServiceAccount."##), + Some(r##"Returns the Cloud IAM access control policy for a + ServiceAccount. + + Note: Service accounts are both + [resources and + identities](/iam/docs/service-accounts#service_account_permissions). This + method treats the service account as a resource. It returns the Cloud IAM + policy that reflects what members have access to the service account. + + This method does not return what resources the service account has access + to. To see if a service account has access to a resource, call the + `getIamPolicy` method on the target resource. For example, to view grants + for a project, call the + [projects.getIamPolicy](/resource-manager/reference/rest/v1/projects/getIamPolicy) + method."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-get-iam-policy", vec![ (Some(r##"resource"##), @@ -3309,6 +3749,50 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-patch", + Some(r##"Patches a ServiceAccount. + + Currently, only the following fields are updatable: + `display_name` and `description`. + + Only fields specified in the request are guaranteed to be returned in + the response. Other fields in the response may be empty. + + Note: The field mask is required."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account in the following format: + `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. + + Requests using `-` as a wildcard for the `PROJECT_ID` will infer the + project from the `account` and the `ACCOUNT` value can be the `email` + address or the `unique_id` of the service account. + + In responses the resource name will always be in the format + `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -3316,8 +3800,22 @@ fn main() { Some(false)), ]), ("service-accounts-set-iam-policy", - Some(r##"Sets the IAM access control policy for a - ServiceAccount."##), + Some(r##"Sets the Cloud IAM access control policy for a + ServiceAccount. + + Note: Service accounts are both + [resources and + identities](/iam/docs/service-accounts#service_account_permissions). This + method treats the service account as a resource. Use it to grant members + access to the service account, such as when they need to impersonate it. + + This method does not grant the service account access to other resources, + such as projects. To grant a service account access to resources, include + the service account in the Cloud IAM policy for the desired resource, then + call the appropriate `setIamPolicy` method on the target resource. For + example, to grant a service account access to a project, call the + [projects.setIamPolicy](/resource-manager/reference/rest/v1/projects/setIamPolicy) + method."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-set-iam-policy", vec![ (Some(r##"resource"##), @@ -3346,7 +3844,11 @@ fn main() { Some(false)), ]), ("service-accounts-sign-blob", - Some(r##"Signs a blob using a service account's system-managed private key."##), + Some(r##"**Note**: This method is in the process of being deprecated. Call the + [`signBlob()`](/iam/credentials/reference/rest/v1/projects.serviceAccounts/signBlob) + method of the Cloud IAM Service Account Credentials API instead. + + Signs a blob using a service account's system-managed private key."##), "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-sign-blob", vec![ (Some(r##"name"##), @@ -3378,7 +3880,11 @@ fn main() { Some(false)), ]), ("service-accounts-sign-jwt", - Some(r##"Signs a JWT using a service account's system-managed private key. + Some(r##"**Note**: This method is in the process of being deprecated. Call the + [`signJwt()`](/iam/credentials/reference/rest/v1/projects.serviceAccounts/signJwt) + method of the Cloud IAM Service Account Credentials API instead. + + Signs a JWT using a service account's system-managed private key. If no expiry time (`exp`) is provided in the `SignJwtRequest`, IAM sets an an expiry time of one hour by default. If you request an expiry time of @@ -3437,6 +3943,39 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-undelete", + Some(r##"Restores a deleted ServiceAccount. + This is to be used as an action of last resort. A service account may + not always be restorable."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-undelete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account in the following format: + `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}'. + Using `-` as a wildcard for the `PROJECT_ID` will infer the project from + the account."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -3444,7 +3983,10 @@ fn main() { Some(false)), ]), ("service-accounts-update", - Some(r##"Updates a ServiceAccount. + Some(r##"Note: This method is in the process of being deprecated. Use + PatchServiceAccount instead. + + Updates a ServiceAccount. Currently, only the following fields are updatable: `display_name` . @@ -3557,7 +4099,7 @@ fn main() { let mut app = App::new("iam1") .author("Sebastian Thiel ") - .version("1.0.8+20181005") + .version("1.0.8+20190321") .about("Manages identity and access control for Google Cloud Platform resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_iam1_cli") .arg(Arg::with_name("url") diff --git a/gen/iam1/Cargo.toml b/gen/iam1/Cargo.toml index 170e2faf9b..9021a30bae 100644 --- a/gen/iam1/Cargo.toml +++ b/gen/iam1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-iam1" -version = "1.0.8+20181005" +version = "1.0.8+20190321" authors = ["Sebastian Thiel "] description = "A complete library to interact with iam (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iam1" homepage = "https://cloud.google.com/iam/" -documentation = "https://docs.rs/google-iam1/1.0.8+20181005" +documentation = "https://docs.rs/google-iam1/1.0.8+20190321" license = "MIT" keywords = ["iam", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/iam1/README.md b/gen/iam1/README.md index 97871c3a91..d58adb57dc 100644 --- a/gen/iam1/README.md +++ b/gen/iam1/README.md @@ -5,24 +5,24 @@ DO NOT EDIT ! --> The `google-iam1` library allows access to all features of the *Google iam* service. -This documentation was generated from *iam* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *iam* crate version *1.0.8+20190321*, where *20190321* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *iam* *v1* API can be found at the [official documentation site](https://cloud.google.com/iam/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.Iam.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.Iam.html) ... * iam policies - * [*lint policy*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.IamPolicyLintPolicyCall.html) and [*query auditable services*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.IamPolicyQueryAuditableServiceCall.html) + * [*lint policy*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.IamPolicyLintPolicyCall.html) and [*query auditable services*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.IamPolicyQueryAuditableServiceCall.html) * organizations - * [*roles create*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.OrganizationRoleCreateCall.html), [*roles delete*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.OrganizationRoleDeleteCall.html), [*roles get*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.OrganizationRoleGetCall.html), [*roles list*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.OrganizationRoleListCall.html), [*roles patch*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.OrganizationRolePatchCall.html) and [*roles undelete*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.OrganizationRoleUndeleteCall.html) -* [permissions](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.Permission.html) - * [*query testable permissions*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.PermissionQueryTestablePermissionCall.html) + * [*roles create*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.OrganizationRoleCreateCall.html), [*roles delete*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.OrganizationRoleDeleteCall.html), [*roles get*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.OrganizationRoleGetCall.html), [*roles list*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.OrganizationRoleListCall.html), [*roles patch*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.OrganizationRolePatchCall.html) and [*roles undelete*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.OrganizationRoleUndeleteCall.html) +* [permissions](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.Permission.html) + * [*query testable permissions*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.PermissionQueryTestablePermissionCall.html) * projects - * [*roles create*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectRoleCreateCall.html), [*roles delete*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectRoleDeleteCall.html), [*roles get*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectRoleGetCall.html), [*roles list*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectRoleListCall.html), [*roles patch*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectRolePatchCall.html), [*roles undelete*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectRoleUndeleteCall.html), [*service accounts create*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountCreateCall.html), [*service accounts delete*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountDeleteCall.html), [*service accounts get*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountGetCall.html), [*service accounts get iam policy*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountGetIamPolicyCall.html), [*service accounts keys create*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountKeyCreateCall.html), [*service accounts keys delete*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountKeyDeleteCall.html), [*service accounts keys get*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountKeyGetCall.html), [*service accounts keys list*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountKeyListCall.html), [*service accounts list*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountListCall.html), [*service accounts set iam policy*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountSetIamPolicyCall.html), [*service accounts sign blob*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountSignBlobCall.html), [*service accounts sign jwt*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountSignJwtCall.html), [*service accounts test iam permissions*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountTestIamPermissionCall.html) and [*service accounts update*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.ProjectServiceAccountUpdateCall.html) -* [roles](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.Role.html) - * [*get*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.RoleGetCall.html), [*list*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.RoleListCall.html) and [*query grantable roles*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.RoleQueryGrantableRoleCall.html) + * [*roles create*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectRoleCreateCall.html), [*roles delete*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectRoleDeleteCall.html), [*roles get*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectRoleGetCall.html), [*roles list*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectRoleListCall.html), [*roles patch*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectRolePatchCall.html), [*roles undelete*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectRoleUndeleteCall.html), [*service accounts create*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountCreateCall.html), [*service accounts delete*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountDeleteCall.html), [*service accounts disable*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountDisableCall.html), [*service accounts enable*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountEnableCall.html), [*service accounts get*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountGetCall.html), [*service accounts get iam policy*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountGetIamPolicyCall.html), [*service accounts keys create*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountKeyCreateCall.html), [*service accounts keys delete*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountKeyDeleteCall.html), [*service accounts keys get*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountKeyGetCall.html), [*service accounts keys list*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountKeyListCall.html), [*service accounts list*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountListCall.html), [*service accounts patch*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountPatchCall.html), [*service accounts set iam policy*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountSetIamPolicyCall.html), [*service accounts sign blob*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountSignBlobCall.html), [*service accounts sign jwt*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountSignJwtCall.html), [*service accounts test iam permissions*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountTestIamPermissionCall.html), [*service accounts undelete*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountUndeleteCall.html) and [*service accounts update*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.ProjectServiceAccountUpdateCall.html) +* [roles](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.Role.html) + * [*get*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.RoleGetCall.html), [*list*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.RoleListCall.html) and [*query grantable roles*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.RoleQueryGrantableRoleCall.html) @@ -31,17 +31,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/struct.Iam.html)** +* **[Hub](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/struct.Iam.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.Part.html)** + * **[Parts](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -149,17 +149,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -169,29 +169,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-iam1/1.0.8+20181005/google_iam1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-iam1/1.0.8+20190321/google_iam1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/iam1/src/lib.rs b/gen/iam1/src/lib.rs index c8a077a20f..7d682619be 100644 --- a/gen/iam1/src/lib.rs +++ b/gen/iam1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *iam* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *iam* crate version *1.0.8+20190321*, where *20190321* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *iam* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/iam/). @@ -18,7 +18,7 @@ //! * [permissions](struct.Permission.html) //! * [*query testable permissions*](struct.PermissionQueryTestablePermissionCall.html) //! * projects -//! * [*roles create*](struct.ProjectRoleCreateCall.html), [*roles delete*](struct.ProjectRoleDeleteCall.html), [*roles get*](struct.ProjectRoleGetCall.html), [*roles list*](struct.ProjectRoleListCall.html), [*roles patch*](struct.ProjectRolePatchCall.html), [*roles undelete*](struct.ProjectRoleUndeleteCall.html), [*service accounts create*](struct.ProjectServiceAccountCreateCall.html), [*service accounts delete*](struct.ProjectServiceAccountDeleteCall.html), [*service accounts get*](struct.ProjectServiceAccountGetCall.html), [*service accounts get iam policy*](struct.ProjectServiceAccountGetIamPolicyCall.html), [*service accounts keys create*](struct.ProjectServiceAccountKeyCreateCall.html), [*service accounts keys delete*](struct.ProjectServiceAccountKeyDeleteCall.html), [*service accounts keys get*](struct.ProjectServiceAccountKeyGetCall.html), [*service accounts keys list*](struct.ProjectServiceAccountKeyListCall.html), [*service accounts list*](struct.ProjectServiceAccountListCall.html), [*service accounts set iam policy*](struct.ProjectServiceAccountSetIamPolicyCall.html), [*service accounts sign blob*](struct.ProjectServiceAccountSignBlobCall.html), [*service accounts sign jwt*](struct.ProjectServiceAccountSignJwtCall.html), [*service accounts test iam permissions*](struct.ProjectServiceAccountTestIamPermissionCall.html) and [*service accounts update*](struct.ProjectServiceAccountUpdateCall.html) +//! * [*roles create*](struct.ProjectRoleCreateCall.html), [*roles delete*](struct.ProjectRoleDeleteCall.html), [*roles get*](struct.ProjectRoleGetCall.html), [*roles list*](struct.ProjectRoleListCall.html), [*roles patch*](struct.ProjectRolePatchCall.html), [*roles undelete*](struct.ProjectRoleUndeleteCall.html), [*service accounts create*](struct.ProjectServiceAccountCreateCall.html), [*service accounts delete*](struct.ProjectServiceAccountDeleteCall.html), [*service accounts disable*](struct.ProjectServiceAccountDisableCall.html), [*service accounts enable*](struct.ProjectServiceAccountEnableCall.html), [*service accounts get*](struct.ProjectServiceAccountGetCall.html), [*service accounts get iam policy*](struct.ProjectServiceAccountGetIamPolicyCall.html), [*service accounts keys create*](struct.ProjectServiceAccountKeyCreateCall.html), [*service accounts keys delete*](struct.ProjectServiceAccountKeyDeleteCall.html), [*service accounts keys get*](struct.ProjectServiceAccountKeyGetCall.html), [*service accounts keys list*](struct.ProjectServiceAccountKeyListCall.html), [*service accounts list*](struct.ProjectServiceAccountListCall.html), [*service accounts patch*](struct.ProjectServiceAccountPatchCall.html), [*service accounts set iam policy*](struct.ProjectServiceAccountSetIamPolicyCall.html), [*service accounts sign blob*](struct.ProjectServiceAccountSignBlobCall.html), [*service accounts sign jwt*](struct.ProjectServiceAccountSignJwtCall.html), [*service accounts test iam permissions*](struct.ProjectServiceAccountTestIamPermissionCall.html), [*service accounts undelete*](struct.ProjectServiceAccountUndeleteCall.html) and [*service accounts update*](struct.ProjectServiceAccountUpdateCall.html) //! * [roles](struct.Role.html) //! * [*get*](struct.RoleGetCall.html), [*list*](struct.RoleListCall.html) and [*query grantable roles*](struct.RoleQueryGrantableRoleCall.html) //! @@ -584,14 +584,8 @@ impl ResponseResult for QueryTestablePermissionsResponse {} pub struct Role { /// Used to perform a consistent read-modify-write. pub etag: Option, - /// The name of the role. - /// - /// When Role is used in CreateRole, the role name must not be set. - /// - /// When Role is used in output and other input such as UpdateRole, the role - /// name is the complete path, e.g., roles/logging.viewer for curated roles - /// and organizations/{ORGANIZATION_ID}/roles/logging.viewer for custom roles. - pub name: Option, + /// Optional. A human-readable description for the role. + pub description: Option, /// Optional. A human-readable title for the role. Typically this /// is limited to 100 UTF-8 bytes. pub title: Option, @@ -605,8 +599,14 @@ pub struct Role { /// selected for a role, the `stage` field will not be included in the /// returned definition for the role. pub stage: Option, - /// Optional. A human-readable description for the role. - pub description: Option, + /// The name of the role. + /// + /// When Role is used in CreateRole, the role name must not be set. + /// + /// When Role is used in output and other input such as UpdateRole, the role + /// name is the complete path, e.g., roles/logging.viewer for curated roles + /// and organizations/{ORGANIZATION_ID}/roles/logging.viewer for custom roles. + pub name: Option, } impl RequestValue for Role {} @@ -693,9 +693,9 @@ impl ResponseResult for ListServiceAccountsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { - /// Associates a list of `members` to a `role`. - /// `bindings` with no members will result in an error. - pub bindings: Option>, + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, /// `etag` is used for optimistic concurrency control as a way to help /// prevent simultaneous updates of a policy from overwriting each other. /// It is strongly suggested that systems make use of the `etag` in the @@ -707,9 +707,9 @@ pub struct Policy { /// If no `etag` is provided in the call to `setIamPolicy`, then the existing /// policy is overwritten blindly. pub etag: Option, - /// Specifies cloud audit logging configuration for this policy. - #[serde(rename="auditConfigs")] - pub audit_configs: Option>, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, /// Deprecated. pub version: Option, } @@ -749,6 +749,25 @@ pub struct QueryGrantableRolesRequest { impl RequestValue for QueryGrantableRolesRequest {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts undelete projects](struct.ProjectServiceAccountUndeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UndeleteServiceAccountResponse { + /// Metadata for the restored service account. + #[serde(rename="restoredAccount")] + pub restored_account: Option, +} + +impl ResponseResult for UndeleteServiceAccountResponse {} + + /// A generic empty message that you can re-use to avoid defining duplicated /// empty messages in your APIs. A typical example is to use it as the request /// or the response type of an API method. For instance: @@ -764,8 +783,10 @@ impl RequestValue for QueryGrantableRolesRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// +/// * [service accounts disable projects](struct.ProjectServiceAccountDisableCall.html) (response) /// * [service accounts delete projects](struct.ProjectServiceAccountDeleteCall.html) (response) /// * [service accounts keys delete projects](struct.ProjectServiceAccountKeyDeleteCall.html) (response) +/// * [service accounts enable projects](struct.ProjectServiceAccountEnableCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Empty { _never_set: Option } @@ -773,6 +794,21 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} +/// The service account enable request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts enable projects](struct.ProjectServiceAccountEnableCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EnableServiceAccountRequest { _never_set: Option } + +impl RequestValue for EnableServiceAccountRequest {} + + /// Response message for `TestIamPermissions` method. /// /// # Activities @@ -792,6 +828,21 @@ pub struct TestIamPermissionsResponse { impl ResponseResult for TestIamPermissionsResponse {} +/// The service account undelete request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts undelete projects](struct.ProjectServiceAccountUndeleteCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UndeleteServiceAccountRequest { _never_set: Option } + +impl RequestValue for UndeleteServiceAccountRequest {} + + /// A permission which can be included by a role. /// /// # Activities @@ -808,23 +859,45 @@ pub struct Permission { pub api_disabled: Option, /// A brief description of what this Permission is used for. pub description: Option, - /// The name of this Permission. - pub name: Option, /// The title of this Permission. pub title: Option, + /// The current launch stage of the permission. + pub stage: Option, /// This permission can ONLY be used in predefined roles. #[serde(rename="onlyInPredefinedRoles")] pub only_in_predefined_roles: Option, /// The current custom role support level. #[serde(rename="customRolesSupportLevel")] pub custom_roles_support_level: Option, - /// The current launch stage of the permission. - pub stage: Option, + /// The name of this Permission. + pub name: Option, } impl Resource for Permission {} +/// The patch service account request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts patch projects](struct.ProjectServiceAccountPatchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PatchServiceAccountRequest { + /// no description provided + #[serde(rename="serviceAccount")] + pub service_account: Option, + /// no description provided + #[serde(rename="updateMask")] + pub update_mask: Option, +} + +impl RequestValue for PatchServiceAccountRequest {} + + /// The response containing the roles defined under a resource. /// /// # Activities @@ -1035,10 +1108,9 @@ impl RequestValue for TestIamPermissionsRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// @@ -1048,9 +1120,10 @@ pub struct Expr { /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} @@ -1079,6 +1152,7 @@ impl Part for Expr {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [service accounts update projects](struct.ProjectServiceAccountUpdateCall.html) (request|response) +/// * [service accounts patch projects](struct.ProjectServiceAccountPatchCall.html) (response) /// * [service accounts get projects](struct.ProjectServiceAccountGetCall.html) (response) /// * [service accounts create projects](struct.ProjectServiceAccountCreateCall.html) (response) /// @@ -1089,13 +1163,27 @@ pub struct ServiceAccount { /// three legged OAuth2 (3LO) flows to access the data of Google users. #[serde(rename="oauth2ClientId")] pub oauth2_client_id: Option, - /// Optional. Note: `etag` is an inoperable legacy field that is only returned - /// for backwards compatibility. - pub etag: Option, /// Optional. A user-specified name for the service account. /// Must be less than or equal to 100 UTF-8 bytes. #[serde(rename="displayName")] pub display_name: Option, + /// Optional. A user-specified opaque description of the service account. + /// Must be less than or equal to 256 UTF-8 bytes. + pub description: Option, + /// @OutputOnly The id of the project that owns the service account. + #[serde(rename="projectId")] + pub project_id: Option, + /// @OutputOnly A bool indicate if the service account is disabled. + /// The field is currently in alpha phase. + pub disabled: Option, + /// Optional. Note: `etag` is an inoperable legacy field that is only returned + /// for backwards compatibility. + pub etag: Option, + /// @OutputOnly The unique and stable id of the service account. + #[serde(rename="uniqueId")] + pub unique_id: Option, + /// @OutputOnly The email address of the service account. + pub email: Option, /// The resource name of the service account in the following format: /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. /// @@ -1106,14 +1194,6 @@ pub struct ServiceAccount { /// In responses the resource name will always be in the format /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. pub name: Option, - /// @OutputOnly The unique and stable id of the service account. - #[serde(rename="uniqueId")] - pub unique_id: Option, - /// @OutputOnly The id of the project that owns the service account. - #[serde(rename="projectId")] - pub project_id: Option, - /// @OutputOnly The email address of the service account. - pub email: Option, } impl RequestValue for ServiceAccount {} @@ -1151,6 +1231,21 @@ pub struct QueryTestablePermissionsRequest { impl RequestValue for QueryTestablePermissionsRequest {} +/// The service account disable request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts disable projects](struct.ProjectServiceAccountDisableCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DisableServiceAccountRequest { _never_set: Option } + +impl RequestValue for DisableServiceAccountRequest {} + + /// The service account sign blob request. /// /// # Activities @@ -1201,12 +1296,12 @@ pub struct LintPolicyRequest { /// not yet implemented and if this field is set, it returns NOT_IMPLEMENTED /// error. pub binding: Option, + /// google.iam.v1.Binding.condition object to be linted. + pub condition: Option, /// `context` contains additional *permission-controlled* data that any /// lint unit may depend on, in form of `{key: value}` pairs. Currently, this /// field is non-operational and it will not be used during the lint operation. pub context: Option>, - /// google.iam.v1.Binding.condition object to be linted. - pub condition: Option, } impl RequestValue for LintPolicyRequest {} @@ -1223,8 +1318,8 @@ impl RequestValue for LintPolicyRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreateServiceAccountRequest { - /// The ServiceAccount resource to create. - /// Currently, only the following values are user assignable: + /// The ServiceAccount resource to + /// create. Currently, only the following values are user assignable: /// `display_name` . #[serde(rename="serviceAccount")] pub service_account: Option, @@ -1270,7 +1365,7 @@ pub struct Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, - /// Unimplemented. The condition that is associated with this binding. + /// The condition that is associated with this binding. /// NOTE: an unsatisfied condition will not allow user access via current /// binding. Different bindings, including their conditions, are examined /// independently. @@ -1295,7 +1390,7 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// @@ -1334,20 +1429,12 @@ impl Part for Binding {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ServiceAccountKey { - /// The output format for the private key. - /// Only provided in `CreateServiceAccountKey` responses, not - /// in `GetServiceAccountKey` or `ListServiceAccountKey` responses. - /// - /// Google never exposes system-managed private keys, and never retains - /// user-managed private keys. - #[serde(rename="privateKeyType")] - pub private_key_type: Option, - /// The key can be used after this timestamp. - #[serde(rename="validAfterTime")] - pub valid_after_time: Option, /// Specifies the algorithm (and possibly key size) for the key. #[serde(rename="keyAlgorithm")] pub key_algorithm: Option, + /// The key can be used after this timestamp. + #[serde(rename="validAfterTime")] + pub valid_after_time: Option, /// The private key data. Only provided in `CreateServiceAccountKey` /// responses. Make sure to keep the private key data secure because it /// allows for the assertion of the service account identity. @@ -1357,6 +1444,14 @@ pub struct ServiceAccountKey { /// auth activate-service-account. #[serde(rename="privateKeyData")] pub private_key_data: Option, + /// The output format for the private key. + /// Only provided in `CreateServiceAccountKey` responses, not + /// in `GetServiceAccountKey` or `ListServiceAccountKey` responses. + /// + /// Google never exposes system-managed private keys, and never retains + /// user-managed private keys. + #[serde(rename="privateKeyType")] + pub private_key_type: Option, /// The key can be used before this timestamp. #[serde(rename="validBeforeTime")] pub valid_before_time: Option, @@ -1895,7 +1990,7 @@ impl<'a, C, A> RoleMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Iam::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `roles_create(...)`, `roles_delete(...)`, `roles_get(...)`, `roles_list(...)`, `roles_patch(...)`, `roles_undelete(...)`, `service_accounts_create(...)`, `service_accounts_delete(...)`, `service_accounts_get(...)`, `service_accounts_get_iam_policy(...)`, `service_accounts_keys_create(...)`, `service_accounts_keys_delete(...)`, `service_accounts_keys_get(...)`, `service_accounts_keys_list(...)`, `service_accounts_list(...)`, `service_accounts_set_iam_policy(...)`, `service_accounts_sign_blob(...)`, `service_accounts_sign_jwt(...)`, `service_accounts_test_iam_permissions(...)` and `service_accounts_update(...)` +/// // like `roles_create(...)`, `roles_delete(...)`, `roles_get(...)`, `roles_list(...)`, `roles_patch(...)`, `roles_undelete(...)`, `service_accounts_create(...)`, `service_accounts_delete(...)`, `service_accounts_disable(...)`, `service_accounts_enable(...)`, `service_accounts_get(...)`, `service_accounts_get_iam_policy(...)`, `service_accounts_keys_create(...)`, `service_accounts_keys_delete(...)`, `service_accounts_keys_get(...)`, `service_accounts_keys_list(...)`, `service_accounts_list(...)`, `service_accounts_patch(...)`, `service_accounts_set_iam_policy(...)`, `service_accounts_sign_blob(...)`, `service_accounts_sign_jwt(...)`, `service_accounts_test_iam_permissions(...)`, `service_accounts_undelete(...)` and `service_accounts_update(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -1953,9 +2048,45 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns the IAM access control policy for a + /// Enables a ServiceAccount. + /// The API is currently in alpha phase. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the service account in the following format: + /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}'. + /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from + /// the account. + pub fn service_accounts_enable(&self, request: EnableServiceAccountRequest, name: &str) -> ProjectServiceAccountEnableCall<'a, C, A> { + ProjectServiceAccountEnableCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the Cloud IAM access control policy for a /// ServiceAccount. /// + /// Note: Service accounts are both + /// [resources and + /// identities](/iam/docs/service-accounts#service_account_permissions). This + /// method treats the service account as a resource. It returns the Cloud IAM + /// policy that reflects what members have access to the service account. + /// + /// This method does not return what resources the service account has access + /// to. To see if a service account has access to a resource, call the + /// `getIamPolicy` method on the target resource. For example, to view grants + /// for a project, call the + /// [projects.getIamPolicy](/resource-manager/reference/rest/v1/projects/getIamPolicy) + /// method. + /// /// # Arguments /// /// * `resource` - REQUIRED: The resource for which the policy is being requested. @@ -2040,6 +2171,10 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// + /// **Note**: This method is in the process of being deprecated. Call the + /// [`signBlob()`](/iam/credentials/reference/rest/v1/projects.serviceAccounts/signBlob) + /// method of the Cloud IAM Service Account Credentials API instead. + /// /// Signs a blob using a service account's system-managed private key. /// /// # Arguments @@ -2063,9 +2198,23 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the IAM access control policy for a + /// Sets the Cloud IAM access control policy for a /// ServiceAccount. /// + /// Note: Service accounts are both + /// [resources and + /// identities](/iam/docs/service-accounts#service_account_permissions). This + /// method treats the service account as a resource. Use it to grant members + /// access to the service account, such as when they need to impersonate it. + /// + /// This method does not grant the service account access to other resources, + /// such as projects. To grant a service account access to resources, include + /// the service account in the Cloud IAM policy for the desired resource, then + /// call the appropriate `setIamPolicy` method on the target resource. For + /// example, to grant a service account access to a project, call the + /// [projects.setIamPolicy](/resource-manager/reference/rest/v1/projects/setIamPolicy) + /// method. + /// /// # Arguments /// /// * `request` - No description provided. @@ -2124,6 +2273,39 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Patches a ServiceAccount. + /// + /// Currently, only the following fields are updatable: + /// `display_name` and `description`. + /// + /// Only fields specified in the request are guaranteed to be returned in + /// the response. Other fields in the response may be empty. + /// + /// Note: The field mask is required. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the service account in the following format: + /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. + /// Requests using `-` as a wildcard for the `PROJECT_ID` will infer the + /// project from the `account` and the `ACCOUNT` value can be the `email` + /// address or the `unique_id` of the service account. + /// In responses the resource name will always be in the format + /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. + pub fn service_accounts_patch(&self, request: PatchServiceAccountRequest, name: &str) -> ProjectServiceAccountPatchCall<'a, C, A> { + ProjectServiceAccountPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates a Role definition. @@ -2168,6 +2350,30 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Disables a ServiceAccount. + /// The API is currently in alpha phase. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the service account in the following format: + /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. + /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from + /// the account. The `ACCOUNT` value can be the `email` address or the + /// `unique_id` of the service account. + pub fn service_accounts_disable(&self, request: DisableServiceAccountRequest, name: &str) -> ProjectServiceAccountDisableCall<'a, C, A> { + ProjectServiceAccountDisableCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Lists the Roles defined on a resource. @@ -2194,6 +2400,33 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// + /// Restores a deleted ServiceAccount. + /// This is to be used as an action of last resort. A service account may + /// not always be restorable. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the service account in the following format: + /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}'. + /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from + /// the account. + pub fn service_accounts_undelete(&self, request: UndeleteServiceAccountRequest, name: &str) -> ProjectServiceAccountUndeleteCall<'a, C, A> { + ProjectServiceAccountUndeleteCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Note: This method is in the process of being deprecated. Use + /// PatchServiceAccount instead. + /// /// Updates a ServiceAccount. /// /// Currently, only the following fields are updatable: @@ -2223,6 +2456,10 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// + /// **Note**: This method is in the process of being deprecated. Call the + /// [`signJwt()`](/iam/credentials/reference/rest/v1/projects.serviceAccounts/signJwt) + /// method of the Cloud IAM Service Account Credentials API instead. + /// /// Signs a JWT using a service account's system-managed private key. /// /// If no expiry time (`exp`) is provided in the `SignJwtRequest`, IAM sets an @@ -2513,7 +2750,7 @@ impl<'a, C, A> OrganizationRoleGetCall<'a, C, A> where C: BorrowMut OrganizationRoleGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2552,7 +2786,7 @@ impl<'a, C, A> OrganizationRoleGetCall<'a, C, A> where C: BorrowMut OrganizationRoleGetCall<'a, C, A> where C: BorrowMut OrganizationRoleUndeleteCall<'a, C, A> where C: BorrowMut OrganizationRoleUndeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2825,7 +3056,7 @@ impl<'a, C, A> OrganizationRoleUndeleteCall<'a, C, A> where C: BorrowMut OrganizationRoleUndeleteCall<'a, C, A> where C: BorrowMut OrganizationRoleDeleteCall<'a, C, A> where C: BorrowMut OrganizationRoleDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3101,7 +3329,7 @@ impl<'a, C, A> OrganizationRoleDeleteCall<'a, C, A> where C: BorrowMut OrganizationRoleDeleteCall<'a, C, A> where C: BorrowMut OrganizationRoleCreateCall<'a, C, A> where C: BorrowMut OrganizationRoleCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3380,7 +3605,7 @@ impl<'a, C, A> OrganizationRoleCreateCall<'a, C, A> where C: BorrowMut OrganizationRoleCreateCall<'a, C, A> where C: BorrowMut OrganizationRolePatchCall<'a, C, A> where C: BorrowMut OrganizationRolePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3669,7 +3891,7 @@ impl<'a, C, A> OrganizationRolePatchCall<'a, C, A> where C: BorrowMut OrganizationRolePatchCall<'a, C, A> where C: BorrowMut OrganizationRoleListCall<'a, C, A> where C: BorrowMut OrganizationRoleListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3962,7 +4181,7 @@ impl<'a, C, A> OrganizationRoleListCall<'a, C, A> where C: BorrowMut OrganizationRoleListCall<'a, C, A> where C: BorrowMut OrganizationRoleListCall<'a, C, A> { @@ -4071,7 +4293,7 @@ impl<'a, C, A> OrganizationRoleListCall<'a, C, A> where C: BorrowMut IamPolicyQueryAuditableServiceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4237,7 +4456,7 @@ impl<'a, C, A> IamPolicyQueryAuditableServiceCall<'a, C, A> where C: BorrowMut IamPolicyQueryAuditableServiceCall<'a, C, A> where C: BorrowMut IamPolicyLintPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4505,7 +4721,7 @@ impl<'a, C, A> IamPolicyLintPolicyCall<'a, C, A> where C: BorrowMut IamPolicyLintPolicyCall<'a, C, A> where C: BorrowMut RoleGetCall<'a, C, A> where C: BorrowMut, A: oauth } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4735,10 +4951,7 @@ impl<'a, C, A> RoleGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4758,7 +4971,7 @@ impl<'a, C, A> RoleGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4839,7 +5052,7 @@ impl<'a, C, A> RoleGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4987,10 +5200,7 @@ impl<'a, C, A> RoleListCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5010,7 +5220,7 @@ impl<'a, C, A> RoleListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5063,7 +5273,10 @@ impl<'a, C, A> RoleListCall<'a, C, A> where C: BorrowMut, A: oaut } - /// Optional view for the returned Role objects. + /// Optional view for the returned Role objects. When `FULL` is specified, + /// the `includedPermissions` field is returned, which includes a list of all + /// permissions in the role. The default value is `BASIC`, which does not + /// return the `includedPermissions` field. /// /// Sets the *view* query property to the given value. pub fn view(mut self, new_value: &str) -> RoleListCall<'a, C, A> { @@ -5116,7 +5329,7 @@ impl<'a, C, A> RoleListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5248,10 +5461,7 @@ impl<'a, C, A> RoleQueryGrantableRoleCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5283,7 +5493,7 @@ impl<'a, C, A> RoleQueryGrantableRoleCall<'a, C, A> where C: BorrowMut RoleQueryGrantableRoleCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyDeleteCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5536,7 +5743,7 @@ impl<'a, C, A> ProjectServiceAccountKeyDeleteCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyDeleteCall<'a, C, A> where C: BorrowMut ProjectRoleGetCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5768,10 +5975,7 @@ impl<'a, C, A> ProjectRoleGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5791,7 +5995,7 @@ impl<'a, C, A> ProjectRoleGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5872,7 +6076,7 @@ impl<'a, C, A> ProjectRoleGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5920,8 +6124,304 @@ impl<'a, C, A> ProjectRoleGetCall<'a, C, A> where C: BorrowMut, A } -/// Returns the IAM access control policy for a +/// Enables a ServiceAccount. +/// The API is currently in alpha phase. +/// +/// A builder for the *serviceAccounts.enable* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// use iam1::EnableServiceAccountRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = EnableServiceAccountRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().service_accounts_enable(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountEnableCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: EnableServiceAccountRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountEnableCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountEnableCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.enable", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:enable"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: EnableServiceAccountRequest) -> ProjectServiceAccountEnableCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the service account in the following format: + /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}'. + /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from + /// the account. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectServiceAccountEnableCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectServiceAccountEnableCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountEnableCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectServiceAccountEnableCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the Cloud IAM access control policy for a /// ServiceAccount. +/// +/// Note: Service accounts are both +/// [resources and +/// identities](/iam/docs/service-accounts#service_account_permissions). This +/// method treats the service account as a resource. It returns the Cloud IAM +/// policy that reflects what members have access to the service account. +/// +/// This method does not return what resources the service account has access +/// to. To see if a service account has access to a resource, call the +/// `getIamPolicy` method on the target resource. For example, to view grants +/// for a project, call the +/// [projects.getIamPolicy](/resource-manager/reference/rest/v1/projects/getIamPolicy) +/// method. /// /// A builder for the *serviceAccounts.getIamPolicy* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -6007,7 +6507,7 @@ impl<'a, C, A> ProjectServiceAccountGetIamPolicyCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6023,10 +6523,7 @@ impl<'a, C, A> ProjectServiceAccountGetIamPolicyCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6046,7 +6543,7 @@ impl<'a, C, A> ProjectServiceAccountGetIamPolicyCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6125,7 +6622,7 @@ impl<'a, C, A> ProjectServiceAccountGetIamPolicyCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6266,7 +6763,7 @@ impl<'a, C, A> ProjectRoleUndeleteCall<'a, C, A> where C: BorrowMut ProjectRoleUndeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6317,7 +6811,7 @@ impl<'a, C, A> ProjectRoleUndeleteCall<'a, C, A> where C: BorrowMut ProjectRoleUndeleteCall<'a, C, A> where C: BorrowMut ProjectRoleUndeleteCall<'a, C, A> where C: BorrowMut ProjectRoleDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6570,10 +7064,7 @@ impl<'a, C, A> ProjectRoleDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6593,7 +7084,7 @@ impl<'a, C, A> ProjectRoleDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6680,7 +7171,7 @@ impl<'a, C, A> ProjectRoleDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6822,7 +7313,7 @@ impl<'a, C, A> ProjectServiceAccountTestIamPermissionCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6838,10 +7329,7 @@ impl<'a, C, A> ProjectServiceAccountTestIamPermissionCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6873,7 +7361,7 @@ impl<'a, C, A> ProjectServiceAccountTestIamPermissionCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6964,7 +7452,7 @@ impl<'a, C, A> ProjectServiceAccountTestIamPermissionCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7012,6 +7500,10 @@ impl<'a, C, A> ProjectServiceAccountTestIamPermissionCall<'a, C, A> where C: Bor } +/// **Note**: This method is in the process of being deprecated. Call the +/// [`signBlob()`](/iam/credentials/reference/rest/v1/projects.serviceAccounts/signBlob) +/// method of the Cloud IAM Service Account Credentials API instead. +/// /// Signs a blob using a service account's system-managed private key. /// /// A builder for the *serviceAccounts.signBlob* method supported by a *project* resource. @@ -7105,7 +7597,7 @@ impl<'a, C, A> ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7156,7 +7645,7 @@ impl<'a, C, A> ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSetIamPolicyCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7408,10 +7911,7 @@ impl<'a, C, A> ProjectServiceAccountSetIamPolicyCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7443,7 +7943,7 @@ impl<'a, C, A> ProjectServiceAccountSetIamPolicyCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7534,7 +8034,7 @@ impl<'a, C, A> ProjectServiceAccountSetIamPolicyCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7668,7 +8168,7 @@ impl<'a, C, A> ProjectServiceAccountDeleteCall<'a, C, A> where C: BorrowMut ProjectServiceAccountDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7707,7 +8204,7 @@ impl<'a, C, A> ProjectServiceAccountDeleteCall<'a, C, A> where C: BorrowMut ProjectServiceAccountDeleteCall<'a, C, A> where C: BorrowMut ProjectServiceAccountCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7982,7 +8476,7 @@ impl<'a, C, A> ProjectServiceAccountCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountCreateCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Iam::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = PatchServiceAccountRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().service_accounts_patch(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: PatchServiceAccountRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ServiceAccount)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: PatchServiceAccountRequest) -> ProjectServiceAccountPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the service account in the following format: + /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. + /// + /// Requests using `-` as a wildcard for the `PROJECT_ID` will infer the + /// project from the `account` and the `ACCOUNT` value can be the `email` + /// address or the `unique_id` of the service account. + /// + /// In responses the resource name will always be in the format + /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectServiceAccountPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectServiceAccountPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectServiceAccountPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates a Role definition. /// /// A builder for the *roles.patch* method supported by a *project* resource. @@ -8155,7 +8944,7 @@ impl<'a, C, A> ProjectServiceAccountCreateCall<'a, C, A> where C: BorrowMut ProjectRolePatchCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8235,10 +9024,7 @@ impl<'a, C, A> ProjectRolePatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8270,7 +9056,7 @@ impl<'a, C, A> ProjectRolePatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8370,7 +9156,7 @@ impl<'a, C, A> ProjectRolePatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8511,7 +9297,7 @@ impl<'a, C, A> ProjectRoleCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8527,10 +9313,7 @@ impl<'a, C, A> ProjectRoleCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8562,7 +9345,7 @@ impl<'a, C, A> ProjectRoleCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8654,7 +9437,7 @@ impl<'a, C, A> ProjectRoleCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8702,6 +9485,290 @@ impl<'a, C, A> ProjectRoleCreateCall<'a, C, A> where C: BorrowMut } +/// Disables a ServiceAccount. +/// The API is currently in alpha phase. +/// +/// A builder for the *serviceAccounts.disable* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// use iam1::DisableServiceAccountRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = DisableServiceAccountRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().service_accounts_disable(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountDisableCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: DisableServiceAccountRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountDisableCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountDisableCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.disable", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:disable"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: DisableServiceAccountRequest) -> ProjectServiceAccountDisableCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the service account in the following format: + /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`. + /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from + /// the account. The `ACCOUNT` value can be the `email` address or the + /// `unique_id` of the service account. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectServiceAccountDisableCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectServiceAccountDisableCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountDisableCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectServiceAccountDisableCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Lists the Roles defined on a resource. /// /// A builder for the *roles.list* method supported by a *project* resource. @@ -8730,10 +9797,10 @@ impl<'a, C, A> ProjectRoleCreateCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().roles_list("parent") -/// .view("sea") +/// .view("et") /// .show_deleted(true) -/// .page_token("duo") -/// .page_size(-21) +/// .page_token("sanctus") +/// .page_size(-22) /// .doit(); /// # } /// ``` @@ -8808,7 +9875,7 @@ impl<'a, C, A> ProjectRoleListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8824,10 +9891,7 @@ impl<'a, C, A> ProjectRoleListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8847,7 +9911,7 @@ impl<'a, C, A> ProjectRoleListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8913,7 +9977,10 @@ impl<'a, C, A> ProjectRoleListCall<'a, C, A> where C: BorrowMut, self._parent = new_value.to_string(); self } - /// Optional view for the returned Role objects. + /// Optional view for the returned Role objects. When `FULL` is specified, + /// the `includedPermissions` field is returned, which includes a list of all + /// permissions in the role. The default value is `BASIC`, which does not + /// return the `includedPermissions` field. /// /// Sets the *view* query property to the given value. pub fn view(mut self, new_value: &str) -> ProjectRoleListCall<'a, C, A> { @@ -8956,7 +10023,7 @@ impl<'a, C, A> ProjectRoleListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9004,6 +10071,293 @@ impl<'a, C, A> ProjectRoleListCall<'a, C, A> where C: BorrowMut, } +/// Restores a deleted ServiceAccount. +/// This is to be used as an action of last resort. A service account may +/// not always be restorable. +/// +/// A builder for the *serviceAccounts.undelete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// use iam1::UndeleteServiceAccountRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UndeleteServiceAccountRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().service_accounts_undelete(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountUndeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: UndeleteServiceAccountRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountUndeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountUndeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UndeleteServiceAccountResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.undelete", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UndeleteServiceAccountRequest) -> ProjectServiceAccountUndeleteCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the service account in the following format: + /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}'. + /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from + /// the account. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectServiceAccountUndeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectServiceAccountUndeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountUndeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectServiceAccountUndeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Note: This method is in the process of being deprecated. Use +/// PatchServiceAccount instead. +/// /// Updates a ServiceAccount. /// /// Currently, only the following fields are updatable: @@ -9101,7 +10455,7 @@ impl<'a, C, A> ProjectServiceAccountUpdateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9152,7 +10503,7 @@ impl<'a, C, A> ProjectServiceAccountUpdateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountUpdateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountUpdateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignJwtCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignJwtCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9446,7 +10798,7 @@ impl<'a, C, A> ProjectServiceAccountSignJwtCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignJwtCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignJwtCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9720,7 +11069,7 @@ impl<'a, C, A> ProjectServiceAccountKeyListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10006,7 +11352,7 @@ impl<'a, C, A> ProjectServiceAccountKeyCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyCreateCall<'a, C, A> where C: BorrowMut ProjectServiceAccountListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10283,7 +11626,7 @@ impl<'a, C, A> ProjectServiceAccountListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountListCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyGetCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10559,7 +11899,7 @@ impl<'a, C, A> ProjectServiceAccountKeyGetCall<'a, C, A> where C: BorrowMut ProjectServiceAccountKeyGetCall<'a, C, A> where C: BorrowMut ProjectServiceAccountGetCall<'a, C, A> where C: BorrowMut ProjectServiceAccountGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10823,7 +12160,7 @@ impl<'a, C, A> ProjectServiceAccountGetCall<'a, C, A> where C: BorrowMut ProjectServiceAccountGetCall<'a, C, A> where C: BorrowMut PermissionQueryTestablePermissionCall<'a, C, A> where C: BorrowMu } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11071,7 +12405,7 @@ impl<'a, C, A> PermissionQueryTestablePermissionCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11151,7 +12485,7 @@ impl<'a, C, A> PermissionQueryTestablePermissionCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/iamcredentials1-cli/Cargo.toml b/gen/iamcredentials1-cli/Cargo.toml index f64585b9cc..a3be23fe0f 100644 --- a/gen/iamcredentials1-cli/Cargo.toml +++ b/gen/iamcredentials1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-iamcredentials1-cli" -version = "1.0.8+20181004" +version = "1.0.8+20190329" authors = ["Sebastian Thiel "] description = "A complete library to interact with IAM Credentials (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iamcredentials1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-iamcredentials1] path = "../iamcredentials1" -version = "1.0.8+20181004" +version = "1.0.8+20190329" diff --git a/gen/iamcredentials1-cli/README.md b/gen/iamcredentials1-cli/README.md index 52f5b38aab..51cf353176 100644 --- a/gen/iamcredentials1-cli/README.md +++ b/gen/iamcredentials1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *IAM Credentials* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *IAM Credentials* API at revision *20190329*. The CLI is at version *1.0.8*. ```bash iamcredentials1 [options] diff --git a/gen/iamcredentials1-cli/mkdocs.yml b/gen/iamcredentials1-cli/mkdocs.yml index a0f21698f5..d31de9c247 100644 --- a/gen/iamcredentials1-cli/mkdocs.yml +++ b/gen/iamcredentials1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: IAM Credentials v1.0.8+20181004 +site_name: IAM Credentials v1.0.8+20190329 site_url: http://byron.github.io/google-apis-rs/google-iamcredentials1-cli site_description: A complete library to interact with IAM Credentials (protocol v1) diff --git a/gen/iamcredentials1-cli/src/main.rs b/gen/iamcredentials1-cli/src/main.rs index 531cb1c37f..95c5d350bf 100644 --- a/gen/iamcredentials1-cli/src/main.rs +++ b/gen/iamcredentials1-cli/src/main.rs @@ -326,8 +326,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "payload" => Some(("payload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "delegates" => Some(("delegates", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payload" => Some(("payload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["delegates", "payload"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -412,8 +412,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "payload" => Some(("payload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "delegates" => Some(("delegates", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payload" => Some(("payload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["delegates", "payload"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -597,7 +597,8 @@ fn main() { None, Some(r##"The resource name of the service account for which the credentials are requested, in the following format: - `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`."##), + `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + character is required; replacing it with a project ID is invalid."##), Some(true), Some(false)), @@ -627,7 +628,8 @@ fn main() { None, Some(r##"The resource name of the service account for which the credentials are requested, in the following format: - `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`."##), + `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + character is required; replacing it with a project ID is invalid."##), Some(true), Some(false)), @@ -657,7 +659,8 @@ fn main() { None, Some(r##"The resource name of the service account for which the credentials are requested, in the following format: - `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`."##), + `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + character is required; replacing it with a project ID is invalid."##), Some(true), Some(false)), @@ -687,7 +690,8 @@ fn main() { None, Some(r##"The resource name of the service account for which the credentials are requested, in the following format: - `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`."##), + `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + character is required; replacing it with a project ID is invalid."##), Some(true), Some(false)), @@ -717,7 +721,8 @@ fn main() { None, Some(r##"The resource name of the service account for which the credentials are requested, in the following format: - `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`."##), + `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + character is required; replacing it with a project ID is invalid."##), Some(true), Some(false)), @@ -745,8 +750,8 @@ fn main() { let mut app = App::new("iamcredentials1") .author("Sebastian Thiel ") - .version("1.0.8+20181004") - .about("IAM Service Account Credentials API") + .version("1.0.8+20190329") + .about("Creates short-lived, limited-privilege credentials for IAM service accounts.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_iamcredentials1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/iamcredentials1/Cargo.toml b/gen/iamcredentials1/Cargo.toml index ffd575b658..e5a9e4e636 100644 --- a/gen/iamcredentials1/Cargo.toml +++ b/gen/iamcredentials1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-iamcredentials1" -version = "1.0.8+20181004" +version = "1.0.8+20190329" authors = ["Sebastian Thiel "] description = "A complete library to interact with IAM Credentials (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iamcredentials1" homepage = "https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials" -documentation = "https://docs.rs/google-iamcredentials1/1.0.8+20181004" +documentation = "https://docs.rs/google-iamcredentials1/1.0.8+20190329" license = "MIT" keywords = ["iamcredentials", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/iamcredentials1/README.md b/gen/iamcredentials1/README.md index ffd5f9e0c8..e98b5e32df 100644 --- a/gen/iamcredentials1/README.md +++ b/gen/iamcredentials1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-iamcredentials1` library allows access to all features of the *Google IAM Credentials* service. -This documentation was generated from *IAM Credentials* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *iamcredentials:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *IAM Credentials* crate version *1.0.8+20190329*, where *20190329* is the exact revision of the *iamcredentials:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *IAM Credentials* *v1* API can be found at the [official documentation site](https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/struct.IAMCredentials.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/struct.IAMCredentials.html) ... * projects - * [*service accounts generate access token*](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/struct.ProjectServiceAccountGenerateAccessTokenCall.html), [*service accounts generate id token*](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/struct.ProjectServiceAccountGenerateIdTokenCall.html), [*service accounts generate identity binding access token*](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/struct.ProjectServiceAccountGenerateIdentityBindingAccessTokenCall.html), [*service accounts sign blob*](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/struct.ProjectServiceAccountSignBlobCall.html) and [*service accounts sign jwt*](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/struct.ProjectServiceAccountSignJwtCall.html) + * [*service accounts generate access token*](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/struct.ProjectServiceAccountGenerateAccessTokenCall.html), [*service accounts generate id token*](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/struct.ProjectServiceAccountGenerateIdTokenCall.html), [*service accounts generate identity binding access token*](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/struct.ProjectServiceAccountGenerateIdentityBindingAccessTokenCall.html), [*service accounts sign blob*](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/struct.ProjectServiceAccountSignBlobCall.html) and [*service accounts sign jwt*](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/struct.ProjectServiceAccountSignJwtCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/struct.IAMCredentials.html)** +* **[Hub](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/struct.IAMCredentials.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.Part.html)** + * **[Parts](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -130,17 +130,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -150,29 +150,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-iamcredentials1/1.0.8+20181004/google_iamcredentials1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-iamcredentials1/1.0.8+20190329/google_iamcredentials1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/iamcredentials1/src/lib.rs b/gen/iamcredentials1/src/lib.rs index cc6a4c5a37..e06e15200b 100644 --- a/gen/iamcredentials1/src/lib.rs +++ b/gen/iamcredentials1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *IAM Credentials* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *iamcredentials:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *IAM Credentials* crate version *1.0.8+20190329*, where *20190329* is the exact revision of the *iamcredentials:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *IAM Credentials* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials). @@ -426,8 +426,6 @@ impl ResponseResult for SignJwtResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SignJwtRequest { - /// The JWT payload to sign: a JSON object that contains a JWT Claims Set. - pub payload: Option, /// The sequence of service accounts in a delegation chain. Each service /// account must be granted the `roles/iam.serviceAccountTokenCreator` role /// on its next service account in the chain. The last service account in the @@ -436,8 +434,11 @@ pub struct SignJwtRequest { /// request. /// /// The delegates must have the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}` + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. pub delegates: Option>, + /// The JWT payload to sign: a JSON object that contains a JWT Claims Set. + pub payload: Option, } impl RequestValue for SignJwtRequest {} @@ -498,7 +499,8 @@ pub struct GenerateIdentityBindingAccessTokenRequest { /// "iss": "https://accounts.google.com", /// "iat": 1517963104, /// "exp": 1517966704, - /// "aud": "https://iamcredentials.googleapis.com/google.iam.credentials.v1.CloudGaia", + /// "aud": + /// "https://iamcredentials.googleapis.com/google.iam.credentials.v1.CloudGaia", /// "sub": "113475438248934895348", /// "my_claims": { /// "additional_claim": "value" @@ -566,8 +568,6 @@ impl ResponseResult for SignBlobResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SignBlobRequest { - /// The bytes to sign. - pub payload: Option, /// The sequence of service accounts in a delegation chain. Each service /// account must be granted the `roles/iam.serviceAccountTokenCreator` role /// on its next service account in the chain. The last service account in the @@ -576,8 +576,11 @@ pub struct SignBlobRequest { /// request. /// /// The delegates must have the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}` + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. pub delegates: Option>, + /// The bytes to sign. + pub payload: Option, } impl RequestValue for SignBlobRequest {} @@ -607,7 +610,8 @@ pub struct GenerateAccessTokenRequest { /// request. /// /// The delegates must have the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}` + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. pub delegates: Option>, /// Code to identify the scopes to be included in the OAuth 2.0 access token. /// See https://developers.google.com/identity/protocols/googlescopes for more @@ -663,7 +667,8 @@ pub struct GenerateIdTokenRequest { /// request. /// /// The delegates must have the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}` + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. pub delegates: Option>, } @@ -723,7 +728,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `request` - No description provided. /// * `name` - The resource name of the service account for which the credentials /// are requested, in the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. pub fn service_accounts_generate_identity_binding_access_token(&self, request: GenerateIdentityBindingAccessTokenRequest, name: &str) -> ProjectServiceAccountGenerateIdentityBindingAccessTokenCall<'a, C, A> { ProjectServiceAccountGenerateIdentityBindingAccessTokenCall { hub: self.hub, @@ -743,7 +749,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `request` - No description provided. /// * `name` - The resource name of the service account for which the credentials /// are requested, in the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. pub fn service_accounts_sign_blob(&self, request: SignBlobRequest, name: &str) -> ProjectServiceAccountSignBlobCall<'a, C, A> { ProjectServiceAccountSignBlobCall { hub: self.hub, @@ -764,7 +771,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `request` - No description provided. /// * `name` - The resource name of the service account for which the credentials /// are requested, in the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. pub fn service_accounts_sign_jwt(&self, request: SignJwtRequest, name: &str) -> ProjectServiceAccountSignJwtCall<'a, C, A> { ProjectServiceAccountSignJwtCall { hub: self.hub, @@ -785,7 +793,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `request` - No description provided. /// * `name` - The resource name of the service account for which the credentials /// are requested, in the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. pub fn service_accounts_generate_id_token(&self, request: GenerateIdTokenRequest, name: &str) -> ProjectServiceAccountGenerateIdTokenCall<'a, C, A> { ProjectServiceAccountGenerateIdTokenCall { hub: self.hub, @@ -806,7 +815,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `request` - No description provided. /// * `name` - The resource name of the service account for which the credentials /// are requested, in the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. pub fn service_accounts_generate_access_token(&self, request: GenerateAccessTokenRequest, name: &str) -> ProjectServiceAccountGenerateAccessTokenCall<'a, C, A> { ProjectServiceAccountGenerateAccessTokenCall { hub: self.hub, @@ -928,7 +938,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateIdentityBindingAccessTokenCall<'a, C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -944,10 +954,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateIdentityBindingAccessTokenCall<'a, C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -966,7 +973,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateIdentityBindingAccessTokenCall<'a, C request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -1032,7 +1039,8 @@ impl<'a, C, A> ProjectServiceAccountGenerateIdentityBindingAccessTokenCall<'a, C } /// The resource name of the service account for which the credentials /// are requested, in the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. /// /// Sets the *name* path property to the given value. /// @@ -1057,7 +1065,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateIdentityBindingAccessTokenCall<'a, C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1175,7 +1183,7 @@ impl<'a, C, A> ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1226,7 +1231,7 @@ impl<'a, C, A> ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignJwtCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignJwtCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1510,7 +1513,7 @@ impl<'a, C, A> ProjectServiceAccountSignJwtCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignJwtCall<'a, C, A> where C: BorrowMut ProjectServiceAccountSignJwtCall<'a, C, A> where C: BorrowMut ProjectServiceAccountGenerateIdTokenCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1759,10 +1763,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateIdTokenCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1794,7 +1795,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateIdTokenCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1861,7 +1862,8 @@ impl<'a, C, A> ProjectServiceAccountGenerateIdTokenCall<'a, C, A> where C: Borro } /// The resource name of the service account for which the credentials /// are requested, in the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. /// /// Sets the *name* path property to the given value. /// @@ -1886,7 +1888,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateIdTokenCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2027,7 +2029,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateAccessTokenCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2043,10 +2045,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateAccessTokenCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2078,7 +2077,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateAccessTokenCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2145,7 +2144,8 @@ impl<'a, C, A> ProjectServiceAccountGenerateAccessTokenCall<'a, C, A> where C: B } /// The resource name of the service account for which the credentials /// are requested, in the following format: - /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. + /// `projects/-/serviceAccounts/{ACCOUNT_EMAIL_OR_UNIQUEID}`. The `-` wildcard + /// character is required; replacing it with a project ID is invalid. /// /// Sets the *name* path property to the given value. /// @@ -2170,7 +2170,7 @@ impl<'a, C, A> ProjectServiceAccountGenerateAccessTokenCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/iap1-cli/Cargo.toml b/gen/iap1-cli/Cargo.toml new file mode 100644 index 0000000000..9dedd18a52 --- /dev/null +++ b/gen/iap1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-iap1-cli" +version = "1.0.8+20190323" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud IAP (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iap1-cli" +homepage = "https://cloud.google.com/iap" +documentation = "http://byron.github.io/google-apis-rs/google_iap1_cli" +license = "MIT" +keywords = ["iap", "google", "cli"] +autobins = false + +[[bin]] +name = "iap1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-iap1] +path = "../iap1" +version = "1.0.8+20190323" diff --git a/gen/iap1-cli/LICENSE.md b/gen/iap1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/iap1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/iap1-cli/README.md b/gen/iap1-cli/README.md new file mode 100644 index 0000000000..f738bf7968 --- /dev/null +++ b/gen/iap1-cli/README.md @@ -0,0 +1,116 @@ + +The `iap1` command-line interface *(CLI)* allows to use most features of the *Google Cloud IAP* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud IAP* API can be found at the +[official documentation site](https://cloud.google.com/iap). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-iap1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/iap1-cli). + +# Usage + +This documentation was generated from the *Cloud IAP* API at revision *20190323*. The CLI is at version *1.0.8*. + +```bash +iap1 [options] + methods + get-iam-policy (-r )... [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] + iap1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `iap1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/iap1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/iap1-secret.json`, assuming that the required *iap* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `iap1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/iap1-cli/mkdocs.yml b/gen/iap1-cli/mkdocs.yml new file mode 100644 index 0000000000..a8f53006e7 --- /dev/null +++ b/gen/iap1-cli/mkdocs.yml @@ -0,0 +1,19 @@ +site_name: Cloud IAP v1.0.8+20190323 +site_url: http://byron.github.io/google-apis-rs/google-iap1-cli +site_description: A complete library to interact with Cloud IAP (protocol v1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/iap1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['methods_get-iam-policy.md', 'Methods', 'Get Iam Policy'] +- ['methods_set-iam-policy.md', 'Methods', 'Set Iam Policy'] +- ['methods_test-iam-permissions.md', 'Methods', 'Test Iam Permissions'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/iap1-cli/src/cmn.rs b/gen/iap1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/iap1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/iap1-cli/src/main.rs b/gen/iap1-cli/src/main.rs new file mode 100644 index 0000000000..def92cd72f --- /dev/null +++ b/gen/iap1-cli/src/main.rs @@ -0,0 +1,607 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_iap1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudIAP>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _methods_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.methods().get_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _methods_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.methods().set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _methods_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.methods().test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("methods", Some(opt)) => { + match opt.subcommand() { + ("get-iam-policy", Some(opt)) => { + call_result = self._methods_get_iam_policy(opt, dry_run, &mut err); + }, + ("set-iam-policy", Some(opt)) => { + call_result = self._methods_set_iam_policy(opt, dry_run, &mut err); + }, + ("test-iam-permissions", Some(opt)) => { + call_result = self._methods_test_iam_permissions(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("methods".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "iap1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "iap1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::CloudIAP::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("methods", "methods: 'get-iam-policy', 'set-iam-policy' and 'test-iam-permissions'", vec![ + ("get-iam-policy", + Some(r##"Gets the access control policy for an Identity-Aware Proxy protected + resource. + More information about managing access via IAP can be found at: + https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), + "Details at http://byron.github.io/google-apis-rs/google_iap1_cli/methods_get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-iam-policy", + Some(r##"Sets the access control policy for an Identity-Aware Proxy protected + resource. Replaces any existing policy. + More information about managing access via IAP can be found at: + https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), + "Details at http://byron.github.io/google-apis-rs/google_iap1_cli/methods_set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the Identity-Aware Proxy protected + resource. + More information about managing access via IAP can be found at: + https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), + "Details at http://byron.github.io/google-apis-rs/google_iap1_cli/methods_test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("iap1") + .author("Sebastian Thiel ") + .version("1.0.8+20190323") + .about("Controls access to cloud applications running on Google Cloud Platform.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_iap1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/iap1/Cargo.toml b/gen/iap1/Cargo.toml new file mode 100644 index 0000000000..0f50576168 --- /dev/null +++ b/gen/iap1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-iap1" +version = "1.0.8+20190323" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud IAP (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iap1" +homepage = "https://cloud.google.com/iap" +documentation = "https://docs.rs/google-iap1/1.0.8+20190323" +license = "MIT" +keywords = ["iap", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/iap1/LICENSE.md b/gen/iap1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/iap1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/iap1/README.md b/gen/iap1/README.md new file mode 100644 index 0000000000..1af93de09a --- /dev/null +++ b/gen/iap1/README.md @@ -0,0 +1,190 @@ + +The `google-iap1` library allows access to all features of the *Google Cloud IAP* service. + +This documentation was generated from *Cloud IAP* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *iap:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Cloud IAP* *v1* API can be found at the +[official documentation site](https://cloud.google.com/iap). +# Features + +Use the following functionality with ease from the central [hub](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/struct.CloudIAP.html) ... + + +* [get iam policy](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/struct.MethodGetIamPolicyCall.html) +* [set iam policy](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/struct.MethodSetIamPolicyCall.html) +* [test iam permissions](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/struct.MethodTestIamPermissionCall.html) + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/struct.CloudIAP.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.methods().get_iam_policy(...).doit() +let r = hub.methods().set_iam_policy(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-iap1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_iap1 as iap1; +use iap1::GetIamPolicyRequest; +use iap1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use iap1::CloudIAP; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = GetIamPolicyRequest::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.methods().get_iam_policy(req, "resource") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-iap1/1.0.8+20190323/google_iap1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **iap1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/iap1/src/cmn.rs b/gen/iap1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/iap1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/iap1/src/lib.rs b/gen/iap1/src/lib.rs new file mode 100644 index 0000000000..82c8d0bfe5 --- /dev/null +++ b/gen/iap1/src/lib.rs @@ -0,0 +1,1573 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud IAP* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *iap:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Cloud IAP* *v1* API can be found at the +//! [official documentation site](https://cloud.google.com/iap). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/iap1). +//! # Features +//! +//! Use the following functionality with ease from the central [hub](struct.CloudIAP.html) ... +//! +//! +//! * [get iam policy](struct.MethodGetIamPolicyCall.html) +//! * [set iam policy](struct.MethodSetIamPolicyCall.html) +//! * [test iam permissions](struct.MethodTestIamPermissionCall.html) +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudIAP.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.methods().get_iam_policy(...).doit() +//! let r = hub.methods().set_iam_policy(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-iap1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_iap1 as iap1; +//! use iap1::GetIamPolicyRequest; +//! use iap1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use iap1::CloudIAP; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = GetIamPolicyRequest::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.methods().get_iam_policy(req, "resource") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudIAP related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_iap1 as iap1; +/// use iap1::GetIamPolicyRequest; +/// use iap1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use iap1::CloudIAP; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.methods().get_iam_policy(req, "resource") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudIAP { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for CloudIAP {} + +impl<'a, C, A> CloudIAP + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudIAP { + CloudIAP { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://iap.googleapis.com/".to_string(), + _root_url: "https://iap.googleapis.com/".to_string(), + } + } + + pub fn methods(&'a self) -> MethodMethods<'a, C, A> { + MethodMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://iap.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://iap.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [test iam permissions](struct.MethodTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestIamPermissionsResponse {} + + +/// Request message for `GetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get iam policy](struct.MethodGetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetIamPolicyRequest { _never_set: Option } + +impl RequestValue for GetIamPolicyRequest {} + + +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [test iam permissions](struct.MethodTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, +} + +impl RequestValue for TestIamPermissionsRequest {} + + +/// Request message for `SetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set iam policy](struct.MethodSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetIamPolicyRequest { + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. + pub policy: Option, +} + +impl RequestValue for SetIamPolicyRequest {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **JSON Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// **YAML Example** +/// +/// bindings: +/// - members: +/// - user:mike@example.com +/// - group:admins@example.com +/// - domain:google.com +/// - serviceAccount:my-other-app@appspot.gserviceaccount.com +/// role: roles/owner +/// - members: +/// - user:sean@example.com +/// role: roles/viewer +/// +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam/docs). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get iam policy](struct.MethodGetIamPolicyCall.html) (response) +/// * [set iam policy](struct.MethodSetIamPolicyCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, + /// Deprecated. + pub version: Option, +} + +impl ResponseResult for Policy {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all free methods, which are not associated with a particular resource. +/// It is not used directly, but through the `CloudIAP` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_iap1 as iap1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use iap1::CloudIAP; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get_iam_policy(...)`, `set_iam_policy(...)` and `test_iam_permissions(...)` +/// // to build up your call. +/// let rb = hub.methods(); +/// # } +/// ``` +pub struct MethodMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIAP, +} + +impl<'a, C, A> MethodsBuilder for MethodMethods<'a, C, A> {} + +impl<'a, C, A> MethodMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy for an Identity-Aware Proxy protected + /// resource. + /// More information about managing access via IAP can be found at: + /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> MethodGetIamPolicyCall<'a, C, A> { + MethodGetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns permissions that a caller has on the Identity-Aware Proxy protected + /// resource. + /// More information about managing access via IAP can be found at: + /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> MethodTestIamPermissionCall<'a, C, A> { + MethodTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy for an Identity-Aware Proxy protected + /// resource. Replaces any existing policy. + /// More information about managing access via IAP can be found at: + /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> MethodSetIamPolicyCall<'a, C, A> { + MethodSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Gets the access control policy for an Identity-Aware Proxy protected +/// resource. +/// More information about managing access via IAP can be found at: +/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api +/// +/// A builder for the *getIamPolicy* method. +/// It is not used directly, but through a `MethodMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iap1 as iap1; +/// use iap1::GetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iap1::CloudIAP; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.methods().get_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct MethodGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIAP, + _request: GetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MethodGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> MethodGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iap.getIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetIamPolicyRequest) -> MethodGetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> MethodGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MethodGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MethodGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns permissions that a caller has on the Identity-Aware Proxy protected +/// resource. +/// More information about managing access via IAP can be found at: +/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api +/// +/// A builder for the *testIamPermissions* method. +/// It is not used directly, but through a `MethodMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iap1 as iap1; +/// use iap1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iap1::CloudIAP; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.methods().test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct MethodTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIAP, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MethodTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> MethodTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iap.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> MethodTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> MethodTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MethodTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MethodTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy for an Identity-Aware Proxy protected +/// resource. Replaces any existing policy. +/// More information about managing access via IAP can be found at: +/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api +/// +/// A builder for the *setIamPolicy* method. +/// It is not used directly, but through a `MethodMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iap1 as iap1; +/// use iap1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iap1::CloudIAP; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.methods().set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct MethodSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudIAP, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MethodSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> MethodSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iap.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> MethodSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> MethodSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MethodSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MethodSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/iap1_beta1-cli/Cargo.toml b/gen/iap1_beta1-cli/Cargo.toml index f53ee22944..8803f3d451 100644 --- a/gen/iap1_beta1-cli/Cargo.toml +++ b/gen/iap1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-iap1_beta1-cli" -version = "1.0.8+20181003" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud IAP (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iap1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-iap1_beta1] path = "../iap1_beta1" -version = "1.0.8+20181003" +version = "1.0.8+20190323" diff --git a/gen/iap1_beta1-cli/README.md b/gen/iap1_beta1-cli/README.md index 1ff77dbf6a..0fef102e3c 100644 --- a/gen/iap1_beta1-cli/README.md +++ b/gen/iap1_beta1-cli/README.md @@ -25,29 +25,14 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud IAP* API at revision *20181003*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud IAP* API at revision *20190323*. The CLI is at version *1.0.8*. ```bash iap1-beta1 [options] - projects - iap-tunnel-get-iam-policy (-r )... [-p ]... [-o ] - iap-tunnel-set-iam-policy (-r )... [-p ]... [-o ] - iap-tunnel-test-iam-permissions (-r )... [-p ]... [-o ] - iap-tunnel-zones-get-iam-policy (-r )... [-p ]... [-o ] - iap-tunnel-zones-instances-get-iam-policy (-r )... [-p ]... [-o ] - iap-tunnel-zones-instances-set-iam-policy (-r )... [-p ]... [-o ] - iap-tunnel-zones-instances-test-iam-permissions (-r )... [-p ]... [-o ] - iap-tunnel-zones-set-iam-policy (-r )... [-p ]... [-o ] - iap-tunnel-zones-test-iam-permissions (-r )... [-p ]... [-o ] - iap-web-get-iam-policy (-r )... [-p ]... [-o ] - iap-web-services-get-iam-policy (-r )... [-p ]... [-o ] - iap-web-services-set-iam-policy (-r )... [-p ]... [-o ] - iap-web-services-test-iam-permissions (-r )... [-p ]... [-o ] - iap-web-services-versions-get-iam-policy (-r )... [-p ]... [-o ] - iap-web-services-versions-set-iam-policy (-r )... [-p ]... [-o ] - iap-web-services-versions-test-iam-permissions (-r )... [-p ]... [-o ] - iap-web-set-iam-policy (-r )... [-p ]... [-o ] - iap-web-test-iam-permissions (-r )... [-p ]... [-o ] + methods + get-iam-policy (-r )... [-p ]... [-o ] + set-iam-policy (-r )... [-p ]... [-o ] + test-iam-permissions (-r )... [-p ]... [-o ] iap1-beta1 --help Configuration: diff --git a/gen/iap1_beta1-cli/mkdocs.yml b/gen/iap1_beta1-cli/mkdocs.yml index e22ae44cac..491750a8a3 100644 --- a/gen/iap1_beta1-cli/mkdocs.yml +++ b/gen/iap1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud IAP v1.0.8+20181003 +site_name: Cloud IAP v1.0.8+20190323 site_url: http://byron.github.io/google-apis-rs/google-iap1_beta1-cli site_description: A complete library to interact with Cloud IAP (protocol v1beta1) @@ -9,24 +9,9 @@ site_dir: build_html pages: - ['index.md', 'Home'] -- ['projects_iap-tunnel-get-iam-policy.md', 'Projects', 'Iap Tunnel Get Iam Policy'] -- ['projects_iap-tunnel-set-iam-policy.md', 'Projects', 'Iap Tunnel Set Iam Policy'] -- ['projects_iap-tunnel-test-iam-permissions.md', 'Projects', 'Iap Tunnel Test Iam Permissions'] -- ['projects_iap-tunnel-zones-get-iam-policy.md', 'Projects', 'Iap Tunnel Zones Get Iam Policy'] -- ['projects_iap-tunnel-zones-instances-get-iam-policy.md', 'Projects', 'Iap Tunnel Zones Instances Get Iam Policy'] -- ['projects_iap-tunnel-zones-instances-set-iam-policy.md', 'Projects', 'Iap Tunnel Zones Instances Set Iam Policy'] -- ['projects_iap-tunnel-zones-instances-test-iam-permissions.md', 'Projects', 'Iap Tunnel Zones Instances Test Iam Permissions'] -- ['projects_iap-tunnel-zones-set-iam-policy.md', 'Projects', 'Iap Tunnel Zones Set Iam Policy'] -- ['projects_iap-tunnel-zones-test-iam-permissions.md', 'Projects', 'Iap Tunnel Zones Test Iam Permissions'] -- ['projects_iap-web-get-iam-policy.md', 'Projects', 'Iap Web Get Iam Policy'] -- ['projects_iap-web-services-get-iam-policy.md', 'Projects', 'Iap Web Services Get Iam Policy'] -- ['projects_iap-web-services-set-iam-policy.md', 'Projects', 'Iap Web Services Set Iam Policy'] -- ['projects_iap-web-services-test-iam-permissions.md', 'Projects', 'Iap Web Services Test Iam Permissions'] -- ['projects_iap-web-services-versions-get-iam-policy.md', 'Projects', 'Iap Web Services Versions Get Iam Policy'] -- ['projects_iap-web-services-versions-set-iam-policy.md', 'Projects', 'Iap Web Services Versions Set Iam Policy'] -- ['projects_iap-web-services-versions-test-iam-permissions.md', 'Projects', 'Iap Web Services Versions Test Iam Permissions'] -- ['projects_iap-web-set-iam-policy.md', 'Projects', 'Iap Web Set Iam Policy'] -- ['projects_iap-web-test-iam-permissions.md', 'Projects', 'Iap Web Test Iam Permissions'] +- ['methods_get-iam-policy.md', 'Methods', 'Get Iam Policy'] +- ['methods_set-iam-policy.md', 'Methods', 'Set Iam Policy'] +- ['methods_test-iam-permissions.md', 'Methods', 'Test Iam Permissions'] theme: readthedocs diff --git a/gen/iap1_beta1-cli/src/main.rs b/gen/iap1_beta1-cli/src/main.rs index 14e7067290..b93684107b 100644 --- a/gen/iap1_beta1-cli/src/main.rs +++ b/gen/iap1_beta1-cli/src/main.rs @@ -46,7 +46,7 @@ struct Engine<'n> { impl<'n> Engine<'n> { - fn _projects_iap_tunnel_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + fn _methods_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); @@ -80,7 +80,7 @@ impl<'n> Engine<'n> { } } let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_tunnel_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); + let mut call = self.hub.methods().get_iam_policy(request, opt.value_of("resource").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { @@ -130,7 +130,7 @@ impl<'n> Engine<'n> { } } - fn _projects_iap_tunnel_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + fn _methods_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); @@ -155,9 +155,8 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -167,7 +166,7 @@ impl<'n> Engine<'n> { } } let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_tunnel_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + let mut call = self.hub.methods().set_iam_policy(request, opt.value_of("resource").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { @@ -217,7 +216,7 @@ impl<'n> Engine<'n> { } } - fn _projects_iap_tunnel_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + fn _methods_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); @@ -252,1287 +251,7 @@ impl<'n> Engine<'n> { } } let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_tunnel_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_tunnel_zones_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_tunnel_zones_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_tunnel_zones_instances_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_tunnel_zones_instances_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_tunnel_zones_instances_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_tunnel_zones_instances_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_tunnel_zones_instances_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_tunnel_zones_instances_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_tunnel_zones_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_tunnel_zones_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_tunnel_zones_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_tunnel_zones_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_web_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_web_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_web_services_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_web_services_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_web_services_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_web_services_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_web_services_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_web_services_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_web_services_versions_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_web_services_versions_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_web_services_versions_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_web_services_versions_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_web_services_versions_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_web_services_versions_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_web_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_web_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_iap_web_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.projects().iap_web_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + let mut call = self.hub.methods().test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { @@ -1587,64 +306,19 @@ impl<'n> Engine<'n> { let mut call_result: Result<(), DoitError> = Ok(()); let mut err_opt: Option = None; match self.opt.subcommand() { - ("projects", Some(opt)) => { + ("methods", Some(opt)) => { match opt.subcommand() { - ("iap-tunnel-get-iam-policy", Some(opt)) => { - call_result = self._projects_iap_tunnel_get_iam_policy(opt, dry_run, &mut err); + ("get-iam-policy", Some(opt)) => { + call_result = self._methods_get_iam_policy(opt, dry_run, &mut err); }, - ("iap-tunnel-set-iam-policy", Some(opt)) => { - call_result = self._projects_iap_tunnel_set_iam_policy(opt, dry_run, &mut err); + ("set-iam-policy", Some(opt)) => { + call_result = self._methods_set_iam_policy(opt, dry_run, &mut err); }, - ("iap-tunnel-test-iam-permissions", Some(opt)) => { - call_result = self._projects_iap_tunnel_test_iam_permissions(opt, dry_run, &mut err); - }, - ("iap-tunnel-zones-get-iam-policy", Some(opt)) => { - call_result = self._projects_iap_tunnel_zones_get_iam_policy(opt, dry_run, &mut err); - }, - ("iap-tunnel-zones-instances-get-iam-policy", Some(opt)) => { - call_result = self._projects_iap_tunnel_zones_instances_get_iam_policy(opt, dry_run, &mut err); - }, - ("iap-tunnel-zones-instances-set-iam-policy", Some(opt)) => { - call_result = self._projects_iap_tunnel_zones_instances_set_iam_policy(opt, dry_run, &mut err); - }, - ("iap-tunnel-zones-instances-test-iam-permissions", Some(opt)) => { - call_result = self._projects_iap_tunnel_zones_instances_test_iam_permissions(opt, dry_run, &mut err); - }, - ("iap-tunnel-zones-set-iam-policy", Some(opt)) => { - call_result = self._projects_iap_tunnel_zones_set_iam_policy(opt, dry_run, &mut err); - }, - ("iap-tunnel-zones-test-iam-permissions", Some(opt)) => { - call_result = self._projects_iap_tunnel_zones_test_iam_permissions(opt, dry_run, &mut err); - }, - ("iap-web-get-iam-policy", Some(opt)) => { - call_result = self._projects_iap_web_get_iam_policy(opt, dry_run, &mut err); - }, - ("iap-web-services-get-iam-policy", Some(opt)) => { - call_result = self._projects_iap_web_services_get_iam_policy(opt, dry_run, &mut err); - }, - ("iap-web-services-set-iam-policy", Some(opt)) => { - call_result = self._projects_iap_web_services_set_iam_policy(opt, dry_run, &mut err); - }, - ("iap-web-services-test-iam-permissions", Some(opt)) => { - call_result = self._projects_iap_web_services_test_iam_permissions(opt, dry_run, &mut err); - }, - ("iap-web-services-versions-get-iam-policy", Some(opt)) => { - call_result = self._projects_iap_web_services_versions_get_iam_policy(opt, dry_run, &mut err); - }, - ("iap-web-services-versions-set-iam-policy", Some(opt)) => { - call_result = self._projects_iap_web_services_versions_set_iam_policy(opt, dry_run, &mut err); - }, - ("iap-web-services-versions-test-iam-permissions", Some(opt)) => { - call_result = self._projects_iap_web_services_versions_test_iam_permissions(opt, dry_run, &mut err); - }, - ("iap-web-set-iam-policy", Some(opt)) => { - call_result = self._projects_iap_web_set_iam_policy(opt, dry_run, &mut err); - }, - ("iap-web-test-iam-permissions", Some(opt)) => { - call_result = self._projects_iap_web_test_iam_permissions(opt, dry_run, &mut err); + ("test-iam-permissions", Some(opt)) => { + call_result = self._methods_test_iam_permissions(opt, dry_run, &mut err); }, _ => { - err.issues.push(CLIError::MissingMethodError("projects".to_string())); + err.issues.push(CLIError::MissingMethodError("methods".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); } } @@ -1734,13 +408,13 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'iap-tunnel-get-iam-policy', 'iap-tunnel-set-iam-policy', 'iap-tunnel-test-iam-permissions', 'iap-tunnel-zones-get-iam-policy', 'iap-tunnel-zones-instances-get-iam-policy', 'iap-tunnel-zones-instances-set-iam-policy', 'iap-tunnel-zones-instances-test-iam-permissions', 'iap-tunnel-zones-set-iam-policy', 'iap-tunnel-zones-test-iam-permissions', 'iap-web-get-iam-policy', 'iap-web-services-get-iam-policy', 'iap-web-services-set-iam-policy', 'iap-web-services-test-iam-permissions', 'iap-web-services-versions-get-iam-policy', 'iap-web-services-versions-set-iam-policy', 'iap-web-services-versions-test-iam-permissions', 'iap-web-set-iam-policy' and 'iap-web-test-iam-permissions'", vec![ - ("iap-tunnel-get-iam-policy", + ("methods", "methods: 'get-iam-policy', 'set-iam-policy' and 'test-iam-permissions'", vec![ + ("get-iam-policy", Some(r##"Gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-tunnel-get-iam-policy", + "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/methods_get-iam-policy", vec![ (Some(r##"resource"##), None, @@ -1767,12 +441,12 @@ fn main() { Some(false), Some(false)), ]), - ("iap-tunnel-set-iam-policy", + ("set-iam-policy", Some(r##"Sets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-tunnel-set-iam-policy", + "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/methods_set-iam-policy", vec![ (Some(r##"resource"##), None, @@ -1799,504 +473,14 @@ fn main() { Some(false), Some(false)), ]), - ("iap-tunnel-test-iam-permissions", + ("test-iam-permissions", Some(r##"Returns permissions that a caller has on the Identity-Aware Proxy protected resource. If the resource does not exist or the caller does not have Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] will be returned. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-tunnel-test-iam-permissions", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-tunnel-zones-get-iam-policy", - Some(r##"Gets the access control policy for an Identity-Aware Proxy protected - resource. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-tunnel-zones-get-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy is being requested. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-tunnel-zones-instances-get-iam-policy", - Some(r##"Gets the access control policy for an Identity-Aware Proxy protected - resource. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-tunnel-zones-instances-get-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy is being requested. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-tunnel-zones-instances-set-iam-policy", - Some(r##"Sets the access control policy for an Identity-Aware Proxy protected - resource. Replaces any existing policy. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-tunnel-zones-instances-set-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy is being specified. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-tunnel-zones-instances-test-iam-permissions", - Some(r##"Returns permissions that a caller has on the Identity-Aware Proxy protected - resource. If the resource does not exist or the caller does not have - Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - will be returned. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-tunnel-zones-instances-test-iam-permissions", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-tunnel-zones-set-iam-policy", - Some(r##"Sets the access control policy for an Identity-Aware Proxy protected - resource. Replaces any existing policy. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-tunnel-zones-set-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy is being specified. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-tunnel-zones-test-iam-permissions", - Some(r##"Returns permissions that a caller has on the Identity-Aware Proxy protected - resource. If the resource does not exist or the caller does not have - Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - will be returned. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-tunnel-zones-test-iam-permissions", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-web-get-iam-policy", - Some(r##"Gets the access control policy for an Identity-Aware Proxy protected - resource. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-web-get-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy is being requested. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-web-services-get-iam-policy", - Some(r##"Gets the access control policy for an Identity-Aware Proxy protected - resource. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-web-services-get-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy is being requested. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-web-services-set-iam-policy", - Some(r##"Sets the access control policy for an Identity-Aware Proxy protected - resource. Replaces any existing policy. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-web-services-set-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy is being specified. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-web-services-test-iam-permissions", - Some(r##"Returns permissions that a caller has on the Identity-Aware Proxy protected - resource. If the resource does not exist or the caller does not have - Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - will be returned. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-web-services-test-iam-permissions", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-web-services-versions-get-iam-policy", - Some(r##"Gets the access control policy for an Identity-Aware Proxy protected - resource. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-web-services-versions-get-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy is being requested. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-web-services-versions-set-iam-policy", - Some(r##"Sets the access control policy for an Identity-Aware Proxy protected - resource. Replaces any existing policy. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-web-services-versions-set-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy is being specified. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-web-services-versions-test-iam-permissions", - Some(r##"Returns permissions that a caller has on the Identity-Aware Proxy protected - resource. If the resource does not exist or the caller does not have - Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - will be returned. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-web-services-versions-test-iam-permissions", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy detail is being requested. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-web-set-iam-policy", - Some(r##"Sets the access control policy for an Identity-Aware Proxy protected - resource. Replaces any existing policy. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-web-set-iam-policy", - vec![ - (Some(r##"resource"##), - None, - Some(r##"REQUIRED: The resource for which the policy is being specified. - See the operation documentation for the appropriate value for this field."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("iap-web-test-iam-permissions", - Some(r##"Returns permissions that a caller has on the Identity-Aware Proxy protected - resource. If the resource does not exist or the caller does not have - Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - will be returned. - More information about managing access via IAP can be found at: - https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api"##), - "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/projects_iap-web-test-iam-permissions", + "Details at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli/methods_test-iam-permissions", vec![ (Some(r##"resource"##), None, @@ -2329,7 +513,7 @@ fn main() { let mut app = App::new("iap1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181003") + .version("1.0.8+20190323") .about("Controls access to cloud applications running on Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_iap1_beta1_cli") .arg(Arg::with_name("url") diff --git a/gen/iap1_beta1/Cargo.toml b/gen/iap1_beta1/Cargo.toml index d9eac697eb..f9e9156928 100644 --- a/gen/iap1_beta1/Cargo.toml +++ b/gen/iap1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-iap1_beta1" -version = "1.0.8+20181003" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud IAP (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iap1_beta1" homepage = "https://cloud.google.com/iap" -documentation = "https://docs.rs/google-iap1_beta1/1.0.8+20181003" +documentation = "https://docs.rs/google-iap1_beta1/1.0.8+20190323" license = "MIT" keywords = ["iap", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/iap1_beta1/README.md b/gen/iap1_beta1/README.md index c2897ee8cf..4d38a407f0 100644 --- a/gen/iap1_beta1/README.md +++ b/gen/iap1_beta1/README.md @@ -5,17 +5,18 @@ DO NOT EDIT ! --> The `google-iap1_beta1` library allows access to all features of the *Google Cloud IAP* service. -This documentation was generated from *Cloud IAP* crate version *1.0.8+20181003*, where *20181003* is the exact revision of the *iap:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud IAP* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *iap:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud IAP* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/iap). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.CloudIAP.html) ... +Use the following functionality with ease from the central [hub](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/struct.CloudIAP.html) ... -* projects - * [*iap_tunnel get iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapTunnelGetIamPolicyCall.html), [*iap_tunnel set iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapTunnelSetIamPolicyCall.html), [*iap_tunnel test iam permissions*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapTunnelTestIamPermissionCall.html), [*iap_tunnel zones get iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapTunnelZoneGetIamPolicyCall.html), [*iap_tunnel zones instances get iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapTunnelZoneInstanceGetIamPolicyCall.html), [*iap_tunnel zones instances set iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapTunnelZoneInstanceSetIamPolicyCall.html), [*iap_tunnel zones instances test iam permissions*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapTunnelZoneInstanceTestIamPermissionCall.html), [*iap_tunnel zones set iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapTunnelZoneSetIamPolicyCall.html), [*iap_tunnel zones test iam permissions*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapTunnelZoneTestIamPermissionCall.html), [*iap_web get iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapWebGetIamPolicyCall.html), [*iap_web services get iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapWebServiceGetIamPolicyCall.html), [*iap_web services set iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapWebServiceSetIamPolicyCall.html), [*iap_web services test iam permissions*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapWebServiceTestIamPermissionCall.html), [*iap_web services versions get iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapWebServiceVersionGetIamPolicyCall.html), [*iap_web services versions set iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapWebServiceVersionSetIamPolicyCall.html), [*iap_web services versions test iam permissions*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapWebServiceVersionTestIamPermissionCall.html), [*iap_web set iam policy*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapWebSetIamPolicyCall.html) and [*iap_web test iam permissions*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.ProjectIapWebTestIamPermissionCall.html) +* [get iam policy](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/struct.MethodGetIamPolicyCall.html) +* [set iam policy](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/struct.MethodSetIamPolicyCall.html) +* [test iam permissions](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/struct.MethodTestIamPermissionCall.html) @@ -23,17 +24,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/struct.CloudIAP.html)** +* **[Hub](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/struct.CloudIAP.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -47,18 +48,8 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.projects().iap_web_services_get_iam_policy(...).doit() -let r = hub.projects().iap_web_set_iam_policy(...).doit() -let r = hub.projects().iap_tunnel_zones_get_iam_policy(...).doit() -let r = hub.projects().iap_tunnel_set_iam_policy(...).doit() -let r = hub.projects().iap_tunnel_zones_set_iam_policy(...).doit() -let r = hub.projects().iap_tunnel_get_iam_policy(...).doit() -let r = hub.projects().iap_web_services_versions_get_iam_policy(...).doit() -let r = hub.projects().iap_web_services_set_iam_policy(...).doit() -let r = hub.projects().iap_web_services_versions_set_iam_policy(...).doit() -let r = hub.projects().iap_web_get_iam_policy(...).doit() -let r = hub.projects().iap_tunnel_zones_instances_get_iam_policy(...).doit() -let r = hub.projects().iap_tunnel_zones_instances_set_iam_policy(...).doit() +let r = hub.methods().get_iam_policy(...).doit() +let r = hub.methods().set_iam_policy(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -118,7 +109,7 @@ let mut req = GetIamPolicyRequest::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.projects().iap_web_services_get_iam_policy(req, "resource") +let result = hub.methods().get_iam_policy(req, "resource") .doit(); match result { @@ -141,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -161,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-iap1_beta1/1.0.8+20181003/google_iap1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-iap1_beta1/1.0.8+20190323/google_iap1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/iap1_beta1/src/lib.rs b/gen/iap1_beta1/src/lib.rs index 62a89053c1..6ca20e5d07 100644 --- a/gen/iap1_beta1/src/lib.rs +++ b/gen/iap1_beta1/src/lib.rs @@ -2,18 +2,19 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud IAP* crate version *1.0.8+20181003*, where *20181003* is the exact revision of the *iap:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud IAP* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *iap:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud IAP* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/iap). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/iap1_beta1). //! # Features //! -//! Handle the following *Resources* with ease from the central [hub](struct.CloudIAP.html) ... +//! Use the following functionality with ease from the central [hub](struct.CloudIAP.html) ... //! -//! * projects -//! * [*iap_tunnel get iam policy*](struct.ProjectIapTunnelGetIamPolicyCall.html), [*iap_tunnel set iam policy*](struct.ProjectIapTunnelSetIamPolicyCall.html), [*iap_tunnel test iam permissions*](struct.ProjectIapTunnelTestIamPermissionCall.html), [*iap_tunnel zones get iam policy*](struct.ProjectIapTunnelZoneGetIamPolicyCall.html), [*iap_tunnel zones instances get iam policy*](struct.ProjectIapTunnelZoneInstanceGetIamPolicyCall.html), [*iap_tunnel zones instances set iam policy*](struct.ProjectIapTunnelZoneInstanceSetIamPolicyCall.html), [*iap_tunnel zones instances test iam permissions*](struct.ProjectIapTunnelZoneInstanceTestIamPermissionCall.html), [*iap_tunnel zones set iam policy*](struct.ProjectIapTunnelZoneSetIamPolicyCall.html), [*iap_tunnel zones test iam permissions*](struct.ProjectIapTunnelZoneTestIamPermissionCall.html), [*iap_web get iam policy*](struct.ProjectIapWebGetIamPolicyCall.html), [*iap_web services get iam policy*](struct.ProjectIapWebServiceGetIamPolicyCall.html), [*iap_web services set iam policy*](struct.ProjectIapWebServiceSetIamPolicyCall.html), [*iap_web services test iam permissions*](struct.ProjectIapWebServiceTestIamPermissionCall.html), [*iap_web services versions get iam policy*](struct.ProjectIapWebServiceVersionGetIamPolicyCall.html), [*iap_web services versions set iam policy*](struct.ProjectIapWebServiceVersionSetIamPolicyCall.html), [*iap_web services versions test iam permissions*](struct.ProjectIapWebServiceVersionTestIamPermissionCall.html), [*iap_web set iam policy*](struct.ProjectIapWebSetIamPolicyCall.html) and [*iap_web test iam permissions*](struct.ProjectIapWebTestIamPermissionCall.html) //! +//! * [get iam policy](struct.MethodGetIamPolicyCall.html) +//! * [set iam policy](struct.MethodSetIamPolicyCall.html) +//! * [test iam permissions](struct.MethodTestIamPermissionCall.html) //! //! //! @@ -47,18 +48,8 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.projects().iap_web_services_get_iam_policy(...).doit() -//! let r = hub.projects().iap_web_set_iam_policy(...).doit() -//! let r = hub.projects().iap_tunnel_zones_get_iam_policy(...).doit() -//! let r = hub.projects().iap_tunnel_set_iam_policy(...).doit() -//! let r = hub.projects().iap_tunnel_zones_set_iam_policy(...).doit() -//! let r = hub.projects().iap_tunnel_get_iam_policy(...).doit() -//! let r = hub.projects().iap_web_services_versions_get_iam_policy(...).doit() -//! let r = hub.projects().iap_web_services_set_iam_policy(...).doit() -//! let r = hub.projects().iap_web_services_versions_set_iam_policy(...).doit() -//! let r = hub.projects().iap_web_get_iam_policy(...).doit() -//! let r = hub.projects().iap_tunnel_zones_instances_get_iam_policy(...).doit() -//! let r = hub.projects().iap_tunnel_zones_instances_set_iam_policy(...).doit() +//! let r = hub.methods().get_iam_policy(...).doit() +//! let r = hub.methods().set_iam_policy(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -119,7 +110,7 @@ //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.projects().iap_web_services_get_iam_policy(req, "resource") +//! let result = hub.methods().get_iam_policy(req, "resource") //! .doit(); //! //! match result { @@ -304,7 +295,7 @@ impl Default for Scope { /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_web_services_get_iam_policy(req, "resource") +/// let result = hub.methods().get_iam_policy(req, "resource") /// .doit(); /// /// match result { @@ -348,8 +339,8 @@ impl<'a, C, A> CloudIAP } } - pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { - ProjectMethods { hub: &self } + pub fn methods(&'a self) -> MethodMethods<'a, C, A> { + MethodMethods { hub: &self } } /// Set the user-agent header field to use in all requests to the server. @@ -381,43 +372,6 @@ impl<'a, C, A> CloudIAP // ############ // SCHEMAS ### // ########## -/// Provides the configuration for logging a type of permissions. -/// Example: -/// -/// { -/// "audit_log_configs": [ -/// { -/// "log_type": "DATA_READ", -/// "exempted_members": [ -/// "user:foo@gmail.com" -/// ] -/// }, -/// { -/// "log_type": "DATA_WRITE", -/// } -/// ] -/// } -/// -/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting -/// foo@gmail.com from DATA_READ logging. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AuditLogConfig { - /// Specifies the identities that do not cause logging for this type of - /// permission. - /// Follows the same format of Binding.members. - #[serde(rename="exemptedMembers")] - pub exempted_members: Option>, - /// The log type that this config enables. - #[serde(rename="logType")] - pub log_type: Option, -} - -impl Part for AuditLogConfig {} - - /// Response message for `TestIamPermissions` method. /// /// # Activities @@ -425,12 +379,7 @@ impl Part for AuditLogConfig {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [iap_tunnel test iam permissions projects](struct.ProjectIapTunnelTestIamPermissionCall.html) (response) -/// * [iap_web services test iam permissions projects](struct.ProjectIapWebServiceTestIamPermissionCall.html) (response) -/// * [iap_tunnel zones instances test iam permissions projects](struct.ProjectIapTunnelZoneInstanceTestIamPermissionCall.html) (response) -/// * [iap_web test iam permissions projects](struct.ProjectIapWebTestIamPermissionCall.html) (response) -/// * [iap_tunnel zones test iam permissions projects](struct.ProjectIapTunnelZoneTestIamPermissionCall.html) (response) -/// * [iap_web services versions test iam permissions projects](struct.ProjectIapWebServiceVersionTestIamPermissionCall.html) (response) +/// * [test iam permissions](struct.MethodTestIamPermissionCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsResponse { @@ -449,12 +398,7 @@ impl ResponseResult for TestIamPermissionsResponse {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [iap_web services get iam policy projects](struct.ProjectIapWebServiceGetIamPolicyCall.html) (request) -/// * [iap_web get iam policy projects](struct.ProjectIapWebGetIamPolicyCall.html) (request) -/// * [iap_tunnel get iam policy projects](struct.ProjectIapTunnelGetIamPolicyCall.html) (request) -/// * [iap_web services versions get iam policy projects](struct.ProjectIapWebServiceVersionGetIamPolicyCall.html) (request) -/// * [iap_tunnel zones get iam policy projects](struct.ProjectIapTunnelZoneGetIamPolicyCall.html) (request) -/// * [iap_tunnel zones instances get iam policy projects](struct.ProjectIapTunnelZoneInstanceGetIamPolicyCall.html) (request) +/// * [get iam policy](struct.MethodGetIamPolicyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GetIamPolicyRequest { _never_set: Option } @@ -469,12 +413,7 @@ impl RequestValue for GetIamPolicyRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [iap_tunnel test iam permissions projects](struct.ProjectIapTunnelTestIamPermissionCall.html) (request) -/// * [iap_web services test iam permissions projects](struct.ProjectIapWebServiceTestIamPermissionCall.html) (request) -/// * [iap_tunnel zones instances test iam permissions projects](struct.ProjectIapTunnelZoneInstanceTestIamPermissionCall.html) (request) -/// * [iap_web test iam permissions projects](struct.ProjectIapWebTestIamPermissionCall.html) (request) -/// * [iap_tunnel zones test iam permissions projects](struct.ProjectIapTunnelZoneTestIamPermissionCall.html) (request) -/// * [iap_web services versions test iam permissions projects](struct.ProjectIapWebServiceVersionTestIamPermissionCall.html) (request) +/// * [test iam permissions](struct.MethodTestIamPermissionCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsRequest { @@ -495,12 +434,7 @@ impl RequestValue for TestIamPermissionsRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [iap_web set iam policy projects](struct.ProjectIapWebSetIamPolicyCall.html) (request) -/// * [iap_tunnel set iam policy projects](struct.ProjectIapTunnelSetIamPolicyCall.html) (request) -/// * [iap_tunnel zones set iam policy projects](struct.ProjectIapTunnelZoneSetIamPolicyCall.html) (request) -/// * [iap_web services set iam policy projects](struct.ProjectIapWebServiceSetIamPolicyCall.html) (request) -/// * [iap_web services versions set iam policy projects](struct.ProjectIapWebServiceVersionSetIamPolicyCall.html) (request) -/// * [iap_tunnel zones instances set iam policy projects](struct.ProjectIapTunnelZoneInstanceSetIamPolicyCall.html) (request) +/// * [set iam policy](struct.MethodSetIamPolicyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetIamPolicyRequest { @@ -509,161 +443,11 @@ pub struct SetIamPolicyRequest { /// valid policy but certain Cloud Platform services (such as Projects) /// might reject them. pub policy: Option, - /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - /// the fields in the mask will be modified. If no mask is provided, the - /// following default mask is used: - /// paths: "bindings, etag" - /// This field is only used by Cloud IAM. - #[serde(rename="updateMask")] - pub update_mask: Option, } impl RequestValue for SetIamPolicyRequest {} -/// Represents an expression text. Example: -/// -/// title: "User account presence" -/// description: "Determines whether the request has a user account" -/// expression: "size(request.user) > 0" -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, - /// Textual representation of an expression in - /// Common Expression Language syntax. - /// - /// The application context of the containing message determines which - /// well-known feature set of CEL is supported. - pub expression: Option, - /// An optional string indicating the location of the expression for error - /// reporting, e.g. a file name and a position in the file. - pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, -} - -impl Part for Expr {} - - -/// Associates `members` with a `role`. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Binding { - /// Role that is assigned to `members`. - /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. - pub role: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. - /// `members` can have the following values: - /// - /// * `allUsers`: A special identifier that represents anyone who is - /// on the internet; with or without a Google account. - /// - /// * `allAuthenticatedUsers`: A special identifier that represents anyone - /// who is authenticated with a Google account or a service account. - /// - /// * `user:{emailid}`: An email address that represents a specific Google - /// account. For example, `alice@gmail.com` . - /// - /// - /// * `serviceAccount:{emailid}`: An email address that represents a service - /// account. For example, `my-other-app@appspot.gserviceaccount.com`. - /// - /// * `group:{emailid}`: An email address that represents a Google group. - /// For example, `admins@example.com`. - /// - /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the - /// users of that domain. For example, `google.com` or `example.com`. - /// - /// - pub members: Option>, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, -} - -impl Part for Binding {} - - -/// Specifies the audit configuration for a service. -/// The configuration determines which permission types are logged, and what -/// identities, if any, are exempted from logging. -/// An AuditConfig must have one or more AuditLogConfigs. -/// -/// If there are AuditConfigs for both `allServices` and a specific service, -/// the union of the two AuditConfigs is used for that service: the log_types -/// specified in each AuditConfig are enabled, and the exempted_members in each -/// AuditLogConfig are exempted. -/// -/// Example Policy with multiple AuditConfigs: -/// -/// { -/// "audit_configs": [ -/// { -/// "service": "allServices" -/// "audit_log_configs": [ -/// { -/// "log_type": "DATA_READ", -/// "exempted_members": [ -/// "user:foo@gmail.com" -/// ] -/// }, -/// { -/// "log_type": "DATA_WRITE", -/// }, -/// { -/// "log_type": "ADMIN_READ", -/// } -/// ] -/// }, -/// { -/// "service": "fooservice.googleapis.com" -/// "audit_log_configs": [ -/// { -/// "log_type": "DATA_READ", -/// }, -/// { -/// "log_type": "DATA_WRITE", -/// "exempted_members": [ -/// "user:bar@gmail.com" -/// ] -/// } -/// ] -/// } -/// ] -/// } -/// -/// For fooservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ -/// logging. It also exempts foo@gmail.com from DATA_READ logging, and -/// bar@gmail.com from DATA_WRITE logging. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AuditConfig { - /// The configuration for logging of each type of permission. - #[serde(rename="auditLogConfigs")] - pub audit_log_configs: Option>, - /// Specifies a service that will be enabled for audit logging. - /// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. - /// `allServices` is a special value that covers all services. - pub service: Option, -} - -impl Part for AuditConfig {} - - /// Defines an Identity and Access Management (IAM) policy. It is used to /// specify access control policies for Cloud Platform resources. /// @@ -715,18 +499,8 @@ impl Part for AuditConfig {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [iap_web services get iam policy projects](struct.ProjectIapWebServiceGetIamPolicyCall.html) (response) -/// * [iap_web set iam policy projects](struct.ProjectIapWebSetIamPolicyCall.html) (response) -/// * [iap_tunnel zones get iam policy projects](struct.ProjectIapTunnelZoneGetIamPolicyCall.html) (response) -/// * [iap_tunnel set iam policy projects](struct.ProjectIapTunnelSetIamPolicyCall.html) (response) -/// * [iap_tunnel zones set iam policy projects](struct.ProjectIapTunnelZoneSetIamPolicyCall.html) (response) -/// * [iap_tunnel get iam policy projects](struct.ProjectIapTunnelGetIamPolicyCall.html) (response) -/// * [iap_web services versions get iam policy projects](struct.ProjectIapWebServiceVersionGetIamPolicyCall.html) (response) -/// * [iap_web services set iam policy projects](struct.ProjectIapWebServiceSetIamPolicyCall.html) (response) -/// * [iap_web services versions set iam policy projects](struct.ProjectIapWebServiceVersionSetIamPolicyCall.html) (response) -/// * [iap_web get iam policy projects](struct.ProjectIapWebGetIamPolicyCall.html) (response) -/// * [iap_tunnel zones instances get iam policy projects](struct.ProjectIapTunnelZoneInstanceGetIamPolicyCall.html) (response) -/// * [iap_tunnel zones instances set iam policy projects](struct.ProjectIapTunnelZoneInstanceSetIamPolicyCall.html) (response) +/// * [get iam policy](struct.MethodGetIamPolicyCall.html) (response) +/// * [set iam policy](struct.MethodSetIamPolicyCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { @@ -744,9 +518,6 @@ pub struct Policy { /// If no `etag` is provided in the call to `setIamPolicy`, then the existing /// policy is overwritten blindly. pub etag: Option, - /// Specifies cloud audit logging configuration for this policy. - #[serde(rename="auditConfigs")] - pub audit_configs: Option>, /// Deprecated. pub version: Option, } @@ -754,12 +525,87 @@ pub struct Policy { impl ResponseResult for Policy {} +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + // ################### // MethodBuilders ### // ################# -/// A builder providing access to all methods supported on *project* resources. +/// A builder providing access to all free methods, which are not associated with a particular resource. /// It is not used directly, but through the `CloudIAP` hub. /// /// # Example @@ -783,37 +629,35 @@ impl ResponseResult for Policy {} /// ::default(), None); /// let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `iap_tunnel_get_iam_policy(...)`, `iap_tunnel_set_iam_policy(...)`, `iap_tunnel_test_iam_permissions(...)`, `iap_tunnel_zones_get_iam_policy(...)`, `iap_tunnel_zones_instances_get_iam_policy(...)`, `iap_tunnel_zones_instances_set_iam_policy(...)`, `iap_tunnel_zones_instances_test_iam_permissions(...)`, `iap_tunnel_zones_set_iam_policy(...)`, `iap_tunnel_zones_test_iam_permissions(...)`, `iap_web_get_iam_policy(...)`, `iap_web_services_get_iam_policy(...)`, `iap_web_services_set_iam_policy(...)`, `iap_web_services_test_iam_permissions(...)`, `iap_web_services_versions_get_iam_policy(...)`, `iap_web_services_versions_set_iam_policy(...)`, `iap_web_services_versions_test_iam_permissions(...)`, `iap_web_set_iam_policy(...)` and `iap_web_test_iam_permissions(...)` +/// // like `get_iam_policy(...)`, `set_iam_policy(...)` and `test_iam_permissions(...)` /// // to build up your call. -/// let rb = hub.projects(); +/// let rb = hub.methods(); /// # } /// ``` -pub struct ProjectMethods<'a, C, A> +pub struct MethodMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a CloudIAP, } -impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for MethodMethods<'a, C, A> {} -impl<'a, C, A> ProjectMethods<'a, C, A> { +impl<'a, C, A> MethodMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns permissions that a caller has on the Identity-Aware Proxy protected - /// resource. If the resource does not exist or the caller does not have - /// Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - /// will be returned. + /// Gets the access control policy for an Identity-Aware Proxy protected + /// resource. /// More information about managing access via IAP can be found at: /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. /// See the operation documentation for the appropriate value for this field. - pub fn iap_tunnel_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectIapTunnelTestIamPermissionCall<'a, C, A> { - ProjectIapTunnelTestIamPermissionCall { + pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> MethodGetIamPolicyCall<'a, C, A> { + MethodGetIamPolicyCall { hub: self.hub, _request: request, _resource: resource.to_string(), @@ -837,56 +681,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `request` - No description provided. /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. /// See the operation documentation for the appropriate value for this field. - pub fn iap_web_services_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectIapWebServiceTestIamPermissionCall<'a, C, A> { - ProjectIapWebServiceTestIamPermissionCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the access control policy for an Identity-Aware Proxy protected - /// resource. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_web_services_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> { - ProjectIapWebServiceGetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns permissions that a caller has on the Identity-Aware Proxy protected - /// resource. If the resource does not exist or the caller does not have - /// Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - /// will be returned. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_web_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectIapWebTestIamPermissionCall<'a, C, A> { - ProjectIapWebTestIamPermissionCall { + pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> MethodTestIamPermissionCall<'a, C, A> { + MethodTestIamPermissionCall { hub: self.hub, _request: request, _resource: resource.to_string(), @@ -908,313 +704,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// * `request` - No description provided. /// * `resource` - REQUIRED: The resource for which the policy is being specified. /// See the operation documentation for the appropriate value for this field. - pub fn iap_web_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectIapWebSetIamPolicyCall<'a, C, A> { - ProjectIapWebSetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the access control policy for an Identity-Aware Proxy protected - /// resource. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_tunnel_zones_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectIapTunnelZoneGetIamPolicyCall<'a, C, A> { - ProjectIapTunnelZoneGetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Sets the access control policy for an Identity-Aware Proxy protected - /// resource. Replaces any existing policy. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_tunnel_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectIapTunnelSetIamPolicyCall<'a, C, A> { - ProjectIapTunnelSetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns permissions that a caller has on the Identity-Aware Proxy protected - /// resource. If the resource does not exist or the caller does not have - /// Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - /// will be returned. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_tunnel_zones_instances_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectIapTunnelZoneInstanceTestIamPermissionCall<'a, C, A> { - ProjectIapTunnelZoneInstanceTestIamPermissionCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the access control policy for an Identity-Aware Proxy protected - /// resource. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_web_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectIapWebGetIamPolicyCall<'a, C, A> { - ProjectIapWebGetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Sets the access control policy for an Identity-Aware Proxy protected - /// resource. Replaces any existing policy. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_tunnel_zones_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectIapTunnelZoneSetIamPolicyCall<'a, C, A> { - ProjectIapTunnelZoneSetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the access control policy for an Identity-Aware Proxy protected - /// resource. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_tunnel_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectIapTunnelGetIamPolicyCall<'a, C, A> { - ProjectIapTunnelGetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the access control policy for an Identity-Aware Proxy protected - /// resource. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_web_services_versions_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectIapWebServiceVersionGetIamPolicyCall<'a, C, A> { - ProjectIapWebServiceVersionGetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Sets the access control policy for an Identity-Aware Proxy protected - /// resource. Replaces any existing policy. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_web_services_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectIapWebServiceSetIamPolicyCall<'a, C, A> { - ProjectIapWebServiceSetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Sets the access control policy for an Identity-Aware Proxy protected - /// resource. Replaces any existing policy. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_web_services_versions_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectIapWebServiceVersionSetIamPolicyCall<'a, C, A> { - ProjectIapWebServiceVersionSetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns permissions that a caller has on the Identity-Aware Proxy protected - /// resource. If the resource does not exist or the caller does not have - /// Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - /// will be returned. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_tunnel_zones_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectIapTunnelZoneTestIamPermissionCall<'a, C, A> { - ProjectIapTunnelZoneTestIamPermissionCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the access control policy for an Identity-Aware Proxy protected - /// resource. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_tunnel_zones_instances_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectIapTunnelZoneInstanceGetIamPolicyCall<'a, C, A> { - ProjectIapTunnelZoneInstanceGetIamPolicyCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns permissions that a caller has on the Identity-Aware Proxy protected - /// resource. If the resource does not exist or the caller does not have - /// Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] - /// will be returned. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_web_services_versions_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectIapWebServiceVersionTestIamPermissionCall<'a, C, A> { - ProjectIapWebServiceVersionTestIamPermissionCall { - hub: self.hub, - _request: request, - _resource: resource.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Sets the access control policy for an Identity-Aware Proxy protected - /// resource. Replaces any existing policy. - /// More information about managing access via IAP can be found at: - /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - pub fn iap_tunnel_zones_instances_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectIapTunnelZoneInstanceSetIamPolicyCall<'a, C, A> { - ProjectIapTunnelZoneInstanceSetIamPolicyCall { + pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> MethodSetIamPolicyCall<'a, C, A> { + MethodSetIamPolicyCall { hub: self.hub, _request: request, _resource: resource.to_string(), @@ -1233,589 +724,13 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Returns permissions that a caller has on the Identity-Aware Proxy protected -/// resource. If the resource does not exist or the caller does not have -/// Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] -/// will be returned. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_tunnel.testIamPermissions* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::TestIamPermissionsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = TestIamPermissionsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_tunnel_test_iam_permissions(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapTunnelTestIamPermissionCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: TestIamPermissionsRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapTunnelTestIamPermissionCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapTunnelTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_tunnel.testIamPermissions", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectIapTunnelTestIamPermissionCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy detail is being requested. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapTunnelTestIamPermissionCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapTunnelTestIamPermissionCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapTunnelTestIamPermissionCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapTunnelTestIamPermissionCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns permissions that a caller has on the Identity-Aware Proxy protected -/// resource. If the resource does not exist or the caller does not have -/// Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] -/// will be returned. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_web.services.testIamPermissions* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::TestIamPermissionsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = TestIamPermissionsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_web_services_test_iam_permissions(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapWebServiceTestIamPermissionCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: TestIamPermissionsRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapWebServiceTestIamPermissionCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapWebServiceTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_web.services.testIamPermissions", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectIapWebServiceTestIamPermissionCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy detail is being requested. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapWebServiceTestIamPermissionCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapWebServiceTestIamPermissionCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapWebServiceTestIamPermissionCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapWebServiceTestIamPermissionCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Gets the access control policy for an Identity-Aware Proxy protected /// resource. /// More information about managing access via IAP can be found at: /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api /// -/// A builder for the *iap_web.services.getIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. +/// A builder for the *getIamPolicy* method. +/// It is not used directly, but through a `MethodMethods` instance. /// /// # Example /// @@ -1845,11 +760,11 @@ impl<'a, C, A> ProjectIapWebServiceTestIamPermissionCall<'a, C, A> where C: Borr /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_web_services_get_iam_policy(req, "resource") +/// let result = hub.methods().get_iam_policy(req, "resource") /// .doit(); /// # } /// ``` -pub struct ProjectIapWebServiceGetIamPolicyCall<'a, C, A> +pub struct MethodGetIamPolicyCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CloudIAP, @@ -1860,9 +775,9 @@ pub struct ProjectIapWebServiceGetIamPolicyCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectIapWebServiceGetIamPolicyCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for MethodGetIamPolicyCall<'a, C, A> {} -impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> MethodGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -1875,7 +790,7 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "iap.projects.iap_web.services.getIamPolicy", + dlg.begin(MethodInfo { id: "iap.getIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("resource", self._resource.to_string())); @@ -1905,7 +820,7 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1921,10 +836,7 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1956,7 +868,7 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2017,7 +929,7 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> { + pub fn request(mut self, new_value: GetIamPolicyRequest) -> MethodGetIamPolicyCall<'a, C, A> { self._request = new_value; self } @@ -2028,7 +940,7 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> { + pub fn resource(mut self, new_value: &str) -> MethodGetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); self } @@ -2038,7 +950,7 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodGetIamPolicyCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -2047,7 +959,7 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2063,7 +975,7 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> MethodGetIamPolicyCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -2083,7 +995,7 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MethodGetIamPolicyCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -2102,8 +1014,8 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut /// More information about managing access via IAP can be found at: /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api /// -/// A builder for the *iap_web.testIamPermissions* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. +/// A builder for the *testIamPermissions* method. +/// It is not used directly, but through a `MethodMethods` instance. /// /// # Example /// @@ -2133,11 +1045,11 @@ impl<'a, C, A> ProjectIapWebServiceGetIamPolicyCall<'a, C, A> where C: BorrowMut /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_web_test_iam_permissions(req, "resource") +/// let result = hub.methods().test_iam_permissions(req, "resource") /// .doit(); /// # } /// ``` -pub struct ProjectIapWebTestIamPermissionCall<'a, C, A> +pub struct MethodTestIamPermissionCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CloudIAP, @@ -2148,9 +1060,9 @@ pub struct ProjectIapWebTestIamPermissionCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectIapWebTestIamPermissionCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for MethodTestIamPermissionCall<'a, C, A> {} -impl<'a, C, A> ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> MethodTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -2163,7 +1075,7 @@ impl<'a, C, A> ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "iap.projects.iap_web.testIamPermissions", + dlg.begin(MethodInfo { id: "iap.testIamPermissions", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("resource", self._resource.to_string())); @@ -2193,7 +1105,7 @@ impl<'a, C, A> ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2244,7 +1153,7 @@ impl<'a, C, A> ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectIapWebTestIamPermissionCall<'a, C, A> { + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> MethodTestIamPermissionCall<'a, C, A> { self._request = new_value; self } @@ -2316,7 +1225,7 @@ impl<'a, C, A> ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectIapWebTestIamPermissionCall<'a, C, A> { + pub fn resource(mut self, new_value: &str) -> MethodTestIamPermissionCall<'a, C, A> { self._resource = new_value.to_string(); self } @@ -2326,7 +1235,7 @@ impl<'a, C, A> ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectIapWebTestIamPermissionCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodTestIamPermissionCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -2335,7 +1244,7 @@ impl<'a, C, A> ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectIapWebTestIamPermissionCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> MethodTestIamPermissionCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -2371,7 +1280,7 @@ impl<'a, C, A> ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectIapWebTestIamPermissionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MethodTestIamPermissionCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -2388,8 +1297,8 @@ impl<'a, C, A> ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectIapWebTestIamPermissionCall<'a, C, A> where C: BorrowMut +pub struct MethodSetIamPolicyCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CloudIAP, @@ -2434,9 +1343,9 @@ pub struct ProjectIapWebSetIamPolicyCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectIapWebSetIamPolicyCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for MethodSetIamPolicyCall<'a, C, A> {} -impl<'a, C, A> ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> MethodSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -2449,7 +1358,7 @@ impl<'a, C, A> ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "iap.projects.iap_web.setIamPolicy", + dlg.begin(MethodInfo { id: "iap.setIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("resource", self._resource.to_string())); @@ -2479,7 +1388,7 @@ impl<'a, C, A> ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2530,7 +1436,7 @@ impl<'a, C, A> ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectIapWebSetIamPolicyCall<'a, C, A> { + pub fn request(mut self, new_value: SetIamPolicyRequest) -> MethodSetIamPolicyCall<'a, C, A> { self._request = new_value; self } @@ -2602,7 +1508,7 @@ impl<'a, C, A> ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectIapWebSetIamPolicyCall<'a, C, A> { + pub fn resource(mut self, new_value: &str) -> MethodSetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); self } @@ -2612,7 +1518,7 @@ impl<'a, C, A> ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectIapWebSetIamPolicyCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodSetIamPolicyCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -2621,7 +1527,7 @@ impl<'a, C, A> ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectIapWebSetIamPolicyCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> MethodSetIamPolicyCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -2657,3731 +1563,7 @@ impl<'a, C, A> ProjectIapWebSetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectIapWebSetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets the access control policy for an Identity-Aware Proxy protected -/// resource. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_tunnel.zones.getIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::GetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_tunnel_zones_get_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapTunnelZoneGetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: GetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapTunnelZoneGetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapTunnelZoneGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_tunnel.zones.getIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectIapTunnelZoneGetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapTunnelZoneGetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapTunnelZoneGetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapTunnelZoneGetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapTunnelZoneGetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Sets the access control policy for an Identity-Aware Proxy protected -/// resource. Replaces any existing policy. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_tunnel.setIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::SetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_tunnel_set_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapTunnelSetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: SetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapTunnelSetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapTunnelSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_tunnel.setIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectIapTunnelSetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapTunnelSetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapTunnelSetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapTunnelSetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapTunnelSetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns permissions that a caller has on the Identity-Aware Proxy protected -/// resource. If the resource does not exist or the caller does not have -/// Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] -/// will be returned. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_tunnel.zones.instances.testIamPermissions* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::TestIamPermissionsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = TestIamPermissionsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_tunnel_zones_instances_test_iam_permissions(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapTunnelZoneInstanceTestIamPermissionCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: TestIamPermissionsRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapTunnelZoneInstanceTestIamPermissionCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapTunnelZoneInstanceTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_tunnel.zones.instances.testIamPermissions", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectIapTunnelZoneInstanceTestIamPermissionCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy detail is being requested. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapTunnelZoneInstanceTestIamPermissionCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapTunnelZoneInstanceTestIamPermissionCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapTunnelZoneInstanceTestIamPermissionCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapTunnelZoneInstanceTestIamPermissionCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets the access control policy for an Identity-Aware Proxy protected -/// resource. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_web.getIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::GetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_web_get_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapWebGetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: GetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapWebGetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapWebGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_web.getIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectIapWebGetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapWebGetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapWebGetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapWebGetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapWebGetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Sets the access control policy for an Identity-Aware Proxy protected -/// resource. Replaces any existing policy. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_tunnel.zones.setIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::SetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_tunnel_zones_set_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapTunnelZoneSetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: SetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapTunnelZoneSetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapTunnelZoneSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_tunnel.zones.setIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectIapTunnelZoneSetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapTunnelZoneSetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapTunnelZoneSetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapTunnelZoneSetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapTunnelZoneSetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets the access control policy for an Identity-Aware Proxy protected -/// resource. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_tunnel.getIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::GetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_tunnel_get_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapTunnelGetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: GetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapTunnelGetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapTunnelGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_tunnel.getIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectIapTunnelGetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapTunnelGetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapTunnelGetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapTunnelGetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapTunnelGetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets the access control policy for an Identity-Aware Proxy protected -/// resource. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_web.services.versions.getIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::GetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_web_services_versions_get_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapWebServiceVersionGetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: GetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapWebServiceVersionGetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapWebServiceVersionGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_web.services.versions.getIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectIapWebServiceVersionGetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapWebServiceVersionGetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapWebServiceVersionGetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapWebServiceVersionGetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapWebServiceVersionGetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Sets the access control policy for an Identity-Aware Proxy protected -/// resource. Replaces any existing policy. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_web.services.setIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::SetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_web_services_set_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapWebServiceSetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: SetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapWebServiceSetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapWebServiceSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_web.services.setIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectIapWebServiceSetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapWebServiceSetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapWebServiceSetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapWebServiceSetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapWebServiceSetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Sets the access control policy for an Identity-Aware Proxy protected -/// resource. Replaces any existing policy. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_web.services.versions.setIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::SetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_web_services_versions_set_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapWebServiceVersionSetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: SetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapWebServiceVersionSetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapWebServiceVersionSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_web.services.versions.setIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectIapWebServiceVersionSetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapWebServiceVersionSetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapWebServiceVersionSetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapWebServiceVersionSetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapWebServiceVersionSetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns permissions that a caller has on the Identity-Aware Proxy protected -/// resource. If the resource does not exist or the caller does not have -/// Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] -/// will be returned. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_tunnel.zones.testIamPermissions* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::TestIamPermissionsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = TestIamPermissionsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_tunnel_zones_test_iam_permissions(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapTunnelZoneTestIamPermissionCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: TestIamPermissionsRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapTunnelZoneTestIamPermissionCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapTunnelZoneTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_tunnel.zones.testIamPermissions", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectIapTunnelZoneTestIamPermissionCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy detail is being requested. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapTunnelZoneTestIamPermissionCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapTunnelZoneTestIamPermissionCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapTunnelZoneTestIamPermissionCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapTunnelZoneTestIamPermissionCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets the access control policy for an Identity-Aware Proxy protected -/// resource. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_tunnel.zones.instances.getIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::GetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = GetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_tunnel_zones_instances_get_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapTunnelZoneInstanceGetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: GetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapTunnelZoneInstanceGetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapTunnelZoneInstanceGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_tunnel.zones.instances.getIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectIapTunnelZoneInstanceGetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy is being requested. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapTunnelZoneInstanceGetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapTunnelZoneInstanceGetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapTunnelZoneInstanceGetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapTunnelZoneInstanceGetIamPolicyCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns permissions that a caller has on the Identity-Aware Proxy protected -/// resource. If the resource does not exist or the caller does not have -/// Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] -/// will be returned. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_web.services.versions.testIamPermissions* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::TestIamPermissionsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = TestIamPermissionsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_web_services_versions_test_iam_permissions(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapWebServiceVersionTestIamPermissionCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: TestIamPermissionsRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapWebServiceVersionTestIamPermissionCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapWebServiceVersionTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_web.services.versions.testIamPermissions", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectIapWebServiceVersionTestIamPermissionCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy detail is being requested. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapWebServiceVersionTestIamPermissionCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapWebServiceVersionTestIamPermissionCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapWebServiceVersionTestIamPermissionCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapWebServiceVersionTestIamPermissionCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Sets the access control policy for an Identity-Aware Proxy protected -/// resource. Replaces any existing policy. -/// More information about managing access via IAP can be found at: -/// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api -/// -/// A builder for the *iap_tunnel.zones.instances.setIamPolicy* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_iap1_beta1 as iap1_beta1; -/// use iap1_beta1::SetIamPolicyRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use iap1_beta1::CloudIAP; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudIAP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SetIamPolicyRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().iap_tunnel_zones_instances_set_iam_policy(req, "resource") -/// .doit(); -/// # } -/// ``` -pub struct ProjectIapTunnelZoneInstanceSetIamPolicyCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudIAP, - _request: SetIamPolicyRequest, - _resource: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectIapTunnelZoneInstanceSetIamPolicyCall<'a, C, A> {} - -impl<'a, C, A> ProjectIapTunnelZoneInstanceSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "iap.projects.iap_tunnel.zones.instances.setIamPolicy", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "resource"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+resource}", "resource")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["resource"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectIapTunnelZoneInstanceSetIamPolicyCall<'a, C, A> { - self._request = new_value; - self - } - /// REQUIRED: The resource for which the policy is being specified. - /// See the operation documentation for the appropriate value for this field. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ProjectIapTunnelZoneInstanceSetIamPolicyCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectIapTunnelZoneInstanceSetIamPolicyCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectIapTunnelZoneInstanceSetIamPolicyCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectIapTunnelZoneInstanceSetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MethodSetIamPolicyCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { diff --git a/gen/identitytoolkit3/Cargo.toml b/gen/identitytoolkit3/Cargo.toml index 737855f832..c0c84eb11c 100644 --- a/gen/identitytoolkit3/Cargo.toml +++ b/gen/identitytoolkit3/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/identitytoolkit3/src/lib.rs b/gen/identitytoolkit3/src/lib.rs index 4a869f1e9d..240289b9e4 100644 --- a/gen/identitytoolkit3/src/lib.rs +++ b/gen/identitytoolkit3/src/lib.rs @@ -2427,10 +2427,7 @@ impl<'a, C, A> RelyingpartyEmailLinkSigninCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2462,7 +2459,7 @@ impl<'a, C, A> RelyingpartyEmailLinkSigninCall<'a, C, A> where C: BorrowMut RelyingpartyEmailLinkSigninCall<'a, C, A> where C: BorrowMut RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2703,7 +2697,7 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2783,7 +2777,7 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2902,10 +2896,7 @@ impl<'a, C, A> RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2925,7 +2916,7 @@ impl<'a, C, A> RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3154,7 +3142,7 @@ impl<'a, C, A> RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3376,7 +3361,7 @@ impl<'a, C, A> RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut RelyingpartySignOutUserCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3605,7 +3587,7 @@ impl<'a, C, A> RelyingpartySignOutUserCall<'a, C, A> where C: BorrowMut RelyingpartySignOutUserCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3846,7 +3825,7 @@ impl<'a, C, A> RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4087,7 +4063,7 @@ impl<'a, C, A> RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4328,7 +4301,7 @@ impl<'a, C, A> RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyCustomTokenCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4569,7 +4539,7 @@ impl<'a, C, A> RelyingpartyVerifyCustomTokenCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyCustomTokenCall<'a, C, A> where C: BorrowMut RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4810,7 +4777,7 @@ impl<'a, C, A> RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5051,7 +5015,7 @@ impl<'a, C, A> RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5292,7 +5253,7 @@ impl<'a, C, A> RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5533,7 +5491,7 @@ impl<'a, C, A> RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut RelyingpartySignupNewUserCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5774,7 +5729,7 @@ impl<'a, C, A> RelyingpartySignupNewUserCall<'a, C, A> where C: BorrowMut RelyingpartySignupNewUserCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyPhoneNumberCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6015,7 +5967,7 @@ impl<'a, C, A> RelyingpartyVerifyPhoneNumberCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyPhoneNumberCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6256,7 +6205,7 @@ impl<'a, C, A> RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut RelyingpartySetProjectConfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6497,7 +6443,7 @@ impl<'a, C, A> RelyingpartySetProjectConfigCall<'a, C, A> where C: BorrowMut RelyingpartySetProjectConfigCall<'a, C, A> where C: BorrowMut RelyingpartySendVerificationCodeCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6738,7 +6681,7 @@ impl<'a, C, A> RelyingpartySendVerificationCodeCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6818,7 +6761,7 @@ impl<'a, C, A> RelyingpartySendVerificationCodeCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6947,10 +6890,7 @@ impl<'a, C, A> RelyingpartyGetProjectConfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6970,7 +6910,7 @@ impl<'a, C, A> RelyingpartyGetProjectConfigCall<'a, C, A> where C: BorrowMut RelyingpartyGetProjectConfigCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Indexing (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/indexing3-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-indexing3] path = "../indexing3" -version = "1.0.8+20181005" +version = "1.0.8+20190330" diff --git a/gen/indexing3-cli/README.md b/gen/indexing3-cli/README.md index 6723fc6187..8b4dc398e7 100644 --- a/gen/indexing3-cli/README.md +++ b/gen/indexing3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Indexing* API at revision *20181005*. The CLI is at version *1.0.8*. +This documentation was generated from the *Indexing* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash indexing3 [options] diff --git a/gen/indexing3-cli/mkdocs.yml b/gen/indexing3-cli/mkdocs.yml index b04ecf54c9..ab5365b33b 100644 --- a/gen/indexing3-cli/mkdocs.yml +++ b/gen/indexing3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Indexing v1.0.8+20181005 +site_name: Indexing v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-indexing3-cli site_description: A complete library to interact with Indexing (protocol v3) diff --git a/gen/indexing3-cli/src/main.rs b/gen/indexing3-cli/src/main.rs index 4ee1cd843b..7d8120ff7e 100644 --- a/gen/indexing3-cli/src/main.rs +++ b/gen/indexing3-cli/src/main.rs @@ -340,8 +340,8 @@ fn main() { let mut app = App::new("indexing3") .author("Sebastian Thiel ") - .version("1.0.8+20181005") - .about("The Indexing API allows developers to share the life cycle of a Web Document with Google.") + .version("1.0.8+20190330") + .about("Notifies Google when your web pages change.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_indexing3_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/indexing3/Cargo.toml b/gen/indexing3/Cargo.toml index 799e924b0d..753e67a573 100644 --- a/gen/indexing3/Cargo.toml +++ b/gen/indexing3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-indexing3" -version = "1.0.8+20181005" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Indexing (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/indexing3" homepage = "https://developers.google.com/search/apis/indexing-api/" -documentation = "https://docs.rs/google-indexing3/1.0.8+20181005" +documentation = "https://docs.rs/google-indexing3/1.0.8+20190330" license = "MIT" keywords = ["indexing", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/indexing3/README.md b/gen/indexing3/README.md index 3b3c4c65be..cfdb0e5cef 100644 --- a/gen/indexing3/README.md +++ b/gen/indexing3/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-indexing3` library allows access to all features of the *Google Indexing* service. -This documentation was generated from *Indexing* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *indexing:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Indexing* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *indexing:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Indexing* *v3* API can be found at the [official documentation site](https://developers.google.com/search/apis/indexing-api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/struct.Indexing.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/struct.Indexing.html) ... -* [url notifications](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/struct.UrlNotification.html) - * [*get metadata*](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/struct.UrlNotificationGetMetadataCall.html) and [*publish*](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/struct.UrlNotificationPublishCall.html) +* [url notifications](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/struct.UrlNotification.html) + * [*get metadata*](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/struct.UrlNotificationGetMetadataCall.html) and [*publish*](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/struct.UrlNotificationPublishCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/struct.Indexing.html)** +* **[Hub](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/struct.Indexing.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.Part.html)** + * **[Parts](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -131,17 +131,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -151,29 +151,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-indexing3/1.0.8+20181005/google_indexing3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-indexing3/1.0.8+20190330/google_indexing3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/indexing3/src/lib.rs b/gen/indexing3/src/lib.rs index 948d4172e4..358f4fe472 100644 --- a/gen/indexing3/src/lib.rs +++ b/gen/indexing3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Indexing* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *indexing:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Indexing* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *indexing:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Indexing* *v3* API can be found at the //! [official documentation site](https://developers.google.com/search/apis/indexing-api/). @@ -612,10 +612,7 @@ impl<'a, C, A> UrlNotificationPublishCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -647,7 +644,7 @@ impl<'a, C, A> UrlNotificationPublishCall<'a, C, A> where C: BorrowMut UrlNotificationPublishCall<'a, C, A> where C: BorrowMut UrlNotificationGetMetadataCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -880,7 +874,7 @@ impl<'a, C, A> UrlNotificationGetMetadataCall<'a, C, A> where C: BorrowMut UrlNotificationGetMetadataCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Cloud Talent Solution (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/jobs3-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-jobs3] path = "../jobs3" -version = "1.0.8+20181008" +version = "1.0.8+20190322" diff --git a/gen/jobs3-cli/README.md b/gen/jobs3-cli/README.md index bb42595e87..2158213706 100644 --- a/gen/jobs3-cli/README.md +++ b/gen/jobs3-cli/README.md @@ -25,11 +25,12 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Talent Solution* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Talent Solution* API at revision *20190322*. The CLI is at version *1.0.8*. ```bash jobs3 [options] projects + client-events-create (-r )... [-p ]... [-o ] companies-create (-r )... [-p ]... [-o ] companies-delete [-p ]... [-o ] companies-get [-p ]... [-o ] diff --git a/gen/jobs3-cli/mkdocs.yml b/gen/jobs3-cli/mkdocs.yml index 151af61e75..ed413dd7a2 100644 --- a/gen/jobs3-cli/mkdocs.yml +++ b/gen/jobs3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Talent Solution v1.0.8+20181008 +site_name: Cloud Talent Solution v1.0.8+20190322 site_url: http://byron.github.io/google-apis-rs/google-jobs3-cli site_description: A complete library to interact with Cloud Talent Solution (protocol v3) @@ -9,6 +9,7 @@ site_dir: build_html pages: - ['index.md', 'Home'] +- ['projects_client-events-create.md', 'Projects', 'Client Events Create'] - ['projects_companies-create.md', 'Projects', 'Companies Create'] - ['projects_companies-delete.md', 'Projects', 'Companies Delete'] - ['projects_companies-get.md', 'Projects', 'Companies Get'] diff --git a/gen/jobs3-cli/src/main.rs b/gen/jobs3-cli/src/main.rs index a5d13256c6..351a44bf12 100644 --- a/gen/jobs3-cli/src/main.rs +++ b/gen/jobs3-cli/src/main.rs @@ -46,6 +46,97 @@ struct Engine<'n> { impl<'n> Engine<'n> { + fn _projects_client_events_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "client-event.event-id" => Some(("clientEvent.eventId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "client-event.parent-event-id" => Some(("clientEvent.parentEventId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "client-event.extra-info" => Some(("clientEvent.extraInfo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "client-event.job-event.type" => Some(("clientEvent.jobEvent.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "client-event.job-event.jobs" => Some(("clientEvent.jobEvent.jobs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "client-event.request-id" => Some(("clientEvent.requestId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "client-event.create-time" => Some(("clientEvent.createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["client-event", "create-time", "event-id", "extra-info", "job-event", "jobs", "parent-event-id", "request-id", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreateClientEventRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().client_events_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_companies_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -72,9 +163,6 @@ impl<'n> Engine<'n> { "company.display-name" => Some(("company.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.name" => Some(("company.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.career-site-uri" => Some(("company.careerSiteUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "company.headquarters-address" => Some(("company.headquartersAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "company.eeo-text" => Some(("company.eeoText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "company.image-uri" => Some(("company.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.derived-info.headquarters-location.location-type" => Some(("company.derivedInfo.headquartersLocation.locationType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.derived-info.headquarters-location.radius-in-miles" => Some(("company.derivedInfo.headquartersLocation.radiusInMiles", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "company.derived-info.headquarters-location.lat-lng.latitude" => Some(("company.derivedInfo.headquartersLocation.latLng.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -90,6 +178,9 @@ impl<'n> Engine<'n> { "company.derived-info.headquarters-location.postal-address.organization" => Some(("company.derivedInfo.headquartersLocation.postalAddress.organization", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.derived-info.headquarters-location.postal-address.sublocality" => Some(("company.derivedInfo.headquartersLocation.postalAddress.sublocality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.derived-info.headquarters-location.postal-address.revision" => Some(("company.derivedInfo.headquartersLocation.postalAddress.revision", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "company.eeo-text" => Some(("company.eeoText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "company.image-uri" => Some(("company.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "company.headquarters-address" => Some(("company.headquartersAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.external-id" => Some(("company.externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.website-uri" => Some(("company.websiteUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.suspended" => Some(("company.suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -349,9 +440,6 @@ impl<'n> Engine<'n> { "company.display-name" => Some(("company.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.name" => Some(("company.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.career-site-uri" => Some(("company.careerSiteUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "company.headquarters-address" => Some(("company.headquartersAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "company.eeo-text" => Some(("company.eeoText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "company.image-uri" => Some(("company.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.derived-info.headquarters-location.location-type" => Some(("company.derivedInfo.headquartersLocation.locationType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.derived-info.headquarters-location.radius-in-miles" => Some(("company.derivedInfo.headquartersLocation.radiusInMiles", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "company.derived-info.headquarters-location.lat-lng.latitude" => Some(("company.derivedInfo.headquartersLocation.latLng.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -367,6 +455,9 @@ impl<'n> Engine<'n> { "company.derived-info.headquarters-location.postal-address.organization" => Some(("company.derivedInfo.headquartersLocation.postalAddress.organization", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.derived-info.headquarters-location.postal-address.sublocality" => Some(("company.derivedInfo.headquartersLocation.postalAddress.sublocality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.derived-info.headquarters-location.postal-address.revision" => Some(("company.derivedInfo.headquartersLocation.postalAddress.revision", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "company.eeo-text" => Some(("company.eeoText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "company.image-uri" => Some(("company.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "company.headquarters-address" => Some(("company.headquartersAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.external-id" => Some(("company.externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.website-uri" => Some(("company.websiteUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "company.suspended" => Some(("company.suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -453,6 +544,9 @@ impl<'n> Engine<'n> { "page-size" => { call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); }, + "language-codes" => { + call = call.add_language_codes(value.unwrap_or("")); + }, "language-code" => { call = call.language_code(value.unwrap_or("")); }, @@ -472,7 +566,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["language-code", "page-size", "company-name", "query", "scope", "type"].iter().map(|v|*v)); + v.extend(["language-code", "page-size", "company-name", "query", "scope", "language-codes", "type"].iter().map(|v|*v)); v } )); } } @@ -620,34 +714,34 @@ impl<'n> Engine<'n> { "job.promotion-value" => Some(("job.promotionValue", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job.employment-types" => Some(("job.employmentTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.job-end-time" => Some(("job.jobEndTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.description" => Some(("job.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.application-info.instruction" => Some(("job.applicationInfo.instruction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.application-info.emails" => Some(("job.applicationInfo.emails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.application-info.uris" => Some(("job.applicationInfo.uris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.posting-expire-time" => Some(("job.postingExpireTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.title" => Some(("job.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.responsibilities" => Some(("job.responsibilities", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.job-start-time" => Some(("job.jobStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.compensation-info.annualized-total-compensation-range.min-compensation.units" => Some(("job.compensationInfo.annualizedTotalCompensationRange.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-total-compensation-range.min-compensation.nanos" => Some(("job.compensationInfo.annualizedTotalCompensationRange.minCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job.compensation-info.annualized-total-compensation-range.min-compensation.units" => Some(("job.compensationInfo.annualizedTotalCompensationRange.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-total-compensation-range.min-compensation.currency-code" => Some(("job.compensationInfo.annualizedTotalCompensationRange.minCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.compensation-info.annualized-total-compensation-range.max-compensation.units" => Some(("job.compensationInfo.annualizedTotalCompensationRange.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-total-compensation-range.max-compensation.nanos" => Some(("job.compensationInfo.annualizedTotalCompensationRange.maxCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job.compensation-info.annualized-total-compensation-range.max-compensation.units" => Some(("job.compensationInfo.annualizedTotalCompensationRange.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-total-compensation-range.max-compensation.currency-code" => Some(("job.compensationInfo.annualizedTotalCompensationRange.maxCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.compensation-info.annualized-base-compensation-range.min-compensation.units" => Some(("job.compensationInfo.annualizedBaseCompensationRange.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-base-compensation-range.min-compensation.nanos" => Some(("job.compensationInfo.annualizedBaseCompensationRange.minCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job.compensation-info.annualized-base-compensation-range.min-compensation.units" => Some(("job.compensationInfo.annualizedBaseCompensationRange.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-base-compensation-range.min-compensation.currency-code" => Some(("job.compensationInfo.annualizedBaseCompensationRange.minCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.compensation-info.annualized-base-compensation-range.max-compensation.units" => Some(("job.compensationInfo.annualizedBaseCompensationRange.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-base-compensation-range.max-compensation.nanos" => Some(("job.compensationInfo.annualizedBaseCompensationRange.maxCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job.compensation-info.annualized-base-compensation-range.max-compensation.units" => Some(("job.compensationInfo.annualizedBaseCompensationRange.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-base-compensation-range.max-compensation.currency-code" => Some(("job.compensationInfo.annualizedBaseCompensationRange.maxCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.department" => Some(("job.department", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.posting-update-time" => Some(("job.postingUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.job-benefits" => Some(("job.jobBenefits", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.requisition-id" => Some(("job.requisitionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.posting-publish-time" => Some(("job.postingPublishTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.application-info.instruction" => Some(("job.applicationInfo.instruction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.application-info.uris" => Some(("job.applicationInfo.uris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job.application-info.emails" => Some(("job.applicationInfo.emails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.description" => Some(("job.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.company-name" => Some(("job.companyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.derived-info.job-categories" => Some(("job.derivedInfo.jobCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.qualifications" => Some(("job.qualifications", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.requisition-id" => Some(("job.requisitionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.job-benefits" => Some(("job.jobBenefits", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.incentives" => Some(("job.incentives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.visibility" => Some(("job.visibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.posting-create-time" => Some(("job.postingCreateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -916,34 +1010,34 @@ impl<'n> Engine<'n> { "job.promotion-value" => Some(("job.promotionValue", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job.employment-types" => Some(("job.employmentTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.job-end-time" => Some(("job.jobEndTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.description" => Some(("job.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.application-info.instruction" => Some(("job.applicationInfo.instruction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.application-info.emails" => Some(("job.applicationInfo.emails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.application-info.uris" => Some(("job.applicationInfo.uris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.posting-expire-time" => Some(("job.postingExpireTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.title" => Some(("job.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.responsibilities" => Some(("job.responsibilities", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.job-start-time" => Some(("job.jobStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.compensation-info.annualized-total-compensation-range.min-compensation.units" => Some(("job.compensationInfo.annualizedTotalCompensationRange.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-total-compensation-range.min-compensation.nanos" => Some(("job.compensationInfo.annualizedTotalCompensationRange.minCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job.compensation-info.annualized-total-compensation-range.min-compensation.units" => Some(("job.compensationInfo.annualizedTotalCompensationRange.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-total-compensation-range.min-compensation.currency-code" => Some(("job.compensationInfo.annualizedTotalCompensationRange.minCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.compensation-info.annualized-total-compensation-range.max-compensation.units" => Some(("job.compensationInfo.annualizedTotalCompensationRange.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-total-compensation-range.max-compensation.nanos" => Some(("job.compensationInfo.annualizedTotalCompensationRange.maxCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job.compensation-info.annualized-total-compensation-range.max-compensation.units" => Some(("job.compensationInfo.annualizedTotalCompensationRange.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-total-compensation-range.max-compensation.currency-code" => Some(("job.compensationInfo.annualizedTotalCompensationRange.maxCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.compensation-info.annualized-base-compensation-range.min-compensation.units" => Some(("job.compensationInfo.annualizedBaseCompensationRange.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-base-compensation-range.min-compensation.nanos" => Some(("job.compensationInfo.annualizedBaseCompensationRange.minCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job.compensation-info.annualized-base-compensation-range.min-compensation.units" => Some(("job.compensationInfo.annualizedBaseCompensationRange.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-base-compensation-range.min-compensation.currency-code" => Some(("job.compensationInfo.annualizedBaseCompensationRange.minCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.compensation-info.annualized-base-compensation-range.max-compensation.units" => Some(("job.compensationInfo.annualizedBaseCompensationRange.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-base-compensation-range.max-compensation.nanos" => Some(("job.compensationInfo.annualizedBaseCompensationRange.maxCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job.compensation-info.annualized-base-compensation-range.max-compensation.units" => Some(("job.compensationInfo.annualizedBaseCompensationRange.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.compensation-info.annualized-base-compensation-range.max-compensation.currency-code" => Some(("job.compensationInfo.annualizedBaseCompensationRange.maxCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.department" => Some(("job.department", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.posting-update-time" => Some(("job.postingUpdateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.job-benefits" => Some(("job.jobBenefits", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.requisition-id" => Some(("job.requisitionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.posting-publish-time" => Some(("job.postingPublishTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.application-info.instruction" => Some(("job.applicationInfo.instruction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.application-info.uris" => Some(("job.applicationInfo.uris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job.application-info.emails" => Some(("job.applicationInfo.emails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "job.description" => Some(("job.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.company-name" => Some(("job.companyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.derived-info.job-categories" => Some(("job.derivedInfo.jobCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.qualifications" => Some(("job.qualifications", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job.requisition-id" => Some(("job.requisitionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "job.job-benefits" => Some(("job.jobBenefits", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job.incentives" => Some(("job.incentives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.visibility" => Some(("job.visibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job.posting-create-time" => Some(("job.postingCreateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1039,7 +1133,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "order-by" => Some(("orderBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "histogram-facets.simple-histogram-facets" => Some(("histogramFacets.simpleHistogramFacets", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "diversification-level" => Some(("diversificationLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enable-broadening" => Some(("enableBroadening", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "job-query.disable-spell-check" => Some(("jobQuery.disableSpellCheck", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "job-query.custom-attribute-filter" => Some(("jobQuery.customAttributeFilter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1047,10 +1141,10 @@ impl<'n> Engine<'n> { "job-query.query" => Some(("jobQuery.query", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.publish-time-range.end-time" => Some(("jobQuery.publishTimeRange.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.publish-time-range.start-time" => Some(("jobQuery.publishTimeRange.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job-query.commute-filter.departure-time.nanos" => Some(("jobQuery.commuteFilter.departureTime.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "job-query.commute-filter.departure-time.seconds" => Some(("jobQuery.commuteFilter.departureTime.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job-query.commute-filter.departure-time.hours" => Some(("jobQuery.commuteFilter.departureTime.hours", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-query.commute-filter.departure-time.nanos" => Some(("jobQuery.commuteFilter.departureTime.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job-query.commute-filter.departure-time.minutes" => Some(("jobQuery.commuteFilter.departureTime.minutes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-query.commute-filter.departure-time.seconds" => Some(("jobQuery.commuteFilter.departureTime.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job-query.commute-filter.road-traffic" => Some(("jobQuery.commuteFilter.roadTraffic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.commute-filter.start-coordinates.latitude" => Some(("jobQuery.commuteFilter.startCoordinates.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "job-query.commute-filter.start-coordinates.longitude" => Some(("jobQuery.commuteFilter.startCoordinates.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -1062,28 +1156,29 @@ impl<'n> Engine<'n> { "job-query.company-names" => Some(("jobQuery.companyNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job-query.company-display-names" => Some(("jobQuery.companyDisplayNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job-query.compensation-filter.units" => Some(("jobQuery.compensationFilter.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job-query.compensation-filter.range.min-compensation.units" => Some(("jobQuery.compensationFilter.range.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.range.min-compensation.nanos" => Some(("jobQuery.compensationFilter.range.minCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-query.compensation-filter.range.min-compensation.units" => Some(("jobQuery.compensationFilter.range.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.range.min-compensation.currency-code" => Some(("jobQuery.compensationFilter.range.minCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job-query.compensation-filter.range.max-compensation.units" => Some(("jobQuery.compensationFilter.range.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.range.max-compensation.nanos" => Some(("jobQuery.compensationFilter.range.maxCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-query.compensation-filter.range.max-compensation.units" => Some(("jobQuery.compensationFilter.range.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.range.max-compensation.currency-code" => Some(("jobQuery.compensationFilter.range.maxCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.type" => Some(("jobQuery.compensationFilter.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.include-jobs-with-unspecified-compensation-range" => Some(("jobQuery.compensationFilter.includeJobsWithUnspecifiedCompensationRange", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "histogram-facets.simple-histogram-facets" => Some(("histogramFacets.simpleHistogramFacets", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "search-mode" => Some(("searchMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "request-metadata.user-id" => Some(("requestMetadata.userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "request-metadata.session-id" => Some(("requestMetadata.sessionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "request-metadata.domain" => Some(("requestMetadata.domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "request-metadata.device-info.device-type" => Some(("requestMetadata.deviceInfo.deviceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "request-metadata.device-info.id" => Some(("requestMetadata.deviceInfo.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "request-metadata.domain" => Some(("requestMetadata.domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "request-metadata.session-id" => Some(("requestMetadata.sessionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "require-precise-result-size" => Some(("requirePreciseResultSize", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "job-view" => Some(("jobView", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "offset" => Some(("offset", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "disable-keyword-match" => Some(("disableKeywordMatch", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-imprecise-addresses", "commute-filter", "commute-method", "company-display-names", "company-names", "compensation-filter", "currency-code", "custom-attribute-filter", "departure-time", "device-info", "device-type", "disable-keyword-match", "disable-spell-check", "domain", "employment-types", "enable-broadening", "end-time", "histogram-facets", "hours", "id", "include-jobs-with-unspecified-compensation-range", "job-categories", "job-query", "job-view", "language-codes", "latitude", "longitude", "max-compensation", "min-compensation", "minutes", "nanos", "offset", "order-by", "page-size", "page-token", "publish-time-range", "query", "range", "request-metadata", "require-precise-result-size", "road-traffic", "search-mode", "seconds", "session-id", "simple-histogram-facets", "start-coordinates", "start-time", "travel-duration", "type", "units", "user-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-imprecise-addresses", "commute-filter", "commute-method", "company-display-names", "company-names", "compensation-filter", "currency-code", "custom-attribute-filter", "departure-time", "device-info", "device-type", "disable-keyword-match", "disable-spell-check", "diversification-level", "domain", "employment-types", "enable-broadening", "end-time", "histogram-facets", "hours", "id", "include-jobs-with-unspecified-compensation-range", "job-categories", "job-query", "job-view", "language-codes", "latitude", "longitude", "max-compensation", "min-compensation", "minutes", "nanos", "offset", "order-by", "page-size", "page-token", "publish-time-range", "query", "range", "request-metadata", "require-precise-result-size", "road-traffic", "search-mode", "seconds", "session-id", "simple-histogram-facets", "start-coordinates", "start-time", "travel-duration", "type", "units", "user-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1167,7 +1262,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "order-by" => Some(("orderBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "histogram-facets.simple-histogram-facets" => Some(("histogramFacets.simpleHistogramFacets", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "diversification-level" => Some(("diversificationLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enable-broadening" => Some(("enableBroadening", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "job-query.disable-spell-check" => Some(("jobQuery.disableSpellCheck", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "job-query.custom-attribute-filter" => Some(("jobQuery.customAttributeFilter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1175,10 +1270,10 @@ impl<'n> Engine<'n> { "job-query.query" => Some(("jobQuery.query", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.publish-time-range.end-time" => Some(("jobQuery.publishTimeRange.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.publish-time-range.start-time" => Some(("jobQuery.publishTimeRange.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job-query.commute-filter.departure-time.nanos" => Some(("jobQuery.commuteFilter.departureTime.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "job-query.commute-filter.departure-time.seconds" => Some(("jobQuery.commuteFilter.departureTime.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job-query.commute-filter.departure-time.hours" => Some(("jobQuery.commuteFilter.departureTime.hours", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-query.commute-filter.departure-time.nanos" => Some(("jobQuery.commuteFilter.departureTime.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job-query.commute-filter.departure-time.minutes" => Some(("jobQuery.commuteFilter.departureTime.minutes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-query.commute-filter.departure-time.seconds" => Some(("jobQuery.commuteFilter.departureTime.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "job-query.commute-filter.road-traffic" => Some(("jobQuery.commuteFilter.roadTraffic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.commute-filter.start-coordinates.latitude" => Some(("jobQuery.commuteFilter.startCoordinates.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "job-query.commute-filter.start-coordinates.longitude" => Some(("jobQuery.commuteFilter.startCoordinates.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -1190,28 +1285,29 @@ impl<'n> Engine<'n> { "job-query.company-names" => Some(("jobQuery.companyNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job-query.company-display-names" => Some(("jobQuery.companyDisplayNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "job-query.compensation-filter.units" => Some(("jobQuery.compensationFilter.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "job-query.compensation-filter.range.min-compensation.units" => Some(("jobQuery.compensationFilter.range.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.range.min-compensation.nanos" => Some(("jobQuery.compensationFilter.range.minCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-query.compensation-filter.range.min-compensation.units" => Some(("jobQuery.compensationFilter.range.minCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.range.min-compensation.currency-code" => Some(("jobQuery.compensationFilter.range.minCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "job-query.compensation-filter.range.max-compensation.units" => Some(("jobQuery.compensationFilter.range.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.range.max-compensation.nanos" => Some(("jobQuery.compensationFilter.range.maxCompensation.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "job-query.compensation-filter.range.max-compensation.units" => Some(("jobQuery.compensationFilter.range.maxCompensation.units", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.range.max-compensation.currency-code" => Some(("jobQuery.compensationFilter.range.maxCompensation.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.type" => Some(("jobQuery.compensationFilter.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "job-query.compensation-filter.include-jobs-with-unspecified-compensation-range" => Some(("jobQuery.compensationFilter.includeJobsWithUnspecifiedCompensationRange", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "histogram-facets.simple-histogram-facets" => Some(("histogramFacets.simpleHistogramFacets", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "search-mode" => Some(("searchMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "request-metadata.user-id" => Some(("requestMetadata.userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "request-metadata.session-id" => Some(("requestMetadata.sessionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "request-metadata.domain" => Some(("requestMetadata.domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "request-metadata.device-info.device-type" => Some(("requestMetadata.deviceInfo.deviceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "request-metadata.device-info.id" => Some(("requestMetadata.deviceInfo.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "request-metadata.domain" => Some(("requestMetadata.domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "request-metadata.session-id" => Some(("requestMetadata.sessionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "require-precise-result-size" => Some(("requirePreciseResultSize", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "job-view" => Some(("jobView", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "offset" => Some(("offset", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "disable-keyword-match" => Some(("disableKeywordMatch", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-imprecise-addresses", "commute-filter", "commute-method", "company-display-names", "company-names", "compensation-filter", "currency-code", "custom-attribute-filter", "departure-time", "device-info", "device-type", "disable-keyword-match", "disable-spell-check", "domain", "employment-types", "enable-broadening", "end-time", "histogram-facets", "hours", "id", "include-jobs-with-unspecified-compensation-range", "job-categories", "job-query", "job-view", "language-codes", "latitude", "longitude", "max-compensation", "min-compensation", "minutes", "nanos", "offset", "order-by", "page-size", "page-token", "publish-time-range", "query", "range", "request-metadata", "require-precise-result-size", "road-traffic", "search-mode", "seconds", "session-id", "simple-histogram-facets", "start-coordinates", "start-time", "travel-duration", "type", "units", "user-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-imprecise-addresses", "commute-filter", "commute-method", "company-display-names", "company-names", "compensation-filter", "currency-code", "custom-attribute-filter", "departure-time", "device-info", "device-type", "disable-keyword-match", "disable-spell-check", "diversification-level", "domain", "employment-types", "enable-broadening", "end-time", "histogram-facets", "hours", "id", "include-jobs-with-unspecified-compensation-range", "job-categories", "job-query", "job-view", "language-codes", "latitude", "longitude", "max-compensation", "min-compensation", "minutes", "nanos", "offset", "order-by", "page-size", "page-token", "publish-time-range", "query", "range", "request-metadata", "require-precise-result-size", "road-traffic", "search-mode", "seconds", "session-id", "simple-histogram-facets", "start-coordinates", "start-time", "travel-duration", "type", "units", "user-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1278,6 +1374,9 @@ impl<'n> Engine<'n> { match self.opt.subcommand() { ("projects", Some(opt)) => { match opt.subcommand() { + ("client-events-create", Some(opt)) => { + call_result = self._projects_client_events_create(opt, dry_run, &mut err); + }, ("companies-create", Some(opt)) => { call_result = self._projects_companies_create(opt, dry_run, &mut err); }, @@ -1411,7 +1510,41 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'companies-create', 'companies-delete', 'companies-get', 'companies-list', 'companies-patch', 'complete', 'jobs-batch-delete', 'jobs-create', 'jobs-delete', 'jobs-get', 'jobs-list', 'jobs-patch', 'jobs-search' and 'jobs-search-for-alert'", vec![ + ("projects", "methods: 'client-events-create', 'companies-create', 'companies-delete', 'companies-get', 'companies-list', 'companies-patch', 'complete', 'jobs-batch-delete', 'jobs-create', 'jobs-delete', 'jobs-get', 'jobs-list', 'jobs-patch', 'jobs-search' and 'jobs-search-for-alert'", vec![ + ("client-events-create", + Some(r##"Report events issued when end user interacts with customer's application + that uses Cloud Talent Solution. You may inspect the created events in + [self service + tools](https://console.cloud.google.com/talent-solution/overview). + [Learn + more](https://cloud.google.com/talent-solution/job-search/docs/management-tools) + about self service tools."##), + "Details at http://byron.github.io/google-apis-rs/google_jobs3_cli/projects_client-events-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Parent project name."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), ("companies-create", Some(r##"Creates a new company entity."##), "Details at http://byron.github.io/google-apis-rs/google_jobs3_cli/projects_companies-create", @@ -1446,7 +1579,8 @@ fn main() { Some(false)), ]), ("companies-delete", - Some(r##"Deletes specified company."##), + Some(r##"Deletes specified company. + Prerequisite: The company has no jobs associated with it."##), "Details at http://byron.github.io/google-apis-rs/google_jobs3_cli/projects_companies-delete", vec![ (Some(r##"name"##), @@ -1869,7 +2003,7 @@ fn main() { let mut app = App::new("jobs3") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190322") .about("Cloud Talent Solution provides the capability to create, read, update, and delete job postings, as well as search jobs based on keywords and filters. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_jobs3_cli") diff --git a/gen/jobs3/Cargo.toml b/gen/jobs3/Cargo.toml index 485eafe8db..a8ddc0162e 100644 --- a/gen/jobs3/Cargo.toml +++ b/gen/jobs3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-jobs3" -version = "1.0.8+20181008" +version = "1.0.8+20190322" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Talent Solution (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/jobs3" homepage = "https://cloud.google.com/talent-solution/job-search/docs/" -documentation = "https://docs.rs/google-jobs3/1.0.8+20181008" +documentation = "https://docs.rs/google-jobs3/1.0.8+20190322" license = "MIT" keywords = ["jobs", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/jobs3/README.md b/gen/jobs3/README.md index 2b68af8cad..e15c4ddc42 100644 --- a/gen/jobs3/README.md +++ b/gen/jobs3/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-jobs3` library allows access to all features of the *Google Cloud Talent Solution* service. -This documentation was generated from *Cloud Talent Solution* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *jobs:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Talent Solution* crate version *1.0.8+20190322*, where *20190322* is the exact revision of the *jobs:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Talent Solution* *v3* API can be found at the [official documentation site](https://cloud.google.com/talent-solution/job-search/docs/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.CloudTalentSolution.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.CloudTalentSolution.html) ... * projects - * [*companies create*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectCompanyCreateCall.html), [*companies delete*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectCompanyDeleteCall.html), [*companies get*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectCompanyGetCall.html), [*companies list*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectCompanyListCall.html), [*companies patch*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectCompanyPatchCall.html), [*complete*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectCompleteCall.html), [*jobs batch delete*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectJobBatchDeleteCall.html), [*jobs create*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectJobCreateCall.html), [*jobs delete*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectJobDeleteCall.html), [*jobs get*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectJobGetCall.html), [*jobs list*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectJobListCall.html), [*jobs patch*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectJobPatchCall.html), [*jobs search*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectJobSearchCall.html) and [*jobs search for alert*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.ProjectJobSearchForAlertCall.html) + * [*client events create*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectClientEventCreateCall.html), [*companies create*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectCompanyCreateCall.html), [*companies delete*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectCompanyDeleteCall.html), [*companies get*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectCompanyGetCall.html), [*companies list*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectCompanyListCall.html), [*companies patch*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectCompanyPatchCall.html), [*complete*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectCompleteCall.html), [*jobs batch delete*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectJobBatchDeleteCall.html), [*jobs create*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectJobCreateCall.html), [*jobs delete*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectJobDeleteCall.html), [*jobs get*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectJobGetCall.html), [*jobs list*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectJobListCall.html), [*jobs patch*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectJobPatchCall.html), [*jobs search*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectJobSearchCall.html) and [*jobs search for alert*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.ProjectJobSearchForAlertCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/struct.CloudTalentSolution.html)** +* **[Hub](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/struct.CloudTalentSolution.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.Part.html)** + * **[Parts](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-jobs3/1.0.8+20181008/google_jobs3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-jobs3/1.0.8+20190322/google_jobs3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/jobs3/src/lib.rs b/gen/jobs3/src/lib.rs index 45650a1ff6..ce2e8391a8 100644 --- a/gen/jobs3/src/lib.rs +++ b/gen/jobs3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Talent Solution* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *jobs:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Talent Solution* crate version *1.0.8+20190322*, where *20190322* is the exact revision of the *jobs:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Talent Solution* *v3* API can be found at the //! [official documentation site](https://cloud.google.com/talent-solution/job-search/docs/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.CloudTalentSolution.html) ... //! //! * projects -//! * [*companies create*](struct.ProjectCompanyCreateCall.html), [*companies delete*](struct.ProjectCompanyDeleteCall.html), [*companies get*](struct.ProjectCompanyGetCall.html), [*companies list*](struct.ProjectCompanyListCall.html), [*companies patch*](struct.ProjectCompanyPatchCall.html), [*complete*](struct.ProjectCompleteCall.html), [*jobs batch delete*](struct.ProjectJobBatchDeleteCall.html), [*jobs create*](struct.ProjectJobCreateCall.html), [*jobs delete*](struct.ProjectJobDeleteCall.html), [*jobs get*](struct.ProjectJobGetCall.html), [*jobs list*](struct.ProjectJobListCall.html), [*jobs patch*](struct.ProjectJobPatchCall.html), [*jobs search*](struct.ProjectJobSearchCall.html) and [*jobs search for alert*](struct.ProjectJobSearchForAlertCall.html) +//! * [*client events create*](struct.ProjectClientEventCreateCall.html), [*companies create*](struct.ProjectCompanyCreateCall.html), [*companies delete*](struct.ProjectCompanyDeleteCall.html), [*companies get*](struct.ProjectCompanyGetCall.html), [*companies list*](struct.ProjectCompanyListCall.html), [*companies patch*](struct.ProjectCompanyPatchCall.html), [*complete*](struct.ProjectCompleteCall.html), [*jobs batch delete*](struct.ProjectJobBatchDeleteCall.html), [*jobs create*](struct.ProjectJobCreateCall.html), [*jobs delete*](struct.ProjectJobDeleteCall.html), [*jobs get*](struct.ProjectJobGetCall.html), [*jobs list*](struct.ProjectJobListCall.html), [*jobs patch*](struct.ProjectJobPatchCall.html), [*jobs search*](struct.ProjectJobSearchCall.html) and [*jobs search for alert*](struct.ProjectJobSearchForAlertCall.html) //! //! //! @@ -404,18 +404,12 @@ impl Part for SpellingCorrection {} pub struct LocationFilter { /// Optional. /// - /// CLDR region code of the country/region of the address. This is used - /// to address ambiguity of the user-input location, for example, "Liverpool" - /// against "Liverpool, NY, US" or "Liverpool, UK". /// - /// Set this field if all the jobs to search against are from a same region, - /// or jobs are world-wide, but the job seeker is from a specific region. - /// - /// See http://cldr.unicode.org/ and - /// http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html - /// for details. Example: "CH" for Switzerland. - #[serde(rename="regionCode")] - pub region_code: Option, + /// The distance_in_miles is applied when the location being searched for is + /// identified as a city or smaller. When the location being searched for is a + /// state or larger, this field is ignored. + #[serde(rename="distanceInMiles")] + pub distance_in_miles: Option, /// Optional. /// /// The latitude and longitude of the geographic center from which to @@ -448,12 +442,18 @@ pub struct LocationFilter { pub telecommute_preference: Option, /// Optional. /// + /// CLDR region code of the country/region of the address. This is used + /// to address ambiguity of the user-input location, for example, "Liverpool" + /// against "Liverpool, NY, US" or "Liverpool, UK". /// - /// The distance_in_miles is applied when the location being searched for is - /// identified as a city or smaller. When the location being searched for is a - /// state or larger, this field is ignored. - #[serde(rename="distanceInMiles")] - pub distance_in_miles: Option, + /// Set this field if all the jobs to search against are from a same region, + /// or jobs are world-wide, but the job seeker is from a specific region. + /// + /// See http://cldr.unicode.org/ and + /// http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + /// for details. Example: "CH" for Switzerland. + #[serde(rename="regionCode")] + pub region_code: Option, } impl Part for LocationFilter {} @@ -481,60 +481,45 @@ pub struct CreateJobRequest { impl RequestValue for CreateJobRequest {} -/// Input only. -/// -/// Options for job processing. +/// Compensation range. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ProcessingOptions { +pub struct CompensationRange { /// Optional. /// - /// Option for job HTML content sanitization. Applied fields are: - /// - /// * description - /// * applicationInfo.instruction - /// * incentives - /// * qualifications - /// * responsibilities - /// - /// HTML tags in these fields may be stripped if sanitiazation is not - /// disabled. - /// - /// Defaults to HtmlSanitization.SIMPLE_FORMATTING_ONLY. - #[serde(rename="htmlSanitization")] - pub html_sanitization: Option, + /// The minimum amount of compensation. If left empty, the value is set + /// to zero and the currency code is set to match the + /// currency code of max_compensation. + #[serde(rename="minCompensation")] + pub min_compensation: Option, /// Optional. /// - /// If set to `true`, the service does not attempt to resolve a - /// more precise address for the job. - #[serde(rename="disableStreetAddressResolution")] - pub disable_street_address_resolution: Option, + /// The maximum amount of compensation. If left empty, the value is set + /// to a maximal compensation value and the currency code is set to + /// match the currency code of + /// min_compensation. + #[serde(rename="maxCompensation")] + pub max_compensation: Option, } -impl Part for ProcessingOptions {} +impl Part for CompensationRange {} -/// Output only. -/// -/// Derived details about the job posting. +/// Derived details about the company. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JobDerivedInfo { - /// Job categories derived from Job.title and Job.description. - #[serde(rename="jobCategories")] - pub job_categories: Option>, - /// Structured locations of the job, resolved from Job.addresses. - /// - /// locations are exactly matched to Job.addresses in the same - /// order. - pub locations: Option>, +pub struct CompanyDerivedInfo { + /// A structured headquarters location of the company, resolved from + /// Company.hq_location if provided. + #[serde(rename="headquartersLocation")] + pub headquarters_location: Option, } -impl Part for JobDerivedInfo {} +impl Part for CompanyDerivedInfo {} /// Output only. @@ -565,7 +550,7 @@ pub struct SearchJobsResponse { #[serde(rename="estimatedTotalSize")] pub estimated_total_size: Option, /// The precise result count, which is available only if the client set - /// enable_precise_result_size to `true` or if the response + /// enable_precise_result_size to `true`, or if the response /// is the last page of results. Otherwise, the value is `-1`. #[serde(rename="totalSize")] pub total_size: Option, @@ -612,9 +597,9 @@ pub struct Location { /// LocationType#LOCALITY. #[serde(rename="locationType")] pub location_type: Option, - /// Radius in meters of the job location. This value is derived from the + /// Radius in miles of the job location. This value is derived from the /// location bounding box in which a circle with the specified radius - /// centered from LatLng coves the area associated with the job location. + /// centered from LatLng covers the area associated with the job location. /// For example, currently, "Mountain View, CA, USA" has a radius of /// 6.17 miles. #[serde(rename="radiusInMiles")] @@ -693,26 +678,27 @@ pub struct ListCompaniesResponse { impl ResponseResult for ListCompaniesResponse {} -/// Output only. -/// -/// Commute details related to this job. +/// Represents a time of day. The date and time zone are either not significant +/// or are specified elsewhere. An API may choose to allow leap seconds. Related +/// types are google.type.Date and `google.protobuf.Timestamp`. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CommuteInfo { - /// The number of seconds required to travel to the job location from the - /// query location. A duration of 0 seconds indicates that the job is not - /// reachable within the requested duration, but was returned as part of an - /// expanded query. - #[serde(rename="travelDuration")] - pub travel_duration: Option, - /// Location used as the destination in the commute calculation. - #[serde(rename="jobLocation")] - pub job_location: Option, +pub struct TimeOfDay { + /// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose + /// to allow the value "24:00:00" for scenarios like business closing time. + pub hours: Option, + /// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + pub nanos: Option, + /// Minutes of hour of day. Must be from 0 to 59. + pub minutes: Option, + /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may + /// allow the value 60 if it allows leap-seconds. + pub seconds: Option, } -impl Part for CommuteInfo {} +impl Part for TimeOfDay {} /// Input only. @@ -772,27 +758,26 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// Represents a time of day. The date and time zone are either not significant -/// or are specified elsewhere. An API may choose to allow leap seconds. Related -/// types are google.type.Date and `google.protobuf.Timestamp`. +/// Output only. +/// +/// Commute details related to this job. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TimeOfDay { - /// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. - pub nanos: Option, - /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may - /// allow the value 60 if it allows leap-seconds. - pub seconds: Option, - /// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose - /// to allow the value "24:00:00" for scenarios like business closing time. - pub hours: Option, - /// Minutes of hour of day. Must be from 0 to 59. - pub minutes: Option, +pub struct CommuteInfo { + /// The number of seconds required to travel to the job location from the + /// query location. A duration of 0 seconds indicates that the job is not + /// reachable within the requested duration, but was returned as part of an + /// expanded query. + #[serde(rename="travelDuration")] + pub travel_duration: Option, + /// Location used as the destination in the commute calculation. + #[serde(rename="jobLocation")] + pub job_location: Option, } -impl Part for TimeOfDay {} +impl Part for CommuteInfo {} /// Input only. @@ -891,14 +876,9 @@ pub struct Company { /// site, for example, "https://careers.google.com". #[serde(rename="careerSiteUri")] pub career_site_uri: Option, - /// Optional. - /// - /// The street address of the company's main headquarters, which may be - /// different from the job location. The service attempts - /// to geolocate the provided address, and populates a more specific - /// location wherever possible in DerivedInfo.headquarters_location. - #[serde(rename="headquartersAddress")] - pub headquarters_address: Option, + /// Output only. Derived details about the company. + #[serde(rename="derivedInfo")] + pub derived_info: Option, /// Optional. /// /// Equal Employment Opportunity legal disclaimer text to be @@ -913,9 +893,14 @@ pub struct Company { /// A URI that hosts the employer's company logo. #[serde(rename="imageUri")] pub image_uri: Option, - /// Output only. Derived details about the company. - #[serde(rename="derivedInfo")] - pub derived_info: Option, + /// Optional. + /// + /// The street address of the company's main headquarters, which may be + /// different from the job location. The service attempts + /// to geolocate the provided address, and populates a more specific + /// location wherever possible in DerivedInfo.headquarters_location. + #[serde(rename="headquartersAddress")] + pub headquarters_address: Option, /// Required. /// /// Client side company identifier, used to uniquely identify the @@ -1078,17 +1063,11 @@ pub struct Job { /// /// The maximum number of allowed characters is 10,000. pub incentives: Option, - /// Required. + /// Optional. /// - /// The requisition ID, also referred to as the posting ID, assigned by the - /// client to identify a job. This field is intended to be used by clients - /// for client identification and tracking of postings. A job is not allowed - /// to be created if there is another job with the same [company_name], - /// language_code and requisition_id. - /// - /// The maximum number of allowed characters is 255. - #[serde(rename="requisitionId")] - pub requisition_id: Option, + /// The benefits included with the job. + #[serde(rename="jobBenefits")] + pub job_benefits: Option>, /// Optional. /// /// A description of the qualifications required to perform the @@ -1127,25 +1106,17 @@ pub struct Job { /// The job PostingRegion (for example, state, country) throughout which /// the job is available. If this field is set, a /// LocationFilter in a search query within the job region - /// finds this job posting if an exact location match is not specified. - /// If this field is set to PostingRegion.NATION_WIDE or - /// [PostingRegion.ADMINISTRATIVE_AREA], setting job addresses + /// finds this job posting if an exact location match isn't specified. + /// If this field is set to PostingRegion.NATION or + /// PostingRegion.ADMINISTRATIVE_AREA, setting job Job.addresses /// to the same location level as this field is strongly recommended. #[serde(rename="postingRegion")] pub posting_region: Option, - /// Required. + /// Required. At least one field within ApplicationInfo must be specified. /// - /// The description of the job, which typically includes a multi-paragraph - /// description of the company and related information. Separate fields are - /// provided on the job object for responsibilities, - /// qualifications, and other job characteristics. Use of - /// these separate job fields is recommended. - /// - /// This field accepts and sanitizes HTML input, and also accepts - /// bold, italic, ordered list, and unordered list markup tags. - /// - /// The maximum number of allowed characters is 100,000. - pub description: Option, + /// Job application information. + #[serde(rename="applicationInfo")] + pub application_info: Option, /// Optional but strongly recommended for the best service /// experience. /// @@ -1192,17 +1163,25 @@ pub struct Job { /// Use of this field in job queries and API calls is preferred over the use of /// requisition_id since this value is unique. pub name: Option, - /// Required. At least one field within ApplicationInfo must be specified. - /// - /// Job application information. - #[serde(rename="applicationInfo")] - pub application_info: Option, /// Required. /// /// The title of the job, such as "Software Engineer" /// /// The maximum number of allowed characters is 500. pub title: Option, + /// Required. + /// + /// The description of the job, which typically includes a multi-paragraph + /// description of the company and related information. Separate fields are + /// provided on the job object for responsibilities, + /// qualifications, and other job characteristics. Use of + /// these separate job fields is recommended. + /// + /// This field accepts and sanitizes HTML input, and also accepts + /// bold, italic, ordered list, and unordered list markup tags. + /// + /// The maximum number of allowed characters is 100,000. + pub description: Option, /// Optional. /// /// A promotion value of the job, as determined by the client. @@ -1272,11 +1251,17 @@ pub struct Job { /// Output only. The timestamp when this job posting was last updated. #[serde(rename="postingUpdateTime")] pub posting_update_time: Option, - /// Optional. + /// Required. /// - /// The benefits included with the job. - #[serde(rename="jobBenefits")] - pub job_benefits: Option>, + /// The requisition ID, also referred to as the posting ID, assigned by the + /// client to identify a job. This field is intended to be used by clients + /// for client identification and tracking of postings. A job is not allowed + /// to be created if there is another job with the same [company_name], + /// language_code and requisition_id. + /// + /// The maximum number of allowed characters is 255. + #[serde(rename="requisitionId")] + pub requisition_id: Option, /// Optional. /// /// The timestamp this job posting was most recently published. The default @@ -1307,19 +1292,21 @@ pub struct RequestMetadata { pub device_info: Option, /// Required. /// - /// A unique session identification string. A session is defined as the - /// duration of an end user's interaction with the service over a certain - /// period. - /// Obfuscate this field for privacy concerns before - /// providing it to the service. + /// The client-defined scope or source of the service call, which typically + /// is the domain on + /// which the service has been implemented and is currently being run. /// - /// If this field is not available for some reason, send "UNKNOWN". Note - /// that any improvements to the model for a particular tenant - /// site, rely on this field being set correctly to some unique session_id. + /// For example, if the service is being run by client Foo, Inc., on + /// job board www.foo.com and career site www.bar.com, then this field is + /// set to "foo.com" for use on the job board, and "bar.com" for use on the + /// career site. + /// + /// If this field isn't available for some reason, send "UNKNOWN". + /// Any improvements to the model for a particular tenant site rely on this + /// field being set correctly to a domain. /// /// The maximum number of allowed characters is 255. - #[serde(rename="sessionId")] - pub session_id: Option, + pub domain: Option, /// Required. /// /// A unique user identification string, as determined by the client. @@ -1337,21 +1324,19 @@ pub struct RequestMetadata { pub user_id: Option, /// Required. /// - /// The client-defined scope or source of the service call, which typically - /// is the domain on - /// which the service has been implemented and is currently being run. + /// A unique session identification string. A session is defined as the + /// duration of an end user's interaction with the service over a certain + /// period. + /// Obfuscate this field for privacy concerns before + /// providing it to the service. /// - /// For example, if the service is being run by client Foo, Inc., on - /// job board www.foo.com and career site www.bar.com, then this field is - /// set to "foo.com" for use on the job board, and "bar.com" for use on the - /// career site. - /// - /// If this field isn't available for some reason, send "UNKNOWN". - /// Any improvements to the model for a particular tenant site rely on this - /// field being set correctly to a domain. + /// If this field is not available for some reason, send "UNKNOWN". Note + /// that any improvements to the model for a particular tenant + /// site, rely on this field being set correctly to some unique session_id. /// /// The maximum number of allowed characters is 255. - pub domain: Option, + #[serde(rename="sessionId")] + pub session_id: Option, } impl Part for RequestMetadata {} @@ -1535,6 +1520,69 @@ pub struct HistogramFacets { impl Part for HistogramFacets {} +/// An event issued when an end user interacts with the application that +/// implements Cloud Talent Solution. Providing this information improves the +/// quality of search and recommendation for the API clients, enabling the +/// service to perform optimally. The number of events sent must be consistent +/// with other calls, such as job searches, issued to the service by the client. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [client events create projects](struct.ProjectClientEventCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClientEvent { + /// Required. + /// + /// A unique identifier, generated by the client application. This `event_id` + /// is used to establish the relationship between different events + /// (see parent_event_id). + #[serde(rename="eventId")] + pub event_id: Option, + /// A event issued when a job seeker interacts with the application that + /// implements Cloud Talent Solution. + #[serde(rename="jobEvent")] + pub job_event: Option, + /// Required. + /// + /// A unique ID generated in the API responses. It can be found in + /// ResponseMetadata.request_id. + #[serde(rename="requestId")] + pub request_id: Option, + /// Optional. + /// + /// The event_id of an event that resulted in the current event. For example, a + /// Job view event usually follows a parent + /// impression event: A job seeker first does a + /// search where a list of jobs appears + /// (impression). The job seeker then selects a + /// result and views the description of a particular job (Job + /// view). + #[serde(rename="parentEventId")] + pub parent_event_id: Option, + /// Optional. + /// + /// Extra information about this event. Used for storing information with no + /// matching field in event payload, for example, user application specific + /// context or details. + /// + /// At most 20 keys are supported. The maximum total size of all keys and + /// values is 2 KB. + #[serde(rename="extraInfo")] + pub extra_info: Option>, + /// Required. + /// + /// The timestamp of the event. + #[serde(rename="createTime")] + pub create_time: Option, +} + +impl ResponseResult for ClientEvent {} + + /// Output only. /// /// Additional information returned to client, such as debugging information. @@ -1578,30 +1626,39 @@ pub struct HistogramResults { impl Part for HistogramResults {} -/// Compensation range. +/// Input only. +/// +/// Options for job processing. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CompensationRange { +pub struct ProcessingOptions { /// Optional. /// - /// The minimum amount of compensation. If left empty, the value is set - /// to zero and the currency code is set to match the - /// currency code of max_compensation. - #[serde(rename="minCompensation")] - pub min_compensation: Option, + /// Option for job HTML content sanitization. Applied fields are: + /// + /// * description + /// * applicationInfo.instruction + /// * incentives + /// * qualifications + /// * responsibilities + /// + /// HTML tags in these fields may be stripped if sanitiazation is not + /// disabled. + /// + /// Defaults to HtmlSanitization.SIMPLE_FORMATTING_ONLY. + #[serde(rename="htmlSanitization")] + pub html_sanitization: Option, /// Optional. /// - /// The maximum amount of compensation. If left empty, the value is set - /// to a maximal compensation value and the currency code is set to - /// match the currency code of - /// min_compensation. - #[serde(rename="maxCompensation")] - pub max_compensation: Option, + /// If set to `true`, the service does not attempt to resolve a + /// more precise address for the job. + #[serde(rename="disableStreetAddressResolution")] + pub disable_street_address_resolution: Option, } -impl Part for CompensationRange {} +impl Part for ProcessingOptions {} /// Output only. @@ -1705,9 +1762,17 @@ pub struct SearchJobsRequest { pub order_by: Option, /// Optional. /// - /// Histogram requests for jobs matching JobQuery. - #[serde(rename="histogramFacets")] - pub histogram_facets: Option, + /// Controls whether highly similar jobs are returned next to each other in + /// the search results. Jobs are identified as highly similar based on + /// their titles, job categories, and locations. Highly similar results are + /// clustered so that only one representative job of the cluster is + /// displayed to the job seeker higher up in the results, with the other jobs + /// being displayed lower down in the results. + /// + /// Defaults to DiversificationLevel.SIMPLE if no value + /// is specified. + #[serde(rename="diversificationLevel")] + pub diversification_level: Option, /// Optional. /// /// Controls whether to broaden the search when it produces sparse results. @@ -1731,6 +1796,11 @@ pub struct SearchJobsRequest { pub page_size: Option, /// Optional. /// + /// Histogram requests for jobs matching JobQuery. + #[serde(rename="histogramFacets")] + pub histogram_facets: Option, + /// Optional. + /// /// Mode of a search. /// /// Defaults to SearchMode.JOB_SEARCH. @@ -2075,9 +2145,9 @@ pub struct JobQuery { /// existence of a key. /// /// Boolean expressions (AND/OR/NOT) are supported up to 3 levels of - /// nesting (for example, "((A AND B AND C) OR NOT D) AND E"), a maximum of 50 + /// nesting (for example, "((A AND B AND C) OR NOT D) AND E"), a maximum of 100 /// comparisons or functions are allowed in the expression. The expression - /// must be < 3000 characters in length. + /// must be < 3000 bytes in length. /// /// Sample Query: /// `(LOWER(driving_license)="class \"a\"" OR EMPTY(driving_license)) AND @@ -2185,9 +2255,9 @@ pub struct JobQuery { /// criteria are retrieved regardless of where they're located. /// /// If multiple values are specified, jobs are retrieved from any of the - /// specified locations, and, if different values are specified - /// for the LocationFilter.distance_in_miles parameter, the maximum - /// provided distance is used for all locations. + /// specified locations. If different values are specified for the + /// LocationFilter.distance_in_miles parameter, the maximum provided + /// distance is used for all locations. /// /// At most 5 location filters are allowed. #[serde(rename="locationFilters")] @@ -2228,20 +2298,20 @@ pub struct ApplicationInfo { /// emails or instruction must be /// specified. /// - /// Use this URI field to direct an applicant to a website, for example to - /// link to an online application form. - /// - /// The maximum number of allowed characters for each entry is 2,000. - pub uris: Option>, - /// Optional but at least one of uris, - /// emails or instruction must be - /// specified. - /// /// Use this field to specify email address(es) to which resumes or /// applications can be sent. /// /// The maximum number of allowed characters for each entry is 255. pub emails: Option>, + /// Optional but at least one of uris, + /// emails or instruction must be + /// specified. + /// + /// Use this URI field to direct an applicant to a website, for example to + /// link to an online application form. + /// + /// The maximum number of allowed characters for each entry is 2,000. + pub uris: Option>, } impl Part for ApplicationInfo {} @@ -2288,9 +2358,6 @@ impl Part for CompensationHistogramResult {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Money { - /// The whole units of the amount. - /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. - pub units: Option, /// Number of nano (10^-9) units of the amount. /// The value must be between -999,999,999 and +999,999,999 inclusive. /// If `units` is positive, `nanos` must be positive or zero. @@ -2298,6 +2365,9 @@ pub struct Money { /// If `units` is negative, `nanos` must be negative or zero. /// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. pub nanos: Option, + /// The whole units of the amount. + /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + pub units: Option, /// The 3-letter currency code defined in ISO 4217. #[serde(rename="currencyCode")] pub currency_code: Option, @@ -2380,19 +2450,50 @@ pub struct UpdateJobRequest { impl RequestValue for UpdateJobRequest {} -/// Derived details about the company. +/// Output only. +/// +/// Derived details about the job posting. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CompanyDerivedInfo { - /// A structured headquarters location of the company, resolved from - /// Company.hq_location if provided. - #[serde(rename="headquartersLocation")] - pub headquarters_location: Option, +pub struct JobDerivedInfo { + /// Job categories derived from Job.title and Job.description. + #[serde(rename="jobCategories")] + pub job_categories: Option>, + /// Structured locations of the job, resolved from Job.addresses. + /// + /// locations are exactly matched to Job.addresses in the same + /// order. + pub locations: Option>, } -impl Part for CompanyDerivedInfo {} +impl Part for JobDerivedInfo {} + + +/// An event issued when a job seeker interacts with the application that +/// implements Cloud Talent Solution. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct JobEvent { + /// Required. + /// + /// The job name(s) associated with this event. + /// For example, if this is an impression event, + /// this field contains the identifiers of all jobs shown to the job seeker. + /// If this was a view event, this field contains the + /// identifier of the viewed job. + pub jobs: Option>, + /// Required. + /// + /// The type of the event (see JobEventType). + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for JobEvent {} /// Output only. @@ -2438,7 +2539,7 @@ pub struct CommuteFilter { /// Optional. /// /// The departure time used to calculate traffic impact, represented as - /// .google.type.TimeOfDay in local time zone. + /// google.type.TimeOfDay in local time zone. /// /// Currently traffic model is restricted to hour level resolution. #[serde(rename="departureTime")] @@ -2464,7 +2565,7 @@ pub struct CommuteFilter { pub travel_duration: Option, /// Optional. /// - /// Specifies the traffic density to use when caculating commute time. + /// Specifies the traffic density to use when calculating commute time. #[serde(rename="roadTraffic")] pub road_traffic: Option, } @@ -2472,6 +2573,28 @@ pub struct CommuteFilter { impl Part for CommuteFilter {} +/// The report event request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [client events create projects](struct.ProjectClientEventCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateClientEventRequest { + /// Required. + /// + /// Events issued when end user interacts with customer's application that + /// uses Cloud Talent Solution. + #[serde(rename="clientEvent")] + pub client_event: Option, +} + +impl RequestValue for CreateClientEventRequest {} + + /// Input only. /// /// Use this field to specify bucketing option for the histogram search response. @@ -2528,7 +2651,7 @@ impl Part for NumericBucketingOption {} /// ::default(), None); /// let mut hub = CloudTalentSolution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `companies_create(...)`, `companies_delete(...)`, `companies_get(...)`, `companies_list(...)`, `companies_patch(...)`, `complete(...)`, `jobs_batch_delete(...)`, `jobs_create(...)`, `jobs_delete(...)`, `jobs_get(...)`, `jobs_list(...)`, `jobs_patch(...)`, `jobs_search(...)` and `jobs_search_for_alert(...)` +/// // like `client_events_create(...)`, `companies_create(...)`, `companies_delete(...)`, `companies_get(...)`, `companies_list(...)`, `companies_patch(...)`, `complete(...)`, `jobs_batch_delete(...)`, `jobs_create(...)`, `jobs_delete(...)`, `jobs_get(...)`, `jobs_list(...)`, `jobs_patch(...)`, `jobs_search(...)` and `jobs_search_for_alert(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -2545,21 +2668,23 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists all companies associated with the service account. + /// Report events issued when end user interacts with customer's application + /// that uses Cloud Talent Solution. You may inspect the created events in + /// [self service + /// tools](https://console.cloud.google.com/talent-solution/overview). + /// [Learn + /// more](https://cloud.google.com/talent-solution/job-search/docs/management-tools) + /// about self service tools. /// /// # Arguments /// - /// * `parent` - Required. - /// Resource name of the project under which the company is created. - /// The format is "projects/{project_id}", for example, - /// "projects/api-test-project". - pub fn companies_list(&self, parent: &str) -> ProjectCompanyListCall<'a, C, A> { - ProjectCompanyListCall { + /// * `request` - No description provided. + /// * `parent` - Parent project name. + pub fn client_events_create(&self, request: CreateClientEventRequest, parent: &str) -> ProjectClientEventCreateCall<'a, C, A> { + ProjectClientEventCreateCall { hub: self.hub, + _request: request, _parent: parent.to_string(), - _require_open_jobs: Default::default(), - _page_token: Default::default(), - _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2588,6 +2713,30 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Lists jobs by filter. + /// + /// # Arguments + /// + /// * `parent` - Required. + /// The resource name of the project under which the job is created. + /// The format is "projects/{project_id}", for example, + /// "projects/api-test-project". + pub fn jobs_list(&self, parent: &str) -> ProjectJobListCall<'a, C, A> { + ProjectJobListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _job_view: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Deletes the specified job. @@ -2659,22 +2808,21 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists jobs by filter. + /// Lists all companies associated with the service account. /// /// # Arguments /// /// * `parent` - Required. - /// The resource name of the project under which the job is created. + /// Resource name of the project under which the company is created. /// The format is "projects/{project_id}", for example, /// "projects/api-test-project". - pub fn jobs_list(&self, parent: &str) -> ProjectJobListCall<'a, C, A> { - ProjectJobListCall { + pub fn companies_list(&self, parent: &str) -> ProjectCompanyListCall<'a, C, A> { + ProjectCompanyListCall { hub: self.hub, _parent: parent.to_string(), + _require_open_jobs: Default::default(), _page_token: Default::default(), _page_size: Default::default(), - _job_view: Default::default(), - _filter: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2808,6 +2956,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Deletes specified company. + /// Prerequisite: The company has no jobs associated with it. /// /// # Arguments /// @@ -2872,6 +3021,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { _scope: Default::default(), _query: Default::default(), _page_size: Default::default(), + _language_codes: Default::default(), _language_code: Default::default(), _company_name: Default::default(), _delegate: Default::default(), @@ -2889,9 +3039,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Lists all companies associated with the service account. +/// Report events issued when end user interacts with customer's application +/// that uses Cloud Talent Solution. You may inspect the created events in +/// [self service +/// tools](https://console.cloud.google.com/talent-solution/overview). +/// [Learn +/// more](https://cloud.google.com/talent-solution/job-search/docs/management-tools) +/// about self service tools. /// -/// A builder for the *companies.list* method supported by a *project* resource. +/// A builder for the *clientEvents.create* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -2903,6 +3059,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_jobs3 as jobs3; +/// use jobs3::CreateClientEventRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -2913,36 +3070,36 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = CloudTalentSolution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreateClientEventRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().companies_list("parent") -/// .require_open_jobs(false) -/// .page_token("dolores") -/// .page_size(-63) +/// let result = hub.projects().client_events_create(req, "parent") /// .doit(); /// # } /// ``` -pub struct ProjectCompanyListCall<'a, C, A> +pub struct ProjectClientEventCreateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CloudTalentSolution, + _request: CreateClientEventRequest, _parent: String, - _require_open_jobs: Option, - _page_token: Option, - _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectCompanyListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectClientEventCreateCall<'a, C, A> {} -impl<'a, C, A> ProjectCompanyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectClientEventCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListCompaniesResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ClientEvent)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -2951,20 +3108,11 @@ impl<'a, C, A> ProjectCompanyListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "jobs.projects.companies.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "jobs.projects.clientEvents.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); - if let Some(value) = self._require_open_jobs { - params.push(("requireOpenJobs", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "requireOpenJobs", "pageToken", "pageSize"].iter() { + for &field in ["alt", "parent"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2976,7 +3124,7 @@ impl<'a, C, A> ProjectCompanyListCall<'a, C, A> where C: BorrowMut ProjectCompanyListCall<'a, C, A> where C: BorrowMut ProjectCompanyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -3027,11 +3183,15 @@ impl<'a, C, A> ProjectCompanyListCall<'a, C, A> where C: BorrowMut ProjectCompanyListCall<'a, C, A> where C: BorrowMut ProjectClientEventCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Parent project name. /// /// Sets the *parent* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectCompanyListCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> ProjectClientEventCreateCall<'a, C, A> { self._parent = new_value.to_string(); self } - /// Optional. - /// - /// Set to true if the companies requested must have open jobs. - /// - /// Defaults to false. - /// - /// If true, at most page_size of companies are fetched, among which - /// only those with open jobs are returned. - /// - /// Sets the *require open jobs* query property to the given value. - pub fn require_open_jobs(mut self, new_value: bool) -> ProjectCompanyListCall<'a, C, A> { - self._require_open_jobs = Some(new_value); - self - } - /// Optional. - /// - /// The starting indicator from which to return results. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectCompanyListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. - /// - /// The maximum number of companies to be returned, at most 100. - /// Default is 100 if a non-positive number is provided. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectCompanyListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectCompanyListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectClientEventCreateCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -3145,7 +3276,7 @@ impl<'a, C, A> ProjectCompanyListCall<'a, C, A> where C: BorrowMut ProjectCompanyListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectCompanyListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectClientEventCreateCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -3181,7 +3312,7 @@ impl<'a, C, A> ProjectCompanyListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectCompanyListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectClientEventCreateCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -3286,7 +3417,7 @@ impl<'a, C, A> ProjectCompanyCreateCall<'a, C, A> where C: BorrowMut ProjectCompanyCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3337,7 +3465,7 @@ impl<'a, C, A> ProjectCompanyCreateCall<'a, C, A> where C: BorrowMut ProjectCompanyCreateCall<'a, C, A> where C: BorrowMut ProjectCompanyCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectCompanyCreateCall<'a, C, A> @@ -3480,812 +3608,6 @@ impl<'a, C, A> ProjectCompanyCreateCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = CloudTalentSolution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().jobs_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectJobDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudTalentSolution, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectJobDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectJobDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "jobs.projects.jobs.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v3/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. - /// - /// The resource name of the job to be deleted. - /// - /// The format is "projects/{project_id}/jobs/{job_id}", - /// for example, "projects/api-test-project/jobs/1234". - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectJobDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectJobDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectJobDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Retrieves specified company. -/// -/// A builder for the *companies.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_jobs3 as jobs3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use jobs3::CloudTalentSolution; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudTalentSolution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().companies_get("name") -/// .doit(); -/// # } -/// ``` -pub struct ProjectCompanyGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudTalentSolution, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectCompanyGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectCompanyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Company)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "jobs.projects.companies.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v3/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. - /// - /// The resource name of the company to be retrieved. - /// - /// The format is "projects/{project_id}/companies/{company_id}", for example, - /// "projects/api-test-project/companies/foo". - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectCompanyGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectCompanyGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectCompanyGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectCompanyGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Searches for jobs using the provided SearchJobsRequest. -/// -/// This call constrains the visibility of jobs -/// present in the database, and only returns jobs that the caller has -/// permission to search against. -/// -/// A builder for the *jobs.search* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_jobs3 as jobs3; -/// use jobs3::SearchJobsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use jobs3::CloudTalentSolution; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = CloudTalentSolution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchJobsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().jobs_search(req, "parent") -/// .doit(); -/// # } -/// ``` -pub struct ProjectJobSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a CloudTalentSolution, - _request: SearchJobsRequest, - _parent: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectJobSearchCall<'a, C, A> {} - -impl<'a, C, A> ProjectJobSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchJobsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "jobs.projects.jobs.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v3/{+parent}/jobs:search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchJobsRequest) -> ProjectJobSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. - /// - /// The resource name of the project to search within. - /// - /// The format is "projects/{project_id}", for example, - /// "projects/api-test-project". - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectJobSearchCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectJobSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectJobSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Lists jobs by filter. /// /// A builder for the *jobs.list* method supported by a *project* resource. @@ -4314,10 +3636,10 @@ impl<'a, C, A> ProjectJobSearchCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().jobs_list("parent") -/// .page_token("labore") -/// .page_size(-9) -/// .job_view("nonumy") -/// .filter("dolores") +/// .page_token("kasd") +/// .page_size(-22) +/// .job_view("takimata") +/// .filter("justo") /// .doit(); /// # } /// ``` @@ -4392,7 +3714,7 @@ impl<'a, C, A> ProjectJobListCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4408,10 +3730,7 @@ impl<'a, C, A> ProjectJobListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4431,7 +3750,7 @@ impl<'a, C, A> ProjectJobListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4570,7 +3889,7 @@ impl<'a, C, A> ProjectJobListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4578,12 +3897,12 @@ impl<'a, C, A> ProjectJobListCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectJobListCall<'a, C, A> @@ -4618,6 +3937,1104 @@ impl<'a, C, A> ProjectJobListCall<'a, C, A> where C: BorrowMut, A } +/// Deletes the specified job. +/// +/// Typically, the job becomes unsearchable within 10 seconds, but it may take +/// up to 5 minutes. +/// +/// A builder for the *jobs.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_jobs3 as jobs3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use jobs3::CloudTalentSolution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTalentSolution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().jobs_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectJobDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTalentSolution, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectJobDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectJobDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "jobs.projects.jobs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v3/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The resource name of the job to be deleted. + /// + /// The format is "projects/{project_id}/jobs/{job_id}", + /// for example, "projects/api-test-project/jobs/1234". + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectJobDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectJobDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectJobDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieves specified company. +/// +/// A builder for the *companies.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_jobs3 as jobs3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use jobs3::CloudTalentSolution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTalentSolution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().companies_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectCompanyGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTalentSolution, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectCompanyGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectCompanyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Company)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "jobs.projects.companies.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v3/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// The resource name of the company to be retrieved. + /// + /// The format is "projects/{project_id}/companies/{company_id}", for example, + /// "projects/api-test-project/companies/foo". + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectCompanyGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectCompanyGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectCompanyGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectCompanyGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Searches for jobs using the provided SearchJobsRequest. +/// +/// This call constrains the visibility of jobs +/// present in the database, and only returns jobs that the caller has +/// permission to search against. +/// +/// A builder for the *jobs.search* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_jobs3 as jobs3; +/// use jobs3::SearchJobsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use jobs3::CloudTalentSolution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTalentSolution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SearchJobsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().jobs_search(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectJobSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTalentSolution, + _request: SearchJobsRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectJobSearchCall<'a, C, A> {} + +impl<'a, C, A> ProjectJobSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SearchJobsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "jobs.projects.jobs.search", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v3/{+parent}/jobs:search"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SearchJobsRequest) -> ProjectJobSearchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. + /// + /// The resource name of the project to search within. + /// + /// The format is "projects/{project_id}", for example, + /// "projects/api-test-project". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectJobSearchCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectJobSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectJobSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectJobSearchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all companies associated with the service account. +/// +/// A builder for the *companies.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_jobs3 as jobs3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use jobs3::CloudTalentSolution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudTalentSolution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().companies_list("parent") +/// .require_open_jobs(false) +/// .page_token("dolores") +/// .page_size(-61) +/// .doit(); +/// # } +/// ``` +pub struct ProjectCompanyListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudTalentSolution, + _parent: String, + _require_open_jobs: Option, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectCompanyListCall<'a, C, A> {} + +impl<'a, C, A> ProjectCompanyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListCompaniesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "jobs.projects.companies.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._require_open_jobs { + params.push(("requireOpenJobs", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "requireOpenJobs", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v3/{+parent}/companies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. + /// + /// Resource name of the project under which the company is created. + /// + /// The format is "projects/{project_id}", for example, + /// "projects/api-test-project". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectCompanyListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. + /// + /// Set to true if the companies requested must have open jobs. + /// + /// Defaults to false. + /// + /// If true, at most page_size of companies are fetched, among which + /// only those with open jobs are returned. + /// + /// Sets the *require open jobs* query property to the given value. + pub fn require_open_jobs(mut self, new_value: bool) -> ProjectCompanyListCall<'a, C, A> { + self._require_open_jobs = Some(new_value); + self + } + /// Optional. + /// + /// The starting indicator from which to return results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectCompanyListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. + /// + /// The maximum number of companies to be returned, at most 100. + /// Default is 100 if a non-positive number is provided. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectCompanyListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectCompanyListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectCompanyListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectCompanyListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Retrieves the specified job, whose status is OPEN or recently EXPIRED /// within the last 90 days. /// @@ -4705,7 +5122,7 @@ impl<'a, C, A> ProjectJobGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4721,10 +5138,7 @@ impl<'a, C, A> ProjectJobGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4744,7 +5158,7 @@ impl<'a, C, A> ProjectJobGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4827,7 +5241,7 @@ impl<'a, C, A> ProjectJobGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4835,12 +5249,12 @@ impl<'a, C, A> ProjectJobGetCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectJobGetCall<'a, C, A> @@ -4977,7 +5391,7 @@ impl<'a, C, A> ProjectJobSearchForAlertCall<'a, C, A> where C: BorrowMut ProjectJobSearchForAlertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5028,7 +5439,7 @@ impl<'a, C, A> ProjectJobSearchForAlertCall<'a, C, A> where C: BorrowMut ProjectJobSearchForAlertCall<'a, C, A> where C: BorrowMut ProjectJobSearchForAlertCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectJobSearchForAlertCall<'a, C, A> @@ -5267,7 +5678,7 @@ impl<'a, C, A> ProjectJobCreateCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5283,10 +5694,7 @@ impl<'a, C, A> ProjectJobCreateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5318,7 +5726,7 @@ impl<'a, C, A> ProjectJobCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5413,7 +5821,7 @@ impl<'a, C, A> ProjectJobCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5421,12 +5829,12 @@ impl<'a, C, A> ProjectJobCreateCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectJobCreateCall<'a, C, A> @@ -5556,7 +5964,7 @@ impl<'a, C, A> ProjectCompanyPatchCall<'a, C, A> where C: BorrowMut ProjectCompanyPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5607,7 +6012,7 @@ impl<'a, C, A> ProjectCompanyPatchCall<'a, C, A> where C: BorrowMut ProjectCompanyPatchCall<'a, C, A> where C: BorrowMut ProjectCompanyPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectCompanyPatchCall<'a, C, A> @@ -5844,7 +6249,7 @@ impl<'a, C, A> ProjectJobBatchDeleteCall<'a, C, A> where C: BorrowMut ProjectJobBatchDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5895,7 +6297,7 @@ impl<'a, C, A> ProjectJobBatchDeleteCall<'a, C, A> where C: BorrowMut ProjectJobBatchDeleteCall<'a, C, A> where C: BorrowMut ProjectJobBatchDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectJobBatchDeleteCall<'a, C, A> @@ -6039,6 +6441,7 @@ impl<'a, C, A> ProjectJobBatchDeleteCall<'a, C, A> where C: BorrowMut ProjectCompanyDeleteCall<'a, C, A> where C: BorrowMut ProjectCompanyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6163,7 +6563,7 @@ impl<'a, C, A> ProjectCompanyDeleteCall<'a, C, A> where C: BorrowMut ProjectCompanyDeleteCall<'a, C, A> where C: BorrowMut ProjectCompanyDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectCompanyDeleteCall<'a, C, A> @@ -6390,7 +6790,7 @@ impl<'a, C, A> ProjectJobPatchCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6406,10 +6806,7 @@ impl<'a, C, A> ProjectJobPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6441,7 +6838,7 @@ impl<'a, C, A> ProjectJobPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6540,7 +6937,7 @@ impl<'a, C, A> ProjectJobPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6548,12 +6945,12 @@ impl<'a, C, A> ProjectJobPatchCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectJobPatchCall<'a, C, A> @@ -6617,12 +7014,13 @@ impl<'a, C, A> ProjectJobPatchCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().complete("name") -/// .type_("et") -/// .scope("diam") -/// .query("ipsum") -/// .page_size(-5) -/// .language_code("et") -/// .company_name("duo") +/// .type_("diam") +/// .scope("ipsum") +/// .query("Lorem") +/// .page_size(-21) +/// .add_language_codes("duo") +/// .language_code("aliquyam") +/// .company_name("sea") /// .doit(); /// # } /// ``` @@ -6635,6 +7033,7 @@ pub struct ProjectCompleteCall<'a, C, A> _scope: Option, _query: Option, _page_size: Option, + _language_codes: Vec, _language_code: Option, _company_name: Option, _delegate: Option<&'a mut Delegate>, @@ -6659,7 +7058,7 @@ impl<'a, C, A> ProjectCompleteCall<'a, C, A> where C: BorrowMut, }; dlg.begin(MethodInfo { id: "jobs.projects.complete", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); params.push(("name", self._name.to_string())); if let Some(value) = self._type_ { params.push(("type", value.to_string())); @@ -6673,13 +7072,18 @@ impl<'a, C, A> ProjectCompleteCall<'a, C, A> where C: BorrowMut, if let Some(value) = self._page_size { params.push(("pageSize", value.to_string())); } + if self._language_codes.len() > 0 { + for f in self._language_codes.iter() { + params.push(("languageCodes", f.to_string())); + } + } if let Some(value) = self._language_code { params.push(("languageCode", value.to_string())); } if let Some(value) = self._company_name { params.push(("companyName", value.to_string())); } - for &field in ["alt", "name", "type", "scope", "query", "pageSize", "languageCode", "companyName"].iter() { + for &field in ["alt", "name", "type", "scope", "query", "pageSize", "languageCodes", "languageCode", "companyName"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -6705,7 +7109,7 @@ impl<'a, C, A> ProjectCompleteCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6721,10 +7125,7 @@ impl<'a, C, A> ProjectCompleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6744,7 +7145,7 @@ impl<'a, C, A> ProjectCompleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6852,22 +7253,50 @@ impl<'a, C, A> ProjectCompleteCall<'a, C, A> where C: BorrowMut, self._page_size = Some(new_value); self } - /// Required. + /// Optional. + /// + /// The list of languages of the query. This is + /// the BCP-47 language code, such as "en-US" or "sr-Latn". + /// For more information, see + /// [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). + /// + /// For CompletionType.JOB_TITLE type, only open jobs with the same + /// language_codes are returned. + /// + /// For CompletionType.COMPANY_NAME type, + /// only companies having open jobs with the same language_codes are + /// returned. + /// + /// For CompletionType.COMBINED type, only open jobs with the same + /// language_codes or companies having open jobs with the same + /// language_codes are returned. + /// + /// The maximum number of allowed characters is 255. + /// + /// Append the given value to the *language codes* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_language_codes(mut self, new_value: &str) -> ProjectCompleteCall<'a, C, A> { + self._language_codes.push(new_value.to_string()); + self + } + /// Deprecated. Use language_codes instead. + /// + /// Optional. /// /// The language of the query. This is /// the BCP-47 language code, such as "en-US" or "sr-Latn". /// For more information, see /// [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). /// - /// For CompletionType.JOB_TITLE type, only open jobs with same + /// For CompletionType.JOB_TITLE type, only open jobs with the same /// language_code are returned. /// /// For CompletionType.COMPANY_NAME type, - /// only companies having open jobs with same language_code are + /// only companies having open jobs with the same language_code are /// returned. /// - /// For CompletionType.COMBINED type, only open jobs with same - /// language_code or companies having open jobs with same + /// For CompletionType.COMBINED type, only open jobs with the same + /// language_code or companies having open jobs with the same /// language_code are returned. /// /// The maximum number of allowed characters is 255. @@ -6904,7 +7333,7 @@ impl<'a, C, A> ProjectCompleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6912,12 +7341,12 @@ impl<'a, C, A> ProjectCompleteCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectCompleteCall<'a, C, A> diff --git a/gen/language1-cli/Cargo.toml b/gen/language1-cli/Cargo.toml index d57c69f979..ce9cf625fa 100644 --- a/gen/language1-cli/Cargo.toml +++ b/gen/language1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-language1-cli" -version = "1.0.8+20180930" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Natural Language (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/language1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-language1] path = "../language1" -version = "1.0.8+20180930" +version = "1.0.8+20190327" diff --git a/gen/language1-cli/README.md b/gen/language1-cli/README.md index d4ad6804d8..075539c89b 100644 --- a/gen/language1-cli/README.md +++ b/gen/language1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Natural Language* API at revision *20180930*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Natural Language* API at revision *20190327*. The CLI is at version *1.0.8*. ```bash language1 [options] diff --git a/gen/language1-cli/mkdocs.yml b/gen/language1-cli/mkdocs.yml index 190bcee242..ea77b05c2f 100644 --- a/gen/language1-cli/mkdocs.yml +++ b/gen/language1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Natural Language v1.0.8+20180930 +site_name: Cloud Natural Language v1.0.8+20190327 site_url: http://byron.github.io/google-apis-rs/google-language1-cli site_description: A complete library to interact with Cloud Natural Language (protocol v1) diff --git a/gen/language1-cli/src/main.rs b/gen/language1-cli/src/main.rs index 29ee2b42ab..49b716c84e 100644 --- a/gen/language1-cli/src/main.rs +++ b/gen/language1-cli/src/main.rs @@ -69,11 +69,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.content" => Some(("document.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.type" => Some(("document.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.language" => Some(("document.language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.gcs-content-uri" => Some(("document.gcsContentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "document", "encoding-type", "gcs-content-uri", "language", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -158,11 +158,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.content" => Some(("document.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.type" => Some(("document.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.language" => Some(("document.language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.gcs-content-uri" => Some(("document.gcsContentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "document", "encoding-type", "gcs-content-uri", "language", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -247,11 +247,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.content" => Some(("document.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.type" => Some(("document.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.language" => Some(("document.language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.gcs-content-uri" => Some(("document.gcsContentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "document", "encoding-type", "gcs-content-uri", "language", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -336,11 +336,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.content" => Some(("document.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.type" => Some(("document.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.language" => Some(("document.language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.gcs-content-uri" => Some(("document.gcsContentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "document", "encoding-type", "gcs-content-uri", "language", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -425,16 +425,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.content" => Some(("document.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.type" => Some(("document.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.language" => Some(("document.language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.gcs-content-uri" => Some(("document.gcsContentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "features.extract-document-sentiment" => Some(("features.extractDocumentSentiment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "features.extract-entity-sentiment" => Some(("features.extractEntitySentiment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "features.classify-text" => Some(("features.classifyText", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "features.extract-entities" => Some(("features.extractEntities", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "features.extract-syntax" => Some(("features.extractSyntax", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "features.classify-text" => Some(("features.classifyText", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "features.extract-document-sentiment" => Some(("features.extractDocumentSentiment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["classify-text", "content", "document", "encoding-type", "extract-document-sentiment", "extract-entities", "extract-entity-sentiment", "extract-syntax", "features", "gcs-content-uri", "language", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -845,8 +845,8 @@ fn main() { let mut app = App::new("language1") .author("Sebastian Thiel ") - .version("1.0.8+20180930") - .about("Provides natural language understanding technologies to developers. Examples include sentiment analysis, entity recognition, entity sentiment analysis, and text annotations.") + .version("1.0.8+20190327") + .about("Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations, to developers.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_language1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/language1/Cargo.toml b/gen/language1/Cargo.toml index 5ced85245e..6ff4acdbcd 100644 --- a/gen/language1/Cargo.toml +++ b/gen/language1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-language1" -version = "1.0.8+20180930" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Natural Language (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/language1" homepage = "https://cloud.google.com/natural-language/" -documentation = "https://docs.rs/google-language1/1.0.8+20180930" +documentation = "https://docs.rs/google-language1/1.0.8+20190327" license = "MIT" keywords = ["language", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/language1/README.md b/gen/language1/README.md index 306baf913f..115c16d811 100644 --- a/gen/language1/README.md +++ b/gen/language1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-language1` library allows access to all features of the *Google Cloud Natural Language* service. -This documentation was generated from *Cloud Natural Language* crate version *1.0.8+20180930*, where *20180930* is the exact revision of the *language:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Natural Language* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *language:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Natural Language* *v1* API can be found at the [official documentation site](https://cloud.google.com/natural-language/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-language1/1.0.8+20180930/google_language1/struct.CloudNaturalLanguage.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-language1/1.0.8+20190327/google_language1/struct.CloudNaturalLanguage.html) ... -* [documents](https://docs.rs/google-language1/1.0.8+20180930/google_language1/struct.Document.html) - * [*analyze entities*](https://docs.rs/google-language1/1.0.8+20180930/google_language1/struct.DocumentAnalyzeEntityCall.html), [*analyze entity sentiment*](https://docs.rs/google-language1/1.0.8+20180930/google_language1/struct.DocumentAnalyzeEntitySentimentCall.html), [*analyze sentiment*](https://docs.rs/google-language1/1.0.8+20180930/google_language1/struct.DocumentAnalyzeSentimentCall.html), [*analyze syntax*](https://docs.rs/google-language1/1.0.8+20180930/google_language1/struct.DocumentAnalyzeSyntaxCall.html), [*annotate text*](https://docs.rs/google-language1/1.0.8+20180930/google_language1/struct.DocumentAnnotateTextCall.html) and [*classify text*](https://docs.rs/google-language1/1.0.8+20180930/google_language1/struct.DocumentClassifyTextCall.html) +* [documents](https://docs.rs/google-language1/1.0.8+20190327/google_language1/struct.Document.html) + * [*analyze entities*](https://docs.rs/google-language1/1.0.8+20190327/google_language1/struct.DocumentAnalyzeEntityCall.html), [*analyze entity sentiment*](https://docs.rs/google-language1/1.0.8+20190327/google_language1/struct.DocumentAnalyzeEntitySentimentCall.html), [*analyze sentiment*](https://docs.rs/google-language1/1.0.8+20190327/google_language1/struct.DocumentAnalyzeSentimentCall.html), [*analyze syntax*](https://docs.rs/google-language1/1.0.8+20190327/google_language1/struct.DocumentAnalyzeSyntaxCall.html), [*annotate text*](https://docs.rs/google-language1/1.0.8+20190327/google_language1/struct.DocumentAnnotateTextCall.html) and [*classify text*](https://docs.rs/google-language1/1.0.8+20190327/google_language1/struct.DocumentClassifyTextCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-language1/1.0.8+20180930/google_language1/struct.CloudNaturalLanguage.html)** +* **[Hub](https://docs.rs/google-language1/1.0.8+20190327/google_language1/struct.CloudNaturalLanguage.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.Part.html)** + * **[Parts](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -135,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-language1/1.0.8+20180930/google_language1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-language1/1.0.8+20190327/google_language1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-language1/1.0.8+20180930/google_language1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-language1/1.0.8+20190327/google_language1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -155,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-language1/1.0.8+20180930/google_language1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-language1/1.0.8+20190327/google_language1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/language1/src/lib.rs b/gen/language1/src/lib.rs index 407ecba972..41000d2475 100644 --- a/gen/language1/src/lib.rs +++ b/gen/language1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Natural Language* crate version *1.0.8+20180930*, where *20180930* is the exact revision of the *language:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Natural Language* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *language:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Natural Language* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/natural-language/). @@ -379,29 +379,41 @@ impl<'a, C, A> CloudNaturalLanguage // ############ // SCHEMAS ### // ########## -/// The sentiment analysis response message. +/// Represents part of speech information for a token. Parts of speech +/// are as defined in +/// http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [analyze sentiment documents](struct.DocumentAnalyzeSentimentCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AnalyzeSentimentResponse { - /// The overall sentiment of the input document. - #[serde(rename="documentSentiment")] - pub document_sentiment: Option, - /// The language of the text, which will be the same as the language specified - /// in the request or, if not specified, the automatically-detected language. - /// See Document.language field for more details. - pub language: Option, - /// The sentiment for all the sentences in the document. - pub sentences: Option>, +pub struct PartOfSpeech { + /// The grammatical case. + pub case: Option, + /// The grammatical mood. + pub mood: Option, + /// The grammatical form. + pub form: Option, + /// The grammatical gender. + pub gender: Option, + /// The grammatical aspect. + pub aspect: Option, + /// The grammatical number. + pub number: Option, + /// The grammatical person. + pub person: Option, + /// The part of speech tag. + pub tag: Option, + /// The grammatical tense. + pub tense: Option, + /// The grammatical reciprocity. + pub reciprocity: Option, + /// The grammatical properness. + pub proper: Option, + /// The grammatical voice. + pub voice: Option, } -impl ResponseResult for AnalyzeSentimentResponse {} +impl Part for PartOfSpeech {} /// Represents the feeling associated with the entire text or entities in @@ -411,13 +423,13 @@ impl ResponseResult for AnalyzeSentimentResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Sentiment { - /// Sentiment score between -1.0 (negative sentiment) and 1.0 - /// (positive sentiment). - pub score: Option, /// A non-negative number in the [0, +inf) range, which represents /// the absolute magnitude of sentiment regardless of score (positive or /// negative). pub magnitude: Option, + /// Sentiment score between -1.0 (negative sentiment) and 1.0 + /// (positive sentiment). + pub score: Option, } impl Part for Sentiment {} @@ -452,11 +464,11 @@ impl RequestValue for ClassifyTextRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AnalyzeEntitySentimentRequest { + /// Input document. + pub document: Option, /// The encoding type used by the API to calculate offsets. #[serde(rename="encodingType")] pub encoding_type: Option, - /// Input document. - pub document: Option, } impl RequestValue for AnalyzeEntitySentimentRequest {} @@ -527,16 +539,16 @@ impl Part for DependencyEdge {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Token { - /// The token text. - pub text: Option, - /// Parts of speech tag for this token. - #[serde(rename="partOfSpeech")] - pub part_of_speech: Option, + /// [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + pub lemma: Option, /// Dependency tree parse for this token. #[serde(rename="dependencyEdge")] pub dependency_edge: Option, - /// [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. - pub lemma: Option, + /// Parts of speech tag for this token. + #[serde(rename="partOfSpeech")] + pub part_of_speech: Option, + /// The token text. + pub text: Option, } impl Part for Token {} @@ -641,11 +653,11 @@ impl ResponseResult for ClassifyTextResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AnnotateTextRequest { + /// Input document. + pub document: Option, /// The encoding type used by the API to calculate offsets. #[serde(rename="encodingType")] pub encoding_type: Option, - /// Input document. - pub document: Option, /// The enabled features. pub features: Option, } @@ -660,21 +672,21 @@ impl RequestValue for AnnotateTextRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Features { + /// Extract document-level sentiment. + #[serde(rename="extractDocumentSentiment")] + pub extract_document_sentiment: Option, /// Classify the full document into categories. #[serde(rename="classifyText")] pub classify_text: Option, - /// Extract entities and their associated sentiment. - #[serde(rename="extractEntitySentiment")] - pub extract_entity_sentiment: Option, /// Extract syntax information. #[serde(rename="extractSyntax")] pub extract_syntax: Option, /// Extract entities. #[serde(rename="extractEntities")] pub extract_entities: Option, - /// Extract document-level sentiment. - #[serde(rename="extractDocumentSentiment")] - pub extract_document_sentiment: Option, + /// Extract entities and their associated sentiment. + #[serde(rename="extractEntitySentiment")] + pub extract_entity_sentiment: Option, } impl Part for Features {} @@ -802,51 +814,39 @@ impl Part for EntityMention {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AnalyzeSentimentRequest { + /// Input document. + pub document: Option, /// The encoding type used by the API to calculate sentence offsets. #[serde(rename="encodingType")] pub encoding_type: Option, - /// Input document. - pub document: Option, } impl RequestValue for AnalyzeSentimentRequest {} -/// Represents part of speech information for a token. Parts of speech -/// are as defined in -/// http://www.lrec-conf.org/proceedings/lrec2012/pdf/274_Paper.pdf +/// The sentiment analysis response message. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [analyze sentiment documents](struct.DocumentAnalyzeSentimentCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PartOfSpeech { - /// The grammatical case. - pub case: Option, - /// The grammatical reciprocity. - pub reciprocity: Option, - /// The grammatical form. - pub form: Option, - /// The grammatical gender. - pub gender: Option, - /// The grammatical number. - pub number: Option, - /// The grammatical person. - pub person: Option, - /// The part of speech tag. - pub tag: Option, - /// The grammatical tense. - pub tense: Option, - /// The grammatical aspect. - pub aspect: Option, - /// The grammatical properness. - pub proper: Option, - /// The grammatical voice. - pub voice: Option, - /// The grammatical mood. - pub mood: Option, +pub struct AnalyzeSentimentResponse { + /// The overall sentiment of the input document. + #[serde(rename="documentSentiment")] + pub document_sentiment: Option, + /// The language of the text, which will be the same as the language specified + /// in the request or, if not specified, the automatically-detected language. + /// See Document.language field for more details. + pub language: Option, + /// The sentiment for all the sentences in the document. + pub sentences: Option>, } -impl Part for PartOfSpeech {} +impl ResponseResult for AnalyzeSentimentResponse {} /// The syntax analysis request message. @@ -860,11 +860,11 @@ impl Part for PartOfSpeech {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AnalyzeSyntaxRequest { + /// Input document. + pub document: Option, /// The encoding type used by the API to calculate offsets. #[serde(rename="encodingType")] pub encoding_type: Option, - /// Input document. - pub document: Option, } impl RequestValue for AnalyzeSyntaxRequest {} @@ -903,11 +903,11 @@ impl ResponseResult for AnalyzeEntitiesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AnalyzeEntitiesRequest { + /// Input document. + pub document: Option, /// The encoding type used by the API to calculate offsets. #[serde(rename="encodingType")] pub encoding_type: Option, - /// Input document. - pub document: Option, } impl RequestValue for AnalyzeEntitiesRequest {} @@ -1180,10 +1180,7 @@ impl<'a, C, A> DocumentAnalyzeSyntaxCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1215,7 +1212,7 @@ impl<'a, C, A> DocumentAnalyzeSyntaxCall<'a, C, A> where C: BorrowMut DocumentAnalyzeSyntaxCall<'a, C, A> where C: BorrowMut DocumentAnalyzeSentimentCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1460,7 +1454,7 @@ impl<'a, C, A> DocumentAnalyzeSentimentCall<'a, C, A> where C: BorrowMut DocumentAnalyzeSentimentCall<'a, C, A> where C: BorrowMut DocumentClassifyTextCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1705,7 +1696,7 @@ impl<'a, C, A> DocumentClassifyTextCall<'a, C, A> where C: BorrowMut DocumentClassifyTextCall<'a, C, A> where C: BorrowMut DocumentAnalyzeEntitySentimentCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1951,7 +1939,7 @@ impl<'a, C, A> DocumentAnalyzeEntitySentimentCall<'a, C, A> where C: BorrowMut DocumentAnalyzeEntitySentimentCall<'a, C, A> where C: BorrowMut DocumentAnalyzeEntityCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2198,7 +2183,7 @@ impl<'a, C, A> DocumentAnalyzeEntityCall<'a, C, A> where C: BorrowMut DocumentAnalyzeEntityCall<'a, C, A> where C: BorrowMut DocumentAnnotateTextCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2444,7 +2426,7 @@ impl<'a, C, A> DocumentAnnotateTextCall<'a, C, A> where C: BorrowMut DocumentAnnotateTextCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Cloud Natural Language (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/language1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-language1_beta1] path = "../language1_beta1" -version = "1.0.8+20180930" +version = "1.0.8+20190327" diff --git a/gen/language1_beta1-cli/README.md b/gen/language1_beta1-cli/README.md index 4757e571e0..c17e0a9312 100644 --- a/gen/language1_beta1-cli/README.md +++ b/gen/language1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Natural Language* API at revision *20180930*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Natural Language* API at revision *20190327*. The CLI is at version *1.0.8*. ```bash language1-beta1 [options] diff --git a/gen/language1_beta1-cli/mkdocs.yml b/gen/language1_beta1-cli/mkdocs.yml index 313a9d5a9b..03a4c86ff1 100644 --- a/gen/language1_beta1-cli/mkdocs.yml +++ b/gen/language1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Natural Language v1.0.8+20180930 +site_name: Cloud Natural Language v1.0.8+20190327 site_url: http://byron.github.io/google-apis-rs/google-language1_beta1-cli site_description: A complete library to interact with Cloud Natural Language (protocol v1beta1) diff --git a/gen/language1_beta1-cli/src/main.rs b/gen/language1_beta1-cli/src/main.rs index be82bca6a8..9769261fc4 100644 --- a/gen/language1_beta1-cli/src/main.rs +++ b/gen/language1_beta1-cli/src/main.rs @@ -69,11 +69,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.content" => Some(("document.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.type" => Some(("document.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.language" => Some(("document.language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.gcs-content-uri" => Some(("document.gcsContentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "document", "encoding-type", "gcs-content-uri", "language", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -158,11 +158,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.content" => Some(("document.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.type" => Some(("document.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.language" => Some(("document.language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.gcs-content-uri" => Some(("document.gcsContentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "document", "encoding-type", "gcs-content-uri", "language", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -247,11 +247,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.content" => Some(("document.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.type" => Some(("document.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.language" => Some(("document.language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.gcs-content-uri" => Some(("document.gcsContentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "document", "encoding-type", "gcs-content-uri", "language", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -336,14 +336,14 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.content" => Some(("document.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.type" => Some(("document.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.language" => Some(("document.language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "document.gcs-content-uri" => Some(("document.gcsContentUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "features.extract-document-sentiment" => Some(("features.extractDocumentSentiment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "features.extract-entities" => Some(("features.extractEntities", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "encoding-type" => Some(("encodingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "features.extract-syntax" => Some(("features.extractSyntax", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "features.extract-entities" => Some(("features.extractEntities", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "features.extract-document-sentiment" => Some(("features.extractDocumentSentiment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "document", "encoding-type", "extract-document-sentiment", "extract-entities", "extract-syntax", "features", "gcs-content-uri", "language", "type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -615,8 +615,8 @@ fn main() { let mut app = App::new("language1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20180930") - .about("Provides natural language understanding technologies to developers. Examples include sentiment analysis, entity recognition, entity sentiment analysis, and text annotations.") + .version("1.0.8+20190327") + .about("Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations, to developers.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_language1_beta1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/language1_beta1/Cargo.toml b/gen/language1_beta1/Cargo.toml index d4b2f42f53..bd90020def 100644 --- a/gen/language1_beta1/Cargo.toml +++ b/gen/language1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-language1_beta1" -version = "1.0.8+20180930" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Natural Language (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/language1_beta1" homepage = "https://cloud.google.com/natural-language/" -documentation = "https://docs.rs/google-language1_beta1/1.0.8+20180930" +documentation = "https://docs.rs/google-language1_beta1/1.0.8+20190327" license = "MIT" keywords = ["language", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/language1_beta1/README.md b/gen/language1_beta1/README.md index a7cb4f8d49..411aaa7339 100644 --- a/gen/language1_beta1/README.md +++ b/gen/language1_beta1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-language1_beta1` library allows access to all features of the *Google Cloud Natural Language* service. -This documentation was generated from *Cloud Natural Language* crate version *1.0.8+20180930*, where *20180930* is the exact revision of the *language:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Natural Language* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *language:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Natural Language* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/natural-language/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/struct.CloudNaturalLanguage.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/struct.CloudNaturalLanguage.html) ... -* [documents](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/struct.Document.html) - * [*analyze entities*](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/struct.DocumentAnalyzeEntityCall.html), [*analyze sentiment*](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/struct.DocumentAnalyzeSentimentCall.html), [*analyze syntax*](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/struct.DocumentAnalyzeSyntaxCall.html) and [*annotate text*](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/struct.DocumentAnnotateTextCall.html) +* [documents](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/struct.Document.html) + * [*analyze entities*](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/struct.DocumentAnalyzeEntityCall.html), [*analyze sentiment*](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/struct.DocumentAnalyzeSentimentCall.html), [*analyze syntax*](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/struct.DocumentAnalyzeSyntaxCall.html) and [*annotate text*](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/struct.DocumentAnnotateTextCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/struct.CloudNaturalLanguage.html)** +* **[Hub](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/struct.CloudNaturalLanguage.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-language1_beta1/1.0.8+20180930/google_language1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-language1_beta1/1.0.8+20190327/google_language1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/language1_beta1/src/lib.rs b/gen/language1_beta1/src/lib.rs index 502c5dd2d4..8b96a13321 100644 --- a/gen/language1_beta1/src/lib.rs +++ b/gen/language1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Natural Language* crate version *1.0.8+20180930*, where *20180930* is the exact revision of the *language:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Natural Language* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *language:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Natural Language* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/natural-language/). @@ -377,29 +377,39 @@ impl<'a, C, A> CloudNaturalLanguage // ############ // SCHEMAS ### // ########## -/// The sentiment analysis response message. +/// Represents part of speech information for a token. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [analyze sentiment documents](struct.DocumentAnalyzeSentimentCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AnalyzeSentimentResponse { - /// The overall sentiment of the input document. - #[serde(rename="documentSentiment")] - pub document_sentiment: Option, - /// The language of the text, which will be the same as the language specified - /// in the request or, if not specified, the automatically-detected language. - /// See Document.language field for more details. - pub language: Option, - /// The sentiment for all the sentences in the document. - pub sentences: Option>, +pub struct PartOfSpeech { + /// The grammatical case. + pub case: Option, + /// The grammatical mood. + pub mood: Option, + /// The grammatical form. + pub form: Option, + /// The grammatical gender. + pub gender: Option, + /// The grammatical aspect. + pub aspect: Option, + /// The grammatical number. + pub number: Option, + /// The grammatical person. + pub person: Option, + /// The part of speech tag. + pub tag: Option, + /// The grammatical tense. + pub tense: Option, + /// The grammatical reciprocity. + pub reciprocity: Option, + /// The grammatical properness. + pub proper: Option, + /// The grammatical voice. + pub voice: Option, } -impl ResponseResult for AnalyzeSentimentResponse {} +impl Part for PartOfSpeech {} /// Represents the feeling associated with the entire text or entities in @@ -413,13 +423,13 @@ pub struct Sentiment { /// favor of score. Please refer to our documentation at /// https://cloud.google.com/natural-language/docs for more information. pub polarity: Option, - /// Sentiment score between -1.0 (negative sentiment) and 1.0 - /// (positive sentiment). - pub score: Option, /// A non-negative number in the [0, +inf) range, which represents /// the absolute magnitude of sentiment regardless of score (positive or /// negative). pub magnitude: Option, + /// Sentiment score between -1.0 (negative sentiment) and 1.0 + /// (positive sentiment). + pub score: Option, } impl Part for Sentiment {} @@ -466,16 +476,16 @@ impl ResponseResult for AnnotateTextResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Token { - /// The token text. - pub text: Option, + /// [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. + pub lemma: Option, /// Dependency tree parse for this token. #[serde(rename="dependencyEdge")] pub dependency_edge: Option, /// Parts of speech tag for this token. #[serde(rename="partOfSpeech")] pub part_of_speech: Option, - /// [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token. - pub lemma: Option, + /// The token text. + pub text: Option, } impl Part for Token {} @@ -560,11 +570,11 @@ impl ResponseResult for AnalyzeSyntaxResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AnnotateTextRequest { + /// Input document. + pub document: Option, /// The encoding type used by the API to calculate offsets. #[serde(rename="encodingType")] pub encoding_type: Option, - /// Input document. - pub document: Option, /// The enabled features. pub features: Option, } @@ -579,15 +589,15 @@ impl RequestValue for AnnotateTextRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Features { - /// Extract syntax information. - #[serde(rename="extractSyntax")] - pub extract_syntax: Option, - /// Extract entities. - #[serde(rename="extractEntities")] - pub extract_entities: Option, /// Extract document-level sentiment. #[serde(rename="extractDocumentSentiment")] pub extract_document_sentiment: Option, + /// Extract entities. + #[serde(rename="extractEntities")] + pub extract_entities: Option, + /// Extract syntax information. + #[serde(rename="extractSyntax")] + pub extract_syntax: Option, } impl Part for Features {} @@ -663,11 +673,6 @@ pub struct Entity { /// Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if /// available. The associated keys are "wikipedia_url" and "mid", respectively. pub metadata: Option>, - /// The entity type. - #[serde(rename="type")] - pub type_: Option, - /// The representative name for the entity. - pub name: Option, /// The salience score associated with the entity in the [0, 1.0] range. /// /// The salience score for an entity provides information about the @@ -675,11 +680,84 @@ pub struct Entity { /// Scores closer to 0 are less salient, while scores closer to 1.0 are highly /// salient. pub salience: Option, + /// The representative name for the entity. + pub name: Option, + /// The entity type. + #[serde(rename="type")] + pub type_: Option, } impl Part for Entity {} +/// The syntax analysis request message. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [analyze syntax documents](struct.DocumentAnalyzeSyntaxCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AnalyzeSyntaxRequest { + /// Input document. + pub document: Option, + /// The encoding type used by the API to calculate offsets. + #[serde(rename="encodingType")] + pub encoding_type: Option, +} + +impl RequestValue for AnalyzeSyntaxRequest {} + + +/// The sentiment analysis request message. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [analyze sentiment documents](struct.DocumentAnalyzeSentimentCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AnalyzeSentimentRequest { + /// Input document. + pub document: Option, + /// The encoding type used by the API to calculate sentence offsets for the + /// sentence sentiment. + #[serde(rename="encodingType")] + pub encoding_type: Option, +} + +impl RequestValue for AnalyzeSentimentRequest {} + + +/// The sentiment analysis response message. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [analyze sentiment documents](struct.DocumentAnalyzeSentimentCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AnalyzeSentimentResponse { + /// The overall sentiment of the input document. + #[serde(rename="documentSentiment")] + pub document_sentiment: Option, + /// The language of the text, which will be the same as the language specified + /// in the request or, if not specified, the automatically-detected language. + /// See Document.language field for more details. + pub language: Option, + /// The sentiment for all the sentences in the document. + pub sentences: Option>, +} + +impl ResponseResult for AnalyzeSentimentResponse {} + + /// Represents a mention for an entity in the text. Currently, proper noun /// mentions are supported. /// @@ -697,84 +775,6 @@ pub struct EntityMention { impl Part for EntityMention {} -/// The sentiment analysis request message. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [analyze sentiment documents](struct.DocumentAnalyzeSentimentCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AnalyzeSentimentRequest { - /// The encoding type used by the API to calculate sentence offsets for the - /// sentence sentiment. - #[serde(rename="encodingType")] - pub encoding_type: Option, - /// Input document. - pub document: Option, -} - -impl RequestValue for AnalyzeSentimentRequest {} - - -/// Represents part of speech information for a token. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PartOfSpeech { - /// The grammatical case. - pub case: Option, - /// The grammatical mood. - pub mood: Option, - /// The grammatical form. - pub form: Option, - /// The grammatical gender. - pub gender: Option, - /// The grammatical aspect. - pub aspect: Option, - /// The grammatical number. - pub number: Option, - /// The grammatical person. - pub person: Option, - /// The part of speech tag. - pub tag: Option, - /// The grammatical tense. - pub tense: Option, - /// The grammatical reciprocity. - pub reciprocity: Option, - /// The grammatical properness. - pub proper: Option, - /// The grammatical voice. - pub voice: Option, -} - -impl Part for PartOfSpeech {} - - -/// The syntax analysis request message. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [analyze syntax documents](struct.DocumentAnalyzeSyntaxCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AnalyzeSyntaxRequest { - /// The encoding type used by the API to calculate offsets. - #[serde(rename="encodingType")] - pub encoding_type: Option, - /// Input document. - pub document: Option, -} - -impl RequestValue for AnalyzeSyntaxRequest {} - - /// The entity analysis response message. /// /// # Activities @@ -808,11 +808,11 @@ impl ResponseResult for AnalyzeEntitiesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AnalyzeEntitiesRequest { + /// Input document. + pub document: Option, /// The encoding type used by the API to calculate offsets. #[serde(rename="encodingType")] pub encoding_type: Option, - /// Input document. - pub document: Option, } impl RequestValue for AnalyzeEntitiesRequest {} @@ -1028,10 +1028,7 @@ impl<'a, C, A> DocumentAnalyzeSyntaxCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1063,7 +1060,7 @@ impl<'a, C, A> DocumentAnalyzeSyntaxCall<'a, C, A> where C: BorrowMut DocumentAnalyzeSyntaxCall<'a, C, A> where C: BorrowMut DocumentAnalyzeEntityCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1310,7 +1304,7 @@ impl<'a, C, A> DocumentAnalyzeEntityCall<'a, C, A> where C: BorrowMut DocumentAnalyzeEntityCall<'a, C, A> where C: BorrowMut DocumentAnalyzeSentimentCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1555,7 +1546,7 @@ impl<'a, C, A> DocumentAnalyzeSentimentCall<'a, C, A> where C: BorrowMut DocumentAnalyzeSentimentCall<'a, C, A> where C: BorrowMut DocumentAnnotateTextCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1801,7 +1789,7 @@ impl<'a, C, A> DocumentAnnotateTextCall<'a, C, A> where C: BorrowMut DocumentAnnotateTextCall<'a, C, A> where C: BorrowMut"] +description = "A complete library to interact with Libraryagent (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/libraryagent1-cli" +homepage = "https://cloud.google.com/docs/quota" +documentation = "http://byron.github.io/google-apis-rs/google_libraryagent1_cli" +license = "MIT" +keywords = ["libraryagent", "google", "cli"] +autobins = false + +[[bin]] +name = "libraryagent1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-libraryagent1] +path = "../libraryagent1" +version = "1.0.8+20190402" diff --git a/gen/libraryagent1-cli/LICENSE.md b/gen/libraryagent1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/libraryagent1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/libraryagent1-cli/README.md b/gen/libraryagent1-cli/README.md new file mode 100644 index 0000000000..77ae238dd7 --- /dev/null +++ b/gen/libraryagent1-cli/README.md @@ -0,0 +1,119 @@ + +The `libraryagent1` command-line interface *(CLI)* allows to use most features of the *Google Libraryagent* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Libraryagent* API can be found at the +[official documentation site](https://cloud.google.com/docs/quota). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-libraryagent1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/libraryagent1-cli). + +# Usage + +This documentation was generated from the *Libraryagent* API at revision *20190402*. The CLI is at version *1.0.8*. + +```bash +libraryagent1 [options] + shelves + books-borrow [-p ]... [-o ] + books-get [-p ]... [-o ] + books-list [-p ]... [-o ] + books-return [-p ]... [-o ] + get [-p ]... [-o ] + list [-p ]... [-o ] + libraryagent1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `libraryagent1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/libraryagent1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/libraryagent1-secret.json`, assuming that the required *libraryagent* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `libraryagent1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/libraryagent1-cli/mkdocs.yml b/gen/libraryagent1-cli/mkdocs.yml new file mode 100644 index 0000000000..6008095ad2 --- /dev/null +++ b/gen/libraryagent1-cli/mkdocs.yml @@ -0,0 +1,22 @@ +site_name: Libraryagent v1.0.8+20190402 +site_url: http://byron.github.io/google-apis-rs/google-libraryagent1-cli +site_description: A complete library to interact with Libraryagent (protocol v1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/libraryagent1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['shelves_books-borrow.md', 'Shelves', 'Books Borrow'] +- ['shelves_books-get.md', 'Shelves', 'Books Get'] +- ['shelves_books-list.md', 'Shelves', 'Books List'] +- ['shelves_books-return.md', 'Shelves', 'Books Return'] +- ['shelves_get.md', 'Shelves', 'Get'] +- ['shelves_list.md', 'Shelves', 'List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/libraryagent1-cli/src/cmn.rs b/gen/libraryagent1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/libraryagent1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/libraryagent1-cli/src/main.rs b/gen/libraryagent1-cli/src/main.rs new file mode 100644 index 0000000000..2405aa87ae --- /dev/null +++ b/gen/libraryagent1-cli/src/main.rs @@ -0,0 +1,726 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_libraryagent1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Libraryagent>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _shelves_books_borrow(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.shelves().books_borrow(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _shelves_books_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.shelves().books_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _shelves_books_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.shelves().books_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _shelves_books_return(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.shelves().books_return(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _shelves_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.shelves().get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _shelves_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.shelves().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("shelves", Some(opt)) => { + match opt.subcommand() { + ("books-borrow", Some(opt)) => { + call_result = self._shelves_books_borrow(opt, dry_run, &mut err); + }, + ("books-get", Some(opt)) => { + call_result = self._shelves_books_get(opt, dry_run, &mut err); + }, + ("books-list", Some(opt)) => { + call_result = self._shelves_books_list(opt, dry_run, &mut err); + }, + ("books-return", Some(opt)) => { + call_result = self._shelves_books_return(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._shelves_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._shelves_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("shelves".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "libraryagent1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "libraryagent1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::Libraryagent::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("shelves", "methods: 'books-borrow', 'books-get', 'books-list', 'books-return', 'get' and 'list'", vec![ + ("books-borrow", + Some(r##"Borrow a book from the library. Returns the book if it is borrowed + successfully. Returns NOT_FOUND if the book does not exist in the library. + Returns quota exceeded error if the amount of books borrowed exceeds + allocation quota in any dimensions."##), + "Details at http://byron.github.io/google-apis-rs/google_libraryagent1_cli/shelves_books-borrow", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the book to borrow."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("books-get", + Some(r##"Gets a book. Returns NOT_FOUND if the book does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_libraryagent1_cli/shelves_books-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the book to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("books-list", + Some(r##"Lists books in a shelf. The order is unspecified but deterministic. Newly + created books will not necessarily be added to the end of this list. + Returns NOT_FOUND if the shelf does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_libraryagent1_cli/shelves_books-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The name of the shelf whose books we'd like to list."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("books-return", + Some(r##"Return a book to the library. Returns the book if it is returned to the + library successfully. + Returns error if the book does not belong to the library + or the users didn't borrow before."##), + "Details at http://byron.github.io/google-apis-rs/google_libraryagent1_cli/shelves_books-return", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the book to return."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets a shelf. Returns NOT_FOUND if the shelf does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_libraryagent1_cli/shelves_get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the shelf to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists shelves. The order is unspecified but deterministic. Newly created + shelves will not necessarily be added to the end of this list."##), + "Details at http://byron.github.io/google-apis-rs/google_libraryagent1_cli/shelves_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("libraryagent1") + .author("Sebastian Thiel ") + .version("1.0.8+20190402") + .about("A simple Google Example Library API.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_libraryagent1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/libraryagent1/Cargo.toml b/gen/libraryagent1/Cargo.toml new file mode 100644 index 0000000000..35b8202379 --- /dev/null +++ b/gen/libraryagent1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-libraryagent1" +version = "1.0.8+20190402" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Libraryagent (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/libraryagent1" +homepage = "https://cloud.google.com/docs/quota" +documentation = "https://docs.rs/google-libraryagent1/1.0.8+20190402" +license = "MIT" +keywords = ["libraryagent", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/libraryagent1/LICENSE.md b/gen/libraryagent1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/libraryagent1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/libraryagent1/README.md b/gen/libraryagent1/README.md new file mode 100644 index 0000000000..f194b5134c --- /dev/null +++ b/gen/libraryagent1/README.md @@ -0,0 +1,184 @@ + +The `google-libraryagent1` library allows access to all features of the *Google Libraryagent* service. + +This documentation was generated from *Libraryagent* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *libraryagent:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Libraryagent* *v1* API can be found at the +[official documentation site](https://cloud.google.com/docs/quota). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/struct.Libraryagent.html) ... + +* shelves + * [*books borrow*](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/struct.ShelveBookBorrowCall.html), [*books get*](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/struct.ShelveBookGetCall.html), [*books list*](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/struct.ShelveBookListCall.html), [*books return*](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/struct.ShelveBookReturnCall.html), [*get*](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/struct.ShelveGetCall.html) and [*list*](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/struct.ShelveListCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/struct.Libraryagent.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.shelves().books_borrow(...).doit() +let r = hub.shelves().books_return(...).doit() +let r = hub.shelves().books_get(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-libraryagent1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_libraryagent1 as libraryagent1; +use libraryagent1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use libraryagent1::Libraryagent; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = Libraryagent::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.shelves().books_borrow("name") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-libraryagent1/1.0.8+20190402/google_libraryagent1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **libraryagent1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/libraryagent1/src/cmn.rs b/gen/libraryagent1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/libraryagent1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/libraryagent1/src/lib.rs b/gen/libraryagent1/src/lib.rs new file mode 100644 index 0000000000..20d8bd1aa1 --- /dev/null +++ b/gen/libraryagent1/src/lib.rs @@ -0,0 +1,2141 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Libraryagent* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *libraryagent:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Libraryagent* *v1* API can be found at the +//! [official documentation site](https://cloud.google.com/docs/quota). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/libraryagent1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Libraryagent.html) ... +//! +//! * shelves +//! * [*books borrow*](struct.ShelveBookBorrowCall.html), [*books get*](struct.ShelveBookGetCall.html), [*books list*](struct.ShelveBookListCall.html), [*books return*](struct.ShelveBookReturnCall.html), [*get*](struct.ShelveGetCall.html) and [*list*](struct.ShelveListCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Libraryagent.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.shelves().books_borrow(...).doit() +//! let r = hub.shelves().books_return(...).doit() +//! let r = hub.shelves().books_get(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-libraryagent1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_libraryagent1 as libraryagent1; +//! use libraryagent1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use libraryagent1::Libraryagent; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = Libraryagent::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.shelves().books_borrow("name") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Libraryagent related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_libraryagent1 as libraryagent1; +/// use libraryagent1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use libraryagent1::Libraryagent; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Libraryagent::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shelves().books_borrow("name") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Libraryagent { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for Libraryagent {} + +impl<'a, C, A> Libraryagent + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Libraryagent { + Libraryagent { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://libraryagent.googleapis.com/".to_string(), + _root_url: "https://libraryagent.googleapis.com/".to_string(), + } + } + + pub fn shelves(&'a self) -> ShelveMethods<'a, C, A> { + ShelveMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://libraryagent.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://libraryagent.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Response message for LibraryAgent.ListShelves. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list shelves](struct.ShelveListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleExampleLibraryagentV1ListShelvesResponse { + /// A token to retrieve next page of results. + /// Pass this value in the + /// ListShelvesRequest.page_token + /// field in the subsequent call to `ListShelves` method to retrieve the next + /// page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of shelves. + pub shelves: Option>, +} + +impl ResponseResult for GoogleExampleLibraryagentV1ListShelvesResponse {} + + +/// A Shelf contains a collection of books with a theme. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get shelves](struct.ShelveGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleExampleLibraryagentV1Shelf { + /// The theme of the shelf + pub theme: Option, + /// Output only. The resource name of the shelf. + /// Shelf names have the form `shelves/{shelf_id}`. + /// The name is ignored when creating a shelf. + pub name: Option, +} + +impl ResponseResult for GoogleExampleLibraryagentV1Shelf {} + + +/// Response message for LibraryAgent.ListBooks. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [books list shelves](struct.ShelveBookListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleExampleLibraryagentV1ListBooksResponse { + /// A token to retrieve next page of results. + /// Pass this value in the + /// ListBooksRequest.page_token + /// field in the subsequent call to `ListBooks` method to retrieve the next + /// page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of books. + pub books: Option>, +} + +impl ResponseResult for GoogleExampleLibraryagentV1ListBooksResponse {} + + +/// A single book in the library. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [books borrow shelves](struct.ShelveBookBorrowCall.html) (response) +/// * [books return shelves](struct.ShelveBookReturnCall.html) (response) +/// * [books get shelves](struct.ShelveBookGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleExampleLibraryagentV1Book { + /// Value indicating whether the book has been read. + pub read: Option, + /// The name of the book author. + pub author: Option, + /// The resource name of the book. + /// Book names have the form `shelves/{shelf_id}/books/{book_id}`. + /// The name is ignored when creating a book. + pub name: Option, + /// The title of the book. + pub title: Option, +} + +impl ResponseResult for GoogleExampleLibraryagentV1Book {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *shelve* resources. +/// It is not used directly, but through the `Libraryagent` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_libraryagent1 as libraryagent1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use libraryagent1::Libraryagent; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Libraryagent::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `books_borrow(...)`, `books_get(...)`, `books_list(...)`, `books_return(...)`, `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.shelves(); +/// # } +/// ``` +pub struct ShelveMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Libraryagent, +} + +impl<'a, C, A> MethodsBuilder for ShelveMethods<'a, C, A> {} + +impl<'a, C, A> ShelveMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Return a book to the library. Returns the book if it is returned to the + /// library successfully. + /// Returns error if the book does not belong to the library + /// or the users didn't borrow before. + /// + /// # Arguments + /// + /// * `name` - The name of the book to return. + pub fn books_return(&self, name: &str) -> ShelveBookReturnCall<'a, C, A> { + ShelveBookReturnCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a shelf. Returns NOT_FOUND if the shelf does not exist. + /// + /// # Arguments + /// + /// * `name` - The name of the shelf to retrieve. + pub fn get(&self, name: &str) -> ShelveGetCall<'a, C, A> { + ShelveGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Borrow a book from the library. Returns the book if it is borrowed + /// successfully. Returns NOT_FOUND if the book does not exist in the library. + /// Returns quota exceeded error if the amount of books borrowed exceeds + /// allocation quota in any dimensions. + /// + /// # Arguments + /// + /// * `name` - The name of the book to borrow. + pub fn books_borrow(&self, name: &str) -> ShelveBookBorrowCall<'a, C, A> { + ShelveBookBorrowCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists shelves. The order is unspecified but deterministic. Newly created + /// shelves will not necessarily be added to the end of this list. + pub fn list(&self) -> ShelveListCall<'a, C, A> { + ShelveListCall { + hub: self.hub, + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists books in a shelf. The order is unspecified but deterministic. Newly + /// created books will not necessarily be added to the end of this list. + /// Returns NOT_FOUND if the shelf does not exist. + /// + /// # Arguments + /// + /// * `parent` - The name of the shelf whose books we'd like to list. + pub fn books_list(&self, parent: &str) -> ShelveBookListCall<'a, C, A> { + ShelveBookListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a book. Returns NOT_FOUND if the book does not exist. + /// + /// # Arguments + /// + /// * `name` - The name of the book to retrieve. + pub fn books_get(&self, name: &str) -> ShelveBookGetCall<'a, C, A> { + ShelveBookGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Return a book to the library. Returns the book if it is returned to the +/// library successfully. +/// Returns error if the book does not belong to the library +/// or the users didn't borrow before. +/// +/// A builder for the *books.return* method supported by a *shelve* resource. +/// It is not used directly, but through a `ShelveMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_libraryagent1 as libraryagent1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use libraryagent1::Libraryagent; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Libraryagent::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shelves().books_return("name") +/// .doit(); +/// # } +/// ``` +pub struct ShelveBookReturnCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Libraryagent, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ShelveBookReturnCall<'a, C, A> {} + +impl<'a, C, A> ShelveBookReturnCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleExampleLibraryagentV1Book)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "libraryagent.shelves.books.return", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:return"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the book to return. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ShelveBookReturnCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ShelveBookReturnCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ShelveBookReturnCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ShelveBookReturnCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a shelf. Returns NOT_FOUND if the shelf does not exist. +/// +/// A builder for the *get* method supported by a *shelve* resource. +/// It is not used directly, but through a `ShelveMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_libraryagent1 as libraryagent1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use libraryagent1::Libraryagent; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Libraryagent::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shelves().get("name") +/// .doit(); +/// # } +/// ``` +pub struct ShelveGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Libraryagent, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ShelveGetCall<'a, C, A> {} + +impl<'a, C, A> ShelveGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleExampleLibraryagentV1Shelf)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "libraryagent.shelves.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the shelf to retrieve. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ShelveGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ShelveGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ShelveGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ShelveGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Borrow a book from the library. Returns the book if it is borrowed +/// successfully. Returns NOT_FOUND if the book does not exist in the library. +/// Returns quota exceeded error if the amount of books borrowed exceeds +/// allocation quota in any dimensions. +/// +/// A builder for the *books.borrow* method supported by a *shelve* resource. +/// It is not used directly, but through a `ShelveMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_libraryagent1 as libraryagent1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use libraryagent1::Libraryagent; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Libraryagent::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shelves().books_borrow("name") +/// .doit(); +/// # } +/// ``` +pub struct ShelveBookBorrowCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Libraryagent, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ShelveBookBorrowCall<'a, C, A> {} + +impl<'a, C, A> ShelveBookBorrowCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleExampleLibraryagentV1Book)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "libraryagent.shelves.books.borrow", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:borrow"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the book to borrow. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ShelveBookBorrowCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ShelveBookBorrowCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ShelveBookBorrowCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ShelveBookBorrowCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists shelves. The order is unspecified but deterministic. Newly created +/// shelves will not necessarily be added to the end of this list. +/// +/// A builder for the *list* method supported by a *shelve* resource. +/// It is not used directly, but through a `ShelveMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_libraryagent1 as libraryagent1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use libraryagent1::Libraryagent; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Libraryagent::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shelves().list() +/// .page_token("kasd") +/// .page_size(-22) +/// .doit(); +/// # } +/// ``` +pub struct ShelveListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Libraryagent, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ShelveListCall<'a, C, A> {} + +impl<'a, C, A> ShelveListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleExampleLibraryagentV1ListShelvesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "libraryagent.shelves.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/shelves"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// A token identifying a page of results the server should return. + /// Typically, this is the value of + /// ListShelvesResponse.next_page_token + /// returned from the previous call to `ListShelves` method. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ShelveListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Requested page size. Server may return fewer shelves than requested. + /// If unspecified, server will pick an appropriate default. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ShelveListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ShelveListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ShelveListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ShelveListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists books in a shelf. The order is unspecified but deterministic. Newly +/// created books will not necessarily be added to the end of this list. +/// Returns NOT_FOUND if the shelf does not exist. +/// +/// A builder for the *books.list* method supported by a *shelve* resource. +/// It is not used directly, but through a `ShelveMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_libraryagent1 as libraryagent1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use libraryagent1::Libraryagent; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Libraryagent::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shelves().books_list("parent") +/// .page_token("justo") +/// .page_size(-1) +/// .doit(); +/// # } +/// ``` +pub struct ShelveBookListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Libraryagent, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ShelveBookListCall<'a, C, A> {} + +impl<'a, C, A> ShelveBookListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleExampleLibraryagentV1ListBooksResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "libraryagent.shelves.books.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/books"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the shelf whose books we'd like to list. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ShelveBookListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A token identifying a page of results the server should return. + /// Typically, this is the value of + /// ListBooksResponse.next_page_token. + /// returned from the previous call to `ListBooks` method. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ShelveBookListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Requested page size. Server may return fewer books than requested. + /// If unspecified, server will pick an appropriate default. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ShelveBookListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ShelveBookListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ShelveBookListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ShelveBookListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a book. Returns NOT_FOUND if the book does not exist. +/// +/// A builder for the *books.get* method supported by a *shelve* resource. +/// It is not used directly, but through a `ShelveMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_libraryagent1 as libraryagent1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use libraryagent1::Libraryagent; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Libraryagent::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shelves().books_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ShelveBookGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Libraryagent, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ShelveBookGetCall<'a, C, A> {} + +impl<'a, C, A> ShelveBookGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleExampleLibraryagentV1Book)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "libraryagent.shelves.books.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the book to retrieve. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ShelveBookGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ShelveBookGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ShelveBookGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ShelveBookGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/licensing1/Cargo.toml b/gen/licensing1/Cargo.toml index f5386294be..88b12282d8 100644 --- a/gen/licensing1/Cargo.toml +++ b/gen/licensing1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/licensing1/src/lib.rs b/gen/licensing1/src/lib.rs index 4002a01db9..772a8968d3 100644 --- a/gen/licensing1/src/lib.rs +++ b/gen/licensing1/src/lib.rs @@ -766,10 +766,7 @@ impl<'a, C, A> LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -789,7 +786,7 @@ impl<'a, C, A> LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1054,7 +1048,7 @@ impl<'a, C, A> LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1156,7 +1150,7 @@ impl<'a, C, A> LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1302,10 +1296,7 @@ impl<'a, C, A> LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1325,7 +1316,7 @@ impl<'a, C, A> LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1602,7 +1590,7 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1714,7 +1702,7 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1867,10 +1855,7 @@ impl<'a, C, A> LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1902,7 +1887,7 @@ impl<'a, C, A> LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2200,7 +2182,7 @@ impl<'a, C, A> LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2496,7 +2475,7 @@ impl<'a, C, A> LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Logging (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-logging2] path = "../logging2" -version = "1.0.8+20180929" +version = "1.0.8+20190325" diff --git a/gen/logging2-cli/README.md b/gen/logging2-cli/README.md index f1345fca2a..a29346e528 100644 --- a/gen/logging2-cli/README.md +++ b/gen/logging2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Logging* API at revision *20180929*. The CLI is at version *1.0.8*. +This documentation was generated from the *Logging* API at revision *20190325*. The CLI is at version *1.0.8*. ```bash logging2 [options] diff --git a/gen/logging2-cli/mkdocs.yml b/gen/logging2-cli/mkdocs.yml index c1544acd1f..def6fbf427 100644 --- a/gen/logging2-cli/mkdocs.yml +++ b/gen/logging2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Logging v1.0.8+20180929 +site_name: Logging v1.0.8+20190325 site_url: http://byron.github.io/google-apis-rs/google-logging2-cli site_description: A complete library to interact with Logging (protocol v2) diff --git a/gen/logging2-cli/src/main.rs b/gen/logging2-cli/src/main.rs index 03349b8f1d..691805d527 100644 --- a/gen/logging2-cli/src/main.rs +++ b/gen/logging2-cli/src/main.rs @@ -70,11 +70,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "disabled", "filter", "name", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -321,11 +323,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "disabled", "filter", "name", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -523,16 +527,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -782,16 +786,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -881,16 +885,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1161,11 +1165,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "disabled", "filter", "name", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1412,11 +1418,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "disabled", "filter", "name", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1504,11 +1512,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "disabled", "filter", "name", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1755,11 +1765,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "disabled", "filter", "name", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1957,16 +1969,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2216,16 +2228,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2315,16 +2327,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2585,11 +2597,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "disabled", "filter", "name", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2836,11 +2850,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "disabled", "filter", "name", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3038,16 +3054,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3297,16 +3313,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3396,16 +3412,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3496,11 +3512,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "disabled", "filter", "name", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3747,11 +3765,13 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disabled" => Some(("disabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "disabled", "filter", "name"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "description", "disabled", "filter", "name", "update-time"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3949,14 +3969,15 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.display-name" => Some(("metricDescriptor.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.description" => Some(("metricDescriptor.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.metric-kind" => Some(("metricDescriptor.metricKind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.value-type" => Some(("metricDescriptor.valueType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "metric-descriptor.metadata.sample-period" => Some(("metricDescriptor.metadata.samplePeriod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "metric-descriptor.metadata.ingest-delay" => Some(("metricDescriptor.metadata.ingestDelay", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.metadata.launch-stage" => Some(("metricDescriptor.metadata.launchStage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "metric-descriptor.metadata.ingest-delay" => Some(("metricDescriptor.metadata.ingestDelay", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "metric-descriptor.metadata.sample-period" => Some(("metricDescriptor.metadata.samplePeriod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.type" => Some(("metricDescriptor.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.unit" => Some(("metricDescriptor.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.name" => Some(("metricDescriptor.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3971,9 +3992,10 @@ impl<'n> Engine<'n> { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "value-extractor" => Some(("valueExtractor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bounds", "bucket-options", "description", "display-name", "explicit-buckets", "exponential-buckets", "filter", "growth-factor", "ingest-delay", "label-extractors", "launch-stage", "linear-buckets", "metadata", "metric-descriptor", "metric-kind", "name", "num-finite-buckets", "offset", "sample-period", "scale", "type", "unit", "value-extractor", "value-type", "version", "width"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["bounds", "bucket-options", "create-time", "description", "display-name", "explicit-buckets", "exponential-buckets", "filter", "growth-factor", "ingest-delay", "label-extractors", "launch-stage", "linear-buckets", "metadata", "metric-descriptor", "metric-kind", "name", "num-finite-buckets", "offset", "sample-period", "scale", "type", "unit", "update-time", "value-extractor", "value-type", "version", "width"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4219,14 +4241,15 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.display-name" => Some(("metricDescriptor.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.description" => Some(("metricDescriptor.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.metric-kind" => Some(("metricDescriptor.metricKind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.value-type" => Some(("metricDescriptor.valueType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "metric-descriptor.metadata.sample-period" => Some(("metricDescriptor.metadata.samplePeriod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "metric-descriptor.metadata.ingest-delay" => Some(("metricDescriptor.metadata.ingestDelay", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.metadata.launch-stage" => Some(("metricDescriptor.metadata.launchStage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "metric-descriptor.metadata.ingest-delay" => Some(("metricDescriptor.metadata.ingestDelay", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "metric-descriptor.metadata.sample-period" => Some(("metricDescriptor.metadata.samplePeriod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.type" => Some(("metricDescriptor.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.unit" => Some(("metricDescriptor.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.name" => Some(("metricDescriptor.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4241,9 +4264,10 @@ impl<'n> Engine<'n> { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "value-extractor" => Some(("valueExtractor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bounds", "bucket-options", "description", "display-name", "explicit-buckets", "exponential-buckets", "filter", "growth-factor", "ingest-delay", "label-extractors", "launch-stage", "linear-buckets", "metadata", "metric-descriptor", "metric-kind", "name", "num-finite-buckets", "offset", "sample-period", "scale", "type", "unit", "value-extractor", "value-type", "version", "width"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["bounds", "bucket-options", "create-time", "description", "display-name", "explicit-buckets", "exponential-buckets", "filter", "growth-factor", "ingest-delay", "label-extractors", "launch-stage", "linear-buckets", "metadata", "metric-descriptor", "metric-kind", "name", "num-finite-buckets", "offset", "sample-period", "scale", "type", "unit", "update-time", "value-extractor", "value-type", "version", "width"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4326,16 +4350,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4585,16 +4609,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4684,16 +4708,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4783,16 +4807,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -5042,16 +5066,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -5813,7 +5837,7 @@ fn main() { Some(false)), ]), ("sinks-patch", - Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), + Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/billing-accounts_sinks-patch", vec![ (Some(r##"sink-name"##), @@ -5846,7 +5870,7 @@ fn main() { Some(false)), ]), ("sinks-update", - Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), + Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/billing-accounts_sinks-update", vec![ (Some(r##"sink-name"##), @@ -5882,7 +5906,7 @@ fn main() { ("entries", "methods: 'list' and 'write'", vec![ ("list", - Some(r##"Lists log entries. Use this method to retrieve log entries from Logging. For ways to export log entries, see Exporting Logs."##), + Some(r##"Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/entries_list", vec![ (Some(r##"kv"##), @@ -6394,7 +6418,7 @@ fn main() { Some(false)), ]), ("sinks-patch", - Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), + Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/folders_sinks-patch", vec![ (Some(r##"sink-name"##), @@ -6427,7 +6451,7 @@ fn main() { Some(false)), ]), ("sinks-update", - Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), + Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/folders_sinks-update", vec![ (Some(r##"sink-name"##), @@ -6854,7 +6878,7 @@ fn main() { Some(false)), ]), ("sinks-patch", - Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), + Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/organizations_sinks-patch", vec![ (Some(r##"sink-name"##), @@ -6887,7 +6911,7 @@ fn main() { Some(false)), ]), ("sinks-update", - Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), + Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/organizations_sinks-update", vec![ (Some(r##"sink-name"##), @@ -7370,7 +7394,7 @@ fn main() { Some(false)), ]), ("sinks-patch", - Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), + Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_sinks-patch", vec![ (Some(r##"sink-name"##), @@ -7403,7 +7427,7 @@ fn main() { Some(false)), ]), ("sinks-update", - Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), + Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/projects_sinks-update", vec![ (Some(r##"sink-name"##), @@ -7553,7 +7577,7 @@ fn main() { Some(false)), ]), ("update", - Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), + Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_cli/sinks_update", vec![ (Some(r##"sink-name"##), @@ -7591,7 +7615,7 @@ fn main() { let mut app = App::new("logging2") .author("Sebastian Thiel ") - .version("1.0.8+20180929") + .version("1.0.8+20190325") .about("Writes log entries and manages your Logging configuration.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_logging2_cli") .arg(Arg::with_name("url") diff --git a/gen/logging2/Cargo.toml b/gen/logging2/Cargo.toml index e1929b9860..8b51aaea31 100644 --- a/gen/logging2/Cargo.toml +++ b/gen/logging2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-logging2" -version = "1.0.8+20180929" +version = "1.0.8+20190325" authors = ["Sebastian Thiel "] description = "A complete library to interact with Logging (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2" homepage = "https://cloud.google.com/logging/docs/" -documentation = "https://docs.rs/google-logging2/1.0.8+20180929" +documentation = "https://docs.rs/google-logging2/1.0.8+20190325" license = "MIT" keywords = ["logging", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/logging2/README.md b/gen/logging2/README.md index c1e589dc1b..3ccd18096b 100644 --- a/gen/logging2/README.md +++ b/gen/logging2/README.md @@ -5,32 +5,32 @@ DO NOT EDIT ! --> The `google-logging2` library allows access to all features of the *Google Logging* service. -This documentation was generated from *Logging* crate version *1.0.8+20180929*, where *20180929* is the exact revision of the *logging:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Logging* crate version *1.0.8+20190325*, where *20190325* is the exact revision of the *logging:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Logging* *v2* API can be found at the [official documentation site](https://cloud.google.com/logging/docs/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.Logging.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.Logging.html) ... * billing accounts - * [*exclusions create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountExclusionCreateCall.html), [*exclusions delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountExclusionDeleteCall.html), [*exclusions get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountExclusionGetCall.html), [*exclusions list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountExclusionListCall.html), [*exclusions patch*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountExclusionPatchCall.html), [*logs delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountSinkListCall.html), [*sinks patch*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountSinkPatchCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.BillingAccountSinkUpdateCall.html) + * [*exclusions create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountExclusionCreateCall.html), [*exclusions delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountExclusionDeleteCall.html), [*exclusions get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountExclusionGetCall.html), [*exclusions list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountExclusionListCall.html), [*exclusions patch*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountExclusionPatchCall.html), [*logs delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountSinkListCall.html), [*sinks patch*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountSinkPatchCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.BillingAccountSinkUpdateCall.html) * entries - * [*list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.EntryListCall.html) and [*write*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.EntryWriteCall.html) + * [*list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.EntryListCall.html) and [*write*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.EntryWriteCall.html) * exclusions - * [*create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ExclusionCreateCall.html), [*delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ExclusionDeleteCall.html), [*get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ExclusionGetCall.html), [*list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ExclusionListCall.html) and [*patch*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ExclusionPatchCall.html) + * [*create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ExclusionCreateCall.html), [*delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ExclusionDeleteCall.html), [*get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ExclusionGetCall.html), [*list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ExclusionListCall.html) and [*patch*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ExclusionPatchCall.html) * folders - * [*exclusions create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderExclusionCreateCall.html), [*exclusions delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderExclusionDeleteCall.html), [*exclusions get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderExclusionGetCall.html), [*exclusions list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderExclusionListCall.html), [*exclusions patch*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderExclusionPatchCall.html), [*logs delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderSinkListCall.html), [*sinks patch*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderSinkPatchCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.FolderSinkUpdateCall.html) + * [*exclusions create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderExclusionCreateCall.html), [*exclusions delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderExclusionDeleteCall.html), [*exclusions get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderExclusionGetCall.html), [*exclusions list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderExclusionListCall.html), [*exclusions patch*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderExclusionPatchCall.html), [*logs delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderSinkListCall.html), [*sinks patch*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderSinkPatchCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.FolderSinkUpdateCall.html) * logs - * [*delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.LogDeleteCall.html) and [*list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.LogListCall.html) -* [monitored resource descriptors](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.MonitoredResourceDescriptor.html) - * [*list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.MonitoredResourceDescriptorListCall.html) + * [*delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.LogDeleteCall.html) and [*list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.LogListCall.html) +* [monitored resource descriptors](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.MonitoredResourceDescriptor.html) + * [*list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.MonitoredResourceDescriptorListCall.html) * organizations - * [*exclusions create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationExclusionCreateCall.html), [*exclusions delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationExclusionDeleteCall.html), [*exclusions get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationExclusionGetCall.html), [*exclusions list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationExclusionListCall.html), [*exclusions patch*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationExclusionPatchCall.html), [*logs delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationSinkListCall.html), [*sinks patch*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationSinkPatchCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.OrganizationSinkUpdateCall.html) + * [*exclusions create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationExclusionCreateCall.html), [*exclusions delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationExclusionDeleteCall.html), [*exclusions get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationExclusionGetCall.html), [*exclusions list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationExclusionListCall.html), [*exclusions patch*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationExclusionPatchCall.html), [*logs delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationSinkListCall.html), [*sinks patch*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationSinkPatchCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.OrganizationSinkUpdateCall.html) * projects - * [*exclusions create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectExclusionCreateCall.html), [*exclusions delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectExclusionDeleteCall.html), [*exclusions get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectExclusionGetCall.html), [*exclusions list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectExclusionListCall.html), [*exclusions patch*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectExclusionPatchCall.html), [*logs delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectLogListCall.html), [*metrics create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectMetricCreateCall.html), [*metrics delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectMetricDeleteCall.html), [*metrics get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectMetricGetCall.html), [*metrics list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectMetricListCall.html), [*metrics update*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectMetricUpdateCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectSinkListCall.html), [*sinks patch*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectSinkPatchCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.ProjectSinkUpdateCall.html) + * [*exclusions create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectExclusionCreateCall.html), [*exclusions delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectExclusionDeleteCall.html), [*exclusions get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectExclusionGetCall.html), [*exclusions list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectExclusionListCall.html), [*exclusions patch*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectExclusionPatchCall.html), [*logs delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectLogListCall.html), [*metrics create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectMetricCreateCall.html), [*metrics delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectMetricDeleteCall.html), [*metrics get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectMetricGetCall.html), [*metrics list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectMetricListCall.html), [*metrics update*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectMetricUpdateCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectSinkListCall.html), [*sinks patch*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectSinkPatchCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.ProjectSinkUpdateCall.html) * sinks - * [*create*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.SinkCreateCall.html), [*delete*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.SinkDeleteCall.html), [*get*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.SinkGetCall.html), [*list*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.SinkListCall.html) and [*update*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.SinkUpdateCall.html) + * [*create*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.SinkCreateCall.html), [*delete*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.SinkDeleteCall.html), [*get*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.SinkGetCall.html), [*list*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.SinkListCall.html) and [*update*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.SinkUpdateCall.html) @@ -39,17 +39,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/struct.Logging.html)** +* **[Hub](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/struct.Logging.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.Part.html)** + * **[Parts](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -166,17 +166,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -186,29 +186,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-logging2/1.0.8+20180929/google_logging2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-logging2/1.0.8+20190325/google_logging2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/logging2/src/lib.rs b/gen/logging2/src/lib.rs index 53210c4cd9..85841a4385 100644 --- a/gen/logging2/src/lib.rs +++ b/gen/logging2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Logging* crate version *1.0.8+20180929*, where *20180929* is the exact revision of the *logging:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Logging* crate version *1.0.8+20190325*, where *20190325* is the exact revision of the *logging:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Logging* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/logging/docs/). @@ -565,19 +565,24 @@ pub struct Explicit { impl Part for Explicit {} -/// Result returned from WriteLogEntries. empty +/// BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [write entries](struct.EntryWriteCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WriteLogEntriesResponse { _never_set: Option } +pub struct BucketOptions { + /// The exponential buckets. + #[serde(rename="exponentialBuckets")] + pub exponential_buckets: Option, + /// The linear bucket. + #[serde(rename="linearBuckets")] + pub linear_buckets: Option, + /// The explicit buckets. + #[serde(rename="explicitBuckets")] + pub explicit_buckets: Option, +} -impl ResponseResult for WriteLogEntriesResponse {} +impl Part for BucketOptions {} /// An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "gce_instance" has labels "instance_id" and "zone": @@ -652,15 +657,15 @@ impl ResponseResult for ListExclusionsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MetricDescriptorMetadata { - /// The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period. - #[serde(rename="samplePeriod")] - pub sample_period: Option, /// The delay of data points caused by ingestion. Data points older than this age are guaranteed to be ingested and available to be read, excluding data loss due to errors. #[serde(rename="ingestDelay")] pub ingest_delay: Option, /// The launch stage of the metric definition. #[serde(rename="launchStage")] pub launch_stage: Option, + /// The sampling period of metric data points. For metrics which are written periodically, consecutive data points are stored at this time interval, excluding data loss due to errors. Metrics with a higher granularity have a smaller sampling period. + #[serde(rename="samplePeriod")] + pub sample_period: Option, } impl Part for MetricDescriptorMetadata {} @@ -695,28 +700,28 @@ impl Part for MetricDescriptorMetadata {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LogSink { - /// Deprecated. This field is ignored when creating or updating sinks. - #[serde(rename="endTime")] - pub end_time: Option, + /// Output only. The last update timestamp of the sink.This field may not be present for older sinks. + #[serde(rename="updateTime")] + pub update_time: Option, /// Required. The client-assigned sink identifier, unique within the project. Example: "my-syslog-errors-to-pubsub". Sink identifiers are limited to 100 characters and can include only the following characters: upper and lower-case alphanumeric characters, underscores, hyphens, and periods. pub name: Option, /// Required. The export destination: /// "storage.googleapis.com/[GCS_BUCKET]" /// "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" /// "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" - /// The sink's writer_identity, set when the sink is created, must have permission to write to the destination or else the log entries are not exported. For more information, see Exporting Logs With Sinks. + /// The sink's writer_identity, set when the sink is created, must have permission to write to the destination or else the log entries are not exported. For more information, see Exporting Logs with Sinks. pub destination: Option, + /// Output only. The creation timestamp of the sink.This field may not be present for older sinks. + #[serde(rename="createTime")] + pub create_time: Option, /// Optional. An advanced logs filter. The only exported log entries are those that are in the resource owning the sink and that match the filter. For example: /// logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR /// pub filter: Option, - /// Deprecated. This field is ignored when creating or updating sinks. - #[serde(rename="startTime")] - pub start_time: Option, /// Deprecated. The log entry format to use for this sink's exported log entries. The v2 format is used by default and cannot be changed. #[serde(rename="outputVersionFormat")] pub output_version_format: Option, - /// Output only. An IAM identity—a service account or group—under which Logging writes the exported log entries to the sink's destination. This field is set by sinks.create and sinks.update, based on the setting of unique_writer_identity in those methods.Until you grant this identity write-access to the destination, log entry exports from this sink will fail. For more information, see Granting access for a resource. Consult the destination service's documentation to determine the appropriate IAM roles to assign to the identity. + /// Output only. An IAM identity—a service account or group—under which Logging writes the exported log entries to the sink's destination. This field is set by sinks.create and sinks.update based on the value of unique_writer_identity in those methods.Until you grant this identity write-access to the destination, log entry exports from this sink will fail. For more information, see Granting Access for a Resource. Consult the destination service's documentation to determine the appropriate IAM roles to assign to the identity. #[serde(rename="writerIdentity")] pub writer_identity: Option, /// Optional. This field applies only to sinks owned by organizations and folders. If the field is false, the default, only the logs owned by the sink's parent resource are available for export. If the field is true, then logs from all the projects, folders, and billing accounts contained in the sink's parent resource are also available for export. Whether a particular log entry from the children is exported depends on the sink's filter expression. For example, if this field is true, then the filter resource.type=gce_instance would export all Compute Engine VM instance log entries from all projects in the sink's parent. To only export entries from certain child projects, filter on the project part of the log name: @@ -759,7 +764,7 @@ pub struct ListLogEntriesRequest { /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. page_token must be the value of next_page_token from the previous response. The values of other method parameters should be identical to those in the previous call. #[serde(rename="pageToken")] pub page_token: Option, - /// Deprecated. Use resource_names instead. One or more project identifiers or project numbers from which to retrieve log entries. Example: "my-project-1A". If present, these project identifiers are converted to resource name format and added to the list of resources in resource_names. + /// Deprecated. Use resource_names instead. One or more project identifiers or project numbers from which to retrieve log entries. Example: "my-project-1A". #[serde(rename="projectIds")] pub project_ids: Option>, /// Optional. A filter that chooses which log entries to return. See Advanced Logs Filters. Only log entries that match the filter are returned. An empty filter matches all log entries in the resources listed in resource_names. Referencing a parent resource that is not listed in resource_names will cause the filter to return no results. The maximum length of the filter is 20000 characters. @@ -787,14 +792,14 @@ impl RequestValue for ListLogEntriesRequest {} /// * [delete sinks](struct.SinkDeleteCall.html) (response) /// * [sinks delete organizations](struct.OrganizationSinkDeleteCall.html) (response) /// * [exclusions delete billing accounts](struct.BillingAccountExclusionDeleteCall.html) (response) -/// * [logs delete billing accounts](struct.BillingAccountLogDeleteCall.html) (response) +/// * [sinks delete billing accounts](struct.BillingAccountSinkDeleteCall.html) (response) /// * [delete logs](struct.LogDeleteCall.html) (response) /// * [logs delete folders](struct.FolderLogDeleteCall.html) (response) /// * [metrics delete projects](struct.ProjectMetricDeleteCall.html) (response) /// * [exclusions delete organizations](struct.OrganizationExclusionDeleteCall.html) (response) /// * [exclusions delete projects](struct.ProjectExclusionDeleteCall.html) (response) /// * [sinks delete projects](struct.ProjectSinkDeleteCall.html) (response) -/// * [sinks delete billing accounts](struct.BillingAccountSinkDeleteCall.html) (response) +/// * [logs delete billing accounts](struct.BillingAccountLogDeleteCall.html) (response) /// * [exclusions delete folders](struct.FolderExclusionDeleteCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -816,9 +821,6 @@ pub struct HttpRequest { pub cache_validated_with_origin_server: Option, /// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" pub protocol: Option, - /// The request method. Examples: "GET", "HEAD", "PUT", "POST". - #[serde(rename="requestMethod")] - pub request_method: Option, /// The request processing latency on the server, from the time the request was received until the response was sent. pub latency: Option, /// The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted. @@ -827,21 +829,25 @@ pub struct HttpRequest { /// The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: "http://example.com/some/info?color=red". #[serde(rename="requestUrl")] pub request_url: Option, + /// Whether or not an entity was served from cache (with or without validation). + #[serde(rename="cacheHit")] + pub cache_hit: Option, /// The IP address (IPv4 or IPv6) of the origin server that the request was sent to. #[serde(rename="serverIp")] pub server_ip: Option, /// Whether or not a cache lookup was attempted. #[serde(rename="cacheLookup")] pub cache_lookup: Option, - /// Whether or not an entity was served from cache (with or without validation). - #[serde(rename="cacheHit")] - pub cache_hit: Option, + /// The request method. Examples: "GET", "HEAD", "PUT", "POST". + #[serde(rename="requestMethod")] + pub request_method: Option, /// The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). pub referer: Option, /// The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329". #[serde(rename="remoteIp")] pub remote_ip: Option, - /// The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)". + /// The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET + /// CLR 1.0.3705)". #[serde(rename="userAgent")] pub user_agent: Option, /// The size of the HTTP request message in bytes, including the request headers and the request body. @@ -998,24 +1004,19 @@ pub struct ListSinksResponse { impl ResponseResult for ListSinksResponse {} -/// BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. +/// Result returned from WriteLogEntries. empty /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [write entries](struct.EntryWriteCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BucketOptions { - /// The exponential buckets. - #[serde(rename="exponentialBuckets")] - pub exponential_buckets: Option, - /// The linear bucket. - #[serde(rename="linearBuckets")] - pub linear_buckets: Option, - /// The explicit buckets. - #[serde(rename="explicitBuckets")] - pub explicit_buckets: Option, -} +pub struct WriteLogEntriesResponse { _never_set: Option } -impl Part for BucketOptions {} +impl ResponseResult for WriteLogEntriesResponse {} /// The parameters to WriteLogEntries. @@ -1086,14 +1087,20 @@ impl RequestValue for WriteLogEntriesRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LogExclusion { + /// Optional. If set to True, then this exclusion is disabled and it does not exclude any log entries. You can update an exclusion to change the value of this field. + pub disabled: Option, /// Required. An advanced logs filter that matches the log entries to be excluded. By using the sample function, you can exclude less than 100% of the matching log entries. For example, the following filter matches 99% of low-severity log entries from load balancers:"resource.type=http_load_balancer severity, - /// Optional. If set to True, then this exclusion is disabled and it does not exclude any log entries. You can use exclusions.patch to change the value of this field. - pub disabled: Option, - /// Required. A client-assigned identifier, such as "load-balancer-exclusion". Identifiers are limited to 100 characters and can include only letters, digits, underscores, hyphens, and periods. - pub name: Option, + /// Output only. The last update timestamp of the exclusion.This field may not be present for older exclusions. + #[serde(rename="updateTime")] + pub update_time: Option, /// Optional. A description of this exclusion. pub description: Option, + /// Output only. The creation timestamp of the exclusion.This field may not be present for older exclusions. + #[serde(rename="createTime")] + pub create_time: Option, + /// Required. A client-assigned identifier, such as "load-balancer-exclusion". Identifiers are limited to 100 characters and can include only letters, digits, underscores, hyphens, and periods. + pub name: Option, } impl RequestValue for LogExclusion {} @@ -1138,13 +1145,13 @@ pub struct LogEntry { /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" /// "folders/[FOLDER_ID]/logs/[LOG_ID]" - /// A project number may optionally be used in place of PROJECT_ID. The project number is translated to its corresponding PROJECT_ID internally and the log_name field will contain PROJECT_ID in queries and exports.[LOG_ID] must be URL-encoded within log_name. Example: "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results. + /// A project number may optionally be used in place of PROJECT_ID. The project number is translated to its corresponding PROJECT_ID internally and the log_name field will contain PROJECT_ID in queries and exports.[LOG_ID] must be URL-encoded within log_name. Example: "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results. #[serde(rename="logName")] pub log_name: Option, /// Optional. A unique identifier for the log entry. If you provide a value, then Logging considers other log entries in the same project, with the same timestamp, and with the same insert_id to be duplicates which can be removed. If omitted in new log entries, then Logging assigns its own unique identifier. The insert_id is also used to order log entries that have the same timestamp value. #[serde(rename="insertId")] pub insert_id: Option, - /// Optional. The span ID within the trace associated with the log entry. For Trace spans, this is the same format that the Trace API v2 uses: a 16-character hexadecimal encoding of an 8-byte array, such as "000000000000004a". + /// Optional. The span ID within the trace associated with the log entry.For Trace spans, this is the same format that the Trace API v2 uses: a 16-character hexadecimal encoding of an 8-byte array, such as "000000000000004a". #[serde(rename="spanId")] pub span_id: Option, /// Optional. Information about an operation associated with the log entry, if applicable. @@ -1152,7 +1159,7 @@ pub struct LogEntry { /// Optional. Source code location information associated with the log entry, if any. #[serde(rename="sourceLocation")] pub source_location: Option, - /// Required. The primary monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error. + /// Required. The primary monitored resource associated with this log entry.Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error. pub resource: Option, /// Optional. The severity of the log entry. The default value is LogSeverity.DEFAULT. pub severity: Option, @@ -1168,10 +1175,10 @@ pub struct LogEntry { /// The log entry payload, represented as a protocol buffer. Some Google Cloud Platform services use this field for their log entry payloads. #[serde(rename="protoPayload")] pub proto_payload: Option>, - /// Optional. The sampling decision of the trace associated with the log entry. True means that the trace resource name in the trace field was sampled for storage in a trace backend. False means that the trace was not sampled for storage when this log entry was written, or the sampling decision was unknown at the time. A non-sampled trace value is still useful as a request correlation identifier. The default is False. + /// Optional. The sampling decision of the trace associated with the log entry.True means that the trace resource name in the trace field was sampled for storage in a trace backend. False means that the trace was not sampled for storage when this log entry was written, or the sampling decision was unknown at the time. A non-sampled trace value is still useful as a request correlation identifier. The default is False. #[serde(rename="traceSampled")] pub trace_sampled: Option, - /// Output only. Additional metadata about the monitored resource. Only k8s_container, k8s_pod, and k8s_node MonitoredResources have this field populated. + /// Deprecated. Output only. Additional metadata about the monitored resource.Only k8s_container, k8s_pod, and k8s_node MonitoredResources have this field populated for GKE versions older than 1.12.6. For GKE versions 1.12.6 and above, the metadata field has been deprecated. The Kubernetes pod labels that used to be in metadata.userLabels will now be present in the labels field with a key prefix of k8s-pod/. The Stackdriver system labels that were present in the metadata.systemLabels field will no longer be available in the LogEntry. pub metadata: Option, } @@ -1205,12 +1212,15 @@ impl Part for LogEntryOperation {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [metrics create projects](struct.ProjectMetricCreateCall.html) (request|response) -/// * [metrics get projects](struct.ProjectMetricGetCall.html) (response) /// * [metrics update projects](struct.ProjectMetricUpdateCall.html) (request|response) +/// * [metrics get projects](struct.ProjectMetricGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LogMetric { - /// Optional. A description of this metric, which is used in documentation. + /// Output only. The last update timestamp of the metric.This field may not be present for older metrics. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters. pub description: Option, /// Optional. The metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression.The name, type, and description fields in the metric_descriptor are output only, and is constructed using the name and description field in the LogMetric.To create a logs-based metric that records a distribution of log values, a DELTA metric kind with a DISTRIBUTION value type must be used along with a value_extractor expression in the LogMetric.Each label in the metric descriptor must have a matching label name as the key and an extractor expression as the value in the label_extractors map.The metric_kind and value_type fields in the metric_descriptor cannot be updated once initially configured. New labels can be added in the metric_descriptor, but existing labels cannot be modified except for their description. #[serde(rename="metricDescriptor")] @@ -1230,6 +1240,9 @@ pub struct LogMetric { pub value_extractor: Option, /// Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed. pub version: Option, + /// Output only. The creation timestamp of the metric.This field may not be present for older metrics. + #[serde(rename="createTime")] + pub create_time: Option, /// Required. The client-assigned metric identifier. Examples: "error_count", "nginx/requests".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: "projects/my-project/metrics/nginx%2Frequests". pub name: Option, } @@ -1257,10 +1270,10 @@ pub struct MonitoredResourceDescriptor { /// Required. The monitored resource type. For example, the type "cloudsql_database" represents databases in Google Cloud SQL. The maximum length of this value is 256 characters. #[serde(rename="type")] pub type_: Option, - /// Optional. The resource name of the monitored resource descriptor: "projects/{project_id}/monitoredResourceDescriptors/{type}" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format "monitoredResourceDescriptors/{type}". - pub name: Option, /// Optional. A detailed description of the monitored resource type that might be used in documentation. pub description: Option, + /// Optional. The resource name of the monitored resource descriptor: "projects/{project_id}/monitoredResourceDescriptors/{type}" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format "monitoredResourceDescriptors/{type}". + pub name: Option, } impl Resource for MonitoredResourceDescriptor {} @@ -1310,6 +1323,30 @@ impl<'a, C, A> MethodsBuilder for FolderMethods<'a, C, A> {} impl<'a, C, A> FolderMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Lists sinks. + /// + /// # Arguments + /// + /// * `parent` - Required. The parent resource whose sinks are to be listed: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// "billingAccounts/[BILLING_ACCOUNT_ID]" + /// "folders/[FOLDER_ID]" + /// + pub fn sinks_list(&self, parent: &str) -> FolderSinkListCall<'a, C, A> { + FolderSinkListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Changes one or more properties of an existing exclusion. @@ -1337,7 +1374,7 @@ impl<'a, C, A> FolderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. + /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// # Arguments /// @@ -1526,31 +1563,7 @@ impl<'a, C, A> FolderMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists sinks. - /// - /// # Arguments - /// - /// * `parent` - Required. The parent resource whose sinks are to be listed: - /// "projects/[PROJECT_ID]" - /// "organizations/[ORGANIZATION_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]" - /// "folders/[FOLDER_ID]" - /// - pub fn sinks_list(&self, parent: &str) -> FolderSinkListCall<'a, C, A> { - FolderSinkListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. + /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// # Arguments /// @@ -1662,42 +1675,24 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. + /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// # Arguments /// - /// * `sinkName` - Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// * `request` - No description provided. + /// * `sinkName` - Required. The full resource name of the sink to update, including the parent resource and the sink identifier: /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" /// "folders/[FOLDER_ID]/sinks/[SINK_ID]" /// Example: "projects/my-project-id/sinks/my-sink-id". - pub fn sinks_delete(&self, sink_name: &str) -> OrganizationSinkDeleteCall<'a, C, A> { - OrganizationSinkDeleteCall { + pub fn sinks_patch(&self, request: LogSink, sink_name: &str) -> OrganizationSinkPatchCall<'a, C, A> { + OrganizationSinkPatchCall { hub: self.hub, + _request: request, _sink_name: sink_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. - /// - /// # Arguments - /// - /// * `logName` - Required. The resource name of the log to delete: - /// "projects/[PROJECT_ID]/logs/[LOG_ID]" - /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - /// "folders/[FOLDER_ID]/logs/[LOG_ID]" - /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. - pub fn logs_delete(&self, log_name: &str) -> OrganizationLogDeleteCall<'a, C, A> { - OrganizationLogDeleteCall { - hub: self.hub, - _log_name: log_name.to_string(), + _update_mask: Default::default(), + _unique_writer_identity: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1777,24 +1772,20 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. + /// Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `sinkName` - Required. The full resource name of the sink to update, including the parent resource and the sink identifier: - /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" - /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - /// "folders/[FOLDER_ID]/sinks/[SINK_ID]" - /// Example: "projects/my-project-id/sinks/my-sink-id". - pub fn sinks_patch(&self, request: LogSink, sink_name: &str) -> OrganizationSinkPatchCall<'a, C, A> { - OrganizationSinkPatchCall { + /// * `logName` - Required. The resource name of the log to delete: + /// "projects/[PROJECT_ID]/logs/[LOG_ID]" + /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" + /// "folders/[FOLDER_ID]/logs/[LOG_ID]" + /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. + pub fn logs_delete(&self, log_name: &str) -> OrganizationLogDeleteCall<'a, C, A> { + OrganizationLogDeleteCall { hub: self.hub, - _request: request, - _sink_name: sink_name.to_string(), - _update_mask: Default::default(), - _unique_writer_identity: Default::default(), + _log_name: log_name.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1803,7 +1794,7 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. + /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// # Arguments /// @@ -1943,6 +1934,28 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + /// "folders/[FOLDER_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_delete(&self, sink_name: &str) -> OrganizationSinkDeleteCall<'a, C, A> { + OrganizationSinkDeleteCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. @@ -2056,7 +2069,7 @@ impl<'a, C, A> SinkMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. + /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// # Arguments /// @@ -2246,7 +2259,7 @@ impl<'a, C, A> EntryMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists log entries. Use this method to retrieve log entries from Logging. For ways to export log entries, see Exporting Logs. + /// Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs. /// /// # Arguments /// @@ -2328,28 +2341,6 @@ impl<'a, C, A> BillingAccountMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Deletes an exclusion. - /// - /// # Arguments - /// - /// * `name` - Required. The resource name of an existing exclusion to delete: - /// "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - /// "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - /// "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - /// Example: "projects/my-project-id/exclusions/my-exclusion-id". - pub fn exclusions_delete(&self, name: &str) -> BillingAccountExclusionDeleteCall<'a, C, A> { - BillingAccountExclusionDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Changes one or more properties of an existing exclusion. @@ -2399,6 +2390,28 @@ impl<'a, C, A> BillingAccountMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes an exclusion. + /// + /// # Arguments + /// + /// * `name` - Required. The resource name of an existing exclusion to delete: + /// "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + /// "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + /// "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + /// "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + /// Example: "projects/my-project-id/exclusions/my-exclusion-id". + pub fn exclusions_delete(&self, name: &str) -> BillingAccountExclusionDeleteCall<'a, C, A> { + BillingAccountExclusionDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Lists all the exclusions in a parent resource. @@ -2425,7 +2438,7 @@ impl<'a, C, A> BillingAccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. + /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// # Arguments /// @@ -2521,7 +2534,7 @@ impl<'a, C, A> BillingAccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. + /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// # Arguments /// @@ -2838,7 +2851,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. + /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// # Arguments /// @@ -2883,7 +2896,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. + /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// # Arguments /// @@ -3318,6 +3331,283 @@ impl<'a, C, A> LogMethods<'a, C, A> { // CallBuilders ### // ################# +/// Lists sinks. +/// +/// A builder for the *sinks.list* method supported by a *folder* resource. +/// It is not used directly, but through a `FolderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2 as logging2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.folders().sinks_list("parent") +/// .page_token("amet.") +/// .page_size(-81) +/// .doit(); +/// # } +/// ``` +pub struct FolderSinkListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FolderSinkListCall<'a, C, A> {} + +impl<'a, C, A> FolderSinkListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListSinksResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.folders.sinks.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+parent}/sinks"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The parent resource whose sinks are to be listed: + /// "projects/[PROJECT_ID]" + /// "organizations/[ORGANIZATION_ID]" + /// "billingAccounts/[BILLING_ACCOUNT_ID]" + /// "folders/[FOLDER_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> FolderSinkListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FolderSinkListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> FolderSinkListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderSinkListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> FolderSinkListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> FolderSinkListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Changes one or more properties of an existing exclusion. /// /// A builder for the *exclusions.patch* method supported by a *folder* resource. @@ -3352,7 +3642,7 @@ impl<'a, C, A> LogMethods<'a, C, A> { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.folders().exclusions_patch(req, "name") -/// .update_mask("amet.") +/// .update_mask("sea") /// .doit(); /// # } /// ``` @@ -3416,7 +3706,7 @@ impl<'a, C, A> FolderExclusionPatchCall<'a, C, A> where C: BorrowMut FolderExclusionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3467,7 +3754,7 @@ impl<'a, C, A> FolderExclusionPatchCall<'a, C, A> where C: BorrowMut FolderExclusionPatchCall<'a, C, A> where C: BorrowMut FolderExclusionPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> FolderExclusionPatchCall<'a, C, A> @@ -3617,7 +3904,7 @@ impl<'a, C, A> FolderExclusionPatchCall<'a, C, A> where C: BorrowMut FolderExclusionPatchCall<'a, C, A> where C: BorrowMut FolderSinkUpdateCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3736,10 +4023,7 @@ impl<'a, C, A> FolderSinkUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3771,7 +4055,7 @@ impl<'a, C, A> FolderSinkUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3883,7 +4167,7 @@ impl<'a, C, A> FolderSinkUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3891,12 +4175,12 @@ impl<'a, C, A> FolderSinkUpdateCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> FolderSinkUpdateCall<'a, C, A> @@ -4017,7 +4301,7 @@ impl<'a, C, A> FolderSinkGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4033,10 +4317,7 @@ impl<'a, C, A> FolderSinkGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4056,7 +4337,7 @@ impl<'a, C, A> FolderSinkGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4139,7 +4420,7 @@ impl<'a, C, A> FolderSinkGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4147,12 +4428,12 @@ impl<'a, C, A> FolderSinkGetCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> FolderSinkGetCall<'a, C, A> @@ -4273,7 +4554,7 @@ impl<'a, C, A> FolderExclusionGetCall<'a, C, A> where C: BorrowMut FolderExclusionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4312,7 +4590,7 @@ impl<'a, C, A> FolderExclusionGetCall<'a, C, A> where C: BorrowMut FolderExclusionGetCall<'a, C, A> where C: BorrowMut FolderExclusionGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> FolderExclusionGetCall<'a, C, A> @@ -4471,8 +4749,8 @@ impl<'a, C, A> FolderExclusionGetCall<'a, C, A> where C: BorrowMut FolderExclusionListCall<'a, C, A> where C: BorrowMut FolderExclusionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4578,7 +4853,7 @@ impl<'a, C, A> FolderExclusionListCall<'a, C, A> where C: BorrowMut FolderExclusionListCall<'a, C, A> where C: BorrowMut FolderExclusionListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> FolderExclusionListCall<'a, C, A> @@ -4757,7 +5032,7 @@ impl<'a, C, A> FolderExclusionListCall<'a, C, A> where C: BorrowMut FolderSinkCreateCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4837,10 +5112,7 @@ impl<'a, C, A> FolderSinkCreateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4872,7 +5144,7 @@ impl<'a, C, A> FolderSinkCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4974,7 +5246,7 @@ impl<'a, C, A> FolderSinkCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4982,12 +5254,12 @@ impl<'a, C, A> FolderSinkCreateCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> FolderSinkCreateCall<'a, C, A> @@ -5115,7 +5387,7 @@ impl<'a, C, A> FolderExclusionCreateCall<'a, C, A> where C: BorrowMut FolderExclusionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5166,7 +5435,7 @@ impl<'a, C, A> FolderExclusionCreateCall<'a, C, A> where C: BorrowMut FolderExclusionCreateCall<'a, C, A> where C: BorrowMut FolderExclusionCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> FolderExclusionCreateCall<'a, C, A> @@ -5395,7 +5664,7 @@ impl<'a, C, A> FolderSinkDeleteCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5411,10 +5680,7 @@ impl<'a, C, A> FolderSinkDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5434,7 +5700,7 @@ impl<'a, C, A> FolderSinkDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5517,7 +5783,7 @@ impl<'a, C, A> FolderSinkDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5525,12 +5791,12 @@ impl<'a, C, A> FolderSinkDeleteCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> FolderSinkDeleteCall<'a, C, A> @@ -5593,8 +5859,8 @@ impl<'a, C, A> FolderSinkDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.folders().logs_list("parent") -/// .page_token("et") -/// .page_size(-41) +/// .page_token("Lorem") +/// .page_size(-21) /// .doit(); /// # } /// ``` @@ -5661,7 +5927,7 @@ impl<'a, C, A> FolderLogListCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5677,10 +5943,7 @@ impl<'a, C, A> FolderLogListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5700,7 +5963,7 @@ impl<'a, C, A> FolderLogListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5797,7 +6060,7 @@ impl<'a, C, A> FolderLogListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5805,12 +6068,12 @@ impl<'a, C, A> FolderLogListCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> FolderLogListCall<'a, C, A> @@ -5845,287 +6108,7 @@ impl<'a, C, A> FolderLogListCall<'a, C, A> where C: BorrowMut, A: } -/// Lists sinks. -/// -/// A builder for the *sinks.list* method supported by a *folder* resource. -/// It is not used directly, but through a `FolderMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2 as logging2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.folders().sinks_list("parent") -/// .page_token("Lorem") -/// .page_size(-21) -/// .doit(); -/// # } -/// ``` -pub struct FolderSinkListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for FolderSinkListCall<'a, C, A> {} - -impl<'a, C, A> FolderSinkListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListSinksResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.folders.sinks.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2/{+parent}/sinks"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The parent resource whose sinks are to be listed: - /// "projects/[PROJECT_ID]" - /// "organizations/[ORGANIZATION_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]" - /// "folders/[FOLDER_ID]" - /// - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> FolderSinkListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> FolderSinkListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> FolderSinkListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> FolderSinkListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> FolderSinkListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> FolderSinkListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. +/// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// A builder for the *sinks.patch* method supported by a *folder* resource. /// It is not used directly, but through a `FolderMethods` instance. @@ -6228,7 +6211,7 @@ impl<'a, C, A> FolderSinkPatchCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6244,10 +6227,7 @@ impl<'a, C, A> FolderSinkPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6279,7 +6259,7 @@ impl<'a, C, A> FolderSinkPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6391,7 +6371,7 @@ impl<'a, C, A> FolderSinkPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6399,12 +6379,12 @@ impl<'a, C, A> FolderSinkPatchCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> FolderSinkPatchCall<'a, C, A> @@ -6525,7 +6505,7 @@ impl<'a, C, A> FolderLogDeleteCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6541,10 +6521,7 @@ impl<'a, C, A> FolderLogDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6564,7 +6541,7 @@ impl<'a, C, A> FolderLogDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6647,7 +6624,7 @@ impl<'a, C, A> FolderLogDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6655,12 +6632,12 @@ impl<'a, C, A> FolderLogDeleteCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> FolderLogDeleteCall<'a, C, A> @@ -6781,7 +6758,7 @@ impl<'a, C, A> FolderExclusionDeleteCall<'a, C, A> where C: BorrowMut FolderExclusionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6820,7 +6794,7 @@ impl<'a, C, A> FolderExclusionDeleteCall<'a, C, A> where C: BorrowMut FolderExclusionDeleteCall<'a, C, A> where C: BorrowMut FolderExclusionDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> FolderExclusionDeleteCall<'a, C, A> @@ -6951,9 +6925,9 @@ impl<'a, C, A> FolderExclusionDeleteCall<'a, C, A> where C: BorrowMut FolderExclusionDeleteCall<'a, C, A> where C: BorrowMut FolderExclusionDeleteCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogSink::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.organizations().sinks_delete("sinkName") +/// let result = hub.organizations().sinks_patch(req, "sinkName") +/// .update_mask("sadipscing") +/// .unique_writer_identity(true) /// .doit(); /// # } /// ``` -pub struct OrganizationSinkDeleteCall<'a, C, A> +pub struct OrganizationSinkPatchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Logging, + _request: LogSink, _sink_name: String, + _update_mask: Option, + _unique_writer_identity: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OrganizationSinkDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for OrganizationSinkPatchCall<'a, C, A> {} -impl<'a, C, A> OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -7007,11 +6992,17 @@ impl<'a, C, A> OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.organizations.sinks.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "logging.organizations.sinks.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); params.push(("sinkName", self._sink_name.to_string())); - for &field in ["alt", "sinkName"].iter() { + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + if let Some(value) = self._unique_writer_identity { + params.push(("uniqueWriterIdentity", value.to_string())); + } + for &field in ["alt", "sinkName", "updateMask", "uniqueWriterIdentity"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -7037,7 +7028,7 @@ impl<'a, C, A> OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -7074,11 +7073,15 @@ impl<'a, C, A> OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut OrganizationSinkPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The full resource name of the sink to update, including the parent resource and the sink identifier: /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" @@ -7140,17 +7152,34 @@ impl<'a, C, A> OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut OrganizationSinkDeleteCall<'a, C, A> { + pub fn sink_name(mut self, new_value: &str) -> OrganizationSinkPatchCall<'a, C, A> { self._sink_name = new_value.to_string(); self } + /// Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> OrganizationSinkPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field: + /// If the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity. + /// If the old value is false and the new value is true, then writer_identity is changed to a unique service account. + /// It is an error if the old value is true and the new value is set to false or defaulted to false. + /// + /// Sets the *unique writer identity* query property to the given value. + pub fn unique_writer_identity(mut self, new_value: bool) -> OrganizationSinkPatchCall<'a, C, A> { + self._unique_writer_identity = Some(new_value); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSinkDeleteCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSinkPatchCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -7159,7 +7188,7 @@ impl<'a, C, A> OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationSinkDeleteCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> OrganizationSinkPatchCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -7195,263 +7224,7 @@ impl<'a, C, A> OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrganizationSinkDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. -/// -/// A builder for the *logs.delete* method supported by a *organization* resource. -/// It is not used directly, but through a `OrganizationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2 as logging2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.organizations().logs_delete("logName") -/// .doit(); -/// # } -/// ``` -pub struct OrganizationLogDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _log_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OrganizationLogDeleteCall<'a, C, A> {} - -impl<'a, C, A> OrganizationLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.organizations.logs.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("logName", self._log_name.to_string())); - for &field in ["alt", "logName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2/{+logName}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+logName}", "logName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["logName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name of the log to delete: - /// "projects/[PROJECT_ID]/logs/[LOG_ID]" - /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - /// "folders/[FOLDER_ID]/logs/[LOG_ID]" - /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. - /// - /// Sets the *log name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn log_name(mut self, new_value: &str) -> OrganizationLogDeleteCall<'a, C, A> { - self._log_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationLogDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> OrganizationLogDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> OrganizationLogDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrganizationSinkPatchCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -7497,7 +7270,7 @@ impl<'a, C, A> OrganizationLogDeleteCall<'a, C, A> where C: BorrowMut OrganizationExclusionPatchCall<'a, C, A> where C: BorrowMut OrganizationExclusionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7612,7 +7382,7 @@ impl<'a, C, A> OrganizationExclusionPatchCall<'a, C, A> where C: BorrowMut OrganizationExclusionPatchCall<'a, C, A> where C: BorrowMut OrganizationExclusionPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationExclusionPatchCall<'a, C, A> @@ -7848,7 +7618,7 @@ impl<'a, C, A> OrganizationExclusionDeleteCall<'a, C, A> where C: BorrowMut OrganizationExclusionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7887,7 +7654,7 @@ impl<'a, C, A> OrganizationExclusionDeleteCall<'a, C, A> where C: BorrowMut OrganizationExclusionDeleteCall<'a, C, A> where C: BorrowMut OrganizationExclusionDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationExclusionDeleteCall<'a, C, A> @@ -8046,8 +7813,8 @@ impl<'a, C, A> OrganizationExclusionDeleteCall<'a, C, A> where C: BorrowMut OrganizationLogListCall<'a, C, A> where C: BorrowMut OrganizationLogListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8153,7 +7917,7 @@ impl<'a, C, A> OrganizationLogListCall<'a, C, A> where C: BorrowMut OrganizationLogListCall<'a, C, A> where C: BorrowMut OrganizationLogListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationLogListCall<'a, C, A> @@ -8298,9 +8062,9 @@ impl<'a, C, A> OrganizationLogListCall<'a, C, A> where C: BorrowMut OrganizationLogListCall<'a, C, A> where C: BorrowMut OrganizationLogListCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = LogSink::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.organizations().sinks_patch(req, "sinkName") -/// .update_mask("dolore") -/// .unique_writer_identity(true) +/// let result = hub.organizations().logs_delete("logName") /// .doit(); /// # } /// ``` -pub struct OrganizationSinkPatchCall<'a, C, A> +pub struct OrganizationLogDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Logging, - _request: LogSink, - _sink_name: String, - _update_mask: Option, - _unique_writer_identity: Option, + _log_name: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OrganizationSinkPatchCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for OrganizationLogDeleteCall<'a, C, A> {} -impl<'a, C, A> OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> OrganizationLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -8365,17 +8118,11 @@ impl<'a, C, A> OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.organizations.sinks.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); - params.push(("sinkName", self._sink_name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - if let Some(value) = self._unique_writer_identity { - params.push(("uniqueWriterIdentity", value.to_string())); - } - for &field in ["alt", "sinkName", "updateMask", "uniqueWriterIdentity"].iter() { + dlg.begin(MethodInfo { id: "logging.organizations.logs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("logName", self._log_name.to_string())); + for &field in ["alt", "logName"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -8387,12 +8134,12 @@ impl<'a, C, A> OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["sinkName"].iter() { + for param_name in ["logName"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -8417,22 +8164,8 @@ impl<'a, C, A> OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -8449,15 +8182,11 @@ impl<'a, C, A> OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut OrganizationSinkPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The full resource name of the sink to update, including the parent resource and the sink identifier: - /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" - /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - /// "folders/[FOLDER_ID]/sinks/[SINK_ID]" - /// Example: "projects/my-project-id/sinks/my-sink-id". - /// - /// Sets the *sink name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn sink_name(mut self, new_value: &str) -> OrganizationSinkPatchCall<'a, C, A> { - self._sink_name = new_value.to_string(); - self - } - /// Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> OrganizationSinkPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field: - /// If the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity. - /// If the old value is false and the new value is true, then writer_identity is changed to a unique service account. - /// It is an error if the old value is true and the new value is set to false or defaulted to false. - /// - /// Sets the *unique writer identity* query property to the given value. - pub fn unique_writer_identity(mut self, new_value: bool) -> OrganizationSinkPatchCall<'a, C, A> { - self._unique_writer_identity = Some(new_value); + pub fn log_name(mut self, new_value: &str) -> OrganizationLogDeleteCall<'a, C, A> { + self._log_name = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -8555,7 +8258,7 @@ impl<'a, C, A> OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut OrganizationSinkPatchCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationLogDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -8564,7 +8267,7 @@ impl<'a, C, A> OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationSinkPatchCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> OrganizationLogDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -8600,7 +8303,7 @@ impl<'a, C, A> OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrganizationSinkPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrganizationLogDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -8612,7 +8315,7 @@ impl<'a, C, A> OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut OrganizationSinkPatchCall<'a, C, A> where C: BorrowMut OrganizationSinkUpdateCall<'a, C, A> where C: BorrowMut OrganizationSinkUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8766,7 +8466,7 @@ impl<'a, C, A> OrganizationSinkUpdateCall<'a, C, A> where C: BorrowMut OrganizationSinkUpdateCall<'a, C, A> where C: BorrowMut OrganizationSinkUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationSinkUpdateCall<'a, C, A> @@ -9012,7 +8712,7 @@ impl<'a, C, A> OrganizationSinkGetCall<'a, C, A> where C: BorrowMut OrganizationSinkGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9051,7 +8748,7 @@ impl<'a, C, A> OrganizationSinkGetCall<'a, C, A> where C: BorrowMut OrganizationSinkGetCall<'a, C, A> where C: BorrowMut OrganizationSinkGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationSinkGetCall<'a, C, A> @@ -9210,8 +8907,8 @@ impl<'a, C, A> OrganizationSinkGetCall<'a, C, A> where C: BorrowMut OrganizationExclusionListCall<'a, C, A> where C: BorrowMut OrganizationExclusionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9317,7 +9011,7 @@ impl<'a, C, A> OrganizationExclusionListCall<'a, C, A> where C: BorrowMut OrganizationExclusionListCall<'a, C, A> where C: BorrowMut OrganizationExclusionListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationExclusionListCall<'a, C, A> @@ -9548,7 +9242,7 @@ impl<'a, C, A> OrganizationExclusionGetCall<'a, C, A> where C: BorrowMut OrganizationExclusionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9587,7 +9278,7 @@ impl<'a, C, A> OrganizationExclusionGetCall<'a, C, A> where C: BorrowMut OrganizationExclusionGetCall<'a, C, A> where C: BorrowMut OrganizationExclusionGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationExclusionGetCall<'a, C, A> @@ -9811,7 +9502,7 @@ impl<'a, C, A> OrganizationExclusionCreateCall<'a, C, A> where C: BorrowMut OrganizationExclusionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9862,7 +9550,7 @@ impl<'a, C, A> OrganizationExclusionCreateCall<'a, C, A> where C: BorrowMut OrganizationExclusionCreateCall<'a, C, A> where C: BorrowMut OrganizationExclusionCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationExclusionCreateCall<'a, C, A> @@ -10033,8 +9721,8 @@ impl<'a, C, A> OrganizationExclusionCreateCall<'a, C, A> where C: BorrowMut OrganizationSinkListCall<'a, C, A> where C: BorrowMut OrganizationSinkListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10140,7 +9825,7 @@ impl<'a, C, A> OrganizationSinkListCall<'a, C, A> where C: BorrowMut OrganizationSinkListCall<'a, C, A> where C: BorrowMut OrganizationSinkListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationSinkListCall<'a, C, A> @@ -10285,6 +9970,259 @@ impl<'a, C, A> OrganizationSinkListCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sinks_delete("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSinkDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSinkDeleteCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSinkDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.organizations.sinks.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+sinkName}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + /// "folders/[FOLDER_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> OrganizationSinkDeleteCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSinkDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSinkDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSinkDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink. /// /// A builder for the *sinks.create* method supported by a *organization* resource. @@ -10383,7 +10321,7 @@ impl<'a, C, A> OrganizationSinkCreateCall<'a, C, A> where C: BorrowMut OrganizationSinkCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10434,7 +10369,7 @@ impl<'a, C, A> OrganizationSinkCreateCall<'a, C, A> where C: BorrowMut OrganizationSinkCreateCall<'a, C, A> where C: BorrowMut OrganizationSinkCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> OrganizationSinkCreateCall<'a, C, A> @@ -10670,7 +10605,7 @@ impl<'a, C, A> SinkGetCall<'a, C, A> where C: BorrowMut, A: oauth } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10686,10 +10621,7 @@ impl<'a, C, A> SinkGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10709,7 +10641,7 @@ impl<'a, C, A> SinkGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10792,7 +10724,7 @@ impl<'a, C, A> SinkGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10800,12 +10732,12 @@ impl<'a, C, A> SinkGetCall<'a, C, A> where C: BorrowMut, A: oauth /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SinkGetCall<'a, C, A> @@ -10926,7 +10858,7 @@ impl<'a, C, A> SinkDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10942,10 +10874,7 @@ impl<'a, C, A> SinkDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10965,7 +10894,7 @@ impl<'a, C, A> SinkDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11048,7 +10977,7 @@ impl<'a, C, A> SinkDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11056,12 +10985,12 @@ impl<'a, C, A> SinkDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SinkDeleteCall<'a, C, A> @@ -11096,7 +11025,7 @@ impl<'a, C, A> SinkDeleteCall<'a, C, A> where C: BorrowMut, A: oa } -/// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. +/// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// A builder for the *update* method supported by a *sink* resource. /// It is not used directly, but through a `SinkMethods` instance. @@ -11199,7 +11128,7 @@ impl<'a, C, A> SinkUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11215,10 +11144,7 @@ impl<'a, C, A> SinkUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11250,7 +11176,7 @@ impl<'a, C, A> SinkUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11362,7 +11288,7 @@ impl<'a, C, A> SinkUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11370,12 +11296,12 @@ impl<'a, C, A> SinkUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SinkUpdateCall<'a, C, A> @@ -11506,7 +11432,7 @@ impl<'a, C, A> SinkListCall<'a, C, A> where C: BorrowMut, A: oaut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11522,10 +11448,7 @@ impl<'a, C, A> SinkListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11545,7 +11468,7 @@ impl<'a, C, A> SinkListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11642,7 +11565,7 @@ impl<'a, C, A> SinkListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11650,12 +11573,12 @@ impl<'a, C, A> SinkListCall<'a, C, A> where C: BorrowMut, A: oaut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SinkListCall<'a, C, A> @@ -11788,7 +11711,7 @@ impl<'a, C, A> SinkCreateCall<'a, C, A> where C: BorrowMut, A: oa } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11804,10 +11727,7 @@ impl<'a, C, A> SinkCreateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11839,7 +11759,7 @@ impl<'a, C, A> SinkCreateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11941,7 +11861,7 @@ impl<'a, C, A> SinkCreateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11949,12 +11869,12 @@ impl<'a, C, A> SinkCreateCall<'a, C, A> where C: BorrowMut, A: oa /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SinkCreateCall<'a, C, A> @@ -12074,10 +11994,7 @@ impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut< } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12097,7 +12014,7 @@ impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12179,7 +12096,7 @@ impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12187,12 +12104,12 @@ impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> MonitoredResourceDescriptorListCall<'a, C, A> @@ -12309,10 +12226,7 @@ impl<'a, C, A> EntryWriteCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12344,7 +12258,7 @@ impl<'a, C, A> EntryWriteCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12424,7 +12338,7 @@ impl<'a, C, A> EntryWriteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12432,12 +12346,12 @@ impl<'a, C, A> EntryWriteCall<'a, C, A> where C: BorrowMut, A: oa /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> EntryWriteCall<'a, C, A> @@ -12472,7 +12386,7 @@ impl<'a, C, A> EntryWriteCall<'a, C, A> where C: BorrowMut, A: oa } -/// Lists log entries. Use this method to retrieve log entries from Logging. For ways to export log entries, see Exporting Logs. +/// Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs. /// /// A builder for the *list* method supported by a *entry* resource. /// It is not used directly, but through a `EntryMethods` instance. @@ -12554,10 +12468,7 @@ impl<'a, C, A> EntryListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12589,7 +12500,7 @@ impl<'a, C, A> EntryListCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12669,7 +12580,7 @@ impl<'a, C, A> EntryListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12677,12 +12588,12 @@ impl<'a, C, A> EntryListCall<'a, C, A> where C: BorrowMut, A: oau /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> EntryListCall<'a, C, A> @@ -12815,7 +12726,7 @@ impl<'a, C, A> BillingAccountSinkCreateCall<'a, C, A> where C: BorrowMut BillingAccountSinkCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12866,7 +12774,7 @@ impl<'a, C, A> BillingAccountSinkCreateCall<'a, C, A> where C: BorrowMut BillingAccountSinkCreateCall<'a, C, A> where C: BorrowMut BillingAccountSinkCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountSinkCreateCall<'a, C, A> @@ -13016,262 +12924,6 @@ impl<'a, C, A> BillingAccountSinkCreateCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.billing_accounts().exclusions_delete("name") -/// .doit(); -/// # } -/// ``` -pub struct BillingAccountExclusionDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for BillingAccountExclusionDeleteCall<'a, C, A> {} - -impl<'a, C, A> BillingAccountExclusionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.billingAccounts.exclusions.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name of an existing exclusion to delete: - /// "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - /// "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - /// "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - /// Example: "projects/my-project-id/exclusions/my-exclusion-id". - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> BillingAccountExclusionDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountExclusionDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> BillingAccountExclusionDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> BillingAccountExclusionDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Changes one or more properties of an existing exclusion. /// /// A builder for the *exclusions.patch* method supported by a *billingAccount* resource. @@ -13306,7 +12958,7 @@ impl<'a, C, A> BillingAccountExclusionDeleteCall<'a, C, A> where C: BorrowMut BillingAccountExclusionPatchCall<'a, C, A> where C: BorrowMut BillingAccountExclusionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13421,7 +13070,7 @@ impl<'a, C, A> BillingAccountExclusionPatchCall<'a, C, A> where C: BorrowMut BillingAccountExclusionPatchCall<'a, C, A> where C: BorrowMut BillingAccountExclusionPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountExclusionPatchCall<'a, C, A> @@ -13599,8 +13248,8 @@ impl<'a, C, A> BillingAccountExclusionPatchCall<'a, C, A> where C: BorrowMut BillingAccountLogListCall<'a, C, A> where C: BorrowMut BillingAccountLogListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13706,7 +13352,7 @@ impl<'a, C, A> BillingAccountLogListCall<'a, C, A> where C: BorrowMut BillingAccountLogListCall<'a, C, A> where C: BorrowMut BillingAccountLogListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountLogListCall<'a, C, A> @@ -13851,6 +13497,259 @@ impl<'a, C, A> BillingAccountLogListCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.billing_accounts().exclusions_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct BillingAccountExclusionDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BillingAccountExclusionDeleteCall<'a, C, A> {} + +impl<'a, C, A> BillingAccountExclusionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.billingAccounts.exclusions.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of an existing exclusion to delete: + /// "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + /// "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + /// "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + /// "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + /// Example: "projects/my-project-id/exclusions/my-exclusion-id". + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> BillingAccountExclusionDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountExclusionDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BillingAccountExclusionDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BillingAccountExclusionDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Lists all the exclusions in a parent resource. /// /// A builder for the *exclusions.list* method supported by a *billingAccount* resource. @@ -13947,7 +13846,7 @@ impl<'a, C, A> BillingAccountExclusionListCall<'a, C, A> where C: BorrowMut BillingAccountExclusionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13986,7 +13882,7 @@ impl<'a, C, A> BillingAccountExclusionListCall<'a, C, A> where C: BorrowMut BillingAccountExclusionListCall<'a, C, A> where C: BorrowMut BillingAccountExclusionListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountExclusionListCall<'a, C, A> @@ -14131,7 +14027,7 @@ impl<'a, C, A> BillingAccountExclusionListCall<'a, C, A> where C: BorrowMut BillingAccountSinkPatchCall<'a, C, A> where C: BorrowMut BillingAccountSinkPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14285,7 +14178,7 @@ impl<'a, C, A> BillingAccountSinkPatchCall<'a, C, A> where C: BorrowMut BillingAccountSinkPatchCall<'a, C, A> where C: BorrowMut BillingAccountSinkPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountSinkPatchCall<'a, C, A> @@ -14541,7 +14434,7 @@ impl<'a, C, A> BillingAccountSinkListCall<'a, C, A> where C: BorrowMut BillingAccountSinkListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14580,7 +14470,7 @@ impl<'a, C, A> BillingAccountSinkListCall<'a, C, A> where C: BorrowMut BillingAccountSinkListCall<'a, C, A> where C: BorrowMut BillingAccountSinkListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountSinkListCall<'a, C, A> @@ -14818,7 +14708,7 @@ impl<'a, C, A> BillingAccountExclusionCreateCall<'a, C, A> where C: BorrowMut BillingAccountExclusionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14869,7 +14756,7 @@ impl<'a, C, A> BillingAccountExclusionCreateCall<'a, C, A> where C: BorrowMut BillingAccountExclusionCreateCall<'a, C, A> where C: BorrowMut BillingAccountExclusionCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountExclusionCreateCall<'a, C, A> @@ -15098,7 +14985,7 @@ impl<'a, C, A> BillingAccountSinkDeleteCall<'a, C, A> where C: BorrowMut BillingAccountSinkDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15137,7 +15021,7 @@ impl<'a, C, A> BillingAccountSinkDeleteCall<'a, C, A> where C: BorrowMut BillingAccountSinkDeleteCall<'a, C, A> where C: BorrowMut BillingAccountSinkDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountSinkDeleteCall<'a, C, A> @@ -15268,7 +15152,7 @@ impl<'a, C, A> BillingAccountSinkDeleteCall<'a, C, A> where C: BorrowMut BillingAccountSinkUpdateCall<'a, C, A> where C: BorrowMut BillingAccountSinkUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15422,7 +15303,7 @@ impl<'a, C, A> BillingAccountSinkUpdateCall<'a, C, A> where C: BorrowMut BillingAccountSinkUpdateCall<'a, C, A> where C: BorrowMut BillingAccountSinkUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountSinkUpdateCall<'a, C, A> @@ -15668,7 +15549,7 @@ impl<'a, C, A> BillingAccountSinkGetCall<'a, C, A> where C: BorrowMut BillingAccountSinkGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15707,7 +15585,7 @@ impl<'a, C, A> BillingAccountSinkGetCall<'a, C, A> where C: BorrowMut BillingAccountSinkGetCall<'a, C, A> where C: BorrowMut BillingAccountSinkGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountSinkGetCall<'a, C, A> @@ -15924,7 +15802,7 @@ impl<'a, C, A> BillingAccountExclusionGetCall<'a, C, A> where C: BorrowMut BillingAccountExclusionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15963,7 +15838,7 @@ impl<'a, C, A> BillingAccountExclusionGetCall<'a, C, A> where C: BorrowMut BillingAccountExclusionGetCall<'a, C, A> where C: BorrowMut BillingAccountExclusionGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountExclusionGetCall<'a, C, A> @@ -16180,7 +16055,7 @@ impl<'a, C, A> BillingAccountLogDeleteCall<'a, C, A> where C: BorrowMut BillingAccountLogDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16219,7 +16091,7 @@ impl<'a, C, A> BillingAccountLogDeleteCall<'a, C, A> where C: BorrowMut BillingAccountLogDeleteCall<'a, C, A> where C: BorrowMut BillingAccountLogDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BillingAccountLogDeleteCall<'a, C, A> @@ -16448,7 +16320,7 @@ impl<'a, C, A> ExclusionPatchCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -16464,10 +16336,7 @@ impl<'a, C, A> ExclusionPatchCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16499,7 +16368,7 @@ impl<'a, C, A> ExclusionPatchCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16601,7 +16470,7 @@ impl<'a, C, A> ExclusionPatchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16609,12 +16478,12 @@ impl<'a, C, A> ExclusionPatchCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ExclusionPatchCall<'a, C, A> @@ -16742,7 +16611,7 @@ impl<'a, C, A> ExclusionCreateCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -16758,10 +16627,7 @@ impl<'a, C, A> ExclusionCreateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16793,7 +16659,7 @@ impl<'a, C, A> ExclusionCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16888,7 +16754,7 @@ impl<'a, C, A> ExclusionCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16896,12 +16762,12 @@ impl<'a, C, A> ExclusionCreateCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ExclusionCreateCall<'a, C, A> @@ -17032,7 +16898,7 @@ impl<'a, C, A> ExclusionListCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -17048,10 +16914,7 @@ impl<'a, C, A> ExclusionListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17071,7 +16934,7 @@ impl<'a, C, A> ExclusionListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17168,7 +17031,7 @@ impl<'a, C, A> ExclusionListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17176,12 +17039,12 @@ impl<'a, C, A> ExclusionListCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ExclusionListCall<'a, C, A> @@ -17302,7 +17165,7 @@ impl<'a, C, A> ExclusionGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -17318,10 +17181,7 @@ impl<'a, C, A> ExclusionGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17341,7 +17201,7 @@ impl<'a, C, A> ExclusionGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17424,7 +17284,7 @@ impl<'a, C, A> ExclusionGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17432,12 +17292,12 @@ impl<'a, C, A> ExclusionGetCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ExclusionGetCall<'a, C, A> @@ -17558,7 +17418,7 @@ impl<'a, C, A> ExclusionDeleteCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -17574,10 +17434,7 @@ impl<'a, C, A> ExclusionDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17597,7 +17454,7 @@ impl<'a, C, A> ExclusionDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17680,7 +17537,7 @@ impl<'a, C, A> ExclusionDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17688,12 +17545,12 @@ impl<'a, C, A> ExclusionDeleteCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ExclusionDeleteCall<'a, C, A> @@ -17824,7 +17681,7 @@ impl<'a, C, A> ProjectExclusionListCall<'a, C, A> where C: BorrowMut ProjectExclusionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17863,7 +17717,7 @@ impl<'a, C, A> ProjectExclusionListCall<'a, C, A> where C: BorrowMut ProjectExclusionListCall<'a, C, A> where C: BorrowMut ProjectExclusionListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectExclusionListCall<'a, C, A> @@ -18008,7 +17862,7 @@ impl<'a, C, A> ProjectExclusionListCall<'a, C, A> where C: BorrowMut ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -18127,10 +17981,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18162,7 +18013,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18274,7 +18125,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18282,12 +18133,12 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectSinkUpdateCall<'a, C, A> @@ -18408,7 +18259,7 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -18424,10 +18275,7 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18447,7 +18295,7 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18527,7 +18375,7 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18535,12 +18383,12 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectMetricGetCall<'a, C, A> @@ -18575,7 +18423,7 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, } -/// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. +/// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// A builder for the *sinks.patch* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -18678,7 +18526,7 @@ impl<'a, C, A> ProjectSinkPatchCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -18694,10 +18542,7 @@ impl<'a, C, A> ProjectSinkPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18729,7 +18574,7 @@ impl<'a, C, A> ProjectSinkPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18841,7 +18686,7 @@ impl<'a, C, A> ProjectSinkPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18849,12 +18694,12 @@ impl<'a, C, A> ProjectSinkPatchCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectSinkPatchCall<'a, C, A> @@ -18985,7 +18830,7 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -19001,10 +18846,7 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19024,7 +18866,7 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19121,7 +18963,7 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19129,12 +18971,12 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLogListCall<'a, C, A> @@ -19255,7 +19097,7 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -19271,10 +19113,7 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19294,7 +19133,7 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19377,7 +19216,7 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19385,12 +19224,12 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectLogDeleteCall<'a, C, A> @@ -19521,7 +19360,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -19537,10 +19376,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19560,7 +19396,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19657,7 +19493,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19665,12 +19501,12 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectSinkListCall<'a, C, A> @@ -19791,7 +19627,7 @@ impl<'a, C, A> ProjectExclusionDeleteCall<'a, C, A> where C: BorrowMut ProjectExclusionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19830,7 +19663,7 @@ impl<'a, C, A> ProjectExclusionDeleteCall<'a, C, A> where C: BorrowMut ProjectExclusionDeleteCall<'a, C, A> where C: BorrowMut ProjectExclusionDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectExclusionDeleteCall<'a, C, A> @@ -20047,7 +19880,7 @@ impl<'a, C, A> ProjectExclusionGetCall<'a, C, A> where C: BorrowMut ProjectExclusionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20086,7 +19916,7 @@ impl<'a, C, A> ProjectExclusionGetCall<'a, C, A> where C: BorrowMut ProjectExclusionGetCall<'a, C, A> where C: BorrowMut ProjectExclusionGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectExclusionGetCall<'a, C, A> @@ -20303,7 +20133,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -20319,10 +20149,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20342,7 +20169,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20425,7 +20252,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20433,12 +20260,12 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectSinkGetCall<'a, C, A> @@ -20559,7 +20386,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -20575,10 +20402,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20598,7 +20422,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20681,7 +20505,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20689,12 +20513,12 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectSinkDeleteCall<'a, C, A> @@ -20822,7 +20646,7 @@ impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut ProjectMetricCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20873,7 +20694,7 @@ impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut ProjectMetricCreateCall<'a, C, A> where C: BorrowMut ProjectMetricCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectMetricCreateCall<'a, C, A> @@ -21111,7 +20932,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -21127,10 +20948,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21162,7 +20980,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21264,7 +21082,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21272,12 +21090,12 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectSinkCreateCall<'a, C, A> @@ -21405,7 +21223,7 @@ impl<'a, C, A> ProjectExclusionCreateCall<'a, C, A> where C: BorrowMut ProjectExclusionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21456,7 +21271,7 @@ impl<'a, C, A> ProjectExclusionCreateCall<'a, C, A> where C: BorrowMut ProjectExclusionCreateCall<'a, C, A> where C: BorrowMut ProjectExclusionCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectExclusionCreateCall<'a, C, A> @@ -21697,7 +21512,7 @@ impl<'a, C, A> ProjectExclusionPatchCall<'a, C, A> where C: BorrowMut ProjectExclusionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21748,7 +21560,7 @@ impl<'a, C, A> ProjectExclusionPatchCall<'a, C, A> where C: BorrowMut ProjectExclusionPatchCall<'a, C, A> where C: BorrowMut ProjectExclusionPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectExclusionPatchCall<'a, C, A> @@ -21991,7 +21803,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22042,7 +21851,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectMetricUpdateCall<'a, C, A> @@ -22268,7 +22077,7 @@ impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22307,7 +22113,7 @@ impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectMetricDeleteCall<'a, C, A> @@ -22531,7 +22337,7 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -22547,10 +22353,7 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22570,7 +22373,7 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22664,7 +22467,7 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22672,12 +22475,12 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectMetricListCall<'a, C, A> @@ -22798,7 +22601,7 @@ impl<'a, C, A> LogDeleteCall<'a, C, A> where C: BorrowMut, A: oau } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -22814,10 +22617,7 @@ impl<'a, C, A> LogDeleteCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22837,7 +22637,7 @@ impl<'a, C, A> LogDeleteCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22920,7 +22720,7 @@ impl<'a, C, A> LogDeleteCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -22928,12 +22728,12 @@ impl<'a, C, A> LogDeleteCall<'a, C, A> where C: BorrowMut, A: oau /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> LogDeleteCall<'a, C, A> @@ -23064,7 +22864,7 @@ impl<'a, C, A> LogListCall<'a, C, A> where C: BorrowMut, A: oauth } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -23080,10 +22880,7 @@ impl<'a, C, A> LogListCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23103,7 +22900,7 @@ impl<'a, C, A> LogListCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23200,7 +22997,7 @@ impl<'a, C, A> LogListCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23208,12 +23005,12 @@ impl<'a, C, A> LogListCall<'a, C, A> where C: BorrowMut, A: oauth /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> LogListCall<'a, C, A> diff --git a/gen/logging2_beta1-cli/Cargo.toml b/gen/logging2_beta1-cli/Cargo.toml index b97b98b214..a11993ac92 100644 --- a/gen/logging2_beta1-cli/Cargo.toml +++ b/gen/logging2_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-logging2_beta1-cli" -version = "1.0.8+20180929" +version = "1.0.8+20190325" authors = ["Sebastian Thiel "] description = "A complete library to interact with Logging (protocol v2beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-logging2_beta1] path = "../logging2_beta1" -version = "1.0.8+20180929" +version = "1.0.8+20190325" diff --git a/gen/logging2_beta1-cli/README.md b/gen/logging2_beta1-cli/README.md index 3a606a2094..492c41e20f 100644 --- a/gen/logging2_beta1-cli/README.md +++ b/gen/logging2_beta1-cli/README.md @@ -25,24 +25,16 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Logging* API at revision *20180929*. The CLI is at version *1.0.8*. +This documentation was generated from the *Logging* API at revision *20190325*. The CLI is at version *1.0.8*. ```bash logging2-beta1 [options] - billing-accounts - logs-delete [-p ]... [-o ] - logs-list [-p ]... [-o ] entries list (-r )... [-p ]... [-o ] write (-r )... [-p ]... [-o ] monitored-resource-descriptors list [-p ]... [-o ] - organizations - logs-delete [-p ]... [-o ] - logs-list [-p ]... [-o ] projects - logs-delete [-p ]... [-o ] - logs-list [-p ]... [-o ] metrics-create (-r )... [-p ]... [-o ] metrics-delete [-p ]... [-o ] metrics-get [-p ]... [-o ] diff --git a/gen/logging2_beta1-cli/mkdocs.yml b/gen/logging2_beta1-cli/mkdocs.yml index debf1aeba3..51ac1b95a0 100644 --- a/gen/logging2_beta1-cli/mkdocs.yml +++ b/gen/logging2_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Logging v1.0.8+20180929 +site_name: Logging v1.0.8+20190325 site_url: http://byron.github.io/google-apis-rs/google-logging2_beta1-cli site_description: A complete library to interact with Logging (protocol v2beta1) @@ -9,15 +9,9 @@ site_dir: build_html pages: - ['index.md', 'Home'] -- ['billing-accounts_logs-delete.md', 'Billing Accounts', 'Logs Delete'] -- ['billing-accounts_logs-list.md', 'Billing Accounts', 'Logs List'] - ['entries_list.md', 'Entries', 'List'] - ['entries_write.md', 'Entries', 'Write'] - ['monitored-resource-descriptors_list.md', 'Monitored Resource Descriptors', 'List'] -- ['organizations_logs-delete.md', 'Organizations', 'Logs Delete'] -- ['organizations_logs-list.md', 'Organizations', 'Logs List'] -- ['projects_logs-delete.md', 'Projects', 'Logs Delete'] -- ['projects_logs-list.md', 'Projects', 'Logs List'] - ['projects_metrics-create.md', 'Projects', 'Metrics Create'] - ['projects_metrics-delete.md', 'Projects', 'Metrics Delete'] - ['projects_metrics-get.md', 'Projects', 'Metrics Get'] diff --git a/gen/logging2_beta1-cli/src/main.rs b/gen/logging2_beta1-cli/src/main.rs index 5beaab845f..0e3d98dad0 100644 --- a/gen/logging2_beta1-cli/src/main.rs +++ b/gen/logging2_beta1-cli/src/main.rs @@ -46,117 +46,6 @@ struct Engine<'n> { impl<'n> Engine<'n> { - fn _billing_accounts_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.billing_accounts().logs_delete(opt.value_of("log-name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _billing_accounts_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.billing_accounts().logs_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _entries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -396,228 +285,6 @@ impl<'n> Engine<'n> { } } - fn _organizations_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.organizations().logs_delete(opt.value_of("log-name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _organizations_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.organizations().logs_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().logs_delete(opt.value_of("log-name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _projects_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().logs_list(opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _projects_metrics_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -641,6 +308,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.display-name" => Some(("metricDescriptor.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.description" => Some(("metricDescriptor.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -663,9 +331,10 @@ impl<'n> Engine<'n> { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "value-extractor" => Some(("valueExtractor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bounds", "bucket-options", "description", "display-name", "explicit-buckets", "exponential-buckets", "filter", "growth-factor", "ingest-delay", "label-extractors", "launch-stage", "linear-buckets", "metadata", "metric-descriptor", "metric-kind", "name", "num-finite-buckets", "offset", "sample-period", "scale", "type", "unit", "value-extractor", "value-type", "version", "width"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["bounds", "bucket-options", "create-time", "description", "display-name", "explicit-buckets", "exponential-buckets", "filter", "growth-factor", "ingest-delay", "label-extractors", "launch-stage", "linear-buckets", "metadata", "metric-descriptor", "metric-kind", "name", "num-finite-buckets", "offset", "sample-period", "scale", "type", "unit", "update-time", "value-extractor", "value-type", "version", "width"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -911,6 +580,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.display-name" => Some(("metricDescriptor.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metric-descriptor.description" => Some(("metricDescriptor.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -933,9 +603,10 @@ impl<'n> Engine<'n> { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "value-extractor" => Some(("valueExtractor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bounds", "bucket-options", "description", "display-name", "explicit-buckets", "exponential-buckets", "filter", "growth-factor", "ingest-delay", "label-extractors", "launch-stage", "linear-buckets", "metadata", "metric-descriptor", "metric-kind", "name", "num-finite-buckets", "offset", "sample-period", "scale", "type", "unit", "value-extractor", "value-type", "version", "width"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["bounds", "bucket-options", "create-time", "description", "display-name", "explicit-buckets", "exponential-buckets", "filter", "growth-factor", "ingest-delay", "label-extractors", "launch-stage", "linear-buckets", "metadata", "metric-descriptor", "metric-kind", "name", "num-finite-buckets", "offset", "sample-period", "scale", "type", "unit", "update-time", "value-extractor", "value-type", "version", "width"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1018,16 +689,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1277,16 +948,16 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "writer-identity" => Some(("writerIdentity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "include-children" => Some(("includeChildren", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "end-time", "filter", "include-children", "name", "output-version-format", "start-time", "writer-identity"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "destination", "filter", "include-children", "name", "output-version-format", "update-time", "writer-identity"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1358,20 +1029,6 @@ impl<'n> Engine<'n> { let mut call_result: Result<(), DoitError> = Ok(()); let mut err_opt: Option = None; match self.opt.subcommand() { - ("billing-accounts", Some(opt)) => { - match opt.subcommand() { - ("logs-delete", Some(opt)) => { - call_result = self._billing_accounts_logs_delete(opt, dry_run, &mut err); - }, - ("logs-list", Some(opt)) => { - call_result = self._billing_accounts_logs_list(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("billing-accounts".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, ("entries", Some(opt)) => { match opt.subcommand() { ("list", Some(opt)) => { @@ -1397,28 +1054,8 @@ impl<'n> Engine<'n> { } } }, - ("organizations", Some(opt)) => { - match opt.subcommand() { - ("logs-delete", Some(opt)) => { - call_result = self._organizations_logs_delete(opt, dry_run, &mut err); - }, - ("logs-list", Some(opt)) => { - call_result = self._organizations_logs_list(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("organizations".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, ("projects", Some(opt)) => { match opt.subcommand() { - ("logs-delete", Some(opt)) => { - call_result = self._projects_logs_delete(opt, dry_run, &mut err); - }, - ("logs-list", Some(opt)) => { - call_result = self._projects_logs_list(opt, dry_run, &mut err); - }, ("metrics-create", Some(opt)) => { call_result = self._projects_metrics_create(opt, dry_run, &mut err); }, @@ -1540,66 +1177,9 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("billing-accounts", "methods: 'logs-delete' and 'logs-list'", vec![ - ("logs-delete", - Some(r##"Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted."##), - "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/billing-accounts_logs-delete", - vec![ - (Some(r##"log-name"##), - None, - Some(r##"Required. The resource name of the log to delete: - "projects/[PROJECT_ID]/logs/[LOG_ID]" - "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - "folders/[FOLDER_ID]/logs/[LOG_ID]" - [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("logs-list", - Some(r##"Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed."##), - "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/billing-accounts_logs-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The resource name that owns the logs: - "projects/[PROJECT_ID]" - "organizations/[ORGANIZATION_ID]" - "billingAccounts/[BILLING_ACCOUNT_ID]" - "folders/[FOLDER_ID]" - "##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - ("entries", "methods: 'list' and 'write'", vec![ ("list", - Some(r##"Lists log entries. Use this method to retrieve log entries from Logging. For ways to export log entries, see Exporting Logs."##), + Some(r##"Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/entries_list", vec![ (Some(r##"kv"##), @@ -1663,118 +1243,7 @@ fn main() { ]), ]), - ("organizations", "methods: 'logs-delete' and 'logs-list'", vec![ - ("logs-delete", - Some(r##"Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted."##), - "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/organizations_logs-delete", - vec![ - (Some(r##"log-name"##), - None, - Some(r##"Required. The resource name of the log to delete: - "projects/[PROJECT_ID]/logs/[LOG_ID]" - "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - "folders/[FOLDER_ID]/logs/[LOG_ID]" - [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("logs-list", - Some(r##"Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed."##), - "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/organizations_logs-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The resource name that owns the logs: - "projects/[PROJECT_ID]" - "organizations/[ORGANIZATION_ID]" - "billingAccounts/[BILLING_ACCOUNT_ID]" - "folders/[FOLDER_ID]" - "##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("projects", "methods: 'logs-delete', 'logs-list', 'metrics-create', 'metrics-delete', 'metrics-get', 'metrics-list', 'metrics-update', 'sinks-create', 'sinks-delete', 'sinks-get', 'sinks-list' and 'sinks-update'", vec![ - ("logs-delete", - Some(r##"Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted."##), - "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_logs-delete", - vec![ - (Some(r##"log-name"##), - None, - Some(r##"Required. The resource name of the log to delete: - "projects/[PROJECT_ID]/logs/[LOG_ID]" - "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - "folders/[FOLDER_ID]/logs/[LOG_ID]" - [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("logs-list", - Some(r##"Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed."##), - "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_logs-list", - vec![ - (Some(r##"parent"##), - None, - Some(r##"Required. The resource name that owns the logs: - "projects/[PROJECT_ID]" - "organizations/[ORGANIZATION_ID]" - "billingAccounts/[BILLING_ACCOUNT_ID]" - "folders/[FOLDER_ID]" - "##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), + ("projects", "methods: 'metrics-create', 'metrics-delete', 'metrics-get', 'metrics-list', 'metrics-update', 'sinks-create', 'sinks-delete', 'sinks-get', 'sinks-list' and 'sinks-update'", vec![ ("metrics-create", Some(r##"Creates a logs-based metric."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_metrics-create", @@ -2022,7 +1491,7 @@ fn main() { Some(false)), ]), ("sinks-update", - Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), + Some(r##"Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."##), "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_sinks-update", vec![ (Some(r##"sink-name"##), @@ -2060,7 +1529,7 @@ fn main() { let mut app = App::new("logging2-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20180929") + .version("1.0.8+20190325") .about("Writes log entries and manages your Logging configuration.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli") .arg(Arg::with_name("url") diff --git a/gen/logging2_beta1/Cargo.toml b/gen/logging2_beta1/Cargo.toml index 90f679d2e7..31b3dd8065 100644 --- a/gen/logging2_beta1/Cargo.toml +++ b/gen/logging2_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-logging2_beta1" -version = "1.0.8+20180929" +version = "1.0.8+20190325" authors = ["Sebastian Thiel "] description = "A complete library to interact with Logging (protocol v2beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1" homepage = "https://cloud.google.com/logging/docs/" -documentation = "https://docs.rs/google-logging2_beta1/1.0.8+20180929" +documentation = "https://docs.rs/google-logging2_beta1/1.0.8+20190325" license = "MIT" keywords = ["logging", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/logging2_beta1/README.md b/gen/logging2_beta1/README.md index ed17fc70a8..c7c4372377 100644 --- a/gen/logging2_beta1/README.md +++ b/gen/logging2_beta1/README.md @@ -5,24 +5,20 @@ DO NOT EDIT ! --> The `google-logging2_beta1` library allows access to all features of the *Google Logging* service. -This documentation was generated from *Logging* crate version *1.0.8+20180929*, where *20180929* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Logging* crate version *1.0.8+20190325*, where *20190325* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Logging* *v2_beta1* API can be found at the [official documentation site](https://cloud.google.com/logging/docs/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.Logging.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.Logging.html) ... -* billing accounts - * [*logs delete*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.BillingAccountLogDeleteCall.html) and [*logs list*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.BillingAccountLogListCall.html) * entries - * [*list*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.EntryListCall.html) and [*write*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.EntryWriteCall.html) -* [monitored resource descriptors](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.MonitoredResourceDescriptor.html) - * [*list*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.MonitoredResourceDescriptorListCall.html) -* organizations - * [*logs delete*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.OrganizationLogDeleteCall.html) and [*logs list*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.OrganizationLogListCall.html) + * [*list*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.EntryListCall.html) and [*write*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.EntryWriteCall.html) +* [monitored resource descriptors](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.MonitoredResourceDescriptor.html) + * [*list*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.MonitoredResourceDescriptorListCall.html) * projects - * [*logs delete*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectLogListCall.html), [*metrics create*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectMetricCreateCall.html), [*metrics delete*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectMetricDeleteCall.html), [*metrics get*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectMetricGetCall.html), [*metrics list*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectMetricListCall.html), [*metrics update*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectMetricUpdateCall.html), [*sinks create*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.ProjectSinkUpdateCall.html) + * [*metrics create*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.ProjectMetricCreateCall.html), [*metrics delete*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.ProjectMetricDeleteCall.html), [*metrics get*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.ProjectMetricGetCall.html), [*metrics list*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.ProjectMetricListCall.html), [*metrics update*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.ProjectMetricUpdateCall.html), [*sinks create*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.ProjectSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.ProjectSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.ProjectSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.ProjectSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.ProjectSinkUpdateCall.html) @@ -31,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/struct.Logging.html)** +* **[Hub](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/struct.Logging.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -55,11 +51,9 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.organizations().logs_delete(...).doit() -let r = hub.projects().logs_delete(...).doit() -let r = hub.projects().metrics_delete(...).doit() -let r = hub.billing_accounts().logs_delete(...).doit() -let r = hub.projects().sinks_delete(...).doit() +let r = hub.projects().metrics_create(...).doit() +let r = hub.projects().metrics_update(...).doit() +let r = hub.projects().metrics_get(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -93,6 +87,7 @@ extern crate hyper; extern crate hyper_rustls; extern crate yup_oauth2 as oauth2; extern crate google_logging2_beta1 as logging2_beta1; +use logging2_beta1::LogMetric; use logging2_beta1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -110,10 +105,15 @@ let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), ::default(), None); let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = LogMetric::default(); + // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.organizations().logs_delete("logName") +let result = hub.projects().metrics_create(req, "parent") .doit(); match result { @@ -136,17 +136,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -156,29 +156,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-logging2_beta1/1.0.8+20180929/google_logging2_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-logging2_beta1/1.0.8+20190325/google_logging2_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/logging2_beta1/src/lib.rs b/gen/logging2_beta1/src/lib.rs index e0d46a2fd1..4390f673ab 100644 --- a/gen/logging2_beta1/src/lib.rs +++ b/gen/logging2_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Logging* crate version *1.0.8+20180929*, where *20180929* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Logging* crate version *1.0.8+20190325*, where *20190325* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Logging* *v2_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/logging/docs/). @@ -11,16 +11,12 @@ //! //! Handle the following *Resources* with ease from the central [hub](struct.Logging.html) ... //! -//! * billing accounts -//! * [*logs delete*](struct.BillingAccountLogDeleteCall.html) and [*logs list*](struct.BillingAccountLogListCall.html) //! * entries //! * [*list*](struct.EntryListCall.html) and [*write*](struct.EntryWriteCall.html) //! * [monitored resource descriptors](struct.MonitoredResourceDescriptor.html) //! * [*list*](struct.MonitoredResourceDescriptorListCall.html) -//! * organizations -//! * [*logs delete*](struct.OrganizationLogDeleteCall.html) and [*logs list*](struct.OrganizationLogListCall.html) //! * projects -//! * [*logs delete*](struct.ProjectLogDeleteCall.html), [*logs list*](struct.ProjectLogListCall.html), [*metrics create*](struct.ProjectMetricCreateCall.html), [*metrics delete*](struct.ProjectMetricDeleteCall.html), [*metrics get*](struct.ProjectMetricGetCall.html), [*metrics list*](struct.ProjectMetricListCall.html), [*metrics update*](struct.ProjectMetricUpdateCall.html), [*sinks create*](struct.ProjectSinkCreateCall.html), [*sinks delete*](struct.ProjectSinkDeleteCall.html), [*sinks get*](struct.ProjectSinkGetCall.html), [*sinks list*](struct.ProjectSinkListCall.html) and [*sinks update*](struct.ProjectSinkUpdateCall.html) +//! * [*metrics create*](struct.ProjectMetricCreateCall.html), [*metrics delete*](struct.ProjectMetricDeleteCall.html), [*metrics get*](struct.ProjectMetricGetCall.html), [*metrics list*](struct.ProjectMetricListCall.html), [*metrics update*](struct.ProjectMetricUpdateCall.html), [*sinks create*](struct.ProjectSinkCreateCall.html), [*sinks delete*](struct.ProjectSinkDeleteCall.html), [*sinks get*](struct.ProjectSinkGetCall.html), [*sinks list*](struct.ProjectSinkListCall.html) and [*sinks update*](struct.ProjectSinkUpdateCall.html) //! //! //! @@ -55,11 +51,9 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.organizations().logs_delete(...).doit() -//! let r = hub.projects().logs_delete(...).doit() -//! let r = hub.projects().metrics_delete(...).doit() -//! let r = hub.billing_accounts().logs_delete(...).doit() -//! let r = hub.projects().sinks_delete(...).doit() +//! let r = hub.projects().metrics_create(...).doit() +//! let r = hub.projects().metrics_update(...).doit() +//! let r = hub.projects().metrics_get(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -93,6 +87,7 @@ //! extern crate hyper_rustls; //! extern crate yup_oauth2 as oauth2; //! extern crate google_logging2_beta1 as logging2_beta1; +//! use logging2_beta1::LogMetric; //! use logging2_beta1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -111,10 +106,15 @@ //! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), //! ::default(), None); //! let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = LogMetric::default(); +//! //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.organizations().logs_delete("logName") +//! let result = hub.projects().metrics_create(req, "parent") //! .doit(); //! //! match result { @@ -288,6 +288,7 @@ impl Default for Scope { /// extern crate hyper_rustls; /// extern crate yup_oauth2 as oauth2; /// extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::LogMetric; /// use logging2_beta1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -306,10 +307,15 @@ impl Default for Scope { /// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// ::default(), None); /// let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogMetric::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.organizations().logs_delete("logName") +/// let result = hub.projects().metrics_create(req, "parent") /// .doit(); /// /// match result { @@ -353,18 +359,12 @@ impl<'a, C, A> Logging } } - pub fn billing_accounts(&'a self) -> BillingAccountMethods<'a, C, A> { - BillingAccountMethods { hub: &self } - } pub fn entries(&'a self) -> EntryMethods<'a, C, A> { EntryMethods { hub: &self } } pub fn monitored_resource_descriptors(&'a self) -> MonitoredResourceDescriptorMethods<'a, C, A> { MonitoredResourceDescriptorMethods { hub: &self } } - pub fn organizations(&'a self) -> OrganizationMethods<'a, C, A> { - OrganizationMethods { hub: &self } - } pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { ProjectMethods { hub: &self } } @@ -455,30 +455,6 @@ pub struct Exponential { impl Part for Exponential {} -/// Result returned from ListLogs. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [logs list projects](struct.ProjectLogListCall.html) (response) -/// * [logs list organizations](struct.OrganizationLogListCall.html) (response) -/// * [logs list billing accounts](struct.BillingAccountLogListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListLogsResponse { - /// If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// A list of log names. For example, "projects/my-project/syslog" or "organizations/123/cloudresourcemanager.googleapis.com%2Factivity". - #[serde(rename="logNames")] - pub log_names: Option>, -} - -impl ResponseResult for ListLogsResponse {} - - /// Result returned from ListLogMetrics. /// /// # Activities @@ -513,19 +489,24 @@ pub struct Explicit { impl Part for Explicit {} -/// Result returned from WriteLogEntries. empty +/// BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [write entries](struct.EntryWriteCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WriteLogEntriesResponse { _never_set: Option } +pub struct BucketOptions { + /// The exponential buckets. + #[serde(rename="exponentialBuckets")] + pub exponential_buckets: Option, + /// The linear bucket. + #[serde(rename="linearBuckets")] + pub linear_buckets: Option, + /// The explicit buckets. + #[serde(rename="explicitBuckets")] + pub explicit_buckets: Option, +} -impl ResponseResult for WriteLogEntriesResponse {} +impl Part for BucketOptions {} /// An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "gce_instance" has labels "instance_id" and "zone": @@ -621,28 +602,28 @@ impl Part for MetricDescriptorMetadata {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LogSink { - /// Deprecated. This field is ignored when creating or updating sinks. - #[serde(rename="endTime")] - pub end_time: Option, + /// Output only. The last update timestamp of the sink.This field may not be present for older sinks. + #[serde(rename="updateTime")] + pub update_time: Option, /// Required. The client-assigned sink identifier, unique within the project. Example: "my-syslog-errors-to-pubsub". Sink identifiers are limited to 100 characters and can include only the following characters: upper and lower-case alphanumeric characters, underscores, hyphens, and periods. pub name: Option, /// Required. The export destination: /// "storage.googleapis.com/[GCS_BUCKET]" /// "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" /// "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" - /// The sink's writer_identity, set when the sink is created, must have permission to write to the destination or else the log entries are not exported. For more information, see Exporting Logs With Sinks. + /// The sink's writer_identity, set when the sink is created, must have permission to write to the destination or else the log entries are not exported. For more information, see Exporting Logs with Sinks. pub destination: Option, + /// Output only. The creation timestamp of the sink.This field may not be present for older sinks. + #[serde(rename="createTime")] + pub create_time: Option, /// Optional. An advanced logs filter. The only exported log entries are those that are in the resource owning the sink and that match the filter. For example: /// logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR /// pub filter: Option, - /// Deprecated. This field is ignored when creating or updating sinks. - #[serde(rename="startTime")] - pub start_time: Option, /// Deprecated. The log entry format to use for this sink's exported log entries. The v2 format is used by default and cannot be changed. #[serde(rename="outputVersionFormat")] pub output_version_format: Option, - /// Output only. An IAM identity—a service account or group—under which Logging writes the exported log entries to the sink's destination. This field is set by sinks.create and sinks.update, based on the setting of unique_writer_identity in those methods.Until you grant this identity write-access to the destination, log entry exports from this sink will fail. For more information, see Granting access for a resource. Consult the destination service's documentation to determine the appropriate IAM roles to assign to the identity. + /// Output only. An IAM identity—a service account or group—under which Logging writes the exported log entries to the sink's destination. This field is set by sinks.create and sinks.update based on the value of unique_writer_identity in those methods.Until you grant this identity write-access to the destination, log entry exports from this sink will fail. For more information, see Granting Access for a Resource. Consult the destination service's documentation to determine the appropriate IAM roles to assign to the identity. #[serde(rename="writerIdentity")] pub writer_identity: Option, /// Optional. This field applies only to sinks owned by organizations and folders. If the field is false, the default, only the logs owned by the sink's parent resource are available for export. If the field is true, then logs from all the projects, folders, and billing accounts contained in the sink's parent resource are also available for export. Whether a particular log entry from the children is exported depends on the sink's filter expression. For example, if this field is true, then the filter resource.type=gce_instance would export all Compute Engine VM instance log entries from all projects in the sink's parent. To only export entries from certain child projects, filter on the project part of the log name: @@ -685,7 +666,7 @@ pub struct ListLogEntriesRequest { /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. page_token must be the value of next_page_token from the previous response. The values of other method parameters should be identical to those in the previous call. #[serde(rename="pageToken")] pub page_token: Option, - /// Deprecated. Use resource_names instead. One or more project identifiers or project numbers from which to retrieve log entries. Example: "my-project-1A". If present, these project identifiers are converted to resource name format and added to the list of resources in resource_names. + /// Deprecated. Use resource_names instead. One or more project identifiers or project numbers from which to retrieve log entries. Example: "my-project-1A". #[serde(rename="projectIds")] pub project_ids: Option>, /// Optional. A filter that chooses which log entries to return. See Advanced Logs Filters. Only log entries that match the filter are returned. An empty filter matches all log entries in the resources listed in resource_names. Referencing a parent resource that is not listed in resource_names will cause the filter to return no results. The maximum length of the filter is 20000 characters. @@ -706,10 +687,7 @@ impl RequestValue for ListLogEntriesRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [logs delete organizations](struct.OrganizationLogDeleteCall.html) (response) -/// * [logs delete projects](struct.ProjectLogDeleteCall.html) (response) /// * [metrics delete projects](struct.ProjectMetricDeleteCall.html) (response) -/// * [logs delete billing accounts](struct.BillingAccountLogDeleteCall.html) (response) /// * [sinks delete projects](struct.ProjectSinkDeleteCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -756,7 +734,8 @@ pub struct HttpRequest { /// The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329". #[serde(rename="remoteIp")] pub remote_ip: Option, - /// The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)". + /// The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET + /// CLR 1.0.3705)". #[serde(rename="userAgent")] pub user_agent: Option, /// The size of the HTTP request message in bytes, including the request headers and the request body. @@ -909,24 +888,19 @@ pub struct ListSinksResponse { impl ResponseResult for ListSinksResponse {} -/// BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. +/// Result returned from WriteLogEntries. empty /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [write entries](struct.EntryWriteCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BucketOptions { - /// The exponential buckets. - #[serde(rename="exponentialBuckets")] - pub exponential_buckets: Option, - /// The linear bucket. - #[serde(rename="linearBuckets")] - pub linear_buckets: Option, - /// The explicit buckets. - #[serde(rename="explicitBuckets")] - pub explicit_buckets: Option, -} +pub struct WriteLogEntriesResponse { _never_set: Option } -impl Part for BucketOptions {} +impl ResponseResult for WriteLogEntriesResponse {} /// The parameters to WriteLogEntries. @@ -1010,13 +984,13 @@ pub struct LogEntry { /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" /// "folders/[FOLDER_ID]/logs/[LOG_ID]" - /// A project number may optionally be used in place of PROJECT_ID. The project number is translated to its corresponding PROJECT_ID internally and the log_name field will contain PROJECT_ID in queries and exports.[LOG_ID] must be URL-encoded within log_name. Example: "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results. + /// A project number may optionally be used in place of PROJECT_ID. The project number is translated to its corresponding PROJECT_ID internally and the log_name field will contain PROJECT_ID in queries and exports.[LOG_ID] must be URL-encoded within log_name. Example: "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results. #[serde(rename="logName")] pub log_name: Option, /// Optional. A unique identifier for the log entry. If you provide a value, then Logging considers other log entries in the same project, with the same timestamp, and with the same insert_id to be duplicates which can be removed. If omitted in new log entries, then Logging assigns its own unique identifier. The insert_id is also used to order log entries that have the same timestamp value. #[serde(rename="insertId")] pub insert_id: Option, - /// Optional. The span ID within the trace associated with the log entry. For Trace spans, this is the same format that the Trace API v2 uses: a 16-character hexadecimal encoding of an 8-byte array, such as "000000000000004a". + /// Optional. The span ID within the trace associated with the log entry.For Trace spans, this is the same format that the Trace API v2 uses: a 16-character hexadecimal encoding of an 8-byte array, such as "000000000000004a". #[serde(rename="spanId")] pub span_id: Option, /// Optional. Information about an operation associated with the log entry, if applicable. @@ -1024,7 +998,7 @@ pub struct LogEntry { /// Optional. Source code location information associated with the log entry, if any. #[serde(rename="sourceLocation")] pub source_location: Option, - /// Required. The primary monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error. + /// Required. The primary monitored resource associated with this log entry.Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error. pub resource: Option, /// Optional. The severity of the log entry. The default value is LogSeverity.DEFAULT. pub severity: Option, @@ -1040,10 +1014,10 @@ pub struct LogEntry { /// The log entry payload, represented as a protocol buffer. Some Google Cloud Platform services use this field for their log entry payloads. #[serde(rename="protoPayload")] pub proto_payload: Option>, - /// Optional. The sampling decision of the trace associated with the log entry. True means that the trace resource name in the trace field was sampled for storage in a trace backend. False means that the trace was not sampled for storage when this log entry was written, or the sampling decision was unknown at the time. A non-sampled trace value is still useful as a request correlation identifier. The default is False. + /// Optional. The sampling decision of the trace associated with the log entry.True means that the trace resource name in the trace field was sampled for storage in a trace backend. False means that the trace was not sampled for storage when this log entry was written, or the sampling decision was unknown at the time. A non-sampled trace value is still useful as a request correlation identifier. The default is False. #[serde(rename="traceSampled")] pub trace_sampled: Option, - /// Output only. Additional metadata about the monitored resource. Only k8s_container, k8s_pod, and k8s_node MonitoredResources have this field populated. + /// Deprecated. Output only. Additional metadata about the monitored resource.Only k8s_container, k8s_pod, and k8s_node MonitoredResources have this field populated for GKE versions older than 1.12.6. For GKE versions 1.12.6 and above, the metadata field has been deprecated. The Kubernetes pod labels that used to be in metadata.userLabels will now be present in the labels field with a key prefix of k8s-pod/. The Stackdriver system labels that were present in the metadata.systemLabels field will no longer be available in the LogEntry. pub metadata: Option, } @@ -1063,7 +1037,10 @@ impl Part for LogEntry {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LogMetric { - /// Optional. A description of this metric, which is used in documentation. + /// Output only. The last update timestamp of the metric.This field may not be present for older metrics. + #[serde(rename="updateTime")] + pub update_time: Option, + /// Optional. A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters. pub description: Option, /// Optional. The metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression.The name, type, and description fields in the metric_descriptor are output only, and is constructed using the name and description field in the LogMetric.To create a logs-based metric that records a distribution of log values, a DELTA metric kind with a DISTRIBUTION value type must be used along with a value_extractor expression in the LogMetric.Each label in the metric descriptor must have a matching label name as the key and an extractor expression as the value in the label_extractors map.The metric_kind and value_type fields in the metric_descriptor cannot be updated once initially configured. New labels can be added in the metric_descriptor, but existing labels cannot be modified except for their description. #[serde(rename="metricDescriptor")] @@ -1083,6 +1060,9 @@ pub struct LogMetric { pub value_extractor: Option, /// Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed. pub version: Option, + /// Output only. The creation timestamp of the metric.This field may not be present for older metrics. + #[serde(rename="createTime")] + pub create_time: Option, /// Required. The client-assigned metric identifier. Examples: "error_count", "nginx/requests".Metric identifiers are limited to 100 characters and can include only the following characters: A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.The metric identifier in this field must not be URL-encoded (https://en.wikipedia.org/wiki/Percent-encoding). However, when the metric identifier appears as the [METRIC_ID] part of a metric_name API parameter, then the metric identifier must be URL-encoded. Example: "projects/my-project/metrics/nginx%2Frequests". pub name: Option, } @@ -1110,10 +1090,10 @@ pub struct MonitoredResourceDescriptor { /// Required. The monitored resource type. For example, the type "cloudsql_database" represents databases in Google Cloud SQL. The maximum length of this value is 256 characters. #[serde(rename="type")] pub type_: Option, - /// Optional. The resource name of the monitored resource descriptor: "projects/{project_id}/monitoredResourceDescriptors/{type}" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format "monitoredResourceDescriptors/{type}". - pub name: Option, /// Optional. A detailed description of the monitored resource type that might be used in documentation. pub description: Option, + /// Optional. The resource name of the monitored resource descriptor: "projects/{project_id}/monitoredResourceDescriptors/{type}" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format "monitoredResourceDescriptors/{type}". + pub name: Option, } impl Resource for MonitoredResourceDescriptor {} @@ -1124,182 +1104,6 @@ impl Resource for MonitoredResourceDescriptor {} // MethodBuilders ### // ################# -/// A builder providing access to all methods supported on *organization* resources. -/// It is not used directly, but through the `Logging` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_logging2_beta1 as logging2_beta1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use logging2_beta1::Logging; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `logs_delete(...)` and `logs_list(...)` -/// // to build up your call. -/// let rb = hub.organizations(); -/// # } -/// ``` -pub struct OrganizationMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, -} - -impl<'a, C, A> MethodsBuilder for OrganizationMethods<'a, C, A> {} - -impl<'a, C, A> OrganizationMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. - /// - /// # Arguments - /// - /// * `logName` - Required. The resource name of the log to delete: - /// "projects/[PROJECT_ID]/logs/[LOG_ID]" - /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - /// "folders/[FOLDER_ID]/logs/[LOG_ID]" - /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. - pub fn logs_delete(&self, log_name: &str) -> OrganizationLogDeleteCall<'a, C, A> { - OrganizationLogDeleteCall { - hub: self.hub, - _log_name: log_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed. - /// - /// # Arguments - /// - /// * `parent` - Required. The resource name that owns the logs: - /// "projects/[PROJECT_ID]" - /// "organizations/[ORGANIZATION_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]" - /// "folders/[FOLDER_ID]" - /// - pub fn logs_list(&self, parent: &str) -> OrganizationLogListCall<'a, C, A> { - OrganizationLogListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *billingAccount* resources. -/// It is not used directly, but through the `Logging` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_logging2_beta1 as logging2_beta1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use logging2_beta1::Logging; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `logs_delete(...)` and `logs_list(...)` -/// // to build up your call. -/// let rb = hub.billing_accounts(); -/// # } -/// ``` -pub struct BillingAccountMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, -} - -impl<'a, C, A> MethodsBuilder for BillingAccountMethods<'a, C, A> {} - -impl<'a, C, A> BillingAccountMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. - /// - /// # Arguments - /// - /// * `logName` - Required. The resource name of the log to delete: - /// "projects/[PROJECT_ID]/logs/[LOG_ID]" - /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - /// "folders/[FOLDER_ID]/logs/[LOG_ID]" - /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. - pub fn logs_delete(&self, log_name: &str) -> BillingAccountLogDeleteCall<'a, C, A> { - BillingAccountLogDeleteCall { - hub: self.hub, - _log_name: log_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed. - /// - /// # Arguments - /// - /// * `parent` - Required. The resource name that owns the logs: - /// "projects/[PROJECT_ID]" - /// "organizations/[ORGANIZATION_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]" - /// "folders/[FOLDER_ID]" - /// - pub fn logs_list(&self, parent: &str) -> BillingAccountLogListCall<'a, C, A> { - BillingAccountLogListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - /// A builder providing access to all methods supported on *monitoredResourceDescriptor* resources. /// It is not used directly, but through the `Logging` hub. /// @@ -1380,7 +1184,7 @@ impl<'a, C, A> MonitoredResourceDescriptorMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `logs_delete(...)`, `logs_list(...)`, `metrics_create(...)`, `metrics_delete(...)`, `metrics_get(...)`, `metrics_list(...)`, `metrics_update(...)`, `sinks_create(...)`, `sinks_delete(...)`, `sinks_get(...)`, `sinks_list(...)` and `sinks_update(...)` +/// // like `metrics_create(...)`, `metrics_delete(...)`, `metrics_get(...)`, `metrics_list(...)`, `metrics_update(...)`, `sinks_create(...)`, `sinks_delete(...)`, `sinks_get(...)`, `sinks_list(...)` and `sinks_update(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -1395,47 +1199,6 @@ impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} impl<'a, C, A> ProjectMethods<'a, C, A> { - /// Create a builder to help you perform the following task: - /// - /// Gets a logs-based metric. - /// - /// # Arguments - /// - /// * `metricName` - The resource name of the desired metric: - /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - /// - pub fn metrics_get(&self, metric_name: &str) -> ProjectMetricGetCall<'a, C, A> { - ProjectMetricGetCall { - hub: self.hub, - _metric_name: metric_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. - /// - /// # Arguments - /// - /// * `logName` - Required. The resource name of the log to delete: - /// "projects/[PROJECT_ID]/logs/[LOG_ID]" - /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - /// "folders/[FOLDER_ID]/logs/[LOG_ID]" - /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. - pub fn logs_delete(&self, log_name: &str) -> ProjectLogDeleteCall<'a, C, A> { - ProjectLogDeleteCall { - hub: self.hub, - _log_name: log_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Lists sinks. @@ -1484,18 +1247,16 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates or updates a logs-based metric. + /// Gets a logs-based metric. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `metricName` - The resource name of the metric to update: + /// * `metricName` - The resource name of the desired metric: /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - /// The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created. - pub fn metrics_update(&self, request: LogMetric, metric_name: &str) -> ProjectMetricUpdateCall<'a, C, A> { - ProjectMetricUpdateCall { + /// + pub fn metrics_get(&self, metric_name: &str) -> ProjectMetricGetCall<'a, C, A> { + ProjectMetricGetCall { hub: self.hub, - _request: request, _metric_name: metric_name.to_string(), _delegate: Default::default(), _scopes: Default::default(), @@ -1505,7 +1266,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter. The updated sink might also have a new writer_identity; see the unique_writer_identity field. + /// Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field. /// /// # Arguments /// @@ -1529,30 +1290,6 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed. - /// - /// # Arguments - /// - /// * `parent` - Required. The resource name that owns the logs: - /// "projects/[PROJECT_ID]" - /// "organizations/[ORGANIZATION_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]" - /// "folders/[FOLDER_ID]" - /// - pub fn logs_list(&self, parent: &str) -> ProjectLogListCall<'a, C, A> { - ProjectLogListCall { - hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Deletes a logs-based metric. @@ -1618,6 +1355,28 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. + /// + /// # Arguments + /// + /// * `sinkName` - Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: + /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" + /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" + /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" + /// "folders/[FOLDER_ID]/sinks/[SINK_ID]" + /// Example: "projects/my-project-id/sinks/my-sink-id". + pub fn sinks_delete(&self, sink_name: &str) -> ProjectSinkDeleteCall<'a, C, A> { + ProjectSinkDeleteCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Lists logs-based metrics. @@ -1641,20 +1400,19 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. + /// Creates or updates a logs-based metric. /// /// # Arguments /// - /// * `sinkName` - Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: - /// "projects/[PROJECT_ID]/sinks/[SINK_ID]" - /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - /// "folders/[FOLDER_ID]/sinks/[SINK_ID]" - /// Example: "projects/my-project-id/sinks/my-sink-id". - pub fn sinks_delete(&self, sink_name: &str) -> ProjectSinkDeleteCall<'a, C, A> { - ProjectSinkDeleteCall { + /// * `request` - No description provided. + /// * `metricName` - The resource name of the metric to update: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created. + pub fn metrics_update(&self, request: LogMetric, metric_name: &str) -> ProjectMetricUpdateCall<'a, C, A> { + ProjectMetricUpdateCall { hub: self.hub, - _sink_name: sink_name.to_string(), + _request: request, + _metric_name: metric_name.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1705,7 +1463,7 @@ impl<'a, C, A> EntryMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists log entries. Use this method to retrieve log entries from Logging. For ways to export log entries, see Exporting Logs. + /// Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs. /// /// # Arguments /// @@ -1746,1078 +1504,6 @@ impl<'a, C, A> EntryMethods<'a, C, A> { // CallBuilders ### // ################# -/// Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. -/// -/// A builder for the *logs.delete* method supported by a *organization* resource. -/// It is not used directly, but through a `OrganizationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.organizations().logs_delete("logName") -/// .doit(); -/// # } -/// ``` -pub struct OrganizationLogDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _log_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OrganizationLogDeleteCall<'a, C, A> {} - -impl<'a, C, A> OrganizationLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.organizations.logs.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("logName", self._log_name.to_string())); - for &field in ["alt", "logName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+logName}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+logName}", "logName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["logName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name of the log to delete: - /// "projects/[PROJECT_ID]/logs/[LOG_ID]" - /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - /// "folders/[FOLDER_ID]/logs/[LOG_ID]" - /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. - /// - /// Sets the *log name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn log_name(mut self, new_value: &str) -> OrganizationLogDeleteCall<'a, C, A> { - self._log_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationLogDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> OrganizationLogDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> OrganizationLogDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed. -/// -/// A builder for the *logs.list* method supported by a *organization* resource. -/// It is not used directly, but through a `OrganizationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.organizations().logs_list("parent") -/// .page_token("dolores") -/// .page_size(-63) -/// .doit(); -/// # } -/// ``` -pub struct OrganizationLogListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OrganizationLogListCall<'a, C, A> {} - -impl<'a, C, A> OrganizationLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.organizations.logs.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/logs"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name that owns the logs: - /// "projects/[PROJECT_ID]" - /// "organizations/[ORGANIZATION_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]" - /// "folders/[FOLDER_ID]" - /// - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> OrganizationLogListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> OrganizationLogListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> OrganizationLogListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationLogListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> OrganizationLogListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> OrganizationLogListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. -/// -/// A builder for the *logs.delete* method supported by a *billingAccount* resource. -/// It is not used directly, but through a `BillingAccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.billing_accounts().logs_delete("logName") -/// .doit(); -/// # } -/// ``` -pub struct BillingAccountLogDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _log_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for BillingAccountLogDeleteCall<'a, C, A> {} - -impl<'a, C, A> BillingAccountLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.billingAccounts.logs.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("logName", self._log_name.to_string())); - for &field in ["alt", "logName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+logName}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+logName}", "logName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["logName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name of the log to delete: - /// "projects/[PROJECT_ID]/logs/[LOG_ID]" - /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - /// "folders/[FOLDER_ID]/logs/[LOG_ID]" - /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. - /// - /// Sets the *log name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn log_name(mut self, new_value: &str) -> BillingAccountLogDeleteCall<'a, C, A> { - self._log_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountLogDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> BillingAccountLogDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> BillingAccountLogDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed. -/// -/// A builder for the *logs.list* method supported by a *billingAccount* resource. -/// It is not used directly, but through a `BillingAccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.billing_accounts().logs_list("parent") -/// .page_token("justo") -/// .page_size(-1) -/// .doit(); -/// # } -/// ``` -pub struct BillingAccountLogListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for BillingAccountLogListCall<'a, C, A> {} - -impl<'a, C, A> BillingAccountLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.billingAccounts.logs.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/logs"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name that owns the logs: - /// "projects/[PROJECT_ID]" - /// "organizations/[ORGANIZATION_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]" - /// "folders/[FOLDER_ID]" - /// - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> BillingAccountLogListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> BillingAccountLogListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> BillingAccountLogListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> BillingAccountLogListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> BillingAccountLogListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> BillingAccountLogListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Lists the descriptors for monitored resource types used by Logging. /// /// A builder for the *list* method supported by a *monitoredResourceDescriptor* resource. @@ -2846,8 +1532,8 @@ impl<'a, C, A> BillingAccountLogListCall<'a, C, A> where C: BorrowMut MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut< } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2926,7 +1609,7 @@ impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3008,7 +1691,7 @@ impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3056,515 +1739,6 @@ impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut< } -/// Gets a logs-based metric. -/// -/// A builder for the *metrics.get* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().metrics_get("metricName") -/// .doit(); -/// # } -/// ``` -pub struct ProjectMetricGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _metric_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectMetricGetCall<'a, C, A> {} - -impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("metricName", self._metric_name.to_string())); - for &field in ["alt", "metricName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+metricName}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["metricName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The resource name of the desired metric: - /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - /// - /// - /// Sets the *metric name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn metric_name(mut self, new_value: &str) -> ProjectMetricGetCall<'a, C, A> { - self._metric_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectMetricGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectMetricGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. -/// -/// A builder for the *logs.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().logs_delete("logName") -/// .doit(); -/// # } -/// ``` -pub struct ProjectLogDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _log_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectLogDeleteCall<'a, C, A> {} - -impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.logs.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("logName", self._log_name.to_string())); - for &field in ["alt", "logName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+logName}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+logName}", "logName")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["logName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name of the log to delete: - /// "projects/[PROJECT_ID]/logs/[LOG_ID]" - /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - /// "folders/[FOLDER_ID]/logs/[LOG_ID]" - /// [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog", "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry. - /// - /// Sets the *log name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn log_name(mut self, new_value: &str) -> ProjectLogDeleteCall<'a, C, A> { - self._log_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLogDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectLogDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectLogDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Lists sinks. /// /// A builder for the *sinks.list* method supported by a *project* resource. @@ -3593,8 +1767,8 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().sinks_list("parent") -/// .page_token("gubergren") -/// .page_size(-95) +/// .page_token("kasd") +/// .page_size(-22) /// .doit(); /// # } /// ``` @@ -3661,7 +1835,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3677,10 +1851,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3700,7 +1871,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3797,7 +1968,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3931,7 +2102,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3947,10 +2118,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3970,7 +2138,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4053,7 +2221,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4101,9 +2269,9 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A } -/// Creates or updates a logs-based metric. +/// Gets a logs-based metric. /// -/// A builder for the *metrics.update* method supported by a *project* resource. +/// A builder for the *metrics.get* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -4115,7 +2283,6 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_logging2_beta1 as logging2_beta1; -/// use logging2_beta1::LogMetric; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -4126,32 +2293,26 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = LogMetric::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().metrics_update(req, "metricName") +/// let result = hub.projects().metrics_get("metricName") /// .doit(); /// # } /// ``` -pub struct ProjectMetricUpdateCall<'a, C, A> +pub struct ProjectMetricGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Logging, - _request: LogMetric, _metric_name: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectMetricUpdateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectMetricGetCall<'a, C, A> {} -impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -4164,9 +2325,9 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "logging.projects.metrics.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("metricName", self._metric_name.to_string())); for &field in ["alt", "metricName"].iter() { if self._additional_params.contains_key(field) { @@ -4194,7 +2355,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -4242,15 +2389,11 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The resource name of the metric to update: + /// The resource name of the desired metric: /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - /// The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created. + /// /// /// Sets the *metric name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn metric_name(mut self, new_value: &str) -> ProjectMetricUpdateCall<'a, C, A> { + pub fn metric_name(mut self, new_value: &str) -> ProjectMetricGetCall<'a, C, A> { self._metric_name = new_value.to_string(); self } @@ -4328,7 +2462,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -4337,7 +2471,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectMetricUpdateCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectMetricGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -4373,7 +2507,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectMetricUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectMetricGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -4385,7 +2519,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4504,10 +2638,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4539,7 +2670,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4651,7 +2782,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4699,286 +2830,6 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut } -/// Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed. -/// -/// A builder for the *logs.list* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_logging2_beta1 as logging2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use logging2_beta1::Logging; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().logs_list("parent") -/// .page_token("et") -/// .page_size(-41) -/// .doit(); -/// # } -/// ``` -pub struct ProjectLogListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectLogListCall<'a, C, A> {} - -impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.logs.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/logs"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The resource name that owns the logs: - /// "projects/[PROJECT_ID]" - /// "organizations/[ORGANIZATION_ID]" - /// "billingAccounts/[BILLING_ACCOUNT_ID]" - /// "folders/[FOLDER_ID]" - /// - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectLogListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectLogListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectLogListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLogListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectLogListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectLogListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Deletes a logs-based metric. /// /// A builder for the *metrics.delete* method supported by a *project* resource. @@ -5065,7 +2916,7 @@ impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5104,7 +2952,7 @@ impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut ProjectSinkCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5346,10 +3194,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5381,7 +3226,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5483,7 +3328,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5624,7 +3469,7 @@ impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut ProjectMetricCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5675,7 +3517,7 @@ impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut ProjectMetricCreateCall<'a, C, A> where C: BorrowMut ProjectMetricCreateCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().metrics_list("parent") -/// .page_token("sea") -/// .page_size(-55) -/// .doit(); -/// # } -/// ``` -pub struct ProjectMetricListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Logging, - _parent: String, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectMetricListCall<'a, C, A> {} - -impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogMetricsResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/metrics"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The name of the project containing the metrics: - /// "projects/[PROJECT_ID]" - /// - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectMetricListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectMetricListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectMetricListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted. /// /// A builder for the *sinks.delete* method supported by a *project* resource. @@ -6178,7 +3743,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6194,10 +3759,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6217,7 +3779,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6300,7 +3862,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6348,7 +3910,562 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut } -/// Lists log entries. Use this method to retrieve log entries from Logging. For ways to export log entries, see Exporting Logs. +/// Lists logs-based metrics. +/// +/// A builder for the *metrics.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_list("parent") +/// .page_token("ea") +/// .page_size(-61) +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricListCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogMetricsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+parent}/metrics"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The name of the project containing the metrics: + /// "projects/[PROJECT_ID]" + /// + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectMetricListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates or updates a logs-based metric. +/// +/// A builder for the *metrics.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::LogMetric; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LogMetric::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().metrics_update(req, "metricName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogMetric, + _metric_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("metricName", self._metric_name.to_string())); + for &field in ["alt", "metricName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2beta1/{+metricName}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["metricName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LogMetric) -> ProjectMetricUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the metric to update: + /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]" + /// The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created. + /// + /// Sets the *metric name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn metric_name(mut self, new_value: &str) -> ProjectMetricUpdateCall<'a, C, A> { + self._metric_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectMetricUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectMetricUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs. /// /// A builder for the *list* method supported by a *entry* resource. /// It is not used directly, but through a `EntryMethods` instance. @@ -6430,10 +4547,7 @@ impl<'a, C, A> EntryListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6465,7 +4579,7 @@ impl<'a, C, A> EntryListCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6545,7 +4659,7 @@ impl<'a, C, A> EntryListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6675,10 +4789,7 @@ impl<'a, C, A> EntryWriteCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6710,7 +4821,7 @@ impl<'a, C, A> EntryWriteCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6790,7 +4901,7 @@ impl<'a, C, A> EntryWriteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/manager1_beta2/Cargo.toml b/gen/manager1_beta2/Cargo.toml index 6244d9dfbd..14dd509653 100644 --- a/gen/manager1_beta2/Cargo.toml +++ b/gen/manager1_beta2/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/manager1_beta2/src/lib.rs b/gen/manager1_beta2/src/lib.rs index 0c3deb0dac..43986f6478 100644 --- a/gen/manager1_beta2/src/lib.rs +++ b/gen/manager1_beta2/src/lib.rs @@ -1505,10 +1505,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1528,7 +1525,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1619,7 +1616,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1762,10 +1759,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1785,7 +1779,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1861,7 +1855,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2010,10 +2004,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2045,7 +2036,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2134,7 +2125,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2278,10 +2269,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2301,7 +2289,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2387,7 +2375,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2538,10 +2526,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2573,7 +2558,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2671,7 +2656,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2817,10 +2802,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2840,7 +2822,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2935,7 +2917,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3089,10 +3071,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3112,7 +3091,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3212,7 +3191,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3357,10 +3336,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3380,7 +3356,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3465,7 +3441,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/manufacturers1-cli/Cargo.toml b/gen/manufacturers1-cli/Cargo.toml index 0a7614d49d..836edbd490 100644 --- a/gen/manufacturers1-cli/Cargo.toml +++ b/gen/manufacturers1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-manufacturers1-cli" -version = "1.0.8+20180919" +version = "1.0.8+20190329" authors = ["Sebastian Thiel "] description = "A complete library to interact with Manufacturer Center (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/manufacturers1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-manufacturers1] path = "../manufacturers1" -version = "1.0.8+20180919" +version = "1.0.8+20190329" diff --git a/gen/manufacturers1-cli/README.md b/gen/manufacturers1-cli/README.md index fa7c487fdb..743bd2d4e3 100644 --- a/gen/manufacturers1-cli/README.md +++ b/gen/manufacturers1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Manufacturer Center* API at revision *20180919*. The CLI is at version *1.0.8*. +This documentation was generated from the *Manufacturer Center* API at revision *20190329*. The CLI is at version *1.0.8*. ```bash manufacturers1 [options] diff --git a/gen/manufacturers1-cli/mkdocs.yml b/gen/manufacturers1-cli/mkdocs.yml index 28c8c60cd7..22b314d45d 100644 --- a/gen/manufacturers1-cli/mkdocs.yml +++ b/gen/manufacturers1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Manufacturer Center v1.0.8+20180919 +site_name: Manufacturer Center v1.0.8+20190329 site_url: http://byron.github.io/google-apis-rs/google-manufacturers1-cli site_description: A complete library to interact with Manufacturer Center (protocol v1) diff --git a/gen/manufacturers1-cli/src/main.rs b/gen/manufacturers1-cli/src/main.rs index 202e5a026b..4d1009f3f2 100644 --- a/gen/manufacturers1-cli/src/main.rs +++ b/gen/manufacturers1-cli/src/main.rs @@ -243,14 +243,14 @@ impl<'n> Engine<'n> { "color" => Some(("color", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "release-date" => Some(("releaseDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "item-group-id" => Some(("itemGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "video-link" => Some(("videoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "gtin" => Some(("gtin", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "excluded-destination" => Some(("excludedDestination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "flavor" => Some(("flavor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "target-client-id" => Some(("targetClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "scent" => Some(("scent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "size" => Some(("size", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "capacity.unit" => Some(("capacity.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "capacity.value" => Some(("capacity.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "capacity.unit" => Some(("capacity.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "pattern" => Some(("pattern", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "disclosure-date" => Some(("disclosureDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -266,15 +266,15 @@ impl<'n> Engine<'n> { "product-name" => Some(("productName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "size-system" => Some(("sizeSystem", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "size-type" => Some(("sizeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "count.unit" => Some(("count.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "count.value" => Some(("count.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "count.unit" => Some(("count.unit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "gender" => Some(("gender", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "product-page-url" => Some(("productPageUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "image-link.status" => Some(("imageLink.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "image-link.image-url" => Some(("imageLink.imageUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "image-link.type" => Some(("imageLink.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "product-type" => Some(("productType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "gtin" => Some(("gtin", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "video-link" => Some(("videoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "age-group" => Some(("ageGroup", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["age-group", "amount", "brand", "capacity", "color", "count", "currency", "description", "disclosure-date", "excluded-destination", "flavor", "format", "gender", "gtin", "image-link", "image-url", "included-destination", "item-group-id", "material", "mpn", "pattern", "product-line", "product-name", "product-page-url", "product-type", "release-date", "scent", "size", "size-system", "size-type", "status", "suggested-retail-price", "target-client-id", "theme", "title", "type", "unit", "value", "video-link"]); @@ -621,7 +621,7 @@ fn main() { let mut app = App::new("manufacturers1") .author("Sebastian Thiel ") - .version("1.0.8+20180919") + .version("1.0.8+20190329") .about("Public API for managing Manufacturer Center related data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_manufacturers1_cli") .arg(Arg::with_name("url") diff --git a/gen/manufacturers1/Cargo.toml b/gen/manufacturers1/Cargo.toml index fa83e0ae29..f1652ee2d9 100644 --- a/gen/manufacturers1/Cargo.toml +++ b/gen/manufacturers1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-manufacturers1" -version = "1.0.8+20180919" +version = "1.0.8+20190329" authors = ["Sebastian Thiel "] description = "A complete library to interact with Manufacturer Center (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/manufacturers1" homepage = "https://developers.google.com/manufacturers/" -documentation = "https://docs.rs/google-manufacturers1/1.0.8+20180919" +documentation = "https://docs.rs/google-manufacturers1/1.0.8+20190329" license = "MIT" keywords = ["manufacturers", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/manufacturers1/README.md b/gen/manufacturers1/README.md index e84fc7f59e..c17afb8fff 100644 --- a/gen/manufacturers1/README.md +++ b/gen/manufacturers1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-manufacturers1` library allows access to all features of the *Google Manufacturer Center* service. -This documentation was generated from *Manufacturer Center* crate version *1.0.8+20180919*, where *20180919* is the exact revision of the *manufacturers:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Manufacturer Center* crate version *1.0.8+20190329*, where *20190329* is the exact revision of the *manufacturers:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Manufacturer Center* *v1* API can be found at the [official documentation site](https://developers.google.com/manufacturers/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/struct.ManufacturerCenter.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/struct.ManufacturerCenter.html) ... * accounts - * [*products delete*](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/struct.AccountProductDeleteCall.html), [*products get*](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/struct.AccountProductGetCall.html), [*products list*](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/struct.AccountProductListCall.html) and [*products update*](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/struct.AccountProductUpdateCall.html) + * [*products delete*](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/struct.AccountProductDeleteCall.html), [*products get*](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/struct.AccountProductGetCall.html), [*products list*](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/struct.AccountProductListCall.html) and [*products update*](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/struct.AccountProductUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/struct.ManufacturerCenter.html)** +* **[Hub](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/struct.ManufacturerCenter.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.Part.html)** + * **[Parts](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -131,17 +131,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -151,29 +151,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-manufacturers1/1.0.8+20180919/google_manufacturers1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-manufacturers1/1.0.8+20190329/google_manufacturers1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/manufacturers1/src/lib.rs b/gen/manufacturers1/src/lib.rs index 5e1dd706c9..52d5293510 100644 --- a/gen/manufacturers1/src/lib.rs +++ b/gen/manufacturers1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Manufacturer Center* crate version *1.0.8+20180919*, where *20180919* is the exact revision of the *manufacturers:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Manufacturer Center* crate version *1.0.8+20190329*, where *20190329* is the exact revision of the *manufacturers:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Manufacturer Center* *v1* API can be found at the //! [official documentation site](https://developers.google.com/manufacturers/). @@ -378,10 +378,10 @@ impl<'a, C, A> ManufacturerCenter /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Count { - /// The numeric value of the number of products in a package. - pub value: Option, /// The unit in which these products are counted. pub unit: Option, + /// The numeric value of the number of products in a package. + pub value: Option, } impl Part for Count {} @@ -445,10 +445,10 @@ impl ResponseResult for Product {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Capacity { - /// The numeric value of the capacity. - pub value: Option, /// The unit of the capacity, i.e., MB, GB, or TB. pub unit: Option, + /// The numeric value of the capacity. + pub value: Option, } impl Part for Capacity {} @@ -477,25 +477,19 @@ pub struct Image { impl Part for Image {} -/// A product detail of the product. For more information, see -/// https://support.google.com/manufacturers/answer/6124116#productdetail. +/// The destination status. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ProductDetail { - /// The name of the attribute. - #[serde(rename="attributeName")] - pub attribute_name: Option, - /// The value of the attribute. - #[serde(rename="attributeValue")] - pub attribute_value: Option, - /// A short section name that can be reused between multiple product details. - #[serde(rename="sectionName")] - pub section_name: Option, +pub struct DestinationStatus { + /// The status of the destination. + pub status: Option, + /// The name of the destination. + pub destination: Option, } -impl Part for ProductDetail {} +impl Part for DestinationStatus {} /// There is no detailed description. @@ -537,19 +531,25 @@ pub struct FeatureDescription { impl Part for FeatureDescription {} -/// The destination status. +/// A product detail of the product. For more information, see +/// https://support.google.com/manufacturers/answer/6124116#productdetail. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DestinationStatus { - /// The status of the destination. - pub status: Option, - /// The name of the destination. - pub destination: Option, +pub struct ProductDetail { + /// The name of the attribute. + #[serde(rename="attributeName")] + pub attribute_name: Option, + /// The value of the attribute. + #[serde(rename="attributeValue")] + pub attribute_value: Option, + /// A short section name that can be reused between multiple product details. + #[serde(rename="sectionName")] + pub section_name: Option, } -impl Part for DestinationStatus {} +impl Part for ProductDetail {} /// Attributes of the product. For more information, see @@ -580,10 +580,9 @@ pub struct Attributes { /// https://support.google.com/manufacturers/answer/6124116#itemgroupid. #[serde(rename="itemGroupId")] pub item_group_id: Option, - /// The videos of the product. For more information, see - /// https://support.google.com/manufacturers/answer/6124116#video. - #[serde(rename="videoLink")] - pub video_link: Option>, + /// The Global Trade Item Number (GTIN) of the product. For more information, + /// see https://support.google.com/manufacturers/answer/6124116#gtin. + pub gtin: Option>, /// A list of excluded destinations. #[serde(rename="excludedDestination")] pub excluded_destination: Option>, @@ -619,10 +618,10 @@ pub struct Attributes { /// The theme of the product. For more information, see /// https://support.google.com/manufacturers/answer/6124116#theme. pub theme: Option, - /// The suggested retail price (MSRP) of the product. For more information, - /// see https://support.google.com/manufacturers/answer/6124116#price. - #[serde(rename="suggestedRetailPrice")] - pub suggested_retail_price: Option, + /// The details of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#productdetail. + #[serde(rename="productDetail")] + pub product_detail: Option>, /// A list of included destinations. #[serde(rename="includedDestination")] pub included_destination: Option>, @@ -638,10 +637,10 @@ pub struct Attributes { /// The brand name of the product. For more information, see /// https://support.google.com/manufacturers/answer/6124116#brand. pub brand: Option, - /// The details of the product. For more information, see - /// https://support.google.com/manufacturers/answer/6124116#productdetail. - #[serde(rename="productDetail")] - pub product_detail: Option>, + /// The suggested retail price (MSRP) of the product. For more information, + /// see https://support.google.com/manufacturers/answer/6124116#price. + #[serde(rename="suggestedRetailPrice")] + pub suggested_retail_price: Option, /// The canonical name of the product. For more information, see /// https://support.google.com/manufacturers/answer/6124116#productname. #[serde(rename="productName")] @@ -680,9 +679,10 @@ pub struct Attributes { /// https://support.google.com/manufacturers/answer/6124116#producttype. #[serde(rename="productType")] pub product_type: Option>, - /// The Global Trade Item Number (GTIN) of the product. For more information, - /// see https://support.google.com/manufacturers/answer/6124116#gtin. - pub gtin: Option>, + /// The videos of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#video. + #[serde(rename="videoLink")] + pub video_link: Option>, /// The target age group of the product. For more information, see /// https://support.google.com/manufacturers/answer/6124116#agegroup. #[serde(rename="ageGroup")] @@ -698,10 +698,6 @@ impl RequestValue for Attributes {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Issue { - /// The server-generated type of the issue, for example, - /// “INCORRECT_TEXT_FORMATTING”, “IMAGE_NOT_SERVEABLE”, etc. - #[serde(rename="type")] - pub type_: Option, /// Longer description of the issue focused on how to resolve it. pub description: Option, /// Short title describing the nature of the issue. @@ -712,10 +708,14 @@ pub struct Issue { pub attribute: Option, /// The destination this issue applies to. pub destination: Option, - /// The timestamp when this issue appeared. - pub timestamp: Option, /// What needs to happen to resolve the issue. pub resolution: Option, + /// The timestamp when this issue appeared. + pub timestamp: Option, + /// The server-generated type of the issue, for example, + /// “INCORRECT_TEXT_FORMATTING”, “IMAGE_NOT_SERVEABLE”, etc. + #[serde(rename="type")] + pub type_: Option, /// The severity of the issue. pub severity: Option, } @@ -869,6 +869,32 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes the product from a Manufacturer Center account. + /// + /// # Arguments + /// + /// * `parent` - Parent ID in the format `accounts/{account_id}`. + /// `account_id` - The ID of the Manufacturer Center account. + /// * `name` - Name in the format `{target_country}:{content_language}:{product_id}`. + /// `target_country` - The target country of the product as a CLDR territory + /// code (for example, US). + /// `content_language` - The content language of the product as a two-letter + /// ISO 639-1 language code (for example, en). + /// `product_id` - The ID of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#id. + pub fn products_delete(&self, parent: &str, name: &str) -> AccountProductDeleteCall<'a, C, A> { + AccountProductDeleteCall { + hub: self.hub, + _parent: parent.to_string(), + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Gets the product from a Manufacturer Center account, including product @@ -901,32 +927,6 @@ impl<'a, C, A> AccountMethods<'a, C, A> { _additional_params: Default::default(), } } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the product from a Manufacturer Center account. - /// - /// # Arguments - /// - /// * `parent` - Parent ID in the format `accounts/{account_id}`. - /// `account_id` - The ID of the Manufacturer Center account. - /// * `name` - Name in the format `{target_country}:{content_language}:{product_id}`. - /// `target_country` - The target country of the product as a CLDR territory - /// code (for example, US). - /// `content_language` - The content language of the product as a two-letter - /// ISO 639-1 language code (for example, en). - /// `product_id` - The ID of the product. For more information, see - /// https://support.google.com/manufacturers/answer/6124116#id. - pub fn products_delete(&self, parent: &str, name: &str) -> AccountProductDeleteCall<'a, C, A> { - AccountProductDeleteCall { - hub: self.hub, - _parent: parent.to_string(), - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } } @@ -1040,7 +1040,7 @@ impl<'a, C, A> AccountProductListCall<'a, C, A> where C: BorrowMut AccountProductListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1079,7 +1076,7 @@ impl<'a, C, A> AccountProductListCall<'a, C, A> where C: BorrowMut AccountProductListCall<'a, C, A> where C: BorrowMut AccountProductUpdateCall<'a, C, A> where C: BorrowMut AccountProductUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1391,7 +1385,7 @@ impl<'a, C, A> AccountProductUpdateCall<'a, C, A> where C: BorrowMut AccountProductUpdateCall<'a, C, A> where C: BorrowMut AccountProductUpdateCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = ManufacturerCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().products_delete("parent", "name") +/// .doit(); +/// # } +/// ``` +pub struct AccountProductDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ManufacturerCenter, + _parent: String, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountProductDeleteCall<'a, C, A> {} + +impl<'a, C, A> AccountProductDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "manufacturers.accounts.products.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "parent", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/products/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Manufacturercenter.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent"), ("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["name", "parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Parent ID in the format `accounts/{account_id}`. + /// + /// `account_id` - The ID of the Manufacturer Center account. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> AccountProductDeleteCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Name in the format `{target_country}:{content_language}:{product_id}`. + /// + /// `target_country` - The target country of the product as a CLDR territory + /// code (for example, US). + /// + /// `content_language` - The content language of the product as a two-letter + /// ISO 639-1 language code (for example, en). + /// + /// `product_id` - The ID of the product. For more information, see + /// https://support.google.com/manufacturers/answer/6124116#id. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> AccountProductDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountProductDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AccountProductDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Manufacturercenter`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountProductDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Gets the product from a Manufacturer Center account, including product /// issues. /// @@ -1584,7 +1849,7 @@ impl<'a, C, A> AccountProductUpdateCall<'a, C, A> where C: BorrowMut AccountProductGetCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1667,10 +1932,7 @@ impl<'a, C, A> AccountProductGetCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1690,7 +1952,7 @@ impl<'a, C, A> AccountProductGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1798,7 +2060,7 @@ impl<'a, C, A> AccountProductGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1846,277 +2108,3 @@ impl<'a, C, A> AccountProductGetCall<'a, C, A> where C: BorrowMut } -/// Deletes the product from a Manufacturer Center account. -/// -/// A builder for the *products.delete* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_manufacturers1 as manufacturers1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use manufacturers1::ManufacturerCenter; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = ManufacturerCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().products_delete("parent", "name") -/// .doit(); -/// # } -/// ``` -pub struct AccountProductDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a ManufacturerCenter, - _parent: String, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AccountProductDeleteCall<'a, C, A> {} - -impl<'a, C, A> AccountProductDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "manufacturers.accounts.products.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - params.push(("name", self._name.to_string())); - for &field in ["alt", "parent", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/{+parent}/products/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Manufacturercenter.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+parent}", "parent"), ("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["name", "parent"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Parent ID in the format `accounts/{account_id}`. - /// - /// `account_id` - The ID of the Manufacturer Center account. - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> AccountProductDeleteCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Name in the format `{target_country}:{content_language}:{product_id}`. - /// - /// `target_country` - The target country of the product as a CLDR territory - /// code (for example, US). - /// - /// `content_language` - The content language of the product as a two-letter - /// ISO 639-1 language code (for example, en). - /// - /// `product_id` - The ID of the product. For more information, see - /// https://support.google.com/manufacturers/answer/6124116#id. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> AccountProductDeleteCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountProductDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AccountProductDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Manufacturercenter`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountProductDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - diff --git a/gen/mirror1-cli/Cargo.toml b/gen/mirror1-cli/Cargo.toml index c1a5065f04..e27a15fd5a 100644 --- a/gen/mirror1-cli/Cargo.toml +++ b/gen/mirror1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-mirror1-cli" -version = "1.0.8+20181004" +version = "1.0.8+20181120" authors = ["Sebastian Thiel "] description = "A complete library to interact with mirror (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/mirror1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-mirror1] path = "../mirror1" -version = "1.0.8+20181004" +version = "1.0.8+20181120" diff --git a/gen/mirror1-cli/README.md b/gen/mirror1-cli/README.md index 114c8b13e9..affe8058cf 100644 --- a/gen/mirror1-cli/README.md +++ b/gen/mirror1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *mirror* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *mirror* API at revision *20181120*. The CLI is at version *1.0.8*. ```bash mirror1 [options] diff --git a/gen/mirror1-cli/mkdocs.yml b/gen/mirror1-cli/mkdocs.yml index f5c44350f3..45cd3029ea 100644 --- a/gen/mirror1-cli/mkdocs.yml +++ b/gen/mirror1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: mirror v1.0.8+20181004 +site_name: mirror v1.0.8+20181120 site_url: http://byron.github.io/google-apis-rs/google-mirror1-cli site_description: A complete library to interact with mirror (protocol v1) diff --git a/gen/mirror1-cli/src/main.rs b/gen/mirror1-cli/src/main.rs index 06d67df85b..098795b16f 100644 --- a/gen/mirror1-cli/src/main.rs +++ b/gen/mirror1-cli/src/main.rs @@ -2564,7 +2564,7 @@ fn main() { let mut app = App::new("mirror1") .author("Sebastian Thiel ") - .version("1.0.8+20181004") + .version("1.0.8+20181120") .about("Interacts with Glass users via the timeline.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_mirror1_cli") .arg(Arg::with_name("url") diff --git a/gen/mirror1/Cargo.toml b/gen/mirror1/Cargo.toml index d1e3c24b6e..49bc595deb 100644 --- a/gen/mirror1/Cargo.toml +++ b/gen/mirror1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-mirror1" -version = "1.0.8+20181004" +version = "1.0.8+20181120" authors = ["Sebastian Thiel "] description = "A complete library to interact with mirror (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/mirror1" homepage = "https://developers.google.com/glass" -documentation = "https://docs.rs/google-mirror1/1.0.8+20181004" +documentation = "https://docs.rs/google-mirror1/1.0.8+20181120" license = "MIT" keywords = ["mirror", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/mirror1/README.md b/gen/mirror1/README.md index 2b99114174..a8e426b422 100644 --- a/gen/mirror1/README.md +++ b/gen/mirror1/README.md @@ -5,37 +5,37 @@ DO NOT EDIT ! --> The `google-mirror1` library allows access to all features of the *Google mirror* service. -This documentation was generated from *mirror* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *mirror* crate version *1.0.8+20181120*, where *20181120* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *mirror* *v1* API can be found at the [official documentation site](https://developers.google.com/glass). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.Mirror.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.Mirror.html) ... -* [accounts](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.Account.html) - * [*insert*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.AccountInsertCall.html) -* [contacts](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.Contact.html) - * [*delete*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.ContactDeleteCall.html), [*get*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.ContactGetCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.ContactInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.ContactListCall.html), [*patch*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.ContactPatchCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.ContactUpdateCall.html) -* [locations](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.Location.html) - * [*get*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.LocationGetCall.html) and [*list*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.LocationListCall.html) -* [settings](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.Setting.html) - * [*get*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.SettingGetCall.html) -* [subscriptions](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.Subscription.html) - * [*delete*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.SubscriptionDeleteCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.SubscriptionInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.SubscriptionListCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.SubscriptionUpdateCall.html) +* [accounts](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.Account.html) + * [*insert*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.AccountInsertCall.html) +* [contacts](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.Contact.html) + * [*delete*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.ContactDeleteCall.html), [*get*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.ContactGetCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.ContactInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.ContactListCall.html), [*patch*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.ContactPatchCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.ContactUpdateCall.html) +* [locations](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.Location.html) + * [*get*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.LocationGetCall.html) and [*list*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.LocationListCall.html) +* [settings](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.Setting.html) + * [*get*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.SettingGetCall.html) +* [subscriptions](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.Subscription.html) + * [*delete*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.SubscriptionDeleteCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.SubscriptionInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.SubscriptionListCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.SubscriptionUpdateCall.html) * timeline - * [*attachments delete*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineAttachmentDeleteCall.html), [*attachments get*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineAttachmentGetCall.html), [*attachments insert*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineAttachmentInsertCall.html), [*attachments list*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineAttachmentListCall.html), [*delete*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineDeleteCall.html), [*get*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineGetCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineListCall.html), [*patch*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelinePatchCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineUpdateCall.html) + * [*attachments delete*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineAttachmentDeleteCall.html), [*attachments get*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineAttachmentGetCall.html), [*attachments insert*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineAttachmentInsertCall.html), [*attachments list*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineAttachmentListCall.html), [*delete*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineDeleteCall.html), [*get*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineGetCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineListCall.html), [*patch*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelinePatchCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineUpdateCall.html) Upload supported by ... -* [*update timeline*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineUpdateCall.html) -* [*insert timeline*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineInsertCall.html) -* [*attachments insert timeline*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineAttachmentInsertCall.html) +* [*update timeline*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineUpdateCall.html) +* [*insert timeline*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineInsertCall.html) +* [*attachments insert timeline*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineAttachmentInsertCall.html) Download supported by ... -* [*attachments get timeline*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.TimelineAttachmentGetCall.html) +* [*attachments get timeline*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.TimelineAttachmentGetCall.html) @@ -43,17 +43,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/struct.Mirror.html)** +* **[Hub](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/struct.Mirror.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.Part.html)** + * **[Parts](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -155,17 +155,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -175,29 +175,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-mirror1/1.0.8+20181004/google_mirror1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-mirror1/1.0.8+20181120/google_mirror1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/mirror1/src/lib.rs b/gen/mirror1/src/lib.rs index 43b74853a2..594e5aa067 100644 --- a/gen/mirror1/src/lib.rs +++ b/gen/mirror1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *mirror* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *mirror* crate version *1.0.8+20181120*, where *20181120* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *mirror* *v1* API can be found at the //! [official documentation site](https://developers.google.com/glass). @@ -1800,10 +1800,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1835,7 +1832,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2079,7 +2073,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2331,7 +2322,7 @@ impl<'a, C, A> SubscriptionUpdateCall<'a, C, A> where C: BorrowMut SubscriptionUpdateCall<'a, C, A> where C: BorrowMut SubscriptionListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2563,7 +2551,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2631,7 +2619,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2773,10 +2761,7 @@ impl<'a, C, A> TimelineAttachmentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2796,7 +2781,7 @@ impl<'a, C, A> TimelineAttachmentListCall<'a, C, A> where C: BorrowMut TimelineAttachmentListCall<'a, C, A> where C: BorrowMut TimelineInsertCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3074,7 +3056,7 @@ impl<'a, C, A> TimelineInsertCall<'a, C, A> where C: BorrowMut, A _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -3229,7 +3211,7 @@ impl<'a, C, A> TimelineInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3378,10 +3360,7 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3413,7 +3392,7 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3503,7 +3482,7 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3657,10 +3636,7 @@ impl<'a, C, A> TimelineListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3680,7 +3656,7 @@ impl<'a, C, A> TimelineListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3797,7 +3773,7 @@ impl<'a, C, A> TimelineListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3949,10 +3925,7 @@ impl<'a, C, A> TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -3985,7 +3958,7 @@ impl<'a, C, A> TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4315,7 +4285,7 @@ impl<'a, C, A> TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut TimelineDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4557,7 +4524,7 @@ impl<'a, C, A> TimelineDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4625,7 +4592,7 @@ impl<'a, C, A> TimelineDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4784,10 +4751,7 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4848,7 +4812,7 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -5013,7 +4977,7 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5178,10 +5142,7 @@ impl<'a, C, A> TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5201,7 +5162,7 @@ impl<'a, C, A> TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut TimelineGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5454,7 +5412,7 @@ impl<'a, C, A> TimelineGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5532,7 +5490,7 @@ impl<'a, C, A> TimelineGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5674,10 +5632,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5697,7 +5652,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5777,7 +5732,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5919,10 +5874,7 @@ impl<'a, C, A> LocationGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5942,7 +5894,7 @@ impl<'a, C, A> LocationGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6020,7 +5972,7 @@ impl<'a, C, A> LocationGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6139,10 +6091,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6162,7 +6111,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6230,7 +6179,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6391,10 +6340,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6413,7 +6359,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -6522,7 +6468,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6641,10 +6587,7 @@ impl<'a, C, A> ContactGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6664,7 +6607,7 @@ impl<'a, C, A> ContactGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6742,7 +6685,7 @@ impl<'a, C, A> ContactGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6883,10 +6826,7 @@ impl<'a, C, A> ContactDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6906,7 +6846,7 @@ impl<'a, C, A> ContactDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6974,7 +6914,7 @@ impl<'a, C, A> ContactDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7100,10 +7040,7 @@ impl<'a, C, A> ContactInsertCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7135,7 +7072,7 @@ impl<'a, C, A> ContactInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7215,7 +7152,7 @@ impl<'a, C, A> ContactInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7364,10 +7301,7 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7399,7 +7333,7 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7489,7 +7423,7 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7608,10 +7542,7 @@ impl<'a, C, A> ContactListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7631,7 +7562,7 @@ impl<'a, C, A> ContactListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7699,7 +7630,7 @@ impl<'a, C, A> ContactListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7848,10 +7779,7 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7883,7 +7811,7 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7973,7 +7901,7 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/ml1-cli/Cargo.toml b/gen/ml1-cli/Cargo.toml index 5f54fb671e..bb9f596269 100644 --- a/gen/ml1-cli/Cargo.toml +++ b/gen/ml1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-ml1-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190325" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Machine Learning Engine (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/ml1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-ml1] path = "../ml1" -version = "1.0.8+20181009" +version = "1.0.8+20190325" diff --git a/gen/ml1-cli/README.md b/gen/ml1-cli/README.md index 41443aed31..6069d9abe3 100644 --- a/gen/ml1-cli/README.md +++ b/gen/ml1-cli/README.md @@ -25,10 +25,12 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Machine Learning Engine* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Machine Learning Engine* API at revision *20190325*. The CLI is at version *1.0.8*. ```bash ml1 [options] + operations + delete [-p ]... [-o ] projects get-config [-p ]... [-o ] jobs-cancel (-r )... [-p ]... [-o ] @@ -56,7 +58,6 @@ ml1 [options] models-versions-patch (-r )... [-p ]... [-o ] models-versions-set-default (-r )... [-p ]... [-o ] operations-cancel [-p ]... [-o ] - operations-delete [-p ]... [-o ] operations-get [-p ]... [-o ] operations-list [-p ]... [-o ] predict (-r )... [-p ]... [-o ] diff --git a/gen/ml1-cli/mkdocs.yml b/gen/ml1-cli/mkdocs.yml index 5b8f34dbed..ef4ce84cff 100644 --- a/gen/ml1-cli/mkdocs.yml +++ b/gen/ml1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Machine Learning Engine v1.0.8+20181009 +site_name: Cloud Machine Learning Engine v1.0.8+20190325 site_url: http://byron.github.io/google-apis-rs/google-ml1-cli site_description: A complete library to interact with Cloud Machine Learning Engine (protocol v1) @@ -9,6 +9,7 @@ site_dir: build_html pages: - ['index.md', 'Home'] +- ['operations_delete.md', 'Operations', 'Delete'] - ['projects_get-config.md', 'Projects', 'Get Config'] - ['projects_jobs-cancel.md', 'Projects', 'Jobs Cancel'] - ['projects_jobs-create.md', 'Projects', 'Jobs Create'] @@ -35,7 +36,6 @@ pages: - ['projects_models-versions-patch.md', 'Projects', 'Models Versions Patch'] - ['projects_models-versions-set-default.md', 'Projects', 'Models Versions Set Default'] - ['projects_operations-cancel.md', 'Projects', 'Operations Cancel'] -- ['projects_operations-delete.md', 'Projects', 'Operations Delete'] - ['projects_operations-get.md', 'Projects', 'Operations Get'] - ['projects_operations-list.md', 'Projects', 'Operations List'] - ['projects_predict.md', 'Projects', 'Predict'] diff --git a/gen/ml1-cli/src/main.rs b/gen/ml1-cli/src/main.rs index 3bf08195ec..70f31b5163 100644 --- a/gen/ml1-cli/src/main.rs +++ b/gen/ml1-cli/src/main.rs @@ -46,6 +46,58 @@ struct Engine<'n> { impl<'n> Engine<'n> { + fn _operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operations().delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_get_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().get_config(opt.value_of("name").unwrap_or("")); @@ -206,13 +258,42 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "error-message" => Some(("errorMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job-id" => Some(("jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-output.is-built-in-algorithm-job" => Some(("trainingOutput.isBuiltInAlgorithmJob", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "training-output.completed-trial-count" => Some(("trainingOutput.completedTrialCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "training-output.is-hyperparameter-tuning-job" => Some(("trainingOutput.isHyperparameterTuningJob", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "training-output.built-in-algorithm-output.framework" => Some(("trainingOutput.builtInAlgorithmOutput.framework", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-output.built-in-algorithm-output.model-path" => Some(("trainingOutput.builtInAlgorithmOutput.modelPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-output.built-in-algorithm-output.runtime-version" => Some(("trainingOutput.builtInAlgorithmOutput.runtimeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-output.built-in-algorithm-output.python-version" => Some(("trainingOutput.builtInAlgorithmOutput.pythonVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-output.consumed-ml-units" => Some(("trainingOutput.consumedMLUnits", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.model-name" => Some(("predictionInput.modelName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.signature-name" => Some(("predictionInput.signatureName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.runtime-version" => Some(("predictionInput.runtimeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.batch-size" => Some(("predictionInput.batchSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.max-worker-count" => Some(("predictionInput.maxWorkerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "prediction-input.uri" => Some(("predictionInput.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.output-path" => Some(("predictionInput.outputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.data-format" => Some(("predictionInput.dataFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.version-name" => Some(("predictionInput.versionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.region" => Some(("predictionInput.region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.input-paths" => Some(("predictionInput.inputPaths", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "prediction-input.output-data-format" => Some(("predictionInput.outputDataFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.worker-type" => Some(("trainingInput.workerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.parameter-server-config.accelerator-config.count" => Some(("trainingInput.parameterServerConfig.acceleratorConfig.count", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.parameter-server-config.accelerator-config.type" => Some(("trainingInput.parameterServerConfig.acceleratorConfig.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.parameter-server-config.image-uri" => Some(("trainingInput.parameterServerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.runtime-version" => Some(("trainingInput.runtimeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.scale-tier" => Some(("trainingInput.scaleTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.master-type" => Some(("trainingInput.masterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.hyperparameters.max-trials" => Some(("trainingInput.hyperparameters.maxTrials", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "training-input.hyperparameters.goal" => Some(("trainingInput.hyperparameters.goal", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.hyperparameters.algorithm" => Some(("trainingInput.hyperparameters.algorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.hyperparameters.max-failed-trials" => Some(("trainingInput.hyperparameters.maxFailedTrials", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "training-input.hyperparameters.enable-trial-early-stopping" => Some(("trainingInput.hyperparameters.enableTrialEarlyStopping", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "training-input.hyperparameters.resume-previous-job-id" => Some(("trainingInput.hyperparameters.resumePreviousJobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.hyperparameters.hyperparameter-metric-tag" => Some(("trainingInput.hyperparameters.hyperparameterMetricTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -225,37 +306,21 @@ impl<'n> Engine<'n> { "training-input.package-uris" => Some(("trainingInput.packageUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "training-input.worker-count" => Some(("trainingInput.workerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "training-input.parameter-server-type" => Some(("trainingInput.parameterServerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.worker-config.accelerator-config.count" => Some(("trainingInput.workerConfig.acceleratorConfig.count", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.worker-config.accelerator-config.type" => Some(("trainingInput.workerConfig.acceleratorConfig.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.worker-config.image-uri" => Some(("trainingInput.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.master-config.accelerator-config.count" => Some(("trainingInput.masterConfig.acceleratorConfig.count", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.master-config.accelerator-config.type" => Some(("trainingInput.masterConfig.acceleratorConfig.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.master-config.image-uri" => Some(("trainingInput.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.parameter-server-count" => Some(("trainingInput.parameterServerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "job-id" => Some(("jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "training-output.completed-trial-count" => Some(("trainingOutput.completedTrialCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "training-output.is-hyperparameter-tuning-job" => Some(("trainingOutput.isHyperparameterTuningJob", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "training-output.consumed-ml-units" => Some(("trainingOutput.consumedMLUnits", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.model-name" => Some(("predictionInput.modelName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.runtime-version" => Some(("predictionInput.runtimeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.signature-name" => Some(("predictionInput.signatureName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.batch-size" => Some(("predictionInput.batchSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.max-worker-count" => Some(("predictionInput.maxWorkerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "prediction-input.uri" => Some(("predictionInput.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.accelerator.count" => Some(("predictionInput.accelerator.count", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.accelerator.type" => Some(("predictionInput.accelerator.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.output-path" => Some(("predictionInput.outputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.data-format" => Some(("predictionInput.dataFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.version-name" => Some(("predictionInput.versionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.region" => Some(("predictionInput.region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.input-paths" => Some(("predictionInput.inputPaths", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "prediction-input.output-data-format" => Some(("predictionInput.outputDataFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-output.output-path" => Some(("predictionOutput.outputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "prediction-output.node-hours" => Some(("predictionOutput.nodeHours", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "prediction-output.output-path" => Some(("predictionOutput.outputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "prediction-output.prediction-count" => Some(("predictionOutput.predictionCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "prediction-output.error-count" => Some(("predictionOutput.errorCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["accelerator", "algorithm", "args", "batch-size", "completed-trial-count", "consumed-ml-units", "count", "create-time", "data-format", "enable-trial-early-stopping", "end-time", "error-count", "error-message", "etag", "goal", "hyperparameter-metric-tag", "hyperparameters", "input-paths", "is-hyperparameter-tuning-job", "job-dir", "job-id", "labels", "master-type", "max-parallel-trials", "max-trials", "max-worker-count", "model-name", "node-hours", "output-data-format", "output-path", "package-uris", "parameter-server-count", "parameter-server-type", "prediction-count", "prediction-input", "prediction-output", "python-module", "python-version", "region", "resume-previous-job-id", "runtime-version", "scale-tier", "signature-name", "start-time", "state", "training-input", "training-output", "type", "uri", "version-name", "worker-count", "worker-type"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["accelerator-config", "algorithm", "args", "batch-size", "built-in-algorithm-output", "completed-trial-count", "consumed-ml-units", "count", "create-time", "data-format", "enable-trial-early-stopping", "end-time", "error-count", "error-message", "etag", "framework", "goal", "hyperparameter-metric-tag", "hyperparameters", "image-uri", "input-paths", "is-built-in-algorithm-job", "is-hyperparameter-tuning-job", "job-dir", "job-id", "labels", "master-config", "master-type", "max-failed-trials", "max-parallel-trials", "max-trials", "max-worker-count", "model-name", "model-path", "node-hours", "output-data-format", "output-path", "package-uris", "parameter-server-config", "parameter-server-count", "parameter-server-type", "prediction-count", "prediction-input", "prediction-output", "python-module", "python-version", "region", "resume-previous-job-id", "runtime-version", "scale-tier", "signature-name", "start-time", "state", "training-input", "training-output", "type", "uri", "version-name", "worker-config", "worker-count", "worker-type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -505,13 +570,42 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "error-message" => Some(("errorMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "job-id" => Some(("jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-output.is-built-in-algorithm-job" => Some(("trainingOutput.isBuiltInAlgorithmJob", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "training-output.completed-trial-count" => Some(("trainingOutput.completedTrialCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "training-output.is-hyperparameter-tuning-job" => Some(("trainingOutput.isHyperparameterTuningJob", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "training-output.built-in-algorithm-output.framework" => Some(("trainingOutput.builtInAlgorithmOutput.framework", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-output.built-in-algorithm-output.model-path" => Some(("trainingOutput.builtInAlgorithmOutput.modelPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-output.built-in-algorithm-output.runtime-version" => Some(("trainingOutput.builtInAlgorithmOutput.runtimeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-output.built-in-algorithm-output.python-version" => Some(("trainingOutput.builtInAlgorithmOutput.pythonVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-output.consumed-ml-units" => Some(("trainingOutput.consumedMLUnits", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.model-name" => Some(("predictionInput.modelName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.signature-name" => Some(("predictionInput.signatureName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.runtime-version" => Some(("predictionInput.runtimeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.batch-size" => Some(("predictionInput.batchSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.max-worker-count" => Some(("predictionInput.maxWorkerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "prediction-input.uri" => Some(("predictionInput.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.output-path" => Some(("predictionInput.outputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.data-format" => Some(("predictionInput.dataFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.version-name" => Some(("predictionInput.versionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.region" => Some(("predictionInput.region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "prediction-input.input-paths" => Some(("predictionInput.inputPaths", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "prediction-input.output-data-format" => Some(("predictionInput.outputDataFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.worker-type" => Some(("trainingInput.workerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.parameter-server-config.accelerator-config.count" => Some(("trainingInput.parameterServerConfig.acceleratorConfig.count", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.parameter-server-config.accelerator-config.type" => Some(("trainingInput.parameterServerConfig.acceleratorConfig.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.parameter-server-config.image-uri" => Some(("trainingInput.parameterServerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.runtime-version" => Some(("trainingInput.runtimeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.scale-tier" => Some(("trainingInput.scaleTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.master-type" => Some(("trainingInput.masterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.hyperparameters.max-trials" => Some(("trainingInput.hyperparameters.maxTrials", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "training-input.hyperparameters.goal" => Some(("trainingInput.hyperparameters.goal", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.hyperparameters.algorithm" => Some(("trainingInput.hyperparameters.algorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.hyperparameters.max-failed-trials" => Some(("trainingInput.hyperparameters.maxFailedTrials", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "training-input.hyperparameters.enable-trial-early-stopping" => Some(("trainingInput.hyperparameters.enableTrialEarlyStopping", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "training-input.hyperparameters.resume-previous-job-id" => Some(("trainingInput.hyperparameters.resumePreviousJobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.hyperparameters.hyperparameter-metric-tag" => Some(("trainingInput.hyperparameters.hyperparameterMetricTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -524,37 +618,21 @@ impl<'n> Engine<'n> { "training-input.package-uris" => Some(("trainingInput.packageUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "training-input.worker-count" => Some(("trainingInput.workerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "training-input.parameter-server-type" => Some(("trainingInput.parameterServerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.worker-config.accelerator-config.count" => Some(("trainingInput.workerConfig.acceleratorConfig.count", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.worker-config.accelerator-config.type" => Some(("trainingInput.workerConfig.acceleratorConfig.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.worker-config.image-uri" => Some(("trainingInput.workerConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.master-config.accelerator-config.count" => Some(("trainingInput.masterConfig.acceleratorConfig.count", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.master-config.accelerator-config.type" => Some(("trainingInput.masterConfig.acceleratorConfig.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "training-input.master-config.image-uri" => Some(("trainingInput.masterConfig.imageUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "training-input.parameter-server-count" => Some(("trainingInput.parameterServerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "job-id" => Some(("jobId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "training-output.completed-trial-count" => Some(("trainingOutput.completedTrialCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "training-output.is-hyperparameter-tuning-job" => Some(("trainingOutput.isHyperparameterTuningJob", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "training-output.consumed-ml-units" => Some(("trainingOutput.consumedMLUnits", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.model-name" => Some(("predictionInput.modelName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.runtime-version" => Some(("predictionInput.runtimeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.signature-name" => Some(("predictionInput.signatureName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.batch-size" => Some(("predictionInput.batchSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.max-worker-count" => Some(("predictionInput.maxWorkerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "prediction-input.uri" => Some(("predictionInput.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.accelerator.count" => Some(("predictionInput.accelerator.count", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.accelerator.type" => Some(("predictionInput.accelerator.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.output-path" => Some(("predictionInput.outputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.data-format" => Some(("predictionInput.dataFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.version-name" => Some(("predictionInput.versionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.region" => Some(("predictionInput.region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-input.input-paths" => Some(("predictionInput.inputPaths", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "prediction-input.output-data-format" => Some(("predictionInput.outputDataFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "prediction-output.output-path" => Some(("predictionOutput.outputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "prediction-output.node-hours" => Some(("predictionOutput.nodeHours", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "prediction-output.output-path" => Some(("predictionOutput.outputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "prediction-output.prediction-count" => Some(("predictionOutput.predictionCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "prediction-output.error-count" => Some(("predictionOutput.errorCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["accelerator", "algorithm", "args", "batch-size", "completed-trial-count", "consumed-ml-units", "count", "create-time", "data-format", "enable-trial-early-stopping", "end-time", "error-count", "error-message", "etag", "goal", "hyperparameter-metric-tag", "hyperparameters", "input-paths", "is-hyperparameter-tuning-job", "job-dir", "job-id", "labels", "master-type", "max-parallel-trials", "max-trials", "max-worker-count", "model-name", "node-hours", "output-data-format", "output-path", "package-uris", "parameter-server-count", "parameter-server-type", "prediction-count", "prediction-input", "prediction-output", "python-module", "python-version", "region", "resume-previous-job-id", "runtime-version", "scale-tier", "signature-name", "start-time", "state", "training-input", "training-output", "type", "uri", "version-name", "worker-count", "worker-type"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["accelerator-config", "algorithm", "args", "batch-size", "built-in-algorithm-output", "completed-trial-count", "consumed-ml-units", "count", "create-time", "data-format", "enable-trial-early-stopping", "end-time", "error-count", "error-message", "etag", "framework", "goal", "hyperparameter-metric-tag", "hyperparameters", "image-uri", "input-paths", "is-built-in-algorithm-job", "is-hyperparameter-tuning-job", "job-dir", "job-id", "labels", "master-config", "master-type", "max-failed-trials", "max-parallel-trials", "max-trials", "max-worker-count", "model-name", "model-path", "node-hours", "output-data-format", "output-path", "package-uris", "parameter-server-config", "parameter-server-count", "parameter-server-type", "prediction-count", "prediction-input", "prediction-output", "python-module", "python-version", "region", "resume-previous-job-id", "runtime-version", "scale-tier", "signature-name", "start-time", "state", "training-input", "training-output", "type", "uri", "version-name", "worker-config", "worker-count", "worker-type"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -925,6 +1003,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "online-prediction-console-logging" => Some(("onlinePredictionConsoleLogging", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "regions" => Some(("regions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -947,7 +1026,7 @@ impl<'n> Engine<'n> { "online-prediction-logging" => Some(("onlinePredictionLogging", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["auto-scaling", "create-time", "default-version", "deployment-uri", "description", "error-message", "etag", "framework", "is-default", "labels", "last-use-time", "machine-type", "manual-scaling", "min-nodes", "name", "nodes", "online-prediction-logging", "python-version", "regions", "runtime-version", "state"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["auto-scaling", "create-time", "default-version", "deployment-uri", "description", "error-message", "etag", "framework", "is-default", "labels", "last-use-time", "machine-type", "manual-scaling", "min-nodes", "name", "nodes", "online-prediction-console-logging", "online-prediction-logging", "python-version", "regions", "runtime-version", "state"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1249,6 +1328,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "online-prediction-console-logging" => Some(("onlinePredictionConsoleLogging", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "regions" => Some(("regions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1271,7 +1351,7 @@ impl<'n> Engine<'n> { "online-prediction-logging" => Some(("onlinePredictionLogging", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["auto-scaling", "create-time", "default-version", "deployment-uri", "description", "error-message", "etag", "framework", "is-default", "labels", "last-use-time", "machine-type", "manual-scaling", "min-nodes", "name", "nodes", "online-prediction-logging", "python-version", "regions", "runtime-version", "state"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["auto-scaling", "create-time", "default-version", "deployment-uri", "description", "error-message", "etag", "framework", "is-default", "labels", "last-use-time", "machine-type", "manual-scaling", "min-nodes", "name", "nodes", "online-prediction-console-logging", "online-prediction-logging", "python-version", "regions", "runtime-version", "state"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2013,58 +2093,6 @@ impl<'n> Engine<'n> { } } - fn _projects_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.projects().operations_delete(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _projects_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().operations_get(opt.value_of("name").unwrap_or("")); @@ -2202,8 +2230,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "http-body.content-type" => Some(("httpBody.contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-body.data" => Some(("httpBody.data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "http-body.content-type" => Some(("httpBody.contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["content-type", "data", "http-body"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -2270,6 +2298,17 @@ impl<'n> Engine<'n> { let mut call_result: Result<(), DoitError> = Ok(()); let mut err_opt: Option = None; match self.opt.subcommand() { + ("operations", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._operations_delete(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("projects", Some(opt)) => { match opt.subcommand() { ("get-config", Some(opt)) => { @@ -2350,9 +2389,6 @@ impl<'n> Engine<'n> { ("operations-cancel", Some(opt)) => { call_result = self._projects_operations_cancel(opt, dry_run, &mut err); }, - ("operations-delete", Some(opt)) => { - call_result = self._projects_operations_delete(opt, dry_run, &mut err); - }, ("operations-get", Some(opt)) => { call_result = self._projects_operations_get(opt, dry_run, &mut err); }, @@ -2453,7 +2489,35 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'get-config', 'jobs-cancel', 'jobs-create', 'jobs-get', 'jobs-get-iam-policy', 'jobs-list', 'jobs-patch', 'jobs-set-iam-policy', 'jobs-test-iam-permissions', 'locations-get', 'locations-list', 'models-create', 'models-delete', 'models-get', 'models-get-iam-policy', 'models-list', 'models-patch', 'models-set-iam-policy', 'models-test-iam-permissions', 'models-versions-create', 'models-versions-delete', 'models-versions-get', 'models-versions-list', 'models-versions-patch', 'models-versions-set-default', 'operations-cancel', 'operations-delete', 'operations-get', 'operations-list' and 'predict'", vec![ + ("operations", "methods: 'delete'", vec![ + ("delete", + Some(r##"Deletes a long-running operation. This method indicates that the client is + no longer interested in the operation result. It does not cancel the + operation. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`."##), + "Details at http://byron.github.io/google-apis-rs/google_ml1_cli/operations_delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be deleted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("projects", "methods: 'get-config', 'jobs-cancel', 'jobs-create', 'jobs-get', 'jobs-get-iam-policy', 'jobs-list', 'jobs-patch', 'jobs-set-iam-policy', 'jobs-test-iam-permissions', 'locations-get', 'locations-list', 'models-create', 'models-delete', 'models-get', 'models-get-iam-policy', 'models-list', 'models-patch', 'models-set-iam-policy', 'models-test-iam-permissions', 'models-versions-create', 'models-versions-delete', 'models-versions-get', 'models-versions-list', 'models-versions-patch', 'models-versions-set-default', 'operations-cancel', 'operations-get', 'operations-list' and 'predict'", vec![ ("get-config", Some(r##"Get the service account information associated with your project. You need this information in order to grant the service account permissions for @@ -3193,31 +3257,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("operations-delete", - Some(r##"Deletes a long-running operation. This method indicates that the client is - no longer interested in the operation result. It does not cancel the - operation. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`."##), - "Details at http://byron.github.io/google-apis-rs/google_ml1_cli/projects_operations-delete", - vec![ - (Some(r##"name"##), - None, - Some(r##"The name of the operation resource to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -3318,7 +3357,7 @@ fn main() { let mut app = App::new("ml1") .author("Sebastian Thiel ") - .version("1.0.8+20181009") + .version("1.0.8+20190325") .about("An API to enable creating and using machine learning models.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_ml1_cli") .arg(Arg::with_name("url") diff --git a/gen/ml1/Cargo.toml b/gen/ml1/Cargo.toml index 3ce10f6a27..21bfcd6333 100644 --- a/gen/ml1/Cargo.toml +++ b/gen/ml1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-ml1" -version = "1.0.8+20181009" +version = "1.0.8+20190325" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Machine Learning Engine (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/ml1" homepage = "https://cloud.google.com/ml/" -documentation = "https://docs.rs/google-ml1/1.0.8+20181009" +documentation = "https://docs.rs/google-ml1/1.0.8+20190325" license = "MIT" keywords = ["ml", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/ml1/README.md b/gen/ml1/README.md index f3d16ed3fd..3d82f64234 100644 --- a/gen/ml1/README.md +++ b/gen/ml1/README.md @@ -5,16 +5,18 @@ DO NOT EDIT ! --> The `google-ml1` library allows access to all features of the *Google Cloud Machine Learning Engine* service. -This documentation was generated from *Cloud Machine Learning Engine* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *ml:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Machine Learning Engine* crate version *1.0.8+20190325*, where *20190325* is the exact revision of the *ml:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Machine Learning Engine* *v1* API can be found at the [official documentation site](https://cloud.google.com/ml/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.CloudMachineLearningEngine.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.CloudMachineLearningEngine.html) ... +* operations + * [*delete*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.OperationDeleteCall.html) * projects - * [*get config*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectGetConfigCall.html), [*jobs cancel*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectJobCancelCall.html), [*jobs create*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectJobCreateCall.html), [*jobs get*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectJobGetCall.html), [*jobs get iam policy*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectJobGetIamPolicyCall.html), [*jobs list*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectJobListCall.html), [*jobs patch*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectJobPatchCall.html), [*jobs set iam policy*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectJobSetIamPolicyCall.html), [*jobs test iam permissions*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectJobTestIamPermissionCall.html), [*locations get*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectLocationListCall.html), [*models create*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelCreateCall.html), [*models delete*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelDeleteCall.html), [*models get*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelGetCall.html), [*models get iam policy*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelGetIamPolicyCall.html), [*models list*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelListCall.html), [*models patch*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelPatchCall.html), [*models set iam policy*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelSetIamPolicyCall.html), [*models test iam permissions*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelTestIamPermissionCall.html), [*models versions create*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelVersionCreateCall.html), [*models versions delete*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelVersionDeleteCall.html), [*models versions get*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelVersionGetCall.html), [*models versions list*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelVersionListCall.html), [*models versions patch*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelVersionPatchCall.html), [*models versions set default*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectModelVersionSetDefaultCall.html), [*operations cancel*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectOperationCancelCall.html), [*operations delete*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectOperationDeleteCall.html), [*operations get*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectOperationGetCall.html), [*operations list*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectOperationListCall.html) and [*predict*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.ProjectPredictCall.html) + * [*get config*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectGetConfigCall.html), [*jobs cancel*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectJobCancelCall.html), [*jobs create*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectJobCreateCall.html), [*jobs get*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectJobGetCall.html), [*jobs get iam policy*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectJobGetIamPolicyCall.html), [*jobs list*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectJobListCall.html), [*jobs patch*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectJobPatchCall.html), [*jobs set iam policy*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectJobSetIamPolicyCall.html), [*jobs test iam permissions*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectJobTestIamPermissionCall.html), [*locations get*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectLocationListCall.html), [*models create*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelCreateCall.html), [*models delete*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelDeleteCall.html), [*models get*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelGetCall.html), [*models get iam policy*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelGetIamPolicyCall.html), [*models list*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelListCall.html), [*models patch*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelPatchCall.html), [*models set iam policy*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelSetIamPolicyCall.html), [*models test iam permissions*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelTestIamPermissionCall.html), [*models versions create*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelVersionCreateCall.html), [*models versions delete*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelVersionDeleteCall.html), [*models versions get*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelVersionGetCall.html), [*models versions list*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelVersionListCall.html), [*models versions patch*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelVersionPatchCall.html), [*models versions set default*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectModelVersionSetDefaultCall.html), [*operations cancel*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectOperationCancelCall.html), [*operations get*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectOperationGetCall.html), [*operations list*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectOperationListCall.html) and [*predict*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.ProjectPredictCall.html) @@ -23,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/struct.CloudMachineLearningEngine.html)** +* **[Hub](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/struct.CloudMachineLearningEngine.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.Part.html)** + * **[Parts](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -136,17 +138,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -156,29 +158,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-ml1/1.0.8+20181009/google_ml1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-ml1/1.0.8+20190325/google_ml1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/ml1/src/lib.rs b/gen/ml1/src/lib.rs index dd288e9a0d..03aafd6f8d 100644 --- a/gen/ml1/src/lib.rs +++ b/gen/ml1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Machine Learning Engine* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *ml:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Machine Learning Engine* crate version *1.0.8+20190325*, where *20190325* is the exact revision of the *ml:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Machine Learning Engine* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/ml/). @@ -11,8 +11,10 @@ //! //! Handle the following *Resources* with ease from the central [hub](struct.CloudMachineLearningEngine.html) ... //! +//! * operations +//! * [*delete*](struct.OperationDeleteCall.html) //! * projects -//! * [*get config*](struct.ProjectGetConfigCall.html), [*jobs cancel*](struct.ProjectJobCancelCall.html), [*jobs create*](struct.ProjectJobCreateCall.html), [*jobs get*](struct.ProjectJobGetCall.html), [*jobs get iam policy*](struct.ProjectJobGetIamPolicyCall.html), [*jobs list*](struct.ProjectJobListCall.html), [*jobs patch*](struct.ProjectJobPatchCall.html), [*jobs set iam policy*](struct.ProjectJobSetIamPolicyCall.html), [*jobs test iam permissions*](struct.ProjectJobTestIamPermissionCall.html), [*locations get*](struct.ProjectLocationGetCall.html), [*locations list*](struct.ProjectLocationListCall.html), [*models create*](struct.ProjectModelCreateCall.html), [*models delete*](struct.ProjectModelDeleteCall.html), [*models get*](struct.ProjectModelGetCall.html), [*models get iam policy*](struct.ProjectModelGetIamPolicyCall.html), [*models list*](struct.ProjectModelListCall.html), [*models patch*](struct.ProjectModelPatchCall.html), [*models set iam policy*](struct.ProjectModelSetIamPolicyCall.html), [*models test iam permissions*](struct.ProjectModelTestIamPermissionCall.html), [*models versions create*](struct.ProjectModelVersionCreateCall.html), [*models versions delete*](struct.ProjectModelVersionDeleteCall.html), [*models versions get*](struct.ProjectModelVersionGetCall.html), [*models versions list*](struct.ProjectModelVersionListCall.html), [*models versions patch*](struct.ProjectModelVersionPatchCall.html), [*models versions set default*](struct.ProjectModelVersionSetDefaultCall.html), [*operations cancel*](struct.ProjectOperationCancelCall.html), [*operations delete*](struct.ProjectOperationDeleteCall.html), [*operations get*](struct.ProjectOperationGetCall.html), [*operations list*](struct.ProjectOperationListCall.html) and [*predict*](struct.ProjectPredictCall.html) +//! * [*get config*](struct.ProjectGetConfigCall.html), [*jobs cancel*](struct.ProjectJobCancelCall.html), [*jobs create*](struct.ProjectJobCreateCall.html), [*jobs get*](struct.ProjectJobGetCall.html), [*jobs get iam policy*](struct.ProjectJobGetIamPolicyCall.html), [*jobs list*](struct.ProjectJobListCall.html), [*jobs patch*](struct.ProjectJobPatchCall.html), [*jobs set iam policy*](struct.ProjectJobSetIamPolicyCall.html), [*jobs test iam permissions*](struct.ProjectJobTestIamPermissionCall.html), [*locations get*](struct.ProjectLocationGetCall.html), [*locations list*](struct.ProjectLocationListCall.html), [*models create*](struct.ProjectModelCreateCall.html), [*models delete*](struct.ProjectModelDeleteCall.html), [*models get*](struct.ProjectModelGetCall.html), [*models get iam policy*](struct.ProjectModelGetIamPolicyCall.html), [*models list*](struct.ProjectModelListCall.html), [*models patch*](struct.ProjectModelPatchCall.html), [*models set iam policy*](struct.ProjectModelSetIamPolicyCall.html), [*models test iam permissions*](struct.ProjectModelTestIamPermissionCall.html), [*models versions create*](struct.ProjectModelVersionCreateCall.html), [*models versions delete*](struct.ProjectModelVersionDeleteCall.html), [*models versions get*](struct.ProjectModelVersionGetCall.html), [*models versions list*](struct.ProjectModelVersionListCall.html), [*models versions patch*](struct.ProjectModelVersionPatchCall.html), [*models versions set default*](struct.ProjectModelVersionSetDefaultCall.html), [*operations cancel*](struct.ProjectOperationCancelCall.html), [*operations get*](struct.ProjectOperationGetCall.html), [*operations list*](struct.ProjectOperationListCall.html) and [*predict*](struct.ProjectPredictCall.html) //! //! //! @@ -344,6 +346,9 @@ impl<'a, C, A> CloudMachineLearningEngine } } + pub fn operations(&'a self) -> OperationMethods<'a, C, A> { + OperationMethods { hub: &self } + } pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { ProjectMethods { hub: &self } } @@ -377,6 +382,50 @@ impl<'a, C, A> CloudMachineLearningEngine // ############ // SCHEMAS ### // ########## +/// Represents output related to a built-in algorithm Job. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1__BuiltInAlgorithmOutput { + /// Framework on which the built-in algorithm was trained on. + pub framework: Option, + /// Built-in algorithm's saved model path. + /// Only set for non-hptuning succeeded jobs. + #[serde(rename="modelPath")] + pub model_path: Option, + /// CMLE runtime version on which the built-in algorithm was trained on. + #[serde(rename="runtimeVersion")] + pub runtime_version: Option, + /// Python version on which the built-in algorithm was trained on. + #[serde(rename="pythonVersion")] + pub python_version: Option, +} + +impl Part for GoogleCloudMlV1__BuiltInAlgorithmOutput {} + + +/// Represents the configuration for a replica in a cluster. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudMlV1__ReplicaConfig { + /// Represents the type and number of accelerators used by the replica. + /// [Learn about restrictions on accelerator configurations for + /// training.](/ml-engine/docs/tensorflow/using-gpus#compute-engine-machine-types-with-gpu) + #[serde(rename="acceleratorConfig")] + pub accelerator_config: Option, + /// The Docker image to run on the replica. This image must be in Container + /// Registry. Learn more about [configuring custom + /// containers](/ml-engine/docs/distributed-training-containers). + #[serde(rename="imageUri")] + pub image_uri: Option, +} + +impl Part for GoogleCloudMlV1__ReplicaConfig {} + + /// Response message for the ListJobs method. /// /// # Activities @@ -479,14 +528,6 @@ impl ResponseResult for GoogleCloudMlV1__Location {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudMlV1__HyperparameterOutput { - /// The hyperparameters given to this trial. - pub hyperparameters: Option>, - /// The final objective metric seen for this trial. - #[serde(rename="finalMetric")] - pub final_metric: Option, - /// The trial id for these results. - #[serde(rename="trialId")] - pub trial_id: Option, /// All recorded object metrics for this trial. This field is not currently /// populated. #[serde(rename="allMetrics")] @@ -494,6 +535,18 @@ pub struct GoogleCloudMlV1__HyperparameterOutput { /// True if the trial is stopped early. #[serde(rename="isTrialStoppedEarly")] pub is_trial_stopped_early: Option, + /// The hyperparameters given to this trial. + pub hyperparameters: Option>, + /// The trial id for these results. + #[serde(rename="trialId")] + pub trial_id: Option, + /// Details related to built-in algorithms job. + /// Only set this for built-in algorithms jobs and for trials that succeeded. + #[serde(rename="builtInAlgorithmOutput")] + pub built_in_algorithm_output: Option, + /// The final objective metric seen for this trial. + #[serde(rename="finalMetric")] + pub final_metric: Option, } impl Part for GoogleCloudMlV1__HyperparameterOutput {} @@ -557,9 +610,9 @@ impl Part for GoogleCloudMlV1__HyperparameterOutput {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleIamV1__Policy { - /// Associates a list of `members` to a `role`. - /// `bindings` with no members will result in an error. - pub bindings: Option>, + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, /// `etag` is used for optimistic concurrency control as a way to help /// prevent simultaneous updates of a policy from overwriting each other. /// It is strongly suggested that systems make use of the `etag` in the @@ -571,9 +624,9 @@ pub struct GoogleIamV1__Policy { /// If no `etag` is provided in the call to `setIamPolicy`, then the existing /// policy is overwritten blindly. pub etag: Option, - /// Specifies cloud audit logging configuration for this policy. - #[serde(rename="auditConfigs")] - pub audit_configs: Option>, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, /// Deprecated. pub version: Option, } @@ -581,35 +634,65 @@ pub struct GoogleIamV1__Policy { impl ResponseResult for GoogleIamV1__Policy {} -/// Represents an expression text. Example: +/// Message that represents an arbitrary HTTP body. It should only be used for +/// payload formats that can't be represented as JSON, such as raw binary or +/// an HTML page. /// -/// title: "User account presence" -/// description: "Determines whether the request has a user account" -/// expression: "size(request.user) > 0" /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// This message can be used both in streaming and non-streaming API methods in +/// the request as well as the response. +/// +/// It can be used as a top-level request field, which is convenient if one +/// wants to extract parameters from either the URL or HTTP template into the +/// request fields and also want access to the raw HTTP body. +/// +/// Example: +/// +/// message GetResourceRequest { +/// // A unique request id. +/// string request_id = 1; +/// +/// // The raw HTTP body is bound to this field. +/// google.api.HttpBody http_body = 2; +/// } +/// +/// service ResourceService { +/// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); +/// rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); +/// } +/// +/// Example with streaming methods: +/// +/// service CaldavService { +/// rpc GetCalendar(stream google.api.HttpBody) +/// returns (stream google.api.HttpBody); +/// rpc UpdateCalendar(stream google.api.HttpBody) +/// returns (stream google.api.HttpBody); +/// } +/// +/// Use of this type only changes how the request and response bodies are +/// handled, all other features will continue to work unchanged. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [predict projects](struct.ProjectPredictCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleType__Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, - /// Textual representation of an expression in - /// Common Expression Language syntax. - /// - /// The application context of the containing message determines which - /// well-known feature set of CEL is supported. - pub expression: Option, - /// An optional string indicating the location of the expression for error - /// reporting, e.g. a file name and a position in the file. - pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, +pub struct GoogleApi__HttpBody { + /// The HTTP Content-Type header value specifying the content type of the body. + #[serde(rename="contentType")] + pub content_type: Option, + /// The HTTP request/response body as raw binary. + pub data: Option, + /// Application specific response metadata. Must be set in the first response + /// for streaming APIs. + pub extensions: Option>>, } -impl Part for GoogleType__Expr {} +impl ResponseResult for GoogleApi__HttpBody {} /// A generic empty message that you can re-use to avoid defining duplicated @@ -627,9 +710,9 @@ impl Part for GoogleType__Expr {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [jobs cancel projects](struct.ProjectJobCancelCall.html) (response) -/// * [operations delete projects](struct.ProjectOperationDeleteCall.html) (response) /// * [operations cancel projects](struct.ProjectOperationCancelCall.html) (response) +/// * [delete operations](struct.OperationDeleteCall.html) (response) +/// * [jobs cancel projects](struct.ProjectJobCancelCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleProtobuf__Empty { _never_set: Option } @@ -659,6 +742,14 @@ pub struct GoogleCloudMlV1__HyperparameterSpec { /// Uses the default CloudML Engine hyperparameter tuning /// algorithm if unspecified. pub algorithm: Option, + /// Optional. How many failed trials that need to be seen before failing the + /// hyperparameter tuning job. User can specify this field to override the + /// default failing criteria for CloudML Engine hyperparameter tuning jobs. + /// + /// Defaults to zero, which means to let the service decide when a + /// hyperparameter job should fail. + #[serde(rename="maxFailedTrials")] + pub max_failed_trials: Option, /// Optional. Indicates if the hyperparameter tuning job enables auto trial /// early stopping. #[serde(rename="enableTrialEarlyStopping")] @@ -774,6 +865,25 @@ impl ResponseResult for GoogleLongrunning__Operation {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudMlV1__Model { + /// Optional. The description specified for the model when it was created. + pub description: Option, + /// Optional. If true, enables logging of stderr and stdout streams + /// for online prediction in Stackdriver Logging. These can be more verbose + /// than the standard access logs (see `online_prediction_logging`) and thus + /// can incur higher cost. However, they are helpful for debugging. Note that + /// since Stackdriver logs may incur a cost, particularly if the total QPS + /// in your project is high, be sure to estimate your costs before enabling + /// this flag. + /// + /// Default is false. + #[serde(rename="onlinePredictionConsoleLogging")] + pub online_prediction_console_logging: Option, + /// Optional. One or more labels that you can add, to organize your models. + /// Each label is a key-value pair, where both the key and the value are + /// arbitrary strings that you supply. + /// For more information, see the documentation on + /// using labels. + pub labels: Option>, /// Optional. The list of regions where the model is going to be deployed. /// Currently only one region per model is supported. /// Defaults to 'us-central1' if nothing is set. @@ -801,15 +911,12 @@ pub struct GoogleCloudMlV1__Model { /// [projects.methods.versions.setDefault](/ml-engine/reference/rest/v1/projects.models.versions/setDefault). #[serde(rename="defaultVersion")] pub default_version: Option, - /// Optional. The description specified for the model when it was created. - pub description: Option, - /// Optional. One or more labels that you can add, to organize your models. - /// Each label is a key-value pair, where both the key and the value are - /// arbitrary strings that you supply. - /// For more information, see the documentation on - /// using labels. - pub labels: Option>, - /// Optional. If true, enables StackDriver Logging for online prediction. + /// Optional. If true, online prediction access logs are sent to StackDriver + /// Logging. These logs are like standard server access logs, containing + /// information like timestamp and latency for each request. Note that + /// Stackdriver logs may incur a cost, particular if the total QPS in your + /// project is high. + /// /// Default is false. #[serde(rename="onlinePredictionLogging")] pub online_prediction_logging: Option, @@ -868,9 +975,11 @@ pub struct GoogleCloudMlV1__ParameterSpec { /// a HyperparameterSpec message. E.g., "learning_rate". #[serde(rename="parameterName")] pub parameter_name: Option, - /// Required if type is `CATEGORICAL`. The list of possible categories. - #[serde(rename="categoricalValues")] - pub categorical_values: Option>, + /// Required if type is `DOUBLE` or `INTEGER`. This field + /// should be unset if type is `CATEGORICAL`. This value should be integers if + /// type is INTEGER. + #[serde(rename="minValue")] + pub min_value: Option, /// Required. The type of the parameter. #[serde(rename="type")] pub type_: Option, @@ -879,11 +988,9 @@ pub struct GoogleCloudMlV1__ParameterSpec { /// type is `INTEGER`. #[serde(rename="maxValue")] pub max_value: Option, - /// Required if type is `DOUBLE` or `INTEGER`. This field - /// should be unset if type is `CATEGORICAL`. This value should be integers if - /// type is INTEGER. - #[serde(rename="minValue")] - pub min_value: Option, + /// Required if type is `CATEGORICAL`. The list of possible categories. + #[serde(rename="categoricalValues")] + pub categorical_values: Option>, } impl Part for GoogleCloudMlV1__ParameterSpec {} @@ -969,25 +1076,14 @@ impl Part for GoogleIamV1__AuditConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudMlV1__TrainingInput { - /// Optional. Specifies the type of virtual machine to use for your training - /// job's worker nodes. - /// - /// The supported values are the same as those described in the entry for - /// `masterType`. - /// - /// This value must be present when `scaleTier` is set to `CUSTOM` and - /// `workerCount` is greater than zero. - #[serde(rename="workerType")] - pub worker_type: Option, - /// Optional. The Google Cloud ML runtime version to use for training. If not - /// set, Google Cloud ML will choose a stable version, which is defined in the - /// documentation of runtime version list. + /// Optional. The Cloud ML Engine runtime version to use for training. If not + /// set, Cloud ML Engine uses the default stable version, 1.0. For more + /// information, see the + /// runtime version list + /// and + /// how to manage runtime versions. #[serde(rename="runtimeVersion")] pub runtime_version: Option, - /// Required. Specifies the machine types, the number of replicas for workers - /// and parameter servers. - #[serde(rename="scaleTier")] - pub scale_tier: Option, /// Optional. Specifies the type of virtual machine to use for your training /// job's master worker. /// @@ -1051,26 +1147,22 @@ pub struct GoogleCloudMlV1__TrainingInput { ///

standard_v100
///
/// A machine equivalent to standard that - /// also includes a single NVIDIA Tesla V100 GPU. The availability of these - /// GPUs is in the Beta launch stage. + /// also includes a single NVIDIA Tesla V100 GPU. ///
///
large_model_v100
///
/// A machine equivalent to large_model that - /// also includes a single NVIDIA Tesla V100 GPU. The availability of these - /// GPUs is in the Beta launch stage. + /// also includes a single NVIDIA Tesla V100 GPU. ///
///
complex_model_m_v100
///
/// A machine equivalent to complex_model_m that - /// also includes four NVIDIA Tesla V100 GPUs. The availability of these - /// GPUs is in the Beta launch stage. + /// also includes four NVIDIA Tesla V100 GPUs. ///
///
complex_model_l_v100
///
/// A machine equivalent to complex_model_l that - /// also includes eight NVIDIA Tesla V100 GPUs. The availability of these - /// GPUs is in the Beta launch stage. + /// also includes eight NVIDIA Tesla V100 GPUs. ///
///
cloud_tpu
///
@@ -1080,61 +1172,157 @@ pub struct GoogleCloudMlV1__TrainingInput { ///
/// /// + /// You may also use certain Compute Engine machine types directly in this + /// field. The following types are supported: + /// + /// - `n1-standard-4` + /// - `n1-standard-8` + /// - `n1-standard-16` + /// - `n1-standard-32` + /// - `n1-standard-64` + /// - `n1-standard-96` + /// - `n1-highmem-2` + /// - `n1-highmem-4` + /// - `n1-highmem-8` + /// - `n1-highmem-16` + /// - `n1-highmem-32` + /// - `n1-highmem-64` + /// - `n1-highmem-96` + /// - `n1-highcpu-16` + /// - `n1-highcpu-32` + /// - `n1-highcpu-64` + /// - `n1-highcpu-96` + /// + /// See more about [using Compute Engine machine + /// types](/ml-engine/docs/tensorflow/machine-types#compute-engine-machine-types). + /// /// You must set this value when `scaleTier` is set to `CUSTOM`. #[serde(rename="masterType")] pub master_type: Option, /// Optional. The set of Hyperparameters to tune. pub hyperparameters: Option, - /// Required. The Google Compute Engine region to run the training job in. - /// See the available regions - /// for ML Engine services. - pub region: Option, /// Optional. Command line arguments to pass to the program. pub args: Option>, /// Required. The Python module name to run after installing the packages. #[serde(rename="pythonModule")] pub python_module: Option, - /// Optional. The version of Python used in training. If not set, the default - /// version is '2.7'. Python '3.5' is available when `runtime_version` is set - /// to '1.4' and above. Python '2.7' works with all supported runtime versions. - #[serde(rename="pythonVersion")] - pub python_version: Option, /// Optional. A Google Cloud Storage path in which to store training outputs /// and other data needed for training. This path is passed to your TensorFlow /// program as the '--job-dir' command-line argument. The benefit of specifying /// this field is that Cloud ML validates the path for use in training. #[serde(rename="jobDir")] pub job_dir: Option, - /// Required. The Google Cloud Storage location of the packages with - /// the training program and any additional dependencies. - /// The maximum number of package URIs is 100. - #[serde(rename="packageUris")] - pub package_uris: Option>, /// Optional. The number of worker replicas to use for the training job. Each /// replica in the cluster will be of the type specified in `worker_type`. /// /// This value can only be used when `scale_tier` is set to `CUSTOM`. If you /// set this value, you must also set `worker_type`. + /// + /// The default value is zero. #[serde(rename="workerCount")] pub worker_count: Option, - /// Optional. Specifies the type of virtual machine to use for your training - /// job's parameter server. - /// - /// The supported values are the same as those described in the entry for - /// `master_type`. - /// - /// This value must be present when `scaleTier` is set to `CUSTOM` and - /// `parameter_server_count` is greater than zero. - #[serde(rename="parameterServerType")] - pub parameter_server_type: Option, /// Optional. The number of parameter server replicas to use for the training /// job. Each replica in the cluster will be of the type specified in /// `parameter_server_type`. /// /// This value can only be used when `scale_tier` is set to `CUSTOM`.If you /// set this value, you must also set `parameter_server_type`. + /// + /// The default value is zero. #[serde(rename="parameterServerCount")] pub parameter_server_count: Option, + /// Optional. Specifies the type of virtual machine to use for your training + /// job's worker nodes. + /// + /// The supported values are the same as those described in the entry for + /// `masterType`. + /// + /// This value must be consistent with the category of machine type that + /// `masterType` uses. In other words, both must be Cloud ML Engine machine + /// types or both must be Compute Engine machine types. + /// + /// If you use `cloud_tpu` for this value, see special instructions for + /// [configuring a custom TPU + /// machine](/ml-engine/docs/tensorflow/using-tpus#configuring_a_custom_tpu_machine). + /// + /// This value must be present when `scaleTier` is set to `CUSTOM` and + /// `workerCount` is greater than zero. + #[serde(rename="workerType")] + pub worker_type: Option, + /// Optional. The configuration for parameter servers. + /// + /// You should only set `parameterServerConfig.acceleratorConfig` if + /// `parameterServerConfigType` is set to a Compute Engine machine type. [Learn + /// about restrictions on accelerator configurations for + /// training.](/ml-engine/docs/tensorflow/using-gpus#compute-engine-machine-types-with-gpu) + /// + /// Set `parameterServerConfig.imageUri` only if you build a custom image for + /// your parameter server. If `parameterServerConfig.imageUri` has not been + /// set, Cloud ML Engine uses the value of `masterConfig.imageUri`. + /// Learn more about [configuring custom + /// containers](/ml-engine/docs/distributed-training-containers). + #[serde(rename="parameterServerConfig")] + pub parameter_server_config: Option, + /// Required. Specifies the machine types, the number of replicas for workers + /// and parameter servers. + #[serde(rename="scaleTier")] + pub scale_tier: Option, + /// Required. The Google Compute Engine region to run the training job in. + /// See the available regions + /// for ML Engine services. + pub region: Option, + /// Optional. The version of Python used in training. If not set, the default + /// version is '2.7'. Python '3.5' is available when `runtime_version` is set + /// to '1.4' and above. Python '2.7' works with all supported + /// runtime versions. + #[serde(rename="pythonVersion")] + pub python_version: Option, + /// Required. The Google Cloud Storage location of the packages with + /// the training program and any additional dependencies. + /// The maximum number of package URIs is 100. + #[serde(rename="packageUris")] + pub package_uris: Option>, + /// Optional. The configuration for workers. + /// + /// You should only set `workerConfig.acceleratorConfig` if `workerType` is set + /// to a Compute Engine machine type. [Learn about restrictions on accelerator + /// configurations for + /// training.](/ml-engine/docs/tensorflow/using-gpus#compute-engine-machine-types-with-gpu) + /// + /// Set `workerConfig.imageUri` only if you build a custom image for your + /// worker. If `workerConfig.imageUri` has not been set, Cloud ML Engine uses + /// the value of `masterConfig.imageUri`. Learn more about + /// [configuring custom + /// containers](/ml-engine/docs/distributed-training-containers). + #[serde(rename="workerConfig")] + pub worker_config: Option, + /// Optional. Specifies the type of virtual machine to use for your training + /// job's parameter server. + /// + /// The supported values are the same as those described in the entry for + /// `master_type`. + /// + /// This value must be consistent with the category of machine type that + /// `masterType` uses. In other words, both must be Cloud ML Engine machine + /// types or both must be Compute Engine machine types. + /// + /// This value must be present when `scaleTier` is set to `CUSTOM` and + /// `parameter_server_count` is greater than zero. + #[serde(rename="parameterServerType")] + pub parameter_server_type: Option, + /// Optional. The configuration for your master worker. + /// + /// You should only set `masterConfig.acceleratorConfig` if `masterType` is set + /// to a Compute Engine machine type. Learn about [restrictions on accelerator + /// configurations for + /// training.](/ml-engine/docs/tensorflow/using-gpus#compute-engine-machine-types-with-gpu) + /// + /// Set `masterConfig.imageUri` only if you build a custom image. Only one of + /// `masterConfig.imageUri` and `runtimeVersion` should be set. Learn more about + /// [configuring custom + /// containers](/ml-engine/docs/distributed-training-containers). + #[serde(rename="masterConfig")] + pub master_config: Option, } impl Part for GoogleCloudMlV1__TrainingInput {} @@ -1208,12 +1396,12 @@ impl Part for GoogleCloudMlV1__ManualScaling {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudMlV1__ListModelsResponse { + /// The list of models. + pub models: Option>, /// Optional. Pass this token as the `page_token` field of the request for a /// subsequent call. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The list of models. - pub models: Option>, } impl ResponseResult for GoogleCloudMlV1__ListModelsResponse {} @@ -1227,7 +1415,7 @@ impl ResponseResult for GoogleCloudMlV1__ListModelsResponse {} pub struct GoogleCloudMlV1__AcceleratorConfig { /// The number of accelerators to attach to each machine running the job. pub count: Option, - /// The available types of accelerators. + /// The type of accelerator to use. #[serde(rename="type")] pub type_: Option, } @@ -1313,12 +1501,12 @@ impl ResponseResult for GoogleIamV1__TestIamPermissionsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudMlV1__PredictionOutput { - /// The output Google Cloud Storage location provided at the job creation time. - #[serde(rename="outputPath")] - pub output_path: Option, /// Node hours used by the batch prediction job. #[serde(rename="nodeHours")] pub node_hours: Option, + /// The output Google Cloud Storage location provided at the job creation time. + #[serde(rename="outputPath")] + pub output_path: Option, /// The number of generated predictions. #[serde(rename="predictionCount")] pub prediction_count: Option, @@ -1336,12 +1524,6 @@ impl Part for GoogleCloudMlV1__PredictionOutput {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudMlV1__TrainingOutput { - /// Results for individual Hyperparameter trials. - /// Only set for hyperparameter tuning jobs. - pub trials: Option>, - /// Whether this job is a hyperparameter tuning job. - #[serde(rename="isHyperparameterTuningJob")] - pub is_hyperparameter_tuning_job: Option, /// The number of hyperparameter tuning trials that completed successfully. /// Only set for hyperparameter tuning jobs. #[serde(rename="completedTrialCount")] @@ -1349,6 +1531,19 @@ pub struct GoogleCloudMlV1__TrainingOutput { /// The amount of ML units consumed by the job. #[serde(rename="consumedMLUnits")] pub consumed_ml_units: Option, + /// Whether this job is a built-in Algorithm job. + #[serde(rename="isBuiltInAlgorithmJob")] + pub is_built_in_algorithm_job: Option, + /// Results for individual Hyperparameter trials. + /// Only set for hyperparameter tuning jobs. + pub trials: Option>, + /// Whether this job is a hyperparameter tuning job. + #[serde(rename="isHyperparameterTuningJob")] + pub is_hyperparameter_tuning_job: Option, + /// Details related to built-in algorithms job. + /// Only set for built-in algorithms jobs. + #[serde(rename="builtInAlgorithmOutput")] + pub built_in_algorithm_output: Option, } impl Part for GoogleCloudMlV1__TrainingOutput {} @@ -1392,7 +1587,7 @@ pub struct GoogleIamV1__Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, - /// Unimplemented. The condition that is associated with this binding. + /// The condition that is associated with this binding. /// NOTE: an unsatisfied condition will not allow user access via current /// binding. Different bindings, including their conditions, are examined /// independently. @@ -1417,7 +1612,7 @@ pub struct GoogleIamV1__Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// @@ -1427,85 +1622,62 @@ pub struct GoogleIamV1__Binding { impl Part for GoogleIamV1__Binding {} -/// Message that represents an arbitrary HTTP body. It should only be used for -/// payload formats that can't be represented as JSON, such as raw binary or -/// an HTML page. +/// Represents an expression text. Example: /// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" /// -/// This message can be used both in streaming and non-streaming API methods in -/// the request as well as the response. +/// This type is not used in any activity, and only used as *part* of another schema. /// -/// It can be used as a top-level request field, which is convenient if one -/// wants to extract parameters from either the URL or HTTP template into the -/// request fields and also want access to the raw HTTP body. -/// -/// Example: -/// -/// message GetResourceRequest { -/// // A unique request id. -/// string request_id = 1; -/// -/// // The raw HTTP body is bound to this field. -/// google.api.HttpBody http_body = 2; -/// } -/// -/// service ResourceService { -/// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); -/// rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); -/// } -/// -/// Example with streaming methods: -/// -/// service CaldavService { -/// rpc GetCalendar(stream google.api.HttpBody) -/// returns (stream google.api.HttpBody); -/// rpc UpdateCalendar(stream google.api.HttpBody) -/// returns (stream google.api.HttpBody); -/// } -/// -/// Use of this type only changes how the request and response bodies are -/// handled, all other features will continue to work unchanged. +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleType__Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for GoogleType__Expr {} + + +/// Returns service account information associated with a project. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [predict projects](struct.ProjectPredictCall.html) (response) +/// * [get config projects](struct.ProjectGetConfigCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleApi__HttpBody { - /// HTTP body binary data. - pub data: Option, - /// The HTTP Content-Type string representing the content type of the body. - #[serde(rename="contentType")] - pub content_type: Option, - /// Application specific response metadata. Must be set in the first response - /// for streaming APIs. - pub extensions: Option>>, -} - -impl ResponseResult for GoogleApi__HttpBody {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudMlV1__Capability { +pub struct GoogleCloudMlV1__GetConfigResponse { + /// The project number for `service_account`. + #[serde(rename="serviceAccountProject")] + pub service_account_project: Option, /// no description provided - #[serde(rename="type")] - pub type_: Option, - /// Available accelerators for the capability. - #[serde(rename="availableAccelerators")] - pub available_accelerators: Option>, + pub config: Option, + /// The service account Cloud ML uses to access resources in the project. + #[serde(rename="serviceAccount")] + pub service_account: Option, } -impl Part for GoogleCloudMlV1__Capability {} +impl ResponseResult for GoogleCloudMlV1__GetConfigResponse {} -/// Represents a training or prediction job. +/// Represents a training, prediction or explanation job. /// /// # Activities /// @@ -1518,9 +1690,9 @@ impl Part for GoogleCloudMlV1__Capability {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudMlV1__Job { - /// Input parameters to create a training job. - #[serde(rename="trainingInput")] - pub training_input: Option, + /// The current training job result. + #[serde(rename="trainingOutput")] + pub training_output: Option, /// Input parameters to create a prediction job. #[serde(rename="predictionInput")] pub prediction_input: Option, @@ -1538,9 +1710,6 @@ pub struct GoogleCloudMlV1__Job { pub labels: Option>, /// Output only. The detailed state of a job. pub state: Option, - /// The current training job result. - #[serde(rename="trainingOutput")] - pub training_output: Option, /// `etag` is used for optimistic concurrency control as a way to help /// prevent simultaneous updates of a job from overwriting each other. /// It is strongly suggested that systems make use of the `etag` in the @@ -1552,6 +1721,9 @@ pub struct GoogleCloudMlV1__Job { /// Output only. When the job processing was started. #[serde(rename="startTime")] pub start_time: Option, + /// Input parameters to create a training job. + #[serde(rename="trainingInput")] + pub training_input: Option, /// Output only. When the job processing was completed. #[serde(rename="endTime")] pub end_time: Option, @@ -1567,17 +1739,17 @@ impl RequestValue for GoogleCloudMlV1__Job {} impl ResponseResult for GoogleCloudMlV1__Job {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -1638,7 +1810,7 @@ pub struct GoogleRpc__Status { impl Part for GoogleRpc__Status {} -/// Represents input parameters for a prediction job. Next field: 19 +/// Represents input parameters for a prediction job. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -1650,13 +1822,6 @@ pub struct GoogleCloudMlV1__PredictionInput { /// `"projects/YOUR_PROJECT/models/YOUR_MODEL"` #[serde(rename="modelName")] pub model_name: Option, - /// Optional. The Google Cloud ML runtime version to use for this batch - /// prediction. If not set, Google Cloud ML will pick the runtime version used - /// during the CreateVersion request for this model version, or choose the - /// latest stable version when model version information is not available - /// such as when the model is specified by uri. - #[serde(rename="runtimeVersion")] - pub runtime_version: Option, /// Optional. The name of the signature defined in the SavedModel to use for /// this job. Please refer to /// [SavedModel](https://tensorflow.github.io/serving/serving_basic.html) @@ -1667,6 +1832,13 @@ pub struct GoogleCloudMlV1__PredictionInput { /// , which is "serving_default". #[serde(rename="signatureName")] pub signature_name: Option, + /// Optional. The Cloud ML Engine runtime version to use for this batch + /// prediction. If not set, Cloud ML Engine will pick the runtime version used + /// during the CreateVersion request for this model version, or choose the + /// latest stable version when model version information is not available + /// such as when the model is specified by uri. + #[serde(rename="runtimeVersion")] + pub runtime_version: Option, /// Optional. Number of records per batch, defaults to 64. /// The service will buffer batch_size number of records in memory before /// invoking one Tensorflow prediction call internally. So take the record @@ -1678,15 +1850,12 @@ pub struct GoogleCloudMlV1__PredictionInput { #[serde(rename="maxWorkerCount")] pub max_worker_count: Option, /// Required. The Google Cloud Storage location of the input data files. - /// May contain wildcards. + /// May contain wildcards. See >, /// Use this field if you want to specify a Google Cloud Storage path for /// the model to use. pub uri: Option, - /// Optional. The type and number of accelerators to be attached to each - /// machine running the job. - pub accelerator: Option, /// Required. The output Google Cloud Storage location. #[serde(rename="outputPath")] pub output_path: Option, @@ -1740,6 +1909,7 @@ impl ResponseResult for GoogleCloudMlV1__ListLocationsResponse {} /// prediction requests. A model can have multiple versions. You can get /// information about all of the versions of a given model by calling /// [projects.models.versions.list](/ml-engine/reference/rest/v1/projects.models.versions/list). +/// Next ID: 30 /// /// # Activities /// @@ -1758,19 +1928,27 @@ pub struct GoogleCloudMlV1__Version { pub error_message: Option, /// Optional. The type of machine on which to serve the model. Currently only /// applies to online prediction service. - /// The following are currently supported and will be deprecated in - /// Beta release. - /// mls1-highmem-1 1 core 2 Gb RAM - /// mls1-highcpu-4 4 core 2 Gb RAM - /// The following are available in Beta: - /// mls1-c1-m2 1 core 2 Gb RAM Default - /// mls1-c4-m2 4 core 2 Gb RAM + ///
+ ///
mls1-c1-m2
+ ///
+ /// The default machine type, with 1 core and 2 GB RAM. The deprecated + /// name for this machine type is "mls1-highmem-1". + ///
+ ///
mls1-c4-m2
+ ///
+ /// In Beta. This machine type has 4 cores and 2 GB RAM. The + /// deprecated name for this machine type is "mls1-highcpu-4". + ///
+ ///
#[serde(rename="machineType")] pub machine_type: Option, /// Optional. The description specified for the version when it was created. pub description: Option, - /// Optional. The Google Cloud ML runtime version to use for this deployment. - /// If not set, Google Cloud ML will choose a version. + /// Optional. The Cloud ML Engine runtime version to use for this deployment. + /// If not set, Cloud ML Engine uses the default stable version, 1.0. For more + /// information, see the + /// [runtime version list](/ml-engine/docs/runtime-version-list) and + /// [how to manage runtime versions](/ml-engine/docs/versioning). #[serde(rename="runtimeVersion")] pub runtime_version: Option, /// Manually select the number of nodes to use for serving the @@ -1852,28 +2030,21 @@ impl RequestValue for GoogleCloudMlV1__Version {} impl ResponseResult for GoogleCloudMlV1__Version {} -/// Returns service account information associated with a project. +/// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get config projects](struct.ProjectGetConfigCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudMlV1__GetConfigResponse { - /// The project number for `service_account`. - #[serde(rename="serviceAccountProject")] - pub service_account_project: Option, - /// The service account Cloud ML uses to access resources in the project. - #[serde(rename="serviceAccount")] - pub service_account: Option, +pub struct GoogleCloudMlV1__Capability { + /// Available accelerators for the capability. + #[serde(rename="availableAccelerators")] + pub available_accelerators: Option>, /// no description provided - pub config: Option, + #[serde(rename="type")] + pub type_: Option, } -impl ResponseResult for GoogleCloudMlV1__GetConfigResponse {} +impl Part for GoogleCloudMlV1__Capability {} /// Options for automatically scaling a model. @@ -1913,7 +2084,9 @@ pub struct GoogleCloudMlV1__AutoScaling { /// /// HTTP request: ///
-    /// PATCH https://ml.googleapis.com/v1/{name=projects/*/models/*/versions/*}?update_mask=autoScaling.minNodes -d @./update_body.json
+    /// PATCH
+    /// https://ml.googleapis.com/v1/{name=projects/*/models/*/versions/*}?update_mask=autoScaling.minNodes
+    /// -d @./update_body.json
     /// 
#[serde(rename="minNodes")] pub min_nodes: Option, @@ -1927,6 +2100,68 @@ impl Part for GoogleCloudMlV1__AutoScaling {} // MethodBuilders ### // ################# +/// A builder providing access to all methods supported on *operation* resources. +/// It is not used directly, but through the `CloudMachineLearningEngine` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_ml1 as ml1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use ml1::CloudMachineLearningEngine; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudMachineLearningEngine::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)` +/// // to build up your call. +/// let rb = hub.operations(); +/// # } +/// ``` +pub struct OperationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudMachineLearningEngine, +} + +impl<'a, C, A> MethodsBuilder for OperationMethods<'a, C, A> {} + +impl<'a, C, A> OperationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes a long-running operation. This method indicates that the client is + /// no longer interested in the operation result. It does not cancel the + /// operation. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource to be deleted. + pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, C, A> { + OperationDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *project* resources. /// It is not used directly, but through the `CloudMachineLearningEngine` hub. /// @@ -1951,7 +2186,7 @@ impl Part for GoogleCloudMlV1__AutoScaling {} /// ::default(), None); /// let mut hub = CloudMachineLearningEngine::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get_config(...)`, `jobs_cancel(...)`, `jobs_create(...)`, `jobs_get(...)`, `jobs_get_iam_policy(...)`, `jobs_list(...)`, `jobs_patch(...)`, `jobs_set_iam_policy(...)`, `jobs_test_iam_permissions(...)`, `locations_get(...)`, `locations_list(...)`, `models_create(...)`, `models_delete(...)`, `models_get(...)`, `models_get_iam_policy(...)`, `models_list(...)`, `models_patch(...)`, `models_set_iam_policy(...)`, `models_test_iam_permissions(...)`, `models_versions_create(...)`, `models_versions_delete(...)`, `models_versions_get(...)`, `models_versions_list(...)`, `models_versions_patch(...)`, `models_versions_set_default(...)`, `operations_cancel(...)`, `operations_delete(...)`, `operations_get(...)`, `operations_list(...)` and `predict(...)` +/// // like `get_config(...)`, `jobs_cancel(...)`, `jobs_create(...)`, `jobs_get(...)`, `jobs_get_iam_policy(...)`, `jobs_list(...)`, `jobs_patch(...)`, `jobs_set_iam_policy(...)`, `jobs_test_iam_permissions(...)`, `locations_get(...)`, `locations_list(...)`, `models_create(...)`, `models_delete(...)`, `models_get(...)`, `models_get_iam_policy(...)`, `models_list(...)`, `models_patch(...)`, `models_set_iam_policy(...)`, `models_test_iam_permissions(...)`, `models_versions_create(...)`, `models_versions_delete(...)`, `models_versions_get(...)`, `models_versions_list(...)`, `models_versions_patch(...)`, `models_versions_set_default(...)`, `operations_cancel(...)`, `operations_get(...)`, `operations_list(...)` and `predict(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -1966,26 +2201,6 @@ impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} impl<'a, C, A> ProjectMethods<'a, C, A> { - /// Create a builder to help you perform the following task: - /// - /// Deletes a long-running operation. This method indicates that the client is - /// no longer interested in the operation result. It does not cancel the - /// operation. If the server doesn't support this method, it returns - /// `google.rpc.Code.UNIMPLEMENTED`. - /// - /// # Arguments - /// - /// * `name` - The name of the operation resource to be deleted. - pub fn operations_delete(&self, name: &str) -> ProjectOperationDeleteCall<'a, C, A> { - ProjectOperationDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Sets the access control policy on the specified resource. Replaces any @@ -2652,8 +2867,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// operation. If the server doesn't support this method, it returns /// `google.rpc.Code.UNIMPLEMENTED`. /// -/// A builder for the *operations.delete* method supported by a *project* resource. -/// It is not used directly, but through a `ProjectMethods` instance. +/// A builder for the *delete* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. /// /// # Example /// @@ -2677,11 +2892,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().operations_delete("name") +/// let result = hub.operations().delete("name") /// .doit(); /// # } /// ``` -pub struct ProjectOperationDeleteCall<'a, C, A> +pub struct OperationDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a CloudMachineLearningEngine, @@ -2691,9 +2906,9 @@ pub struct ProjectOperationDeleteCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectOperationDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for OperationDeleteCall<'a, C, A> {} -impl<'a, C, A> ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -2706,7 +2921,7 @@ impl<'a, C, A> ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "ml.projects.operations.delete", + dlg.begin(MethodInfo { id: "ml.operations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); @@ -2736,7 +2951,7 @@ impl<'a, C, A> ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2775,7 +2987,7 @@ impl<'a, C, A> ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectOperationDeleteCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> OperationDeleteCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -2844,7 +3056,7 @@ impl<'a, C, A> ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectOperationDeleteCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -2853,7 +3065,7 @@ impl<'a, C, A> ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectOperationDeleteCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> OperationDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -2889,7 +3101,7 @@ impl<'a, C, A> ProjectOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectOperationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -2995,7 +3207,7 @@ impl<'a, C, A> ProjectJobSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectJobSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3046,7 +3255,7 @@ impl<'a, C, A> ProjectJobSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectJobSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectPredictCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3297,10 +3506,7 @@ impl<'a, C, A> ProjectPredictCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3332,7 +3538,7 @@ impl<'a, C, A> ProjectPredictCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3424,7 +3630,7 @@ impl<'a, C, A> ProjectPredictCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3564,7 +3770,7 @@ impl<'a, C, A> ProjectModelVersionDeleteCall<'a, C, A> where C: BorrowMut ProjectModelVersionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3603,7 +3806,7 @@ impl<'a, C, A> ProjectModelVersionDeleteCall<'a, C, A> where C: BorrowMut ProjectModelVersionDeleteCall<'a, C, A> where C: BorrowMut ProjectJobCreateCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3840,10 +4043,7 @@ impl<'a, C, A> ProjectJobCreateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3875,7 +4075,7 @@ impl<'a, C, A> ProjectJobCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3965,7 +4165,7 @@ impl<'a, C, A> ProjectJobCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4112,7 +4312,7 @@ impl<'a, C, A> ProjectJobTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectJobTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4163,7 +4360,7 @@ impl<'a, C, A> ProjectJobTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectJobTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectModelVersionSetDefaultCall<'a, C, A> where C: BorrowMut ProjectModelVersionSetDefaultCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4453,7 +4647,7 @@ impl<'a, C, A> ProjectModelVersionSetDefaultCall<'a, C, A> where C: BorrowMut ProjectModelVersionSetDefaultCall<'a, C, A> where C: BorrowMut ProjectModelPatchCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4710,10 +4904,7 @@ impl<'a, C, A> ProjectModelPatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4745,7 +4936,7 @@ impl<'a, C, A> ProjectModelPatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4856,7 +5047,7 @@ impl<'a, C, A> ProjectModelPatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4998,7 +5189,7 @@ impl<'a, C, A> ProjectModelSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectModelSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5049,7 +5237,7 @@ impl<'a, C, A> ProjectModelSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectModelSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectJobGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectJobGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5315,7 +5500,7 @@ impl<'a, C, A> ProjectJobGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectJobGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5577,7 +5759,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectJobGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5827,10 +6009,7 @@ impl<'a, C, A> ProjectJobGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5850,7 +6029,7 @@ impl<'a, C, A> ProjectJobGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5928,7 +6107,7 @@ impl<'a, C, A> ProjectJobGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6069,7 +6248,7 @@ impl<'a, C, A> ProjectJobCancelCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6085,10 +6264,7 @@ impl<'a, C, A> ProjectJobCancelCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6120,7 +6296,7 @@ impl<'a, C, A> ProjectJobCancelCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6210,7 +6386,7 @@ impl<'a, C, A> ProjectJobCancelCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6359,7 +6535,7 @@ impl<'a, C, A> ProjectModelVersionPatchCall<'a, C, A> where C: BorrowMut ProjectModelVersionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6410,7 +6583,7 @@ impl<'a, C, A> ProjectModelVersionPatchCall<'a, C, A> where C: BorrowMut ProjectModelVersionPatchCall<'a, C, A> where C: BorrowMut ProjectModelVersionGetCall<'a, C, A> where C: BorrowMut ProjectModelVersionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6696,7 +6866,7 @@ impl<'a, C, A> ProjectModelVersionGetCall<'a, C, A> where C: BorrowMut ProjectModelVersionGetCall<'a, C, A> where C: BorrowMut ProjectJobPatchCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6938,10 +7108,7 @@ impl<'a, C, A> ProjectJobPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6973,7 +7140,7 @@ impl<'a, C, A> ProjectJobPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7088,7 +7255,7 @@ impl<'a, C, A> ProjectJobPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7225,7 +7392,7 @@ impl<'a, C, A> ProjectGetConfigCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7241,10 +7408,7 @@ impl<'a, C, A> ProjectGetConfigCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7264,7 +7428,7 @@ impl<'a, C, A> ProjectGetConfigCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7342,7 +7506,7 @@ impl<'a, C, A> ProjectGetConfigCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7477,7 +7641,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7516,7 +7677,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectModelTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectModelTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7792,7 +7950,7 @@ impl<'a, C, A> ProjectModelTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectModelTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectOperationListCall<'a, C, A> where C: BorrowMut ProjectOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8080,7 +8235,7 @@ impl<'a, C, A> ProjectOperationListCall<'a, C, A> where C: BorrowMut ProjectOperationListCall<'a, C, A> where C: BorrowMut ProjectModelVersionCreateCall<'a, C, A> where C: BorrowMut ProjectModelVersionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8378,7 +8530,7 @@ impl<'a, C, A> ProjectModelVersionCreateCall<'a, C, A> where C: BorrowMut ProjectModelVersionCreateCall<'a, C, A> where C: BorrowMut ProjectModelGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectModelGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8643,7 +8792,7 @@ impl<'a, C, A> ProjectModelGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectModelGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectModelVersionListCall<'a, C, A> where C: BorrowMut ProjectModelVersionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8917,7 +9063,7 @@ impl<'a, C, A> ProjectModelVersionListCall<'a, C, A> where C: BorrowMut ProjectModelVersionListCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9198,7 +9341,7 @@ impl<'a, C, A> ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationGetCall<'a, C, A> where C: BorrowMut ProjectOperationCancelCall<'a, C, A> where C: BorrowMut ProjectOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9458,7 +9598,7 @@ impl<'a, C, A> ProjectOperationCancelCall<'a, C, A> where C: BorrowMut ProjectOperationCancelCall<'a, C, A> where C: BorrowMut ProjectModelCreateCall<'a, C, A> where C: BorrowMut ProjectModelCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9732,7 +9869,7 @@ impl<'a, C, A> ProjectModelCreateCall<'a, C, A> where C: BorrowMut ProjectModelCreateCall<'a, C, A> where C: BorrowMut ProjectModelDeleteCall<'a, C, A> where C: BorrowMut ProjectModelDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9999,7 +10133,7 @@ impl<'a, C, A> ProjectModelDeleteCall<'a, C, A> where C: BorrowMut ProjectModelDeleteCall<'a, C, A> where C: BorrowMut ProjectJobListCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10245,10 +10379,7 @@ impl<'a, C, A> ProjectJobListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10268,7 +10399,7 @@ impl<'a, C, A> ProjectJobListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10382,7 +10513,7 @@ impl<'a, C, A> ProjectJobListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10518,7 +10649,7 @@ impl<'a, C, A> ProjectModelGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10534,10 +10665,7 @@ impl<'a, C, A> ProjectModelGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10557,7 +10685,7 @@ impl<'a, C, A> ProjectModelGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10635,7 +10763,7 @@ impl<'a, C, A> ProjectModelGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10790,7 +10918,7 @@ impl<'a, C, A> ProjectModelListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10806,10 +10934,7 @@ impl<'a, C, A> ProjectModelListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10829,7 +10954,7 @@ impl<'a, C, A> ProjectModelListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10935,7 +11060,7 @@ impl<'a, C, A> ProjectModelListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/monitoring3-cli/Cargo.toml b/gen/monitoring3-cli/Cargo.toml index 4eb622a3fc..b61ea7c9ca 100644 --- a/gen/monitoring3-cli/Cargo.toml +++ b/gen/monitoring3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-monitoring3-cli" -version = "1.0.8+20181009" +version = "1.0.8+20190331" authors = ["Sebastian Thiel "] description = "A complete library to interact with Monitoring (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/monitoring3-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-monitoring3] path = "../monitoring3" -version = "1.0.8+20181009" +version = "1.0.8+20190331" diff --git a/gen/monitoring3-cli/README.md b/gen/monitoring3-cli/README.md index c37eb0064b..e7ee7d0743 100644 --- a/gen/monitoring3-cli/README.md +++ b/gen/monitoring3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Monitoring* API at revision *20181009*. The CLI is at version *1.0.8*. +This documentation was generated from the *Monitoring* API at revision *20190331*. The CLI is at version *1.0.8*. ```bash monitoring3 [options] diff --git a/gen/monitoring3-cli/mkdocs.yml b/gen/monitoring3-cli/mkdocs.yml index 2ff1bbebf8..39279ecb31 100644 --- a/gen/monitoring3-cli/mkdocs.yml +++ b/gen/monitoring3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Monitoring v1.0.8+20181009 +site_name: Monitoring v1.0.8+20190331 site_url: http://byron.github.io/google-apis-rs/google-monitoring3-cli site_description: A complete library to interact with Monitoring (protocol v3) diff --git a/gen/monitoring3-cli/src/main.rs b/gen/monitoring3-cli/src/main.rs index cfaf2bb81c..2464d13e58 100644 --- a/gen/monitoring3-cli/src/main.rs +++ b/gen/monitoring3-cli/src/main.rs @@ -74,13 +74,13 @@ impl<'n> Engine<'n> { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-record.mutated-by" => Some(("creationRecord.mutatedBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-record.mutate-time" => Some(("creationRecord.mutateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "documentation.mime-type" => Some(("documentation.mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "documentation.content" => Some(("documentation.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "documentation.mime-type" => Some(("documentation.mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enabled" => Some(("enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "mutation-record.mutated-by" => Some(("mutationRecord.mutatedBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "mutation-record.mutate-time" => Some(("mutationRecord.mutateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-labels" => Some(("userLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "notification-channels" => Some(("notificationChannels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "mutation-record.mutated-by" => Some(("mutationRecord.mutatedBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "mutation-record.mutate-time" => Some(("mutationRecord.mutateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["combiner", "content", "creation-record", "display-name", "documentation", "enabled", "mime-type", "mutate-time", "mutated-by", "mutation-record", "name", "notification-channels", "user-labels"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -339,13 +339,13 @@ impl<'n> Engine<'n> { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-record.mutated-by" => Some(("creationRecord.mutatedBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-record.mutate-time" => Some(("creationRecord.mutateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "documentation.mime-type" => Some(("documentation.mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "documentation.content" => Some(("documentation.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "documentation.mime-type" => Some(("documentation.mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enabled" => Some(("enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "mutation-record.mutated-by" => Some(("mutationRecord.mutatedBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "mutation-record.mutate-time" => Some(("mutationRecord.mutateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-labels" => Some(("userLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "notification-channels" => Some(("notificationChannels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "mutation-record.mutated-by" => Some(("mutationRecord.mutatedBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "mutation-record.mutate-time" => Some(("mutationRecord.mutateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["combiner", "content", "creation-record", "display-name", "documentation", "enabled", "mime-type", "mutate-time", "mutated-by", "mutation-record", "name", "notification-channels", "user-labels"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -597,6 +597,9 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "recursive" => { + call = call.recursive(arg_from_str(value.unwrap_or("false"), err, "recursive", "boolean")); + }, _ => { let mut found = false; for param in &self.gp { @@ -610,6 +613,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["recursive"].iter().map(|v|*v)); v } )); } } @@ -2217,16 +2221,15 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "monitored-resource.labels" => Some(("monitoredResource.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "monitored-resource.type" => Some(("monitoredResource.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-group.resource-type" => Some(("resourceGroup.resourceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-group.group-id" => Some(("resourceGroup.groupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "is-internal" => Some(("isInternal", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "tcp-check.port" => Some(("tcpCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "period" => Some(("period", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "selected-regions" => Some(("selectedRegions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "resource-group.resource-type" => Some(("resourceGroup.resourceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "resource-group.group-id" => Some(("resourceGroup.groupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "monitored-resource.labels" => Some(("monitoredResource.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "monitored-resource.type" => Some(("monitoredResource.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-check.use-ssl" => Some(("httpCheck.useSsl", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "http-check.headers" => Some(("httpCheck.headers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "http-check.auth-info.username" => Some(("httpCheck.authInfo.username", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2236,7 +2239,7 @@ impl<'n> Engine<'n> { "http-check.port" => Some(("httpCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "timeout" => Some(("timeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-info", "display-name", "group-id", "headers", "http-check", "is-internal", "labels", "mask-headers", "monitored-resource", "name", "password", "path", "period", "port", "resource-group", "resource-type", "selected-regions", "tcp-check", "timeout", "type", "use-ssl", "username"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-info", "display-name", "group-id", "headers", "http-check", "labels", "mask-headers", "monitored-resource", "name", "password", "path", "period", "port", "resource-group", "resource-type", "selected-regions", "tcp-check", "timeout", "type", "use-ssl", "username"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2482,16 +2485,15 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "monitored-resource.labels" => Some(("monitoredResource.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "monitored-resource.type" => Some(("monitoredResource.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-group.resource-type" => Some(("resourceGroup.resourceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-group.group-id" => Some(("resourceGroup.groupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "is-internal" => Some(("isInternal", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "tcp-check.port" => Some(("tcpCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "period" => Some(("period", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "selected-regions" => Some(("selectedRegions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "resource-group.resource-type" => Some(("resourceGroup.resourceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "resource-group.group-id" => Some(("resourceGroup.groupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "monitored-resource.labels" => Some(("monitoredResource.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "monitored-resource.type" => Some(("monitoredResource.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "http-check.use-ssl" => Some(("httpCheck.useSsl", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "http-check.headers" => Some(("httpCheck.headers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "http-check.auth-info.username" => Some(("httpCheck.authInfo.username", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2501,7 +2503,7 @@ impl<'n> Engine<'n> { "http-check.port" => Some(("httpCheck.port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "timeout" => Some(("timeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-info", "display-name", "group-id", "headers", "http-check", "is-internal", "labels", "mask-headers", "monitored-resource", "name", "password", "path", "period", "port", "resource-group", "resource-type", "selected-regions", "tcp-check", "timeout", "type", "use-ssl", "username"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["auth-info", "display-name", "group-id", "headers", "http-check", "labels", "mask-headers", "monitored-resource", "name", "password", "path", "period", "port", "resource-group", "resource-type", "selected-regions", "tcp-check", "timeout", "type", "use-ssl", "username"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3732,7 +3734,7 @@ fn main() { let mut app = App::new("monitoring3") .author("Sebastian Thiel ") - .version("1.0.8+20181009") + .version("1.0.8+20190331") .about("Manages your Stackdriver Monitoring data and configurations. Most projects must be associated with a Stackdriver account, with a few exceptions as noted on the individual method pages.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_monitoring3_cli") .arg(Arg::with_name("url") diff --git a/gen/monitoring3/Cargo.toml b/gen/monitoring3/Cargo.toml index e696906191..fbcdc7dd4d 100644 --- a/gen/monitoring3/Cargo.toml +++ b/gen/monitoring3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-monitoring3" -version = "1.0.8+20181009" +version = "1.0.8+20190331" authors = ["Sebastian Thiel "] description = "A complete library to interact with Monitoring (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/monitoring3" homepage = "https://cloud.google.com/monitoring/api/" -documentation = "https://docs.rs/google-monitoring3/1.0.8+20181009" +documentation = "https://docs.rs/google-monitoring3/1.0.8+20190331" license = "MIT" keywords = ["monitoring", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/monitoring3/README.md b/gen/monitoring3/README.md index f23acfcd4c..2a8c3f6217 100644 --- a/gen/monitoring3/README.md +++ b/gen/monitoring3/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-monitoring3` library allows access to all features of the *Google Monitoring* service. -This documentation was generated from *Monitoring* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Monitoring* crate version *1.0.8+20190331*, where *20190331* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Monitoring* *v3* API can be found at the [official documentation site](https://cloud.google.com/monitoring/api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.Monitoring.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.Monitoring.html) ... * projects - * [*alert policies create*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectAlertPolicyCreateCall.html), [*alert policies delete*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectAlertPolicyDeleteCall.html), [*alert policies get*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectAlertPolicyGetCall.html), [*alert policies list*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectAlertPolicyListCall.html), [*alert policies patch*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectAlertPolicyPatchCall.html), [*collectd time series create*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectCollectdTimeSeryCreateCall.html), [*groups create*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectGroupCreateCall.html), [*groups delete*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectGroupDeleteCall.html), [*groups get*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectGroupGetCall.html), [*groups list*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectGroupListCall.html), [*groups members list*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectGroupMemberListCall.html), [*groups update*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectGroupUpdateCall.html), [*metric descriptors create*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectMetricDescriptorCreateCall.html), [*metric descriptors delete*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectMetricDescriptorDeleteCall.html), [*metric descriptors get*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectMetricDescriptorGetCall.html), [*metric descriptors list*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectMetricDescriptorListCall.html), [*monitored resource descriptors get*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectMonitoredResourceDescriptorGetCall.html), [*monitored resource descriptors list*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectMonitoredResourceDescriptorListCall.html), [*notification channel descriptors get*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectNotificationChannelDescriptorGetCall.html), [*notification channel descriptors list*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectNotificationChannelDescriptorListCall.html), [*notification channels create*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectNotificationChannelCreateCall.html), [*notification channels delete*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectNotificationChannelDeleteCall.html), [*notification channels get*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectNotificationChannelGetCall.html), [*notification channels get verification code*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectNotificationChannelGetVerificationCodeCall.html), [*notification channels list*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectNotificationChannelListCall.html), [*notification channels patch*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectNotificationChannelPatchCall.html), [*notification channels send verification code*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectNotificationChannelSendVerificationCodeCall.html), [*notification channels verify*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectNotificationChannelVerifyCall.html), [*time series create*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectTimeSeryCreateCall.html), [*time series list*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectTimeSeryListCall.html), [*uptime check configs create*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectUptimeCheckConfigCreateCall.html), [*uptime check configs delete*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectUptimeCheckConfigDeleteCall.html), [*uptime check configs get*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectUptimeCheckConfigGetCall.html), [*uptime check configs list*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectUptimeCheckConfigListCall.html) and [*uptime check configs patch*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.ProjectUptimeCheckConfigPatchCall.html) -* [uptime check ips](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.UptimeCheckIp.html) - * [*list*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.UptimeCheckIpListCall.html) + * [*alert policies create*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectAlertPolicyCreateCall.html), [*alert policies delete*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectAlertPolicyDeleteCall.html), [*alert policies get*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectAlertPolicyGetCall.html), [*alert policies list*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectAlertPolicyListCall.html), [*alert policies patch*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectAlertPolicyPatchCall.html), [*collectd time series create*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectCollectdTimeSeryCreateCall.html), [*groups create*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectGroupCreateCall.html), [*groups delete*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectGroupDeleteCall.html), [*groups get*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectGroupGetCall.html), [*groups list*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectGroupListCall.html), [*groups members list*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectGroupMemberListCall.html), [*groups update*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectGroupUpdateCall.html), [*metric descriptors create*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectMetricDescriptorCreateCall.html), [*metric descriptors delete*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectMetricDescriptorDeleteCall.html), [*metric descriptors get*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectMetricDescriptorGetCall.html), [*metric descriptors list*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectMetricDescriptorListCall.html), [*monitored resource descriptors get*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectMonitoredResourceDescriptorGetCall.html), [*monitored resource descriptors list*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectMonitoredResourceDescriptorListCall.html), [*notification channel descriptors get*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectNotificationChannelDescriptorGetCall.html), [*notification channel descriptors list*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectNotificationChannelDescriptorListCall.html), [*notification channels create*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectNotificationChannelCreateCall.html), [*notification channels delete*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectNotificationChannelDeleteCall.html), [*notification channels get*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectNotificationChannelGetCall.html), [*notification channels get verification code*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectNotificationChannelGetVerificationCodeCall.html), [*notification channels list*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectNotificationChannelListCall.html), [*notification channels patch*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectNotificationChannelPatchCall.html), [*notification channels send verification code*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectNotificationChannelSendVerificationCodeCall.html), [*notification channels verify*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectNotificationChannelVerifyCall.html), [*time series create*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectTimeSeryCreateCall.html), [*time series list*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectTimeSeryListCall.html), [*uptime check configs create*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectUptimeCheckConfigCreateCall.html), [*uptime check configs delete*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectUptimeCheckConfigDeleteCall.html), [*uptime check configs get*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectUptimeCheckConfigGetCall.html), [*uptime check configs list*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectUptimeCheckConfigListCall.html) and [*uptime check configs patch*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.ProjectUptimeCheckConfigPatchCall.html) +* [uptime check ips](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.UptimeCheckIp.html) + * [*list*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.UptimeCheckIpListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/struct.Monitoring.html)** +* **[Hub](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/struct.Monitoring.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.Part.html)** + * **[Parts](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-monitoring3/1.0.8+20181009/google_monitoring3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-monitoring3/1.0.8+20190331/google_monitoring3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/monitoring3/src/lib.rs b/gen/monitoring3/src/lib.rs index edd68e4bd5..238b06cd17 100644 --- a/gen/monitoring3/src/lib.rs +++ b/gen/monitoring3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Monitoring* crate version *1.0.8+20181009*, where *20181009* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Monitoring* crate version *1.0.8+20190331*, where *20190331* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Monitoring* *v3* API can be found at the //! [official documentation site](https://cloud.google.com/monitoring/api/). @@ -234,14 +234,14 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// Publish metric data to your Google Cloud projects - Write, + /// View monitoring data for all of your Google Cloud and third-party projects + Read, /// View and manage your data across Google Cloud Platform services CloudPlatform, - /// View monitoring data for all of your Google Cloud and third-party projects - Read, + /// Publish metric data to your Google Cloud projects + Write, /// View and write monitoring data for all of your Google and third-party Cloud and API projects Full, @@ -250,9 +250,9 @@ pub enum Scope { impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { - Scope::Write => "https://www.googleapis.com/auth/monitoring.write", - Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", Scope::Read => "https://www.googleapis.com/auth/monitoring.read", + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::Write => "https://www.googleapis.com/auth/monitoring.write", Scope::Full => "https://www.googleapis.com/auth/monitoring", } } @@ -461,29 +461,29 @@ impl RequestValue for Group {} impl ResponseResult for Group {} -/// A collection of data points that describes the time-varying values of a metric. A time series is identified by a combination of a fully-specified monitored resource and a fully-specified metric. This type is used for both listing and creating time series. +/// The protocol for the ListUptimeCheckConfigs response. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [uptime check configs list projects](struct.ProjectUptimeCheckConfigListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TimeSeries { - /// The data points of this time series. When listing time series, points are returned in reverse time order.When creating a time series, this field must contain exactly one point and the point's type must be the same as the value type of the associated metric. If the associated metric's descriptor must be auto-created, then the value type of the descriptor is determined by the point's type, which must be BOOL, INT64, DOUBLE, or DISTRIBUTION. - pub points: Option>, - /// The associated monitored resource. Custom metrics can use only certain monitored resource types in their time series data. - pub resource: Option, - /// The metric kind of the time series. When listing time series, this metric kind might be different from the metric kind of the associated metric if this time series is an alignment or reduction of other time series.When creating a time series, this field is optional. If present, it must be the same as the metric kind of the associated metric. If the associated metric's descriptor must be auto-created, then this field specifies the metric kind of the new descriptor and must be either GAUGE (the default) or CUMULATIVE. - #[serde(rename="metricKind")] - pub metric_kind: Option, - /// The value type of the time series. When listing time series, this value type might be different from the value type of the associated metric if this time series is an alignment or reduction of other time series.When creating a time series, this field is optional. If present, it must be the same as the type of the data in the points field. - #[serde(rename="valueType")] - pub value_type: Option, - /// The associated metric. A fully-specified metric used to identify the time series. - pub metric: Option, - /// Output only. The associated monitored resource metadata. When reading a a timeseries, this field will include metadata labels that are explicitly named in the reduction. When creating a timeseries, this field is ignored. - pub metadata: Option, +pub struct ListUptimeCheckConfigsResponse { + /// This field represents the pagination token to retrieve the next page of results. If the value is empty, it means no further results for the request. To retrieve the next page of results, the value of the next_page_token is passed to the subsequent List method call (in the request message's page_token field). + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The total number of uptime check configurations for the project, irrespective of any pagination. + #[serde(rename="totalSize")] + pub total_size: Option, + /// The returned uptime check configurations. + #[serde(rename="uptimeCheckConfigs")] + pub uptime_check_configs: Option>, } -impl Part for TimeSeries {} +impl ResponseResult for ListUptimeCheckConfigsResponse {} /// BucketOptions describes the bucket boundaries used to create a histogram for the distribution. The buckets can be in a linear sequence, an exponential sequence, or each bucket can be specified explicitly. BucketOptions does not include the number of values in each bucket.A bucket has an inclusive lower bound and exclusive upper bound for the values that are counted for that bucket. The upper bound of a bucket must be strictly greater than the lower bound. The sequence of N buckets for a distribution consists of an underflow bucket (number 0), zero or more finite buckets (number 1 through N - 2) and an overflow bucket (number N - 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the same as the upper bound of bucket i - 1. The buckets span the whole range of finite values: lower bound of the underflow bucket is -infinity and the upper bound of the overflow bucket is +infinity. The finite buckets are so-called because both bounds are finite. @@ -573,32 +573,29 @@ impl Part for CollectdValue {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UptimeCheckConfig { - /// The group resource associated with the configuration. - #[serde(rename="resourceGroup")] - pub resource_group: Option, + /// The monitored resource (https://cloud.google.com/monitoring/api/resources) associated with the configuration. The following monitored resource types are supported for uptime checks: uptime_url gce_instance gae_app aws_ec2_instance aws_elb_load_balancer + #[serde(rename="monitoredResource")] + pub monitored_resource: Option, /// A human-friendly name for the uptime check configuration. The display name should be unique within a Stackdriver Workspace in order to make it easier to identify; however, uniqueness is not enforced. Required. #[serde(rename="displayName")] pub display_name: Option, /// A unique resource name for this UptimeCheckConfig. The format is:projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].This field should be omitted when creating the uptime check configuration; on create, the resource name is assigned by the server and included in the response. pub name: Option, - /// Denotes whether this is a check that egresses from InternalCheckers. - #[serde(rename="isInternal")] - pub is_internal: Option, /// Contains information needed to make a TCP check. #[serde(rename="tcpCheck")] pub tcp_check: Option, - /// How often, in seconds, the uptime check is performed. Currently, the only supported values are 60s (1 minute), 300s (5 minutes), 600s (10 minutes), and 900s (15 minutes). Optional, defaults to 300s. - pub period: Option, - /// The list of regions from which the check will be run. If this field is specified, enough regions to include a minimum of 3 locations must be provided, or an error message is returned. Not specifying this field will result in uptime checks running from all regions. + /// The list of regions from which the check will be run. Some regions contain one location, and others contain more than one. If this field is specified, enough regions to include a minimum of 3 locations must be provided, or an error message is returned. Not specifying this field will result in uptime checks running from all regions. #[serde(rename="selectedRegions")] pub selected_regions: Option>, - /// The monitored resource (https://cloud.google.com/monitoring/api/resources) associated with the configuration. The following monitored resource types are supported for uptime checks: uptime_url gce_instance gae_app aws_ec2_instance aws_elb_load_balancer - #[serde(rename="monitoredResource")] - pub monitored_resource: Option, + /// How often, in seconds, the uptime check is performed. Currently, the only supported values are 60s (1 minute), 300s (5 minutes), 600s (10 minutes), and 900s (15 minutes). Optional, defaults to 60s. + pub period: Option, + /// The group resource associated with the configuration. + #[serde(rename="resourceGroup")] + pub resource_group: Option, /// Contains information needed to make an HTTP or HTTPS check. #[serde(rename="httpCheck")] pub http_check: Option, - /// The internal checkers that this check will egress from. If is_internal is true and this list is empty, the check will egress from all InternalCheckers configured for the project that owns this CheckConfig. + /// The internal checkers that this check will egress from. If is_internal is true and this list is empty, the check will egress from all the InternalCheckers configured for the project that owns this CheckConfig. #[serde(rename="internalCheckers")] pub internal_checkers: Option>, /// The maximum amount of time to wait for the request to complete (must be between 1 and 60 seconds). Required. @@ -632,6 +629,36 @@ pub struct MetricDescriptorMetadata { impl Part for MetricDescriptorMetadata {} +/// Distribution contains summary statistics for a population of values. It optionally contains a histogram representing the distribution of those values across a set of buckets.The summary statistics are the count, mean, sum of the squared deviation from the mean, the minimum, and the maximum of the set of population of values. The histogram is based on a sequence of buckets and gives a count of values that fall into each bucket. The boundaries of the buckets are given either explicitly or by formulas for buckets of fixed or exponentially increasing widths.Although it is not forbidden, it is generally a bad idea to include non-finite values (infinities or NaNs) in the population of values, as this will render the mean and sum_of_squared_deviation fields meaningless. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Distribution { + /// The number of values in the population. Must be non-negative. This value must equal the sum of the values in bucket_counts if a histogram is provided. + pub count: Option, + /// Required in the Stackdriver Monitoring API v3. The values for each bucket specified in bucket_options. The sum of the values in bucketCounts must equal the value in the count field of the Distribution object. The order of the bucket counts follows the numbering schemes described for the three bucket types. The underflow bucket has number 0; the finite buckets, if any, have numbers 1 through N-2; and the overflow bucket has number N-1. The size of bucket_counts must not be greater than N. If the size is less than N, then the remaining buckets are assigned values of zero. + #[serde(rename="bucketCounts")] + pub bucket_counts: Option>, + /// The sum of squared deviations from the mean of the values in the population. For values x_i this is: + /// Sum[i=1..n]((x_i - mean)^2) + /// Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition describes Welford's method for accumulating this sum in one pass.If count is zero then this field must be zero. + #[serde(rename="sumOfSquaredDeviation")] + pub sum_of_squared_deviation: Option, + /// If specified, contains the range of the population values. The field must not be present if the count is zero. This field is presently ignored by the Stackdriver Monitoring API v3. + pub range: Option, + /// Required in the Stackdriver Monitoring API v3. Defines the histogram bucket boundaries. + #[serde(rename="bucketOptions")] + pub bucket_options: Option, + /// Must be in increasing order of value field. + pub exemplars: Option>, + /// The arithmetic mean of the values in the population. If count is zero then this field must be zero. + pub mean: Option, +} + +impl Part for Distribution {} + + /// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: /// service Foo { /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); @@ -720,10 +747,10 @@ impl Part for Linear {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MetricAbsence { - /// A filter that identifies which time series should be compared with the threshold.The filter is similar to the one that is specified in the MetricService.ListTimeSeries request (that call is useful to verify the time series that will be retrieved / processed) and must specify the metric type and optionally may contain restrictions on resource type, resource labels, and metric labels. This field may not exceed 2048 Unicode characters in length. - pub filter: Option, /// The amount of time that a time series must fail to report new data to be considered failing. Currently, only values that are a multiple of a minute--e.g. 60, 120, or 300 seconds--are supported. If an invalid value is given, an error will be returned. The Duration.nanos field is ignored. pub duration: Option, + /// A filter that identifies which time series should be compared with the threshold.The filter is similar to the one that is specified in the MetricService.ListTimeSeries request (that call is useful to verify the time series that will be retrieved / processed) and must specify the metric type and optionally may contain restrictions on resource type, resource labels, and metric labels. This field may not exceed 2048 Unicode characters in length. + pub filter: Option, /// The number/percent of time series for which the comparison must hold in order for the condition to trigger. If unspecified, then the condition will trigger if the comparison is true for any of the time series that have been identified by filter and aggregations. pub trigger: Option, /// Specifies the alignment of data points in individual time series as well as how to combine the retrieved time series together (such as when aggregating multiple streams on each resource to a single stream for each resource or when aggregating streams across all members of a group of resrouces). Multiple aggregations are applied in the order specified.This field is similar to the one in the MetricService.ListTimeSeries request. It is advisable to use the ListTimeSeries method when debugging this field. @@ -739,15 +766,15 @@ impl Part for MetricAbsence {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Aggregation { - /// The approach to be used to align individual time series. Not all alignment functions may be applied to all time series, depending on the metric type and value type of the original time series. Alignment may change the metric type or the value type of the time series.Time series data must be aligned in order to perform cross-time series reduction. If crossSeriesReducer is specified, then perSeriesAligner must be specified and not equal ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error is returned. - #[serde(rename="perSeriesAligner")] - pub per_series_aligner: Option, - /// The alignment period for per-time series alignment. If present, alignmentPeriod must be at least 60 seconds. After per-time series alignment, each time series will contain data points only on the period boundaries. If perSeriesAligner is not specified or equals ALIGN_NONE, then this field is ignored. If perSeriesAligner is specified and does not equal ALIGN_NONE, then this field must be defined; otherwise an error is returned. - #[serde(rename="alignmentPeriod")] - pub alignment_period: Option, /// The set of fields to preserve when crossSeriesReducer is specified. The groupByFields determine how the time series are partitioned into subsets prior to applying the aggregation function. Each subset contains time series that have the same value for each of the grouping fields. Each individual time series is a member of exactly one subset. The crossSeriesReducer is applied to each subset of time series. It is not possible to reduce across different resource types, so this field implicitly contains resource.type. Fields not specified in groupByFields are aggregated away. If groupByFields is not specified and all the time series have the same resource type, then the time series are aggregated into a single output time series. If crossSeriesReducer is not defined, this field is ignored. #[serde(rename="groupByFields")] pub group_by_fields: Option>, + /// The alignment period for per-time series alignment. If present, alignmentPeriod must be at least 60 seconds. After per-time series alignment, each time series will contain data points only on the period boundaries. If perSeriesAligner is not specified or equals ALIGN_NONE, then this field is ignored. If perSeriesAligner is specified and does not equal ALIGN_NONE, then this field must be defined; otherwise an error is returned. + #[serde(rename="alignmentPeriod")] + pub alignment_period: Option, + /// The approach to be used to align individual time series. Not all alignment functions may be applied to all time series, depending on the metric type and value type of the original time series. Alignment may change the metric type or the value type of the time series.Time series data must be aligned in order to perform cross-time series reduction. If crossSeriesReducer is specified, then perSeriesAligner must be specified and not equal ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error is returned. + #[serde(rename="perSeriesAligner")] + pub per_series_aligner: Option, /// The approach to be used to combine time series. Not all reducer functions may be applied to all time series, depending on the metric type and the value type of the original time series. Reduction may change the metric type of value type of the time series.Time series data must be aligned in order to perform cross-time series reduction. If crossSeriesReducer is specified, then perSeriesAligner must be specified and not equal ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error is returned. #[serde(rename="crossSeriesReducer")] pub cross_series_reducer: Option, @@ -773,7 +800,7 @@ pub struct NotificationChannel { /// An optional human-readable name for this notification channel. It is recommended that you specify a non-empty and unique name in order to make it easier to identify the channels in your project, though this is not enforced. The display name is limited to 512 Unicode characters. #[serde(rename="displayName")] pub display_name: Option, - /// An optional human-readable description of this notification channel. This description may provide additional details, beyond the display name, for the channel. This may not exceeed 1024 Unicode characters. + /// An optional human-readable description of this notification channel. This description may provide additional details, beyond the display name, for the channel. This may not exceed 1024 Unicode characters. pub description: Option, /// Configuration fields that define the channel and its behavior. The permissible and required labels are specified in the NotificationChannelDescriptor.labels of the NotificationChannelDescriptor corresponding to the type field. pub labels: Option>, @@ -827,6 +854,9 @@ pub struct AlertPolicy { pub documentation: Option, /// Whether or not the policy is enabled. On write, the default interpretation if unset is that the policy is enabled. On read, clients should not make any assumption about the state if it has not been populated. The field should always be populated on List and Get operations, unless a field projection has been specified that strips it out. pub enabled: Option, + /// A read-only record of the most recent change to the alerting policy. If provided in a call to create or update, this field will be ignored. + #[serde(rename="mutationRecord")] + pub mutation_record: Option, /// User-supplied key/value data to be used for organizing and identifying the AlertPolicy objects.The field can contain up to 64 entries. Each key and value is limited to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values can contain only lowercase letters, numerals, underscores, and dashes. Keys must begin with a letter. #[serde(rename="userLabels")] pub user_labels: Option>, @@ -835,9 +865,6 @@ pub struct AlertPolicy { /// #[serde(rename="notificationChannels")] pub notification_channels: Option>, - /// A read-only record of the most recent change to the alerting policy. If provided in a call to create or update, this field will be ignored. - #[serde(rename="mutationRecord")] - pub mutation_record: Option, /// A list of conditions for the policy. The conditions are combined by AND or OR according to the combiner field. If the combined conditions evaluate to true, then an incident is created. A policy can have from one to six conditions. pub conditions: Option>, } @@ -870,7 +897,7 @@ pub struct Condition { impl Part for Condition {} -/// A time interval extending just after a start time through an end time. If the start time is the same as the end time, then the interval represents a single point in time. +/// A time interval extending just after a start time through an end time. The start time must not be later than the end time. The default start time is the end time, making the startTime value technically optional. Whether this is useful depends on the MetricKind. If the start and end times are the same, the interval represents a point in time. This is appropriate for GAUGE metrics, but not for DELTA and CUMULATIVE metrics, which cover a span of time. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -1141,12 +1168,12 @@ impl Part for MetricThreshold {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListUptimeCheckIpsResponse { - /// The returned list of IP addresses (including region and location) that the checkers run from. - #[serde(rename="uptimeCheckIps")] - pub uptime_check_ips: Option>, /// This field represents the pagination token to retrieve the next page of results. If the value is empty, it means no further results for the request. To retrieve the next page of results, the value of the next_page_token is passed to the subsequent List method call (in the request message's page_token field). NOTE: this field is not yet implemented #[serde(rename="nextPageToken")] pub next_page_token: Option, + /// The returned list of IP addresses (including region and location) that the checkers run from. + #[serde(rename="uptimeCheckIps")] + pub uptime_check_ips: Option>, } impl ResponseResult for ListUptimeCheckIpsResponse {} @@ -1453,10 +1480,10 @@ pub struct MonitoredResourceDescriptor { /// Required. The monitored resource type. For example, the type "cloudsql_database" represents databases in Google Cloud SQL. The maximum length of this value is 256 characters. #[serde(rename="type")] pub type_: Option, - /// Optional. The resource name of the monitored resource descriptor: "projects/{project_id}/monitoredResourceDescriptors/{type}" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format "monitoredResourceDescriptors/{type}". - pub name: Option, /// Optional. A detailed description of the monitored resource type that might be used in documentation. pub description: Option, + /// Optional. The resource name of the monitored resource descriptor: "projects/{project_id}/monitoredResourceDescriptors/{type}" where {type} is the value of the type field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format "monitoredResourceDescriptors/{type}". + pub name: Option, } impl ResponseResult for MonitoredResourceDescriptor {} @@ -1538,11 +1565,11 @@ impl ResponseResult for ListNotificationChannelDescriptorsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Documentation { + /// The text of the documentation, interpreted according to mime_type. The content may not exceed 8,192 Unicode characters and may not exceed more than 10,240 bytes when encoded in UTF-8 format, whichever is smaller. + pub content: Option, /// The format of the content field. Presently, only the value "text/markdown" is supported. See Markdown (https://en.wikipedia.org/wiki/Markdown) for more information. #[serde(rename="mimeType")] pub mime_type: Option, - /// The text of the documentation, interpreted according to mime_type. The content may not exceed 8,192 Unicode characters and may not exceed more than 10,240 bytes when encoded in UTF-8 format, whichever is smaller. - pub content: Option, } impl Part for Documentation {} @@ -1565,7 +1592,7 @@ pub struct HttpCheck { /// Boolean specifiying whether to encrypt the header information. Encryption should be specified for any headers related to authentication that you do not wish to be seen when retrieving the configuration. The server will be responsible for encrypting the headers. On Get/List calls, if mask_headers is set to True then the headers will be obscured with ******. #[serde(rename="maskHeaders")] pub mask_headers: Option, - /// The path to the page to run the check against. Will be combined with the host (specified within the MonitoredResource) and port to construct the full URL. Optional (defaults to "/"). + /// The path to the page to run the check against. Will be combined with the host (specified within the MonitoredResource) and port to construct the full URL. Optional (defaults to "/"). If the provided path does not begin with "/", it will be prepended automatically. pub path: Option, /// The port to the page to run the check against. Will be combined with host (specified within the MonitoredResource) and path to construct the full URL. Optional (defaults to 80 without SSL, or 443 with SSL). pub port: Option, @@ -1597,7 +1624,7 @@ impl Part for Range {} pub struct Exemplar { /// The observation (sampling) time of the above value. pub timestamp: Option, - /// Contextual information about the example value. Examples are:Trace ID: type.googleapis.com/google.devtools.cloudtrace.v1.TraceLiteral string: type.googleapis.com/google.protobuf.StringValueLabels dropped during aggregation: type.googleapis.com/google.monitoring.v3.DroppedLabelsThere may be only a single attachment of any given message type in a single exemplar, and this is enforced by the system. + /// Contextual information about the example value. Examples are:Trace: type.googleapis.com/google.monitoring.v3.SpanContextLiteral string: type.googleapis.com/google.protobuf.StringValueLabels dropped during aggregation: type.googleapis.com/google.monitoring.v3.DroppedLabelsThere may be only a single attachment of any given message type in a single exemplar, and this is enforced by the system. pub attachments: Option>>, /// Value of the exemplar point. This value determines to which bucket the exemplar belongs. pub value: Option, @@ -1606,59 +1633,29 @@ pub struct Exemplar { impl Part for Exemplar {} -/// The protocol for the ListUptimeCheckConfigs response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [uptime check configs list projects](struct.ProjectUptimeCheckConfigListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListUptimeCheckConfigsResponse { - /// This field represents the pagination token to retrieve the next page of results. If the value is empty, it means no further results for the request. To retrieve the next page of results, the value of the next_page_token is passed to the subsequent List method call (in the request message's page_token field). - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The total number of uptime check configurations for the project, irrespective of any pagination. - #[serde(rename="totalSize")] - pub total_size: Option, - /// The returned uptime check configurations. - #[serde(rename="uptimeCheckConfigs")] - pub uptime_check_configs: Option>, -} - -impl ResponseResult for ListUptimeCheckConfigsResponse {} - - -/// Distribution contains summary statistics for a population of values. It optionally contains a histogram representing the distribution of those values across a set of buckets.The summary statistics are the count, mean, sum of the squared deviation from the mean, the minimum, and the maximum of the set of population of values. The histogram is based on a sequence of buckets and gives a count of values that fall into each bucket. The boundaries of the buckets are given either explicitly or by formulas for buckets of fixed or exponentially increasing widths.Although it is not forbidden, it is generally a bad idea to include non-finite values (infinities or NaNs) in the population of values, as this will render the mean and sum_of_squared_deviation fields meaningless. +/// A collection of data points that describes the time-varying values of a metric. A time series is identified by a combination of a fully-specified monitored resource and a fully-specified metric. This type is used for both listing and creating time series. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Distribution { - /// The number of values in the population. Must be non-negative. This value must equal the sum of the values in bucket_counts if a histogram is provided. - pub count: Option, - /// Required in the Stackdriver Monitoring API v3. The values for each bucket specified in bucket_options. The sum of the values in bucketCounts must equal the value in the count field of the Distribution object. The order of the bucket counts follows the numbering schemes described for the three bucket types. The underflow bucket has number 0; the finite buckets, if any, have numbers 1 through N-2; and the overflow bucket has number N-1. The size of bucket_counts must not be greater than N. If the size is less than N, then the remaining buckets are assigned values of zero. - #[serde(rename="bucketCounts")] - pub bucket_counts: Option>, - /// The sum of squared deviations from the mean of the values in the population. For values x_i this is: - /// Sum[i=1..n]((x_i - mean)^2) - /// Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition describes Welford's method for accumulating this sum in one pass.If count is zero then this field must be zero. - #[serde(rename="sumOfSquaredDeviation")] - pub sum_of_squared_deviation: Option, - /// If specified, contains the range of the population values. The field must not be present if the count is zero. This field is presently ignored by the Stackdriver Monitoring API v3. - pub range: Option, - /// Required in the Stackdriver Monitoring API v3. Defines the histogram bucket boundaries. - #[serde(rename="bucketOptions")] - pub bucket_options: Option, - /// Must be in increasing order of value field. - pub exemplars: Option>, - /// The arithmetic mean of the values in the population. If count is zero then this field must be zero. - pub mean: Option, +pub struct TimeSeries { + /// The data points of this time series. When listing time series, points are returned in reverse time order.When creating a time series, this field must contain exactly one point and the point's type must be the same as the value type of the associated metric. If the associated metric's descriptor must be auto-created, then the value type of the descriptor is determined by the point's type, which must be BOOL, INT64, DOUBLE, or DISTRIBUTION. + pub points: Option>, + /// The associated monitored resource. Custom metrics can use only certain monitored resource types in their time series data. + pub resource: Option, + /// The metric kind of the time series. When listing time series, this metric kind might be different from the metric kind of the associated metric if this time series is an alignment or reduction of other time series.When creating a time series, this field is optional. If present, it must be the same as the metric kind of the associated metric. If the associated metric's descriptor must be auto-created, then this field specifies the metric kind of the new descriptor and must be either GAUGE (the default) or CUMULATIVE. + #[serde(rename="metricKind")] + pub metric_kind: Option, + /// The associated metric. A fully-specified metric used to identify the time series. + pub metric: Option, + /// The value type of the time series. When listing time series, this value type might be different from the value type of the associated metric if this time series is an alignment or reduction of other time series.When creating a time series, this field is optional. If present, it must be the same as the type of the data in the points field. + #[serde(rename="valueType")] + pub value_type: Option, + /// Output only. The associated monitored resource metadata. When reading a a timeseries, this field will include metadata labels that are explicitly named in the reduction. When creating a timeseries, this field is ignored. + pub metadata: Option, } -impl Part for Distribution {} +impl Part for TimeSeries {} /// A type of authentication to perform against the specified resource or URL that uses username and password. Currently, only Basic authentication is supported in Uptime Monitoring. @@ -1694,19 +1691,24 @@ pub struct LabelDescriptor { impl Part for LabelDescriptor {} -/// Nimbus InternalCheckers. The API currently only allows reading of internal checkers, creation of internal checkers is a manual process. +/// An internal checker allows uptime checks to run on private/internal GCP resources. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InternalChecker { + /// The current operational state of the internal checker. + pub state: Option, /// The checker's human-readable name. The display name should be unique within a Stackdriver Workspace in order to make it easier to identify; however, uniqueness is not enforced. #[serde(rename="displayName")] pub display_name: Option, /// The GCP VPC network (https://cloud.google.com/vpc/docs/vpc) where the internal resource lives (ex: "default"). pub network: Option, - /// A unique resource name for this InternalChecker. The format is:projects/[PROJECT_ID]/internalCheckers/[CHECKER_ID].PROJECT_ID is the GCP project ID where the internal resource lives. Not necessarily the same as the project_id for the config. + /// A unique resource name for this InternalChecker. The format is:projects/[PROJECT_ID]/internalCheckers/[INTERNAL_CHECKER_ID].PROJECT_ID is the stackdriver workspace project for the uptime check config associated with the internal checker. pub name: Option, + /// The GCP project_id where the internal checker lives. Not necessary the same as the workspace project. + #[serde(rename="peerProjectId")] + pub peer_project_id: Option, /// The GCP zone the uptime check should egress from. Only respected for internal uptime checks, where internal_network is specified. #[serde(rename="gcpZone")] pub gcp_zone: Option, @@ -1772,7 +1774,7 @@ impl Part for Metric {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreateTimeSeriesRequest { - /// The new data to be added to a list of time series. Adds at most one data point to each of several time series. The new data point must be more recent than any other point in its time series. Each TimeSeries value must fully specify a unique time series by supplying all label values for the metric and the monitored resource. + /// The new data to be added to a list of time series. Adds at most one data point to each of several time series. The new data point must be more recent than any other point in its time series. Each TimeSeries value must fully specify a unique time series by supplying all label values for the metric and the monitored resource.The maximum number of TimeSeries objects per Create request is 200. #[serde(rename="timeSeries")] pub time_series: Option>, } @@ -1901,13 +1903,13 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a single metric descriptor. This method does not require a Stackdriver account. + /// Gets a single notification channel. The channel includes the relevant configuration details with which the channel was created. However, the response may truncate or omit passwords, API keys, or other private key matter and thus the response may not be 100% identical to the information that was supplied in the call to the create method. /// /// # Arguments /// - /// * `name` - The metric descriptor on which to execute the request. The format is "projects/{project_id_or_number}/metricDescriptors/{metric_id}". An example value of {metric_id} is "compute.googleapis.com/instance/disk/read_bytes_count". - pub fn metric_descriptors_get(&self, name: &str) -> ProjectMetricDescriptorGetCall<'a, C, A> { - ProjectMetricDescriptorGetCall { + /// * `name` - The channel for which to execute the request. The format is projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]. + pub fn notification_channels_get(&self, name: &str) -> ProjectNotificationChannelGetCall<'a, C, A> { + ProjectNotificationChannelGetCall { hub: self.hub, _name: name.to_string(), _delegate: Default::default(), @@ -1918,20 +1920,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via updateMask. Returns the updated alerting policy. + /// Gets a single metric descriptor. This method does not require a Stackdriver account. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `name` - Required if the policy exists. The resource name for this policy. The syntax is: - /// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - /// [ALERT_POLICY_ID] is assigned by Stackdriver Monitoring when the policy is created. When calling the alertPolicies.create method, do not include the name field in the alerting policy passed as part of the request. - pub fn alert_policies_patch(&self, request: AlertPolicy, name: &str) -> ProjectAlertPolicyPatchCall<'a, C, A> { - ProjectAlertPolicyPatchCall { + /// * `name` - The metric descriptor on which to execute the request. The format is "projects/{project_id_or_number}/metricDescriptors/{metric_id}". An example value of {metric_id} is "compute.googleapis.com/instance/disk/read_bytes_count". + pub fn metric_descriptors_get(&self, name: &str) -> ProjectMetricDescriptorGetCall<'a, C, A> { + ProjectMetricDescriptorGetCall { hub: self.hub, - _request: request, _name: name.to_string(), - _update_mask: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2262,17 +2259,20 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a single alerting policy. + /// Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via updateMask. Returns the updated alerting policy. /// /// # Arguments /// - /// * `name` - The alerting policy to retrieve. The format is + /// * `request` - No description provided. + /// * `name` - Required if the policy exists. The resource name for this policy. The syntax is: /// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - /// - pub fn alert_policies_get(&self, name: &str) -> ProjectAlertPolicyGetCall<'a, C, A> { - ProjectAlertPolicyGetCall { + /// [ALERT_POLICY_ID] is assigned by Stackdriver Monitoring when the policy is created. When calling the alertPolicies.create method, do not include the name field in the alerting policy passed as part of the request. + pub fn alert_policies_patch(&self, request: AlertPolicy, name: &str) -> ProjectAlertPolicyPatchCall<'a, C, A> { + ProjectAlertPolicyPatchCall { hub: self.hub, + _request: request, _name: name.to_string(), + _update_mask: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2456,13 +2456,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a single notification channel. The channel includes the relevant configuration details with which the channel was created. However, the response may truncate or omit passwords, API keys, or other private key matter and thus the response may not be 100% identical to the information that was supplied in the call to the create method. + /// Gets a single alerting policy. /// /// # Arguments /// - /// * `name` - The channel for which to execute the request. The format is projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]. - pub fn notification_channels_get(&self, name: &str) -> ProjectNotificationChannelGetCall<'a, C, A> { - ProjectNotificationChannelGetCall { + /// * `name` - The alerting policy to retrieve. The format is + /// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] + /// + pub fn alert_policies_get(&self, name: &str) -> ProjectAlertPolicyGetCall<'a, C, A> { + ProjectAlertPolicyGetCall { hub: self.hub, _name: name.to_string(), _delegate: Default::default(), @@ -2501,6 +2503,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { ProjectGroupDeleteCall { hub: self.hub, _name: name.to_string(), + _recursive: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2656,10 +2659,7 @@ impl<'a, C, A> UptimeCheckIpListCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2679,7 +2679,7 @@ impl<'a, C, A> UptimeCheckIpListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2761,7 +2761,7 @@ impl<'a, C, A> UptimeCheckIpListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2902,7 +2902,7 @@ impl<'a, C, A> ProjectNotificationChannelGetVerificationCodeCall<'a, C, A> where } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2918,10 +2918,7 @@ impl<'a, C, A> ProjectNotificationChannelGetVerificationCodeCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2953,7 +2950,7 @@ impl<'a, C, A> ProjectNotificationChannelGetVerificationCodeCall<'a, C, A> where request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3043,7 +3040,7 @@ impl<'a, C, A> ProjectNotificationChannelGetVerificationCodeCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3091,6 +3088,254 @@ impl<'a, C, A> ProjectNotificationChannelGetVerificationCodeCall<'a, C, A> where } +/// Gets a single notification channel. The channel includes the relevant configuration details with which the channel was created. However, the response may truncate or omit passwords, API keys, or other private key matter and thus the response may not be 100% identical to the information that was supplied in the call to the create method. +/// +/// A builder for the *notificationChannels.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_monitoring3 as monitoring3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use monitoring3::Monitoring; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Monitoring::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().notification_channels_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectNotificationChannelGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Monitoring, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectNotificationChannelGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, NotificationChannel)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "monitoring.projects.notificationChannels.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v3/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The channel for which to execute the request. The format is projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectNotificationChannelGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectNotificationChannelGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectNotificationChannelGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectNotificationChannelGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Gets a single metric descriptor. This method does not require a Stackdriver account. /// /// A builder for the *metricDescriptors.get* method supported by a *project* resource. @@ -3177,7 +3422,7 @@ impl<'a, C, A> ProjectMetricDescriptorGetCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3216,7 +3458,7 @@ impl<'a, C, A> ProjectMetricDescriptorGetCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorGetCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorGetCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Monitoring::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = AlertPolicy::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().alert_policies_patch(req, "name") -/// .update_mask("erat") -/// .doit(); -/// # } -/// ``` -pub struct ProjectAlertPolicyPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Monitoring, - _request: AlertPolicy, - _name: String, - _update_mask: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProjectAlertPolicyPatchCall<'a, C, A> {} - -impl<'a, C, A> ProjectAlertPolicyPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AlertPolicy)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "monitoring.projects.alertPolicies.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - if let Some(value) = self._update_mask { - params.push(("updateMask", value.to_string())); - } - for &field in ["alt", "name", "updateMask"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v3/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: AlertPolicy) -> ProjectAlertPolicyPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Required if the policy exists. The resource name for this policy. The syntax is: - /// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - /// [ALERT_POLICY_ID] is assigned by Stackdriver Monitoring when the policy is created. When calling the alertPolicies.create method, do not include the name field in the alerting policy passed as part of the request. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAlertPolicyPatchCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// Optional. A list of alerting policy field names. If this field is not empty, each listed field in the existing alerting policy is set to the value of the corresponding field in the supplied policy (alert_policy), or to the field's default value if the field is not in the supplied alerting policy. Fields not listed retain their previous value.Examples of valid field masks include display_name, documentation, documentation.content, documentation.mime_type, user_labels, user_label.nameofkey, enabled, conditions, combiner, etc.If this field is empty, then the supplied alerting policy replaces the existing policy. It is the same as deleting the existing policy and adding the supplied policy, except for the following: - /// The new policy will have the same [ALERT_POLICY_ID] as the former policy. This gives you continuity with the former policy in your notifications and incidents. - /// Conditions in the new policy will keep their former [CONDITION_ID] if the supplied condition includes the name field with that [CONDITION_ID]. If the supplied condition omits the name field, then a new [CONDITION_ID] is created. - /// - /// Sets the *update mask* query property to the given value. - pub fn update_mask(mut self, new_value: &str) -> ProjectAlertPolicyPatchCall<'a, C, A> { - self._update_mask = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAlertPolicyPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectAlertPolicyPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectAlertPolicyPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Creates a new notification channel, representing a single notification endpoint such as an email address, SMS number, or PagerDuty service. /// /// A builder for the *notificationChannels.create* method supported by a *project* resource. @@ -3733,7 +3677,7 @@ impl<'a, C, A> ProjectNotificationChannelCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3749,10 +3693,7 @@ impl<'a, C, A> ProjectNotificationChannelCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3784,7 +3725,7 @@ impl<'a, C, A> ProjectNotificationChannelCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3876,7 +3817,7 @@ impl<'a, C, A> ProjectNotificationChannelCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3958,7 +3899,7 @@ impl<'a, C, A> ProjectNotificationChannelCreateCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().notification_channels_patch(req, "name") -/// .update_mask("nonumy") +/// .update_mask("sea") /// .doit(); /// # } /// ``` @@ -4022,7 +3963,7 @@ impl<'a, C, A> ProjectNotificationChannelPatchCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4038,10 +3979,7 @@ impl<'a, C, A> ProjectNotificationChannelPatchCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4073,7 +4011,7 @@ impl<'a, C, A> ProjectNotificationChannelPatchCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4172,7 +4110,7 @@ impl<'a, C, A> ProjectNotificationChannelPatchCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4248,11 +4186,11 @@ impl<'a, C, A> ProjectNotificationChannelPatchCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().groups_list("name") -/// .page_token("gubergren") -/// .page_size(-95) -/// .descendants_of_group("aliquyam") -/// .children_of_group("ea") -/// .ancestors_of_group("no") +/// .page_token("dolores") +/// .page_size(-61) +/// .descendants_of_group("sadipscing") +/// .children_of_group("aliquyam") +/// .ancestors_of_group("ea") /// .doit(); /// # } /// ``` @@ -4331,7 +4269,7 @@ impl<'a, C, A> ProjectGroupListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4347,10 +4285,7 @@ impl<'a, C, A> ProjectGroupListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4370,7 +4305,7 @@ impl<'a, C, A> ProjectGroupListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4483,7 +4418,7 @@ impl<'a, C, A> ProjectGroupListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4629,7 +4564,7 @@ impl<'a, C, A> ProjectGroupCreateCall<'a, C, A> where C: BorrowMut ProjectGroupCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4680,7 +4612,7 @@ impl<'a, C, A> ProjectGroupCreateCall<'a, C, A> where C: BorrowMut ProjectGroupCreateCall<'a, C, A> where C: BorrowMut ProjectGroupGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4927,10 +4859,7 @@ impl<'a, C, A> ProjectGroupGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4950,7 +4879,7 @@ impl<'a, C, A> ProjectGroupGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5028,7 +4957,7 @@ impl<'a, C, A> ProjectGroupGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5104,8 +5033,8 @@ impl<'a, C, A> ProjectGroupGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().notification_channel_descriptors_list("name") -/// .page_token("diam") -/// .page_size(-55) +/// .page_token("et") +/// .page_size(-41) /// .doit(); /// # } /// ``` @@ -5172,7 +5101,7 @@ impl<'a, C, A> ProjectNotificationChannelDescriptorListCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5188,10 +5117,7 @@ impl<'a, C, A> ProjectNotificationChannelDescriptorListCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5211,7 +5137,7 @@ impl<'a, C, A> ProjectNotificationChannelDescriptorListCall<'a, C, A> where C: B let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5305,7 +5231,7 @@ impl<'a, C, A> ProjectNotificationChannelDescriptorListCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5446,7 +5372,7 @@ impl<'a, C, A> ProjectTimeSeryCreateCall<'a, C, A> where C: BorrowMut ProjectTimeSeryCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5497,7 +5420,7 @@ impl<'a, C, A> ProjectTimeSeryCreateCall<'a, C, A> where C: BorrowMut ProjectTimeSeryCreateCall<'a, C, A> where C: BorrowMut ProjectTimeSeryCreateCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorListCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5775,7 +5695,7 @@ impl<'a, C, A> ProjectMetricDescriptorListCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorListCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorListCall<'a, C, A> where C: BorrowMut ProjectMonitoredResourceDescriptorListCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6041,10 +5961,7 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorListCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6064,7 +5981,7 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorListCall<'a, C, A> where C: Bor let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6165,7 +6082,7 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorListCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6299,7 +6216,7 @@ impl<'a, C, A> ProjectUptimeCheckConfigGetCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6338,7 +6252,7 @@ impl<'a, C, A> ProjectUptimeCheckConfigGetCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigGetCall<'a, C, A> where C: BorrowMut ProjectNotificationChannelDescriptorGetCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6566,10 +6480,7 @@ impl<'a, C, A> ProjectNotificationChannelDescriptorGetCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6589,7 +6500,7 @@ impl<'a, C, A> ProjectNotificationChannelDescriptorGetCall<'a, C, A> where C: Bo let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6667,7 +6578,7 @@ impl<'a, C, A> ProjectNotificationChannelDescriptorGetCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6743,17 +6654,17 @@ impl<'a, C, A> ProjectNotificationChannelDescriptorGetCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().time_series_list("name") -/// .view("amet") -/// .page_token("no") -/// .page_size(-36) -/// .order_by("eirmod") -/// .interval_start_time("dolore") -/// .interval_end_time("invidunt") -/// .filter("aliquyam") -/// .aggregation_per_series_aligner("accusam") -/// .add_aggregation_group_by_fields("Lorem") -/// .aggregation_cross_series_reducer("sea") -/// .aggregation_alignment_period("et") +/// .view("elitr") +/// .page_token("amet") +/// .page_size(-60) +/// .order_by("labore") +/// .interval_start_time("eirmod") +/// .interval_end_time("dolore") +/// .filter("invidunt") +/// .aggregation_per_series_aligner("aliquyam") +/// .add_aggregation_group_by_fields("accusam") +/// .aggregation_cross_series_reducer("Lorem") +/// .aggregation_alignment_period("sea") /// .doit(); /// # } /// ``` @@ -6858,7 +6769,7 @@ impl<'a, C, A> ProjectTimeSeryListCall<'a, C, A> where C: BorrowMut ProjectTimeSeryListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6897,7 +6805,7 @@ impl<'a, C, A> ProjectTimeSeryListCall<'a, C, A> where C: BorrowMut ProjectTimeSeryListCall<'a, C, A> where C: BorrowMut ProjectTimeSeryListCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyListCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7249,7 +7154,7 @@ impl<'a, C, A> ProjectAlertPolicyListCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyListCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7530,7 +7432,7 @@ impl<'a, C, A> ProjectMetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut ProjectCollectdTimeSeryCreateCall<'a, C, A> where C: BorrowMut ProjectCollectdTimeSeryCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7800,7 +7699,7 @@ impl<'a, C, A> ProjectCollectdTimeSeryCreateCall<'a, C, A> where C: BorrowMut ProjectCollectdTimeSeryCreateCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyCreateCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8082,7 +7978,7 @@ impl<'a, C, A> ProjectAlertPolicyCreateCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyCreateCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyCreateCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyCreateCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyCreateCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = Monitoring::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AlertPolicy::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().alert_policies_get("name") +/// let result = hub.projects().alert_policies_patch(req, "name") +/// .update_mask("ut") /// .doit(); /// # } /// ``` -pub struct ProjectAlertPolicyGetCall<'a, C, A> +pub struct ProjectAlertPolicyPatchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Monitoring, + _request: AlertPolicy, _name: String, + _update_mask: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectAlertPolicyGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAlertPolicyPatchCall<'a, C, A> {} -impl<'a, C, A> ProjectAlertPolicyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAlertPolicyPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -8276,11 +8181,14 @@ impl<'a, C, A> ProjectAlertPolicyGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "monitoring.projects.alertPolicies.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "monitoring.projects.alertPolicies.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -8306,7 +8214,7 @@ impl<'a, C, A> ProjectAlertPolicyGetCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -8343,11 +8259,15 @@ impl<'a, C, A> ProjectAlertPolicyGetCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyGetCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Required if the policy exists. The resource name for this policy. The syntax is: /// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - /// + /// [ALERT_POLICY_ID] is assigned by Stackdriver Monitoring when the policy is created. When calling the alertPolicies.create method, do not include the name field in the alerting policy passed as part of the request. /// /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectAlertPolicyGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectAlertPolicyPatchCall<'a, C, A> { self._name = new_value.to_string(); self } + /// Optional. A list of alerting policy field names. If this field is not empty, each listed field in the existing alerting policy is set to the value of the corresponding field in the supplied policy (alert_policy), or to the field's default value if the field is not in the supplied alerting policy. Fields not listed retain their previous value.Examples of valid field masks include display_name, documentation, documentation.content, documentation.mime_type, user_labels, user_label.nameofkey, enabled, conditions, combiner, etc.If this field is empty, then the supplied alerting policy replaces the existing policy. It is the same as deleting the existing policy and adding the supplied policy, except for the following: + /// The new policy will have the same [ALERT_POLICY_ID] as the former policy. This gives you continuity with the former policy in your notifications and incidents. + /// Conditions in the new policy will keep their former [CONDITION_ID] if the supplied condition includes the name field with that [CONDITION_ID]. If the supplied condition omits the name field, then a new [CONDITION_ID] is created. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectAlertPolicyPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAlertPolicyGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAlertPolicyPatchCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -8425,7 +8363,7 @@ impl<'a, C, A> ProjectAlertPolicyGetCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectAlertPolicyGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAlertPolicyPatchCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -8461,7 +8399,7 @@ impl<'a, C, A> ProjectAlertPolicyGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectAlertPolicyGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAlertPolicyPatchCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -8579,7 +8517,7 @@ impl<'a, C, A> ProjectNotificationChannelListCall<'a, C, A> where C: BorrowMut ProjectNotificationChannelListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8618,7 +8553,7 @@ impl<'a, C, A> ProjectNotificationChannelListCall<'a, C, A> where C: BorrowMut ProjectNotificationChannelListCall<'a, C, A> where C: BorrowMut ProjectGroupUpdateCall<'a, C, A> where C: BorrowMut ProjectGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8921,7 +8853,7 @@ impl<'a, C, A> ProjectGroupUpdateCall<'a, C, A> where C: BorrowMut ProjectGroupUpdateCall<'a, C, A> where C: BorrowMut ProjectNotificationChannelSendVerificationCodeCall<'a, C, A> wher } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9175,10 +9107,7 @@ impl<'a, C, A> ProjectNotificationChannelSendVerificationCodeCall<'a, C, A> wher } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9210,7 +9139,7 @@ impl<'a, C, A> ProjectNotificationChannelSendVerificationCodeCall<'a, C, A> wher request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9300,7 +9229,7 @@ impl<'a, C, A> ProjectNotificationChannelSendVerificationCodeCall<'a, C, A> wher /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9446,7 +9375,7 @@ impl<'a, C, A> ProjectUptimeCheckConfigPatchCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9497,7 +9423,7 @@ impl<'a, C, A> ProjectUptimeCheckConfigPatchCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigPatchCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigCreateCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9786,7 +9709,7 @@ impl<'a, C, A> ProjectUptimeCheckConfigCreateCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigCreateCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyDeleteCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10049,7 +9969,7 @@ impl<'a, C, A> ProjectAlertPolicyDeleteCall<'a, C, A> where C: BorrowMut ProjectAlertPolicyDeleteCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigDeleteCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10302,7 +10219,7 @@ impl<'a, C, A> ProjectUptimeCheckConfigDeleteCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigDeleteCall<'a, C, A> where C: BorrowMut ProjectNotificationChannelDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10535,10 +10452,7 @@ impl<'a, C, A> ProjectNotificationChannelDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10558,7 +10472,7 @@ impl<'a, C, A> ProjectNotificationChannelDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10643,7 +10557,7 @@ impl<'a, C, A> ProjectNotificationChannelDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10802,7 +10716,7 @@ impl<'a, C, A> ProjectGroupMemberListCall<'a, C, A> where C: BorrowMut ProjectGroupMemberListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10841,7 +10752,7 @@ impl<'a, C, A> ProjectGroupMemberListCall<'a, C, A> where C: BorrowMut ProjectGroupMemberListCall<'a, C, A> where C: BorrowMut ProjectGroupMemberListCall<'a, C, A> where C: BorrowMut ProjectGroupMemberListCall<'a, C, A> where C: BorrowMut +pub struct ProjectAlertPolicyGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Monitoring, @@ -11045,13 +10956,13 @@ pub struct ProjectNotificationChannelGetCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectNotificationChannelGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectAlertPolicyGetCall<'a, C, A> {} -impl<'a, C, A> ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectAlertPolicyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, NotificationChannel)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, AlertPolicy)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -11060,7 +10971,7 @@ impl<'a, C, A> ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "monitoring.projects.notificationChannels.get", + dlg.begin(MethodInfo { id: "monitoring.projects.alertPolicies.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("name", self._name.to_string())); @@ -11090,7 +11001,7 @@ impl<'a, C, A> ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11129,7 +11037,7 @@ impl<'a, C, A> ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut ProjectNotificationChannelGetCall<'a, C, A> { + pub fn name(mut self, new_value: &str) -> ProjectAlertPolicyGetCall<'a, C, A> { self._name = new_value.to_string(); self } @@ -11198,7 +11108,7 @@ impl<'a, C, A> ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut ProjectNotificationChannelGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectAlertPolicyGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -11207,7 +11117,7 @@ impl<'a, C, A> ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectNotificationChannelGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectAlertPolicyGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -11243,7 +11153,7 @@ impl<'a, C, A> ProjectNotificationChannelGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectNotificationChannelGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectAlertPolicyGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -11348,7 +11258,7 @@ impl<'a, C, A> ProjectMetricDescriptorCreateCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11399,7 +11306,7 @@ impl<'a, C, A> ProjectMetricDescriptorCreateCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorCreateCall<'a, C, A> where C: BorrowMut ProjectMetricDescriptorCreateCall<'a, C, A> where C: BorrowMut hub: &'a Monitoring, _name: String, + _recursive: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -11595,9 +11504,12 @@ impl<'a, C, A> ProjectGroupDeleteCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(3 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + if let Some(value) = self._recursive { + params.push(("recursive", value.to_string())); + } + for &field in ["alt", "name", "recursive"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -11623,7 +11535,7 @@ impl<'a, C, A> ProjectGroupDeleteCall<'a, C, A> where C: BorrowMut ProjectGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11662,7 +11571,7 @@ impl<'a, C, A> ProjectGroupDeleteCall<'a, C, A> where C: BorrowMut ProjectGroupDeleteCall<'a, C, A> where C: BorrowMut ProjectGroupDeleteCall<'a, C, A> { + self._recursive = Some(new_value); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -11740,7 +11656,7 @@ impl<'a, C, A> ProjectGroupDeleteCall<'a, C, A> where C: BorrowMut ProjectGroupDeleteCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigListCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11923,7 +11836,7 @@ impl<'a, C, A> ProjectUptimeCheckConfigListCall<'a, C, A> where C: BorrowMut ProjectUptimeCheckConfigListCall<'a, C, A> where C: BorrowMut ProjectMonitoredResourceDescriptorGetCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12165,10 +12078,7 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorGetCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12188,7 +12098,7 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorGetCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12266,7 +12176,7 @@ impl<'a, C, A> ProjectMonitoredResourceDescriptorGetCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12407,7 +12317,7 @@ impl<'a, C, A> ProjectNotificationChannelVerifyCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12423,10 +12333,7 @@ impl<'a, C, A> ProjectNotificationChannelVerifyCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12458,7 +12365,7 @@ impl<'a, C, A> ProjectNotificationChannelVerifyCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12548,7 +12455,7 @@ impl<'a, C, A> ProjectNotificationChannelVerifyCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/oslogin1-cli/Cargo.toml b/gen/oslogin1-cli/Cargo.toml index 9de206d27b..40fb5236e2 100644 --- a/gen/oslogin1-cli/Cargo.toml +++ b/gen/oslogin1-cli/Cargo.toml @@ -4,11 +4,11 @@ [package] name = "google-oslogin1-cli" -version = "1.0.8+20181008" +version = "1.0.8+20190309" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud OS Login (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/oslogin1-cli" -homepage = "https://cloud.google.com/compute/docs/oslogin/rest/" +homepage = "https://cloud.google.com/compute/docs/oslogin/" documentation = "http://byron.github.io/google-apis-rs/google_oslogin1_cli" license = "MIT" keywords = ["oslogin", "google", "cli"] @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-oslogin1] path = "../oslogin1" -version = "1.0.8+20181008" +version = "1.0.8+20190309" diff --git a/gen/oslogin1-cli/README.md b/gen/oslogin1-cli/README.md index 381a65c778..995db96ddc 100644 --- a/gen/oslogin1-cli/README.md +++ b/gen/oslogin1-cli/README.md @@ -11,7 +11,7 @@ capabilities. Errors will be printed to standard error, and cause the program's If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. Everything else about the *Cloud OS Login* API can be found at the -[official documentation site](https://cloud.google.com/compute/docs/oslogin/rest/). +[official documentation site](https://cloud.google.com/compute/docs/oslogin/). # Installation and Source Code @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud OS Login* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud OS Login* API at revision *20190309*. The CLI is at version *1.0.8*. ```bash oslogin1 [options] diff --git a/gen/oslogin1-cli/mkdocs.yml b/gen/oslogin1-cli/mkdocs.yml index 04e88ae304..9434d47de3 100644 --- a/gen/oslogin1-cli/mkdocs.yml +++ b/gen/oslogin1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud OS Login v1.0.8+20181008 +site_name: Cloud OS Login v1.0.8+20190309 site_url: http://byron.github.io/google-apis-rs/google-oslogin1-cli site_description: A complete library to interact with Cloud OS Login (protocol v1) diff --git a/gen/oslogin1-cli/src/main.rs b/gen/oslogin1-cli/src/main.rs index 9b2b86dc37..c580c42692 100644 --- a/gen/oslogin1-cli/src/main.rs +++ b/gen/oslogin1-cli/src/main.rs @@ -52,6 +52,12 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "system-id" => { + call = call.system_id(value.unwrap_or("")); + }, + "project-id" => { + call = call.project_id(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -65,6 +71,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["project-id", "system-id"].iter().map(|v|*v)); v } )); } } @@ -715,7 +722,7 @@ fn main() { let mut app = App::new("oslogin1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190309") .about("Manages OS login configuration for Google account users.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_oslogin1_cli") .arg(Arg::with_name("url") diff --git a/gen/oslogin1/Cargo.toml b/gen/oslogin1/Cargo.toml index 4f0294d372..828e41bb03 100644 --- a/gen/oslogin1/Cargo.toml +++ b/gen/oslogin1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-oslogin1" -version = "1.0.8+20181008" +version = "1.0.8+20190309" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud OS Login (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/oslogin1" -homepage = "https://cloud.google.com/compute/docs/oslogin/rest/" -documentation = "https://docs.rs/google-oslogin1/1.0.8+20181008" +homepage = "https://cloud.google.com/compute/docs/oslogin/" +documentation = "https://docs.rs/google-oslogin1/1.0.8+20190309" license = "MIT" keywords = ["oslogin", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/oslogin1/README.md b/gen/oslogin1/README.md index c6ae76db23..8c10b975e1 100644 --- a/gen/oslogin1/README.md +++ b/gen/oslogin1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-oslogin1` library allows access to all features of the *Google Cloud OS Login* service. -This documentation was generated from *Cloud OS Login* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *oslogin:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud OS Login* crate version *1.0.8+20190309*, where *20190309* is the exact revision of the *oslogin:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud OS Login* *v1* API can be found at the -[official documentation site](https://cloud.google.com/compute/docs/oslogin/rest/). +[official documentation site](https://cloud.google.com/compute/docs/oslogin/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/struct.CloudOSLogin.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/struct.CloudOSLogin.html) ... * users - * [*get login profile*](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/struct.UserGetLoginProfileCall.html), [*import ssh public key*](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/struct.UserImportSshPublicKeyCall.html), [*projects delete*](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/struct.UserProjectDeleteCall.html), [*ssh public keys delete*](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/struct.UserSshPublicKeyDeleteCall.html), [*ssh public keys get*](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/struct.UserSshPublicKeyGetCall.html) and [*ssh public keys patch*](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/struct.UserSshPublicKeyPatchCall.html) + * [*get login profile*](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/struct.UserGetLoginProfileCall.html), [*import ssh public key*](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/struct.UserImportSshPublicKeyCall.html), [*projects delete*](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/struct.UserProjectDeleteCall.html), [*ssh public keys delete*](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/struct.UserSshPublicKeyDeleteCall.html), [*ssh public keys get*](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/struct.UserSshPublicKeyGetCall.html) and [*ssh public keys patch*](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/struct.UserSshPublicKeyPatchCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/struct.CloudOSLogin.html)** +* **[Hub](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/struct.CloudOSLogin.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.Part.html)** + * **[Parts](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-oslogin1/1.0.8+20181008/google_oslogin1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-oslogin1/1.0.8+20190309/google_oslogin1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/oslogin1/src/lib.rs b/gen/oslogin1/src/lib.rs index dec355f888..187589084c 100644 --- a/gen/oslogin1/src/lib.rs +++ b/gen/oslogin1/src/lib.rs @@ -2,10 +2,10 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud OS Login* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *oslogin:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud OS Login* crate version *1.0.8+20190309*, where *20190309* is the exact revision of the *oslogin:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud OS Login* *v1* API can be found at the -//! [official documentation site](https://cloud.google.com/compute/docs/oslogin/rest/). +//! [official documentation site](https://cloud.google.com/compute/docs/oslogin/). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/oslogin1). //! # Features //! @@ -422,6 +422,30 @@ pub struct ImportSshPublicKeyResponse { impl ResponseResult for ImportSshPublicKeyResponse {} +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [ssh public keys delete users](struct.UserSshPublicKeyDeleteCall.html) (response) +/// * [projects delete users](struct.UserProjectDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + /// The SSH public key information associated with a Google account. /// /// # Activities @@ -450,30 +474,6 @@ impl RequestValue for SshPublicKey {} impl ResponseResult for SshPublicKey {} -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [ssh public keys delete users](struct.UserSshPublicKeyDeleteCall.html) (response) -/// * [projects delete users](struct.UserProjectDeleteCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - /// The POSIX account information associated with a Google account. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -493,15 +493,15 @@ pub struct PosixAccount { pub operating_system_type: Option, /// The default group ID. pub gid: Option, + /// The GECOS (user information) entry for this account. + pub gecos: Option, + /// The path to the home directory for this account. + #[serde(rename="homeDirectory")] + pub home_directory: Option, /// System identifier for which account the username or uid applies to. /// By default, the empty value is used. #[serde(rename="systemId")] pub system_id: Option, - /// The path to the home directory for this account. - #[serde(rename="homeDirectory")] - pub home_directory: Option, - /// The GECOS (user information) entry for this account. - pub gecos: Option, /// Output only. A POSIX account identifier. #[serde(rename="accountId")] pub account_id: Option, @@ -626,6 +626,8 @@ impl<'a, C, A> UserMethods<'a, C, A> { UserGetLoginProfileCall { hub: self.hub, _name: name.to_string(), + _system_id: Default::default(), + _project_id: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -769,7 +771,7 @@ impl<'a, C, A> UserProjectDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -785,10 +787,7 @@ impl<'a, C, A> UserProjectDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -808,7 +807,7 @@ impl<'a, C, A> UserProjectDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -888,7 +887,7 @@ impl<'a, C, A> UserProjectDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1036,7 +1035,7 @@ impl<'a, C, A> UserImportSshPublicKeyCall<'a, C, A> where C: BorrowMut UserImportSshPublicKeyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1087,7 +1083,7 @@ impl<'a, C, A> UserImportSshPublicKeyCall<'a, C, A> where C: BorrowMut UserImportSshPublicKeyCall<'a, C, A> where C: BorrowMut UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1357,7 +1350,7 @@ impl<'a, C, A> UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut hub: &'a CloudOSLogin, _name: String, + _system_id: Option, + _project_id: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -1544,9 +1541,15 @@ impl<'a, C, A> UserGetLoginProfileCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(3 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + if let Some(value) = self._system_id { + params.push(("systemId", value.to_string())); + } + if let Some(value) = self._project_id { + params.push(("projectId", value.to_string())); + } + for &field in ["alt", "name", "systemId", "projectId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1572,7 +1575,7 @@ impl<'a, C, A> UserGetLoginProfileCall<'a, C, A> where C: BorrowMut UserGetLoginProfileCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1611,7 +1611,7 @@ impl<'a, C, A> UserGetLoginProfileCall<'a, C, A> where C: BorrowMut UserGetLoginProfileCall<'a, C, A> where C: BorrowMut UserGetLoginProfileCall<'a, C, A> { + self._system_id = Some(new_value.to_string()); + self + } + /// The project ID of the Google Cloud Platform project. + /// + /// Sets the *project id* query property to the given value. + pub fn project_id(mut self, new_value: &str) -> UserGetLoginProfileCall<'a, C, A> { + self._project_id = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -1689,7 +1703,7 @@ impl<'a, C, A> UserGetLoginProfileCall<'a, C, A> where C: BorrowMut UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1862,7 +1873,7 @@ impl<'a, C, A> UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut UserSshPublicKeyPatchCall<'a, C, A> where C: BorrowMut UserSshPublicKeyPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2140,7 +2148,7 @@ impl<'a, C, A> UserSshPublicKeyPatchCall<'a, C, A> where C: BorrowMut UserSshPublicKeyPatchCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Cloud OS Login (protocol v1beta)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/oslogin1_beta-cli" -homepage = "https://cloud.google.com/compute/docs/oslogin/rest/" +homepage = "https://cloud.google.com/compute/docs/oslogin/" documentation = "http://byron.github.io/google-apis-rs/google_oslogin1_beta_cli" license = "MIT" keywords = ["oslogin", "google", "cli"] @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-oslogin1_beta] path = "../oslogin1_beta" -version = "1.0.8+20181008" +version = "1.0.8+20190309" diff --git a/gen/oslogin1_beta-cli/README.md b/gen/oslogin1_beta-cli/README.md index 51cc12d7ee..27d7fc1ac7 100644 --- a/gen/oslogin1_beta-cli/README.md +++ b/gen/oslogin1_beta-cli/README.md @@ -11,7 +11,7 @@ capabilities. Errors will be printed to standard error, and cause the program's If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. Everything else about the *Cloud OS Login* API can be found at the -[official documentation site](https://cloud.google.com/compute/docs/oslogin/rest/). +[official documentation site](https://cloud.google.com/compute/docs/oslogin/). # Installation and Source Code @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud OS Login* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud OS Login* API at revision *20190309*. The CLI is at version *1.0.8*. ```bash oslogin1-beta [options] diff --git a/gen/oslogin1_beta-cli/mkdocs.yml b/gen/oslogin1_beta-cli/mkdocs.yml index c4a6c4d5ca..1a983864c8 100644 --- a/gen/oslogin1_beta-cli/mkdocs.yml +++ b/gen/oslogin1_beta-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud OS Login v1.0.8+20181008 +site_name: Cloud OS Login v1.0.8+20190309 site_url: http://byron.github.io/google-apis-rs/google-oslogin1_beta-cli site_description: A complete library to interact with Cloud OS Login (protocol v1beta) diff --git a/gen/oslogin1_beta-cli/src/main.rs b/gen/oslogin1_beta-cli/src/main.rs index ec3404da20..9649beadba 100644 --- a/gen/oslogin1_beta-cli/src/main.rs +++ b/gen/oslogin1_beta-cli/src/main.rs @@ -52,6 +52,12 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "system-id" => { + call = call.system_id(value.unwrap_or("")); + }, + "project-id" => { + call = call.project_id(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -65,6 +71,7 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); + v.extend(["project-id", "system-id"].iter().map(|v|*v)); v } )); } } @@ -715,7 +722,7 @@ fn main() { let mut app = App::new("oslogin1-beta") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190309") .about("Manages OS login configuration for Google account users.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_oslogin1_beta_cli") .arg(Arg::with_name("url") diff --git a/gen/oslogin1_beta/Cargo.toml b/gen/oslogin1_beta/Cargo.toml index 4b6c76f056..49cb1b0e44 100644 --- a/gen/oslogin1_beta/Cargo.toml +++ b/gen/oslogin1_beta/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-oslogin1_beta" -version = "1.0.8+20181008" +version = "1.0.8+20190309" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud OS Login (protocol v1beta)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/oslogin1_beta" -homepage = "https://cloud.google.com/compute/docs/oslogin/rest/" -documentation = "https://docs.rs/google-oslogin1_beta/1.0.8+20181008" +homepage = "https://cloud.google.com/compute/docs/oslogin/" +documentation = "https://docs.rs/google-oslogin1_beta/1.0.8+20190309" license = "MIT" keywords = ["oslogin", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/oslogin1_beta/README.md b/gen/oslogin1_beta/README.md index a54da5864c..20678cbdd2 100644 --- a/gen/oslogin1_beta/README.md +++ b/gen/oslogin1_beta/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-oslogin1_beta` library allows access to all features of the *Google Cloud OS Login* service. -This documentation was generated from *Cloud OS Login* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *oslogin:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud OS Login* crate version *1.0.8+20190309*, where *20190309* is the exact revision of the *oslogin:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud OS Login* *v1_beta* API can be found at the -[official documentation site](https://cloud.google.com/compute/docs/oslogin/rest/). +[official documentation site](https://cloud.google.com/compute/docs/oslogin/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/struct.CloudOSLogin.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/struct.CloudOSLogin.html) ... * users - * [*get login profile*](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/struct.UserGetLoginProfileCall.html), [*import ssh public key*](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/struct.UserImportSshPublicKeyCall.html), [*projects delete*](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/struct.UserProjectDeleteCall.html), [*ssh public keys delete*](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/struct.UserSshPublicKeyDeleteCall.html), [*ssh public keys get*](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/struct.UserSshPublicKeyGetCall.html) and [*ssh public keys patch*](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/struct.UserSshPublicKeyPatchCall.html) + * [*get login profile*](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/struct.UserGetLoginProfileCall.html), [*import ssh public key*](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/struct.UserImportSshPublicKeyCall.html), [*projects delete*](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/struct.UserProjectDeleteCall.html), [*ssh public keys delete*](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/struct.UserSshPublicKeyDeleteCall.html), [*ssh public keys get*](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/struct.UserSshPublicKeyGetCall.html) and [*ssh public keys patch*](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/struct.UserSshPublicKeyPatchCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/struct.CloudOSLogin.html)** +* **[Hub](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/struct.CloudOSLogin.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.Part.html)** + * **[Parts](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.RequestValue.html) and -[decodable](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.RequestValue.html) and +[decodable](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-oslogin1_beta/1.0.8+20181008/google_oslogin1_beta/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-oslogin1_beta/1.0.8+20190309/google_oslogin1_beta/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/oslogin1_beta/src/lib.rs b/gen/oslogin1_beta/src/lib.rs index 0455003aa5..ef9218f8c0 100644 --- a/gen/oslogin1_beta/src/lib.rs +++ b/gen/oslogin1_beta/src/lib.rs @@ -2,10 +2,10 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud OS Login* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *oslogin:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud OS Login* crate version *1.0.8+20190309*, where *20190309* is the exact revision of the *oslogin:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud OS Login* *v1_beta* API can be found at the -//! [official documentation site](https://cloud.google.com/compute/docs/oslogin/rest/). +//! [official documentation site](https://cloud.google.com/compute/docs/oslogin/). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/oslogin1_beta). //! # Features //! @@ -430,6 +430,30 @@ pub struct ImportSshPublicKeyResponse { impl ResponseResult for ImportSshPublicKeyResponse {} +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [ssh public keys delete users](struct.UserSshPublicKeyDeleteCall.html) (response) +/// * [projects delete users](struct.UserProjectDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + /// The SSH public key information associated with a Google account. /// /// # Activities @@ -458,30 +482,6 @@ impl RequestValue for SshPublicKey {} impl ResponseResult for SshPublicKey {} -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [ssh public keys delete users](struct.UserSshPublicKeyDeleteCall.html) (response) -/// * [projects delete users](struct.UserProjectDeleteCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - /// The POSIX account information associated with a Google account. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -501,15 +501,15 @@ pub struct PosixAccount { pub operating_system_type: Option, /// The default group ID. pub gid: Option, + /// The GECOS (user information) entry for this account. + pub gecos: Option, + /// The path to the home directory for this account. + #[serde(rename="homeDirectory")] + pub home_directory: Option, /// System identifier for which account the username or uid applies to. /// By default, the empty value is used. #[serde(rename="systemId")] pub system_id: Option, - /// The path to the home directory for this account. - #[serde(rename="homeDirectory")] - pub home_directory: Option, - /// The GECOS (user information) entry for this account. - pub gecos: Option, /// Output only. A POSIX account identifier. #[serde(rename="accountId")] pub account_id: Option, @@ -634,6 +634,8 @@ impl<'a, C, A> UserMethods<'a, C, A> { UserGetLoginProfileCall { hub: self.hub, _name: name.to_string(), + _system_id: Default::default(), + _project_id: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -777,7 +779,7 @@ impl<'a, C, A> UserProjectDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -793,10 +795,7 @@ impl<'a, C, A> UserProjectDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -816,7 +815,7 @@ impl<'a, C, A> UserProjectDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -896,7 +895,7 @@ impl<'a, C, A> UserProjectDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -904,12 +903,12 @@ impl<'a, C, A> UserProjectDeleteCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> UserProjectDeleteCall<'a, C, A> @@ -1044,7 +1043,7 @@ impl<'a, C, A> UserImportSshPublicKeyCall<'a, C, A> where C: BorrowMut UserImportSshPublicKeyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1095,7 +1091,7 @@ impl<'a, C, A> UserImportSshPublicKeyCall<'a, C, A> where C: BorrowMut UserImportSshPublicKeyCall<'a, C, A> where C: BorrowMut UserImportSshPublicKeyCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> UserImportSshPublicKeyCall<'a, C, A> @@ -1326,7 +1322,7 @@ impl<'a, C, A> UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1365,7 +1358,7 @@ impl<'a, C, A> UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> UserSshPublicKeyDeleteCall<'a, C, A> @@ -1522,6 +1515,8 @@ impl<'a, C, A> UserSshPublicKeyDeleteCall<'a, C, A> where C: BorrowMut hub: &'a CloudOSLogin, _name: String, + _system_id: Option, + _project_id: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -1552,9 +1549,15 @@ impl<'a, C, A> UserGetLoginProfileCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(3 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + if let Some(value) = self._system_id { + params.push(("systemId", value.to_string())); + } + if let Some(value) = self._project_id { + params.push(("projectId", value.to_string())); + } + for &field in ["alt", "name", "systemId", "projectId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1580,7 +1583,7 @@ impl<'a, C, A> UserGetLoginProfileCall<'a, C, A> where C: BorrowMut UserGetLoginProfileCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1619,7 +1619,7 @@ impl<'a, C, A> UserGetLoginProfileCall<'a, C, A> where C: BorrowMut UserGetLoginProfileCall<'a, C, A> where C: BorrowMut UserGetLoginProfileCall<'a, C, A> { + self._system_id = Some(new_value.to_string()); + self + } + /// The project ID of the Google Cloud Platform project. + /// + /// Sets the *project id* query property to the given value. + pub fn project_id(mut self, new_value: &str) -> UserGetLoginProfileCall<'a, C, A> { + self._project_id = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -1697,7 +1711,7 @@ impl<'a, C, A> UserGetLoginProfileCall<'a, C, A> where C: BorrowMut UserGetLoginProfileCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> UserGetLoginProfileCall<'a, C, A> @@ -1831,7 +1845,7 @@ impl<'a, C, A> UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1870,7 +1881,7 @@ impl<'a, C, A> UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> UserSshPublicKeyGetCall<'a, C, A> @@ -2033,7 +2044,7 @@ impl<'a, C, A> UserSshPublicKeyGetCall<'a, C, A> where C: BorrowMut UserSshPublicKeyPatchCall<'a, C, A> where C: BorrowMut UserSshPublicKeyPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2148,7 +2156,7 @@ impl<'a, C, A> UserSshPublicKeyPatchCall<'a, C, A> where C: BorrowMut UserSshPublicKeyPatchCall<'a, C, A> where C: BorrowMut UserSshPublicKeyPatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> UserSshPublicKeyPatchCall<'a, C, A> diff --git a/gen/pagespeedonline2-cli/Cargo.toml b/gen/pagespeedonline2-cli/Cargo.toml index 101fdb106f..c49d4e135e 100644 --- a/gen/pagespeedonline2-cli/Cargo.toml +++ b/gen/pagespeedonline2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pagespeedonline2-cli" -version = "1.0.8+20180822" +version = "1.0.8+20190129" authors = ["Sebastian Thiel "] description = "A complete library to interact with pagespeedonline (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-pagespeedonline2] path = "../pagespeedonline2" -version = "1.0.8+20180822" +version = "1.0.8+20190129" diff --git a/gen/pagespeedonline2-cli/README.md b/gen/pagespeedonline2-cli/README.md index 095bf0572d..13088db277 100644 --- a/gen/pagespeedonline2-cli/README.md +++ b/gen/pagespeedonline2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *pagespeedonline* API at revision *20180822*. The CLI is at version *1.0.8*. +This documentation was generated from the *pagespeedonline* API at revision *20190129*. The CLI is at version *1.0.8*. ```bash pagespeedonline2 [options] diff --git a/gen/pagespeedonline2-cli/mkdocs.yml b/gen/pagespeedonline2-cli/mkdocs.yml index 1f48209eac..2efa359fa8 100644 --- a/gen/pagespeedonline2-cli/mkdocs.yml +++ b/gen/pagespeedonline2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: pagespeedonline v1.0.8+20180822 +site_name: pagespeedonline v1.0.8+20190129 site_url: http://byron.github.io/google-apis-rs/google-pagespeedonline2-cli site_description: A complete library to interact with pagespeedonline (protocol v2) diff --git a/gen/pagespeedonline2-cli/src/main.rs b/gen/pagespeedonline2-cli/src/main.rs index 0cac5d0327..2652d34f92 100644 --- a/gen/pagespeedonline2-cli/src/main.rs +++ b/gen/pagespeedonline2-cli/src/main.rs @@ -238,7 +238,7 @@ fn main() { let mut app = App::new("pagespeedonline2") .author("Sebastian Thiel ") - .version("1.0.8+20180822") + .version("1.0.8+20190129") .about("Analyzes the performance of a web page and provides tailored suggestions to make that page faster.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pagespeedonline2_cli") .arg(Arg::with_name("folder") diff --git a/gen/pagespeedonline2/Cargo.toml b/gen/pagespeedonline2/Cargo.toml index 35e71f198b..85779ee0e2 100644 --- a/gen/pagespeedonline2/Cargo.toml +++ b/gen/pagespeedonline2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-pagespeedonline2" -version = "1.0.8+20180822" +version = "1.0.8+20190129" authors = ["Sebastian Thiel "] description = "A complete library to interact with pagespeedonline (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline2" homepage = "https://developers.google.com/speed/docs/insights/v2/getting-started" -documentation = "https://docs.rs/google-pagespeedonline2/1.0.8+20180822" +documentation = "https://docs.rs/google-pagespeedonline2/1.0.8+20190129" license = "MIT" keywords = ["pagespeedonline", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/pagespeedonline2/README.md b/gen/pagespeedonline2/README.md index 46c86bb18e..d1495fb1ad 100644 --- a/gen/pagespeedonline2/README.md +++ b/gen/pagespeedonline2/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-pagespeedonline2` library allows access to all features of the *Google pagespeedonline* service. -This documentation was generated from *pagespeedonline* crate version *1.0.8+20180822*, where *20180822* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *pagespeedonline* crate version *1.0.8+20190129*, where *20190129* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *pagespeedonline* *v2* API can be found at the [official documentation site](https://developers.google.com/speed/docs/insights/v2/getting-started). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/struct.Pagespeedonline.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/struct.Pagespeedonline.html) ... * pagespeedapi - * [*runpagespeed*](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/struct.PagespeedapiRunpagespeedCall.html) + * [*runpagespeed*](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/struct.PagespeedapiRunpagespeedCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/struct.Pagespeedonline.html)** +* **[Hub](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/struct.Pagespeedonline.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.Part.html)** + * **[Parts](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -129,17 +129,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -149,29 +149,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-pagespeedonline2/1.0.8+20180822/google_pagespeedonline2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-pagespeedonline2/1.0.8+20190129/google_pagespeedonline2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/pagespeedonline2/src/lib.rs b/gen/pagespeedonline2/src/lib.rs index a8e7766e66..0d3a3212fe 100644 --- a/gen/pagespeedonline2/src/lib.rs +++ b/gen/pagespeedonline2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *pagespeedonline* crate version *1.0.8+20180822*, where *20180822* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *pagespeedonline* crate version *1.0.8+20190129*, where *20190129* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *pagespeedonline* *v2* API can be found at the //! [official documentation site](https://developers.google.com/speed/docs/insights/v2/getting-started). @@ -852,17 +852,14 @@ impl<'a, C, A> PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -975,7 +972,7 @@ impl<'a, C, A> PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with pagespeedonline (protocol v4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline4-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-pagespeedonline4] path = "../pagespeedonline4" -version = "1.0.8+20180822" +version = "1.0.8+20190129" diff --git a/gen/pagespeedonline4-cli/README.md b/gen/pagespeedonline4-cli/README.md index 5ffad57da2..7e8f5bc639 100644 --- a/gen/pagespeedonline4-cli/README.md +++ b/gen/pagespeedonline4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *pagespeedonline* API at revision *20180822*. The CLI is at version *1.0.8*. +This documentation was generated from the *pagespeedonline* API at revision *20190129*. The CLI is at version *1.0.8*. ```bash pagespeedonline4 [options] diff --git a/gen/pagespeedonline4-cli/mkdocs.yml b/gen/pagespeedonline4-cli/mkdocs.yml index 98773cd167..b030cb7239 100644 --- a/gen/pagespeedonline4-cli/mkdocs.yml +++ b/gen/pagespeedonline4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: pagespeedonline v1.0.8+20180822 +site_name: pagespeedonline v1.0.8+20190129 site_url: http://byron.github.io/google-apis-rs/google-pagespeedonline4-cli site_description: A complete library to interact with pagespeedonline (protocol v4) diff --git a/gen/pagespeedonline4-cli/src/main.rs b/gen/pagespeedonline4-cli/src/main.rs index e1f8f8449e..457aa4c5e0 100644 --- a/gen/pagespeedonline4-cli/src/main.rs +++ b/gen/pagespeedonline4-cli/src/main.rs @@ -247,7 +247,7 @@ fn main() { let mut app = App::new("pagespeedonline4") .author("Sebastian Thiel ") - .version("1.0.8+20180822") + .version("1.0.8+20190129") .about("Analyzes the performance of a web page and provides tailored suggestions to make that page faster.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pagespeedonline4_cli") .arg(Arg::with_name("folder") diff --git a/gen/pagespeedonline4/Cargo.toml b/gen/pagespeedonline4/Cargo.toml index 4617ad0dcf..b39666e60c 100644 --- a/gen/pagespeedonline4/Cargo.toml +++ b/gen/pagespeedonline4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-pagespeedonline4" -version = "1.0.8+20180822" +version = "1.0.8+20190129" authors = ["Sebastian Thiel "] description = "A complete library to interact with pagespeedonline (protocol v4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline4" homepage = "https://developers.google.com/speed/docs/insights/v4/getting-started" -documentation = "https://docs.rs/google-pagespeedonline4/1.0.8+20180822" +documentation = "https://docs.rs/google-pagespeedonline4/1.0.8+20190129" license = "MIT" keywords = ["pagespeedonline", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/pagespeedonline4/README.md b/gen/pagespeedonline4/README.md index cd51775e47..7f24637690 100644 --- a/gen/pagespeedonline4/README.md +++ b/gen/pagespeedonline4/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-pagespeedonline4` library allows access to all features of the *Google pagespeedonline* service. -This documentation was generated from *pagespeedonline* crate version *1.0.8+20180822*, where *20180822* is the exact revision of the *pagespeedonline:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *pagespeedonline* crate version *1.0.8+20190129*, where *20190129* is the exact revision of the *pagespeedonline:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *pagespeedonline* *v4* API can be found at the [official documentation site](https://developers.google.com/speed/docs/insights/v4/getting-started). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/struct.Pagespeedonline.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/struct.Pagespeedonline.html) ... * pagespeedapi - * [*runpagespeed*](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/struct.PagespeedapiRunpagespeedCall.html) + * [*runpagespeed*](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/struct.PagespeedapiRunpagespeedCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/struct.Pagespeedonline.html)** +* **[Hub](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/struct.Pagespeedonline.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.Part.html)** + * **[Parts](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-pagespeedonline4/1.0.8+20180822/google_pagespeedonline4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-pagespeedonline4/1.0.8+20190129/google_pagespeedonline4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/pagespeedonline4/src/lib.rs b/gen/pagespeedonline4/src/lib.rs index b1478c050c..d39071e328 100644 --- a/gen/pagespeedonline4/src/lib.rs +++ b/gen/pagespeedonline4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *pagespeedonline* crate version *1.0.8+20180822*, where *20180822* is the exact revision of the *pagespeedonline:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *pagespeedonline* crate version *1.0.8+20190129*, where *20190129* is the exact revision of the *pagespeedonline:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *pagespeedonline* *v4* API can be found at the //! [official documentation site](https://developers.google.com/speed/docs/insights/v4/getting-started). @@ -964,17 +964,14 @@ impl<'a, C, A> PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1108,7 +1105,7 @@ impl<'a, C, A> PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut"] +description = "A complete library to interact with pagespeedonline (protocol v5)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline5-cli" +homepage = "https://developers.google.com/speed/docs/insights/v5/get-started" +documentation = "http://byron.github.io/google-apis-rs/google_pagespeedonline5_cli" +license = "MIT" +keywords = ["pagespeedonline", "google", "cli"] +autobins = false + +[[bin]] +name = "pagespeedonline5" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-pagespeedonline5] +path = "../pagespeedonline5" +version = "1.0.8+20190129" diff --git a/gen/pagespeedonline5-cli/LICENSE.md b/gen/pagespeedonline5-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/pagespeedonline5-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/pagespeedonline5-cli/README.md b/gen/pagespeedonline5-cli/README.md new file mode 100644 index 0000000000..5b69917f03 --- /dev/null +++ b/gen/pagespeedonline5-cli/README.md @@ -0,0 +1,110 @@ + +The `pagespeedonline5` command-line interface *(CLI)* allows to use most features of the *Google pagespeedonline* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *pagespeedonline* API can be found at the +[official documentation site](https://developers.google.com/speed/docs/insights/v5/get-started). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-pagespeedonline5-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline5-cli). + +# Usage + +This documentation was generated from the *pagespeedonline* API at revision *20190129*. The CLI is at version *1.0.8*. + +```bash +pagespeedonline5 [options] + pagespeedapi + runpagespeed [-p ]... [-o ] + pagespeedonline5 --help + +Configuration: + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `pagespeedonline5-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/pagespeedonline5-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/pagespeedonline5-secret.json`, assuming that the required *pagespeedonline* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `pagespeedonline5 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/pagespeedonline5-cli/mkdocs.yml b/gen/pagespeedonline5-cli/mkdocs.yml new file mode 100644 index 0000000000..33d390353a --- /dev/null +++ b/gen/pagespeedonline5-cli/mkdocs.yml @@ -0,0 +1,17 @@ +site_name: pagespeedonline v1.0.8+20190129 +site_url: http://byron.github.io/google-apis-rs/google-pagespeedonline5-cli +site_description: A complete library to interact with pagespeedonline (protocol v5) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline5-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['pagespeedapi_runpagespeed.md', 'Pagespeedapi', 'Runpagespeed'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/pagespeedonline5-cli/src/cmn.rs b/gen/pagespeedonline5-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/pagespeedonline5-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/pagespeedonline5-cli/src/main.rs b/gen/pagespeedonline5-cli/src/main.rs new file mode 100644 index 0000000000..f6d855f9b5 --- /dev/null +++ b/gen/pagespeedonline5-cli/src/main.rs @@ -0,0 +1,329 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_pagespeedonline5 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Pagespeedonline>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _pagespeedapi_runpagespeed(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.pagespeedapi().runpagespeed(opt.value_of("url").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "utm-source" => { + call = call.utm_source(value.unwrap_or("")); + }, + "utm-campaign" => { + call = call.utm_campaign(value.unwrap_or("")); + }, + "strategy" => { + call = call.strategy(value.unwrap_or("")); + }, + "locale" => { + call = call.locale(value.unwrap_or("")); + }, + "category" => { + call = call.add_category(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["locale", "utm-campaign", "category", "utm-source", "strategy"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("pagespeedapi", Some(opt)) => { + match opt.subcommand() { + ("runpagespeed", Some(opt)) => { + call_result = self._pagespeedapi_runpagespeed(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("pagespeedapi".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "pagespeedonline5-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "pagespeedonline5", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::Pagespeedonline::new(client, auth), + gp: vec!["alt", "fields", "key", "oauth-token", "pretty-print", "quota-user", "user-ip"], + gpm: vec![ + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("user-ip", "userIp"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("pagespeedapi", "methods: 'runpagespeed'", vec![ + ("runpagespeed", + Some(r##"Runs PageSpeed analysis on the page at the specified URL, and returns PageSpeed scores, a list of suggestions to make that page faster, and other information."##), + "Details at http://byron.github.io/google-apis-rs/google_pagespeedonline5_cli/pagespeedapi_runpagespeed", + vec![ + (Some(r##"url"##), + None, + Some(r##"The URL to fetch and analyze"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("pagespeedonline5") + .author("Sebastian Thiel ") + .version("1.0.8+20190129") + .about("Analyzes the performance of a web page and provides tailored suggestions to make that page faster.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pagespeedonline5_cli") + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/pagespeedonline5/Cargo.toml b/gen/pagespeedonline5/Cargo.toml new file mode 100644 index 0000000000..54bcc632d4 --- /dev/null +++ b/gen/pagespeedonline5/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-pagespeedonline5" +version = "1.0.8+20190129" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with pagespeedonline (protocol v5)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline5" +homepage = "https://developers.google.com/speed/docs/insights/v5/get-started" +documentation = "https://docs.rs/google-pagespeedonline5/1.0.8+20190129" +license = "MIT" +keywords = ["pagespeedonline", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/pagespeedonline5/LICENSE.md b/gen/pagespeedonline5/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/pagespeedonline5/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/pagespeedonline5/README.md b/gen/pagespeedonline5/README.md new file mode 100644 index 0000000000..a4dbec830a --- /dev/null +++ b/gen/pagespeedonline5/README.md @@ -0,0 +1,187 @@ + +The `google-pagespeedonline5` library allows access to all features of the *Google pagespeedonline* service. + +This documentation was generated from *pagespeedonline* crate version *1.0.8+20190129*, where *20190129* is the exact revision of the *pagespeedonline:v5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *pagespeedonline* *v5* API can be found at the +[official documentation site](https://developers.google.com/speed/docs/insights/v5/get-started). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/struct.Pagespeedonline.html) ... + +* pagespeedapi + * [*runpagespeed*](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/struct.PagespeedapiRunpagespeedCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/struct.Pagespeedonline.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.pagespeedapi().runpagespeed(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-pagespeedonline5 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_pagespeedonline5 as pagespeedonline5; +use pagespeedonline5::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use pagespeedonline5::Pagespeedonline; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = Pagespeedonline::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.pagespeedapi().runpagespeed("url") + .utm_source("sit") + .utm_campaign("Stet") + .strategy("sed") + .locale("et") + .add_category("dolores") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.RequestValue.html) and +[decodable](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-pagespeedonline5/1.0.8+20190129/google_pagespeedonline5/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **pagespeedonline5** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/pagespeedonline5/src/cmn.rs b/gen/pagespeedonline5/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/pagespeedonline5/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/pagespeedonline5/src/lib.rs b/gen/pagespeedonline5/src/lib.rs new file mode 100644 index 0000000000..b16802fec6 --- /dev/null +++ b/gen/pagespeedonline5/src/lib.rs @@ -0,0 +1,1093 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *pagespeedonline* crate version *1.0.8+20190129*, where *20190129* is the exact revision of the *pagespeedonline:v5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *pagespeedonline* *v5* API can be found at the +//! [official documentation site](https://developers.google.com/speed/docs/insights/v5/get-started). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline5). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Pagespeedonline.html) ... +//! +//! * pagespeedapi +//! * [*runpagespeed*](struct.PagespeedapiRunpagespeedCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Pagespeedonline.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.pagespeedapi().runpagespeed(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-pagespeedonline5 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_pagespeedonline5 as pagespeedonline5; +//! use pagespeedonline5::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use pagespeedonline5::Pagespeedonline; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = Pagespeedonline::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.pagespeedapi().runpagespeed("url") +//! .utm_source("accusam") +//! .utm_campaign("takimata") +//! .strategy("justo") +//! .locale("amet.") +//! .add_category("erat") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Pagespeedonline related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_pagespeedonline5 as pagespeedonline5; +/// use pagespeedonline5::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use pagespeedonline5::Pagespeedonline; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Pagespeedonline::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.pagespeedapi().runpagespeed("url") +/// .utm_source("sea") +/// .utm_campaign("nonumy") +/// .strategy("dolores") +/// .locale("gubergren") +/// .add_category("sadipscing") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Pagespeedonline { + client: RefCell, + auth: RefCell
, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for Pagespeedonline {} + +impl<'a, C, A> Pagespeedonline + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Pagespeedonline { + Pagespeedonline { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://www.googleapis.com/pagespeedonline/v5/".to_string(), + _root_url: "https://www.googleapis.com/".to_string(), + } + } + + pub fn pagespeedapi(&'a self) -> PagespeedapiMethods<'a, C, A> { + PagespeedapiMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://www.googleapis.com/pagespeedonline/v5/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://www.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [runpagespeed pagespeedapi](struct.PagespeedapiRunpagespeedCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PagespeedApiPagespeedResponseV5 { + /// Kind of result. + pub kind: Option, + /// The captcha verify result + #[serde(rename="captchaResult")] + pub captcha_result: Option, + /// Canonicalized and final URL for the document, after following page redirects (if any). + pub id: Option, + /// Metrics of end users' page loading experience. + #[serde(rename="loadingExperience")] + pub loading_experience: Option, + /// The version of PageSpeed used to generate these results. + pub version: Option, + /// The UTC timestamp of this analysis. + #[serde(rename="analysisUTCTimestamp")] + pub analysis_utc_timestamp: Option, + /// Lighthouse response for the audit url as an object. + #[serde(rename="lighthouseResult")] + pub lighthouse_result: Option, + /// Metrics of the aggregated page loading experience of the origin + #[serde(rename="originLoadingExperience")] + pub origin_loading_experience: Option, +} + +impl ResponseResult for PagespeedApiPagespeedResponseV5 {} + + +/// Timing information for this LHR. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseResultV5Timing { + /// The total duration of Lighthouse's run. + pub total: Option, +} + +impl NestedType for LighthouseResultV5Timing {} +impl Part for LighthouseResultV5Timing {} + + +/// Map of categories in the LHR. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseResultV5Categories { + /// The Search-Engine-Optimization (SEO) category, containing all seo related audits. + pub seo: Option, + /// The best practices category, containing all web best practice related audits. + #[serde(rename="best-practices")] + pub best_practices: Option, + /// The performance category, containing all performance related audits. + pub performance: Option, + /// The accessibility category, containing all accessibility related audits. + pub accessibility: Option, + /// The Progressive-Web-App (PWA) category, containing all pwa related audits. + pub pwa: Option, +} + +impl NestedType for LighthouseResultV5Categories {} +impl Part for LighthouseResultV5Categories {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseCategoryV5 { + /// A description for the manual audits in the category. + #[serde(rename="manualDescription")] + pub manual_description: Option, + /// no description provided + pub score: Option, + /// A more detailed description of the category and its importance. + pub description: Option, + /// The human-friendly name of the category. + pub title: Option, + /// An array of references to all the audit members of this category. + #[serde(rename="auditRefs")] + pub audit_refs: Option>, + /// The string identifier of the category. + pub id: Option, +} + +impl Part for LighthouseCategoryV5 {} + + +/// Environment settings that were used when making this LHR. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseResultV5Environment { + /// The benchmark index number that indicates rough device class. + #[serde(rename="benchmarkIndex")] + pub benchmark_index: Option, + /// The user agent string that was sent over the network. + #[serde(rename="networkUserAgent")] + pub network_user_agent: Option, + /// The user agent string of the version of Chrome used. + #[serde(rename="hostUserAgent")] + pub host_user_agent: Option, +} + +impl NestedType for LighthouseResultV5Environment {} +impl Part for LighthouseResultV5Environment {} + + +/// Internationalized strings that are formatted to the locale in configSettings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseResultV5I18nRendererFormattedStrings { + /// The heading that is shown above a list of audits that are passing. + #[serde(rename="passedAuditsGroupTitle")] + pub passed_audits_group_title: Option, + /// The tooltip text on an expandable chevron icon. + #[serde(rename="auditGroupExpandTooltip")] + pub audit_group_expand_tooltip: Option, + /// The disclaimer shown below a performance metric value. + #[serde(rename="varianceDisclaimer")] + pub variance_disclaimer: Option, + /// The heading for the estimated page load savings of opportunity audits. + #[serde(rename="opportunitySavingsColumnLabel")] + pub opportunity_savings_column_label: Option, + /// The error string shown next to an erroring audit. + #[serde(rename="errorMissingAuditInfo")] + pub error_missing_audit_info: Option, + /// The disclaimer shown under performance explaning that the network can vary. + #[serde(rename="lsPerformanceCategoryDescription")] + pub ls_performance_category_description: Option, + /// The heading shown above a list of audits that were not computerd in the run. + #[serde(rename="manualAuditsGroupTitle")] + pub manual_audits_group_title: Option, + /// The heading shown above a list of audits that do not apply to a page. + #[serde(rename="notApplicableAuditsGroupTitle")] + pub not_applicable_audits_group_title: Option, + /// The label that explains the score gauges scale (0-49, 50-89, 90-100). + #[serde(rename="scorescaleLabel")] + pub scorescale_label: Option, + /// The label shown above a bulleted list of warnings. + #[serde(rename="warningHeader")] + pub warning_header: Option, + /// The title of the lab data performance category. + #[serde(rename="labDataTitle")] + pub lab_data_title: Option, + /// The label shown preceding important warnings that may have invalidated an entire report. + #[serde(rename="toplevelWarningsMessage")] + pub toplevel_warnings_message: Option, + /// The label for values shown in the summary of critical request chains. + #[serde(rename="crcLongestDurationLabel")] + pub crc_longest_duration_label: Option, + /// The label shown next to an audit or metric that has had an error. + #[serde(rename="errorLabel")] + pub error_label: Option, + /// The heading for the estimated page load savings opportunity of an audit. + #[serde(rename="opportunityResourceColumnLabel")] + pub opportunity_resource_column_label: Option, + /// The label for the initial request in a critical request chain. + #[serde(rename="crcInitialNavigation")] + pub crc_initial_navigation: Option, +} + +impl NestedType for LighthouseResultV5I18nRendererFormattedStrings {} +impl Part for LighthouseResultV5I18nRendererFormattedStrings {} + + +/// A grouping contained in a category that groups similar audits together. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseResultV5CategoryGroups { + /// An optional human readable description of the category group. + pub description: Option, + /// The title of the category group. + pub title: Option, +} + +impl NestedType for LighthouseResultV5CategoryGroups {} +impl Part for LighthouseResultV5CategoryGroups {} + + +/// The configuration settings for this LHR. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseResultV5ConfigSettings { + /// The locale setting. + pub locale: Option, + /// no description provided + #[serde(rename="onlyCategories")] + pub only_categories: Option, + /// The form factor the emulation should use. + #[serde(rename="emulatedFormFactor")] + pub emulated_form_factor: Option, +} + +impl NestedType for LighthouseResultV5ConfigSettings {} +impl Part for LighthouseResultV5ConfigSettings {} + + +/// The internationalization strings that are required to render the LHR. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseResultV5I18n { + /// Internationalized strings that are formatted to the locale in configSettings. + #[serde(rename="rendererFormattedStrings")] + pub renderer_formatted_strings: Option, +} + +impl NestedType for LighthouseResultV5I18n {} +impl Part for LighthouseResultV5I18n {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseResultV5 { + /// The time that this run was fetched. + #[serde(rename="fetchTime")] + pub fetch_time: Option, + /// The final resolved url that was audited. + #[serde(rename="finalUrl")] + pub final_url: Option, + /// Map of category groups in the LHR. + #[serde(rename="categoryGroups")] + pub category_groups: Option>, + /// List of all run warnings in the LHR. Will always output to at least `[]`. + #[serde(rename="runWarnings")] + pub run_warnings: Option>, + /// A top-level error message that, if present, indicates a serious enough problem that this Lighthouse result may need to be discarded. + #[serde(rename="runtimeError")] + pub runtime_error: Option, + /// The configuration settings for this LHR. + #[serde(rename="configSettings")] + pub config_settings: Option, + /// The lighthouse version that was used to generate this LHR. + #[serde(rename="lighthouseVersion")] + pub lighthouse_version: Option, + /// Environment settings that were used when making this LHR. + pub environment: Option, + /// The internationalization strings that are required to render the LHR. + pub i18n: Option, + /// Timing information for this LHR. + pub timing: Option, + /// The user agent that was used to run this LHR. + #[serde(rename="userAgent")] + pub user_agent: Option, + /// Map of audits in the LHR. + pub audits: Option>, + /// Map of categories in the LHR. + pub categories: Option, + /// The original requested url. + #[serde(rename="requestedUrl")] + pub requested_url: Option, +} + +impl Part for LighthouseResultV5 {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PagespeedApiLoadingExperienceV5MetricsDistributions { + /// no description provided + pub max: Option, + /// no description provided + pub proportion: Option, + /// no description provided + pub min: Option, +} + +impl NestedType for PagespeedApiLoadingExperienceV5MetricsDistributions {} +impl Part for PagespeedApiLoadingExperienceV5MetricsDistributions {} + + +/// A top-level error message that, if present, indicates a serious enough problem that this Lighthouse result may need to be discarded. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseResultV5RuntimeError { + /// A human readable message explaining the error code. + pub message: Option, + /// The enumerated Lighthouse Error code. + pub code: Option, +} + +impl NestedType for LighthouseResultV5RuntimeError {} +impl Part for LighthouseResultV5RuntimeError {} + + +/// An array of references to all the audit members of this category. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseCategoryV5AuditRefs { + /// The category group that the audit belongs to (optional). + pub group: Option, + /// The audit ref id. + pub id: Option, + /// The weight this audit's score has on the overall category score. + pub weight: Option, +} + +impl NestedType for LighthouseCategoryV5AuditRefs {} +impl Part for LighthouseCategoryV5AuditRefs {} + + +/// The version of PageSpeed used to generate these results. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PagespeedApiPagespeedResponseV5Version { + /// The major version number of PageSpeed used to generate these results. + pub major: Option, + /// The minor version number of PageSpeed used to generate these results. + pub minor: Option, +} + +impl NestedType for PagespeedApiPagespeedResponseV5Version {} +impl Part for PagespeedApiPagespeedResponseV5Version {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PagespeedApiLoadingExperienceV5 { + /// no description provided + pub metrics: Option>, + /// The url, pattern or origin which the metrics are on. + pub id: Option, + /// no description provided + pub overall_category: Option, + /// no description provided + pub initial_url: Option, +} + +impl Part for PagespeedApiLoadingExperienceV5 {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LighthouseAuditResultV5 { + /// The description of the audit. + pub description: Option, + /// The human readable title. + pub title: Option, + /// An explanation of the errors in the audit. + pub explanation: Option, + /// An error message from a thrown error inside the audit. + #[serde(rename="errorMessage")] + pub error_message: Option, + /// no description provided + pub score: Option, + /// Freeform details section of the audit. + pub details: Option>, + /// no description provided + pub warnings: Option, + /// The value that should be displayed on the UI for this audit. + #[serde(rename="displayValue")] + pub display_value: Option, + /// The enumerated score display mode. + #[serde(rename="scoreDisplayMode")] + pub score_display_mode: Option, + /// The audit's id. + pub id: Option, +} + +impl Part for LighthouseAuditResultV5 {} + + +/// The type of the metric. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PagespeedApiLoadingExperienceV5Metrics { + /// no description provided + pub category: Option, + /// no description provided + pub percentile: Option, + /// no description provided + pub distributions: Option>, +} + +impl NestedType for PagespeedApiLoadingExperienceV5Metrics {} +impl Part for PagespeedApiLoadingExperienceV5Metrics {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *pagespeedapi* resources. +/// It is not used directly, but through the `Pagespeedonline` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_pagespeedonline5 as pagespeedonline5; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use pagespeedonline5::Pagespeedonline; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Pagespeedonline::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `runpagespeed(...)` +/// // to build up your call. +/// let rb = hub.pagespeedapi(); +/// # } +/// ``` +pub struct PagespeedapiMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pagespeedonline, +} + +impl<'a, C, A> MethodsBuilder for PagespeedapiMethods<'a, C, A> {} + +impl<'a, C, A> PagespeedapiMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Runs PageSpeed analysis on the page at the specified URL, and returns PageSpeed scores, a list of suggestions to make that page faster, and other information. + /// + /// # Arguments + /// + /// * `url` - The URL to fetch and analyze + pub fn runpagespeed(&self, url: &str) -> PagespeedapiRunpagespeedCall<'a, C, A> { + PagespeedapiRunpagespeedCall { + hub: self.hub, + _url: url.to_string(), + _utm_source: Default::default(), + _utm_campaign: Default::default(), + _strategy: Default::default(), + _locale: Default::default(), + _category: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Runs PageSpeed analysis on the page at the specified URL, and returns PageSpeed scores, a list of suggestions to make that page faster, and other information. +/// +/// A builder for the *runpagespeed* method supported by a *pagespeedapi* resource. +/// It is not used directly, but through a `PagespeedapiMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_pagespeedonline5 as pagespeedonline5; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use pagespeedonline5::Pagespeedonline; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Pagespeedonline::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.pagespeedapi().runpagespeed("url") +/// .utm_source("ea") +/// .utm_campaign("no") +/// .strategy("justo") +/// .locale("justo") +/// .add_category("et") +/// .doit(); +/// # } +/// ``` +pub struct PagespeedapiRunpagespeedCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Pagespeedonline, + _url: String, + _utm_source: Option, + _utm_campaign: Option, + _strategy: Option, + _locale: Option, + _category: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, +} + +impl<'a, C, A> CallBuilder for PagespeedapiRunpagespeedCall<'a, C, A> {} + +impl<'a, C, A> PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PagespeedApiPagespeedResponseV5)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "pagespeedonline.pagespeedapi.runpagespeed", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("url", self._url.to_string())); + if let Some(value) = self._utm_source { + params.push(("utm_source", value.to_string())); + } + if let Some(value) = self._utm_campaign { + params.push(("utm_campaign", value.to_string())); + } + if let Some(value) = self._strategy { + params.push(("strategy", value.to_string())); + } + if let Some(value) = self._locale { + params.push(("locale", value.to_string())); + } + if self._category.len() > 0 { + for f in self._category.iter() { + params.push(("category", f.to_string())); + } + } + for &field in ["alt", "url", "utm_source", "utm_campaign", "strategy", "locale", "category"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "runPagespeed"; + + let mut key = self.hub.auth.borrow_mut().api_key(); + if key.is_none() { + key = dlg.api_key(); + } + match key { + Some(value) => params.push(("key", value)), + None => { + dlg.finished(false); + return Err(Error::MissingAPIKey) + } + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The URL to fetch and analyze + /// + /// Sets the *url* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn url(mut self, new_value: &str) -> PagespeedapiRunpagespeedCall<'a, C, A> { + self._url = new_value.to_string(); + self + } + /// Campaign source for analytics. + /// + /// Sets the *utm_source* query property to the given value. + pub fn utm_source(mut self, new_value: &str) -> PagespeedapiRunpagespeedCall<'a, C, A> { + self._utm_source = Some(new_value.to_string()); + self + } + /// Campaign name for analytics. + /// + /// Sets the *utm_campaign* query property to the given value. + pub fn utm_campaign(mut self, new_value: &str) -> PagespeedapiRunpagespeedCall<'a, C, A> { + self._utm_campaign = Some(new_value.to_string()); + self + } + /// The analysis strategy (desktop or mobile) to use, and desktop is the default + /// + /// Sets the *strategy* query property to the given value. + pub fn strategy(mut self, new_value: &str) -> PagespeedapiRunpagespeedCall<'a, C, A> { + self._strategy = Some(new_value.to_string()); + self + } + /// The locale used to localize formatted results + /// + /// Sets the *locale* query property to the given value. + pub fn locale(mut self, new_value: &str) -> PagespeedapiRunpagespeedCall<'a, C, A> { + self._locale = Some(new_value.to_string()); + self + } + /// A Lighthouse category to run; if none are given, only Performance category will be run + /// + /// Append the given value to the *category* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_category(mut self, new_value: &str) -> PagespeedapiRunpagespeedCall<'a, C, A> { + self._category.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PagespeedapiRunpagespeedCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PagespeedapiRunpagespeedCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + +} + + diff --git a/gen/partners2/Cargo.toml b/gen/partners2/Cargo.toml index 00d2dd479f..4758b6fe1f 100644 --- a/gen/partners2/Cargo.toml +++ b/gen/partners2/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/partners2/src/lib.rs b/gen/partners2/src/lib.rs index bc8a4dda5f..fa38e54bb2 100644 --- a/gen/partners2/src/lib.rs +++ b/gen/partners2/src/lib.rs @@ -2731,10 +2731,7 @@ impl<'a, C, A> MethodUpdateCompanyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2753,7 +2750,7 @@ impl<'a, C, A> MethodUpdateCompanyCall<'a, C, A> where C: BorrowMut MethodUpdateCompanyCall<'a, C, A> where C: BorrowMut MethodGetPartnersstatuCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -3171,7 +3165,7 @@ impl<'a, C, A> MethodGetPartnersstatuCall<'a, C, A> where C: BorrowMut MethodUpdateLeadCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3350,7 +3341,7 @@ impl<'a, C, A> MethodUpdateLeadCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -3492,7 +3483,7 @@ impl<'a, C, A> MethodUpdateLeadCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3607,10 +3598,7 @@ impl<'a, C, A> UserEventLogCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3629,7 +3617,7 @@ impl<'a, C, A> UserEventLogCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -3708,7 +3696,7 @@ impl<'a, C, A> UserEventLogCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3825,10 +3813,7 @@ impl<'a, C, A> ClientMessageLogCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3847,7 +3832,7 @@ impl<'a, C, A> ClientMessageLogCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -3926,7 +3911,7 @@ impl<'a, C, A> ClientMessageLogCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4114,17 +4099,14 @@ impl<'a, C, A> CompanyGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -4290,7 +4272,7 @@ impl<'a, C, A> CompanyGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4428,10 +4410,7 @@ impl<'a, C, A> CompanyLeadCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4450,7 +4429,7 @@ impl<'a, C, A> CompanyLeadCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -4539,7 +4518,7 @@ impl<'a, C, A> CompanyLeadCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4784,17 +4763,14 @@ impl<'a, C, A> CompanyListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -5075,7 +5051,7 @@ impl<'a, C, A> CompanyListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5236,17 +5212,14 @@ impl<'a, C, A> LeadListCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -5393,7 +5366,7 @@ impl<'a, C, A> LeadListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5549,17 +5522,14 @@ impl<'a, C, A> AnalyticListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -5706,7 +5676,7 @@ impl<'a, C, A> AnalyticListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5871,17 +5841,14 @@ impl<'a, C, A> OfferHistoryListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -6034,7 +6001,7 @@ impl<'a, C, A> OfferHistoryListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6179,17 +6146,14 @@ impl<'a, C, A> OfferListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -6310,7 +6274,7 @@ impl<'a, C, A> OfferListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6455,17 +6419,14 @@ impl<'a, C, A> UserStateListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -6586,7 +6547,7 @@ impl<'a, C, A> UserStateListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6739,10 +6700,7 @@ impl<'a, C, A> UserUpdateProfileCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6761,7 +6719,7 @@ impl<'a, C, A> UserUpdateProfileCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -6894,7 +6852,7 @@ impl<'a, C, A> UserUpdateProfileCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7069,10 +7027,7 @@ impl<'a, C, A> UserCreateCompanyRelationCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7091,7 +7046,7 @@ impl<'a, C, A> UserCreateCompanyRelationCall<'a, C, A> where C: BorrowMut UserCreateCompanyRelationCall<'a, C, A> where C: BorrowMut UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -7557,7 +7509,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7725,17 +7677,14 @@ impl<'a, C, A> UserDeleteCompanyRelationCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -7867,7 +7816,7 @@ impl<'a, C, A> UserDeleteCompanyRelationCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with People Service (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/people1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-people1] path = "../people1" -version = "1.0.8+20181010" +version = "1.0.8+20190330" diff --git a/gen/people1-cli/README.md b/gen/people1-cli/README.md index fa69bf57bc..1ca19273f1 100644 --- a/gen/people1-cli/README.md +++ b/gen/people1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *People Service* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *People Service* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash people1 [options] diff --git a/gen/people1-cli/mkdocs.yml b/gen/people1-cli/mkdocs.yml index 038940318f..a37cf01fb3 100644 --- a/gen/people1-cli/mkdocs.yml +++ b/gen/people1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: People Service v1.0.8+20181010 +site_name: People Service v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-people1-cli site_description: A complete library to interact with People Service (protocol v1) diff --git a/gen/people1-cli/src/main.rs b/gen/people1-cli/src/main.rs index 14bb7c7bed..cca8b60e93 100644 --- a/gen/people1-cli/src/main.rs +++ b/gen/people1-cli/src/main.rs @@ -128,8 +128,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "contact-group.group-type" => Some(("contactGroup.groupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "contact-group.formatted-name" => Some(("contactGroup.formattedName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "contact-group.group-type" => Some(("contactGroup.groupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "contact-group.name" => Some(("contactGroup.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "contact-group.member-resource-names" => Some(("contactGroup.memberResourceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "contact-group.member-count" => Some(("contactGroup.memberCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -481,8 +481,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "contact-group.group-type" => Some(("contactGroup.groupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "contact-group.formatted-name" => Some(("contactGroup.formattedName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "contact-group.group-type" => Some(("contactGroup.groupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "contact-group.name" => Some(("contactGroup.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "contact-group.member-resource-names" => Some(("contactGroup.memberResourceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "contact-group.member-count" => Some(("contactGroup.memberCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -651,8 +651,8 @@ impl<'n> Engine<'n> { "age-range" => Some(("ageRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "resource-name" => Some(("resourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "metadata.previous-resource-names" => Some(("metadata.previousResourceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "metadata.deleted" => Some(("metadata.deleted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "metadata.previous-resource-names" => Some(("metadata.previousResourceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "metadata.linked-people-resource-names" => Some(("metadata.linkedPeopleResourceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "metadata.object-type" => Some(("metadata.objectType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -919,8 +919,8 @@ impl<'n> Engine<'n> { "age-range" => Some(("ageRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "resource-name" => Some(("resourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "metadata.previous-resource-names" => Some(("metadata.previousResourceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "metadata.deleted" => Some(("metadata.deleted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "metadata.previous-resource-names" => Some(("metadata.previousResourceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "metadata.linked-people-resource-names" => Some(("metadata.linkedPeopleResourceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "metadata.object-type" => Some(("metadata.objectType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -1237,7 +1237,11 @@ fn main() { Some(false)), ]), ("members-modify", - Some(r##"Modify the members of a contact group owned by the authenticated user."##), + Some(r##"Modify the members of a contact group owned by the authenticated user. +
+ The only system contact groups that can have members added are + `contactGroups/myContacts` and `contactGroups/starred`. Other system + contact groups are deprecated and can only have contacts removed."##), "Details at http://byron.github.io/google-apis-rs/google_people1_cli/contact-groups_members-modify", vec![ (Some(r##"resource-name"##), @@ -1465,7 +1469,7 @@ fn main() { let mut app = App::new("people1") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190330") .about("Provides access to information about profiles and contacts.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_people1_cli") .arg(Arg::with_name("url") diff --git a/gen/people1/Cargo.toml b/gen/people1/Cargo.toml index 748db3c808..44812b238e 100644 --- a/gen/people1/Cargo.toml +++ b/gen/people1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-people1" -version = "1.0.8+20181010" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with People Service (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/people1" homepage = "https://developers.google.com/people/" -documentation = "https://docs.rs/google-people1/1.0.8+20181010" +documentation = "https://docs.rs/google-people1/1.0.8+20190330" license = "MIT" keywords = ["people", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/people1/README.md b/gen/people1/README.md index eaf4ec9134..7c89f98c26 100644 --- a/gen/people1/README.md +++ b/gen/people1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-people1` library allows access to all features of the *Google People Service* service. -This documentation was generated from *People Service* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *people:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *People Service* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *people:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *People Service* *v1* API can be found at the [official documentation site](https://developers.google.com/people/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.PeopleService.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.PeopleService.html) ... -* [contact groups](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.ContactGroup.html) - * [*batch get*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.ContactGroupBatchGetCall.html), [*create*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.ContactGroupCreateCall.html), [*delete*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.ContactGroupDeleteCall.html), [*get*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.ContactGroupGetCall.html), [*list*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.ContactGroupListCall.html), [*members modify*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.ContactGroupMemberModifyCall.html) and [*update*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.ContactGroupUpdateCall.html) +* [contact groups](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.ContactGroup.html) + * [*batch get*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.ContactGroupBatchGetCall.html), [*create*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.ContactGroupCreateCall.html), [*delete*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.ContactGroupDeleteCall.html), [*get*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.ContactGroupGetCall.html), [*list*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.ContactGroupListCall.html), [*members modify*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.ContactGroupMemberModifyCall.html) and [*update*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.ContactGroupUpdateCall.html) * people - * [*connections list*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.PeopleConnectionListCall.html), [*create contact*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.PeopleCreateContactCall.html), [*delete contact*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.PeopleDeleteContactCall.html), [*get*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.PeopleGetCall.html), [*get batch get*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.PeopleGetBatchGetCall.html) and [*update contact*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.PeopleUpdateContactCall.html) + * [*connections list*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.PeopleConnectionListCall.html), [*create contact*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.PeopleCreateContactCall.html), [*delete contact*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.PeopleDeleteContactCall.html), [*get*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.PeopleGetCall.html), [*get batch get*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.PeopleGetBatchGetCall.html) and [*update contact*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.PeopleUpdateContactCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-people1/1.0.8+20181010/google_people1/struct.PeopleService.html)** +* **[Hub](https://docs.rs/google-people1/1.0.8+20190330/google_people1/struct.PeopleService.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.Part.html)** + * **[Parts](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -135,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-people1/1.0.8+20181010/google_people1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-people1/1.0.8+20190330/google_people1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-people1/1.0.8+20181010/google_people1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-people1/1.0.8+20190330/google_people1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -155,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-people1/1.0.8+20181010/google_people1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-people1/1.0.8+20190330/google_people1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/people1/src/lib.rs b/gen/people1/src/lib.rs index 1bccd50939..e7e3775d46 100644 --- a/gen/people1/src/lib.rs +++ b/gen/people1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *People Service* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *people:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *People Service* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *people:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *People Service* *v1* API can be found at the //! [official documentation site](https://developers.google.com/people/). @@ -236,13 +236,13 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// Know the list of people in your circles, your age range, and language + /// View your basic profile info, including your age range and language PluLogin, /// View your complete date of birth UserBirthdayRead, - /// View your contacts + /// See and download your contacts ContactReadonly, /// View your email addresses @@ -251,13 +251,13 @@ pub enum Scope { /// View your street addresses UserAddresseRead, - /// Manage your contacts + /// See, edit, download, and permanently delete your contacts Contact, /// View your phone numbers UserPhonenumberRead, - /// View your basic profile info + /// See your personal info, including any personal info you've made publicly available UserinfoProfile, /// View your email address @@ -447,11 +447,11 @@ impl ResponseResult for ListContactGroupsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListConnectionsResponse { + /// The list of people that the requestor is connected to. + pub connections: Option>, /// The token that can be used to retrieve the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The list of people that the requestor is connected to. - pub connections: Option>, /// The token that can be used to retrieve changes since the last request. #[serde(rename="nextSyncToken")] pub next_sync_token: Option, @@ -503,16 +503,6 @@ impl Part for RelationshipStatus {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PersonResponse { - /// The status of the response. - pub status: Option, - /// The person. - pub person: Option, - /// **DEPRECATED** (Please use status instead) - /// - /// [HTTP 1.1 status code] - /// (http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html). - #[serde(rename="httpStatusCode")] - pub http_status_code: Option, /// The original requested resource name. May be different than the resource /// name on the returned person. /// @@ -521,6 +511,16 @@ pub struct PersonResponse { /// profile URL. #[serde(rename="requestedResourceName")] pub requested_resource_name: Option, + /// The person. + pub person: Option, + /// **DEPRECATED** (Please use status instead) + /// + /// [HTTP 1.1 status code] + /// (http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html). + #[serde(rename="httpStatusCode")] + pub http_status_code: Option, + /// The status of the response. + pub status: Option, } impl Part for PersonResponse {} @@ -532,10 +532,10 @@ impl Part for PersonResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UserDefined { - /// The end user specified value of the user defined data. - pub value: Option, /// The end user specified key of the user defined data. pub key: Option, + /// The end user specified value of the user defined data. + pub value: Option, /// Metadata about the user defined data. pub metadata: Option, } @@ -662,83 +662,42 @@ pub struct CoverPhoto { impl Part for CoverPhoto {} -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: +/// Metadata about a field. /// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } +/// This type is not used in any activity, and only used as *part* of another schema. /// -/// The JSON representation for `Empty` is empty JSON object `{}`. +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FieldMetadata { + /// The source of the field. + pub source: Option, + /// True if the field is verified; false if the field is unverified. A + /// verified field is typically a name, email address, phone number, or + /// website that has been confirmed to be owned by the person. + pub verified: Option, + /// True if the field is the primary field; false if the field is a secondary + /// field. + pub primary: Option, +} + +impl Part for FieldMetadata {} + + +/// There is no detailed description. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [delete contact groups](struct.ContactGroupDeleteCall.html) (response) -/// * [delete contact people](struct.PeopleDeleteContactCall.html) (response) +/// * [get batch get people](struct.PeopleGetBatchGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - -/// A person's name. If the name is a mononym, the family name is empty. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Name { - /// The middle name(s) spelled as they sound. - #[serde(rename="phoneticMiddleName")] - pub phonetic_middle_name: Option, - /// The given name spelled as it sounds. - #[serde(rename="phoneticGivenName")] - pub phonetic_given_name: Option, - /// The honorific prefixes, such as `Mrs.` or `Dr.` - #[serde(rename="honorificPrefix")] - pub honorific_prefix: Option, - /// The family name spelled as it sounds. - #[serde(rename="phoneticFamilyName")] - pub phonetic_family_name: Option, - /// The read-only display name formatted according to the locale specified by - /// the viewer's account or the `Accept-Language` HTTP header. - #[serde(rename="displayName")] - pub display_name: Option, - /// The middle name(s). - #[serde(rename="middleName")] - pub middle_name: Option, - /// The honorific prefixes spelled as they sound. - #[serde(rename="phoneticHonorificPrefix")] - pub phonetic_honorific_prefix: Option, - /// The family name. - #[serde(rename="familyName")] - pub family_name: Option, - /// The full name spelled as it sounds. - #[serde(rename="phoneticFullName")] - pub phonetic_full_name: Option, - /// The read-only display name with the last name first formatted according to - /// the locale specified by the viewer's account or the - /// `Accept-Language` HTTP header. - #[serde(rename="displayNameLastFirst")] - pub display_name_last_first: Option, - /// The honorific suffixes spelled as they sound. - #[serde(rename="phoneticHonorificSuffix")] - pub phonetic_honorific_suffix: Option, - /// The given name. - #[serde(rename="givenName")] - pub given_name: Option, - /// The honorific suffixes, such as `Jr.` - #[serde(rename="honorificSuffix")] - pub honorific_suffix: Option, - /// Metadata about the name. - pub metadata: Option, +pub struct GetPeopleResponse { + /// The response for each requested resource name. + pub responses: Option>, } -impl Part for Name {} +impl ResponseResult for GetPeopleResponse {} /// A person's read-only relationship interest . @@ -799,14 +758,14 @@ impl Part for BraggingRights {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ContactGroup { - /// The read-only contact group type. - #[serde(rename="groupType")] - pub group_type: Option, /// The read-only name translated and formatted in the viewer's account locale /// or the `Accept-Language` HTTP header locale for system groups names. /// Group names set by the owner are the same as name. #[serde(rename="formattedName")] pub formatted_name: Option, + /// The read-only contact group type. + #[serde(rename="groupType")] + pub group_type: Option, /// The contact group name set by the group owner or a system provided name /// for system groups. pub name: Option, @@ -873,24 +832,28 @@ pub struct Birthday { impl Part for Birthday {} -/// Metadata about a field. +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete contact groups](struct.ContactGroupDeleteCall.html) (response) +/// * [delete contact people](struct.PeopleDeleteContactCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct FieldMetadata { - /// The source of the field. - pub source: Option, - /// True if the field is verified; false if the field is unverified. A - /// verified field is typically a name, email address, phone number, or - /// website that has been confirmed to be owned by the person. - pub verified: Option, - /// True if the field is the primary field; false if the field is a secondary - /// field. - pub primary: Option, -} +pub struct Empty { _never_set: Option } -impl Part for FieldMetadata {} +impl ResponseResult for Empty {} /// A person's physical address. May be a P.O. box or street address. All fields @@ -900,16 +863,16 @@ impl Part for FieldMetadata {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Address { - /// The read-only type of the address translated and formatted in the viewer's - /// account locale or the `Accept-Language` HTTP header locale. - #[serde(rename="formattedType")] - pub formatted_type: Option, + /// The city of the address. + pub city: Option, /// The [ISO 3166-1 alpha-2](http://www.iso.org/iso/country_codes.htm) country /// code of the address. #[serde(rename="countryCode")] pub country_code: Option, - /// The city of the address. - pub city: Option, + /// The read-only type of the address translated and formatted in the viewer's + /// account locale or the `Accept-Language` HTTP header locale. + #[serde(rename="formattedType")] + pub formatted_type: Option, /// The unstructured value of the address. If this is not set by the user it /// will be automatically constructed from structured values. #[serde(rename="formattedValue")] @@ -957,16 +920,16 @@ impl Part for Address {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Date { - /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without - /// a year. - pub year: Option, + /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a + /// month and day. + pub month: Option, /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0 /// if specifying a year by itself or a year and month where the day is not /// significant. pub day: Option, - /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a - /// month and day. - pub month: Option, + /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without + /// a year. + pub year: Option, } impl Part for Date {} @@ -1070,17 +1033,17 @@ pub struct ContactGroupResponse { impl Part for ContactGroupResponse {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -1201,22 +1164,59 @@ pub struct AgeRangeType { impl Part for AgeRangeType {} -/// There is no detailed description. +/// A person's name. If the name is a mononym, the family name is empty. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get batch get people](struct.PeopleGetBatchGetCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetPeopleResponse { - /// The response for each requested resource name. - pub responses: Option>, +pub struct Name { + /// The middle name(s) spelled as they sound. + #[serde(rename="phoneticMiddleName")] + pub phonetic_middle_name: Option, + /// The given name spelled as it sounds. + #[serde(rename="phoneticGivenName")] + pub phonetic_given_name: Option, + /// The honorific prefixes, such as `Mrs.` or `Dr.` + #[serde(rename="honorificPrefix")] + pub honorific_prefix: Option, + /// The read-only display name with the last name first formatted according to + /// the locale specified by the viewer's account or the + /// `Accept-Language` HTTP header. + #[serde(rename="displayNameLastFirst")] + pub display_name_last_first: Option, + /// The read-only display name formatted according to the locale specified by + /// the viewer's account or the `Accept-Language` HTTP header. + #[serde(rename="displayName")] + pub display_name: Option, + /// The middle name(s). + #[serde(rename="middleName")] + pub middle_name: Option, + /// The honorific prefixes spelled as they sound. + #[serde(rename="phoneticHonorificPrefix")] + pub phonetic_honorific_prefix: Option, + /// The family name. + #[serde(rename="familyName")] + pub family_name: Option, + /// The full name spelled as it sounds. + #[serde(rename="phoneticFullName")] + pub phonetic_full_name: Option, + /// The family name spelled as it sounds. + #[serde(rename="phoneticFamilyName")] + pub phonetic_family_name: Option, + /// The honorific suffixes spelled as they sound. + #[serde(rename="phoneticHonorificSuffix")] + pub phonetic_honorific_suffix: Option, + /// The given name. + #[serde(rename="givenName")] + pub given_name: Option, + /// The honorific suffixes, such as `Jr.` + #[serde(rename="honorificSuffix")] + pub honorific_suffix: Option, + /// Metadata about the name. + pub metadata: Option, } -impl ResponseResult for GetPeopleResponse {} +impl Part for Name {} /// A person's associated URLs. @@ -1450,12 +1450,15 @@ impl Part for Gender {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PhoneNumber { - /// The read-only canonicalized [ITU-T E.164](https://law.resource.org/pub/us/cfr/ibr/004/itu-t.E.164.1.2008.pdf) + /// The read-only canonicalized [ITU-T + /// E.164](https://law.resource.org/pub/us/cfr/ibr/004/itu-t.E.164.1.2008.pdf) /// form of the phone number. #[serde(rename="canonicalForm")] pub canonical_form: Option, - /// Metadata about the phone number. - pub metadata: Option, + /// The read-only type of the phone number translated and formatted in the + /// viewer's account locale or the `Accept-Language` HTTP header locale. + #[serde(rename="formattedType")] + pub formatted_type: Option, /// The type of the phone number. The type can be custom or one of these /// predefined values: /// @@ -1475,10 +1478,8 @@ pub struct PhoneNumber { pub type_: Option, /// The phone number. pub value: Option, - /// The read-only type of the phone number translated and formatted in the - /// viewer's account locale or the `Accept-Language` HTTP header locale. - #[serde(rename="formattedType")] - pub formatted_type: Option, + /// Metadata about the phone number. + pub metadata: Option, } impl Part for PhoneNumber {} @@ -1495,7 +1496,8 @@ pub struct Organization { /// viewer's account locale or the `Accept-Language` HTTP header locale. #[serde(rename="formattedType")] pub formatted_type: Option, - /// The domain name associated with the organization; for example, `google.com`. + /// The domain name associated with the organization; for example, + /// `google.com`. pub domain: Option, /// The end date when the person left the organization. #[serde(rename="endDate")] @@ -1617,6 +1619,10 @@ impl Part for ContactGroupMetadata {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PersonMetadata { + /// True if the person resource has been deleted. Populated only for + /// [`connections.list`](/people/api/rest/v1/people.connections/list) requests + /// that include a sync token. + pub deleted: Option, /// Any former resource names this person has had. Populated only for /// [`connections.list`](/people/api/rest/v1/people.connections/list) requests /// that include a sync token. @@ -1626,21 +1632,17 @@ pub struct PersonMetadata { /// profile URL. #[serde(rename="previousResourceNames")] pub previous_resource_names: Option>, - /// The sources of data for the person. - pub sources: Option>, /// Resource names of people linked to this resource. #[serde(rename="linkedPeopleResourceNames")] pub linked_people_resource_names: Option>, - /// True if the person resource has been deleted. Populated only for - /// [`connections.list`](/people/api/rest/v1/people.connections/list) requests - /// that include a sync token. - pub deleted: Option, /// **DEPRECATED** (Please use /// `person.metadata.sources.profileMetadata.objectType` instead) /// /// The type of the person object. #[serde(rename="objectType")] pub object_type: Option, + /// The sources of data for the person. + pub sources: Option>, } impl Part for PersonMetadata {} @@ -1671,12 +1673,12 @@ impl ResponseResult for ModifyContactGroupMembersResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Relation { - /// The name of the other person this relation refers to. - pub person: Option, /// The type of the relation translated and formatted in the viewer's account /// locale or the locale specified in the Accept-Language HTTP header. #[serde(rename="formattedType")] pub formatted_type: Option, + /// Metadata about the relation. + pub metadata: Option, /// The person's relation to the other person. The type can be custom or one of /// these predefined values: /// @@ -1696,8 +1698,8 @@ pub struct Relation { /// * `partner` #[serde(rename="type")] pub type_: Option, - /// Metadata about the relation. - pub metadata: Option, + /// The name of the other person this relation refers to. + pub person: Option, } impl Part for Relation {} @@ -1943,6 +1945,10 @@ impl<'a, C, A> ContactGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Modify the members of a contact group owned by the authenticated user. + ///
+ /// The only system contact groups that can have members added are + /// `contactGroups/myContacts` and `contactGroups/starred`. Other system + /// contact groups are deprecated and can only have contacts removed. /// /// # Arguments /// @@ -2259,10 +2265,7 @@ impl<'a, C, A> ContactGroupBatchGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2282,7 +2285,7 @@ impl<'a, C, A> ContactGroupBatchGetCall<'a, C, A> where C: BorrowMut ContactGroupBatchGetCall<'a, C, A> where C: BorrowMut ContactGroupListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2527,7 +2527,7 @@ impl<'a, C, A> ContactGroupListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2619,7 +2619,7 @@ impl<'a, C, A> ContactGroupListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2749,10 +2749,7 @@ impl<'a, C, A> ContactGroupCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2784,7 +2781,7 @@ impl<'a, C, A> ContactGroupCreateCall<'a, C, A> where C: BorrowMut ContactGroupCreateCall<'a, C, A> where C: BorrowMut ContactGroupUpdateCall<'a, C, A> where C: BorrowMut ContactGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3057,7 +3051,7 @@ impl<'a, C, A> ContactGroupUpdateCall<'a, C, A> where C: BorrowMut ContactGroupUpdateCall<'a, C, A> where C: BorrowMut ContactGroupDeleteCall<'a, C, A> where C: BorrowMut ContactGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3327,7 +3318,7 @@ impl<'a, C, A> ContactGroupDeleteCall<'a, C, A> where C: BorrowMut ContactGroupDeleteCall<'a, C, A> where C: BorrowMut ContactGroupDeleteCall<'a, C, A> where C: BorrowMut +/// The only system contact groups that can have members added are +/// `contactGroups/myContacts` and `contactGroups/starred`. Other system +/// contact groups are deprecated and can only have contacts removed. /// /// A builder for the *members.modify* method supported by a *contactGroup* resource. /// It is not used directly, but through a `ContactGroupMethods` instance. @@ -3553,7 +3548,7 @@ impl<'a, C, A> ContactGroupMemberModifyCall<'a, C, A> where C: BorrowMut ContactGroupMemberModifyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3604,7 +3596,7 @@ impl<'a, C, A> ContactGroupMemberModifyCall<'a, C, A> where C: BorrowMut ContactGroupMemberModifyCall<'a, C, A> where C: BorrowMut ContactGroupGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3850,10 +3842,7 @@ impl<'a, C, A> ContactGroupGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3873,7 +3862,7 @@ impl<'a, C, A> ContactGroupGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3958,7 +3947,7 @@ impl<'a, C, A> ContactGroupGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4130,7 +4119,7 @@ impl<'a, C, A> PeopleConnectionListCall<'a, C, A> where C: BorrowMut PeopleConnectionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4169,7 +4155,7 @@ impl<'a, C, A> PeopleConnectionListCall<'a, C, A> where C: BorrowMut PeopleConnectionListCall<'a, C, A> where C: BorrowMut PeopleCreateContactCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4507,7 +4490,7 @@ impl<'a, C, A> PeopleCreateContactCall<'a, C, A> where C: BorrowMut PeopleCreateContactCall<'a, C, A> where C: BorrowMut PeopleDeleteContactCall<'a, C, A> where C: BorrowMut PeopleDeleteContactCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4767,7 +4747,7 @@ impl<'a, C, A> PeopleDeleteContactCall<'a, C, A> where C: BorrowMut PeopleDeleteContactCall<'a, C, A> where C: BorrowMut PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5008,10 +4988,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5031,7 +5008,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5164,7 +5141,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5321,7 +5298,7 @@ impl<'a, C, A> PeopleUpdateContactCall<'a, C, A> where C: BorrowMut PeopleUpdateContactCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5372,7 +5346,7 @@ impl<'a, C, A> PeopleUpdateContactCall<'a, C, A> where C: BorrowMut PeopleUpdateContactCall<'a, C, A> where C: BorrowMut PeopleGetBatchGetCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5660,7 +5631,7 @@ impl<'a, C, A> PeopleGetBatchGetCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5793,7 +5764,7 @@ impl<'a, C, A> PeopleGetBatchGetCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/photoslibrary1-cli/Cargo.toml b/gen/photoslibrary1-cli/Cargo.toml index ab55c36930..8bef3b4db3 100644 --- a/gen/photoslibrary1-cli/Cargo.toml +++ b/gen/photoslibrary1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-photoslibrary1-cli" -version = "1.0.8+20181004" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with Photos Library (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/photoslibrary1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-photoslibrary1] path = "../photoslibrary1" -version = "1.0.8+20181004" +version = "1.0.8+20190402" diff --git a/gen/photoslibrary1-cli/README.md b/gen/photoslibrary1-cli/README.md index 72e27727ca..e48668c12f 100644 --- a/gen/photoslibrary1-cli/README.md +++ b/gen/photoslibrary1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Photos Library* API at revision *20181004*. The CLI is at version *1.0.8*. +This documentation was generated from the *Photos Library* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash photoslibrary1 [options] @@ -35,14 +35,17 @@ photoslibrary1 [options] get [-p ]... [-o ] list [-p ]... [-o ] share (-r )... [-p ]... [-o ] + unshare (-r )... [-p ]... [-o ] media-items batch-create (-r )... [-p ]... [-o ] + batch-get [-p ]... [-o ] get [-p ]... [-o ] list [-p ]... [-o ] search (-r )... [-p ]... [-o ] shared-albums get [-p ]... [-o ] join (-r )... [-p ]... [-o ] + leave (-r )... [-p ]... [-o ] list [-p ]... [-o ] photoslibrary1 --help diff --git a/gen/photoslibrary1-cli/mkdocs.yml b/gen/photoslibrary1-cli/mkdocs.yml index 108e288ed3..74447d6242 100644 --- a/gen/photoslibrary1-cli/mkdocs.yml +++ b/gen/photoslibrary1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Photos Library v1.0.8+20181004 +site_name: Photos Library v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-photoslibrary1-cli site_description: A complete library to interact with Photos Library (protocol v1) @@ -14,12 +14,15 @@ pages: - ['albums_get.md', 'Albums', 'Get'] - ['albums_list.md', 'Albums', 'List'] - ['albums_share.md', 'Albums', 'Share'] +- ['albums_unshare.md', 'Albums', 'Unshare'] - ['media-items_batch-create.md', 'Media Items', 'Batch Create'] +- ['media-items_batch-get.md', 'Media Items', 'Batch Get'] - ['media-items_get.md', 'Media Items', 'Get'] - ['media-items_list.md', 'Media Items', 'List'] - ['media-items_search.md', 'Media Items', 'Search'] - ['shared-albums_get.md', 'Shared Albums', 'Get'] - ['shared-albums_join.md', 'Shared Albums', 'Join'] +- ['shared-albums_leave.md', 'Shared Albums', 'Leave'] - ['shared-albums_list.md', 'Shared Albums', 'List'] theme: readthedocs diff --git a/gen/photoslibrary1-cli/src/main.rs b/gen/photoslibrary1-cli/src/main.rs index cf3f636131..0e38a24b90 100644 --- a/gen/photoslibrary1-cli/src/main.rs +++ b/gen/photoslibrary1-cli/src/main.rs @@ -70,8 +70,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "album-position.relative-media-item-id" => Some(("albumPosition.relativeMediaItemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "album-position.relative-enrichment-item-id" => Some(("albumPosition.relativeEnrichmentItemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "album-position.position" => Some(("albumPosition.position", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "album-position.relative-enrichment-item-id" => Some(("albumPosition.relativeEnrichmentItemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "new-enrichment-item.location-enrichment.location.location-name" => Some(("newEnrichmentItem.locationEnrichment.location.locationName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "new-enrichment-item.location-enrichment.location.latlng.latitude" => Some(("newEnrichmentItem.locationEnrichment.location.latlng.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "new-enrichment-item.location-enrichment.location.latlng.longitude" => Some(("newEnrichmentItem.locationEnrichment.location.latlng.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -169,11 +169,11 @@ impl<'n> Engine<'n> { "album.media-items-count" => Some(("album.mediaItemsCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "album.title" => Some(("album.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "album.is-writeable" => Some(("album.isWriteable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "album.share-info.shareable-url" => Some(("album.shareInfo.shareableUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "album.share-info.share-token" => Some(("album.shareInfo.shareToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "album.share-info.is-joined" => Some(("album.shareInfo.isJoined", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "album.share-info.shared-album-options.is-commentable" => Some(("album.shareInfo.sharedAlbumOptions.isCommentable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "album.share-info.shared-album-options.is-collaborative" => Some(("album.shareInfo.sharedAlbumOptions.isCollaborative", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "album.share-info.share-token" => Some(("album.shareInfo.shareToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "album.share-info.is-joined" => Some(("album.shareInfo.isJoined", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "album.share-info.shareable-url" => Some(("album.shareInfo.shareableUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "album.cover-photo-base-url" => Some(("album.coverPhotoBaseUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "album.product-url" => Some(("album.productUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "album.cover-photo-media-item-id" => Some(("album.coverPhotoMediaItemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -245,9 +245,6 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { - "share-token" => { - call = call.share_token(value.unwrap_or("")); - }, _ => { let mut found = false; for param in &self.gp { @@ -261,7 +258,6 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["share-token"].iter().map(|v|*v)); v } )); } } @@ -443,6 +439,90 @@ impl<'n> Engine<'n> { } } + fn _albums_unshare(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UnshareAlbumRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.albums().unshare(request, opt.value_of("album-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _media_items_batch_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -468,8 +548,8 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "album-id" => Some(("albumId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "album-position.relative-media-item-id" => Some(("albumPosition.relativeMediaItemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "album-position.relative-enrichment-item-id" => Some(("albumPosition.relativeEnrichmentItemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "album-position.position" => Some(("albumPosition.position", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "album-position.relative-enrichment-item-id" => Some(("albumPosition.relativeEnrichmentItemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["album-id", "album-position", "position", "relative-enrichment-item-id", "relative-media-item-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -531,6 +611,62 @@ impl<'n> Engine<'n> { } } + fn _media_items_batch_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.media_items().batch_get(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "media-item-ids" => { + call = call.add_media_item_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["media-item-ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _media_items_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.media_items().get(opt.value_of("media-item-id").unwrap_or("")); @@ -666,12 +802,12 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "album-id" => Some(("albumId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "filters.content-filter.excluded-content-categories" => Some(("filters.contentFilter.excludedContentCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "filters.content-filter.included-content-categories" => Some(("filters.contentFilter.includedContentCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "filters.include-archived-media" => Some(("filters.includeArchivedMedia", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "filters.exclude-non-app-created-data" => Some(("filters.excludeNonAppCreatedData", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "filters.media-type-filter.media-types" => Some(("filters.mediaTypeFilter.mediaTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["album-id", "content-filter", "exclude-non-app-created-data", "excluded-content-categories", "filters", "include-archived-media", "included-content-categories", "media-type-filter", "media-types", "page-size", "page-token"]); @@ -740,9 +876,6 @@ impl<'n> Engine<'n> { for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { - "album-id" => { - call = call.album_id(value.unwrap_or("")); - }, _ => { let mut found = false; for param in &self.gp { @@ -756,7 +889,6 @@ impl<'n> Engine<'n> { err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["album-id"].iter().map(|v|*v)); v } )); } } @@ -875,6 +1007,91 @@ impl<'n> Engine<'n> { } } + fn _shared_albums_leave(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "share-token" => Some(("shareToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["share-token"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LeaveSharedAlbumRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.shared_albums().leave(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _shared_albums_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.shared_albums().list(); @@ -959,6 +1176,9 @@ impl<'n> Engine<'n> { ("share", Some(opt)) => { call_result = self._albums_share(opt, dry_run, &mut err); }, + ("unshare", Some(opt)) => { + call_result = self._albums_unshare(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("albums".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -970,6 +1190,9 @@ impl<'n> Engine<'n> { ("batch-create", Some(opt)) => { call_result = self._media_items_batch_create(opt, dry_run, &mut err); }, + ("batch-get", Some(opt)) => { + call_result = self._media_items_batch_get(opt, dry_run, &mut err); + }, ("get", Some(opt)) => { call_result = self._media_items_get(opt, dry_run, &mut err); }, @@ -993,6 +1216,9 @@ impl<'n> Engine<'n> { ("join", Some(opt)) => { call_result = self._shared_albums_join(opt, dry_run, &mut err); }, + ("leave", Some(opt)) => { + call_result = self._shared_albums_leave(opt, dry_run, &mut err); + }, ("list", Some(opt)) => { call_result = self._shared_albums_list(opt, dry_run, &mut err); }, @@ -1087,7 +1313,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("albums", "methods: 'add-enrichment', 'create', 'get', 'list' and 'share'", vec![ + ("albums", "methods: 'add-enrichment', 'create', 'get', 'list', 'share' and 'unshare'", vec![ ("add-enrichment", Some(r##"Adds an enrichment at a specified position in a defined album."##), "Details at http://byron.github.io/google-apis-rs/google_photoslibrary1_cli/albums_add-enrichment", @@ -1139,16 +1365,14 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Returns the album based on the specified `albumId` or `shareToken`. - Exactly one of `albumId` and `shareToken` must be set. - The `albumId` should be the ID of an album owned by the user or a shared + Some(r##"Returns the album based on the specified `albumId`. + The `albumId` must be the ID of an album owned by the user or a shared album that the user has joined."##), "Details at http://byron.github.io/google-apis-rs/google_photoslibrary1_cli/albums_get", vec![ (Some(r##"album-id"##), None, - Some(r##"Identifier of the album to be requested. Must not be set if `shareToken` is - set."##), + Some(r##"Identifier of the album to be requested."##), Some(true), Some(false)), @@ -1206,6 +1430,40 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("unshare", + Some(r##"Marks a previously shared album as private. This means that the album is + no longer shared and all the non-owners will lose access to the album. All + non-owner content will be removed from the album. If a non-owner has + previously added the album to their library, they will retain all photos in + their library. This action can only be performed on albums which were + created by the developer via the API."##), + "Details at http://byron.github.io/google-apis-rs/google_photoslibrary1_cli/albums_unshare", + vec![ + (Some(r##"album-id"##), + None, + Some(r##"Identifier of the album to be unshared. This album id must belong to an + album created by the developer."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1214,7 +1472,7 @@ fn main() { ]), ]), - ("media-items", "methods: 'batch-create', 'get', 'list' and 'search'", vec![ + ("media-items", "methods: 'batch-create', 'batch-get', 'get', 'list' and 'search'", vec![ ("batch-create", Some(r##"Creates one or more media items in a user's Google Photos library. @@ -1248,6 +1506,23 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("batch-get", + Some(r##"Returns the list of media items for the specified media item identifiers. + Items are returned in the same order as the supplied identifiers."##), + "Details at http://byron.github.io/google-apis-rs/google_photoslibrary1_cli/media-items_batch-get", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1255,12 +1530,12 @@ fn main() { Some(false)), ]), ("get", - Some(r##"Returns the media item for the specified media item `id`."##), + Some(r##"Returns the media item for the specified media item identifier."##), "Details at http://byron.github.io/google-apis-rs/google_photoslibrary1_cli/media-items_get", vec![ (Some(r##"media-item-id"##), None, - Some(r##"Identifier of media item to be requested."##), + Some(r##"Identifier of the media item to be requested."##), Some(true), Some(false)), @@ -1297,9 +1572,9 @@ fn main() { If no filters are set, then all media items in the user's library are returned. If an album is set, all media items in the specified album are returned. - If filters are specified, media items that match the filters from the user's - library are listed. - If you set both the album and the filters, the request results in an error."##), + If filters are specified, media items that match the filters from the + user's library are listed. If you set both the album and the filters, the + request results in an error."##), "Details at http://byron.github.io/google-apis-rs/google_photoslibrary1_cli/media-items_search", vec![ (Some(r##"kv"##), @@ -1322,18 +1597,14 @@ fn main() { ]), ]), - ("shared-albums", "methods: 'get', 'join' and 'list'", vec![ + ("shared-albums", "methods: 'get', 'join', 'leave' and 'list'", vec![ ("get", - Some(r##"Returns the album based on the specified `albumId` or `shareToken`. - Exactly one of `albumId` and `shareToken` must be set. - The `albumId` should be the ID of an album owned by the user or a shared - album that the user has joined."##), + Some(r##"Returns the album based on the specified `shareToken`."##), "Details at http://byron.github.io/google-apis-rs/google_photoslibrary1_cli/shared-albums_get", vec![ (Some(r##"share-token"##), None, - Some(r##"Share token of the album to be request. Must not be set if `albumId` is - set."##), + Some(r##"Share token of the album to be requested."##), Some(true), Some(false)), @@ -1365,6 +1636,29 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("leave", + Some(r##"Leaves a previously-joined shared album on behalf of the Google Photos + user. The user must not own this album."##), + "Details at http://byron.github.io/google-apis-rs/google_photoslibrary1_cli/shared-albums_leave", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1394,7 +1688,7 @@ fn main() { let mut app = App::new("photoslibrary1") .author("Sebastian Thiel ") - .version("1.0.8+20181004") + .version("1.0.8+20190402") .about("Manage photos, videos, and albums in Google Photos ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_photoslibrary1_cli") diff --git a/gen/photoslibrary1/Cargo.toml b/gen/photoslibrary1/Cargo.toml index 8e1d7c2f6c..19665a7df1 100644 --- a/gen/photoslibrary1/Cargo.toml +++ b/gen/photoslibrary1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-photoslibrary1" -version = "1.0.8+20181004" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with Photos Library (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/photoslibrary1" homepage = "https://developers.google.com/photos/" -documentation = "https://docs.rs/google-photoslibrary1/1.0.8+20181004" +documentation = "https://docs.rs/google-photoslibrary1/1.0.8+20190402" license = "MIT" keywords = ["photoslibrary", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/photoslibrary1/README.md b/gen/photoslibrary1/README.md index 14bd009b97..c0066ae8ce 100644 --- a/gen/photoslibrary1/README.md +++ b/gen/photoslibrary1/README.md @@ -5,20 +5,20 @@ DO NOT EDIT ! --> The `google-photoslibrary1` library allows access to all features of the *Google Photos Library* service. -This documentation was generated from *Photos Library* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *photoslibrary:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Photos Library* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *photoslibrary:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Photos Library* *v1* API can be found at the [official documentation site](https://developers.google.com/photos/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.PhotosLibrary.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.PhotosLibrary.html) ... -* [albums](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.Album.html) - * [*add enrichment*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.AlbumAddEnrichmentCall.html), [*create*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.AlbumCreateCall.html), [*get*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.AlbumGetCall.html), [*list*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.AlbumListCall.html) and [*share*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.AlbumShareCall.html) -* [media items](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.MediaItem.html) - * [*batch create*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.MediaItemBatchCreateCall.html), [*get*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.MediaItemGetCall.html), [*list*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.MediaItemListCall.html) and [*search*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.MediaItemSearchCall.html) +* [albums](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.Album.html) + * [*add enrichment*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.AlbumAddEnrichmentCall.html), [*create*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.AlbumCreateCall.html), [*get*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.AlbumGetCall.html), [*list*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.AlbumListCall.html), [*share*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.AlbumShareCall.html) and [*unshare*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.AlbumUnshareCall.html) +* [media items](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.MediaItem.html) + * [*batch create*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.MediaItemBatchCreateCall.html), [*batch get*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.MediaItemBatchGetCall.html), [*get*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.MediaItemGetCall.html), [*list*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.MediaItemListCall.html) and [*search*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.MediaItemSearchCall.html) * shared albums - * [*get*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.SharedAlbumGetCall.html), [*join*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.SharedAlbumJoinCall.html) and [*list*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.SharedAlbumListCall.html) + * [*get*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.SharedAlbumGetCall.html), [*join*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.SharedAlbumJoinCall.html), [*leave*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.SharedAlbumLeaveCall.html) and [*list*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.SharedAlbumListCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/struct.PhotosLibrary.html)** +* **[Hub](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/struct.PhotosLibrary.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.Part.html)** + * **[Parts](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -51,9 +51,10 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.albums().list(...).doit() -let r = hub.albums().add_enrichment(...).doit() let r = hub.shared_albums().get(...).doit() +let r = hub.albums().add_enrichment(...).doit() +let r = hub.albums().list(...).doit() +let r = hub.albums().unshare(...).doit() let r = hub.albums().share(...).doit() let r = hub.albums().create(...).doit() let r = hub.albums().get(...).doit() @@ -136,17 +137,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -156,29 +157,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-photoslibrary1/1.0.8+20181004/google_photoslibrary1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-photoslibrary1/1.0.8+20190402/google_photoslibrary1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/photoslibrary1/src/lib.rs b/gen/photoslibrary1/src/lib.rs index f49a165a55..b2a756786f 100644 --- a/gen/photoslibrary1/src/lib.rs +++ b/gen/photoslibrary1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Photos Library* crate version *1.0.8+20181004*, where *20181004* is the exact revision of the *photoslibrary:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Photos Library* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *photoslibrary:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Photos Library* *v1* API can be found at the //! [official documentation site](https://developers.google.com/photos/). @@ -12,11 +12,11 @@ //! Handle the following *Resources* with ease from the central [hub](struct.PhotosLibrary.html) ... //! //! * [albums](struct.Album.html) -//! * [*add enrichment*](struct.AlbumAddEnrichmentCall.html), [*create*](struct.AlbumCreateCall.html), [*get*](struct.AlbumGetCall.html), [*list*](struct.AlbumListCall.html) and [*share*](struct.AlbumShareCall.html) +//! * [*add enrichment*](struct.AlbumAddEnrichmentCall.html), [*create*](struct.AlbumCreateCall.html), [*get*](struct.AlbumGetCall.html), [*list*](struct.AlbumListCall.html), [*share*](struct.AlbumShareCall.html) and [*unshare*](struct.AlbumUnshareCall.html) //! * [media items](struct.MediaItem.html) -//! * [*batch create*](struct.MediaItemBatchCreateCall.html), [*get*](struct.MediaItemGetCall.html), [*list*](struct.MediaItemListCall.html) and [*search*](struct.MediaItemSearchCall.html) +//! * [*batch create*](struct.MediaItemBatchCreateCall.html), [*batch get*](struct.MediaItemBatchGetCall.html), [*get*](struct.MediaItemGetCall.html), [*list*](struct.MediaItemListCall.html) and [*search*](struct.MediaItemSearchCall.html) //! * shared albums -//! * [*get*](struct.SharedAlbumGetCall.html), [*join*](struct.SharedAlbumJoinCall.html) and [*list*](struct.SharedAlbumListCall.html) +//! * [*get*](struct.SharedAlbumGetCall.html), [*join*](struct.SharedAlbumJoinCall.html), [*leave*](struct.SharedAlbumLeaveCall.html) and [*list*](struct.SharedAlbumListCall.html) //! //! //! @@ -51,9 +51,10 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.albums().list(...).doit() -//! let r = hub.albums().add_enrichment(...).doit() //! let r = hub.shared_albums().get(...).doit() +//! let r = hub.albums().add_enrichment(...).doit() +//! let r = hub.albums().list(...).doit() +//! let r = hub.albums().unshare(...).doit() //! let r = hub.albums().share(...).doit() //! let r = hub.albums().create(...).doit() //! let r = hub.albums().get(...).doit() @@ -404,9 +405,10 @@ impl<'a, C, A> PhotosLibrary /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list albums](struct.AlbumListCall.html) (none) -/// * [add enrichment albums](struct.AlbumAddEnrichmentCall.html) (none) /// * [get shared albums](struct.SharedAlbumGetCall.html) (response) +/// * [add enrichment albums](struct.AlbumAddEnrichmentCall.html) (none) +/// * [list albums](struct.AlbumListCall.html) (none) +/// * [unshare albums](struct.AlbumUnshareCall.html) (none) /// * [share albums](struct.AlbumShareCall.html) (none) /// * [create albums](struct.AlbumCreateCall.html) (response) /// * [get albums](struct.AlbumGetCall.html) (response) @@ -454,28 +456,27 @@ impl Resource for Album {} impl ResponseResult for Album {} -/// List of all media items from the user's Google Photos library. +/// Response to retrieve a list of media items. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list media items](struct.MediaItemListCall.html) (response) +/// * [batch get media items](struct.MediaItemBatchGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListMediaItemsResponse { - /// [Output only] Token to use to get the next set of media items. Its presence - /// is the only reliable indicator of more media items being available in the - /// next request. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// [Output only] List of media items in the user's library. - #[serde(rename="mediaItems")] - pub media_items: Option>, +pub struct BatchGetMediaItemsResponse { + /// [Output only] List of media items retrieved. + /// Note that even if the call to BatchGetMediaItems succeeds, there may have + /// been failures for some media items in the batch. These failures are + /// indicated in each + /// MediaItemResult.status. + #[serde(rename="mediaItemResults")] + pub media_item_results: Option>, } -impl ResponseResult for ListMediaItemsResponse {} +impl ResponseResult for BatchGetMediaItemsResponse {} /// An enrichment containing text. @@ -563,6 +564,7 @@ impl ResponseResult for ListAlbumsResponse {} /// * [batch create media items](struct.MediaItemBatchCreateCall.html) (none) /// * [get media items](struct.MediaItemGetCall.html) (response) /// * [search media items](struct.MediaItemSearchCall.html) (none) +/// * [batch get media items](struct.MediaItemBatchGetCall.html) (none) /// * [list media items](struct.MediaItemListCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -601,58 +603,43 @@ impl Resource for MediaItem {} impl ResponseResult for MediaItem {} -/// Request to add an enrichment to a specific album at a specific position. +/// Response to successfully leaving the shared album on behalf of the user. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [add enrichment albums](struct.AlbumAddEnrichmentCall.html) (request) +/// * [leave shared albums](struct.SharedAlbumLeaveCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddEnrichmentToAlbumRequest { - /// The position in the album where the enrichment is to be inserted. - #[serde(rename="albumPosition")] - pub album_position: Option, - /// The enrichment to be added. - #[serde(rename="newEnrichmentItem")] - pub new_enrichment_item: Option, -} +pub struct LeaveSharedAlbumResponse { _never_set: Option } -impl RequestValue for AddEnrichmentToAlbumRequest {} +impl ResponseResult for LeaveSharedAlbumResponse {} -/// Request to create one or more media items in a user's Google Photos library. -/// If an `albumid` is specified, the media items are also added to that album. -/// `albumPosition` is optional and can only be specified if an `albumId` is set. +/// List of all media items from the user's Google Photos library. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [batch create media items](struct.MediaItemBatchCreateCall.html) (request) +/// * [list media items](struct.MediaItemListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchCreateMediaItemsRequest { - /// Identifier of the album where the media items are added. The media items - /// are also added to the user's library. This is an optional field. - #[serde(rename="albumId")] - pub album_id: Option, - /// List of media items to be created. - #[serde(rename="newMediaItems")] - pub new_media_items: Option>, - /// Position in the album where the media items are added. If not - /// specified, the media items are added to the end of the album (as per - /// the default value, that is, `LAST_IN_ALBUM`). The request fails if this - /// field is set and the `albumId` is not specified. The request will also fail - /// if you set the field and are not the owner of the shared album. - #[serde(rename="albumPosition")] - pub album_position: Option, +pub struct ListMediaItemsResponse { + /// [Output only] Token to use to get the next set of media items. Its presence + /// is the only reliable indicator of more media items being available in the + /// next request. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output only] List of media items in the user's library. + #[serde(rename="mediaItems")] + pub media_items: Option>, } -impl RequestValue for BatchCreateMediaItemsRequest {} +impl ResponseResult for ListMediaItemsResponse {} /// Represents a physical location. @@ -671,6 +658,25 @@ pub struct Location { impl Part for Location {} +/// Result of retrieving a media item. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MediaItemResult { + /// Media item retrieved from the user's library. It's populated if no errors + /// occurred and the media item was fetched successfully. + #[serde(rename="mediaItem")] + pub media_item: Option, + /// If an error occurred while accessing this media item, this field + /// is populated with information related to the error. For details regarding + /// this field, see Status. + pub status: Option, +} + +impl Part for MediaItemResult {} + + /// Specifies a position in an album. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -681,12 +687,12 @@ pub struct AlbumPosition { /// Only used when position type is AFTER_MEDIA_ITEM. #[serde(rename="relativeMediaItemId")] pub relative_media_item_id: Option, - /// Type of position, for a media or enrichment item. - pub position: Option, /// The enrichment item to which the position is relative to. /// Only used when position type is AFTER_ENRICHMENT_ITEM. #[serde(rename="relativeEnrichmentItemId")] pub relative_enrichment_item_id: Option, + /// Type of position, for a media or enrichment item. + pub position: Option, } impl Part for AlbumPosition {} @@ -715,30 +721,36 @@ pub struct ListSharedAlbumsResponse { impl ResponseResult for ListSharedAlbumsResponse {} -/// An enrichment item. +/// Options that control the sharing of an album. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EnrichmentItem { - /// Identifier of the enrichment item. - pub id: Option, +pub struct SharedAlbumOptions { + /// True if the shared album allows the owner and the collaborators (users + /// who have joined the album) to add comments to the album. Defaults to false. + #[serde(rename="isCommentable")] + pub is_commentable: Option, + /// True if the shared album allows collaborators (users who have joined + /// the album) to add media items to it. Defaults to false. + #[serde(rename="isCollaborative")] + pub is_collaborative: Option, } -impl Part for EnrichmentItem {} +impl Part for SharedAlbumOptions {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -799,6 +811,26 @@ pub struct Status { impl Part for Status {} +/// Request to leave a shared album on behalf of the user. This uses a shareToken +/// which can be acquired via the or listSharedAlbums or getAlbum calls. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [leave shared albums](struct.SharedAlbumLeaveCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LeaveSharedAlbumRequest { + /// Token to leave the shared album on behalf of the user. + #[serde(rename="shareToken")] + pub share_token: Option, +} + +impl RequestValue for LeaveSharedAlbumRequest {} + + /// An enrichment containing a map, showing origin and destination locations. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -827,23 +859,17 @@ pub struct LocationEnrichment { impl Part for LocationEnrichment {} -/// Options that control the sharing of an album. +/// An enrichment item. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SharedAlbumOptions { - /// True if the shared album allows the owner and the collaborators (users - /// who have joined the album) to add comments to the album. Defaults to false. - #[serde(rename="isCommentable")] - pub is_commentable: Option, - /// True if the shared album allows collaborators (users who have joined - /// the album) to add media items to it. Defaults to false. - #[serde(rename="isCollaborative")] - pub is_collaborative: Option, +pub struct EnrichmentItem { + /// Identifier of the enrichment item. + pub id: Option, } -impl Part for SharedAlbumOptions {} +impl Part for EnrichmentItem {} /// Response to successfully joining the shared album on behalf of the user. @@ -870,14 +896,14 @@ impl ResponseResult for JoinSharedAlbumResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Date { - /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without - /// a year. - pub year: Option, - /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a year/month where the day isn't significant. - pub day: Option, /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a /// month and day. pub month: Option, + /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a year/month where the day isn't significant. + pub day: Option, + /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without + /// a year. + pub year: Option, } impl Part for Date {} @@ -915,12 +941,12 @@ impl ResponseResult for SearchMediaItemsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Filters { - /// Filters the media items based on their creation date. - #[serde(rename="dateFilter")] - pub date_filter: Option, /// Filters the media items based on their content. #[serde(rename="contentFilter")] pub content_filter: Option, + /// Filters the media items based on their creation date. + #[serde(rename="dateFilter")] + pub date_filter: Option, /// If set, the results include media items that the user has archived. /// Defaults to false (archived media items aren't included). #[serde(rename="includeArchivedMedia")] @@ -1012,9 +1038,11 @@ impl Part for MediaTypeFilter {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ShareInfo { - /// Options that control the sharing of an album. - #[serde(rename="sharedAlbumOptions")] - pub shared_album_options: Option, + /// A link to the album that's now shared on the Google Photos website and app. + /// Anyone with the link can access this shared album and see all of the items + /// present in the album. + #[serde(rename="shareableUrl")] + pub shareable_url: Option, /// A token that can be used by other users to join this shared album via the /// API. #[serde(rename="shareToken")] @@ -1023,11 +1051,9 @@ pub struct ShareInfo { /// of the shared album. #[serde(rename="isJoined")] pub is_joined: Option, - /// A link to the album that's now shared on the Google Photos website and app. - /// Anyone with the link can access this shared album and see all of the items - /// present in the album. - #[serde(rename="shareableUrl")] - pub shareable_url: Option, + /// Options that control the sharing of an album. + #[serde(rename="sharedAlbumOptions")] + pub shared_album_options: Option, } impl Part for ShareInfo {} @@ -1052,6 +1078,21 @@ pub struct AddEnrichmentToAlbumResponse { impl ResponseResult for AddEnrichmentToAlbumResponse {} +/// Response of a successful unshare of a shared album. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [unshare albums](struct.AlbumUnshareCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UnshareAlbumResponse { _never_set: Option } + +impl ResponseResult for UnshareAlbumResponse {} + + /// New media item that's created in a user's Google Photos account. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1095,18 +1136,18 @@ impl Part for ContributorInfo {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MediaMetadata { - /// Original width (in pixels) of the media item. - pub width: Option, + /// Metadata for a photo media type. + pub photo: Option, + /// Metadata for a video media type. + pub video: Option
Status. @@ -1326,10 +1425,6 @@ pub struct NewMediaItemResult { /// The upload token used to create this new media item. #[serde(rename="uploadToken")] pub upload_token: Option, - /// Media item created with the upload token. It's populated if no errors - /// occurred and the media item was created successfully. - #[serde(rename="mediaItem")] - pub media_item: Option, } impl Part for NewMediaItemResult {} @@ -1365,246 +1460,26 @@ pub struct Photo { impl Part for Photo {} +/// Request to unshare a shared album in Google Photos. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [unshare albums](struct.AlbumUnshareCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UnshareAlbumRequest { _never_set: Option } + +impl RequestValue for UnshareAlbumRequest {} + + // ################### // MethodBuilders ### // ################# -/// A builder providing access to all methods supported on *album* resources. -/// It is not used directly, but through the `PhotosLibrary` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_photoslibrary1 as photoslibrary1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use photoslibrary1::PhotosLibrary; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `add_enrichment(...)`, `create(...)`, `get(...)`, `list(...)` and `share(...)` -/// // to build up your call. -/// let rb = hub.albums(); -/// # } -/// ``` -pub struct AlbumMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PhotosLibrary, -} - -impl<'a, C, A> MethodsBuilder for AlbumMethods<'a, C, A> {} - -impl<'a, C, A> AlbumMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Marks an album as shared and accessible to other users. This action can - /// only be performed on albums which were created by the developer via the - /// API. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `albumId` - Identifier of the album to be shared. This `albumId` must belong to an - /// album created by the developer. - pub fn share(&self, request: ShareAlbumRequest, album_id: &str) -> AlbumShareCall<'a, C, A> { - AlbumShareCall { - hub: self.hub, - _request: request, - _album_id: album_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists all albums shown to a user in the Albums tab of the Google - /// Photos app. - pub fn list(&self) -> AlbumListCall<'a, C, A> { - AlbumListCall { - hub: self.hub, - _page_token: Default::default(), - _page_size: Default::default(), - _exclude_non_app_created_data: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Adds an enrichment at a specified position in a defined album. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `albumId` - Identifier of the album where the enrichment is to be added. - pub fn add_enrichment(&self, request: AddEnrichmentToAlbumRequest, album_id: &str) -> AlbumAddEnrichmentCall<'a, C, A> { - AlbumAddEnrichmentCall { - hub: self.hub, - _request: request, - _album_id: album_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates an album in a user's Google Photos library. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: CreateAlbumRequest) -> AlbumCreateCall<'a, C, A> { - AlbumCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the album based on the specified `albumId` or `shareToken`. - /// Exactly one of `albumId` and `shareToken` must be set. - /// The `albumId` should be the ID of an album owned by the user or a shared - /// album that the user has joined. - /// - /// # Arguments - /// - /// * `albumId` - Identifier of the album to be requested. Must not be set if `shareToken` is - /// set. - pub fn get(&self, album_id: &str) -> AlbumGetCall<'a, C, A> { - AlbumGetCall { - hub: self.hub, - _album_id: album_id.to_string(), - _share_token: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *sharedAlbum* resources. -/// It is not used directly, but through the `PhotosLibrary` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate hyper_rustls; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_photoslibrary1 as photoslibrary1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use photoslibrary1::PhotosLibrary; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// ::default(), None); -/// let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)`, `join(...)` and `list(...)` -/// // to build up your call. -/// let rb = hub.shared_albums(); -/// # } -/// ``` -pub struct SharedAlbumMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PhotosLibrary, -} - -impl<'a, C, A> MethodsBuilder for SharedAlbumMethods<'a, C, A> {} - -impl<'a, C, A> SharedAlbumMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Joins a shared album on behalf of the Google Photos user. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn join(&self, request: JoinSharedAlbumRequest) -> SharedAlbumJoinCall<'a, C, A> { - SharedAlbumJoinCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns the album based on the specified `albumId` or `shareToken`. - /// Exactly one of `albumId` and `shareToken` must be set. - /// The `albumId` should be the ID of an album owned by the user or a shared - /// album that the user has joined. - /// - /// # Arguments - /// - /// * `shareToken` - Share token of the album to be request. Must not be set if `albumId` is - /// set. - pub fn get(&self, share_token: &str) -> SharedAlbumGetCall<'a, C, A> { - SharedAlbumGetCall { - hub: self.hub, - _share_token: share_token.to_string(), - _album_id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists all shared albums available in the Sharing tab of the - /// user's Google Photos app. - pub fn list(&self) -> SharedAlbumListCall<'a, C, A> { - SharedAlbumListCall { - hub: self.hub, - _page_token: Default::default(), - _page_size: Default::default(), - _exclude_non_app_created_data: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - /// A builder providing access to all methods supported on *mediaItem* resources. /// It is not used directly, but through the `PhotosLibrary` hub. /// @@ -1629,7 +1504,7 @@ impl<'a, C, A> SharedAlbumMethods<'a, C, A> { /// ::default(), None); /// let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `batch_create(...)`, `get(...)`, `list(...)` and `search(...)` +/// // like `batch_create(...)`, `batch_get(...)`, `get(...)`, `list(...)` and `search(...)` /// // to build up your call. /// let rb = hub.media_items(); /// # } @@ -1644,6 +1519,43 @@ impl<'a, C, A> MethodsBuilder for MediaItemMethods<'a, C, A> {} impl<'a, C, A> MediaItemMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Searches for media items in a user's Google Photos library. + /// If no filters are set, then all media items in the user's library are + /// returned. + /// If an album is set, all media items in the specified album are returned. + /// If filters are specified, media items that match the filters from the + /// user's library are listed. If you set both the album and the filters, the + /// request results in an error. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn search(&self, request: SearchMediaItemsRequest) -> MediaItemSearchCall<'a, C, A> { + MediaItemSearchCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the list of media items for the specified media item identifiers. + /// Items are returned in the same order as the supplied identifiers. + pub fn batch_get(&self) -> MediaItemBatchGetCall<'a, C, A> { + MediaItemBatchGetCall { + hub: self.hub, + _media_item_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates one or more media items in a user's Google Photos library. @@ -1680,11 +1592,11 @@ impl<'a, C, A> MediaItemMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns the media item for the specified media item `id`. + /// Returns the media item for the specified media item identifier. /// /// # Arguments /// - /// * `mediaItemId` - Identifier of media item to be requested. + /// * `mediaItemId` - Identifier of the media item to be requested. pub fn get(&self, media_item_id: &str) -> MediaItemGetCall<'a, C, A> { MediaItemGetCall { hub: self.hub, @@ -1695,29 +1607,6 @@ impl<'a, C, A> MediaItemMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Searches for media items in a user's Google Photos library. - /// If no filters are set, then all media items in the user's library are - /// returned. - /// If an album is set, all media items in the specified album are returned. - /// If filters are specified, media items that match the filters from the user's - /// library are listed. - /// If you set both the album and the filters, the request results in an error. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchMediaItemsRequest) -> MediaItemSearchCall<'a, C, A> { - MediaItemSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// List all media items from a user's Google Photos library. @@ -1735,18 +1624,292 @@ impl<'a, C, A> MediaItemMethods<'a, C, A> { +/// A builder providing access to all methods supported on *sharedAlbum* resources. +/// It is not used directly, but through the `PhotosLibrary` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_photoslibrary1 as photoslibrary1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use photoslibrary1::PhotosLibrary; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `join(...)`, `leave(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.shared_albums(); +/// # } +/// ``` +pub struct SharedAlbumMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, +} + +impl<'a, C, A> MethodsBuilder for SharedAlbumMethods<'a, C, A> {} + +impl<'a, C, A> SharedAlbumMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Returns the album based on the specified `shareToken`. + /// + /// # Arguments + /// + /// * `shareToken` - Share token of the album to be requested. + pub fn get(&self, share_token: &str) -> SharedAlbumGetCall<'a, C, A> { + SharedAlbumGetCall { + hub: self.hub, + _share_token: share_token.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Leaves a previously-joined shared album on behalf of the Google Photos + /// user. The user must not own this album. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn leave(&self, request: LeaveSharedAlbumRequest) -> SharedAlbumLeaveCall<'a, C, A> { + SharedAlbumLeaveCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Joins a shared album on behalf of the Google Photos user. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn join(&self, request: JoinSharedAlbumRequest) -> SharedAlbumJoinCall<'a, C, A> { + SharedAlbumJoinCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all shared albums available in the Sharing tab of the + /// user's Google Photos app. + pub fn list(&self) -> SharedAlbumListCall<'a, C, A> { + SharedAlbumListCall { + hub: self.hub, + _page_token: Default::default(), + _page_size: Default::default(), + _exclude_non_app_created_data: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *album* resources. +/// It is not used directly, but through the `PhotosLibrary` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_photoslibrary1 as photoslibrary1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use photoslibrary1::PhotosLibrary; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `add_enrichment(...)`, `create(...)`, `get(...)`, `list(...)`, `share(...)` and `unshare(...)` +/// // to build up your call. +/// let rb = hub.albums(); +/// # } +/// ``` +pub struct AlbumMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, +} + +impl<'a, C, A> MethodsBuilder for AlbumMethods<'a, C, A> {} + +impl<'a, C, A> AlbumMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Adds an enrichment at a specified position in a defined album. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `albumId` - Identifier of the album where the enrichment is to be added. + pub fn add_enrichment(&self, request: AddEnrichmentToAlbumRequest, album_id: &str) -> AlbumAddEnrichmentCall<'a, C, A> { + AlbumAddEnrichmentCall { + hub: self.hub, + _request: request, + _album_id: album_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all albums shown to a user in the Albums tab of the Google + /// Photos app. + pub fn list(&self) -> AlbumListCall<'a, C, A> { + AlbumListCall { + hub: self.hub, + _page_token: Default::default(), + _page_size: Default::default(), + _exclude_non_app_created_data: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Marks a previously shared album as private. This means that the album is + /// no longer shared and all the non-owners will lose access to the album. All + /// non-owner content will be removed from the album. If a non-owner has + /// previously added the album to their library, they will retain all photos in + /// their library. This action can only be performed on albums which were + /// created by the developer via the API. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `albumId` - Identifier of the album to be unshared. This album id must belong to an + /// album created by the developer. + pub fn unshare(&self, request: UnshareAlbumRequest, album_id: &str) -> AlbumUnshareCall<'a, C, A> { + AlbumUnshareCall { + hub: self.hub, + _request: request, + _album_id: album_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Marks an album as shared and accessible to other users. This action can + /// only be performed on albums which were created by the developer via the + /// API. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `albumId` - Identifier of the album to be shared. This `albumId` must belong to an + /// album created by the developer. + pub fn share(&self, request: ShareAlbumRequest, album_id: &str) -> AlbumShareCall<'a, C, A> { + AlbumShareCall { + hub: self.hub, + _request: request, + _album_id: album_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates an album in a user's Google Photos library. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn create(&self, request: CreateAlbumRequest) -> AlbumCreateCall<'a, C, A> { + AlbumCreateCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the album based on the specified `albumId`. + /// The `albumId` must be the ID of an album owned by the user or a shared + /// album that the user has joined. + /// + /// # Arguments + /// + /// * `albumId` - Identifier of the album to be requested. + pub fn get(&self, album_id: &str) -> AlbumGetCall<'a, C, A> { + AlbumGetCall { + hub: self.hub, + _album_id: album_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + // ################### // CallBuilders ### // ################# -/// Marks an album as shared and accessible to other users. This action can -/// only be performed on albums which were created by the developer via the -/// API. +/// Searches for media items in a user's Google Photos library. +/// If no filters are set, then all media items in the user's library are +/// returned. +/// If an album is set, all media items in the specified album are returned. +/// If filters are specified, media items that match the filters from the +/// user's library are listed. If you set both the album and the filters, the +/// request results in an error. /// -/// A builder for the *share* method supported by a *album* resource. -/// It is not used directly, but through a `AlbumMethods` instance. +/// A builder for the *search* method supported by a *mediaItem* resource. +/// It is not used directly, but through a `MediaItemMethods` instance. /// /// # Example /// @@ -1757,7 +1920,7 @@ impl<'a, C, A> MediaItemMethods<'a, C, A> { /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_photoslibrary1 as photoslibrary1; -/// use photoslibrary1::ShareAlbumRequest; +/// use photoslibrary1::SearchMediaItemsRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -1771,34 +1934,32 @@ impl<'a, C, A> MediaItemMethods<'a, C, A> { /// // As the method needs a request, you would usually fill it with the desired information /// // into the respective structure. Some of the parts shown here might not be applicable ! /// // Values shown here are possibly random and not representative ! -/// let mut req = ShareAlbumRequest::default(); +/// let mut req = SearchMediaItemsRequest::default(); /// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.albums().share(req, "albumId") +/// let result = hub.media_items().search(req) /// .doit(); /// # } /// ``` -pub struct AlbumShareCall<'a, C, A> +pub struct MediaItemSearchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a PhotosLibrary, - _request: ShareAlbumRequest, - _album_id: String, + _request: SearchMediaItemsRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AlbumShareCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for MediaItemSearchCall<'a, C, A> {} -impl<'a, C, A> AlbumShareCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> MediaItemSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ShareAlbumResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + pub fn doit(mut self) -> Result<(hyper::client::Response, SearchMediaItemsResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -1806,11 +1967,10 @@ impl<'a, C, A> AlbumShareCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "photoslibrary.albums.share", + dlg.begin(MethodInfo { id: "photoslibrary.mediaItems.search", http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("albumId", self._album_id.to_string())); - for &field in ["alt", "albumId"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1822,580 +1982,13 @@ impl<'a, C, A> AlbumShareCall<'a, C, A> where C: BorrowMut, A: oa params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/albums/{+albumId}:share"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Sharing.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+albumId}", "albumId")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["albumId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ShareAlbumRequest) -> AlbumShareCall<'a, C, A> { - self._request = new_value; - self - } - /// Identifier of the album to be shared. This `albumId` must belong to an - /// album created by the developer. - /// - /// Sets the *album id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn album_id(mut self, new_value: &str) -> AlbumShareCall<'a, C, A> { - self._album_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumShareCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AlbumShareCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Sharing`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AlbumShareCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists all albums shown to a user in the Albums tab of the Google -/// Photos app. -/// -/// A builder for the *list* method supported by a *album* resource. -/// It is not used directly, but through a `AlbumMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_photoslibrary1 as photoslibrary1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use photoslibrary1::PhotosLibrary; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.albums().list() -/// .page_token("amet.") -/// .page_size(-81) -/// .exclude_non_app_created_data(true) -/// .doit(); -/// # } -/// ``` -pub struct AlbumListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PhotosLibrary, - _page_token: Option, - _page_size: Option, - _exclude_non_app_created_data: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AlbumListCall<'a, C, A> {} - -impl<'a, C, A> AlbumListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListAlbumsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "photoslibrary.albums.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if let Some(value) = self._exclude_non_app_created_data { - params.push(("excludeNonAppCreatedData", value.to_string())); - } - for &field in ["alt", "pageToken", "pageSize", "excludeNonAppCreatedData"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/albums"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// A continuation token to get the next page of the results. Adding this to - /// the request returns the rows after the `pageToken`. The `pageToken` should - /// be the value returned in the `nextPageToken` parameter in the response to - /// the `listAlbums` request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> AlbumListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Maximum number of albums to return in the response. The default number of - /// albums to return at a time is 20. The maximum `pageSize` is 50. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> AlbumListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// If set, the results exclude media items that were not created by this app. - /// Defaults to false (all albums are returned). This field is ignored if the - /// photoslibrary.readonly.appcreateddata scope is used. - /// - /// Sets the *exclude non app created data* query property to the given value. - pub fn exclude_non_app_created_data(mut self, new_value: bool) -> AlbumListCall<'a, C, A> { - self._exclude_non_app_created_data = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AlbumListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AlbumListCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Adds an enrichment at a specified position in a defined album. -/// -/// A builder for the *addEnrichment* method supported by a *album* resource. -/// It is not used directly, but through a `AlbumMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_photoslibrary1 as photoslibrary1; -/// use photoslibrary1::AddEnrichmentToAlbumRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use photoslibrary1::PhotosLibrary; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = AddEnrichmentToAlbumRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.albums().add_enrichment(req, "albumId") -/// .doit(); -/// # } -/// ``` -pub struct AlbumAddEnrichmentCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PhotosLibrary, - _request: AddEnrichmentToAlbumRequest, - _album_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AlbumAddEnrichmentCall<'a, C, A> {} - -impl<'a, C, A> AlbumAddEnrichmentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AddEnrichmentToAlbumResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "photoslibrary.albums.addEnrichment", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("albumId", self._album_id.to_string())); - for &field in ["alt", "albumId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/albums/{+albumId}:addEnrichment"; + let mut url = self.hub._base_url.clone() + "v1/mediaItems:search"; if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+albumId}", "albumId")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["albumId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2427,7 +2020,7 @@ impl<'a, C, A> AlbumAddEnrichmentCall<'a, C, A> where C: BorrowMut AlbumAddEnrichmentCall<'a, C, A> where C: BorrowMut AlbumAddEnrichmentCall<'a, C, A> { + pub fn request(mut self, new_value: SearchMediaItemsRequest) -> MediaItemSearchCall<'a, C, A> { self._request = new_value; self } - /// Identifier of the album where the enrichment is to be added. - /// - /// Sets the *album id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn album_id(mut self, new_value: &str) -> AlbumAddEnrichmentCall<'a, C, A> { - self._album_id = new_value.to_string(); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumAddEnrichmentCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MediaItemSearchCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -2517,7 +2100,7 @@ impl<'a, C, A> AlbumAddEnrichmentCall<'a, C, A> where C: BorrowMut AlbumAddEnrichmentCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AlbumAddEnrichmentCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> MediaItemSearchCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -2553,7 +2136,7 @@ impl<'a, C, A> AlbumAddEnrichmentCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AlbumAddEnrichmentCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MediaItemSearchCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -2565,10 +2148,11 @@ impl<'a, C, A> AlbumAddEnrichmentCall<'a, C, A> where C: BorrowMut AlbumAddEnrichmentCall<'a, C, A> where C: BorrowMut AlbumAddEnrichmentCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = CreateAlbumRequest::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.albums().create(req) +/// let result = hub.media_items().batch_get() +/// .add_media_item_ids("justo") /// .doit(); /// # } /// ``` -pub struct AlbumCreateCall<'a, C, A> +pub struct MediaItemBatchGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a PhotosLibrary, - _request: CreateAlbumRequest, + _media_item_ids: Vec, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AlbumCreateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for MediaItemBatchGetCall<'a, C, A> {} -impl<'a, C, A> AlbumCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> MediaItemBatchGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Album)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, BatchGetMediaItemsResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -2626,10 +2205,15 @@ impl<'a, C, A> AlbumCreateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "photoslibrary.albums.create", - http_method: hyper::method::Method::Post }); + dlg.begin(MethodInfo { id: "photoslibrary.mediaItems.batchGet", + http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { + if self._media_item_ids.len() > 0 { + for f in self._media_item_ids.iter() { + params.push(("mediaItemIds", f.to_string())); + } + } + for &field in ["alt", "mediaItemIds"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2641,289 +2225,13 @@ impl<'a, C, A> AlbumCreateCall<'a, C, A> where C: BorrowMut, A: o params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/albums"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: CreateAlbumRequest) -> AlbumCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AlbumCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AlbumCreateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the album based on the specified `albumId` or `shareToken`. -/// Exactly one of `albumId` and `shareToken` must be set. -/// The `albumId` should be the ID of an album owned by the user or a shared -/// album that the user has joined. -/// -/// A builder for the *get* method supported by a *album* resource. -/// It is not used directly, but through a `AlbumMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_photoslibrary1 as photoslibrary1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use photoslibrary1::PhotosLibrary; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.albums().get("albumId") -/// .share_token("dolores") -/// .doit(); -/// # } -/// ``` -pub struct AlbumGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PhotosLibrary, - _album_id: String, - _share_token: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AlbumGetCall<'a, C, A> {} - -impl<'a, C, A> AlbumGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Album)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "photoslibrary.albums.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("albumId", self._album_id.to_string())); - if let Some(value) = self._share_token { - params.push(("shareToken", value.to_string())); - } - for &field in ["alt", "albumId", "shareToken"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/albums/{+albumId}"; + let mut url = self.hub._base_url.clone() + "v1/mediaItems:batchGet"; if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+albumId}", "albumId")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["albumId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2943,7 +2251,7 @@ impl<'a, C, A> AlbumGetCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2996,23 +2304,14 @@ impl<'a, C, A> AlbumGetCall<'a, C, A> where C: BorrowMut, A: oaut } - /// Identifier of the album to be requested. Must not be set if `shareToken` is - /// set. + /// Identifiers of the media items to be requested. + /// Must not contain repeated identifiers and cannot be empty. The maximum + /// number of media items that can be retrieved in one call is 50. /// - /// Sets the *album id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn album_id(mut self, new_value: &str) -> AlbumGetCall<'a, C, A> { - self._album_id = new_value.to_string(); - self - } - /// Share token of the album to be request. Must not be set if `albumId` is - /// set. - /// - /// Sets the *share token* query property to the given value. - pub fn share_token(mut self, new_value: &str) -> AlbumGetCall<'a, C, A> { - self._share_token = Some(new_value.to_string()); + /// Append the given value to the *media item ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_media_item_ids(mut self, new_value: &str) -> MediaItemBatchGetCall<'a, C, A> { + self._media_item_ids.push(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -3021,7 +2320,7 @@ impl<'a, C, A> AlbumGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MediaItemBatchGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -3030,7 +2329,7 @@ impl<'a, C, A> AlbumGetCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3046,7 +2345,7 @@ impl<'a, C, A> AlbumGetCall<'a, C, A> where C: BorrowMut, A: oaut /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> AlbumGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> MediaItemBatchGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -3066,777 +2365,7 @@ impl<'a, C, A> AlbumGetCall<'a, C, A> where C: BorrowMut, A: oaut /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AlbumGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Joins a shared album on behalf of the Google Photos user. -/// -/// A builder for the *join* method supported by a *sharedAlbum* resource. -/// It is not used directly, but through a `SharedAlbumMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_photoslibrary1 as photoslibrary1; -/// use photoslibrary1::JoinSharedAlbumRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use photoslibrary1::PhotosLibrary; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = JoinSharedAlbumRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.shared_albums().join(req) -/// .doit(); -/// # } -/// ``` -pub struct SharedAlbumJoinCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PhotosLibrary, - _request: JoinSharedAlbumRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for SharedAlbumJoinCall<'a, C, A> {} - -impl<'a, C, A> SharedAlbumJoinCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, JoinSharedAlbumResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "photoslibrary.sharedAlbums.join", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/sharedAlbums:join"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Sharing.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: JoinSharedAlbumRequest) -> SharedAlbumJoinCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> SharedAlbumJoinCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> SharedAlbumJoinCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Sharing`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> SharedAlbumJoinCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Returns the album based on the specified `albumId` or `shareToken`. -/// Exactly one of `albumId` and `shareToken` must be set. -/// The `albumId` should be the ID of an album owned by the user or a shared -/// album that the user has joined. -/// -/// A builder for the *get* method supported by a *sharedAlbum* resource. -/// It is not used directly, but through a `SharedAlbumMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_photoslibrary1 as photoslibrary1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use photoslibrary1::PhotosLibrary; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.shared_albums().get("shareToken") -/// .album_id("sadipscing") -/// .doit(); -/// # } -/// ``` -pub struct SharedAlbumGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PhotosLibrary, - _share_token: String, - _album_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for SharedAlbumGetCall<'a, C, A> {} - -impl<'a, C, A> SharedAlbumGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Album)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "photoslibrary.sharedAlbums.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("shareToken", self._share_token.to_string())); - if let Some(value) = self._album_id { - params.push(("albumId", value.to_string())); - } - for &field in ["alt", "shareToken", "albumId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/sharedAlbums/{+shareToken}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+shareToken}", "shareToken")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["shareToken"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Share token of the album to be request. Must not be set if `albumId` is - /// set. - /// - /// Sets the *share token* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn share_token(mut self, new_value: &str) -> SharedAlbumGetCall<'a, C, A> { - self._share_token = new_value.to_string(); - self - } - /// Identifier of the album to be requested. Must not be set if `shareToken` is - /// set. - /// - /// Sets the *album id* query property to the given value. - pub fn album_id(mut self, new_value: &str) -> SharedAlbumGetCall<'a, C, A> { - self._album_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> SharedAlbumGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> SharedAlbumGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> SharedAlbumGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Lists all shared albums available in the Sharing tab of the -/// user's Google Photos app. -/// -/// A builder for the *list* method supported by a *sharedAlbum* resource. -/// It is not used directly, but through a `SharedAlbumMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_photoslibrary1 as photoslibrary1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use photoslibrary1::PhotosLibrary; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.shared_albums().list() -/// .page_token("aliquyam") -/// .page_size(-66) -/// .exclude_non_app_created_data(false) -/// .doit(); -/// # } -/// ``` -pub struct SharedAlbumListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PhotosLibrary, - _page_token: Option, - _page_size: Option, - _exclude_non_app_created_data: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for SharedAlbumListCall<'a, C, A> {} - -impl<'a, C, A> SharedAlbumListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListSharedAlbumsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "photoslibrary.sharedAlbums.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if let Some(value) = self._exclude_non_app_created_data { - params.push(("excludeNonAppCreatedData", value.to_string())); - } - for &field in ["alt", "pageToken", "pageSize", "excludeNonAppCreatedData"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/sharedAlbums"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// A continuation token to get the next page of the results. Adding this to - /// the request returns the rows after the `pageToken`. The `pageToken` should - /// be the value returned in the `nextPageToken` parameter in the response to - /// the `listSharedAlbums` request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> SharedAlbumListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Maximum number of albums to return in the response. The default number of - /// albums to return at a time is 20. The maximum `pageSize` is 50. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> SharedAlbumListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// If set, the results exclude media items that were not created by this app. - /// Defaults to false (all albums are returned). This field is ignored if the - /// photoslibrary.readonly.appcreateddata scope is used. - /// - /// Sets the *exclude non app created data* query property to the given value. - pub fn exclude_non_app_created_data(mut self, new_value: bool) -> SharedAlbumListCall<'a, C, A> { - self._exclude_non_app_created_data = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> SharedAlbumListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> SharedAlbumListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> SharedAlbumListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MediaItemBatchGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -3947,10 +2476,7 @@ impl<'a, C, A> MediaItemBatchCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3982,7 +2508,7 @@ impl<'a, C, A> MediaItemBatchCreateCall<'a, C, A> where C: BorrowMut MediaItemBatchCreateCall<'a, C, A> where C: BorrowMut MediaItemBatchCreateCall<'a, C, A> where C: BorrowMut MediaItemGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4212,10 +2738,7 @@ impl<'a, C, A> MediaItemGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4235,7 +2758,7 @@ impl<'a, C, A> MediaItemGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4288,7 +2811,7 @@ impl<'a, C, A> MediaItemGetCall<'a, C, A> where C: BorrowMut, A: } - /// Identifier of media item to be requested. + /// Identifier of the media item to be requested. /// /// Sets the *media item id* path property to the given value. /// @@ -4313,7 +2836,7 @@ impl<'a, C, A> MediaItemGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4361,257 +2884,6 @@ impl<'a, C, A> MediaItemGetCall<'a, C, A> where C: BorrowMut, A: } -/// Searches for media items in a user's Google Photos library. -/// If no filters are set, then all media items in the user's library are -/// returned. -/// If an album is set, all media items in the specified album are returned. -/// If filters are specified, media items that match the filters from the user's -/// library are listed. -/// If you set both the album and the filters, the request results in an error. -/// -/// A builder for the *search* method supported by a *mediaItem* resource. -/// It is not used directly, but through a `MediaItemMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_photoslibrary1 as photoslibrary1; -/// use photoslibrary1::SearchMediaItemsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use photoslibrary1::PhotosLibrary; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = SearchMediaItemsRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.media_items().search(req) -/// .doit(); -/// # } -/// ``` -pub struct MediaItemSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PhotosLibrary, - _request: SearchMediaItemsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MediaItemSearchCall<'a, C, A> {} - -impl<'a, C, A> MediaItemSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchMediaItemsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "photoslibrary.mediaItems.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/mediaItems:search"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: SearchMediaItemsRequest) -> MediaItemSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> MediaItemSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> MediaItemSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> MediaItemSearchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// List all media items from a user's Google Photos library. /// /// A builder for the *list* method supported by a *mediaItem* resource. @@ -4640,8 +2912,8 @@ impl<'a, C, A> MediaItemSearchCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.media_items().list() -/// .page_token("justo") -/// .page_size(-34) +/// .page_token("erat") +/// .page_size(-35) /// .doit(); /// # } /// ``` @@ -4697,10 +2969,7 @@ impl<'a, C, A> MediaItemListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4720,7 +2989,7 @@ impl<'a, C, A> MediaItemListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4806,7 +3075,7 @@ impl<'a, C, A> MediaItemListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4854,3 +3123,2582 @@ impl<'a, C, A> MediaItemListCall<'a, C, A> where C: BorrowMut, A: } +/// Returns the album based on the specified `shareToken`. +/// +/// A builder for the *get* method supported by a *sharedAlbum* resource. +/// It is not used directly, but through a `SharedAlbumMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_photoslibrary1 as photoslibrary1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use photoslibrary1::PhotosLibrary; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shared_albums().get("shareToken") +/// .doit(); +/// # } +/// ``` +pub struct SharedAlbumGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, + _share_token: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SharedAlbumGetCall<'a, C, A> {} + +impl<'a, C, A> SharedAlbumGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Album)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "photoslibrary.sharedAlbums.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("shareToken", self._share_token.to_string())); + for &field in ["alt", "shareToken"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/sharedAlbums/{+shareToken}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Sharing.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+shareToken}", "shareToken")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["shareToken"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Share token of the album to be requested. + /// + /// Sets the *share token* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn share_token(mut self, new_value: &str) -> SharedAlbumGetCall<'a, C, A> { + self._share_token = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SharedAlbumGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> SharedAlbumGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Sharing`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SharedAlbumGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Leaves a previously-joined shared album on behalf of the Google Photos +/// user. The user must not own this album. +/// +/// A builder for the *leave* method supported by a *sharedAlbum* resource. +/// It is not used directly, but through a `SharedAlbumMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_photoslibrary1 as photoslibrary1; +/// use photoslibrary1::LeaveSharedAlbumRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use photoslibrary1::PhotosLibrary; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = LeaveSharedAlbumRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shared_albums().leave(req) +/// .doit(); +/// # } +/// ``` +pub struct SharedAlbumLeaveCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, + _request: LeaveSharedAlbumRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SharedAlbumLeaveCall<'a, C, A> {} + +impl<'a, C, A> SharedAlbumLeaveCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LeaveSharedAlbumResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "photoslibrary.sharedAlbums.leave", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/sharedAlbums:leave"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Sharing.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: LeaveSharedAlbumRequest) -> SharedAlbumLeaveCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SharedAlbumLeaveCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> SharedAlbumLeaveCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Sharing`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SharedAlbumLeaveCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Joins a shared album on behalf of the Google Photos user. +/// +/// A builder for the *join* method supported by a *sharedAlbum* resource. +/// It is not used directly, but through a `SharedAlbumMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_photoslibrary1 as photoslibrary1; +/// use photoslibrary1::JoinSharedAlbumRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use photoslibrary1::PhotosLibrary; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = JoinSharedAlbumRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shared_albums().join(req) +/// .doit(); +/// # } +/// ``` +pub struct SharedAlbumJoinCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, + _request: JoinSharedAlbumRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SharedAlbumJoinCall<'a, C, A> {} + +impl<'a, C, A> SharedAlbumJoinCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, JoinSharedAlbumResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "photoslibrary.sharedAlbums.join", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/sharedAlbums:join"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Sharing.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: JoinSharedAlbumRequest) -> SharedAlbumJoinCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SharedAlbumJoinCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> SharedAlbumJoinCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Sharing`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SharedAlbumJoinCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all shared albums available in the Sharing tab of the +/// user's Google Photos app. +/// +/// A builder for the *list* method supported by a *sharedAlbum* resource. +/// It is not used directly, but through a `SharedAlbumMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_photoslibrary1 as photoslibrary1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use photoslibrary1::PhotosLibrary; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.shared_albums().list() +/// .page_token("nonumy") +/// .page_size(-19) +/// .exclude_non_app_created_data(false) +/// .doit(); +/// # } +/// ``` +pub struct SharedAlbumListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, + _page_token: Option, + _page_size: Option, + _exclude_non_app_created_data: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SharedAlbumListCall<'a, C, A> {} + +impl<'a, C, A> SharedAlbumListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListSharedAlbumsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "photoslibrary.sharedAlbums.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._exclude_non_app_created_data { + params.push(("excludeNonAppCreatedData", value.to_string())); + } + for &field in ["alt", "pageToken", "pageSize", "excludeNonAppCreatedData"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/sharedAlbums"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// A continuation token to get the next page of the results. Adding this to + /// the request returns the rows after the `pageToken`. The `pageToken` should + /// be the value returned in the `nextPageToken` parameter in the response to + /// the `listSharedAlbums` request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SharedAlbumListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of albums to return in the response. The default number of + /// albums to return at a time is 20. The maximum `pageSize` is 50. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> SharedAlbumListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// If set, the results exclude media items that were not created by this app. + /// Defaults to false (all albums are returned). This field is ignored if the + /// photoslibrary.readonly.appcreateddata scope is used. + /// + /// Sets the *exclude non app created data* query property to the given value. + pub fn exclude_non_app_created_data(mut self, new_value: bool) -> SharedAlbumListCall<'a, C, A> { + self._exclude_non_app_created_data = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SharedAlbumListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> SharedAlbumListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> SharedAlbumListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Adds an enrichment at a specified position in a defined album. +/// +/// A builder for the *addEnrichment* method supported by a *album* resource. +/// It is not used directly, but through a `AlbumMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_photoslibrary1 as photoslibrary1; +/// use photoslibrary1::AddEnrichmentToAlbumRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use photoslibrary1::PhotosLibrary; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AddEnrichmentToAlbumRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.albums().add_enrichment(req, "albumId") +/// .doit(); +/// # } +/// ``` +pub struct AlbumAddEnrichmentCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, + _request: AddEnrichmentToAlbumRequest, + _album_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AlbumAddEnrichmentCall<'a, C, A> {} + +impl<'a, C, A> AlbumAddEnrichmentCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AddEnrichmentToAlbumResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "photoslibrary.albums.addEnrichment", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("albumId", self._album_id.to_string())); + for &field in ["alt", "albumId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/albums/{+albumId}:addEnrichment"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+albumId}", "albumId")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["albumId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AddEnrichmentToAlbumRequest) -> AlbumAddEnrichmentCall<'a, C, A> { + self._request = new_value; + self + } + /// Identifier of the album where the enrichment is to be added. + /// + /// Sets the *album id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn album_id(mut self, new_value: &str) -> AlbumAddEnrichmentCall<'a, C, A> { + self._album_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumAddEnrichmentCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AlbumAddEnrichmentCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlbumAddEnrichmentCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all albums shown to a user in the Albums tab of the Google +/// Photos app. +/// +/// A builder for the *list* method supported by a *album* resource. +/// It is not used directly, but through a `AlbumMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_photoslibrary1 as photoslibrary1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use photoslibrary1::PhotosLibrary; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.albums().list() +/// .page_token("aliquyam") +/// .page_size(-66) +/// .exclude_non_app_created_data(false) +/// .doit(); +/// # } +/// ``` +pub struct AlbumListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, + _page_token: Option, + _page_size: Option, + _exclude_non_app_created_data: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AlbumListCall<'a, C, A> {} + +impl<'a, C, A> AlbumListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListAlbumsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "photoslibrary.albums.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._exclude_non_app_created_data { + params.push(("excludeNonAppCreatedData", value.to_string())); + } + for &field in ["alt", "pageToken", "pageSize", "excludeNonAppCreatedData"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/albums"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// A continuation token to get the next page of the results. Adding this to + /// the request returns the rows after the `pageToken`. The `pageToken` should + /// be the value returned in the `nextPageToken` parameter in the response to + /// the `listAlbums` request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AlbumListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of albums to return in the response. The default number of + /// albums to return at a time is 20. The maximum `pageSize` is 50. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> AlbumListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// If set, the results exclude media items that were not created by this app. + /// Defaults to false (all albums are returned). This field is ignored if the + /// photoslibrary.readonly.appcreateddata scope is used. + /// + /// Sets the *exclude non app created data* query property to the given value. + pub fn exclude_non_app_created_data(mut self, new_value: bool) -> AlbumListCall<'a, C, A> { + self._exclude_non_app_created_data = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AlbumListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlbumListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Marks a previously shared album as private. This means that the album is +/// no longer shared and all the non-owners will lose access to the album. All +/// non-owner content will be removed from the album. If a non-owner has +/// previously added the album to their library, they will retain all photos in +/// their library. This action can only be performed on albums which were +/// created by the developer via the API. +/// +/// A builder for the *unshare* method supported by a *album* resource. +/// It is not used directly, but through a `AlbumMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_photoslibrary1 as photoslibrary1; +/// use photoslibrary1::UnshareAlbumRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use photoslibrary1::PhotosLibrary; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UnshareAlbumRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.albums().unshare(req, "albumId") +/// .doit(); +/// # } +/// ``` +pub struct AlbumUnshareCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, + _request: UnshareAlbumRequest, + _album_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AlbumUnshareCall<'a, C, A> {} + +impl<'a, C, A> AlbumUnshareCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UnshareAlbumResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "photoslibrary.albums.unshare", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("albumId", self._album_id.to_string())); + for &field in ["alt", "albumId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/albums/{+albumId}:unshare"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Sharing.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+albumId}", "albumId")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["albumId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: UnshareAlbumRequest) -> AlbumUnshareCall<'a, C, A> { + self._request = new_value; + self + } + /// Identifier of the album to be unshared. This album id must belong to an + /// album created by the developer. + /// + /// Sets the *album id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn album_id(mut self, new_value: &str) -> AlbumUnshareCall<'a, C, A> { + self._album_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumUnshareCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AlbumUnshareCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Sharing`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlbumUnshareCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Marks an album as shared and accessible to other users. This action can +/// only be performed on albums which were created by the developer via the +/// API. +/// +/// A builder for the *share* method supported by a *album* resource. +/// It is not used directly, but through a `AlbumMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_photoslibrary1 as photoslibrary1; +/// use photoslibrary1::ShareAlbumRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use photoslibrary1::PhotosLibrary; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ShareAlbumRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.albums().share(req, "albumId") +/// .doit(); +/// # } +/// ``` +pub struct AlbumShareCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, + _request: ShareAlbumRequest, + _album_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AlbumShareCall<'a, C, A> {} + +impl<'a, C, A> AlbumShareCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ShareAlbumResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "photoslibrary.albums.share", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("albumId", self._album_id.to_string())); + for &field in ["alt", "albumId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/albums/{+albumId}:share"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Sharing.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+albumId}", "albumId")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["albumId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ShareAlbumRequest) -> AlbumShareCall<'a, C, A> { + self._request = new_value; + self + } + /// Identifier of the album to be shared. This `albumId` must belong to an + /// album created by the developer. + /// + /// Sets the *album id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn album_id(mut self, new_value: &str) -> AlbumShareCall<'a, C, A> { + self._album_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumShareCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AlbumShareCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Sharing`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlbumShareCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates an album in a user's Google Photos library. +/// +/// A builder for the *create* method supported by a *album* resource. +/// It is not used directly, but through a `AlbumMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_photoslibrary1 as photoslibrary1; +/// use photoslibrary1::CreateAlbumRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use photoslibrary1::PhotosLibrary; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = CreateAlbumRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.albums().create(req) +/// .doit(); +/// # } +/// ``` +pub struct AlbumCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, + _request: CreateAlbumRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AlbumCreateCall<'a, C, A> {} + +impl<'a, C, A> AlbumCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Album)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "photoslibrary.albums.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/albums"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: CreateAlbumRequest) -> AlbumCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AlbumCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlbumCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the album based on the specified `albumId`. +/// The `albumId` must be the ID of an album owned by the user or a shared +/// album that the user has joined. +/// +/// A builder for the *get* method supported by a *album* resource. +/// It is not used directly, but through a `AlbumMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_photoslibrary1 as photoslibrary1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use photoslibrary1::PhotosLibrary; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = PhotosLibrary::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.albums().get("albumId") +/// .doit(); +/// # } +/// ``` +pub struct AlbumGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a PhotosLibrary, + _album_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AlbumGetCall<'a, C, A> {} + +impl<'a, C, A> AlbumGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Album)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "photoslibrary.albums.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("albumId", self._album_id.to_string())); + for &field in ["alt", "albumId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/albums/{+albumId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+albumId}", "albumId")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["albumId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifier of the album to be requested. + /// + /// Sets the *album id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn album_id(mut self, new_value: &str) -> AlbumGetCall<'a, C, A> { + self._album_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AlbumGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AlbumGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AlbumGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/playcustomapp1/Cargo.toml b/gen/playcustomapp1/Cargo.toml index 9fc8ee9871..450ef4bdd3 100644 --- a/gen/playcustomapp1/Cargo.toml +++ b/gen/playcustomapp1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/playcustomapp1/src/lib.rs b/gen/playcustomapp1/src/lib.rs index 2f4753110d..a81a15c588 100644 --- a/gen/playcustomapp1/src/lib.rs +++ b/gen/playcustomapp1/src/lib.rs @@ -585,10 +585,7 @@ impl<'a, C, A> AccountCustomAppCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -649,7 +646,7 @@ impl<'a, C, A> AccountCustomAppCreateCall<'a, C, A> where C: BorrowMut (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -814,7 +811,7 @@ impl<'a, C, A> AccountCustomAppCreateCall<'a, C, A> where C: BorrowMut AccountOrderListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1225,7 +1222,7 @@ impl<'a, C, A> AccountOrderListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1364,7 +1361,7 @@ impl<'a, C, A> AccountOrderListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1519,10 +1516,7 @@ impl<'a, C, A> AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1542,7 +1536,7 @@ impl<'a, C, A> AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut AccountOrderGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1816,7 +1807,7 @@ impl<'a, C, A> AccountOrderGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1904,7 +1895,7 @@ impl<'a, C, A> AccountOrderGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2054,10 +2045,7 @@ impl<'a, C, A> AccountAvailGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2077,7 +2065,7 @@ impl<'a, C, A> AccountAvailGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2165,7 +2153,7 @@ impl<'a, C, A> AccountAvailGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2371,10 +2359,7 @@ impl<'a, C, A> AccountAvailListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2394,7 +2379,7 @@ impl<'a, C, A> AccountAvailListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2546,7 +2531,7 @@ impl<'a, C, A> AccountAvailListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2759,10 +2744,7 @@ impl<'a, C, A> AccountStoreInfoListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2782,7 +2764,7 @@ impl<'a, C, A> AccountStoreInfoListCall<'a, C, A> where C: BorrowMut AccountStoreInfoListCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with plus (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plus1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-plus1] path = "../plus1" -version = "1.0.8+20181007" +version = "1.0.8+20190328" diff --git a/gen/plus1-cli/README.md b/gen/plus1-cli/README.md index cdc9ee9de6..6cd98e2b2c 100644 --- a/gen/plus1-cli/README.md +++ b/gen/plus1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *plus* API at revision *20181007*. The CLI is at version *1.0.8*. +This documentation was generated from the *plus* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash plus1 [options] diff --git a/gen/plus1-cli/mkdocs.yml b/gen/plus1-cli/mkdocs.yml index 9599189897..c061f5e6ef 100644 --- a/gen/plus1-cli/mkdocs.yml +++ b/gen/plus1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: plus v1.0.8+20181007 +site_name: plus v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-plus1-cli site_description: A complete library to interact with plus (protocol v1) diff --git a/gen/plus1-cli/src/main.rs b/gen/plus1-cli/src/main.rs index 3b41b2cae6..f08aebf919 100644 --- a/gen/plus1-cli/src/main.rs +++ b/gen/plus1-cli/src/main.rs @@ -711,7 +711,7 @@ fn main() { let arg_data = [ ("activities", "methods: 'get', 'list' and 'search'", vec![ ("get", - Some(r##"Get an activity."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/activities_get", vec![ (Some(r##"activity-id"##), @@ -733,7 +733,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"List all of the activities in the specified collection for a particular user."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/activities_list", vec![ (Some(r##"user-id"##), @@ -761,7 +761,7 @@ fn main() { Some(false)), ]), ("search", - Some(r##"Search public activities."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/activities_search", vec![ (Some(r##"query"##), @@ -786,7 +786,7 @@ fn main() { ("comments", "methods: 'get' and 'list'", vec![ ("get", - Some(r##"Get a comment."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/comments_get", vec![ (Some(r##"comment-id"##), @@ -808,7 +808,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"List all of the comments for an activity."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/comments_list", vec![ (Some(r##"activity-id"##), @@ -883,7 +883,7 @@ fn main() { Some(false)), ]), ("list-by-activity", - Some(r##"List all of the people in the specified collection for a particular activity."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/people_list-by-activity", vec![ (Some(r##"activity-id"##), @@ -911,7 +911,7 @@ fn main() { Some(false)), ]), ("search", - Some(r##"Search all public profiles."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/people_search", vec![ (Some(r##"query"##), @@ -938,7 +938,7 @@ fn main() { let mut app = App::new("plus1") .author("Sebastian Thiel ") - .version("1.0.8+20181007") + .version("1.0.8+20190328") .about("Builds on top of the Google+ platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_plus1_cli") .arg(Arg::with_name("url") diff --git a/gen/plus1/Cargo.toml b/gen/plus1/Cargo.toml index 4a410c9875..e43152897a 100644 --- a/gen/plus1/Cargo.toml +++ b/gen/plus1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-plus1" -version = "1.0.8+20181007" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with plus (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plus1" homepage = "https://developers.google.com/+/api/" -documentation = "https://docs.rs/google-plus1/1.0.8+20181007" +documentation = "https://docs.rs/google-plus1/1.0.8+20190328" license = "MIT" keywords = ["plus", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/plus1/README.md b/gen/plus1/README.md index 479faa884f..45d7099a37 100644 --- a/gen/plus1/README.md +++ b/gen/plus1/README.md @@ -5,20 +5,20 @@ DO NOT EDIT ! --> The `google-plus1` library allows access to all features of the *Google plus* service. -This documentation was generated from *plus* crate version *1.0.8+20181007*, where *20181007* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *plus* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *plus* *v1* API can be found at the [official documentation site](https://developers.google.com/+/api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.Plus.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.Plus.html) ... -* [activities](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.Activity.html) - * [*get*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.ActivityGetCall.html), [*list*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.ActivityListCall.html) and [*search*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.ActivitySearchCall.html) -* [comments](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.Comment.html) - * [*get*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.CommentGetCall.html) and [*list*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.CommentListCall.html) +* [activities](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.Activity.html) + * [*get*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.ActivityGetCall.html), [*list*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.ActivityListCall.html) and [*search*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.ActivitySearchCall.html) +* [comments](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.Comment.html) + * [*get*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.CommentGetCall.html) and [*list*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.CommentListCall.html) * people - * [*get*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.PeopleGetCall.html), [*list*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.PeopleListCall.html), [*list by activity*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.PeopleListByActivityCall.html) and [*search*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.PeopleSearchCall.html) + * [*get*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.PeopleGetCall.html), [*list*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.PeopleListCall.html), [*list by activity*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.PeopleListByActivityCall.html) and [*search*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.PeopleSearchCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/struct.Plus.html)** +* **[Hub](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/struct.Plus.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.Part.html)** + * **[Parts](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-plus1/1.0.8+20181007/google_plus1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-plus1/1.0.8+20190328/google_plus1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/plus1/src/lib.rs b/gen/plus1/src/lib.rs index d7e3dd263c..b04d668943 100644 --- a/gen/plus1/src/lib.rs +++ b/gen/plus1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *plus* crate version *1.0.8+20181007*, where *20181007* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *plus* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *plus* *v1* API can be found at the //! [official documentation site](https://developers.google.com/+/api/). @@ -234,13 +234,13 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// Know the list of people in your circles, your age range, and language + /// View your basic profile info, including your age range and language Login, /// View your email address UserinfoEmail, - /// View your basic profile info + /// See your personal info, including any personal info you've made publicly available UserinfoProfile, /// Know who you are on Google @@ -1624,7 +1624,7 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Search public activities. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -1645,7 +1645,7 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Get an activity. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -1662,7 +1662,7 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// List all of the activities in the specified collection for a particular user. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -1725,7 +1725,7 @@ impl<'a, C, A> CommentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// List all of the comments for an activity. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -1745,7 +1745,7 @@ impl<'a, C, A> CommentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Get a comment. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -1804,7 +1804,7 @@ impl<'a, C, A> PeopleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Search all public profiles. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -1824,7 +1824,7 @@ impl<'a, C, A> PeopleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// List all of the people in the specified collection for a particular activity. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -1891,7 +1891,7 @@ impl<'a, C, A> PeopleMethods<'a, C, A> { // CallBuilders ### // ################# -/// Search public activities. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *search* method supported by a *activity* resource. /// It is not used directly, but through a `ActivityMethods` instance. @@ -1988,10 +1988,7 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2011,7 +2008,7 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2117,7 +2114,7 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2161,7 +2158,7 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A } -/// Get an activity. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *get* method supported by a *activity* resource. /// It is not used directly, but through a `ActivityMethods` instance. @@ -2259,10 +2256,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2282,7 +2276,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2360,7 +2354,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2404,7 +2398,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o } -/// List all of the activities in the specified collection for a particular user. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *list* method supported by a *activity* resource. /// It is not used directly, but through a `ActivityMethods` instance. @@ -2514,10 +2508,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2537,7 +2528,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2639,7 +2630,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2683,7 +2674,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } -/// List all of the comments for an activity. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *list* method supported by a *comment* resource. /// It is not used directly, but through a `CommentMethods` instance. @@ -2796,10 +2787,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2819,7 +2807,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2918,7 +2906,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2962,7 +2950,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } -/// Get a comment. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *get* method supported by a *comment* resource. /// It is not used directly, but through a `CommentMethods` instance. @@ -3060,10 +3048,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3083,7 +3068,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3161,7 +3146,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3205,7 +3190,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Search all public profiles. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *search* method supported by a *people* resource. /// It is not used directly, but through a `PeopleMethods` instance. @@ -3297,10 +3282,7 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3320,7 +3302,7 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3419,7 +3401,7 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3463,7 +3445,7 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: } -/// List all of the people in the specified collection for a particular activity. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *listByActivity* method supported by a *people* resource. /// It is not used directly, but through a `PeopleMethods` instance. @@ -3573,10 +3555,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3596,7 +3575,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3880,7 +3856,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3989,7 +3965,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4131,10 +4107,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4154,7 +4127,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4232,7 +4205,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/plusdomains1-cli/Cargo.toml b/gen/plusdomains1-cli/Cargo.toml index d52a3b51fc..c5005bc827 100644 --- a/gen/plusdomains1-cli/Cargo.toml +++ b/gen/plusdomains1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plusdomains1-cli" -version = "1.0.8+20181007" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with plusDomains (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plusdomains1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-plusdomains1] path = "../plusdomains1" -version = "1.0.8+20181007" +version = "1.0.8+20190328" diff --git a/gen/plusdomains1-cli/README.md b/gen/plusdomains1-cli/README.md index ac0c740ac1..62f473d6a8 100644 --- a/gen/plusdomains1-cli/README.md +++ b/gen/plusdomains1-cli/README.md @@ -25,28 +25,19 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *plusDomains* API at revision *20181007*. The CLI is at version *1.0.8*. +This documentation was generated from the *plusDomains* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash plusdomains1 [options] activities get [-p ]... [-o ] - insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] audiences list [-p ]... [-o ] circles - add-people [-p ]... [-o ] - get [-p ]... [-o ] - insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - remove [-p ]... - remove-people [-p ]... - update (-r )... [-p ]... [-o ] comments get [-p ]... [-o ] - insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] media insert (-r )... (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] diff --git a/gen/plusdomains1-cli/mkdocs.yml b/gen/plusdomains1-cli/mkdocs.yml index 1eb56c4265..d6e916806c 100644 --- a/gen/plusdomains1-cli/mkdocs.yml +++ b/gen/plusdomains1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: plusDomains v1.0.8+20181007 +site_name: plusDomains v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-plusdomains1-cli site_description: A complete library to interact with plusDomains (protocol v1) @@ -10,19 +10,10 @@ site_dir: build_html pages: - ['index.md', 'Home'] - ['activities_get.md', 'Activities', 'Get'] -- ['activities_insert.md', 'Activities', 'Insert'] - ['activities_list.md', 'Activities', 'List'] - ['audiences_list.md', 'Audiences', 'List'] -- ['circles_add-people.md', 'Circles', 'Add People'] -- ['circles_get.md', 'Circles', 'Get'] -- ['circles_insert.md', 'Circles', 'Insert'] - ['circles_list.md', 'Circles', 'List'] -- ['circles_patch.md', 'Circles', 'Patch'] -- ['circles_remove.md', 'Circles', 'Remove'] -- ['circles_remove-people.md', 'Circles', 'Remove People'] -- ['circles_update.md', 'Circles', 'Update'] - ['comments_get.md', 'Comments', 'Get'] -- ['comments_insert.md', 'Comments', 'Insert'] - ['comments_list.md', 'Comments', 'List'] - ['media_insert.md', 'Media', 'Insert'] - ['people_get.md', 'People', 'Get'] diff --git a/gen/plusdomains1-cli/src/main.rs b/gen/plusdomains1-cli/src/main.rs index 78bef00b33..0f0a9b55be 100644 --- a/gen/plusdomains1-cli/src/main.rs +++ b/gen/plusdomains1-cli/src/main.rs @@ -98,149 +98,6 @@ impl<'n> Engine<'n> { } } - fn _activities_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "place-name" => Some(("placeName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "provider.title" => Some(("provider.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "geocode" => Some(("geocode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.resharers.total-items" => Some(("object.resharers.totalItems", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "object.resharers.self-link" => Some(("object.resharers.selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.original-content" => Some(("object.originalContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.plusoners.total-items" => Some(("object.plusoners.totalItems", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "object.plusoners.self-link" => Some(("object.plusoners.selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.actor.display-name" => Some(("object.actor.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.actor.url" => Some(("object.actor.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.actor.image.url" => Some(("object.actor.image.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.actor.client-specific-actor-info.youtube-actor-info.channel-id" => Some(("object.actor.clientSpecificActorInfo.youtubeActorInfo.channelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.actor.verification.ad-hoc-verified" => Some(("object.actor.verification.adHocVerified", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.actor.id" => Some(("object.actor.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.content" => Some(("object.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.url" => Some(("object.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.status-for-viewer.can-plusone" => Some(("object.statusForViewer.canPlusone", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "object.status-for-viewer.can-update" => Some(("object.statusForViewer.canUpdate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "object.status-for-viewer.is-plus-oned" => Some(("object.statusForViewer.isPlusOned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "object.status-for-viewer.resharing-disabled" => Some(("object.statusForViewer.resharingDisabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "object.status-for-viewer.can-comment" => Some(("object.statusForViewer.canComment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "object.replies.total-items" => Some(("object.replies.totalItems", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "object.replies.self-link" => Some(("object.replies.selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.id" => Some(("object.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.object-type" => Some(("object.objectType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.display-name" => Some(("actor.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.name.given-name" => Some(("actor.name.givenName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.name.family-name" => Some(("actor.name.familyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.url" => Some(("actor.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.image.url" => Some(("actor.image.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.client-specific-actor-info.youtube-actor-info.channel-id" => Some(("actor.clientSpecificActorInfo.youtubeActorInfo.channelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.verification.ad-hoc-verified" => Some(("actor.verification.adHocVerified", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.id" => Some(("actor.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "place-id" => Some(("placeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "access.kind" => Some(("access.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "access.description" => Some(("access.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "access.domain-restricted" => Some(("access.domainRestricted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "radius" => Some(("radius", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "location.position.latitude" => Some(("location.position.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "location.position.longitude" => Some(("location.position.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "location.kind" => Some(("location.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "location.display-name" => Some(("location.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "location.id" => Some(("location.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "location.address.formatted" => Some(("location.address.formatted", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "verb" => Some(("verb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "crosspost-source" => Some(("crosspostSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "annotation" => Some(("annotation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "address" => Some(("address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "published" => Some(("published", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["access", "actor", "ad-hoc-verified", "address", "annotation", "can-comment", "can-plusone", "can-update", "channel-id", "client-specific-actor-info", "content", "crosspost-source", "description", "display-name", "domain-restricted", "etag", "family-name", "formatted", "geocode", "given-name", "id", "image", "is-plus-oned", "kind", "latitude", "location", "longitude", "name", "object", "object-type", "original-content", "place-id", "place-name", "plusoners", "position", "provider", "published", "radius", "replies", "resharers", "resharing-disabled", "self-link", "status-for-viewer", "title", "total-items", "updated", "url", "verb", "verification", "youtube-actor-info"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Activity = json::value::from_value(object).unwrap(); - let mut call = self.hub.activities().insert(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "preview" => { - call = call.preview(arg_from_str(value.unwrap_or("false"), err, "preview", "boolean")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["preview"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.activities().list(opt.value_of("user-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); @@ -359,208 +216,6 @@ impl<'n> Engine<'n> { } } - fn _circles_add_people(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.circles().add_people(opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "user-id" => { - call = call.add_user_id(value.unwrap_or("")); - }, - "email" => { - call = call.add_email(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["user-id", "email"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _circles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.circles().get(opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _circles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "people.total-items" => Some(("people.totalItems", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "display-name", "etag", "id", "kind", "people", "self-link", "total-items"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Circle = json::value::from_value(object).unwrap(); - let mut call = self.hub.circles().insert(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _circles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.circles().list(opt.value_of("user-id").unwrap_or("")); @@ -620,283 +275,6 @@ impl<'n> Engine<'n> { } } - fn _circles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "people.total-items" => Some(("people.totalItems", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "display-name", "etag", "id", "kind", "people", "self-link", "total-items"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Circle = json::value::from_value(object).unwrap(); - let mut call = self.hub.circles().patch(request, opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _circles_remove(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.circles().remove(opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _circles_remove_people(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.circles().remove_people(opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "user-id" => { - call = call.add_user_id(value.unwrap_or("")); - }, - "email" => { - call = call.add_email(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["user-id", "email"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _circles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "people.total-items" => Some(("people.totalItems", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "display-name", "etag", "id", "kind", "people", "self-link", "total-items"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Circle = json::value::from_value(object).unwrap(); - let mut call = self.hub.circles().update(request, opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _comments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().get(opt.value_of("comment-id").unwrap_or("")); @@ -949,107 +327,6 @@ impl<'n> Engine<'n> { } } - fn _comments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "plusoners.total-items" => Some(("plusoners.totalItems", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "object.content" => Some(("object.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.original-content" => Some(("object.originalContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.object-type" => Some(("object.objectType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.display-name" => Some(("actor.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.url" => Some(("actor.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.image.url" => Some(("actor.image.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.client-specific-actor-info.youtube-actor-info.channel-id" => Some(("actor.clientSpecificActorInfo.youtubeActorInfo.channelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.verification.ad-hoc-verified" => Some(("actor.verification.adHocVerified", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "actor.id" => Some(("actor.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "verb" => Some(("verb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "published" => Some(("published", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["actor", "ad-hoc-verified", "channel-id", "client-specific-actor-info", "content", "display-name", "etag", "id", "image", "kind", "object", "object-type", "original-content", "plusoners", "published", "self-link", "total-items", "updated", "url", "verb", "verification", "youtube-actor-info"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Comment = json::value::from_value(object).unwrap(); - let mut call = self.hub.comments().insert(request, opt.value_of("activity-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _comments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().list(opt.value_of("activity-id").unwrap_or("")); @@ -1462,9 +739,6 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._activities_get(opt, dry_run, &mut err); }, - ("insert", Some(opt)) => { - call_result = self._activities_insert(opt, dry_run, &mut err); - }, ("list", Some(opt)) => { call_result = self._activities_list(opt, dry_run, &mut err); }, @@ -1487,30 +761,9 @@ impl<'n> Engine<'n> { }, ("circles", Some(opt)) => { match opt.subcommand() { - ("add-people", Some(opt)) => { - call_result = self._circles_add_people(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._circles_get(opt, dry_run, &mut err); - }, - ("insert", Some(opt)) => { - call_result = self._circles_insert(opt, dry_run, &mut err); - }, ("list", Some(opt)) => { call_result = self._circles_list(opt, dry_run, &mut err); }, - ("patch", Some(opt)) => { - call_result = self._circles_patch(opt, dry_run, &mut err); - }, - ("remove", Some(opt)) => { - call_result = self._circles_remove(opt, dry_run, &mut err); - }, - ("remove-people", Some(opt)) => { - call_result = self._circles_remove_people(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._circles_update(opt, dry_run, &mut err); - }, _ => { err.issues.push(CLIError::MissingMethodError("circles".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -1522,9 +775,6 @@ impl<'n> Engine<'n> { ("get", Some(opt)) => { call_result = self._comments_get(opt, dry_run, &mut err); }, - ("insert", Some(opt)) => { - call_result = self._comments_insert(opt, dry_run, &mut err); - }, ("list", Some(opt)) => { call_result = self._comments_list(opt, dry_run, &mut err); }, @@ -1648,9 +898,9 @@ fn main() { let mut exit_status = 0i32; let upload_value_names = ["mode", "file"]; let arg_data = [ - ("activities", "methods: 'get', 'insert' and 'list'", vec![ + ("activities", "methods: 'get' and 'list'", vec![ ("get", - Some(r##"Get an activity."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/activities_get", vec![ (Some(r##"activity-id"##), @@ -1665,34 +915,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("insert", - Some(r##"Create a new activity for the authenticated user."##), - "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/activities_insert", - vec![ - (Some(r##"user-id"##), - None, - Some(r##"The ID of the user to create the activity on behalf of. Its value should be "me", to indicate the authenticated user."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1700,7 +922,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"List all of the activities in the specified collection for a particular user."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/activities_list", vec![ (Some(r##"user-id"##), @@ -1731,7 +953,7 @@ fn main() { ("audiences", "methods: 'list'", vec![ ("list", - Some(r##"List all of the audiences to which a user can share."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/audiences_list", vec![ (Some(r##"user-id"##), @@ -1754,81 +976,9 @@ fn main() { ]), ]), - ("circles", "methods: 'add-people', 'get', 'insert', 'list', 'patch', 'remove', 'remove-people' and 'update'", vec![ - ("add-people", - Some(r##"Add a person to a circle. Google+ limits certain circle operations, including the number of circle adds. Learn More."##), - "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_add-people", - vec![ - (Some(r##"circle-id"##), - None, - Some(r##"The ID of the circle to add the person to."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Get a circle."##), - "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_get", - vec![ - (Some(r##"circle-id"##), - None, - Some(r##"The ID of the circle to get."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("insert", - Some(r##"Create a new circle for the authenticated user."##), - "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_insert", - vec![ - (Some(r##"user-id"##), - None, - Some(r##"The ID of the user to create the circle on behalf of. The value "me" can be used to indicate the authenticated user."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), + ("circles", "methods: 'list'", vec![ ("list", - Some(r##"List all of the circles for a user."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_list", vec![ (Some(r##"user-id"##), @@ -1843,94 +993,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Update a circle's description. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_patch", - vec![ - (Some(r##"circle-id"##), - None, - Some(r##"The ID of the circle to update."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("remove", - Some(r##"Delete a circle."##), - "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_remove", - vec![ - (Some(r##"circle-id"##), - None, - Some(r##"The ID of the circle to delete."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("remove-people", - Some(r##"Remove a person from a circle."##), - "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_remove-people", - vec![ - (Some(r##"circle-id"##), - None, - Some(r##"The ID of the circle to remove the person from."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("update", - Some(r##"Update a circle's description."##), - "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_update", - vec![ - (Some(r##"circle-id"##), - None, - Some(r##"The ID of the circle to update."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1939,9 +1001,9 @@ fn main() { ]), ]), - ("comments", "methods: 'get', 'insert' and 'list'", vec![ + ("comments", "methods: 'get' and 'list'", vec![ ("get", - Some(r##"Get a comment."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/comments_get", vec![ (Some(r##"comment-id"##), @@ -1956,34 +1018,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("insert", - Some(r##"Create a new comment in reply to an activity."##), - "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/comments_insert", - vec![ - (Some(r##"activity-id"##), - None, - Some(r##"The ID of the activity to reply to."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1991,7 +1025,7 @@ fn main() { Some(false)), ]), ("list", - Some(r##"List all of the comments for an activity."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/comments_list", vec![ (Some(r##"activity-id"##), @@ -2016,7 +1050,7 @@ fn main() { ("media", "methods: 'insert'", vec![ ("insert", - Some(r##"Add a new media item to an album. The current upload size limitations are 36MB for a photo and 1GB for a video. Uploads do not count against quota if photos are less than 2048 pixels on their longest side or videos are less than 15 minutes in length."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/media_insert", vec![ (Some(r##"user-id"##), @@ -2109,7 +1143,7 @@ fn main() { Some(false)), ]), ("list-by-activity", - Some(r##"List all of the people in the specified collection for a particular activity."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/people_list-by-activity", vec![ (Some(r##"activity-id"##), @@ -2137,7 +1171,7 @@ fn main() { Some(false)), ]), ("list-by-circle", - Some(r##"List all of the people who are members of a circle."##), + Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/people_list-by-circle", vec![ (Some(r##"circle-id"##), @@ -2164,7 +1198,7 @@ fn main() { let mut app = App::new("plusdomains1") .author("Sebastian Thiel ") - .version("1.0.8+20181007") + .version("1.0.8+20190328") .about("Builds on top of the Google+ platform for Google Apps Domains.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_plusdomains1_cli") .arg(Arg::with_name("url") diff --git a/gen/plusdomains1/Cargo.toml b/gen/plusdomains1/Cargo.toml index a23fa5c07c..464439c08e 100644 --- a/gen/plusdomains1/Cargo.toml +++ b/gen/plusdomains1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-plusdomains1" -version = "1.0.8+20181007" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with plusDomains (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plusdomains1" homepage = "https://developers.google.com/+/domains/" -documentation = "https://docs.rs/google-plusdomains1/1.0.8+20181007" +documentation = "https://docs.rs/google-plusdomains1/1.0.8+20190328" license = "MIT" keywords = ["plusDomains", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/plusdomains1/README.md b/gen/plusdomains1/README.md index fcd4d9e1f1..6404a899ad 100644 --- a/gen/plusdomains1/README.md +++ b/gen/plusdomains1/README.md @@ -5,31 +5,31 @@ DO NOT EDIT ! --> The `google-plusdomains1` library allows access to all features of the *Google plusDomains* service. -This documentation was generated from *plusDomains* crate version *1.0.8+20181007*, where *20181007* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *plusDomains* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *plusDomains* *v1* API can be found at the [official documentation site](https://developers.google.com/+/domains/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.PlusDomains.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.PlusDomains.html) ... -* [activities](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.Activity.html) - * [*get*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.ActivityGetCall.html), [*insert*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.ActivityInsertCall.html) and [*list*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.ActivityListCall.html) -* [audiences](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.Audience.html) - * [*list*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.AudienceListCall.html) -* [circles](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.Circle.html) - * [*add people*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CircleAddPeopleCall.html), [*get*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CircleGetCall.html), [*insert*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CircleInsertCall.html), [*list*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CircleListCall.html), [*patch*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CirclePatchCall.html), [*remove*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CircleRemoveCall.html), [*remove people*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CircleRemovePeopleCall.html) and [*update*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CircleUpdateCall.html) -* [comments](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.Comment.html) - * [*get*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CommentGetCall.html), [*insert*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CommentInsertCall.html) and [*list*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.CommentListCall.html) -* [media](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.Media.html) - * [*insert*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.MediaInsertCall.html) +* [activities](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.Activity.html) + * [*get*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.ActivityGetCall.html) and [*list*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.ActivityListCall.html) +* [audiences](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.Audience.html) + * [*list*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.AudienceListCall.html) +* [circles](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.Circle.html) + * [*list*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.CircleListCall.html) +* [comments](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.Comment.html) + * [*get*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.CommentGetCall.html) and [*list*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.CommentListCall.html) +* [media](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.Media.html) + * [*insert*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.MediaInsertCall.html) * people - * [*get*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.PeopleGetCall.html), [*list*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.PeopleListCall.html), [*list by activity*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.PeopleListByActivityCall.html) and [*list by circle*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.PeopleListByCircleCall.html) + * [*get*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.PeopleGetCall.html), [*list*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.PeopleListCall.html), [*list by activity*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.PeopleListByActivityCall.html) and [*list by circle*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.PeopleListByCircleCall.html) Upload supported by ... -* [*insert media*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.MediaInsertCall.html) +* [*insert media*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.MediaInsertCall.html) @@ -37,17 +37,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/struct.PlusDomains.html)** +* **[Hub](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/struct.PlusDomains.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.Part.html)** + * **[Parts](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -61,14 +61,9 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.circles().remove_people(...).doit() -let r = hub.circles().insert(...).doit() -let r = hub.circles().add_people(...).doit() -let r = hub.circles().get(...).doit() -let r = hub.circles().list(...).doit() -let r = hub.circles().update(...).doit() -let r = hub.circles().patch(...).doit() -let r = hub.circles().remove(...).doit() +let r = hub.people().list_by_circle(...).doit() +let r = hub.people().list_by_activity(...).doit() +let r = hub.people().list(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -122,9 +117,10 @@ let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsCo // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! -let result = hub.circles().remove_people("circleId") - .add_user_id("sit") - .add_email("Stet") +let result = hub.people().list("userId", "collection") + .page_token("Stet") + .order_by("sed") + .max_results(16) .doit(); match result { @@ -147,17 +143,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -167,29 +163,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-plusdomains1/1.0.8+20181007/google_plusdomains1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-plusdomains1/1.0.8+20190328/google_plusdomains1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/plusdomains1/src/lib.rs b/gen/plusdomains1/src/lib.rs index d02d96ca5d..739e9e1793 100644 --- a/gen/plusdomains1/src/lib.rs +++ b/gen/plusdomains1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *plusDomains* crate version *1.0.8+20181007*, where *20181007* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *plusDomains* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *plusDomains* *v1* API can be found at the //! [official documentation site](https://developers.google.com/+/domains/). @@ -12,13 +12,13 @@ //! Handle the following *Resources* with ease from the central [hub](struct.PlusDomains.html) ... //! //! * [activities](struct.Activity.html) -//! * [*get*](struct.ActivityGetCall.html), [*insert*](struct.ActivityInsertCall.html) and [*list*](struct.ActivityListCall.html) +//! * [*get*](struct.ActivityGetCall.html) and [*list*](struct.ActivityListCall.html) //! * [audiences](struct.Audience.html) //! * [*list*](struct.AudienceListCall.html) //! * [circles](struct.Circle.html) -//! * [*add people*](struct.CircleAddPeopleCall.html), [*get*](struct.CircleGetCall.html), [*insert*](struct.CircleInsertCall.html), [*list*](struct.CircleListCall.html), [*patch*](struct.CirclePatchCall.html), [*remove*](struct.CircleRemoveCall.html), [*remove people*](struct.CircleRemovePeopleCall.html) and [*update*](struct.CircleUpdateCall.html) +//! * [*list*](struct.CircleListCall.html) //! * [comments](struct.Comment.html) -//! * [*get*](struct.CommentGetCall.html), [*insert*](struct.CommentInsertCall.html) and [*list*](struct.CommentListCall.html) +//! * [*get*](struct.CommentGetCall.html) and [*list*](struct.CommentListCall.html) //! * [media](struct.Media.html) //! * [*insert*](struct.MediaInsertCall.html) //! * people @@ -61,14 +61,9 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.circles().remove_people(...).doit() -//! let r = hub.circles().insert(...).doit() -//! let r = hub.circles().add_people(...).doit() -//! let r = hub.circles().get(...).doit() -//! let r = hub.circles().list(...).doit() -//! let r = hub.circles().update(...).doit() -//! let r = hub.circles().patch(...).doit() -//! let r = hub.circles().remove(...).doit() +//! let r = hub.people().list_by_circle(...).doit() +//! let r = hub.people().list_by_activity(...).doit() +//! let r = hub.people().list(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -123,9 +118,10 @@ //! // You can configure optional parameters by calling the respective setters at will, and //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! -//! let result = hub.circles().remove_people("circleId") -//! .add_user_id("et") -//! .add_email("dolores") +//! let result = hub.people().list("userId", "collection") +//! .page_token("accusam") +//! .order_by("takimata") +//! .max_results(31) //! .doit(); //! //! match result { @@ -248,11 +244,11 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// Know the list of people in your circles, your age range, and language + /// View your basic profile info, including your age range and language PluLogin, - /// View your basic profile info - UserinfoProfile, + /// Send your photos and videos to Google+ + PluMediaUpload, /// View your Google+ posts, comments, and stream PluStreamRead, @@ -263,17 +259,11 @@ pub enum Scope { /// View your own Google+ profile and profiles visible to you PluProfileRead, - /// Manage your circles and add people and pages. People and pages you add to your circles will be notified. Others may see this information publicly. People you add to circles can use Hangouts with you. - PluCircleWrite, - /// View your email address UserinfoEmail, - /// Send your photos and videos to Google+ - PluMediaUpload, - - /// Manage your Google+ posts, comments, and stream - PluStreamWrite, + /// See your personal info, including any personal info you've made publicly available + UserinfoProfile, /// Know who you are on Google PluMe, @@ -283,14 +273,12 @@ impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { Scope::PluLogin => "https://www.googleapis.com/auth/plus.login", - Scope::UserinfoProfile => "https://www.googleapis.com/auth/userinfo.profile", + Scope::PluMediaUpload => "https://www.googleapis.com/auth/plus.media.upload", Scope::PluStreamRead => "https://www.googleapis.com/auth/plus.stream.read", Scope::PluCircleRead => "https://www.googleapis.com/auth/plus.circles.read", Scope::PluProfileRead => "https://www.googleapis.com/auth/plus.profiles.read", - Scope::PluCircleWrite => "https://www.googleapis.com/auth/plus.circles.write", Scope::UserinfoEmail => "https://www.googleapis.com/auth/userinfo.email", - Scope::PluMediaUpload => "https://www.googleapis.com/auth/plus.media.upload", - Scope::PluStreamWrite => "https://www.googleapis.com/auth/plus.stream.write", + Scope::UserinfoProfile => "https://www.googleapis.com/auth/userinfo.profile", Scope::PluMe => "https://www.googleapis.com/auth/plus.me", } } @@ -340,9 +328,10 @@ impl Default for Scope { /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.circles().remove_people("circleId") -/// .add_user_id("accusam") -/// .add_email("takimata") +/// let result = hub.people().list("userId", "collection") +/// .page_token("labore") +/// .order_by("sea") +/// .max_results(11) /// .doit(); /// /// match result { @@ -650,7 +639,6 @@ impl Part for PersonOrganizations {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [insert activities](struct.ActivityInsertCall.html) (request|response) /// * [get activities](struct.ActivityGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -702,7 +690,6 @@ pub struct Activity { pub published: Option, } -impl RequestValue for Activity {} impl ResponseResult for Activity {} @@ -880,14 +867,7 @@ impl Part for ActivityObjectAttachmentsImage {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [remove people circles](struct.CircleRemovePeopleCall.html) (none) -/// * [insert circles](struct.CircleInsertCall.html) (request|response) -/// * [add people circles](struct.CircleAddPeopleCall.html) (response) -/// * [get circles](struct.CircleGetCall.html) (response) /// * [list circles](struct.CircleListCall.html) (none) -/// * [update circles](struct.CircleUpdateCall.html) (request|response) -/// * [patch circles](struct.CirclePatchCall.html) (request|response) -/// * [remove circles](struct.CircleRemoveCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Circle { @@ -909,9 +889,7 @@ pub struct Circle { pub self_link: Option, } -impl RequestValue for Circle {} impl Resource for Circle {} -impl ResponseResult for Circle {} /// The activity this comment replied to. @@ -1702,7 +1680,6 @@ impl Part for ActivityActorImage {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [insert comments](struct.CommentInsertCall.html) (request|response) /// * [get comments](struct.CommentGetCall.html) (response) /// * [list comments](struct.CommentListCall.html) (none) /// @@ -1735,7 +1712,6 @@ pub struct Comment { pub self_link: Option, } -impl RequestValue for Comment {} impl Resource for Comment {} impl ResponseResult for Comment {} @@ -1964,7 +1940,7 @@ impl Part for ActivityActorVerification {} /// ::default(), None); /// let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `add_people(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)`, `remove(...)`, `remove_people(...)` and `update(...)` +/// // like `list(...)` /// // to build up your call. /// let rb = hub.circles(); /// # } @@ -1981,81 +1957,7 @@ impl<'a, C, A> CircleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Remove a person from a circle. - /// - /// # Arguments - /// - /// * `circleId` - The ID of the circle to remove the person from. - pub fn remove_people(&self, circle_id: &str) -> CircleRemovePeopleCall<'a, C, A> { - CircleRemovePeopleCall { - hub: self.hub, - _circle_id: circle_id.to_string(), - _user_id: Default::default(), - _email: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Create a new circle for the authenticated user. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `userId` - The ID of the user to create the circle on behalf of. The value "me" can be used to indicate the authenticated user. - pub fn insert(&self, request: Circle, user_id: &str) -> CircleInsertCall<'a, C, A> { - CircleInsertCall { - hub: self.hub, - _request: request, - _user_id: user_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Add a person to a circle. Google+ limits certain circle operations, including the number of circle adds. Learn More. - /// - /// # Arguments - /// - /// * `circleId` - The ID of the circle to add the person to. - pub fn add_people(&self, circle_id: &str) -> CircleAddPeopleCall<'a, C, A> { - CircleAddPeopleCall { - hub: self.hub, - _circle_id: circle_id.to_string(), - _user_id: Default::default(), - _email: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Get a circle. - /// - /// # Arguments - /// - /// * `circleId` - The ID of the circle to get. - pub fn get(&self, circle_id: &str) -> CircleGetCall<'a, C, A> { - CircleGetCall { - hub: self.hub, - _circle_id: circle_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// List all of the circles for a user. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -2071,61 +1973,6 @@ impl<'a, C, A> CircleMethods<'a, C, A> { _additional_params: Default::default(), } } - - /// Create a builder to help you perform the following task: - /// - /// Update a circle's description. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `circleId` - The ID of the circle to update. - pub fn update(&self, request: Circle, circle_id: &str) -> CircleUpdateCall<'a, C, A> { - CircleUpdateCall { - hub: self.hub, - _request: request, - _circle_id: circle_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Update a circle's description. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `circleId` - The ID of the circle to update. - pub fn patch(&self, request: Circle, circle_id: &str) -> CirclePatchCall<'a, C, A> { - CirclePatchCall { - hub: self.hub, - _request: request, - _circle_id: circle_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Delete a circle. - /// - /// # Arguments - /// - /// * `circleId` - The ID of the circle to delete. - pub fn remove(&self, circle_id: &str) -> CircleRemoveCall<'a, C, A> { - CircleRemoveCall { - hub: self.hub, - _circle_id: circle_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } } @@ -2154,7 +2001,7 @@ impl<'a, C, A> CircleMethods<'a, C, A> { /// ::default(), None); /// let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)`, `insert(...)` and `list(...)` +/// // like `get(...)` and `list(...)` /// // to build up your call. /// let rb = hub.activities(); /// # } @@ -2171,27 +2018,7 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Create a new activity for the authenticated user. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `userId` - The ID of the user to create the activity on behalf of. Its value should be "me", to indicate the authenticated user. - pub fn insert(&self, request: Activity, user_id: &str) -> ActivityInsertCall<'a, C, A> { - ActivityInsertCall { - hub: self.hub, - _request: request, - _user_id: user_id.to_string(), - _preview: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Get an activity. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -2208,7 +2035,7 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// List all of the activities in the specified collection for a particular user. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -2271,7 +2098,7 @@ impl<'a, C, A> PeopleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// List all of the people who are members of a circle. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -2329,7 +2156,7 @@ impl<'a, C, A> PeopleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// List all of the people in the specified collection for a particular activity. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -2392,7 +2219,7 @@ impl<'a, C, A> MediaMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Add a new media item to an album. The current upload size limitations are 36MB for a photo and 1GB for a video. Uploads do not count against quota if photos are less than 2048 pixels on their longest side or videos are less than 15 minutes in length. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -2438,7 +2265,7 @@ impl<'a, C, A> MediaMethods<'a, C, A> { /// ::default(), None); /// let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)`, `insert(...)` and `list(...)` +/// // like `get(...)` and `list(...)` /// // to build up your call. /// let rb = hub.comments(); /// # } @@ -2455,26 +2282,7 @@ impl<'a, C, A> CommentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Create a new comment in reply to an activity. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `activityId` - The ID of the activity to reply to. - pub fn insert(&self, request: Comment, activity_id: &str) -> CommentInsertCall<'a, C, A> { - CommentInsertCall { - hub: self.hub, - _request: request, - _activity_id: activity_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// List all of the comments for an activity. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -2494,7 +2302,7 @@ impl<'a, C, A> CommentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Get a comment. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -2553,7 +2361,7 @@ impl<'a, C, A> AudienceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// List all of the audiences to which a user can share. + /// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// # Arguments /// @@ -2579,1059 +2387,7 @@ impl<'a, C, A> AudienceMethods<'a, C, A> { // CallBuilders ### // ################# -/// Remove a person from a circle. -/// -/// A builder for the *removePeople* method supported by a *circle* resource. -/// It is not used directly, but through a `CircleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plusdomains1 as plusdomains1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plusdomains1::PlusDomains; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.circles().remove_people("circleId") -/// .add_user_id("amet.") -/// .add_email("erat") -/// .doit(); -/// # } -/// ``` -pub struct CircleRemovePeopleCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PlusDomains, - _circle_id: String, - _user_id: Vec, - _email: Vec, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CircleRemovePeopleCall<'a, C, A> {} - -impl<'a, C, A> CircleRemovePeopleCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plusDomains.circles.removePeople", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("circleId", self._circle_id.to_string())); - if self._user_id.len() > 0 { - for f in self._user_id.iter() { - params.push(("userId", f.to_string())); - } - } - if self._email.len() > 0 { - for f in self._email.iter() { - params.push(("email", f.to_string())); - } - } - for &field in ["circleId", "userId", "email"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = self.hub._base_url.clone() + "circles/{circleId}/people"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::PluCircleWrite.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{circleId}", "circleId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["circleId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the circle to remove the person from. - /// - /// Sets the *circle id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn circle_id(mut self, new_value: &str) -> CircleRemovePeopleCall<'a, C, A> { - self._circle_id = new_value.to_string(); - self - } - /// IDs of the people to remove from the circle. Optional, can be repeated. - /// - /// Append the given value to the *user id* query property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - pub fn add_user_id(mut self, new_value: &str) -> CircleRemovePeopleCall<'a, C, A> { - self._user_id.push(new_value.to_string()); - self - } - /// Email of the people to add to the circle. Optional, can be repeated. - /// - /// Append the given value to the *email* query property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - pub fn add_email(mut self, new_value: &str) -> CircleRemovePeopleCall<'a, C, A> { - self._email.push(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CircleRemovePeopleCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CircleRemovePeopleCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::PluCircleWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CircleRemovePeopleCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Create a new circle for the authenticated user. -/// -/// A builder for the *insert* method supported by a *circle* resource. -/// It is not used directly, but through a `CircleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plusdomains1 as plusdomains1; -/// use plusdomains1::Circle; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plusdomains1::PlusDomains; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Circle::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.circles().insert(req, "userId") -/// .doit(); -/// # } -/// ``` -pub struct CircleInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PlusDomains, - _request: Circle, - _user_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CircleInsertCall<'a, C, A> {} - -impl<'a, C, A> CircleInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Circle)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plusDomains.circles.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("userId", self._user_id.to_string())); - for &field in ["alt", "userId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "people/{userId}/circles"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::PluCircleWrite.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userId}", "userId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["userId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Circle) -> CircleInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the user to create the circle on behalf of. The value "me" can be used to indicate the authenticated user. - /// - /// Sets the *user id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_id(mut self, new_value: &str) -> CircleInsertCall<'a, C, A> { - self._user_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CircleInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CircleInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::PluCircleWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CircleInsertCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Add a person to a circle. Google+ limits certain circle operations, including the number of circle adds. Learn More. -/// -/// A builder for the *addPeople* method supported by a *circle* resource. -/// It is not used directly, but through a `CircleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plusdomains1 as plusdomains1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plusdomains1::PlusDomains; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.circles().add_people("circleId") -/// .add_user_id("nonumy") -/// .add_email("dolores") -/// .doit(); -/// # } -/// ``` -pub struct CircleAddPeopleCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PlusDomains, - _circle_id: String, - _user_id: Vec, - _email: Vec, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CircleAddPeopleCall<'a, C, A> {} - -impl<'a, C, A> CircleAddPeopleCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Circle)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plusDomains.circles.addPeople", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("circleId", self._circle_id.to_string())); - if self._user_id.len() > 0 { - for f in self._user_id.iter() { - params.push(("userId", f.to_string())); - } - } - if self._email.len() > 0 { - for f in self._email.iter() { - params.push(("email", f.to_string())); - } - } - for &field in ["alt", "circleId", "userId", "email"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "circles/{circleId}/people"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::PluCircleWrite.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{circleId}", "circleId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["circleId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the circle to add the person to. - /// - /// Sets the *circle id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn circle_id(mut self, new_value: &str) -> CircleAddPeopleCall<'a, C, A> { - self._circle_id = new_value.to_string(); - self - } - /// IDs of the people to add to the circle. Optional, can be repeated. - /// - /// Append the given value to the *user id* query property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - pub fn add_user_id(mut self, new_value: &str) -> CircleAddPeopleCall<'a, C, A> { - self._user_id.push(new_value.to_string()); - self - } - /// Email of the people to add to the circle. Optional, can be repeated. - /// - /// Append the given value to the *email* query property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - pub fn add_email(mut self, new_value: &str) -> CircleAddPeopleCall<'a, C, A> { - self._email.push(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CircleAddPeopleCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CircleAddPeopleCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::PluCircleWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CircleAddPeopleCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Get a circle. -/// -/// A builder for the *get* method supported by a *circle* resource. -/// It is not used directly, but through a `CircleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plusdomains1 as plusdomains1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plusdomains1::PlusDomains; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.circles().get("circleId") -/// .doit(); -/// # } -/// ``` -pub struct CircleGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PlusDomains, - _circle_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CircleGetCall<'a, C, A> {} - -impl<'a, C, A> CircleGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Circle)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plusDomains.circles.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("circleId", self._circle_id.to_string())); - for &field in ["alt", "circleId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "circles/{circleId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::PluCircleRead.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{circleId}", "circleId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["circleId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the circle to get. - /// - /// Sets the *circle id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn circle_id(mut self, new_value: &str) -> CircleGetCall<'a, C, A> { - self._circle_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CircleGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CircleGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::PluCircleRead`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CircleGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// List all of the circles for a user. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *list* method supported by a *circle* resource. /// It is not used directly, but through a `CircleMethods` instance. @@ -3659,8 +2415,8 @@ impl<'a, C, A> CircleGetCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.circles().list("userId") -/// .page_token("aliquyam") -/// .max_results(35) +/// .page_token("gubergren") +/// .max_results(6) /// .doit(); /// # } /// ``` @@ -3739,10 +2495,7 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3762,7 +2515,7 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3854,7 +2607,7 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3898,1073 +2651,7 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa } -/// Update a circle's description. -/// -/// A builder for the *update* method supported by a *circle* resource. -/// It is not used directly, but through a `CircleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plusdomains1 as plusdomains1; -/// use plusdomains1::Circle; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plusdomains1::PlusDomains; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Circle::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.circles().update(req, "circleId") -/// .doit(); -/// # } -/// ``` -pub struct CircleUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PlusDomains, - _request: Circle, - _circle_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CircleUpdateCall<'a, C, A> {} - -impl<'a, C, A> CircleUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Circle)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plusDomains.circles.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("circleId", self._circle_id.to_string())); - for &field in ["alt", "circleId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "circles/{circleId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::PluCircleWrite.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{circleId}", "circleId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["circleId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Circle) -> CircleUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the circle to update. - /// - /// Sets the *circle id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn circle_id(mut self, new_value: &str) -> CircleUpdateCall<'a, C, A> { - self._circle_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CircleUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CircleUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::PluCircleWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CircleUpdateCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Update a circle's description. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *circle* resource. -/// It is not used directly, but through a `CircleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plusdomains1 as plusdomains1; -/// use plusdomains1::Circle; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plusdomains1::PlusDomains; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Circle::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.circles().patch(req, "circleId") -/// .doit(); -/// # } -/// ``` -pub struct CirclePatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PlusDomains, - _request: Circle, - _circle_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CirclePatchCall<'a, C, A> {} - -impl<'a, C, A> CirclePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Circle)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plusDomains.circles.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("circleId", self._circle_id.to_string())); - for &field in ["alt", "circleId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "circles/{circleId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::PluCircleWrite.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{circleId}", "circleId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["circleId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Circle) -> CirclePatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the circle to update. - /// - /// Sets the *circle id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn circle_id(mut self, new_value: &str) -> CirclePatchCall<'a, C, A> { - self._circle_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CirclePatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CirclePatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::PluCircleWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CirclePatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Delete a circle. -/// -/// A builder for the *remove* method supported by a *circle* resource. -/// It is not used directly, but through a `CircleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plusdomains1 as plusdomains1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plusdomains1::PlusDomains; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.circles().remove("circleId") -/// .doit(); -/// # } -/// ``` -pub struct CircleRemoveCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PlusDomains, - _circle_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CircleRemoveCall<'a, C, A> {} - -impl<'a, C, A> CircleRemoveCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plusDomains.circles.remove", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(2 + self._additional_params.len()); - params.push(("circleId", self._circle_id.to_string())); - for &field in ["circleId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = self.hub._base_url.clone() + "circles/{circleId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::PluCircleWrite.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{circleId}", "circleId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["circleId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the circle to delete. - /// - /// Sets the *circle id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn circle_id(mut self, new_value: &str) -> CircleRemoveCall<'a, C, A> { - self._circle_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CircleRemoveCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CircleRemoveCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::PluCircleWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CircleRemoveCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Create a new activity for the authenticated user. -/// -/// A builder for the *insert* method supported by a *activity* resource. -/// It is not used directly, but through a `ActivityMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plusdomains1 as plusdomains1; -/// use plusdomains1::Activity; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plusdomains1::PlusDomains; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Activity::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.activities().insert(req, "userId") -/// .preview(true) -/// .doit(); -/// # } -/// ``` -pub struct ActivityInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PlusDomains, - _request: Activity, - _user_id: String, - _preview: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ActivityInsertCall<'a, C, A> {} - -impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Activity)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plusDomains.activities.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); - params.push(("userId", self._user_id.to_string())); - if let Some(value) = self._preview { - params.push(("preview", value.to_string())); - } - for &field in ["alt", "userId", "preview"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "people/{userId}/activities"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::PluLogin.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userId}", "userId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["userId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Activity) -> ActivityInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the user to create the activity on behalf of. Its value should be "me", to indicate the authenticated user. - /// - /// Sets the *user id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_id(mut self, new_value: &str) -> ActivityInsertCall<'a, C, A> { - self._user_id = new_value.to_string(); - self - } - /// If "true", extract the potential media attachments for a URL. The response will include all possible attachments for a URL, including video, photos, and articles based on the content of the page. - /// - /// Sets the *preview* query property to the given value. - pub fn preview(mut self, new_value: bool) -> ActivityInsertCall<'a, C, A> { - self._preview = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ActivityInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ActivityInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::PluLogin`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ActivityInsertCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Get an activity. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *get* method supported by a *activity* resource. /// It is not used directly, but through a `ActivityMethods` instance. @@ -5062,10 +2749,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5085,7 +2769,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5163,7 +2847,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5207,7 +2891,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o } -/// List all of the activities in the specified collection for a particular user. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *list* method supported by a *activity* resource. /// It is not used directly, but through a `ActivityMethods` instance. @@ -5235,8 +2919,8 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.activities().list("userId", "collection") -/// .page_token("et") -/// .max_results(31) +/// .page_token("justo") +/// .max_results(80) /// .doit(); /// # } /// ``` @@ -5317,10 +3001,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5340,7 +3021,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5442,7 +3123,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5486,7 +3167,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } -/// List all of the people who are members of a circle. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *listByCircle* method supported by a *people* resource. /// It is not used directly, but through a `PeopleMethods` instance. @@ -5514,8 +3195,8 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.people().list_by_circle("circleId") -/// .page_token("sea") -/// .max_results(46) +/// .page_token("et") +/// .max_results(60) /// .doit(); /// # } /// ``` @@ -5594,10 +3275,7 @@ impl<'a, C, A> PeopleListByCircleCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5617,7 +3295,7 @@ impl<'a, C, A> PeopleListByCircleCall<'a, C, A> where C: BorrowMut PeopleListByCircleCall<'a, C, A> where C: BorrowMut PeopleListByCircleCall<'a, C, A> where C: BorrowMut PeopleListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5891,7 +3566,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6000,7 +3675,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6142,10 +3817,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6165,7 +3837,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6243,7 +3915,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6287,7 +3959,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau } -/// List all of the people in the specified collection for a particular activity. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *listByActivity* method supported by a *people* resource. /// It is not used directly, but through a `PeopleMethods` instance. @@ -6315,8 +3987,8 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.people().list_by_activity("activityId", "collection") -/// .page_token("labore") -/// .max_results(62) +/// .page_token("erat") +/// .max_results(6) /// .doit(); /// # } /// ``` @@ -6397,10 +4069,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6420,7 +4089,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> where C: BorrowMut MediaInsertCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6745,7 +4411,7 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -6917,7 +4583,7 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6961,281 +4627,7 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o } -/// Create a new comment in reply to an activity. -/// -/// A builder for the *insert* method supported by a *comment* resource. -/// It is not used directly, but through a `CommentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plusdomains1 as plusdomains1; -/// use plusdomains1::Comment; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plusdomains1::PlusDomains; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = PlusDomains::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Comment::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.comments().insert(req, "activityId") -/// .doit(); -/// # } -/// ``` -pub struct CommentInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a PlusDomains, - _request: Comment, - _activity_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CommentInsertCall<'a, C, A> {} - -impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Comment)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plusDomains.comments.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("activityId", self._activity_id.to_string())); - for &field in ["alt", "activityId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "activities/{activityId}/comments"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::PluLogin.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{activityId}", "activityId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["activityId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Comment) -> CommentInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the activity to reply to. - /// - /// Sets the *activity id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn activity_id(mut self, new_value: &str) -> CommentInsertCall<'a, C, A> { - self._activity_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> CommentInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CommentInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::PluLogin`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> CommentInsertCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// List all of the comments for an activity. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *list* method supported by a *comment* resource. /// It is not used directly, but through a `CommentMethods` instance. @@ -7263,9 +4655,9 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.comments().list("activityId") -/// .sort_order("Lorem") -/// .page_token("sea") -/// .max_results(80) +/// .sort_order("amet") +/// .page_token("no") +/// .max_results(65) /// .doit(); /// # } /// ``` @@ -7348,10 +4740,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7371,7 +4760,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7470,7 +4859,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7514,7 +4903,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } -/// Get a comment. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *get* method supported by a *comment* resource. /// It is not used directly, but through a `CommentMethods` instance. @@ -7612,10 +5001,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7635,7 +5021,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7713,7 +5099,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7757,7 +5143,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// List all of the audiences to which a user can share. +/// Shut down. See https://developers.google.com/+/api-shutdown for more details. /// /// A builder for the *list* method supported by a *audience* resource. /// It is not used directly, but through a `AudienceMethods` instance. @@ -7785,8 +5171,8 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.audiences().list("userId") -/// .page_token("eirmod") -/// .max_results(43) +/// .page_token("invidunt") +/// .max_results(19) /// .doit(); /// # } /// ``` @@ -7865,10 +5251,7 @@ impl<'a, C, A> AudienceListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7888,7 +5271,7 @@ impl<'a, C, A> AudienceListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7980,7 +5363,7 @@ impl<'a, C, A> AudienceListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/prediction1d6/Cargo.toml b/gen/prediction1d6/Cargo.toml index 91f60b348e..0a62edab80 100644 --- a/gen/prediction1d6/Cargo.toml +++ b/gen/prediction1d6/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/prediction1d6/src/lib.rs b/gen/prediction1d6/src/lib.rs index f6cf0eff3d..3bbfee1b3d 100644 --- a/gen/prediction1d6/src/lib.rs +++ b/gen/prediction1d6/src/lib.rs @@ -1211,10 +1211,7 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1234,7 +1231,7 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1322,7 +1319,7 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1473,10 +1470,7 @@ impl<'a, C, A> TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1508,7 +1502,7 @@ impl<'a, C, A> TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut TrainedmodelListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1783,7 +1774,7 @@ impl<'a, C, A> TrainedmodelListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1875,7 +1866,7 @@ impl<'a, C, A> TrainedmodelListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2018,10 +2009,7 @@ impl<'a, C, A> TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2041,7 +2029,7 @@ impl<'a, C, A> TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut TrainedmodelInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2303,7 +2288,7 @@ impl<'a, C, A> TrainedmodelInsertCall<'a, C, A> where C: BorrowMut TrainedmodelInsertCall<'a, C, A> where C: BorrowMut TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2560,7 +2542,7 @@ impl<'a, C, A> TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut TrainedmodelPredictCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2834,7 +2813,7 @@ impl<'a, C, A> TrainedmodelPredictCall<'a, C, A> where C: BorrowMut TrainedmodelPredictCall<'a, C, A> where C: BorrowMut HostedmodelPredictCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3120,7 +3096,7 @@ impl<'a, C, A> HostedmodelPredictCall<'a, C, A> where C: BorrowMut HostedmodelPredictCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with proximitybeacon (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/proximitybeacon1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-proximitybeacon1_beta1] path = "../proximitybeacon1_beta1" -version = "1.0.8+20181008" +version = "1.0.8+20190323" diff --git a/gen/proximitybeacon1_beta1-cli/README.md b/gen/proximitybeacon1_beta1-cli/README.md index c0663e38d1..c91881be35 100644 --- a/gen/proximitybeacon1_beta1-cli/README.md +++ b/gen/proximitybeacon1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *proximitybeacon* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *proximitybeacon* API at revision *20190323*. The CLI is at version *1.0.8*. ```bash proximitybeacon1-beta1 [options] diff --git a/gen/proximitybeacon1_beta1-cli/mkdocs.yml b/gen/proximitybeacon1_beta1-cli/mkdocs.yml index b00e3f7444..34e1f3c896 100644 --- a/gen/proximitybeacon1_beta1-cli/mkdocs.yml +++ b/gen/proximitybeacon1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: proximitybeacon v1.0.8+20181008 +site_name: proximitybeacon v1.0.8+20190323 site_url: http://byron.github.io/google-apis-rs/google-proximitybeacon1_beta1-cli site_description: A complete library to interact with proximitybeacon (protocol v1beta1) diff --git a/gen/proximitybeacon1_beta1-cli/src/main.rs b/gen/proximitybeacon1_beta1-cli/src/main.rs index 024ef2d335..cec4189c25 100644 --- a/gen/proximitybeacon1_beta1-cli/src/main.rs +++ b/gen/proximitybeacon1_beta1-cli/src/main.rs @@ -267,9 +267,9 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "max-distance-meters" => Some(("maxDistanceMeters", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "attachment-name" => Some(("attachmentName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "creation-time-ms" => Some(("creationTimeMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creation-time-ms" => Some(("creationTimeMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "attachment-name" => Some(("attachmentName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "namespaced-type" => Some(("namespacedType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["attachment-name", "creation-time-ms", "data", "max-distance-meters", "namespaced-type"]); @@ -836,9 +836,9 @@ impl<'n> Engine<'n> { "place-id" => Some(("placeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ephemeral-id-registration.rotation-period-exponent" => Some(("ephemeralIdRegistration.rotationPeriodExponent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "ephemeral-id-registration.initial-clock-value" => Some(("ephemeralIdRegistration.initialClockValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ephemeral-id-registration.service-ecdh-public-key" => Some(("ephemeralIdRegistration.serviceEcdhPublicKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ephemeral-id-registration.initial-eid" => Some(("ephemeralIdRegistration.initialEid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ephemeral-id-registration.beacon-ecdh-public-key" => Some(("ephemeralIdRegistration.beaconEcdhPublicKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ephemeral-id-registration.initial-eid" => Some(("ephemeralIdRegistration.initialEid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ephemeral-id-registration.service-ecdh-public-key" => Some(("ephemeralIdRegistration.serviceEcdhPublicKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ephemeral-id-registration.beacon-identity-key" => Some(("ephemeralIdRegistration.beaconIdentityKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "advertised-id.type" => Some(("advertisedId.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "advertised-id.id" => Some(("advertisedId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -942,9 +942,9 @@ impl<'n> Engine<'n> { "place-id" => Some(("placeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ephemeral-id-registration.rotation-period-exponent" => Some(("ephemeralIdRegistration.rotationPeriodExponent", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "ephemeral-id-registration.initial-clock-value" => Some(("ephemeralIdRegistration.initialClockValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ephemeral-id-registration.service-ecdh-public-key" => Some(("ephemeralIdRegistration.serviceEcdhPublicKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "ephemeral-id-registration.initial-eid" => Some(("ephemeralIdRegistration.initialEid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ephemeral-id-registration.beacon-ecdh-public-key" => Some(("ephemeralIdRegistration.beaconEcdhPublicKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ephemeral-id-registration.initial-eid" => Some(("ephemeralIdRegistration.initialEid", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ephemeral-id-registration.service-ecdh-public-key" => Some(("ephemeralIdRegistration.serviceEcdhPublicKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ephemeral-id-registration.beacon-identity-key" => Some(("ephemeralIdRegistration.beaconIdentityKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "advertised-id.type" => Some(("advertisedId.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "advertised-id.id" => Some(("advertisedId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1961,7 +1961,7 @@ fn main() { let mut app = App::new("proximitybeacon1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190323") .about("Registers, manages, indexes, and searches beacons.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli") .arg(Arg::with_name("url") diff --git a/gen/proximitybeacon1_beta1/Cargo.toml b/gen/proximitybeacon1_beta1/Cargo.toml index ca0e46edd7..fb8aa95a1f 100644 --- a/gen/proximitybeacon1_beta1/Cargo.toml +++ b/gen/proximitybeacon1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-proximitybeacon1_beta1" -version = "1.0.8+20181008" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with proximitybeacon (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/proximitybeacon1_beta1" homepage = "https://developers.google.com/beacons/proximity/" -documentation = "https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008" +documentation = "https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323" license = "MIT" keywords = ["proximitybeacon", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/proximitybeacon1_beta1/README.md b/gen/proximitybeacon1_beta1/README.md index 208fcc405c..8be0288e66 100644 --- a/gen/proximitybeacon1_beta1/README.md +++ b/gen/proximitybeacon1_beta1/README.md @@ -5,24 +5,24 @@ DO NOT EDIT ! --> The `google-proximitybeacon1_beta1` library allows access to all features of the *Google proximitybeacon* service. -This documentation was generated from *proximitybeacon* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *proximitybeacon* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *proximitybeacon* *v1_beta1* API can be found at the [official documentation site](https://developers.google.com/beacons/proximity/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.Proximitybeacon.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.Proximitybeacon.html) ... * beaconinfo - * [*getforobserved*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconinfoGetforobservedCall.html) -* [beacons](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.Beacon.html) - * [*activate*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconActivateCall.html), [*attachments batch delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconAttachmentBatchDeleteCall.html), [*attachments create*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconAttachmentCreateCall.html), [*attachments delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconAttachmentDeleteCall.html), [*attachments list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconAttachmentListCall.html), [*deactivate*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconDeactivateCall.html), [*decommission*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconDecommissionCall.html), [*delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconDeleteCall.html), [*diagnostics list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconDiagnosticListCall.html), [*get*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconGetCall.html), [*list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconListCall.html), [*register*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconRegisterCall.html) and [*update*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.BeaconUpdateCall.html) -* [namespaces](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.Namespace.html) - * [*list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.NamespaceListCall.html) and [*update*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.NamespaceUpdateCall.html) + * [*getforobserved*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconinfoGetforobservedCall.html) +* [beacons](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.Beacon.html) + * [*activate*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconActivateCall.html), [*attachments batch delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconAttachmentBatchDeleteCall.html), [*attachments create*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconAttachmentCreateCall.html), [*attachments delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconAttachmentDeleteCall.html), [*attachments list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconAttachmentListCall.html), [*deactivate*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconDeactivateCall.html), [*decommission*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconDecommissionCall.html), [*delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconDeleteCall.html), [*diagnostics list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconDiagnosticListCall.html), [*get*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconGetCall.html), [*list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconListCall.html), [*register*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconRegisterCall.html) and [*update*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.BeaconUpdateCall.html) +* [namespaces](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.Namespace.html) + * [*list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.NamespaceListCall.html) and [*update*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.NamespaceUpdateCall.html) Other activities are ... -* [get eidparams](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.MethodGetEidparamCall.html) +* [get eidparams](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.MethodGetEidparamCall.html) @@ -30,17 +30,17 @@ Other activities are ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/struct.Proximitybeacon.html)** +* **[Hub](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/struct.Proximitybeacon.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -147,17 +147,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -167,29 +167,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20181008/google_proximitybeacon1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-proximitybeacon1_beta1/1.0.8+20190323/google_proximitybeacon1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/proximitybeacon1_beta1/src/lib.rs b/gen/proximitybeacon1_beta1/src/lib.rs index d6c7803268..88ce16a38b 100644 --- a/gen/proximitybeacon1_beta1/src/lib.rs +++ b/gen/proximitybeacon1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *proximitybeacon* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *proximitybeacon* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *proximitybeacon* *v1_beta1* API can be found at the //! [official documentation site](https://developers.google.com/beacons/proximity/). @@ -424,20 +424,20 @@ pub struct BeaconAttachment { /// Negative values are invalid and return an error. #[serde(rename="maxDistanceMeters")] pub max_distance_meters: Option, - /// An opaque data container for client-provided data. Must be - /// [base64](http://tools.ietf.org/html/rfc4648#section-4) encoded in HTTP - /// requests, and will be so encoded (with padding) in responses. - /// Required. - pub data: Option, - /// The UTC time when this attachment was created, in milliseconds since the - /// UNIX epoch. - #[serde(rename="creationTimeMs")] - pub creation_time_ms: Option, /// Resource name of this attachment. Attachment names have the format: /// beacons/beacon_id/attachments/attachment_id. /// Leave this empty on creation. #[serde(rename="attachmentName")] pub attachment_name: Option, + /// The UTC time when this attachment was created, in milliseconds since the + /// UNIX epoch. + #[serde(rename="creationTimeMs")] + pub creation_time_ms: Option, + /// An opaque data container for client-provided data. Must be + /// [base64](http://tools.ietf.org/html/rfc4648#section-4) encoded in HTTP + /// requests, and will be so encoded (with padding) in responses. + /// Required. + pub data: Option, /// Specifies what kind of attachment this is. Tells a client how to /// interpret the `data` field. Format is namespace/type. Namespace /// provides type separation between clients. Type describes the type of @@ -502,12 +502,12 @@ impl Part for IndoorLevel {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListBeaconsResponse { + /// The beacons that matched the search criteria. + pub beacons: Option>, /// An opaque pagination token that the client may provide in their next /// request to retrieve the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The beacons that matched the search criteria. - pub beacons: Option>, /// Estimate of the total number of beacons matched by the query. Higher /// values may be less accurate. #[serde(rename="totalCount")] @@ -529,9 +529,6 @@ impl ResponseResult for ListBeaconsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GetInfoForObservedBeaconsRequest { - /// The beacons that the client has encountered. - /// At least one must be given. - pub observations: Option>, /// Specifies what kind of attachments to include in the response. /// When given, the response will include only attachments of the given types. /// When empty, no attachments will be returned. Must be in the format @@ -540,6 +537,9 @@ pub struct GetInfoForObservedBeaconsRequest { /// Optional. #[serde(rename="namespacedTypes")] pub namespaced_types: Option>, + /// The beacons that the client has encountered. + /// At least one must be given. + pub observations: Option>, } impl RequestValue for GetInfoForObservedBeaconsRequest {} @@ -653,7 +653,9 @@ impl Part for AdvertisedId {} /// bluetooth client) handle the identity key, and obviously on how /// securely the identity key was generated. /// -/// See [the Eddystone specification](https://github.com/google/eddystone/tree/master/eddystone-eid) at GitHub. +/// See [the Eddystone +/// specification](https://github.com/google/eddystone/tree/master/eddystone-eid) +/// at GitHub. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -668,17 +670,18 @@ pub struct EphemeralIdRegistration { pub initial_eid: Option, /// Indicates the nominal period between each rotation of the beacon's /// ephemeral ID. "Nominal" because the beacon should randomize the - /// actual interval. See [the spec at github](https://github.com/google/eddystone/tree/master/eddystone-eid) + /// actual interval. See [the spec at + /// github](https://github.com/google/eddystone/tree/master/eddystone-eid) /// for details. This value corresponds to a power-of-two scaler on the /// beacon's clock: when the scaler value is K, the beacon will begin /// broadcasting a new ephemeral ID on average every 2^K seconds. #[serde(rename="rotationPeriodExponent")] pub rotation_period_exponent: Option, - /// The service's public key used for the Elliptic curve Diffie-Hellman - /// key exchange. When this field is populated, `beacon_ecdh_public_key` + /// The beacon's public key used for the Elliptic curve Diffie-Hellman + /// key exchange. When this field is populated, `service_ecdh_public_key` /// must also be populated, and `beacon_identity_key` must not be. - #[serde(rename="serviceEcdhPublicKey")] - pub service_ecdh_public_key: Option, + #[serde(rename="beaconEcdhPublicKey")] + pub beacon_ecdh_public_key: Option, /// The initial clock value of the beacon. The beacon's clock must have /// begun counting at this value immediately prior to transmitting this /// value to the resolving service. Significant delay in transmitting this @@ -686,11 +689,11 @@ pub struct EphemeralIdRegistration { /// value is not provided, the default is zero. #[serde(rename="initialClockValue")] pub initial_clock_value: Option, - /// The beacon's public key used for the Elliptic curve Diffie-Hellman - /// key exchange. When this field is populated, `service_ecdh_public_key` + /// The service's public key used for the Elliptic curve Diffie-Hellman + /// key exchange. When this field is populated, `beacon_ecdh_public_key` /// must also be populated, and `beacon_identity_key` must not be. - #[serde(rename="beaconEcdhPublicKey")] - pub beacon_ecdh_public_key: Option, + #[serde(rename="serviceEcdhPublicKey")] + pub service_ecdh_public_key: Option, /// The private key of the beacon. If this field is populated, /// `beacon_ecdh_public_key` and `service_ecdh_public_key` must not be /// populated. @@ -1013,16 +1016,16 @@ impl ResponseResult for ListDiagnosticsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Date { - /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without - /// a year. - pub year: Option, + /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a + /// month and day. + pub month: Option, /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0 /// if specifying a year by itself or a year and month where the day is not /// significant. pub day: Option, - /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a - /// month and day. - pub month: Option, + /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without + /// a year. + pub year: Option, } impl Part for Date {} @@ -1816,7 +1819,7 @@ impl<'a, C, A> BeaconAttachmentListCall<'a, C, A> where C: BorrowMut BeaconAttachmentListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1855,7 +1855,7 @@ impl<'a, C, A> BeaconAttachmentListCall<'a, C, A> where C: BorrowMut BeaconAttachmentListCall<'a, C, A> where C: BorrowMut BeaconAttachmentListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BeaconAttachmentListCall<'a, C, A> @@ -2109,7 +2109,7 @@ impl<'a, C, A> BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2125,10 +2125,7 @@ impl<'a, C, A> BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2148,7 +2145,7 @@ impl<'a, C, A> BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2242,7 +2239,7 @@ impl<'a, C, A> BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2250,12 +2247,12 @@ impl<'a, C, A> BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> BeaconGetCall<'a, C, A> @@ -2403,7 +2400,7 @@ impl<'a, C, A> BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2454,7 +2448,7 @@ impl<'a, C, A> BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BeaconAttachmentCreateCall<'a, C, A> @@ -2706,7 +2700,7 @@ impl<'a, C, A> BeaconDecommissionCall<'a, C, A> where C: BorrowMut BeaconDecommissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2745,7 +2736,7 @@ impl<'a, C, A> BeaconDecommissionCall<'a, C, A> where C: BorrowMut BeaconDecommissionCall<'a, C, A> where C: BorrowMut BeaconDecommissionCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BeaconDecommissionCall<'a, C, A> @@ -2985,7 +2976,7 @@ impl<'a, C, A> BeaconActivateCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3001,10 +2992,7 @@ impl<'a, C, A> BeaconActivateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3024,7 +3012,7 @@ impl<'a, C, A> BeaconActivateCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3118,7 +3106,7 @@ impl<'a, C, A> BeaconActivateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3126,12 +3114,12 @@ impl<'a, C, A> BeaconActivateCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> BeaconActivateCall<'a, C, A> @@ -3267,10 +3255,7 @@ impl<'a, C, A> BeaconListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3290,7 +3275,7 @@ impl<'a, C, A> BeaconListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3455,7 +3440,7 @@ impl<'a, C, A> BeaconListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3463,12 +3448,12 @@ impl<'a, C, A> BeaconListCall<'a, C, A> where C: BorrowMut, A: oa /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> BeaconListCall<'a, C, A> @@ -3611,7 +3596,7 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3627,10 +3612,7 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3662,7 +3644,7 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3768,7 +3750,7 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3776,12 +3758,12 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> BeaconUpdateCall<'a, C, A> @@ -3915,7 +3897,7 @@ impl<'a, C, A> BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3954,7 +3933,7 @@ impl<'a, C, A> BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BeaconAttachmentDeleteCall<'a, C, A> @@ -4192,7 +4171,7 @@ impl<'a, C, A> BeaconDeactivateCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4208,10 +4187,7 @@ impl<'a, C, A> BeaconDeactivateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4231,7 +4207,7 @@ impl<'a, C, A> BeaconDeactivateCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4325,7 +4301,7 @@ impl<'a, C, A> BeaconDeactivateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4333,12 +4309,12 @@ impl<'a, C, A> BeaconDeactivateCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> BeaconDeactivateCall<'a, C, A> @@ -4465,10 +4441,7 @@ impl<'a, C, A> BeaconRegisterCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4500,7 +4473,7 @@ impl<'a, C, A> BeaconRegisterCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4590,7 +4563,7 @@ impl<'a, C, A> BeaconRegisterCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4598,12 +4571,12 @@ impl<'a, C, A> BeaconRegisterCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> BeaconRegisterCall<'a, C, A> @@ -4735,7 +4708,7 @@ impl<'a, C, A> BeaconDeleteCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4751,10 +4724,7 @@ impl<'a, C, A> BeaconDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4774,7 +4744,7 @@ impl<'a, C, A> BeaconDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4867,7 +4837,7 @@ impl<'a, C, A> BeaconDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4875,12 +4845,12 @@ impl<'a, C, A> BeaconDeleteCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> BeaconDeleteCall<'a, C, A> @@ -5027,7 +4997,7 @@ impl<'a, C, A> BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5066,7 +5033,7 @@ impl<'a, C, A> BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BeaconDiagnosticListCall<'a, C, A> @@ -5331,7 +5298,7 @@ impl<'a, C, A> BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5370,7 +5334,7 @@ impl<'a, C, A> BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BeaconAttachmentBatchDeleteCall<'a, C, A> @@ -5617,10 +5581,7 @@ impl<'a, C, A> BeaconinfoGetforobservedCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5639,7 +5600,7 @@ impl<'a, C, A> BeaconinfoGetforobservedCall<'a, C, A> where C: BorrowMut BeaconinfoGetforobservedCall<'a, C, A> where C: BorrowMut BeaconinfoGetforobservedCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> BeaconinfoGetforobservedCall<'a, C, A> @@ -5824,10 +5785,7 @@ impl<'a, C, A> MethodGetEidparamCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5847,7 +5805,7 @@ impl<'a, C, A> MethodGetEidparamCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5915,7 +5873,7 @@ impl<'a, C, A> MethodGetEidparamCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5923,12 +5881,12 @@ impl<'a, C, A> MethodGetEidparamCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> MethodGetEidparamCall<'a, C, A> @@ -6049,10 +6007,7 @@ impl<'a, C, A> NamespaceListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6072,7 +6027,7 @@ impl<'a, C, A> NamespaceListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6148,7 +6103,7 @@ impl<'a, C, A> NamespaceListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6156,12 +6111,12 @@ impl<'a, C, A> NamespaceListCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> NamespaceListCall<'a, C, A> @@ -6295,7 +6250,7 @@ impl<'a, C, A> NamespaceUpdateCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6311,10 +6266,7 @@ impl<'a, C, A> NamespaceUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6346,7 +6298,7 @@ impl<'a, C, A> NamespaceUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6447,7 +6399,7 @@ impl<'a, C, A> NamespaceUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6455,12 +6407,12 @@ impl<'a, C, A> NamespaceUpdateCall<'a, C, A> where C: BorrowMut, /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> NamespaceUpdateCall<'a, C, A> diff --git a/gen/pubsub1-cli/Cargo.toml b/gen/pubsub1-cli/Cargo.toml index 20b84e1395..df2ff27d4c 100644 --- a/gen/pubsub1-cli/Cargo.toml +++ b/gen/pubsub1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1-cli" -version = "1.0.8+20181001" +version = "1.0.8+20190314" authors = ["Sebastian Thiel "] description = "A complete library to interact with Pubsub (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-pubsub1] path = "../pubsub1" -version = "1.0.8+20181001" +version = "1.0.8+20190314" diff --git a/gen/pubsub1-cli/README.md b/gen/pubsub1-cli/README.md index 5b73d27c69..53d9f754a1 100644 --- a/gen/pubsub1-cli/README.md +++ b/gen/pubsub1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Pubsub* API at revision *20181001*. The CLI is at version *1.0.8*. +This documentation was generated from the *Pubsub* API at revision *20190314*. The CLI is at version *1.0.8*. ```bash pubsub1 [options] diff --git a/gen/pubsub1-cli/mkdocs.yml b/gen/pubsub1-cli/mkdocs.yml index ff12936a69..a9f89a3ecc 100644 --- a/gen/pubsub1-cli/mkdocs.yml +++ b/gen/pubsub1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Pubsub v1.0.8+20181001 +site_name: Pubsub v1.0.8+20190314 site_url: http://byron.github.io/google-apis-rs/google-pubsub1-cli site_description: A complete library to interact with Pubsub (protocol v1) diff --git a/gen/pubsub1-cli/src/main.rs b/gen/pubsub1-cli/src/main.rs index 8b8f5f9763..9017d1249c 100644 --- a/gen/pubsub1-cli/src/main.rs +++ b/gen/pubsub1-cli/src/main.rs @@ -719,12 +719,15 @@ impl<'n> Engine<'n> { "ack-deadline-seconds" => Some(("ackDeadlineSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "push-config.attributes" => Some(("pushConfig.attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "push-config.oidc-token.audience" => Some(("pushConfig.oidcToken.audience", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "push-config.oidc-token.service-account-email" => Some(("pushConfig.oidcToken.serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "push-config.push-endpoint" => Some(("pushConfig.pushEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "topic" => Some(("topic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "message-retention-duration" => Some(("messageRetentionDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "retain-acked-messages" => Some(("retainAckedMessages", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "expiration-policy.ttl" => Some(("expirationPolicy.ttl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["ack-deadline-seconds", "attributes", "labels", "message-retention-duration", "name", "push-config", "push-endpoint", "retain-acked-messages", "topic"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["ack-deadline-seconds", "attributes", "audience", "expiration-policy", "labels", "message-retention-duration", "name", "oidc-token", "push-config", "push-endpoint", "retain-acked-messages", "service-account-email", "topic", "ttl"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1109,9 +1112,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "push-config.attributes" => Some(("pushConfig.attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "push-config.oidc-token.audience" => Some(("pushConfig.oidcToken.audience", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "push-config.oidc-token.service-account-email" => Some(("pushConfig.oidcToken.serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "push-config.push-endpoint" => Some(("pushConfig.pushEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["attributes", "push-config", "push-endpoint"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["attributes", "audience", "oidc-token", "push-config", "push-endpoint", "service-account-email"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1199,12 +1204,15 @@ impl<'n> Engine<'n> { "subscription.ack-deadline-seconds" => Some(("subscription.ackDeadlineSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "subscription.labels" => Some(("subscription.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "subscription.push-config.attributes" => Some(("subscription.pushConfig.attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "subscription.push-config.oidc-token.audience" => Some(("subscription.pushConfig.oidcToken.audience", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subscription.push-config.oidc-token.service-account-email" => Some(("subscription.pushConfig.oidcToken.serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subscription.push-config.push-endpoint" => Some(("subscription.pushConfig.pushEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subscription.topic" => Some(("subscription.topic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subscription.message-retention-duration" => Some(("subscription.messageRetentionDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subscription.retain-acked-messages" => Some(("subscription.retainAckedMessages", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "subscription.expiration-policy.ttl" => Some(("subscription.expirationPolicy.ttl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["ack-deadline-seconds", "attributes", "labels", "message-retention-duration", "name", "push-config", "push-endpoint", "retain-acked-messages", "subscription", "topic", "update-mask"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["ack-deadline-seconds", "attributes", "audience", "expiration-policy", "labels", "message-retention-duration", "name", "oidc-token", "push-config", "push-endpoint", "retain-acked-messages", "service-account-email", "subscription", "topic", "ttl", "update-mask"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2565,25 +2573,22 @@ fn main() { ("projects", "methods: 'snapshots-create', 'snapshots-delete', 'snapshots-get', 'snapshots-get-iam-policy', 'snapshots-list', 'snapshots-patch', 'snapshots-set-iam-policy', 'snapshots-test-iam-permissions', 'subscriptions-acknowledge', 'subscriptions-create', 'subscriptions-delete', 'subscriptions-get', 'subscriptions-get-iam-policy', 'subscriptions-list', 'subscriptions-modify-ack-deadline', 'subscriptions-modify-push-config', 'subscriptions-patch', 'subscriptions-pull', 'subscriptions-seek', 'subscriptions-set-iam-policy', 'subscriptions-test-iam-permissions', 'topics-create', 'topics-delete', 'topics-get', 'topics-get-iam-policy', 'topics-list', 'topics-patch', 'topics-publish', 'topics-set-iam-policy', 'topics-snapshots-list', 'topics-subscriptions-list' and 'topics-test-iam-permissions'", vec![ ("snapshots-create", Some(r##"Creates a snapshot from the requested subscription. Snapshots are used in - Seek operations, which allow + Seek + operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. -

- BETA: This feature is part of a beta release. This API might be - changed in backward-incompatible ways and is not recommended for production - use. It is not subject to any SLA or deprecation policy.

- If the snapshot already exists, returns `ALREADY_EXISTS`. +

If the snapshot already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the `Snapshot.expire_time` field. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription, conforming - to the [resource name format](https://cloud.google.com/pubsub/docs/overview#names). - The generated - name is populated in the returned Snapshot object. Note that for REST API - requests, you must specify a name in the request."##), + to the + [resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names). + The generated name is populated in the returned Snapshot object. Note that + for REST API requests, you must specify a name in the request."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_snapshots-create", vec![ (Some(r##"name"##), @@ -2592,7 +2597,8 @@ fn main() { If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the - resource name rules. + + resource name rules. Format is `projects/{project}/snapshots/{snap}`."##), Some(true), Some(false)), @@ -2617,13 +2623,11 @@ fn main() { ]), ("snapshots-delete", Some(r##"Removes an existing snapshot. Snapshots are used in - Seek operations, which allow + Seek + operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

- BETA: This feature is part of a beta release. This API might be - changed in backward-incompatible ways and is not recommended for production - use. It is not subject to any SLA or deprecation policy. When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old @@ -2651,13 +2655,10 @@ fn main() { ]), ("snapshots-get", Some(r##"Gets the configuration details of a snapshot. Snapshots are used in - Seek operations, which allow - you to manage message acknowledgments in bulk. That is, you can set the - acknowledgment state of messages in an existing subscription to the state - captured by a snapshot.

- BETA: This feature is part of a beta release. This API might be - changed in backward-incompatible ways and is not recommended for production - use. It is not subject to any SLA or deprecation policy."##), + Seek + operations, which allow you to manage message acknowledgments in bulk. That + is, you can set the acknowledgment state of messages in an existing + subscription to the state captured by a snapshot."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_snapshots-get", vec![ (Some(r##"snapshot"##), @@ -2706,13 +2707,11 @@ fn main() { ]), ("snapshots-list", Some(r##"Lists the existing snapshots. Snapshots are used in - Seek operations, which allow + Seek + operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state - captured by a snapshot.

- BETA: This feature is part of a beta release. This API might be - changed in backward-incompatible ways and is not recommended for production - use. It is not subject to any SLA or deprecation policy."##), + captured by a snapshot."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_snapshots-list", vec![ (Some(r##"project"##), @@ -2736,14 +2735,11 @@ fn main() { ]), ("snapshots-patch", Some(r##"Updates an existing snapshot. Snapshots are used in - Seek operations, which allow + Seek + operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state - captured by a snapshot.

- BETA: This feature is part of a beta release. This API might be - changed in backward-incompatible ways and is not recommended for production - use. It is not subject to any SLA or deprecation policy. - Note that certain properties of a snapshot are not modifiable."##), + captured by a snapshot."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_snapshots-patch", vec![ (Some(r##"name"##), @@ -2872,14 +2868,15 @@ fn main() { ]), ("subscriptions-create", Some(r##"Creates a subscription to a given topic. See the - resource name rules. + + resource name rules. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the - [resource name format](https://cloud.google.com/pubsub/docs/overview#names). + [resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-create", @@ -3146,14 +3143,12 @@ fn main() { ("subscriptions-seek", Some(r##"Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided in the request. Snapshots are used in - Seek operations, which allow + Seek + operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. Note that both the subscription and the snapshot - must be on the same topic.

- BETA: This feature is part of a beta release. This API might be - changed in backward-incompatible ways and is not recommended for production - use. It is not subject to any SLA or deprecation policy."##), + must be on the same topic."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-seek", vec![ (Some(r##"subscription"##), @@ -3247,7 +3242,8 @@ fn main() { ]), ("topics-create", Some(r##"Creates the given topic with the given name. See the - resource name rules."##), + + resource name rules."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-create", vec![ (Some(r##"name"##), @@ -3473,13 +3469,11 @@ fn main() { ]), ("topics-snapshots-list", Some(r##"Lists the names of the snapshots on this topic. Snapshots are used in - Seek operations, which allow + Seek + operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state - captured by a snapshot.

- BETA: This feature is part of a beta release. This API might be - changed in backward-incompatible ways and is not recommended for production - use. It is not subject to any SLA or deprecation policy."##), + captured by a snapshot."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-snapshots-list", vec![ (Some(r##"topic"##), @@ -3565,7 +3559,7 @@ fn main() { let mut app = App::new("pubsub1") .author("Sebastian Thiel ") - .version("1.0.8+20181001") + .version("1.0.8+20190314") .about("Provides reliable, many-to-many, asynchronous messaging between applications. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pubsub1_cli") diff --git a/gen/pubsub1/Cargo.toml b/gen/pubsub1/Cargo.toml index ede26ae561..4e0b4123fe 100644 --- a/gen/pubsub1/Cargo.toml +++ b/gen/pubsub1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-pubsub1" -version = "1.0.8+20181001" +version = "1.0.8+20190314" authors = ["Sebastian Thiel "] description = "A complete library to interact with Pubsub (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1" homepage = "https://cloud.google.com/pubsub/docs" -documentation = "https://docs.rs/google-pubsub1/1.0.8+20181001" +documentation = "https://docs.rs/google-pubsub1/1.0.8+20190314" license = "MIT" keywords = ["pubsub", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/pubsub1/README.md b/gen/pubsub1/README.md index e270839e3b..b0ac45894c 100644 --- a/gen/pubsub1/README.md +++ b/gen/pubsub1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-pubsub1` library allows access to all features of the *Google Pubsub* service. -This documentation was generated from *Pubsub* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Pubsub* crate version *1.0.8+20190314*, where *20190314* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Pubsub* *v1* API can be found at the [official documentation site](https://cloud.google.com/pubsub/docs). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.Pubsub.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.Pubsub.html) ... * projects - * [*snapshots create*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSnapshotCreateCall.html), [*snapshots delete*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSnapshotDeleteCall.html), [*snapshots get*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSnapshotGetCall.html), [*snapshots get iam policy*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSnapshotGetIamPolicyCall.html), [*snapshots list*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSnapshotListCall.html), [*snapshots patch*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSnapshotPatchCall.html), [*snapshots set iam policy*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSnapshotSetIamPolicyCall.html), [*snapshots test iam permissions*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSnapshotTestIamPermissionCall.html), [*subscriptions acknowledge*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions patch*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionPatchCall.html), [*subscriptions pull*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionPullCall.html), [*subscriptions seek*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionSeekCall.html), [*subscriptions set iam policy*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicCreateCall.html), [*topics delete*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicDeleteCall.html), [*topics get*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicGetCall.html), [*topics get iam policy*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicListCall.html), [*topics patch*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicPatchCall.html), [*topics publish*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicPublishCall.html), [*topics set iam policy*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicSetIamPolicyCall.html), [*topics snapshots list*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicSnapshotListCall.html), [*topics subscriptions list*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.ProjectTopicTestIamPermissionCall.html) + * [*snapshots create*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSnapshotCreateCall.html), [*snapshots delete*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSnapshotDeleteCall.html), [*snapshots get*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSnapshotGetCall.html), [*snapshots get iam policy*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSnapshotGetIamPolicyCall.html), [*snapshots list*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSnapshotListCall.html), [*snapshots patch*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSnapshotPatchCall.html), [*snapshots set iam policy*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSnapshotSetIamPolicyCall.html), [*snapshots test iam permissions*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSnapshotTestIamPermissionCall.html), [*subscriptions acknowledge*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions patch*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionPatchCall.html), [*subscriptions pull*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionPullCall.html), [*subscriptions seek*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionSeekCall.html), [*subscriptions set iam policy*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicCreateCall.html), [*topics delete*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicDeleteCall.html), [*topics get*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicGetCall.html), [*topics get iam policy*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicListCall.html), [*topics patch*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicPatchCall.html), [*topics publish*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicPublishCall.html), [*topics set iam policy*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicSetIamPolicyCall.html), [*topics snapshots list*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicSnapshotListCall.html), [*topics subscriptions list*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.ProjectTopicTestIamPermissionCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/struct.Pubsub.html)** +* **[Hub](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/struct.Pubsub.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.Part.html)** + * **[Parts](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -135,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -155,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-pubsub1/1.0.8+20181001/google_pubsub1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-pubsub1/1.0.8+20190314/google_pubsub1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/pubsub1/src/lib.rs b/gen/pubsub1/src/lib.rs index 54a1927101..6f08754482 100644 --- a/gen/pubsub1/src/lib.rs +++ b/gen/pubsub1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Pubsub* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Pubsub* crate version *1.0.8+20190314*, where *20190314* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Pubsub* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/pubsub/docs). @@ -379,42 +379,30 @@ impl<'a, C, A> Pubsub // ############ // SCHEMAS ### // ########## -/// Response for the `Seek` method (this response is empty). +/// Request for the `Pull` method. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [subscriptions seek projects](struct.ProjectSubscriptionSeekCall.html) (response) +/// * [subscriptions pull projects](struct.ProjectSubscriptionPullCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SeekResponse { _never_set: Option } - -impl ResponseResult for SeekResponse {} - - -/// Request message for `TestIamPermissions` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [subscriptions test iam permissions projects](struct.ProjectSubscriptionTestIamPermissionCall.html) (request) -/// * [topics test iam permissions projects](struct.ProjectTopicTestIamPermissionCall.html) (request) -/// * [snapshots test iam permissions projects](struct.ProjectSnapshotTestIamPermissionCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TestIamPermissionsRequest { - /// The set of permissions to check for the `resource`. Permissions with - /// wildcards (such as '*' or 'storage.*') are not allowed. For more - /// information see - /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - pub permissions: Option>, +pub struct PullRequest { + /// If this field set to true, the system will respond immediately even if + /// it there are no messages available to return in the `Pull` response. + /// Otherwise, the system may wait (for a bounded amount of time) until at + /// least one message is available, rather than returning no messages. + #[serde(rename="returnImmediately")] + pub return_immediately: Option, + /// The maximum number of messages returned for this request. The Pub/Sub + /// system may return fewer than the number specified. + #[serde(rename="maxMessages")] + pub max_messages: Option, } -impl RequestValue for TestIamPermissionsRequest {} +impl RequestValue for PullRequest {} /// Response for the `ListTopicSubscriptions` method. @@ -479,27 +467,6 @@ pub struct ReceivedMessage { impl Part for ReceivedMessage {} -/// Response for the `Publish` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [topics publish projects](struct.ProjectTopicPublishCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PublishResponse { - /// The server-assigned ID of each published message, in the same order as - /// the messages in the request. IDs are guaranteed to be unique within - /// the topic. - #[serde(rename="messageIds")] - pub message_ids: Option>, -} - -impl ResponseResult for PublishResponse {} - - /// Request for the Acknowledge method. /// /// # Activities @@ -534,8 +501,9 @@ pub struct ModifyAckDeadlineRequest { /// The new ack deadline with respect to the time this request was sent to /// the Pub/Sub system. For example, if the value is 10, the new /// ack deadline will expire 10 seconds after the `ModifyAckDeadline` call - /// was made. Specifying zero may immediately make the message available for - /// another pull request. + /// was made. Specifying zero might immediately make the message available for + /// delivery to another subscriber client. This typically results in an + /// increase in the rate of message redeliveries (that is, duplicates). /// The minimum deadline you can specify is 0 seconds. /// The maximum deadline you can specify is 600 seconds (10 minutes). #[serde(rename="ackDeadlineSeconds")] @@ -548,6 +516,78 @@ pub struct ModifyAckDeadlineRequest { impl RequestValue for ModifyAckDeadlineRequest {} +/// Request for the `Seek` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [subscriptions seek projects](struct.ProjectSubscriptionSeekCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SeekRequest { + /// The snapshot to seek to. The snapshot's topic must be the same as that of + /// the provided subscription. + /// Format is `projects/{project}/snapshots/{snap}`. + pub snapshot: Option, + /// The time to seek to. + /// Messages retained in the subscription that were published before this + /// time are marked as acknowledged, and messages retained in the + /// subscription that were published after this time are marked as + /// unacknowledged. Note that this operation affects only those messages + /// retained in the subscription (configured by the combination of + /// `message_retention_duration` and `retain_acked_messages`). For example, + /// if `time` corresponds to a point before the message retention + /// window (or to a point before the system's notion of the subscription + /// creation time), only retained messages will be marked as unacknowledged, + /// and already-expunged messages will not be restored. + pub time: Option, +} + +impl RequestValue for SeekRequest {} + + +/// Request for the Publish method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [topics publish projects](struct.ProjectTopicPublishCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PublishRequest { + /// The messages to publish. + pub messages: Option>, +} + +impl RequestValue for PublishRequest {} + + +/// Response for the `ListSnapshots` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [snapshots list projects](struct.ProjectSnapshotListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListSnapshotsResponse { + /// If not empty, indicates that there may be more snapshot that match the + /// request; this value should be passed in a new `ListSnapshotsRequest`. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The resulting snapshots. + pub snapshots: Option>, +} + +impl ResponseResult for ListSnapshotsResponse {} + + /// Defines an Identity and Access Management (IAM) policy. It is used to /// specify access control policies for Cloud Platform resources. /// @@ -629,152 +669,6 @@ pub struct Policy { impl ResponseResult for Policy {} -/// Request for the Publish method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [topics publish projects](struct.ProjectTopicPublishCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PublishRequest { - /// The messages to publish. - pub messages: Option>, -} - -impl RequestValue for PublishRequest {} - - -/// A snapshot resource. Snapshots are used in -/// Seek operations, which allow -/// you to manage message acknowledgments in bulk. That is, you can set the -/// acknowledgment state of messages in an existing subscription to the state -/// captured by a snapshot.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [snapshots get projects](struct.ProjectSnapshotGetCall.html) (response) -/// * [snapshots create projects](struct.ProjectSnapshotCreateCall.html) (response) -/// * [snapshots patch projects](struct.ProjectSnapshotPatchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Snapshot { - /// The snapshot is guaranteed to exist up until this time. - /// A newly-created snapshot expires no later than 7 days from the time of its - /// creation. Its exact lifetime is determined at creation by the existing - /// backlog in the source subscription. Specifically, the lifetime of the - /// snapshot is `7 days - (age of oldest unacked message in the subscription)`. - /// For example, consider a subscription whose oldest unacked message is 3 days - /// old. If a snapshot is created from this subscription, the snapshot -- which - /// will always capture this 3-day-old backlog as long as the snapshot - /// exists -- will expire in 4 days. The service will refuse to create a - /// snapshot that would expire in less than 1 hour after creation. - #[serde(rename="expireTime")] - pub expire_time: Option, - /// The name of the topic from which this snapshot is retaining messages. - pub topic: Option, - /// See Creating and managing labels. - pub labels: Option>, - /// The name of the snapshot. - pub name: Option, -} - -impl ResponseResult for Snapshot {} - - -/// Response for the `ListSnapshots` method.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [snapshots list projects](struct.ProjectSnapshotListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListSnapshotsResponse { - /// If not empty, indicates that there may be more snapshot that match the - /// request; this value should be passed in a new `ListSnapshotsRequest`. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The resulting snapshots. - pub snapshots: Option>, -} - -impl ResponseResult for ListSnapshotsResponse {} - - -/// Request for the `Seek` method.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [subscriptions seek projects](struct.ProjectSubscriptionSeekCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SeekRequest { - /// The snapshot to seek to. The snapshot's topic must be the same as that of - /// the provided subscription. - /// Format is `projects/{project}/snapshots/{snap}`. - pub snapshot: Option, - /// The time to seek to. - /// Messages retained in the subscription that were published before this - /// time are marked as acknowledged, and messages retained in the - /// subscription that were published after this time are marked as - /// unacknowledged. Note that this operation affects only those messages - /// retained in the subscription (configured by the combination of - /// `message_retention_duration` and `retain_acked_messages`). For example, - /// if `time` corresponds to a point before the message retention - /// window (or to a point before the system's notion of the subscription - /// creation time), only retained messages will be marked as unacknowledged, - /// and already-expunged messages will not be restored. - pub time: Option, -} - -impl RequestValue for SeekRequest {} - - -/// Request for the UpdateSnapshot method.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [snapshots patch projects](struct.ProjectSnapshotPatchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateSnapshotRequest { - /// The updated snapshot object. - pub snapshot: Option, - /// Indicates which fields in the provided snapshot to update. - /// Must be specified and non-empty. - #[serde(rename="updateMask")] - pub update_mask: Option, -} - -impl RequestValue for UpdateSnapshotRequest {} - - /// Response for the `ListSubscriptions` method. /// /// # Activities @@ -918,214 +812,31 @@ pub struct TestIamPermissionsResponse { impl ResponseResult for TestIamPermissionsResponse {} -/// A message that is published by publishers and consumed by subscribers. The -/// message must contain either a non-empty data field or at least one attribute. +/// Contains information needed for generating an +/// [OpenID Connect +/// token](https://developers.google.com/identity/protocols/OpenIDConnect). /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PubsubMessage { - /// Optional attributes for this message. - pub attributes: Option>, - /// The message data field. If this field is empty, the message must contain - /// at least one attribute. - pub data: Option, - /// The time at which the message was published, populated by the server when - /// it receives the `Publish` call. It must not be populated by the - /// publisher in a `Publish` call. - #[serde(rename="publishTime")] - pub publish_time: Option, - /// ID of this message, assigned by the server when the message is published. - /// Guaranteed to be unique within the topic. This value may be read by a - /// subscriber that receives a `PubsubMessage` via a `Pull` call or a push - /// delivery. It must not be populated by the publisher in a `Publish` call. - #[serde(rename="messageId")] - pub message_id: Option, +pub struct OidcToken { + /// Audience to be used when generating OIDC token. The audience claim + /// identifies the recipients that the JWT is intended for. The audience + /// value is a single case-sensitive string. Having multiple values (array) + /// for the audience field is not supported. More info about the OIDC JWT + /// token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 + /// Note: if not specified, the Push endpoint URL will be used. + pub audience: Option, + /// [Service account + /// email](https://cloud.google.com/iam/docs/service-accounts) + /// to be used for generating the OIDC token. The caller (for + /// CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must + /// have the iam.serviceAccounts.actAs permission for the service account. + #[serde(rename="serviceAccountEmail")] + pub service_account_email: Option, } -impl Part for PubsubMessage {} - - -/// Request for the `Pull` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [subscriptions pull projects](struct.ProjectSubscriptionPullCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PullRequest { - /// If this field set to true, the system will respond immediately even if - /// it there are no messages available to return in the `Pull` response. - /// Otherwise, the system may wait (for a bounded amount of time) until at - /// least one message is available, rather than returning no messages. - #[serde(rename="returnImmediately")] - pub return_immediately: Option, - /// The maximum number of messages returned for this request. The Pub/Sub - /// system may return fewer than the number specified. - #[serde(rename="maxMessages")] - pub max_messages: Option, -} - -impl RequestValue for PullRequest {} - - -/// Associates `members` with a `role`. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Binding { - /// Role that is assigned to `members`. - /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. - pub role: Option, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. - /// `members` can have the following values: - /// - /// * `allUsers`: A special identifier that represents anyone who is - /// on the internet; with or without a Google account. - /// - /// * `allAuthenticatedUsers`: A special identifier that represents anyone - /// who is authenticated with a Google account or a service account. - /// - /// * `user:{emailid}`: An email address that represents a specific Google - /// account. For example, `alice@gmail.com` . - /// - /// - /// * `serviceAccount:{emailid}`: An email address that represents a service - /// account. For example, `my-other-app@appspot.gserviceaccount.com`. - /// - /// * `group:{emailid}`: An email address that represents a Google group. - /// For example, `admins@example.com`. - /// - /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the - /// users of that domain. For example, `google.com` or `example.com`. - /// - /// - pub members: Option>, -} - -impl Part for Binding {} - - -/// Request for the `CreateSnapshot` method.

-/// BETA: This feature is part of a beta release. This API might be changed in -/// backward-incompatible ways and is not recommended for production use. -/// It is not subject to any SLA or deprecation policy. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [snapshots create projects](struct.ProjectSnapshotCreateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateSnapshotRequest { - /// See Creating and managing labels. - pub labels: Option>, - /// The subscription whose backlog the snapshot retains. - /// Specifically, the created snapshot is guaranteed to retain: - /// (a) The existing backlog on the subscription. More precisely, this is - /// defined as the messages in the subscription's backlog that are - /// unacknowledged upon the successful completion of the - /// `CreateSnapshot` request; as well as: - /// (b) Any messages published to the subscription's topic following the - /// successful completion of the CreateSnapshot request. - /// Format is `projects/{project}/subscriptions/{sub}`. - pub subscription: Option, -} - -impl RequestValue for CreateSnapshotRequest {} - - -/// A topic resource. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [topics create projects](struct.ProjectTopicCreateCall.html) (request|response) -/// * [topics patch projects](struct.ProjectTopicPatchCall.html) (response) -/// * [topics get projects](struct.ProjectTopicGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Topic { - /// See Creating and managing labels. - pub labels: Option>, - /// The name of the topic. It must have the format - /// `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, - /// and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), - /// underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent - /// signs (`%`). It must be between 3 and 255 characters in length, and it - /// must not start with `"goog"`. - pub name: Option, -} - -impl RequestValue for Topic {} -impl ResponseResult for Topic {} - - -/// Request for the UpdateSubscription method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [subscriptions patch projects](struct.ProjectSubscriptionPatchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateSubscriptionRequest { - /// Indicates which fields in the provided subscription to update. - /// Must be specified and non-empty. - #[serde(rename="updateMask")] - pub update_mask: Option, - /// The updated subscription object. - pub subscription: Option, -} - -impl RequestValue for UpdateSubscriptionRequest {} - - -/// Represents an expression text. Example: -/// -/// title: "User account presence" -/// description: "Determines whether the request has a user account" -/// expression: "size(request.user) > 0" -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, - /// Textual representation of an expression in - /// Common Expression Language syntax. - /// - /// The application context of the containing message determines which - /// well-known feature set of CEL is supported. - pub expression: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, - /// An optional string indicating the location of the expression for error - /// reporting, e.g. a file name and a position in the file. - pub location: Option, -} - -impl Part for Expr {} +impl Part for OidcToken {} /// Response for the `Pull` method. @@ -1150,10 +861,7 @@ pub struct PullResponse { impl ResponseResult for PullResponse {} -/// Response for the `ListTopicSnapshots` method.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. +/// Response for the `ListTopicSnapshots` method. /// /// # Activities /// @@ -1204,6 +912,10 @@ pub struct PushConfig { /// * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. /// * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. pub attributes: Option>, + /// If specified, Pub/Sub will generate and attach an OIDC JWT token as an + /// `Authorization` header in the HTTP request for every pushed message. + #[serde(rename="oidcToken")] + pub oidc_token: Option, /// A URL locating the endpoint to which messages should be pushed. /// For example, a Webhook endpoint might use "https://example.com/push". #[serde(rename="pushEndpoint")] @@ -1226,33 +938,6 @@ impl Part for PushConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Subscription { - /// The name of the topic from which this subscription is receiving messages. - /// Format is `projects/{project}/topics/{topic}`. - /// The value of this field will be `_deleted-topic_` if the topic has been - /// deleted. - pub topic: Option, - /// How long to retain unacknowledged messages in the subscription's backlog, - /// from the moment a message is published. - /// If `retain_acked_messages` is true, then this also configures the retention - /// of acknowledged messages, and thus configures how far back in time a `Seek` - /// can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10 - /// minutes.

- /// BETA: This feature is part of a beta release. This API might be - /// changed in backward-incompatible ways and is not recommended for production - /// use. It is not subject to any SLA or deprecation policy. - #[serde(rename="messageRetentionDuration")] - pub message_retention_duration: Option, - /// Indicates whether to retain acknowledged messages. If true, then - /// messages are not expunged from the subscription's backlog, even if they are - /// acknowledged, until they fall out of the `message_retention_duration` - /// window. This must be true if you would like to - /// Seek to a timestamp. - ///

- /// BETA: This feature is part of a beta release. This API might be - /// changed in backward-incompatible ways and is not recommended for production - /// use. It is not subject to any SLA or deprecation policy. - #[serde(rename="retainAckedMessages")] - pub retain_acked_messages: Option, /// The name of the subscription. It must have the format /// `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must /// start with a letter, and contain only letters (`[A-Za-z]`), numbers @@ -1260,11 +945,11 @@ pub struct Subscription { /// plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters /// in length, and it must not start with `"goog"`. pub name: Option, - /// This value is the maximum time after a subscriber receives a message - /// before the subscriber should acknowledge the message. After message - /// delivery but before the ack deadline expires and before the message is - /// acknowledged, it is an outstanding message and will not be delivered - /// again during that time (on a best-effort basis). + /// The approximate amount of time (on a best-effort basis) Pub/Sub waits for + /// the subscriber to acknowledge receipt before resending the message. In the + /// interval after the message is delivered and before it is acknowledged, it + /// is considered to be outstanding. During that time period, the + /// message will not be redelivered (on a best-effort basis). /// /// For pull subscriptions, this value is used as the initial value for the ack /// deadline. To override this value for a given message, call @@ -1282,19 +967,383 @@ pub struct Subscription { /// system will eventually redeliver the message. #[serde(rename="ackDeadlineSeconds")] pub ack_deadline_seconds: Option, - /// See Creating and managing labels. + /// See Creating and + /// managing labels. pub labels: Option>, /// If push delivery is used with this subscription, this field is /// used to configure it. An empty `pushConfig` signifies that the subscriber /// will pull and ack messages using API methods. #[serde(rename="pushConfig")] pub push_config: Option, + /// The name of the topic from which this subscription is receiving messages. + /// Format is `projects/{project}/topics/{topic}`. + /// The value of this field will be `_deleted-topic_` if the topic has been + /// deleted. + pub topic: Option, + /// How long to retain unacknowledged messages in the subscription's backlog, + /// from the moment a message is published. + /// If `retain_acked_messages` is true, then this also configures the retention + /// of acknowledged messages, and thus configures how far back in time a `Seek` + /// can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10 + /// minutes. + #[serde(rename="messageRetentionDuration")] + pub message_retention_duration: Option, + /// Indicates whether to retain acknowledged messages. If true, then + /// messages are not expunged from the subscription's backlog, even if they are + /// acknowledged, until they fall out of the `message_retention_duration` + /// window. This must be true if you would like to + /// + /// Seek to a timestamp. + #[serde(rename="retainAckedMessages")] + pub retain_acked_messages: Option, + /// A policy that specifies the conditions for this subscription's expiration. + /// A subscription is considered active as long as any connected subscriber is + /// successfully consuming messages from the subscription or is issuing + /// operations on the subscription. If `expiration_policy` is not set, a + /// *default policy* with `ttl` of 31 days will be used. The minimum allowed + /// value for `expiration_policy.ttl` is 1 day. + /// BETA: This feature is part of a beta release. This API might be + /// changed in backward-incompatible ways and is not recommended for production + /// use. It is not subject to any SLA or deprecation policy. + #[serde(rename="expirationPolicy")] + pub expiration_policy: Option, } impl RequestValue for Subscription {} impl ResponseResult for Subscription {} +/// Response for the `Seek` method (this response is empty). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [subscriptions seek projects](struct.ProjectSubscriptionSeekCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SeekResponse { _never_set: Option } + +impl ResponseResult for SeekResponse {} + + +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [subscriptions test iam permissions projects](struct.ProjectSubscriptionTestIamPermissionCall.html) (request) +/// * [topics test iam permissions projects](struct.ProjectTopicTestIamPermissionCall.html) (request) +/// * [snapshots test iam permissions projects](struct.ProjectSnapshotTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, +} + +impl RequestValue for TestIamPermissionsRequest {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// Response for the `Publish` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [topics publish projects](struct.ProjectTopicPublishCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PublishResponse { + /// The server-assigned ID of each published message, in the same order as + /// the messages in the request. IDs are guaranteed to be unique within + /// the topic. + #[serde(rename="messageIds")] + pub message_ids: Option>, +} + +impl ResponseResult for PublishResponse {} + + +/// A snapshot resource. Snapshots are used in +/// Seek +/// operations, which allow +/// you to manage message acknowledgments in bulk. That is, you can set the +/// acknowledgment state of messages in an existing subscription to the state +/// captured by a snapshot. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [snapshots get projects](struct.ProjectSnapshotGetCall.html) (response) +/// * [snapshots create projects](struct.ProjectSnapshotCreateCall.html) (response) +/// * [snapshots patch projects](struct.ProjectSnapshotPatchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Snapshot { + /// The snapshot is guaranteed to exist up until this time. + /// A newly-created snapshot expires no later than 7 days from the time of its + /// creation. Its exact lifetime is determined at creation by the existing + /// backlog in the source subscription. Specifically, the lifetime of the + /// snapshot is `7 days - (age of oldest unacked message in the subscription)`. + /// For example, consider a subscription whose oldest unacked message is 3 days + /// old. If a snapshot is created from this subscription, the snapshot -- which + /// will always capture this 3-day-old backlog as long as the snapshot + /// exists -- will expire in 4 days. The service will refuse to create a + /// snapshot that would expire in less than 1 hour after creation. + #[serde(rename="expireTime")] + pub expire_time: Option, + /// The name of the topic from which this snapshot is retaining messages. + pub topic: Option, + /// See Creating and + /// managing labels. + pub labels: Option>, + /// The name of the snapshot. + pub name: Option, +} + +impl ResponseResult for Snapshot {} + + +/// A policy that specifies the conditions for resource expiration (i.e., +/// automatic resource deletion). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExpirationPolicy { + /// Specifies the "time-to-live" duration for an associated resource. The + /// resource expires if it is not active for a period of `ttl`. The definition + /// of "activity" depends on the type of the associated resource. The minimum + /// and maximum allowed values for `ttl` depend on the type of the associated + /// resource, as well. If `ttl` is not set, the associated resource never + /// expires. + pub ttl: Option, +} + +impl Part for ExpirationPolicy {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// Unimplemented. The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + +/// Request for the `CreateSnapshot` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [snapshots create projects](struct.ProjectSnapshotCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateSnapshotRequest { + /// See Creating and + /// managing labels. + pub labels: Option>, + /// The subscription whose backlog the snapshot retains. + /// Specifically, the created snapshot is guaranteed to retain: + /// (a) The existing backlog on the subscription. More precisely, this is + /// defined as the messages in the subscription's backlog that are + /// unacknowledged upon the successful completion of the + /// `CreateSnapshot` request; as well as: + /// (b) Any messages published to the subscription's topic following the + /// successful completion of the CreateSnapshot request. + /// Format is `projects/{project}/subscriptions/{sub}`. + pub subscription: Option, +} + +impl RequestValue for CreateSnapshotRequest {} + + +/// A topic resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [topics create projects](struct.ProjectTopicCreateCall.html) (request|response) +/// * [topics patch projects](struct.ProjectTopicPatchCall.html) (response) +/// * [topics get projects](struct.ProjectTopicGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Topic { + /// See Creating and + /// managing labels. + pub labels: Option>, + /// The name of the topic. It must have the format + /// `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, + /// and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), + /// underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent + /// signs (`%`). It must be between 3 and 255 characters in length, and it + /// must not start with `"goog"`. + pub name: Option, +} + +impl RequestValue for Topic {} +impl ResponseResult for Topic {} + + +/// Request for the UpdateSubscription method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [subscriptions patch projects](struct.ProjectSubscriptionPatchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UpdateSubscriptionRequest { + /// Indicates which fields in the provided subscription to update. + /// Must be specified and non-empty. + #[serde(rename="updateMask")] + pub update_mask: Option, + /// The updated subscription object. + pub subscription: Option, +} + +impl RequestValue for UpdateSubscriptionRequest {} + + +/// Request for the UpdateSnapshot method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [snapshots patch projects](struct.ProjectSnapshotPatchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UpdateSnapshotRequest { + /// The updated snapshot object. + pub snapshot: Option, + /// Indicates which fields in the provided snapshot to update. + /// Must be specified and non-empty. + #[serde(rename="updateMask")] + pub update_mask: Option, +} + +impl RequestValue for UpdateSnapshotRequest {} + + +/// A message that is published by publishers and consumed by subscribers. The +/// message must contain either a non-empty data field or at least one attribute. +/// Note that client libraries represent this object differently +/// depending on the language. See the corresponding +/// client +/// library documentation for more information. See +/// Quotas and limits +/// for more information about message limits. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PubsubMessage { + /// Optional attributes for this message. + pub attributes: Option>, + /// The message data field. If this field is empty, the message must contain + /// at least one attribute. + pub data: Option, + /// The time at which the message was published, populated by the server when + /// it receives the `Publish` call. It must not be populated by the + /// publisher in a `Publish` call. + #[serde(rename="publishTime")] + pub publish_time: Option, + /// ID of this message, assigned by the server when the message is published. + /// Guaranteed to be unique within the topic. This value may be read by a + /// subscriber that receives a `PubsubMessage` via a `Pull` call or a push + /// delivery. It must not be populated by the publisher in a `Publish` call. + #[serde(rename="messageId")] + pub message_id: Option, +} + +impl Part for PubsubMessage {} + + // ################### // MethodBuilders ### @@ -1362,7 +1411,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Creates the given topic with the given name. See the - /// resource name rules. + /// + /// resource name rules. /// /// # Arguments /// @@ -1624,13 +1674,10 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Gets the configuration details of a snapshot. Snapshots are used in - /// Seek operations, which allow - /// you to manage message acknowledgments in bulk. That is, you can set the - /// acknowledgment state of messages in an existing subscription to the state - /// captured by a snapshot.

- /// BETA: This feature is part of a beta release. This API might be - /// changed in backward-incompatible ways and is not recommended for production - /// use. It is not subject to any SLA or deprecation policy. + /// Seek + /// operations, which allow you to manage message acknowledgments in bulk. That + /// is, you can set the acknowledgment state of messages in an existing + /// subscription to the state captured by a snapshot. /// /// # Arguments /// @@ -1689,14 +1736,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Updates an existing snapshot. Snapshots are used in - /// Seek operations, which allow + /// Seek + /// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state - /// captured by a snapshot.

- /// BETA: This feature is part of a beta release. This API might be - /// changed in backward-incompatible ways and is not recommended for production - /// use. It is not subject to any SLA or deprecation policy. - /// Note that certain properties of a snapshot are not modifiable. + /// captured by a snapshot. /// /// # Arguments /// @@ -1755,13 +1799,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Removes an existing snapshot. Snapshots are used in - /// Seek operations, which allow + /// Seek + /// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state /// captured by a snapshot.

- /// BETA: This feature is part of a beta release. This API might be - /// changed in backward-incompatible ways and is not recommended for production - /// use. It is not subject to any SLA or deprecation policy. /// When the snapshot is deleted, all messages retained in the snapshot /// are immediately dropped. After a snapshot is deleted, a new one may be /// created with the same name, but the new one has no association with the old @@ -1830,14 +1872,15 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Creates a subscription to a given topic. See the - /// resource name rules. + /// + /// resource name rules. /// If the subscription already exists, returns `ALREADY_EXISTS`. /// If the corresponding topic doesn't exist, returns `NOT_FOUND`. /// /// If the name is not provided in the request, the server will assign a random /// name for this subscription on the same project as the topic, conforming /// to the - /// [resource name format](https://cloud.google.com/pubsub/docs/overview#names). + /// [resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names). /// The generated name is populated in the returned Subscription object. /// Note that for REST API requests, you must specify a name in the request. /// @@ -1889,25 +1932,22 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Creates a snapshot from the requested subscription. Snapshots are used in - /// Seek operations, which allow + /// Seek + /// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state /// captured by a snapshot. - ///

- /// BETA: This feature is part of a beta release. This API might be - /// changed in backward-incompatible ways and is not recommended for production - /// use. It is not subject to any SLA or deprecation policy.

- /// If the snapshot already exists, returns `ALREADY_EXISTS`. + ///

If the snapshot already exists, returns `ALREADY_EXISTS`. /// If the requested subscription doesn't exist, returns `NOT_FOUND`. /// If the backlog in the subscription is too old -- and the resulting snapshot /// would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. /// See also the `Snapshot.expire_time` field. If the name is not provided in /// the request, the server will assign a random /// name for this snapshot on the same project as the subscription, conforming - /// to the [resource name format](https://cloud.google.com/pubsub/docs/overview#names). - /// The generated - /// name is populated in the returned Snapshot object. Note that for REST API - /// requests, you must specify a name in the request. + /// to the + /// [resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names). + /// The generated name is populated in the returned Snapshot object. Note that + /// for REST API requests, you must specify a name in the request. /// /// # Arguments /// @@ -1916,7 +1956,8 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// If the name is not provided in the request, the server will assign a random /// name for this snapshot on the same project as the subscription. /// Note that for REST API requests, you must specify a name. See the - /// resource name rules. + /// + /// resource name rules. /// Format is `projects/{project}/snapshots/{snap}`. pub fn snapshots_create(&self, request: CreateSnapshotRequest, name: &str) -> ProjectSnapshotCreateCall<'a, C, A> { ProjectSnapshotCreateCall { @@ -1954,13 +1995,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Lists the existing snapshots. Snapshots are used in - /// Seek operations, which allow + /// Seek + /// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state - /// captured by a snapshot.

- /// BETA: This feature is part of a beta release. This API might be - /// changed in backward-incompatible ways and is not recommended for production - /// use. It is not subject to any SLA or deprecation policy. + /// captured by a snapshot. /// /// # Arguments /// @@ -2003,14 +2042,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// Seeks an existing subscription to a point in time or to a given snapshot, /// whichever is provided in the request. Snapshots are used in - /// Seek operations, which allow + /// Seek + /// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state /// captured by a snapshot. Note that both the subscription and the snapshot - /// must be on the same topic.

- /// BETA: This feature is part of a beta release. This API might be - /// changed in backward-incompatible ways and is not recommended for production - /// use. It is not subject to any SLA or deprecation policy. + /// must be on the same topic. /// /// # Arguments /// @@ -2068,13 +2105,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Lists the names of the snapshots on this topic. Snapshots are used in - /// Seek operations, which allow + /// Seek + /// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state - /// captured by a snapshot.

- /// BETA: This feature is part of a beta release. This API might be - /// changed in backward-incompatible ways and is not recommended for production - /// use. It is not subject to any SLA or deprecation policy. + /// captured by a snapshot. /// /// # Arguments /// @@ -2218,7 +2253,7 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2257,7 +2289,7 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut resource name rules. +/// +/// resource name rules. /// /// A builder for the *topics.create* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -2494,7 +2527,7 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2545,7 +2575,7 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2838,7 +2865,7 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3092,10 +3119,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3127,7 +3151,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3218,7 +3242,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3365,7 +3389,7 @@ impl<'a, C, A> ProjectSnapshotTestIamPermissionCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3381,10 +3405,7 @@ impl<'a, C, A> ProjectSnapshotTestIamPermissionCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3416,7 +3437,7 @@ impl<'a, C, A> ProjectSnapshotTestIamPermissionCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3507,7 +3528,7 @@ impl<'a, C, A> ProjectSnapshotTestIamPermissionCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3650,7 +3671,7 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3701,7 +3719,7 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3954,10 +3972,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3989,7 +4004,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4080,7 +4095,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4216,7 +4231,7 @@ impl<'a, C, A> ProjectSnapshotGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSnapshotGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4255,7 +4267,7 @@ impl<'a, C, A> ProjectSnapshotGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSnapshotGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4495,10 +4507,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4530,7 +4539,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4621,7 +4630,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4757,7 +4766,7 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4796,7 +4802,7 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5073,7 +5076,7 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5341,7 +5341,7 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMutSeek operations, which allow -/// you to manage message acknowledgments in bulk. That is, you can set the -/// acknowledgment state of messages in an existing subscription to the state -/// captured by a snapshot.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. +/// Seek +/// operations, which allow you to manage message acknowledgments in bulk. That +/// is, you can set the acknowledgment state of messages in an existing +/// subscription to the state captured by a snapshot. /// /// A builder for the *snapshots.get* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -5561,7 +5558,7 @@ impl<'a, C, A> ProjectSnapshotGetCall<'a, C, A> where C: BorrowMut ProjectSnapshotGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5600,7 +5594,7 @@ impl<'a, C, A> ProjectSnapshotGetCall<'a, C, A> where C: BorrowMut ProjectSnapshotGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5831,10 +5825,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5854,7 +5845,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5933,7 +5924,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6077,7 +6068,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6093,10 +6084,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6116,7 +6104,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6211,7 +6199,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6260,14 +6248,11 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, /// Updates an existing snapshot. Snapshots are used in -/// Seek operations, which allow +/// Seek +/// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state -/// captured by a snapshot.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. -/// Note that certain properties of a snapshot are not modifiable. +/// captured by a snapshot. /// /// A builder for the *snapshots.patch* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -6360,7 +6345,7 @@ impl<'a, C, A> ProjectSnapshotPatchCall<'a, C, A> where C: BorrowMut ProjectSnapshotPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6411,7 +6393,7 @@ impl<'a, C, A> ProjectSnapshotPatchCall<'a, C, A> where C: BorrowMut ProjectSnapshotPatchCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6694,7 +6673,7 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6935,10 +6914,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6958,7 +6934,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7037,7 +7013,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7086,13 +7062,11 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, /// Removes an existing snapshot. Snapshots are used in -/// Seek operations, which allow +/// Seek +/// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state /// captured by a snapshot.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. /// When the snapshot is deleted, all messages retained in the snapshot /// are immediately dropped. After a snapshot is deleted, a new one may be /// created with the same name, but the new one has no association with the old @@ -7182,7 +7156,7 @@ impl<'a, C, A> ProjectSnapshotDeleteCall<'a, C, A> where C: BorrowMut ProjectSnapshotDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7221,7 +7192,7 @@ impl<'a, C, A> ProjectSnapshotDeleteCall<'a, C, A> where C: BorrowMut ProjectSnapshotDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7493,7 +7461,7 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicPatchCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7742,10 +7710,7 @@ impl<'a, C, A> ProjectTopicPatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7777,7 +7742,7 @@ impl<'a, C, A> ProjectTopicPatchCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7872,7 +7837,7 @@ impl<'a, C, A> ProjectTopicPatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7921,14 +7886,15 @@ impl<'a, C, A> ProjectTopicPatchCall<'a, C, A> where C: BorrowMut /// Creates a subscription to a given topic. See the -/// resource name rules. +/// +/// resource name rules. /// If the subscription already exists, returns `ALREADY_EXISTS`. /// If the corresponding topic doesn't exist, returns `NOT_FOUND`. /// /// If the name is not provided in the request, the server will assign a random /// name for this subscription on the same project as the topic, conforming /// to the -/// [resource name format](https://cloud.google.com/pubsub/docs/overview#names). +/// [resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names). /// The generated name is populated in the returned Subscription object. /// Note that for REST API requests, you must specify a name in the request. /// @@ -8023,7 +7989,7 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8074,7 +8037,7 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPatchCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8362,7 +8322,7 @@ impl<'a, C, A> ProjectSubscriptionPatchCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPatchCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPatchCall<'a, C, A> where C: BorrowMutSeek operations, which allow +/// Seek +/// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state /// captured by a snapshot. -///

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy.

-/// If the snapshot already exists, returns `ALREADY_EXISTS`. +///

If the snapshot already exists, returns `ALREADY_EXISTS`. /// If the requested subscription doesn't exist, returns `NOT_FOUND`. /// If the backlog in the subscription is too old -- and the resulting snapshot /// would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. /// See also the `Snapshot.expire_time` field. If the name is not provided in /// the request, the server will assign a random /// name for this snapshot on the same project as the subscription, conforming -/// to the [resource name format](https://cloud.google.com/pubsub/docs/overview#names). -/// The generated -/// name is populated in the returned Snapshot object. Note that for REST API -/// requests, you must specify a name in the request. +/// to the +/// [resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names). +/// The generated name is populated in the returned Snapshot object. Note that +/// for REST API requests, you must specify a name in the request. /// /// A builder for the *snapshots.create* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -8617,7 +8574,7 @@ impl<'a, C, A> ProjectSnapshotCreateCall<'a, C, A> where C: BorrowMut ProjectSnapshotCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8668,7 +8622,7 @@ impl<'a, C, A> ProjectSnapshotCreateCall<'a, C, A> where C: BorrowMut ProjectSnapshotCreateCall<'a, C, A> where C: BorrowMutresource name rules. + /// + /// resource name rules. /// Format is `projects/{project}/snapshots/{snap}`. /// /// Sets the *name* path property to the given value. @@ -8763,7 +8718,7 @@ impl<'a, C, A> ProjectSnapshotCreateCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8940,7 +8892,7 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> where C: BorrowMutSeek operations, which allow +/// Seek +/// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state -/// captured by a snapshot.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. +/// captured by a snapshot. /// /// A builder for the *snapshots.list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -9170,7 +9120,7 @@ impl<'a, C, A> ProjectSnapshotListCall<'a, C, A> where C: BorrowMut ProjectSnapshotListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9209,7 +9156,7 @@ impl<'a, C, A> ProjectSnapshotListCall<'a, C, A> where C: BorrowMut ProjectSnapshotListCall<'a, C, A> where C: BorrowMut ProjectSnapshotSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSnapshotSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9497,7 +9441,7 @@ impl<'a, C, A> ProjectSnapshotSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSnapshotSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSnapshotSetIamPolicyCall<'a, C, A> where C: BorrowMutSeek operations, which allow +/// Seek +/// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state /// captured by a snapshot. Note that both the subscription and the snapshot -/// must be on the same topic.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. +/// must be on the same topic. /// /// A builder for the *subscriptions.seek* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -9738,7 +9680,7 @@ impl<'a, C, A> ProjectSubscriptionSeekCall<'a, C, A> where C: BorrowMut ProjectSubscriptionSeekCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9789,7 +9728,7 @@ impl<'a, C, A> ProjectSubscriptionSeekCall<'a, C, A> where C: BorrowMut ProjectSubscriptionSeekCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10052,7 +9988,7 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10314,7 +10247,7 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMutSeek operations, which allow +/// Seek +/// operations, which allow /// you to manage message acknowledgments in bulk. That is, you can set the /// acknowledgment state of messages in an existing subscription to the state -/// captured by a snapshot.

-/// BETA: This feature is part of a beta release. This API might be -/// changed in backward-incompatible ways and is not recommended for production -/// use. It is not subject to any SLA or deprecation policy. +/// captured by a snapshot. /// /// A builder for the *topics.snapshots.list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -10560,7 +10491,7 @@ impl<'a, C, A> ProjectTopicSnapshotListCall<'a, C, A> where C: BorrowMut ProjectTopicSnapshotListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10599,7 +10527,7 @@ impl<'a, C, A> ProjectTopicSnapshotListCall<'a, C, A> where C: BorrowMut ProjectTopicSnapshotListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10852,10 +10780,7 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10887,7 +10812,7 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10978,7 +10903,7 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/pubsub1_beta2-cli/Cargo.toml b/gen/pubsub1_beta2-cli/Cargo.toml index 4355fc1366..c279149afd 100644 --- a/gen/pubsub1_beta2-cli/Cargo.toml +++ b/gen/pubsub1_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1_beta2-cli" -version = "1.0.8+20181001" +version = "1.0.8+20190314" authors = ["Sebastian Thiel "] description = "A complete library to interact with Pubsub (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1_beta2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-pubsub1_beta2] path = "../pubsub1_beta2" -version = "1.0.8+20181001" +version = "1.0.8+20190314" diff --git a/gen/pubsub1_beta2-cli/README.md b/gen/pubsub1_beta2-cli/README.md index 7028fcdefa..ec53ff171e 100644 --- a/gen/pubsub1_beta2-cli/README.md +++ b/gen/pubsub1_beta2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Pubsub* API at revision *20181001*. The CLI is at version *1.0.8*. +This documentation was generated from the *Pubsub* API at revision *20190314*. The CLI is at version *1.0.8*. ```bash pubsub1-beta2 [options] diff --git a/gen/pubsub1_beta2-cli/mkdocs.yml b/gen/pubsub1_beta2-cli/mkdocs.yml index 85b7fe8d5f..68788d44d6 100644 --- a/gen/pubsub1_beta2-cli/mkdocs.yml +++ b/gen/pubsub1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Pubsub v1.0.8+20181001 +site_name: Pubsub v1.0.8+20190314 site_url: http://byron.github.io/google-apis-rs/google-pubsub1_beta2-cli site_description: A complete library to interact with Pubsub (protocol v1beta2) diff --git a/gen/pubsub1_beta2-cli/src/main.rs b/gen/pubsub1_beta2-cli/src/main.rs index 95f4ae08b1..601ca54155 100644 --- a/gen/pubsub1_beta2-cli/src/main.rs +++ b/gen/pubsub1_beta2-cli/src/main.rs @@ -157,10 +157,12 @@ impl<'n> Engine<'n> { "ack-deadline-seconds" => Some(("ackDeadlineSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "topic" => Some(("topic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "push-config.attributes" => Some(("pushConfig.attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "push-config.oidc-token.audience" => Some(("pushConfig.oidcToken.audience", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "push-config.oidc-token.service-account-email" => Some(("pushConfig.oidcToken.serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "push-config.push-endpoint" => Some(("pushConfig.pushEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["ack-deadline-seconds", "attributes", "name", "push-config", "push-endpoint", "topic"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["ack-deadline-seconds", "attributes", "audience", "name", "oidc-token", "push-config", "push-endpoint", "service-account-email", "topic"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -459,8 +461,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ack-deadline-seconds" => Some(("ackDeadlineSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "ack-ids" => Some(("ackIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "ack-id" => Some(("ackId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ack-ids" => Some(("ackIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["ack-deadline-seconds", "ack-id", "ack-ids"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -546,9 +548,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "push-config.attributes" => Some(("pushConfig.attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "push-config.oidc-token.audience" => Some(("pushConfig.oidcToken.audience", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "push-config.oidc-token.service-account-email" => Some(("pushConfig.oidcToken.serviceAccountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "push-config.push-endpoint" => Some(("pushConfig.pushEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["attributes", "push-config", "push-endpoint"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["attributes", "audience", "oidc-token", "push-config", "push-endpoint", "service-account-email"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2218,7 +2222,7 @@ fn main() { let mut app = App::new("pubsub1-beta2") .author("Sebastian Thiel ") - .version("1.0.8+20181001") + .version("1.0.8+20190314") .about("Provides reliable, many-to-many, asynchronous messaging between applications. ") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli") diff --git a/gen/pubsub1_beta2/Cargo.toml b/gen/pubsub1_beta2/Cargo.toml index 78b7f2d508..c29dbb5d12 100644 --- a/gen/pubsub1_beta2/Cargo.toml +++ b/gen/pubsub1_beta2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-pubsub1_beta2" -version = "1.0.8+20181001" +version = "1.0.8+20190314" authors = ["Sebastian Thiel "] description = "A complete library to interact with Pubsub (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1_beta2" homepage = "https://cloud.google.com/pubsub/docs" -documentation = "https://docs.rs/google-pubsub1_beta2/1.0.8+20181001" +documentation = "https://docs.rs/google-pubsub1_beta2/1.0.8+20190314" license = "MIT" keywords = ["pubsub", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/pubsub1_beta2/README.md b/gen/pubsub1_beta2/README.md index 872611439e..2a7d39aa58 100644 --- a/gen/pubsub1_beta2/README.md +++ b/gen/pubsub1_beta2/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-pubsub1_beta2` library allows access to all features of the *Google Pubsub* service. -This documentation was generated from *Pubsub* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Pubsub* crate version *1.0.8+20190314*, where *20190314* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Pubsub* *v1_beta2* API can be found at the [official documentation site](https://cloud.google.com/pubsub/docs). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.Pubsub.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.Pubsub.html) ... * projects - * [*subscriptions acknowledge*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions pull*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionPullCall.html), [*subscriptions set iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectTopicCreateCall.html), [*topics delete*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectTopicDeleteCall.html), [*topics get*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectTopicGetCall.html), [*topics get iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectTopicListCall.html), [*topics publish*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectTopicPublishCall.html), [*topics set iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectTopicSetIamPolicyCall.html), [*topics subscriptions list*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.ProjectTopicTestIamPermissionCall.html) + * [*subscriptions acknowledge*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions pull*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionPullCall.html), [*subscriptions set iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectTopicCreateCall.html), [*topics delete*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectTopicDeleteCall.html), [*topics get*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectTopicGetCall.html), [*topics get iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectTopicListCall.html), [*topics publish*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectTopicPublishCall.html), [*topics set iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectTopicSetIamPolicyCall.html), [*topics subscriptions list*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.ProjectTopicTestIamPermissionCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/struct.Pubsub.html)** +* **[Hub](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/struct.Pubsub.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.Part.html)** + * **[Parts](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -134,17 +134,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -154,29 +154,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-pubsub1_beta2/1.0.8+20181001/google_pubsub1_beta2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-pubsub1_beta2/1.0.8+20190314/google_pubsub1_beta2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/pubsub1_beta2/src/lib.rs b/gen/pubsub1_beta2/src/lib.rs index 74595a76de..4e7b986279 100644 --- a/gen/pubsub1_beta2/src/lib.rs +++ b/gen/pubsub1_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Pubsub* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Pubsub* crate version *1.0.8+20190314*, where *20190314* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Pubsub* *v1_beta2* API can be found at the //! [official documentation site](https://cloud.google.com/pubsub/docs). @@ -378,6 +378,33 @@ impl<'a, C, A> Pubsub // ############ // SCHEMAS ### // ########## +/// Request for the `Pull` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [subscriptions pull projects](struct.ProjectSubscriptionPullCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PullRequest { + /// If this is specified as true the system will respond immediately even if + /// it is not able to return a message in the `Pull` response. Otherwise the + /// system is allowed to wait until at least one message is available rather + /// than returning no messages. The client may cancel the request if it does + /// not wish to wait any longer for the response. + #[serde(rename="returnImmediately")] + pub return_immediately: Option, + /// The maximum number of messages returned for this request. The Pub/Sub + /// system may return fewer than the number specified. + #[serde(rename="maxMessages")] + pub max_messages: Option, +} + +impl RequestValue for PullRequest {} + + /// Request message for `TestIamPermissions` method. /// /// # Activities @@ -520,13 +547,13 @@ pub struct ModifyAckDeadlineRequest { /// another pull request. #[serde(rename="ackDeadlineSeconds")] pub ack_deadline_seconds: Option, - /// List of acknowledgment IDs. - #[serde(rename="ackIds")] - pub ack_ids: Option>, /// The acknowledgment ID. Either this or ack_ids must be populated, but not /// both. #[serde(rename="ackId")] pub ack_id: Option, + /// List of acknowledgment IDs. + #[serde(rename="ackIds")] + pub ack_ids: Option>, } impl RequestValue for ModifyAckDeadlineRequest {} @@ -745,31 +772,31 @@ pub struct TestIamPermissionsResponse { impl ResponseResult for TestIamPermissionsResponse {} -/// Request for the `Pull` method. +/// Contains information needed for generating an +/// [OpenID Connect +/// token](https://developers.google.com/identity/protocols/OpenIDConnect). /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [subscriptions pull projects](struct.ProjectSubscriptionPullCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PullRequest { - /// If this is specified as true the system will respond immediately even if - /// it is not able to return a message in the `Pull` response. Otherwise the - /// system is allowed to wait until at least one message is available rather - /// than returning no messages. The client may cancel the request if it does - /// not wish to wait any longer for the response. - #[serde(rename="returnImmediately")] - pub return_immediately: Option, - /// The maximum number of messages returned for this request. The Pub/Sub - /// system may return fewer than the number specified. - #[serde(rename="maxMessages")] - pub max_messages: Option, +pub struct OidcToken { + /// Audience to be used when generating OIDC token. The audience claim + /// identifies the recipients that the JWT is intended for. The audience + /// value is a single case-sensitive string. Having multiple values (array) + /// for the audience field is not supported. More info about the OIDC JWT + /// token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 + /// Note: if not specified, the Push endpoint URL will be used. + pub audience: Option, + /// [Service account + /// email](https://cloud.google.com/iam/docs/service-accounts) + /// to be used for generating the OIDC token. The caller (for + /// CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must + /// have the iam.serviceAccounts.actAs permission for the service account. + #[serde(rename="serviceAccountEmail")] + pub service_account_email: Option, } -impl RequestValue for PullRequest {} +impl Part for OidcToken {} /// Configuration for a push delivery endpoint. @@ -801,6 +828,10 @@ pub struct PushConfig { /// * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. /// * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. pub attributes: Option>, + /// If specified, Pub/Sub will generate and attach an OIDC JWT token as an + /// `Authorization` header in the HTTP request for every pushed message. + #[serde(rename="oidcToken")] + pub oidc_token: Option, /// A URL locating the endpoint to which messages should be pushed. /// For example, a Webhook endpoint might use "https://example.com/push". #[serde(rename="pushEndpoint")] @@ -869,7 +900,7 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// @@ -889,10 +920,9 @@ impl Part for Binding {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// @@ -902,9 +932,10 @@ pub struct Expr { /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} @@ -1599,7 +1630,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1615,10 +1646,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1638,7 +1666,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1732,7 +1760,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1876,7 +1904,7 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1927,7 +1952,7 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2209,7 +2231,7 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2502,7 +2521,7 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2755,10 +2774,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2790,7 +2806,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2880,7 +2896,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3023,7 +3039,7 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3074,7 +3087,7 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3314,10 +3327,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3337,7 +3347,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3415,7 +3425,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3551,7 +3561,7 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3590,7 +3597,7 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3830,10 +3837,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3865,7 +3869,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3955,7 +3959,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4093,7 +4097,7 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4132,7 +4133,7 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4403,7 +4401,7 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4692,7 +4687,7 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4985,7 +4977,7 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5227,10 +5219,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5250,7 +5239,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5329,7 +5318,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5476,7 +5465,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5492,10 +5481,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5527,7 +5513,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5618,7 +5604,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5756,7 +5742,7 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5795,7 +5778,7 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6046,7 +6026,7 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6307,7 +6284,7 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6584,7 +6558,7 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6836,10 +6810,7 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6871,7 +6842,7 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6962,7 +6933,7 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/qpxexpress1/Cargo.toml b/gen/qpxexpress1/Cargo.toml index fb431801b4..797df2b561 100644 --- a/gen/qpxexpress1/Cargo.toml +++ b/gen/qpxexpress1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/qpxexpress1/src/lib.rs b/gen/qpxexpress1/src/lib.rs index 9418bd1d22..2650eb67df 100644 --- a/gen/qpxexpress1/src/lib.rs +++ b/gen/qpxexpress1/src/lib.rs @@ -1103,10 +1103,7 @@ impl<'a, C, A> TripSearchCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1125,7 +1122,7 @@ impl<'a, C, A> TripSearchCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -1204,7 +1201,7 @@ impl<'a, C, A> TripSearchCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/redis1-cli/Cargo.toml b/gen/redis1-cli/Cargo.toml index 7f53619e19..66d549bd98 100644 --- a/gen/redis1-cli/Cargo.toml +++ b/gen/redis1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-redis1-cli" -version = "1.0.8+20180928" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Redis (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/redis1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-redis1] path = "../redis1" -version = "1.0.8+20180928" +version = "1.0.8+20190327" diff --git a/gen/redis1-cli/README.md b/gen/redis1-cli/README.md index 4882decf15..3a21c5f444 100644 --- a/gen/redis1-cli/README.md +++ b/gen/redis1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Redis* API at revision *20180928*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Redis* API at revision *20190327*. The CLI is at version *1.0.8*. ```bash redis1 [options] @@ -33,6 +33,7 @@ redis1 [options] locations-get [-p ]... [-o ] locations-instances-create (-r )... [-p ]... [-o ] locations-instances-delete [-p ]... [-o ] + locations-instances-failover (-r )... [-p ]... [-o ] locations-instances-get [-p ]... [-o ] locations-instances-list [-p ]... [-o ] locations-instances-patch (-r )... [-p ]... [-o ] diff --git a/gen/redis1-cli/mkdocs.yml b/gen/redis1-cli/mkdocs.yml index 302064f9b1..1aba79c79a 100644 --- a/gen/redis1-cli/mkdocs.yml +++ b/gen/redis1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Redis v1.0.8+20180928 +site_name: Cloud Redis v1.0.8+20190327 site_url: http://byron.github.io/google-apis-rs/google-redis1-cli site_description: A complete library to interact with Cloud Redis (protocol v1) @@ -12,6 +12,7 @@ pages: - ['projects_locations-get.md', 'Projects', 'Locations Get'] - ['projects_locations-instances-create.md', 'Projects', 'Locations Instances Create'] - ['projects_locations-instances-delete.md', 'Projects', 'Locations Instances Delete'] +- ['projects_locations-instances-failover.md', 'Projects', 'Locations Instances Failover'] - ['projects_locations-instances-get.md', 'Projects', 'Locations Instances Get'] - ['projects_locations-instances-list.md', 'Projects', 'Locations Instances List'] - ['projects_locations-instances-patch.md', 'Projects', 'Locations Instances Patch'] diff --git a/gen/redis1-cli/src/main.rs b/gen/redis1-cli/src/main.rs index 4c031533bc..0164859844 100644 --- a/gen/redis1-cli/src/main.rs +++ b/gen/redis1-cli/src/main.rs @@ -133,11 +133,11 @@ impl<'n> Engine<'n> { "memory-size-gb" => Some(("memorySizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "host" => Some(("host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "location-id" => Some(("locationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "authorized-network" => Some(("authorizedNetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status-message" => Some(("statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "redis-configs" => Some(("redisConfigs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "tier" => Some(("tier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "status-message" => Some(("statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authorized-network" => Some(("authorizedNetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["alternative-location-id", "authorized-network", "create-time", "current-location-id", "display-name", "host", "labels", "location-id", "memory-size-gb", "name", "port", "redis-configs", "redis-version", "reserved-ip-range", "state", "status-message", "tier"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -255,6 +255,91 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_instances_failover(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "data-protection-mode" => Some(("dataProtectionMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["data-protection-mode"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FailoverInstanceRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_instances_failover(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_locations_instances_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().locations_instances_get(opt.value_of("name").unwrap_or("")); @@ -401,11 +486,11 @@ impl<'n> Engine<'n> { "memory-size-gb" => Some(("memorySizeGb", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "host" => Some(("host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "location-id" => Some(("locationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "authorized-network" => Some(("authorizedNetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status-message" => Some(("statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "redis-configs" => Some(("redisConfigs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "tier" => Some(("tier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "status-message" => Some(("statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authorized-network" => Some(("authorizedNetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["alternative-location-id", "authorized-network", "create-time", "current-location-id", "display-name", "host", "labels", "location-id", "memory-size-gb", "name", "port", "redis-configs", "redis-version", "reserved-ip-range", "state", "status-message", "tier"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -767,6 +852,9 @@ impl<'n> Engine<'n> { ("locations-instances-delete", Some(opt)) => { call_result = self._projects_locations_instances_delete(opt, dry_run, &mut err); }, + ("locations-instances-failover", Some(opt)) => { + call_result = self._projects_locations_instances_failover(opt, dry_run, &mut err); + }, ("locations-instances-get", Some(opt)) => { call_result = self._projects_locations_instances_get(opt, dry_run, &mut err); }, @@ -882,7 +970,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'locations-get', 'locations-instances-create', 'locations-instances-delete', 'locations-instances-get', 'locations-instances-list', 'locations-instances-patch', 'locations-list', 'locations-operations-cancel', 'locations-operations-delete', 'locations-operations-get' and 'locations-operations-list'", vec![ + ("projects", "methods: 'locations-get', 'locations-instances-create', 'locations-instances-delete', 'locations-instances-failover', 'locations-instances-get', 'locations-instances-list', 'locations-instances-patch', 'locations-list', 'locations-operations-cancel', 'locations-operations-delete', 'locations-operations-get' and 'locations-operations-list'", vec![ ("locations-get", Some(r##"Gets information about a location."##), "Details at http://byron.github.io/google-apis-rs/google_redis1_cli/projects_locations-get", @@ -965,6 +1053,37 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-instances-failover", + Some(r##"Failover the master role to current replica node against a specific + STANDARD tier redis instance."##), + "Details at http://byron.github.io/google-apis-rs/google_redis1_cli/projects_locations-instances-failover", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. Redis instance resource name using the form: + `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + where `location_id` refers to a GCP region"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -1205,8 +1324,8 @@ fn main() { let mut app = App::new("redis1") .author("Sebastian Thiel ") - .version("1.0.8+20180928") - .about("The Google Cloud Memorystore for Redis API is used for creating and managing Redis instances on the Google Cloud Platform.") + .version("1.0.8+20190327") + .about("Creates and manages Redis instances on the Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_redis1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/redis1/Cargo.toml b/gen/redis1/Cargo.toml index 45de9362bb..a7ecfffcd0 100644 --- a/gen/redis1/Cargo.toml +++ b/gen/redis1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-redis1" -version = "1.0.8+20180928" +version = "1.0.8+20190327" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Redis (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/redis1" homepage = "https://cloud.google.com/memorystore/docs/redis/" -documentation = "https://docs.rs/google-redis1/1.0.8+20180928" +documentation = "https://docs.rs/google-redis1/1.0.8+20190327" license = "MIT" keywords = ["redis", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/redis1/README.md b/gen/redis1/README.md index c8096f842b..b57d894201 100644 --- a/gen/redis1/README.md +++ b/gen/redis1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-redis1` library allows access to all features of the *Google Cloud Redis* service. -This documentation was generated from *Cloud Redis* crate version *1.0.8+20180928*, where *20180928* is the exact revision of the *redis:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Redis* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *redis:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Redis* *v1* API can be found at the [official documentation site](https://cloud.google.com/memorystore/docs/redis/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.CloudRedis.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.CloudRedis.html) ... * projects - * [*locations get*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationGetCall.html), [*locations instances create*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationInstanceCreateCall.html), [*locations instances delete*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationInstanceDeleteCall.html), [*locations instances get*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationInstanceGetCall.html), [*locations instances list*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationInstanceListCall.html), [*locations instances patch*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationInstancePatchCall.html), [*locations list*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationListCall.html), [*locations operations cancel*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.ProjectLocationOperationListCall.html) + * [*locations get*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationGetCall.html), [*locations instances create*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationInstanceCreateCall.html), [*locations instances delete*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationInstanceDeleteCall.html), [*locations instances failover*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationInstanceFailoverCall.html), [*locations instances get*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationInstanceGetCall.html), [*locations instances list*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationInstanceListCall.html), [*locations instances patch*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationInstancePatchCall.html), [*locations list*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationListCall.html), [*locations operations cancel*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.ProjectLocationOperationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/struct.CloudRedis.html)** +* **[Hub](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/struct.CloudRedis.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.Part.html)** + * **[Parts](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -49,6 +49,7 @@ Or specifically ... ```ignore let r = hub.projects().locations_instances_create(...).doit() let r = hub.projects().locations_instances_delete(...).doit() +let r = hub.projects().locations_instances_failover(...).doit() let r = hub.projects().locations_operations_get(...).doit() let r = hub.projects().locations_instances_patch(...).doit() ``` @@ -134,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -154,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-redis1/1.0.8+20180928/google_redis1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-redis1/1.0.8+20190327/google_redis1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/redis1/src/lib.rs b/gen/redis1/src/lib.rs index ac471af77e..77e1d028e5 100644 --- a/gen/redis1/src/lib.rs +++ b/gen/redis1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Redis* crate version *1.0.8+20180928*, where *20180928* is the exact revision of the *redis:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Redis* crate version *1.0.8+20190327*, where *20190327* is the exact revision of the *redis:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Redis* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/memorystore/docs/redis/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.CloudRedis.html) ... //! //! * projects -//! * [*locations get*](struct.ProjectLocationGetCall.html), [*locations instances create*](struct.ProjectLocationInstanceCreateCall.html), [*locations instances delete*](struct.ProjectLocationInstanceDeleteCall.html), [*locations instances get*](struct.ProjectLocationInstanceGetCall.html), [*locations instances list*](struct.ProjectLocationInstanceListCall.html), [*locations instances patch*](struct.ProjectLocationInstancePatchCall.html), [*locations list*](struct.ProjectLocationListCall.html), [*locations operations cancel*](struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](struct.ProjectLocationOperationListCall.html) +//! * [*locations get*](struct.ProjectLocationGetCall.html), [*locations instances create*](struct.ProjectLocationInstanceCreateCall.html), [*locations instances delete*](struct.ProjectLocationInstanceDeleteCall.html), [*locations instances failover*](struct.ProjectLocationInstanceFailoverCall.html), [*locations instances get*](struct.ProjectLocationInstanceGetCall.html), [*locations instances list*](struct.ProjectLocationInstanceListCall.html), [*locations instances patch*](struct.ProjectLocationInstancePatchCall.html), [*locations list*](struct.ProjectLocationListCall.html), [*locations operations cancel*](struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](struct.ProjectLocationOperationGetCall.html) and [*locations operations list*](struct.ProjectLocationOperationListCall.html) //! //! //! @@ -49,6 +49,7 @@ //! ```ignore //! let r = hub.projects().locations_instances_create(...).doit() //! let r = hub.projects().locations_instances_delete(...).doit() +//! let r = hub.projects().locations_instances_failover(...).doit() //! let r = hub.projects().locations_operations_get(...).doit() //! let r = hub.projects().locations_instances_patch(...).doit() //! ``` @@ -401,22 +402,24 @@ pub struct ListInstancesResponse { /// "status" field set to ERROR and "status_message" field set to "location not /// available for ListInstances". pub instances: Option>, + /// Locations that could not be reached. + pub unreachable: Option>, } impl ResponseResult for ListInstancesResponse {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -477,25 +480,24 @@ pub struct Status { impl Part for Status {} -/// The response message for Operations.ListOperations. +/// Request for Failover. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations operations list projects](struct.ProjectLocationOperationListCall.html) (response) +/// * [locations instances failover projects](struct.ProjectLocationInstanceFailoverCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListOperationsResponse { - /// A list of operations that matches the specified filter in the request. - pub operations: Option>, - /// The standard List next-page token. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, +pub struct FailoverInstanceRequest { + /// Optional. Available data protection modes that the user can choose. If it's + /// unspecified, data protection mode will be LIMITED_DATA_LOSS by default. + #[serde(rename="dataProtectionMode")] + pub data_protection_mode: Option, } -impl ResponseResult for ListOperationsResponse {} +impl RequestValue for FailoverInstanceRequest {} /// A Google Cloud Redis instance. @@ -506,8 +508,8 @@ impl ResponseResult for ListOperationsResponse {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [locations instances create projects](struct.ProjectLocationInstanceCreateCall.html) (request) -/// * [locations instances get projects](struct.ProjectLocationInstanceGetCall.html) (response) /// * [locations instances patch projects](struct.ProjectLocationInstancePatchCall.html) (request) +/// * [locations instances get projects](struct.ProjectLocationInstanceGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Instance { @@ -580,16 +582,16 @@ pub struct Instance { pub memory_size_gb: Option, /// Output only. The current state of this instance. pub state: Option, - /// Output only. Additional information about the current status of this - /// instance, if available. - #[serde(rename="statusMessage")] - pub status_message: Option, /// Optional. The full name of the Google Compute Engine /// [network](/compute/docs/networks-and-firewalls#networks) to which the /// instance is connected. If left unspecified, the `default` network /// will be used. #[serde(rename="authorizedNetwork")] pub authorized_network: Option, + /// Output only. Additional information about the current status of this + /// instance, if available. + #[serde(rename="statusMessage")] + pub status_message: Option, } impl RequestValue for Instance {} @@ -628,17 +630,17 @@ impl ResponseResult for ListLocationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Location { - /// Resource ID for the region. For example: "us-east1". - #[serde(rename="locationId")] - pub location_id: Option, - /// Cross-service attributes for the location. For example - /// - /// {"cloud.googleapis.com/region": "us-east1"} - pub labels: Option>, /// The friendly name for this location, typically a nearby city name. /// For example, "Tokyo". #[serde(rename="displayName")] pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// Resource ID for the region. For example: "us-east1". + #[serde(rename="locationId")] + pub location_id: Option, /// Full resource name for the region. For example: "projects/example-project/locations/us-east1". pub name: Option, /// Output only. The set of available zones in the location. The map is keyed by the lowercase ID of each zone, as defined by Compute Engine. These keys can be specified in `location_id` or `alternative_location_id` fields when creating a Redis instance. @@ -658,6 +660,7 @@ impl ResponseResult for Location {} /// /// * [locations instances create projects](struct.ProjectLocationInstanceCreateCall.html) (response) /// * [locations instances delete projects](struct.ProjectLocationInstanceDeleteCall.html) (response) +/// * [locations instances failover projects](struct.ProjectLocationInstanceFailoverCall.html) (response) /// * [locations operations get projects](struct.ProjectLocationOperationGetCall.html) (response) /// * [locations instances patch projects](struct.ProjectLocationInstancePatchCall.html) (response) /// @@ -729,6 +732,27 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations operations list projects](struct.ProjectLocationOperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for ListOperationsResponse {} + + // ################### // MethodBuilders ### @@ -758,7 +782,7 @@ impl ResponseResult for Empty {} /// ::default(), None); /// let mut hub = CloudRedis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `locations_get(...)`, `locations_instances_create(...)`, `locations_instances_delete(...)`, `locations_instances_get(...)`, `locations_instances_list(...)`, `locations_instances_patch(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)` +/// // like `locations_get(...)`, `locations_instances_create(...)`, `locations_instances_delete(...)`, `locations_instances_failover(...)`, `locations_instances_get(...)`, `locations_instances_list(...)`, `locations_instances_patch(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -849,6 +873,28 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Failover the master role to current replica node against a specific + /// STANDARD tier redis instance. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. Redis instance resource name using the form: + /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + /// where `location_id` refers to a GCP region + pub fn locations_instances_failover(&self, request: FailoverInstanceRequest, name: &str) -> ProjectLocationInstanceFailoverCall<'a, C, A> { + ProjectLocationInstanceFailoverCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates the metadata and configuration of a specific Redis instance. @@ -1131,7 +1177,7 @@ impl<'a, C, A> ProjectLocationInstanceDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1170,7 +1213,7 @@ impl<'a, C, A> ProjectLocationInstanceDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationInstanceDeleteCall<'a, C, A> @@ -1384,7 +1427,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1423,7 +1463,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> @@ -1638,7 +1678,7 @@ impl<'a, C, A> ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1677,7 +1714,7 @@ impl<'a, C, A> ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C, A> @@ -1889,7 +1926,7 @@ impl<'a, C, A> ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1928,7 +1962,7 @@ impl<'a, C, A> ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationInstanceGetCall<'a, C, A> @@ -2056,6 +2090,288 @@ impl<'a, C, A> ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = CloudRedis::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = FailoverInstanceRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_instances_failover(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationInstanceFailoverCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudRedis, + _request: FailoverInstanceRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationInstanceFailoverCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationInstanceFailoverCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "redis.projects.locations.instances.failover", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:failover"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: FailoverInstanceRequest) -> ProjectLocationInstanceFailoverCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. Redis instance resource name using the form: + /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}` + /// where `location_id` refers to a GCP region + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceFailoverCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationInstanceFailoverCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationInstanceFailoverCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationInstanceFailoverCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates the metadata and configuration of a specific Redis instance. /// /// Completed longrunning.Operation will contain the new instance object @@ -2094,7 +2410,7 @@ impl<'a, C, A> ProjectLocationInstanceGetCall<'a, C, A> where C: BorrowMut ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2209,7 +2522,7 @@ impl<'a, C, A> ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationInstancePatchCall<'a, C, A> @@ -2397,9 +2710,9 @@ impl<'a, C, A> ProjectLocationInstancePatchCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2509,7 +2819,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C, A> @@ -2701,7 +3011,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceCreateCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2816,7 +3123,7 @@ impl<'a, C, A> ProjectLocationInstanceCreateCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceCreateCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceCreateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationInstanceCreateCall<'a, C, A> @@ -3058,7 +3365,7 @@ impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3097,7 +3401,7 @@ impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C, A> @@ -3260,9 +3564,9 @@ impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3372,7 +3673,7 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C, A> @@ -3554,8 +3855,8 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceListCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3661,7 +3959,7 @@ impl<'a, C, A> ProjectLocationInstanceListCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceListCall<'a, C, A> where C: BorrowMut ProjectLocationInstanceListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationInstanceListCall<'a, C, A> @@ -3905,7 +4203,7 @@ impl<'a, C, A> ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3944,7 +4239,7 @@ impl<'a, C, A> ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C, A> diff --git a/gen/remotebuildexecution2-cli/Cargo.toml b/gen/remotebuildexecution2-cli/Cargo.toml new file mode 100644 index 0000000000..97e91c9ae2 --- /dev/null +++ b/gen/remotebuildexecution2-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-remotebuildexecution2-cli" +version = "1.0.8+20190326" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Remote Build Execution (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/remotebuildexecution2-cli" +homepage = "https://cloud.google.com/remote-build-execution/docs/" +documentation = "http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli" +license = "MIT" +keywords = ["remotebuildexecution", "google", "cli"] +autobins = false + +[[bin]] +name = "remotebuildexecution2" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-remotebuildexecution2] +path = "../remotebuildexecution2" +version = "1.0.8+20190326" diff --git a/gen/remotebuildexecution2-cli/LICENSE.md b/gen/remotebuildexecution2-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/remotebuildexecution2-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/remotebuildexecution2-cli/README.md b/gen/remotebuildexecution2-cli/README.md new file mode 100644 index 0000000000..6cc25c5586 --- /dev/null +++ b/gen/remotebuildexecution2-cli/README.md @@ -0,0 +1,126 @@ + +The `remotebuildexecution2` command-line interface *(CLI)* allows to use most features of the *Google Remote Build Execution* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Remote Build Execution* API can be found at the +[official documentation site](https://cloud.google.com/remote-build-execution/docs/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-remotebuildexecution2-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/remotebuildexecution2-cli). + +# Usage + +This documentation was generated from the *Remote Build Execution* API at revision *20190326*. The CLI is at version *1.0.8*. + +```bash +remotebuildexecution2 [options] + action-results + get [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + actions + execute (-r )... [-p ]... [-o ] + blobs + batch-read (-r )... [-p ]... [-o ] + batch-update (-r )... [-p ]... [-o ] + find-missing (-r )... [-p ]... [-o ] + get-tree [-p ]... [-o ] + methods + get-capabilities [-p ]... [-o ] + operations + wait-execution (-r )... [-p ]... [-o ] + remotebuildexecution2 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `remotebuildexecution2-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/remotebuildexecution2-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/remotebuildexecution2-secret.json`, assuming that the required *remotebuildexecution* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `remotebuildexecution2 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/remotebuildexecution2-cli/mkdocs.yml b/gen/remotebuildexecution2-cli/mkdocs.yml new file mode 100644 index 0000000000..6d9a4e85f9 --- /dev/null +++ b/gen/remotebuildexecution2-cli/mkdocs.yml @@ -0,0 +1,25 @@ +site_name: Remote Build Execution v1.0.8+20190326 +site_url: http://byron.github.io/google-apis-rs/google-remotebuildexecution2-cli +site_description: A complete library to interact with Remote Build Execution (protocol v2) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/remotebuildexecution2-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['action-results_get.md', 'Action Results', 'Get'] +- ['action-results_update.md', 'Action Results', 'Update'] +- ['actions_execute.md', 'Actions', 'Execute'] +- ['blobs_batch-read.md', 'Blobs', 'Batch Read'] +- ['blobs_batch-update.md', 'Blobs', 'Batch Update'] +- ['blobs_find-missing.md', 'Blobs', 'Find Missing'] +- ['blobs_get-tree.md', 'Blobs', 'Get Tree'] +- ['methods_get-capabilities.md', 'Methods', 'Get Capabilities'] +- ['operations_wait-execution.md', 'Operations', 'Wait Execution'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/remotebuildexecution2-cli/src/cmn.rs b/gen/remotebuildexecution2-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/remotebuildexecution2-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/remotebuildexecution2-cli/src/main.rs b/gen/remotebuildexecution2-cli/src/main.rs new file mode 100644 index 0000000000..cb5aa673c0 --- /dev/null +++ b/gen/remotebuildexecution2-cli/src/main.rs @@ -0,0 +1,1470 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_remotebuildexecution2 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::RemoteBuildExecution>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _action_results_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.action_results().get(opt.value_of("instance-name").unwrap_or(""), opt.value_of("hash").unwrap_or(""), opt.value_of("size-bytes").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _action_results_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "execution-metadata.output-upload-start-timestamp" => Some(("executionMetadata.outputUploadStartTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "execution-metadata.worker-completed-timestamp" => Some(("executionMetadata.workerCompletedTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "execution-metadata.queued-timestamp" => Some(("executionMetadata.queuedTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "execution-metadata.worker" => Some(("executionMetadata.worker", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "execution-metadata.execution-start-timestamp" => Some(("executionMetadata.executionStartTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "execution-metadata.input-fetch-start-timestamp" => Some(("executionMetadata.inputFetchStartTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "execution-metadata.worker-start-timestamp" => Some(("executionMetadata.workerStartTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "execution-metadata.output-upload-completed-timestamp" => Some(("executionMetadata.outputUploadCompletedTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "execution-metadata.execution-completed-timestamp" => Some(("executionMetadata.executionCompletedTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "execution-metadata.input-fetch-completed-timestamp" => Some(("executionMetadata.inputFetchCompletedTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "stderr-digest.size-bytes" => Some(("stderrDigest.sizeBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "stderr-digest.hash" => Some(("stderrDigest.hash", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "stdout-raw" => Some(("stdoutRaw", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "stderr-raw" => Some(("stderrRaw", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "stdout-digest.size-bytes" => Some(("stdoutDigest.sizeBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "stdout-digest.hash" => Some(("stdoutDigest.hash", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exit-code" => Some(("exitCode", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["execution-completed-timestamp", "execution-metadata", "execution-start-timestamp", "exit-code", "hash", "input-fetch-completed-timestamp", "input-fetch-start-timestamp", "output-upload-completed-timestamp", "output-upload-start-timestamp", "queued-timestamp", "size-bytes", "stderr-digest", "stderr-raw", "stdout-digest", "stdout-raw", "worker", "worker-completed-timestamp", "worker-start-timestamp"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BuildBazelRemoteExecutionV2ActionResult = json::value::from_value(object).unwrap(); + let mut call = self.hub.action_results().update(request, opt.value_of("instance-name").unwrap_or(""), opt.value_of("hash").unwrap_or(""), opt.value_of("size-bytes").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "results-cache-policy-priority" => { + call = call.results_cache_policy_priority(arg_from_str(value.unwrap_or("-0"), err, "results-cache-policy-priority", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["results-cache-policy-priority"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _actions_execute(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "results-cache-policy.priority" => Some(("resultsCachePolicy.priority", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "skip-cache-lookup" => Some(("skipCacheLookup", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "action-digest.size-bytes" => Some(("actionDigest.sizeBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "action-digest.hash" => Some(("actionDigest.hash", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "execution-policy.priority" => Some(("executionPolicy.priority", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["action-digest", "execution-policy", "hash", "priority", "results-cache-policy", "size-bytes", "skip-cache-lookup"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BuildBazelRemoteExecutionV2ExecuteRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.actions().execute(request, opt.value_of("instance-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _blobs_batch_read(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BuildBazelRemoteExecutionV2BatchReadBlobsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.blobs().batch_read(request, opt.value_of("instance-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _blobs_batch_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.blobs().batch_update(request, opt.value_of("instance-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _blobs_find_missing(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BuildBazelRemoteExecutionV2FindMissingBlobsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.blobs().find_missing(request, opt.value_of("instance-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _blobs_get_tree(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.blobs().get_tree(opt.value_of("instance-name").unwrap_or(""), opt.value_of("hash").unwrap_or(""), opt.value_of("size-bytes").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _methods_get_capabilities(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.methods().get_capabilities(opt.value_of("instance-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operations_wait_execution(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::BuildBazelRemoteExecutionV2WaitExecutionRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.operations().wait_execution(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("action-results", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._action_results_get(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._action_results_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("action-results".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("actions", Some(opt)) => { + match opt.subcommand() { + ("execute", Some(opt)) => { + call_result = self._actions_execute(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("actions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("blobs", Some(opt)) => { + match opt.subcommand() { + ("batch-read", Some(opt)) => { + call_result = self._blobs_batch_read(opt, dry_run, &mut err); + }, + ("batch-update", Some(opt)) => { + call_result = self._blobs_batch_update(opt, dry_run, &mut err); + }, + ("find-missing", Some(opt)) => { + call_result = self._blobs_find_missing(opt, dry_run, &mut err); + }, + ("get-tree", Some(opt)) => { + call_result = self._blobs_get_tree(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("blobs".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("methods", Some(opt)) => { + match opt.subcommand() { + ("get-capabilities", Some(opt)) => { + call_result = self._methods_get_capabilities(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("methods".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("operations", Some(opt)) => { + match opt.subcommand() { + ("wait-execution", Some(opt)) => { + call_result = self._operations_wait_execution(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "remotebuildexecution2-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "remotebuildexecution2", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::RemoteBuildExecution::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("action-results", "methods: 'get' and 'update'", vec![ + ("get", + Some(r##"Retrieve a cached execution result. + + Errors: + + * `NOT_FOUND`: The requested `ActionResult` is not in the cache."##), + "Details at http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli/action-results_get", + vec![ + (Some(r##"instance-name"##), + None, + Some(r##"The instance of the execution system to operate against. A server may + support multiple instances of the execution system (with their own workers, + storage, caches, etc.). The server MAY require use of this field to select + between them in an implementation-defined fashion, otherwise it can be + omitted."##), + Some(true), + Some(false)), + + (Some(r##"hash"##), + None, + Some(r##"The hash. In the case of SHA-256, it will always be a lowercase hex string + exactly 64 characters long."##), + Some(true), + Some(false)), + + (Some(r##"size-bytes"##), + None, + Some(r##"The size of the blob, in bytes."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Upload a new execution result. + + In order to allow the server to perform access control based on the type of + action, and to assist with client debugging, the client MUST first upload + the Action that produced the + result, along with its + Command, into the + `ContentAddressableStorage`. + + Errors: + + * `INVALID_ARGUMENT`: One or more arguments are invalid. + * `FAILED_PRECONDITION`: One or more errors occurred in updating the + action result, such as a missing command or action. + * `RESOURCE_EXHAUSTED`: There is insufficient storage space to add the + entry to the cache."##), + "Details at http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli/action-results_update", + vec![ + (Some(r##"instance-name"##), + None, + Some(r##"The instance of the execution system to operate against. A server may + support multiple instances of the execution system (with their own workers, + storage, caches, etc.). The server MAY require use of this field to select + between them in an implementation-defined fashion, otherwise it can be + omitted."##), + Some(true), + Some(false)), + + (Some(r##"hash"##), + None, + Some(r##"The hash. In the case of SHA-256, it will always be a lowercase hex string + exactly 64 characters long."##), + Some(true), + Some(false)), + + (Some(r##"size-bytes"##), + None, + Some(r##"The size of the blob, in bytes."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("actions", "methods: 'execute'", vec![ + ("execute", + Some(r##"Execute an action remotely. + + In order to execute an action, the client must first upload all of the + inputs, the + Command to run, and the + Action into the + ContentAddressableStorage. + It then calls `Execute` with an `action_digest` referring to them. The + server will run the action and eventually return the result. + + The input `Action`'s fields MUST meet the various canonicalization + requirements specified in the documentation for their types so that it has + the same digest as other logically equivalent `Action`s. The server MAY + enforce the requirements and return errors if a non-canonical input is + received. It MAY also proceed without verifying some or all of the + requirements, such as for performance reasons. If the server does not + verify the requirement, then it will treat the `Action` as distinct from + another logically equivalent action if they hash differently. + + Returns a stream of + google.longrunning.Operation messages + describing the resulting execution, with eventual `response` + ExecuteResponse. The + `metadata` on the operation is of type + ExecuteOperationMetadata. + + If the client remains connected after the first response is returned after + the server, then updates are streamed as if the client had called + WaitExecution + until the execution completes or the request reaches an error. The + operation can also be queried using Operations + API. + + The server NEED NOT implement other methods or functionality of the + Operations API. + + Errors discovered during creation of the `Operation` will be reported + as gRPC Status errors, while errors that occurred while running the + action will be reported in the `status` field of the `ExecuteResponse`. The + server MUST NOT set the `error` field of the `Operation` proto. + The possible errors include: + + * `INVALID_ARGUMENT`: One or more arguments are invalid. + * `FAILED_PRECONDITION`: One or more errors occurred in setting up the + action requested, such as a missing input or command or no worker being + available. The client may be able to fix the errors and retry. + * `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to run + the action. + * `UNAVAILABLE`: Due to a transient condition, such as all workers being + occupied (and the server does not support a queue), the action could not + be started. The client should retry. + * `INTERNAL`: An internal error occurred in the execution engine or the + worker. + * `DEADLINE_EXCEEDED`: The execution timed out. + * `CANCELLED`: The operation was cancelled by the client. This status is + only possible if the server implements the Operations API CancelOperation + method, and it was called for the current execution. + + In the case of a missing input or command, the server SHOULD additionally + send a PreconditionFailure error detail + where, for each requested blob not present in the CAS, there is a + `Violation` with a `type` of `MISSING` and a `subject` of + `"blobs/{hash}/{size}"` indicating the digest of the missing blob."##), + "Details at http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli/actions_execute", + vec![ + (Some(r##"instance-name"##), + None, + Some(r##"The instance of the execution system to operate against. A server may + support multiple instances of the execution system (with their own workers, + storage, caches, etc.). The server MAY require use of this field to select + between them in an implementation-defined fashion, otherwise it can be + omitted."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("blobs", "methods: 'batch-read', 'batch-update', 'find-missing' and 'get-tree'", vec![ + ("batch-read", + Some(r##"Download many blobs at once. + + The server may enforce a limit of the combined total size of blobs + to be downloaded using this API. This limit may be obtained using the + Capabilities API. + Requests exceeding the limit should either be split into smaller + chunks or downloaded using the + ByteStream API, as appropriate. + + This request is equivalent to calling a Bytestream `Read` request + on each individual blob, in parallel. The requests may succeed or fail + independently. + + Errors: + + * `INVALID_ARGUMENT`: The client attempted to read more than the + server supported limit. + + Every error on individual read will be returned in the corresponding digest + status."##), + "Details at http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli/blobs_batch-read", + vec![ + (Some(r##"instance-name"##), + None, + Some(r##"The instance of the execution system to operate against. A server may + support multiple instances of the execution system (with their own workers, + storage, caches, etc.). The server MAY require use of this field to select + between them in an implementation-defined fashion, otherwise it can be + omitted."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("batch-update", + Some(r##"Upload many blobs at once. + + The server may enforce a limit of the combined total size of blobs + to be uploaded using this API. This limit may be obtained using the + Capabilities API. + Requests exceeding the limit should either be split into smaller + chunks or uploaded using the + ByteStream API, as appropriate. + + This request is equivalent to calling a Bytestream `Write` request + on each individual blob, in parallel. The requests may succeed or fail + independently. + + Errors: + + * `INVALID_ARGUMENT`: The client attempted to upload more than the + server supported limit. + + Individual requests may return the following errors, additionally: + + * `RESOURCE_EXHAUSTED`: There is insufficient disk quota to store the blob. + * `INVALID_ARGUMENT`: The + Digest does not match the + provided data."##), + "Details at http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli/blobs_batch-update", + vec![ + (Some(r##"instance-name"##), + None, + Some(r##"The instance of the execution system to operate against. A server may + support multiple instances of the execution system (with their own workers, + storage, caches, etc.). The server MAY require use of this field to select + between them in an implementation-defined fashion, otherwise it can be + omitted."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("find-missing", + Some(r##"Determine if blobs are present in the CAS. + + Clients can use this API before uploading blobs to determine which ones are + already present in the CAS and do not need to be uploaded again. + + There are no method-specific errors."##), + "Details at http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli/blobs_find-missing", + vec![ + (Some(r##"instance-name"##), + None, + Some(r##"The instance of the execution system to operate against. A server may + support multiple instances of the execution system (with their own workers, + storage, caches, etc.). The server MAY require use of this field to select + between them in an implementation-defined fashion, otherwise it can be + omitted."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-tree", + Some(r##"Fetch the entire directory tree rooted at a node. + + This request must be targeted at a + Directory stored in the + ContentAddressableStorage + (CAS). The server will enumerate the `Directory` tree recursively and + return every node descended from the root. + + The GetTreeRequest.page_token parameter can be used to skip ahead in + the stream (e.g. when retrying a partially completed and aborted request), + by setting it to a value taken from GetTreeResponse.next_page_token of the + last successfully processed GetTreeResponse). + + The exact traversal order is unspecified and, unless retrieving subsequent + pages from an earlier request, is not guaranteed to be stable across + multiple invocations of `GetTree`. + + If part of the tree is missing from the CAS, the server will return the + portion present and omit the rest. + + * `NOT_FOUND`: The requested tree root is not present in the CAS."##), + "Details at http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli/blobs_get-tree", + vec![ + (Some(r##"instance-name"##), + None, + Some(r##"The instance of the execution system to operate against. A server may + support multiple instances of the execution system (with their own workers, + storage, caches, etc.). The server MAY require use of this field to select + between them in an implementation-defined fashion, otherwise it can be + omitted."##), + Some(true), + Some(false)), + + (Some(r##"hash"##), + None, + Some(r##"The hash. In the case of SHA-256, it will always be a lowercase hex string + exactly 64 characters long."##), + Some(true), + Some(false)), + + (Some(r##"size-bytes"##), + None, + Some(r##"The size of the blob, in bytes."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("methods", "methods: 'get-capabilities'", vec![ + ("get-capabilities", + Some(r##"GetCapabilities returns the server capabilities configuration."##), + "Details at http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli/methods_get-capabilities", + vec![ + (Some(r##"instance-name"##), + None, + Some(r##"The instance of the execution system to operate against. A server may + support multiple instances of the execution system (with their own workers, + storage, caches, etc.). The server MAY require use of this field to select + between them in an implementation-defined fashion, otherwise it can be + omitted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("operations", "methods: 'wait-execution'", vec![ + ("wait-execution", + Some(r##"Wait for an execution operation to complete. When the client initially + makes the request, the server immediately responds with the current status + of the execution. The server will leave the request stream open until the + operation completes, and then respond with the completed operation. The + server MAY choose to stream additional updates as execution progresses, + such as to provide an update as to the state of the execution."##), + "Details at http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli/operations_wait-execution", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the Operation + returned by Execute."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("remotebuildexecution2") + .author("Sebastian Thiel ") + .version("1.0.8+20190326") + .about("Supplies a Remote Execution API service for tools such as bazel.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_remotebuildexecution2_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/remotebuildexecution2/Cargo.toml b/gen/remotebuildexecution2/Cargo.toml new file mode 100644 index 0000000000..2937457047 --- /dev/null +++ b/gen/remotebuildexecution2/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-remotebuildexecution2" +version = "1.0.8+20190326" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Remote Build Execution (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/remotebuildexecution2" +homepage = "https://cloud.google.com/remote-build-execution/docs/" +documentation = "https://docs.rs/google-remotebuildexecution2/1.0.8+20190326" +license = "MIT" +keywords = ["remotebuildexecution", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/remotebuildexecution2/LICENSE.md b/gen/remotebuildexecution2/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/remotebuildexecution2/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/remotebuildexecution2/README.md b/gen/remotebuildexecution2/README.md new file mode 100644 index 0000000000..051c360c84 --- /dev/null +++ b/gen/remotebuildexecution2/README.md @@ -0,0 +1,199 @@ + +The `google-remotebuildexecution2` library allows access to all features of the *Google Remote Build Execution* service. + +This documentation was generated from *Remote Build Execution* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *remotebuildexecution:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Remote Build Execution* *v2* API can be found at the +[official documentation site](https://cloud.google.com/remote-build-execution/docs/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.RemoteBuildExecution.html) ... + +* action results + * [*get*](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.ActionResultGetCall.html) and [*update*](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.ActionResultUpdateCall.html) +* actions + * [*execute*](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.ActionExecuteCall.html) +* blobs + * [*batch read*](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.BlobBatchReadCall.html), [*batch update*](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.BlobBatchUpdateCall.html), [*find missing*](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.BlobFindMissingCall.html) and [*get tree*](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.BlobGetTreeCall.html) +* operations + * [*wait execution*](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.OperationWaitExecutionCall.html) + +Other activities are ... + +* [get capabilities](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.MethodGetCapabilityCall.html) + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/struct.RemoteBuildExecution.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.action_results().get(...).doit() +let r = hub.action_results().update(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-remotebuildexecution2 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_remotebuildexecution2 as remotebuildexecution2; +use remotebuildexecution2::BuildBazelRemoteExecutionV2ActionResult; +use remotebuildexecution2::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use remotebuildexecution2::RemoteBuildExecution; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = BuildBazelRemoteExecutionV2ActionResult::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.action_results().update(req, "instanceName", "hash", "sizeBytes") + .results_cache_policy_priority(-42) + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-remotebuildexecution2/1.0.8+20190326/google_remotebuildexecution2/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **remotebuildexecution2** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/remotebuildexecution2/src/cmn.rs b/gen/remotebuildexecution2/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/remotebuildexecution2/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/remotebuildexecution2/src/lib.rs b/gen/remotebuildexecution2/src/lib.rs new file mode 100644 index 0000000000..ef68f27c9d --- /dev/null +++ b/gen/remotebuildexecution2/src/lib.rs @@ -0,0 +1,4710 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Remote Build Execution* crate version *1.0.8+20190326*, where *20190326* is the exact revision of the *remotebuildexecution:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Remote Build Execution* *v2* API can be found at the +//! [official documentation site](https://cloud.google.com/remote-build-execution/docs/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/remotebuildexecution2). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.RemoteBuildExecution.html) ... +//! +//! * action results +//! * [*get*](struct.ActionResultGetCall.html) and [*update*](struct.ActionResultUpdateCall.html) +//! * actions +//! * [*execute*](struct.ActionExecuteCall.html) +//! * blobs +//! * [*batch read*](struct.BlobBatchReadCall.html), [*batch update*](struct.BlobBatchUpdateCall.html), [*find missing*](struct.BlobFindMissingCall.html) and [*get tree*](struct.BlobGetTreeCall.html) +//! * operations +//! * [*wait execution*](struct.OperationWaitExecutionCall.html) +//! +//! Other activities are ... +//! +//! * [get capabilities](struct.MethodGetCapabilityCall.html) +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.RemoteBuildExecution.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.action_results().get(...).doit() +//! let r = hub.action_results().update(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-remotebuildexecution2 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_remotebuildexecution2 as remotebuildexecution2; +//! use remotebuildexecution2::BuildBazelRemoteExecutionV2ActionResult; +//! use remotebuildexecution2::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use remotebuildexecution2::RemoteBuildExecution; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = BuildBazelRemoteExecutionV2ActionResult::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.action_results().update(req, "instanceName", "hash", "sizeBytes") +//! .results_cache_policy_priority(-22) +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all RemoteBuildExecution related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// use remotebuildexecution2::BuildBazelRemoteExecutionV2ActionResult; +/// use remotebuildexecution2::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use remotebuildexecution2::RemoteBuildExecution; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BuildBazelRemoteExecutionV2ActionResult::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.action_results().update(req, "instanceName", "hash", "sizeBytes") +/// .results_cache_policy_priority(-81) +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct RemoteBuildExecution { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for RemoteBuildExecution {} + +impl<'a, C, A> RemoteBuildExecution + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> RemoteBuildExecution { + RemoteBuildExecution { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://remotebuildexecution.googleapis.com/".to_string(), + _root_url: "https://remotebuildexecution.googleapis.com/".to_string(), + } + } + + pub fn action_results(&'a self) -> ActionResultMethods<'a, C, A> { + ActionResultMethods { hub: &self } + } + pub fn actions(&'a self) -> ActionMethods<'a, C, A> { + ActionMethods { hub: &self } + } + pub fn blobs(&'a self) -> BlobMethods<'a, C, A> { + BlobMethods { hub: &self } + } + pub fn methods(&'a self) -> MethodMethods<'a, C, A> { + MethodMethods { hub: &self } + } + pub fn operations(&'a self) -> OperationMethods<'a, C, A> { + OperationMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://remotebuildexecution.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://remotebuildexecution.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Supported range of priorities, including boundaries. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange { + /// no description provided + #[serde(rename="maxPriority")] + pub max_priority: Option, + /// no description provided + #[serde(rename="minPriority")] + pub min_priority: Option, +} + +impl Part for BuildBazelRemoteExecutionV2PriorityCapabilitiesPriorityRange {} + + +/// A `SymlinkNode` represents a symbolic link. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2SymlinkNode { + /// The name of the symlink. + pub name: Option, + /// The target path of the symlink. The path separator is a forward slash `/`. + /// The target path can be relative to the parent directory of the symlink or + /// it can be an absolute path starting with `/`. Support for absolute paths + /// can be checked using the Capabilities + /// API. The canonical form forbids the substrings `/./` and `//` in the target + /// path. `..` components are allowed anywhere in the target path. + pub target: Option, +} + +impl Part for BuildBazelRemoteExecutionV2SymlinkNode {} + + +/// A `Directory` represents a directory node in a file tree, containing zero or +/// more children FileNodes, +/// DirectoryNodes and +/// SymlinkNodes. +/// Each `Node` contains its name in the directory, either the digest of its +/// content (either a file blob or a `Directory` proto) or a symlink target, as +/// well as possibly some metadata about the file or directory. +/// +/// In order to ensure that two equivalent directory trees hash to the same +/// value, the following restrictions MUST be obeyed when constructing a +/// a `Directory`: +/// +/// * Every child in the directory must have a path of exactly one segment. +/// Multiple levels of directory hierarchy may not be collapsed. +/// * Each child in the directory must have a unique path segment (file name). +/// * The files, directories and symlinks in the directory must each be sorted +/// in lexicographical order by path. The path strings must be sorted by code +/// point, equivalently, by UTF-8 bytes. +/// +/// A `Directory` that obeys the restrictions is said to be in canonical form. +/// +/// As an example, the following could be used for a file named `bar` and a +/// directory named `foo` with an executable file named `baz` (hashes shortened +/// for readability): +/// +/// ```json +/// // (Directory proto) +/// { +/// files: [ +/// { +/// name: "bar", +/// digest: { +/// hash: "4a73bc9d03...", +/// size: 65534 +/// } +/// } +/// ], +/// directories: [ +/// { +/// name: "foo", +/// digest: { +/// hash: "4cf2eda940...", +/// size: 43 +/// } +/// } +/// ] +/// } +/// +/// // (Directory proto with hash "4cf2eda940..." and size 43) +/// { +/// files: [ +/// { +/// name: "baz", +/// digest: { +/// hash: "b2c941073e...", +/// size: 1294, +/// }, +/// is_executable: true +/// } +/// ] +/// } +/// ``` +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2Directory { + /// The files in the directory. + pub files: Option>, + /// The symlinks in the directory. + pub symlinks: Option>, + /// The subdirectories in the directory. + pub directories: Option>, +} + +impl Part for BuildBazelRemoteExecutionV2Directory {} + + +/// A response message for +/// ContentAddressableStorage.FindMissingBlobs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [find missing blobs](struct.BlobFindMissingCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2FindMissingBlobsResponse { + /// A list of the blobs requested *not* present in the storage. + #[serde(rename="missingBlobDigests")] + pub missing_blob_digests: Option>, +} + +impl ResponseResult for BuildBazelRemoteExecutionV2FindMissingBlobsResponse {} + + +/// A response message for +/// ContentAddressableStorage.GetTree. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get tree blobs](struct.BlobGetTreeCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2GetTreeResponse { + /// If present, signifies that there are more results which the client can + /// retrieve by passing this as the page_token in a subsequent + /// request. + /// If empty, signifies that this is the last page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The directories descended from the requested root. + pub directories: Option>, +} + +impl ResponseResult for BuildBazelRemoteExecutionV2GetTreeResponse {} + + +/// A request message for +/// ContentAddressableStorage.BatchReadBlobs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batch read blobs](struct.BlobBatchReadCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2BatchReadBlobsRequest { + /// The individual blob digests. + pub digests: Option>, +} + +impl RequestValue for BuildBazelRemoteExecutionV2BatchReadBlobsRequest {} + + +/// Allowed values for priority in +/// ResultsCachePolicy +/// Used for querying both cache and execution valid priority ranges. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2PriorityCapabilities { + /// no description provided + pub priorities: Option>, +} + +impl Part for BuildBazelRemoteExecutionV2PriorityCapabilities {} + + +/// A request message for +/// WaitExecution. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [wait execution operations](struct.OperationWaitExecutionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2WaitExecutionRequest { _never_set: Option } + +impl RequestValue for BuildBazelRemoteExecutionV2WaitExecutionRequest {} + + +/// A request corresponding to a single blob that the client wants to upload. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest { + /// The raw binary data. + pub data: Option, + /// The digest of the blob. This MUST be the digest of `data`. + pub digest: Option, +} + +impl Part for BuildBazelRemoteExecutionV2BatchUpdateBlobsRequestRequest {} + + +/// An ActionResult represents the result of an +/// Action being run. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get action results](struct.ActionResultGetCall.html) (response) +/// * [update action results](struct.ActionResultUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2ActionResult { + /// The details of the execution that originally produced this result. + #[serde(rename="executionMetadata")] + pub execution_metadata: Option, + /// The output files of the action that are symbolic links to other files. Those + /// may be links to other output files, or input files, or even absolute paths + /// outside of the working directory, if the server supports + /// SymlinkAbsolutePathStrategy.ALLOWED. + /// For each output file requested in the `output_files` field of the Action, + /// if the corresponding file existed after + /// the action completed, a single entry will be present either in this field, + /// or in the `output_files` field, if the file was not a symbolic link. + /// + /// If the action does not produce the requested output, or produces a + /// directory where a regular file is expected or vice versa, then that output + /// will be omitted from the list. The server is free to arrange the output + /// list as desired; clients MUST NOT assume that the output list is sorted. + #[serde(rename="outputFileSymlinks")] + pub output_file_symlinks: Option>, + /// The digest for a blob containing the standard error of the action, which + /// can be retrieved from the + /// ContentAddressableStorage. + /// See `stderr_raw` for when this will be set. + #[serde(rename="stderrDigest")] + pub stderr_digest: Option, + /// The standard output buffer of the action. The server will determine, based + /// on the size of the buffer, whether to return it in raw form or to return + /// a digest in `stdout_digest` that points to the buffer. If neither is set, + /// then the buffer is empty. The client SHOULD NOT assume it will get one of + /// the raw buffer or a digest on any given request and should be prepared to + /// handle either. + #[serde(rename="stdoutRaw")] + pub stdout_raw: Option, + /// The standard error buffer of the action. The server will determine, based + /// on the size of the buffer, whether to return it in raw form or to return + /// a digest in `stderr_digest` that points to the buffer. If neither is set, + /// then the buffer is empty. The client SHOULD NOT assume it will get one of + /// the raw buffer or a digest on any given request and should be prepared to + /// handle either. + #[serde(rename="stderrRaw")] + pub stderr_raw: Option, + /// The digest for a blob containing the standard output of the action, which + /// can be retrieved from the + /// ContentAddressableStorage. + /// See `stdout_raw` for when this will be set. + #[serde(rename="stdoutDigest")] + pub stdout_digest: Option, + /// The output files of the action. For each output file requested in the + /// `output_files` field of the Action, if the corresponding file existed after + /// the action completed, a single entry will be present either in this field, + /// or in the output_file_symlinks field, if the file was a symbolic link to + /// another file. + /// + /// If the action does not produce the requested output, or produces a + /// directory where a regular file is expected or vice versa, then that output + /// will be omitted from the list. The server is free to arrange the output + /// list as desired; clients MUST NOT assume that the output list is sorted. + #[serde(rename="outputFiles")] + pub output_files: Option>, + /// The output directories of the action that are symbolic links to other + /// directories. Those may be links to other output directories, or input + /// directories, or even absolute paths outside of the working directory, + /// if the server supports + /// SymlinkAbsolutePathStrategy.ALLOWED. + /// For each output directory requested in the `output_directories` field of + /// the Action, if the directory file existed after + /// the action completed, a single entry will be present either in this field, + /// or in the `output_directories` field, if the directory was not a symbolic link. + /// + /// If the action does not produce the requested output, or produces a + /// file where a directory is expected or vice versa, then that output + /// will be omitted from the list. The server is free to arrange the output + /// list as desired; clients MUST NOT assume that the output list is sorted. + #[serde(rename="outputDirectorySymlinks")] + pub output_directory_symlinks: Option>, + /// The output directories of the action. For each output directory requested + /// in the `output_directories` field of the Action, if the corresponding + /// directory existed after the action completed, a single entry will be + /// present in the output list, which will contain the digest of a + /// Tree message containing the + /// directory tree, and the path equal exactly to the corresponding Action + /// output_directories member. + /// + /// As an example, suppose the Action had an output directory `a/b/dir` and the + /// execution produced the following contents in `a/b/dir`: a file named `bar` + /// and a directory named `foo` with an executable file named `baz`. Then, + /// output_directory will contain (hashes shortened for readability): + /// + /// ```json + /// // OutputDirectory proto: + /// { + /// path: "a/b/dir" + /// tree_digest: { + /// hash: "4a73bc9d03...", + /// size: 55 + /// } + /// } + /// // Tree proto with hash "4a73bc9d03..." and size 55: + /// { + /// root: { + /// files: [ + /// { + /// name: "bar", + /// digest: { + /// hash: "4a73bc9d03...", + /// size: 65534 + /// } + /// } + /// ], + /// directories: [ + /// { + /// name: "foo", + /// digest: { + /// hash: "4cf2eda940...", + /// size: 43 + /// } + /// } + /// ] + /// } + /// children : { + /// // (Directory proto with hash "4cf2eda940..." and size 43) + /// files: [ + /// { + /// name: "baz", + /// digest: { + /// hash: "b2c941073e...", + /// size: 1294, + /// }, + /// is_executable: true + /// } + /// ] + /// } + /// } + /// ``` + #[serde(rename="outputDirectories")] + pub output_directories: Option>, + /// The exit code of the command. + #[serde(rename="exitCode")] + pub exit_code: Option, +} + +impl RequestValue for BuildBazelRemoteExecutionV2ActionResult {} +impl ResponseResult for BuildBazelRemoteExecutionV2ActionResult {} + + +/// A response message for +/// Capabilities.GetCapabilities. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get capabilities](struct.MethodGetCapabilityCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2ServerCapabilities { + /// Earliest RE API version supported, including deprecated versions. + #[serde(rename="deprecatedApiVersion")] + pub deprecated_api_version: Option, + /// Earliest non-deprecated RE API version supported. + #[serde(rename="lowApiVersion")] + pub low_api_version: Option, + /// Capabilities of the remote cache system. + #[serde(rename="cacheCapabilities")] + pub cache_capabilities: Option, + /// Latest RE API version supported. + #[serde(rename="highApiVersion")] + pub high_api_version: Option, + /// Capabilities of the remote execution system. + #[serde(rename="executionCapabilities")] + pub execution_capabilities: Option, +} + +impl ResponseResult for BuildBazelRemoteExecutionV2ServerCapabilities {} + + +/// A response message for +/// ContentAddressableStorage.BatchReadBlobs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batch read blobs](struct.BlobBatchReadCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2BatchReadBlobsResponse { + /// The responses to the requests. + pub responses: Option>, +} + +impl ResponseResult for BuildBazelRemoteExecutionV2BatchReadBlobsResponse {} + + +/// A `DirectoryNode` represents a child of a +/// Directory which is itself +/// a `Directory` and its associated metadata. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2DirectoryNode { + /// The name of the directory. + pub name: Option, + /// The digest of the + /// Directory object + /// represented. See Digest + /// for information about how to take the digest of a proto message. + pub digest: Option, +} + +impl Part for BuildBazelRemoteExecutionV2DirectoryNode {} + + +/// An `OutputDirectory` is the output in an `ActionResult` corresponding to a +/// directory's full contents rather than a single file. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2OutputDirectory { + /// The full path of the directory relative to the working directory. The path + /// separator is a forward slash `/`. Since this is a relative path, it MUST + /// NOT begin with a leading forward slash. The empty string value is allowed, + /// and it denotes the entire working directory. + pub path: Option, + /// The digest of the encoded + /// Tree proto containing the + /// directory's contents. + #[serde(rename="treeDigest")] + pub tree_digest: Option, +} + +impl Part for BuildBazelRemoteExecutionV2OutputDirectory {} + + +/// A request message for +/// Execution.Execute. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [execute actions](struct.ActionExecuteCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2ExecuteRequest { + /// An optional policy for the results of this execution in the remote cache. + /// The server will have a default policy if this is not provided. + /// This may be applied to both the ActionResult and the associated blobs. + #[serde(rename="resultsCachePolicy")] + pub results_cache_policy: Option, + /// If true, the action will be executed anew even if its result was already + /// present in the cache. If false, the result may be served from the + /// ActionCache. + #[serde(rename="skipCacheLookup")] + pub skip_cache_lookup: Option, + /// The digest of the Action to + /// execute. + #[serde(rename="actionDigest")] + pub action_digest: Option, + /// An optional policy for execution of the action. + /// The server will have a default policy if this is not provided. + #[serde(rename="executionPolicy")] + pub execution_policy: Option, +} + +impl RequestValue for BuildBazelRemoteExecutionV2ExecuteRequest {} + + +/// Describes the server/instance capabilities for updating the action cache. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities { + /// no description provided + #[serde(rename="updateEnabled")] + pub update_enabled: Option, +} + +impl Part for BuildBazelRemoteExecutionV2ActionCacheUpdateCapabilities {} + + +/// Capabilities of the remote cache system. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2CacheCapabilities { + /// Supported cache priority range for both CAS and ActionCache. + #[serde(rename="cachePriorityCapabilities")] + pub cache_priority_capabilities: Option, + /// Maximum total size of blobs to be uploaded/downloaded using + /// batch methods. A value of 0 means no limit is set, although + /// in practice there will always be a message size limitation + /// of the protocol in use, e.g. GRPC. + #[serde(rename="maxBatchTotalSizeBytes")] + pub max_batch_total_size_bytes: Option, + /// Capabilities for updating the action cache. + #[serde(rename="actionCacheUpdateCapabilities")] + pub action_cache_update_capabilities: Option, + /// All the digest functions supported by the remote cache. + /// Remote cache may support multiple digest functions simultaneously. + #[serde(rename="digestFunction")] + pub digest_function: Option>, + /// Whether absolute symlink targets are supported. + #[serde(rename="symlinkAbsolutePathStrategy")] + pub symlink_absolute_path_strategy: Option, +} + +impl Part for BuildBazelRemoteExecutionV2CacheCapabilities {} + + +/// The full version of a given tool. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelSemverSemVer { + /// The major version, e.g 10 for 10.2.3. + pub major: Option, + /// The pre-release version. Either this field or major/minor/patch fields + /// must be filled. They are mutually exclusive. Pre-release versions are + /// assumed to be earlier than any released versions. + pub prerelease: Option, + /// The minor version, e.g. 2 for 10.2.3. + pub minor: Option, + /// The patch version, e.g 3 for 10.2.3. + pub patch: Option, +} + +impl Part for BuildBazelSemverSemVer {} + + +/// A request message for +/// ContentAddressableStorage.FindMissingBlobs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [find missing blobs](struct.BlobFindMissingCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2FindMissingBlobsRequest { + /// A list of the blobs to check. + #[serde(rename="blobDigests")] + pub blob_digests: Option>, +} + +impl RequestValue for BuildBazelRemoteExecutionV2FindMissingBlobsRequest {} + + +/// A response corresponding to a single blob that the client tried to upload. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2BatchReadBlobsResponseResponse { + /// The result of attempting to download that blob. + pub status: Option, + /// The raw binary data. + pub data: Option, + /// The digest to which this response corresponds. + pub digest: Option, +} + +impl Part for BuildBazelRemoteExecutionV2BatchReadBlobsResponseResponse {} + + +/// An `OutputSymlink` is similar to a +/// Symlink, but it is used as an +/// output in an `ActionResult`. +/// +/// `OutputSymlink` is binary-compatible with `SymlinkNode`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2OutputSymlink { + /// The full path of the symlink relative to the working directory, including the + /// filename. The path separator is a forward slash `/`. Since this is a + /// relative path, it MUST NOT begin with a leading forward slash. + pub path: Option, + /// The target path of the symlink. The path separator is a forward slash `/`. + /// The target path can be relative to the parent directory of the symlink or + /// it can be an absolute path starting with `/`. Support for absolute paths + /// can be checked using the Capabilities + /// API. The canonical form forbids the substrings `/./` and `//` in the target + /// path. `..` components are allowed anywhere in the target path. + pub target: Option, +} + +impl Part for BuildBazelRemoteExecutionV2OutputSymlink {} + + +/// A response corresponding to a single blob that the client tried to upload. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2BatchUpdateBlobsResponseResponse { + /// The result of attempting to upload that blob. + pub status: Option, + /// The blob digest to which this response corresponds. + pub digest: Option, +} + +impl Part for BuildBazelRemoteExecutionV2BatchUpdateBlobsResponseResponse {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleRpcStatus { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for GoogleRpcStatus {} + + +/// A `FileNode` represents a single file and associated metadata. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2FileNode { + /// True if file is executable, false otherwise. + #[serde(rename="isExecutable")] + pub is_executable: Option, + /// The name of the file. + pub name: Option, + /// The digest of the file's content. + pub digest: Option, +} + +impl Part for BuildBazelRemoteExecutionV2FileNode {} + + +/// An `OutputFile` is similar to a +/// FileNode, but it is used as an +/// output in an `ActionResult`. It allows a full file path rather than +/// only a name. +/// +/// `OutputFile` is binary-compatible with `FileNode`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2OutputFile { + /// The full path of the file relative to the working directory, including the + /// filename. The path separator is a forward slash `/`. Since this is a + /// relative path, it MUST NOT begin with a leading forward slash. + pub path: Option, + /// True if file is executable, false otherwise. + #[serde(rename="isExecutable")] + pub is_executable: Option, + /// The digest of the file's content. + pub digest: Option, +} + +impl Part for BuildBazelRemoteExecutionV2OutputFile {} + + +/// A response message for +/// ContentAddressableStorage.BatchUpdateBlobs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batch update blobs](struct.BlobBatchUpdateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2BatchUpdateBlobsResponse { + /// The responses to the requests. + pub responses: Option>, +} + +impl ResponseResult for BuildBazelRemoteExecutionV2BatchUpdateBlobsResponse {} + + +/// A content digest. A digest for a given blob consists of the size of the blob +/// and its hash. The hash algorithm to use is defined by the server, but servers +/// SHOULD use SHA-256. +/// +/// The size is considered to be an integral part of the digest and cannot be +/// separated. That is, even if the `hash` field is correctly specified but +/// `size_bytes` is not, the server MUST reject the request. +/// +/// The reason for including the size in the digest is as follows: in a great +/// many cases, the server needs to know the size of the blob it is about to work +/// with prior to starting an operation with it, such as flattening Merkle tree +/// structures or streaming it to a worker. Technically, the server could +/// implement a separate metadata store, but this results in a significantly more +/// complicated implementation as opposed to having the client specify the size +/// up-front (or storing the size along with the digest in every message where +/// digests are embedded). This does mean that the API leaks some implementation +/// details of (what we consider to be) a reasonable server implementation, but +/// we consider this to be a worthwhile tradeoff. +/// +/// When a `Digest` is used to refer to a proto message, it always refers to the +/// message in binary encoded form. To ensure consistent hashing, clients and +/// servers MUST ensure that they serialize messages according to the following +/// rules, even if there are alternate valid encodings for the same message: +/// +/// * Fields are serialized in tag order. +/// * There are no unknown fields. +/// * There are no duplicate fields. +/// * Fields are serialized according to the default semantics for their type. +/// +/// Most protocol buffer implementations will always follow these rules when +/// serializing, but care should be taken to avoid shortcuts. For instance, +/// concatenating two messages to merge them may produce duplicate fields. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2Digest { + /// The size of the blob, in bytes. + #[serde(rename="sizeBytes")] + pub size_bytes: Option, + /// The hash. In the case of SHA-256, it will always be a lowercase hex string + /// exactly 64 characters long. + pub hash: Option, +} + +impl Part for BuildBazelRemoteExecutionV2Digest {} + + +/// A request message for +/// ContentAddressableStorage.BatchUpdateBlobs. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [batch update blobs](struct.BlobBatchUpdateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest { + /// The individual upload requests. + pub requests: Option>, +} + +impl RequestValue for BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest {} + + +/// A `ResultsCachePolicy` is used for fine-grained control over how action +/// outputs are stored in the CAS and Action Cache. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2ResultsCachePolicy { + /// The priority (relative importance) of this content in the overall cache. + /// Generally, a lower value means a longer retention time or other advantage, + /// but the interpretation of a given value is server-dependent. A priority of + /// 0 means a *default* value, decided by the server. + /// + /// The particular semantics of this field is up to the server. In particular, + /// every server will have their own supported range of priorities, and will + /// decide how these map into retention/eviction policy. + pub priority: Option, +} + +impl Part for BuildBazelRemoteExecutionV2ResultsCachePolicy {} + + +/// An `ExecutionPolicy` can be used to control the scheduling of the action. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2ExecutionPolicy { + /// The priority (relative importance) of this action. Generally, a lower value + /// means that the action should be run sooner than actions having a greater + /// priority value, but the interpretation of a given value is server- + /// dependent. A priority of 0 means the *default* priority. Priorities may be + /// positive or negative, and such actions should run later or sooner than + /// actions having the default priority, respectively. The particular semantics + /// of this field is up to the server. In particular, every server will have + /// their own supported range of priorities, and will decide how these map into + /// scheduling policy. + pub priority: Option, +} + +impl Part for BuildBazelRemoteExecutionV2ExecutionPolicy {} + + +/// Capabilities of the remote execution system. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2ExecutionCapabilities { + /// Supported execution priority range. + #[serde(rename="executionPriorityCapabilities")] + pub execution_priority_capabilities: Option, + /// Whether remote execution is enabled for the particular server/instance. + #[serde(rename="execEnabled")] + pub exec_enabled: Option, + /// Remote execution may only support a single digest function. + #[serde(rename="digestFunction")] + pub digest_function: Option, +} + +impl Part for BuildBazelRemoteExecutionV2ExecutionCapabilities {} + + +/// ExecutedActionMetadata contains details about a completed execution. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BuildBazelRemoteExecutionV2ExecutedActionMetadata { + /// When the worker started uploading action outputs. + #[serde(rename="outputUploadStartTimestamp")] + pub output_upload_start_timestamp: Option, + /// When the worker completed the action, including all stages. + #[serde(rename="workerCompletedTimestamp")] + pub worker_completed_timestamp: Option, + /// When was the action added to the queue. + #[serde(rename="queuedTimestamp")] + pub queued_timestamp: Option, + /// The name of the worker which ran the execution. + pub worker: Option, + /// When the worker started executing the action command. + #[serde(rename="executionStartTimestamp")] + pub execution_start_timestamp: Option, + /// When the worker completed executing the action command. + #[serde(rename="executionCompletedTimestamp")] + pub execution_completed_timestamp: Option, + /// When the worker received the action. + #[serde(rename="workerStartTimestamp")] + pub worker_start_timestamp: Option, + /// When the worker finished uploading action outputs. + #[serde(rename="outputUploadCompletedTimestamp")] + pub output_upload_completed_timestamp: Option, + /// When the worker started fetching action inputs. + #[serde(rename="inputFetchStartTimestamp")] + pub input_fetch_start_timestamp: Option, + /// When the worker finished fetching action inputs. + #[serde(rename="inputFetchCompletedTimestamp")] + pub input_fetch_completed_timestamp: Option, +} + +impl Part for BuildBazelRemoteExecutionV2ExecutedActionMetadata {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [wait execution operations](struct.OperationWaitExecutionCall.html) (response) +/// * [execute actions](struct.ActionExecuteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleLongrunningOperation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl ResponseResult for GoogleLongrunningOperation {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *operation* resources. +/// It is not used directly, but through the `RemoteBuildExecution` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use remotebuildexecution2::RemoteBuildExecution; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `wait_execution(...)` +/// // to build up your call. +/// let rb = hub.operations(); +/// # } +/// ``` +pub struct OperationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, +} + +impl<'a, C, A> MethodsBuilder for OperationMethods<'a, C, A> {} + +impl<'a, C, A> OperationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Wait for an execution operation to complete. When the client initially + /// makes the request, the server immediately responds with the current status + /// of the execution. The server will leave the request stream open until the + /// operation completes, and then respond with the completed operation. The + /// server MAY choose to stream additional updates as execution progresses, + /// such as to provide an update as to the state of the execution. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The name of the Operation + /// returned by Execute. + pub fn wait_execution(&self, request: BuildBazelRemoteExecutionV2WaitExecutionRequest, name: &str) -> OperationWaitExecutionCall<'a, C, A> { + OperationWaitExecutionCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *actionResult* resources. +/// It is not used directly, but through the `RemoteBuildExecution` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use remotebuildexecution2::RemoteBuildExecution; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.action_results(); +/// # } +/// ``` +pub struct ActionResultMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, +} + +impl<'a, C, A> MethodsBuilder for ActionResultMethods<'a, C, A> {} + +impl<'a, C, A> ActionResultMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieve a cached execution result. + /// + /// Errors: + /// + /// * `NOT_FOUND`: The requested `ActionResult` is not in the cache. + /// + /// # Arguments + /// + /// * `instanceName` - The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// * `hash` - The hash. In the case of SHA-256, it will always be a lowercase hex string + /// exactly 64 characters long. + /// * `sizeBytes` - The size of the blob, in bytes. + pub fn get(&self, instance_name: &str, hash: &str, size_bytes: &str) -> ActionResultGetCall<'a, C, A> { + ActionResultGetCall { + hub: self.hub, + _instance_name: instance_name.to_string(), + _hash: hash.to_string(), + _size_bytes: size_bytes.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Upload a new execution result. + /// + /// In order to allow the server to perform access control based on the type of + /// action, and to assist with client debugging, the client MUST first upload + /// the Action that produced the + /// result, along with its + /// Command, into the + /// `ContentAddressableStorage`. + /// + /// Errors: + /// + /// * `INVALID_ARGUMENT`: One or more arguments are invalid. + /// * `FAILED_PRECONDITION`: One or more errors occurred in updating the + /// action result, such as a missing command or action. + /// * `RESOURCE_EXHAUSTED`: There is insufficient storage space to add the + /// entry to the cache. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `instanceName` - The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// * `hash` - The hash. In the case of SHA-256, it will always be a lowercase hex string + /// exactly 64 characters long. + /// * `sizeBytes` - The size of the blob, in bytes. + pub fn update(&self, request: BuildBazelRemoteExecutionV2ActionResult, instance_name: &str, hash: &str, size_bytes: &str) -> ActionResultUpdateCall<'a, C, A> { + ActionResultUpdateCall { + hub: self.hub, + _request: request, + _instance_name: instance_name.to_string(), + _hash: hash.to_string(), + _size_bytes: size_bytes.to_string(), + _results_cache_policy_priority: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *blob* resources. +/// It is not used directly, but through the `RemoteBuildExecution` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use remotebuildexecution2::RemoteBuildExecution; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `batch_read(...)`, `batch_update(...)`, `find_missing(...)` and `get_tree(...)` +/// // to build up your call. +/// let rb = hub.blobs(); +/// # } +/// ``` +pub struct BlobMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, +} + +impl<'a, C, A> MethodsBuilder for BlobMethods<'a, C, A> {} + +impl<'a, C, A> BlobMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Determine if blobs are present in the CAS. + /// + /// Clients can use this API before uploading blobs to determine which ones are + /// already present in the CAS and do not need to be uploaded again. + /// + /// There are no method-specific errors. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `instanceName` - The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + pub fn find_missing(&self, request: BuildBazelRemoteExecutionV2FindMissingBlobsRequest, instance_name: &str) -> BlobFindMissingCall<'a, C, A> { + BlobFindMissingCall { + hub: self.hub, + _request: request, + _instance_name: instance_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Upload many blobs at once. + /// + /// The server may enforce a limit of the combined total size of blobs + /// to be uploaded using this API. This limit may be obtained using the + /// Capabilities API. + /// Requests exceeding the limit should either be split into smaller + /// chunks or uploaded using the + /// ByteStream API, as appropriate. + /// + /// This request is equivalent to calling a Bytestream `Write` request + /// on each individual blob, in parallel. The requests may succeed or fail + /// independently. + /// + /// Errors: + /// + /// * `INVALID_ARGUMENT`: The client attempted to upload more than the + /// server supported limit. + /// + /// Individual requests may return the following errors, additionally: + /// + /// * `RESOURCE_EXHAUSTED`: There is insufficient disk quota to store the blob. + /// * `INVALID_ARGUMENT`: The + /// Digest does not match the + /// provided data. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `instanceName` - The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + pub fn batch_update(&self, request: BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest, instance_name: &str) -> BlobBatchUpdateCall<'a, C, A> { + BlobBatchUpdateCall { + hub: self.hub, + _request: request, + _instance_name: instance_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Download many blobs at once. + /// + /// The server may enforce a limit of the combined total size of blobs + /// to be downloaded using this API. This limit may be obtained using the + /// Capabilities API. + /// Requests exceeding the limit should either be split into smaller + /// chunks or downloaded using the + /// ByteStream API, as appropriate. + /// + /// This request is equivalent to calling a Bytestream `Read` request + /// on each individual blob, in parallel. The requests may succeed or fail + /// independently. + /// + /// Errors: + /// + /// * `INVALID_ARGUMENT`: The client attempted to read more than the + /// server supported limit. + /// + /// Every error on individual read will be returned in the corresponding digest + /// status. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `instanceName` - The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + pub fn batch_read(&self, request: BuildBazelRemoteExecutionV2BatchReadBlobsRequest, instance_name: &str) -> BlobBatchReadCall<'a, C, A> { + BlobBatchReadCall { + hub: self.hub, + _request: request, + _instance_name: instance_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Fetch the entire directory tree rooted at a node. + /// + /// This request must be targeted at a + /// Directory stored in the + /// ContentAddressableStorage + /// (CAS). The server will enumerate the `Directory` tree recursively and + /// return every node descended from the root. + /// + /// The GetTreeRequest.page_token parameter can be used to skip ahead in + /// the stream (e.g. when retrying a partially completed and aborted request), + /// by setting it to a value taken from GetTreeResponse.next_page_token of the + /// last successfully processed GetTreeResponse). + /// + /// The exact traversal order is unspecified and, unless retrieving subsequent + /// pages from an earlier request, is not guaranteed to be stable across + /// multiple invocations of `GetTree`. + /// + /// If part of the tree is missing from the CAS, the server will return the + /// portion present and omit the rest. + /// + /// * `NOT_FOUND`: The requested tree root is not present in the CAS. + /// + /// # Arguments + /// + /// * `instanceName` - The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// * `hash` - The hash. In the case of SHA-256, it will always be a lowercase hex string + /// exactly 64 characters long. + /// * `sizeBytes` - The size of the blob, in bytes. + pub fn get_tree(&self, instance_name: &str, hash: &str, size_bytes: &str) -> BlobGetTreeCall<'a, C, A> { + BlobGetTreeCall { + hub: self.hub, + _instance_name: instance_name.to_string(), + _hash: hash.to_string(), + _size_bytes: size_bytes.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *action* resources. +/// It is not used directly, but through the `RemoteBuildExecution` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use remotebuildexecution2::RemoteBuildExecution; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `execute(...)` +/// // to build up your call. +/// let rb = hub.actions(); +/// # } +/// ``` +pub struct ActionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, +} + +impl<'a, C, A> MethodsBuilder for ActionMethods<'a, C, A> {} + +impl<'a, C, A> ActionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Execute an action remotely. + /// + /// In order to execute an action, the client must first upload all of the + /// inputs, the + /// Command to run, and the + /// Action into the + /// ContentAddressableStorage. + /// It then calls `Execute` with an `action_digest` referring to them. The + /// server will run the action and eventually return the result. + /// + /// The input `Action`'s fields MUST meet the various canonicalization + /// requirements specified in the documentation for their types so that it has + /// the same digest as other logically equivalent `Action`s. The server MAY + /// enforce the requirements and return errors if a non-canonical input is + /// received. It MAY also proceed without verifying some or all of the + /// requirements, such as for performance reasons. If the server does not + /// verify the requirement, then it will treat the `Action` as distinct from + /// another logically equivalent action if they hash differently. + /// + /// Returns a stream of + /// google.longrunning.Operation messages + /// describing the resulting execution, with eventual `response` + /// ExecuteResponse. The + /// `metadata` on the operation is of type + /// ExecuteOperationMetadata. + /// + /// If the client remains connected after the first response is returned after + /// the server, then updates are streamed as if the client had called + /// WaitExecution + /// until the execution completes or the request reaches an error. The + /// operation can also be queried using Operations + /// API. + /// + /// The server NEED NOT implement other methods or functionality of the + /// Operations API. + /// + /// Errors discovered during creation of the `Operation` will be reported + /// as gRPC Status errors, while errors that occurred while running the + /// action will be reported in the `status` field of the `ExecuteResponse`. The + /// server MUST NOT set the `error` field of the `Operation` proto. + /// The possible errors include: + /// + /// * `INVALID_ARGUMENT`: One or more arguments are invalid. + /// * `FAILED_PRECONDITION`: One or more errors occurred in setting up the + /// action requested, such as a missing input or command or no worker being + /// available. The client may be able to fix the errors and retry. + /// * `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to run + /// the action. + /// * `UNAVAILABLE`: Due to a transient condition, such as all workers being + /// occupied (and the server does not support a queue), the action could not + /// be started. The client should retry. + /// * `INTERNAL`: An internal error occurred in the execution engine or the + /// worker. + /// * `DEADLINE_EXCEEDED`: The execution timed out. + /// * `CANCELLED`: The operation was cancelled by the client. This status is + /// only possible if the server implements the Operations API CancelOperation + /// method, and it was called for the current execution. + /// + /// In the case of a missing input or command, the server SHOULD additionally + /// send a PreconditionFailure error detail + /// where, for each requested blob not present in the CAS, there is a + /// `Violation` with a `type` of `MISSING` and a `subject` of + /// `"blobs/{hash}/{size}"` indicating the digest of the missing blob. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `instanceName` - The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + pub fn execute(&self, request: BuildBazelRemoteExecutionV2ExecuteRequest, instance_name: &str) -> ActionExecuteCall<'a, C, A> { + ActionExecuteCall { + hub: self.hub, + _request: request, + _instance_name: instance_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all free methods, which are not associated with a particular resource. +/// It is not used directly, but through the `RemoteBuildExecution` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use remotebuildexecution2::RemoteBuildExecution; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get_capabilities(...)` +/// // to build up your call. +/// let rb = hub.methods(); +/// # } +/// ``` +pub struct MethodMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, +} + +impl<'a, C, A> MethodsBuilder for MethodMethods<'a, C, A> {} + +impl<'a, C, A> MethodMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// GetCapabilities returns the server capabilities configuration. + /// + /// # Arguments + /// + /// * `instanceName` - The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + pub fn get_capabilities(&self, instance_name: &str) -> MethodGetCapabilityCall<'a, C, A> { + MethodGetCapabilityCall { + hub: self.hub, + _instance_name: instance_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Wait for an execution operation to complete. When the client initially +/// makes the request, the server immediately responds with the current status +/// of the execution. The server will leave the request stream open until the +/// operation completes, and then respond with the completed operation. The +/// server MAY choose to stream additional updates as execution progresses, +/// such as to provide an update as to the state of the execution. +/// +/// A builder for the *waitExecution* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// use remotebuildexecution2::BuildBazelRemoteExecutionV2WaitExecutionRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use remotebuildexecution2::RemoteBuildExecution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BuildBazelRemoteExecutionV2WaitExecutionRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().wait_execution(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct OperationWaitExecutionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, + _request: BuildBazelRemoteExecutionV2WaitExecutionRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationWaitExecutionCall<'a, C, A> {} + +impl<'a, C, A> OperationWaitExecutionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "remotebuildexecution.operations.waitExecution", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+name}:waitExecution"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BuildBazelRemoteExecutionV2WaitExecutionRequest) -> OperationWaitExecutionCall<'a, C, A> { + self._request = new_value; + self + } + /// The name of the Operation + /// returned by Execute. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationWaitExecutionCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationWaitExecutionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationWaitExecutionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationWaitExecutionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Retrieve a cached execution result. +/// +/// Errors: +/// +/// * `NOT_FOUND`: The requested `ActionResult` is not in the cache. +/// +/// A builder for the *get* method supported by a *actionResult* resource. +/// It is not used directly, but through a `ActionResultMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use remotebuildexecution2::RemoteBuildExecution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.action_results().get("instanceName", "hash", "sizeBytes") +/// .doit(); +/// # } +/// ``` +pub struct ActionResultGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, + _instance_name: String, + _hash: String, + _size_bytes: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ActionResultGetCall<'a, C, A> {} + +impl<'a, C, A> ActionResultGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BuildBazelRemoteExecutionV2ActionResult)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "remotebuildexecution.actionResults.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("instanceName", self._instance_name.to_string())); + params.push(("hash", self._hash.to_string())); + params.push(("sizeBytes", self._size_bytes.to_string())); + for &field in ["alt", "instanceName", "hash", "sizeBytes"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/actionResults/{hash}/{sizeBytes}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+instanceName}", "instanceName"), ("{hash}", "hash"), ("{sizeBytes}", "sizeBytes")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["sizeBytes", "hash", "instanceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// + /// Sets the *instance name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance_name(mut self, new_value: &str) -> ActionResultGetCall<'a, C, A> { + self._instance_name = new_value.to_string(); + self + } + /// The hash. In the case of SHA-256, it will always be a lowercase hex string + /// exactly 64 characters long. + /// + /// Sets the *hash* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn hash(mut self, new_value: &str) -> ActionResultGetCall<'a, C, A> { + self._hash = new_value.to_string(); + self + } + /// The size of the blob, in bytes. + /// + /// Sets the *size bytes* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn size_bytes(mut self, new_value: &str) -> ActionResultGetCall<'a, C, A> { + self._size_bytes = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ActionResultGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ActionResultGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ActionResultGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Upload a new execution result. +/// +/// In order to allow the server to perform access control based on the type of +/// action, and to assist with client debugging, the client MUST first upload +/// the Action that produced the +/// result, along with its +/// Command, into the +/// `ContentAddressableStorage`. +/// +/// Errors: +/// +/// * `INVALID_ARGUMENT`: One or more arguments are invalid. +/// * `FAILED_PRECONDITION`: One or more errors occurred in updating the +/// action result, such as a missing command or action. +/// * `RESOURCE_EXHAUSTED`: There is insufficient storage space to add the +/// entry to the cache. +/// +/// A builder for the *update* method supported by a *actionResult* resource. +/// It is not used directly, but through a `ActionResultMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// use remotebuildexecution2::BuildBazelRemoteExecutionV2ActionResult; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use remotebuildexecution2::RemoteBuildExecution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BuildBazelRemoteExecutionV2ActionResult::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.action_results().update(req, "instanceName", "hash", "sizeBytes") +/// .results_cache_policy_priority(-66) +/// .doit(); +/// # } +/// ``` +pub struct ActionResultUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, + _request: BuildBazelRemoteExecutionV2ActionResult, + _instance_name: String, + _hash: String, + _size_bytes: String, + _results_cache_policy_priority: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ActionResultUpdateCall<'a, C, A> {} + +impl<'a, C, A> ActionResultUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BuildBazelRemoteExecutionV2ActionResult)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "remotebuildexecution.actionResults.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("instanceName", self._instance_name.to_string())); + params.push(("hash", self._hash.to_string())); + params.push(("sizeBytes", self._size_bytes.to_string())); + if let Some(value) = self._results_cache_policy_priority { + params.push(("resultsCachePolicy.priority", value.to_string())); + } + for &field in ["alt", "instanceName", "hash", "sizeBytes", "resultsCachePolicy.priority"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/actionResults/{hash}/{sizeBytes}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+instanceName}", "instanceName"), ("{hash}", "hash"), ("{sizeBytes}", "sizeBytes")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["sizeBytes", "hash", "instanceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BuildBazelRemoteExecutionV2ActionResult) -> ActionResultUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// + /// Sets the *instance name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance_name(mut self, new_value: &str) -> ActionResultUpdateCall<'a, C, A> { + self._instance_name = new_value.to_string(); + self + } + /// The hash. In the case of SHA-256, it will always be a lowercase hex string + /// exactly 64 characters long. + /// + /// Sets the *hash* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn hash(mut self, new_value: &str) -> ActionResultUpdateCall<'a, C, A> { + self._hash = new_value.to_string(); + self + } + /// The size of the blob, in bytes. + /// + /// Sets the *size bytes* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn size_bytes(mut self, new_value: &str) -> ActionResultUpdateCall<'a, C, A> { + self._size_bytes = new_value.to_string(); + self + } + /// The priority (relative importance) of this content in the overall cache. + /// Generally, a lower value means a longer retention time or other advantage, + /// but the interpretation of a given value is server-dependent. A priority of + /// 0 means a *default* value, decided by the server. + /// + /// The particular semantics of this field is up to the server. In particular, + /// every server will have their own supported range of priorities, and will + /// decide how these map into retention/eviction policy. + /// + /// Sets the *results cache policy.priority* query property to the given value. + pub fn results_cache_policy_priority(mut self, new_value: i32) -> ActionResultUpdateCall<'a, C, A> { + self._results_cache_policy_priority = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ActionResultUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ActionResultUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ActionResultUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Determine if blobs are present in the CAS. +/// +/// Clients can use this API before uploading blobs to determine which ones are +/// already present in the CAS and do not need to be uploaded again. +/// +/// There are no method-specific errors. +/// +/// A builder for the *findMissing* method supported by a *blob* resource. +/// It is not used directly, but through a `BlobMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// use remotebuildexecution2::BuildBazelRemoteExecutionV2FindMissingBlobsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use remotebuildexecution2::RemoteBuildExecution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BuildBazelRemoteExecutionV2FindMissingBlobsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.blobs().find_missing(req, "instanceName") +/// .doit(); +/// # } +/// ``` +pub struct BlobFindMissingCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, + _request: BuildBazelRemoteExecutionV2FindMissingBlobsRequest, + _instance_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BlobFindMissingCall<'a, C, A> {} + +impl<'a, C, A> BlobFindMissingCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BuildBazelRemoteExecutionV2FindMissingBlobsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "remotebuildexecution.blobs.findMissing", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("instanceName", self._instance_name.to_string())); + for &field in ["alt", "instanceName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/blobs:findMissing"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+instanceName}", "instanceName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["instanceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BuildBazelRemoteExecutionV2FindMissingBlobsRequest) -> BlobFindMissingCall<'a, C, A> { + self._request = new_value; + self + } + /// The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// + /// Sets the *instance name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance_name(mut self, new_value: &str) -> BlobFindMissingCall<'a, C, A> { + self._instance_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BlobFindMissingCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BlobFindMissingCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BlobFindMissingCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Upload many blobs at once. +/// +/// The server may enforce a limit of the combined total size of blobs +/// to be uploaded using this API. This limit may be obtained using the +/// Capabilities API. +/// Requests exceeding the limit should either be split into smaller +/// chunks or uploaded using the +/// ByteStream API, as appropriate. +/// +/// This request is equivalent to calling a Bytestream `Write` request +/// on each individual blob, in parallel. The requests may succeed or fail +/// independently. +/// +/// Errors: +/// +/// * `INVALID_ARGUMENT`: The client attempted to upload more than the +/// server supported limit. +/// +/// Individual requests may return the following errors, additionally: +/// +/// * `RESOURCE_EXHAUSTED`: There is insufficient disk quota to store the blob. +/// * `INVALID_ARGUMENT`: The +/// Digest does not match the +/// provided data. +/// +/// A builder for the *batchUpdate* method supported by a *blob* resource. +/// It is not used directly, but through a `BlobMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// use remotebuildexecution2::BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use remotebuildexecution2::RemoteBuildExecution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.blobs().batch_update(req, "instanceName") +/// .doit(); +/// # } +/// ``` +pub struct BlobBatchUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, + _request: BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest, + _instance_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BlobBatchUpdateCall<'a, C, A> {} + +impl<'a, C, A> BlobBatchUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BuildBazelRemoteExecutionV2BatchUpdateBlobsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "remotebuildexecution.blobs.batchUpdate", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("instanceName", self._instance_name.to_string())); + for &field in ["alt", "instanceName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/blobs:batchUpdate"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+instanceName}", "instanceName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["instanceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BuildBazelRemoteExecutionV2BatchUpdateBlobsRequest) -> BlobBatchUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// + /// Sets the *instance name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance_name(mut self, new_value: &str) -> BlobBatchUpdateCall<'a, C, A> { + self._instance_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BlobBatchUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BlobBatchUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BlobBatchUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Download many blobs at once. +/// +/// The server may enforce a limit of the combined total size of blobs +/// to be downloaded using this API. This limit may be obtained using the +/// Capabilities API. +/// Requests exceeding the limit should either be split into smaller +/// chunks or downloaded using the +/// ByteStream API, as appropriate. +/// +/// This request is equivalent to calling a Bytestream `Read` request +/// on each individual blob, in parallel. The requests may succeed or fail +/// independently. +/// +/// Errors: +/// +/// * `INVALID_ARGUMENT`: The client attempted to read more than the +/// server supported limit. +/// +/// Every error on individual read will be returned in the corresponding digest +/// status. +/// +/// A builder for the *batchRead* method supported by a *blob* resource. +/// It is not used directly, but through a `BlobMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// use remotebuildexecution2::BuildBazelRemoteExecutionV2BatchReadBlobsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use remotebuildexecution2::RemoteBuildExecution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BuildBazelRemoteExecutionV2BatchReadBlobsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.blobs().batch_read(req, "instanceName") +/// .doit(); +/// # } +/// ``` +pub struct BlobBatchReadCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, + _request: BuildBazelRemoteExecutionV2BatchReadBlobsRequest, + _instance_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BlobBatchReadCall<'a, C, A> {} + +impl<'a, C, A> BlobBatchReadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BuildBazelRemoteExecutionV2BatchReadBlobsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "remotebuildexecution.blobs.batchRead", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("instanceName", self._instance_name.to_string())); + for &field in ["alt", "instanceName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/blobs:batchRead"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+instanceName}", "instanceName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["instanceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BuildBazelRemoteExecutionV2BatchReadBlobsRequest) -> BlobBatchReadCall<'a, C, A> { + self._request = new_value; + self + } + /// The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// + /// Sets the *instance name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance_name(mut self, new_value: &str) -> BlobBatchReadCall<'a, C, A> { + self._instance_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BlobBatchReadCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BlobBatchReadCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BlobBatchReadCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Fetch the entire directory tree rooted at a node. +/// +/// This request must be targeted at a +/// Directory stored in the +/// ContentAddressableStorage +/// (CAS). The server will enumerate the `Directory` tree recursively and +/// return every node descended from the root. +/// +/// The GetTreeRequest.page_token parameter can be used to skip ahead in +/// the stream (e.g. when retrying a partially completed and aborted request), +/// by setting it to a value taken from GetTreeResponse.next_page_token of the +/// last successfully processed GetTreeResponse). +/// +/// The exact traversal order is unspecified and, unless retrieving subsequent +/// pages from an earlier request, is not guaranteed to be stable across +/// multiple invocations of `GetTree`. +/// +/// If part of the tree is missing from the CAS, the server will return the +/// portion present and omit the rest. +/// +/// * `NOT_FOUND`: The requested tree root is not present in the CAS. +/// +/// A builder for the *getTree* method supported by a *blob* resource. +/// It is not used directly, but through a `BlobMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use remotebuildexecution2::RemoteBuildExecution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.blobs().get_tree("instanceName", "hash", "sizeBytes") +/// .page_token("ipsum") +/// .page_size(-5) +/// .doit(); +/// # } +/// ``` +pub struct BlobGetTreeCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, + _instance_name: String, + _hash: String, + _size_bytes: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BlobGetTreeCall<'a, C, A> {} + +impl<'a, C, A> BlobGetTreeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BuildBazelRemoteExecutionV2GetTreeResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "remotebuildexecution.blobs.getTree", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("instanceName", self._instance_name.to_string())); + params.push(("hash", self._hash.to_string())); + params.push(("sizeBytes", self._size_bytes.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "instanceName", "hash", "sizeBytes", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/blobs/{hash}/{sizeBytes}:getTree"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+instanceName}", "instanceName"), ("{hash}", "hash"), ("{sizeBytes}", "sizeBytes")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["sizeBytes", "hash", "instanceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// + /// Sets the *instance name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance_name(mut self, new_value: &str) -> BlobGetTreeCall<'a, C, A> { + self._instance_name = new_value.to_string(); + self + } + /// The hash. In the case of SHA-256, it will always be a lowercase hex string + /// exactly 64 characters long. + /// + /// Sets the *hash* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn hash(mut self, new_value: &str) -> BlobGetTreeCall<'a, C, A> { + self._hash = new_value.to_string(); + self + } + /// The size of the blob, in bytes. + /// + /// Sets the *size bytes* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn size_bytes(mut self, new_value: &str) -> BlobGetTreeCall<'a, C, A> { + self._size_bytes = new_value.to_string(); + self + } + /// A page token, which must be a value received in a previous + /// GetTreeResponse. + /// If present, the server will use it to return the following page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> BlobGetTreeCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// A maximum page size to request. If present, the server will request no more + /// than this many items. Regardless of whether a page size is specified, the + /// server may place its own limit on the number of items to be returned and + /// require the client to retrieve more items using a subsequent request. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> BlobGetTreeCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> BlobGetTreeCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> BlobGetTreeCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> BlobGetTreeCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Execute an action remotely. +/// +/// In order to execute an action, the client must first upload all of the +/// inputs, the +/// Command to run, and the +/// Action into the +/// ContentAddressableStorage. +/// It then calls `Execute` with an `action_digest` referring to them. The +/// server will run the action and eventually return the result. +/// +/// The input `Action`'s fields MUST meet the various canonicalization +/// requirements specified in the documentation for their types so that it has +/// the same digest as other logically equivalent `Action`s. The server MAY +/// enforce the requirements and return errors if a non-canonical input is +/// received. It MAY also proceed without verifying some or all of the +/// requirements, such as for performance reasons. If the server does not +/// verify the requirement, then it will treat the `Action` as distinct from +/// another logically equivalent action if they hash differently. +/// +/// Returns a stream of +/// google.longrunning.Operation messages +/// describing the resulting execution, with eventual `response` +/// ExecuteResponse. The +/// `metadata` on the operation is of type +/// ExecuteOperationMetadata. +/// +/// If the client remains connected after the first response is returned after +/// the server, then updates are streamed as if the client had called +/// WaitExecution +/// until the execution completes or the request reaches an error. The +/// operation can also be queried using Operations +/// API. +/// +/// The server NEED NOT implement other methods or functionality of the +/// Operations API. +/// +/// Errors discovered during creation of the `Operation` will be reported +/// as gRPC Status errors, while errors that occurred while running the +/// action will be reported in the `status` field of the `ExecuteResponse`. The +/// server MUST NOT set the `error` field of the `Operation` proto. +/// The possible errors include: +/// +/// * `INVALID_ARGUMENT`: One or more arguments are invalid. +/// * `FAILED_PRECONDITION`: One or more errors occurred in setting up the +/// action requested, such as a missing input or command or no worker being +/// available. The client may be able to fix the errors and retry. +/// * `RESOURCE_EXHAUSTED`: There is insufficient quota of some resource to run +/// the action. +/// * `UNAVAILABLE`: Due to a transient condition, such as all workers being +/// occupied (and the server does not support a queue), the action could not +/// be started. The client should retry. +/// * `INTERNAL`: An internal error occurred in the execution engine or the +/// worker. +/// * `DEADLINE_EXCEEDED`: The execution timed out. +/// * `CANCELLED`: The operation was cancelled by the client. This status is +/// only possible if the server implements the Operations API CancelOperation +/// method, and it was called for the current execution. +/// +/// In the case of a missing input or command, the server SHOULD additionally +/// send a PreconditionFailure error detail +/// where, for each requested blob not present in the CAS, there is a +/// `Violation` with a `type` of `MISSING` and a `subject` of +/// `"blobs/{hash}/{size}"` indicating the digest of the missing blob. +/// +/// A builder for the *execute* method supported by a *action* resource. +/// It is not used directly, but through a `ActionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// use remotebuildexecution2::BuildBazelRemoteExecutionV2ExecuteRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use remotebuildexecution2::RemoteBuildExecution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = BuildBazelRemoteExecutionV2ExecuteRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.actions().execute(req, "instanceName") +/// .doit(); +/// # } +/// ``` +pub struct ActionExecuteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, + _request: BuildBazelRemoteExecutionV2ExecuteRequest, + _instance_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ActionExecuteCall<'a, C, A> {} + +impl<'a, C, A> ActionExecuteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GoogleLongrunningOperation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "remotebuildexecution.actions.execute", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("instanceName", self._instance_name.to_string())); + for &field in ["alt", "instanceName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/actions:execute"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+instanceName}", "instanceName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["instanceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: BuildBazelRemoteExecutionV2ExecuteRequest) -> ActionExecuteCall<'a, C, A> { + self._request = new_value; + self + } + /// The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// + /// Sets the *instance name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance_name(mut self, new_value: &str) -> ActionExecuteCall<'a, C, A> { + self._instance_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ActionExecuteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ActionExecuteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ActionExecuteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// GetCapabilities returns the server capabilities configuration. +/// +/// A builder for the *getCapabilities* method. +/// It is not used directly, but through a `MethodMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_remotebuildexecution2 as remotebuildexecution2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use remotebuildexecution2::RemoteBuildExecution; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = RemoteBuildExecution::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.methods().get_capabilities("instanceName") +/// .doit(); +/// # } +/// ``` +pub struct MethodGetCapabilityCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a RemoteBuildExecution, + _instance_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MethodGetCapabilityCall<'a, C, A> {} + +impl<'a, C, A> MethodGetCapabilityCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BuildBazelRemoteExecutionV2ServerCapabilities)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "remotebuildexecution.getCapabilities", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("instanceName", self._instance_name.to_string())); + for &field in ["alt", "instanceName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v2/{+instanceName}/capabilities"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+instanceName}", "instanceName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["instanceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The instance of the execution system to operate against. A server may + /// support multiple instances of the execution system (with their own workers, + /// storage, caches, etc.). The server MAY require use of this field to select + /// between them in an implementation-defined fashion, otherwise it can be + /// omitted. + /// + /// Sets the *instance name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance_name(mut self, new_value: &str) -> MethodGetCapabilityCall<'a, C, A> { + self._instance_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MethodGetCapabilityCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MethodGetCapabilityCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MethodGetCapabilityCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/replicapool1_beta2/Cargo.toml b/gen/replicapool1_beta2/Cargo.toml index c88cd7abf6..f84f6da67d 100644 --- a/gen/replicapool1_beta2/Cargo.toml +++ b/gen/replicapool1_beta2/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/replicapool1_beta2/src/lib.rs b/gen/replicapool1_beta2/src/lib.rs index a6b26b8fa1..136f7050d8 100644 --- a/gen/replicapool1_beta2/src/lib.rs +++ b/gen/replicapool1_beta2/src/lib.rs @@ -1248,10 +1248,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1271,7 +1268,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1380,7 +1377,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1526,10 +1523,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1549,7 +1543,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1647,7 +1641,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1800,10 +1794,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1835,7 +1826,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1945,7 +1936,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2104,10 +2095,7 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2127,7 +2115,7 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2424,7 +2409,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2703,7 +2685,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2989,7 +2968,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3099,7 +3078,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3252,10 +3231,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3287,7 +3263,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3397,7 +3373,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3543,10 +3519,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3566,7 +3539,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3852,7 +3822,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3962,7 +3932,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4110,10 +4080,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4133,7 +4100,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4429,7 +4393,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4539,7 +4503,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/replicapoolupdater1_beta1/Cargo.toml b/gen/replicapoolupdater1_beta1/Cargo.toml index 95d7a53cc4..4f0dc1a2d4 100644 --- a/gen/replicapoolupdater1_beta1/Cargo.toml +++ b/gen/replicapoolupdater1_beta1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/replicapoolupdater1_beta1/src/lib.rs b/gen/replicapoolupdater1_beta1/src/lib.rs index dc0d56b930..06ba7ffea8 100644 --- a/gen/replicapoolupdater1_beta1/src/lib.rs +++ b/gen/replicapoolupdater1_beta1/src/lib.rs @@ -1209,10 +1209,7 @@ impl<'a, C, A> RollingUpdatePauseCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1232,7 +1229,7 @@ impl<'a, C, A> RollingUpdatePauseCall<'a, C, A> where C: BorrowMut RollingUpdatePauseCall<'a, C, A> where C: BorrowMut RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1499,7 +1493,7 @@ impl<'a, C, A> RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut RollingUpdateGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1766,7 +1757,7 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1864,7 +1855,7 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2010,10 +2001,7 @@ impl<'a, C, A> RollingUpdateResumeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2033,7 +2021,7 @@ impl<'a, C, A> RollingUpdateResumeCall<'a, C, A> where C: BorrowMut RollingUpdateResumeCall<'a, C, A> where C: BorrowMut RollingUpdateListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2313,7 +2298,7 @@ impl<'a, C, A> RollingUpdateListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2422,7 +2407,7 @@ impl<'a, C, A> RollingUpdateListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2573,10 +2558,7 @@ impl<'a, C, A> RollingUpdateInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2608,7 +2590,7 @@ impl<'a, C, A> RollingUpdateInsertCall<'a, C, A> where C: BorrowMut RollingUpdateInsertCall<'a, C, A> where C: BorrowMut RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2892,7 +2871,7 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3011,7 +2990,7 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3157,10 +3136,7 @@ impl<'a, C, A> RollingUpdateCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3180,7 +3156,7 @@ impl<'a, C, A> RollingUpdateCancelCall<'a, C, A> where C: BorrowMut RollingUpdateCancelCall<'a, C, A> where C: BorrowMut ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3447,7 +3420,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3545,7 +3518,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3704,10 +3677,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3727,7 +3697,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3836,7 +3806,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/reseller1_sandbox/Cargo.toml b/gen/reseller1_sandbox/Cargo.toml index e7a2effac4..f383a4d6d2 100644 --- a/gen/reseller1_sandbox/Cargo.toml +++ b/gen/reseller1_sandbox/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/reseller1_sandbox/src/lib.rs b/gen/reseller1_sandbox/src/lib.rs index 7f4507b488..dd8ff4bf4a 100644 --- a/gen/reseller1_sandbox/src/lib.rs +++ b/gen/reseller1_sandbox/src/lib.rs @@ -1192,10 +1192,7 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1227,7 +1224,7 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1317,7 +1314,7 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1448,10 +1445,7 @@ impl<'a, C, A> CustomerInsertCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1483,7 +1477,7 @@ impl<'a, C, A> CustomerInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1570,7 +1564,7 @@ impl<'a, C, A> CustomerInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1719,10 +1713,7 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1754,7 +1745,7 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1844,7 +1835,7 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1986,10 +1977,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2009,7 +1997,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2087,7 +2075,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2241,10 +2229,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2276,7 +2261,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2541,7 +2523,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2796,7 +2775,7 @@ impl<'a, C, A> SubscriptionGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2884,7 +2863,7 @@ impl<'a, C, A> SubscriptionGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3028,10 +3007,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3051,7 +3027,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3154,7 +3130,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3305,10 +3281,7 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3340,7 +3313,7 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3440,7 +3413,7 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3584,10 +3557,7 @@ impl<'a, C, A> SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3607,7 +3577,7 @@ impl<'a, C, A> SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3881,7 +3848,7 @@ impl<'a, C, A> SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut SubscriptionSuspendCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4148,7 +4112,7 @@ impl<'a, C, A> SubscriptionSuspendCall<'a, C, A> where C: BorrowMut SubscriptionSuspendCall<'a, C, A> where C: BorrowMut SubscriptionActivateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4403,7 +4364,7 @@ impl<'a, C, A> SubscriptionActivateCall<'a, C, A> where C: BorrowMut SubscriptionActivateCall<'a, C, A> where C: BorrowMut SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4677,7 +4635,7 @@ impl<'a, C, A> SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1271,7 +1268,7 @@ impl<'a, C, A> ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1569,7 +1563,7 @@ impl<'a, C, A> ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut ZoneViewListResourceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1873,7 +1864,7 @@ impl<'a, C, A> ZoneViewListResourceCall<'a, C, A> where C: BorrowMut ZoneViewListResourceCall<'a, C, A> where C: BorrowMut ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2175,7 +2163,7 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2273,7 +2261,7 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2427,10 +2415,7 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2450,7 +2435,7 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2552,7 +2537,7 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2703,10 +2688,7 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2738,7 +2720,7 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2838,7 +2820,7 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2984,10 +2966,7 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3007,7 +2986,7 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3105,7 +3084,7 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3258,10 +3237,7 @@ impl<'a, C, A> ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3293,7 +3269,7 @@ impl<'a, C, A> ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3577,7 +3550,7 @@ impl<'a, C, A> ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3851,7 +3821,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3949,7 +3919,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4108,10 +4078,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4131,7 +4098,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4240,7 +4207,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/run1-cli/Cargo.toml b/gen/run1-cli/Cargo.toml new file mode 100644 index 0000000000..37787189f0 --- /dev/null +++ b/gen/run1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-run1-cli" +version = "1.0.8+20190401" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Run (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/run1-cli" +homepage = "https://cloud.google.com/run/" +documentation = "http://byron.github.io/google-apis-rs/google_run1_cli" +license = "MIT" +keywords = ["run", "google", "cli"] +autobins = false + +[[bin]] +name = "run1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-run1] +path = "../run1" +version = "1.0.8+20190401" diff --git a/gen/run1-cli/LICENSE.md b/gen/run1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/run1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/run1-cli/README.md b/gen/run1-cli/README.md new file mode 100644 index 0000000000..0b364e28f4 --- /dev/null +++ b/gen/run1-cli/README.md @@ -0,0 +1,114 @@ + +The `run1` command-line interface *(CLI)* allows to use most features of the *Google Cloud Run* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Cloud Run* API can be found at the +[official documentation site](https://cloud.google.com/run/). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-run1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/run1-cli). + +# Usage + +This documentation was generated from the *Cloud Run* API at revision *20190401*. The CLI is at version *1.0.8*. + +```bash +run1 [options] + projects + locations-get [-p ]... [-o ] + run1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `run1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/run1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/run1-secret.json`, assuming that the required *run* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `run1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/run1-cli/mkdocs.yml b/gen/run1-cli/mkdocs.yml new file mode 100644 index 0000000000..65f6c7c8c2 --- /dev/null +++ b/gen/run1-cli/mkdocs.yml @@ -0,0 +1,17 @@ +site_name: Cloud Run v1.0.8+20190401 +site_url: http://byron.github.io/google-apis-rs/google-run1-cli +site_description: A complete library to interact with Cloud Run (protocol v1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/run1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['projects_locations-get.md', 'Projects', 'Locations Get'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/run1-cli/src/cmn.rs b/gen/run1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/run1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/run1-cli/src/main.rs b/gen/run1-cli/src/main.rs new file mode 100644 index 0000000000..7a17fba82c --- /dev/null +++ b/gen/run1-cli/src/main.rs @@ -0,0 +1,324 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_run1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::CloudRun>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _projects_locations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("projects", Some(opt)) => { + match opt.subcommand() { + ("locations-get", Some(opt)) => { + call_result = self._projects_locations_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "run1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "run1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::CloudRun::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("projects", "methods: 'locations-get'", vec![ + ("locations-get", + Some(r##"Gets information about a location."##), + "Details at http://byron.github.io/google-apis-rs/google_run1_cli/projects_locations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name for the location."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("run1") + .author("Sebastian Thiel ") + .version("1.0.8+20190401") + .about("Deploy and manage user provided container images that scale automatically based on HTTP traffic.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_run1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/run1/Cargo.toml b/gen/run1/Cargo.toml new file mode 100644 index 0000000000..51da2c41f4 --- /dev/null +++ b/gen/run1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-run1" +version = "1.0.8+20190401" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Cloud Run (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/run1" +homepage = "https://cloud.google.com/run/" +documentation = "https://docs.rs/google-run1/1.0.8+20190401" +license = "MIT" +keywords = ["run", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/run1/LICENSE.md b/gen/run1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/run1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/run1/README.md b/gen/run1/README.md new file mode 100644 index 0000000000..599bf92c07 --- /dev/null +++ b/gen/run1/README.md @@ -0,0 +1,182 @@ + +The `google-run1` library allows access to all features of the *Google Cloud Run* service. + +This documentation was generated from *Cloud Run* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *run:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Cloud Run* *v1* API can be found at the +[official documentation site](https://cloud.google.com/run/). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-run1/1.0.8+20190401/google_run1/struct.CloudRun.html) ... + +* projects + * [*locations get*](https://docs.rs/google-run1/1.0.8+20190401/google_run1/struct.ProjectLocationGetCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-run1/1.0.8+20190401/google_run1/struct.CloudRun.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.projects().locations_get(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-run1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_run1 as run1; +use run1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use run1::CloudRun; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = CloudRun::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.projects().locations_get("name") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-run1/1.0.8+20190401/google_run1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-run1/1.0.8+20190401/google_run1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-run1/1.0.8+20190401/google_run1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **run1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/run1/src/cmn.rs b/gen/run1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/run1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/run1/src/lib.rs b/gen/run1/src/lib.rs new file mode 100644 index 0000000000..82773e7345 --- /dev/null +++ b/gen/run1/src/lib.rs @@ -0,0 +1,711 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Cloud Run* crate version *1.0.8+20190401*, where *20190401* is the exact revision of the *run:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Cloud Run* *v1* API can be found at the +//! [official documentation site](https://cloud.google.com/run/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/run1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.CloudRun.html) ... +//! +//! * projects +//! * [*locations get*](struct.ProjectLocationGetCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.CloudRun.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().locations_get(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-run1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_run1 as run1; +//! use run1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use run1::CloudRun; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = CloudRun::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.projects().locations_get("name") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all CloudRun related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_run1 as run1; +/// use run1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use run1::CloudRun; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudRun::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_get("name") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct CloudRun { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for CloudRun {} + +impl<'a, C, A> CloudRun + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> CloudRun { + CloudRun { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://run.googleapis.com/".to_string(), + _root_url: "https://run.googleapis.com/".to_string(), + } + } + + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://run.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://run.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// A resource that represents Google Cloud Platform location. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Location { + /// The friendly name for this location, typically a nearby city name. + /// For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, + /// Resource name for the location, which may vary between implementations. + /// For example: `"projects/example-project/locations/us-east1"` + pub name: Option, + /// Service-specific metadata. For example the available capacity at the given + /// location. + pub metadata: Option>, +} + +impl ResponseResult for Location {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `CloudRun` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_run1 as run1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use run1::CloudRun; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = CloudRun::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `locations_get(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudRun, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a location. + /// + /// # Arguments + /// + /// * `name` - Resource name for the location. + pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C, A> { + ProjectLocationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Gets information about a location. +/// +/// A builder for the *locations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_run1 as run1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use run1::CloudRun; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = CloudRun::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a CloudRun, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Location)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "run.projects.locations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name for the location. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/runtimeconfig1-cli/Cargo.toml b/gen/runtimeconfig1-cli/Cargo.toml index a0c4f006ca..7e14644172 100644 --- a/gen/runtimeconfig1-cli/Cargo.toml +++ b/gen/runtimeconfig1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-runtimeconfig1-cli" -version = "1.0.8+20180924" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud RuntimeConfig (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/runtimeconfig1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-runtimeconfig1] path = "../runtimeconfig1" -version = "1.0.8+20180924" +version = "1.0.8+20190330" diff --git a/gen/runtimeconfig1-cli/README.md b/gen/runtimeconfig1-cli/README.md index 4b16d82058..3c3c4b5fa0 100644 --- a/gen/runtimeconfig1-cli/README.md +++ b/gen/runtimeconfig1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud RuntimeConfig* API at revision *20180924*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud RuntimeConfig* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash runtimeconfig1 [options] diff --git a/gen/runtimeconfig1-cli/mkdocs.yml b/gen/runtimeconfig1-cli/mkdocs.yml index 19cc634cf1..5e52c23f29 100644 --- a/gen/runtimeconfig1-cli/mkdocs.yml +++ b/gen/runtimeconfig1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud RuntimeConfig v1.0.8+20180924 +site_name: Cloud RuntimeConfig v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-runtimeconfig1-cli site_description: A complete library to interact with Cloud RuntimeConfig (protocol v1) diff --git a/gen/runtimeconfig1-cli/src/main.rs b/gen/runtimeconfig1-cli/src/main.rs index bedd9a0527..9adda751cb 100644 --- a/gen/runtimeconfig1-cli/src/main.rs +++ b/gen/runtimeconfig1-cli/src/main.rs @@ -451,7 +451,7 @@ fn main() { let mut app = App::new("runtimeconfig1") .author("Sebastian Thiel ") - .version("1.0.8+20180924") + .version("1.0.8+20190330") .about("The Runtime Configurator allows you to dynamically configure and expose variables through Google Cloud Platform. In addition, you can also set Watchers and Waiters that will watch for changes to your data and return based on certain conditions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_runtimeconfig1_cli") .arg(Arg::with_name("url") diff --git a/gen/runtimeconfig1/Cargo.toml b/gen/runtimeconfig1/Cargo.toml index 2da6c7a2cb..9f94ff5053 100644 --- a/gen/runtimeconfig1/Cargo.toml +++ b/gen/runtimeconfig1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-runtimeconfig1" -version = "1.0.8+20180924" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud RuntimeConfig (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/runtimeconfig1" homepage = "https://cloud.google.com/deployment-manager/runtime-configurator/" -documentation = "https://docs.rs/google-runtimeconfig1/1.0.8+20180924" +documentation = "https://docs.rs/google-runtimeconfig1/1.0.8+20190330" license = "MIT" keywords = ["runtimeconfig", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/runtimeconfig1/README.md b/gen/runtimeconfig1/README.md index 459fd5ad6c..336d25dbb9 100644 --- a/gen/runtimeconfig1/README.md +++ b/gen/runtimeconfig1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-runtimeconfig1` library allows access to all features of the *Google Cloud RuntimeConfig* service. -This documentation was generated from *Cloud RuntimeConfig* crate version *1.0.8+20180924*, where *20180924* is the exact revision of the *runtimeconfig:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud RuntimeConfig* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *runtimeconfig:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud RuntimeConfig* *v1* API can be found at the [official documentation site](https://cloud.google.com/deployment-manager/runtime-configurator/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/struct.CloudRuntimeConfig.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/struct.CloudRuntimeConfig.html) ... -* [operations](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/struct.Operation.html) - * [*cancel*](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/struct.OperationDeleteCall.html) and [*list*](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/struct.OperationListCall.html) +* [operations](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/struct.Operation.html) + * [*cancel*](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/struct.OperationDeleteCall.html) and [*list*](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/struct.OperationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/struct.CloudRuntimeConfig.html)** +* **[Hub](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/struct.CloudRuntimeConfig.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.Part.html)** + * **[Parts](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -129,17 +129,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -149,29 +149,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-runtimeconfig1/1.0.8+20180924/google_runtimeconfig1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-runtimeconfig1/1.0.8+20190330/google_runtimeconfig1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/runtimeconfig1/src/lib.rs b/gen/runtimeconfig1/src/lib.rs index a43dd89bd0..a6205fb830 100644 --- a/gen/runtimeconfig1/src/lib.rs +++ b/gen/runtimeconfig1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud RuntimeConfig* crate version *1.0.8+20180924*, where *20180924* is the exact revision of the *runtimeconfig:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud RuntimeConfig* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *runtimeconfig:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud RuntimeConfig* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/deployment-manager/runtime-configurator/). @@ -370,17 +370,17 @@ impl<'a, C, A> CloudRuntimeConfig // ############ // SCHEMAS ### // ########## -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -441,21 +441,6 @@ pub struct Status { impl Part for Status {} -/// The request message for Operations.CancelOperation. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [cancel operations](struct.OperationCancelCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CancelOperationRequest { _never_set: Option } - -impl RequestValue for CancelOperationRequest {} - - /// This resource represents a long-running operation that is the result of a /// network API call. /// @@ -499,25 +484,19 @@ pub struct Operation { impl Resource for Operation {} -/// The response message for Operations.ListOperations. +/// The request message for Operations.CancelOperation. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list operations](struct.OperationListCall.html) (response) +/// * [cancel operations](struct.OperationCancelCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListOperationsResponse { - /// The standard List next-page token. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// A list of operations that matches the specified filter in the request. - pub operations: Option>, -} +pub struct CancelOperationRequest { _never_set: Option } -impl ResponseResult for ListOperationsResponse {} +impl RequestValue for CancelOperationRequest {} /// A generic empty message that you can re-use to avoid defining duplicated @@ -544,6 +523,27 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operations](struct.OperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for ListOperationsResponse {} + + // ################### // MethodBuilders ### @@ -784,7 +784,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -800,10 +800,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -823,7 +820,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -922,7 +919,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1059,7 +1056,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1075,10 +1072,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1098,7 +1092,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1176,7 +1170,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1326,7 +1320,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1342,10 +1336,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1377,7 +1368,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1467,7 +1458,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/runtimeconfig1_beta1-cli/Cargo.toml b/gen/runtimeconfig1_beta1-cli/Cargo.toml index db3c6dffd0..98678a3099 100644 --- a/gen/runtimeconfig1_beta1-cli/Cargo.toml +++ b/gen/runtimeconfig1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-runtimeconfig1_beta1-cli" -version = "1.0.8+20181008" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud RuntimeConfig (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/runtimeconfig1_beta1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-runtimeconfig1_beta1] path = "../runtimeconfig1_beta1" -version = "1.0.8+20181008" +version = "1.0.8+20190330" diff --git a/gen/runtimeconfig1_beta1-cli/README.md b/gen/runtimeconfig1_beta1-cli/README.md index ae056102f7..bc75b5cb2e 100644 --- a/gen/runtimeconfig1_beta1-cli/README.md +++ b/gen/runtimeconfig1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud RuntimeConfig* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud RuntimeConfig* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash runtimeconfig1-beta1 [options] diff --git a/gen/runtimeconfig1_beta1-cli/mkdocs.yml b/gen/runtimeconfig1_beta1-cli/mkdocs.yml index 3ac1b8df46..8fda6c44a3 100644 --- a/gen/runtimeconfig1_beta1-cli/mkdocs.yml +++ b/gen/runtimeconfig1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud RuntimeConfig v1.0.8+20181008 +site_name: Cloud RuntimeConfig v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-runtimeconfig1_beta1-cli site_description: A complete library to interact with Cloud RuntimeConfig (protocol v1beta1) diff --git a/gen/runtimeconfig1_beta1-cli/src/main.rs b/gen/runtimeconfig1_beta1-cli/src/main.rs index c3852fefe4..fb5242a717 100644 --- a/gen/runtimeconfig1_beta1-cli/src/main.rs +++ b/gen/runtimeconfig1_beta1-cli/src/main.rs @@ -769,8 +769,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "text" => Some(("text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -1120,8 +1120,8 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "text" => Some(("text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -2441,7 +2441,7 @@ fn main() { let mut app = App::new("runtimeconfig1-beta1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190330") .about("The Runtime Configurator allows you to dynamically configure and expose variables through Google Cloud Platform. In addition, you can also set Watchers and Waiters that will watch for changes to your data and return based on certain conditions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_runtimeconfig1_beta1_cli") .arg(Arg::with_name("url") diff --git a/gen/runtimeconfig1_beta1/Cargo.toml b/gen/runtimeconfig1_beta1/Cargo.toml index ddfbf17d52..439be63d3e 100644 --- a/gen/runtimeconfig1_beta1/Cargo.toml +++ b/gen/runtimeconfig1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-runtimeconfig1_beta1" -version = "1.0.8+20181008" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud RuntimeConfig (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/runtimeconfig1_beta1" homepage = "https://cloud.google.com/deployment-manager/runtime-configurator/" -documentation = "https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008" +documentation = "https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330" license = "MIT" keywords = ["runtimeconfig", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/runtimeconfig1_beta1/README.md b/gen/runtimeconfig1_beta1/README.md index 57321bf892..770221841c 100644 --- a/gen/runtimeconfig1_beta1/README.md +++ b/gen/runtimeconfig1_beta1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-runtimeconfig1_beta1` library allows access to all features of the *Google Cloud RuntimeConfig* service. -This documentation was generated from *Cloud RuntimeConfig* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *runtimeconfig:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud RuntimeConfig* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *runtimeconfig:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud RuntimeConfig* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/deployment-manager/runtime-configurator/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.CloudRuntimeConfig.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.CloudRuntimeConfig.html) ... * projects - * [*configs create*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigCreateCall.html), [*configs delete*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigDeleteCall.html), [*configs get*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigGetCall.html), [*configs get iam policy*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigGetIamPolicyCall.html), [*configs list*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigListCall.html), [*configs operations get*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigOperationGetCall.html), [*configs operations test iam permissions*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigOperationTestIamPermissionCall.html), [*configs set iam policy*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigSetIamPolicyCall.html), [*configs test iam permissions*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigTestIamPermissionCall.html), [*configs update*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigUpdateCall.html), [*configs variables create*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigVariableCreateCall.html), [*configs variables delete*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigVariableDeleteCall.html), [*configs variables get*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigVariableGetCall.html), [*configs variables list*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigVariableListCall.html), [*configs variables test iam permissions*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigVariableTestIamPermissionCall.html), [*configs variables update*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigVariableUpdateCall.html), [*configs variables watch*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigVariableWatchCall.html), [*configs waiters create*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigWaiterCreateCall.html), [*configs waiters delete*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigWaiterDeleteCall.html), [*configs waiters get*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigWaiterGetCall.html), [*configs waiters list*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigWaiterListCall.html) and [*configs waiters test iam permissions*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.ProjectConfigWaiterTestIamPermissionCall.html) + * [*configs create*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigCreateCall.html), [*configs delete*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigDeleteCall.html), [*configs get*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigGetCall.html), [*configs get iam policy*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigGetIamPolicyCall.html), [*configs list*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigListCall.html), [*configs operations get*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigOperationGetCall.html), [*configs operations test iam permissions*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigOperationTestIamPermissionCall.html), [*configs set iam policy*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigSetIamPolicyCall.html), [*configs test iam permissions*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigTestIamPermissionCall.html), [*configs update*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigUpdateCall.html), [*configs variables create*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigVariableCreateCall.html), [*configs variables delete*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigVariableDeleteCall.html), [*configs variables get*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigVariableGetCall.html), [*configs variables list*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigVariableListCall.html), [*configs variables test iam permissions*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigVariableTestIamPermissionCall.html), [*configs variables update*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigVariableUpdateCall.html), [*configs variables watch*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigVariableWatchCall.html), [*configs waiters create*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigWaiterCreateCall.html), [*configs waiters delete*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigWaiterDeleteCall.html), [*configs waiters get*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigWaiterGetCall.html), [*configs waiters list*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigWaiterListCall.html) and [*configs waiters test iam permissions*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.ProjectConfigWaiterTestIamPermissionCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/struct.CloudRuntimeConfig.html)** +* **[Hub](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/struct.CloudRuntimeConfig.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -47,10 +47,10 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.projects().configs_variables_watch(...).doit() +let r = hub.projects().configs_variables_create(...).doit() let r = hub.projects().configs_variables_get(...).doit() let r = hub.projects().configs_variables_update(...).doit() -let r = hub.projects().configs_variables_create(...).doit() +let r = hub.projects().configs_variables_watch(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -134,17 +134,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -154,29 +154,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20181008/google_runtimeconfig1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-runtimeconfig1_beta1/1.0.8+20190330/google_runtimeconfig1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/runtimeconfig1_beta1/src/lib.rs b/gen/runtimeconfig1_beta1/src/lib.rs index 858353edb0..fdc4d8e71d 100644 --- a/gen/runtimeconfig1_beta1/src/lib.rs +++ b/gen/runtimeconfig1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud RuntimeConfig* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *runtimeconfig:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud RuntimeConfig* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *runtimeconfig:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud RuntimeConfig* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/deployment-manager/runtime-configurator/). @@ -47,10 +47,10 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.projects().configs_variables_watch(...).doit() +//! let r = hub.projects().configs_variables_create(...).doit() //! let r = hub.projects().configs_variables_get(...).doit() //! let r = hub.projects().configs_variables_update(...).doit() -//! let r = hub.projects().configs_variables_create(...).doit() +//! let r = hub.projects().configs_variables_watch(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -424,10 +424,10 @@ pub struct SetIamPolicyRequest { impl RequestValue for SetIamPolicyRequest {} -/// A Waiter resource waits for some end condition within a RuntimeConfig resource -/// to be met before it returns. For example, assume you have a distributed -/// system where each node writes to a Variable resource indicating the node's -/// readiness as part of the startup process. +/// A Waiter resource waits for some end condition within a RuntimeConfig +/// resource to be met before it returns. For example, assume you have a +/// distributed system where each node writes to a Variable resource indicating +/// the node's readiness as part of the startup process. /// /// You then configure a Waiter resource with the success condition set to wait /// until some number of nodes have checked in. Afterwards, your application @@ -437,7 +437,8 @@ impl RequestValue for SetIamPolicyRequest {} /// Once created, a Waiter resource is immutable. /// /// To learn more about using waiters, read the -/// [Creating a Waiter](/deployment-manager/runtime-configurator/creating-a-waiter) +/// [Creating a +/// Waiter](/deployment-manager/runtime-configurator/creating-a-waiter) /// documentation. /// /// # Activities @@ -474,9 +475,9 @@ pub struct Waiter { /// After you create a Waiter resource, you cannot change the resource name. pub name: Option, /// [Required] The success condition. If this condition is met, `done` will be - /// set to `true` and the `error` value will remain unset. The failure condition - /// takes precedence over the success condition. If both conditions are met, a - /// failure will be indicated. + /// set to `true` and the `error` value will remain unset. The failure + /// condition takes precedence over the success condition. If both conditions + /// are met, a failure will be indicated. pub success: Option, /// Output only. If the waiter ended due to a failure or timeout, this value /// will be set. @@ -507,10 +508,9 @@ impl ResponseResult for Waiter {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// @@ -520,9 +520,10 @@ pub struct Expr { /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} @@ -656,17 +657,17 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -847,6 +848,11 @@ pub struct Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, /// Specifies the identities requesting access for a Cloud Platform resource. /// `members` can have the following values: /// @@ -867,16 +873,11 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// pub members: Option>, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, } impl Part for Binding {} @@ -906,10 +907,10 @@ impl Part for EndCondition {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [configs variables watch projects](struct.ProjectConfigVariableWatchCall.html) (response) +/// * [configs variables create projects](struct.ProjectConfigVariableCreateCall.html) (request|response) /// * [configs variables get projects](struct.ProjectConfigVariableGetCall.html) (response) /// * [configs variables update projects](struct.ProjectConfigVariableUpdateCall.html) (request|response) -/// * [configs variables create projects](struct.ProjectConfigVariableCreateCall.html) (request|response) +/// * [configs variables watch projects](struct.ProjectConfigVariableWatchCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Variable { @@ -917,23 +918,26 @@ pub struct Variable { /// than 4096 bytes. Empty values are also accepted. For example, /// `text: "my text value"`. The string must be valid UTF-8. pub text: Option, + /// Output only. The current state of the variable. The variable state + /// indicates the outcome of the `variables().watch` call and is visible + /// through the `get` and `list` calls. + pub state: Option, /// Output only. The time of the last variable update. + /// Timestamp will be UTC timestamp. #[serde(rename="updateTime")] pub update_time: Option, - /// [Ouput only] The current state of the variable. The variable state indicates - /// the outcome of the `variables().watch` call and is visible through the - /// `get` and `list` calls. - pub state: Option, /// The binary value of the variable. The length of the value must be less /// than 4096 bytes. Empty values are also accepted. The value must be - /// base64 encoded. Only one of `value` or `text` can be set. + /// base64 encoded, and must comply with IETF RFC4648 + /// (https://www.ietf.org/rfc/rfc4648.txt). Only one of `value` or `text` + /// can be set. pub value: Option, /// The name of the variable resource, in the format: /// /// projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME] /// /// The `[PROJECT_ID]` must be a valid project ID, `[CONFIG_NAME]` must be a - /// valid RuntimeConfig reource and `[VARIABLE_NAME]` follows Unix file system + /// valid RuntimeConfig resource and `[VARIABLE_NAME]` follows Unix file system /// file path naming. /// /// The `[VARIABLE_NAME]` can contain ASCII letters, numbers, slashes and @@ -997,15 +1001,15 @@ impl ResponseResult for Operation {} /// A Cardinality condition for the Waiter resource. A cardinality condition is /// met when the number of variables under a specified path prefix reaches a /// predefined number. For example, if you set a Cardinality condition where -/// the `path` is set to `/foo` and the number of paths is set to 2, the +/// the `path` is set to `/foo` and the number of paths is set to `2`, the /// following variables would meet the condition in a RuntimeConfig resource: /// /// + `/foo/variable1 = "value1"` /// + `/foo/variable2 = "value2"` /// + `/bar/variable3 = "value3"` /// -/// It would not would not satisify the same condition with the `number` set to -/// 3, however, because there is only 2 paths that start with `/foo`. +/// It would not satisfy the same condition with the `number` set to +/// `3`, however, because there is only 2 paths that start with `/foo`. /// Cardinality conditions are recursive; all subtrees under the specific /// path prefix are counted. /// @@ -1705,7 +1709,7 @@ impl<'a, C, A> ProjectConfigVariableWatchCall<'a, C, A> where C: BorrowMut ProjectConfigVariableWatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1756,7 +1757,7 @@ impl<'a, C, A> ProjectConfigVariableWatchCall<'a, C, A> where C: BorrowMut ProjectConfigVariableWatchCall<'a, C, A> where C: BorrowMut ProjectConfigVariableTestIamPermissionCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2011,10 +2012,7 @@ impl<'a, C, A> ProjectConfigVariableTestIamPermissionCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2046,7 +2044,7 @@ impl<'a, C, A> ProjectConfigVariableTestIamPermissionCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2137,7 +2135,7 @@ impl<'a, C, A> ProjectConfigVariableTestIamPermissionCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2278,7 +2276,7 @@ impl<'a, C, A> ProjectConfigUpdateCall<'a, C, A> where C: BorrowMut ProjectConfigUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2329,7 +2324,7 @@ impl<'a, C, A> ProjectConfigUpdateCall<'a, C, A> where C: BorrowMut ProjectConfigUpdateCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterTestIamPermissionCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2584,10 +2579,7 @@ impl<'a, C, A> ProjectConfigWaiterTestIamPermissionCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2619,7 +2611,7 @@ impl<'a, C, A> ProjectConfigWaiterTestIamPermissionCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2710,7 +2702,7 @@ impl<'a, C, A> ProjectConfigWaiterTestIamPermissionCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2852,7 +2844,7 @@ impl<'a, C, A> ProjectConfigSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectConfigSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2903,7 +2892,7 @@ impl<'a, C, A> ProjectConfigSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectConfigSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectConfigGetCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3144,10 +3133,7 @@ impl<'a, C, A> ProjectConfigGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3167,7 +3153,7 @@ impl<'a, C, A> ProjectConfigGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3247,7 +3233,7 @@ impl<'a, C, A> ProjectConfigGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3383,7 +3369,7 @@ impl<'a, C, A> ProjectConfigGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectConfigGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3422,7 +3405,7 @@ impl<'a, C, A> ProjectConfigGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectConfigGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterDeleteCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3674,7 +3654,7 @@ impl<'a, C, A> ProjectConfigWaiterDeleteCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterDeleteCall<'a, C, A> where C: BorrowMut ProjectConfigVariableCreateCall<'a, C, A> where C: BorrowMut ProjectConfigVariableCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3958,7 +3935,7 @@ impl<'a, C, A> ProjectConfigVariableCreateCall<'a, C, A> where C: BorrowMut ProjectConfigVariableCreateCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterListCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4250,7 +4224,7 @@ impl<'a, C, A> ProjectConfigWaiterListCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterListCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterCreateCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4548,7 +4519,7 @@ impl<'a, C, A> ProjectConfigWaiterCreateCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterCreateCall<'a, C, A> where C: BorrowMut ProjectConfigOperationGetCall<'a, C, A> where C: BorrowMut ProjectConfigOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4832,7 +4800,7 @@ impl<'a, C, A> ProjectConfigOperationGetCall<'a, C, A> where C: BorrowMut ProjectConfigOperationGetCall<'a, C, A> where C: BorrowMut ProjectConfigVariableGetCall<'a, C, A> where C: BorrowMut ProjectConfigVariableGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5083,7 +5048,7 @@ impl<'a, C, A> ProjectConfigVariableGetCall<'a, C, A> where C: BorrowMut ProjectConfigVariableGetCall<'a, C, A> where C: BorrowMut ProjectConfigDeleteCall<'a, C, A> where C: BorrowMut ProjectConfigDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5336,7 +5298,7 @@ impl<'a, C, A> ProjectConfigDeleteCall<'a, C, A> where C: BorrowMut ProjectConfigDeleteCall<'a, C, A> where C: BorrowMut ProjectConfigOperationTestIamPermissionCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5579,10 +5541,7 @@ impl<'a, C, A> ProjectConfigOperationTestIamPermissionCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5614,7 +5573,7 @@ impl<'a, C, A> ProjectConfigOperationTestIamPermissionCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5705,7 +5664,7 @@ impl<'a, C, A> ProjectConfigOperationTestIamPermissionCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5852,7 +5811,7 @@ impl<'a, C, A> ProjectConfigTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectConfigTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5903,7 +5859,7 @@ impl<'a, C, A> ProjectConfigTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectConfigTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectConfigListCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6154,10 +6110,7 @@ impl<'a, C, A> ProjectConfigListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6177,7 +6130,7 @@ impl<'a, C, A> ProjectConfigListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6273,7 +6226,7 @@ impl<'a, C, A> ProjectConfigListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6417,7 +6370,7 @@ impl<'a, C, A> ProjectConfigVariableDeleteCall<'a, C, A> where C: BorrowMut ProjectConfigVariableDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6456,7 +6406,7 @@ impl<'a, C, A> ProjectConfigVariableDeleteCall<'a, C, A> where C: BorrowMut ProjectConfigVariableDeleteCall<'a, C, A> where C: BorrowMut ProjectConfigVariableUpdateCall<'a, C, A> where C: BorrowMut ProjectConfigVariableUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6736,7 +6683,7 @@ impl<'a, C, A> ProjectConfigVariableUpdateCall<'a, C, A> where C: BorrowMut ProjectConfigVariableUpdateCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterGetCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7001,7 +6945,7 @@ impl<'a, C, A> ProjectConfigWaiterGetCall<'a, C, A> where C: BorrowMut ProjectConfigWaiterGetCall<'a, C, A> where C: BorrowMut ProjectConfigVariableListCall<'a, C, A> where C: BorrowMut ProjectConfigVariableListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7278,7 +7219,7 @@ impl<'a, C, A> ProjectConfigVariableListCall<'a, C, A> where C: BorrowMut ProjectConfigVariableListCall<'a, C, A> where C: BorrowMut ProjectConfigCreateCall<'a, C, A> where C: BorrowMut ProjectConfigCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7592,7 +7530,7 @@ impl<'a, C, A> ProjectConfigCreateCall<'a, C, A> where C: BorrowMut ProjectConfigCreateCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with safebrowsing (protocol v4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/safebrowsing4-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-safebrowsing4] path = "../safebrowsing4" -version = "1.0.8+20181010" +version = "1.0.8+20190402" diff --git a/gen/safebrowsing4-cli/README.md b/gen/safebrowsing4-cli/README.md index 561db410de..8d0e842627 100644 --- a/gen/safebrowsing4-cli/README.md +++ b/gen/safebrowsing4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *safebrowsing* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *safebrowsing* API at revision *20190402*. The CLI is at version *1.0.8*. ```bash safebrowsing4 [options] diff --git a/gen/safebrowsing4-cli/mkdocs.yml b/gen/safebrowsing4-cli/mkdocs.yml index 3d8b3cb04c..dd3aff0a9c 100644 --- a/gen/safebrowsing4-cli/mkdocs.yml +++ b/gen/safebrowsing4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: safebrowsing v1.0.8+20181010 +site_name: safebrowsing v1.0.8+20190402 site_url: http://byron.github.io/google-apis-rs/google-safebrowsing4-cli site_description: A complete library to interact with safebrowsing (protocol v4) diff --git a/gen/safebrowsing4-cli/src/main.rs b/gen/safebrowsing4-cli/src/main.rs index 7b045bf61c..a0f6b2f89c 100644 --- a/gen/safebrowsing4-cli/src/main.rs +++ b/gen/safebrowsing4-cli/src/main.rs @@ -897,7 +897,7 @@ fn main() { let mut app = App::new("safebrowsing4") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190402") .about("Enables client applications to check web resources (most commonly URLs) against Google-generated lists of unsafe web resources.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_safebrowsing4_cli") .arg(Arg::with_name("folder") diff --git a/gen/safebrowsing4/Cargo.toml b/gen/safebrowsing4/Cargo.toml index 0654a08257..c1fe35f58d 100644 --- a/gen/safebrowsing4/Cargo.toml +++ b/gen/safebrowsing4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-safebrowsing4" -version = "1.0.8+20181010" +version = "1.0.8+20190402" authors = ["Sebastian Thiel "] description = "A complete library to interact with safebrowsing (protocol v4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/safebrowsing4" homepage = "https://developers.google.com/safe-browsing/" -documentation = "https://docs.rs/google-safebrowsing4/1.0.8+20181010" +documentation = "https://docs.rs/google-safebrowsing4/1.0.8+20190402" license = "MIT" keywords = ["safebrowsing", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/safebrowsing4/README.md b/gen/safebrowsing4/README.md index 35f84ef01a..dad1685806 100644 --- a/gen/safebrowsing4/README.md +++ b/gen/safebrowsing4/README.md @@ -5,28 +5,28 @@ DO NOT EDIT ! --> The `google-safebrowsing4` library allows access to all features of the *Google safebrowsing* service. -This documentation was generated from *safebrowsing* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *safebrowsing:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *safebrowsing* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *safebrowsing:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *safebrowsing* *v4* API can be found at the [official documentation site](https://developers.google.com/safe-browsing/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/struct.Safebrowsing.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/struct.Safebrowsing.html) ... * encoded full hashes - * [*get*](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/struct.EncodedFullHasheGetCall.html) + * [*get*](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/struct.EncodedFullHasheGetCall.html) * encoded updates - * [*get*](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/struct.EncodedUpdateGetCall.html) + * [*get*](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/struct.EncodedUpdateGetCall.html) * full hashes - * [*find*](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/struct.FullHasheFindCall.html) -* [threat hits](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/struct.ThreatHit.html) - * [*create*](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/struct.ThreatHitCreateCall.html) + * [*find*](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/struct.FullHasheFindCall.html) +* [threat hits](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/struct.ThreatHit.html) + * [*create*](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/struct.ThreatHitCreateCall.html) * threat list updates - * [*fetch*](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/struct.ThreatListUpdateFetchCall.html) + * [*fetch*](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/struct.ThreatListUpdateFetchCall.html) * threat lists - * [*list*](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/struct.ThreatListListCall.html) + * [*list*](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/struct.ThreatListListCall.html) * threat matches - * [*find*](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/struct.ThreatMatcheFindCall.html) + * [*find*](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/struct.ThreatMatcheFindCall.html) @@ -35,17 +35,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/struct.Safebrowsing.html)** +* **[Hub](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/struct.Safebrowsing.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.Part.html)** + * **[Parts](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -139,17 +139,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -159,29 +159,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-safebrowsing4/1.0.8+20181010/google_safebrowsing4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-safebrowsing4/1.0.8+20190402/google_safebrowsing4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/safebrowsing4/src/lib.rs b/gen/safebrowsing4/src/lib.rs index 50091c74ca..ce9f920fcd 100644 --- a/gen/safebrowsing4/src/lib.rs +++ b/gen/safebrowsing4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *safebrowsing* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *safebrowsing:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *safebrowsing* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *safebrowsing:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *safebrowsing* *v4* API can be found at the //! [official documentation site](https://developers.google.com/safe-browsing/). @@ -512,26 +512,26 @@ impl RequestValue for FindThreatMatchesRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ThreatEntrySet { - /// The encoded 4-byte prefixes of SHA256-formatted entries, using a - /// Golomb-Rice encoding. The hashes are converted to uint32, sorted in - /// ascending order, then delta encoded and stored as encoded_data. - #[serde(rename="riceHashes")] - pub rice_hashes: Option, /// The compression type for the entries in this set. #[serde(rename="compressionType")] pub compression_type: Option, /// The raw removal indices for a local list. #[serde(rename="rawIndices")] pub raw_indices: Option, + /// The raw SHA256-formatted entries. + #[serde(rename="rawHashes")] + pub raw_hashes: Option, + /// The encoded 4-byte prefixes of SHA256-formatted entries, using a + /// Golomb-Rice encoding. The hashes are converted to uint32, sorted in + /// ascending order, then delta encoded and stored as encoded_data. + #[serde(rename="riceHashes")] + pub rice_hashes: Option, /// The encoded local, lexicographically-sorted list indices, using a /// Golomb-Rice encoding. Used for sending compressed removal indices. The /// removal indices (uint32) are sorted in ascending order, then delta encoded /// and stored as encoded_data. #[serde(rename="riceIndices")] pub rice_indices: Option, - /// The raw SHA256-formatted entries. - #[serde(rename="rawHashes")] - pub raw_hashes: Option, } impl Part for ThreatEntrySet {} @@ -671,24 +671,6 @@ pub struct ClientInfo { impl Part for ClientInfo {} -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [find threat matches](struct.ThreatMatcheFindCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct FindThreatMatchesResponse { - /// The threat list matches. - pub matches: Option>, -} - -impl ResponseResult for FindThreatMatchesResponse {} - - /// Describes an individual threat list. A list is defined by three parameters: /// the type of threat posed, the type of platform targeted by the threat, and /// the type of entries in the list. @@ -760,19 +742,22 @@ pub struct ThreatEntry { impl Part for ThreatEntry {} -/// A single metadata entry. +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [find threat matches](struct.ThreatMatcheFindCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MetadataEntry { - /// The metadata entry key. For JSON requests, the key is base64-encoded. - pub key: Option, - /// The metadata entry value. For JSON requests, the value is base64-encoded. - pub value: Option, +pub struct FindThreatMatchesResponse { + /// The threat list matches. + pub matches: Option>, } -impl Part for MetadataEntry {} +impl ResponseResult for FindThreatMatchesResponse {} /// There is no detailed description. @@ -865,15 +850,15 @@ pub struct ThreatInfo { /// The threat types to be checked. #[serde(rename="threatTypes")] pub threat_types: Option>, - /// The entry types to be checked. - #[serde(rename="threatEntryTypes")] - pub threat_entry_types: Option>, /// The threat entries to be checked. #[serde(rename="threatEntries")] pub threat_entries: Option>, /// The platform types to be checked. #[serde(rename="platformTypes")] pub platform_types: Option>, + /// The entry types to be checked. + #[serde(rename="threatEntryTypes")] + pub threat_entry_types: Option>, } impl Part for ThreatInfo {} @@ -933,6 +918,21 @@ pub struct FindFullHashesRequest { impl RequestValue for FindFullHashesRequest {} +/// A single metadata entry. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MetadataEntry { + /// The metadata entry key. For JSON requests, the key is base64-encoded. + pub key: Option, + /// The metadata entry value. For JSON requests, the value is base64-encoded. + pub value: Option, +} + +impl Part for MetadataEntry {} + + /// There is no detailed description. /// /// # Activities @@ -1518,17 +1518,14 @@ impl<'a, C, A> EncodedFullHasheGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1620,7 +1617,7 @@ impl<'a, C, A> EncodedFullHasheGetCall<'a, C, A> where C: BorrowMut FullHasheFindCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1757,7 +1751,7 @@ impl<'a, C, A> FullHasheFindCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -1836,7 +1830,7 @@ impl<'a, C, A> FullHasheFindCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1952,10 +1946,7 @@ impl<'a, C, A> ThreatListUpdateFetchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1974,7 +1965,7 @@ impl<'a, C, A> ThreatListUpdateFetchCall<'a, C, A> where C: BorrowMut ThreatListUpdateFetchCall<'a, C, A> where C: BorrowMut EncodedUpdateGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -2296,7 +2284,7 @@ impl<'a, C, A> EncodedUpdateGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2404,17 +2392,14 @@ impl<'a, C, A> ThreatListListCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -2481,7 +2466,7 @@ impl<'a, C, A> ThreatListListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2596,10 +2581,7 @@ impl<'a, C, A> ThreatMatcheFindCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2618,7 +2600,7 @@ impl<'a, C, A> ThreatMatcheFindCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -2697,7 +2679,7 @@ impl<'a, C, A> ThreatMatcheFindCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2813,10 +2795,7 @@ impl<'a, C, A> ThreatHitCreateCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2835,7 +2814,7 @@ impl<'a, C, A> ThreatHitCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -2914,7 +2893,7 @@ impl<'a, C, A> ThreatHitCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/searchconsole1-cli/Cargo.toml b/gen/searchconsole1-cli/Cargo.toml index 263a3f8230..9756c3dc69 100644 --- a/gen/searchconsole1-cli/Cargo.toml +++ b/gen/searchconsole1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-searchconsole1-cli" -version = "1.0.8+20181010" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with Search Console (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/searchconsole1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-searchconsole1] path = "../searchconsole1" -version = "1.0.8+20181010" +version = "1.0.8+20190403" diff --git a/gen/searchconsole1-cli/README.md b/gen/searchconsole1-cli/README.md index 4c56d0c5fc..eb9d92547c 100644 --- a/gen/searchconsole1-cli/README.md +++ b/gen/searchconsole1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Search Console* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *Search Console* API at revision *20190403*. The CLI is at version *1.0.8*. ```bash searchconsole1 [options] diff --git a/gen/searchconsole1-cli/mkdocs.yml b/gen/searchconsole1-cli/mkdocs.yml index 9190c753a8..0ccde2db6f 100644 --- a/gen/searchconsole1-cli/mkdocs.yml +++ b/gen/searchconsole1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Search Console v1.0.8+20181010 +site_name: Search Console v1.0.8+20190403 site_url: http://byron.github.io/google-apis-rs/google-searchconsole1-cli site_description: A complete library to interact with Search Console (protocol v1) diff --git a/gen/searchconsole1-cli/src/main.rs b/gen/searchconsole1-cli/src/main.rs index 6630aecb0c..38de2a609f 100644 --- a/gen/searchconsole1-cli/src/main.rs +++ b/gen/searchconsole1-cli/src/main.rs @@ -259,7 +259,7 @@ fn main() { let mut app = App::new("searchconsole1") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190403") .about("Provides tools for running validation tests against single URLs") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_searchconsole1_cli") .arg(Arg::with_name("folder") diff --git a/gen/searchconsole1/Cargo.toml b/gen/searchconsole1/Cargo.toml index 57891d0509..edf1e6d4bb 100644 --- a/gen/searchconsole1/Cargo.toml +++ b/gen/searchconsole1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-searchconsole1" -version = "1.0.8+20181010" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with Search Console (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/searchconsole1" homepage = "https://developers.google.com/webmaster-tools/search-console-api/" -documentation = "https://docs.rs/google-searchconsole1/1.0.8+20181010" +documentation = "https://docs.rs/google-searchconsole1/1.0.8+20190403" license = "MIT" keywords = ["searchconsole", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/searchconsole1/README.md b/gen/searchconsole1/README.md index 7627d91505..780a7b1ab8 100644 --- a/gen/searchconsole1/README.md +++ b/gen/searchconsole1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-searchconsole1` library allows access to all features of the *Google Search Console* service. -This documentation was generated from *Search Console* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *searchconsole:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Search Console* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *searchconsole:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Search Console* *v1* API can be found at the [official documentation site](https://developers.google.com/webmaster-tools/search-console-api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/struct.SearchConsole.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/struct.SearchConsole.html) ... * url testing tools - * [*mobile friendly test run*](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/struct.UrlTestingToolMobileFriendlyTestRunCall.html) + * [*mobile friendly test run*](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/struct.UrlTestingToolMobileFriendlyTestRunCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/struct.SearchConsole.html)** +* **[Hub](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/struct.SearchConsole.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.Part.html)** + * **[Parts](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -130,17 +130,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -150,29 +150,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-searchconsole1/1.0.8+20181010/google_searchconsole1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-searchconsole1/1.0.8+20190403/google_searchconsole1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/searchconsole1/src/lib.rs b/gen/searchconsole1/src/lib.rs index 054d342500..8dc0b8c713 100644 --- a/gen/searchconsole1/src/lib.rs +++ b/gen/searchconsole1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Search Console* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *searchconsole:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Search Console* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *searchconsole:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Search Console* *v1* API can be found at the //! [official documentation site](https://developers.google.com/webmaster-tools/search-console-api/). @@ -631,10 +631,7 @@ impl<'a, C, A> UrlTestingToolMobileFriendlyTestRunCall<'a, C, A> where C: Borrow } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -653,7 +650,7 @@ impl<'a, C, A> UrlTestingToolMobileFriendlyTestRunCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -732,7 +729,7 @@ impl<'a, C, A> UrlTestingToolMobileFriendlyTestRunCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -740,12 +737,12 @@ impl<'a, C, A> UrlTestingToolMobileFriendlyTestRunCall<'a, C, A> where C: Borrow /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> UrlTestingToolMobileFriendlyTestRunCall<'a, C, A> diff --git a/gen/securitycenter1-cli/Cargo.toml b/gen/securitycenter1-cli/Cargo.toml new file mode 100644 index 0000000000..405d8e40b4 --- /dev/null +++ b/gen/securitycenter1-cli/Cargo.toml @@ -0,0 +1,42 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-securitycenter1-cli" +version = "1.0.8+20190402" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Security Command Center (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/securitycenter1-cli" +homepage = "https://console.cloud.google.com/apis/api/securitycenter.googleapis.com/overview" +documentation = "http://byron.github.io/google-apis-rs/google_securitycenter1_cli" +license = "MIT" +keywords = ["securitycenter", "google", "cli"] +autobins = false + +[[bin]] +name = "securitycenter1" +path = "src/main.rs" + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +strsim = "^0.5" +hyper-rustls = "^0.6" +yup-hyper-mock = "^2.0" +clap = "^2.0" + +[features] + + + +[dependencies.google-securitycenter1] +path = "../securitycenter1" +version = "1.0.8+20190402" diff --git a/gen/securitycenter1-cli/LICENSE.md b/gen/securitycenter1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/securitycenter1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/securitycenter1-cli/README.md b/gen/securitycenter1-cli/README.md new file mode 100644 index 0000000000..0426d2e284 --- /dev/null +++ b/gen/securitycenter1-cli/README.md @@ -0,0 +1,136 @@ + +The `securitycenter1` command-line interface *(CLI)* allows to use most features of the *Google Security Command Center* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *Security Command Center* API can be found at the +[official documentation site](https://console.cloud.google.com/apis/api/securitycenter.googleapis.com/overview). + +# Installation and Source Code + +Install the command-line interface with cargo using: + +```bash +cargo install google-securitycenter1-cli +``` + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/securitycenter1-cli). + +# Usage + +This documentation was generated from the *Security Command Center* API at revision *20190402*. The CLI is at version *1.0.8*. + +```bash +securitycenter1 [options] + organizations + assets-group (-r )... [-p ]... [-o ] + assets-list [-p ]... [-o ] + assets-run-discovery (-r )... [-p ]... [-o ] + assets-update-security-marks (-r )... [-p ]... [-o ] + get-organization-settings [-p ]... [-o ] + operations-cancel [-p ]... [-o ] + operations-delete [-p ]... [-o ] + operations-get [-p ]... [-o ] + operations-list [-p ]... [-o ] + sources-create (-r )... [-p ]... [-o ] + sources-findings-create (-r )... [-p ]... [-o ] + sources-findings-group (-r )... [-p ]... [-o ] + sources-findings-list [-p ]... [-o ] + sources-findings-patch (-r )... [-p ]... [-o ] + sources-findings-set-state (-r )... [-p ]... [-o ] + sources-findings-update-security-marks (-r )... [-p ]... [-o ] + sources-get [-p ]... [-o ] + sources-get-iam-policy (-r )... [-p ]... [-o ] + sources-list [-p ]... [-o ] + sources-patch (-r )... [-p ]... [-o ] + sources-set-iam-policy (-r )... [-p ]... [-o ] + sources-test-iam-permissions (-r )... [-p ]... [-o ] + update-organization-settings (-r )... [-p ]... [-o ] + securitycenter1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `securitycenter1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/securitycenter1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/securitycenter1-secret.json`, assuming that the required *securitycenter* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `securitycenter1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/securitycenter1-cli/mkdocs.yml b/gen/securitycenter1-cli/mkdocs.yml new file mode 100644 index 0000000000..b7184f0c78 --- /dev/null +++ b/gen/securitycenter1-cli/mkdocs.yml @@ -0,0 +1,39 @@ +site_name: Security Command Center v1.0.8+20190402 +site_url: http://byron.github.io/google-apis-rs/google-securitycenter1-cli +site_description: A complete library to interact with Security Command Center (protocol v1) + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/securitycenter1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['organizations_assets-group.md', 'Organizations', 'Assets Group'] +- ['organizations_assets-list.md', 'Organizations', 'Assets List'] +- ['organizations_assets-run-discovery.md', 'Organizations', 'Assets Run Discovery'] +- ['organizations_assets-update-security-marks.md', 'Organizations', 'Assets Update Security Marks'] +- ['organizations_get-organization-settings.md', 'Organizations', 'Get Organization Settings'] +- ['organizations_operations-cancel.md', 'Organizations', 'Operations Cancel'] +- ['organizations_operations-delete.md', 'Organizations', 'Operations Delete'] +- ['organizations_operations-get.md', 'Organizations', 'Operations Get'] +- ['organizations_operations-list.md', 'Organizations', 'Operations List'] +- ['organizations_sources-create.md', 'Organizations', 'Sources Create'] +- ['organizations_sources-findings-create.md', 'Organizations', 'Sources Findings Create'] +- ['organizations_sources-findings-group.md', 'Organizations', 'Sources Findings Group'] +- ['organizations_sources-findings-list.md', 'Organizations', 'Sources Findings List'] +- ['organizations_sources-findings-patch.md', 'Organizations', 'Sources Findings Patch'] +- ['organizations_sources-findings-set-state.md', 'Organizations', 'Sources Findings Set State'] +- ['organizations_sources-findings-update-security-marks.md', 'Organizations', 'Sources Findings Update Security Marks'] +- ['organizations_sources-get.md', 'Organizations', 'Sources Get'] +- ['organizations_sources-get-iam-policy.md', 'Organizations', 'Sources Get Iam Policy'] +- ['organizations_sources-list.md', 'Organizations', 'Sources List'] +- ['organizations_sources-patch.md', 'Organizations', 'Sources Patch'] +- ['organizations_sources-set-iam-policy.md', 'Organizations', 'Sources Set Iam Policy'] +- ['organizations_sources-test-iam-permissions.md', 'Organizations', 'Sources Test Iam Permissions'] +- ['organizations_update-organization-settings.md', 'Organizations', 'Update Organization Settings'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/securitycenter1-cli/src/cmn.rs b/gen/securitycenter1-cli/src/cmn.rs new file mode 100644 index 0000000000..acddb75913 --- /dev/null +++ b/gen/securitycenter1-cli/src/cmn.rs @@ -0,0 +1,799 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::error::Error as StdError; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request", + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { + if m.contains_key(k) { + return m.get_mut(k).expect("value to exist"); + } + m.insert(k.to_owned(), Value::Object(Default::default())); + m.get_mut(k).expect("value to exist") +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)); + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None; + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, + mut object: &mut Value, + value: &str, + type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len() - 1] { + let tmp = object; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => panic!("We don't expect non-object Values here ..."), + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len() - 1]; + let to_jval = |value: &str, + jtype: JsonType, + err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + JsonType::String => Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)) + .is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + ComplexType::Vec => { + match *assure_entry(mapping, field) { + Value::Array(ref mut values) => + values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!(), + } + } + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *assure_entry(mapping, &field) { + + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!(), + } + } + } + } + _ => unreachable!(), + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, + err: &mut InvalidOptionsError, + for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || { + err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(), for_hashmap)) + }; + match kv.find('=') { + None => { + add_err(); + return (kv, None); + } + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")); + } + (key, Some(&kv[pos + 1..])) + } + } +} + +pub fn calltype_from_str(name: &str, + valid_protocols: Vec, + err: &mut InvalidOptionsError) + -> CallType { + CallType::Upload(match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::Io((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + }, + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, + err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) + -> T + where T: FromStr + Default, + ::Err: fmt::Display +{ + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); + Default::default() + } + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + + +#[derive(Debug)] +pub enum TokenStorageError { + Json(json::Error), + Io(io::Error), +} + +impl fmt::Display for TokenStorageError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), + } + } +} + +impl StdError for TokenStorageError { + fn description(&self) -> &str { + "Failure when getting or setting the token storage" + } +} + + +impl TokenStorage for JsonTokenStorage { + type Error = TokenStorageError; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(TokenStorageError::Json(serde_err)), + } + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, TokenStorageError> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(TokenStorageError::Json(err)), + } + } + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(TokenStorageError::Io(io_err)), + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) => + writeln!(f, + "Could not decode file at '{}' with error: {}.", + path, + err), + ApplicationSecretError::FormatError(ref path) => + writeln!(f, + "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + Io((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => + writeln!(f, + "Directory '{}' could not be created with error: {}.", + dir, + err), + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) => + writeln!(f, + "Couldn't find HOME directory of current user, failed to expand '{}'.", + dir), + ConfigurationError::Secret(ref err) => writeln!(f, "Secret -> {}", err), + ConfigurationError::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + Io((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::Io((ref file_path, ref io_err)) => + writeln!(f, + "Failed to open '{}' for reading with error: {}.", + file_path, + io_err), + InputError::Mime(ref mime) => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) => + writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) => + writeln!(f, + "'{}': Single field separator may not be last character.", + field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = match *suggestion { + Some(ref s) => { + let kv = match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + } + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) => + writeln!(f, + "'{}' is not a valid upload protocol. Choose from one of {}.", + proto_name, + valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => + writeln!(f, + "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, + value, + type_name, + err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + } + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { + "hashmap " + } else { + "" + }; + writeln!(f, + "'{}' does not match {}pattern =.", + kv, + hashmap_info) + } + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)); + } + + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new() + .create(true) + .write(true) + .open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err); + } + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))), + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/securitycenter1-cli/src/main.rs b/gen/securitycenter1-cli/src/main.rs new file mode 100644 index 0000000000..be8fdae6e3 --- /dev/null +++ b/gen/securitycenter1-cli/src/main.rs @@ -0,0 +1,2768 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate hyper_rustls; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_securitycenter1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, FlowType}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::SecurityCommandCenter>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _organizations_assets_group(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "compare-duration" => Some(("compareDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-by" => Some(("groupBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "read-time" => Some(("readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["compare-duration", "filter", "group-by", "page-size", "page-token", "read-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GroupAssetsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().assets_group(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_assets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().assets_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "read-time" => { + call = call.read_time(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + "field-mask" => { + call = call.field_mask(value.unwrap_or("")); + }, + "compare-duration" => { + call = call.compare_duration(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-by", "compare-duration", "page-size", "field-mask", "filter", "page-token", "read-time"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_assets_run_discovery(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RunAssetDiscoveryRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().assets_run_discovery(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_assets_update_security_marks(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "marks" => Some(("marks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["marks", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SecurityMarks = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().assets_update_security_marks(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + "start-time" => { + call = call.start_time(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask", "start-time"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_get_organization_settings(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().get_organization_settings(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().operations_cancel(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().operations_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().operations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().operations_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "display-name", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Source = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sources_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_findings_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "category" => Some(("category", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "event-time" => Some(("eventTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "security-marks.name" => Some(("securityMarks.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "security-marks.marks" => Some(("securityMarks.marks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "resource-name" => Some(("resourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-uri" => Some(("externalUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["category", "create-time", "event-time", "external-uri", "marks", "name", "parent", "resource-name", "security-marks", "state"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Finding = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sources_findings_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "finding-id" => { + call = call.finding_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["finding-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_findings_group(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "compare-duration" => Some(("compareDuration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-by" => Some(("groupBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "read-time" => Some(("readTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["compare-duration", "filter", "group-by", "page-size", "page-token", "read-time"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GroupFindingsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sources_findings_group(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_findings_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().sources_findings_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "read-time" => { + call = call.read_time(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + "field-mask" => { + call = call.field_mask(value.unwrap_or("")); + }, + "compare-duration" => { + call = call.compare_duration(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-by", "compare-duration", "page-size", "field-mask", "filter", "page-token", "read-time"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_findings_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "category" => Some(("category", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "event-time" => Some(("eventTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent" => Some(("parent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "security-marks.name" => Some(("securityMarks.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "security-marks.marks" => Some(("securityMarks.marks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "resource-name" => Some(("resourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-uri" => Some(("externalUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["category", "create-time", "event-time", "external-uri", "marks", "name", "parent", "resource-name", "security-marks", "state"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Finding = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sources_findings_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_findings_set_state(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["start-time", "state"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetFindingStateRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sources_findings_set_state(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_findings_update_security_marks(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "marks" => Some(("marks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["marks", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SecurityMarks = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sources_findings_update_security_marks(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + "start-time" => { + call = call.start_time(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask", "start-time"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().sources_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec![]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sources_get_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.organizations().sources_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "display-name", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Source = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sources_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "update-mask", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sources_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_sources_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().sources_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _organizations_update_organization_settings(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "asset-discovery-config.project-ids" => Some(("assetDiscoveryConfig.projectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "asset-discovery-config.inclusion-mode" => Some(("assetDiscoveryConfig.inclusionMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enable-asset-discovery" => Some(("enableAssetDiscovery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["asset-discovery-config", "enable-asset-discovery", "inclusion-mode", "name", "project-ids"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::OrganizationSettings = json::value::from_value(object).unwrap(); + let mut call = self.hub.organizations().update_organization_settings(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("organizations", Some(opt)) => { + match opt.subcommand() { + ("assets-group", Some(opt)) => { + call_result = self._organizations_assets_group(opt, dry_run, &mut err); + }, + ("assets-list", Some(opt)) => { + call_result = self._organizations_assets_list(opt, dry_run, &mut err); + }, + ("assets-run-discovery", Some(opt)) => { + call_result = self._organizations_assets_run_discovery(opt, dry_run, &mut err); + }, + ("assets-update-security-marks", Some(opt)) => { + call_result = self._organizations_assets_update_security_marks(opt, dry_run, &mut err); + }, + ("get-organization-settings", Some(opt)) => { + call_result = self._organizations_get_organization_settings(opt, dry_run, &mut err); + }, + ("operations-cancel", Some(opt)) => { + call_result = self._organizations_operations_cancel(opt, dry_run, &mut err); + }, + ("operations-delete", Some(opt)) => { + call_result = self._organizations_operations_delete(opt, dry_run, &mut err); + }, + ("operations-get", Some(opt)) => { + call_result = self._organizations_operations_get(opt, dry_run, &mut err); + }, + ("operations-list", Some(opt)) => { + call_result = self._organizations_operations_list(opt, dry_run, &mut err); + }, + ("sources-create", Some(opt)) => { + call_result = self._organizations_sources_create(opt, dry_run, &mut err); + }, + ("sources-findings-create", Some(opt)) => { + call_result = self._organizations_sources_findings_create(opt, dry_run, &mut err); + }, + ("sources-findings-group", Some(opt)) => { + call_result = self._organizations_sources_findings_group(opt, dry_run, &mut err); + }, + ("sources-findings-list", Some(opt)) => { + call_result = self._organizations_sources_findings_list(opt, dry_run, &mut err); + }, + ("sources-findings-patch", Some(opt)) => { + call_result = self._organizations_sources_findings_patch(opt, dry_run, &mut err); + }, + ("sources-findings-set-state", Some(opt)) => { + call_result = self._organizations_sources_findings_set_state(opt, dry_run, &mut err); + }, + ("sources-findings-update-security-marks", Some(opt)) => { + call_result = self._organizations_sources_findings_update_security_marks(opt, dry_run, &mut err); + }, + ("sources-get", Some(opt)) => { + call_result = self._organizations_sources_get(opt, dry_run, &mut err); + }, + ("sources-get-iam-policy", Some(opt)) => { + call_result = self._organizations_sources_get_iam_policy(opt, dry_run, &mut err); + }, + ("sources-list", Some(opt)) => { + call_result = self._organizations_sources_list(opt, dry_run, &mut err); + }, + ("sources-patch", Some(opt)) => { + call_result = self._organizations_sources_patch(opt, dry_run, &mut err); + }, + ("sources-set-iam-policy", Some(opt)) => { + call_result = self._organizations_sources_set_iam_policy(opt, dry_run, &mut err); + }, + ("sources-test-iam-permissions", Some(opt)) => { + call_result = self._organizations_sources_test_iam_permissions(opt, dry_run, &mut err); + }, + ("update-organization-settings", Some(opt)) => { + call_result = self._organizations_update_organization_settings(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("organizations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "securitycenter1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }, + JsonTokenStorage { + program_name: "securitycenter1", + db_dir: config_dir.clone(), + }, Some(FlowType::InstalledRedirect(54324))); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new()) + }) + } else { + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())) + }; + let engine = Engine { + opt: opt, + hub: api::SecurityCommandCenter::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("organizations", "methods: 'assets-group', 'assets-list', 'assets-run-discovery', 'assets-update-security-marks', 'get-organization-settings', 'operations-cancel', 'operations-delete', 'operations-get', 'operations-list', 'sources-create', 'sources-findings-create', 'sources-findings-group', 'sources-findings-list', 'sources-findings-patch', 'sources-findings-set-state', 'sources-findings-update-security-marks', 'sources-get', 'sources-get-iam-policy', 'sources-list', 'sources-patch', 'sources-set-iam-policy', 'sources-test-iam-permissions' and 'update-organization-settings'", vec![ + ("assets-group", + Some(r##"Filters an organization's assets and groups them by their specified + properties."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_assets-group", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the organization to groupBy. Its format is + "organizations/[organization_id]"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("assets-list", + Some(r##"Lists an organization's assets."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_assets-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the organization assets should belong to. Its format is + "organizations/[organization_id]"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("assets-run-discovery", + Some(r##"Runs asset discovery. The discovery is tracked with a long-running + operation. + + This API can only be called with limited frequency for an organization. If + it is called too frequently the caller will receive a TOO_MANY_REQUESTS + error."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_assets-run-discovery", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the organization to run asset discovery for. Its format is + "organizations/[organization_id]"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("assets-update-security-marks", + Some(r##"Updates security marks."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_assets-update-security-marks", + vec![ + (Some(r##"name"##), + None, + Some(r##"The relative resource name of the SecurityMarks. See: + https://cloud.google.com/apis/design/resource_names#relative_resource_name + Examples: + "organizations/123/assets/456/securityMarks" + "organizations/123/sources/456/findings/789/securityMarks"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-organization-settings", + Some(r##"Gets the settings for an organization."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_get-organization-settings", + vec![ + (Some(r##"name"##), + None, + Some(r##"Name of the organization to get organization settings for. Its format is + "organizations/[organization_id]/organizationSettings"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-cancel", + Some(r##"Starts asynchronous cancellation on a long-running operation. The server + makes a best effort to cancel the operation, but success is not + guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. Clients can use + Operations.GetOperation or + other methods to check whether the cancellation succeeded or whether the + operation completed despite cancellation. On successful cancellation, + the operation is not deleted; instead, it becomes an operation with + an Operation.error value with a google.rpc.Status.code of 1, + corresponding to `Code.CANCELLED`."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_operations-cancel", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be cancelled."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-delete", + Some(r##"Deletes a long-running operation. This method indicates that the client is + no longer interested in the operation result. It does not cancel the + operation. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_operations-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource to be deleted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_operations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-list", + Some(r##"Lists operations that match the specified filter in the request. If the + server doesn't support this method, it returns `UNIMPLEMENTED`. + + NOTE: the `name` binding allows API services to override the binding + to use different resource name schemes, such as `users/*/operations`. To + override the binding, API services can add a binding such as + `"/v1/{name=users/*}/operations"` to their service configuration. + For backwards compatibility, the default name includes the operations + collection id, however overriding users must ensure the name binding + is the parent resource, without the operations collection id."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_operations-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation's parent resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-create", + Some(r##"Creates a source."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Resource name of the new source's parent. Its format should be + "organizations/[organization_id]"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-findings-create", + Some(r##"Creates a finding. The corresponding source must exist for finding creation + to succeed."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-findings-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Resource name of the new finding's parent. Its format should be + "organizations/[organization_id]/sources/[source_id]"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-findings-group", + Some(r##"Filters an organization or source's findings and groups them by their + specified properties. + + To group across all sources provide a `-` as the source id. + Example: /v1/organizations/123/sources/-/findings"##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-findings-group", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the source to groupBy. Its format is + "organizations/[organization_id]/sources/[source_id]". To groupBy across + all sources provide a source_id of `-`. For example: + organizations/123/sources/-"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-findings-list", + Some(r##"Lists an organization or source's findings. + + To list across all sources provide a `-` as the source id. + Example: /v1/organizations/123/sources/-/findings"##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-findings-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Name of the source the findings belong to. Its format is + "organizations/[organization_id]/sources/[source_id]". To list across all + sources provide a source_id of `-`. For example: + organizations/123/sources/-"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-findings-patch", + Some(r##"Creates or updates a finding. The corresponding source must exist for a + finding creation to succeed."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-findings-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The relative resource name of this finding. See: + https://cloud.google.com/apis/design/resource_names#relative_resource_name + Example: + "organizations/123/sources/456/findings/789""##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-findings-set-state", + Some(r##"Updates the state of a finding."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-findings-set-state", + vec![ + (Some(r##"name"##), + None, + Some(r##"The relative resource name of the finding. See: + https://cloud.google.com/apis/design/resource_names#relative_resource_name + Example: + "organizations/123/sources/456/finding/789"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-findings-update-security-marks", + Some(r##"Updates security marks."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-findings-update-security-marks", + vec![ + (Some(r##"name"##), + None, + Some(r##"The relative resource name of the SecurityMarks. See: + https://cloud.google.com/apis/design/resource_names#relative_resource_name + Examples: + "organizations/123/assets/456/securityMarks" + "organizations/123/sources/456/findings/789/securityMarks"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-get", + Some(r##"Gets a source."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Relative resource name of the source. Its format is + "organizations/[organization_id]/source/[source_id]"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-get-iam-policy", + Some(r##"Gets the access control policy on the specified Source."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-list", + Some(r##"Lists all sources belonging to an organization."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Resource name of the parent of sources to list. Its format should be + "organizations/[organization_id]"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-patch", + Some(r##"Updates a source."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The relative resource name of this source. See: + https://cloud.google.com/apis/design/resource_names#relative_resource_name + Example: + "organizations/123/sources/456""##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-set-iam-policy", + Some(r##"Sets the access control policy on the specified Source."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sources-test-iam-permissions", + Some(r##"Returns the permissions that a caller has on the specified source."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_sources-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update-organization-settings", + Some(r##"Updates an organization's settings."##), + "Details at http://byron.github.io/google-apis-rs/google_securitycenter1_cli/organizations_update-organization-settings", + vec![ + (Some(r##"name"##), + None, + Some(r##"The relative resource name of the settings. See: + https://cloud.google.com/apis/design/resource_names#relative_resource_name + Example: + "organizations/123/organizationSettings"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("securitycenter1") + .author("Sebastian Thiel ") + .version("1.0.8+20190402") + .about("Cloud Security Command Center API provides access to temporal views of assets and findings within an organization.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_securitycenter1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/securitycenter1/Cargo.toml b/gen/securitycenter1/Cargo.toml new file mode 100644 index 0000000000..91ccdf46ba --- /dev/null +++ b/gen/securitycenter1/Cargo.toml @@ -0,0 +1,32 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-securitycenter1" +version = "1.0.8+20190402" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Security Command Center (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/securitycenter1" +homepage = "https://console.cloud.google.com/apis/api/securitycenter.googleapis.com/overview" +documentation = "https://docs.rs/google-securitycenter1/1.0.8+20190402" +license = "MIT" +keywords = ["securitycenter", "google", "protocol", "web", "api"] +autobins = false + + +[dev-dependencies] +hyper-rustls = "^0.6" + +[dependencies] +hyper = "^ 0.10" +mime = "^ 0.2.0" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" +yup-oauth2 = "^ 1.0" +url = "= 1.7" + +[features] + + diff --git a/gen/securitycenter1/LICENSE.md b/gen/securitycenter1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/securitycenter1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/securitycenter1/README.md b/gen/securitycenter1/README.md new file mode 100644 index 0000000000..d7c603862f --- /dev/null +++ b/gen/securitycenter1/README.md @@ -0,0 +1,191 @@ + +The `google-securitycenter1` library allows access to all features of the *Google Security Command Center* service. + +This documentation was generated from *Security Command Center* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *securitycenter:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. + +Everything else about the *Security Command Center* *v1* API can be found at the +[official documentation site](https://console.cloud.google.com/apis/api/securitycenter.googleapis.com/overview). +# Features + +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.SecurityCommandCenter.html) ... + +* organizations + * [*assets group*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationAssetGroupCall.html), [*assets list*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationAssetListCall.html), [*assets run discovery*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationAssetRunDiscoveryCall.html), [*assets update security marks*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationAssetUpdateSecurityMarkCall.html), [*get organization settings*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationGetOrganizationSettingCall.html), [*operations cancel*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationOperationCancelCall.html), [*operations delete*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationOperationDeleteCall.html), [*operations get*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationOperationGetCall.html), [*operations list*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationOperationListCall.html), [*sources create*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceCreateCall.html), [*sources findings create*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceFindingCreateCall.html), [*sources findings group*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceFindingGroupCall.html), [*sources findings list*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceFindingListCall.html), [*sources findings patch*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceFindingPatchCall.html), [*sources findings set state*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceFindingSetStateCall.html), [*sources findings update security marks*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceFindingUpdateSecurityMarkCall.html), [*sources get*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceGetCall.html), [*sources get iam policy*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceGetIamPolicyCall.html), [*sources list*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceListCall.html), [*sources patch*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourcePatchCall.html), [*sources set iam policy*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceSetIamPolicyCall.html), [*sources test iam permissions*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationSourceTestIamPermissionCall.html) and [*update organization settings*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.OrganizationUpdateOrganizationSettingCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/struct.SecurityCommandCenter.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.organizations().sources_findings_set_state(...).doit() +let r = hub.organizations().sources_findings_create(...).doit() +let r = hub.organizations().sources_findings_patch(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-securitycenter1 = "*" +# This project intentionally uses an old version of Hyper. See +# https://github.com/Byron/google-apis-rs/issues/173 for more +# information. +hyper = "^0.10" +hyper-rustls = "^0.6" +serde = "^1.0" +serde_json = "^1.0" +yup-oauth2 = "^1.0" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate hyper_rustls; +extern crate yup_oauth2 as oauth2; +extern crate google_securitycenter1 as securitycenter1; +use securitycenter1::Finding; +use securitycenter1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use securitycenter1::SecurityCommandCenter; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), + ::default(), None); +let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +// As the method needs a request, you would usually fill it with the desired information +// into the respective structure. Some of the parts shown here might not be applicable ! +// Values shown here are possibly random and not representative ! +let mut req = Finding::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `doit()`. +// Values shown here are possibly random and not representative ! +let result = hub.organizations().sources_findings_create(req, "parent") + .finding_id("sit") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). + +When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +makes the system potentially resilient to all kinds of errors. + +## Uploads and Downloads +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.ResponseResult.html), it will return that by default. +You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +this call: `.param("alt", "media")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.CallBuilder.html) before making the final `doit()` call. +Respective methods will be called to provide progress information, as well as determine whether the system should +retry on failure. + +The [delegate trait](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. + +## Optional Parts in Server-Requests + +All structures provided by this library are made to be [enocodable](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.Part.html) which are identifiable by name, which will be sent to +the server to indicate either the set parts of the request or the desired parts in the response. + +## Builder Arguments + +Using [method builders](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +These will always take a single argument, for which the following statements are true. + +* [PODs][wiki-pod] are handed by copy +* strings are passed as `&str` +* [request values](https://docs.rs/google-securitycenter1/1.0.8+20190402/google_securitycenter1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **securitycenter1** library was generated by Sebastian Thiel, and is placed +under the *MIT* license. +You can read the full text at the repository's [license file][repo-license]. + +[repo-license]: https://github.com/Byron/google-apis-rsblob/master/LICENSE.md diff --git a/gen/securitycenter1/src/cmn.rs b/gen/securitycenter1/src/cmn.rs new file mode 100644 index 0000000000..77d71c8896 --- /dev/null +++ b/gen/securitycenter1/src/cmn.rs @@ -0,0 +1,753 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat, Bearer}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Request ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_none() && self.last_part_boundary.is_none() + } + + /// Returns true if we are handling our last part + fn is_last_part(&self) -> bool { + self.raw_parts.len() == 0 && self.current_part.is_some() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// A utility type to perform a resumable upload from start to end. +pub struct ResumableUploadHelper<'a, A: 'a> { + pub client: &'a mut hyper::client::Client, + pub delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/securitycenter1/src/lib.rs b/gen/securitycenter1/src/lib.rs new file mode 100644 index 0000000000..338eab19b8 --- /dev/null +++ b/gen/securitycenter1/src/lib.rs @@ -0,0 +1,8936 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *Security Command Center* crate version *1.0.8+20190402*, where *20190402* is the exact revision of the *securitycenter:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! +//! Everything else about the *Security Command Center* *v1* API can be found at the +//! [official documentation site](https://console.cloud.google.com/apis/api/securitycenter.googleapis.com/overview). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/securitycenter1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.SecurityCommandCenter.html) ... +//! +//! * organizations +//! * [*assets group*](struct.OrganizationAssetGroupCall.html), [*assets list*](struct.OrganizationAssetListCall.html), [*assets run discovery*](struct.OrganizationAssetRunDiscoveryCall.html), [*assets update security marks*](struct.OrganizationAssetUpdateSecurityMarkCall.html), [*get organization settings*](struct.OrganizationGetOrganizationSettingCall.html), [*operations cancel*](struct.OrganizationOperationCancelCall.html), [*operations delete*](struct.OrganizationOperationDeleteCall.html), [*operations get*](struct.OrganizationOperationGetCall.html), [*operations list*](struct.OrganizationOperationListCall.html), [*sources create*](struct.OrganizationSourceCreateCall.html), [*sources findings create*](struct.OrganizationSourceFindingCreateCall.html), [*sources findings group*](struct.OrganizationSourceFindingGroupCall.html), [*sources findings list*](struct.OrganizationSourceFindingListCall.html), [*sources findings patch*](struct.OrganizationSourceFindingPatchCall.html), [*sources findings set state*](struct.OrganizationSourceFindingSetStateCall.html), [*sources findings update security marks*](struct.OrganizationSourceFindingUpdateSecurityMarkCall.html), [*sources get*](struct.OrganizationSourceGetCall.html), [*sources get iam policy*](struct.OrganizationSourceGetIamPolicyCall.html), [*sources list*](struct.OrganizationSourceListCall.html), [*sources patch*](struct.OrganizationSourcePatchCall.html), [*sources set iam policy*](struct.OrganizationSourceSetIamPolicyCall.html), [*sources test iam permissions*](struct.OrganizationSourceTestIamPermissionCall.html) and [*update organization settings*](struct.OrganizationUpdateOrganizationSettingCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.SecurityCommandCenter.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.organizations().sources_findings_set_state(...).doit() +//! let r = hub.organizations().sources_findings_create(...).doit() +//! let r = hub.organizations().sources_findings_patch(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-securitycenter1 = "*" +//! # This project intentionally uses an old version of Hyper. See +//! # https://github.com/Byron/google-apis-rs/issues/173 for more +//! # information. +//! hyper = "^0.10" +//! hyper-rustls = "^0.6" +//! serde = "^1.0" +//! serde_json = "^1.0" +//! yup-oauth2 = "^1.0" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate hyper_rustls; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_securitycenter1 as securitycenter1; +//! use securitycenter1::Finding; +//! use securitycenter1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use securitycenter1::SecurityCommandCenter; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +//! ::default(), None); +//! let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +//! // As the method needs a request, you would usually fill it with the desired information +//! // into the respective structure. Some of the parts shown here might not be applicable ! +//! // Values shown here are possibly random and not representative ! +//! let mut req = Finding::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `doit()`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.organizations().sources_findings_create(req, "parent") +//! .finding_id("sed") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +//! +//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This +//! makes the system potentially resilient to all kinds of errors. +//! +//! ## Uploads and Downloads +//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. +//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making +//! this call: `.param("alt", "media")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. +//! Respective methods will be called to provide progress information, as well as determine whether the system should +//! retry on failure. +//! +//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +//! +//! ## Optional Parts in Server-Requests +//! +//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to +//! the server to indicate either the set parts of the request or the desired parts in the response. +//! +//! ## Builder Arguments +//! +//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +//! These will always take a single argument, for which the following statements are true. +//! +//! * [PODs][wiki-pod] are handed by copy +//! * strings are passed as `&str` +//! * [request values](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +#[macro_use] +extern crate serde_derive; + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +use std::collections::HashMap; +use std::cell::RefCell; +use std::borrow::BorrowMut; +use std::default::Default; +use std::collections::BTreeMap; +use serde_json as json; +use std::io; +use std::fs; +use std::mem; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all SecurityCommandCenter related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::Finding; +/// use securitycenter1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use securitycenter1::SecurityCommandCenter; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Finding::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_findings_create(req, "parent") +/// .finding_id("dolores") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct SecurityCommandCenter { + client: RefCell, + auth: RefCell, + _user_agent: String, + _base_url: String, + _root_url: String, +} + +impl<'a, C, A> Hub for SecurityCommandCenter {} + +impl<'a, C, A> SecurityCommandCenter + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> SecurityCommandCenter { + SecurityCommandCenter { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/1.0.8".to_string(), + _base_url: "https://securitycenter.googleapis.com/".to_string(), + _root_url: "https://securitycenter.googleapis.com/".to_string(), + } + } + + pub fn organizations(&'a self) -> OrganizationMethods<'a, C, A> { + OrganizationMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/1.0.8`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + mem::replace(&mut self._user_agent, agent_name) + } + + /// Set the base url to use in all requests to the server. + /// It defaults to `https://securitycenter.googleapis.com/`. + /// + /// Returns the previously set base url. + pub fn base_url(&mut self, new_base_url: String) -> String { + mem::replace(&mut self._base_url, new_base_url) + } + + /// Set the root url to use in all requests to the server. + /// It defaults to `https://securitycenter.googleapis.com/`. + /// + /// Returns the previously set root url. + pub fn root_url(&mut self, new_root_url: String) -> String { + mem::replace(&mut self._root_url, new_root_url) + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Result containing the Asset and its State. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListAssetsResult { + /// State change of the asset between the points in time. + #[serde(rename="stateChange")] + pub state_change: Option, + /// Asset matching the search request. + pub asset: Option, +} + +impl Part for ListAssetsResult {} + + +/// Request message for `SetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources set iam policy organizations](struct.OrganizationSourceSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetIamPolicyRequest { + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. + pub policy: Option, + /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + /// the fields in the mask will be modified. If no mask is provided, the + /// following default mask is used: + /// paths: "bindings, etag" + /// This field is only used by Cloud IAM. + #[serde(rename="updateMask")] + pub update_mask: Option, +} + +impl RequestValue for SetIamPolicyRequest {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to +/// specify access control policies for Cloud Platform resources. +/// +/// +/// A `Policy` consists of a list of `bindings`. A `binding` binds a list of +/// `members` to a `role`, where the members can be user accounts, Google groups, +/// Google domains, and service accounts. A `role` is a named list of permissions +/// defined by IAM. +/// +/// **JSON Example** +/// +/// { +/// "bindings": [ +/// { +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" +/// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] +/// } +/// ] +/// } +/// +/// **YAML Example** +/// +/// bindings: +/// - members: +/// - user:mike@example.com +/// - group:admins@example.com +/// - domain:google.com +/// - serviceAccount:my-other-app@appspot.gserviceaccount.com +/// role: roles/owner +/// - members: +/// - user:sean@example.com +/// role: roles/viewer +/// +/// +/// For a description of IAM and its features, see the +/// [IAM developer's guide](https://cloud.google.com/iam/docs). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources get iam policy organizations](struct.OrganizationSourceGetIamPolicyCall.html) (response) +/// * [sources set iam policy organizations](struct.OrganizationSourceSetIamPolicyCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Specifies cloud audit logging configuration for this policy. + #[serde(rename="auditConfigs")] + pub audit_configs: Option>, + /// `etag` is used for optimistic concurrency control as a way to help + /// prevent simultaneous updates of a policy from overwriting each other. + /// It is strongly suggested that systems make use of the `etag` in the + /// read-modify-write cycle to perform policy updates in order to avoid race + /// conditions: An `etag` is returned in the response to `getIamPolicy`, and + /// systems are expected to put that etag in the request to `setIamPolicy` to + /// ensure that their change will be applied to the same version of the policy. + /// + /// If no `etag` is provided in the call to `setIamPolicy`, then the existing + /// policy is overwritten blindly. + pub etag: Option, + /// Associates a list of `members` to a `role`. + /// `bindings` with no members will result in an error. + pub bindings: Option>, + /// Deprecated. + pub version: Option, +} + +impl ResponseResult for Policy {} + + +/// Cloud Security Command Center's (Cloud SCC) representation of a Google Cloud +/// Platform (GCP) resource. +/// +/// The Asset is a Cloud SCC resource that captures information about a single +/// GCP resource. All modifications to an Asset are only within the context of +/// Cloud SCC and don't affect the referenced GCP resource. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Asset { + /// Resource managed properties. These properties are managed and defined by + /// the GCP resource and cannot be modified by the user. + #[serde(rename="resourceProperties")] + pub resource_properties: Option>, + /// The time at which the asset was last updated, added, or deleted in Cloud + /// SCC. + #[serde(rename="updateTime")] + pub update_time: Option, + /// The relative resource name of this asset. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/assets/456". + pub name: Option, + /// IAM Policy information associated with the GCP resource described by the + /// Cloud SCC asset. This information is managed and defined by the GCP + /// resource and cannot be modified by the user. + #[serde(rename="iamPolicy")] + pub iam_policy: Option, + /// User specified security marks. These marks are entirely managed by the user + /// and come from the SecurityMarks resource that belongs to the asset. + #[serde(rename="securityMarks")] + pub security_marks: Option, + /// The time at which the asset was created in Cloud SCC. + #[serde(rename="createTime")] + pub create_time: Option, + /// Cloud SCC managed properties. These properties are managed by + /// Cloud SCC and cannot be modified by the user. + #[serde(rename="securityCenterProperties")] + pub security_center_properties: Option, +} + +impl Part for Asset {} + + +/// Request message for grouping by findings. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources findings group organizations](struct.OrganizationSourceFindingGroupCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GroupFindingsRequest { + /// Expression that defines the filter to apply across findings. + /// The expression is a list of one or more restrictions combined via logical + /// operators `AND` and `OR`. + /// Parentheses are supported, and `OR` has higher precedence than `AND`. + /// + /// Restrictions have the form ` ` and may have a `-` + /// character in front of them to indicate negation. Examples include: + /// + /// * name + /// * source_properties.a_property + /// * security_marks.marks.marka + /// + /// The supported operators are: + /// + /// * `=` for all value types. + /// * `>`, `<`, `>=`, `<=` for integer values. + /// * `:`, meaning substring matching, for strings. + /// + /// The supported value types are: + /// + /// * string literals in quotes. + /// * integer literals without quotes. + /// * boolean literals `true` and `false` without quotes. + /// + /// The following field and operator combinations are supported: + /// name | `=` + /// parent | '=', ':' + /// resource_name | '=', ':' + /// state | '=', ':' + /// category | '=', ':' + /// external_uri | '=', ':' + /// event_time | `>`, `<`, `>=`, `<=` + /// security_marks | '=', ':' + /// source_properties | '=', ':', `>`, `<`, `>=`, `<=` + /// + /// For example, `source_properties.size = 100` is a valid filter string. + pub filter: Option, + /// The value returned by the last `GroupFindingsResponse`; indicates + /// that this is a continuation of a prior `GroupFindings` call, and + /// that the system should return the next page of data. + #[serde(rename="pageToken")] + pub page_token: Option, + /// When compare_duration is set, the GroupResult's "state_change" attribute is + /// updated to indicate whether the finding had its state changed, the + /// finding's state remained unchanged, or if the finding was added during the + /// compare_duration period of time that precedes the read_time. This is the + /// time between (read_time - compare_duration) and read_time. + /// + /// The state_change value is derived based on the presence and state of the + /// finding at the two points in time. Intermediate state changes between the + /// two times don't affect the result. For example, the results aren't affected + /// if the finding is made inactive and then active again. + /// + /// Possible "state_change" values when compare_duration is specified: + /// + /// * "CHANGED": indicates that the finding was present at the start of + /// compare_duration, but changed its state at read_time. + /// * "UNCHANGED": indicates that the finding was present at the start of + /// compare_duration and did not change state at read_time. + /// * "ADDED": indicates that the finding was not present at the start + /// of compare_duration, but was present at read_time. + /// + /// If compare_duration is not specified, then the only possible state_change + /// is "UNUSED", which will be the state_change set for all findings present + /// at read_time. + /// + /// If this field is set then `state_change` must be a specified field in + /// `group_by`. + #[serde(rename="compareDuration")] + pub compare_duration: Option, + /// The maximum number of results to return in a single response. Default is + /// 10, minimum is 1, maximum is 1000. + #[serde(rename="pageSize")] + pub page_size: Option, + /// Expression that defines what assets fields to use for grouping (including + /// `state_change`). The string value should follow SQL syntax: comma separated + /// list of fields. For example: "parent,resource_name". + /// + /// The following fields are supported: + /// + /// * resource_name + /// * category + /// * state + /// * parent + /// + /// The following fields are supported when compare_duration is set: + /// + /// * state_change + #[serde(rename="groupBy")] + pub group_by: Option, + /// Time used as a reference point when filtering findings. The filter is + /// limited to findings existing at the supplied time and their values are + /// those at that specific time. Absence of this field will default to the + /// API's version of NOW. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl RequestValue for GroupFindingsRequest {} + + +/// Cloud Security Command Center (Cloud SCC) finding. +/// +/// A finding is a record of assessment data (security, risk, health or privacy) +/// ingested into Cloud SCC for presentation, notification, analysis, +/// policy testing, and enforcement. For example, an XSS vulnerability in an +/// App Engine application is a finding. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources findings set state organizations](struct.OrganizationSourceFindingSetStateCall.html) (response) +/// * [sources findings create organizations](struct.OrganizationSourceFindingCreateCall.html) (request|response) +/// * [sources findings patch organizations](struct.OrganizationSourceFindingPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Finding { + /// The additional taxonomy group within findings from a given source. + /// This field is immutable after creation time. + /// Example: "XSS_FLASH_INJECTION" + pub category: Option, + /// The time at which the event took place. For example, if the finding + /// represents an open firewall it would capture the time the open firewall was + /// detected. + #[serde(rename="eventTime")] + pub event_time: Option, + /// Source specific properties. These properties are managed by the source + /// that writes the finding. The key names in the source_properties map must be + /// between 1 and 255 characters, and must start with a letter and contain + /// alphanumeric characters or underscores only. + #[serde(rename="sourceProperties")] + pub source_properties: Option>, + /// The relative resource name of this finding. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/sources/456/findings/789" + pub name: Option, + /// The relative resource name of the source the finding belongs to. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// This field is immutable after creation time. + /// For example: + /// "organizations/123/sources/456" + pub parent: Option, + /// The state of the finding. + pub state: Option, + /// The full resource name of the Google Cloud Platform (GCP) resource this + /// finding is for. See: + /// https://cloud.google.com/apis/design/resource_names#full_resource_name + /// This field is immutable after creation time. + #[serde(rename="resourceName")] + pub resource_name: Option, + /// Output only. User specified security marks. These marks are entirely + /// managed by the user and come from the SecurityMarks resource that belongs + /// to the finding. + #[serde(rename="securityMarks")] + pub security_marks: Option, + /// The time at which the finding was created in Cloud SCC. + #[serde(rename="createTime")] + pub create_time: Option, + /// The URI that, if available, points to a web page outside of Cloud SCC + /// where additional information about the finding can be found. This field is + /// guaranteed to be either empty or a well formed URL. + #[serde(rename="externalUri")] + pub external_uri: Option, +} + +impl RequestValue for Finding {} +impl ResponseResult for Finding {} + + +/// Response message for listing assets. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [assets list organizations](struct.OrganizationAssetListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListAssetsResponse { + /// Token to retrieve the next page of results, or empty if there are no more + /// results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The total number of assets matching the query. + #[serde(rename="totalSize")] + pub total_size: Option, + /// Assets matching the list request. + #[serde(rename="listAssetsResults")] + pub list_assets_results: Option>, + /// Time used for executing the list request. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl ResponseResult for ListAssetsResponse {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [operations cancel organizations](struct.OrganizationOperationCancelCall.html) (response) +/// * [operations delete organizations](struct.OrganizationOperationDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources test iam permissions organizations](struct.OrganizationSourceTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestIamPermissionsResponse {} + + +/// Result containing the Finding and its StateChange. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListFindingsResult { + /// Finding matching the search request. + pub finding: Option, + /// State change of the finding between the points in time. + #[serde(rename="stateChange")] + pub state_change: Option, +} + +impl Part for ListFindingsResult {} + + +/// Result containing the properties and count of a groupBy request. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GroupResult { + /// Total count of resources for the given properties. + pub count: Option, + /// Properties matching the groupBy fields in the request. + pub properties: Option>, +} + +impl Part for GroupResult {} + + +/// Request message for updating a finding's state. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources findings set state organizations](struct.OrganizationSourceFindingSetStateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetFindingStateRequest { + /// The desired State of the finding. + pub state: Option, + /// The time at which the updated state takes effect. + #[serde(rename="startTime")] + pub start_time: Option, +} + +impl RequestValue for SetFindingStateRequest {} + + +/// Request message for running asset discovery for an organization. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [assets run discovery organizations](struct.OrganizationAssetRunDiscoveryCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RunAssetDiscoveryRequest { _never_set: Option } + +impl RequestValue for RunAssetDiscoveryRequest {} + + +/// Cloud SCC managed properties. These properties are managed by Cloud SCC and +/// cannot be modified by the user. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SecurityCenterProperties { + /// The type of the GCP resource. Examples include: APPLICATION, + /// PROJECT, and ORGANIZATION. This is a case insensitive field defined by + /// Cloud SCC and/or the producer of the resource and is immutable + /// after create time. + #[serde(rename="resourceType")] + pub resource_type: Option, + /// The full resource name of the GCP resource this asset + /// represents. This field is immutable after create time. See: + /// https://cloud.google.com/apis/design/resource_names#full_resource_name + #[serde(rename="resourceName")] + pub resource_name: Option, + /// The full resource name of the immediate parent of the resource. See: + /// https://cloud.google.com/apis/design/resource_names#full_resource_name + #[serde(rename="resourceParent")] + pub resource_parent: Option, + /// The full resource name of the project the resource belongs to. See: + /// https://cloud.google.com/apis/design/resource_names#full_resource_name + #[serde(rename="resourceProject")] + pub resource_project: Option, + /// Owners of the Google Cloud resource. + #[serde(rename="resourceOwners")] + pub resource_owners: Option>, +} + +impl Part for SecurityCenterProperties {} + + +/// Response message for listing findings. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources findings list organizations](struct.OrganizationSourceFindingListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListFindingsResponse { + /// Token to retrieve the next page of results, or empty if there are no more + /// results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The total number of findings matching the query. + #[serde(rename="totalSize")] + pub total_size: Option, + /// Findings matching the list request. + #[serde(rename="listFindingsResults")] + pub list_findings_results: Option>, + /// Time used for executing the list request. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl ResponseResult for ListFindingsResponse {} + + +/// Response message for grouping by assets. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [assets group organizations](struct.OrganizationAssetGroupCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GroupAssetsResponse { + /// Token to retrieve the next page of results, or empty if there are no more + /// results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The total number of results matching the query. + #[serde(rename="totalSize")] + pub total_size: Option, + /// Group results. There exists an element for each existing unique + /// combination of property/values. The element contains a count for the number + /// of times those specific property/values appear. + #[serde(rename="groupByResults")] + pub group_by_results: Option>, + /// Time used for executing the groupBy request. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl ResponseResult for GroupAssetsResponse {} + + +/// User specified security marks that are attached to the parent Cloud Security +/// Command Center (Cloud SCC) resource. Security marks are scoped within a Cloud +/// SCC organization -- they can be modified and viewed by all users who have +/// proper permissions on the organization. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [assets update security marks organizations](struct.OrganizationAssetUpdateSecurityMarkCall.html) (request|response) +/// * [sources findings update security marks organizations](struct.OrganizationSourceFindingUpdateSecurityMarkCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SecurityMarks { + /// The relative resource name of the SecurityMarks. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Examples: + /// "organizations/123/assets/456/securityMarks" + /// "organizations/123/sources/456/findings/789/securityMarks". + pub name: Option, + /// Mutable user specified security marks belonging to the parent resource. + /// Constraints are as follows: + /// - Keys and values are treated as case insensitive + /// - Keys must be between 1 - 256 characters (inclusive) + /// - Keys must be letters, numbers, underscores, or dashes + /// - Values have leading and trailing whitespace trimmed, remaining + /// characters must be between 1 - 4096 characters (inclusive) + pub marks: Option>, +} + +impl RequestValue for SecurityMarks {} +impl ResponseResult for SecurityMarks {} + + +/// Provides the configuration for logging a type of permissions. +/// Example: +/// +/// { +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// } +/// ] +/// } +/// +/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting +/// foo@gmail.com from DATA_READ logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditLogConfig { + /// Specifies the identities that do not cause logging for this type of + /// permission. + /// Follows the same format of Binding.members. + #[serde(rename="exemptedMembers")] + pub exempted_members: Option>, + /// The log type that this config enables. + #[serde(rename="logType")] + pub log_type: Option, +} + +impl Part for AuditLogConfig {} + + +/// Request message for `GetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources get iam policy organizations](struct.OrganizationSourceGetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetIamPolicyRequest { _never_set: Option } + +impl RequestValue for GetIamPolicyRequest {} + + +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources test iam permissions organizations](struct.OrganizationSourceTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with + /// wildcards (such as '*' or 'storage.*') are not allowed. For more + /// information see + /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + pub permissions: Option>, +} + +impl RequestValue for TestIamPermissionsRequest {} + + +/// Represents an expression text. Example: +/// +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. + /// + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, +} + +impl Part for Expr {} + + +/// User specified settings that are attached to the Cloud Security Command +/// Center (Cloud SCC) organization. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get organization settings organizations](struct.OrganizationGetOrganizationSettingCall.html) (response) +/// * [update organization settings organizations](struct.OrganizationUpdateOrganizationSettingCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrganizationSettings { + /// The configuration used for Asset Discovery runs. + #[serde(rename="assetDiscoveryConfig")] + pub asset_discovery_config: Option, + /// The relative resource name of the settings. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/organizationSettings". + pub name: Option, + /// A flag that indicates if Asset Discovery should be enabled. If the flag is + /// set to `true`, then discovery of assets will occur. If it is set to `false, + /// all historical assets will remain, but discovery of future assets will not + /// occur. + #[serde(rename="enableAssetDiscovery")] + pub enable_asset_discovery: Option, +} + +impl RequestValue for OrganizationSettings {} +impl ResponseResult for OrganizationSettings {} + + +/// Request message for grouping by assets. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [assets group organizations](struct.OrganizationAssetGroupCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GroupAssetsRequest { + /// Expression that defines the filter to apply across assets. + /// The expression is a list of zero or more restrictions combined via logical + /// operators `AND` and `OR`. + /// Parentheses are supported, and `OR` has higher precedence than `AND`. + /// + /// Restrictions have the form ` ` and may have a `-` + /// character in front of them to indicate negation. The fields map to those + /// defined in the Asset resource. Examples include: + /// + /// * name + /// * security_center_properties.resource_name + /// * resource_properties.a_property + /// * security_marks.marks.marka + /// + /// The supported operators are: + /// + /// * `=` for all value types. + /// * `>`, `<`, `>=`, `<=` for integer values. + /// * `:`, meaning substring matching, for strings. + /// + /// The supported value types are: + /// + /// * string literals in quotes. + /// * integer literals without quotes. + /// * boolean literals `true` and `false` without quotes. + /// + /// The following field and operator combinations are supported: + /// name | `=` + /// update_time | `>`, `<`, `>=`, `<=` + /// iam_policy.policy_blob | '=', ':' + /// resource_properties | '=', ':', `>`, `<`, `>=`, `<=` + /// security_marks | '=', ':' + /// security_center_properties.resource_name | '=', ':' + /// security_center_properties.resource_type | '=', ':' + /// security_center_properties.resource_parent | '=', ':' + /// security_center_properties.resource_project | '=', ':' + /// security_center_properties.resource_owners | '=', ':' + /// + /// For example, `resource_properties.size = 100` is a valid filter string. + pub filter: Option, + /// The value returned by the last `GroupAssetsResponse`; indicates + /// that this is a continuation of a prior `GroupAssets` call, and that the + /// system should return the next page of data. + #[serde(rename="pageToken")] + pub page_token: Option, + /// When compare_duration is set, the GroupResult's "state_change" property is + /// updated to indicate whether the asset was added, removed, or remained + /// present during the compare_duration period of time that precedes the + /// read_time. This is the time between (read_time - compare_duration) and + /// read_time. + /// + /// The state change value is derived based on the presence of the asset at the + /// two points in time. Intermediate state changes between the two times don't + /// affect the result. For example, the results aren't affected if the asset is + /// removed and re-created again. + /// + /// Possible "state_change" values when compare_duration is specified: + /// + /// * "ADDED": indicates that the asset was not present at the start of + /// compare_duration, but present at reference_time. + /// * "REMOVED": indicates that the asset was present at the start of + /// compare_duration, but not present at reference_time. + /// * "ACTIVE": indicates that the asset was present at both the + /// start and the end of the time period defined by + /// compare_duration and reference_time. + /// + /// If compare_duration is not specified, then the only possible state_change + /// is "UNUSED", which will be the state_change set for all assets present at + /// read_time. + /// + /// If this field is set then `state_change` must be a specified field in + /// `group_by`. + #[serde(rename="compareDuration")] + pub compare_duration: Option, + /// The maximum number of results to return in a single response. Default is + /// 10, minimum is 1, maximum is 1000. + #[serde(rename="pageSize")] + pub page_size: Option, + /// Expression that defines what assets fields to use for grouping. The string + /// value should follow SQL syntax: comma separated list of fields. For + /// example: + /// "security_center_properties.resource_project,security_center_properties.project". + /// + /// The following fields are supported when compare_duration is not set: + /// + /// * security_center_properties.resource_project + /// * security_center_properties.resource_type + /// * security_center_properties.resource_parent + /// + /// The following fields are supported when compare_duration is set: + /// + /// * security_center_properties.resource_type + #[serde(rename="groupBy")] + pub group_by: Option, + /// Time used as a reference point when filtering assets. The filter is limited + /// to assets existing at the supplied time and their values are those at that + /// specific time. Absence of this field will default to the API's version of + /// NOW. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl RequestValue for GroupAssetsRequest {} + + +/// Response message for group by findings. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources findings group organizations](struct.OrganizationSourceFindingGroupCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GroupFindingsResponse { + /// Token to retrieve the next page of results, or empty if there are no more + /// results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The total number of results matching the query. + #[serde(rename="totalSize")] + pub total_size: Option, + /// Group results. There exists an element for each existing unique + /// combination of property/values. The element contains a count for the number + /// of times those specific property/values appear. + #[serde(rename="groupByResults")] + pub group_by_results: Option>, + /// Time used for executing the groupBy request. + #[serde(rename="readTime")] + pub read_time: Option, +} + +impl ResponseResult for GroupFindingsResponse {} + + +/// The response message for Operations.ListOperations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [operations list organizations](struct.OrganizationOperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, +} + +impl ResponseResult for ListOperationsResponse {} + + +/// Cloud Security Command Center's (Cloud SCC) finding source. A finding source +/// is an entity or a mechanism that can produce a finding. A source is like a +/// container of findings that come from the same scanner, logger, monitor, etc. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources patch organizations](struct.OrganizationSourcePatchCall.html) (request|response) +/// * [sources create organizations](struct.OrganizationSourceCreateCall.html) (request|response) +/// * [sources get organizations](struct.OrganizationSourceGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Source { + /// The source’s display name. + /// A source’s display name must be unique amongst its siblings, for example, + /// two sources with the same parent can't share the same display name. + /// The display name must start and end with a letter or digit, may contain + /// letters, digits, spaces, hyphens, and underscores, and can be no longer + /// than 32 characters. This is captured by the regular expression: + /// [\p{L}\p{N}]({\p{L}\p{N}_- ]{0,30}[\p{L}\p{N}])?. + #[serde(rename="displayName")] + pub display_name: Option, + /// The description of the source (max of 1024 characters). + /// Example: + /// "Cloud Security Scanner is a web security scanner for common + /// vulnerabilities in App Engine applications. It can automatically + /// scan and detect four common vulnerabilities, including cross-site-scripting + /// (XSS), Flash injection, mixed content (HTTP in HTTPS), and + /// outdated/insecure libraries." + pub description: Option, + /// The relative resource name of this source. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/sources/456" + pub name: Option, +} + +impl RequestValue for Source {} +impl ResponseResult for Source {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// The condition that is associated with this binding. + /// NOTE: An unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + +/// Specifies the audit configuration for a service. +/// The configuration determines which permission types are logged, and what +/// identities, if any, are exempted from logging. +/// An AuditConfig must have one or more AuditLogConfigs. +/// +/// If there are AuditConfigs for both `allServices` and a specific service, +/// the union of the two AuditConfigs is used for that service: the log_types +/// specified in each AuditConfig are enabled, and the exempted_members in each +/// AuditLogConfig are exempted. +/// +/// Example Policy with multiple AuditConfigs: +/// +/// { +/// "audit_configs": [ +/// { +/// "service": "allServices" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// "exempted_members": [ +/// "user:foo@gmail.com" +/// ] +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// }, +/// { +/// "log_type": "ADMIN_READ", +/// } +/// ] +/// }, +/// { +/// "service": "fooservice.googleapis.com" +/// "audit_log_configs": [ +/// { +/// "log_type": "DATA_READ", +/// }, +/// { +/// "log_type": "DATA_WRITE", +/// "exempted_members": [ +/// "user:bar@gmail.com" +/// ] +/// } +/// ] +/// } +/// ] +/// } +/// +/// For fooservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ +/// logging. It also exempts foo@gmail.com from DATA_READ logging, and +/// bar@gmail.com from DATA_WRITE logging. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AuditConfig { + /// The configuration for logging of each type of permission. + #[serde(rename="auditLogConfigs")] + pub audit_log_configs: Option>, + /// Specifies a service that will be enabled for audit logging. + /// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + /// `allServices` is a special value that covers all services. + pub service: Option, +} + +impl Part for AuditConfig {} + + +/// IAM Policy information associated with the GCP resource described by the +/// Cloud SCC asset. This information is managed and defined by the GCP +/// resource and cannot be modified by the user. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IamPolicy { + /// The JSON representation of the Policy associated with the asset. + /// See https://cloud.google.com/iam/reference/rest/v1/Policy for format + /// details. + #[serde(rename="policyBlob")] + pub policy_blob: Option, +} + +impl Part for IamPolicy {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [assets run discovery organizations](struct.OrganizationAssetRunDiscoveryCall.html) (response) +/// * [operations get organizations](struct.OrganizationOperationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl ResponseResult for Operation {} + + +/// The configuration used for Asset Discovery runs. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AssetDiscoveryConfig { + /// The project ids to use for filtering asset discovery. + #[serde(rename="projectIds")] + pub project_ids: Option>, + /// The mode to use for filtering asset discovery. + #[serde(rename="inclusionMode")] + pub inclusion_mode: Option, +} + +impl Part for AssetDiscoveryConfig {} + + +/// Response message for listing sources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sources list organizations](struct.OrganizationSourceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListSourcesResponse { + /// Token to retrieve the next page of results, or empty if there are no more + /// results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Sources belonging to the requested parent. + pub sources: Option>, +} + +impl ResponseResult for ListSourcesResponse {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *organization* resources. +/// It is not used directly, but through the `SecurityCommandCenter` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_securitycenter1 as securitycenter1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use securitycenter1::SecurityCommandCenter; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `assets_group(...)`, `assets_list(...)`, `assets_run_discovery(...)`, `assets_update_security_marks(...)`, `get_organization_settings(...)`, `operations_cancel(...)`, `operations_delete(...)`, `operations_get(...)`, `operations_list(...)`, `sources_create(...)`, `sources_findings_create(...)`, `sources_findings_group(...)`, `sources_findings_list(...)`, `sources_findings_patch(...)`, `sources_findings_set_state(...)`, `sources_findings_update_security_marks(...)`, `sources_get(...)`, `sources_get_iam_policy(...)`, `sources_list(...)`, `sources_patch(...)`, `sources_set_iam_policy(...)`, `sources_test_iam_permissions(...)` and `update_organization_settings(...)` +/// // to build up your call. +/// let rb = hub.organizations(); +/// # } +/// ``` +pub struct OrganizationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, +} + +impl<'a, C, A> MethodsBuilder for OrganizationMethods<'a, C, A> {} + +impl<'a, C, A> OrganizationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets the settings for an organization. + /// + /// # Arguments + /// + /// * `name` - Name of the organization to get organization settings for. Its format is + /// "organizations/[organization_id]/organizationSettings". + pub fn get_organization_settings(&self, name: &str) -> OrganizationGetOrganizationSettingCall<'a, C, A> { + OrganizationGetOrganizationSettingCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Filters an organization or source's findings and groups them by their + /// specified properties. + /// + /// To group across all sources provide a `-` as the source id. + /// Example: /v1/organizations/123/sources/-/findings + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Name of the source to groupBy. Its format is + /// "organizations/[organization_id]/sources/[source_id]". To groupBy across + /// all sources provide a source_id of `-`. For example: + /// organizations/123/sources/- + pub fn sources_findings_group(&self, request: GroupFindingsRequest, parent: &str) -> OrganizationSourceFindingGroupCall<'a, C, A> { + OrganizationSourceFindingGroupCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all sources belonging to an organization. + /// + /// # Arguments + /// + /// * `parent` - Resource name of the parent of sources to list. Its format should be + /// "organizations/[organization_id]". + pub fn sources_list(&self, parent: &str) -> OrganizationSourceListCall<'a, C, A> { + OrganizationSourceListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an organization's settings. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The relative resource name of the settings. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/organizationSettings". + pub fn update_organization_settings(&self, request: OrganizationSettings, name: &str) -> OrganizationUpdateOrganizationSettingCall<'a, C, A> { + OrganizationUpdateOrganizationSettingCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the permissions that a caller has on the specified source. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn sources_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> OrganizationSourceTestIamPermissionCall<'a, C, A> { + OrganizationSourceTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Runs asset discovery. The discovery is tracked with a long-running + /// operation. + /// + /// This API can only be called with limited frequency for an organization. If + /// it is called too frequently the caller will receive a TOO_MANY_REQUESTS + /// error. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Name of the organization to run asset discovery for. Its format is + /// "organizations/[organization_id]". + pub fn assets_run_discovery(&self, request: RunAssetDiscoveryRequest, parent: &str) -> OrganizationAssetRunDiscoveryCall<'a, C, A> { + OrganizationAssetRunDiscoveryCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the access control policy on the specified Source. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + pub fn sources_get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> OrganizationSourceGetIamPolicyCall<'a, C, A> { + OrganizationSourceGetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Starts asynchronous cancellation on a long-running operation. The server + /// makes a best effort to cancel the operation, but success is not + /// guaranteed. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use + /// Operations.GetOperation or + /// other methods to check whether the cancellation succeeded or whether the + /// operation completed despite cancellation. On successful cancellation, + /// the operation is not deleted; instead, it becomes an operation with + /// an Operation.error value with a google.rpc.Status.code of 1, + /// corresponding to `Code.CANCELLED`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource to be cancelled. + pub fn operations_cancel(&self, name: &str) -> OrganizationOperationCancelCall<'a, C, A> { + OrganizationOperationCancelCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the state of a finding. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The relative resource name of the finding. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/sources/456/finding/789". + pub fn sources_findings_set_state(&self, request: SetFindingStateRequest, name: &str) -> OrganizationSourceFindingSetStateCall<'a, C, A> { + OrganizationSourceFindingSetStateCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists an organization or source's findings. + /// + /// To list across all sources provide a `-` as the source id. + /// Example: /v1/organizations/123/sources/-/findings + /// + /// # Arguments + /// + /// * `parent` - Name of the source the findings belong to. Its format is + /// "organizations/[organization_id]/sources/[source_id]". To list across all + /// sources provide a source_id of `-`. For example: + /// organizations/123/sources/- + pub fn sources_findings_list(&self, parent: &str) -> OrganizationSourceFindingListCall<'a, C, A> { + OrganizationSourceFindingListCall { + hub: self.hub, + _parent: parent.to_string(), + _read_time: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _order_by: Default::default(), + _filter: Default::default(), + _field_mask: Default::default(), + _compare_duration: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates or updates a finding. The corresponding source must exist for a + /// finding creation to succeed. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The relative resource name of this finding. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/sources/456/findings/789" + pub fn sources_findings_patch(&self, request: Finding, name: &str) -> OrganizationSourceFindingPatchCall<'a, C, A> { + OrganizationSourceFindingPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Filters an organization's assets and groups them by their specified + /// properties. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Name of the organization to groupBy. Its format is + /// "organizations/[organization_id]". + pub fn assets_group(&self, request: GroupAssetsRequest, parent: &str) -> OrganizationAssetGroupCall<'a, C, A> { + OrganizationAssetGroupCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates security marks. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The relative resource name of the SecurityMarks. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Examples: + /// "organizations/123/assets/456/securityMarks" + /// "organizations/123/sources/456/findings/789/securityMarks". + pub fn sources_findings_update_security_marks(&self, request: SecurityMarks, name: &str) -> OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> { + OrganizationSourceFindingUpdateSecurityMarkCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _start_time: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a source. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The relative resource name of this source. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/sources/456" + pub fn sources_patch(&self, request: Source, name: &str) -> OrganizationSourcePatchCall<'a, C, A> { + OrganizationSourcePatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists an organization's assets. + /// + /// # Arguments + /// + /// * `parent` - Name of the organization assets should belong to. Its format is + /// "organizations/[organization_id]". + pub fn assets_list(&self, parent: &str) -> OrganizationAssetListCall<'a, C, A> { + OrganizationAssetListCall { + hub: self.hub, + _parent: parent.to_string(), + _read_time: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _order_by: Default::default(), + _filter: Default::default(), + _field_mask: Default::default(), + _compare_duration: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn operations_get(&self, name: &str) -> OrganizationOperationGetCall<'a, C, A> { + OrganizationOperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists operations that match the specified filter in the request. If the + /// server doesn't support this method, it returns `UNIMPLEMENTED`. + /// + /// NOTE: the `name` binding allows API services to override the binding + /// to use different resource name schemes, such as `users/*/operations`. To + /// override the binding, API services can add a binding such as + /// `"/v1/{name=users/*}/operations"` to their service configuration. + /// For backwards compatibility, the default name includes the operations + /// collection id, however overriding users must ensure the name binding + /// is the parent resource, without the operations collection id. + /// + /// # Arguments + /// + /// * `name` - The name of the operation's parent resource. + pub fn operations_list(&self, name: &str) -> OrganizationOperationListCall<'a, C, A> { + OrganizationOperationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates security marks. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The relative resource name of the SecurityMarks. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Examples: + /// "organizations/123/assets/456/securityMarks" + /// "organizations/123/sources/456/findings/789/securityMarks". + pub fn assets_update_security_marks(&self, request: SecurityMarks, name: &str) -> OrganizationAssetUpdateSecurityMarkCall<'a, C, A> { + OrganizationAssetUpdateSecurityMarkCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _start_time: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the access control policy on the specified Source. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + pub fn sources_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> OrganizationSourceSetIamPolicyCall<'a, C, A> { + OrganizationSourceSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a source. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Resource name of the new source's parent. Its format should be + /// "organizations/[organization_id]". + pub fn sources_create(&self, request: Source, parent: &str) -> OrganizationSourceCreateCall<'a, C, A> { + OrganizationSourceCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a finding. The corresponding source must exist for finding creation + /// to succeed. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Resource name of the new finding's parent. Its format should be + /// "organizations/[organization_id]/sources/[source_id]". + pub fn sources_findings_create(&self, request: Finding, parent: &str) -> OrganizationSourceFindingCreateCall<'a, C, A> { + OrganizationSourceFindingCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _finding_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a long-running operation. This method indicates that the client is + /// no longer interested in the operation result. It does not cancel the + /// operation. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource to be deleted. + pub fn operations_delete(&self, name: &str) -> OrganizationOperationDeleteCall<'a, C, A> { + OrganizationOperationDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a source. + /// + /// # Arguments + /// + /// * `name` - Relative resource name of the source. Its format is + /// "organizations/[organization_id]/source/[source_id]". + pub fn sources_get(&self, name: &str) -> OrganizationSourceGetCall<'a, C, A> { + OrganizationSourceGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Gets the settings for an organization. +/// +/// A builder for the *getOrganizationSettings* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().get_organization_settings("name") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationGetOrganizationSettingCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationGetOrganizationSettingCall<'a, C, A> {} + +impl<'a, C, A> OrganizationGetOrganizationSettingCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrganizationSettings)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.getOrganizationSettings", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the organization to get organization settings for. Its format is + /// "organizations/[organization_id]/organizationSettings". + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationGetOrganizationSettingCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationGetOrganizationSettingCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationGetOrganizationSettingCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationGetOrganizationSettingCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Filters an organization or source's findings and groups them by their +/// specified properties. +/// +/// To group across all sources provide a `-` as the source id. +/// Example: /v1/organizations/123/sources/-/findings +/// +/// A builder for the *sources.findings.group* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::GroupFindingsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GroupFindingsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_findings_group(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceFindingGroupCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: GroupFindingsRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceFindingGroupCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceFindingGroupCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GroupFindingsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.findings.group", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/findings:group"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GroupFindingsRequest) -> OrganizationSourceFindingGroupCall<'a, C, A> { + self._request = new_value; + self + } + /// Name of the source to groupBy. Its format is + /// "organizations/[organization_id]/sources/[source_id]". To groupBy across + /// all sources provide a source_id of `-`. For example: + /// organizations/123/sources/- + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationSourceFindingGroupCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceFindingGroupCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceFindingGroupCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceFindingGroupCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists all sources belonging to an organization. +/// +/// A builder for the *sources.list* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_list("parent") +/// .page_token("justo") +/// .page_size(-1) +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceListCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListSourcesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/sources"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name of the parent of sources to list. Its format should be + /// "organizations/[organization_id]". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationSourceListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The value returned by the last `ListSourcesResponse`; indicates + /// that this is a continuation of a prior `ListSources` call, and + /// that the system should return the next page of data. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrganizationSourceListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of results to return in a single response. Default is + /// 10, minimum is 1, maximum is 1000. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OrganizationSourceListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an organization's settings. +/// +/// A builder for the *updateOrganizationSettings* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::OrganizationSettings; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = OrganizationSettings::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().update_organization_settings(req, "name") +/// .update_mask("labore") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationUpdateOrganizationSettingCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: OrganizationSettings, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationUpdateOrganizationSettingCall<'a, C, A> {} + +impl<'a, C, A> OrganizationUpdateOrganizationSettingCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrganizationSettings)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.updateOrganizationSettings", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: OrganizationSettings) -> OrganizationUpdateOrganizationSettingCall<'a, C, A> { + self._request = new_value; + self + } + /// The relative resource name of the settings. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/organizationSettings". + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationUpdateOrganizationSettingCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The FieldMask to use when updating the settings resource. + /// + /// If empty all mutable fields will be updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> OrganizationUpdateOrganizationSettingCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationUpdateOrganizationSettingCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationUpdateOrganizationSettingCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationUpdateOrganizationSettingCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Returns the permissions that a caller has on the specified source. +/// +/// A builder for the *sources.testIamPermissions* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: TestIamPermissionsRequest) -> OrganizationSourceTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> OrganizationSourceTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceTestIamPermissionCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Runs asset discovery. The discovery is tracked with a long-running +/// operation. +/// +/// This API can only be called with limited frequency for an organization. If +/// it is called too frequently the caller will receive a TOO_MANY_REQUESTS +/// error. +/// +/// A builder for the *assets.runDiscovery* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::RunAssetDiscoveryRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = RunAssetDiscoveryRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().assets_run_discovery(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationAssetRunDiscoveryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: RunAssetDiscoveryRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationAssetRunDiscoveryCall<'a, C, A> {} + +impl<'a, C, A> OrganizationAssetRunDiscoveryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.assets.runDiscovery", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/assets:runDiscovery"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: RunAssetDiscoveryRequest) -> OrganizationAssetRunDiscoveryCall<'a, C, A> { + self._request = new_value; + self + } + /// Name of the organization to run asset discovery for. Its format is + /// "organizations/[organization_id]". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationAssetRunDiscoveryCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationAssetRunDiscoveryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationAssetRunDiscoveryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationAssetRunDiscoveryCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the access control policy on the specified Source. +/// +/// A builder for the *sources.getIamPolicy* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::GetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_get_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: GetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.getIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GetIamPolicyRequest) -> OrganizationSourceGetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being requested. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> OrganizationSourceGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceGetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Starts asynchronous cancellation on a long-running operation. The server +/// makes a best effort to cancel the operation, but success is not +/// guaranteed. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. Clients can use +/// Operations.GetOperation or +/// other methods to check whether the cancellation succeeded or whether the +/// operation completed despite cancellation. On successful cancellation, +/// the operation is not deleted; instead, it becomes an operation with +/// an Operation.error value with a google.rpc.Status.code of 1, +/// corresponding to `Code.CANCELLED`. +/// +/// A builder for the *operations.cancel* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().operations_cancel("name") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationOperationCancelCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationOperationCancelCall<'a, C, A> {} + +impl<'a, C, A> OrganizationOperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.operations.cancel", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource to be cancelled. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationOperationCancelCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationOperationCancelCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationOperationCancelCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationOperationCancelCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates the state of a finding. +/// +/// A builder for the *sources.findings.setState* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::SetFindingStateRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetFindingStateRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_findings_set_state(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceFindingSetStateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: SetFindingStateRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceFindingSetStateCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceFindingSetStateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Finding)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.findings.setState", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:setState"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetFindingStateRequest) -> OrganizationSourceFindingSetStateCall<'a, C, A> { + self._request = new_value; + self + } + /// The relative resource name of the finding. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/sources/456/finding/789". + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationSourceFindingSetStateCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceFindingSetStateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceFindingSetStateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceFindingSetStateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists an organization or source's findings. +/// +/// To list across all sources provide a `-` as the source id. +/// Example: /v1/organizations/123/sources/-/findings +/// +/// A builder for the *sources.findings.list* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_findings_list("parent") +/// .read_time("ea") +/// .page_token("no") +/// .page_size(-21) +/// .order_by("justo") +/// .filter("et") +/// .field_mask("et") +/// .compare_duration("diam") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceFindingListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _parent: String, + _read_time: Option, + _page_token: Option, + _page_size: Option, + _order_by: Option, + _filter: Option, + _field_mask: Option, + _compare_duration: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceFindingListCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceFindingListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListFindingsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.findings.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._read_time { + params.push(("readTime", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + if let Some(value) = self._field_mask { + params.push(("fieldMask", value.to_string())); + } + if let Some(value) = self._compare_duration { + params.push(("compareDuration", value.to_string())); + } + for &field in ["alt", "parent", "readTime", "pageToken", "pageSize", "orderBy", "filter", "fieldMask", "compareDuration"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/findings"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the source the findings belong to. Its format is + /// "organizations/[organization_id]/sources/[source_id]". To list across all + /// sources provide a source_id of `-`. For example: + /// organizations/123/sources/- + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationSourceFindingListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Time used as a reference point when filtering findings. The filter is + /// limited to findings existing at the supplied time and their values are + /// those at that specific time. Absence of this field will default to the + /// API's version of NOW. + /// + /// Sets the *read time* query property to the given value. + pub fn read_time(mut self, new_value: &str) -> OrganizationSourceFindingListCall<'a, C, A> { + self._read_time = Some(new_value.to_string()); + self + } + /// The value returned by the last `ListFindingsResponse`; indicates + /// that this is a continuation of a prior `ListFindings` call, and + /// that the system should return the next page of data. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrganizationSourceFindingListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of results to return in a single response. Default is + /// 10, minimum is 1, maximum is 1000. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OrganizationSourceFindingListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Expression that defines what fields and order to use for sorting. The + /// string value should follow SQL syntax: comma separated list of fields. For + /// example: "name,resource_properties.a_property". The default sorting order + /// is ascending. To specify descending order for a field, a suffix " desc" + /// should be appended to the field name. For example: "name + /// desc,source_properties.a_property". Redundant space characters in the + /// syntax are insignificant. "name desc,source_properties.a_property" and " + /// name desc , source_properties.a_property " are equivalent. + /// + /// The following fields are supported: + /// name + /// parent + /// state + /// category + /// resource_name + /// event_time + /// source_properties + /// security_marks + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> OrganizationSourceFindingListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// Expression that defines the filter to apply across findings. + /// The expression is a list of one or more restrictions combined via logical + /// operators `AND` and `OR`. + /// Parentheses are supported, and `OR` has higher precedence than `AND`. + /// + /// Restrictions have the form ` ` and may have a `-` + /// character in front of them to indicate negation. Examples include: + /// + /// * name + /// * source_properties.a_property + /// * security_marks.marks.marka + /// + /// The supported operators are: + /// + /// * `=` for all value types. + /// * `>`, `<`, `>=`, `<=` for integer values. + /// * `:`, meaning substring matching, for strings. + /// + /// The supported value types are: + /// + /// * string literals in quotes. + /// * integer literals without quotes. + /// * boolean literals `true` and `false` without quotes. + /// + /// The following field and operator combinations are supported: + /// name | `=` + /// parent | '=', ':' + /// resource_name | '=', ':' + /// state | '=', ':' + /// category | '=', ':' + /// external_uri | '=', ':' + /// event_time | `>`, `<`, `>=`, `<=` + /// security_marks | '=', ':' + /// source_properties | '=', ':', `>`, `<`, `>=`, `<=` + /// + /// For example, `source_properties.size = 100` is a valid filter string. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> OrganizationSourceFindingListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// Optional. + /// + /// A field mask to specify the Finding fields to be listed in the response. + /// An empty field mask will list all fields. + /// + /// Sets the *field mask* query property to the given value. + pub fn field_mask(mut self, new_value: &str) -> OrganizationSourceFindingListCall<'a, C, A> { + self._field_mask = Some(new_value.to_string()); + self + } + /// When compare_duration is set, the ListFindingsResult's "state_change" + /// attribute is updated to indicate whether the finding had its state changed, + /// the finding's state remained unchanged, or if the finding was added in any + /// state during the compare_duration period of time that precedes the + /// read_time. This is the time between (read_time - compare_duration) and + /// read_time. + /// + /// The state_change value is derived based on the presence and state of the + /// finding at the two points in time. Intermediate state changes between the + /// two times don't affect the result. For example, the results aren't affected + /// if the finding is made inactive and then active again. + /// + /// Possible "state_change" values when compare_duration is specified: + /// + /// * "CHANGED": indicates that the finding was present at the start of + /// compare_duration, but changed its state at read_time. + /// * "UNCHANGED": indicates that the finding was present at the start of + /// compare_duration and did not change state at read_time. + /// * "ADDED": indicates that the finding was not present at the start + /// of compare_duration, but was present at read_time. + /// + /// If compare_duration is not specified, then the only possible state_change + /// is "UNUSED", which will be the state_change set for all findings present at + /// read_time. + /// + /// Sets the *compare duration* query property to the given value. + pub fn compare_duration(mut self, new_value: &str) -> OrganizationSourceFindingListCall<'a, C, A> { + self._compare_duration = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceFindingListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceFindingListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceFindingListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates or updates a finding. The corresponding source must exist for a +/// finding creation to succeed. +/// +/// A builder for the *sources.findings.patch* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::Finding; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Finding::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_findings_patch(req, "name") +/// .update_mask("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceFindingPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: Finding, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceFindingPatchCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceFindingPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Finding)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.findings.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Finding) -> OrganizationSourceFindingPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The relative resource name of this finding. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/sources/456/findings/789" + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationSourceFindingPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The FieldMask to use when updating the finding resource. This field should + /// not be specified when creating a finding. + /// + /// When updating a finding, an empty mask is treated as updating all mutable + /// fields and replacing source_properties. Individual source_properties can + /// be added/updated by using "source_properties." in the field + /// mask. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> OrganizationSourceFindingPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceFindingPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceFindingPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceFindingPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Filters an organization's assets and groups them by their specified +/// properties. +/// +/// A builder for the *assets.group* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::GroupAssetsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = GroupAssetsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().assets_group(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationAssetGroupCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: GroupAssetsRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationAssetGroupCall<'a, C, A> {} + +impl<'a, C, A> OrganizationAssetGroupCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GroupAssetsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.assets.group", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/assets:group"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: GroupAssetsRequest) -> OrganizationAssetGroupCall<'a, C, A> { + self._request = new_value; + self + } + /// Name of the organization to groupBy. Its format is + /// "organizations/[organization_id]". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationAssetGroupCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationAssetGroupCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationAssetGroupCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationAssetGroupCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates security marks. +/// +/// A builder for the *sources.findings.updateSecurityMarks* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::SecurityMarks; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SecurityMarks::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_findings_update_security_marks(req, "name") +/// .update_mask("aliquyam") +/// .start_time("sea") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: SecurityMarks, + _name: String, + _update_mask: Option, + _start_time: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SecurityMarks)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.findings.updateSecurityMarks", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + if let Some(value) = self._start_time { + params.push(("startTime", value.to_string())); + } + for &field in ["alt", "name", "updateMask", "startTime"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SecurityMarks) -> OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> { + self._request = new_value; + self + } + /// The relative resource name of the SecurityMarks. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Examples: + /// "organizations/123/assets/456/securityMarks" + /// "organizations/123/sources/456/findings/789/securityMarks". + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The FieldMask to use when updating the security marks resource. + /// + /// The field mask must not contain duplicate fields. + /// If empty or set to "marks", all marks will be replaced. Individual + /// marks can be updated using "marks.". + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The time at which the updated SecurityMarks take effect. + /// If not set uses current server time. Updates will be applied to the + /// SecurityMarks that are active immediately preceding this time. + /// + /// Sets the *start time* query property to the given value. + pub fn start_time(mut self, new_value: &str) -> OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> { + self._start_time = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceFindingUpdateSecurityMarkCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates a source. +/// +/// A builder for the *sources.patch* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::Source; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Source::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_patch(req, "name") +/// .update_mask("eos") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourcePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: Source, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourcePatchCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourcePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Source)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Source) -> OrganizationSourcePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The relative resource name of this source. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Example: + /// "organizations/123/sources/456" + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationSourcePatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The FieldMask to use when updating the source resource. + /// + /// If empty all mutable fields will be updated. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> OrganizationSourcePatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourcePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourcePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourcePatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists an organization's assets. +/// +/// A builder for the *assets.list* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().assets_list("parent") +/// .read_time("sadipscing") +/// .page_token("dolor") +/// .page_size(-39) +/// .order_by("elitr") +/// .filter("amet") +/// .field_mask("no") +/// .compare_duration("labore") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationAssetListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _parent: String, + _read_time: Option, + _page_token: Option, + _page_size: Option, + _order_by: Option, + _filter: Option, + _field_mask: Option, + _compare_duration: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationAssetListCall<'a, C, A> {} + +impl<'a, C, A> OrganizationAssetListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListAssetsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.assets.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._read_time { + params.push(("readTime", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + if let Some(value) = self._field_mask { + params.push(("fieldMask", value.to_string())); + } + if let Some(value) = self._compare_duration { + params.push(("compareDuration", value.to_string())); + } + for &field in ["alt", "parent", "readTime", "pageToken", "pageSize", "orderBy", "filter", "fieldMask", "compareDuration"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/assets"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the organization assets should belong to. Its format is + /// "organizations/[organization_id]". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationAssetListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Time used as a reference point when filtering assets. The filter is limited + /// to assets existing at the supplied time and their values are those at that + /// specific time. Absence of this field will default to the API's version of + /// NOW. + /// + /// Sets the *read time* query property to the given value. + pub fn read_time(mut self, new_value: &str) -> OrganizationAssetListCall<'a, C, A> { + self._read_time = Some(new_value.to_string()); + self + } + /// The value returned by the last `ListAssetsResponse`; indicates + /// that this is a continuation of a prior `ListAssets` call, and + /// that the system should return the next page of data. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrganizationAssetListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of results to return in a single response. Default is + /// 10, minimum is 1, maximum is 1000. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OrganizationAssetListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Expression that defines what fields and order to use for sorting. The + /// string value should follow SQL syntax: comma separated list of fields. For + /// example: "name,resource_properties.a_property". The default sorting order + /// is ascending. To specify descending order for a field, a suffix " desc" + /// should be appended to the field name. For example: "name + /// desc,resource_properties.a_property". Redundant space characters in the + /// syntax are insignificant. "name desc,resource_properties.a_property" and " + /// name desc , resource_properties.a_property " are equivalent. + /// + /// The following fields are supported: + /// name + /// update_time + /// resource_properties + /// security_marks + /// security_center_properties.resource_name + /// security_center_properties.resource_parent + /// security_center_properties.resource_project + /// security_center_properties.resource_type + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> OrganizationAssetListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// Expression that defines the filter to apply across assets. + /// The expression is a list of zero or more restrictions combined via logical + /// operators `AND` and `OR`. + /// Parentheses are supported, and `OR` has higher precedence than `AND`. + /// + /// Restrictions have the form ` ` and may have a `-` + /// character in front of them to indicate negation. The fields map to those + /// defined in the Asset resource. Examples include: + /// + /// * name + /// * security_center_properties.resource_name + /// * resource_properties.a_property + /// * security_marks.marks.marka + /// + /// The supported operators are: + /// + /// * `=` for all value types. + /// * `>`, `<`, `>=`, `<=` for integer values. + /// * `:`, meaning substring matching, for strings. + /// + /// The supported value types are: + /// + /// * string literals in quotes. + /// * integer literals without quotes. + /// * boolean literals `true` and `false` without quotes. + /// + /// The following are the allowed field and operator combinations: + /// name | `=` + /// update_time | `>`, `<`, `>=`, `<=` + /// iam_policy.policy_blob | '=', ':' + /// resource_properties | '=', ':', `>`, `<`, `>=`, `<=` + /// security_marks | '=', ':' + /// security_center_properties.resource_name | '=', ':' + /// security_center_properties.resource_type | '=', ':' + /// security_center_properties.resource_parent | '=', ':' + /// security_center_properties.resource_project | '=', ':' + /// security_center_properties.resource_owners | '=', ':' + /// + /// For example, `resource_properties.size = 100` is a valid filter string. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> OrganizationAssetListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// Optional. + /// + /// A field mask to specify the ListAssetsResult fields to be listed in the + /// response. + /// An empty field mask will list all fields. + /// + /// Sets the *field mask* query property to the given value. + pub fn field_mask(mut self, new_value: &str) -> OrganizationAssetListCall<'a, C, A> { + self._field_mask = Some(new_value.to_string()); + self + } + /// When compare_duration is set, the ListAssetsResult's "state_change" + /// attribute is updated to indicate whether the asset was added, removed, or + /// remained present during the compare_duration period of time that precedes + /// the read_time. This is the time between (read_time - compare_duration) and + /// read_time. + /// + /// The state_change value is derived based on the presence of the asset at the + /// two points in time. Intermediate state changes between the two times don't + /// affect the result. For example, the results aren't affected if the asset is + /// removed and re-created again. + /// + /// Possible "state_change" values when compare_duration is specified: + /// + /// * "ADDED": indicates that the asset was not present at the start of + /// compare_duration, but present at read_time. + /// * "REMOVED": indicates that the asset was present at the start of + /// compare_duration, but not present at read_time. + /// * "ACTIVE": indicates that the asset was present at both the + /// start and the end of the time period defined by + /// compare_duration and read_time. + /// + /// If compare_duration is not specified, then the only possible state_change + /// is "UNUSED", which will be the state_change set for all assets present at + /// read_time. + /// + /// Sets the *compare duration* query property to the given value. + pub fn compare_duration(mut self, new_value: &str) -> OrganizationAssetListCall<'a, C, A> { + self._compare_duration = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationAssetListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationAssetListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationAssetListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *operations.get* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().operations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationOperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationOperationGetCall<'a, C, A> {} + +impl<'a, C, A> OrganizationOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationOperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationOperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationOperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationOperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists operations that match the specified filter in the request. If the +/// server doesn't support this method, it returns `UNIMPLEMENTED`. +/// +/// NOTE: the `name` binding allows API services to override the binding +/// to use different resource name schemes, such as `users/*/operations`. To +/// override the binding, API services can add a binding such as +/// `"/v1/{name=users/*}/operations"` to their service configuration. +/// For backwards compatibility, the default name includes the operations +/// collection id, however overriding users must ensure the name binding +/// is the parent resource, without the operations collection id. +/// +/// A builder for the *operations.list* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().operations_list("name") +/// .page_token("invidunt") +/// .page_size(-82) +/// .filter("accusam") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationOperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationOperationListCall<'a, C, A> {} + +impl<'a, C, A> OrganizationOperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation's parent resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationOperationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrganizationOperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> OrganizationOperationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> OrganizationOperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationOperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationOperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationOperationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates security marks. +/// +/// A builder for the *assets.updateSecurityMarks* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::SecurityMarks; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SecurityMarks::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().assets_update_security_marks(req, "name") +/// .update_mask("sea") +/// .start_time("et") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationAssetUpdateSecurityMarkCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: SecurityMarks, + _name: String, + _update_mask: Option, + _start_time: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationAssetUpdateSecurityMarkCall<'a, C, A> {} + +impl<'a, C, A> OrganizationAssetUpdateSecurityMarkCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SecurityMarks)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.assets.updateSecurityMarks", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + if let Some(value) = self._start_time { + params.push(("startTime", value.to_string())); + } + for &field in ["alt", "name", "updateMask", "startTime"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SecurityMarks) -> OrganizationAssetUpdateSecurityMarkCall<'a, C, A> { + self._request = new_value; + self + } + /// The relative resource name of the SecurityMarks. See: + /// https://cloud.google.com/apis/design/resource_names#relative_resource_name + /// Examples: + /// "organizations/123/assets/456/securityMarks" + /// "organizations/123/sources/456/findings/789/securityMarks". + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationAssetUpdateSecurityMarkCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The FieldMask to use when updating the security marks resource. + /// + /// The field mask must not contain duplicate fields. + /// If empty or set to "marks", all marks will be replaced. Individual + /// marks can be updated using "marks.". + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> OrganizationAssetUpdateSecurityMarkCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The time at which the updated SecurityMarks take effect. + /// If not set uses current server time. Updates will be applied to the + /// SecurityMarks that are active immediately preceding this time. + /// + /// Sets the *start time* query property to the given value. + pub fn start_time(mut self, new_value: &str) -> OrganizationAssetUpdateSecurityMarkCall<'a, C, A> { + self._start_time = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationAssetUpdateSecurityMarkCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationAssetUpdateSecurityMarkCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationAssetUpdateSecurityMarkCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Sets the access control policy on the specified Source. +/// +/// A builder for the *sources.setIamPolicy* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SetIamPolicyRequest) -> OrganizationSourceSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. + /// See the operation documentation for the appropriate value for this field. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> OrganizationSourceSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceSetIamPolicyCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a source. +/// +/// A builder for the *sources.create* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::Source; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Source::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_create(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: Source, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceCreateCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Source)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/sources"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Source) -> OrganizationSourceCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Resource name of the new source's parent. Its format should be + /// "organizations/[organization_id]". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationSourceCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a finding. The corresponding source must exist for finding creation +/// to succeed. +/// +/// A builder for the *sources.findings.create* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// use securitycenter1::Finding; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Finding::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_findings_create(req, "parent") +/// .finding_id("sanctus") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceFindingCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _request: Finding, + _parent: String, + _finding_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceFindingCreateCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceFindingCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Finding)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.findings.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._finding_id { + params.push(("findingId", value.to_string())); + } + for &field in ["alt", "parent", "findingId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/findings"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Finding) -> OrganizationSourceFindingCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Resource name of the new finding's parent. Its format should be + /// "organizations/[organization_id]/sources/[source_id]". + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> OrganizationSourceFindingCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Unique identifier provided by the client within the parent scope. + /// It must be alphanumeric and less than or equal to 32 characters and + /// greater than 0 characters in length. + /// + /// Sets the *finding id* query property to the given value. + pub fn finding_id(mut self, new_value: &str) -> OrganizationSourceFindingCreateCall<'a, C, A> { + self._finding_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceFindingCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceFindingCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceFindingCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a long-running operation. This method indicates that the client is +/// no longer interested in the operation result. It does not cancel the +/// operation. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. +/// +/// A builder for the *operations.delete* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().operations_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationOperationDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationOperationDeleteCall<'a, C, A> {} + +impl<'a, C, A> OrganizationOperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.operations.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource to be deleted. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationOperationDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationOperationDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationOperationDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationOperationDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a source. +/// +/// A builder for the *sources.get* method supported by a *organization* resource. +/// It is not used directly, but through a `OrganizationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_securitycenter1 as securitycenter1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use securitycenter1::SecurityCommandCenter; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = SecurityCommandCenter::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.organizations().sources_get("name") +/// .doit(); +/// # } +/// ``` +pub struct OrganizationSourceGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a SecurityCommandCenter, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrganizationSourceGetCall<'a, C, A> {} + +impl<'a, C, A> OrganizationSourceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Source)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "securitycenter.organizations.sources.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Relative resource name of the source. Its format is + /// "organizations/[organization_id]/source/[source_id]". + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OrganizationSourceGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OrganizationSourceGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OrganizationSourceGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OrganizationSourceGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/servicebroker1-cli/Cargo.toml b/gen/servicebroker1-cli/Cargo.toml index 287f1f17c6..09014c832d 100644 --- a/gen/servicebroker1-cli/Cargo.toml +++ b/gen/servicebroker1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-servicebroker1-cli" -version = "1.0.8+20180924" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Service Broker (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/servicebroker1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-servicebroker1] path = "../servicebroker1" -version = "1.0.8+20180924" +version = "1.0.8+20190330" diff --git a/gen/servicebroker1-cli/README.md b/gen/servicebroker1-cli/README.md index f12d23a7ef..ee37cec7de 100644 --- a/gen/servicebroker1-cli/README.md +++ b/gen/servicebroker1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Service Broker* API at revision *20180924*. The CLI is at version *1.0.8*. +This documentation was generated from the *Service Broker* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash servicebroker1 [options] diff --git a/gen/servicebroker1-cli/mkdocs.yml b/gen/servicebroker1-cli/mkdocs.yml index 942bb00a2f..503da5ac28 100644 --- a/gen/servicebroker1-cli/mkdocs.yml +++ b/gen/servicebroker1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Service Broker v1.0.8+20180924 +site_name: Service Broker v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-servicebroker1-cli site_description: A complete library to interact with Service Broker (protocol v1) diff --git a/gen/servicebroker1-cli/src/main.rs b/gen/servicebroker1-cli/src/main.rs index fe9ba9f460..874b495883 100644 --- a/gen/servicebroker1-cli/src/main.rs +++ b/gen/servicebroker1-cli/src/main.rs @@ -473,7 +473,7 @@ fn main() { let mut app = App::new("servicebroker1") .author("Sebastian Thiel ") - .version("1.0.8+20180924") + .version("1.0.8+20190330") .about("The Google Cloud Platform Service Broker API provides Google hosted implementation of the Open Service Broker API (https://www.openservicebrokerapi.org/). diff --git a/gen/servicebroker1/Cargo.toml b/gen/servicebroker1/Cargo.toml index a9eb26a92e..7833cabff1 100644 --- a/gen/servicebroker1/Cargo.toml +++ b/gen/servicebroker1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-servicebroker1" -version = "1.0.8+20180924" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Service Broker (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/servicebroker1" homepage = "https://cloud.google.com/kubernetes-engine/docs/concepts/add-on/service-broker" -documentation = "https://docs.rs/google-servicebroker1/1.0.8+20180924" +documentation = "https://docs.rs/google-servicebroker1/1.0.8+20190330" license = "MIT" keywords = ["servicebroker", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/servicebroker1/README.md b/gen/servicebroker1/README.md index 8ed935d04f..463c31d8e8 100644 --- a/gen/servicebroker1/README.md +++ b/gen/servicebroker1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-servicebroker1` library allows access to all features of the *Google Service Broker* service. -This documentation was generated from *Service Broker* crate version *1.0.8+20180924*, where *20180924* is the exact revision of the *servicebroker:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Service Broker* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *servicebroker:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Service Broker* *v1* API can be found at the [official documentation site](https://cloud.google.com/kubernetes-engine/docs/concepts/add-on/service-broker). # Features -Use the following functionality with ease from the central [hub](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/struct.ServiceBroker.html) ... +Use the following functionality with ease from the central [hub](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/struct.ServiceBroker.html) ... -* [get iam policy](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/struct.MethodGetIamPolicyCall.html) -* [set iam policy](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/struct.MethodSetIamPolicyCall.html) -* [test iam permissions](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/struct.MethodTestIamPermissionCall.html) +* [get iam policy](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/struct.MethodGetIamPolicyCall.html) +* [set iam policy](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/struct.MethodSetIamPolicyCall.html) +* [test iam permissions](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/struct.MethodTestIamPermissionCall.html) @@ -24,17 +24,17 @@ Use the following functionality with ease from the central [hub](https://docs.rs The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/struct.ServiceBroker.html)** +* **[Hub](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/struct.ServiceBroker.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.Part.html)** + * **[Parts](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-servicebroker1/1.0.8+20180924/google_servicebroker1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-servicebroker1/1.0.8+20190330/google_servicebroker1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/servicebroker1/src/lib.rs b/gen/servicebroker1/src/lib.rs index 10347989cc..e4e06a952c 100644 --- a/gen/servicebroker1/src/lib.rs +++ b/gen/servicebroker1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Service Broker* crate version *1.0.8+20180924*, where *20180924* is the exact revision of the *servicebroker:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Service Broker* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *servicebroker:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Service Broker* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/kubernetes-engine/docs/concepts/add-on/service-broker). @@ -421,7 +421,7 @@ pub struct GoogleIamV1__Binding { /// Role that is assigned to `members`. /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. pub role: Option, - /// Unimplemented. The condition that is associated with this binding. + /// The condition that is associated with this binding. /// NOTE: an unsatisfied condition will not allow user access via current /// binding. Different bindings, including their conditions, are examined /// independently. @@ -446,7 +446,7 @@ pub struct GoogleIamV1__Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// @@ -466,22 +466,22 @@ impl Part for GoogleIamV1__Binding {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleType__Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// /// The application context of the containing message determines which /// well-known feature set of CEL is supported. pub expression: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for GoogleType__Expr {} @@ -804,7 +804,7 @@ impl<'a, C, A> MethodTestIamPermissionCall<'a, C, A> where C: BorrowMut MethodTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -855,7 +852,7 @@ impl<'a, C, A> MethodTestIamPermissionCall<'a, C, A> where C: BorrowMut MethodTestIamPermissionCall<'a, C, A> where C: BorrowMut MethodSetIamPolicyCall<'a, C, A> where C: BorrowMut MethodSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1139,7 +1133,7 @@ impl<'a, C, A> MethodSetIamPolicyCall<'a, C, A> where C: BorrowMut MethodSetIamPolicyCall<'a, C, A> where C: BorrowMut MethodGetIamPolicyCall<'a, C, A> where C: BorrowMut MethodGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1405,7 +1396,7 @@ impl<'a, C, A> MethodGetIamPolicyCall<'a, C, A> where C: BorrowMut MethodGetIamPolicyCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Service Control (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/servicecontrol1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-servicecontrol1] path = "../servicecontrol1" -version = "1.0.8+20181008" +version = "1.0.8+20190323" diff --git a/gen/servicecontrol1-cli/README.md b/gen/servicecontrol1-cli/README.md index 95450cde25..bc28a4d4d2 100644 --- a/gen/servicecontrol1-cli/README.md +++ b/gen/servicecontrol1-cli/README.md @@ -25,17 +25,14 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Service Control* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *Service Control* API at revision *20190323*. The CLI is at version *1.0.8*. ```bash servicecontrol1 [options] services allocate-quota (-r )... [-p ]... [-o ] check (-r )... [-p ]... [-o ] - end-reconciliation (-r )... [-p ]... [-o ] - release-quota (-r )... [-p ]... [-o ] report (-r )... [-p ]... [-o ] - start-reconciliation (-r )... [-p ]... [-o ] servicecontrol1 --help Configuration: diff --git a/gen/servicecontrol1-cli/mkdocs.yml b/gen/servicecontrol1-cli/mkdocs.yml index 898970e84b..4787865463 100644 --- a/gen/servicecontrol1-cli/mkdocs.yml +++ b/gen/servicecontrol1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Service Control v1.0.8+20181008 +site_name: Service Control v1.0.8+20190323 site_url: http://byron.github.io/google-apis-rs/google-servicecontrol1-cli site_description: A complete library to interact with Service Control (protocol v1) @@ -11,10 +11,7 @@ pages: - ['index.md', 'Home'] - ['services_allocate-quota.md', 'Services', 'Allocate Quota'] - ['services_check.md', 'Services', 'Check'] -- ['services_end-reconciliation.md', 'Services', 'End Reconciliation'] -- ['services_release-quota.md', 'Services', 'Release Quota'] - ['services_report.md', 'Services', 'Report'] -- ['services_start-reconciliation.md', 'Services', 'Start Reconciliation'] theme: readthedocs diff --git a/gen/servicecontrol1-cli/src/main.rs b/gen/servicecontrol1-cli/src/main.rs index 546137d8af..3a8f3265b7 100644 --- a/gen/servicecontrol1-cli/src/main.rs +++ b/gen/servicecontrol1-cli/src/main.rs @@ -233,186 +233,6 @@ impl<'n> Engine<'n> { } } - fn _services_end_reconciliation(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "service-config-id" => Some(("serviceConfigId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reconciliation-operation.quota-mode" => Some(("reconciliationOperation.quotaMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reconciliation-operation.consumer-id" => Some(("reconciliationOperation.consumerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reconciliation-operation.labels" => Some(("reconciliationOperation.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "reconciliation-operation.method-name" => Some(("reconciliationOperation.methodName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reconciliation-operation.operation-id" => Some(("reconciliationOperation.operationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["consumer-id", "labels", "method-name", "operation-id", "quota-mode", "reconciliation-operation", "service-config-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::EndReconciliationRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.services().end_reconciliation(request, opt.value_of("service-name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _services_release_quota(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "release-operation.quota-mode" => Some(("releaseOperation.quotaMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "release-operation.consumer-id" => Some(("releaseOperation.consumerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "release-operation.labels" => Some(("releaseOperation.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "release-operation.method-name" => Some(("releaseOperation.methodName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "release-operation.operation-id" => Some(("releaseOperation.operationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "service-config-id" => Some(("serviceConfigId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["consumer-id", "labels", "method-name", "operation-id", "quota-mode", "release-operation", "service-config-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ReleaseQuotaRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.services().release_quota(request, opt.value_of("service-name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _services_report(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -498,96 +318,6 @@ impl<'n> Engine<'n> { } } - fn _services_start_reconciliation(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "service-config-id" => Some(("serviceConfigId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reconciliation-operation.quota-mode" => Some(("reconciliationOperation.quotaMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reconciliation-operation.consumer-id" => Some(("reconciliationOperation.consumerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reconciliation-operation.labels" => Some(("reconciliationOperation.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), - "reconciliation-operation.method-name" => Some(("reconciliationOperation.methodName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reconciliation-operation.operation-id" => Some(("reconciliationOperation.operationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["consumer-id", "labels", "method-name", "operation-id", "quota-mode", "reconciliation-operation", "service-config-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::StartReconciliationRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.services().start_reconciliation(request, opt.value_of("service-name").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); @@ -601,18 +331,9 @@ impl<'n> Engine<'n> { ("check", Some(opt)) => { call_result = self._services_check(opt, dry_run, &mut err); }, - ("end-reconciliation", Some(opt)) => { - call_result = self._services_end_reconciliation(opt, dry_run, &mut err); - }, - ("release-quota", Some(opt)) => { - call_result = self._services_release_quota(opt, dry_run, &mut err); - }, ("report", Some(opt)) => { call_result = self._services_report(opt, dry_run, &mut err); }, - ("start-reconciliation", Some(opt)) => { - call_result = self._services_start_reconciliation(opt, dry_run, &mut err); - }, _ => { err.issues.push(CLIError::MissingMethodError("services".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -704,7 +425,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("services", "methods: 'allocate-quota', 'check', 'end-reconciliation', 'release-quota', 'report' and 'start-reconciliation'", vec![ + ("services", "methods: 'allocate-quota', 'check' and 'report'", vec![ ("allocate-quota", Some(r##"Attempts to allocate quota for the specified consumer. It should be called before the operation is executed. @@ -788,83 +509,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("end-reconciliation", - Some(r##"Signals the quota controller that service ends the ongoing usage - reconciliation. - - This method requires the `servicemanagement.services.quota` - permission on the specified service. For more information, see - [Google Cloud IAM](https://cloud.google.com/iam)."##), - "Details at http://byron.github.io/google-apis-rs/google_servicecontrol1_cli/services_end-reconciliation", - vec![ - (Some(r##"service-name"##), - None, - Some(r##"Name of the service as specified in the service configuration. For example, - `"pubsub.googleapis.com"`. - - See google.api.Service for the definition of a service name."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("release-quota", - Some(r##"Releases previously allocated quota done through AllocateQuota method. - - This method requires the `servicemanagement.services.quota` - permission on the specified service. For more information, see - [Cloud IAM](https://cloud.google.com/iam). - - - **NOTE:** The client **must** fail-open on server errors `INTERNAL`, - `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system - reliability, the server may inject these errors to prohibit any hard - dependency on the quota functionality."##), - "Details at http://byron.github.io/google-apis-rs/google_servicecontrol1_cli/services_release-quota", - vec![ - (Some(r##"service-name"##), - None, - Some(r##"Name of the service as specified in the service configuration. For example, - `"pubsub.googleapis.com"`. - - See google.api.Service for the definition of a service name."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -911,61 +555,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("start-reconciliation", - Some(r##"Unlike rate quota, allocation quota does not get refilled periodically. - So, it is possible that the quota usage as seen by the service differs from - what the One Platform considers the usage is. This is expected to happen - only rarely, but over time this can accumulate. Services can invoke - StartReconciliation and EndReconciliation to correct this usage drift, as - described below: - 1. Service sends StartReconciliation with a timestamp in future for each - metric that needs to be reconciled. The timestamp being in future allows - to account for in-flight AllocateQuota and ReleaseQuota requests for the - same metric. - 2. One Platform records this timestamp and starts tracking subsequent - AllocateQuota and ReleaseQuota requests until EndReconciliation is - called. - 3. At or after the time specified in the StartReconciliation, service - sends EndReconciliation with the usage that needs to be reconciled to. - 4. One Platform adjusts its own record of usage for that metric to the - value specified in EndReconciliation by taking in to account any - allocation or release between StartReconciliation and EndReconciliation. - - Signals the quota controller that the service wants to perform a usage - reconciliation as specified in the request. - - This method requires the `servicemanagement.services.quota` - permission on the specified service. For more information, see - [Google Cloud IAM](https://cloud.google.com/iam)."##), - "Details at http://byron.github.io/google-apis-rs/google_servicecontrol1_cli/services_start-reconciliation", - vec![ - (Some(r##"service-name"##), - None, - Some(r##"Name of the service as specified in the service configuration. For example, - `"pubsub.googleapis.com"`. - - See google.api.Service for the definition of a service name."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -978,8 +567,8 @@ fn main() { let mut app = App::new("servicecontrol1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") - .about("Google Service Control provides control plane functionality to managed services, such as logging, monitoring, and status checks.") + .version("1.0.8+20190323") + .about("Provides control plane functionality to managed services, such as logging, monitoring, and status checks.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_servicecontrol1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/servicecontrol1/Cargo.toml b/gen/servicecontrol1/Cargo.toml index df76ed2b9a..59c122ba1d 100644 --- a/gen/servicecontrol1/Cargo.toml +++ b/gen/servicecontrol1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-servicecontrol1" -version = "1.0.8+20181008" +version = "1.0.8+20190323" authors = ["Sebastian Thiel "] description = "A complete library to interact with Service Control (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/servicecontrol1" homepage = "https://cloud.google.com/service-control/" -documentation = "https://docs.rs/google-servicecontrol1/1.0.8+20181008" +documentation = "https://docs.rs/google-servicecontrol1/1.0.8+20190323" license = "MIT" keywords = ["servicecontrol", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/servicecontrol1/README.md b/gen/servicecontrol1/README.md index bee59725da..409a8268a0 100644 --- a/gen/servicecontrol1/README.md +++ b/gen/servicecontrol1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-servicecontrol1` library allows access to all features of the *Google Service Control* service. -This documentation was generated from *Service Control* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *servicecontrol:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Service Control* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *servicecontrol:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Service Control* *v1* API can be found at the [official documentation site](https://cloud.google.com/service-control/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/struct.ServiceControl.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/struct.ServiceControl.html) ... * services - * [*allocate quota*](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/struct.ServiceAllocateQuotaCall.html), [*check*](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/struct.ServiceCheckCall.html), [*end reconciliation*](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/struct.ServiceEndReconciliationCall.html), [*release quota*](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/struct.ServiceReleaseQuotaCall.html), [*report*](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/struct.ServiceReportCall.html) and [*start reconciliation*](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/struct.ServiceStartReconciliationCall.html) + * [*allocate quota*](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/struct.ServiceAllocateQuotaCall.html), [*check*](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/struct.ServiceCheckCall.html) and [*report*](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/struct.ServiceReportCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/struct.ServiceControl.html)** +* **[Hub](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/struct.ServiceControl.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.Part.html)** + * **[Parts](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -130,17 +130,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -150,29 +150,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-servicecontrol1/1.0.8+20181008/google_servicecontrol1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-servicecontrol1/1.0.8+20190323/google_servicecontrol1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/servicecontrol1/src/lib.rs b/gen/servicecontrol1/src/lib.rs index ad5218ed0c..b6bab57923 100644 --- a/gen/servicecontrol1/src/lib.rs +++ b/gen/servicecontrol1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Service Control* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *servicecontrol:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Service Control* crate version *1.0.8+20190323*, where *20190323* is the exact revision of the *servicecontrol:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Service Control* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/service-control/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.ServiceControl.html) ... //! //! * services -//! * [*allocate quota*](struct.ServiceAllocateQuotaCall.html), [*check*](struct.ServiceCheckCall.html), [*end reconciliation*](struct.ServiceEndReconciliationCall.html), [*release quota*](struct.ServiceReleaseQuotaCall.html), [*report*](struct.ServiceReportCall.html) and [*start reconciliation*](struct.ServiceStartReconciliationCall.html) +//! * [*allocate quota*](struct.ServiceAllocateQuotaCall.html), [*check*](struct.ServiceCheckCall.html) and [*report*](struct.ServiceReportCall.html) //! //! //! @@ -381,6 +381,10 @@ impl<'a, C, A> ServiceControl /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CheckError { + /// Contains public information about the check error. If available, + /// `status.code` will be non zero and client can propagate it out as public + /// error. + pub status: Option, /// The error code. pub code: Option, /// Free-form text providing details on the error cause of the error. @@ -539,17 +543,6 @@ impl RequestValue for ReportRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct QuotaInfo { - /// Map of quota group name to the actual number of tokens consumed. If the - /// quota check was not successful, then this will not be populated due to no - /// quota consumption. - /// - /// We are not merging this field with 'quota_metrics' field because of the - /// complexity of scaling in Chemist client code base. For simplicity, we will - /// keep this field for Castor (that scales quota usage) and 'quota_metrics' - /// for SuperQuota (that doesn't scale quota usage). - /// - #[serde(rename="quotaConsumed")] - pub quota_consumed: Option>, /// Quota metrics to indicate the usage. Depending on the check request, one or /// more of the following metrics will be included: /// @@ -573,35 +566,22 @@ pub struct QuotaInfo { /// Deprecated: Use quota_metrics to get per quota group limit exceeded status. #[serde(rename="limitExceeded")] pub limit_exceeded: Option>, + /// Map of quota group name to the actual number of tokens consumed. If the + /// quota check was not successful, then this will not be populated due to no + /// quota consumption. + /// + /// We are not merging this field with 'quota_metrics' field because of the + /// complexity of scaling in Chemist client code base. For simplicity, we will + /// keep this field for Castor (that scales quota usage) and 'quota_metrics' + /// for SuperQuota (that doesn't scale quota usage). + /// + #[serde(rename="quotaConsumed")] + pub quota_consumed: Option>, } impl Part for QuotaInfo {} -/// Request message for the ReleaseQuota method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [release quota services](struct.ServiceReleaseQuotaCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReleaseQuotaRequest { - /// Operation that describes the quota release. - #[serde(rename="releaseOperation")] - pub release_operation: Option, - /// Specifies which version of service configuration should be used to process - /// the request. If unspecified or no matching version can be found, the latest - /// one will be used. - #[serde(rename="serviceConfigId")] - pub service_config_id: Option, -} - -impl RequestValue for ReleaseQuotaRequest {} - - /// Distribution represents a frequency distribution of double-valued sample /// points. It contains the size of the population of sample points plus /// additional optional information: @@ -697,6 +677,7 @@ impl Part for ExplicitBuckets {} pub struct CheckRequest { /// Indicates if service activation check should be skipped for this request. /// Default behavior is to perform the check and apply relevant quota. + /// WARNING: Setting this flag to "true" will disable quota enforcement. #[serde(rename="skipActivationCheck")] pub skip_activation_check: Option, /// The operation to be checked. @@ -716,17 +697,311 @@ pub struct CheckRequest { impl RequestValue for CheckRequest {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// A common proto for logging HTTP requests. Only contains semantics +/// defined by the HTTP specification. Product-specific logging +/// information MUST be defined in a separate message. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HttpRequest { + /// The response code indicating the status of the response. + /// Examples: 200, 404. + pub status: Option, + /// Whether or not the response was validated with the origin server before + /// being served from cache. This field is only meaningful if `cache_hit` is + /// True. + #[serde(rename="cacheValidatedWithOriginServer")] + pub cache_validated_with_origin_server: Option, + /// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" + pub protocol: Option, + /// The request processing latency on the server, from the time the request was + /// received until the response was sent. + pub latency: Option, + /// The number of HTTP response bytes inserted into cache. Set only when a + /// cache fill was attempted. + #[serde(rename="cacheFillBytes")] + pub cache_fill_bytes: Option, + /// The scheme (http, https), the host name, the path, and the query + /// portion of the URL that was requested. + /// Example: `"http://example.com/some/info?color=red"`. + #[serde(rename="requestUrl")] + pub request_url: Option, + /// Whether or not an entity was served from cache + /// (with or without validation). + #[serde(rename="cacheHit")] + pub cache_hit: Option, + /// The IP address (IPv4 or IPv6) of the origin server that the request was + /// sent to. + #[serde(rename="serverIp")] + pub server_ip: Option, + /// Whether or not a cache lookup was attempted. + #[serde(rename="cacheLookup")] + pub cache_lookup: Option, + /// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. + #[serde(rename="requestMethod")] + pub request_method: Option, + /// The referer URL of the request, as defined in + /// [HTTP/1.1 Header Field + /// Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + pub referer: Option, + /// The IP address (IPv4 or IPv6) of the client that issued the HTTP + /// request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. + #[serde(rename="remoteIp")] + pub remote_ip: Option, + /// The user agent sent by the client. Example: + /// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET + /// CLR 1.0.3705)"`. + #[serde(rename="userAgent")] + pub user_agent: Option, + /// The size of the HTTP request message in bytes, including the request + /// headers and the request body. + #[serde(rename="requestSize")] + pub request_size: Option, + /// The size of the HTTP response message sent back to the client, in bytes, + /// including the response headers and the response body. + #[serde(rename="responseSize")] + pub response_size: Option, +} + +impl Part for HttpRequest {} + + +/// Response message for the Report method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [report services](struct.ServiceReportCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportResponse { + /// Partial failures, one for each `Operation` in the request that failed + /// processing. There are three possible combinations of the RPC status: + /// + /// 1. The combination of a successful RPC status and an empty `report_errors` + /// list indicates a complete success where all `Operations` in the + /// request are processed successfully. + /// 2. The combination of a successful RPC status and a non-empty + /// `report_errors` list indicates a partial success where some + /// `Operations` in the request succeeded. Each + /// `Operation` that failed processing has a corresponding item + /// in this list. + /// 3. A failed RPC status indicates a general non-deterministic failure. + /// When this happens, it's impossible to know which of the + /// 'Operations' in the request succeeded or failed. + #[serde(rename="reportErrors")] + pub report_errors: Option>, + /// Quota usage for each quota release `Operation` request. + /// + /// Fully or partially failed quota release request may or may not be present + /// in `report_quota_info`. For example, a failed quota release request will + /// have the current quota usage info when precise quota library returns the + /// info. A deadline exceeded quota request will not have quota usage info. + /// + /// If there is no quota release request, report_quota_info will be empty. + /// + #[serde(rename="reportInfos")] + pub report_infos: Option>, + /// The actual config id used to process the request. + #[serde(rename="serviceConfigId")] + pub service_config_id: Option, +} + +impl ResponseResult for ReportResponse {} + + +/// Represents a set of metric values in the same metric. +/// Each metric value in the set should have a unique combination of start time, +/// end time, and label values. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MetricValueSet { + /// The values in this metric. + #[serde(rename="metricValues")] + pub metric_values: Option>, + /// The metric name defined in the service configuration. + #[serde(rename="metricName")] + pub metric_name: Option, +} + +impl Part for MetricValueSet {} + + +/// Represents error information for QuotaOperation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QuotaError { + /// Error code. + pub code: Option, + /// Free-form text that provides details on the cause of the error. + pub description: Option, + /// Subject to whom this error applies. See the specific enum for more details + /// on this field. For example, "clientip:" or + /// "project:". + pub subject: Option, +} + +impl Part for QuotaError {} + + +/// Describes a resource associated with this operation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceInfo { + /// The identifier of the parent of this resource instance. + /// Must be in one of the following formats: + /// - “projects/” + /// - “folders/” + /// - “organizations/” + #[serde(rename="resourceContainer")] + pub resource_container: Option, + /// The location of the resource. If not empty, the resource will be checked + /// against location policy. The value must be a valid zone, region or + /// multiregion. For example: "europe-west4" or "northamerica-northeast1-a" + #[serde(rename="resourceLocation")] + pub resource_location: Option, + /// Name of the resource. This is used for auditing purposes. + #[serde(rename="resourceName")] + pub resource_name: Option, +} + +impl Part for ResourceInfo {} + + +/// An individual log entry. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogEntry { + /// Optional. Information about the HTTP request associated with this + /// log entry, if applicable. + #[serde(rename="httpRequest")] + pub http_request: Option, + /// Required. The log to which this log entry belongs. Examples: `"syslog"`, + /// `"book_log"`. + pub name: Option, + /// The log entry payload, represented as a Unicode string (UTF-8). + #[serde(rename="textPayload")] + pub text_payload: Option, + /// The time the event described by the log entry occurred. If + /// omitted, defaults to operation start time. + pub timestamp: Option, + /// A set of user-defined (key, value) data that provides additional + /// information about the log entry. + pub labels: Option>, + /// The log entry payload, represented as a structure that + /// is expressed as a JSON object. + #[serde(rename="structPayload")] + pub struct_payload: Option>, + /// A unique ID for the log entry used for deduplication. If omitted, + /// the implementation will generate one based on operation_id. + #[serde(rename="insertId")] + pub insert_id: Option, + /// The log entry payload, represented as a protocol buffer that is + /// expressed as a JSON object. The only accepted type currently is + /// AuditLog. + #[serde(rename="protoPayload")] + pub proto_payload: Option>, + /// Optional. Resource name of the trace associated with the log entry, if any. + /// If this field contains a relative resource name, you can assume the name is + /// relative to `//tracing.googleapis.com`. Example: + /// `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824` + pub trace: Option, + /// Optional. Information about an operation associated with the log entry, if + /// applicable. + pub operation: Option, + /// The severity of the log entry. The default value is + /// `LogSeverity.DEFAULT`. + pub severity: Option, +} + +impl Part for LogEntry {} + + +/// `ConsumerInfo` provides information about the consumer. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConsumerInfo { + /// The consumer identity number, can be Google cloud project number, folder + /// number or organization number e.g. 1234567890. A value of 0 indicates no + /// consumer number is found. + #[serde(rename="consumerNumber")] + pub consumer_number: Option, + /// no description provided + #[serde(rename="type")] + pub type_: Option, + /// The Google cloud project number, e.g. 1234567890. A value of 0 indicates + /// no project number is found. + /// + /// NOTE: This field is deprecated after Chemist support flexible consumer + /// id. New code should not depend on this field anymore. + #[serde(rename="projectNumber")] + pub project_number: Option, +} + +impl Part for ConsumerInfo {} + + +/// Response message for the Check method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [check services](struct.ServiceCheckCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CheckResponse { + /// The same operation_id value used in the CheckRequest. + /// Used for logging and diagnostics purposes. + #[serde(rename="operationId")] + pub operation_id: Option, + /// The actual config id used to process the request. + #[serde(rename="serviceConfigId")] + pub service_config_id: Option, + /// Feedback data returned from the server during processing a Check request. + #[serde(rename="checkInfo")] + pub check_info: Option, + /// Indicate the decision of the check. + /// + /// If no check errors are present, the service should process the operation. + /// Otherwise the service should use the list of errors to determine the + /// appropriate action. + #[serde(rename="checkErrors")] + pub check_errors: Option>, + /// Quota information for the check request associated with this response. + /// + #[serde(rename="quotaInfo")] + pub quota_info: Option, +} + +impl ResponseResult for CheckResponse {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -787,403 +1062,6 @@ pub struct Status { impl Part for Status {} -/// Response message for the Report method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [report services](struct.ServiceReportCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReportResponse { - /// The actual config id used to process the request. - #[serde(rename="serviceConfigId")] - pub service_config_id: Option, - /// Quota usage for each quota release `Operation` request. - /// - /// Fully or partially failed quota release request may or may not be present - /// in `report_quota_info`. For example, a failed quota release request will - /// have the current quota usage info when precise quota library returns the - /// info. A deadline exceeded quota request will not have quota usage info. - /// - /// If there is no quota release request, report_quota_info will be empty. - /// - #[serde(rename="reportInfos")] - pub report_infos: Option>, - /// Partial failures, one for each `Operation` in the request that failed - /// processing. There are three possible combinations of the RPC status: - /// - /// 1. The combination of a successful RPC status and an empty `report_errors` - /// list indicates a complete success where all `Operations` in the - /// request are processed successfully. - /// 2. The combination of a successful RPC status and a non-empty - /// `report_errors` list indicates a partial success where some - /// `Operations` in the request succeeded. Each - /// `Operation` that failed processing has a corresponding item - /// in this list. - /// 3. A failed RPC status indicates a general non-deterministic failure. - /// When this happens, it's impossible to know which of the - /// 'Operations' in the request succeeded or failed. - #[serde(rename="reportErrors")] - pub report_errors: Option>, -} - -impl ResponseResult for ReportResponse {} - - -/// Response message for the ReleaseQuota method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [release quota services](struct.ServiceReleaseQuotaCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReleaseQuotaResponse { - /// The same operation_id value used in the ReleaseQuotaRequest. Used for - /// logging and diagnostics purposes. - #[serde(rename="operationId")] - pub operation_id: Option, - /// ID of the actual config used to process the request. - #[serde(rename="serviceConfigId")] - pub service_config_id: Option, - /// Quota metrics to indicate the result of release. Depending on the - /// request, one or more of the following metrics will be included: - /// - /// 1. For rate quota, per quota group or per quota metric released amount - /// will be specified using the following delta metric: - /// "serviceruntime.googleapis.com/api/consumer/quota_refund_count" - /// - /// 2. For allocation quota, per quota metric total usage will be specified - /// using the following gauge metric: - /// "serviceruntime.googleapis.com/allocation/consumer/quota_used_count" - /// - /// 3. For allocation quota, value for each quota limit associated with - /// the metrics will be specified using the following gauge metric: - /// "serviceruntime.googleapis.com/quota/limit" - #[serde(rename="quotaMetrics")] - pub quota_metrics: Option>, - /// Indicates the decision of the release. - #[serde(rename="releaseErrors")] - pub release_errors: Option>, -} - -impl ResponseResult for ReleaseQuotaResponse {} - - -/// Represents a set of metric values in the same metric. -/// Each metric value in the set should have a unique combination of start time, -/// end time, and label values. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MetricValueSet { - /// The values in this metric. - #[serde(rename="metricValues")] - pub metric_values: Option>, - /// The metric name defined in the service configuration. - #[serde(rename="metricName")] - pub metric_name: Option, -} - -impl Part for MetricValueSet {} - - -/// Represents error information for QuotaOperation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct QuotaError { - /// Error code. - pub code: Option, - /// Free-form text that provides details on the cause of the error. - pub description: Option, - /// Subject to whom this error applies. See the specific enum for more details - /// on this field. For example, "clientip:" or - /// "project:". - pub subject: Option, -} - -impl Part for QuotaError {} - - -/// Describes a resource associated with this operation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResourceInfo { - /// The identifier of the parent of this resource instance. - /// Must be in one of the following formats: - /// - “projects/” - /// - “folders/” - /// - “organizations/” - #[serde(rename="resourceContainer")] - pub resource_container: Option, - /// Name of the resource. This is used for auditing purposes. - #[serde(rename="resourceName")] - pub resource_name: Option, - /// The location of the resource. If not empty, the resource will be checked - /// against location policy. The value must be a valid zone, region or - /// multiregion. For example: "europe-west4" or "northamerica-northeast1-a" - #[serde(rename="resourceLocation")] - pub resource_location: Option, -} - -impl Part for ResourceInfo {} - - -/// An individual log entry. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LogEntry { - /// Optional. Information about the HTTP request associated with this - /// log entry, if applicable. - #[serde(rename="httpRequest")] - pub http_request: Option, - /// The severity of the log entry. The default value is - /// `LogSeverity.DEFAULT`. - pub severity: Option, - /// Optional. Resource name of the trace associated with the log entry, if any. - /// If this field contains a relative resource name, you can assume the name is - /// relative to `//tracing.googleapis.com`. Example: - /// `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824` - pub trace: Option, - /// The log entry payload, represented as a Unicode string (UTF-8). - #[serde(rename="textPayload")] - pub text_payload: Option, - /// The time the event described by the log entry occurred. If - /// omitted, defaults to operation start time. - pub timestamp: Option, - /// A set of user-defined (key, value) data that provides additional - /// information about the log entry. - pub labels: Option>, - /// The log entry payload, represented as a structure that - /// is expressed as a JSON object. - #[serde(rename="structPayload")] - pub struct_payload: Option>, - /// The log entry payload, represented as a protocol buffer that is - /// expressed as a JSON object. The only accepted type currently is - /// AuditLog. - #[serde(rename="protoPayload")] - pub proto_payload: Option>, - /// A unique ID for the log entry used for deduplication. If omitted, - /// the implementation will generate one based on operation_id. - #[serde(rename="insertId")] - pub insert_id: Option, - /// Optional. Information about an operation associated with the log entry, if - /// applicable. - pub operation: Option, - /// Required. The log to which this log entry belongs. Examples: `"syslog"`, - /// `"book_log"`. - pub name: Option, -} - -impl Part for LogEntry {} - - -/// Response message for QuotaController.EndReconciliation. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [end reconciliation services](struct.ServiceEndReconciliationCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EndReconciliationResponse { - /// ID of the actual config used to process the request. - #[serde(rename="serviceConfigId")] - pub service_config_id: Option, - /// Metric values as tracked by One Platform before the adjustment was made. - /// The following metrics will be included: - /// - /// 1. Per quota metric total usage will be specified using the following gauge - /// metric: - /// "serviceruntime.googleapis.com/allocation/consumer/quota_used_count" - /// - /// 2. Value for each quota limit associated with the metrics will be specified - /// using the following gauge metric: - /// "serviceruntime.googleapis.com/quota/limit" - /// - /// 3. Delta value of the usage after the reconciliation for limits associated - /// with the metrics will be specified using the following metric: - /// "serviceruntime.googleapis.com/allocation/reconciliation_delta" - /// The delta value is defined as: - /// new_usage_from_client - existing_value_in_spanner. - /// This metric is not defined in serviceruntime.yaml or in Cloud Monarch. - /// This metric is meant for callers' use only. Since this metric is not - /// defined in the monitoring backend, reporting on this metric will result in - /// an error. - #[serde(rename="quotaMetrics")] - pub quota_metrics: Option>, - /// Indicates the decision of the reconciliation end. - #[serde(rename="reconciliationErrors")] - pub reconciliation_errors: Option>, - /// The same operation_id value used in the EndReconciliationRequest. Used for - /// logging and diagnostics purposes. - #[serde(rename="operationId")] - pub operation_id: Option, -} - -impl ResponseResult for EndReconciliationResponse {} - - -/// `ConsumerInfo` provides information about the consumer project. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ConsumerInfo { - /// The Google cloud project number, e.g. 1234567890. A value of 0 indicates - /// no project number is found. - #[serde(rename="projectNumber")] - pub project_number: Option, -} - -impl Part for ConsumerInfo {} - - -/// Response message for the Check method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [check services](struct.ServiceCheckCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CheckResponse { - /// The same operation_id value used in the CheckRequest. - /// Used for logging and diagnostics purposes. - #[serde(rename="operationId")] - pub operation_id: Option, - /// The actual config id used to process the request. - #[serde(rename="serviceConfigId")] - pub service_config_id: Option, - /// Feedback data returned from the server during processing a Check request. - #[serde(rename="checkInfo")] - pub check_info: Option, - /// Indicate the decision of the check. - /// - /// If no check errors are present, the service should process the operation. - /// Otherwise the service should use the list of errors to determine the - /// appropriate action. - #[serde(rename="checkErrors")] - pub check_errors: Option>, - /// Quota information for the check request associated with this response. - /// - #[serde(rename="quotaInfo")] - pub quota_info: Option, -} - -impl ResponseResult for CheckResponse {} - - -/// A common proto for logging HTTP requests. Only contains semantics -/// defined by the HTTP specification. Product-specific logging -/// information MUST be defined in a separate message. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct HttpRequest { - /// The response code indicating the status of the response. - /// Examples: 200, 404. - pub status: Option, - /// Whether or not the response was validated with the origin server before - /// being served from cache. This field is only meaningful if `cache_hit` is - /// True. - #[serde(rename="cacheValidatedWithOriginServer")] - pub cache_validated_with_origin_server: Option, - /// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" - pub protocol: Option, - /// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. - #[serde(rename="requestMethod")] - pub request_method: Option, - /// The request processing latency on the server, from the time the request was - /// received until the response was sent. - pub latency: Option, - /// The number of HTTP response bytes inserted into cache. Set only when a - /// cache fill was attempted. - #[serde(rename="cacheFillBytes")] - pub cache_fill_bytes: Option, - /// The scheme (http, https), the host name, the path, and the query - /// portion of the URL that was requested. - /// Example: `"http://example.com/some/info?color=red"`. - #[serde(rename="requestUrl")] - pub request_url: Option, - /// The IP address (IPv4 or IPv6) of the origin server that the request was - /// sent to. - #[serde(rename="serverIp")] - pub server_ip: Option, - /// Whether or not a cache lookup was attempted. - #[serde(rename="cacheLookup")] - pub cache_lookup: Option, - /// Whether or not an entity was served from cache - /// (with or without validation). - #[serde(rename="cacheHit")] - pub cache_hit: Option, - /// The referer URL of the request, as defined in - /// [HTTP/1.1 Header Field - /// Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). - pub referer: Option, - /// The IP address (IPv4 or IPv6) of the client that issued the HTTP - /// request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. - #[serde(rename="remoteIp")] - pub remote_ip: Option, - /// The user agent sent by the client. Example: - /// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET - /// CLR 1.0.3705)"`. - #[serde(rename="userAgent")] - pub user_agent: Option, - /// The size of the HTTP request message in bytes, including the request - /// headers and the request body. - #[serde(rename="requestSize")] - pub request_size: Option, - /// The size of the HTTP response message sent back to the client, in bytes, - /// including the response headers and the response body. - #[serde(rename="responseSize")] - pub response_size: Option, -} - -impl Part for HttpRequest {} - - -/// Request message for QuotaController.StartReconciliation. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [start reconciliation services](struct.ServiceStartReconciliationCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StartReconciliationRequest { - /// Specifies which version of service configuration should be used to process - /// the request. If unspecified or no matching version can be found, the latest - /// one will be used. - #[serde(rename="serviceConfigId")] - pub service_config_id: Option, - /// Operation that describes the quota reconciliation. - #[serde(rename="reconciliationOperation")] - pub reconciliation_operation: Option, -} - -impl RequestValue for StartReconciliationRequest {} - - /// Request message for the AllocateQuota method. /// /// # Activities @@ -1359,30 +1237,6 @@ pub struct Money { impl Part for Money {} -/// Request message for QuotaController.EndReconciliation. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [end reconciliation services](struct.ServiceEndReconciliationCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EndReconciliationRequest { - /// Specifies which version of service configuration should be used to process - /// the request. If unspecified or no matching version can be found, the latest - /// one will be used. - #[serde(rename="serviceConfigId")] - pub service_config_id: Option, - /// Operation that describes the quota reconciliation. - #[serde(rename="reconciliationOperation")] - pub reconciliation_operation: Option, -} - -impl RequestValue for EndReconciliationRequest {} - - /// Contains additional info about the report operation. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1400,44 +1254,6 @@ pub struct ReportInfo { impl Part for ReportInfo {} -/// Response message for QuotaController.StartReconciliation. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [start reconciliation services](struct.ServiceStartReconciliationCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StartReconciliationResponse { - /// ID of the actual config used to process the request. - #[serde(rename="serviceConfigId")] - pub service_config_id: Option, - /// Metric values as tracked by One Platform before the start of - /// reconciliation. The following metrics will be included: - /// - /// 1. Per quota metric total usage will be specified using the following gauge - /// metric: - /// "serviceruntime.googleapis.com/allocation/consumer/quota_used_count" - /// - /// 2. Value for each quota limit associated with the metrics will be specified - /// using the following gauge metric: - /// "serviceruntime.googleapis.com/quota/limit" - #[serde(rename="quotaMetrics")] - pub quota_metrics: Option>, - /// Indicates the decision of the reconciliation start. - #[serde(rename="reconciliationErrors")] - pub reconciliation_errors: Option>, - /// The same operation_id value used in the StartReconciliationRequest. Used - /// for logging and diagnostics purposes. - #[serde(rename="operationId")] - pub operation_id: Option, -} - -impl ResponseResult for StartReconciliationResponse {} - - /// Represents the processing error of one Operation in the request. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1474,6 +1290,23 @@ impl Part for QuotaProperties {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Operation { + /// Fully qualified name of the operation. Reserved for future use. + #[serde(rename="operationName")] + pub operation_name: Option, + /// Represents information about this operation. Each MetricValueSet + /// corresponds to a metric defined in the service configuration. + /// The data type used in the MetricValueSet must agree with + /// the data type specified in the metric definition. + /// + /// Within a single operation, it is not allowed to have more than one + /// MetricValue instances that have the same metric names and identical + /// label value combinations. If a request has such duplicated MetricValue + /// instances, the entire request is rejected with + /// an invalid argument error. + #[serde(rename="metricValueSets")] + pub metric_value_sets: Option>, + /// DO NOT USE. This is an experimental field. + pub importance: Option, /// Labels describing the operation. Only the following labels are allowed: /// /// - Labels describing monitored resources as defined in @@ -1491,23 +1324,6 @@ pub struct Operation { /// where the API is served, such as App Engine, Compute Engine, or /// Kubernetes Engine. pub labels: Option>, - /// Represents information about this operation. Each MetricValueSet - /// corresponds to a metric defined in the service configuration. - /// The data type used in the MetricValueSet must agree with - /// the data type specified in the metric definition. - /// - /// Within a single operation, it is not allowed to have more than one - /// MetricValue instances that have the same metric names and identical - /// label value combinations. If a request has such duplicated MetricValue - /// instances, the entire request is rejected with - /// an invalid argument error. - #[serde(rename="metricValueSets")] - pub metric_value_sets: Option>, - /// DO NOT USE. This is an experimental field. - pub importance: Option, - /// Fully qualified name of the operation. Reserved for future use. - #[serde(rename="operationName")] - pub operation_name: Option, /// Represents the properties needed for quota check. Applicable only if this /// operation is for a quota check request. If this is not specified, no quota /// check will be performed. @@ -1543,10 +1359,13 @@ pub struct Operation { /// consumer, but not for service-initiated operations that are /// not related to a specific consumer. /// - /// This can be in one of the following formats: - /// project:, - /// project_number:, - /// api_key:. + /// - This can be in one of the following formats: + /// - project:PROJECT_ID, + /// - project`_`number:PROJECT_NUMBER, + /// - projects/PROJECT_ID or PROJECT_NUMBER, + /// - folders/FOLDER_NUMBER, + /// - organizations/ORGANIZATION_NUMBER, + /// - api`_`key:API_KEY. #[serde(rename="consumerId")] pub consumer_id: Option, /// The resources that are involved in the operation. @@ -1622,7 +1441,7 @@ impl Part for LinearBuckets {} /// ::default(), None); /// let mut hub = ServiceControl::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `allocate_quota(...)`, `check(...)`, `end_reconciliation(...)`, `release_quota(...)`, `report(...)` and `start_reconciliation(...)` +/// // like `allocate_quota(...)`, `check(...)` and `report(...)` /// // to build up your call. /// let rb = hub.services(); /// # } @@ -1637,37 +1456,6 @@ impl<'a, C, A> MethodsBuilder for ServiceMethods<'a, C, A> {} impl<'a, C, A> ServiceMethods<'a, C, A> { - /// Create a builder to help you perform the following task: - /// - /// Releases previously allocated quota done through AllocateQuota method. - /// - /// This method requires the `servicemanagement.services.quota` - /// permission on the specified service. For more information, see - /// [Cloud IAM](https://cloud.google.com/iam). - /// - /// - /// **NOTE:** The client **must** fail-open on server errors `INTERNAL`, - /// `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system - /// reliability, the server may inject these errors to prohibit any hard - /// dependency on the quota functionality. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `serviceName` - Name of the service as specified in the service configuration. For example, - /// `"pubsub.googleapis.com"`. - /// See google.api.Service for the definition of a service name. - pub fn release_quota(&self, request: ReleaseQuotaRequest, service_name: &str) -> ServiceReleaseQuotaCall<'a, C, A> { - ServiceReleaseQuotaCall { - hub: self.hub, - _request: request, - _service_name: service_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Checks whether an operation on a service should be allowed to proceed @@ -1706,108 +1494,6 @@ impl<'a, C, A> ServiceMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Unlike rate quota, allocation quota does not get refilled periodically. - /// So, it is possible that the quota usage as seen by the service differs from - /// what the One Platform considers the usage is. This is expected to happen - /// only rarely, but over time this can accumulate. Services can invoke - /// StartReconciliation and EndReconciliation to correct this usage drift, as - /// described below: - /// 1. Service sends StartReconciliation with a timestamp in future for each - /// metric that needs to be reconciled. The timestamp being in future allows - /// to account for in-flight AllocateQuota and ReleaseQuota requests for the - /// same metric. - /// 2. One Platform records this timestamp and starts tracking subsequent - /// AllocateQuota and ReleaseQuota requests until EndReconciliation is - /// called. - /// 3. At or after the time specified in the StartReconciliation, service - /// sends EndReconciliation with the usage that needs to be reconciled to. - /// 4. One Platform adjusts its own record of usage for that metric to the - /// value specified in EndReconciliation by taking in to account any - /// allocation or release between StartReconciliation and EndReconciliation. - /// - /// Signals the quota controller that the service wants to perform a usage - /// reconciliation as specified in the request. - /// - /// This method requires the `servicemanagement.services.quota` - /// permission on the specified service. For more information, see - /// [Google Cloud IAM](https://cloud.google.com/iam). - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `serviceName` - Name of the service as specified in the service configuration. For example, - /// `"pubsub.googleapis.com"`. - /// See google.api.Service for the definition of a service name. - pub fn start_reconciliation(&self, request: StartReconciliationRequest, service_name: &str) -> ServiceStartReconciliationCall<'a, C, A> { - ServiceStartReconciliationCall { - hub: self.hub, - _request: request, - _service_name: service_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Signals the quota controller that service ends the ongoing usage - /// reconciliation. - /// - /// This method requires the `servicemanagement.services.quota` - /// permission on the specified service. For more information, see - /// [Google Cloud IAM](https://cloud.google.com/iam). - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `serviceName` - Name of the service as specified in the service configuration. For example, - /// `"pubsub.googleapis.com"`. - /// See google.api.Service for the definition of a service name. - pub fn end_reconciliation(&self, request: EndReconciliationRequest, service_name: &str) -> ServiceEndReconciliationCall<'a, C, A> { - ServiceEndReconciliationCall { - hub: self.hub, - _request: request, - _service_name: service_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Attempts to allocate quota for the specified consumer. It should be called - /// before the operation is executed. - /// - /// This method requires the `servicemanagement.services.quota` - /// permission on the specified service. For more information, see - /// [Cloud IAM](https://cloud.google.com/iam). - /// - /// **NOTE:** The client **must** fail-open on server errors `INTERNAL`, - /// `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system - /// reliability, the server may inject these errors to prohibit any hard - /// dependency on the quota functionality. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `serviceName` - Name of the service as specified in the service configuration. For example, - /// `"pubsub.googleapis.com"`. - /// See google.api.Service for the definition of a service name. - pub fn allocate_quota(&self, request: AllocateQuotaRequest, service_name: &str) -> ServiceAllocateQuotaCall<'a, C, A> { - ServiceAllocateQuotaCall { - hub: self.hub, - _request: request, - _service_name: service_name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Reports operation results to Google Service Control, such as logs and @@ -1843,6 +1529,37 @@ impl<'a, C, A> ServiceMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Attempts to allocate quota for the specified consumer. It should be called + /// before the operation is executed. + /// + /// This method requires the `servicemanagement.services.quota` + /// permission on the specified service. For more information, see + /// [Cloud IAM](https://cloud.google.com/iam). + /// + /// **NOTE:** The client **must** fail-open on server errors `INTERNAL`, + /// `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system + /// reliability, the server may inject these errors to prohibit any hard + /// dependency on the quota functionality. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `serviceName` - Name of the service as specified in the service configuration. For example, + /// `"pubsub.googleapis.com"`. + /// See google.api.Service for the definition of a service name. + pub fn allocate_quota(&self, request: AllocateQuotaRequest, service_name: &str) -> ServiceAllocateQuotaCall<'a, C, A> { + ServiceAllocateQuotaCall { + hub: self.hub, + _request: request, + _service_name: service_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -1853,297 +1570,6 @@ impl<'a, C, A> ServiceMethods<'a, C, A> { // CallBuilders ### // ################# -/// Releases previously allocated quota done through AllocateQuota method. -/// -/// This method requires the `servicemanagement.services.quota` -/// permission on the specified service. For more information, see -/// [Cloud IAM](https://cloud.google.com/iam). -/// -/// -/// **NOTE:** The client **must** fail-open on server errors `INTERNAL`, -/// `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system -/// reliability, the server may inject these errors to prohibit any hard -/// dependency on the quota functionality. -/// -/// A builder for the *releaseQuota* method supported by a *service* resource. -/// It is not used directly, but through a `ServiceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_servicecontrol1 as servicecontrol1; -/// use servicecontrol1::ReleaseQuotaRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use servicecontrol1::ServiceControl; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = ServiceControl::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = ReleaseQuotaRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.services().release_quota(req, "serviceName") -/// .doit(); -/// # } -/// ``` -pub struct ServiceReleaseQuotaCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a ServiceControl, - _request: ReleaseQuotaRequest, - _service_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ServiceReleaseQuotaCall<'a, C, A> {} - -impl<'a, C, A> ServiceReleaseQuotaCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ReleaseQuotaResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "servicecontrol.services.releaseQuota", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("serviceName", self._service_name.to_string())); - for &field in ["alt", "serviceName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/services/{serviceName}:releaseQuota"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{serviceName}", "serviceName")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["serviceName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: ReleaseQuotaRequest) -> ServiceReleaseQuotaCall<'a, C, A> { - self._request = new_value; - self - } - /// Name of the service as specified in the service configuration. For example, - /// `"pubsub.googleapis.com"`. - /// - /// See google.api.Service for the definition of a service name. - /// - /// Sets the *service name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn service_name(mut self, new_value: &str) -> ServiceReleaseQuotaCall<'a, C, A> { - self._service_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ServiceReleaseQuotaCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ServiceReleaseQuotaCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ServiceReleaseQuotaCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Checks whether an operation on a service should be allowed to proceed /// based on the configuration of the service and related policies. It must be /// called before the operation is executed. @@ -2264,10 +1690,7 @@ impl<'a, C, A> ServiceCheckCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2299,7 +1722,7 @@ impl<'a, C, A> ServiceCheckCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2394,7 +1817,7 @@ impl<'a, C, A> ServiceCheckCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2402,12 +1825,12 @@ impl<'a, C, A> ServiceCheckCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ServiceCheckCall<'a, C, A> @@ -2442,888 +1865,6 @@ impl<'a, C, A> ServiceCheckCall<'a, C, A> where C: BorrowMut, A: } -/// Unlike rate quota, allocation quota does not get refilled periodically. -/// So, it is possible that the quota usage as seen by the service differs from -/// what the One Platform considers the usage is. This is expected to happen -/// only rarely, but over time this can accumulate. Services can invoke -/// StartReconciliation and EndReconciliation to correct this usage drift, as -/// described below: -/// 1. Service sends StartReconciliation with a timestamp in future for each -/// metric that needs to be reconciled. The timestamp being in future allows -/// to account for in-flight AllocateQuota and ReleaseQuota requests for the -/// same metric. -/// 2. One Platform records this timestamp and starts tracking subsequent -/// AllocateQuota and ReleaseQuota requests until EndReconciliation is -/// called. -/// 3. At or after the time specified in the StartReconciliation, service -/// sends EndReconciliation with the usage that needs to be reconciled to. -/// 4. One Platform adjusts its own record of usage for that metric to the -/// value specified in EndReconciliation by taking in to account any -/// allocation or release between StartReconciliation and EndReconciliation. -/// -/// Signals the quota controller that the service wants to perform a usage -/// reconciliation as specified in the request. -/// -/// This method requires the `servicemanagement.services.quota` -/// permission on the specified service. For more information, see -/// [Google Cloud IAM](https://cloud.google.com/iam). -/// -/// A builder for the *startReconciliation* method supported by a *service* resource. -/// It is not used directly, but through a `ServiceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_servicecontrol1 as servicecontrol1; -/// use servicecontrol1::StartReconciliationRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use servicecontrol1::ServiceControl; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = ServiceControl::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = StartReconciliationRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.services().start_reconciliation(req, "serviceName") -/// .doit(); -/// # } -/// ``` -pub struct ServiceStartReconciliationCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a ServiceControl, - _request: StartReconciliationRequest, - _service_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ServiceStartReconciliationCall<'a, C, A> {} - -impl<'a, C, A> ServiceStartReconciliationCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, StartReconciliationResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "servicecontrol.services.startReconciliation", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("serviceName", self._service_name.to_string())); - for &field in ["alt", "serviceName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/services/{serviceName}:startReconciliation"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{serviceName}", "serviceName")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["serviceName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: StartReconciliationRequest) -> ServiceStartReconciliationCall<'a, C, A> { - self._request = new_value; - self - } - /// Name of the service as specified in the service configuration. For example, - /// `"pubsub.googleapis.com"`. - /// - /// See google.api.Service for the definition of a service name. - /// - /// Sets the *service name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn service_name(mut self, new_value: &str) -> ServiceStartReconciliationCall<'a, C, A> { - self._service_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ServiceStartReconciliationCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ServiceStartReconciliationCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ServiceStartReconciliationCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Signals the quota controller that service ends the ongoing usage -/// reconciliation. -/// -/// This method requires the `servicemanagement.services.quota` -/// permission on the specified service. For more information, see -/// [Google Cloud IAM](https://cloud.google.com/iam). -/// -/// A builder for the *endReconciliation* method supported by a *service* resource. -/// It is not used directly, but through a `ServiceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_servicecontrol1 as servicecontrol1; -/// use servicecontrol1::EndReconciliationRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use servicecontrol1::ServiceControl; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = ServiceControl::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = EndReconciliationRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.services().end_reconciliation(req, "serviceName") -/// .doit(); -/// # } -/// ``` -pub struct ServiceEndReconciliationCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a ServiceControl, - _request: EndReconciliationRequest, - _service_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ServiceEndReconciliationCall<'a, C, A> {} - -impl<'a, C, A> ServiceEndReconciliationCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, EndReconciliationResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "servicecontrol.services.endReconciliation", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("serviceName", self._service_name.to_string())); - for &field in ["alt", "serviceName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/services/{serviceName}:endReconciliation"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{serviceName}", "serviceName")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["serviceName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: EndReconciliationRequest) -> ServiceEndReconciliationCall<'a, C, A> { - self._request = new_value; - self - } - /// Name of the service as specified in the service configuration. For example, - /// `"pubsub.googleapis.com"`. - /// - /// See google.api.Service for the definition of a service name. - /// - /// Sets the *service name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn service_name(mut self, new_value: &str) -> ServiceEndReconciliationCall<'a, C, A> { - self._service_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ServiceEndReconciliationCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ServiceEndReconciliationCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ServiceEndReconciliationCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Attempts to allocate quota for the specified consumer. It should be called -/// before the operation is executed. -/// -/// This method requires the `servicemanagement.services.quota` -/// permission on the specified service. For more information, see -/// [Cloud IAM](https://cloud.google.com/iam). -/// -/// **NOTE:** The client **must** fail-open on server errors `INTERNAL`, -/// `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system -/// reliability, the server may inject these errors to prohibit any hard -/// dependency on the quota functionality. -/// -/// A builder for the *allocateQuota* method supported by a *service* resource. -/// It is not used directly, but through a `ServiceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_servicecontrol1 as servicecontrol1; -/// use servicecontrol1::AllocateQuotaRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use servicecontrol1::ServiceControl; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = ServiceControl::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = AllocateQuotaRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.services().allocate_quota(req, "serviceName") -/// .doit(); -/// # } -/// ``` -pub struct ServiceAllocateQuotaCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a ServiceControl, - _request: AllocateQuotaRequest, - _service_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ServiceAllocateQuotaCall<'a, C, A> {} - -impl<'a, C, A> ServiceAllocateQuotaCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AllocateQuotaResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "servicecontrol.services.allocateQuota", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("serviceName", self._service_name.to_string())); - for &field in ["alt", "serviceName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/services/{serviceName}:allocateQuota"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{serviceName}", "serviceName")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["serviceName"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: AllocateQuotaRequest) -> ServiceAllocateQuotaCall<'a, C, A> { - self._request = new_value; - self - } - /// Name of the service as specified in the service configuration. For example, - /// `"pubsub.googleapis.com"`. - /// - /// See google.api.Service for the definition of a service name. - /// - /// Sets the *service name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn service_name(mut self, new_value: &str) -> ServiceAllocateQuotaCall<'a, C, A> { - self._service_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ServiceAllocateQuotaCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ServiceAllocateQuotaCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ServiceAllocateQuotaCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Reports operation results to Google Service Control, such as logs and /// metrics. It should be called after an operation is completed. /// @@ -3442,10 +1983,7 @@ impl<'a, C, A> ServiceReportCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3477,7 +2015,7 @@ impl<'a, C, A> ServiceReportCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3572,7 +2110,7 @@ impl<'a, C, A> ServiceReportCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3580,12 +2118,12 @@ impl<'a, C, A> ServiceReportCall<'a, C, A> where C: BorrowMut, A: /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ServiceReportCall<'a, C, A> @@ -3620,3 +2158,291 @@ impl<'a, C, A> ServiceReportCall<'a, C, A> where C: BorrowMut, A: } +/// Attempts to allocate quota for the specified consumer. It should be called +/// before the operation is executed. +/// +/// This method requires the `servicemanagement.services.quota` +/// permission on the specified service. For more information, see +/// [Cloud IAM](https://cloud.google.com/iam). +/// +/// **NOTE:** The client **must** fail-open on server errors `INTERNAL`, +/// `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system +/// reliability, the server may inject these errors to prohibit any hard +/// dependency on the quota functionality. +/// +/// A builder for the *allocateQuota* method supported by a *service* resource. +/// It is not used directly, but through a `ServiceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_servicecontrol1 as servicecontrol1; +/// use servicecontrol1::AllocateQuotaRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use servicecontrol1::ServiceControl; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = ServiceControl::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AllocateQuotaRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.services().allocate_quota(req, "serviceName") +/// .doit(); +/// # } +/// ``` +pub struct ServiceAllocateQuotaCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceControl, + _request: AllocateQuotaRequest, + _service_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ServiceAllocateQuotaCall<'a, C, A> {} + +impl<'a, C, A> ServiceAllocateQuotaCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AllocateQuotaResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "servicecontrol.services.allocateQuota", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("serviceName", self._service_name.to_string())); + for &field in ["alt", "serviceName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/services/{serviceName}:allocateQuota"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{serviceName}", "serviceName")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["serviceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AllocateQuotaRequest) -> ServiceAllocateQuotaCall<'a, C, A> { + self._request = new_value; + self + } + /// Name of the service as specified in the service configuration. For example, + /// `"pubsub.googleapis.com"`. + /// + /// See google.api.Service for the definition of a service name. + /// + /// Sets the *service name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn service_name(mut self, new_value: &str) -> ServiceAllocateQuotaCall<'a, C, A> { + self._service_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ServiceAllocateQuotaCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ServiceAllocateQuotaCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ServiceAllocateQuotaCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/serviceregistryalpha/Cargo.toml b/gen/serviceregistryalpha/Cargo.toml index 8fe49f1f0f..a4f7e2e7ce 100644 --- a/gen/serviceregistryalpha/Cargo.toml +++ b/gen/serviceregistryalpha/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/serviceregistryalpha/src/lib.rs b/gen/serviceregistryalpha/src/lib.rs index c11d1a51e3..9d3b911b56 100644 --- a/gen/serviceregistryalpha/src/lib.rs +++ b/gen/serviceregistryalpha/src/lib.rs @@ -991,10 +991,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1014,7 +1011,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1102,7 +1099,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1264,10 +1261,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1287,7 +1281,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1405,7 +1399,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1554,10 +1548,7 @@ impl<'a, C, A> EndpointInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1589,7 +1580,7 @@ impl<'a, C, A> EndpointInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1679,7 +1670,7 @@ impl<'a, C, A> EndpointInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1823,10 +1814,7 @@ impl<'a, C, A> EndpointDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1846,7 +1834,7 @@ impl<'a, C, A> EndpointDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1934,7 +1922,7 @@ impl<'a, C, A> EndpointDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2085,10 +2073,7 @@ impl<'a, C, A> EndpointUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2120,7 +2105,7 @@ impl<'a, C, A> EndpointUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2220,7 +2205,7 @@ impl<'a, C, A> EndpointUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2371,10 +2356,7 @@ impl<'a, C, A> EndpointPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2406,7 +2388,7 @@ impl<'a, C, A> EndpointPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2506,7 +2488,7 @@ impl<'a, C, A> EndpointPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2668,10 +2650,7 @@ impl<'a, C, A> EndpointListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2691,7 +2670,7 @@ impl<'a, C, A> EndpointListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2809,7 +2788,7 @@ impl<'a, C, A> EndpointListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2953,10 +2932,7 @@ impl<'a, C, A> EndpointGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2976,7 +2952,7 @@ impl<'a, C, A> EndpointGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3064,7 +3040,7 @@ impl<'a, C, A> EndpointGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/sheets4-cli/Cargo.toml b/gen/sheets4-cli/Cargo.toml index 127ee9654d..42ad2b155d 100644 --- a/gen/sheets4-cli/Cargo.toml +++ b/gen/sheets4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-sheets4-cli" -version = "1.0.8+20181010" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Sheets (protocol v4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/sheets4-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-sheets4] path = "../sheets4" -version = "1.0.8+20181010" +version = "1.0.8+20190330" diff --git a/gen/sheets4-cli/README.md b/gen/sheets4-cli/README.md index 725a9b1fa6..2d5ad70275 100644 --- a/gen/sheets4-cli/README.md +++ b/gen/sheets4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Sheets* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *Sheets* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash sheets4 [options] diff --git a/gen/sheets4-cli/mkdocs.yml b/gen/sheets4-cli/mkdocs.yml index f72d114342..996ddeedb1 100644 --- a/gen/sheets4-cli/mkdocs.yml +++ b/gen/sheets4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Sheets v1.0.8+20181010 +site_name: Sheets v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-sheets4-cli site_description: A complete library to interact with Sheets (protocol v4) diff --git a/gen/sheets4-cli/src/main.rs b/gen/sheets4-cli/src/main.rs index 117d015426..ad00fab802 100644 --- a/gen/sheets4-cli/src/main.rs +++ b/gen/sheets4-cli/src/main.rs @@ -173,18 +173,6 @@ impl<'n> Engine<'n> { "properties.default-format.background-color.green" => Some(("properties.defaultFormat.backgroundColor.green", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "properties.default-format.background-color.red" => Some(("properties.defaultFormat.backgroundColor.red", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "properties.default-format.vertical-alignment" => Some(("properties.defaultFormat.verticalAlignment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "properties.default-format.text-format.foreground-color.blue" => Some(("properties.defaultFormat.textFormat.foregroundColor.blue", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "properties.default-format.text-format.foreground-color.alpha" => Some(("properties.defaultFormat.textFormat.foregroundColor.alpha", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "properties.default-format.text-format.foreground-color.green" => Some(("properties.defaultFormat.textFormat.foregroundColor.green", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "properties.default-format.text-format.foreground-color.red" => Some(("properties.defaultFormat.textFormat.foregroundColor.red", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "properties.default-format.text-format.bold" => Some(("properties.defaultFormat.textFormat.bold", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "properties.default-format.text-format.strikethrough" => Some(("properties.defaultFormat.textFormat.strikethrough", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "properties.default-format.text-format.font-family" => Some(("properties.defaultFormat.textFormat.fontFamily", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "properties.default-format.text-format.font-size" => Some(("properties.defaultFormat.textFormat.fontSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "properties.default-format.text-format.italic" => Some(("properties.defaultFormat.textFormat.italic", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "properties.default-format.text-format.underline" => Some(("properties.defaultFormat.textFormat.underline", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "properties.default-format.wrap-strategy" => Some(("properties.defaultFormat.wrapStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "properties.default-format.hyperlink-display-type" => Some(("properties.defaultFormat.hyperlinkDisplayType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "properties.default-format.borders.top.color.blue" => Some(("properties.defaultFormat.borders.top.color.blue", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "properties.default-format.borders.top.color.alpha" => Some(("properties.defaultFormat.borders.top.color.alpha", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "properties.default-format.borders.top.color.green" => Some(("properties.defaultFormat.borders.top.color.green", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -209,6 +197,18 @@ impl<'n> Engine<'n> { "properties.default-format.borders.bottom.color.red" => Some(("properties.defaultFormat.borders.bottom.color.red", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "properties.default-format.borders.bottom.width" => Some(("properties.defaultFormat.borders.bottom.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "properties.default-format.borders.bottom.style" => Some(("properties.defaultFormat.borders.bottom.style", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "properties.default-format.wrap-strategy" => Some(("properties.defaultFormat.wrapStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "properties.default-format.hyperlink-display-type" => Some(("properties.defaultFormat.hyperlinkDisplayType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "properties.default-format.text-format.foreground-color.blue" => Some(("properties.defaultFormat.textFormat.foregroundColor.blue", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "properties.default-format.text-format.foreground-color.alpha" => Some(("properties.defaultFormat.textFormat.foregroundColor.alpha", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "properties.default-format.text-format.foreground-color.green" => Some(("properties.defaultFormat.textFormat.foregroundColor.green", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "properties.default-format.text-format.foreground-color.red" => Some(("properties.defaultFormat.textFormat.foregroundColor.red", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "properties.default-format.text-format.bold" => Some(("properties.defaultFormat.textFormat.bold", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "properties.default-format.text-format.strikethrough" => Some(("properties.defaultFormat.textFormat.strikethrough", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "properties.default-format.text-format.font-family" => Some(("properties.defaultFormat.textFormat.fontFamily", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "properties.default-format.text-format.font-size" => Some(("properties.defaultFormat.textFormat.fontSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "properties.default-format.text-format.italic" => Some(("properties.defaultFormat.textFormat.italic", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "properties.default-format.text-format.underline" => Some(("properties.defaultFormat.textFormat.underline", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "properties.default-format.text-rotation.angle" => Some(("properties.defaultFormat.textRotation.angle", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "properties.default-format.text-rotation.vertical" => Some(("properties.defaultFormat.textRotation.vertical", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "properties.iterative-calculation-settings.convergence-threshold" => Some(("properties.iterativeCalculationSettings.convergenceThreshold", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -2228,7 +2228,7 @@ fn main() { let mut app = App::new("sheets4") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190330") .about("Reads and writes Google Sheets.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_sheets4_cli") .arg(Arg::with_name("url") diff --git a/gen/sheets4/Cargo.toml b/gen/sheets4/Cargo.toml index b6f2bd913c..973450178e 100644 --- a/gen/sheets4/Cargo.toml +++ b/gen/sheets4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-sheets4" -version = "1.0.8+20181010" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with Sheets (protocol v4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/sheets4" homepage = "https://developers.google.com/sheets/" -documentation = "https://docs.rs/google-sheets4/1.0.8+20181010" +documentation = "https://docs.rs/google-sheets4/1.0.8+20190330" license = "MIT" keywords = ["sheets", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/sheets4/README.md b/gen/sheets4/README.md index 912540adad..f83fe8bd8a 100644 --- a/gen/sheets4/README.md +++ b/gen/sheets4/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-sheets4` library allows access to all features of the *Google Sheets* service. -This documentation was generated from *Sheets* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *sheets:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Sheets* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *sheets:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Sheets* *v4* API can be found at the [official documentation site](https://developers.google.com/sheets/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.Sheets.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.Sheets.html) ... -* [spreadsheets](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.Spreadsheet.html) - * [*batch update*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetBatchUpdateCall.html), [*create*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetCreateCall.html), [*developer metadata get*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetDeveloperMetadataGetCall.html), [*developer metadata search*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetDeveloperMetadataSearchCall.html), [*get*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetGetCall.html), [*get by data filter*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetGetByDataFilterCall.html), [*sheets copy to*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetSheetCopyToCall.html), [*values append*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetValueAppendCall.html), [*values batch clear*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetValueBatchClearCall.html), [*values batch clear by data filter*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetValueBatchClearByDataFilterCall.html), [*values batch get*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetValueBatchGetCall.html), [*values batch get by data filter*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetValueBatchGetByDataFilterCall.html), [*values batch update*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetValueBatchUpdateCall.html), [*values batch update by data filter*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetValueBatchUpdateByDataFilterCall.html), [*values clear*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetValueClearCall.html), [*values get*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetValueGetCall.html) and [*values update*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.SpreadsheetValueUpdateCall.html) +* [spreadsheets](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.Spreadsheet.html) + * [*batch update*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetBatchUpdateCall.html), [*create*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetCreateCall.html), [*developer metadata get*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetDeveloperMetadataGetCall.html), [*developer metadata search*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetDeveloperMetadataSearchCall.html), [*get*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetGetCall.html), [*get by data filter*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetGetByDataFilterCall.html), [*sheets copy to*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetSheetCopyToCall.html), [*values append*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetValueAppendCall.html), [*values batch clear*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetValueBatchClearCall.html), [*values batch clear by data filter*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetValueBatchClearByDataFilterCall.html), [*values batch get*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetValueBatchGetCall.html), [*values batch get by data filter*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetValueBatchGetByDataFilterCall.html), [*values batch update*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetValueBatchUpdateCall.html), [*values batch update by data filter*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetValueBatchUpdateByDataFilterCall.html), [*values clear*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetValueClearCall.html), [*values get*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetValueGetCall.html) and [*values update*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.SpreadsheetValueUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/struct.Sheets.html)** +* **[Hub](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/struct.Sheets.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.Part.html)** + * **[Parts](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -151,17 +151,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -171,29 +171,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-sheets4/1.0.8+20190330/google_sheets4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/sheets4/src/lib.rs b/gen/sheets4/src/lib.rs index 7c04bcca43..fa2766dcdf 100644 --- a/gen/sheets4/src/lib.rs +++ b/gen/sheets4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Sheets* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *sheets:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Sheets* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *sheets:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Sheets* *v4* API can be found at the //! [official documentation site](https://developers.google.com/sheets/). @@ -252,16 +252,16 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// View and manage the files in your Google Drive + /// See, edit, create, and delete all of your Google Drive files Drive, - /// View the files in your Google Drive + /// See and download all your Google Drive files DriveReadonly, /// View and manage Google Drive files and folders that you have opened or created with this app DriveFile, - /// View and manage your spreadsheets in Google Drive + /// See, edit, create, and delete your spreadsheets in Google Drive Spreadsheet, /// View your Google Spreadsheets @@ -412,72 +412,47 @@ impl<'a, C, A> Sheets // ############ // SCHEMAS ### // ########## -/// Merges all cells in the range. +/// A group over an interval of rows or columns on a sheet, which can contain or +/// be contained within other groups. A group can be collapsed or expanded as a +/// unit on the sheet. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MergeCellsRequest { - /// The range of cells to merge. - pub range: Option, - /// How the cells should be merged. - #[serde(rename="mergeType")] - pub merge_type: Option, +pub struct DimensionGroup { + /// The range over which this group exists. + pub range: Option, + /// The depth of the group, representing how many groups have a range that + /// wholly contains the range of this group. + pub depth: Option, + /// This field is true if this group is collapsed. A collapsed group remains + /// collapsed if an overlapping group at a shallower depth is expanded. + /// + /// A true value does not imply that all dimensions within the group are + /// hidden, since a dimension's visibility can change independently from this + /// group property. However, when this property is updated, all dimensions + /// within it are set to hidden if this field is true, or set to visible if + /// this field is false. + pub collapsed: Option, } -impl Part for MergeCellsRequest {} +impl Part for DimensionGroup {} -/// A sheet in a spreadsheet. +/// Adds a new conditional format rule at the given index. +/// All subsequent rules' indexes are incremented. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Sheet { - /// The conditional format rules in this sheet. - #[serde(rename="conditionalFormats")] - pub conditional_formats: Option>, - /// The banded (alternating colors) ranges on this sheet. - #[serde(rename="bandedRanges")] - pub banded_ranges: Option>, - /// The ranges that are merged together. - pub merges: Option>, - /// The filter on this sheet, if any. - #[serde(rename="basicFilter")] - pub basic_filter: Option, - /// The developer metadata associated with a sheet. - #[serde(rename="developerMetadata")] - pub developer_metadata: Option>, - /// All column groups on this sheet, ordered by increasing range start index, - /// then by group depth. - #[serde(rename="columnGroups")] - pub column_groups: Option>, - /// The specifications of every chart on this sheet. - pub charts: Option>, - /// The filter views in this sheet. - #[serde(rename="filterViews")] - pub filter_views: Option>, - /// The properties of the sheet. - pub properties: Option, - /// The protected ranges in this sheet. - #[serde(rename="protectedRanges")] - pub protected_ranges: Option>, - /// Data in the grid, if this is a grid sheet. - /// The number of GridData objects returned is dependent on the number of - /// ranges requested on this sheet. For example, if this is representing - /// `Sheet1`, and the spreadsheet was requested with ranges - /// `Sheet1!A1:C10` and `Sheet1!D15:E20`, then the first GridData will have a - /// startRow/startColumn of `0`, - /// while the second one will have `startRow 14` (zero-based row 15), - /// and `startColumn 3` (zero-based column D). - pub data: Option>, - /// All row groups on this sheet, ordered by increasing range start index, then - /// by group depth. - #[serde(rename="rowGroups")] - pub row_groups: Option>, +pub struct AddConditionalFormatRuleRequest { + /// The zero-based index where the rule should be inserted. + pub index: Option, + /// The rule to add. + pub rule: Option, } -impl Part for Sheet {} +impl Part for AddConditionalFormatRuleRequest {} /// Updates properties of the sheet with the specified @@ -598,21 +573,39 @@ pub struct AddSheetResponse { impl Part for AddSheetResponse {} -/// Sets a data validation rule to every cell in the range. -/// To clear validation in a range, call this with no rule specified. +/// The position of an embedded object such as a chart. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SetDataValidationRequest { - /// The range the data validation rule should apply to. - pub range: Option, - /// The data validation rule to set on each cell in the range, - /// or empty to clear the data validation in the range. - pub rule: Option, +pub struct EmbeddedObjectPosition { + /// If true, the embedded object is put on a new sheet whose ID + /// is chosen for you. Used only when writing. + #[serde(rename="newSheet")] + pub new_sheet: Option, + /// The sheet this is on. Set only if the embedded object + /// is on its own sheet. Must be non-negative. + #[serde(rename="sheetId")] + pub sheet_id: Option, + /// The position at which the object is overlaid on top of a grid. + #[serde(rename="overlayPosition")] + pub overlay_position: Option, } -impl Part for SetDataValidationRequest {} +impl Part for EmbeddedObjectPosition {} + + +/// The result of adding a filter view. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AddFilterViewResponse { + /// The newly added filter view. + pub filter: Option, +} + +impl Part for AddFilterViewResponse {} /// Inserts cells into a range, shifting the existing cells over or down. @@ -633,71 +626,56 @@ pub struct InsertRangeRequest { impl Part for InsertRangeRequest {} -/// Data within a range of the spreadsheet. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [values append spreadsheets](struct.SpreadsheetValueAppendCall.html) (request) -/// * [values get spreadsheets](struct.SpreadsheetValueGetCall.html) (response) -/// * [values update spreadsheets](struct.SpreadsheetValueUpdateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ValueRange { - /// The range the values cover, in A1 notation. - /// For output, this range indicates the entire requested range, - /// even though the values will exclude trailing rows and columns. - /// When appending values, this field represents the range to search for a - /// table, after which values will be appended. - pub range: Option, - /// The data that was read or to be written. This is an array of arrays, - /// the outer array representing all the data and each inner array - /// representing a major dimension. Each item in the inner array - /// corresponds with one cell. - /// - /// For output, empty trailing rows and columns will not be included. - /// - /// For input, supported value types are: bool, string, and double. - /// Null values will be skipped. - /// To set a cell to an empty value, set the string value to an empty string. - pub values: Option>>, - /// The major dimension of the values. - /// - /// For output, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`, - /// then requesting `range=A1:B2,majorDimension=ROWS` will return - /// `[[1,2],[3,4]]`, - /// whereas requesting `range=A1:B2,majorDimension=COLUMNS` will return - /// `[[1,3],[2,4]]`. - /// - /// For input, with `range=A1:B2,majorDimension=ROWS` then `[[1,2],[3,4]]` - /// will set `A1=1,B1=2,A2=3,B2=4`. With `range=A1:B2,majorDimension=COLUMNS` - /// then `[[1,2],[3,4]]` will set `A1=1,B1=3,A2=2,B2=4`. - /// - /// When writing, if this field is not set, it defaults to ROWS. - #[serde(rename="majorDimension")] - pub major_dimension: Option, -} - -impl RequestValue for ValueRange {} -impl ResponseResult for ValueRange {} - - -/// Adds a new conditional format rule at the given index. -/// All subsequent rules' indexes are incremented. +/// A sheet in a spreadsheet. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddConditionalFormatRuleRequest { - /// The zero-based index where the rule should be inserted. - pub index: Option, - /// The rule to add. - pub rule: Option, +pub struct Sheet { + /// The conditional format rules in this sheet. + #[serde(rename="conditionalFormats")] + pub conditional_formats: Option>, + /// The banded (alternating colors) ranges on this sheet. + #[serde(rename="bandedRanges")] + pub banded_ranges: Option>, + /// The ranges that are merged together. + pub merges: Option>, + /// The filter on this sheet, if any. + #[serde(rename="basicFilter")] + pub basic_filter: Option, + /// The developer metadata associated with a sheet. + #[serde(rename="developerMetadata")] + pub developer_metadata: Option>, + /// All column groups on this sheet, ordered by increasing range start index, + /// then by group depth. + #[serde(rename="columnGroups")] + pub column_groups: Option>, + /// The specifications of every chart on this sheet. + pub charts: Option>, + /// The filter views in this sheet. + #[serde(rename="filterViews")] + pub filter_views: Option>, + /// The properties of the sheet. + pub properties: Option, + /// The protected ranges in this sheet. + #[serde(rename="protectedRanges")] + pub protected_ranges: Option>, + /// Data in the grid, if this is a grid sheet. + /// The number of GridData objects returned is dependent on the number of + /// ranges requested on this sheet. For example, if this is representing + /// `Sheet1`, and the spreadsheet was requested with ranges + /// `Sheet1!A1:C10` and `Sheet1!D15:E20`, then the first GridData will have a + /// startRow/startColumn of `0`, + /// while the second one will have `startRow 14` (zero-based row 15), + /// and `startColumn 3` (zero-based column D). + pub data: Option>, + /// All row groups on this sheet, ordered by increasing range start index, then + /// by group depth. + #[serde(rename="rowGroups")] + pub row_groups: Option>, } -impl Part for AddConditionalFormatRuleRequest {} +impl Part for Sheet {} /// A single interpolation point on a gradient conditional format. @@ -730,61 +708,57 @@ impl Part for InterpolationPoint {} pub struct PasteDataRequest { /// The coordinate at which the data should start being inserted. pub coordinate: Option, - /// How the data should be pasted. - #[serde(rename="type")] - pub type_: Option, + /// The data to insert. + pub data: Option, /// The delimiter in the data. pub delimiter: Option, /// True if the data is HTML. pub html: Option, - /// The data to insert. - pub data: Option, + /// How the data should be pasted. + #[serde(rename="type")] + pub type_: Option, } impl Part for PasteDataRequest {} -/// An org chart. -/// Org charts require a unique set of labels in labels and may -/// optionally include parent_labels and tooltips. -/// parent_labels contain, for each node, the label identifying the parent -/// node. tooltips contain, for each node, an optional tooltip. -/// -/// For example, to describe an OrgChart with Alice as the CEO, Bob as the -/// President (reporting to Alice) and Cathy as VP of Sales (also reporting to -/// Alice), have labels contain "Alice", "Bob", "Cathy", -/// parent_labels contain "", "Alice", "Alice" and tooltips contain -/// "CEO", "President", "VP Sales". +/// Criteria for showing/hiding rows in a filter or filter view. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OrgChartSpec { - /// The data containing the tooltip for the corresponding node. A blank value - /// results in no tooltip being displayed for the node. - /// This field is optional. - pub tooltips: Option, - /// The data containing the label of the parent for the corresponding node. - /// A blank value indicates that the node has no parent and is a top-level - /// node. - /// This field is optional. - #[serde(rename="parentLabels")] - pub parent_labels: Option, - /// The color of the org chart nodes. - #[serde(rename="nodeColor")] - pub node_color: Option, - /// The data containing the labels for all the nodes in the chart. Labels - /// must be unique. - pub labels: Option, - /// The color of the selected org chart nodes. - #[serde(rename="selectedNodeColor")] - pub selected_node_color: Option, - /// The size of the org chart nodes. - #[serde(rename="nodeSize")] - pub node_size: Option, +pub struct FilterCriteria { + /// Values that should be hidden. + #[serde(rename="hiddenValues")] + pub hidden_values: Option>, + /// A condition that must be true for values to be shown. + /// (This does not override hiddenValues -- if a value is listed there, + /// it will still be hidden.) + pub condition: Option, } -impl Part for OrgChartSpec {} +impl Part for FilterCriteria {} + + +/// The default filter associated with a sheet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BasicFilter { + /// The range the filter covers. + pub range: Option, + /// The sort order per column. Later specifications are used when values + /// are equal in the earlier specifications. + #[serde(rename="sortSpecs")] + pub sort_specs: Option>, + /// The criteria for showing/hiding values per column. + /// The map's key is the column index, and the value is the criteria for + /// that column. + pub criteria: Option>, +} + +impl Part for BasicFilter {} /// Adds a filter view. @@ -846,12 +820,12 @@ pub struct BasicChartSpec { /// The type of the chart. #[serde(rename="chartType")] pub chart_type: Option, + /// The axis on the chart. + pub axis: Option>, /// True to make the chart 3D. /// Applies to Bar and Column charts. #[serde(rename="threeDimensional")] pub three_dimensional: Option, - /// The axis on the chart. - pub axis: Option>, } impl Part for BasicChartSpec {} @@ -916,12 +890,12 @@ impl Part for DuplicateFilterViewRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct WaterfallChartSpec { - /// The stacked type. - #[serde(rename="stackedType")] - pub stacked_type: Option, /// True to hide connector lines between columns. #[serde(rename="hideConnectorLines")] pub hide_connector_lines: Option, + /// The stacked type. + #[serde(rename="stackedType")] + pub stacked_type: Option, /// The domain data (horizontal axis) for the waterfall chart. pub domain: Option, /// The line style for the connector lines. @@ -944,54 +918,38 @@ impl Part for WaterfallChartSpec {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManualRuleGroup { + /// The group name, which must be a string. Each group in a given + /// ManualRule must have a unique group name. + #[serde(rename="groupName")] + pub group_name: Option, /// The items in the source data that should be placed into this group. Each /// item may be a string, number, or boolean. Items may appear in at most one /// group within a given ManualRule. Items that do not appear in any /// group will appear on their own. pub items: Option>, - /// The group name, which must be a string. Each group in a given - /// ManualRule must have a unique group name. - #[serde(rename="groupName")] - pub group_name: Option, } impl Part for ManualRuleGroup {} -/// The response when updating a range of values in a spreadsheet. +/// The request for clearing more than one range selected by a +/// DataFilter in a spreadsheet. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [values update spreadsheets](struct.SpreadsheetValueUpdateCall.html) (response) +/// * [values batch clear by data filter spreadsheets](struct.SpreadsheetValueBatchClearByDataFilterCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateValuesResponse { - /// The range (in A1 notation) that updates were applied to. - #[serde(rename="updatedRange")] - pub updated_range: Option, - /// The number of columns where at least one cell in the column was updated. - #[serde(rename="updatedColumns")] - pub updated_columns: Option, - /// The number of rows where at least one cell in the row was updated. - #[serde(rename="updatedRows")] - pub updated_rows: Option, - /// The values of the cells after updates were applied. - /// This is only included if the request's `includeValuesInResponse` field - /// was `true`. - #[serde(rename="updatedData")] - pub updated_data: Option, - /// The spreadsheet the updates were applied to. - #[serde(rename="spreadsheetId")] - pub spreadsheet_id: Option, - /// The number of cells updated. - #[serde(rename="updatedCells")] - pub updated_cells: Option, +pub struct BatchClearValuesByDataFilterRequest { + /// The DataFilters used to determine which ranges to clear. + #[serde(rename="dataFilters")] + pub data_filters: Option>, } -impl ResponseResult for UpdateValuesResponse {} +impl RequestValue for BatchClearValuesByDataFilterRequest {} /// A request to create developer metadata. @@ -1113,10 +1071,10 @@ pub struct ChartSpec { pub alt_text: Option, /// The subtitle of the chart. pub subtitle: Option, - /// The subtitle text format. - /// Strikethrough and underline are not supported. - #[serde(rename="subtitleTextFormat")] - pub subtitle_text_format: Option, + /// The background color of the entire chart. + /// Not applicable to Org charts. + #[serde(rename="backgroundColor")] + pub background_color: Option, /// The title text format. /// Strikethrough and underline are not supported. #[serde(rename="titleTextFormat")] @@ -1125,9 +1083,9 @@ pub struct ChartSpec { /// This field is optional. #[serde(rename="titleTextPosition")] pub title_text_position: Option, - /// A waterfall chart specification. - #[serde(rename="waterfallChart")] - pub waterfall_chart: Option, + /// Determines how the charts will use hidden rows or columns. + #[serde(rename="hiddenDimensionStrategy")] + pub hidden_dimension_strategy: Option, /// A pie chart specification. #[serde(rename="pieChart")] pub pie_chart: Option, @@ -1154,17 +1112,17 @@ pub struct ChartSpec { /// This field is optional. #[serde(rename="subtitleTextPosition")] pub subtitle_text_position: Option, - /// The background color of the entire chart. - /// Not applicable to Org charts. - #[serde(rename="backgroundColor")] - pub background_color: Option, + /// The subtitle text format. + /// Strikethrough and underline are not supported. + #[serde(rename="subtitleTextFormat")] + pub subtitle_text_format: Option, /// True to make a chart fill the entire space in which it's rendered with /// minimum padding. False to use the default padding. /// (Not applicable to Geo and Org charts.) pub maximized: Option, - /// Determines how the charts will use hidden rows or columns. - #[serde(rename="hiddenDimensionStrategy")] - pub hidden_dimension_strategy: Option, + /// A waterfall chart specification. + #[serde(rename="waterfallChart")] + pub waterfall_chart: Option, /// An org chart specification. #[serde(rename="orgChart")] pub org_chart: Option, @@ -1193,23 +1151,59 @@ pub struct ConditionalFormatRule { impl Part for ConditionalFormatRule {} -/// A reply to a developer metadata search request. +/// A protected range. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [developer metadata search spreadsheets](struct.SpreadsheetDeveloperMetadataSearchCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchDeveloperMetadataResponse { - /// The metadata matching the criteria of the search request. - #[serde(rename="matchedDeveloperMetadata")] - pub matched_developer_metadata: Option>, +pub struct ProtectedRange { + /// The list of unprotected ranges within a protected sheet. + /// Unprotected ranges are only supported on protected sheets. + #[serde(rename="unprotectedRanges")] + pub unprotected_ranges: Option>, + /// True if the user who requested this protected range can edit the + /// protected area. + /// This field is read-only. + #[serde(rename="requestingUserCanEdit")] + pub requesting_user_can_edit: Option, + /// The description of this protected range. + pub description: Option, + /// The named range this protected range is backed by, if any. + /// + /// When writing, only one of range or named_range_id + /// may be set. + #[serde(rename="namedRangeId")] + pub named_range_id: Option, + /// The users and groups with edit access to the protected range. + /// This field is only visible to users with edit access to the protected + /// range and the document. + /// Editors are not supported with warning_only protection. + pub editors: Option, + /// The range that is being protected. + /// The range may be fully unbounded, in which case this is considered + /// a protected sheet. + /// + /// When writing, only one of range or named_range_id + /// may be set. + pub range: Option, + /// The ID of the protected range. + /// This field is read-only. + #[serde(rename="protectedRangeId")] + pub protected_range_id: Option, + /// True if this protected range will show a warning when editing. + /// Warning-based protection means that every user can edit data in the + /// protected range, except editing will prompt a warning asking the user + /// to confirm the edit. + /// + /// When writing: if this field is true, then editors is ignored. + /// Additionally, if this field is changed from true to false and the + /// `editors` field is not set (nor included in the field mask), then + /// the editors will be set to all the editors in the document. + #[serde(rename="warningOnly")] + pub warning_only: Option, } -impl ResponseResult for SearchDeveloperMetadataResponse {} +impl Part for ProtectedRange {} /// The result of updating an embedded object's position. @@ -1332,18 +1326,24 @@ pub struct CandlestickDomain { impl Part for CandlestickDomain {} -/// The response from updating developer metadata. +/// The number format of a cell. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateDeveloperMetadataResponse { - /// The updated developer metadata. - #[serde(rename="developerMetadata")] - pub developer_metadata: Option>, +pub struct NumberFormat { + /// Pattern string used for formatting. If not set, a default pattern based on + /// the user's locale will be used if necessary for the given type. + /// See the [Date and Number Formats guide](/sheets/api/guides/formats) for + /// more information about the supported patterns. + pub pattern: Option, + /// The type of the number format. + /// When writing, this field must be set. + #[serde(rename="type")] + pub type_: Option, } -impl Part for UpdateDeveloperMetadataResponse {} +impl Part for NumberFormat {} /// A sort order associated with a specific column or row. @@ -1363,17 +1363,21 @@ pub struct SortSpec { impl Part for SortSpec {} -/// Data about each cell in a row. +/// Adds a new protected range. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RowData { - /// The values in the row, one per column. - pub values: Option>, +pub struct AddProtectedRangeRequest { + /// The protected range to be added. The + /// protectedRangeId field is optional; if + /// one is not set, an id will be randomly generated. (It is an error to + /// specify the ID of a range that already exists.) + #[serde(rename="protectedRange")] + pub protected_range: Option, } -impl Part for RowData {} +impl Part for AddProtectedRangeRequest {} /// The result of deleting a conditional format rule. @@ -1389,46 +1393,21 @@ pub struct DeleteConditionalFormatRuleResponse { impl Part for DeleteConditionalFormatRuleResponse {} -/// A histogram chart. -/// A histogram chart groups data items into bins, displaying each bin as a -/// column of stacked items. Histograms are used to display the distribution -/// of a dataset. Each column of items represents a range into which those -/// items fall. The number of bins can be chosen automatically or specified -/// explicitly. +/// Sets a data validation rule to every cell in the range. +/// To clear validation in a range, call this with no rule specified. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct HistogramChartSpec { - /// The outlier percentile is used to ensure that outliers do not adversely - /// affect the calculation of bucket sizes. For example, setting an outlier - /// percentile of 0.05 indicates that the top and bottom 5% of values when - /// calculating buckets. The values are still included in the chart, they will - /// be added to the first or last buckets instead of their own buckets. - /// Must be between 0.0 and 0.5. - #[serde(rename="outlierPercentile")] - pub outlier_percentile: Option, - /// The series for a histogram may be either a single series of values to be - /// bucketed or multiple series, each of the same length, containing the name - /// of the series followed by the values to be bucketed for that series. - pub series: Option>, - /// Whether horizontal divider lines should be displayed between items in each - /// column. - #[serde(rename="showItemDividers")] - pub show_item_dividers: Option, - /// The position of the chart legend. - #[serde(rename="legendPosition")] - pub legend_position: Option, - /// By default the bucket size (the range of values stacked in a single - /// column) is chosen automatically, but it may be overridden here. - /// E.g., A bucket size of 1.5 results in buckets from 0 - 1.5, 1.5 - 3.0, etc. - /// Cannot be negative. - /// This field is optional. - #[serde(rename="bucketSize")] - pub bucket_size: Option, +pub struct SetDataValidationRequest { + /// The range the data validation rule should apply to. + pub range: Option, + /// The data validation rule to set on each cell in the range, + /// or empty to clear the data validation in the range. + pub rule: Option, } -impl Part for HistogramChartSpec {} +impl Part for SetDataValidationRequest {} /// Updates an existing protected range with the specified @@ -1513,10 +1492,10 @@ impl Part for CutPasteRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct BubbleChartSpec { - /// The minimum radius size of the bubbles, in pixels. - /// If specific, the field must be a positive value. - #[serde(rename="bubbleMinRadiusSize")] - pub bubble_min_radius_size: Option, + /// The opacity of the bubbles between 0 and 1.0. + /// 0 is fully transparent and 1 is fully opaque. + #[serde(rename="bubbleOpacity")] + pub bubble_opacity: Option, /// The data containing the bubble x-values. These values locate the bubbles /// in the chart horizontally. pub domain: Option, @@ -1534,10 +1513,10 @@ pub struct BubbleChartSpec { /// If specified, the field must be a positive value. #[serde(rename="bubbleMaxRadiusSize")] pub bubble_max_radius_size: Option, - /// The opacity of the bubbles between 0 and 1.0. - /// 0 is fully transparent and 1 is fully opaque. - #[serde(rename="bubbleOpacity")] - pub bubble_opacity: Option, + /// The minimum radius size of the bubbles, in pixels. + /// If specific, the field must be a positive value. + #[serde(rename="bubbleMinRadiusSize")] + pub bubble_min_radius_size: Option, /// The data containing the bubble group IDs. All bubbles with the same group /// ID are drawn in the same color. If bubble_sizes is specified then /// this field must also be specified but may contain blank values. @@ -1641,15 +1620,15 @@ pub struct AutoFillRequest { /// This differs based on the type and amount of source data. #[serde(rename="useAlternateSeries")] pub use_alternate_series: Option, + /// The range to autofill. This will examine the range and detect + /// the location that has data and automatically fill that data + /// in to the rest of the range. + pub range: Option, /// The source and destination areas to autofill. /// This explicitly lists the source of the autofill and where to /// extend that data. #[serde(rename="sourceAndDestination")] pub source_and_destination: Option, - /// The range to autofill. This will examine the range and detect - /// the location that has data and automatically fill that data - /// in to the rest of the range. - pub range: Option, } impl Part for AutoFillRequest {} @@ -1765,6 +1744,34 @@ pub struct DuplicateSheetResponse { impl Part for DuplicateSheetResponse {} +/// The location an object is overlaid on top of a grid. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OverlayPosition { + /// The cell the object is anchored to. + #[serde(rename="anchorCell")] + pub anchor_cell: Option, + /// The vertical offset, in pixels, that the object is offset + /// from the anchor cell. + #[serde(rename="offsetYPixels")] + pub offset_y_pixels: Option, + /// The width of the object, in pixels. Defaults to 600. + #[serde(rename="widthPixels")] + pub width_pixels: Option, + /// The horizontal offset, in pixels, that the object is offset + /// from the anchor cell. + #[serde(rename="offsetXPixels")] + pub offset_x_pixels: Option, + /// The height of the object, in pixels. Defaults to 371. + #[serde(rename="heightPixels")] + pub height_pixels: Option, +} + +impl Part for OverlayPosition {} + + /// The format of a run of text in a cell. /// Absent values indicate that the field isn't specified. /// @@ -1832,41 +1839,30 @@ pub struct DeveloperMetadataLocation { /// or column; it cannot be unbounded or span multiple rows or columns. #[serde(rename="dimensionRange")] pub dimension_range: Option, - /// True when metadata is associated with an entire spreadsheet. - pub spreadsheet: Option, /// The ID of the sheet when metadata is associated with an entire sheet. #[serde(rename="sheetId")] pub sheet_id: Option, + /// True when metadata is associated with an entire spreadsheet. + pub spreadsheet: Option, } impl Part for DeveloperMetadataLocation {} -/// A group over an interval of rows or columns on a sheet, which can contain or -/// be contained within other groups. A group can be collapsed or expanded as a -/// unit on the sheet. +/// Merges all cells in the range. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DimensionGroup { - /// The depth of the group, representing how many groups have a range that - /// wholly contains the range of this group. - pub depth: Option, - /// The range over which this group exists. - pub range: Option, - /// This field is true if this group is collapsed. A collapsed group remains - /// collapsed if an overlapping group at a shallower depth is expanded. - /// - /// A true value does not imply that all dimensions within the group are - /// hidden, since a dimension's visibility can change independently from this - /// group property. However, when this property is updated, all dimensions - /// within it are set to hidden if this field is true, or set to visible if - /// this field is false. - pub collapsed: Option, +pub struct MergeCellsRequest { + /// The range of cells to merge. + pub range: Option, + /// How the cells should be merged. + #[serde(rename="mergeType")] + pub merge_type: Option, } -impl Part for DimensionGroup {} +impl Part for MergeCellsRequest {} /// Criteria for showing/hiding rows in a pivot table. @@ -1913,76 +1909,23 @@ pub struct UpdateEmbeddedObjectPositionRequest { impl Part for UpdateEmbeddedObjectPositionRequest {} -/// Adds a new protected range. +/// A reply to a developer metadata search request. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [developer metadata search spreadsheets](struct.SpreadsheetDeveloperMetadataSearchCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddProtectedRangeRequest { - /// The protected range to be added. The - /// protectedRangeId field is optional; if - /// one is not set, an id will be randomly generated. (It is an error to - /// specify the ID of a range that already exists.) - #[serde(rename="protectedRange")] - pub protected_range: Option, +pub struct SearchDeveloperMetadataResponse { + /// The metadata matching the criteria of the search request. + #[serde(rename="matchedDeveloperMetadata")] + pub matched_developer_metadata: Option>, } -impl Part for AddProtectedRangeRequest {} - - -/// A protected range. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ProtectedRange { - /// The list of unprotected ranges within a protected sheet. - /// Unprotected ranges are only supported on protected sheets. - #[serde(rename="unprotectedRanges")] - pub unprotected_ranges: Option>, - /// True if the user who requested this protected range can edit the - /// protected area. - /// This field is read-only. - #[serde(rename="requestingUserCanEdit")] - pub requesting_user_can_edit: Option, - /// The description of this protected range. - pub description: Option, - /// The named range this protected range is backed by, if any. - /// - /// When writing, only one of range or named_range_id - /// may be set. - #[serde(rename="namedRangeId")] - pub named_range_id: Option, - /// The users and groups with edit access to the protected range. - /// This field is only visible to users with edit access to the protected - /// range and the document. - /// Editors are not supported with warning_only protection. - pub editors: Option, - /// The range that is being protected. - /// The range may be fully unbounded, in which case this is considered - /// a protected sheet. - /// - /// When writing, only one of range or named_range_id - /// may be set. - pub range: Option, - /// The ID of the protected range. - /// This field is read-only. - #[serde(rename="protectedRangeId")] - pub protected_range_id: Option, - /// True if this protected range will show a warning when editing. - /// Warning-based protection means that every user can edit data in the - /// protected range, except editing will prompt a warning asking the user - /// to confirm the edit. - /// - /// When writing: if this field is true, then editors is ignored. - /// Additionally, if this field is changed from true to false and the - /// `editors` field is not set (nor included in the field mask), then - /// the editors will be set to all the editors in the document. - #[serde(rename="warningOnly")] - pub warning_only: Option, -} - -impl Part for ProtectedRange {} +impl ResponseResult for SearchDeveloperMetadataResponse {} /// The request for clearing more than one range of values in a spreadsheet. @@ -2023,75 +1966,21 @@ pub struct TextToColumnsRequest { impl Part for TextToColumnsRequest {} -/// A single grouping (either row or column) in a pivot table. +/// An error in a cell. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PivotGroup { - /// True if the pivot table should include the totals for this grouping. - #[serde(rename="showTotals")] - pub show_totals: Option, - /// The column offset of the source range that this grouping is based on. - /// - /// For example, if the source was `C10:E15`, a `sourceColumnOffset` of `0` - /// means this group refers to column `C`, whereas the offset `1` would refer - /// to column `D`. - #[serde(rename="sourceColumnOffset")] - pub source_column_offset: Option, - /// The labels to use for the row/column groups which can be customized. For - /// example, in the following pivot table, the row label is `Region` (which - /// could be renamed to `State`) and the column label is `Product` (which - /// could be renamed `Item`). Pivot tables created before December 2017 do - /// not have header labels. If you'd like to add header labels to an existing - /// pivot table, please delete the existing pivot table and then create a new - /// pivot table with same parameters. - /// - /// +--------------+---------+-------+ - /// | SUM of Units | Product | | - /// | Region | Pen | Paper | - /// +--------------+---------+-------+ - /// | New York | 345 | 98 | - /// | Oregon | 234 | 123 | - /// | Tennessee | 531 | 415 | - /// +--------------+---------+-------+ - /// | Grand Total | 1110 | 636 | - /// +--------------+---------+-------+ - pub label: Option, - /// Metadata about values in the grouping. - #[serde(rename="valueMetadata")] - pub value_metadata: Option>, - /// The bucket of the opposite pivot group to sort by. - /// If not specified, sorting is alphabetical by this group's values. - #[serde(rename="valueBucket")] - pub value_bucket: Option, - /// The order the values in this group should be sorted. - #[serde(rename="sortOrder")] - pub sort_order: Option, - /// True if the headings in this pivot group should be repeated. - /// This is only valid for row groupings and is ignored by columns. - /// - /// By default, we minimize repitition of headings by not showing higher - /// level headings where they are the same. For example, even though the - /// third row below corresponds to "Q1 Mar", "Q1" is not shown because - /// it is redundant with previous rows. Setting repeat_headings to true - /// would cause "Q1" to be repeated for "Feb" and "Mar". - /// - /// +--------------+ - /// | Q1 | Jan | - /// | | Feb | - /// | | Mar | - /// +--------+-----+ - /// | Q1 Total | - /// +--------------+ - #[serde(rename="repeatHeadings")] - pub repeat_headings: Option, - /// The group rule to apply to this row/column group. - #[serde(rename="groupRule")] - pub group_rule: Option, +pub struct ErrorValue { + /// A message with more information about the error + /// (in the spreadsheet's locale). + pub message: Option, + /// The type of error. + #[serde(rename="type")] + pub type_: Option, } -impl Part for PivotGroup {} +impl Part for ErrorValue {} /// The data included in a domain or series. @@ -2145,28 +2034,6 @@ pub struct CreateDeveloperMetadataResponse { impl Part for CreateDeveloperMetadataResponse {} -/// A request to retrieve all developer metadata matching the set of specified -/// criteria. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [developer metadata search spreadsheets](struct.SpreadsheetDeveloperMetadataSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchDeveloperMetadataRequest { - /// The data filters describing the criteria used to determine which - /// DeveloperMetadata entries to return. DeveloperMetadata matching any of the - /// specified filters will be included in the response. - #[serde(rename="dataFilters")] - pub data_filters: Option>, -} - -impl RequestValue for SearchDeveloperMetadataRequest {} - - /// A condition that can evaluate to true or false. /// BooleanConditions are used by conditional formatting, /// data validation, and the criteria in filters. @@ -2188,24 +2055,100 @@ pub struct BooleanCondition { impl Part for BooleanCondition {} -/// Settings to control how circular dependencies are resolved with iterative -/// calculation. +/// A range on a sheet. +/// All indexes are zero-based. +/// Indexes are half open, e.g the start index is inclusive +/// and the end index is exclusive -- [start_index, end_index). +/// Missing indexes indicate the range is unbounded on that side. +/// +/// For example, if `"Sheet1"` is sheet ID 0, then: +/// +/// `Sheet1!A1:A1 == sheet_id: 0, +/// start_row_index: 0, end_row_index: 1, +/// start_column_index: 0, end_column_index: 1` +/// +/// `Sheet1!A3:B4 == sheet_id: 0, +/// start_row_index: 2, end_row_index: 4, +/// start_column_index: 0, end_column_index: 2` +/// +/// `Sheet1!A:B == sheet_id: 0, +/// start_column_index: 0, end_column_index: 2` +/// +/// `Sheet1!A5:B == sheet_id: 0, +/// start_row_index: 4, +/// start_column_index: 0, end_column_index: 2` +/// +/// `Sheet1 == sheet_id:0` +/// +/// The start index must always be less than or equal to the end index. +/// If the start index equals the end index, then the range is empty. +/// Empty ranges are typically not meaningful and are usually rendered in the +/// UI as `#REF!`. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct IterativeCalculationSettings { - /// When iterative calculation is enabled and successive results differ by - /// less than this threshold value, the calculation rounds stop. - #[serde(rename="convergenceThreshold")] - pub convergence_threshold: Option, - /// When iterative calculation is enabled, the maximum number of calculation - /// rounds to perform. - #[serde(rename="maxIterations")] - pub max_iterations: Option, +pub struct GridRange { + /// The end row (exclusive) of the range, or not set if unbounded. + #[serde(rename="endRowIndex")] + pub end_row_index: Option, + /// The end column (exclusive) of the range, or not set if unbounded. + #[serde(rename="endColumnIndex")] + pub end_column_index: Option, + /// The sheet this range is on. + #[serde(rename="sheetId")] + pub sheet_id: Option, + /// The start column (inclusive) of the range, or not set if unbounded. + #[serde(rename="startColumnIndex")] + pub start_column_index: Option, + /// The start row (inclusive) of the range, or not set if unbounded. + #[serde(rename="startRowIndex")] + pub start_row_index: Option, } -impl Part for IterativeCalculationSettings {} +impl Part for GridRange {} + + +/// A histogram chart. +/// A histogram chart groups data items into bins, displaying each bin as a +/// column of stacked items. Histograms are used to display the distribution +/// of a dataset. Each column of items represents a range into which those +/// items fall. The number of bins can be chosen automatically or specified +/// explicitly. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HistogramChartSpec { + /// The outlier percentile is used to ensure that outliers do not adversely + /// affect the calculation of bucket sizes. For example, setting an outlier + /// percentile of 0.05 indicates that the top and bottom 5% of values when + /// calculating buckets. The values are still included in the chart, they will + /// be added to the first or last buckets instead of their own buckets. + /// Must be between 0.0 and 0.5. + #[serde(rename="outlierPercentile")] + pub outlier_percentile: Option, + /// The series for a histogram may be either a single series of values to be + /// bucketed or multiple series, each of the same length, containing the name + /// of the series followed by the values to be bucketed for that series. + pub series: Option>, + /// Whether horizontal divider lines should be displayed between items in each + /// column. + #[serde(rename="showItemDividers")] + pub show_item_dividers: Option, + /// The position of the chart legend. + #[serde(rename="legendPosition")] + pub legend_position: Option, + /// By default the bucket size (the range of values stacked in a single + /// column) is chosen automatically, but it may be overridden here. + /// E.g., A bucket size of 1.5 results in buckets from 0 - 1.5, 1.5 - 3.0, etc. + /// Cannot be negative. + /// This field is optional. + #[serde(rename="bucketSize")] + pub bucket_size: Option, +} + +impl Part for HistogramChartSpec {} /// The response when updating a range of values in a spreadsheet. @@ -2219,17 +2162,17 @@ impl Part for IterativeCalculationSettings {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct BatchUpdateValuesByDataFilterResponse { - /// The total number of rows where at least one cell in the row was updated. - #[serde(rename="totalUpdatedRows")] - pub total_updated_rows: Option, + /// The spreadsheet the updates were applied to. + #[serde(rename="spreadsheetId")] + pub spreadsheet_id: Option, /// The response for each range updated. pub responses: Option>, /// The total number of cells updated. #[serde(rename="totalUpdatedCells")] pub total_updated_cells: Option, - /// The spreadsheet the updates were applied to. - #[serde(rename="spreadsheetId")] - pub spreadsheet_id: Option, + /// The total number of rows where at least one cell in the row was updated. + #[serde(rename="totalUpdatedRows")] + pub total_updated_rows: Option, /// The total number of sheets where at least one cell in the sheet was /// updated. #[serde(rename="totalUpdatedSheets")] @@ -2352,41 +2295,68 @@ impl Part for MatchedDeveloperMetadata {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CandlestickData { - /// The range data (vertical axis) for the low/minimum value for each candle. - /// This is the bottom of the candle's center line. - #[serde(rename="lowSeries")] - pub low_series: Option, - /// The range data (vertical axis) for the high/maximum value for each - /// candle. This is the top of the candle's center line. - #[serde(rename="highSeries")] - pub high_series: Option, - /// The range data (vertical axis) for the open/initial value for each - /// candle. This is the bottom of the candle body. If less than the close - /// value the candle will be filled. Otherwise the candle will be hollow. - #[serde(rename="openSeries")] - pub open_series: Option, /// The range data (vertical axis) for the close/final value for each candle. /// This is the top of the candle body. If greater than the open value the /// candle will be filled. Otherwise the candle will be hollow. #[serde(rename="closeSeries")] pub close_series: Option, + /// The range data (vertical axis) for the high/maximum value for each + /// candle. This is the top of the candle's center line. + #[serde(rename="highSeries")] + pub high_series: Option, + /// The range data (vertical axis) for the low/minimum value for each candle. + /// This is the bottom of the candle's center line. + #[serde(rename="lowSeries")] + pub low_series: Option, + /// The range data (vertical axis) for the open/initial value for each + /// candle. This is the bottom of the candle body. If less than the close + /// value the candle will be filled. Otherwise the candle will be hollow. + #[serde(rename="openSeries")] + pub open_series: Option, } impl Part for CandlestickData {} -/// Clears the basic filter, if any exists on the sheet. +/// The request for updating more than one range of values in a spreadsheet. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [values batch update spreadsheets](struct.SpreadsheetValueBatchUpdateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ClearBasicFilterRequest { - /// The sheet ID on which the basic filter should be cleared. - #[serde(rename="sheetId")] - pub sheet_id: Option, +pub struct BatchUpdateValuesRequest { + /// Determines how values in the response should be rendered. + /// The default render option is ValueRenderOption.FORMATTED_VALUE. + #[serde(rename="responseValueRenderOption")] + pub response_value_render_option: Option, + /// The new values to apply to the spreadsheet. + pub data: Option>, + /// Determines if the update response should include the values + /// of the cells that were updated. By default, responses + /// do not include the updated values. The `updatedData` field within + /// each of the BatchUpdateValuesResponse.responses will contain + /// the updated values. If the range to write was larger than than the range + /// actually written, the response will include all values in the requested + /// range (excluding trailing empty rows and columns). + #[serde(rename="includeValuesInResponse")] + pub include_values_in_response: Option, + /// How the input data should be interpreted. + #[serde(rename="valueInputOption")] + pub value_input_option: Option, + /// Determines how dates, times, and durations in the response should be + /// rendered. This is ignored if response_value_render_option is + /// FORMATTED_VALUE. + /// The default dateTime render option is + /// DateTimeRenderOption.SERIAL_NUMBER. + #[serde(rename="responseDateTimeRenderOption")] + pub response_date_time_render_option: Option, } -impl Part for ClearBasicFilterRequest {} +impl RequestValue for BatchUpdateValuesRequest {} /// Updates the borders of a range. @@ -2426,22 +2396,23 @@ pub struct UpdateBordersRequest { impl Part for UpdateBordersRequest {} -/// Deletes a group over the specified range by decrementing the depth of the -/// dimensions in the range. -/// -/// For example, assume the sheet has a depth-1 group over B:E and a depth-2 -/// group over C:D. Deleting a group over D:E leaves the sheet with a -/// depth-1 group over B:D and a depth-2 group over C:C. +/// Deletes a range of cells, shifting other cells into the deleted area. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteDimensionGroupRequest { - /// The range of the group to be deleted. - pub range: Option, +pub struct DeleteRangeRequest { + /// The range of cells to delete. + pub range: Option, + /// The dimension from which deleted cells will be replaced with. + /// If ROWS, existing cells will be shifted upward to + /// replace the deleted cells. If COLUMNS, existing cells + /// will be shifted left to replace the deleted cells. + #[serde(rename="shiftDimension")] + pub shift_dimension: Option, } -impl Part for DeleteDimensionGroupRequest {} +impl Part for DeleteRangeRequest {} /// A border along a cell. @@ -2476,35 +2447,32 @@ pub struct TextPosition { impl Part for TextPosition {} -/// Data in the grid, as well as metadata about the dimensions. +/// The value of the condition. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GridData { - /// The first row this GridData refers to, zero-based. - #[serde(rename="startRow")] - pub start_row: Option, - /// The first column this GridData refers to, zero-based. - #[serde(rename="startColumn")] - pub start_column: Option, - /// Metadata about the requested columns in the grid, starting with the column - /// in start_column. - #[serde(rename="columnMetadata")] - pub column_metadata: Option>, - /// Metadata about the requested rows in the grid, starting with the row - /// in start_row. - #[serde(rename="rowMetadata")] - pub row_metadata: Option>, - /// The data in the grid, one entry per row, - /// starting with the row in startRow. - /// The values in RowData will correspond to columns starting - /// at start_column. - #[serde(rename="rowData")] - pub row_data: Option>, +pub struct ConditionValue { + /// A relative date (based on the current date). + /// Valid only if the type is + /// DATE_BEFORE, + /// DATE_AFTER, + /// DATE_ON_OR_BEFORE or + /// DATE_ON_OR_AFTER. + /// + /// Relative dates are not supported in data validation. + /// They are supported only in conditional formatting and + /// conditional filters. + #[serde(rename="relativeDate")] + pub relative_date: Option, + /// A value the condition is based on. + /// The value is parsed as if the user typed into a cell. + /// Formulas are supported (and must begin with an `=` or a '+'). + #[serde(rename="userEnteredValue")] + pub user_entered_value: Option, } -impl Part for GridData {} +impl Part for ConditionValue {} /// A value range that was matched by one or more data filers. @@ -2525,6 +2493,33 @@ pub struct MatchedValueRange { impl Part for MatchedValueRange {} +/// Inserts rows or columns in a sheet at a particular index. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InsertDimensionRequest { + /// Whether dimension properties should be extended from the dimensions + /// before or after the newly inserted dimensions. + /// True to inherit from the dimensions before (in which case the start + /// index must be greater than 0), and false to inherit from the dimensions + /// after. + /// + /// For example, if row index 0 has red background and row index 1 + /// has a green background, then inserting 2 rows at index 1 can inherit + /// either the green or red background. If `inheritFromBefore` is true, + /// the two new rows will be red (because the row before the insertion point + /// was red), whereas if `inheritFromBefore` is false, the two new rows will + /// be green (because the row after the insertion point was green). + #[serde(rename="inheritFromBefore")] + pub inherit_from_before: Option, + /// The dimensions to insert. Both the start and end indexes must be bounded. + pub range: Option, +} + +impl Part for InsertDimensionRequest {} + + /// A request to delete developer metadata. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -2591,31 +2586,28 @@ pub struct BatchClearValuesResponse { impl ResponseResult for BatchClearValuesResponse {} -/// Moves one or more rows or columns. +/// Properties about a dimension. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MoveDimensionRequest { - /// The source dimensions to move. - pub source: Option, - /// The zero-based start index of where to move the source data to, - /// based on the coordinates *before* the source data is removed - /// from the grid. Existing data will be shifted down or right - /// (depending on the dimension) to make room for the moved dimensions. - /// The source dimensions are removed from the grid, so the - /// the data may end up in a different index than specified. - /// - /// For example, given `A1..A5` of `0, 1, 2, 3, 4` and wanting to move - /// `"1"` and `"2"` to between `"3"` and `"4"`, the source would be - /// `ROWS [1..3)`,and the destination index would be `"4"` - /// (the zero-based index of row 5). - /// The end result would be `A1..A5` of `0, 3, 1, 2, 4`. - #[serde(rename="destinationIndex")] - pub destination_index: Option, +pub struct DimensionProperties { + /// The height (if a row) or width (if a column) of the dimension in pixels. + #[serde(rename="pixelSize")] + pub pixel_size: Option, + /// The developer metadata associated with a single row or column. + #[serde(rename="developerMetadata")] + pub developer_metadata: Option>, + /// True if this dimension is explicitly hidden. + #[serde(rename="hiddenByUser")] + pub hidden_by_user: Option, + /// True if this dimension is being filtered. + /// This field is read-only. + #[serde(rename="hiddenByFilter")] + pub hidden_by_filter: Option, } -impl Part for MoveDimensionRequest {} +impl Part for DimensionProperties {} /// The result of adding a chart to a spreadsheet. @@ -2690,19 +2682,6 @@ pub struct BatchGetValuesByDataFilterRequest { impl RequestValue for BatchGetValuesByDataFilterRequest {} -/// Sets the basic filter associated with a sheet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SetBasicFilterRequest { - /// The filter to set. - pub filter: Option, -} - -impl Part for SetBasicFilterRequest {} - - /// The response when updating a range of values by a data filter in a /// spreadsheet. /// @@ -3066,38 +3045,6 @@ pub struct Padding { impl Part for Padding {} -/// A pivot table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PivotTable { - /// The range the pivot table is reading data from. - pub source: Option, - /// Whether values should be listed horizontally (as columns) - /// or vertically (as rows). - #[serde(rename="valueLayout")] - pub value_layout: Option, - /// Each row grouping in the pivot table. - pub rows: Option>, - /// A list of values to include in the pivot table. - pub values: Option>, - /// An optional mapping of filters per source column offset. - /// - /// The filters are applied before aggregating data into the pivot table. - /// The map's key is the column offset of the source range that you want to - /// filter, and the value is the criteria for that column. - /// - /// For example, if the source was `C10:E15`, a key of `0` will have the filter - /// for column `C`, whereas the key `1` is for column `D`. - pub criteria: Option>, - /// Each column grouping in the pivot table. - pub columns: Option>, -} - -impl Part for PivotTable {} - - /// A data validation rule. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -3167,66 +3114,43 @@ pub struct ExtendedValue { impl Part for ExtendedValue {} -/// A single response from an update. +/// Deletes a group over the specified range by decrementing the depth of the +/// dimensions in the range. +/// +/// For example, assume the sheet has a depth-1 group over B:E and a depth-2 +/// group over C:D. Deleting a group over D:E leaves the sheet with a +/// depth-1 group over B:D and a depth-2 group over C:C. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Response { - /// A reply from duplicating a filter view. - #[serde(rename="duplicateFilterView")] - pub duplicate_filter_view: Option, - /// A reply from creating a developer metadata entry. - #[serde(rename="createDeveloperMetadata")] - pub create_developer_metadata: Option, - /// A reply from deleting a dimension group. - #[serde(rename="deleteDimensionGroup")] - pub delete_dimension_group: Option, - /// A reply from updating a conditional format rule. - #[serde(rename="updateConditionalFormatRule")] - pub update_conditional_format_rule: Option, - /// A reply from adding a named range. - #[serde(rename="addNamedRange")] - pub add_named_range: Option, - /// A reply from adding a protected range. - #[serde(rename="addProtectedRange")] - pub add_protected_range: Option, - /// A reply from updating a developer metadata entry. - #[serde(rename="updateDeveloperMetadata")] - pub update_developer_metadata: Option, - /// A reply from adding a dimension group. - #[serde(rename="addDimensionGroup")] - pub add_dimension_group: Option, - /// A reply from adding a banded range. - #[serde(rename="addBanding")] - pub add_banding: Option, - /// A reply from adding a filter view. - #[serde(rename="addFilterView")] - pub add_filter_view: Option, - /// A reply from updating an embedded object's position. - #[serde(rename="updateEmbeddedObjectPosition")] - pub update_embedded_object_position: Option, - /// A reply from duplicating a sheet. - #[serde(rename="duplicateSheet")] - pub duplicate_sheet: Option, - /// A reply from deleting a developer metadata entry. - #[serde(rename="deleteDeveloperMetadata")] - pub delete_developer_metadata: Option, - /// A reply from adding a chart. - #[serde(rename="addChart")] - pub add_chart: Option, - /// A reply from adding a sheet. - #[serde(rename="addSheet")] - pub add_sheet: Option, - /// A reply from doing a find/replace. - #[serde(rename="findReplace")] - pub find_replace: Option, - /// A reply from deleting a conditional format rule. - #[serde(rename="deleteConditionalFormatRule")] - pub delete_conditional_format_rule: Option, +pub struct DeleteDimensionGroupRequest { + /// The range of the group to be deleted. + pub range: Option, } -impl Part for Response {} +impl Part for DeleteDimensionGroupRequest {} + + +/// A rule that may or may not match, depending on the condition. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BooleanRule { + /// The condition of the rule. If the condition evaluates to true, + /// the format is applied. + pub condition: Option, + /// The format to apply. + /// Conditional formatting can only apply a subset of formatting: + /// bold, italic, + /// strikethrough, + /// foreground color & + /// background color. + pub format: Option, +} + +impl Part for BooleanRule {} /// Adds a named range to the spreadsheet. @@ -3397,77 +3321,90 @@ pub struct BatchGetValuesResponse { impl ResponseResult for BatchGetValuesResponse {} -/// A coordinate in a sheet. -/// All indexes are zero-based. +/// The result of adding a new protected range. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GridCoordinate { - /// The row index of the coordinate. - #[serde(rename="rowIndex")] - pub row_index: Option, - /// The column index of the coordinate. - #[serde(rename="columnIndex")] - pub column_index: Option, - /// The sheet this coordinate is on. - #[serde(rename="sheetId")] - pub sheet_id: Option, +pub struct AddProtectedRangeResponse { + /// The newly added protected range. + #[serde(rename="protectedRange")] + pub protected_range: Option, } -impl Part for GridCoordinate {} +impl Part for AddProtectedRangeResponse {} -/// A single series of data for a waterfall chart. +/// Allows you to organize the date-time values in a source data column into +/// buckets based on selected parts of their date or time values. For example, +/// consider a pivot table showing sales transactions by date: +/// +/// +----------+--------------+ +/// | Date | SUM of Sales | +/// +----------+--------------+ +/// | 1/1/2017 | $621.14 | +/// | 2/3/2017 | $708.84 | +/// | 5/8/2017 | $326.84 | +/// ... +/// +----------+--------------+ +/// Applying a date-time group rule with a DateTimeRuleType of YEAR_MONTH +/// results in the following pivot table. +/// +/// +--------------+--------------+ +/// | Grouped Date | SUM of Sales | +/// +--------------+--------------+ +/// | 2017-Jan | $53,731.78 | +/// | 2017-Feb | $83,475.32 | +/// | 2017-Mar | $94,385.05 | +/// ... +/// +--------------+--------------+ /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WaterfallChartSeries { - /// Styles for all columns in this series with negative values. - #[serde(rename="negativeColumnsStyle")] - pub negative_columns_style: Option, - /// True to hide the subtotal column from the end of the series. By default, - /// a subtotal column will appear at the end of each series. Setting this - /// field to true will hide that subtotal column for this series. - #[serde(rename="hideTrailingSubtotal")] - pub hide_trailing_subtotal: Option, - /// Styles for all columns in this series with positive values. - #[serde(rename="positiveColumnsStyle")] - pub positive_columns_style: Option, - /// The data being visualized in this series. - pub data: Option, - /// Custom subtotal columns appearing in this series. The order in which - /// subtotals are defined is not significant. Only one subtotal may be - /// defined for each data point. - #[serde(rename="customSubtotals")] - pub custom_subtotals: Option>, - /// Styles for all subtotal columns in this series. - #[serde(rename="subtotalColumnsStyle")] - pub subtotal_columns_style: Option, +pub struct DateTimeRule { + /// The type of date-time grouping to apply. + #[serde(rename="type")] + pub type_: Option, } -impl Part for WaterfallChartSeries {} +impl Part for DateTimeRule {} -/// The request for clearing more than one range selected by a -/// DataFilter in a spreadsheet. +/// The response when updating a range of values in a spreadsheet. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [values batch clear by data filter spreadsheets](struct.SpreadsheetValueBatchClearByDataFilterCall.html) (request) +/// * [values update spreadsheets](struct.SpreadsheetValueUpdateCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchClearValuesByDataFilterRequest { - /// The DataFilters used to determine which ranges to clear. - #[serde(rename="dataFilters")] - pub data_filters: Option>, +pub struct UpdateValuesResponse { + /// The number of columns where at least one cell in the column was updated. + #[serde(rename="updatedColumns")] + pub updated_columns: Option, + /// The range (in A1 notation) that updates were applied to. + #[serde(rename="updatedRange")] + pub updated_range: Option, + /// The number of rows where at least one cell in the row was updated. + #[serde(rename="updatedRows")] + pub updated_rows: Option, + /// The values of the cells after updates were applied. + /// This is only included if the request's `includeValuesInResponse` field + /// was `true`. + #[serde(rename="updatedData")] + pub updated_data: Option, + /// The spreadsheet the updates were applied to. + #[serde(rename="spreadsheetId")] + pub spreadsheet_id: Option, + /// The number of cells updated. + #[serde(rename="updatedCells")] + pub updated_cells: Option, } -impl RequestValue for BatchClearValuesByDataFilterRequest {} +impl ResponseResult for UpdateValuesResponse {} /// The series of a CandlestickData. @@ -3574,24 +3511,18 @@ pub struct BandedRange { impl Part for BandedRange {} -/// The number format of a cell. +/// The response from updating developer metadata. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NumberFormat { - /// Pattern string used for formatting. If not set, a default pattern based on - /// the user's locale will be used if necessary for the given type. - /// See the [Date and Number Formats guide](/sheets/api/guides/formats) for more - /// information about the supported patterns. - pub pattern: Option, - /// The type of the number format. - /// When writing, this field must be set. - #[serde(rename="type")] - pub type_: Option, +pub struct UpdateDeveloperMetadataResponse { + /// The updated developer metadata. + #[serde(rename="developerMetadata")] + pub developer_metadata: Option>, } -impl Part for NumberFormat {} +impl Part for UpdateDeveloperMetadataResponse {} /// Properties of a grid. @@ -3626,25 +3557,98 @@ pub struct GridProperties { impl Part for GridProperties {} -/// A rule that may or may not match, depending on the condition. +/// A single response from an update. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BooleanRule { - /// The condition of the rule. If the condition evaluates to true, - /// the format is applied. - pub condition: Option, - /// The format to apply. - /// Conditional formatting can only apply a subset of formatting: - /// bold, italic, - /// strikethrough, - /// foreground color & - /// background color. - pub format: Option, +pub struct Response { + /// A reply from duplicating a filter view. + #[serde(rename="duplicateFilterView")] + pub duplicate_filter_view: Option, + /// A reply from updating an embedded object's position. + #[serde(rename="updateEmbeddedObjectPosition")] + pub update_embedded_object_position: Option, + /// A reply from deleting a dimension group. + #[serde(rename="deleteDimensionGroup")] + pub delete_dimension_group: Option, + /// A reply from updating a conditional format rule. + #[serde(rename="updateConditionalFormatRule")] + pub update_conditional_format_rule: Option, + /// A reply from adding a named range. + #[serde(rename="addNamedRange")] + pub add_named_range: Option, + /// A reply from adding a protected range. + #[serde(rename="addProtectedRange")] + pub add_protected_range: Option, + /// A reply from updating a developer metadata entry. + #[serde(rename="updateDeveloperMetadata")] + pub update_developer_metadata: Option, + /// A reply from adding a dimension group. + #[serde(rename="addDimensionGroup")] + pub add_dimension_group: Option, + /// A reply from adding a banded range. + #[serde(rename="addBanding")] + pub add_banding: Option, + /// A reply from adding a filter view. + #[serde(rename="addFilterView")] + pub add_filter_view: Option, + /// A reply from duplicating a sheet. + #[serde(rename="duplicateSheet")] + pub duplicate_sheet: Option, + /// A reply from deleting a developer metadata entry. + #[serde(rename="deleteDeveloperMetadata")] + pub delete_developer_metadata: Option, + /// A reply from adding a chart. + #[serde(rename="addChart")] + pub add_chart: Option, + /// A reply from creating a developer metadata entry. + #[serde(rename="createDeveloperMetadata")] + pub create_developer_metadata: Option, + /// A reply from adding a sheet. + #[serde(rename="addSheet")] + pub add_sheet: Option, + /// A reply from doing a find/replace. + #[serde(rename="findReplace")] + pub find_replace: Option, + /// A reply from deleting a conditional format rule. + #[serde(rename="deleteConditionalFormatRule")] + pub delete_conditional_format_rule: Option, } -impl Part for BooleanRule {} +impl Part for Response {} + + +/// The rotation applied to text in a cell. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TextRotation { + /// The angle between the standard orientation and the desired orientation. + /// Measured in degrees. Valid values are between -90 and 90. Positive + /// angles are angled upwards, negative are angled downwards. + /// + /// Note: For LTR text direction positive angles are in the + /// counterclockwise direction, whereas for RTL they are in the clockwise + /// direction + pub angle: Option, + /// If true, text reads top to bottom, but the orientation of individual + /// characters is unchanged. + /// For example: + /// + /// | V | + /// | e | + /// | r | + /// | t | + /// | i | + /// | c | + /// | a | + /// | l | + pub vertical: Option, +} + +impl Part for TextRotation {} /// A single series of data in a chart. @@ -3723,13 +3727,1264 @@ pub struct BatchUpdateSpreadsheetRequest { impl RequestValue for BatchUpdateSpreadsheetRequest {} +/// Updates the state of the specified group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UpdateDimensionGroupRequest { + /// The fields that should be updated. At least one field must be specified. + /// The root `dimensionGroup` is implied and should not be specified. + /// A single `"*"` can be used as short-hand for listing every field. + pub fields: Option, + /// The group whose state should be updated. The range and depth of the group + /// should specify a valid group on the sheet, and all other fields updated. + #[serde(rename="dimensionGroup")] + pub dimension_group: Option, +} + +impl Part for UpdateDimensionGroupRequest {} + + +/// The request for updating more than one range of values in a spreadsheet. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [values batch update by data filter spreadsheets](struct.SpreadsheetValueBatchUpdateByDataFilterCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchUpdateValuesByDataFilterRequest { + /// Determines how values in the response should be rendered. + /// The default render option is ValueRenderOption.FORMATTED_VALUE. + #[serde(rename="responseValueRenderOption")] + pub response_value_render_option: Option, + /// The new values to apply to the spreadsheet. If more than one range is + /// matched by the specified DataFilter the specified values will be + /// applied to all of those ranges. + pub data: Option>, + /// Determines if the update response should include the values + /// of the cells that were updated. By default, responses + /// do not include the updated values. The `updatedData` field within + /// each of the BatchUpdateValuesResponse.responses will contain + /// the updated values. If the range to write was larger than than the range + /// actually written, the response will include all values in the requested + /// range (excluding trailing empty rows and columns). + #[serde(rename="includeValuesInResponse")] + pub include_values_in_response: Option, + /// How the input data should be interpreted. + #[serde(rename="valueInputOption")] + pub value_input_option: Option, + /// Determines how dates, times, and durations in the response should be + /// rendered. This is ignored if response_value_render_option is + /// FORMATTED_VALUE. + /// The default dateTime render option is + /// DateTimeRenderOption.SERIAL_NUMBER. + #[serde(rename="responseDateTimeRenderOption")] + pub response_date_time_render_option: Option, +} + +impl RequestValue for BatchUpdateValuesByDataFilterRequest {} + + +/// Automatically resizes one or more dimensions based on the contents +/// of the cells in that dimension. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AutoResizeDimensionsRequest { + /// The dimensions to automatically resize. + pub dimensions: Option, +} + +impl Part for AutoResizeDimensionsRequest {} + + +/// Data in the grid, as well as metadata about the dimensions. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GridData { + /// Metadata about the requested rows in the grid, starting with the row + /// in start_row. + #[serde(rename="rowMetadata")] + pub row_metadata: Option>, + /// The first column this GridData refers to, zero-based. + #[serde(rename="startColumn")] + pub start_column: Option, + /// Metadata about the requested columns in the grid, starting with the column + /// in start_column. + #[serde(rename="columnMetadata")] + pub column_metadata: Option>, + /// The first row this GridData refers to, zero-based. + #[serde(rename="startRow")] + pub start_row: Option, + /// The data in the grid, one entry per row, + /// starting with the row in startRow. + /// The values in RowData will correspond to columns starting + /// at start_column. + #[serde(rename="rowData")] + pub row_data: Option>, +} + +impl Part for GridData {} + + +/// The result of a filter view being duplicated. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DuplicateFilterViewResponse { + /// The newly created filter. + pub filter: Option, +} + +impl Part for DuplicateFilterViewResponse {} + + +/// Filter that describes what data should be selected or returned from a +/// request. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DataFilter { + /// Selects data associated with the developer metadata matching the criteria + /// described by this DeveloperMetadataLookup. + #[serde(rename="developerMetadataLookup")] + pub developer_metadata_lookup: Option, + /// Selects data that matches the specified A1 range. + #[serde(rename="a1Range")] + pub a1_range: Option, + /// Selects data that matches the range described by the GridRange. + #[serde(rename="gridRange")] + pub grid_range: Option, +} + +impl Part for DataFilter {} + + +/// Removes the named range with the given ID from the spreadsheet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteNamedRangeRequest { + /// The ID of the named range to delete. + #[serde(rename="namedRangeId")] + pub named_range_id: Option, +} + +impl Part for DeleteNamedRangeRequest {} + + +/// Developer metadata associated with a location or object in a spreadsheet. +/// Developer metadata may be used to associate arbitrary data with various +/// parts of a spreadsheet and will remain associated at those locations as they +/// move around and the spreadsheet is edited. For example, if developer +/// metadata is associated with row 5 and another row is then subsequently +/// inserted above row 5, that original metadata will still be associated with +/// the row it was first associated with (what is now row 6). If the associated +/// object is deleted its metadata is deleted too. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [developer metadata get spreadsheets](struct.SpreadsheetDeveloperMetadataGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeveloperMetadata { + /// The spreadsheet-scoped unique ID that identifies the metadata. IDs may be + /// specified when metadata is created, otherwise one will be randomly + /// generated and assigned. Must be positive. + #[serde(rename="metadataId")] + pub metadata_id: Option, + /// Data associated with the metadata's key. + #[serde(rename="metadataValue")] + pub metadata_value: Option, + /// The location where the metadata is associated. + pub location: Option, + /// The metadata visibility. Developer metadata must always have a visibility + /// specified. + pub visibility: Option, + /// The metadata key. There may be multiple metadata in a spreadsheet with the + /// same key. Developer metadata must always have a key specified. + #[serde(rename="metadataKey")] + pub metadata_key: Option, +} + +impl ResponseResult for DeveloperMetadata {} + + +/// Updates all cells in a range with new data. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UpdateCellsRequest { + /// The fields of CellData that should be updated. + /// At least one field must be specified. + /// The root is the CellData; 'row.values.' should not be specified. + /// A single `"*"` can be used as short-hand for listing every field. + pub fields: Option, + /// The range to write data to. + /// + /// If the data in rows does not cover the entire requested range, + /// the fields matching those set in fields will be cleared. + pub range: Option, + /// The data to write. + pub rows: Option>, + /// The coordinate to start writing data at. + /// Any number of rows and columns (including a different number of + /// columns per row) may be written. + pub start: Option, +} + +impl Part for UpdateCellsRequest {} + + +/// Source ranges for a chart. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChartSourceRange { + /// The ranges of data for a series or domain. + /// Exactly one dimension must have a length of 1, + /// and all sources in the list must have the same dimension + /// with length 1. + /// The domain (if it exists) & all series must have the same number + /// of source ranges. If using more than one source range, then the source + /// range at a given offset must be in order and contiguous across the domain + /// and series. + /// + /// For example, these are valid configurations: + /// + /// domain sources: A1:A5 + /// series1 sources: B1:B5 + /// series2 sources: D6:D10 + /// + /// domain sources: A1:A5, C10:C12 + /// series1 sources: B1:B5, D10:D12 + /// series2 sources: C1:C5, E10:E12 + pub sources: Option>, +} + +impl Part for ChartSourceRange {} + + +/// Deletes the dimensions from the sheet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteDimensionRequest { + /// The dimensions to delete from the sheet. + pub range: Option, +} + +impl Part for DeleteDimensionRequest {} + + +/// Properties that describe the style of a line. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LineStyle { + /// The thickness of the line, in px. + pub width: Option, + /// The dash type of the line. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for LineStyle {} + + +/// Creates a group over the specified range. +/// +/// If the requested range is a superset of the range of an existing group G, +/// then the depth of G is incremented and this new group G' has the +/// depth of that group. For example, a group [C:D, depth 1] + [B:E] results in +/// groups [B:E, depth 1] and [C:D, depth 2]. +/// If the requested range is a subset of the range of an existing group G, +/// then the depth of the new group G' becomes one greater than the depth of G. +/// For example, a group [B:E, depth 1] + [C:D] results in groups [B:E, depth 1] +/// and [C:D, depth 2]. +/// If the requested range starts before and ends within, or starts within and +/// ends after, the range of an existing group G, then the range of the existing +/// group G becomes the union of the ranges, and the new group G' has +/// depth one greater than the depth of G and range as the intersection of the +/// ranges. For example, a group [B:D, depth 1] + [C:E] results in groups [B:E, +/// depth 1] and [C:D, depth 2]. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AddDimensionGroupRequest { + /// The range over which to create a group. + pub range: Option, +} + +impl Part for AddDimensionGroupRequest {} + + +/// Properties referring a single dimension (either row or column). If both +/// BandedRange.row_properties and BandedRange.column_properties are +/// set, the fill colors are applied to cells according to the following rules: +/// +/// * header_color and footer_color take priority over band colors. +/// * first_band_color takes priority over second_band_color. +/// * row_properties takes priority over column_properties. +/// +/// For example, the first row color takes priority over the first column +/// color, but the first column color takes priority over the second row color. +/// Similarly, the row header takes priority over the column header in the +/// top left cell, but the column header takes priority over the first row +/// color if the row header is not set. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BandingProperties { + /// The second color that is alternating. (Required) + #[serde(rename="secondBandColor")] + pub second_band_color: Option, + /// The color of the first row or column. If this field is set, the first + /// row or column will be filled with this color and the colors will + /// alternate between first_band_color and second_band_color starting + /// from the second row or column. Otherwise, the first row or column will be + /// filled with first_band_color and the colors will proceed to alternate + /// as they normally would. + #[serde(rename="headerColor")] + pub header_color: Option, + /// The color of the last row or column. If this field is not set, the last + /// row or column will be filled with either first_band_color or + /// second_band_color, depending on the color of the previous row or + /// column. + #[serde(rename="footerColor")] + pub footer_color: Option, + /// The first color that is alternating. (Required) + #[serde(rename="firstBandColor")] + pub first_band_color: Option, +} + +impl Part for BandingProperties {} + + +/// A histogram series containing the series color and data. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HistogramSeries { + /// The color of the column representing this series in each bucket. + /// This field is optional. + #[serde(rename="barColor")] + pub bar_color: Option, + /// The data for this histogram series. + pub data: Option, +} + +impl Part for HistogramSeries {} + + +/// The domain of a chart. +/// For example, if charting stock prices over time, this would be the date. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BasicChartDomain { + /// The data of the domain. For example, if charting stock prices over time, + /// this is the data representing the dates. + pub domain: Option, + /// True to reverse the order of the domain values (horizontal axis). + pub reversed: Option, +} + +impl Part for BasicChartDomain {} + + +/// The result of deleting a group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteDimensionGroupResponse { + /// All groups of a dimension after deleting a group from that dimension. + #[serde(rename="dimensionGroups")] + pub dimension_groups: Option>, +} + +impl Part for DeleteDimensionGroupResponse {} + + +/// Styles for a waterfall chart column. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WaterfallChartColumnStyle { + /// The color of the column. + pub color: Option, + /// The label of the column's legend. + pub label: Option, +} + +impl Part for WaterfallChartColumnStyle {} + + +/// The format of a cell. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CellFormat { + /// A format describing how number values should be represented to the user. + #[serde(rename="numberFormat")] + pub number_format: Option, + /// The direction of the text in the cell. + #[serde(rename="textDirection")] + pub text_direction: Option, + /// The padding of the cell. + pub padding: Option, + /// The vertical alignment of the value in the cell. + #[serde(rename="verticalAlignment")] + pub vertical_alignment: Option, + /// The background color of the cell. + #[serde(rename="backgroundColor")] + pub background_color: Option, + /// The horizontal alignment of the value in the cell. + #[serde(rename="horizontalAlignment")] + pub horizontal_alignment: Option, + /// The borders of the cell. + pub borders: Option, + /// The rotation applied to text in a cell + #[serde(rename="textRotation")] + pub text_rotation: Option, + /// How a hyperlink, if it exists, should be displayed in the cell. + #[serde(rename="hyperlinkDisplayType")] + pub hyperlink_display_type: Option, + /// The format of the text in the cell (unless overridden by a format run). + #[serde(rename="textFormat")] + pub text_format: Option, + /// The wrap strategy for the value in the cell. + #[serde(rename="wrapStrategy")] + pub wrap_strategy: Option, +} + +impl Part for CellFormat {} + + +/// Sorts data in rows based on a sort order per column. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SortRangeRequest { + /// The range to sort. + pub range: Option, + /// The sort order per column. Later specifications are used when values + /// are equal in the earlier specifications. + #[serde(rename="sortSpecs")] + pub sort_specs: Option>, +} + +impl Part for SortRangeRequest {} + + +/// A filter view. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FilterView { + /// The range this filter view covers. + /// + /// When writing, only one of range or named_range_id + /// may be set. + pub range: Option, + /// The sort order per column. Later specifications are used when values + /// are equal in the earlier specifications. + #[serde(rename="sortSpecs")] + pub sort_specs: Option>, + /// The name of the filter view. + pub title: Option, + /// The named range this filter view is backed by, if any. + /// + /// When writing, only one of range or named_range_id + /// may be set. + #[serde(rename="namedRangeId")] + pub named_range_id: Option, + /// The criteria for showing/hiding values per column. + /// The map's key is the column index, and the value is the criteria for + /// that column. + pub criteria: Option>, + /// The ID of the filter view. + #[serde(rename="filterViewId")] + pub filter_view_id: Option, +} + +impl Part for FilterView {} + + +/// The definition of how a value in a pivot table should be calculated. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PivotValue { + /// A custom formula to calculate the value. The formula must start + /// with an `=` character. + pub formula: Option, + /// A function to summarize the value. + /// If formula is set, the only supported values are + /// SUM and + /// CUSTOM. + /// If sourceColumnOffset is set, then `CUSTOM` + /// is not supported. + #[serde(rename="summarizeFunction")] + pub summarize_function: Option, + /// A name to use for the value. + pub name: Option, + /// The column offset of the source range that this value reads from. + /// + /// For example, if the source was `C10:E15`, a `sourceColumnOffset` of `0` + /// means this value refers to column `C`, whereas the offset `1` would + /// refer to column `D`. + #[serde(rename="sourceColumnOffset")] + pub source_column_offset: Option, + /// If specified, indicates that pivot values should be displayed as + /// the result of a calculation with another pivot value. For example, if + /// calculated_display_type is specified as PERCENT_OF_GRAND_TOTAL, all the + /// pivot values are displayed as the percentage of the grand total. In + /// the Sheets UI, this is referred to as "Show As" in the value section of a + /// pivot table. + #[serde(rename="calculatedDisplayType")] + pub calculated_display_type: Option, +} + +impl Part for PivotValue {} + + +/// Adds a new sheet. +/// When a sheet is added at a given index, +/// all subsequent sheets' indexes are incremented. +/// To add an object sheet, use AddChartRequest instead and specify +/// EmbeddedObjectPosition.sheetId or +/// EmbeddedObjectPosition.newSheet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AddSheetRequest { + /// The properties the new sheet should have. + /// All properties are optional. + /// The sheetId field is optional; if one is not + /// set, an id will be randomly generated. (It is an error to specify the ID + /// of a sheet that already exists.) + pub properties: Option, +} + +impl Part for AddSheetRequest {} + + +/// Appends rows or columns to the end of a sheet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AppendDimensionRequest { + /// The number of rows or columns to append. + pub length: Option, + /// Whether rows or columns should be appended. + pub dimension: Option, + /// The sheet to append rows or columns to. + #[serde(rename="sheetId")] + pub sheet_id: Option, +} + +impl Part for AppendDimensionRequest {} + + +/// Randomizes the order of the rows in a range. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RandomizeRangeRequest { + /// The range to randomize. + pub range: Option, +} + +impl Part for RandomizeRangeRequest {} + + +/// Clears the basic filter, if any exists on the sheet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClearBasicFilterRequest { + /// The sheet ID on which the basic filter should be cleared. + #[serde(rename="sheetId")] + pub sheet_id: Option, +} + +impl Part for ClearBasicFilterRequest {} + + +/// A range of values whose location is specified by a DataFilter. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DataFilterValueRange { + /// The data filter describing the location of the values in the spreadsheet. + #[serde(rename="dataFilter")] + pub data_filter: Option, + /// The data to be written. If the provided values exceed any of the ranges + /// matched by the data filter then the request will fail. If the provided + /// values are less than the matched ranges only the specified values will be + /// written, existing values in the matched ranges will remain unaffected. + pub values: Option>>, + /// The major dimension of the values. + #[serde(rename="majorDimension")] + pub major_dimension: Option, +} + +impl Part for DataFilterValueRange {} + + +/// Updates a chart's specifications. +/// (This does not move or resize a chart. To move or resize a chart, use +/// UpdateEmbeddedObjectPositionRequest.) +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UpdateChartSpecRequest { + /// The ID of the chart to update. + #[serde(rename="chartId")] + pub chart_id: Option, + /// The specification to apply to the chart. + pub spec: Option, +} + +impl Part for UpdateChartSpecRequest {} + + +/// Deletes the embedded object with the given ID. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteEmbeddedObjectRequest { + /// The ID of the embedded object to delete. + #[serde(rename="objectId")] + pub object_id: Option, +} + +impl Part for DeleteEmbeddedObjectRequest {} + + +/// The request to copy a sheet across spreadsheets. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sheets copy to spreadsheets](struct.SpreadsheetSheetCopyToCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CopySheetToAnotherSpreadsheetRequest { + /// The ID of the spreadsheet to copy the sheet to. + #[serde(rename="destinationSpreadsheetId")] + pub destination_spreadsheet_id: Option, +} + +impl RequestValue for CopySheetToAnotherSpreadsheetRequest {} + + +/// A pivot table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PivotTable { + /// The range the pivot table is reading data from. + pub source: Option, + /// Whether values should be listed horizontally (as columns) + /// or vertically (as rows). + #[serde(rename="valueLayout")] + pub value_layout: Option, + /// Each row grouping in the pivot table. + pub rows: Option>, + /// A list of values to include in the pivot table. + pub values: Option>, + /// An optional mapping of filters per source column offset. + /// + /// The filters are applied before aggregating data into the pivot table. + /// The map's key is the column offset of the source range that you want to + /// filter, and the value is the criteria for that column. + /// + /// For example, if the source was `C10:E15`, a key of `0` will have the filter + /// for column `C`, whereas the key `1` is for column `D`. + pub criteria: Option>, + /// Each column grouping in the pivot table. + pub columns: Option>, +} + +impl Part for PivotTable {} + + +/// The response when clearing a range of values in a spreadsheet. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [values clear spreadsheets](struct.SpreadsheetValueClearCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClearValuesResponse { + /// The spreadsheet the updates were applied to. + #[serde(rename="spreadsheetId")] + pub spreadsheet_id: Option, + /// The range (in A1 notation) that was cleared. + /// (If the request was for an unbounded range or a ranger larger + /// than the bounds of the sheet, this will be the actual range + /// that was cleared, bounded to the sheet's limits.) + #[serde(rename="clearedRange")] + pub cleared_range: Option, +} + +impl ResponseResult for ClearValuesResponse {} + + +/// Data about each cell in a row. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RowData { + /// The values in the row, one per column. + pub values: Option>, +} + +impl Part for RowData {} + + +/// A coordinate in a sheet. +/// All indexes are zero-based. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GridCoordinate { + /// The row index of the coordinate. + #[serde(rename="rowIndex")] + pub row_index: Option, + /// The column index of the coordinate. + #[serde(rename="columnIndex")] + pub column_index: Option, + /// The sheet this coordinate is on. + #[serde(rename="sheetId")] + pub sheet_id: Option, +} + +impl Part for GridCoordinate {} + + +/// Duplicates the contents of a sheet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DuplicateSheetRequest { + /// The name of the new sheet. If empty, a new name is chosen for you. + #[serde(rename="newSheetName")] + pub new_sheet_name: Option, + /// The zero-based index where the new sheet should be inserted. + /// The index of all sheets after this are incremented. + #[serde(rename="insertSheetIndex")] + pub insert_sheet_index: Option, + /// The sheet to duplicate. + #[serde(rename="sourceSheetId")] + pub source_sheet_id: Option, + /// If set, the ID of the new sheet. If not set, an ID is chosen. + /// If set, the ID must not conflict with any existing sheet ID. + /// If set, it must be non-negative. + #[serde(rename="newSheetId")] + pub new_sheet_id: Option, +} + +impl Part for DuplicateSheetRequest {} + + +/// A single kind of update to apply to a spreadsheet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Request { + /// Duplicates a filter view. + #[serde(rename="duplicateFilterView")] + pub duplicate_filter_view: Option, + /// Sorts data in a range. + #[serde(rename="sortRange")] + pub sort_range: Option, + /// Updates an embedded object's (e.g. chart, image) position. + #[serde(rename="updateEmbeddedObjectPosition")] + pub update_embedded_object_position: Option, + /// Updates an existing conditional format rule. + #[serde(rename="updateConditionalFormatRule")] + pub update_conditional_format_rule: Option, + /// Updates the state of the specified group. + #[serde(rename="updateDimensionGroup")] + pub update_dimension_group: Option, + /// Deletes rows or columns in a sheet. + #[serde(rename="deleteDimension")] + pub delete_dimension: Option, + /// Cuts data from one area and pastes it to another. + #[serde(rename="cutPaste")] + pub cut_paste: Option, + /// Deletes an embedded object (e.g, chart, image) in a sheet. + #[serde(rename="deleteEmbeddedObject")] + pub delete_embedded_object: Option, + /// Pastes data (HTML or delimited) into a sheet. + #[serde(rename="pasteData")] + pub paste_data: Option, + /// Appends cells after the last row with data in a sheet. + #[serde(rename="appendCells")] + pub append_cells: Option, + /// Duplicates a sheet. + #[serde(rename="duplicateSheet")] + pub duplicate_sheet: Option, + /// Updates a sheet's properties. + #[serde(rename="updateSheetProperties")] + pub update_sheet_properties: Option, + /// Adds a chart. + #[serde(rename="addChart")] + pub add_chart: Option, + /// Adds a new conditional format rule. + #[serde(rename="addConditionalFormatRule")] + pub add_conditional_format_rule: Option, + /// Removes a banded range + #[serde(rename="deleteBanding")] + pub delete_banding: Option, + /// Repeats a single cell across a range. + #[serde(rename="repeatCell")] + pub repeat_cell: Option, + /// Finds and replaces occurrences of some text with other text. + #[serde(rename="findReplace")] + pub find_replace: Option, + /// Automatically fills in more data based on existing data. + #[serde(rename="autoFill")] + pub auto_fill: Option, + /// Sets the basic filter on a sheet. + #[serde(rename="setBasicFilter")] + pub set_basic_filter: Option, + /// Updates the spreadsheet's properties. + #[serde(rename="updateSpreadsheetProperties")] + pub update_spreadsheet_properties: Option, + /// Updates many cells at once. + #[serde(rename="updateCells")] + pub update_cells: Option, + /// Randomizes the order of the rows in a range. + #[serde(rename="randomizeRange")] + pub randomize_range: Option, + /// Appends dimensions to the end of a sheet. + #[serde(rename="appendDimension")] + pub append_dimension: Option, + /// Updates a banded range + #[serde(rename="updateBanding")] + pub update_banding: Option, + /// Adds a new banded range + #[serde(rename="addBanding")] + pub add_banding: Option, + /// Automatically resizes one or more dimensions based on the contents + /// of the cells in that dimension. + #[serde(rename="autoResizeDimensions")] + pub auto_resize_dimensions: Option, + /// Updates dimensions' properties. + #[serde(rename="updateDimensionProperties")] + pub update_dimension_properties: Option, + /// Converts a column of text into many columns of text. + #[serde(rename="textToColumns")] + pub text_to_columns: Option, + /// Unmerges merged cells. + #[serde(rename="unmergeCells")] + pub unmerge_cells: Option, + /// Sets data validation for one or more cells. + #[serde(rename="setDataValidation")] + pub set_data_validation: Option, + /// Deletes a range of cells from a sheet, shifting the remaining cells. + #[serde(rename="deleteRange")] + pub delete_range: Option, + /// Clears the basic filter on a sheet. + #[serde(rename="clearBasicFilter")] + pub clear_basic_filter: Option, + /// Adds a named range. + #[serde(rename="addNamedRange")] + pub add_named_range: Option, + /// Updates a chart's specifications. + #[serde(rename="updateChartSpec")] + pub update_chart_spec: Option, + /// Inserts new cells in a sheet, shifting the existing cells. + #[serde(rename="insertRange")] + pub insert_range: Option, + /// Updates an existing developer metadata entry + #[serde(rename="updateDeveloperMetadata")] + pub update_developer_metadata: Option, + /// Moves rows or columns to another location in a sheet. + #[serde(rename="moveDimension")] + pub move_dimension: Option, + /// Updates a protected range. + #[serde(rename="updateProtectedRange")] + pub update_protected_range: Option, + /// Creates new developer metadata + #[serde(rename="createDeveloperMetadata")] + pub create_developer_metadata: Option, + /// Deletes a group over the specified range. + #[serde(rename="deleteDimensionGroup")] + pub delete_dimension_group: Option, + /// Merges cells together. + #[serde(rename="mergeCells")] + pub merge_cells: Option, + /// Deletes a protected range. + #[serde(rename="deleteProtectedRange")] + pub delete_protected_range: Option, + /// Adds a filter view. + #[serde(rename="addFilterView")] + pub add_filter_view: Option, + /// Deletes developer metadata + #[serde(rename="deleteDeveloperMetadata")] + pub delete_developer_metadata: Option, + /// Deletes a sheet. + #[serde(rename="deleteSheet")] + pub delete_sheet: Option, + /// Updates the borders in a range of cells. + #[serde(rename="updateBorders")] + pub update_borders: Option, + /// Adds a protected range. + #[serde(rename="addProtectedRange")] + pub add_protected_range: Option, + /// Copies data from one area and pastes it to another. + #[serde(rename="copyPaste")] + pub copy_paste: Option, + /// Adds a sheet. + #[serde(rename="addSheet")] + pub add_sheet: Option, + /// Deletes a named range. + #[serde(rename="deleteNamedRange")] + pub delete_named_range: Option, + /// Deletes a filter view from a sheet. + #[serde(rename="deleteFilterView")] + pub delete_filter_view: Option, + /// Updates a named range. + #[serde(rename="updateNamedRange")] + pub update_named_range: Option, + /// Inserts new rows or columns in a sheet. + #[serde(rename="insertDimension")] + pub insert_dimension: Option, + /// Updates the properties of a filter view. + #[serde(rename="updateFilterView")] + pub update_filter_view: Option, + /// Deletes an existing conditional format rule. + #[serde(rename="deleteConditionalFormatRule")] + pub delete_conditional_format_rule: Option, + /// Creates a group over the specified range. + #[serde(rename="addDimensionGroup")] + pub add_dimension_group: Option, +} + +impl Part for Request {} + + +/// Settings to control how circular dependencies are resolved with iterative +/// calculation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IterativeCalculationSettings { + /// When iterative calculation is enabled and successive results differ by + /// less than this threshold value, the calculation rounds stop. + #[serde(rename="convergenceThreshold")] + pub convergence_threshold: Option, + /// When iterative calculation is enabled, the maximum number of calculation + /// rounds to perform. + #[serde(rename="maxIterations")] + pub max_iterations: Option, +} + +impl Part for IterativeCalculationSettings {} + + +/// A single series of data for a waterfall chart. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WaterfallChartSeries { + /// Styles for all columns in this series with negative values. + #[serde(rename="negativeColumnsStyle")] + pub negative_columns_style: Option, + /// True to hide the subtotal column from the end of the series. By default, + /// a subtotal column will appear at the end of each series. Setting this + /// field to true will hide that subtotal column for this series. + #[serde(rename="hideTrailingSubtotal")] + pub hide_trailing_subtotal: Option, + /// Styles for all columns in this series with positive values. + #[serde(rename="positiveColumnsStyle")] + pub positive_columns_style: Option, + /// The data being visualized in this series. + pub data: Option, + /// Custom subtotal columns appearing in this series. The order in which + /// subtotals are defined is not significant. Only one subtotal may be + /// defined for each data point. + #[serde(rename="customSubtotals")] + pub custom_subtotals: Option>, + /// Styles for all subtotal columns in this series. + #[serde(rename="subtotalColumnsStyle")] + pub subtotal_columns_style: Option, +} + +impl Part for WaterfallChartSeries {} + + +/// A request to retrieve all developer metadata matching the set of specified +/// criteria. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [developer metadata search spreadsheets](struct.SpreadsheetDeveloperMetadataSearchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SearchDeveloperMetadataRequest { + /// The data filters describing the criteria used to determine which + /// DeveloperMetadata entries to return. DeveloperMetadata matching any of the + /// specified filters will be included in the response. + #[serde(rename="dataFilters")] + pub data_filters: Option>, +} + +impl RequestValue for SearchDeveloperMetadataRequest {} + + +/// Updates all cells in the range to the values in the given Cell object. +/// Only the fields listed in the fields field are updated; others are +/// unchanged. +/// +/// If writing a cell with a formula, the formula's ranges will automatically +/// increment for each field in the range. +/// For example, if writing a cell with formula `=A1` into range B2:C4, +/// B2 would be `=A1`, B3 would be `=A2`, B4 would be `=A3`, +/// C2 would be `=B1`, C3 would be `=B2`, C4 would be `=B3`. +/// +/// To keep the formula's ranges static, use the `$` indicator. +/// For example, use the formula `=$A$1` to prevent both the row and the +/// column from incrementing. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RepeatCellRequest { + /// The data to write. + pub cell: Option, + /// The fields that should be updated. At least one field must be specified. + /// The root `cell` is implied and should not be specified. + /// A single `"*"` can be used as short-hand for listing every field. + pub fields: Option, + /// The range to repeat the cell in. + pub range: Option, +} + +impl Part for RepeatCellRequest {} + + +/// Deletes a particular filter view. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteFilterViewRequest { + /// The ID of the filter to delete. + #[serde(rename="filterId")] + pub filter_id: Option, +} + +impl Part for DeleteFilterViewRequest {} + + +/// A range along a single dimension on a sheet. +/// All indexes are zero-based. +/// Indexes are half open: the start index is inclusive +/// and the end index is exclusive. +/// Missing indexes indicate the range is unbounded on that side. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionRange { + /// The end (exclusive) of the span, or not set if unbounded. + #[serde(rename="endIndex")] + pub end_index: Option, + /// The start (inclusive) of the span, or not set if unbounded. + #[serde(rename="startIndex")] + pub start_index: Option, + /// The dimension of the span. + pub dimension: Option, + /// The sheet this span is on. + #[serde(rename="sheetId")] + pub sheet_id: Option, +} + +impl Part for DimensionRange {} + + +/// Moves one or more rows or columns. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MoveDimensionRequest { + /// The source dimensions to move. + pub source: Option, + /// The zero-based start index of where to move the source data to, + /// based on the coordinates *before* the source data is removed + /// from the grid. Existing data will be shifted down or right + /// (depending on the dimension) to make room for the moved dimensions. + /// The source dimensions are removed from the grid, so the + /// the data may end up in a different index than specified. + /// + /// For example, given `A1..A5` of `0, 1, 2, 3, 4` and wanting to move + /// `"1"` and `"2"` to between `"3"` and `"4"`, the source would be + /// `ROWS [1..3)`,and the destination index would be `"4"` + /// (the zero-based index of row 5). + /// The end result would be `A1..A5` of `0, 3, 1, 2, 4`. + #[serde(rename="destinationIndex")] + pub destination_index: Option, +} + +impl Part for MoveDimensionRequest {} + + +/// A run of a text format. The format of this run continues until the start +/// index of the next run. +/// When updating, all fields must be set. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TextFormatRun { + /// The character index where this run starts. + #[serde(rename="startIndex")] + pub start_index: Option, + /// The format of this run. Absent values inherit the cell's format. + pub format: Option, +} + +impl Part for TextFormatRun {} + + +/// Sets the basic filter associated with a sheet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetBasicFilterRequest { + /// The filter to set. + pub filter: Option, +} + +impl Part for SetBasicFilterRequest {} + + +/// An org chart. +/// Org charts require a unique set of labels in labels and may +/// optionally include parent_labels and tooltips. +/// parent_labels contain, for each node, the label identifying the parent +/// node. tooltips contain, for each node, an optional tooltip. +/// +/// For example, to describe an OrgChart with Alice as the CEO, Bob as the +/// President (reporting to Alice) and Cathy as VP of Sales (also reporting to +/// Alice), have labels contain "Alice", "Bob", "Cathy", +/// parent_labels contain "", "Alice", "Alice" and tooltips contain +/// "CEO", "President", "VP Sales". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrgChartSpec { + /// The data containing the tooltip for the corresponding node. A blank value + /// results in no tooltip being displayed for the node. + /// This field is optional. + pub tooltips: Option, + /// The data containing the label of the parent for the corresponding node. + /// A blank value indicates that the node has no parent and is a top-level + /// node. + /// This field is optional. + #[serde(rename="parentLabels")] + pub parent_labels: Option, + /// The color of the org chart nodes. + #[serde(rename="nodeColor")] + pub node_color: Option, + /// The data containing the labels for all the nodes in the chart. Labels + /// must be unique. + pub labels: Option, + /// The color of the selected org chart nodes. + #[serde(rename="selectedNodeColor")] + pub selected_node_color: Option, + /// The size of the org chart nodes. + #[serde(rename="nodeSize")] + pub node_size: Option, +} + +impl Part for OrgChartSpec {} + + +/// The result of adding a banded range. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AddBandingResponse { + /// The banded range that was added. + #[serde(rename="bandedRange")] + pub banded_range: Option, +} + +impl Part for AddBandingResponse {} + + /// Represents a color in the RGBA color space. This representation is designed /// for simplicity of conversion to/from color representations in various /// languages over compactness; for example, the fields of this representation /// can be trivially provided to the constructor of "java.awt.Color" in Java; it /// can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" /// method in iOS; and, with just a little work, it can be easily formatted into -/// a CSS "rgba()" string in JavaScript, as well. Here are some examples: +/// a CSS "rgba()" string in JavaScript, as well. +/// +/// Note: this proto does not carry information about the absolute color space +/// that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, +/// DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color +/// space. /// /// Example (Java): /// @@ -3865,253 +5120,23 @@ pub struct Color { impl Part for Color {} -/// Updates the state of the specified group. +/// A candlestick +/// chart. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateDimensionGroupRequest { - /// The fields that should be updated. At least one field must be specified. - /// The root `dimensionGroup` is implied and should not be specified. - /// A single `"*"` can be used as short-hand for listing every field. - pub fields: Option, - /// The group whose state should be updated. The range and depth of the group - /// should specify a valid group on the sheet, and all other fields updated. - #[serde(rename="dimensionGroup")] - pub dimension_group: Option, +pub struct CandlestickChartSpec { + /// The domain data (horizontal axis) for the candlestick chart. String data + /// will be treated as discrete labels, other data will be treated as + /// continuous values. + pub domain: Option, + /// The Candlestick chart data. + /// Only one CandlestickData is supported. + pub data: Option>, } -impl Part for UpdateDimensionGroupRequest {} - - -/// The request for updating more than one range of values in a spreadsheet. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [values batch update by data filter spreadsheets](struct.SpreadsheetValueBatchUpdateByDataFilterCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchUpdateValuesByDataFilterRequest { - /// Determines how values in the response should be rendered. - /// The default render option is ValueRenderOption.FORMATTED_VALUE. - #[serde(rename="responseValueRenderOption")] - pub response_value_render_option: Option, - /// The new values to apply to the spreadsheet. If more than one range is - /// matched by the specified DataFilter the specified values will be - /// applied to all of those ranges. - pub data: Option>, - /// Determines if the update response should include the values - /// of the cells that were updated. By default, responses - /// do not include the updated values. The `updatedData` field within - /// each of the BatchUpdateValuesResponse.responses will contain - /// the updated values. If the range to write was larger than than the range - /// actually written, the response will include all values in the requested - /// range (excluding trailing empty rows and columns). - #[serde(rename="includeValuesInResponse")] - pub include_values_in_response: Option, - /// How the input data should be interpreted. - #[serde(rename="valueInputOption")] - pub value_input_option: Option, - /// Determines how dates, times, and durations in the response should be - /// rendered. This is ignored if response_value_render_option is - /// FORMATTED_VALUE. - /// The default dateTime render option is - /// DateTimeRenderOption.SERIAL_NUMBER. - #[serde(rename="responseDateTimeRenderOption")] - pub response_date_time_render_option: Option, -} - -impl RequestValue for BatchUpdateValuesByDataFilterRequest {} - - -/// The position of an embedded object such as a chart. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EmbeddedObjectPosition { - /// If true, the embedded object is put on a new sheet whose ID - /// is chosen for you. Used only when writing. - #[serde(rename="newSheet")] - pub new_sheet: Option, - /// The sheet this is on. Set only if the embedded object - /// is on its own sheet. Must be non-negative. - #[serde(rename="sheetId")] - pub sheet_id: Option, - /// The position at which the object is overlaid on top of a grid. - #[serde(rename="overlayPosition")] - pub overlay_position: Option, -} - -impl Part for EmbeddedObjectPosition {} - - -/// The value of the condition. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ConditionValue { - /// A relative date (based on the current date). - /// Valid only if the type is - /// DATE_BEFORE, - /// DATE_AFTER, - /// DATE_ON_OR_BEFORE or - /// DATE_ON_OR_AFTER. - /// - /// Relative dates are not supported in data validation. - /// They are supported only in conditional formatting and - /// conditional filters. - #[serde(rename="relativeDate")] - pub relative_date: Option, - /// A value the condition is based on. - /// The value is parsed as if the user typed into a cell. - /// Formulas are supported (and must begin with an `=` or a '+'). - #[serde(rename="userEnteredValue")] - pub user_entered_value: Option, -} - -impl Part for ConditionValue {} - - -/// The default filter associated with a sheet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BasicFilter { - /// The range the filter covers. - pub range: Option, - /// The sort order per column. Later specifications are used when values - /// are equal in the earlier specifications. - #[serde(rename="sortSpecs")] - pub sort_specs: Option>, - /// The criteria for showing/hiding values per column. - /// The map's key is the column index, and the value is the criteria for - /// that column. - pub criteria: Option>, -} - -impl Part for BasicFilter {} - - -/// The result of a filter view being duplicated. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DuplicateFilterViewResponse { - /// The newly created filter. - pub filter: Option, -} - -impl Part for DuplicateFilterViewResponse {} - - -/// Filter that describes what data should be selected or returned from a -/// request. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DataFilter { - /// Selects data associated with the developer metadata matching the criteria - /// described by this DeveloperMetadataLookup. - #[serde(rename="developerMetadataLookup")] - pub developer_metadata_lookup: Option, - /// Selects data that matches the specified A1 range. - #[serde(rename="a1Range")] - pub a1_range: Option, - /// Selects data that matches the range described by the GridRange. - #[serde(rename="gridRange")] - pub grid_range: Option, -} - -impl Part for DataFilter {} - - -/// Removes the named range with the given ID from the spreadsheet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteNamedRangeRequest { - /// The ID of the named range to delete. - #[serde(rename="namedRangeId")] - pub named_range_id: Option, -} - -impl Part for DeleteNamedRangeRequest {} - - -/// Developer metadata associated with a location or object in a spreadsheet. -/// Developer metadata may be used to associate arbitrary data with various -/// parts of a spreadsheet and will remain associated at those locations as they -/// move around and the spreadsheet is edited. For example, if developer -/// metadata is associated with row 5 and another row is then subsequently -/// inserted above row 5, that original metadata will still be associated with -/// the row it was first associated with (what is now row 6). If the associated -/// object is deleted its metadata is deleted too. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [developer metadata get spreadsheets](struct.SpreadsheetDeveloperMetadataGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeveloperMetadata { - /// The spreadsheet-scoped unique ID that identifies the metadata. IDs may be - /// specified when metadata is created, otherwise one will be randomly - /// generated and assigned. Must be positive. - #[serde(rename="metadataId")] - pub metadata_id: Option, - /// Data associated with the metadata's key. - #[serde(rename="metadataValue")] - pub metadata_value: Option, - /// The location where the metadata is associated. - pub location: Option, - /// The metadata visibility. Developer metadata must always have a visibility - /// specified. - pub visibility: Option, - /// The metadata key. There may be multiple metadata in a spreadsheet with the - /// same key. Developer metadata must always have a key specified. - #[serde(rename="metadataKey")] - pub metadata_key: Option, -} - -impl ResponseResult for DeveloperMetadata {} - - -/// Updates all cells in a range with new data. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateCellsRequest { - /// The fields of CellData that should be updated. - /// At least one field must be specified. - /// The root is the CellData; 'row.values.' should not be specified. - /// A single `"*"` can be used as short-hand for listing every field. - pub fields: Option, - /// The range to write data to. - /// - /// If the data in rows does not cover the entire requested range, - /// the fields matching those set in fields will be cleared. - pub range: Option, - /// The data to write. - pub rows: Option>, - /// The coordinate to start writing data at. - /// Any number of rows and columns (including a different number of - /// columns per row) may be written. - pub start: Option, -} - -impl Part for UpdateCellsRequest {} +impl Part for CandlestickChartSpec {} /// Updates properties of the filter view. @@ -4131,1167 +5156,55 @@ pub struct UpdateFilterViewRequest { impl Part for UpdateFilterViewRequest {} -/// Deletes the dimensions from the sheet. +/// Data within a range of the spreadsheet. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [values append spreadsheets](struct.SpreadsheetValueAppendCall.html) (request) +/// * [values get spreadsheets](struct.SpreadsheetValueGetCall.html) (response) +/// * [values update spreadsheets](struct.SpreadsheetValueUpdateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteDimensionRequest { - /// The dimensions to delete from the sheet. - pub range: Option, -} - -impl Part for DeleteDimensionRequest {} - - -/// Properties that describe the style of a line. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LineStyle { - /// The thickness of the line, in px. - pub width: Option, - /// The dash type of the line. - #[serde(rename="type")] - pub type_: Option, -} - -impl Part for LineStyle {} - - -/// Creates a group over the specified range. -/// -/// If the requested range is a superset of the range of an existing group G, -/// then the depth of G is incremented and this new group G' has the -/// depth of that group. For example, a group [C:D, depth 1] + [B:E] results in -/// groups [B:E, depth 1] and [C:D, depth 2]. -/// If the requested range is a subset of the range of an existing group G, -/// then the depth of the new group G' becomes one greater than the depth of G. -/// For example, a group [B:E, depth 1] + [C:D] results in groups [B:E, depth 1] -/// and [C:D, depth 2]. -/// If the requested range starts before and ends within, or starts within and -/// ends after, the range of an existing group G, then the range of the existing -/// group G becomes the union of the ranges, and the new group G' has -/// depth one greater than the depth of G and range as the intersection of the -/// ranges. For example, a group [B:D, depth 1] + [C:E] results in groups [B:E, -/// depth 1] and [C:D, depth 2]. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddDimensionGroupRequest { - /// The range over which to create a group. - pub range: Option, -} - -impl Part for AddDimensionGroupRequest {} - - -/// Properties referring a single dimension (either row or column). If both -/// BandedRange.row_properties and BandedRange.column_properties are -/// set, the fill colors are applied to cells according to the following rules: -/// -/// * header_color and footer_color take priority over band colors. -/// * first_band_color takes priority over second_band_color. -/// * row_properties takes priority over column_properties. -/// -/// For example, the first row color takes priority over the first column -/// color, but the first column color takes priority over the second row color. -/// Similarly, the row header takes priority over the column header in the -/// top left cell, but the column header takes priority over the first row -/// color if the row header is not set. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BandingProperties { - /// The second color that is alternating. (Required) - #[serde(rename="secondBandColor")] - pub second_band_color: Option, - /// The color of the first row or column. If this field is set, the first - /// row or column will be filled with this color and the colors will - /// alternate between first_band_color and second_band_color starting - /// from the second row or column. Otherwise, the first row or column will be - /// filled with first_band_color and the colors will proceed to alternate - /// as they normally would. - #[serde(rename="headerColor")] - pub header_color: Option, - /// The color of the last row or column. If this field is not set, the last - /// row or column will be filled with either first_band_color or - /// second_band_color, depending on the color of the previous row or - /// column. - #[serde(rename="footerColor")] - pub footer_color: Option, - /// The first color that is alternating. (Required) - #[serde(rename="firstBandColor")] - pub first_band_color: Option, -} - -impl Part for BandingProperties {} - - -/// A histogram series containing the series color and data. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct HistogramSeries { - /// The color of the column representing this series in each bucket. - /// This field is optional. - #[serde(rename="barColor")] - pub bar_color: Option, - /// The data for this histogram series. - pub data: Option, -} - -impl Part for HistogramSeries {} - - -/// The domain of a chart. -/// For example, if charting stock prices over time, this would be the date. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BasicChartDomain { - /// True to reverse the order of the domain values (horizontal axis). - pub reversed: Option, - /// The data of the domain. For example, if charting stock prices over time, - /// this is the data representing the dates. - pub domain: Option, -} - -impl Part for BasicChartDomain {} - - -/// The result of deleting a group. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteDimensionGroupResponse { - /// All groups of a dimension after deleting a group from that dimension. - #[serde(rename="dimensionGroups")] - pub dimension_groups: Option>, -} - -impl Part for DeleteDimensionGroupResponse {} - - -/// Styles for a waterfall chart column. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WaterfallChartColumnStyle { - /// The color of the column. - pub color: Option, - /// The label of the column's legend. - pub label: Option, -} - -impl Part for WaterfallChartColumnStyle {} - - -/// The format of a cell. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CellFormat { - /// A format describing how number values should be represented to the user. - #[serde(rename="numberFormat")] - pub number_format: Option, - /// The direction of the text in the cell. - #[serde(rename="textDirection")] - pub text_direction: Option, - /// The padding of the cell. - pub padding: Option, - /// The vertical alignment of the value in the cell. - #[serde(rename="verticalAlignment")] - pub vertical_alignment: Option, - /// The background color of the cell. - #[serde(rename="backgroundColor")] - pub background_color: Option, - /// The horizontal alignment of the value in the cell. - #[serde(rename="horizontalAlignment")] - pub horizontal_alignment: Option, - /// The format of the text in the cell (unless overridden by a format run). - #[serde(rename="textFormat")] - pub text_format: Option, - /// The rotation applied to text in a cell - #[serde(rename="textRotation")] - pub text_rotation: Option, - /// How a hyperlink, if it exists, should be displayed in the cell. - #[serde(rename="hyperlinkDisplayType")] - pub hyperlink_display_type: Option, - /// The borders of the cell. - pub borders: Option, - /// The wrap strategy for the value in the cell. - #[serde(rename="wrapStrategy")] - pub wrap_strategy: Option, -} - -impl Part for CellFormat {} - - -/// Sorts data in rows based on a sort order per column. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SortRangeRequest { - /// The range to sort. - pub range: Option, - /// The sort order per column. Later specifications are used when values - /// are equal in the earlier specifications. - #[serde(rename="sortSpecs")] - pub sort_specs: Option>, -} - -impl Part for SortRangeRequest {} - - -/// A filter view. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct FilterView { - /// The range this filter view covers. +pub struct ValueRange { + /// The range the values cover, in A1 notation. + /// For output, this range indicates the entire requested range, + /// even though the values will exclude trailing rows and columns. + /// When appending values, this field represents the range to search for a + /// table, after which values will be appended. + pub range: Option, + /// The data that was read or to be written. This is an array of arrays, + /// the outer array representing all the data and each inner array + /// representing a major dimension. Each item in the inner array + /// corresponds with one cell. /// - /// When writing, only one of range or named_range_id - /// may be set. - pub range: Option, - /// The sort order per column. Later specifications are used when values - /// are equal in the earlier specifications. - #[serde(rename="sortSpecs")] - pub sort_specs: Option>, - /// The name of the filter view. - pub title: Option, - /// The named range this filter view is backed by, if any. + /// For output, empty trailing rows and columns will not be included. /// - /// When writing, only one of range or named_range_id - /// may be set. - #[serde(rename="namedRangeId")] - pub named_range_id: Option, - /// The criteria for showing/hiding values per column. - /// The map's key is the column index, and the value is the criteria for - /// that column. - pub criteria: Option>, - /// The ID of the filter view. - #[serde(rename="filterViewId")] - pub filter_view_id: Option, -} - -impl Part for FilterView {} - - -/// The definition of how a value in a pivot table should be calculated. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PivotValue { - /// A custom formula to calculate the value. The formula must start - /// with an `=` character. - pub formula: Option, - /// A function to summarize the value. - /// If formula is set, the only supported values are - /// SUM and - /// CUSTOM. - /// If sourceColumnOffset is set, then `CUSTOM` - /// is not supported. - #[serde(rename="summarizeFunction")] - pub summarize_function: Option, - /// A name to use for the value. - pub name: Option, - /// The column offset of the source range that this value reads from. - /// - /// For example, if the source was `C10:E15`, a `sourceColumnOffset` of `0` - /// means this value refers to column `C`, whereas the offset `1` would - /// refer to column `D`. - #[serde(rename="sourceColumnOffset")] - pub source_column_offset: Option, - /// If specified, indicates that pivot values should be displayed as - /// the result of a calculation with another pivot value. For example, if - /// calculated_display_type is specified as PERCENT_OF_GRAND_TOTAL, all the - /// pivot values are displayed as the percentage of the grand total. In - /// the Sheets UI, this is referred to as "Show As" in the value section of a - /// pivot table. - #[serde(rename="calculatedDisplayType")] - pub calculated_display_type: Option, -} - -impl Part for PivotValue {} - - -/// Adds a new sheet. -/// When a sheet is added at a given index, -/// all subsequent sheets' indexes are incremented. -/// To add an object sheet, use AddChartRequest instead and specify -/// EmbeddedObjectPosition.sheetId or -/// EmbeddedObjectPosition.newSheet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddSheetRequest { - /// The properties the new sheet should have. - /// All properties are optional. - /// The sheetId field is optional; if one is not - /// set, an id will be randomly generated. (It is an error to specify the ID - /// of a sheet that already exists.) - pub properties: Option, -} - -impl Part for AddSheetRequest {} - - -/// Appends rows or columns to the end of a sheet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AppendDimensionRequest { - /// The number of rows or columns to append. - pub length: Option, - /// The sheet to append rows or columns to. - #[serde(rename="sheetId")] - pub sheet_id: Option, - /// Whether rows or columns should be appended. - pub dimension: Option, -} - -impl Part for AppendDimensionRequest {} - - -/// Randomizes the order of the rows in a range. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RandomizeRangeRequest { - /// The range to randomize. - pub range: Option, -} - -impl Part for RandomizeRangeRequest {} - - -/// The rotation applied to text in a cell. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TextRotation { - /// The angle between the standard orientation and the desired orientation. - /// Measured in degrees. Valid values are between -90 and 90. Positive - /// angles are angled upwards, negative are angled downwards. - /// - /// Note: For LTR text direction positive angles are in the counterclockwise - /// direction, whereas for RTL they are in the clockwise direction - pub angle: Option, - /// If true, text reads top to bottom, but the orientation of individual - /// characters is unchanged. - /// For example: - /// - /// | V | - /// | e | - /// | r | - /// | t | - /// | i | - /// | c | - /// | a | - /// | l | - pub vertical: Option, -} - -impl Part for TextRotation {} - - -/// A range of values whose location is specified by a DataFilter. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DataFilterValueRange { - /// The data to be written. If the provided values exceed any of the ranges - /// matched by the data filter then the request will fail. If the provided - /// values are less than the matched ranges only the specified values will be - /// written, existing values in the matched ranges will remain unaffected. + /// For input, supported value types are: bool, string, and double. + /// Null values will be skipped. + /// To set a cell to an empty value, set the string value to an empty string. pub values: Option>>, - /// The data filter describing the location of the values in the spreadsheet. - #[serde(rename="dataFilter")] - pub data_filter: Option, /// The major dimension of the values. + /// + /// For output, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`, + /// then requesting `range=A1:B2,majorDimension=ROWS` will return + /// `[[1,2],[3,4]]`, + /// whereas requesting `range=A1:B2,majorDimension=COLUMNS` will return + /// `[[1,3],[2,4]]`. + /// + /// For input, with `range=A1:B2,majorDimension=ROWS` then `[[1,2],[3,4]]` + /// will set `A1=1,B1=2,A2=3,B2=4`. With `range=A1:B2,majorDimension=COLUMNS` + /// then `[[1,2],[3,4]]` will set `A1=1,B1=3,A2=2,B2=4`. + /// + /// When writing, if this field is not set, it defaults to ROWS. #[serde(rename="majorDimension")] pub major_dimension: Option, } -impl Part for DataFilterValueRange {} - - -/// Updates a chart's specifications. -/// (This does not move or resize a chart. To move or resize a chart, use -/// UpdateEmbeddedObjectPositionRequest.) -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateChartSpecRequest { - /// The ID of the chart to update. - #[serde(rename="chartId")] - pub chart_id: Option, - /// The specification to apply to the chart. - pub spec: Option, -} - -impl Part for UpdateChartSpecRequest {} - - -/// An error in a cell. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ErrorValue { - /// A message with more information about the error - /// (in the spreadsheet's locale). - pub message: Option, - /// The type of error. - #[serde(rename="type")] - pub type_: Option, -} - -impl Part for ErrorValue {} - - -/// The request to copy a sheet across spreadsheets. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [sheets copy to spreadsheets](struct.SpreadsheetSheetCopyToCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CopySheetToAnotherSpreadsheetRequest { - /// The ID of the spreadsheet to copy the sheet to. - #[serde(rename="destinationSpreadsheetId")] - pub destination_spreadsheet_id: Option, -} - -impl RequestValue for CopySheetToAnotherSpreadsheetRequest {} - - -/// Deletes the embedded object with the given ID. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteEmbeddedObjectRequest { - /// The ID of the embedded object to delete. - #[serde(rename="objectId")] - pub object_id: Option, -} - -impl Part for DeleteEmbeddedObjectRequest {} - - -/// The response when clearing a range of values in a spreadsheet. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [values clear spreadsheets](struct.SpreadsheetValueClearCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ClearValuesResponse { - /// The spreadsheet the updates were applied to. - #[serde(rename="spreadsheetId")] - pub spreadsheet_id: Option, - /// The range (in A1 notation) that was cleared. - /// (If the request was for an unbounded range or a ranger larger - /// than the bounds of the sheet, this will be the actual range - /// that was cleared, bounded to the sheet's limits.) - #[serde(rename="clearedRange")] - pub cleared_range: Option, -} - -impl ResponseResult for ClearValuesResponse {} - - -/// The result of adding a new protected range. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddProtectedRangeResponse { - /// The newly added protected range. - #[serde(rename="protectedRange")] - pub protected_range: Option, -} - -impl Part for AddProtectedRangeResponse {} - - -/// Duplicates the contents of a sheet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DuplicateSheetRequest { - /// The name of the new sheet. If empty, a new name is chosen for you. - #[serde(rename="newSheetName")] - pub new_sheet_name: Option, - /// The zero-based index where the new sheet should be inserted. - /// The index of all sheets after this are incremented. - #[serde(rename="insertSheetIndex")] - pub insert_sheet_index: Option, - /// The sheet to duplicate. - #[serde(rename="sourceSheetId")] - pub source_sheet_id: Option, - /// If set, the ID of the new sheet. If not set, an ID is chosen. - /// If set, the ID must not conflict with any existing sheet ID. - /// If set, it must be non-negative. - #[serde(rename="newSheetId")] - pub new_sheet_id: Option, -} - -impl Part for DuplicateSheetRequest {} - - -/// A single kind of update to apply to a spreadsheet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Request { - /// Duplicates a filter view. - #[serde(rename="duplicateFilterView")] - pub duplicate_filter_view: Option, - /// Sorts data in a range. - #[serde(rename="sortRange")] - pub sort_range: Option, - /// Updates an embedded object's (e.g. chart, image) position. - #[serde(rename="updateEmbeddedObjectPosition")] - pub update_embedded_object_position: Option, - /// Updates an existing conditional format rule. - #[serde(rename="updateConditionalFormatRule")] - pub update_conditional_format_rule: Option, - /// Updates the state of the specified group. - #[serde(rename="updateDimensionGroup")] - pub update_dimension_group: Option, - /// Deletes rows or columns in a sheet. - #[serde(rename="deleteDimension")] - pub delete_dimension: Option, - /// Cuts data from one area and pastes it to another. - #[serde(rename="cutPaste")] - pub cut_paste: Option, - /// Creates new developer metadata - #[serde(rename="createDeveloperMetadata")] - pub create_developer_metadata: Option, - /// Deletes an embedded object (e.g, chart, image) in a sheet. - #[serde(rename="deleteEmbeddedObject")] - pub delete_embedded_object: Option, - /// Pastes data (HTML or delimited) into a sheet. - #[serde(rename="pasteData")] - pub paste_data: Option, - /// Appends cells after the last row with data in a sheet. - #[serde(rename="appendCells")] - pub append_cells: Option, - /// Adds a named range. - #[serde(rename="addNamedRange")] - pub add_named_range: Option, - /// Duplicates a sheet. - #[serde(rename="duplicateSheet")] - pub duplicate_sheet: Option, - /// Updates a sheet's properties. - #[serde(rename="updateSheetProperties")] - pub update_sheet_properties: Option, - /// Adds a chart. - #[serde(rename="addChart")] - pub add_chart: Option, - /// Adds a new conditional format rule. - #[serde(rename="addConditionalFormatRule")] - pub add_conditional_format_rule: Option, - /// Removes a banded range - #[serde(rename="deleteBanding")] - pub delete_banding: Option, - /// Repeats a single cell across a range. - #[serde(rename="repeatCell")] - pub repeat_cell: Option, - /// Finds and replaces occurrences of some text with other text. - #[serde(rename="findReplace")] - pub find_replace: Option, - /// Randomizes the order of the rows in a range. - #[serde(rename="randomizeRange")] - pub randomize_range: Option, - /// Sets the basic filter on a sheet. - #[serde(rename="setBasicFilter")] - pub set_basic_filter: Option, - /// Updates the spreadsheet's properties. - #[serde(rename="updateSpreadsheetProperties")] - pub update_spreadsheet_properties: Option, - /// Updates many cells at once. - #[serde(rename="updateCells")] - pub update_cells: Option, - /// Automatically fills in more data based on existing data. - #[serde(rename="autoFill")] - pub auto_fill: Option, - /// Appends dimensions to the end of a sheet. - #[serde(rename="appendDimension")] - pub append_dimension: Option, - /// Updates a banded range - #[serde(rename="updateBanding")] - pub update_banding: Option, - /// Automatically resizes one or more dimensions based on the contents - /// of the cells in that dimension. - #[serde(rename="autoResizeDimensions")] - pub auto_resize_dimensions: Option, - /// Updates dimensions' properties. - #[serde(rename="updateDimensionProperties")] - pub update_dimension_properties: Option, - /// Unmerges merged cells. - #[serde(rename="unmergeCells")] - pub unmerge_cells: Option, - /// Deletes a group over the specified range. - #[serde(rename="deleteDimensionGroup")] - pub delete_dimension_group: Option, - /// Deletes a range of cells from a sheet, shifting the remaining cells. - #[serde(rename="deleteRange")] - pub delete_range: Option, - /// Clears the basic filter on a sheet. - #[serde(rename="clearBasicFilter")] - pub clear_basic_filter: Option, - /// Converts a column of text into many columns of text. - #[serde(rename="textToColumns")] - pub text_to_columns: Option, - /// Updates a chart's specifications. - #[serde(rename="updateChartSpec")] - pub update_chart_spec: Option, - /// Inserts new cells in a sheet, shifting the existing cells. - #[serde(rename="insertRange")] - pub insert_range: Option, - /// Updates an existing developer metadata entry - #[serde(rename="updateDeveloperMetadata")] - pub update_developer_metadata: Option, - /// Moves rows or columns to another location in a sheet. - #[serde(rename="moveDimension")] - pub move_dimension: Option, - /// Updates a protected range. - #[serde(rename="updateProtectedRange")] - pub update_protected_range: Option, - /// Adds a new banded range - #[serde(rename="addBanding")] - pub add_banding: Option, - /// Deletes a filter view from a sheet. - #[serde(rename="deleteFilterView")] - pub delete_filter_view: Option, - /// Merges cells together. - #[serde(rename="mergeCells")] - pub merge_cells: Option, - /// Deletes a protected range. - #[serde(rename="deleteProtectedRange")] - pub delete_protected_range: Option, - /// Adds a filter view. - #[serde(rename="addFilterView")] - pub add_filter_view: Option, - /// Updates the borders in a range of cells. - #[serde(rename="updateBorders")] - pub update_borders: Option, - /// Deletes a sheet. - #[serde(rename="deleteSheet")] - pub delete_sheet: Option, - /// Deletes developer metadata - #[serde(rename="deleteDeveloperMetadata")] - pub delete_developer_metadata: Option, - /// Adds a protected range. - #[serde(rename="addProtectedRange")] - pub add_protected_range: Option, - /// Copies data from one area and pastes it to another. - #[serde(rename="copyPaste")] - pub copy_paste: Option, - /// Adds a sheet. - #[serde(rename="addSheet")] - pub add_sheet: Option, - /// Deletes a named range. - #[serde(rename="deleteNamedRange")] - pub delete_named_range: Option, - /// Updates a named range. - #[serde(rename="updateNamedRange")] - pub update_named_range: Option, - /// Inserts new rows or columns in a sheet. - #[serde(rename="insertDimension")] - pub insert_dimension: Option, - /// Sets data validation for one or more cells. - #[serde(rename="setDataValidation")] - pub set_data_validation: Option, - /// Updates the properties of a filter view. - #[serde(rename="updateFilterView")] - pub update_filter_view: Option, - /// Deletes an existing conditional format rule. - #[serde(rename="deleteConditionalFormatRule")] - pub delete_conditional_format_rule: Option, - /// Creates a group over the specified range. - #[serde(rename="addDimensionGroup")] - pub add_dimension_group: Option, -} - -impl Part for Request {} - - -/// A range on a sheet. -/// All indexes are zero-based. -/// Indexes are half open, e.g the start index is inclusive -/// and the end index is exclusive -- [start_index, end_index). -/// Missing indexes indicate the range is unbounded on that side. -/// -/// For example, if `"Sheet1"` is sheet ID 0, then: -/// -/// `Sheet1!A1:A1 == sheet_id: 0, -/// start_row_index: 0, end_row_index: 1, -/// start_column_index: 0, end_column_index: 1` -/// -/// `Sheet1!A3:B4 == sheet_id: 0, -/// start_row_index: 2, end_row_index: 4, -/// start_column_index: 0, end_column_index: 2` -/// -/// `Sheet1!A:B == sheet_id: 0, -/// start_column_index: 0, end_column_index: 2` -/// -/// `Sheet1!A5:B == sheet_id: 0, -/// start_row_index: 4, -/// start_column_index: 0, end_column_index: 2` -/// -/// `Sheet1 == sheet_id:0` -/// -/// The start index must always be less than or equal to the end index. -/// If the start index equals the end index, then the range is empty. -/// Empty ranges are typically not meaningful and are usually rendered in the -/// UI as `#REF!`. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GridRange { - /// The end row (exclusive) of the range, or not set if unbounded. - #[serde(rename="endRowIndex")] - pub end_row_index: Option, - /// The end column (exclusive) of the range, or not set if unbounded. - #[serde(rename="endColumnIndex")] - pub end_column_index: Option, - /// The sheet this range is on. - #[serde(rename="sheetId")] - pub sheet_id: Option, - /// The start column (inclusive) of the range, or not set if unbounded. - #[serde(rename="startColumnIndex")] - pub start_column_index: Option, - /// The start row (inclusive) of the range, or not set if unbounded. - #[serde(rename="startRowIndex")] - pub start_row_index: Option, -} - -impl Part for GridRange {} - - -/// Allows you to organize the date-time values in a source data column into -/// buckets based on selected parts of their date or time values. For example, -/// consider a pivot table showing sales transactions by date: -/// -/// +----------+--------------+ -/// | Date | SUM of Sales | -/// +----------+--------------+ -/// | 1/1/2017 | $621.14 | -/// | 2/3/2017 | $708.84 | -/// | 5/8/2017 | $326.84 | -/// ... -/// +----------+--------------+ -/// Applying a date-time group rule with a DateTimeRuleType of YEAR_MONTH -/// results in the following pivot table. -/// -/// +--------------+--------------+ -/// | Grouped Date | SUM of Sales | -/// +--------------+--------------+ -/// | 2017-Jan | $53,731.78 | -/// | 2017-Feb | $83,475.32 | -/// | 2017-Mar | $94,385.05 | -/// ... -/// +--------------+--------------+ -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DateTimeRule { - /// The type of date-time grouping to apply. - #[serde(rename="type")] - pub type_: Option, -} - -impl Part for DateTimeRule {} - - -/// Inserts rows or columns in a sheet at a particular index. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InsertDimensionRequest { - /// Whether dimension properties should be extended from the dimensions - /// before or after the newly inserted dimensions. - /// True to inherit from the dimensions before (in which case the start - /// index must be greater than 0), and false to inherit from the dimensions - /// after. - /// - /// For example, if row index 0 has red background and row index 1 - /// has a green background, then inserting 2 rows at index 1 can inherit - /// either the green or red background. If `inheritFromBefore` is true, - /// the two new rows will be red (because the row before the insertion point - /// was red), whereas if `inheritFromBefore` is false, the two new rows will - /// be green (because the row after the insertion point was green). - #[serde(rename="inheritFromBefore")] - pub inherit_from_before: Option, - /// The dimensions to insert. Both the start and end indexes must be bounded. - pub range: Option, -} - -impl Part for InsertDimensionRequest {} - - -/// Updates all cells in the range to the values in the given Cell object. -/// Only the fields listed in the fields field are updated; others are -/// unchanged. -/// -/// If writing a cell with a formula, the formula's ranges will automatically -/// increment for each field in the range. -/// For example, if writing a cell with formula `=A1` into range B2:C4, -/// B2 would be `=A1`, B3 would be `=A2`, B4 would be `=A3`, -/// C2 would be `=B1`, C3 would be `=B2`, C4 would be `=B3`. -/// -/// To keep the formula's ranges static, use the `$` indicator. -/// For example, use the formula `=$A$1` to prevent both the row and the -/// column from incrementing. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RepeatCellRequest { - /// The data to write. - pub cell: Option, - /// The fields that should be updated. At least one field must be specified. - /// The root `cell` is implied and should not be specified. - /// A single `"*"` can be used as short-hand for listing every field. - pub fields: Option, - /// The range to repeat the cell in. - pub range: Option, -} - -impl Part for RepeatCellRequest {} - - -/// Deletes a particular filter view. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteFilterViewRequest { - /// The ID of the filter to delete. - #[serde(rename="filterId")] - pub filter_id: Option, -} - -impl Part for DeleteFilterViewRequest {} - - -/// A range along a single dimension on a sheet. -/// All indexes are zero-based. -/// Indexes are half open: the start index is inclusive -/// and the end index is exclusive. -/// Missing indexes indicate the range is unbounded on that side. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DimensionRange { - /// The end (exclusive) of the span, or not set if unbounded. - #[serde(rename="endIndex")] - pub end_index: Option, - /// The start (inclusive) of the span, or not set if unbounded. - #[serde(rename="startIndex")] - pub start_index: Option, - /// The dimension of the span. - pub dimension: Option, - /// The sheet this span is on. - #[serde(rename="sheetId")] - pub sheet_id: Option, -} - -impl Part for DimensionRange {} - - -/// Deletes a range of cells, shifting other cells into the deleted area. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteRangeRequest { - /// The range of cells to delete. - pub range: Option, - /// The dimension from which deleted cells will be replaced with. - /// If ROWS, existing cells will be shifted upward to - /// replace the deleted cells. If COLUMNS, existing cells - /// will be shifted left to replace the deleted cells. - #[serde(rename="shiftDimension")] - pub shift_dimension: Option, -} - -impl Part for DeleteRangeRequest {} - - -/// Properties about a dimension. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DimensionProperties { - /// The height (if a row) or width (if a column) of the dimension in pixels. - #[serde(rename="pixelSize")] - pub pixel_size: Option, - /// The developer metadata associated with a single row or column. - #[serde(rename="developerMetadata")] - pub developer_metadata: Option>, - /// True if this dimension is explicitly hidden. - #[serde(rename="hiddenByUser")] - pub hidden_by_user: Option, - /// True if this dimension is being filtered. - /// This field is read-only. - #[serde(rename="hiddenByFilter")] - pub hidden_by_filter: Option, -} - -impl Part for DimensionProperties {} - - -/// A run of a text format. The format of this run continues until the start -/// index of the next run. -/// When updating, all fields must be set. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TextFormatRun { - /// The character index where this run starts. - #[serde(rename="startIndex")] - pub start_index: Option, - /// The format of this run. Absent values inherit the cell's format. - pub format: Option, -} - -impl Part for TextFormatRun {} - - -/// The location an object is overlaid on top of a grid. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OverlayPosition { - /// The cell the object is anchored to. - #[serde(rename="anchorCell")] - pub anchor_cell: Option, - /// The vertical offset, in pixels, that the object is offset - /// from the anchor cell. - #[serde(rename="offsetYPixels")] - pub offset_y_pixels: Option, - /// The width of the object, in pixels. Defaults to 600. - #[serde(rename="widthPixels")] - pub width_pixels: Option, - /// The horizontal offset, in pixels, that the object is offset - /// from the anchor cell. - #[serde(rename="offsetXPixels")] - pub offset_x_pixels: Option, - /// The height of the object, in pixels. Defaults to 371. - #[serde(rename="heightPixels")] - pub height_pixels: Option, -} - -impl Part for OverlayPosition {} - - -/// The result of adding a banded range. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddBandingResponse { - /// The banded range that was added. - #[serde(rename="bandedRange")] - pub banded_range: Option, -} - -impl Part for AddBandingResponse {} - - -/// A pie chart. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PieChartSpec { - /// The data that covers the one and only series of the pie chart. - pub series: Option, - /// The data that covers the domain of the pie chart. - pub domain: Option, - /// True if the pie is three dimensional. - #[serde(rename="threeDimensional")] - pub three_dimensional: Option, - /// Where the legend of the pie chart should be drawn. - #[serde(rename="legendPosition")] - pub legend_position: Option, - /// The size of the hole in the pie chart. - #[serde(rename="pieHole")] - pub pie_hole: Option, -} - -impl Part for PieChartSpec {} - - -/// The request for updating more than one range of values in a spreadsheet. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [values batch update spreadsheets](struct.SpreadsheetValueBatchUpdateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchUpdateValuesRequest { - /// Determines how values in the response should be rendered. - /// The default render option is ValueRenderOption.FORMATTED_VALUE. - #[serde(rename="responseValueRenderOption")] - pub response_value_render_option: Option, - /// The new values to apply to the spreadsheet. - pub data: Option>, - /// Determines if the update response should include the values - /// of the cells that were updated. By default, responses - /// do not include the updated values. The `updatedData` field within - /// each of the BatchUpdateValuesResponse.responses will contain - /// the updated values. If the range to write was larger than than the range - /// actually written, the response will include all values in the requested - /// range (excluding trailing empty rows and columns). - #[serde(rename="includeValuesInResponse")] - pub include_values_in_response: Option, - /// How the input data should be interpreted. - #[serde(rename="valueInputOption")] - pub value_input_option: Option, - /// Determines how dates, times, and durations in the response should be - /// rendered. This is ignored if response_value_render_option is - /// FORMATTED_VALUE. - /// The default dateTime render option is - /// DateTimeRenderOption.SERIAL_NUMBER. - #[serde(rename="responseDateTimeRenderOption")] - pub response_date_time_render_option: Option, -} - -impl RequestValue for BatchUpdateValuesRequest {} - - -/// A candlestick chart. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CandlestickChartSpec { - /// The domain data (horizontal axis) for the candlestick chart. String data - /// will be treated as discrete labels, other data will be treated as - /// continuous values. - pub domain: Option, - /// The Candlestick chart data. - /// Only one CandlestickData is supported. - pub data: Option>, -} - -impl Part for CandlestickChartSpec {} - - -/// Source ranges for a chart. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ChartSourceRange { - /// The ranges of data for a series or domain. - /// Exactly one dimension must have a length of 1, - /// and all sources in the list must have the same dimension - /// with length 1. - /// The domain (if it exists) & all series must have the same number - /// of source ranges. If using more than one source range, then the source - /// range at a given offset must be in order and contiguous across the domain - /// and series. - /// - /// For example, these are valid configurations: - /// - /// domain sources: A1:A5 - /// series1 sources: B1:B5 - /// series2 sources: D6:D10 - /// - /// domain sources: A1:A5, C10:C12 - /// series1 sources: B1:B5, D10:D12 - /// series2 sources: C1:C5, E10:E12 - pub sources: Option>, -} - -impl Part for ChartSourceRange {} - - -/// A color scale for a treemap chart. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TreemapChartColorScale { - /// The background color for cells that have no color data associated with - /// them. Defaults to #000000 if not specified. - #[serde(rename="noDataColor")] - pub no_data_color: Option, - /// The background color for cells with a color value at the midpoint between - /// minValue and - /// maxValue. Defaults to #efe6dc if not - /// specified. - #[serde(rename="midValueColor")] - pub mid_value_color: Option, - /// The background color for cells with a color value less than or equal to - /// minValue. Defaults to #dc3912 if not - /// specified. - #[serde(rename="minValueColor")] - pub min_value_color: Option, - /// The background color for cells with a color value greater than or equal - /// to maxValue. Defaults to #109618 if not - /// specified. - #[serde(rename="maxValueColor")] - pub max_value_color: Option, -} - -impl Part for TreemapChartColorScale {} - - -/// The result of adding a filter view. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddFilterViewResponse { - /// The newly added filter view. - pub filter: Option, -} - -impl Part for AddFilterViewResponse {} +impl RequestValue for ValueRange {} +impl ResponseResult for ValueRange {} /// Removes the banded range with the given ID from the spreadsheet. @@ -5351,6 +5264,77 @@ pub struct FindReplaceRequest { impl Part for FindReplaceRequest {} +/// A single grouping (either row or column) in a pivot table. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PivotGroup { + /// True if the pivot table should include the totals for this grouping. + #[serde(rename="showTotals")] + pub show_totals: Option, + /// The column offset of the source range that this grouping is based on. + /// + /// For example, if the source was `C10:E15`, a `sourceColumnOffset` of `0` + /// means this group refers to column `C`, whereas the offset `1` would refer + /// to column `D`. + #[serde(rename="sourceColumnOffset")] + pub source_column_offset: Option, + /// The labels to use for the row/column groups which can be customized. For + /// example, in the following pivot table, the row label is `Region` (which + /// could be renamed to `State`) and the column label is `Product` (which + /// could be renamed `Item`). Pivot tables created before December 2017 do + /// not have header labels. If you'd like to add header labels to an existing + /// pivot table, please delete the existing pivot table and then create a new + /// pivot table with same parameters. + /// + /// +--------------+---------+-------+ + /// | SUM of Units | Product | | + /// | Region | Pen | Paper | + /// +--------------+---------+-------+ + /// | New York | 345 | 98 | + /// | Oregon | 234 | 123 | + /// | Tennessee | 531 | 415 | + /// +--------------+---------+-------+ + /// | Grand Total | 1110 | 636 | + /// +--------------+---------+-------+ + pub label: Option, + /// Metadata about values in the grouping. + #[serde(rename="valueMetadata")] + pub value_metadata: Option>, + /// The bucket of the opposite pivot group to sort by. + /// If not specified, sorting is alphabetical by this group's values. + #[serde(rename="valueBucket")] + pub value_bucket: Option, + /// The order the values in this group should be sorted. + #[serde(rename="sortOrder")] + pub sort_order: Option, + /// True if the headings in this pivot group should be repeated. + /// This is only valid for row groupings and is ignored by columns. + /// + /// By default, we minimize repitition of headings by not showing higher + /// level headings where they are the same. For example, even though the + /// third row below corresponds to "Q1 Mar", "Q1" is not shown because + /// it is redundant with previous rows. Setting repeat_headings to true + /// would cause "Q1" to be repeated for "Feb" and "Mar". + /// + /// +--------------+ + /// | Q1 | Jan | + /// | | Feb | + /// | | Mar | + /// +--------+-----+ + /// | Q1 Total | + /// +--------------+ + #[serde(rename="repeatHeadings")] + pub repeat_headings: Option, + /// The group rule to apply to this row/column group. + #[serde(rename="groupRule")] + pub group_rule: Option, +} + +impl Part for PivotGroup {} + + /// An axis of the chart. /// A chart may not have more than one axis per /// axis position. @@ -5359,52 +5343,75 @@ impl Part for FindReplaceRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct BasicChartAxis { - /// The axis title text position. - #[serde(rename="titleTextPosition")] - pub title_text_position: Option, /// The position of this axis. pub position: Option, - /// The title of this axis. If set, this overrides any title inferred - /// from headers of the data. - pub title: Option, /// The format of the title. /// Only valid if the axis is not associated with the domain. pub format: Option, + /// The title of this axis. If set, this overrides any title inferred + /// from headers of the data. + pub title: Option, + /// The axis title text position. + #[serde(rename="titleTextPosition")] + pub title_text_position: Option, } impl Part for BasicChartAxis {} -/// Automatically resizes one or more dimensions based on the contents -/// of the cells in that dimension. +/// A color scale for a treemap chart. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AutoResizeDimensionsRequest { - /// The dimensions to automatically resize. - pub dimensions: Option, +pub struct TreemapChartColorScale { + /// The background color for cells that have no color data associated with + /// them. Defaults to #000000 if not specified. + #[serde(rename="noDataColor")] + pub no_data_color: Option, + /// The background color for cells with a color value at the midpoint between + /// minValue and + /// maxValue. Defaults to #efe6dc if not + /// specified. + #[serde(rename="midValueColor")] + pub mid_value_color: Option, + /// The background color for cells with a color value less than or equal to + /// minValue. Defaults to #dc3912 if not + /// specified. + #[serde(rename="minValueColor")] + pub min_value_color: Option, + /// The background color for cells with a color value greater than or equal + /// to maxValue. Defaults to #109618 if not + /// specified. + #[serde(rename="maxValueColor")] + pub max_value_color: Option, } -impl Part for AutoResizeDimensionsRequest {} +impl Part for TreemapChartColorScale {} -/// Criteria for showing/hiding rows in a filter or filter view. +/// A pie chart. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct FilterCriteria { - /// Values that should be hidden. - #[serde(rename="hiddenValues")] - pub hidden_values: Option>, - /// A condition that must be true for values to be shown. - /// (This does not override hiddenValues -- if a value is listed there, - /// it will still be hidden.) - pub condition: Option, +pub struct PieChartSpec { + /// The data that covers the one and only series of the pie chart. + pub series: Option, + /// The data that covers the domain of the pie chart. + pub domain: Option, + /// True if the pie is three dimensional. + #[serde(rename="threeDimensional")] + pub three_dimensional: Option, + /// Where the legend of the pie chart should be drawn. + #[serde(rename="legendPosition")] + pub legend_position: Option, + /// The size of the hole in the pie chart. + #[serde(rename="pieHole")] + pub pie_hole: Option, } -impl Part for FilterCriteria {} +impl Part for PieChartSpec {} @@ -6032,10 +6039,7 @@ impl<'a, C, A> SpreadsheetGetByDataFilterCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6067,7 +6071,7 @@ impl<'a, C, A> SpreadsheetGetByDataFilterCall<'a, C, A> where C: BorrowMut SpreadsheetGetByDataFilterCall<'a, C, A> where C: BorrowMut SpreadsheetGetByDataFilterCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SpreadsheetGetByDataFilterCall<'a, C, A> @@ -6287,10 +6291,7 @@ impl<'a, C, A> SpreadsheetCreateCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6322,7 +6323,7 @@ impl<'a, C, A> SpreadsheetCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6402,7 +6403,7 @@ impl<'a, C, A> SpreadsheetCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6410,12 +6411,12 @@ impl<'a, C, A> SpreadsheetCreateCall<'a, C, A> where C: BorrowMut /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SpreadsheetCreateCall<'a, C, A> @@ -6558,10 +6559,7 @@ impl<'a, C, A> SpreadsheetValueBatchClearCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6593,7 +6591,7 @@ impl<'a, C, A> SpreadsheetValueBatchClearCall<'a, C, A> where C: BorrowMut SpreadsheetValueBatchClearCall<'a, C, A> where C: BorrowMut SpreadsheetValueBatchClearCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SpreadsheetValueBatchClearCall<'a, C, A> @@ -6861,10 +6859,7 @@ impl<'a, C, A> SpreadsheetGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6884,7 +6879,7 @@ impl<'a, C, A> SpreadsheetGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6978,7 +6973,7 @@ impl<'a, C, A> SpreadsheetGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6986,12 +6981,12 @@ impl<'a, C, A> SpreadsheetGetCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SpreadsheetGetCall<'a, C, A> @@ -7147,10 +7142,7 @@ impl<'a, C, A> SpreadsheetValueBatchGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7170,7 +7162,7 @@ impl<'a, C, A> SpreadsheetValueBatchGetCall<'a, C, A> where C: BorrowMut SpreadsheetValueBatchGetCall<'a, C, A> where C: BorrowMut SpreadsheetValueBatchGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SpreadsheetValueBatchGetCall<'a, C, A> @@ -7480,10 +7472,7 @@ impl<'a, C, A> SpreadsheetValueAppendCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7515,7 +7504,7 @@ impl<'a, C, A> SpreadsheetValueAppendCall<'a, C, A> where C: BorrowMut SpreadsheetValueAppendCall<'a, C, A> where C: BorrowMut SpreadsheetValueAppendCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SpreadsheetValueAppendCall<'a, C, A> @@ -7821,10 +7810,7 @@ impl<'a, C, A> SpreadsheetValueGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7844,7 +7830,7 @@ impl<'a, C, A> SpreadsheetValueGetCall<'a, C, A> where C: BorrowMut SpreadsheetValueGetCall<'a, C, A> where C: BorrowMut SpreadsheetValueGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SpreadsheetValueGetCall<'a, C, A> @@ -8119,10 +8105,7 @@ impl<'a, C, A> SpreadsheetSheetCopyToCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8154,7 +8137,7 @@ impl<'a, C, A> SpreadsheetSheetCopyToCall<'a, C, A> where C: BorrowMut SpreadsheetSheetCopyToCall<'a, C, A> where C: BorrowMut SpreadsheetSheetCopyToCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SpreadsheetSheetCopyToCall<'a, C, A> @@ -8412,10 +8395,7 @@ impl<'a, C, A> SpreadsheetValueClearCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8447,7 +8427,7 @@ impl<'a, C, A> SpreadsheetValueClearCall<'a, C, A> where C: BorrowMut SpreadsheetValueClearCall<'a, C, A> where C: BorrowMut SpreadsheetValueClearCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SpreadsheetValueClearCall<'a, C, A> @@ -8724,10 +8704,7 @@ impl<'a, C, A> SpreadsheetValueUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8759,7 +8736,7 @@ impl<'a, C, A> SpreadsheetValueUpdateCall<'a, C, A> where C: BorrowMut SpreadsheetValueUpdateCall<'a, C, A> where C: BorrowMut SpreadsheetValueUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SpreadsheetValueUpdateCall<'a, C, A> @@ -9053,10 +9030,7 @@ impl<'a, C, A> SpreadsheetValueBatchUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9088,7 +9062,7 @@ impl<'a, C, A> SpreadsheetValueBatchUpdateCall<'a, C, A> where C: BorrowMut SpreadsheetValueBatchUpdateCall<'a, C, A> where C: BorrowMut SpreadsheetValueBatchUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SpreadsheetValueBatchUpdateCall<'a, C, A> @@ -9334,10 +9308,7 @@ impl<'a, C, A> SpreadsheetValueBatchGetByDataFilterCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9369,7 +9340,7 @@ impl<'a, C, A> SpreadsheetValueBatchGetByDataFilterCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9459,7 +9430,7 @@ impl<'a, C, A> SpreadsheetValueBatchGetByDataFilterCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9467,12 +9438,12 @@ impl<'a, C, A> SpreadsheetValueBatchGetByDataFilterCall<'a, C, A> where C: Borro /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SpreadsheetValueBatchGetByDataFilterCall<'a, C, A> @@ -9616,10 +9587,7 @@ impl<'a, C, A> SpreadsheetValueBatchClearByDataFilterCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9651,7 +9619,7 @@ impl<'a, C, A> SpreadsheetValueBatchClearByDataFilterCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9741,7 +9709,7 @@ impl<'a, C, A> SpreadsheetValueBatchClearByDataFilterCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9749,12 +9717,12 @@ impl<'a, C, A> SpreadsheetValueBatchClearByDataFilterCall<'a, C, A> where C: Bor /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SpreadsheetValueBatchClearByDataFilterCall<'a, C, A> @@ -9897,10 +9865,7 @@ impl<'a, C, A> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9932,7 +9897,7 @@ impl<'a, C, A> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10022,7 +9987,7 @@ impl<'a, C, A> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10030,12 +9995,12 @@ impl<'a, C, A> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C, A> where C: Bo /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C, A> @@ -10193,10 +10158,7 @@ impl<'a, C, A> SpreadsheetBatchUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10228,7 +10190,7 @@ impl<'a, C, A> SpreadsheetBatchUpdateCall<'a, C, A> where C: BorrowMut SpreadsheetBatchUpdateCall<'a, C, A> where C: BorrowMut SpreadsheetBatchUpdateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SpreadsheetBatchUpdateCall<'a, C, A> @@ -10475,10 +10437,7 @@ impl<'a, C, A> SpreadsheetDeveloperMetadataSearchCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10510,7 +10469,7 @@ impl<'a, C, A> SpreadsheetDeveloperMetadataSearchCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10600,7 +10559,7 @@ impl<'a, C, A> SpreadsheetDeveloperMetadataSearchCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10608,12 +10567,12 @@ impl<'a, C, A> SpreadsheetDeveloperMetadataSearchCall<'a, C, A> where C: BorrowM /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SpreadsheetDeveloperMetadataSearchCall<'a, C, A> @@ -10750,10 +10709,7 @@ impl<'a, C, A> SpreadsheetDeveloperMetadataGetCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10773,7 +10729,7 @@ impl<'a, C, A> SpreadsheetDeveloperMetadataGetCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10861,7 +10817,7 @@ impl<'a, C, A> SpreadsheetDeveloperMetadataGetCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10869,12 +10825,12 @@ impl<'a, C, A> SpreadsheetDeveloperMetadataGetCall<'a, C, A> where C: BorrowMut< /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> SpreadsheetDeveloperMetadataGetCall<'a, C, A> diff --git a/gen/siteverification1/Cargo.toml b/gen/siteverification1/Cargo.toml index 1ab5d34acb..a1f2f6b3cc 100644 --- a/gen/siteverification1/Cargo.toml +++ b/gen/siteverification1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/siteverification1/src/lib.rs b/gen/siteverification1/src/lib.rs index be194fdffa..44444abe51 100644 --- a/gen/siteverification1/src/lib.rs +++ b/gen/siteverification1/src/lib.rs @@ -767,10 +767,7 @@ impl<'a, C, A> WebResourceGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -790,7 +787,7 @@ impl<'a, C, A> WebResourceGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -868,7 +865,7 @@ impl<'a, C, A> WebResourceGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1017,10 +1014,7 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1052,7 +1046,7 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1142,7 +1136,7 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1261,10 +1255,7 @@ impl<'a, C, A> WebResourceListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1284,7 +1275,7 @@ impl<'a, C, A> WebResourceListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1352,7 +1343,7 @@ impl<'a, C, A> WebResourceListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1493,10 +1484,7 @@ impl<'a, C, A> WebResourceDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1516,7 +1504,7 @@ impl<'a, C, A> WebResourceDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1584,7 +1572,7 @@ impl<'a, C, A> WebResourceDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1710,10 +1698,7 @@ impl<'a, C, A> WebResourceGetTokenCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1745,7 +1730,7 @@ impl<'a, C, A> WebResourceGetTokenCall<'a, C, A> where C: BorrowMut WebResourceGetTokenCall<'a, C, A> where C: BorrowMut WebResourceUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2009,7 +1991,7 @@ impl<'a, C, A> WebResourceUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2099,7 +2081,7 @@ impl<'a, C, A> WebResourceUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2227,10 +2209,7 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2262,7 +2241,7 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2352,7 +2331,7 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/sourcerepo1-cli/Cargo.toml b/gen/sourcerepo1-cli/Cargo.toml index 113c7321f9..d151f345d9 100644 --- a/gen/sourcerepo1-cli/Cargo.toml +++ b/gen/sourcerepo1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-sourcerepo1-cli" -version = "1.0.8+20180718" +version = "1.0.8+20190221" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Source Repositories (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/sourcerepo1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-sourcerepo1] path = "../sourcerepo1" -version = "1.0.8+20180718" +version = "1.0.8+20190221" diff --git a/gen/sourcerepo1-cli/README.md b/gen/sourcerepo1-cli/README.md index 24fa062cd4..761e3949e4 100644 --- a/gen/sourcerepo1-cli/README.md +++ b/gen/sourcerepo1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Source Repositories* API at revision *20180718*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Source Repositories* API at revision *20190221*. The CLI is at version *1.0.8*. ```bash sourcerepo1 [options] diff --git a/gen/sourcerepo1-cli/mkdocs.yml b/gen/sourcerepo1-cli/mkdocs.yml index 08af705750..879748a511 100644 --- a/gen/sourcerepo1-cli/mkdocs.yml +++ b/gen/sourcerepo1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Source Repositories v1.0.8+20180718 +site_name: Cloud Source Repositories v1.0.8+20190221 site_url: http://byron.github.io/google-apis-rs/google-sourcerepo1-cli site_description: A complete library to interact with Cloud Source Repositories (protocol v1) diff --git a/gen/sourcerepo1-cli/src/main.rs b/gen/sourcerepo1-cli/src/main.rs index 4a9ecb1c44..8f96f151b8 100644 --- a/gen/sourcerepo1-cli/src/main.rs +++ b/gen/sourcerepo1-cli/src/main.rs @@ -122,11 +122,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size" => Some(("size", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "mirror-config.url" => Some(("mirrorConfig.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "mirror-config.webhook-id" => Some(("mirrorConfig.webhookId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "mirror-config.deploy-key-id" => Some(("mirrorConfig.deployKeyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "size" => Some(("size", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["deploy-key-id", "mirror-config", "name", "size", "url", "webhook-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -427,11 +427,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "repo.url" => Some(("repo.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "repo.size" => Some(("repo.size", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "repo.name" => Some(("repo.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "repo.mirror-config.url" => Some(("repo.mirrorConfig.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "repo.mirror-config.webhook-id" => Some(("repo.mirrorConfig.webhookId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "repo.mirror-config.deploy-key-id" => Some(("repo.mirrorConfig.deployKeyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "repo.name" => Some(("repo.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "repo.size" => Some(("repo.size", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-mask" => Some(("updateMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["deploy-key-id", "mirror-config", "name", "repo", "size", "update-mask", "url", "webhook-id"]); @@ -1157,8 +1157,8 @@ fn main() { let mut app = App::new("sourcerepo1") .author("Sebastian Thiel ") - .version("1.0.8+20180718") - .about("Access source code repositories hosted by Google.") + .version("1.0.8+20190221") + .about("Accesses source code repositories hosted by Google.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_sourcerepo1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/sourcerepo1/Cargo.toml b/gen/sourcerepo1/Cargo.toml index abe83a6f23..ba9f8886db 100644 --- a/gen/sourcerepo1/Cargo.toml +++ b/gen/sourcerepo1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-sourcerepo1" -version = "1.0.8+20180718" +version = "1.0.8+20190221" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Source Repositories (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/sourcerepo1" homepage = "https://cloud.google.com/source-repositories/docs/apis" -documentation = "https://docs.rs/google-sourcerepo1/1.0.8+20180718" +documentation = "https://docs.rs/google-sourcerepo1/1.0.8+20190221" license = "MIT" keywords = ["sourcerepo", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/sourcerepo1/README.md b/gen/sourcerepo1/README.md index 570ee387ac..257265326c 100644 --- a/gen/sourcerepo1/README.md +++ b/gen/sourcerepo1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-sourcerepo1` library allows access to all features of the *Google Cloud Source Repositories* service. -This documentation was generated from *Cloud Source Repositories* crate version *1.0.8+20180718*, where *20180718* is the exact revision of the *sourcerepo:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Source Repositories* crate version *1.0.8+20190221*, where *20190221* is the exact revision of the *sourcerepo:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Source Repositories* *v1* API can be found at the [official documentation site](https://cloud.google.com/source-repositories/docs/apis). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.CloudSourceRepositories.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.CloudSourceRepositories.html) ... * projects - * [*get config*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.ProjectGetConfigCall.html), [*repos create*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.ProjectRepoCreateCall.html), [*repos delete*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.ProjectRepoDeleteCall.html), [*repos get*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.ProjectRepoGetCall.html), [*repos get iam policy*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.ProjectRepoGetIamPolicyCall.html), [*repos list*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.ProjectRepoListCall.html), [*repos patch*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.ProjectRepoPatchCall.html), [*repos set iam policy*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.ProjectRepoSetIamPolicyCall.html), [*repos test iam permissions*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.ProjectRepoTestIamPermissionCall.html) and [*update config*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.ProjectUpdateConfigCall.html) + * [*get config*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.ProjectGetConfigCall.html), [*repos create*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.ProjectRepoCreateCall.html), [*repos delete*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.ProjectRepoDeleteCall.html), [*repos get*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.ProjectRepoGetCall.html), [*repos get iam policy*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.ProjectRepoGetIamPolicyCall.html), [*repos list*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.ProjectRepoListCall.html), [*repos patch*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.ProjectRepoPatchCall.html), [*repos set iam policy*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.ProjectRepoSetIamPolicyCall.html), [*repos test iam permissions*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.ProjectRepoTestIamPermissionCall.html) and [*update config*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.ProjectUpdateConfigCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/struct.CloudSourceRepositories.html)** +* **[Hub](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/struct.CloudSourceRepositories.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.Part.html)** + * **[Parts](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-sourcerepo1/1.0.8+20180718/google_sourcerepo1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-sourcerepo1/1.0.8+20190221/google_sourcerepo1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/sourcerepo1/src/lib.rs b/gen/sourcerepo1/src/lib.rs index ccfa7276c5..3243791a0b 100644 --- a/gen/sourcerepo1/src/lib.rs +++ b/gen/sourcerepo1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Source Repositories* crate version *1.0.8+20180718*, where *20180718* is the exact revision of the *sourcerepo:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Source Repositories* crate version *1.0.8+20190221*, where *20190221* is the exact revision of the *sourcerepo:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Source Repositories* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/source-repositories/docs/apis). @@ -480,22 +480,22 @@ impl RequestValue for SetIamPolicyRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, /// Textual representation of an expression in /// Common Expression Language syntax. /// /// The application context of the containing message determines which /// well-known feature set of CEL is supported. pub expression: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, /// An optional string indicating the location of the expression for error /// reporting, e.g. a file name and a position in the file. pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } impl Part for Expr {} @@ -662,6 +662,9 @@ pub struct PubsubConfig { /// `projects//topics/`. The project needs to be the same /// project as this config is in. pub topic: Option, + /// The format of the Cloud Pub/Sub messages. + #[serde(rename="messageFormat")] + pub message_format: Option, /// Email address of the service account used for publishing Cloud Pub/Sub /// messages. This service account needs to be in the same project as the /// PubsubConfig. When added, the caller needs to have @@ -669,9 +672,6 @@ pub struct PubsubConfig { /// unspecified, it defaults to the compute engine default service account. #[serde(rename="serviceAccountEmail")] pub service_account_email: Option, - /// The format of the Cloud Pub/Sub messages. - #[serde(rename="messageFormat")] - pub message_format: Option, } impl Part for PubsubConfig {} @@ -756,7 +756,7 @@ pub struct Binding { /// For example, `admins@example.com`. /// /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// * `domain:{domain}`: The G Suite domain (primary) that represents all the /// users of that domain. For example, `google.com` or `example.com`. /// /// @@ -782,9 +782,10 @@ pub struct Repo { /// URL to clone the repository from Google Cloud Source Repositories. /// Read-only field. pub url: Option, - /// The disk usage of the repo, in bytes. Read-only field. Size is only - /// returned by GetRepo. - pub size: Option, + /// How this repository publishes a change in the repository through Cloud + /// Pub/Sub. Keyed by the topic names. + #[serde(rename="pubsubConfigs")] + pub pubsub_configs: Option>, /// How this repository mirrors a repository managed by another service. /// Read-only field. #[serde(rename="mirrorConfig")] @@ -793,10 +794,9 @@ pub struct Repo { /// `projects//repos/`. The repo name may contain slashes. /// eg, `projects/myproject/repos/name/with/slash` pub name: Option, - /// How this repository publishes a change in the repository through Cloud - /// Pub/Sub. Keyed by the topic names. - #[serde(rename="pubsubConfigs")] - pub pubsub_configs: Option>, + /// The disk usage of the repo, in bytes. Read-only field. Size is only + /// returned by GetRepo. + pub size: Option, } impl RequestValue for Repo {} @@ -1265,7 +1265,7 @@ impl<'a, C, A> ProjectUpdateConfigCall<'a, C, A> where C: BorrowMut ProjectUpdateConfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1316,7 +1313,7 @@ impl<'a, C, A> ProjectUpdateConfigCall<'a, C, A> where C: BorrowMut ProjectUpdateConfigCall<'a, C, A> where C: BorrowMut ProjectRepoDeleteCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1557,10 +1554,7 @@ impl<'a, C, A> ProjectRepoDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1580,7 +1574,7 @@ impl<'a, C, A> ProjectRepoDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1659,7 +1653,7 @@ impl<'a, C, A> ProjectRepoDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1802,7 +1796,7 @@ impl<'a, C, A> ProjectRepoTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectRepoTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1853,7 +1844,7 @@ impl<'a, C, A> ProjectRepoTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectRepoTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectRepoSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRepoSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2137,7 +2125,7 @@ impl<'a, C, A> ProjectRepoSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRepoSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRepoPatchCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2385,10 +2373,7 @@ impl<'a, C, A> ProjectRepoPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2420,7 +2405,7 @@ impl<'a, C, A> ProjectRepoPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2511,7 +2496,7 @@ impl<'a, C, A> ProjectRepoPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2647,7 +2632,7 @@ impl<'a, C, A> ProjectRepoGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRepoGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2686,7 +2668,7 @@ impl<'a, C, A> ProjectRepoGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRepoGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectRepoCreateCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2925,10 +2907,7 @@ impl<'a, C, A> ProjectRepoCreateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2960,7 +2939,7 @@ impl<'a, C, A> ProjectRepoCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3051,7 +3030,7 @@ impl<'a, C, A> ProjectRepoCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3196,7 +3175,7 @@ impl<'a, C, A> ProjectRepoListCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3212,10 +3191,7 @@ impl<'a, C, A> ProjectRepoListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3235,7 +3211,7 @@ impl<'a, C, A> ProjectRepoListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3331,7 +3307,7 @@ impl<'a, C, A> ProjectRepoListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3465,7 +3441,7 @@ impl<'a, C, A> ProjectRepoGetCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3481,10 +3457,7 @@ impl<'a, C, A> ProjectRepoGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3504,7 +3477,7 @@ impl<'a, C, A> ProjectRepoGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3583,7 +3556,7 @@ impl<'a, C, A> ProjectRepoGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3717,7 +3690,7 @@ impl<'a, C, A> ProjectGetConfigCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3733,10 +3706,7 @@ impl<'a, C, A> ProjectGetConfigCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3756,7 +3726,7 @@ impl<'a, C, A> ProjectGetConfigCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3835,7 +3805,7 @@ impl<'a, C, A> ProjectGetConfigCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/spanner1-cli/Cargo.toml b/gen/spanner1-cli/Cargo.toml index fc30b613e2..b748bb4d9b 100644 --- a/gen/spanner1-cli/Cargo.toml +++ b/gen/spanner1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-spanner1-cli" -version = "1.0.8+20180920" +version = "1.0.8+20190312" authors = ["Sebastian Thiel "] description = "A complete library to interact with Spanner (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/spanner1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-spanner1] path = "../spanner1" -version = "1.0.8+20180920" +version = "1.0.8+20190312" diff --git a/gen/spanner1-cli/README.md b/gen/spanner1-cli/README.md index 38900a357f..8e1f576fd6 100644 --- a/gen/spanner1-cli/README.md +++ b/gen/spanner1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Spanner* API at revision *20180920*. The CLI is at version *1.0.8*. +This documentation was generated from the *Spanner* API at revision *20190312*. The CLI is at version *1.0.8*. ```bash spanner1 [options] @@ -47,6 +47,7 @@ spanner1 [options] instances-databases-sessions-commit (-r )... [-p ]... [-o ] instances-databases-sessions-create (-r )... [-p ]... [-o ] instances-databases-sessions-delete [-p ]... [-o ] + instances-databases-sessions-execute-batch-dml (-r )... [-p ]... [-o ] instances-databases-sessions-execute-sql (-r )... [-p ]... [-o ] instances-databases-sessions-execute-streaming-sql (-r )... [-p ]... [-o ] instances-databases-sessions-get [-p ]... [-o ] diff --git a/gen/spanner1-cli/mkdocs.yml b/gen/spanner1-cli/mkdocs.yml index 0d9d08cf63..57c11544a5 100644 --- a/gen/spanner1-cli/mkdocs.yml +++ b/gen/spanner1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Spanner v1.0.8+20180920 +site_name: Spanner v1.0.8+20190312 site_url: http://byron.github.io/google-apis-rs/google-spanner1-cli site_description: A complete library to interact with Spanner (protocol v1) @@ -26,6 +26,7 @@ pages: - ['projects_instances-databases-sessions-commit.md', 'Projects', 'Instances Databases Sessions Commit'] - ['projects_instances-databases-sessions-create.md', 'Projects', 'Instances Databases Sessions Create'] - ['projects_instances-databases-sessions-delete.md', 'Projects', 'Instances Databases Sessions Delete'] +- ['projects_instances-databases-sessions-execute-batch-dml.md', 'Projects', 'Instances Databases Sessions Execute Batch Dml'] - ['projects_instances-databases-sessions-execute-sql.md', 'Projects', 'Instances Databases Sessions Execute Sql'] - ['projects_instances-databases-sessions-execute-streaming-sql.md', 'Projects', 'Instances Databases Sessions Execute Streaming Sql'] - ['projects_instances-databases-sessions-get.md', 'Projects', 'Instances Databases Sessions Get'] diff --git a/gen/spanner1-cli/src/main.rs b/gen/spanner1-cli/src/main.rs index 868268be69..e84dce62e2 100644 --- a/gen/spanner1-cli/src/main.rs +++ b/gen/spanner1-cli/src/main.rs @@ -1172,6 +1172,104 @@ impl<'n> Engine<'n> { } } + fn _projects_instances_databases_sessions_execute_batch_dml(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "seqno" => Some(("seqno", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction.begin.read-only.min-read-timestamp" => Some(("transaction.begin.readOnly.minReadTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction.begin.read-only.read-timestamp" => Some(("transaction.begin.readOnly.readTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction.begin.read-only.max-staleness" => Some(("transaction.begin.readOnly.maxStaleness", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction.begin.read-only.exact-staleness" => Some(("transaction.begin.readOnly.exactStaleness", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction.begin.read-only.return-read-timestamp" => Some(("transaction.begin.readOnly.returnReadTimestamp", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "transaction.begin.read-only.strong" => Some(("transaction.begin.readOnly.strong", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "transaction.single-use.read-only.min-read-timestamp" => Some(("transaction.singleUse.readOnly.minReadTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction.single-use.read-only.read-timestamp" => Some(("transaction.singleUse.readOnly.readTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction.single-use.read-only.max-staleness" => Some(("transaction.singleUse.readOnly.maxStaleness", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction.single-use.read-only.exact-staleness" => Some(("transaction.singleUse.readOnly.exactStaleness", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transaction.single-use.read-only.return-read-timestamp" => Some(("transaction.singleUse.readOnly.returnReadTimestamp", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "transaction.single-use.read-only.strong" => Some(("transaction.singleUse.readOnly.strong", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "transaction.id" => Some(("transaction.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["begin", "exact-staleness", "id", "max-staleness", "min-read-timestamp", "read-only", "read-timestamp", "return-read-timestamp", "seqno", "single-use", "strong", "transaction"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ExecuteBatchDmlRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().instances_databases_sessions_execute_batch_dml(request, opt.value_of("session").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _projects_instances_databases_sessions_execute_sql(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -3031,6 +3129,9 @@ impl<'n> Engine<'n> { ("instances-databases-sessions-delete", Some(opt)) => { call_result = self._projects_instances_databases_sessions_delete(opt, dry_run, &mut err); }, + ("instances-databases-sessions-execute-batch-dml", Some(opt)) => { + call_result = self._projects_instances_databases_sessions_execute_batch_dml(opt, dry_run, &mut err); + }, ("instances-databases-sessions-execute-sql", Some(opt)) => { call_result = self._projects_instances_databases_sessions_execute_sql(opt, dry_run, &mut err); }, @@ -3191,7 +3292,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("projects", "methods: 'instance-configs-get', 'instance-configs-list', 'instances-create', 'instances-databases-create', 'instances-databases-drop-database', 'instances-databases-get', 'instances-databases-get-ddl', 'instances-databases-get-iam-policy', 'instances-databases-list', 'instances-databases-operations-cancel', 'instances-databases-operations-delete', 'instances-databases-operations-get', 'instances-databases-operations-list', 'instances-databases-sessions-begin-transaction', 'instances-databases-sessions-commit', 'instances-databases-sessions-create', 'instances-databases-sessions-delete', 'instances-databases-sessions-execute-sql', 'instances-databases-sessions-execute-streaming-sql', 'instances-databases-sessions-get', 'instances-databases-sessions-list', 'instances-databases-sessions-partition-query', 'instances-databases-sessions-partition-read', 'instances-databases-sessions-read', 'instances-databases-sessions-rollback', 'instances-databases-sessions-streaming-read', 'instances-databases-set-iam-policy', 'instances-databases-test-iam-permissions', 'instances-databases-update-ddl', 'instances-delete', 'instances-get', 'instances-get-iam-policy', 'instances-list', 'instances-operations-cancel', 'instances-operations-delete', 'instances-operations-get', 'instances-operations-list', 'instances-patch', 'instances-set-iam-policy' and 'instances-test-iam-permissions'", vec![ + ("projects", "methods: 'instance-configs-get', 'instance-configs-list', 'instances-create', 'instances-databases-create', 'instances-databases-drop-database', 'instances-databases-get', 'instances-databases-get-ddl', 'instances-databases-get-iam-policy', 'instances-databases-list', 'instances-databases-operations-cancel', 'instances-databases-operations-delete', 'instances-databases-operations-get', 'instances-databases-operations-list', 'instances-databases-sessions-begin-transaction', 'instances-databases-sessions-commit', 'instances-databases-sessions-create', 'instances-databases-sessions-delete', 'instances-databases-sessions-execute-batch-dml', 'instances-databases-sessions-execute-sql', 'instances-databases-sessions-execute-streaming-sql', 'instances-databases-sessions-get', 'instances-databases-sessions-list', 'instances-databases-sessions-partition-query', 'instances-databases-sessions-partition-read', 'instances-databases-sessions-read', 'instances-databases-sessions-rollback', 'instances-databases-sessions-streaming-read', 'instances-databases-set-iam-policy', 'instances-databases-test-iam-permissions', 'instances-databases-update-ddl', 'instances-delete', 'instances-get', 'instances-get-iam-policy', 'instances-list', 'instances-operations-cancel', 'instances-operations-delete', 'instances-operations-get', 'instances-operations-list', 'instances-patch', 'instances-set-iam-policy' and 'instances-test-iam-permissions'", vec![ ("instance-configs-get", Some(r##"Gets information about a particular instance configuration."##), "Details at http://byron.github.io/google-apis-rs/google_spanner1_cli/projects_instance-configs-get", @@ -3686,7 +3787,9 @@ fn main() { Some(false)), ]), ("instances-databases-sessions-delete", - Some(r##"Ends a session, releasing server resources associated with it."##), + Some(r##"Ends a session, releasing server resources associated with it. This will + asynchronously trigger cancellation of any operations that are running with + this session."##), "Details at http://byron.github.io/google-apis-rs/google_spanner1_cli/projects_instances-databases-sessions-delete", vec![ (Some(r##"name"##), @@ -3701,6 +3804,52 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("instances-databases-sessions-execute-batch-dml", + Some(r##"Executes a batch of SQL DML statements. This method allows many statements + to be run with lower latency than submitting them sequentially with + ExecuteSql. + + Statements are executed in order, sequentially. + ExecuteBatchDmlResponse will contain a + ResultSet for each DML statement that has successfully executed. If a + statement fails, its error status will be returned as part of the + ExecuteBatchDmlResponse. Execution will + stop at the first failed statement; the remaining statements will not run. + + ExecuteBatchDml is expected to return an OK status with a response even if + there was an error while processing one of the DML statements. Clients must + inspect response.status to determine if there were any errors while + processing the request. + + See more details in + ExecuteBatchDmlRequest and + ExecuteBatchDmlResponse."##), + "Details at http://byron.github.io/google-apis-rs/google_spanner1_cli/projects_instances-databases-sessions-execute-batch-dml", + vec![ + (Some(r##"session"##), + None, + Some(r##"Required. The session in which the DML statements should be performed."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -4470,7 +4619,7 @@ fn main() { let mut app = App::new("spanner1") .author("Sebastian Thiel ") - .version("1.0.8+20180920") + .version("1.0.8+20190312") .about("Cloud Spanner is a managed, mission-critical, globally consistent and scalable relational database service.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_spanner1_cli") .arg(Arg::with_name("url") diff --git a/gen/spanner1/Cargo.toml b/gen/spanner1/Cargo.toml index 65c5d6f884..90a87b25d8 100644 --- a/gen/spanner1/Cargo.toml +++ b/gen/spanner1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-spanner1" -version = "1.0.8+20180920" +version = "1.0.8+20190312" authors = ["Sebastian Thiel "] description = "A complete library to interact with Spanner (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/spanner1" homepage = "https://cloud.google.com/spanner/" -documentation = "https://docs.rs/google-spanner1/1.0.8+20180920" +documentation = "https://docs.rs/google-spanner1/1.0.8+20190312" license = "MIT" keywords = ["spanner", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/spanner1/README.md b/gen/spanner1/README.md index ef4094d686..b2b305d32a 100644 --- a/gen/spanner1/README.md +++ b/gen/spanner1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-spanner1` library allows access to all features of the *Google Spanner* service. -This documentation was generated from *Spanner* crate version *1.0.8+20180920*, where *20180920* is the exact revision of the *spanner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Spanner* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *spanner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Spanner* *v1* API can be found at the [official documentation site](https://cloud.google.com/spanner/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.Spanner.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.Spanner.html) ... * projects - * [*instance configs get*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceConfigGetCall.html), [*instance configs list*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceConfigListCall.html), [*instances create*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceCreateCall.html), [*instances databases create*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseCreateCall.html), [*instances databases drop database*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseDropDatabaseCall.html), [*instances databases get*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseGetCall.html), [*instances databases get ddl*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseGetDdlCall.html), [*instances databases get iam policy*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseGetIamPolicyCall.html), [*instances databases list*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseListCall.html), [*instances databases operations cancel*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseOperationCancelCall.html), [*instances databases operations delete*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseOperationDeleteCall.html), [*instances databases operations get*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseOperationGetCall.html), [*instances databases operations list*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseOperationListCall.html), [*instances databases sessions begin transaction*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionBeginTransactionCall.html), [*instances databases sessions commit*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionCommitCall.html), [*instances databases sessions create*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionCreateCall.html), [*instances databases sessions delete*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionDeleteCall.html), [*instances databases sessions execute sql*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionExecuteSqlCall.html), [*instances databases sessions execute streaming sql*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionExecuteStreamingSqlCall.html), [*instances databases sessions get*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionGetCall.html), [*instances databases sessions list*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionListCall.html), [*instances databases sessions partition query*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionPartitionQueryCall.html), [*instances databases sessions partition read*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionPartitionReadCall.html), [*instances databases sessions read*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionReadCall.html), [*instances databases sessions rollback*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionRollbackCall.html), [*instances databases sessions streaming read*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSessionStreamingReadCall.html), [*instances databases set iam policy*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseSetIamPolicyCall.html), [*instances databases test iam permissions*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseTestIamPermissionCall.html), [*instances databases update ddl*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDatabaseUpdateDdlCall.html), [*instances delete*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceDeleteCall.html), [*instances get*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceGetCall.html), [*instances get iam policy*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceGetIamPolicyCall.html), [*instances list*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceListCall.html), [*instances operations cancel*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceOperationCancelCall.html), [*instances operations delete*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceOperationDeleteCall.html), [*instances operations get*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceOperationGetCall.html), [*instances operations list*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceOperationListCall.html), [*instances patch*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstancePatchCall.html), [*instances set iam policy*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceSetIamPolicyCall.html) and [*instances test iam permissions*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.ProjectInstanceTestIamPermissionCall.html) + * [*instance configs get*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceConfigGetCall.html), [*instance configs list*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceConfigListCall.html), [*instances create*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceCreateCall.html), [*instances databases create*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseCreateCall.html), [*instances databases drop database*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseDropDatabaseCall.html), [*instances databases get*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseGetCall.html), [*instances databases get ddl*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseGetDdlCall.html), [*instances databases get iam policy*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseGetIamPolicyCall.html), [*instances databases list*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseListCall.html), [*instances databases operations cancel*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseOperationCancelCall.html), [*instances databases operations delete*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseOperationDeleteCall.html), [*instances databases operations get*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseOperationGetCall.html), [*instances databases operations list*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseOperationListCall.html), [*instances databases sessions begin transaction*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionBeginTransactionCall.html), [*instances databases sessions commit*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionCommitCall.html), [*instances databases sessions create*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionCreateCall.html), [*instances databases sessions delete*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionDeleteCall.html), [*instances databases sessions execute batch dml*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionExecuteBatchDmlCall.html), [*instances databases sessions execute sql*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionExecuteSqlCall.html), [*instances databases sessions execute streaming sql*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionExecuteStreamingSqlCall.html), [*instances databases sessions get*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionGetCall.html), [*instances databases sessions list*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionListCall.html), [*instances databases sessions partition query*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionPartitionQueryCall.html), [*instances databases sessions partition read*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionPartitionReadCall.html), [*instances databases sessions read*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionReadCall.html), [*instances databases sessions rollback*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionRollbackCall.html), [*instances databases sessions streaming read*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSessionStreamingReadCall.html), [*instances databases set iam policy*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseSetIamPolicyCall.html), [*instances databases test iam permissions*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseTestIamPermissionCall.html), [*instances databases update ddl*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDatabaseUpdateDdlCall.html), [*instances delete*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceDeleteCall.html), [*instances get*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceGetCall.html), [*instances get iam policy*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceGetIamPolicyCall.html), [*instances list*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceListCall.html), [*instances operations cancel*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceOperationCancelCall.html), [*instances operations delete*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceOperationDeleteCall.html), [*instances operations get*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceOperationGetCall.html), [*instances operations list*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceOperationListCall.html), [*instances patch*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstancePatchCall.html), [*instances set iam policy*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceSetIamPolicyCall.html) and [*instances test iam permissions*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.ProjectInstanceTestIamPermissionCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/struct.Spanner.html)** +* **[Hub](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/struct.Spanner.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.Part.html)** + * **[Parts](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -137,17 +137,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -157,29 +157,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-spanner1/1.0.8+20180920/google_spanner1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-spanner1/1.0.8+20190312/google_spanner1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/spanner1/src/lib.rs b/gen/spanner1/src/lib.rs index ed3f53875e..5663337c4a 100644 --- a/gen/spanner1/src/lib.rs +++ b/gen/spanner1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Spanner* crate version *1.0.8+20180920*, where *20180920* is the exact revision of the *spanner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Spanner* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *spanner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Spanner* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/spanner/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Spanner.html) ... //! //! * projects -//! * [*instance configs get*](struct.ProjectInstanceConfigGetCall.html), [*instance configs list*](struct.ProjectInstanceConfigListCall.html), [*instances create*](struct.ProjectInstanceCreateCall.html), [*instances databases create*](struct.ProjectInstanceDatabaseCreateCall.html), [*instances databases drop database*](struct.ProjectInstanceDatabaseDropDatabaseCall.html), [*instances databases get*](struct.ProjectInstanceDatabaseGetCall.html), [*instances databases get ddl*](struct.ProjectInstanceDatabaseGetDdlCall.html), [*instances databases get iam policy*](struct.ProjectInstanceDatabaseGetIamPolicyCall.html), [*instances databases list*](struct.ProjectInstanceDatabaseListCall.html), [*instances databases operations cancel*](struct.ProjectInstanceDatabaseOperationCancelCall.html), [*instances databases operations delete*](struct.ProjectInstanceDatabaseOperationDeleteCall.html), [*instances databases operations get*](struct.ProjectInstanceDatabaseOperationGetCall.html), [*instances databases operations list*](struct.ProjectInstanceDatabaseOperationListCall.html), [*instances databases sessions begin transaction*](struct.ProjectInstanceDatabaseSessionBeginTransactionCall.html), [*instances databases sessions commit*](struct.ProjectInstanceDatabaseSessionCommitCall.html), [*instances databases sessions create*](struct.ProjectInstanceDatabaseSessionCreateCall.html), [*instances databases sessions delete*](struct.ProjectInstanceDatabaseSessionDeleteCall.html), [*instances databases sessions execute sql*](struct.ProjectInstanceDatabaseSessionExecuteSqlCall.html), [*instances databases sessions execute streaming sql*](struct.ProjectInstanceDatabaseSessionExecuteStreamingSqlCall.html), [*instances databases sessions get*](struct.ProjectInstanceDatabaseSessionGetCall.html), [*instances databases sessions list*](struct.ProjectInstanceDatabaseSessionListCall.html), [*instances databases sessions partition query*](struct.ProjectInstanceDatabaseSessionPartitionQueryCall.html), [*instances databases sessions partition read*](struct.ProjectInstanceDatabaseSessionPartitionReadCall.html), [*instances databases sessions read*](struct.ProjectInstanceDatabaseSessionReadCall.html), [*instances databases sessions rollback*](struct.ProjectInstanceDatabaseSessionRollbackCall.html), [*instances databases sessions streaming read*](struct.ProjectInstanceDatabaseSessionStreamingReadCall.html), [*instances databases set iam policy*](struct.ProjectInstanceDatabaseSetIamPolicyCall.html), [*instances databases test iam permissions*](struct.ProjectInstanceDatabaseTestIamPermissionCall.html), [*instances databases update ddl*](struct.ProjectInstanceDatabaseUpdateDdlCall.html), [*instances delete*](struct.ProjectInstanceDeleteCall.html), [*instances get*](struct.ProjectInstanceGetCall.html), [*instances get iam policy*](struct.ProjectInstanceGetIamPolicyCall.html), [*instances list*](struct.ProjectInstanceListCall.html), [*instances operations cancel*](struct.ProjectInstanceOperationCancelCall.html), [*instances operations delete*](struct.ProjectInstanceOperationDeleteCall.html), [*instances operations get*](struct.ProjectInstanceOperationGetCall.html), [*instances operations list*](struct.ProjectInstanceOperationListCall.html), [*instances patch*](struct.ProjectInstancePatchCall.html), [*instances set iam policy*](struct.ProjectInstanceSetIamPolicyCall.html) and [*instances test iam permissions*](struct.ProjectInstanceTestIamPermissionCall.html) +//! * [*instance configs get*](struct.ProjectInstanceConfigGetCall.html), [*instance configs list*](struct.ProjectInstanceConfigListCall.html), [*instances create*](struct.ProjectInstanceCreateCall.html), [*instances databases create*](struct.ProjectInstanceDatabaseCreateCall.html), [*instances databases drop database*](struct.ProjectInstanceDatabaseDropDatabaseCall.html), [*instances databases get*](struct.ProjectInstanceDatabaseGetCall.html), [*instances databases get ddl*](struct.ProjectInstanceDatabaseGetDdlCall.html), [*instances databases get iam policy*](struct.ProjectInstanceDatabaseGetIamPolicyCall.html), [*instances databases list*](struct.ProjectInstanceDatabaseListCall.html), [*instances databases operations cancel*](struct.ProjectInstanceDatabaseOperationCancelCall.html), [*instances databases operations delete*](struct.ProjectInstanceDatabaseOperationDeleteCall.html), [*instances databases operations get*](struct.ProjectInstanceDatabaseOperationGetCall.html), [*instances databases operations list*](struct.ProjectInstanceDatabaseOperationListCall.html), [*instances databases sessions begin transaction*](struct.ProjectInstanceDatabaseSessionBeginTransactionCall.html), [*instances databases sessions commit*](struct.ProjectInstanceDatabaseSessionCommitCall.html), [*instances databases sessions create*](struct.ProjectInstanceDatabaseSessionCreateCall.html), [*instances databases sessions delete*](struct.ProjectInstanceDatabaseSessionDeleteCall.html), [*instances databases sessions execute batch dml*](struct.ProjectInstanceDatabaseSessionExecuteBatchDmlCall.html), [*instances databases sessions execute sql*](struct.ProjectInstanceDatabaseSessionExecuteSqlCall.html), [*instances databases sessions execute streaming sql*](struct.ProjectInstanceDatabaseSessionExecuteStreamingSqlCall.html), [*instances databases sessions get*](struct.ProjectInstanceDatabaseSessionGetCall.html), [*instances databases sessions list*](struct.ProjectInstanceDatabaseSessionListCall.html), [*instances databases sessions partition query*](struct.ProjectInstanceDatabaseSessionPartitionQueryCall.html), [*instances databases sessions partition read*](struct.ProjectInstanceDatabaseSessionPartitionReadCall.html), [*instances databases sessions read*](struct.ProjectInstanceDatabaseSessionReadCall.html), [*instances databases sessions rollback*](struct.ProjectInstanceDatabaseSessionRollbackCall.html), [*instances databases sessions streaming read*](struct.ProjectInstanceDatabaseSessionStreamingReadCall.html), [*instances databases set iam policy*](struct.ProjectInstanceDatabaseSetIamPolicyCall.html), [*instances databases test iam permissions*](struct.ProjectInstanceDatabaseTestIamPermissionCall.html), [*instances databases update ddl*](struct.ProjectInstanceDatabaseUpdateDdlCall.html), [*instances delete*](struct.ProjectInstanceDeleteCall.html), [*instances get*](struct.ProjectInstanceGetCall.html), [*instances get iam policy*](struct.ProjectInstanceGetIamPolicyCall.html), [*instances list*](struct.ProjectInstanceListCall.html), [*instances operations cancel*](struct.ProjectInstanceOperationCancelCall.html), [*instances operations delete*](struct.ProjectInstanceOperationDeleteCall.html), [*instances operations get*](struct.ProjectInstanceOperationGetCall.html), [*instances operations list*](struct.ProjectInstanceOperationListCall.html), [*instances patch*](struct.ProjectInstancePatchCall.html), [*instances set iam policy*](struct.ProjectInstanceSetIamPolicyCall.html) and [*instances test iam permissions*](struct.ProjectInstanceTestIamPermissionCall.html) //! //! //! @@ -385,185 +385,6 @@ impl<'a, C, A> Spanner // ############ // SCHEMAS ### // ########## -/// The response for ListInstances. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances list projects](struct.ProjectInstanceListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListInstancesResponse { - /// `next_page_token` can be sent in a subsequent - /// ListInstances call to fetch more - /// of the matching instances. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of requested instances. - pub instances: Option>, -} - -impl ResponseResult for ListInstancesResponse {} - - -/// Contains an ordered list of nodes appearing in the query plan. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct QueryPlan { - /// The nodes in the query plan. Plan nodes are returned in pre-order starting - /// with the plan root. Each PlanNode's `id` corresponds to its index in - /// `plan_nodes`. - #[serde(rename="planNodes")] - pub plan_nodes: Option>, -} - -impl Part for QueryPlan {} - - -/// The response for ListInstanceConfigs. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instance configs list projects](struct.ProjectInstanceConfigListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListInstanceConfigsResponse { - /// `next_page_token` can be sent in a subsequent - /// ListInstanceConfigs call to - /// fetch more of the matching instance configurations. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of requested instance configurations. - #[serde(rename="instanceConfigs")] - pub instance_configs: Option>, -} - -impl ResponseResult for ListInstanceConfigsResponse {} - - -/// Request message for `SetIamPolicy` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases set iam policy projects](struct.ProjectInstanceDatabaseSetIamPolicyCall.html) (request) -/// * [instances set iam policy projects](struct.ProjectInstanceSetIamPolicyCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SetIamPolicyRequest { - /// REQUIRED: The complete policy to be applied to the `resource`. The size of - /// the policy is limited to a few 10s of KB. An empty policy is a - /// valid policy but certain Cloud Platform services (such as Projects) - /// might reject them. - pub policy: Option, -} - -impl RequestValue for SetIamPolicyRequest {} - - -/// The request for PartitionQuery -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases sessions partition query projects](struct.ProjectInstanceDatabaseSessionPartitionQueryCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PartitionQueryRequest { - /// Additional options that affect how many partitions are created. - #[serde(rename="partitionOptions")] - pub partition_options: Option, - /// It is not always possible for Cloud Spanner to infer the right SQL type - /// from a JSON value. For example, values of type `BYTES` and values - /// of type `STRING` both appear in params as JSON strings. - /// - /// In these cases, `param_types` can be used to specify the exact - /// SQL type for some or all of the SQL query parameters. See the - /// definition of Type for more information - /// about SQL types. - #[serde(rename="paramTypes")] - pub param_types: Option>, - /// Read only snapshot transactions are supported, read/write and single use - /// transactions are not. - pub transaction: Option, - /// The SQL query string can contain parameter placeholders. A parameter - /// placeholder consists of `'@'` followed by the parameter - /// name. Parameter names consist of any combination of letters, - /// numbers, and underscores. - /// - /// Parameters can appear anywhere that a literal value is expected. The same - /// parameter name can be used more than once, for example: - /// `"WHERE id > @msg_id AND id < @msg_id + 100"` - /// - /// It is an error to execute an SQL query with unbound parameters. - /// - /// Parameter values are specified using `params`, which is a JSON - /// object whose keys are parameter names, and whose values are the - /// corresponding parameter values. - pub params: Option>, - /// The query request to generate partitions for. The request will fail if - /// the query is not root partitionable. The query plan of a root - /// partitionable query has a single distributed union operator. A distributed - /// union operator conceptually divides one or more tables into multiple - /// splits, remotely evaluates a subquery independently on each split, and - /// then unions all results. - /// - /// This must not contain DML commands, such as INSERT, UPDATE, or - /// DELETE. Use ExecuteStreamingSql with a - /// PartitionedDml transaction for large, partition-friendly DML operations. - pub sql: Option, -} - -impl RequestValue for PartitionQueryRequest {} - - -/// Results from Read or -/// ExecuteSql. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases sessions execute sql projects](struct.ProjectInstanceDatabaseSessionExecuteSqlCall.html) (response) -/// * [instances databases sessions read projects](struct.ProjectInstanceDatabaseSessionReadCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResultSet { - /// Each element in `rows` is a row whose format is defined by - /// metadata.row_type. The ith element - /// in each row matches the ith field in - /// metadata.row_type. Elements are - /// encoded based on type as described - /// here. - pub rows: Option>>, - /// Query plan and execution statistics for the SQL statement that - /// produced this result set. These can be requested by setting - /// ExecuteSqlRequest.query_mode. - /// DML statements always produce stats containing the number of rows - /// modified, unless executed using the - /// ExecuteSqlRequest.QueryMode.PLAN ExecuteSqlRequest.query_mode. - /// Other fields may or may not be populated, based on the - /// ExecuteSqlRequest.query_mode. - pub stats: Option, - /// Metadata about the result set, such as row type information. - pub metadata: Option, -} - -impl ResponseResult for ResultSet {} - - /// The response for ListSessions. /// /// # Activities @@ -605,35 +426,6 @@ pub struct CreateSessionRequest { impl RequestValue for CreateSessionRequest {} -/// Arguments to insert, update, insert_or_update, and -/// replace operations. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Write { - /// Required. The table whose rows will be written. - pub table: Option, - /// The values to be written. `values` can contain more than one - /// list of values. If it does, then multiple rows are written, one - /// for each entry in `values`. Each list in `values` must have - /// exactly as many entries as there are entries in columns - /// above. Sending multiple lists is equivalent to sending multiple - /// `Mutation`s, each containing one `values` entry and repeating - /// table and columns. Individual values in each list are - /// encoded as described here. - pub values: Option>>, - /// The names of the columns in table to be written. - /// - /// The list of columns must contain enough columns to allow - /// Cloud Spanner to derive values for all primary key columns in the - /// row(s) to be modified. - pub columns: Option>, -} - -impl Part for Write {} - - /// An isolated set of Cloud Spanner resources on which databases can be hosted. /// /// # Activities @@ -699,45 +491,6 @@ pub struct Instance { impl ResponseResult for Instance {} -/// The response for ListDatabases. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases list projects](struct.ProjectInstanceDatabaseListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListDatabasesResponse { - /// `next_page_token` can be sent in a subsequent - /// ListDatabases call to fetch more - /// of the matching databases. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Databases that matched the request. - pub databases: Option>, -} - -impl ResponseResult for ListDatabasesResponse {} - - -/// Request message for `GetIamPolicy` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances get iam policy projects](struct.ProjectInstanceGetIamPolicyCall.html) (request) -/// * [instances databases get iam policy projects](struct.ProjectInstanceDatabaseGetIamPolicyCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetIamPolicyRequest { _never_set: Option } - -impl RequestValue for GetIamPolicyRequest {} - - /// KeyRange represents a range of rows in a table or index. /// /// A range has a start key and an end key. These keys can be open or @@ -861,11 +614,9 @@ pub struct Mutation { /// Insert new rows in a table. If any of the rows already exist, /// the write or transaction fails with error `ALREADY_EXISTS`. pub insert: Option, - /// Like insert, except that if the row already exists, it is - /// deleted, and the column values provided are inserted - /// instead. Unlike insert_or_update, this means any values not - /// explicitly written become `NULL`. - pub replace: Option, + /// Delete rows from a table. Succeeds whether or not the named + /// rows were present. + pub delete: Option, /// Like insert, except that if the row already exists, then /// its column values are overwritten with the ones provided. Any /// column values not explicitly written are preserved. @@ -874,14 +625,1126 @@ pub struct Mutation { /// Update existing rows in a table. If any of the rows does not /// already exist, the transaction fails with error `NOT_FOUND`. pub update: Option, - /// Delete rows from a table. Succeeds whether or not the named - /// rows were present. - pub delete: Option, + /// Like insert, except that if the row already exists, it is + /// deleted, and the column values provided are inserted + /// instead. Unlike insert_or_update, this means any values not + /// explicitly written become `NULL`. + pub replace: Option, } impl Part for Mutation {} +/// A single DML statement. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Statement { + /// It is not always possible for Cloud Spanner to infer the right SQL type + /// from a JSON value. For example, values of type `BYTES` and values + /// of type `STRING` both appear in params as JSON strings. + /// + /// In these cases, `param_types` can be used to specify the exact + /// SQL type for some or all of the SQL statement parameters. See the + /// definition of Type for more information + /// about SQL types. + #[serde(rename="paramTypes")] + pub param_types: Option>, + /// The DML string can contain parameter placeholders. A parameter + /// placeholder consists of `'@'` followed by the parameter + /// name. Parameter names consist of any combination of letters, + /// numbers, and underscores. + /// + /// Parameters can appear anywhere that a literal value is expected. The + /// same parameter name can be used more than once, for example: + /// `"WHERE id > @msg_id AND id < @msg_id + 100"` + /// + /// It is an error to execute an SQL statement with unbound parameters. + /// + /// Parameter values are specified using `params`, which is a JSON + /// object whose keys are parameter names, and whose values are the + /// corresponding parameter values. + pub params: Option>, + /// Required. The DML string. + pub sql: Option, +} + +impl Part for Statement {} + + +/// Enqueues the given DDL statements to be applied, in order but not +/// necessarily all at once, to the database schema at some point (or +/// points) in the future. The server checks that the statements +/// are executable (syntactically valid, name tables that exist, etc.) +/// before enqueueing them, but they may still fail upon +/// later execution (e.g., if a statement from another batch of +/// statements is applied first and it conflicts in some way, or if +/// there is some data-related problem like a `NULL` value in a column to +/// which `NOT NULL` would be added). If a statement fails, all +/// subsequent statements in the batch are automatically cancelled. +/// +/// Each batch of statements is assigned a name which can be used with +/// the Operations API to monitor +/// progress. See the +/// operation_id field for more +/// details. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases update ddl projects](struct.ProjectInstanceDatabaseUpdateDdlCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UpdateDatabaseDdlRequest { + /// DDL statements to be applied to the database. + pub statements: Option>, + /// If empty, the new update request is assigned an + /// automatically-generated operation ID. Otherwise, `operation_id` + /// is used to construct the name of the resulting + /// Operation. + /// + /// Specifying an explicit operation ID simplifies determining + /// whether the statements were executed in the event that the + /// UpdateDatabaseDdl call is replayed, + /// or the return value is otherwise lost: the database and + /// `operation_id` fields can be combined to form the + /// name of the resulting + /// longrunning.Operation: `/operations/`. + /// + /// `operation_id` should be unique within the database, and must be + /// a valid identifier: `a-z*`. Note that + /// automatically-generated operation IDs always begin with an + /// underscore. If the named operation already exists, + /// UpdateDatabaseDdl returns + /// `ALREADY_EXISTS`. + #[serde(rename="operationId")] + pub operation_id: Option, +} + +impl RequestValue for UpdateDatabaseDdlRequest {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases operations cancel projects](struct.ProjectInstanceDatabaseOperationCancelCall.html) (response) +/// * [instances databases drop database projects](struct.ProjectInstanceDatabaseDropDatabaseCall.html) (response) +/// * [instances operations delete projects](struct.ProjectInstanceOperationDeleteCall.html) (response) +/// * [instances databases operations delete projects](struct.ProjectInstanceDatabaseOperationDeleteCall.html) (response) +/// * [instances delete projects](struct.ProjectInstanceDeleteCall.html) (response) +/// * [instances operations cancel projects](struct.ProjectInstanceOperationCancelCall.html) (response) +/// * [instances databases sessions rollback projects](struct.ProjectInstanceDatabaseSessionRollbackCall.html) (response) +/// * [instances databases sessions delete projects](struct.ProjectInstanceDatabaseSessionDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// The `Status` type defines a logical error model that is suitable for different +/// programming environments, including REST APIs and RPC APIs. It is used by +/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// +/// - Simple to use and understand for most users +/// - Flexible enough to meet unexpected needs +/// +/// # Overview +/// +/// The `Status` message contains three pieces of data: error code, error message, +/// and error details. The error code should be an enum value of +/// google.rpc.Code, but it may accept additional error codes if needed. The +/// error message should be a developer-facing English message that helps +/// developers *understand* and *resolve* the error. If a localized user-facing +/// error message is needed, put the localized message in the error details or +/// localize it in the client. The optional error details may contain arbitrary +/// information about the error. There is a predefined set of error detail types +/// in the package `google.rpc` that can be used for common error conditions. +/// +/// # Language mapping +/// +/// The `Status` message is the logical representation of the error model, but it +/// is not necessarily the actual wire format. When the `Status` message is +/// exposed in different client libraries and different wire protocols, it can be +/// mapped differently. For example, it will likely be mapped to some exceptions +/// in Java, but more likely mapped to some error codes in C. +/// +/// # Other uses +/// +/// The error model and the `Status` message can be used in a variety of +/// environments, either with or without APIs, to provide a +/// consistent developer experience across different environments. +/// +/// Example uses of this error model include: +/// +/// - Partial errors. If a service needs to return partial errors to the client, +/// it may embed the `Status` in the normal response to indicate the partial +/// errors. +/// +/// - Workflow errors. A typical workflow has multiple steps. Each step may +/// have a `Status` message for error reporting. +/// +/// - Batch operations. If a client uses batch request and batch response, the +/// `Status` message should be used directly inside batch response, one for +/// each error sub-response. +/// +/// - Asynchronous operations. If an API call embeds asynchronous operation +/// results in its response, the status of those operations should be +/// represented directly using the `Status` message. +/// +/// - Logging. If some API errors are stored in logs, the message `Status` could +/// be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// A developer-facing error message, which should be in English. Any + /// user-facing error message should be localized and sent in the + /// google.rpc.Status.details field, or localized by the client. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There is a common set of + /// message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases test iam permissions projects](struct.ProjectInstanceDatabaseTestIamPermissionCall.html) (response) +/// * [instances test iam permissions projects](struct.ProjectInstanceTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is + /// allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestIamPermissionsResponse {} + + +/// The request for CreateInstance. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances create projects](struct.ProjectInstanceCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateInstanceRequest { + /// Required. The ID of the instance to create. Valid identifiers are of the + /// form `a-z*[a-z0-9]` and must be between 6 and 30 characters in + /// length. + #[serde(rename="instanceId")] + pub instance_id: Option, + /// Required. The instance to create. The name may be omitted, but if + /// specified must be `/instances/`. + pub instance: Option, +} + +impl RequestValue for CreateInstanceRequest {} + + +/// `StructType` defines the fields of a STRUCT type. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StructType { + /// The list of fields that make up this struct. Order is + /// significant, because values of this struct type are represented as + /// lists, where the order of field values matches the order of + /// fields in the StructType. In turn, the order of fields + /// matches the order of columns in a read request, or the order of + /// fields in the `SELECT` clause of a query. + pub fields: Option>, +} + +impl Part for StructType {} + + +/// Request message for `GetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances get iam policy projects](struct.ProjectInstanceGetIamPolicyCall.html) (request) +/// * [instances databases get iam policy projects](struct.ProjectInstanceDatabaseGetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetIamPolicyRequest { _never_set: Option } + +impl RequestValue for GetIamPolicyRequest {} + + +/// A Cloud Spanner database. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases get projects](struct.ProjectInstanceDatabaseGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Database { + /// Output only. The current database state. + pub state: Option, + /// Required. The name of the database. Values are of the form + /// `projects//instances//databases/`, + /// where `` is as specified in the `CREATE DATABASE` + /// statement. This name can be passed to other API methods to + /// identify the database. + pub name: Option, +} + +impl ResponseResult for Database {} + + +/// The response for ExecuteBatchDml. Contains a list +/// of ResultSet, one for each DML statement that has successfully executed. +/// If a statement fails, the error is returned as part of the response payload. +/// Clients can determine whether all DML statements have run successfully, or if +/// a statement failed, using one of the following approaches: +/// +/// 1. Check if 'status' field is OkStatus. +/// 2. Check if result_sets_size() equals the number of statements in +/// ExecuteBatchDmlRequest. +/// +/// Example 1: A request with 5 DML statements, all executed successfully. +/// Result: A response with 5 ResultSets, one for each statement in the same +/// order, and an OK status. +/// +/// Example 2: A request with 5 DML statements. The 3rd statement has a syntax +/// error. +/// Result: A response with 2 ResultSets, for the first 2 statements that +/// run successfully, and a syntax error (INVALID_ARGUMENT) status. From +/// result_set_size() client can determine that the 3rd statement has failed. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases sessions execute batch dml projects](struct.ProjectInstanceDatabaseSessionExecuteBatchDmlCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExecuteBatchDmlResponse { + /// If all DML statements are executed successfully, status will be OK. + /// Otherwise, the error status of the first failed statement. + pub status: Option, + /// ResultSets, one for each statement in the request that ran successfully, in + /// the same order as the statements in the request. Each ResultSet will + /// not contain any rows. The ResultSetStats in each ResultSet will + /// contain the number of rows modified by the statement. + /// + /// Only the first ResultSet in the response contains a valid + /// ResultSetMetadata. + #[serde(rename="resultSets")] + pub result_sets: Option>, +} + +impl ResponseResult for ExecuteBatchDmlResponse {} + + +/// The response for GetDatabaseDdl. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases get ddl projects](struct.ProjectInstanceDatabaseGetDdlCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetDatabaseDdlResponse { + /// A list of formatted DDL statements defining the schema of the database + /// specified in the request. + pub statements: Option>, +} + +impl ResponseResult for GetDatabaseDdlResponse {} + + +/// The response for PartitionQuery +/// or PartitionRead +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases sessions partition query projects](struct.ProjectInstanceDatabaseSessionPartitionQueryCall.html) (response) +/// * [instances databases sessions partition read projects](struct.ProjectInstanceDatabaseSessionPartitionReadCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PartitionResponse { + /// Transaction created by this request. + pub transaction: Option, + /// Partitions created by this request. + pub partitions: Option>, +} + +impl ResponseResult for PartitionResponse {} + + +/// The request for PartitionRead +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases sessions partition read projects](struct.ProjectInstanceDatabaseSessionPartitionReadCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PartitionReadRequest { + /// If non-empty, the name of an index on table. This index is + /// used instead of the table primary key when interpreting key_set + /// and sorting result rows. See key_set for further information. + pub index: Option, + /// Read only snapshot transactions are supported, read/write and single use + /// transactions are not. + pub transaction: Option, + /// Required. `key_set` identifies the rows to be yielded. `key_set` names the + /// primary keys of the rows in table to be yielded, unless index + /// is present. If index is present, then key_set instead names + /// index keys in index. + /// + /// It is not an error for the `key_set` to name rows that do not + /// exist in the database. Read yields nothing for nonexistent rows. + #[serde(rename="keySet")] + pub key_set: Option, + /// Additional options that affect how many partitions are created. + #[serde(rename="partitionOptions")] + pub partition_options: Option, + /// Required. The name of the table in the database to be read. + pub table: Option, + /// The columns of table to be returned for each row matching + /// this request. + pub columns: Option>, +} + +impl RequestValue for PartitionReadRequest {} + + +/// This message is used to select the transaction in which a +/// Read or +/// ExecuteSql call runs. +/// +/// See TransactionOptions for more information about transactions. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TransactionSelector { + /// Begin a new transaction and execute this read or SQL query in + /// it. The transaction ID of the new transaction is returned in + /// ResultSetMetadata.transaction, which is a Transaction. + pub begin: Option, + /// Execute the read or SQL query in a temporary transaction. + /// This is the most efficient way to execute a transaction that + /// consists of a single SQL query. + #[serde(rename="singleUse")] + pub single_use: Option, + /// Execute the read or SQL query in a previously-started transaction. + pub id: Option, +} + +impl Part for TransactionSelector {} + + +/// Message type to initiate a read-write transaction. Currently this +/// transaction type has no options. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReadWrite { _never_set: Option } + +impl Part for ReadWrite {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. + /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + pub role: Option, + /// Unimplemented. The condition that is associated with this binding. + /// NOTE: an unsatisfied condition will not allow user access via current + /// binding. Different bindings, including their conditions, are examined + /// independently. + pub condition: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. + /// `members` can have the following values: + /// + /// * `allUsers`: A special identifier that represents anyone who is + /// on the internet; with or without a Google account. + /// + /// * `allAuthenticatedUsers`: A special identifier that represents anyone + /// who is authenticated with a Google account or a service account. + /// + /// * `user:{emailid}`: An email address that represents a specific Google + /// account. For example, `alice@gmail.com` . + /// + /// + /// * `serviceAccount:{emailid}`: An email address that represents a service + /// account. For example, `my-other-app@appspot.gserviceaccount.com`. + /// + /// * `group:{emailid}`: An email address that represents a Google group. + /// For example, `admins@example.com`. + /// + /// + /// * `domain:{domain}`: A Google Apps domain name that represents all the + /// users of that domain. For example, `google.com` or `example.com`. + /// + /// + pub members: Option>, +} + +impl Part for Binding {} + + +/// Message type to initiate a Partitioned DML transaction. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PartitionedDml { _never_set: Option } + +impl Part for PartitionedDml {} + + +/// The request for CreateDatabase. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases create projects](struct.ProjectInstanceDatabaseCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateDatabaseRequest { + /// An optional list of DDL statements to run inside the newly created + /// database. Statements can create tables, indexes, etc. These + /// statements execute atomically with the creation of the database: + /// if there is an error in any statement, the database is not created. + #[serde(rename="extraStatements")] + pub extra_statements: Option>, + /// Required. A `CREATE DATABASE` statement, which specifies the ID of the + /// new database. The database ID must conform to the regular expression + /// `a-z*[a-z0-9]` and be between 2 and 30 characters in length. + /// If the database ID is a reserved word or if it contains a hyphen, the + /// database ID must be enclosed in backticks (`` ` ``). + #[serde(rename="createStatement")] + pub create_statement: Option, +} + +impl RequestValue for CreateDatabaseRequest {} + + +/// The request for Rollback. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases sessions rollback projects](struct.ProjectInstanceDatabaseSessionRollbackCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RollbackRequest { + /// Required. The transaction to roll back. + #[serde(rename="transactionId")] + pub transaction_id: Option, +} + +impl RequestValue for RollbackRequest {} + + +/// `KeySet` defines a collection of Cloud Spanner keys and/or key ranges. All +/// the keys are expected to be in the same table or index. The keys need +/// not be sorted in any particular way. +/// +/// If the same key is specified multiple times in the set (for example +/// if two ranges, two keys, or a key and a range overlap), Cloud Spanner +/// behaves as if the key were only specified once. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct KeySet { + /// A list of specific keys. Entries in `keys` should have exactly as + /// many elements as there are columns in the primary or index key + /// with which this `KeySet` is used. Individual key values are + /// encoded as described here. + pub keys: Option>>, + /// A list of key ranges. See KeyRange for more information about + /// key range specifications. + pub ranges: Option>, + /// For convenience `all` can be set to `true` to indicate that this + /// `KeySet` matches all keys in the table or index. Note that any keys + /// specified in `keys` or `ranges` are only yielded once. + pub all: Option, +} + +impl Part for KeySet {} + + +/// Message type to initiate a read-only transaction. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReadOnly { + /// Executes all reads at a timestamp >= `min_read_timestamp`. + /// + /// This is useful for requesting fresher data than some previous + /// read, or data that is fresh enough to observe the effects of some + /// previously committed transaction whose timestamp is known. + /// + /// Note that this option can only be used in single-use transactions. + /// + /// A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + /// Example: `"2014-10-02T15:01:23.045123456Z"`. + #[serde(rename="minReadTimestamp")] + pub min_read_timestamp: Option, + /// If true, the Cloud Spanner-selected read timestamp is included in + /// the Transaction message that describes the transaction. + #[serde(rename="returnReadTimestamp")] + pub return_read_timestamp: Option, + /// Read at a timestamp where all previously committed transactions + /// are visible. + pub strong: Option, + /// Executes all reads at the given timestamp. Unlike other modes, + /// reads at a specific timestamp are repeatable; the same read at + /// the same timestamp always returns the same data. If the + /// timestamp is in the future, the read will block until the + /// specified timestamp, modulo the read's deadline. + /// + /// Useful for large scale consistent reads such as mapreduces, or + /// for coordinating many reads against a consistent snapshot of the + /// data. + /// + /// A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + /// Example: `"2014-10-02T15:01:23.045123456Z"`. + #[serde(rename="readTimestamp")] + pub read_timestamp: Option, + /// Read data at a timestamp >= `NOW - max_staleness` + /// seconds. Guarantees that all writes that have committed more + /// than the specified number of seconds ago are visible. Because + /// Cloud Spanner chooses the exact timestamp, this mode works even if + /// the client's local clock is substantially skewed from Cloud Spanner + /// commit timestamps. + /// + /// Useful for reading the freshest data available at a nearby + /// replica, while bounding the possible staleness if the local + /// replica has fallen behind. + /// + /// Note that this option can only be used in single-use + /// transactions. + #[serde(rename="maxStaleness")] + pub max_staleness: Option, + /// Executes all reads at a timestamp that is `exact_staleness` + /// old. The timestamp is chosen soon after the read is started. + /// + /// Guarantees that all writes that have committed more than the + /// specified number of seconds ago are visible. Because Cloud Spanner + /// chooses the exact timestamp, this mode works even if the client's + /// local clock is substantially skewed from Cloud Spanner commit + /// timestamps. + /// + /// Useful for reading at nearby replicas without the distributed + /// timestamp negotiation overhead of `max_staleness`. + #[serde(rename="exactStaleness")] + pub exact_staleness: Option, +} + +impl Part for ReadOnly {} + + +/// Metadata associated with a parent-child relationship appearing in a +/// PlanNode. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChildLink { + /// Only present if the child node is SCALAR and corresponds + /// to an output variable of the parent node. The field carries the name of + /// the output variable. + /// For example, a `TableScan` operator that reads rows from a table will + /// have child links to the `SCALAR` nodes representing the output variables + /// created for each column that is read by the operator. The corresponding + /// `variable` fields will be set to the variable names assigned to the + /// columns. + pub variable: Option, + /// The node to which the link points. + #[serde(rename="childIndex")] + pub child_index: Option, + /// The type of the link. For example, in Hash Joins this could be used to + /// distinguish between the build child and the probe child, or in the case + /// of the child being an output variable, to represent the tag associated + /// with the output variable. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for ChildLink {} + + +/// The request for Read and +/// StreamingRead. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases sessions streaming read projects](struct.ProjectInstanceDatabaseSessionStreamingReadCall.html) (request) +/// * [instances databases sessions read projects](struct.ProjectInstanceDatabaseSessionReadCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReadRequest { + /// If non-empty, the name of an index on table. This index is + /// used instead of the table primary key when interpreting key_set + /// and sorting result rows. See key_set for further information. + pub index: Option, + /// The transaction to use. If none is provided, the default is a + /// temporary read-only transaction with strong concurrency. + pub transaction: Option, + /// If this request is resuming a previously interrupted read, + /// `resume_token` should be copied from the last + /// PartialResultSet yielded before the interruption. Doing this + /// enables the new read to resume where the last read left off. The + /// rest of the request parameters must exactly match the request + /// that yielded this token. + #[serde(rename="resumeToken")] + pub resume_token: Option, + /// If present, results will be restricted to the specified partition + /// previously created using PartitionRead(). There must be an exact + /// match for the values of fields common to this message and the + /// PartitionReadRequest message used to create this partition_token. + #[serde(rename="partitionToken")] + pub partition_token: Option, + /// Required. `key_set` identifies the rows to be yielded. `key_set` names the + /// primary keys of the rows in table to be yielded, unless index + /// is present. If index is present, then key_set instead names + /// index keys in index. + /// + /// If the partition_token field is empty, rows are yielded + /// in table primary key order (if index is empty) or index key order + /// (if index is non-empty). If the partition_token field is not + /// empty, rows will be yielded in an unspecified order. + /// + /// It is not an error for the `key_set` to name rows that do not + /// exist in the database. Read yields nothing for nonexistent rows. + #[serde(rename="keySet")] + pub key_set: Option, + /// If greater than zero, only the first `limit` rows are yielded. If `limit` + /// is zero, the default is no limit. A limit cannot be specified if + /// `partition_token` is set. + pub limit: Option, + /// Required. The name of the table in the database to be read. + pub table: Option, + /// The columns of table to be returned for each row matching + /// this request. + pub columns: Option>, +} + +impl RequestValue for ReadRequest {} + + +/// Options for a PartitionQueryRequest and +/// PartitionReadRequest. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PartitionOptions { + /// **Note:** This hint is currently ignored by PartitionQuery and + /// PartitionRead requests. + /// + /// The desired maximum number of partitions to return. For example, this may + /// be set to the number of workers available. The default for this option + /// is currently 10,000. The maximum value is currently 200,000. This is only + /// a hint. The actual number of partitions returned may be smaller or larger + /// than this maximum count request. + #[serde(rename="maxPartitions")] + pub max_partitions: Option, + /// **Note:** This hint is currently ignored by PartitionQuery and + /// PartitionRead requests. + /// + /// The desired data size for each partition generated. The default for this + /// option is currently 1 GiB. This is only a hint. The actual size of each + /// partition may be smaller or larger than this size request. + #[serde(rename="partitionSizeBytes")] + pub partition_size_bytes: Option, +} + +impl Part for PartitionOptions {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases operations get projects](struct.ProjectInstanceDatabaseOperationGetCall.html) (response) +/// * [instances operations get projects](struct.ProjectInstanceOperationGetCall.html) (response) +/// * [instances databases create projects](struct.ProjectInstanceDatabaseCreateCall.html) (response) +/// * [instances create projects](struct.ProjectInstanceCreateCall.html) (response) +/// * [instances databases update ddl projects](struct.ProjectInstanceDatabaseUpdateDdlCall.html) (response) +/// * [instances patch projects](struct.ProjectInstancePatchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl ResponseResult for Operation {} + + +/// The response for ListInstances. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances list projects](struct.ProjectInstanceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListInstancesResponse { + /// `next_page_token` can be sent in a subsequent + /// ListInstances call to fetch more + /// of the matching instances. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of requested instances. + pub instances: Option>, +} + +impl ResponseResult for ListInstancesResponse {} + + +/// Contains an ordered list of nodes appearing in the query plan. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct QueryPlan { + /// The nodes in the query plan. Plan nodes are returned in pre-order starting + /// with the plan root. Each PlanNode's `id` corresponds to its index in + /// `plan_nodes`. + #[serde(rename="planNodes")] + pub plan_nodes: Option>, +} + +impl Part for QueryPlan {} + + +/// Request message for `SetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases set iam policy projects](struct.ProjectInstanceDatabaseSetIamPolicyCall.html) (request) +/// * [instances set iam policy projects](struct.ProjectInstanceSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetIamPolicyRequest { + /// REQUIRED: The complete policy to be applied to the `resource`. The size of + /// the policy is limited to a few 10s of KB. An empty policy is a + /// valid policy but certain Cloud Platform services (such as Projects) + /// might reject them. + pub policy: Option, +} + +impl RequestValue for SetIamPolicyRequest {} + + +/// The request for PartitionQuery +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases sessions partition query projects](struct.ProjectInstanceDatabaseSessionPartitionQueryCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PartitionQueryRequest { + /// It is not always possible for Cloud Spanner to infer the right SQL type + /// from a JSON value. For example, values of type `BYTES` and values + /// of type `STRING` both appear in params as JSON strings. + /// + /// In these cases, `param_types` can be used to specify the exact + /// SQL type for some or all of the SQL query parameters. See the + /// definition of Type for more information + /// about SQL types. + #[serde(rename="paramTypes")] + pub param_types: Option>, + /// Additional options that affect how many partitions are created. + #[serde(rename="partitionOptions")] + pub partition_options: Option, + /// Read only snapshot transactions are supported, read/write and single use + /// transactions are not. + pub transaction: Option, + /// The SQL query string can contain parameter placeholders. A parameter + /// placeholder consists of `'@'` followed by the parameter + /// name. Parameter names consist of any combination of letters, + /// numbers, and underscores. + /// + /// Parameters can appear anywhere that a literal value is expected. The same + /// parameter name can be used more than once, for example: + /// `"WHERE id > @msg_id AND id < @msg_id + 100"` + /// + /// It is an error to execute an SQL query with unbound parameters. + /// + /// Parameter values are specified using `params`, which is a JSON + /// object whose keys are parameter names, and whose values are the + /// corresponding parameter values. + pub params: Option>, + /// The query request to generate partitions for. The request will fail if + /// the query is not root partitionable. The query plan of a root + /// partitionable query has a single distributed union operator. A distributed + /// union operator conceptually divides one or more tables into multiple + /// splits, remotely evaluates a subquery independently on each split, and + /// then unions all results. + /// + /// This must not contain DML commands, such as INSERT, UPDATE, or + /// DELETE. Use ExecuteStreamingSql with a + /// PartitionedDml transaction for large, partition-friendly DML operations. + pub sql: Option, +} + +impl RequestValue for PartitionQueryRequest {} + + +/// Results from Read or +/// ExecuteSql. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases sessions execute sql projects](struct.ProjectInstanceDatabaseSessionExecuteSqlCall.html) (response) +/// * [instances databases sessions read projects](struct.ProjectInstanceDatabaseSessionReadCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResultSet { + /// Each element in `rows` is a row whose format is defined by + /// metadata.row_type. The ith element + /// in each row matches the ith field in + /// metadata.row_type. Elements are + /// encoded based on type as described + /// here. + pub rows: Option>>, + /// Query plan and execution statistics for the SQL statement that + /// produced this result set. These can be requested by setting + /// ExecuteSqlRequest.query_mode. + /// DML statements always produce stats containing the number of rows + /// modified, unless executed using the + /// ExecuteSqlRequest.QueryMode.PLAN ExecuteSqlRequest.query_mode. + /// Other fields may or may not be populated, based on the + /// ExecuteSqlRequest.query_mode. + pub stats: Option, + /// Metadata about the result set, such as row type information. + pub metadata: Option, +} + +impl ResponseResult for ResultSet {} + + +/// Arguments to insert, update, insert_or_update, and +/// replace operations. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Write { + /// Required. The table whose rows will be written. + pub table: Option, + /// The values to be written. `values` can contain more than one + /// list of values. If it does, then multiple rows are written, one + /// for each entry in `values`. Each list in `values` must have + /// exactly as many entries as there are entries in columns + /// above. Sending multiple lists is equivalent to sending multiple + /// `Mutation`s, each containing one `values` entry and repeating + /// table and columns. Individual values in each list are + /// encoded as described here. + pub values: Option>>, + /// The names of the columns in table to be written. + /// + /// The list of columns must contain enough columns to allow + /// Cloud Spanner to derive values for all primary key columns in the + /// row(s) to be modified. + pub columns: Option>, +} + +impl Part for Write {} + + +/// Message representing a single field of a struct. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Field { + /// The type of the field. + #[serde(rename="type")] + pub type_: Option, + /// The name of the field. For reads, this is the column name. For + /// SQL queries, it is the column alias (e.g., `"Word"` in the + /// query `"SELECT 'hello' AS Word"`), or the column name (e.g., + /// `"ColName"` in the query `"SELECT ColName FROM Table"`). Some + /// columns might have an empty name (e.g., !"SELECT + /// UPPER(ColName)"`). Note that a query result can contain + /// multiple fields with the same name. + pub name: Option, +} + +impl Part for Field {} + + +/// The response for ListDatabases. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases list projects](struct.ProjectInstanceDatabaseListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListDatabasesResponse { + /// `next_page_token` can be sent in a subsequent + /// ListDatabases call to fetch more + /// of the matching databases. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Databases that matched the request. + pub databases: Option>, +} + +impl ResponseResult for ListDatabasesResponse {} + + +/// Additional statistics about a ResultSet or PartialResultSet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResultSetStats { + /// Partitioned DML does not offer exactly-once semantics, so it + /// returns a lower bound of the rows modified. + #[serde(rename="rowCountLowerBound")] + pub row_count_lower_bound: Option, + /// Standard DML returns an exact count of rows that were modified. + #[serde(rename="rowCountExact")] + pub row_count_exact: Option, + /// QueryPlan for the query associated with this result. + #[serde(rename="queryPlan")] + pub query_plan: Option, + /// Aggregated statistics from the execution of the query. Only present when + /// the query is profiled. For example, a query could return the statistics as + /// follows: + /// + /// { + /// "rows_returned": "3", + /// "elapsed_time": "1.22 secs", + /// "cpu_time": "1.19 secs" + /// } + #[serde(rename="queryStats")] + pub query_stats: Option>, +} + +impl Part for ResultSetStats {} + + +/// The response for Commit. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [instances databases sessions commit projects](struct.ProjectInstanceDatabaseSessionCommitCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CommitResponse { + /// The Cloud Spanner timestamp at which the transaction committed. + #[serde(rename="commitTimestamp")] + pub commit_timestamp: Option, +} + +impl ResponseResult for CommitResponse {} + + /// Defines an Identity and Access Management (IAM) policy. It is used to /// specify access control policies for Cloud Platform resources. /// @@ -961,107 +1824,131 @@ pub struct Policy { impl ResponseResult for Policy {} -/// Enqueues the given DDL statements to be applied, in order but not -/// necessarily all at once, to the database schema at some point (or -/// points) in the future. The server checks that the statements -/// are executable (syntactically valid, name tables that exist, etc.) -/// before enqueueing them, but they may still fail upon -/// later execution (e.g., if a statement from another batch of -/// statements is applied first and it conflicts in some way, or if -/// there is some data-related problem like a `NULL` value in a column to -/// which `NOT NULL` would be added). If a statement fails, all -/// subsequent statements in the batch are automatically cancelled. +/// `Type` indicates the type of a Cloud Spanner value, as might be stored in a +/// table cell or returned from an SQL query. /// -/// Each batch of statements is assigned a name which can be used with -/// the Operations API to monitor -/// progress. See the -/// operation_id field for more -/// details. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases update ddl projects](struct.ProjectInstanceDatabaseUpdateDdlCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateDatabaseDdlRequest { - /// DDL statements to be applied to the database. - pub statements: Option>, - /// If empty, the new update request is assigned an - /// automatically-generated operation ID. Otherwise, `operation_id` - /// is used to construct the name of the resulting - /// Operation. - /// - /// Specifying an explicit operation ID simplifies determining - /// whether the statements were executed in the event that the - /// UpdateDatabaseDdl call is replayed, - /// or the return value is otherwise lost: the database and - /// `operation_id` fields can be combined to form the - /// name of the resulting - /// longrunning.Operation: `/operations/`. - /// - /// `operation_id` should be unique within the database, and must be - /// a valid identifier: `a-z*`. Note that - /// automatically-generated operation IDs always begin with an - /// underscore. If the named operation already exists, - /// UpdateDatabaseDdl returns - /// `ALREADY_EXISTS`. - #[serde(rename="operationId")] - pub operation_id: Option, +pub struct Type { + /// If code == STRUCT, then `struct_type` + /// provides type information for the struct's fields. + #[serde(rename="structType")] + pub struct_type: Option, + /// Required. The TypeCode for this type. + pub code: Option, + /// If code == ARRAY, then `array_element_type` + /// is the type of the array elements. + #[serde(rename="arrayElementType")] + pub array_element_type: Option>>, } -impl RequestValue for UpdateDatabaseDdlRequest {} +impl Part for Type {} -/// The response for Commit. +/// A session in the Cloud Spanner API. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [instances databases sessions commit projects](struct.ProjectInstanceDatabaseSessionCommitCall.html) (response) +/// * [instances databases sessions get projects](struct.ProjectInstanceDatabaseSessionGetCall.html) (response) +/// * [instances databases sessions create projects](struct.ProjectInstanceDatabaseSessionCreateCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CommitResponse { - /// The Cloud Spanner timestamp at which the transaction committed. - #[serde(rename="commitTimestamp")] - pub commit_timestamp: Option, +pub struct Session { + /// The labels for the session. + /// + /// * Label keys must be between 1 and 63 characters long and must conform to + /// the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + /// * Label values must be between 0 and 63 characters long and must conform + /// to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + /// * No more than 64 labels can be associated with a given session. + /// + /// See https://goo.gl/xmQnxf for more information on and examples of labels. + pub labels: Option>, + /// Output only. The timestamp when the session is created. + #[serde(rename="createTime")] + pub create_time: Option, + /// Output only. The approximate timestamp when the session is last used. It is + /// typically earlier than the actual last use time. + #[serde(rename="approximateLastUseTime")] + pub approximate_last_use_time: Option, + /// The name of the session. This is always system-assigned; values provided + /// when creating a session are ignored. + pub name: Option, } -impl ResponseResult for CommitResponse {} +impl ResponseResult for Session {} -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. +/// The request for UpdateInstance. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [instances databases operations cancel projects](struct.ProjectInstanceDatabaseOperationCancelCall.html) (response) -/// * [instances databases drop database projects](struct.ProjectInstanceDatabaseDropDatabaseCall.html) (response) -/// * [instances operations delete projects](struct.ProjectInstanceOperationDeleteCall.html) (response) -/// * [instances databases operations delete projects](struct.ProjectInstanceDatabaseOperationDeleteCall.html) (response) -/// * [instances delete projects](struct.ProjectInstanceDeleteCall.html) (response) -/// * [instances operations cancel projects](struct.ProjectInstanceOperationCancelCall.html) (response) -/// * [instances databases sessions rollback projects](struct.ProjectInstanceDatabaseSessionRollbackCall.html) (response) -/// * [instances databases sessions delete projects](struct.ProjectInstanceDatabaseSessionDeleteCall.html) (response) +/// * [instances patch projects](struct.ProjectInstancePatchCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } +pub struct UpdateInstanceRequest { + /// Required. The instance to update, which must always include the instance + /// name. Otherwise, only fields mentioned in [][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] need be included. + pub instance: Option, + /// Required. A mask specifying which fields in [][google.spanner.admin.instance.v1.UpdateInstanceRequest.instance] should be updated. + /// The field mask must always be specified; this prevents any future fields in + /// [][google.spanner.admin.instance.v1.Instance] from being erased accidentally by clients that do not know + /// about them. + #[serde(rename="fieldMask")] + pub field_mask: Option, +} -impl ResponseResult for Empty {} +impl RequestValue for UpdateInstanceRequest {} + + +/// Node information for nodes appearing in a QueryPlan.plan_nodes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlanNode { + /// The `PlanNode`'s index in node list. + pub index: Option, + /// Used to determine the type of node. May be needed for visualizing + /// different kinds of nodes differently. For example, If the node is a + /// SCALAR node, it will have a condensed representation + /// which can be used to directly embed a description of the node in its + /// parent. + pub kind: Option, + /// The display name for the node. + #[serde(rename="displayName")] + pub display_name: Option, + /// The execution statistics associated with the node, contained in a group of + /// key-value pairs. Only present if the plan was returned as a result of a + /// profile query. For example, number of executions, number of rows/time per + /// execution etc. + #[serde(rename="executionStats")] + pub execution_stats: Option>, + /// List of child node `index`es and their relationship to this parent. + #[serde(rename="childLinks")] + pub child_links: Option>, + /// Condensed representation for SCALAR nodes. + #[serde(rename="shortRepresentation")] + pub short_representation: Option, + /// Attributes relevant to the node contained in a group of key-value pairs. + /// For example, a Parameter Reference node could have the following + /// information in its metadata: + /// + /// { + /// "parameter_reference": "param1", + /// "parameter_type": "array" + /// } + pub metadata: Option>, +} + +impl Part for PlanNode {} /// # Transactions @@ -1372,164 +2259,6 @@ pub struct TransactionOptions { impl Part for TransactionOptions {} -/// Response message for `TestIamPermissions` method. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases test iam permissions projects](struct.ProjectInstanceDatabaseTestIamPermissionCall.html) (response) -/// * [instances test iam permissions projects](struct.ProjectInstanceTestIamPermissionCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TestIamPermissionsResponse { - /// A subset of `TestPermissionsRequest.permissions` that the caller is - /// allowed. - pub permissions: Option>, -} - -impl ResponseResult for TestIamPermissionsResponse {} - - -/// `Type` indicates the type of a Cloud Spanner value, as might be stored in a -/// table cell or returned from an SQL query. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Type { - /// If code == STRUCT, then `struct_type` - /// provides type information for the struct's fields. - #[serde(rename="structType")] - pub struct_type: Option, - /// Required. The TypeCode for this type. - pub code: Option, - /// If code == ARRAY, then `array_element_type` - /// is the type of the array elements. - #[serde(rename="arrayElementType")] - pub array_element_type: Option>>, -} - -impl Part for Type {} - - -/// The request for BeginTransaction. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases sessions begin transaction projects](struct.ProjectInstanceDatabaseSessionBeginTransactionCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BeginTransactionRequest { - /// Required. Options for the new transaction. - pub options: Option, -} - -impl RequestValue for BeginTransactionRequest {} - - -/// The request for UpdateInstance. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances patch projects](struct.ProjectInstancePatchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateInstanceRequest { - /// Required. The instance to update, which must always include the instance - /// name. Otherwise, only fields mentioned in [][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] need be included. - pub instance: Option, - /// Required. A mask specifying which fields in [][google.spanner.admin.instance.v1.UpdateInstanceRequest.instance] should be updated. - /// The field mask must always be specified; this prevents any future fields in - /// [][google.spanner.admin.instance.v1.Instance] from being erased accidentally by clients that do not know - /// about them. - #[serde(rename="fieldMask")] - pub field_mask: Option, -} - -impl RequestValue for UpdateInstanceRequest {} - - -/// The request for CreateInstance. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances create projects](struct.ProjectInstanceCreateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateInstanceRequest { - /// Required. The ID of the instance to create. Valid identifiers are of the - /// form `a-z*[a-z0-9]` and must be between 6 and 30 characters in - /// length. - #[serde(rename="instanceId")] - pub instance_id: Option, - /// Required. The instance to create. The name may be omitted, but if - /// specified must be `/instances/`. - pub instance: Option, -} - -impl RequestValue for CreateInstanceRequest {} - - -/// Represents an expression text. Example: -/// -/// title: "User account presence" -/// description: "Determines whether the request has a user account" -/// expression: "size(request.user) > 0" -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Expr { - /// An optional title for the expression, i.e. a short string describing - /// its purpose. This can be used e.g. in UIs which allow to enter the - /// expression. - pub title: Option, - /// Textual representation of an expression in - /// Common Expression Language syntax. - /// - /// The application context of the containing message determines which - /// well-known feature set of CEL is supported. - pub expression: Option, - /// An optional description of the expression. This is a longer text which - /// describes the expression, e.g. when hovered over it in a UI. - pub description: Option, - /// An optional string indicating the location of the expression for error - /// reporting, e.g. a file name and a position in the file. - pub location: Option, -} - -impl Part for Expr {} - - -/// `StructType` defines the fields of a STRUCT type. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StructType { - /// The list of fields that make up this struct. Order is - /// significant, because values of this struct type are represented as - /// lists, where the order of field values matches the order of - /// fields in the StructType. In turn, the order of fields - /// matches the order of columns in a read request, or the order of - /// fields in the `SELECT` clause of a query. - pub fields: Option>, -} - -impl Part for StructType {} - - /// A transaction. /// /// # Activities @@ -1583,90 +2312,35 @@ pub struct TestIamPermissionsRequest { impl RequestValue for TestIamPermissionsRequest {} -/// A Cloud Spanner database. +/// Represents an expression text. Example: /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases get projects](struct.ProjectInstanceDatabaseGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Database { - /// Output only. The current database state. - pub state: Option, - /// Required. The name of the database. Values are of the form - /// `projects//instances//databases/`, - /// where `` is as specified in the `CREATE DATABASE` - /// statement. This name can be passed to other API methods to - /// identify the database. - pub name: Option, -} - -impl ResponseResult for Database {} - - -/// Node information for nodes appearing in a QueryPlan.plan_nodes. +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PlanNode { - /// The `PlanNode`'s index in node list. - pub index: Option, - /// Used to determine the type of node. May be needed for visualizing - /// different kinds of nodes differently. For example, If the node is a - /// SCALAR node, it will have a condensed representation - /// which can be used to directly embed a description of the node in its - /// parent. - pub kind: Option, - /// The display name for the node. - #[serde(rename="displayName")] - pub display_name: Option, - /// The execution statistics associated with the node, contained in a group of - /// key-value pairs. Only present if the plan was returned as a result of a - /// profile query. For example, number of executions, number of rows/time per - /// execution etc. - #[serde(rename="executionStats")] - pub execution_stats: Option>, - /// List of child node `index`es and their relationship to this parent. - #[serde(rename="childLinks")] - pub child_links: Option>, - /// Condensed representation for SCALAR nodes. - #[serde(rename="shortRepresentation")] - pub short_representation: Option, - /// Attributes relevant to the node contained in a group of key-value pairs. - /// For example, a Parameter Reference node could have the following - /// information in its metadata: +pub struct Expr { + /// An optional description of the expression. This is a longer text which + /// describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in + /// Common Expression Language syntax. /// - /// { - /// "parameter_reference": "param1", - /// "parameter_type": "array" - /// } - pub metadata: Option>, + /// The application context of the containing message determines which + /// well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error + /// reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing + /// its purpose. This can be used e.g. in UIs which allow to enter the + /// expression. + pub title: Option, } -impl Part for PlanNode {} - - -/// The response for GetDatabaseDdl. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases get ddl projects](struct.ProjectInstanceDatabaseGetDdlCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetDatabaseDdlResponse { - /// A list of formatted DDL statements defining the schema of the database - /// specified in the request. - pub statements: Option>, -} - -impl ResponseResult for GetDatabaseDdlResponse {} +impl Part for Expr {} /// Information returned for each partition returned in a @@ -1801,98 +2475,36 @@ pub struct PartialResultSet { impl ResponseResult for PartialResultSet {} -/// The response for PartitionQuery -/// or PartitionRead +/// The request for ExecuteBatchDml /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [instances databases sessions partition query projects](struct.ProjectInstanceDatabaseSessionPartitionQueryCall.html) (response) -/// * [instances databases sessions partition read projects](struct.ProjectInstanceDatabaseSessionPartitionReadCall.html) (response) +/// * [instances databases sessions execute batch dml projects](struct.ProjectInstanceDatabaseSessionExecuteBatchDmlCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PartitionResponse { - /// Transaction created by this request. - pub transaction: Option, - /// Partitions created by this request. - pub partitions: Option>, -} - -impl ResponseResult for PartitionResponse {} - - -/// The request for PartitionRead -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases sessions partition read projects](struct.ProjectInstanceDatabaseSessionPartitionReadCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PartitionReadRequest { - /// If non-empty, the name of an index on table. This index is - /// used instead of the table primary key when interpreting key_set - /// and sorting result rows. See key_set for further information. - pub index: Option, - /// Read only snapshot transactions are supported, read/write and single use - /// transactions are not. +pub struct ExecuteBatchDmlRequest { + /// A per-transaction sequence number used to identify this request. This is + /// used in the same space as the seqno in + /// ExecuteSqlRequest. See more details + /// in ExecuteSqlRequest. + pub seqno: Option, + /// The transaction to use. A ReadWrite transaction is required. Single-use + /// transactions are not supported (to avoid replay). The caller must either + /// supply an existing transaction ID or begin a new transaction. pub transaction: Option, - /// Required. `key_set` identifies the rows to be yielded. `key_set` names the - /// primary keys of the rows in table to be yielded, unless index - /// is present. If index is present, then key_set instead names - /// index keys in index. + /// The list of statements to execute in this batch. Statements are executed + /// serially, such that the effects of statement i are visible to statement + /// i+1. Each statement must be a DML statement. Execution will stop at the + /// first failed statement; the remaining statements will not run. /// - /// It is not an error for the `key_set` to name rows that do not - /// exist in the database. Read yields nothing for nonexistent rows. - #[serde(rename="keySet")] - pub key_set: Option, - /// Additional options that affect how many partitions are created. - #[serde(rename="partitionOptions")] - pub partition_options: Option, - /// Required. The name of the table in the database to be read. - pub table: Option, - /// The columns of table to be returned for each row matching - /// this request. - pub columns: Option>, + /// REQUIRES: statements_size() > 0. + pub statements: Option>, } -impl RequestValue for PartitionReadRequest {} - - -/// Additional statistics about a ResultSet or PartialResultSet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResultSetStats { - /// Partitioned DML does not offer exactly-once semantics, so it - /// returns a lower bound of the rows modified. - #[serde(rename="rowCountLowerBound")] - pub row_count_lower_bound: Option, - /// Standard DML returns an exact count of rows that were modified. - #[serde(rename="rowCountExact")] - pub row_count_exact: Option, - /// QueryPlan for the query associated with this result. - #[serde(rename="queryPlan")] - pub query_plan: Option, - /// Aggregated statistics from the execution of the query. Only present when - /// the query is profiled. For example, a query could return the statistics as - /// follows: - /// - /// { - /// "rows_returned": "3", - /// "elapsed_time": "1.22 secs", - /// "cpu_time": "1.19 secs" - /// } - #[serde(rename="queryStats")] - pub query_stats: Option>, -} - -impl Part for ResultSetStats {} +impl RequestValue for ExecuteBatchDmlRequest {} /// The request for ExecuteSql and @@ -1957,6 +2569,13 @@ pub struct ExecuteSqlRequest { /// about SQL types. #[serde(rename="paramTypes")] pub param_types: Option>, + /// Used to control the amount of debugging information returned in + /// ResultSetStats. If partition_token is set, query_mode can only + /// be set to QueryMode.NORMAL. + #[serde(rename="queryMode")] + pub query_mode: Option, + /// Required. The SQL string. + pub sql: Option, /// The SQL string can contain parameter placeholders. A parameter /// placeholder consists of `'@'` followed by the parameter /// name. Parameter names consist of any combination of letters, @@ -1972,44 +2591,11 @@ pub struct ExecuteSqlRequest { /// object whose keys are parameter names, and whose values are the /// corresponding parameter values. pub params: Option>, - /// Required. The SQL string. - pub sql: Option, - /// Used to control the amount of debugging information returned in - /// ResultSetStats. If partition_token is set, query_mode can only - /// be set to QueryMode.NORMAL. - #[serde(rename="queryMode")] - pub query_mode: Option, } impl RequestValue for ExecuteSqlRequest {} -/// This message is used to select the transaction in which a -/// Read or -/// ExecuteSql call runs. -/// -/// See TransactionOptions for more information about transactions. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TransactionSelector { - /// Begin a new transaction and execute this read or SQL query in - /// it. The transaction ID of the new transaction is returned in - /// ResultSetMetadata.transaction, which is a Transaction. - pub begin: Option, - /// Execute the read or SQL query in a temporary transaction. - /// This is the most efficient way to execute a transaction that - /// consists of a single SQL query. - #[serde(rename="singleUse")] - pub single_use: Option, - /// Execute the read or SQL query in a previously-started transaction. - pub id: Option, -} - -impl Part for TransactionSelector {} - - /// A possible configuration for a Cloud Spanner instance. Configurations /// define the geographic placement of nodes and their replication. /// @@ -2040,13 +2626,13 @@ impl ResponseResult for InstanceConfig {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Delete { - /// Required. The table whose rows will be deleted. - pub table: Option, /// Required. The primary keys of the rows within table to delete. /// Delete is idempotent. The transaction will succeed even if some or all /// rows do not exist. #[serde(rename="keySet")] pub key_set: Option, + /// Required. The table whose rows will be deleted. + pub table: Option, } impl Part for Delete {} @@ -2086,77 +2672,6 @@ pub struct CommitRequest { impl RequestValue for CommitRequest {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: -/// -/// - Simple to use and understand for most users -/// - Flexible enough to meet unexpected needs -/// -/// # Overview -/// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of -/// google.rpc.Code, but it may accept additional error codes if needed. The -/// error message should be a developer-facing English message that helps -/// developers *understand* and *resolve* the error. If a localized user-facing -/// error message is needed, put the localized message in the error details or -/// localize it in the client. The optional error details may contain arbitrary -/// information about the error. There is a predefined set of error detail types -/// in the package `google.rpc` that can be used for common error conditions. -/// -/// # Language mapping -/// -/// The `Status` message is the logical representation of the error model, but it -/// is not necessarily the actual wire format. When the `Status` message is -/// exposed in different client libraries and different wire protocols, it can be -/// mapped differently. For example, it will likely be mapped to some exceptions -/// in Java, but more likely mapped to some error codes in C. -/// -/// # Other uses -/// -/// The error model and the `Status` message can be used in a variety of -/// environments, either with or without APIs, to provide a -/// consistent developer experience across different environments. -/// -/// Example uses of this error model include: -/// -/// - Partial errors. If a service needs to return partial errors to the client, -/// it may embed the `Status` in the normal response to indicate the partial -/// errors. -/// -/// - Workflow errors. A typical workflow has multiple steps. Each step may -/// have a `Status` message for error reporting. -/// -/// - Batch operations. If a client uses batch request and batch response, the -/// `Status` message should be used directly inside batch response, one for -/// each error sub-response. -/// -/// - Asynchronous operations. If an API call embeds asynchronous operation -/// results in its response, the status of those operations should be -/// represented directly using the `Status` message. -/// -/// - Logging. If some API errors are stored in logs, the message `Status` could -/// be used directly after any stripping needed for security/privacy reasons. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Status { - /// A developer-facing error message, which should be in English. Any - /// user-facing error message should be localized and sent in the - /// google.rpc.Status.details field, or localized by the client. - pub message: Option, - /// The status code, which should be an enum value of google.rpc.Code. - pub code: Option, - /// A list of messages that carry the error details. There is a common set of - /// message types for APIs to use. - pub details: Option>>, -} - -impl Part for Status {} - - /// The response message for Operations.ListOperations. /// /// # Activities @@ -2179,369 +2694,22 @@ pub struct ListOperationsResponse { impl ResponseResult for ListOperationsResponse {} -/// Message representing a single field of a struct. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Field { - /// The type of the field. - #[serde(rename="type")] - pub type_: Option, - /// The name of the field. For reads, this is the column name. For - /// SQL queries, it is the column alias (e.g., `"Word"` in the - /// query `"SELECT 'hello' AS Word"`), or the column name (e.g., - /// `"ColName"` in the query `"SELECT ColName FROM Table"`). Some - /// columns might have an empty name (e.g., !"SELECT - /// UPPER(ColName)"`). Note that a query result can contain - /// multiple fields with the same name. - pub name: Option, -} - -impl Part for Field {} - - -/// Message type to initiate a read-write transaction. Currently this -/// transaction type has no options. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReadWrite { _never_set: Option } - -impl Part for ReadWrite {} - - -/// Associates `members` with a `role`. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Binding { - /// Role that is assigned to `members`. - /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`. - pub role: Option, - /// Unimplemented. The condition that is associated with this binding. - /// NOTE: an unsatisfied condition will not allow user access via current - /// binding. Different bindings, including their conditions, are examined - /// independently. - pub condition: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. - /// `members` can have the following values: - /// - /// * `allUsers`: A special identifier that represents anyone who is - /// on the internet; with or without a Google account. - /// - /// * `allAuthenticatedUsers`: A special identifier that represents anyone - /// who is authenticated with a Google account or a service account. - /// - /// * `user:{emailid}`: An email address that represents a specific Google - /// account. For example, `alice@gmail.com` . - /// - /// - /// * `serviceAccount:{emailid}`: An email address that represents a service - /// account. For example, `my-other-app@appspot.gserviceaccount.com`. - /// - /// * `group:{emailid}`: An email address that represents a Google group. - /// For example, `admins@example.com`. - /// - /// - /// * `domain:{domain}`: A Google Apps domain name that represents all the - /// users of that domain. For example, `google.com` or `example.com`. - /// - /// - pub members: Option>, -} - -impl Part for Binding {} - - -/// Message type to initiate a Partitioned DML transaction. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PartitionedDml { _never_set: Option } - -impl Part for PartitionedDml {} - - -/// The request for CreateDatabase. +/// The request for BeginTransaction. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [instances databases create projects](struct.ProjectInstanceDatabaseCreateCall.html) (request) +/// * [instances databases sessions begin transaction projects](struct.ProjectInstanceDatabaseSessionBeginTransactionCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateDatabaseRequest { - /// An optional list of DDL statements to run inside the newly created - /// database. Statements can create tables, indexes, etc. These - /// statements execute atomically with the creation of the database: - /// if there is an error in any statement, the database is not created. - #[serde(rename="extraStatements")] - pub extra_statements: Option>, - /// Required. A `CREATE DATABASE` statement, which specifies the ID of the - /// new database. The database ID must conform to the regular expression - /// `a-z*[a-z0-9]` and be between 2 and 30 characters in length. - /// If the database ID is a reserved word or if it contains a hyphen, the - /// database ID must be enclosed in backticks (`` ` ``). - #[serde(rename="createStatement")] - pub create_statement: Option, +pub struct BeginTransactionRequest { + /// Required. Options for the new transaction. + pub options: Option, } -impl RequestValue for CreateDatabaseRequest {} - - -/// The request for Rollback. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases sessions rollback projects](struct.ProjectInstanceDatabaseSessionRollbackCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RollbackRequest { - /// Required. The transaction to roll back. - #[serde(rename="transactionId")] - pub transaction_id: Option, -} - -impl RequestValue for RollbackRequest {} - - -/// `KeySet` defines a collection of Cloud Spanner keys and/or key ranges. All -/// the keys are expected to be in the same table or index. The keys need -/// not be sorted in any particular way. -/// -/// If the same key is specified multiple times in the set (for example -/// if two ranges, two keys, or a key and a range overlap), Cloud Spanner -/// behaves as if the key were only specified once. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct KeySet { - /// A list of key ranges. See KeyRange for more information about - /// key range specifications. - pub ranges: Option>, - /// A list of specific keys. Entries in `keys` should have exactly as - /// many elements as there are columns in the primary or index key - /// with which this `KeySet` is used. Individual key values are - /// encoded as described here. - pub keys: Option>>, - /// For convenience `all` can be set to `true` to indicate that this - /// `KeySet` matches all keys in the table or index. Note that any keys - /// specified in `keys` or `ranges` are only yielded once. - pub all: Option, -} - -impl Part for KeySet {} - - -/// Message type to initiate a read-only transaction. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReadOnly { - /// Executes all reads at a timestamp >= `min_read_timestamp`. - /// - /// This is useful for requesting fresher data than some previous - /// read, or data that is fresh enough to observe the effects of some - /// previously committed transaction whose timestamp is known. - /// - /// Note that this option can only be used in single-use transactions. - /// - /// A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - /// Example: `"2014-10-02T15:01:23.045123456Z"`. - #[serde(rename="minReadTimestamp")] - pub min_read_timestamp: Option, - /// If true, the Cloud Spanner-selected read timestamp is included in - /// the Transaction message that describes the transaction. - #[serde(rename="returnReadTimestamp")] - pub return_read_timestamp: Option, - /// Read at a timestamp where all previously committed transactions - /// are visible. - pub strong: Option, - /// Executes all reads at the given timestamp. Unlike other modes, - /// reads at a specific timestamp are repeatable; the same read at - /// the same timestamp always returns the same data. If the - /// timestamp is in the future, the read will block until the - /// specified timestamp, modulo the read's deadline. - /// - /// Useful for large scale consistent reads such as mapreduces, or - /// for coordinating many reads against a consistent snapshot of the - /// data. - /// - /// A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - /// Example: `"2014-10-02T15:01:23.045123456Z"`. - #[serde(rename="readTimestamp")] - pub read_timestamp: Option, - /// Read data at a timestamp >= `NOW - max_staleness` - /// seconds. Guarantees that all writes that have committed more - /// than the specified number of seconds ago are visible. Because - /// Cloud Spanner chooses the exact timestamp, this mode works even if - /// the client's local clock is substantially skewed from Cloud Spanner - /// commit timestamps. - /// - /// Useful for reading the freshest data available at a nearby - /// replica, while bounding the possible staleness if the local - /// replica has fallen behind. - /// - /// Note that this option can only be used in single-use - /// transactions. - #[serde(rename="maxStaleness")] - pub max_staleness: Option, - /// Executes all reads at a timestamp that is `exact_staleness` - /// old. The timestamp is chosen soon after the read is started. - /// - /// Guarantees that all writes that have committed more than the - /// specified number of seconds ago are visible. Because Cloud Spanner - /// chooses the exact timestamp, this mode works even if the client's - /// local clock is substantially skewed from Cloud Spanner commit - /// timestamps. - /// - /// Useful for reading at nearby replicas without the distributed - /// timestamp negotiation overhead of `max_staleness`. - #[serde(rename="exactStaleness")] - pub exact_staleness: Option, -} - -impl Part for ReadOnly {} - - -/// Metadata associated with a parent-child relationship appearing in a -/// PlanNode. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ChildLink { - /// Only present if the child node is SCALAR and corresponds - /// to an output variable of the parent node. The field carries the name of - /// the output variable. - /// For example, a `TableScan` operator that reads rows from a table will - /// have child links to the `SCALAR` nodes representing the output variables - /// created for each column that is read by the operator. The corresponding - /// `variable` fields will be set to the variable names assigned to the - /// columns. - pub variable: Option, - /// The type of the link. For example, in Hash Joins this could be used to - /// distinguish between the build child and the probe child, or in the case - /// of the child being an output variable, to represent the tag associated - /// with the output variable. - #[serde(rename="type")] - pub type_: Option, - /// The node to which the link points. - #[serde(rename="childIndex")] - pub child_index: Option, -} - -impl Part for ChildLink {} - - -/// The request for Read and -/// StreamingRead. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases sessions streaming read projects](struct.ProjectInstanceDatabaseSessionStreamingReadCall.html) (request) -/// * [instances databases sessions read projects](struct.ProjectInstanceDatabaseSessionReadCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReadRequest { - /// If non-empty, the name of an index on table. This index is - /// used instead of the table primary key when interpreting key_set - /// and sorting result rows. See key_set for further information. - pub index: Option, - /// The transaction to use. If none is provided, the default is a - /// temporary read-only transaction with strong concurrency. - pub transaction: Option, - /// If this request is resuming a previously interrupted read, - /// `resume_token` should be copied from the last - /// PartialResultSet yielded before the interruption. Doing this - /// enables the new read to resume where the last read left off. The - /// rest of the request parameters must exactly match the request - /// that yielded this token. - #[serde(rename="resumeToken")] - pub resume_token: Option, - /// If present, results will be restricted to the specified partition - /// previously created using PartitionRead(). There must be an exact - /// match for the values of fields common to this message and the - /// PartitionReadRequest message used to create this partition_token. - #[serde(rename="partitionToken")] - pub partition_token: Option, - /// Required. `key_set` identifies the rows to be yielded. `key_set` names the - /// primary keys of the rows in table to be yielded, unless index - /// is present. If index is present, then key_set instead names - /// index keys in index. - /// - /// If the partition_token field is empty, rows are yielded - /// in table primary key order (if index is empty) or index key order - /// (if index is non-empty). If the partition_token field is not - /// empty, rows will be yielded in an unspecified order. - /// - /// It is not an error for the `key_set` to name rows that do not - /// exist in the database. Read yields nothing for nonexistent rows. - #[serde(rename="keySet")] - pub key_set: Option, - /// If greater than zero, only the first `limit` rows are yielded. If `limit` - /// is zero, the default is no limit. A limit cannot be specified if - /// `partition_token` is set. - pub limit: Option, - /// Required. The name of the table in the database to be read. - pub table: Option, - /// The columns of table to be returned for each row matching - /// this request. - pub columns: Option>, -} - -impl RequestValue for ReadRequest {} - - -/// A session in the Cloud Spanner API. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [instances databases sessions get projects](struct.ProjectInstanceDatabaseSessionGetCall.html) (response) -/// * [instances databases sessions create projects](struct.ProjectInstanceDatabaseSessionCreateCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Session { - /// The labels for the session. - /// - /// * Label keys must be between 1 and 63 characters long and must conform to - /// the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. - /// * Label values must be between 0 and 63 characters long and must conform - /// to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - /// * No more than 64 labels can be associated with a given session. - /// - /// See https://goo.gl/xmQnxf for more information on and examples of labels. - pub labels: Option>, - /// Output only. The timestamp when the session is created. - #[serde(rename="createTime")] - pub create_time: Option, - /// Output only. The approximate timestamp when the session is last used. It is - /// typically earlier than the actual last use time. - #[serde(rename="approximateLastUseTime")] - pub approximate_last_use_time: Option, - /// The name of the session. This is always system-assigned; values provided - /// when creating a session are ignored. - pub name: Option, -} - -impl ResponseResult for Session {} +impl RequestValue for BeginTransactionRequest {} /// Metadata about a ResultSet or PartialResultSet. @@ -2568,80 +2736,28 @@ pub struct ResultSetMetadata { impl Part for ResultSetMetadata {} -/// Options for a PartitionQueryRequest and -/// PartitionReadRequest. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PartitionOptions { - /// **Note:** This hint is currently ignored by PartitionQuery and - /// PartitionRead requests. - /// - /// The desired maximum number of partitions to return. For example, this may - /// be set to the number of workers available. The default for this option - /// is currently 10,000. The maximum value is currently 200,000. This is only - /// a hint. The actual number of partitions returned may be smaller or larger - /// than this maximum count request. - #[serde(rename="maxPartitions")] - pub max_partitions: Option, - /// **Note:** This hint is currently ignored by PartitionQuery and - /// PartitionRead requests. - /// - /// The desired data size for each partition generated. The default for this - /// option is currently 1 GiB. This is only a hint. The actual size of each - /// partition may be smaller or larger than this size request. - #[serde(rename="partitionSizeBytes")] - pub partition_size_bytes: Option, -} - -impl Part for PartitionOptions {} - - -/// This resource represents a long-running operation that is the result of a -/// network API call. +/// The response for ListInstanceConfigs. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [instances databases operations get projects](struct.ProjectInstanceDatabaseOperationGetCall.html) (response) -/// * [instances operations get projects](struct.ProjectInstanceOperationGetCall.html) (response) -/// * [instances databases create projects](struct.ProjectInstanceDatabaseCreateCall.html) (response) -/// * [instances create projects](struct.ProjectInstanceCreateCall.html) (response) -/// * [instances databases update ddl projects](struct.ProjectInstanceDatabaseUpdateDdlCall.html) (response) -/// * [instances patch projects](struct.ProjectInstancePatchCall.html) (response) +/// * [instance configs list projects](struct.ProjectInstanceConfigListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// The error result of the operation in case of failure or cancellation. - pub error: Option, - /// If the value is `false`, it means the operation is still in progress. - /// If `true`, the operation is completed, and either `error` or `response` is - /// available. - pub done: Option, - /// The normal response of the operation in case of success. If the original - /// method returns no data on success, such as `Delete`, the response is - /// `google.protobuf.Empty`. If the original method is standard - /// `Get`/`Create`/`Update`, the response should be the resource. For other - /// methods, the response should have the type `XxxResponse`, where `Xxx` - /// is the original method name. For example, if the original method name - /// is `TakeSnapshot()`, the inferred response type is - /// `TakeSnapshotResponse`. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that - /// originally returns it. If you use the default HTTP mapping, the - /// `name` should have the format of `operations/some/unique/name`. - pub name: Option, - /// Service-specific metadata associated with the operation. It typically - /// contains progress information and common metadata such as create time. - /// Some services might not provide such metadata. Any method that returns a - /// long-running operation should document the metadata type, if any. - pub metadata: Option>, +pub struct ListInstanceConfigsResponse { + /// `next_page_token` can be sent in a subsequent + /// ListInstanceConfigs call to + /// fetch more of the matching instance configurations. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of requested instance configurations. + #[serde(rename="instanceConfigs")] + pub instance_configs: Option>, } -impl ResponseResult for Operation {} +impl ResponseResult for ListInstanceConfigsResponse {} /// Condensed representation of a node and its subtree. Only present for @@ -2693,7 +2809,7 @@ impl Part for ShortRepresentation {} /// ::default(), None); /// let mut hub = Spanner::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `instance_configs_get(...)`, `instance_configs_list(...)`, `instances_create(...)`, `instances_databases_create(...)`, `instances_databases_drop_database(...)`, `instances_databases_get(...)`, `instances_databases_get_ddl(...)`, `instances_databases_get_iam_policy(...)`, `instances_databases_list(...)`, `instances_databases_operations_cancel(...)`, `instances_databases_operations_delete(...)`, `instances_databases_operations_get(...)`, `instances_databases_operations_list(...)`, `instances_databases_sessions_begin_transaction(...)`, `instances_databases_sessions_commit(...)`, `instances_databases_sessions_create(...)`, `instances_databases_sessions_delete(...)`, `instances_databases_sessions_execute_sql(...)`, `instances_databases_sessions_execute_streaming_sql(...)`, `instances_databases_sessions_get(...)`, `instances_databases_sessions_list(...)`, `instances_databases_sessions_partition_query(...)`, `instances_databases_sessions_partition_read(...)`, `instances_databases_sessions_read(...)`, `instances_databases_sessions_rollback(...)`, `instances_databases_sessions_streaming_read(...)`, `instances_databases_set_iam_policy(...)`, `instances_databases_test_iam_permissions(...)`, `instances_databases_update_ddl(...)`, `instances_delete(...)`, `instances_get(...)`, `instances_get_iam_policy(...)`, `instances_list(...)`, `instances_operations_cancel(...)`, `instances_operations_delete(...)`, `instances_operations_get(...)`, `instances_operations_list(...)`, `instances_patch(...)`, `instances_set_iam_policy(...)` and `instances_test_iam_permissions(...)` +/// // like `instance_configs_get(...)`, `instance_configs_list(...)`, `instances_create(...)`, `instances_databases_create(...)`, `instances_databases_drop_database(...)`, `instances_databases_get(...)`, `instances_databases_get_ddl(...)`, `instances_databases_get_iam_policy(...)`, `instances_databases_list(...)`, `instances_databases_operations_cancel(...)`, `instances_databases_operations_delete(...)`, `instances_databases_operations_get(...)`, `instances_databases_operations_list(...)`, `instances_databases_sessions_begin_transaction(...)`, `instances_databases_sessions_commit(...)`, `instances_databases_sessions_create(...)`, `instances_databases_sessions_delete(...)`, `instances_databases_sessions_execute_batch_dml(...)`, `instances_databases_sessions_execute_sql(...)`, `instances_databases_sessions_execute_streaming_sql(...)`, `instances_databases_sessions_get(...)`, `instances_databases_sessions_list(...)`, `instances_databases_sessions_partition_query(...)`, `instances_databases_sessions_partition_read(...)`, `instances_databases_sessions_read(...)`, `instances_databases_sessions_rollback(...)`, `instances_databases_sessions_streaming_read(...)`, `instances_databases_set_iam_policy(...)`, `instances_databases_test_iam_permissions(...)`, `instances_databases_update_ddl(...)`, `instances_delete(...)`, `instances_get(...)`, `instances_get_iam_policy(...)`, `instances_list(...)`, `instances_operations_cancel(...)`, `instances_operations_delete(...)`, `instances_operations_get(...)`, `instances_operations_list(...)`, `instances_patch(...)`, `instances_set_iam_policy(...)` and `instances_test_iam_permissions(...)` /// // to build up your call. /// let rb = hub.projects(); /// # } @@ -2859,6 +2975,43 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Executes a batch of SQL DML statements. This method allows many statements + /// to be run with lower latency than submitting them sequentially with + /// ExecuteSql. + /// + /// Statements are executed in order, sequentially. + /// ExecuteBatchDmlResponse will contain a + /// ResultSet for each DML statement that has successfully executed. If a + /// statement fails, its error status will be returned as part of the + /// ExecuteBatchDmlResponse. Execution will + /// stop at the first failed statement; the remaining statements will not run. + /// + /// ExecuteBatchDml is expected to return an OK status with a response even if + /// there was an error while processing one of the DML statements. Clients must + /// inspect response.status to determine if there were any errors while + /// processing the request. + /// + /// See more details in + /// ExecuteBatchDmlRequest and + /// ExecuteBatchDmlResponse. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `session` - Required. The session in which the DML statements should be performed. + pub fn instances_databases_sessions_execute_batch_dml(&self, request: ExecuteBatchDmlRequest, session: &str) -> ProjectInstanceDatabaseSessionExecuteBatchDmlCall<'a, C, A> { + ProjectInstanceDatabaseSessionExecuteBatchDmlCall { + hub: self.hub, + _request: request, + _session: session.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Sets the access control policy on an instance resource. Replaces any @@ -3099,18 +3252,23 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a long-running operation. This method indicates that the client is - /// no longer interested in the operation result. It does not cancel the - /// operation. If the server doesn't support this method, it returns - /// `google.rpc.Code.UNIMPLEMENTED`. + /// Updates the schema of a Cloud Spanner database by + /// creating/altering/dropping tables, columns, indexes, etc. The returned + /// long-running operation will have a name of + /// the format `/operations/` and can be used to + /// track execution of the schema change(s). The + /// metadata field type is + /// UpdateDatabaseDdlMetadata. The operation has no response. /// /// # Arguments /// - /// * `name` - The name of the operation resource to be deleted. - pub fn instances_databases_operations_delete(&self, name: &str) -> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> { - ProjectInstanceDatabaseOperationDeleteCall { + /// * `request` - No description provided. + /// * `database` - Required. The database to update. + pub fn instances_databases_update_ddl(&self, request: UpdateDatabaseDdlRequest, database: &str) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> { + ProjectInstanceDatabaseUpdateDdlCall { hub: self.hub, - _name: name.to_string(), + _request: request, + _database: database.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3203,7 +3361,9 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Ends a session, releasing server resources associated with it. + /// Ends a session, releasing server resources associated with it. This will + /// asynchronously trigger cancellation of any operations that are running with + /// this session. /// /// # Arguments /// @@ -3620,23 +3780,18 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the schema of a Cloud Spanner database by - /// creating/altering/dropping tables, columns, indexes, etc. The returned - /// long-running operation will have a name of - /// the format `/operations/` and can be used to - /// track execution of the schema change(s). The - /// metadata field type is - /// UpdateDatabaseDdlMetadata. The operation has no response. + /// Deletes a long-running operation. This method indicates that the client is + /// no longer interested in the operation result. It does not cancel the + /// operation. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `database` - Required. The database to update. - pub fn instances_databases_update_ddl(&self, request: UpdateDatabaseDdlRequest, database: &str) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> { - ProjectInstanceDatabaseUpdateDdlCall { + /// * `name` - The name of the operation resource to be deleted. + pub fn instances_databases_operations_delete(&self, name: &str) -> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> { + ProjectInstanceDatabaseOperationDeleteCall { hub: self.hub, - _request: request, - _database: database.to_string(), + _name: name.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3828,7 +3983,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionPartitionQueryCall<'a, C, A> where } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3844,10 +3999,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionPartitionQueryCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3879,7 +4031,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionPartitionQueryCall<'a, C, A> where request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3969,7 +4121,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionPartitionQueryCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4103,7 +4255,7 @@ impl<'a, C, A> ProjectInstanceDatabaseGetCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4142,7 +4291,7 @@ impl<'a, C, A> ProjectInstanceDatabaseGetCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseGetCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseSessionCommitCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4385,10 +4534,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionCommitCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4420,7 +4566,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionCommitCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4510,7 +4656,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionCommitCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4655,7 +4801,7 @@ impl<'a, C, A> ProjectInstanceGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectInstanceGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4706,7 +4849,7 @@ impl<'a, C, A> ProjectInstanceGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectInstanceGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseGetIamPolicyCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4958,10 +5101,7 @@ impl<'a, C, A> ProjectInstanceDatabaseGetIamPolicyCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4993,7 +5133,7 @@ impl<'a, C, A> ProjectInstanceDatabaseGetIamPolicyCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5083,7 +5223,7 @@ impl<'a, C, A> ProjectInstanceDatabaseGetIamPolicyCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5236,7 +5376,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionReadCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5252,10 +5392,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionReadCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5287,7 +5424,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionReadCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5377,7 +5514,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionReadCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5425,6 +5562,303 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionReadCall<'a, C, A> where C: BorrowM } +/// Executes a batch of SQL DML statements. This method allows many statements +/// to be run with lower latency than submitting them sequentially with +/// ExecuteSql. +/// +/// Statements are executed in order, sequentially. +/// ExecuteBatchDmlResponse will contain a +/// ResultSet for each DML statement that has successfully executed. If a +/// statement fails, its error status will be returned as part of the +/// ExecuteBatchDmlResponse. Execution will +/// stop at the first failed statement; the remaining statements will not run. +/// +/// ExecuteBatchDml is expected to return an OK status with a response even if +/// there was an error while processing one of the DML statements. Clients must +/// inspect response.status to determine if there were any errors while +/// processing the request. +/// +/// See more details in +/// ExecuteBatchDmlRequest and +/// ExecuteBatchDmlResponse. +/// +/// A builder for the *instances.databases.sessions.executeBatchDml* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_spanner1 as spanner1; +/// use spanner1::ExecuteBatchDmlRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use spanner1::Spanner; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Spanner::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ExecuteBatchDmlRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().instances_databases_sessions_execute_batch_dml(req, "session") +/// .doit(); +/// # } +/// ``` +pub struct ProjectInstanceDatabaseSessionExecuteBatchDmlCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Spanner, + _request: ExecuteBatchDmlRequest, + _session: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectInstanceDatabaseSessionExecuteBatchDmlCall<'a, C, A> {} + +impl<'a, C, A> ProjectInstanceDatabaseSessionExecuteBatchDmlCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ExecuteBatchDmlResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "spanner.projects.instances.databases.sessions.executeBatchDml", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("session", self._session.to_string())); + for &field in ["alt", "session"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+session}:executeBatchDml"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+session}", "session")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["session"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ExecuteBatchDmlRequest) -> ProjectInstanceDatabaseSessionExecuteBatchDmlCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The session in which the DML statements should be performed. + /// + /// Sets the *session* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn session(mut self, new_value: &str) -> ProjectInstanceDatabaseSessionExecuteBatchDmlCall<'a, C, A> { + self._session = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceDatabaseSessionExecuteBatchDmlCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectInstanceDatabaseSessionExecuteBatchDmlCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectInstanceDatabaseSessionExecuteBatchDmlCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Sets the access control policy on an instance resource. Replaces any /// existing policy. /// @@ -5522,7 +5956,7 @@ impl<'a, C, A> ProjectInstanceSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectInstanceSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5573,7 +6004,7 @@ impl<'a, C, A> ProjectInstanceSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectInstanceSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseTestIamPermissionCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5825,10 +6256,7 @@ impl<'a, C, A> ProjectInstanceDatabaseTestIamPermissionCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5860,7 +6288,7 @@ impl<'a, C, A> ProjectInstanceDatabaseTestIamPermissionCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5950,7 +6378,7 @@ impl<'a, C, A> ProjectInstanceDatabaseTestIamPermissionCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6026,8 +6454,8 @@ impl<'a, C, A> ProjectInstanceDatabaseTestIamPermissionCall<'a, C, A> where C: B /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().instances_databases_list("parent") -/// .page_token("labore") -/// .page_size(-9) +/// .page_token("sea") +/// .page_size(-90) /// .doit(); /// # } /// ``` @@ -6094,7 +6522,7 @@ impl<'a, C, A> ProjectInstanceDatabaseListCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6133,7 +6558,7 @@ impl<'a, C, A> ProjectInstanceDatabaseListCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseListCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseSessionRollbackCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6393,10 +6818,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionRollbackCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6428,7 +6850,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionRollbackCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6518,7 +6940,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionRollbackCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6652,7 +7074,7 @@ impl<'a, C, A> ProjectInstanceGetCall<'a, C, A> where C: BorrowMut ProjectInstanceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6691,7 +7110,7 @@ impl<'a, C, A> ProjectInstanceGetCall<'a, C, A> where C: BorrowMut ProjectInstanceGetCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseOperationGetCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6922,10 +7341,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationGetCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6945,7 +7361,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationGetCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7023,7 +7439,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationGetCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7168,7 +7584,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionStreamingReadCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7184,10 +7600,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionStreamingReadCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7219,7 +7632,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionStreamingReadCall<'a, C, A> where C request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7309,7 +7722,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionStreamingReadCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7385,8 +7798,8 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionStreamingReadCall<'a, C, A> where C /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().instances_list("parent") -/// .page_token("ea") -/// .page_size(-61) +/// .page_token("no") +/// .page_size(-21) /// .filter("justo") /// .doit(); /// # } @@ -7458,7 +7871,7 @@ impl<'a, C, A> ProjectInstanceListCall<'a, C, A> where C: BorrowMut ProjectInstanceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7497,7 +7907,7 @@ impl<'a, C, A> ProjectInstanceListCall<'a, C, A> where C: BorrowMut ProjectInstanceListCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseSessionCreateCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7793,10 +8203,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionCreateCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7828,7 +8235,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionCreateCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7918,7 +8325,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionCreateCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8066,7 +8473,7 @@ impl<'a, C, A> ProjectInstanceDatabaseCreateCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8117,7 +8521,7 @@ impl<'a, C, A> ProjectInstanceDatabaseCreateCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseCreateCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseCreateCall<'a, C, A> where C: BorrowMut/operations/` and can be used to +/// track execution of the schema change(s). The +/// metadata field type is +/// UpdateDatabaseDdlMetadata. The operation has no response. /// -/// A builder for the *instances.databases.operations.delete* method supported by a *project* resource. +/// A builder for the *instances.databases.updateDdl* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -8273,6 +8680,7 @@ impl<'a, C, A> ProjectInstanceDatabaseCreateCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseCreateCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = Spanner::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = UpdateDatabaseDdlRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().instances_databases_operations_delete("name") +/// let result = hub.projects().instances_databases_update_ddl(req, "database") /// .doit(); /// # } /// ``` -pub struct ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> +pub struct ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Spanner, - _name: String, + _request: UpdateDatabaseDdlRequest, + _database: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> {} -impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -8315,11 +8729,11 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "spanner.projects.instances.databases.operations.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + dlg.begin(MethodInfo { id: "spanner.projects.instances.databases.updateDdl", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("database", self._database.to_string())); + for &field in ["alt", "database"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -8331,12 +8745,12 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/{+name}"; + let mut url = self.hub._base_url.clone() + "v1/{+database}/ddl"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+name}", "name")].iter() { + for &(find_this, param_name) in [("{+database}", "database")].iter() { let mut replace_with = String::new(); for &(name, ref value) in params.iter() { if name == param_name { @@ -8345,13 +8759,13 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { + for param_name in ["database"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -8361,11 +8775,19 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -8382,11 +8804,15 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor } }; let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -8437,14 +8863,23 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor } - /// The name of the operation resource to be deleted. /// - /// Sets the *name* path property to the given value. + /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> { - self._name = new_value.to_string(); + pub fn request(mut self, new_value: UpdateDatabaseDdlRequest) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The database to update. + /// + /// Sets the *database* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn database(mut self, new_value: &str) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> { + self._database = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -8453,7 +8888,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -8462,7 +8897,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8478,7 +8913,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -8498,7 +8933,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -8607,7 +9042,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSetIamPolicyCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8623,10 +9058,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSetIamPolicyCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8658,7 +9090,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSetIamPolicyCall<'a, C, A> where C: Borrow request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8748,7 +9180,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSetIamPolicyCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8928,7 +9360,7 @@ impl<'a, C, A> ProjectInstancePatchCall<'a, C, A> where C: BorrowMut ProjectInstancePatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8979,7 +9408,7 @@ impl<'a, C, A> ProjectInstancePatchCall<'a, C, A> where C: BorrowMut ProjectInstancePatchCall<'a, C, A> where C: BorrowMut ProjectInstancePatchCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseSessionDeleteCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9222,10 +9653,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionDeleteCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9245,7 +9673,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionDeleteCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9323,7 +9751,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionDeleteCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9457,7 +9885,7 @@ impl<'a, C, A> ProjectInstanceConfigGetCall<'a, C, A> where C: BorrowMut ProjectInstanceConfigGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9496,7 +9921,7 @@ impl<'a, C, A> ProjectInstanceConfigGetCall<'a, C, A> where C: BorrowMut ProjectInstanceConfigGetCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseSessionExecuteSqlCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9742,10 +10167,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionExecuteSqlCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9777,7 +10199,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionExecuteSqlCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9867,7 +10289,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionExecuteSqlCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10013,7 +10435,7 @@ impl<'a, C, A> ProjectInstanceTestIamPermissionCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10029,10 +10451,7 @@ impl<'a, C, A> ProjectInstanceTestIamPermissionCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10064,7 +10483,7 @@ impl<'a, C, A> ProjectInstanceTestIamPermissionCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10154,7 +10573,7 @@ impl<'a, C, A> ProjectInstanceTestIamPermissionCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10290,7 +10709,7 @@ impl<'a, C, A> ProjectInstanceDatabaseGetDdlCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseGetDdlCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10329,7 +10745,7 @@ impl<'a, C, A> ProjectInstanceDatabaseGetDdlCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseGetDdlCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseSessionBeginTransactionCall<'a, C, A> wher } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10567,10 +10983,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionBeginTransactionCall<'a, C, A> wher } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10602,7 +11015,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionBeginTransactionCall<'a, C, A> wher request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10692,7 +11105,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionBeginTransactionCall<'a, C, A> wher /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10777,9 +11190,9 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionBeginTransactionCall<'a, C, A> wher /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().instances_operations_list("name") -/// .page_token("erat") -/// .page_size(-95) -/// .filter("dolor") +/// .page_token("sadipscing") +/// .page_size(-48) +/// .filter("eirmod") /// .doit(); /// # } /// ``` @@ -10850,7 +11263,7 @@ impl<'a, C, A> ProjectInstanceOperationListCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10889,7 +11299,7 @@ impl<'a, C, A> ProjectInstanceOperationListCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationListCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationListCall<'a, C, A> where C: BorrowMut ProjectInstanceConfigListCall<'a, C, A> where C: BorrowMut ProjectInstanceConfigListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11171,7 +11578,7 @@ impl<'a, C, A> ProjectInstanceConfigListCall<'a, C, A> where C: BorrowMut ProjectInstanceConfigListCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseSessionPartitionReadCall<'a, C, A> where C } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11437,10 +11844,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionPartitionReadCall<'a, C, A> where C } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11472,7 +11876,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionPartitionReadCall<'a, C, A> where C request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11562,7 +11966,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionPartitionReadCall<'a, C, A> where C /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11707,7 +12111,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionExecuteStreamingSqlCall<'a, C, A> w } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11723,10 +12127,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionExecuteStreamingSqlCall<'a, C, A> w } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11758,7 +12159,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionExecuteStreamingSqlCall<'a, C, A> w request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11848,7 +12249,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionExecuteStreamingSqlCall<'a, C, A> w /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11984,7 +12385,7 @@ impl<'a, C, A> ProjectInstanceOperationGetCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12023,7 +12421,7 @@ impl<'a, C, A> ProjectInstanceOperationGetCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationGetCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseOperationCancelCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12260,10 +12658,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationCancelCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12283,7 +12678,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationCancelCall<'a, C, A> where C: Bor let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12361,7 +12756,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationCancelCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12437,9 +12832,9 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationCancelCall<'a, C, A> where C: Bor /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().instances_databases_sessions_list("database") -/// .page_token("aliquyam") -/// .page_size(-73) -/// .filter("Lorem") +/// .page_token("accusam") +/// .page_size(-56) +/// .filter("sea") /// .doit(); /// # } /// ``` @@ -12510,7 +12905,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionListCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12526,10 +12921,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionListCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12549,7 +12941,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionListCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12660,7 +13052,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionListCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12745,9 +13137,9 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionListCall<'a, C, A> where C: BorrowM /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().instances_databases_operations_list("name") -/// .page_token("et") -/// .page_size(-70) -/// .filter("et") +/// .page_token("duo") +/// .page_size(-21) +/// .filter("eirmod") /// .doit(); /// # } /// ``` @@ -12818,7 +13210,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationListCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12834,10 +13226,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationListCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12857,7 +13246,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationListCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12956,7 +13345,7 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationListCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13130,7 +13519,7 @@ impl<'a, C, A> ProjectInstanceCreateCall<'a, C, A> where C: BorrowMut ProjectInstanceCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13181,7 +13567,7 @@ impl<'a, C, A> ProjectInstanceCreateCall<'a, C, A> where C: BorrowMut ProjectInstanceCreateCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseDropDatabaseCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -13422,10 +13808,7 @@ impl<'a, C, A> ProjectInstanceDatabaseDropDatabaseCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13445,7 +13828,7 @@ impl<'a, C, A> ProjectInstanceDatabaseDropDatabaseCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13523,7 +13906,7 @@ impl<'a, C, A> ProjectInstanceDatabaseDropDatabaseCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13660,7 +14043,7 @@ impl<'a, C, A> ProjectInstanceOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13699,7 +14079,7 @@ impl<'a, C, A> ProjectInstanceOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationDeleteCall<'a, C, A> where C: BorrowMut/operations/` and can be used to -/// track execution of the schema change(s). The -/// metadata field type is -/// UpdateDatabaseDdlMetadata. The operation has no response. +/// Deletes a long-running operation. This method indicates that the client is +/// no longer interested in the operation result. It does not cancel the +/// operation. If the server doesn't support this method, it returns +/// `google.rpc.Code.UNIMPLEMENTED`. /// -/// A builder for the *instances.databases.updateDdl* method supported by a *project* resource. +/// A builder for the *instances.databases.operations.delete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. /// /// # Example @@ -13845,7 +14222,6 @@ impl<'a, C, A> ProjectInstanceOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationDeleteCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = Spanner::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = UpdateDatabaseDdlRequest::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.projects().instances_databases_update_ddl(req, "database") +/// let result = hub.projects().instances_databases_operations_delete("name") /// .doit(); /// # } /// ``` -pub struct ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> +pub struct ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Spanner, - _request: UpdateDatabaseDdlRequest, - _database: String, + _name: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> {} -impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -13894,11 +14264,11 @@ impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "spanner.projects.instances.databases.updateDdl", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("database", self._database.to_string())); - for &field in ["alt", "database"].iter() { + dlg.begin(MethodInfo { id: "spanner.projects.instances.databases.operations.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -13910,12 +14280,12 @@ impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/{+database}/ddl"; + let mut url = self.hub._base_url.clone() + "v1/{+name}"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+database}", "database")].iter() { + for &(find_this, param_name) in [("{+name}", "name")].iter() { let mut replace_with = String::new(); for &(name, ref value) in params.iter() { if name == param_name { @@ -13924,13 +14294,13 @@ impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["database"].iter() { + for param_name in ["name"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -13940,22 +14310,8 @@ impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -13972,15 +14328,11 @@ impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut } }; let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -14031,23 +14383,14 @@ impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut } + /// The name of the operation resource to be deleted. /// - /// Sets the *request* property to the given value. + /// Sets the *name* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn request(mut self, new_value: UpdateDatabaseDdlRequest) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The database to update. - /// - /// Sets the *database* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn database(mut self, new_value: &str) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> { - self._database = new_value.to_string(); + pub fn name(mut self, new_value: &str) -> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> { + self._name = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -14056,7 +14399,7 @@ impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -14065,7 +14408,7 @@ impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14081,7 +14424,7 @@ impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -14101,7 +14444,7 @@ impl<'a, C, A> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> where C: BorrowMut /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectInstanceDatabaseUpdateDdlCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -14209,7 +14552,7 @@ impl<'a, C, A> ProjectInstanceDeleteCall<'a, C, A> where C: BorrowMut ProjectInstanceDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14248,7 +14588,7 @@ impl<'a, C, A> ProjectInstanceDeleteCall<'a, C, A> where C: BorrowMut ProjectInstanceDeleteCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationCancelCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14509,7 +14846,7 @@ impl<'a, C, A> ProjectInstanceOperationCancelCall<'a, C, A> where C: BorrowMut ProjectInstanceOperationCancelCall<'a, C, A> where C: BorrowMut ProjectInstanceDatabaseSessionGetCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -14739,10 +15076,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionGetCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14762,7 +15096,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionGetCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14840,7 +15174,7 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionGetCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/spectrum1_explorer/Cargo.toml b/gen/spectrum1_explorer/Cargo.toml index 7638b45afc..dff307a60f 100644 --- a/gen/spectrum1_explorer/Cargo.toml +++ b/gen/spectrum1_explorer/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/spectrum1_explorer/src/lib.rs b/gen/spectrum1_explorer/src/lib.rs index face200a04..36cbb348ce 100644 --- a/gen/spectrum1_explorer/src/lib.rs +++ b/gen/spectrum1_explorer/src/lib.rs @@ -1427,10 +1427,7 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1449,7 +1446,7 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut PawRegisterCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1661,7 +1655,7 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -1740,7 +1734,7 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1851,10 +1845,7 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1873,7 +1864,7 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -1952,7 +1943,7 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2063,10 +2054,7 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut, A: oauth } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2085,7 +2073,7 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut, A: oauth request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -2164,7 +2152,7 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2275,10 +2263,7 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2297,7 +2282,7 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut PawVerifyDeviceCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2509,7 +2491,7 @@ impl<'a, C, A> PawVerifyDeviceCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) @@ -2588,7 +2570,7 @@ impl<'a, C, A> PawVerifyDeviceCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/speech1-cli/Cargo.toml b/gen/speech1-cli/Cargo.toml index 9ff24abb05..9fcbc33aba 100644 --- a/gen/speech1-cli/Cargo.toml +++ b/gen/speech1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-speech1-cli" -version = "1.0.8+20181005" +version = "1.0.8+20190321" authors = ["Sebastian Thiel "] description = "A complete library to interact with Speech (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/speech1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-speech1] path = "../speech1" -version = "1.0.8+20181005" +version = "1.0.8+20190321" diff --git a/gen/speech1-cli/README.md b/gen/speech1-cli/README.md index 4eea6a23e8..399e4a42cd 100644 --- a/gen/speech1-cli/README.md +++ b/gen/speech1-cli/README.md @@ -25,13 +25,17 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Speech* API at revision *20181005*. The CLI is at version *1.0.8*. +This documentation was generated from the *Speech* API at revision *20190321*. The CLI is at version *1.0.8*. ```bash speech1 [options] operations get [-p ]... [-o ] list [-p ]... [-o ] + projects + locations-operations-get [-p ]... [-o ] + locations-operations-list [-p ]... [-o ] + operations-manual-recognition-tasks-get [-p ]... [-o ] speech longrunningrecognize (-r )... [-p ]... [-o ] recognize (-r )... [-p ]... [-o ] diff --git a/gen/speech1-cli/mkdocs.yml b/gen/speech1-cli/mkdocs.yml index 5b7f13df5c..1b7ee582e1 100644 --- a/gen/speech1-cli/mkdocs.yml +++ b/gen/speech1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Speech v1.0.8+20181005 +site_name: Speech v1.0.8+20190321 site_url: http://byron.github.io/google-apis-rs/google-speech1-cli site_description: A complete library to interact with Speech (protocol v1) @@ -11,6 +11,9 @@ pages: - ['index.md', 'Home'] - ['operations_get.md', 'Operations', 'Get'] - ['operations_list.md', 'Operations', 'List'] +- ['projects_locations-operations-get.md', 'Projects', 'Locations Operations Get'] +- ['projects_locations-operations-list.md', 'Projects', 'Locations Operations List'] +- ['projects_operations-manual-recognition-tasks-get.md', 'Projects', 'Operations Manual Recognition Tasks Get'] - ['speech_longrunningrecognize.md', 'Speech', 'Longrunningrecognize'] - ['speech_recognize.md', 'Speech', 'Recognize'] diff --git a/gen/speech1-cli/src/main.rs b/gen/speech1-cli/src/main.rs index 7daeb0cd64..1aefb2b8ed 100644 --- a/gen/speech1-cli/src/main.rs +++ b/gen/speech1-cli/src/main.rs @@ -163,6 +163,172 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_operations_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_operations_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_operations_manual_recognition_tasks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().operations_manual_recognition_tasks_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _speech_longrunningrecognize(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -189,16 +355,27 @@ impl<'n> Engine<'n> { "audio.content" => Some(("audio.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "audio.uri" => Some(("audio.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.language-code" => Some(("config.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.audio-channel-count" => Some(("config.audioChannelCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.encoding" => Some(("config.encoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.enable-automatic-punctuation" => Some(("config.enableAutomaticPunctuation", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "config.enable-separate-recognition-per-channel" => Some(("config.enableSeparateRecognitionPerChannel", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.enable-word-time-offsets" => Some(("config.enableWordTimeOffsets", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.max-alternatives" => Some(("config.maxAlternatives", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.use-enhanced" => Some(("config.useEnhanced", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.sample-rate-hertz" => Some(("config.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.profanity-filter" => Some(("config.profanityFilter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.model" => Some(("config.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.recording-device-type" => Some(("config.metadata.recordingDeviceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.original-media-type" => Some(("config.metadata.originalMediaType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.microphone-distance" => Some(("config.metadata.microphoneDistance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.obfuscated-id" => Some(("config.metadata.obfuscatedId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.recording-device-name" => Some(("config.metadata.recordingDeviceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.industry-naics-code-of-audio" => Some(("config.metadata.industryNaicsCodeOfAudio", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.metadata.audio-topic" => Some(("config.metadata.audioTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.original-mime-type" => Some(("config.metadata.originalMimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.interaction-type" => Some(("config.metadata.interactionType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["audio", "config", "content", "enable-automatic-punctuation", "enable-word-time-offsets", "encoding", "language-code", "max-alternatives", "model", "profanity-filter", "sample-rate-hertz", "uri", "use-enhanced"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["audio", "audio-channel-count", "audio-topic", "config", "content", "enable-automatic-punctuation", "enable-separate-recognition-per-channel", "enable-word-time-offsets", "encoding", "industry-naics-code-of-audio", "interaction-type", "language-code", "max-alternatives", "metadata", "microphone-distance", "model", "obfuscated-id", "original-media-type", "original-mime-type", "profanity-filter", "recording-device-name", "recording-device-type", "sample-rate-hertz", "uri", "use-enhanced"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -284,16 +461,27 @@ impl<'n> Engine<'n> { "audio.content" => Some(("audio.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "audio.uri" => Some(("audio.uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.language-code" => Some(("config.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.audio-channel-count" => Some(("config.audioChannelCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.encoding" => Some(("config.encoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "config.enable-automatic-punctuation" => Some(("config.enableAutomaticPunctuation", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "config.enable-separate-recognition-per-channel" => Some(("config.enableSeparateRecognitionPerChannel", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.enable-word-time-offsets" => Some(("config.enableWordTimeOffsets", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.max-alternatives" => Some(("config.maxAlternatives", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.use-enhanced" => Some(("config.useEnhanced", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.sample-rate-hertz" => Some(("config.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "config.profanity-filter" => Some(("config.profanityFilter", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "config.model" => Some(("config.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.recording-device-type" => Some(("config.metadata.recordingDeviceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.original-media-type" => Some(("config.metadata.originalMediaType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.microphone-distance" => Some(("config.metadata.microphoneDistance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.obfuscated-id" => Some(("config.metadata.obfuscatedId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.recording-device-name" => Some(("config.metadata.recordingDeviceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.industry-naics-code-of-audio" => Some(("config.metadata.industryNaicsCodeOfAudio", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "config.metadata.audio-topic" => Some(("config.metadata.audioTopic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.original-mime-type" => Some(("config.metadata.originalMimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "config.metadata.interaction-type" => Some(("config.metadata.interactionType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["audio", "config", "content", "enable-automatic-punctuation", "enable-word-time-offsets", "encoding", "language-code", "max-alternatives", "model", "profanity-filter", "sample-rate-hertz", "uri", "use-enhanced"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["audio", "audio-channel-count", "audio-topic", "config", "content", "enable-automatic-punctuation", "enable-separate-recognition-per-channel", "enable-word-time-offsets", "encoding", "industry-naics-code-of-audio", "interaction-type", "language-code", "max-alternatives", "metadata", "microphone-distance", "model", "obfuscated-id", "original-media-type", "original-mime-type", "profanity-filter", "recording-device-name", "recording-device-type", "sample-rate-hertz", "uri", "use-enhanced"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -372,6 +560,23 @@ impl<'n> Engine<'n> { } } }, + ("projects", Some(opt)) => { + match opt.subcommand() { + ("locations-operations-get", Some(opt)) => { + call_result = self._projects_locations_operations_get(opt, dry_run, &mut err); + }, + ("locations-operations-list", Some(opt)) => { + call_result = self._projects_locations_operations_list(opt, dry_run, &mut err); + }, + ("operations-manual-recognition-tasks-get", Some(opt)) => { + call_result = self._projects_operations_manual_recognition_tasks_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("speech", Some(opt)) => { match opt.subcommand() { ("longrunningrecognize", Some(opt)) => { @@ -523,12 +728,96 @@ fn main() { ]), ]), + ("projects", "methods: 'locations-operations-get', 'locations-operations-list' and 'operations-manual-recognition-tasks-get'", vec![ + ("locations-operations-get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_speech1_cli/projects_locations-operations-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-operations-list", + Some(r##"Lists operations that match the specified filter in the request. If the + server doesn't support this method, it returns `UNIMPLEMENTED`. + + NOTE: the `name` binding allows API services to override the binding + to use different resource name schemes, such as `users/*/operations`. To + override the binding, API services can add a binding such as + `"/v1/{name=users/*}/operations"` to their service configuration. + For backwards compatibility, the default name includes the operations + collection id, however overriding users must ensure the name binding + is the parent resource, without the operations collection id."##), + "Details at http://byron.github.io/google-apis-rs/google_speech1_cli/projects_locations-operations-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation's parent resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-manual-recognition-tasks-get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the API + service."##), + "Details at http://byron.github.io/google-apis-rs/google_speech1_cli/projects_operations-manual-recognition-tasks-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("speech", "methods: 'longrunningrecognize' and 'recognize'", vec![ ("longrunningrecognize", Some(r##"Performs asynchronous speech recognition: receive results via the google.longrunning.Operations interface. Returns either an `Operation.error` or an `Operation.response` which contains - a `LongRunningRecognizeResponse` message."##), + a `LongRunningRecognizeResponse` message. + For more information on asynchronous speech recognition, see the + [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize)."##), "Details at http://byron.github.io/google-apis-rs/google_speech1_cli/speech_longrunningrecognize", vec![ (Some(r##"kv"##), @@ -578,7 +867,7 @@ fn main() { let mut app = App::new("speech1") .author("Sebastian Thiel ") - .version("1.0.8+20181005") + .version("1.0.8+20190321") .about("Converts audio to text by applying powerful neural network models.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_speech1_cli") .arg(Arg::with_name("url") diff --git a/gen/speech1/Cargo.toml b/gen/speech1/Cargo.toml index 1cf5e9ea18..eb146dd545 100644 --- a/gen/speech1/Cargo.toml +++ b/gen/speech1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-speech1" -version = "1.0.8+20181005" +version = "1.0.8+20190321" authors = ["Sebastian Thiel "] description = "A complete library to interact with Speech (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/speech1" homepage = "https://cloud.google.com/speech-to-text/docs/quickstart-protocol" -documentation = "https://docs.rs/google-speech1/1.0.8+20181005" +documentation = "https://docs.rs/google-speech1/1.0.8+20190321" license = "MIT" keywords = ["speech", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/speech1/README.md b/gen/speech1/README.md index 669da97114..78d00c1cd5 100644 --- a/gen/speech1/README.md +++ b/gen/speech1/README.md @@ -5,18 +5,20 @@ DO NOT EDIT ! --> The `google-speech1` library allows access to all features of the *Google Speech* service. -This documentation was generated from *Speech* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *speech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Speech* crate version *1.0.8+20190321*, where *20190321* is the exact revision of the *speech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Speech* *v1* API can be found at the [official documentation site](https://cloud.google.com/speech-to-text/docs/quickstart-protocol). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/struct.Speech.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/struct.Speech.html) ... -* [operations](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/struct.Operation.html) - * [*get*](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/struct.OperationListCall.html) +* [operations](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/struct.Operation.html) + * [*get*](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/struct.OperationListCall.html) +* projects + * [*locations operations get*](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/struct.ProjectLocationOperationGetCall.html), [*locations operations list*](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/struct.ProjectLocationOperationListCall.html) and [*operations manual recognition tasks get*](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/struct.ProjectOperationManualRecognitionTaskGetCall.html) * speech - * [*longrunningrecognize*](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/struct.SpeechLongrunningrecognizeCall.html) and [*recognize*](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/struct.SpeechRecognizeCall.html) + * [*longrunningrecognize*](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/struct.SpeechLongrunningrecognizeCall.html) and [*recognize*](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/struct.SpeechRecognizeCall.html) @@ -25,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/struct.Speech.html)** +* **[Hub](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/struct.Speech.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.Part.html)** + * **[Parts](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -49,8 +51,10 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore +let r = hub.projects().operations_manual_recognition_tasks_get(...).doit() let r = hub.operations().get(...).doit() let r = hub.speech().longrunningrecognize(...).doit() +let r = hub.projects().locations_operations_get(...).doit() let r = hub.operations().list(...).doit() ``` @@ -132,17 +136,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -152,29 +156,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-speech1/1.0.8+20181005/google_speech1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-speech1/1.0.8+20190321/google_speech1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/speech1/src/lib.rs b/gen/speech1/src/lib.rs index 404b01101b..0cf6c74a39 100644 --- a/gen/speech1/src/lib.rs +++ b/gen/speech1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Speech* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *speech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Speech* crate version *1.0.8+20190321*, where *20190321* is the exact revision of the *speech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Speech* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/speech-to-text/docs/quickstart-protocol). @@ -13,6 +13,8 @@ //! //! * [operations](struct.Operation.html) //! * [*get*](struct.OperationGetCall.html) and [*list*](struct.OperationListCall.html) +//! * projects +//! * [*locations operations get*](struct.ProjectLocationOperationGetCall.html), [*locations operations list*](struct.ProjectLocationOperationListCall.html) and [*operations manual recognition tasks get*](struct.ProjectOperationManualRecognitionTaskGetCall.html) //! * speech //! * [*longrunningrecognize*](struct.SpeechLongrunningrecognizeCall.html) and [*recognize*](struct.SpeechRecognizeCall.html) //! @@ -49,8 +51,10 @@ //! Or specifically ... //! //! ```ignore +//! let r = hub.projects().operations_manual_recognition_tasks_get(...).doit() //! let r = hub.operations().get(...).doit() //! let r = hub.speech().longrunningrecognize(...).doit() +//! let r = hub.projects().locations_operations_get(...).doit() //! let r = hub.operations().list(...).doit() //! ``` //! @@ -340,6 +344,9 @@ impl<'a, C, A> Speech pub fn operations(&'a self) -> OperationMethods<'a, C, A> { OperationMethods { hub: &self } } + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } pub fn speech(&'a self) -> SpeechMethods<'a, C, A> { SpeechMethods { hub: &self } } @@ -373,17 +380,17 @@ impl<'a, C, A> Speech // ############ // SCHEMAS ### // ########## -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -450,6 +457,11 @@ impl Part for Status {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SpeechRecognitionResult { + /// For multi-channel audio, this is the channel number corresponding to the + /// recognized result for the audio from that channel. + /// For audio_channel_count = N, its output values can range from '1' to 'N'. + #[serde(rename="channelTag")] + pub channel_tag: Option, /// Output only. May contain one or more recognition hypotheses (up to the /// maximum specified in `max_alternatives`). /// These alternatives are ordered in terms of accuracy, with the top (first) @@ -489,6 +501,7 @@ impl ResponseResult for RecognizeResponse {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [list operations](struct.OperationListCall.html) (response) +/// * [locations operations list projects](struct.ProjectLocationOperationListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListOperationsResponse { @@ -502,25 +515,6 @@ pub struct ListOperationsResponse { impl ResponseResult for ListOperationsResponse {} -/// Provides "hints" to the speech recognizer to favor specific words and phrases -/// in the results. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SpeechContext { - /// *Optional* A list of strings containing words and phrases "hints" so that - /// the speech recognition is more likely to recognize them. This can be used - /// to improve the accuracy for specific words and phrases, for example, if - /// specific commands are typically spoken by the user. This can also be used - /// to add additional words to the vocabulary of the recognizer. See - /// [usage limits](/speech-to-text/quotas#content). - pub phrases: Option>, -} - -impl Part for SpeechContext {} - - /// Contains audio data in the encoding specified in the `RecognitionConfig`. /// Either `content` or `uri` must be supplied. Supplying both or neither /// returns google.rpc.Code.INVALID_ARGUMENT. See @@ -571,13 +565,6 @@ pub struct WordInfo { /// vary. #[serde(rename="startTime")] pub start_time: Option, - /// Output only. A distinct integer value is assigned for every speaker within - /// the audio. This field specifies which one of those speakers was detected to - /// have spoken this word. Value ranges from '1' to diarization_speaker_count. - /// speaker_tag is set if enable_speaker_diarization = 'true' and only in the - /// top alternative. - #[serde(rename="speakerTag")] - pub speaker_tag: Option, } impl Part for WordInfo {} @@ -605,6 +592,25 @@ pub struct LongRunningRecognizeRequest { impl RequestValue for LongRunningRecognizeRequest {} +/// Provides "hints" to the speech recognizer to favor specific words and phrases +/// in the results. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SpeechContext { + /// *Optional* A list of strings containing words and phrases "hints" so that + /// the speech recognition is more likely to recognize them. This can be used + /// to improve the accuracy for specific words and phrases, for example, if + /// specific commands are typically spoken by the user. This can also be used + /// to add additional words to the vocabulary of the recognizer. See + /// [usage limits](/speech-to-text/quotas#content). + pub phrases: Option>, +} + +impl Part for SpeechContext {} + + /// This resource represents a long-running operation that is the result of a /// network API call. /// @@ -613,8 +619,10 @@ impl RequestValue for LongRunningRecognizeRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// +/// * [operations manual recognition tasks get projects](struct.ProjectOperationManualRecognitionTaskGetCall.html) (response) /// * [get operations](struct.OperationGetCall.html) (response) /// * [longrunningrecognize speech](struct.SpeechLongrunningrecognizeCall.html) (response) +/// * [locations operations get projects](struct.ProjectLocationOperationGetCall.html) (response) /// * [list operations](struct.OperationListCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -709,6 +717,17 @@ pub struct RecognitionConfig { /// for a list of the currently supported language codes. #[serde(rename="languageCode")] pub language_code: Option, + /// *Optional* The number of channels in the input audio data. + /// ONLY set this for MULTI-CHANNEL recognition. + /// Valid values for LINEAR16 and FLAC are `1`-`8`. + /// Valid values for OGG_OPUS are '1'-'254'. + /// Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`. + /// If `0` or omitted, defaults to one channel (mono). + /// Note: We only recognize the first channel by default. + /// To perform independent recognition on each channel set + /// `enable_separate_recognition_per_channel` to 'true'. + #[serde(rename="audioChannelCount")] + pub audio_channel_count: Option, /// Encoding of audio data sent in all `RecognitionAudio` messages. /// This field is optional for `FLAC` and `WAV` audio files and required /// for all other audio formats. For details, see AudioEncoding. @@ -722,6 +741,14 @@ pub struct RecognitionConfig { /// premium feature. #[serde(rename="enableAutomaticPunctuation")] pub enable_automatic_punctuation: Option, + /// This needs to be set to `true` explicitly and `audio_channel_count` > 1 + /// to get each channel recognized separately. The recognition result will + /// contain a `channel_tag` field to state which channel that result belongs + /// to. If this is not true, we will only recognize the first channel. The + /// request is billed cumulatively for all channels recognized: + /// `audio_channel_count` multiplied by the length of the audio. + #[serde(rename="enableSeparateRecognitionPerChannel")] + pub enable_separate_recognition_per_channel: Option, /// *Optional* If `true`, the top result includes a list of words and /// the start and end time offsets (timestamps) for those words. If /// `false`, no word-level time offset information is returned. The default is @@ -758,8 +785,8 @@ pub struct RecognitionConfig { /// 16000 is optimal. For best results, set the sampling rate of the audio /// source to 16000 Hz. If that's not possible, use the native sample rate of /// the audio source (instead of re-sampling). - /// This field is optional for `FLAC` and `WAV` audio files and required - /// for all other audio formats. For details, see AudioEncoding. + /// This field is optional for FLAC and WAV audio files, but is + /// required for all other audio formats. For details, see AudioEncoding. #[serde(rename="sampleRateHertz")] pub sample_rate_hertz: Option, /// *Optional* If set to `true`, the server will attempt to filter out @@ -806,11 +833,61 @@ pub struct RecognitionConfig { /// information, see [Phrase Hints](/speech-to-text/docs/basics#phrase-hints). #[serde(rename="speechContexts")] pub speech_contexts: Option>, + /// *Optional* Metadata regarding this request. + pub metadata: Option, } impl Part for RecognitionConfig {} +/// Description of audio data to be recognized. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RecognitionMetadata { + /// The type of device the speech was recorded with. + #[serde(rename="recordingDeviceType")] + pub recording_device_type: Option, + /// The original media the speech was recorded on. + #[serde(rename="originalMediaType")] + pub original_media_type: Option, + /// The audio type that most closely describes the audio being recognized. + #[serde(rename="microphoneDistance")] + pub microphone_distance: Option, + /// Obfuscated (privacy-protected) ID of the user, to identify number of + /// unique users using the service. + #[serde(rename="obfuscatedId")] + pub obfuscated_id: Option, + /// Mime type of the original audio file. For example `audio/m4a`, + /// `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`. + /// A list of possible audio mime types is maintained at + /// http://www.iana.org/assignments/media-types/media-types.xhtml#audio + #[serde(rename="originalMimeType")] + pub original_mime_type: Option, + /// The industry vertical to which this speech recognition request most + /// closely applies. This is most indicative of the topics contained + /// in the audio. Use the 6-digit NAICS code to identify the industry + /// vertical - see https://www.naics.com/search/. + #[serde(rename="industryNaicsCodeOfAudio")] + pub industry_naics_code_of_audio: Option, + /// Description of the content. Eg. "Recordings of federal supreme court + /// hearings from 2012". + #[serde(rename="audioTopic")] + pub audio_topic: Option, + /// The device used to make the recording. Examples 'Nexus 5X' or + /// 'Polycom SoundStation IP 6000' or 'POTS' or 'VoIP' or + /// 'Cardioid Microphone'. + #[serde(rename="recordingDeviceName")] + pub recording_device_name: Option, + /// The use case most closely describing the audio content to be recognized. + #[serde(rename="interactionType")] + pub interaction_type: Option, +} + +impl Part for RecognitionMetadata {} + + // ################### // MethodBuilders ### @@ -855,25 +932,6 @@ impl<'a, C, A> MethodsBuilder for OperationMethods<'a, C, A> {} impl<'a, C, A> OperationMethods<'a, C, A> { - /// Create a builder to help you perform the following task: - /// - /// Gets the latest state of a long-running operation. Clients can use this - /// method to poll the operation result at intervals as recommended by the API - /// service. - /// - /// # Arguments - /// - /// * `name` - The name of the operation resource. - pub fn get(&self, name: &str) -> OperationGetCall<'a, C, A> { - OperationGetCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Lists operations that match the specified filter in the request. If the @@ -898,6 +956,25 @@ impl<'a, C, A> OperationMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn get(&self, name: &str) -> OperationGetCall<'a, C, A> { + OperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -947,6 +1024,8 @@ impl<'a, C, A> SpeechMethods<'a, C, A> { /// google.longrunning.Operations interface. Returns either an /// `Operation.error` or an `Operation.response` which contains /// a `LongRunningRecognizeResponse` message. + /// For more information on asynchronous speech recognition, see the + /// [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize). /// /// # Arguments /// @@ -982,265 +1061,121 @@ impl<'a, C, A> SpeechMethods<'a, C, A> { +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `Speech` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_speech1 as speech1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use speech1::Speech; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Speech::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `locations_operations_get(...)`, `locations_operations_list(...)` and `operations_manual_recognition_tasks_get(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Speech, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn operations_manual_recognition_tasks_get(&self, name: &str) -> ProjectOperationManualRecognitionTaskGetCall<'a, C, A> { + ProjectOperationManualRecognitionTaskGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists operations that match the specified filter in the request. If the + /// server doesn't support this method, it returns `UNIMPLEMENTED`. + /// + /// NOTE: the `name` binding allows API services to override the binding + /// to use different resource name schemes, such as `users/*/operations`. To + /// override the binding, API services can add a binding such as + /// `"/v1/{name=users/*}/operations"` to their service configuration. + /// For backwards compatibility, the default name includes the operations + /// collection id, however overriding users must ensure the name binding + /// is the parent resource, without the operations collection id. + /// + /// # Arguments + /// + /// * `name` - The name of the operation's parent resource. + pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C, A> { + ProjectLocationOperationListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C, A> { + ProjectLocationOperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + // ################### // CallBuilders ### // ################# -/// Gets the latest state of a long-running operation. Clients can use this -/// method to poll the operation result at intervals as recommended by the API -/// service. -/// -/// A builder for the *get* method supported by a *operation* resource. -/// It is not used directly, but through a `OperationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_speech1 as speech1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use speech1::Speech; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = Speech::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.operations().get("name") -/// .doit(); -/// # } -/// ``` -pub struct OperationGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Speech, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {} - -impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "speech.operations.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/operations/{+name}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The name of the operation resource. - /// - /// Sets the *name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Lists operations that match the specified filter in the request. If the /// server doesn't support this method, it returns `UNIMPLEMENTED`. /// @@ -1278,10 +1213,10 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.operations().list() -/// .page_token("sea") -/// .page_size(-90) -/// .name("dolores") -/// .filter("gubergren") +/// .page_token("labore") +/// .page_size(-9) +/// .name("nonumy") +/// .filter("dolores") /// .doit(); /// # } /// ``` @@ -1345,10 +1280,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1368,7 +1300,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1464,7 +1396,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1512,10 +1444,262 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *get* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_speech1 as speech1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use speech1::Speech; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Speech::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().get("name") +/// .doit(); +/// # } +/// ``` +pub struct OperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Speech, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {} + +impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "speech.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/operations/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Performs asynchronous speech recognition: receive results via the /// google.longrunning.Operations interface. Returns either an /// `Operation.error` or an `Operation.response` which contains /// a `LongRunningRecognizeResponse` message. +/// For more information on asynchronous speech recognition, see the +/// [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize). /// /// A builder for the *longrunningrecognize* method supported by a *speech* resource. /// It is not used directly, but through a `SpeechMethods` instance. @@ -1597,10 +1781,7 @@ impl<'a, C, A> SpeechLongrunningrecognizeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1632,7 +1813,7 @@ impl<'a, C, A> SpeechLongrunningrecognizeCall<'a, C, A> where C: BorrowMut SpeechLongrunningrecognizeCall<'a, C, A> where C: BorrowMut SpeechRecognizeCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1878,7 +2056,7 @@ impl<'a, C, A> SpeechRecognizeCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1958,7 +2136,7 @@ impl<'a, C, A> SpeechRecognizeCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2006,3 +2184,796 @@ impl<'a, C, A> SpeechRecognizeCall<'a, C, A> where C: BorrowMut, } +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *operations.manualRecognitionTasks.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_speech1 as speech1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use speech1::Speech; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Speech::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().operations_manual_recognition_tasks_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectOperationManualRecognitionTaskGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Speech, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectOperationManualRecognitionTaskGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectOperationManualRecognitionTaskGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "speech.projects.operations.manualRecognitionTasks.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectOperationManualRecognitionTaskGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectOperationManualRecognitionTaskGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectOperationManualRecognitionTaskGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectOperationManualRecognitionTaskGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists operations that match the specified filter in the request. If the +/// server doesn't support this method, it returns `UNIMPLEMENTED`. +/// +/// NOTE: the `name` binding allows API services to override the binding +/// to use different resource name schemes, such as `users/*/operations`. To +/// override the binding, API services can add a binding such as +/// `"/v1/{name=users/*}/operations"` to their service configuration. +/// For backwards compatibility, the default name includes the operations +/// collection id, however overriding users must ensure the name binding +/// is the parent resource, without the operations collection id. +/// +/// A builder for the *locations.operations.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_speech1 as speech1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use speech1::Speech; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Speech::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_operations_list("name") +/// .page_token("ea") +/// .page_size(-61) +/// .filter("justo") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationOperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Speech, + _name: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationOperationListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "speech.projects.locations.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}/operations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation's parent resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The standard list page token. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The standard list page size. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The standard list filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationOperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationOperationListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *locations.operations.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_speech1 as speech1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use speech1::Speech; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Speech::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_operations_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationOperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Speech, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationOperationGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "speech.projects.locations.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationOperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationOperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/speech1_beta1/Cargo.toml b/gen/speech1_beta1/Cargo.toml index 4597ae4017..cf66bb85a3 100644 --- a/gen/speech1_beta1/Cargo.toml +++ b/gen/speech1_beta1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/speech1_beta1/src/lib.rs b/gen/speech1_beta1/src/lib.rs index 0976fdac29..0878fa610e 100644 --- a/gen/speech1_beta1/src/lib.rs +++ b/gen/speech1_beta1/src/lib.rs @@ -963,7 +963,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -979,10 +979,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1002,7 +999,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1080,7 +1077,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1232,10 +1229,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1255,7 +1249,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1351,7 +1345,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1486,10 +1480,7 @@ impl<'a, C, A> SpeechAsyncrecognizeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1521,7 +1512,7 @@ impl<'a, C, A> SpeechAsyncrecognizeCall<'a, C, A> where C: BorrowMut SpeechAsyncrecognizeCall<'a, C, A> where C: BorrowMut SpeechSyncrecognizeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1767,7 +1755,7 @@ impl<'a, C, A> SpeechSyncrecognizeCall<'a, C, A> where C: BorrowMut SpeechSyncrecognizeCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with SQL Admin (protocol v1beta4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/sqladmin1_beta4-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-sqladmin1_beta4] path = "../sqladmin1_beta4" -version = "1.0.8+20180917" +version = "1.0.8+20190328" diff --git a/gen/sqladmin1_beta4-cli/README.md b/gen/sqladmin1_beta4-cli/README.md index fd336b19f3..f9d3837371 100644 --- a/gen/sqladmin1_beta4-cli/README.md +++ b/gen/sqladmin1_beta4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *SQL Admin* API at revision *20180917*. The CLI is at version *1.0.8*. +This documentation was generated from the *SQL Admin* API at revision *20190328*. The CLI is at version *1.0.8*. ```bash sqladmin1-beta4 [options] diff --git a/gen/sqladmin1_beta4-cli/mkdocs.yml b/gen/sqladmin1_beta4-cli/mkdocs.yml index 408f8fa8c8..efd3d22b05 100644 --- a/gen/sqladmin1_beta4-cli/mkdocs.yml +++ b/gen/sqladmin1_beta4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: SQL Admin v1.0.8+20180917 +site_name: SQL Admin v1.0.8+20190328 site_url: http://byron.github.io/google-apis-rs/google-sqladmin1_beta4-cli site_description: A complete library to interact with SQL Admin (protocol v1beta4) diff --git a/gen/sqladmin1_beta4-cli/src/main.rs b/gen/sqladmin1_beta4-cli/src/main.rs index ee450cef15..28c7bd6fe8 100644 --- a/gen/sqladmin1_beta4-cli/src/main.rs +++ b/gen/sqladmin1_beta4-cli/src/main.rs @@ -1112,9 +1112,10 @@ impl<'n> Engine<'n> { "export-context.csv-export-options.select-query" => Some(("exportContext.csvExportOptions.selectQuery", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "export-context.databases" => Some(("exportContext.databases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "export-context.sql-export-options.tables" => Some(("exportContext.sqlExportOptions.tables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "export-context.sql-export-options.mysql-export-options.master-data" => Some(("exportContext.sqlExportOptions.mysqlExportOptions.masterData", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "export-context.sql-export-options.schema-only" => Some(("exportContext.sqlExportOptions.schemaOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["csv-export-options", "databases", "export-context", "file-type", "kind", "schema-only", "select-query", "sql-export-options", "tables", "uri"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["csv-export-options", "databases", "export-context", "file-type", "kind", "master-data", "mysql-export-options", "schema-only", "select-query", "sql-export-options", "tables", "uri"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1432,8 +1433,12 @@ impl<'n> Engine<'n> { "database-version" => Some(("databaseVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "instance-type" => Some(("instanceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "max-disk-size" => Some(("maxDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-configuration.kind" => Some(("diskEncryptionConfiguration.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-configuration.kms-key-name" => Some(("diskEncryptionConfiguration.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "suspension-reason" => Some(("suspensionReason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "master-instance-name" => Some(("masterInstanceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-status.kms-key-version-name" => Some(("diskEncryptionStatus.kmsKeyVersionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-status.kind" => Some(("diskEncryptionStatus.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "gce-zone" => Some(("gceZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1502,7 +1507,7 @@ impl<'n> Engine<'n> { "replica-configuration.mysql-replica-configuration.client-key" => Some(("replicaConfiguration.mysqlReplicaConfiguration.clientKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "availability-type", "available", "backend-type", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "connection-name", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "data-disk-type", "database-replication-enabled", "database-version", "day", "dump-file-path", "enabled", "etag", "expiration-time", "failover-replica", "failover-target", "follow-gae-application", "gce-zone", "host-port", "hour", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "location-preference", "maintenance-window", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "private-network", "project", "region", "replica-configuration", "replica-names", "replication-log-archiving-enabled", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "storage-auto-resize", "storage-auto-resize-limit", "suspension-reason", "tier", "update-track", "user-labels", "username", "verify-server-certificate", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "availability-type", "available", "backend-type", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "connection-name", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "data-disk-type", "database-replication-enabled", "database-version", "day", "disk-encryption-configuration", "disk-encryption-status", "dump-file-path", "enabled", "etag", "expiration-time", "failover-replica", "failover-target", "follow-gae-application", "gce-zone", "host-port", "hour", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "kms-key-name", "kms-key-version-name", "location-preference", "maintenance-window", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "private-network", "project", "region", "replica-configuration", "replica-names", "replication-log-archiving-enabled", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "storage-auto-resize", "storage-auto-resize-limit", "suspension-reason", "tier", "update-track", "user-labels", "username", "verify-server-certificate", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1705,8 +1710,12 @@ impl<'n> Engine<'n> { "database-version" => Some(("databaseVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "instance-type" => Some(("instanceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "max-disk-size" => Some(("maxDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-configuration.kind" => Some(("diskEncryptionConfiguration.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-configuration.kms-key-name" => Some(("diskEncryptionConfiguration.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "suspension-reason" => Some(("suspensionReason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "master-instance-name" => Some(("masterInstanceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-status.kms-key-version-name" => Some(("diskEncryptionStatus.kmsKeyVersionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-status.kind" => Some(("diskEncryptionStatus.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "gce-zone" => Some(("gceZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1775,7 +1784,7 @@ impl<'n> Engine<'n> { "replica-configuration.mysql-replica-configuration.client-key" => Some(("replicaConfiguration.mysqlReplicaConfiguration.clientKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "availability-type", "available", "backend-type", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "connection-name", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "data-disk-type", "database-replication-enabled", "database-version", "day", "dump-file-path", "enabled", "etag", "expiration-time", "failover-replica", "failover-target", "follow-gae-application", "gce-zone", "host-port", "hour", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "location-preference", "maintenance-window", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "private-network", "project", "region", "replica-configuration", "replica-names", "replication-log-archiving-enabled", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "storage-auto-resize", "storage-auto-resize-limit", "suspension-reason", "tier", "update-track", "user-labels", "username", "verify-server-certificate", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "availability-type", "available", "backend-type", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "connection-name", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "data-disk-type", "database-replication-enabled", "database-version", "day", "disk-encryption-configuration", "disk-encryption-status", "dump-file-path", "enabled", "etag", "expiration-time", "failover-replica", "failover-target", "follow-gae-application", "gce-zone", "host-port", "hour", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "kms-key-name", "kms-key-version-name", "location-preference", "maintenance-window", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "private-network", "project", "region", "replica-configuration", "replica-names", "replication-log-archiving-enabled", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "storage-auto-resize", "storage-auto-resize-limit", "suspension-reason", "tier", "update-track", "user-labels", "username", "verify-server-certificate", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2383,8 +2392,12 @@ impl<'n> Engine<'n> { "database-version" => Some(("databaseVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "instance-type" => Some(("instanceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "max-disk-size" => Some(("maxDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-configuration.kind" => Some(("diskEncryptionConfiguration.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-configuration.kms-key-name" => Some(("diskEncryptionConfiguration.kmsKeyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "suspension-reason" => Some(("suspensionReason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "master-instance-name" => Some(("masterInstanceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-status.kms-key-version-name" => Some(("diskEncryptionStatus.kmsKeyVersionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-encryption-status.kind" => Some(("diskEncryptionStatus.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "gce-zone" => Some(("gceZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2453,7 +2466,7 @@ impl<'n> Engine<'n> { "replica-configuration.mysql-replica-configuration.client-key" => Some(("replicaConfiguration.mysqlReplicaConfiguration.clientKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "availability-type", "available", "backend-type", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "connection-name", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "data-disk-type", "database-replication-enabled", "database-version", "day", "dump-file-path", "enabled", "etag", "expiration-time", "failover-replica", "failover-target", "follow-gae-application", "gce-zone", "host-port", "hour", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "location-preference", "maintenance-window", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "private-network", "project", "region", "replica-configuration", "replica-names", "replication-log-archiving-enabled", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "storage-auto-resize", "storage-auto-resize-limit", "suspension-reason", "tier", "update-track", "user-labels", "username", "verify-server-certificate", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "availability-type", "available", "backend-type", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "connection-name", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "data-disk-type", "database-replication-enabled", "database-version", "day", "disk-encryption-configuration", "disk-encryption-status", "dump-file-path", "enabled", "etag", "expiration-time", "failover-replica", "failover-target", "follow-gae-application", "gce-zone", "host-port", "hour", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "kms-key-name", "kms-key-version-name", "location-preference", "maintenance-window", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "private-network", "project", "region", "replica-configuration", "replica-names", "replication-log-archiving-enabled", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "storage-auto-resize", "storage-auto-resize-limit", "suspension-reason", "tier", "update-track", "user-labels", "username", "verify-server-certificate", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4985,7 +4998,7 @@ fn main() { let mut app = App::new("sqladmin1-beta4") .author("Sebastian Thiel ") - .version("1.0.8+20180917") + .version("1.0.8+20190328") .about("Creates and manages Cloud SQL instances, which provide fully managed MySQL or PostgreSQL databases.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli") .arg(Arg::with_name("url") diff --git a/gen/sqladmin1_beta4/Cargo.toml b/gen/sqladmin1_beta4/Cargo.toml index ca86098a93..cbe4ca72cd 100644 --- a/gen/sqladmin1_beta4/Cargo.toml +++ b/gen/sqladmin1_beta4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-sqladmin1_beta4" -version = "1.0.8+20180917" +version = "1.0.8+20190328" authors = ["Sebastian Thiel "] description = "A complete library to interact with SQL Admin (protocol v1beta4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/sqladmin1_beta4" homepage = "https://cloud.google.com/sql/docs/reference/latest" -documentation = "https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917" +documentation = "https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328" license = "MIT" keywords = ["sqladmin", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/sqladmin1_beta4/README.md b/gen/sqladmin1_beta4/README.md index f16c24016e..75ea0e0d85 100644 --- a/gen/sqladmin1_beta4/README.md +++ b/gen/sqladmin1_beta4/README.md @@ -5,30 +5,30 @@ DO NOT EDIT ! --> The `google-sqladmin1_beta4` library allows access to all features of the *Google SQL Admin* service. -This documentation was generated from *SQL Admin* crate version *1.0.8+20180917*, where *20180917* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *SQL Admin* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *SQL Admin* *v1_beta4* API can be found at the [official documentation site](https://cloud.google.com/sql/docs/reference/latest). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.SQLAdmin.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.SQLAdmin.html) ... -* [backup runs](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.BackupRun.html) - * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.BackupRunDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.BackupRunGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.BackupRunInsertCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.BackupRunListCall.html) -* [databases](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.Database.html) - * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.DatabaseDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.DatabaseGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.DatabaseInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.DatabaseListCall.html), [*patch*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.DatabasePatchCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.DatabaseUpdateCall.html) -* [flags](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.Flag.html) - * [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.FlagListCall.html) +* [backup runs](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.BackupRun.html) + * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.BackupRunDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.BackupRunGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.BackupRunInsertCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.BackupRunListCall.html) +* [databases](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.Database.html) + * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.DatabaseDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.DatabaseGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.DatabaseInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.DatabaseListCall.html), [*patch*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.DatabasePatchCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.DatabaseUpdateCall.html) +* [flags](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.Flag.html) + * [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.FlagListCall.html) * instances - * [*add server ca*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceAddServerCaCall.html), [*clone*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceCloneCall.html), [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceDeleteCall.html), [*demote master*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceDemoteMasterCall.html), [*export*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceExportCall.html), [*failover*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceFailoverCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceGetCall.html), [*import*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceImportCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceListCall.html), [*list server cas*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceListServerCaCall.html), [*patch*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstancePatchCall.html), [*promote replica*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstancePromoteReplicaCall.html), [*reset ssl config*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceResetSslConfigCall.html), [*restart*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceRestartCall.html), [*restore backup*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceRestoreBackupCall.html), [*rotate server ca*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceRotateServerCaCall.html), [*start replica*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceStartReplicaCall.html), [*stop replica*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceStopReplicaCall.html), [*truncate log*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceTruncateLogCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.InstanceUpdateCall.html) -* [operations](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.Operation.html) - * [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.OperationListCall.html) -* [ssl certs](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.SslCert.html) - * [*create ephemeral*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.SslCertCreateEphemeralCall.html), [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.SslCertDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.SslCertGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.SslCertInsertCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.SslCertListCall.html) -* [tiers](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.Tier.html) - * [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.TierListCall.html) -* [users](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.User.html) - * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.UserDeleteCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.UserInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.UserListCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.UserUpdateCall.html) + * [*add server ca*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceAddServerCaCall.html), [*clone*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceCloneCall.html), [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceDeleteCall.html), [*demote master*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceDemoteMasterCall.html), [*export*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceExportCall.html), [*failover*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceFailoverCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceGetCall.html), [*import*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceImportCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceListCall.html), [*list server cas*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceListServerCaCall.html), [*patch*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstancePatchCall.html), [*promote replica*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstancePromoteReplicaCall.html), [*reset ssl config*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceResetSslConfigCall.html), [*restart*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceRestartCall.html), [*restore backup*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceRestoreBackupCall.html), [*rotate server ca*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceRotateServerCaCall.html), [*start replica*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceStartReplicaCall.html), [*stop replica*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceStopReplicaCall.html), [*truncate log*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceTruncateLogCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.InstanceUpdateCall.html) +* [operations](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.Operation.html) + * [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.OperationListCall.html) +* [ssl certs](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.SslCert.html) + * [*create ephemeral*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.SslCertCreateEphemeralCall.html), [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.SslCertDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.SslCertGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.SslCertInsertCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.SslCertListCall.html) +* [tiers](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.Tier.html) + * [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.TierListCall.html) +* [users](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.User.html) + * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.UserDeleteCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.UserInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.UserListCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.UserUpdateCall.html) @@ -37,17 +37,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/struct.SQLAdmin.html)** +* **[Hub](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/struct.SQLAdmin.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.Part.html)** + * **[Parts](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -174,17 +174,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -194,29 +194,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-sqladmin1_beta4/1.0.8+20180917/google_sqladmin1_beta4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-sqladmin1_beta4/1.0.8+20190328/google_sqladmin1_beta4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/sqladmin1_beta4/src/lib.rs b/gen/sqladmin1_beta4/src/lib.rs index a9272499f6..e7fb99bf0f 100644 --- a/gen/sqladmin1_beta4/src/lib.rs +++ b/gen/sqladmin1_beta4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *SQL Admin* crate version *1.0.8+20180917*, where *20180917* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *SQL Admin* crate version *1.0.8+20190328*, where *20190328* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *SQL Admin* *v1_beta4* API can be found at the //! [official documentation site](https://cloud.google.com/sql/docs/reference/latest). @@ -440,19 +440,20 @@ impl<'a, C, A> SQLAdmin // ############ // SCHEMAS ### // ########## -/// Database instance operation errors list wrapper. +/// Disk encryption configuration. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationErrors { - /// This is always sql#operationErrors. +pub struct DiskEncryptionConfiguration { + /// This is always sql#diskEncryptionConfiguration. pub kind: Option, - /// The list of errors encountered while processing this operation. - pub errors: Option>, + /// KMS key resource name + #[serde(rename="kmsKeyName")] + pub kms_key_name: Option, } -impl Part for OperationErrors {} +impl Part for DiskEncryptionConfiguration {} /// A BackupRun resource. @@ -523,19 +524,19 @@ pub struct SslCertDetail { impl Part for SslCertDetail {} -/// Database flags for Cloud SQL instances. +/// Database instance operation errors list wrapper. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DatabaseFlags { - /// The name of the flag. These flags are passed at instance startup, so include both server options and system variables for MySQL. Flags should be specified with underscores, not hyphens. For more information, see Configuring Database Flags in the Cloud SQL documentation. - pub name: Option, - /// The value of the flag. Booleans should be set to on for true and off for false. This field must be omitted if the flag doesn't take a value. - pub value: Option, +pub struct OperationErrors { + /// This is always sql#operationErrors. + pub kind: Option, + /// The list of errors encountered while processing this operation. + pub errors: Option>, } -impl Part for DatabaseFlags {} +impl Part for OperationErrors {} /// Database instance restore from backup context. @@ -579,20 +580,20 @@ pub struct DemoteMasterContext { impl Part for DemoteMasterContext {} -/// Options for exporting data as CSV. -/// Exporting in CSV format using the Cloud SQL Admin API is not supported for PostgreSQL instances. +/// Disk encryption status. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExportContextCsvExportOptions { - /// The select query used to extract the data. - #[serde(rename="selectQuery")] - pub select_query: Option, +pub struct DiskEncryptionStatus { + /// KMS key version used to encrypt the Cloud SQL instance disk + #[serde(rename="kmsKeyVersionName")] + pub kms_key_version_name: Option, + /// This is always sql#diskEncryptionStatus. + pub kind: Option, } -impl NestedType for ExportContextCsvExportOptions {} -impl Part for ExportContextCsvExportOptions {} +impl Part for DiskEncryptionStatus {} /// Database instance backup configuration. @@ -743,6 +744,21 @@ pub struct TiersListResponse { impl ResponseResult for TiersListResponse {} +/// Options for exporting data as CSV. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExportContextCsvExportOptions { + /// The select query used to extract the data. + #[serde(rename="selectQuery")] + pub select_query: Option, +} + +impl NestedType for ExportContextCsvExportOptions {} +impl Part for ExportContextCsvExportOptions {} + + /// Database instance import context. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -751,7 +767,7 @@ impl ResponseResult for TiersListResponse {} pub struct ImportContext { /// This is always sql#importContext. pub kind: Option, - /// The PostgreSQL user for this import operation. Defaults to cloudsqlsuperuser. PostgreSQL instances only. + /// The PostgreSQL user for this import operation. PostgreSQL instances only. #[serde(rename="importUser")] pub import_user: Option, /// The target database for the import. If fileType is SQL, this field is required only if the import file does not specify a database, and is overridden by any database specification in the import file. If fileType is CSV, one database must be specified. @@ -759,11 +775,9 @@ pub struct ImportContext { /// The file type for the specified uri. /// SQL: The file contains SQL statements. /// CSV: The file contains CSV data. - /// Importing CSV data using the Cloud SQL Admin API is not supported for PostgreSQL instances. #[serde(rename="fileType")] pub file_type: Option, /// Options for importing data as CSV. - /// Importing CSV data using the Cloud SQL Admin API is not supported for PostgreSQL instances. #[serde(rename="csvImportOptions")] pub csv_import_options: Option, /// Path to the import file in Cloud Storage, in the form gs://bucketName/fileName. Compressed gzip files (.gz) are supported when fileType is SQL. The instance must have write permissions to the bucket and read access to the file. @@ -800,19 +814,17 @@ impl Part for IpMapping {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ExportContext { /// Options for exporting data as CSV. - /// Exporting in CSV format using the Cloud SQL Admin API is not supported for PostgreSQL instances. #[serde(rename="csvExportOptions")] pub csv_export_options: Option, /// This is always sql#exportContext. pub kind: Option, /// Databases to be exported. /// MySQL instances: If fileType is SQL and no database is specified, all databases are exported, except for the mysql system database. If fileType is CSV, you can specify one database, either by using this property or by using the csvExportOptions.selectQuery property, which takes precedence over this property. - /// PostgreSQL instances: If fileType is SQL, you must specify one database to be exported. A fileType of CSV is not supported for PostgreSQL instances. + /// PostgreSQL instances: Specify exactly one database to be exported. If fileType is CSV, this database must match the database used in the csvExportOptions.selectQuery property. pub databases: Option>, /// The file type for the specified uri. /// SQL: The file contains SQL statements. /// CSV: The file contains CSV data. - /// CSV is not supported for PostgreSQL instances. #[serde(rename="fileType")] pub file_type: Option, /// Options for exporting data as SQL statements. @@ -889,7 +901,6 @@ impl ResponseResult for Database {} /// Options for importing data as CSV. -/// Importing CSV data using the Cloud SQL Admin API is not supported for PostgreSQL instances. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -920,7 +931,7 @@ pub struct IpConfiguration { /// The list of external networks that are allowed to connect to the instance using the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24). #[serde(rename="authorizedNetworks")] pub authorized_networks: Option>, - /// Reserved for future use. + /// The resource link for the VPC network from which the Cloud SQL instance is accessible for private IP. For example, /projects/myProject/global/networks/default. This setting can be updated, but it cannot be removed after it is set. #[serde(rename="privateNetwork")] pub private_network: Option, } @@ -956,6 +967,9 @@ impl Part for OperationError {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Flag { + /// True if the flag is only released in Beta. + #[serde(rename="inBeta")] + pub in_beta: Option, /// This is always sql#flag. pub kind: Option, /// This is the name of the flag. Flag names always use underscores, not hyphens, e.g. max_allowed_packet @@ -966,12 +980,12 @@ pub struct Flag { /// The database version this flag applies to. Can be MYSQL_5_5, MYSQL_5_6, or MYSQL_5_7. MYSQL_5_7 is applicable only to Second Generation instances. #[serde(rename="appliesTo")] pub applies_to: Option>, - /// For INTEGER flags, the maximum allowed value. - #[serde(rename="maxValue")] - pub max_value: Option, /// Indicates whether changing this flag will trigger a database restart. Only applicable to Second Generation instances. #[serde(rename="requiresRestart")] pub requires_restart: Option, + /// For INTEGER flags, the maximum allowed value. + #[serde(rename="maxValue")] + pub max_value: Option, /// For INTEGER flags, the minimum allowed value. #[serde(rename="minValue")] pub min_value: Option, @@ -1205,6 +1219,21 @@ pub struct MySqlReplicaConfiguration { impl Part for MySqlReplicaConfiguration {} +/// Options for exporting from MySQL. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExportContextSqlExportOptionsMysqlExportOptions { + /// Option to include SQL statement required to set up replication. If set to 1, the dump file includes a CHANGE MASTER TO statement with the binary log coordinates. If set to 2, the CHANGE MASTER TO statement is written as a SQL comment, and has no effect. All other values are ignored. + #[serde(rename="masterData")] + pub master_data: Option, +} + +impl NestedType for ExportContextSqlExportOptionsMysqlExportOptions {} +impl Part for ExportContextSqlExportOptionsMysqlExportOptions {} + + /// Database instance settings. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1475,7 +1504,7 @@ pub struct InstancesTruncateLogRequest { impl RequestValue for InstancesTruncateLogRequest {} -/// Maintenance window. This specifies when a v2 Cloud SQL instance should preferably be restarted for system maintenance puruposes. +/// Maintenance window. This specifies when a v2 Cloud SQL instance should preferably be restarted for system maintenance purposes. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -1512,27 +1541,19 @@ impl NestedType for DatabaseInstanceFailoverReplica {} impl Part for DatabaseInstanceFailoverReplica {} -/// Database instances list response. +/// An Admin API warning message. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list instances](struct.InstanceListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InstancesListResponse { - /// The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// List of database instance resources. - pub items: Option>, - /// This is always sql#instancesList. - pub kind: Option, +pub struct ApiWarning { + /// The warning message. + pub message: Option, + /// Code to uniquely identify the warning type. + pub code: Option, } -impl ResponseResult for InstancesListResponse {} +impl Part for ApiWarning {} /// Database instance export request. @@ -1554,6 +1575,46 @@ pub struct InstancesExportRequest { impl RequestValue for InstancesExportRequest {} +/// Database instances list response. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list instances](struct.InstanceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InstancesListResponse { + /// The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of database instance resources. + pub items: Option>, + /// This is always sql#instancesList. + pub kind: Option, + /// List of warnings that ocurred while handling the request. + pub warnings: Option>, +} + +impl ResponseResult for InstancesListResponse {} + + +/// Database flags for Cloud SQL instances. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DatabaseFlags { + /// The name of the flag. These flags are passed at instance startup, so include both server options and system variables for MySQL. Flags should be specified with underscores, not hyphens. For more information, see Configuring Database Flags in the Cloud SQL documentation. + pub name: Option, + /// The value of the flag. Booleans should be set to on for true and off for false. This field must be omitted if the flag doesn't take a value. + pub value: Option, +} + +impl Part for DatabaseFlags {} + + /// User list response. /// /// # Activities @@ -1615,7 +1676,10 @@ pub struct DatabaseInstance { /// Connection name of the Cloud SQL instance used in connection strings. #[serde(rename="connectionName")] pub connection_name: Option, - /// The database engine type and version. The databaseVersion field can not be changed after instance creation. MySQL Second Generation instances: MYSQL_5_7 (default) or MYSQL_5_6. PostgreSQL instances: POSTGRES_9_6 MySQL First Generation instances: MYSQL_5_6 (default) or MYSQL_5_5 + /// Configuration specific to on-premises instances. + #[serde(rename="onPremisesConfiguration")] + pub on_premises_configuration: Option, + /// The database engine type and version. The databaseVersion field can not be changed after instance creation. MySQL Second Generation instances: MYSQL_5_7 (default) or MYSQL_5_6. PostgreSQL instances: POSTGRES_9_6 (default) or POSTGRES_11 Beta. MySQL First Generation instances: MYSQL_5_6 (default) or MYSQL_5_5 #[serde(rename="databaseVersion")] pub database_version: Option, /// The instance type. This can be one of the following. @@ -1627,9 +1691,9 @@ pub struct DatabaseInstance { /// The maximum disk size of the instance in bytes. #[serde(rename="maxDiskSize")] pub max_disk_size: Option, - /// Configuration specific to on-premises instances. - #[serde(rename="onPremisesConfiguration")] - pub on_premises_configuration: Option, + /// Disk encryption configuration specific to an instance. Applies only to Second Generation instances. + #[serde(rename="diskEncryptionConfiguration")] + pub disk_encryption_configuration: Option, /// This is always sql#instance. pub kind: Option, /// Name of the Cloud SQL instance. This does not include the project ID. @@ -1648,6 +1712,9 @@ pub struct DatabaseInstance { /// The name of the instance which will act as master in the replication setup. #[serde(rename="masterInstanceName")] pub master_instance_name: Option, + /// Disk encryption status specific to an instance. Applies only to Second Generation instances. + #[serde(rename="diskEncryptionStatus")] + pub disk_encryption_status: Option, /// The project ID of the project containing the Cloud SQL instance. The Google apps domain is prefixed if applicable. pub project: Option, /// The current serving state of the Cloud SQL instance. This can be one of the following. @@ -1889,6 +1956,9 @@ impl Part for LocationPreference {} pub struct ExportContextSqlExportOptions { /// Tables to export, or that were exported, from the specified database. If you specify tables, specify one and only one database. For PostgreSQL instances, you can specify only one table. pub tables: Option>, + /// Options for exporting from MySQL. + #[serde(rename="mysqlExportOptions")] + pub mysql_export_options: Option, /// Export only schemas. #[serde(rename="schemaOnly")] pub schema_only: Option, @@ -3263,10 +3333,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3286,7 +3353,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3388,7 +3455,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3532,10 +3599,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3555,7 +3619,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3643,7 +3707,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3785,10 +3849,7 @@ impl<'a, C, A> TierListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3808,7 +3869,7 @@ impl<'a, C, A> TierListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3886,7 +3947,7 @@ impl<'a, C, A> TierListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4030,10 +4091,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4053,7 +4111,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4141,7 +4199,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4289,10 +4347,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4312,7 +4367,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4420,7 +4475,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4578,10 +4633,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4613,7 +4665,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4730,7 +4782,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4881,10 +4933,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4916,7 +4965,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5016,7 +5065,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5167,10 +5216,7 @@ impl<'a, C, A> InstanceTruncateLogCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5202,7 +5248,7 @@ impl<'a, C, A> InstanceTruncateLogCall<'a, C, A> where C: BorrowMut InstanceTruncateLogCall<'a, C, A> where C: BorrowMut InstanceDemoteMasterCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5488,7 +5531,7 @@ impl<'a, C, A> InstanceDemoteMasterCall<'a, C, A> where C: BorrowMut InstanceDemoteMasterCall<'a, C, A> where C: BorrowMut InstanceFailoverCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5774,7 +5814,7 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5874,7 +5914,7 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6025,10 +6065,7 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6060,7 +6097,7 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6160,7 +6197,7 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6304,10 +6341,7 @@ impl<'a, C, A> InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6327,7 +6361,7 @@ impl<'a, C, A> InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut InstanceAddServerCaCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6582,7 +6613,7 @@ impl<'a, C, A> InstanceAddServerCaCall<'a, C, A> where C: BorrowMut InstanceAddServerCaCall<'a, C, A> where C: BorrowMut InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6837,7 +6865,7 @@ impl<'a, C, A> InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut InstanceGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7092,7 +7117,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7180,7 +7205,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7331,10 +7356,7 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7366,7 +7388,7 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7466,7 +7488,7 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7617,10 +7639,7 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7652,7 +7671,7 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7752,7 +7771,7 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7896,10 +7915,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7919,7 +7935,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8007,7 +8023,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8151,10 +8167,7 @@ impl<'a, C, A> InstanceStopReplicaCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8174,7 +8187,7 @@ impl<'a, C, A> InstanceStopReplicaCall<'a, C, A> where C: BorrowMut InstanceStopReplicaCall<'a, C, A> where C: BorrowMut InstanceStartReplicaCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8429,7 +8439,7 @@ impl<'a, C, A> InstanceStartReplicaCall<'a, C, A> where C: BorrowMut InstanceStartReplicaCall<'a, C, A> where C: BorrowMut InstanceInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8701,7 +8708,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8791,7 +8798,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8942,10 +8949,7 @@ impl<'a, C, A> InstanceRotateServerCaCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8977,7 +8981,7 @@ impl<'a, C, A> InstanceRotateServerCaCall<'a, C, A> where C: BorrowMut InstanceRotateServerCaCall<'a, C, A> where C: BorrowMut InstanceListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9257,7 +9258,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9356,7 +9357,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9500,10 +9501,7 @@ impl<'a, C, A> InstanceListServerCaCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9523,7 +9521,7 @@ impl<'a, C, A> InstanceListServerCaCall<'a, C, A> where C: BorrowMut InstanceListServerCaCall<'a, C, A> where C: BorrowMut InstanceUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9797,7 +9792,7 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9897,7 +9892,7 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10041,10 +10036,7 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10064,7 +10056,7 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10152,7 +10144,7 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10303,10 +10295,7 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10338,7 +10327,7 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10438,7 +10427,7 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10589,10 +10578,7 @@ impl<'a, C, A> InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10624,7 +10610,7 @@ impl<'a, C, A> InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut FlagListCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10871,7 +10854,7 @@ impl<'a, C, A> FlagListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10946,7 +10929,7 @@ impl<'a, C, A> FlagListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11092,10 +11075,7 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11115,7 +11095,7 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11213,7 +11193,7 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11366,10 +11346,7 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11401,7 +11378,7 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11511,7 +11488,7 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11655,10 +11632,7 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11678,7 +11652,7 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11766,7 +11740,7 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11917,10 +11891,7 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11952,7 +11923,7 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12052,7 +12023,7 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12198,10 +12169,7 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12221,7 +12189,7 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12319,7 +12287,7 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12472,10 +12440,7 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12507,7 +12472,7 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12617,7 +12582,7 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12768,10 +12733,7 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12803,7 +12765,7 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12903,7 +12865,7 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13049,10 +13011,7 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13072,7 +13031,7 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13170,7 +13129,7 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13316,10 +13275,7 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13339,7 +13295,7 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13437,7 +13393,7 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13588,10 +13544,7 @@ impl<'a, C, A> SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13623,7 +13576,7 @@ impl<'a, C, A> SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut SslCertListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13890,7 +13840,7 @@ impl<'a, C, A> SslCertListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13978,7 +13928,7 @@ impl<'a, C, A> SslCertListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14132,10 +14082,7 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14155,7 +14102,7 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14257,7 +14204,7 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14403,10 +14350,7 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14426,7 +14370,7 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14524,7 +14468,7 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14670,10 +14614,7 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14693,7 +14634,7 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14791,7 +14732,7 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14942,10 +14883,7 @@ impl<'a, C, A> BackupRunInsertCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14977,7 +14915,7 @@ impl<'a, C, A> BackupRunInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15077,7 +15015,7 @@ impl<'a, C, A> BackupRunInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/storage1-cli/Cargo.toml b/gen/storage1-cli/Cargo.toml index 4d7773905b..9cd0a3616f 100644 --- a/gen/storage1-cli/Cargo.toml +++ b/gen/storage1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-storage1-cli" -version = "1.0.8+20180905" +version = "1.0.8+20190226" authors = ["Sebastian Thiel "] description = "A complete library to interact with storage (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/storage1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-storage1] path = "../storage1" -version = "1.0.8+20180905" +version = "1.0.8+20190226" diff --git a/gen/storage1-cli/README.md b/gen/storage1-cli/README.md index 966e9b1842..158d41a2b0 100644 --- a/gen/storage1-cli/README.md +++ b/gen/storage1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *storage* API at revision *20180905*. The CLI is at version *1.0.8*. +This documentation was generated from the *storage* API at revision *20190226*. The CLI is at version *1.0.8*. ```bash storage1 [options] diff --git a/gen/storage1-cli/mkdocs.yml b/gen/storage1-cli/mkdocs.yml index bc76ab367e..c499532909 100644 --- a/gen/storage1-cli/mkdocs.yml +++ b/gen/storage1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: storage v1.0.8+20180905 +site_name: storage v1.0.8+20190226 site_url: http://byron.github.io/google-apis-rs/google-storage1-cli site_description: A complete library to interact with storage (protocol v1) diff --git a/gen/storage1-cli/src/main.rs b/gen/storage1-cli/src/main.rs index cebb07f6a7..da8b6858f8 100644 --- a/gen/storage1-cli/src/main.rs +++ b/gen/storage1-cli/src/main.rs @@ -723,6 +723,8 @@ impl<'n> Engine<'n> { "retention-policy.is-locked" => Some(("retentionPolicy.isLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "retention-policy.retention-period" => Some(("retentionPolicy.retentionPeriod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "iam-configuration.bucket-policy-only.enabled" => Some(("iamConfiguration.bucketPolicyOnly.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "iam-configuration.bucket-policy-only.locked-time" => Some(("iamConfiguration.bucketPolicyOnly.lockedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "owner.entity-id" => Some(("owner.entityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "owner.entity" => Some(("owner.entity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-event-based-hold" => Some(("defaultEventBasedHold", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -730,7 +732,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["billing", "default-event-based-hold", "default-kms-key-name", "effective-time", "enabled", "encryption", "entity", "entity-id", "etag", "id", "is-locked", "kind", "labels", "location", "log-bucket", "log-object-prefix", "logging", "main-page-suffix", "metageneration", "name", "not-found-page", "owner", "project-number", "requester-pays", "retention-period", "retention-policy", "self-link", "storage-class", "time-created", "updated", "versioning", "website"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["billing", "bucket-policy-only", "default-event-based-hold", "default-kms-key-name", "effective-time", "enabled", "encryption", "entity", "entity-id", "etag", "iam-configuration", "id", "is-locked", "kind", "labels", "location", "locked-time", "log-bucket", "log-object-prefix", "logging", "main-page-suffix", "metageneration", "name", "not-found-page", "owner", "project-number", "requester-pays", "retention-period", "retention-policy", "self-link", "storage-class", "time-created", "updated", "versioning", "website"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -969,6 +971,8 @@ impl<'n> Engine<'n> { "retention-policy.is-locked" => Some(("retentionPolicy.isLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "retention-policy.retention-period" => Some(("retentionPolicy.retentionPeriod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "iam-configuration.bucket-policy-only.enabled" => Some(("iamConfiguration.bucketPolicyOnly.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "iam-configuration.bucket-policy-only.locked-time" => Some(("iamConfiguration.bucketPolicyOnly.lockedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "owner.entity-id" => Some(("owner.entityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "owner.entity" => Some(("owner.entity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-event-based-hold" => Some(("defaultEventBasedHold", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -976,7 +980,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["billing", "default-event-based-hold", "default-kms-key-name", "effective-time", "enabled", "encryption", "entity", "entity-id", "etag", "id", "is-locked", "kind", "labels", "location", "log-bucket", "log-object-prefix", "logging", "main-page-suffix", "metageneration", "name", "not-found-page", "owner", "project-number", "requester-pays", "retention-period", "retention-policy", "self-link", "storage-class", "time-created", "updated", "versioning", "website"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["billing", "bucket-policy-only", "default-event-based-hold", "default-kms-key-name", "effective-time", "enabled", "encryption", "entity", "entity-id", "etag", "iam-configuration", "id", "is-locked", "kind", "labels", "location", "locked-time", "log-bucket", "log-object-prefix", "logging", "main-page-suffix", "metageneration", "name", "not-found-page", "owner", "project-number", "requester-pays", "retention-period", "retention-policy", "self-link", "storage-class", "time-created", "updated", "versioning", "website"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1244,6 +1248,8 @@ impl<'n> Engine<'n> { "retention-policy.is-locked" => Some(("retentionPolicy.isLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "retention-policy.retention-period" => Some(("retentionPolicy.retentionPeriod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "iam-configuration.bucket-policy-only.enabled" => Some(("iamConfiguration.bucketPolicyOnly.enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "iam-configuration.bucket-policy-only.locked-time" => Some(("iamConfiguration.bucketPolicyOnly.lockedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "owner.entity-id" => Some(("owner.entityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "owner.entity" => Some(("owner.entity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "default-event-based-hold" => Some(("defaultEventBasedHold", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1251,7 +1257,7 @@ impl<'n> Engine<'n> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "location" => Some(("location", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["billing", "default-event-based-hold", "default-kms-key-name", "effective-time", "enabled", "encryption", "entity", "entity-id", "etag", "id", "is-locked", "kind", "labels", "location", "log-bucket", "log-object-prefix", "logging", "main-page-suffix", "metageneration", "name", "not-found-page", "owner", "project-number", "requester-pays", "retention-period", "retention-policy", "self-link", "storage-class", "time-created", "updated", "versioning", "website"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["billing", "bucket-policy-only", "default-event-based-hold", "default-kms-key-name", "effective-time", "enabled", "encryption", "entity", "entity-id", "etag", "iam-configuration", "id", "is-locked", "kind", "labels", "location", "locked-time", "log-bucket", "log-object-prefix", "logging", "main-page-suffix", "metageneration", "name", "not-found-page", "owner", "project-number", "requester-pays", "retention-period", "retention-policy", "self-link", "storage-class", "time-created", "updated", "versioning", "website"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4724,7 +4730,7 @@ fn main() { Some(false)), ]), ("patch", - Some(r##"Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. This method supports patch semantics."##), + Some(r##"Patches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/buckets_patch", vec![ (Some(r##"bucket"##), @@ -5793,7 +5799,7 @@ fn main() { let mut app = App::new("storage1") .author("Sebastian Thiel ") - .version("1.0.8+20180905") + .version("1.0.8+20190226") .about("Stores and retrieves potentially large, immutable data objects.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_storage1_cli") .arg(Arg::with_name("url") diff --git a/gen/storage1/Cargo.toml b/gen/storage1/Cargo.toml index 882813d7c0..ef8bdef34c 100644 --- a/gen/storage1/Cargo.toml +++ b/gen/storage1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-storage1" -version = "1.0.8+20180905" +version = "1.0.8+20190226" authors = ["Sebastian Thiel "] description = "A complete library to interact with storage (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/storage1" homepage = "https://developers.google.com/storage/docs/json_api/" -documentation = "https://docs.rs/google-storage1/1.0.8+20180905" +documentation = "https://docs.rs/google-storage1/1.0.8+20190226" license = "MIT" keywords = ["storage", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/storage1/README.md b/gen/storage1/README.md index 847193fd35..5314f3c5b6 100644 --- a/gen/storage1/README.md +++ b/gen/storage1/README.md @@ -5,44 +5,44 @@ DO NOT EDIT ! --> The `google-storage1` library allows access to all features of the *Google storage* service. -This documentation was generated from *storage* crate version *1.0.8+20180905*, where *20180905* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *storage* crate version *1.0.8+20190226*, where *20190226* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *storage* *v1* API can be found at the [official documentation site](https://developers.google.com/storage/docs/json_api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.Storage.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.Storage.html) ... -* [bucket access controls](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketAccessControl.html) - * [*delete*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketAccessControlUpdateCall.html) -* [buckets](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.Bucket.html) - * [*delete*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketGetCall.html), [*get iam policy*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketGetIamPolicyCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketListCall.html), [*lock retention policy*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketLockRetentionPolicyCall.html), [*patch*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketPatchCall.html), [*set iam policy*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketTestIamPermissionCall.html) and [*update*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.BucketUpdateCall.html) -* [channels](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.Channel.html) - * [*stop*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ChannelStopCall.html) +* [bucket access controls](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketAccessControl.html) + * [*delete*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketAccessControlUpdateCall.html) +* [buckets](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.Bucket.html) + * [*delete*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketGetCall.html), [*get iam policy*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketGetIamPolicyCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketListCall.html), [*lock retention policy*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketLockRetentionPolicyCall.html), [*patch*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketPatchCall.html), [*set iam policy*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketTestIamPermissionCall.html) and [*update*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.BucketUpdateCall.html) +* [channels](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.Channel.html) + * [*stop*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ChannelStopCall.html) * default object access controls - * [*delete*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.DefaultObjectAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.DefaultObjectAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.DefaultObjectAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.DefaultObjectAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.DefaultObjectAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.DefaultObjectAccessControlUpdateCall.html) -* [notifications](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.Notification.html) - * [*delete*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.NotificationDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.NotificationGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.NotificationInsertCall.html) and [*list*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.NotificationListCall.html) -* [object access controls](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectAccessControl.html) - * [*delete*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectAccessControlUpdateCall.html) -* [objects](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.Object.html) - * [*compose*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectComposeCall.html), [*copy*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectCopyCall.html), [*delete*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectGetCall.html), [*get iam policy*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectGetIamPolicyCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectPatchCall.html), [*rewrite*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectRewriteCall.html), [*set iam policy*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectTestIamPermissionCall.html), [*update*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectUpdateCall.html) and [*watch all*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectWatchAllCall.html) + * [*delete*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.DefaultObjectAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.DefaultObjectAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.DefaultObjectAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.DefaultObjectAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.DefaultObjectAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.DefaultObjectAccessControlUpdateCall.html) +* [notifications](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.Notification.html) + * [*delete*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.NotificationDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.NotificationGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.NotificationInsertCall.html) and [*list*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.NotificationListCall.html) +* [object access controls](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectAccessControl.html) + * [*delete*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectAccessControlUpdateCall.html) +* [objects](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.Object.html) + * [*compose*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectComposeCall.html), [*copy*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectCopyCall.html), [*delete*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectGetCall.html), [*get iam policy*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectGetIamPolicyCall.html), [*insert*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectPatchCall.html), [*rewrite*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectRewriteCall.html), [*set iam policy*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectTestIamPermissionCall.html), [*update*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectUpdateCall.html) and [*watch all*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectWatchAllCall.html) * projects - * [*service account get*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ProjectServiceAccountGetCall.html) + * [*service account get*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ProjectServiceAccountGetCall.html) Upload supported by ... -* [*insert objects*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectInsertCall.html) +* [*insert objects*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectInsertCall.html) Download supported by ... -* [*get objects*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectGetCall.html) +* [*get objects*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectGetCall.html) Subscription supported by ... -* [*watch all objects*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectWatchAllCall.html) -* [*list objects*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.ObjectListCall.html) +* [*watch all objects*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectWatchAllCall.html) +* [*list objects*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.ObjectListCall.html) @@ -50,17 +50,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/struct.Storage.html)** +* **[Hub](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/struct.Storage.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.Part.html)** + * **[Parts](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -184,17 +184,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -204,29 +204,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-storage1/1.0.8+20180905/google_storage1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-storage1/1.0.8+20190226/google_storage1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/storage1/src/lib.rs b/gen/storage1/src/lib.rs index ccf8d3418d..ca165c9e1e 100644 --- a/gen/storage1/src/lib.rs +++ b/gen/storage1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *storage* crate version *1.0.8+20180905*, where *20180905* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *storage* crate version *1.0.8+20190226*, where *20190226* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *storage* *v1* API can be found at the //! [official documentation site](https://developers.google.com/storage/docs/json_api/). @@ -528,24 +528,25 @@ impl NestedType for ComposeRequestSourceObjects {} impl Part for ComposeRequestSourceObjects {} -/// A subscription to receive Google PubSub notifications. +/// Represents an expression text. Example: title: "User account presence" description: "Determines whether the request has a user account" expression: "size(request.user) > 0" /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [service account get projects](struct.ProjectServiceAccountGetCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ServiceAccount { - /// The kind of item this is. For notifications, this is always storage#notification. +pub struct Expr { + /// The kind of item this is. For storage, this is always storage#expr. This field is ignored on input. pub kind: Option, - /// The ID of the notification. - pub email_address: Option, + /// An optional description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. + pub description: Option, + /// Textual representation of an expression in Common Expression Language syntax. The application context of the containing message determines which well-known feature set of CEL is supported. + pub expression: Option, + /// An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file. + pub location: Option, + /// An optional title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. + pub title: Option, } -impl ResponseResult for ServiceAccount {} +impl Part for Expr {} /// An access-control list. @@ -590,86 +591,24 @@ impl NestedType for BucketCors {} impl Part for BucketCors {} -/// A bucket. +/// A subscription to receive Google PubSub notifications. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [lock retention policy buckets](struct.BucketLockRetentionPolicyCall.html) (response) -/// * [update buckets](struct.BucketUpdateCall.html) (request|response) -/// * [test iam permissions buckets](struct.BucketTestIamPermissionCall.html) (none) -/// * [insert buckets](struct.BucketInsertCall.html) (request|response) -/// * [delete buckets](struct.BucketDeleteCall.html) (none) -/// * [set iam policy buckets](struct.BucketSetIamPolicyCall.html) (none) -/// * [get iam policy buckets](struct.BucketGetIamPolicyCall.html) (none) -/// * [patch buckets](struct.BucketPatchCall.html) (request|response) -/// * [list buckets](struct.BucketListCall.html) (none) -/// * [get buckets](struct.BucketGetCall.html) (response) +/// * [service account get projects](struct.ProjectServiceAccountGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Bucket { - /// The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information. - pub website: Option, - /// The URI of this bucket. - #[serde(rename="selfLink")] - pub self_link: Option, - /// The modification time of the bucket in RFC 3339 format. - pub updated: Option, - /// The creation time of the bucket in RFC 3339 format. - #[serde(rename="timeCreated")] - pub time_created: Option, - /// User-provided labels, in key/value pairs. - pub labels: Option>, - /// Default access controls to apply to new objects when no ACL is provided. - #[serde(rename="defaultObjectAcl")] - pub default_object_acl: Option>, - /// The bucket's retention policy. The retention policy enforces a minimum retention time for all objects contained in the bucket, based on their creation time. Any attempt to overwrite or delete objects younger than the retention period will result in a PERMISSION_DENIED error. An unlocked retention policy can be modified or removed from the bucket via a storage.buckets.update operation. A locked retention policy cannot be removed or shortened in duration for the lifetime of the bucket. Attempting to remove or decrease period of a locked retention policy will result in a PERMISSION_DENIED error. - #[serde(rename="retentionPolicy")] - pub retention_policy: Option, - /// The bucket's Cross-Origin Resource Sharing (CORS) configuration. - pub cors: Option>, - /// The owner of the bucket. This is always the project team's owner group. - pub owner: Option, - /// The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. - pub logging: Option, - /// Access controls on the bucket. - pub acl: Option>, - /// The ID of the bucket. For buckets, the id and name properties are the same. - pub id: Option, - /// The project number of the project the bucket belongs to. - #[serde(rename="projectNumber")] - pub project_number: Option, - /// The metadata generation of this bucket. - pub metageneration: Option, - /// The kind of item this is. For buckets, this is always storage#bucket. +pub struct ServiceAccount { + /// The kind of item this is. For notifications, this is always storage#notification. pub kind: Option, - /// The default value for event-based hold on newly created objects in this bucket. Event-based hold is a way to retain objects indefinitely until an event occurs, signified by the hold's release. After being released, such objects will be subject to bucket-level retention (if any). One sample use case of this flag is for banks to hold loan documents for at least 3 years after loan is paid in full. Here, bucket-level retention is 3 years and the event is loan being paid in full. In this example, these objects will be held intact for any number of years until the event has occurred (event-based hold on the object is released) and then 3 more years after that. That means retention duration of the objects begins from the moment event-based hold transitioned from true to false. Objects under event-based hold cannot be deleted, overwritten or archived until the hold is removed. - #[serde(rename="defaultEventBasedHold")] - pub default_event_based_hold: Option, - /// The name of the bucket. - pub name: Option, - /// The bucket's billing configuration. - pub billing: Option, - /// Encryption configuration for a bucket. - pub encryption: Option, - /// The bucket's lifecycle configuration. See lifecycle management for more information. - pub lifecycle: Option, - /// HTTP 1.1 Entity tag for the bucket. - pub etag: Option, - /// The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US. See the developer's guide for the authoritative list. - pub location: Option, - /// The bucket's versioning configuration. - pub versioning: Option, - /// The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see storage classes. - #[serde(rename="storageClass")] - pub storage_class: Option, + /// The ID of the notification. + pub email_address: Option, } -impl RequestValue for Bucket {} -impl Resource for Bucket {} -impl ResponseResult for Bucket {} +impl ResponseResult for ServiceAccount {} /// The bucket's retention policy. The retention policy enforces a minimum retention time for all objects contained in the bucket, based on their creation time. Any attempt to overwrite or delete objects younger than the retention period will result in a PERMISSION_DENIED error. An unlocked retention policy can be modified or removed from the bucket via a storage.buckets.update operation. A locked retention policy cannot be removed or shortened in duration for the lifetime of the bucket. Attempting to remove or decrease period of a locked retention policy will result in a PERMISSION_DENIED error. @@ -693,6 +632,35 @@ impl NestedType for BucketRetentionPolicy {} impl Part for BucketRetentionPolicy {} +/// The condition(s) under which the action will be taken. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BucketLifecycleRuleCondition { + /// Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this version of the object. + #[serde(rename="numNewerVersions")] + pub num_newer_versions: Option, + /// A date in RFC 3339 format with only the date part (for instance, "2013-01-15"). This condition is satisfied when an object is created before midnight of the specified date in UTC. + #[serde(rename="createdBefore")] + pub created_before: Option, + /// A regular expression that satisfies the RE2 syntax. This condition is satisfied when the name of the object matches the RE2 pattern. Note: This feature is currently in the "Early Access" launch stage and is only available to a whitelisted set of users; that means that this feature may be changed in backward-incompatible ways and that it is not guaranteed to be released. + #[serde(rename="matchesPattern")] + pub matches_pattern: Option, + /// Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects. + #[serde(rename="isLive")] + pub is_live: Option, + /// Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. + #[serde(rename="matchesStorageClass")] + pub matches_storage_class: Option>, + /// Age of an object (in days). This condition is satisfied when an object reaches the specified age. + pub age: Option, +} + +impl NestedType for BucketLifecycleRuleCondition {} +impl Part for BucketLifecycleRuleCondition {} + + /// Encryption configuration for a bucket. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -743,33 +711,18 @@ impl NestedType for ObjectAccessControlProjectTeam {} impl Part for ObjectAccessControlProjectTeam {} -/// The condition(s) under which the action will be taken. +/// The bucket's lifecycle configuration. See lifecycle management for more information. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BucketLifecycleRuleCondition { - /// Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this version of the object. - #[serde(rename="numNewerVersions")] - pub num_newer_versions: Option, - /// A date in RFC 3339 format with only the date part (for instance, "2013-01-15"). This condition is satisfied when an object is created before midnight of the specified date in UTC. - #[serde(rename="createdBefore")] - pub created_before: Option, - /// A regular expression that satisfies the RE2 syntax. This condition is satisfied when the name of the object matches the RE2 pattern. Note: This feature is currently in the "Early Access" launch stage and is only available to a whitelisted set of users; that means that this feature may be changed in backward-incompatible ways and that it is not guaranteed to be released. - #[serde(rename="matchesPattern")] - pub matches_pattern: Option, - /// Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects. - #[serde(rename="isLive")] - pub is_live: Option, - /// Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. - #[serde(rename="matchesStorageClass")] - pub matches_storage_class: Option>, - /// Age of an object (in days). This condition is satisfied when an object reaches the specified age. - pub age: Option, +pub struct BucketLifecycle { + /// A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken. + pub rule: Option>, } -impl NestedType for BucketLifecycleRuleCondition {} -impl Part for BucketLifecycleRuleCondition {} +impl NestedType for BucketLifecycle {} +impl Part for BucketLifecycle {} /// A bucket/object IAM policy. @@ -992,8 +945,8 @@ pub struct PolicyBindings { /// - roles/storage.legacyBucketWriter — Read access to buckets with object listing/creation/deletion. Equivalent to an ACL entry on a bucket with the WRITER role. /// - roles/storage.legacyBucketOwner — Read and write access to existing buckets with object listing/creation/deletion. Equivalent to an ACL entry on a bucket with the OWNER role. pub role: Option, - /// no description provided - pub condition: Option, + /// The condition that is associated with this binding. NOTE: an unsatisfied condition will not allow user access via current binding. Different bindings, including their conditions, are examined independently. + pub condition: Option, /// A collection of identifiers for members who may assume the provided role. Recognized identifiers are as follows: /// - allUsers — A special identifier that represents anyone on the internet; with or without a Google account. /// - allAuthenticatedUsers — A special identifier that represents anyone who is authenticated with a Google account or a service account. @@ -1053,6 +1006,21 @@ impl Resource for Channel {} impl ResponseResult for Channel {} +/// The bucket's IAM configuration. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BucketIamConfiguration { + /// The bucket's Bucket Policy Only configuration. + #[serde(rename="bucketPolicyOnly")] + pub bucket_policy_only: Option, +} + +impl NestedType for BucketIamConfiguration {} +impl Part for BucketIamConfiguration {} + + /// The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1106,18 +1074,106 @@ pub struct TestIamPermissionsResponse { impl ResponseResult for TestIamPermissionsResponse {} -/// The bucket's lifecycle configuration. See lifecycle management for more information. +/// A bucket. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [lock retention policy buckets](struct.BucketLockRetentionPolicyCall.html) (response) +/// * [update buckets](struct.BucketUpdateCall.html) (request|response) +/// * [test iam permissions buckets](struct.BucketTestIamPermissionCall.html) (none) +/// * [insert buckets](struct.BucketInsertCall.html) (request|response) +/// * [delete buckets](struct.BucketDeleteCall.html) (none) +/// * [set iam policy buckets](struct.BucketSetIamPolicyCall.html) (none) +/// * [get iam policy buckets](struct.BucketGetIamPolicyCall.html) (none) +/// * [patch buckets](struct.BucketPatchCall.html) (request|response) +/// * [list buckets](struct.BucketListCall.html) (none) +/// * [get buckets](struct.BucketGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Bucket { + /// The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information. + pub website: Option, + /// The URI of this bucket. + #[serde(rename="selfLink")] + pub self_link: Option, + /// The modification time of the bucket in RFC 3339 format. + pub updated: Option, + /// The creation time of the bucket in RFC 3339 format. + #[serde(rename="timeCreated")] + pub time_created: Option, + /// User-provided labels, in key/value pairs. + pub labels: Option>, + /// Default access controls to apply to new objects when no ACL is provided. + #[serde(rename="defaultObjectAcl")] + pub default_object_acl: Option>, + /// The bucket's retention policy. The retention policy enforces a minimum retention time for all objects contained in the bucket, based on their creation time. Any attempt to overwrite or delete objects younger than the retention period will result in a PERMISSION_DENIED error. An unlocked retention policy can be modified or removed from the bucket via a storage.buckets.update operation. A locked retention policy cannot be removed or shortened in duration for the lifetime of the bucket. Attempting to remove or decrease period of a locked retention policy will result in a PERMISSION_DENIED error. + #[serde(rename="retentionPolicy")] + pub retention_policy: Option, + /// The bucket's Cross-Origin Resource Sharing (CORS) configuration. + pub cors: Option>, + /// The owner of the bucket. This is always the project team's owner group. + pub owner: Option, + /// The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. + pub logging: Option, + /// Access controls on the bucket. + pub acl: Option>, + /// The ID of the bucket. For buckets, the id and name properties are the same. + pub id: Option, + /// The project number of the project the bucket belongs to. + #[serde(rename="projectNumber")] + pub project_number: Option, + /// The metadata generation of this bucket. + pub metageneration: Option, + /// The kind of item this is. For buckets, this is always storage#bucket. + pub kind: Option, + /// The default value for event-based hold on newly created objects in this bucket. Event-based hold is a way to retain objects indefinitely until an event occurs, signified by the hold's release. After being released, such objects will be subject to bucket-level retention (if any). One sample use case of this flag is for banks to hold loan documents for at least 3 years after loan is paid in full. Here, bucket-level retention is 3 years and the event is loan being paid in full. In this example, these objects will be held intact for any number of years until the event has occurred (event-based hold on the object is released) and then 3 more years after that. That means retention duration of the objects begins from the moment event-based hold transitioned from true to false. Objects under event-based hold cannot be deleted, overwritten or archived until the hold is removed. + #[serde(rename="defaultEventBasedHold")] + pub default_event_based_hold: Option, + /// The name of the bucket. + pub name: Option, + /// The bucket's billing configuration. + pub billing: Option, + /// Encryption configuration for a bucket. + pub encryption: Option, + /// The bucket's lifecycle configuration. See lifecycle management for more information. + pub lifecycle: Option, + /// HTTP 1.1 Entity tag for the bucket. + pub etag: Option, + /// The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US. See the developer's guide for the authoritative list. + pub location: Option, + /// The bucket's IAM configuration. + #[serde(rename="iamConfiguration")] + pub iam_configuration: Option, + /// The bucket's versioning configuration. + pub versioning: Option, + /// The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see storage classes. + #[serde(rename="storageClass")] + pub storage_class: Option, +} + +impl RequestValue for Bucket {} +impl Resource for Bucket {} +impl ResponseResult for Bucket {} + + +/// The bucket's Bucket Policy Only configuration. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BucketLifecycle { - /// A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken. - pub rule: Option>, +pub struct BucketIamConfigurationBucketPolicyOnly { + /// If set, access checks only use bucket-level IAM policies or above. + pub enabled: Option, + /// The deadline time for changing iamConfiguration.bucketPolicyOnly.enabled from true to false in RFC 3339 format. iamConfiguration.bucketPolicyOnly.enabled may be changed from true to false until the locked time, after which the field is immutable. + #[serde(rename="lockedTime")] + pub locked_time: Option, } -impl NestedType for BucketLifecycle {} -impl Part for BucketLifecycle {} +impl NestedType for BucketIamConfigurationBucketPolicyOnly {} +impl Part for BucketIamConfigurationBucketPolicyOnly {} /// A Compose request. @@ -2619,7 +2675,7 @@ impl<'a, C, A> BucketMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. This method supports patch semantics. + /// Patches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. /// /// # Arguments /// @@ -3010,10 +3066,7 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3045,7 +3098,7 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3142,7 +3195,7 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3299,10 +3352,7 @@ impl<'a, C, A> DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3322,7 +3372,7 @@ impl<'a, C, A> DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3612,7 +3659,7 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3719,7 +3766,7 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3867,10 +3914,7 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3890,7 +3934,7 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3975,7 +4019,7 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4131,10 +4175,7 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4166,7 +4207,7 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4273,7 +4314,7 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4422,10 +4463,7 @@ impl<'a, C, A> DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4445,7 +4483,7 @@ impl<'a, C, A> DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4731,7 +4766,7 @@ impl<'a, C, A> BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5009,7 +5041,7 @@ impl<'a, C, A> BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5283,7 +5312,7 @@ impl<'a, C, A> BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut BucketAccessControlGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5552,7 +5578,7 @@ impl<'a, C, A> BucketAccessControlGetCall<'a, C, A> where C: BorrowMut BucketAccessControlGetCall<'a, C, A> where C: BorrowMut BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5838,7 +5861,7 @@ impl<'a, C, A> BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut BucketAccessControlListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6115,7 +6135,7 @@ impl<'a, C, A> BucketAccessControlListCall<'a, C, A> where C: BorrowMut BucketAccessControlListCall<'a, C, A> where C: BorrowMut ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6360,7 +6377,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6430,7 +6447,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6584,10 +6601,7 @@ impl<'a, C, A> NotificationInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6619,7 +6633,7 @@ impl<'a, C, A> NotificationInsertCall<'a, C, A> where C: BorrowMut NotificationInsertCall<'a, C, A> where C: BorrowMut NotificationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6887,7 +6898,7 @@ impl<'a, C, A> NotificationDeleteCall<'a, C, A> where C: BorrowMut NotificationDeleteCall<'a, C, A> where C: BorrowMut NotificationGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7144,7 +7152,7 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7239,7 +7247,7 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7386,10 +7394,7 @@ impl<'a, C, A> NotificationListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7409,7 +7414,7 @@ impl<'a, C, A> NotificationListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7494,7 +7499,7 @@ impl<'a, C, A> NotificationListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7724,10 +7729,7 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7759,7 +7761,7 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7984,7 +7986,7 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8184,10 +8186,7 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8207,7 +8206,7 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8344,7 +8343,7 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8533,10 +8532,7 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8568,7 +8564,7 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -8714,7 +8710,7 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8875,10 +8871,7 @@ impl<'a, C, A> ObjectSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8910,7 +8903,7 @@ impl<'a, C, A> ObjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ObjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ObjectGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9201,7 +9191,7 @@ impl<'a, C, A> ObjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ObjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9529,7 +9516,7 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9685,7 +9672,7 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9894,10 +9881,7 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9956,7 +9940,7 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -10189,7 +10173,7 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10365,10 +10349,7 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10400,7 +10381,7 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10535,7 +10516,7 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10708,10 +10689,7 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10731,7 +10709,7 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10851,7 +10829,7 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11033,10 +11011,7 @@ impl<'a, C, A> ObjectListCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11056,7 +11031,7 @@ impl<'a, C, A> ObjectListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11190,7 +11165,7 @@ impl<'a, C, A> ObjectListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11350,10 +11325,7 @@ impl<'a, C, A> ObjectTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11373,7 +11345,7 @@ impl<'a, C, A> ObjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ObjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11736,7 +11705,7 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11940,7 +11909,7 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12131,10 +12100,7 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12166,7 +12132,7 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12322,7 +12288,7 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12478,10 +12444,7 @@ impl<'a, C, A> ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12501,7 +12464,7 @@ impl<'a, C, A> ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12811,7 +12771,7 @@ impl<'a, C, A> ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut ObjectAccessControlListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13112,7 +13069,7 @@ impl<'a, C, A> ObjectAccessControlListCall<'a, C, A> where C: BorrowMut ObjectAccessControlListCall<'a, C, A> where C: BorrowMut ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13392,7 +13346,7 @@ impl<'a, C, A> ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13692,7 +13643,7 @@ impl<'a, C, A> ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14012,7 +13960,7 @@ impl<'a, C, A> ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut BucketPatchCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14340,7 +14285,7 @@ impl<'a, C, A> BucketPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14472,7 +14417,7 @@ impl<'a, C, A> BucketPatchCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14651,10 +14596,7 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14686,7 +14628,7 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14818,7 +14760,7 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14980,10 +14922,7 @@ impl<'a, C, A> BucketGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15003,7 +14942,7 @@ impl<'a, C, A> BucketGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15109,7 +15048,7 @@ impl<'a, C, A> BucketGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15265,10 +15204,7 @@ impl<'a, C, A> BucketDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15288,7 +15224,7 @@ impl<'a, C, A> BucketDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15377,7 +15313,7 @@ impl<'a, C, A> BucketDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15526,10 +15462,7 @@ impl<'a, C, A> BucketLockRetentionPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15549,7 +15482,7 @@ impl<'a, C, A> BucketLockRetentionPolicyCall<'a, C, A> where C: BorrowMut BucketLockRetentionPolicyCall<'a, C, A> where C: BorrowMut BucketInsertCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15827,7 +15757,7 @@ impl<'a, C, A> BucketInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15945,7 +15875,7 @@ impl<'a, C, A> BucketInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16098,10 +16028,7 @@ impl<'a, C, A> BucketTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16121,7 +16048,7 @@ impl<'a, C, A> BucketTestIamPermissionCall<'a, C, A> where C: BorrowMut BucketTestIamPermissionCall<'a, C, A> where C: BorrowMut BucketSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -16406,7 +16330,7 @@ impl<'a, C, A> BucketSetIamPolicyCall<'a, C, A> where C: BorrowMut BucketSetIamPolicyCall<'a, C, A> where C: BorrowMut BucketGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16673,7 +16594,7 @@ impl<'a, C, A> BucketGetIamPolicyCall<'a, C, A> where C: BorrowMut BucketGetIamPolicyCall<'a, C, A> where C: BorrowMut BucketListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16927,7 +16845,7 @@ impl<'a, C, A> BucketListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17040,7 +16958,7 @@ impl<'a, C, A> BucketListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17187,10 +17105,7 @@ impl<'a, C, A> ProjectServiceAccountGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17210,7 +17125,7 @@ impl<'a, C, A> ProjectServiceAccountGetCall<'a, C, A> where C: BorrowMut ProjectServiceAccountGetCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with storagetransfer (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/storagetransfer1-cli" -homepage = "https://cloud.google.com/storage/transfer" +homepage = "https://cloud.google.com/storage-transfer/docs" documentation = "http://byron.github.io/google-apis-rs/google_storagetransfer1_cli" license = "MIT" keywords = ["storagetransfer", "google", "cli"] @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-storagetransfer1] path = "../storagetransfer1" -version = "1.0.8+20181008" +version = "1.0.8+20190330" diff --git a/gen/storagetransfer1-cli/README.md b/gen/storagetransfer1-cli/README.md index 36b9d93149..f7c8a62694 100644 --- a/gen/storagetransfer1-cli/README.md +++ b/gen/storagetransfer1-cli/README.md @@ -11,7 +11,7 @@ capabilities. Errors will be printed to standard error, and cause the program's If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. Everything else about the *storagetransfer* API can be found at the -[official documentation site](https://cloud.google.com/storage/transfer). +[official documentation site](https://cloud.google.com/storage-transfer/docs). # Installation and Source Code @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *storagetransfer* API at revision *20181008*. The CLI is at version *1.0.8*. +This documentation was generated from the *storagetransfer* API at revision *20190330*. The CLI is at version *1.0.8*. ```bash storagetransfer1 [options] diff --git a/gen/storagetransfer1-cli/mkdocs.yml b/gen/storagetransfer1-cli/mkdocs.yml index 115e761b14..fd5f505493 100644 --- a/gen/storagetransfer1-cli/mkdocs.yml +++ b/gen/storagetransfer1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: storagetransfer v1.0.8+20181008 +site_name: storagetransfer v1.0.8+20190330 site_url: http://byron.github.io/google-apis-rs/google-storagetransfer1-cli site_description: A complete library to interact with storagetransfer (protocol v1) diff --git a/gen/storagetransfer1-cli/src/main.rs b/gen/storagetransfer1-cli/src/main.rs index 679ee138d3..65145fe99f 100644 --- a/gen/storagetransfer1-cli/src/main.rs +++ b/gen/storagetransfer1-cli/src/main.rs @@ -121,6 +121,7 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transfer-spec.object-conditions.max-time-elapsed-since-last-modification" => Some(("transferSpec.objectConditions.maxTimeElapsedSinceLastModification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transfer-spec.object-conditions.include-prefixes" => Some(("transferSpec.objectConditions.includePrefixes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "transfer-spec.object-conditions.exclude-prefixes" => Some(("transferSpec.objectConditions.excludePrefixes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -134,15 +135,14 @@ impl<'n> Engine<'n> { "transfer-spec.aws-s3-data-source.aws-access-key.secret-access-key" => Some(("transferSpec.awsS3DataSource.awsAccessKey.secretAccessKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transfer-spec.aws-s3-data-source.aws-access-key.access-key-id" => Some(("transferSpec.awsS3DataSource.awsAccessKey.accessKeyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transfer-spec.aws-s3-data-source.bucket-name" => Some(("transferSpec.awsS3DataSource.bucketName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "deletion-time" => Some(("deletionTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "schedule.start-time-of-day.hours" => Some(("schedule.startTimeOfDay.hours", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "schedule.start-time-of-day.nanos" => Some(("schedule.startTimeOfDay.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "schedule.start-time-of-day.seconds" => Some(("schedule.startTimeOfDay.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "schedule.start-time-of-day.minutes" => Some(("schedule.startTimeOfDay.minutes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "schedule.schedule-start-date.year" => Some(("schedule.scheduleStartDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "schedule.schedule-start-date.day" => Some(("schedule.scheduleStartDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "schedule.schedule-start-date.month" => Some(("schedule.scheduleStartDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.start-time-of-day.hours" => Some(("schedule.startTimeOfDay.hours", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.start-time-of-day.nanos" => Some(("schedule.startTimeOfDay.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.start-time-of-day.minutes" => Some(("schedule.startTimeOfDay.minutes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.start-time-of-day.seconds" => Some(("schedule.startTimeOfDay.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "schedule.schedule-end-date.year" => Some(("schedule.scheduleEndDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "schedule.schedule-end-date.day" => Some(("schedule.scheduleEndDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "schedule.schedule-end-date.month" => Some(("schedule.scheduleEndDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -355,6 +355,7 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-transfer-job-field-mask" => Some(("updateTransferJobFieldMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "transfer-job.status" => Some(("transferJob.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transfer-job.transfer-spec.object-conditions.max-time-elapsed-since-last-modification" => Some(("transferJob.transferSpec.objectConditions.maxTimeElapsedSinceLastModification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transfer-job.transfer-spec.object-conditions.include-prefixes" => Some(("transferJob.transferSpec.objectConditions.includePrefixes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "transfer-job.transfer-spec.object-conditions.exclude-prefixes" => Some(("transferJob.transferSpec.objectConditions.excludePrefixes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -368,15 +369,14 @@ impl<'n> Engine<'n> { "transfer-job.transfer-spec.aws-s3-data-source.aws-access-key.secret-access-key" => Some(("transferJob.transferSpec.awsS3DataSource.awsAccessKey.secretAccessKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transfer-job.transfer-spec.aws-s3-data-source.aws-access-key.access-key-id" => Some(("transferJob.transferSpec.awsS3DataSource.awsAccessKey.accessKeyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transfer-job.transfer-spec.aws-s3-data-source.bucket-name" => Some(("transferJob.transferSpec.awsS3DataSource.bucketName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transfer-job.status" => Some(("transferJob.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transfer-job.deletion-time" => Some(("transferJob.deletionTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transfer-job.schedule.start-time-of-day.hours" => Some(("transferJob.schedule.startTimeOfDay.hours", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "transfer-job.schedule.start-time-of-day.nanos" => Some(("transferJob.schedule.startTimeOfDay.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "transfer-job.schedule.start-time-of-day.seconds" => Some(("transferJob.schedule.startTimeOfDay.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "transfer-job.schedule.start-time-of-day.minutes" => Some(("transferJob.schedule.startTimeOfDay.minutes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "transfer-job.schedule.schedule-start-date.year" => Some(("transferJob.schedule.scheduleStartDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "transfer-job.schedule.schedule-start-date.day" => Some(("transferJob.schedule.scheduleStartDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "transfer-job.schedule.schedule-start-date.month" => Some(("transferJob.schedule.scheduleStartDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "transfer-job.schedule.start-time-of-day.hours" => Some(("transferJob.schedule.startTimeOfDay.hours", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "transfer-job.schedule.start-time-of-day.nanos" => Some(("transferJob.schedule.startTimeOfDay.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "transfer-job.schedule.start-time-of-day.minutes" => Some(("transferJob.schedule.startTimeOfDay.minutes", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "transfer-job.schedule.start-time-of-day.seconds" => Some(("transferJob.schedule.startTimeOfDay.seconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "transfer-job.schedule.schedule-end-date.year" => Some(("transferJob.schedule.scheduleEndDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "transfer-job.schedule.schedule-end-date.day" => Some(("transferJob.schedule.scheduleEndDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "transfer-job.schedule.schedule-end-date.month" => Some(("transferJob.schedule.scheduleEndDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -1272,7 +1272,7 @@ fn main() { let mut app = App::new("storagetransfer1") .author("Sebastian Thiel ") - .version("1.0.8+20181008") + .version("1.0.8+20190330") .about("Transfers data from external data sources to a Google Cloud Storage bucket or between Google Cloud Storage buckets.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli") .arg(Arg::with_name("url") diff --git a/gen/storagetransfer1/Cargo.toml b/gen/storagetransfer1/Cargo.toml index 9a663c32f5..b822c1e254 100644 --- a/gen/storagetransfer1/Cargo.toml +++ b/gen/storagetransfer1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-storagetransfer1" -version = "1.0.8+20181008" +version = "1.0.8+20190330" authors = ["Sebastian Thiel "] description = "A complete library to interact with storagetransfer (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/storagetransfer1" -homepage = "https://cloud.google.com/storage/transfer" -documentation = "https://docs.rs/google-storagetransfer1/1.0.8+20181008" +homepage = "https://cloud.google.com/storage-transfer/docs" +documentation = "https://docs.rs/google-storagetransfer1/1.0.8+20190330" license = "MIT" keywords = ["storagetransfer", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/storagetransfer1/README.md b/gen/storagetransfer1/README.md index 5da7beb780..79f2d59857 100644 --- a/gen/storagetransfer1/README.md +++ b/gen/storagetransfer1/README.md @@ -5,20 +5,20 @@ DO NOT EDIT ! --> The `google-storagetransfer1` library allows access to all features of the *Google storagetransfer* service. -This documentation was generated from *storagetransfer* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *storagetransfer* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *storagetransfer* *v1* API can be found at the -[official documentation site](https://cloud.google.com/storage/transfer). +[official documentation site](https://cloud.google.com/storage-transfer/docs). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.Storagetransfer.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.Storagetransfer.html) ... -* [google service accounts](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.GoogleServiceAccount.html) - * [*get*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.GoogleServiceAccountGetCall.html) -* [transfer jobs](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferJob.html) - * [*create*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferJobCreateCall.html), [*get*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferJobGetCall.html), [*list*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferJobListCall.html) and [*patch*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferJobPatchCall.html) -* [transfer operations](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferOperation.html) - * [*cancel*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferOperationCancelCall.html), [*delete*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferOperationDeleteCall.html), [*get*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferOperationGetCall.html), [*list*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferOperationListCall.html), [*pause*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferOperationPauseCall.html) and [*resume*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.TransferOperationResumeCall.html) +* [google service accounts](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.GoogleServiceAccount.html) + * [*get*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.GoogleServiceAccountGetCall.html) +* [transfer jobs](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferJob.html) + * [*create*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferJobCreateCall.html), [*get*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferJobGetCall.html), [*list*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferJobListCall.html) and [*patch*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferJobPatchCall.html) +* [transfer operations](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferOperation.html) + * [*cancel*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferOperationCancelCall.html), [*delete*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferOperationDeleteCall.html), [*get*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferOperationGetCall.html), [*list*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferOperationListCall.html), [*pause*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferOperationPauseCall.html) and [*resume*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.TransferOperationResumeCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/struct.Storagetransfer.html)** +* **[Hub](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/struct.Storagetransfer.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.Part.html)** + * **[Parts](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -136,17 +136,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -156,29 +156,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-storagetransfer1/1.0.8+20181008/google_storagetransfer1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-storagetransfer1/1.0.8+20190330/google_storagetransfer1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/storagetransfer1/src/lib.rs b/gen/storagetransfer1/src/lib.rs index 92bb9a795c..7d07de74e5 100644 --- a/gen/storagetransfer1/src/lib.rs +++ b/gen/storagetransfer1/src/lib.rs @@ -2,10 +2,10 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *storagetransfer* crate version *1.0.8+20181008*, where *20181008* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *storagetransfer* crate version *1.0.8+20190330*, where *20190330* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *storagetransfer* *v1* API can be found at the -//! [official documentation site](https://cloud.google.com/storage/transfer). +//! [official documentation site](https://cloud.google.com/storage-transfer/docs). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/storagetransfer1). //! # Features //! @@ -428,7 +428,8 @@ impl Part for TransferSpec {} /// AWS access key (see -/// [AWS Security Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)). +/// [AWS Security +/// Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)). /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -447,21 +448,29 @@ pub struct AwsAccessKey { impl Part for AwsAccessKey {} -/// Conditions that determine which objects will be transferred. +/// Conditions that determine which objects will be transferred. Applies only +/// to S3 and GCS objects. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ObjectConditions { - /// `maxTimeElapsedSinceLastModification` is the complement to - /// `minTimeElapsedSinceLastModification`. + /// If specified, only objects with a `lastModificationTime` on or after + /// `NOW` - `maxTimeElapsedSinceLastModification` and objects that don't have + /// a `lastModificationTime` are transferred. + /// + /// Note that `NOW` refers to the creation time of the transfer job, and + /// `lastModificationTime` refers to the time of the last change to the + /// object's content or metadata. Specifically, this would be the `updated` + /// property of GCS objects and the `LastModified` field of S3 objects. #[serde(rename="maxTimeElapsedSinceLastModification")] pub max_time_elapsed_since_last_modification: Option, /// If `includePrefixes` is specified, objects that satisfy the object /// conditions must have names that start with one of the `includePrefixes` - /// and that do not start with any of the `excludePrefixes`. If `includePrefixes` - /// is not specified, all objects except those that have names starting with - /// one of the `excludePrefixes` must satisfy the object conditions. + /// and that do not start with any of the `excludePrefixes`. If + /// `includePrefixes` is not specified, all objects except those that have + /// names starting with one of the `excludePrefixes` must satisfy the object + /// conditions. /// /// Requirements: /// @@ -498,13 +507,14 @@ pub struct ObjectConditions { /// The max size of `excludePrefixes` is 1000. #[serde(rename="excludePrefixes")] pub exclude_prefixes: Option>, - /// If unspecified, `minTimeElapsedSinceLastModification` takes a zero value - /// and `maxTimeElapsedSinceLastModification` takes the maximum possible - /// value of Duration. Objects that satisfy the object conditions - /// must either have a `lastModificationTime` greater or equal to - /// `NOW` - `maxTimeElapsedSinceLastModification` and less than - /// `NOW` - `minTimeElapsedSinceLastModification`, or not have a - /// `lastModificationTime`. + /// If specified, only objects with a `lastModificationTime` before + /// `NOW` - `minTimeElapsedSinceLastModification` and objects that don't have a + /// `lastModificationTime` are transferred. + /// + /// Note that `NOW` refers to the creation time of the transfer job, and + /// `lastModificationTime` refers to the time of the last change to the + /// object's content or metadata. Specifically, this would be the `updated` + /// property of GCS objects and the `LastModified` field of S3 objects. #[serde(rename="minTimeElapsedSinceLastModification")] pub min_time_elapsed_since_last_modification: Option, } @@ -595,18 +605,18 @@ impl Part for TransferCounters {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TransferOperation { + /// Status of the transfer operation. + pub status: Option, /// Transfer specification. /// Required. #[serde(rename="transferSpec")] pub transfer_spec: Option, - /// Status of the transfer operation. - pub status: Option, /// The name of the transfer job that triggers this transfer operation. #[serde(rename="transferJobName")] pub transfer_job_name: Option, /// A globally unique ID assigned by the system. pub name: Option, - /// The ID of the Google Cloud Platform Console project that owns the operation. + /// The ID of the Google Cloud Platform Project that owns the operation. /// Required. #[serde(rename="projectId")] pub project_id: Option, @@ -640,7 +650,8 @@ pub struct AwsS3Data { #[serde(rename="awsAccessKey")] pub aws_access_key: Option, /// S3 Bucket name (see - /// [Creating a bucket](http://docs.aws.amazon.com/AmazonS3/latest/dev/create-bucket-get-location-example.html)). + /// [Creating a + /// bucket](http://docs.aws.amazon.com/AmazonS3/latest/dev/create-bucket-get-location-example.html)). /// Required. #[serde(rename="bucketName")] pub bucket_name: Option, @@ -655,13 +666,13 @@ impl Part for AwsS3Data {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ErrorLogEntry { + /// A list of messages that carry the error details. + #[serde(rename="errorDetails")] + pub error_details: Option>, /// A URL that refers to the target (a data source, a data sink, /// or an object) with which the error is associated. /// Required. pub url: Option, - /// A list of messages that carry the error details. - #[serde(rename="errorDetails")] - pub error_details: Option>, } impl Part for ErrorLogEntry {} @@ -757,11 +768,11 @@ pub struct TimeOfDay { pub hours: Option, /// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. pub nanos: Option, + /// Minutes of hour of day. Must be from 0 to 59. + pub minutes: Option, /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may /// allow the value 60 if it allows leap-seconds. pub seconds: Option, - /// Minutes of hour of day. Must be from 0 to 59. - pub minutes: Option, } impl Part for TimeOfDay {} @@ -793,17 +804,17 @@ pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -911,6 +922,12 @@ impl ResponseResult for ListOperationsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Schedule { + /// The first day the recurring transfer is scheduled to run. If + /// `scheduleStartDate` is in the past, the transfer will run for the first + /// time on the following day. + /// Required. + #[serde(rename="scheduleStartDate")] + pub schedule_start_date: Option, /// The time in UTC at which the transfer will be scheduled to start in a day. /// Transfers may start later than this time. If not specified, recurring and /// one-time transfers that are scheduled to run today will run immediately; @@ -920,12 +937,6 @@ pub struct Schedule { /// day is specified in your local timezone. #[serde(rename="startTimeOfDay")] pub start_time_of_day: Option, - /// The first day the recurring transfer is scheduled to run. If - /// `scheduleStartDate` is in the past, the transfer will run for the first - /// time on the following day. - /// Required. - #[serde(rename="scheduleStartDate")] - pub schedule_start_date: Option, /// The last day the recurring transfer will be run. If `scheduleEndDate` /// is the same as `scheduleStartDate`, the transfer will be executed only /// once. @@ -947,6 +958,9 @@ pub struct ErrorSummary { #[serde(rename="errorCode")] pub error_code: Option, /// Error samples. + /// + /// No more than 100 error log entries may be recorded for a given + /// error code for a single task. #[serde(rename="errorLogEntries")] pub error_log_entries: Option>, /// Count of this type of error. @@ -1065,14 +1079,11 @@ impl Part for TransferOptions {} /// /// * [list transfer jobs](struct.TransferJobListCall.html) (none) /// * [create transfer jobs](struct.TransferJobCreateCall.html) (request|response) -/// * [get transfer jobs](struct.TransferJobGetCall.html) (response) /// * [patch transfer jobs](struct.TransferJobPatchCall.html) (response) +/// * [get transfer jobs](struct.TransferJobGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TransferJob { - /// Transfer specification. - #[serde(rename="transferSpec")] - pub transfer_spec: Option, /// Status of the job. This value MUST be specified for /// `CreateTransferJobRequests`. /// @@ -1081,12 +1092,15 @@ pub struct TransferJob { /// `DISABLED`, and an operation spawned by the transfer is running, the status /// change would not affect the current operation. pub status: Option, + /// Transfer specification. + #[serde(rename="transferSpec")] + pub transfer_spec: Option, /// This field cannot be changed by user requests. #[serde(rename="deletionTime")] pub deletion_time: Option, /// Schedule specification. pub schedule: Option, - /// The ID of the Google Cloud Platform Console project that owns the job. + /// The ID of the Google Cloud Platform Project that owns the job. #[serde(rename="projectId")] pub project_id: Option, /// This field cannot be changed by user requests. @@ -1627,7 +1641,7 @@ impl<'a, C, A> TransferOperationPauseCall<'a, C, A> where C: BorrowMut TransferOperationPauseCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1678,7 +1689,7 @@ impl<'a, C, A> TransferOperationPauseCall<'a, C, A> where C: BorrowMut TransferOperationPauseCall<'a, C, A> where C: BorrowMut TransferOperationResumeCall<'a, C, A> where C: BorrowMut TransferOperationResumeCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1961,7 +1969,7 @@ impl<'a, C, A> TransferOperationResumeCall<'a, C, A> where C: BorrowMut TransferOperationResumeCall<'a, C, A> where C: BorrowMut TransferOperationDeleteCall<'a, C, A> where C: BorrowMut TransferOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2225,7 +2230,7 @@ impl<'a, C, A> TransferOperationDeleteCall<'a, C, A> where C: BorrowMut TransferOperationDeleteCall<'a, C, A> where C: BorrowMut TransferOperationGetCall<'a, C, A> where C: BorrowMut TransferOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2478,7 +2480,7 @@ impl<'a, C, A> TransferOperationGetCall<'a, C, A> where C: BorrowMut TransferOperationGetCall<'a, C, A> where C: BorrowMut TransferOperationListCall<'a, C, A> where C: BorrowMut TransferOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2753,7 +2752,7 @@ impl<'a, C, A> TransferOperationListCall<'a, C, A> where C: BorrowMut TransferOperationListCall<'a, C, A> where C: BorrowMut TransferOperationCancelCall<'a, C, A> where C: BorrowMut TransferOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3025,7 +3021,7 @@ impl<'a, C, A> TransferOperationCancelCall<'a, C, A> where C: BorrowMut TransferOperationCancelCall<'a, C, A> where C: BorrowMut GoogleServiceAccountGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3279,7 +3272,7 @@ impl<'a, C, A> GoogleServiceAccountGetCall<'a, C, A> where C: BorrowMut GoogleServiceAccountGetCall<'a, C, A> where C: BorrowMut TransferJobListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3520,7 +3510,7 @@ impl<'a, C, A> TransferJobListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3592,9 +3582,9 @@ impl<'a, C, A> TransferJobListCall<'a, C, A> where C: BorrowMut, /// "job_names":["jobid1","jobid2",...], /// "job_statuses":["status1","status2",...]}. /// Since `job_names` and `job_statuses` support multiple values, their values - /// must be specified with array notation. `project_id` is required. `job_names` - /// and `job_statuses` are optional. The valid values for `job_statuses` are - /// case-insensitive: `ENABLED`, `DISABLED`, and `DELETED`. + /// must be specified with array notation. `project_id` is required. + /// `job_names` and `job_statuses` are optional. The valid values for + /// `job_statuses` are case-insensitive: `ENABLED`, `DISABLED`, and `DELETED`. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TransferJobListCall<'a, C, A> { @@ -3616,7 +3606,7 @@ impl<'a, C, A> TransferJobListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3759,7 +3749,7 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3775,10 +3765,7 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3810,7 +3797,7 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3901,7 +3888,7 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4040,7 +4027,7 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4056,10 +4043,7 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4079,7 +4063,7 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4166,7 +4150,7 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4296,10 +4280,7 @@ impl<'a, C, A> TransferJobCreateCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4331,7 +4312,7 @@ impl<'a, C, A> TransferJobCreateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4411,7 +4392,7 @@ impl<'a, C, A> TransferJobCreateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/surveys2/Cargo.toml b/gen/surveys2/Cargo.toml index 3d08c05f9f..3163f161a5 100644 --- a/gen/surveys2/Cargo.toml +++ b/gen/surveys2/Cargo.toml @@ -24,7 +24,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/surveys2/src/lib.rs b/gen/surveys2/src/lib.rs index eaa7f95f3e..6c62ae877d 100644 --- a/gen/surveys2/src/lib.rs +++ b/gen/surveys2/src/lib.rs @@ -1120,10 +1120,7 @@ impl<'a, C, A> SurveyStopCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1143,7 +1140,7 @@ impl<'a, C, A> SurveyStopCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1220,7 +1217,7 @@ impl<'a, C, A> SurveyStopCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1346,10 +1343,7 @@ impl<'a, C, A> SurveyInsertCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1381,7 +1375,7 @@ impl<'a, C, A> SurveyInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1461,7 +1455,7 @@ impl<'a, C, A> SurveyInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1603,10 +1597,7 @@ impl<'a, C, A> SurveyDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1626,7 +1617,7 @@ impl<'a, C, A> SurveyDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1704,7 +1695,7 @@ impl<'a, C, A> SurveyDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1838,10 +1829,7 @@ impl<'a, C, A> SurveyListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1861,7 +1849,7 @@ impl<'a, C, A> SurveyListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1947,7 +1935,7 @@ impl<'a, C, A> SurveyListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2096,10 +2084,7 @@ impl<'a, C, A> SurveyUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2131,7 +2116,7 @@ impl<'a, C, A> SurveyUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2221,7 +2206,7 @@ impl<'a, C, A> SurveyUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2370,10 +2355,7 @@ impl<'a, C, A> SurveyStartCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2405,7 +2387,7 @@ impl<'a, C, A> SurveyStartCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2494,7 +2476,7 @@ impl<'a, C, A> SurveyStartCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2636,10 +2618,7 @@ impl<'a, C, A> SurveyGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2659,7 +2638,7 @@ impl<'a, C, A> SurveyGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2737,7 +2716,7 @@ impl<'a, C, A> SurveyGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2907,10 +2886,7 @@ impl<'a, C, A> ResultGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2942,7 +2918,7 @@ impl<'a, C, A> ResultGetCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3032,7 +3008,7 @@ impl<'a, C, A> ResultGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/tagmanager1-cli/Cargo.toml b/gen/tagmanager1-cli/Cargo.toml index 1cf3992a47..d5a8e8e9f2 100644 --- a/gen/tagmanager1-cli/Cargo.toml +++ b/gen/tagmanager1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-tagmanager1-cli" -version = "1.0.8+20171108" +version = "1.0.8+20190220" authors = ["Sebastian Thiel "] description = "A complete library to interact with Tag Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tagmanager1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-tagmanager1] path = "../tagmanager1" -version = "1.0.8+20171108" +version = "1.0.8+20190220" diff --git a/gen/tagmanager1-cli/README.md b/gen/tagmanager1-cli/README.md index 960b41252c..809b2f5758 100644 --- a/gen/tagmanager1-cli/README.md +++ b/gen/tagmanager1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Tag Manager* API at revision *20171108*. The CLI is at version *1.0.8*. +This documentation was generated from the *Tag Manager* API at revision *20190220*. The CLI is at version *1.0.8*. ```bash tagmanager1 [options] @@ -36,7 +36,6 @@ tagmanager1 [options] containers-environments-delete [-p ]... containers-environments-get [-p ]... [-o ] containers-environments-list [-p ]... [-o ] - containers-environments-patch (-r )... [-p ]... [-o ] containers-environments-update (-r )... [-p ]... [-o ] containers-folders-create (-r )... [-p ]... [-o ] containers-folders-delete [-p ]... diff --git a/gen/tagmanager1-cli/mkdocs.yml b/gen/tagmanager1-cli/mkdocs.yml index bbc3d1c166..30acd7c4ae 100644 --- a/gen/tagmanager1-cli/mkdocs.yml +++ b/gen/tagmanager1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Tag Manager v1.0.8+20171108 +site_name: Tag Manager v1.0.8+20190220 site_url: http://byron.github.io/google-apis-rs/google-tagmanager1-cli site_description: A complete library to interact with Tag Manager (protocol v1) @@ -15,7 +15,6 @@ pages: - ['accounts_containers-environments-delete.md', 'Accounts', 'Containers Environments Delete'] - ['accounts_containers-environments-get.md', 'Accounts', 'Containers Environments Get'] - ['accounts_containers-environments-list.md', 'Accounts', 'Containers Environments List'] -- ['accounts_containers-environments-patch.md', 'Accounts', 'Containers Environments Patch'] - ['accounts_containers-environments-update.md', 'Accounts', 'Containers Environments Update'] - ['accounts_containers-folders-create.md', 'Accounts', 'Containers Folders Create'] - ['accounts_containers-folders-delete.md', 'Accounts', 'Containers Folders Delete'] diff --git a/gen/tagmanager1-cli/src/main.rs b/gen/tagmanager1-cli/src/main.rs index e3998fdb38..b8cb24f22f 100644 --- a/gen/tagmanager1-cli/src/main.rs +++ b/gen/tagmanager1-cli/src/main.rs @@ -429,106 +429,6 @@ impl<'n> Engine<'n> { } } - fn _accounts_containers_environments_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "authorization-code" => Some(("authorizationCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "container-id" => Some(("containerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "environment-id" => Some(("environmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "enable-debug" => Some(("enableDebug", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "authorization-timestamp-ms" => Some(("authorizationTimestampMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "container-version-id" => Some(("containerVersionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "authorization-code", "authorization-timestamp-ms", "container-id", "container-version-id", "description", "enable-debug", "environment-id", "fingerprint", "name", "type", "url"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Environment = json::value::from_value(object).unwrap(); - let mut call = self.hub.accounts().containers_environments_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("environment-id").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "fingerprint" => { - call = call.fingerprint(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["fingerprint"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _accounts_containers_environments_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -3594,9 +3494,6 @@ impl<'n> Engine<'n> { ("containers-environments-list", Some(opt)) => { call_result = self._accounts_containers_environments_list(opt, dry_run, &mut err); }, - ("containers-environments-patch", Some(opt)) => { - call_result = self._accounts_containers_environments_patch(opt, dry_run, &mut err); - }, ("containers-environments-update", Some(opt)) => { call_result = self._accounts_containers_environments_update(opt, dry_run, &mut err); }, @@ -3814,7 +3711,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("accounts", "methods: 'containers-create', 'containers-delete', 'containers-environments-create', 'containers-environments-delete', 'containers-environments-get', 'containers-environments-list', 'containers-environments-patch', 'containers-environments-update', 'containers-folders-create', 'containers-folders-delete', 'containers-folders-entities-list', 'containers-folders-get', 'containers-folders-list', 'containers-folders-update', 'containers-get', 'containers-list', 'containers-move-folders-update', 'containers-reauthorize-environments-update', 'containers-tags-create', 'containers-tags-delete', 'containers-tags-get', 'containers-tags-list', 'containers-tags-update', 'containers-triggers-create', 'containers-triggers-delete', 'containers-triggers-get', 'containers-triggers-list', 'containers-triggers-update', 'containers-update', 'containers-variables-create', 'containers-variables-delete', 'containers-variables-get', 'containers-variables-list', 'containers-variables-update', 'containers-versions-create', 'containers-versions-delete', 'containers-versions-get', 'containers-versions-list', 'containers-versions-publish', 'containers-versions-restore', 'containers-versions-undelete', 'containers-versions-update', 'get', 'list', 'permissions-create', 'permissions-delete', 'permissions-get', 'permissions-list', 'permissions-update' and 'update'", vec![ + ("accounts", "methods: 'containers-create', 'containers-delete', 'containers-environments-create', 'containers-environments-delete', 'containers-environments-get', 'containers-environments-list', 'containers-environments-update', 'containers-folders-create', 'containers-folders-delete', 'containers-folders-entities-list', 'containers-folders-get', 'containers-folders-list', 'containers-folders-update', 'containers-get', 'containers-list', 'containers-move-folders-update', 'containers-reauthorize-environments-update', 'containers-tags-create', 'containers-tags-delete', 'containers-tags-get', 'containers-tags-list', 'containers-tags-update', 'containers-triggers-create', 'containers-triggers-delete', 'containers-triggers-get', 'containers-triggers-list', 'containers-triggers-update', 'containers-update', 'containers-variables-create', 'containers-variables-delete', 'containers-variables-get', 'containers-variables-list', 'containers-variables-update', 'containers-versions-create', 'containers-versions-delete', 'containers-versions-get', 'containers-versions-list', 'containers-versions-publish', 'containers-versions-restore', 'containers-versions-undelete', 'containers-versions-update', 'get', 'list', 'permissions-create', 'permissions-delete', 'permissions-get', 'permissions-list', 'permissions-update' and 'update'", vec![ ("containers-create", Some(r##"Creates a Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-create", @@ -3983,46 +3880,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("containers-environments-patch", - Some(r##"Updates a GTM Environment. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-environments-patch", - vec![ - (Some(r##"account-id"##), - None, - Some(r##"The GTM Account ID."##), - Some(true), - Some(false)), - - (Some(r##"container-id"##), - None, - Some(r##"The GTM Container ID."##), - Some(true), - Some(false)), - - (Some(r##"environment-id"##), - None, - Some(r##"The GTM Environment ID."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -5389,7 +5246,7 @@ fn main() { let mut app = App::new("tagmanager1") .author("Sebastian Thiel ") - .version("1.0.8+20171108") + .version("1.0.8+20190220") .about("Accesses Tag Manager accounts and containers.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_tagmanager1_cli") .arg(Arg::with_name("url") diff --git a/gen/tagmanager1/Cargo.toml b/gen/tagmanager1/Cargo.toml index 7ce5c1521a..af350a2619 100644 --- a/gen/tagmanager1/Cargo.toml +++ b/gen/tagmanager1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-tagmanager1" -version = "1.0.8+20171108" +version = "1.0.8+20190220" authors = ["Sebastian Thiel "] description = "A complete library to interact with Tag Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tagmanager1" homepage = "https://developers.google.com/tag-manager/api/v1/" -documentation = "https://docs.rs/google-tagmanager1/1.0.8+20171108" +documentation = "https://docs.rs/google-tagmanager1/1.0.8+20190220" license = "MIT" keywords = ["tagmanager", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/tagmanager1/README.md b/gen/tagmanager1/README.md index cc2df0f2ab..6b4c857bd5 100644 --- a/gen/tagmanager1/README.md +++ b/gen/tagmanager1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-tagmanager1` library allows access to all features of the *Google Tag Manager* service. -This documentation was generated from *Tag Manager* crate version *1.0.8+20171108*, where *20171108* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Tag Manager* crate version *1.0.8+20190220*, where *20190220* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Tag Manager* *v1* API can be found at the [official documentation site](https://developers.google.com/tag-manager/api/v1/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.TagManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.TagManager.html) ... -* [accounts](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.Account.html) - * [*containers create*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerCreateCall.html), [*containers delete*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerDeleteCall.html), [*containers environments create*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerEnvironmentCreateCall.html), [*containers environments delete*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerEnvironmentDeleteCall.html), [*containers environments get*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerEnvironmentGetCall.html), [*containers environments list*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerEnvironmentListCall.html), [*containers environments patch*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerEnvironmentPatchCall.html), [*containers environments update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerEnvironmentUpdateCall.html), [*containers folders create*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerFolderCreateCall.html), [*containers folders delete*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerFolderDeleteCall.html), [*containers folders entities list*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerFolderEntityListCall.html), [*containers folders get*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerFolderGetCall.html), [*containers folders list*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerFolderListCall.html), [*containers folders update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerFolderUpdateCall.html), [*containers get*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerGetCall.html), [*containers list*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerListCall.html), [*containers move_folders update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerMoveFolderUpdateCall.html), [*containers reauthorize_environments update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerReauthorizeEnvironmentUpdateCall.html), [*containers tags create*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerTagCreateCall.html), [*containers tags delete*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerTagDeleteCall.html), [*containers tags get*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerTagGetCall.html), [*containers tags list*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerTagListCall.html), [*containers tags update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerTagUpdateCall.html), [*containers triggers create*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerTriggerCreateCall.html), [*containers triggers delete*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerTriggerDeleteCall.html), [*containers triggers get*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerTriggerGetCall.html), [*containers triggers list*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerTriggerListCall.html), [*containers triggers update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerTriggerUpdateCall.html), [*containers update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerUpdateCall.html), [*containers variables create*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVariableCreateCall.html), [*containers variables delete*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVariableDeleteCall.html), [*containers variables get*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVariableGetCall.html), [*containers variables list*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVariableListCall.html), [*containers variables update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVariableUpdateCall.html), [*containers versions create*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVersionCreateCall.html), [*containers versions delete*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVersionDeleteCall.html), [*containers versions get*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVersionGetCall.html), [*containers versions list*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVersionListCall.html), [*containers versions publish*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVersionPublishCall.html), [*containers versions restore*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVersionRestoreCall.html), [*containers versions undelete*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVersionUndeleteCall.html), [*containers versions update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountContainerVersionUpdateCall.html), [*get*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountGetCall.html), [*list*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountListCall.html), [*permissions create*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountPermissionCreateCall.html), [*permissions delete*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountPermissionDeleteCall.html), [*permissions get*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountPermissionGetCall.html), [*permissions list*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountPermissionListCall.html), [*permissions update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountPermissionUpdateCall.html) and [*update*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.AccountUpdateCall.html) +* [accounts](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.Account.html) + * [*containers create*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerCreateCall.html), [*containers delete*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerDeleteCall.html), [*containers environments create*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerEnvironmentCreateCall.html), [*containers environments delete*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerEnvironmentDeleteCall.html), [*containers environments get*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerEnvironmentGetCall.html), [*containers environments list*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerEnvironmentListCall.html), [*containers environments update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerEnvironmentUpdateCall.html), [*containers folders create*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerFolderCreateCall.html), [*containers folders delete*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerFolderDeleteCall.html), [*containers folders entities list*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerFolderEntityListCall.html), [*containers folders get*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerFolderGetCall.html), [*containers folders list*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerFolderListCall.html), [*containers folders update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerFolderUpdateCall.html), [*containers get*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerGetCall.html), [*containers list*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerListCall.html), [*containers move_folders update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerMoveFolderUpdateCall.html), [*containers reauthorize_environments update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerReauthorizeEnvironmentUpdateCall.html), [*containers tags create*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerTagCreateCall.html), [*containers tags delete*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerTagDeleteCall.html), [*containers tags get*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerTagGetCall.html), [*containers tags list*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerTagListCall.html), [*containers tags update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerTagUpdateCall.html), [*containers triggers create*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerTriggerCreateCall.html), [*containers triggers delete*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerTriggerDeleteCall.html), [*containers triggers get*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerTriggerGetCall.html), [*containers triggers list*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerTriggerListCall.html), [*containers triggers update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerTriggerUpdateCall.html), [*containers update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerUpdateCall.html), [*containers variables create*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVariableCreateCall.html), [*containers variables delete*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVariableDeleteCall.html), [*containers variables get*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVariableGetCall.html), [*containers variables list*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVariableListCall.html), [*containers variables update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVariableUpdateCall.html), [*containers versions create*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVersionCreateCall.html), [*containers versions delete*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVersionDeleteCall.html), [*containers versions get*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVersionGetCall.html), [*containers versions list*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVersionListCall.html), [*containers versions publish*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVersionPublishCall.html), [*containers versions restore*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVersionRestoreCall.html), [*containers versions undelete*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVersionUndeleteCall.html), [*containers versions update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountContainerVersionUpdateCall.html), [*get*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountGetCall.html), [*list*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountListCall.html), [*permissions create*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountPermissionCreateCall.html), [*permissions delete*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountPermissionDeleteCall.html), [*permissions get*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountPermissionGetCall.html), [*permissions list*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountPermissionListCall.html), [*permissions update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountPermissionUpdateCall.html) and [*update*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.AccountUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/struct.TagManager.html)** +* **[Hub](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/struct.TagManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.Part.html)** + * **[Parts](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -54,7 +54,6 @@ let r = hub.accounts().permissions_create(...).doit() let r = hub.accounts().containers_environments_delete(...).doit() let r = hub.accounts().permissions_delete(...).doit() let r = hub.accounts().containers_get(...).doit() -let r = hub.accounts().containers_environments_patch(...).doit() let r = hub.accounts().containers_versions_list(...).doit() let r = hub.accounts().containers_triggers_update(...).doit() let r = hub.accounts().containers_triggers_get(...).doit() @@ -182,17 +181,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -202,29 +201,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-tagmanager1/1.0.8+20171108/google_tagmanager1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-tagmanager1/1.0.8+20190220/google_tagmanager1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/tagmanager1/src/lib.rs b/gen/tagmanager1/src/lib.rs index 49e5ae5639..0caf0e714a 100644 --- a/gen/tagmanager1/src/lib.rs +++ b/gen/tagmanager1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Tag Manager* crate version *1.0.8+20171108*, where *20171108* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Tag Manager* crate version *1.0.8+20190220*, where *20190220* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Tag Manager* *v1* API can be found at the //! [official documentation site](https://developers.google.com/tag-manager/api/v1/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.TagManager.html) ... //! //! * [accounts](struct.Account.html) -//! * [*containers create*](struct.AccountContainerCreateCall.html), [*containers delete*](struct.AccountContainerDeleteCall.html), [*containers environments create*](struct.AccountContainerEnvironmentCreateCall.html), [*containers environments delete*](struct.AccountContainerEnvironmentDeleteCall.html), [*containers environments get*](struct.AccountContainerEnvironmentGetCall.html), [*containers environments list*](struct.AccountContainerEnvironmentListCall.html), [*containers environments patch*](struct.AccountContainerEnvironmentPatchCall.html), [*containers environments update*](struct.AccountContainerEnvironmentUpdateCall.html), [*containers folders create*](struct.AccountContainerFolderCreateCall.html), [*containers folders delete*](struct.AccountContainerFolderDeleteCall.html), [*containers folders entities list*](struct.AccountContainerFolderEntityListCall.html), [*containers folders get*](struct.AccountContainerFolderGetCall.html), [*containers folders list*](struct.AccountContainerFolderListCall.html), [*containers folders update*](struct.AccountContainerFolderUpdateCall.html), [*containers get*](struct.AccountContainerGetCall.html), [*containers list*](struct.AccountContainerListCall.html), [*containers move_folders update*](struct.AccountContainerMoveFolderUpdateCall.html), [*containers reauthorize_environments update*](struct.AccountContainerReauthorizeEnvironmentUpdateCall.html), [*containers tags create*](struct.AccountContainerTagCreateCall.html), [*containers tags delete*](struct.AccountContainerTagDeleteCall.html), [*containers tags get*](struct.AccountContainerTagGetCall.html), [*containers tags list*](struct.AccountContainerTagListCall.html), [*containers tags update*](struct.AccountContainerTagUpdateCall.html), [*containers triggers create*](struct.AccountContainerTriggerCreateCall.html), [*containers triggers delete*](struct.AccountContainerTriggerDeleteCall.html), [*containers triggers get*](struct.AccountContainerTriggerGetCall.html), [*containers triggers list*](struct.AccountContainerTriggerListCall.html), [*containers triggers update*](struct.AccountContainerTriggerUpdateCall.html), [*containers update*](struct.AccountContainerUpdateCall.html), [*containers variables create*](struct.AccountContainerVariableCreateCall.html), [*containers variables delete*](struct.AccountContainerVariableDeleteCall.html), [*containers variables get*](struct.AccountContainerVariableGetCall.html), [*containers variables list*](struct.AccountContainerVariableListCall.html), [*containers variables update*](struct.AccountContainerVariableUpdateCall.html), [*containers versions create*](struct.AccountContainerVersionCreateCall.html), [*containers versions delete*](struct.AccountContainerVersionDeleteCall.html), [*containers versions get*](struct.AccountContainerVersionGetCall.html), [*containers versions list*](struct.AccountContainerVersionListCall.html), [*containers versions publish*](struct.AccountContainerVersionPublishCall.html), [*containers versions restore*](struct.AccountContainerVersionRestoreCall.html), [*containers versions undelete*](struct.AccountContainerVersionUndeleteCall.html), [*containers versions update*](struct.AccountContainerVersionUpdateCall.html), [*get*](struct.AccountGetCall.html), [*list*](struct.AccountListCall.html), [*permissions create*](struct.AccountPermissionCreateCall.html), [*permissions delete*](struct.AccountPermissionDeleteCall.html), [*permissions get*](struct.AccountPermissionGetCall.html), [*permissions list*](struct.AccountPermissionListCall.html), [*permissions update*](struct.AccountPermissionUpdateCall.html) and [*update*](struct.AccountUpdateCall.html) +//! * [*containers create*](struct.AccountContainerCreateCall.html), [*containers delete*](struct.AccountContainerDeleteCall.html), [*containers environments create*](struct.AccountContainerEnvironmentCreateCall.html), [*containers environments delete*](struct.AccountContainerEnvironmentDeleteCall.html), [*containers environments get*](struct.AccountContainerEnvironmentGetCall.html), [*containers environments list*](struct.AccountContainerEnvironmentListCall.html), [*containers environments update*](struct.AccountContainerEnvironmentUpdateCall.html), [*containers folders create*](struct.AccountContainerFolderCreateCall.html), [*containers folders delete*](struct.AccountContainerFolderDeleteCall.html), [*containers folders entities list*](struct.AccountContainerFolderEntityListCall.html), [*containers folders get*](struct.AccountContainerFolderGetCall.html), [*containers folders list*](struct.AccountContainerFolderListCall.html), [*containers folders update*](struct.AccountContainerFolderUpdateCall.html), [*containers get*](struct.AccountContainerGetCall.html), [*containers list*](struct.AccountContainerListCall.html), [*containers move_folders update*](struct.AccountContainerMoveFolderUpdateCall.html), [*containers reauthorize_environments update*](struct.AccountContainerReauthorizeEnvironmentUpdateCall.html), [*containers tags create*](struct.AccountContainerTagCreateCall.html), [*containers tags delete*](struct.AccountContainerTagDeleteCall.html), [*containers tags get*](struct.AccountContainerTagGetCall.html), [*containers tags list*](struct.AccountContainerTagListCall.html), [*containers tags update*](struct.AccountContainerTagUpdateCall.html), [*containers triggers create*](struct.AccountContainerTriggerCreateCall.html), [*containers triggers delete*](struct.AccountContainerTriggerDeleteCall.html), [*containers triggers get*](struct.AccountContainerTriggerGetCall.html), [*containers triggers list*](struct.AccountContainerTriggerListCall.html), [*containers triggers update*](struct.AccountContainerTriggerUpdateCall.html), [*containers update*](struct.AccountContainerUpdateCall.html), [*containers variables create*](struct.AccountContainerVariableCreateCall.html), [*containers variables delete*](struct.AccountContainerVariableDeleteCall.html), [*containers variables get*](struct.AccountContainerVariableGetCall.html), [*containers variables list*](struct.AccountContainerVariableListCall.html), [*containers variables update*](struct.AccountContainerVariableUpdateCall.html), [*containers versions create*](struct.AccountContainerVersionCreateCall.html), [*containers versions delete*](struct.AccountContainerVersionDeleteCall.html), [*containers versions get*](struct.AccountContainerVersionGetCall.html), [*containers versions list*](struct.AccountContainerVersionListCall.html), [*containers versions publish*](struct.AccountContainerVersionPublishCall.html), [*containers versions restore*](struct.AccountContainerVersionRestoreCall.html), [*containers versions undelete*](struct.AccountContainerVersionUndeleteCall.html), [*containers versions update*](struct.AccountContainerVersionUpdateCall.html), [*get*](struct.AccountGetCall.html), [*list*](struct.AccountListCall.html), [*permissions create*](struct.AccountPermissionCreateCall.html), [*permissions delete*](struct.AccountPermissionDeleteCall.html), [*permissions get*](struct.AccountPermissionGetCall.html), [*permissions list*](struct.AccountPermissionListCall.html), [*permissions update*](struct.AccountPermissionUpdateCall.html) and [*update*](struct.AccountUpdateCall.html) //! //! //! @@ -54,7 +54,6 @@ //! let r = hub.accounts().containers_environments_delete(...).doit() //! let r = hub.accounts().permissions_delete(...).doit() //! let r = hub.accounts().containers_get(...).doit() -//! let r = hub.accounts().containers_environments_patch(...).doit() //! let r = hub.accounts().containers_versions_list(...).doit() //! let r = hub.accounts().containers_triggers_update(...).doit() //! let r = hub.accounts().containers_triggers_get(...).doit() @@ -705,7 +704,6 @@ impl ResponseResult for ListVariablesResponse {} /// * [containers environments delete accounts](struct.AccountContainerEnvironmentDeleteCall.html) (none) /// * [permissions delete accounts](struct.AccountPermissionDeleteCall.html) (none) /// * [containers get accounts](struct.AccountContainerGetCall.html) (none) -/// * [containers environments patch accounts](struct.AccountContainerEnvironmentPatchCall.html) (none) /// * [containers versions list accounts](struct.AccountContainerVersionListCall.html) (none) /// * [containers triggers update accounts](struct.AccountContainerTriggerUpdateCall.html) (none) /// * [containers triggers get accounts](struct.AccountContainerTriggerGetCall.html) (none) @@ -823,7 +821,6 @@ impl ResponseResult for ListAccountsResponse {} /// /// * [containers environments create accounts](struct.AccountContainerEnvironmentCreateCall.html) (request|response) /// * [containers environments update accounts](struct.AccountContainerEnvironmentUpdateCall.html) (request|response) -/// * [containers environments patch accounts](struct.AccountContainerEnvironmentPatchCall.html) (request|response) /// * [containers environments get accounts](struct.AccountContainerEnvironmentGetCall.html) (response) /// * [containers reauthorize_environments update accounts](struct.AccountContainerReauthorizeEnvironmentUpdateCall.html) (request|response) /// @@ -1481,7 +1478,7 @@ impl Part for Condition {} /// ::default(), None); /// let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `containers_create(...)`, `containers_delete(...)`, `containers_environments_create(...)`, `containers_environments_delete(...)`, `containers_environments_get(...)`, `containers_environments_list(...)`, `containers_environments_patch(...)`, `containers_environments_update(...)`, `containers_folders_create(...)`, `containers_folders_delete(...)`, `containers_folders_entities_list(...)`, `containers_folders_get(...)`, `containers_folders_list(...)`, `containers_folders_update(...)`, `containers_get(...)`, `containers_list(...)`, `containers_move_folders_update(...)`, `containers_reauthorize_environments_update(...)`, `containers_tags_create(...)`, `containers_tags_delete(...)`, `containers_tags_get(...)`, `containers_tags_list(...)`, `containers_tags_update(...)`, `containers_triggers_create(...)`, `containers_triggers_delete(...)`, `containers_triggers_get(...)`, `containers_triggers_list(...)`, `containers_triggers_update(...)`, `containers_update(...)`, `containers_variables_create(...)`, `containers_variables_delete(...)`, `containers_variables_get(...)`, `containers_variables_list(...)`, `containers_variables_update(...)`, `containers_versions_create(...)`, `containers_versions_delete(...)`, `containers_versions_get(...)`, `containers_versions_list(...)`, `containers_versions_publish(...)`, `containers_versions_restore(...)`, `containers_versions_undelete(...)`, `containers_versions_update(...)`, `get(...)`, `list(...)`, `permissions_create(...)`, `permissions_delete(...)`, `permissions_get(...)`, `permissions_list(...)`, `permissions_update(...)` and `update(...)` +/// // like `containers_create(...)`, `containers_delete(...)`, `containers_environments_create(...)`, `containers_environments_delete(...)`, `containers_environments_get(...)`, `containers_environments_list(...)`, `containers_environments_update(...)`, `containers_folders_create(...)`, `containers_folders_delete(...)`, `containers_folders_entities_list(...)`, `containers_folders_get(...)`, `containers_folders_list(...)`, `containers_folders_update(...)`, `containers_get(...)`, `containers_list(...)`, `containers_move_folders_update(...)`, `containers_reauthorize_environments_update(...)`, `containers_tags_create(...)`, `containers_tags_delete(...)`, `containers_tags_get(...)`, `containers_tags_list(...)`, `containers_tags_update(...)`, `containers_triggers_create(...)`, `containers_triggers_delete(...)`, `containers_triggers_get(...)`, `containers_triggers_list(...)`, `containers_triggers_update(...)`, `containers_update(...)`, `containers_variables_create(...)`, `containers_variables_delete(...)`, `containers_variables_get(...)`, `containers_variables_list(...)`, `containers_variables_update(...)`, `containers_versions_create(...)`, `containers_versions_delete(...)`, `containers_versions_get(...)`, `containers_versions_list(...)`, `containers_versions_publish(...)`, `containers_versions_restore(...)`, `containers_versions_undelete(...)`, `containers_versions_update(...)`, `get(...)`, `list(...)`, `permissions_create(...)`, `permissions_delete(...)`, `permissions_get(...)`, `permissions_list(...)`, `permissions_update(...)` and `update(...)` /// // to build up your call. /// let rb = hub.accounts(); /// # } @@ -1629,30 +1626,6 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Updates a GTM Environment. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `accountId` - The GTM Account ID. - /// * `containerId` - The GTM Container ID. - /// * `environmentId` - The GTM Environment ID. - pub fn containers_environments_patch(&self, request: Environment, account_id: &str, container_id: &str, environment_id: &str) -> AccountContainerEnvironmentPatchCall<'a, C, A> { - AccountContainerEnvironmentPatchCall { - hub: self.hub, - _request: request, - _account_id: account_id.to_string(), - _container_id: container_id.to_string(), - _environment_id: environment_id.to_string(), - _fingerprint: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Lists all Container Versions of a GTM Container. @@ -2639,10 +2612,7 @@ impl<'a, C, A> AccountContainerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2662,7 +2632,7 @@ impl<'a, C, A> AccountContainerListCall<'a, C, A> where C: BorrowMut AccountContainerListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2905,7 +2872,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountContainerEnvironmentCreateCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3169,7 +3133,7 @@ impl<'a, C, A> AccountContainerEnvironmentCreateCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3269,7 +3233,7 @@ impl<'a, C, A> AccountContainerEnvironmentCreateCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3418,10 +3382,7 @@ impl<'a, C, A> AccountPermissionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3453,7 +3414,7 @@ impl<'a, C, A> AccountPermissionCreateCall<'a, C, A> where C: BorrowMut AccountPermissionCreateCall<'a, C, A> where C: BorrowMut AccountContainerEnvironmentDeleteCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3711,7 +3669,7 @@ impl<'a, C, A> AccountContainerEnvironmentDeleteCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3799,7 +3757,7 @@ impl<'a, C, A> AccountContainerEnvironmentDeleteCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3942,10 +3900,7 @@ impl<'a, C, A> AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3965,7 +3920,7 @@ impl<'a, C, A> AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut AccountContainerGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4210,7 +4162,7 @@ impl<'a, C, A> AccountContainerGetCall<'a, C, A> where C: BorrowMut AccountContainerGetCall<'a, C, A> where C: BorrowMut AccountContainerGetCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Environment::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_environments_patch(req, "accountId", "containerId", "environmentId") -/// .fingerprint("eos") -/// .doit(); -/// # } -/// ``` -pub struct AccountContainerEnvironmentPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a TagManager, - _request: Environment, - _account_id: String, - _container_id: String, - _environment_id: String, - _fingerprint: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AccountContainerEnvironmentPatchCall<'a, C, A> {} - -impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Environment)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.environments.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); - params.push(("accountId", self._account_id.to_string())); - params.push(("containerId", self._container_id.to_string())); - params.push(("environmentId", self._environment_id.to_string())); - if let Some(value) = self._fingerprint { - params.push(("fingerprint", value.to_string())); - } - for &field in ["alt", "accountId", "containerId", "environmentId", "fingerprint"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "accounts/{accountId}/containers/{containerId}/environments/{environmentId}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::EditContainer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{accountId}", "accountId"), ("{containerId}", "containerId"), ("{environmentId}", "environmentId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["environmentId", "containerId", "accountId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Environment) -> AccountContainerEnvironmentPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The GTM Account ID. - /// - /// Sets the *account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> AccountContainerEnvironmentPatchCall<'a, C, A> { - self._account_id = new_value.to_string(); - self - } - /// The GTM Container ID. - /// - /// Sets the *container id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn container_id(mut self, new_value: &str) -> AccountContainerEnvironmentPatchCall<'a, C, A> { - self._container_id = new_value.to_string(); - self - } - /// The GTM Environment ID. - /// - /// Sets the *environment id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn environment_id(mut self, new_value: &str) -> AccountContainerEnvironmentPatchCall<'a, C, A> { - self._environment_id = new_value.to_string(); - self - } - /// When provided, this fingerprint must match the fingerprint of the environment in storage. - /// - /// Sets the *fingerprint* query property to the given value. - pub fn fingerprint(mut self, new_value: &str) -> AccountContainerEnvironmentPatchCall<'a, C, A> { - self._fingerprint = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerEnvironmentPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountContainerEnvironmentPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::EditContainer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountContainerEnvironmentPatchCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Lists all Container Versions of a GTM Container. /// /// A builder for the *containers.versions.list* method supported by a *account* resource. @@ -4680,8 +4322,8 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_versions_list("accountId", "containerId") -/// .include_deleted(true) -/// .headers(true) +/// .include_deleted(false) +/// .headers(false) /// .doit(); /// # } /// ``` @@ -4762,10 +4404,7 @@ impl<'a, C, A> AccountContainerVersionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4785,7 +4424,7 @@ impl<'a, C, A> AccountContainerVersionListCall<'a, C, A> where C: BorrowMut AccountContainerVersionListCall<'a, C, A> where C: BorrowMut AccountContainerVersionListCall<'a, C, A> where C: BorrowMut AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5080,7 +4716,7 @@ impl<'a, C, A> AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5366,7 +4999,7 @@ impl<'a, C, A> AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5630,7 +5260,7 @@ impl<'a, C, A> AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5876,7 +5503,7 @@ impl<'a, C, A> AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut AccountContainerCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6148,7 +5772,7 @@ impl<'a, C, A> AccountContainerCreateCall<'a, C, A> where C: BorrowMut AccountContainerCreateCall<'a, C, A> where C: BorrowMut AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6406,7 +6027,7 @@ impl<'a, C, A> AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6663,7 +6281,7 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6761,7 +6379,7 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6907,10 +6525,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6930,7 +6545,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7028,7 +6643,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7172,10 +6787,7 @@ impl<'a, C, A> AccountContainerEnvironmentListCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7195,7 +6807,7 @@ impl<'a, C, A> AccountContainerEnvironmentListCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7283,7 +6895,7 @@ impl<'a, C, A> AccountContainerEnvironmentListCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7427,10 +7039,7 @@ impl<'a, C, A> AccountContainerTagListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7450,7 +7059,7 @@ impl<'a, C, A> AccountContainerTagListCall<'a, C, A> where C: BorrowMut AccountContainerTagListCall<'a, C, A> where C: BorrowMut AccountContainerTagListCall<'a, C, A> where C: BorrowMut AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7712,7 +7318,7 @@ impl<'a, C, A> AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7986,7 +7589,7 @@ impl<'a, C, A> AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8253,7 +7853,7 @@ impl<'a, C, A> AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8537,7 +8134,7 @@ impl<'a, C, A> AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8804,7 +8398,7 @@ impl<'a, C, A> AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9060,7 +8651,7 @@ impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9337,7 +8925,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9434,7 +9022,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9585,10 +9173,7 @@ impl<'a, C, A> AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9620,7 +9205,7 @@ impl<'a, C, A> AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9887,7 +9469,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10183,7 +9762,7 @@ impl<'a, C, A> AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10307,7 +9886,7 @@ impl<'a, C, A> AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10453,10 +10032,7 @@ impl<'a, C, A> AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10476,7 +10052,7 @@ impl<'a, C, A> AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10760,7 +10333,7 @@ impl<'a, C, A> AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut AccountContainerVariableListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11027,7 +10597,7 @@ impl<'a, C, A> AccountContainerVariableListCall<'a, C, A> where C: BorrowMut AccountContainerVariableListCall<'a, C, A> where C: BorrowMut AccountContainerTagGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11284,7 +10851,7 @@ impl<'a, C, A> AccountContainerTagGetCall<'a, C, A> where C: BorrowMut AccountContainerTagGetCall<'a, C, A> where C: BorrowMut AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11551,7 +11115,7 @@ impl<'a, C, A> AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11817,7 +11378,7 @@ impl<'a, C, A> AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12091,7 +11649,7 @@ impl<'a, C, A> AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12384,7 +11939,7 @@ impl<'a, C, A> AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut AccountListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12643,7 +12195,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12711,7 +12263,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12862,10 +12414,7 @@ impl<'a, C, A> AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12897,7 +12446,7 @@ impl<'a, C, A> AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13165,7 +12711,7 @@ impl<'a, C, A> AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut AccountContainerReauthorizeEnvironmentUpdateCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13441,7 +12984,7 @@ impl<'a, C, A> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C, A> where request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13551,7 +13094,7 @@ impl<'a, C, A> AccountContainerReauthorizeEnvironmentUpdateCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13693,10 +13236,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13716,7 +13256,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13794,7 +13334,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13872,7 +13412,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_update(req, "accountId", "containerId") -/// .fingerprint("diam") +/// .fingerprint("est") /// .doit(); /// # } /// ``` @@ -13950,10 +13490,7 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13985,7 +13522,7 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14285,7 +13819,7 @@ impl<'a, C, A> AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut AccountContainerEnvironmentUpdateCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14595,7 +14126,7 @@ impl<'a, C, A> AccountContainerEnvironmentUpdateCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14712,7 +14243,7 @@ impl<'a, C, A> AccountContainerEnvironmentUpdateCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14863,10 +14394,7 @@ impl<'a, C, A> AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14898,7 +14426,7 @@ impl<'a, C, A> AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut AccountContainerFolderListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15165,7 +14690,7 @@ impl<'a, C, A> AccountContainerFolderListCall<'a, C, A> where C: BorrowMut AccountContainerFolderListCall<'a, C, A> where C: BorrowMut AccountContainerFolderListCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15446,7 +14968,7 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15756,7 +15275,7 @@ impl<'a, C, A> AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16042,7 +15558,7 @@ impl<'a, C, A> AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Tag Manager (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tagmanager2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-tagmanager2] path = "../tagmanager2" -version = "1.0.8+20171108" +version = "1.0.8+20190220" diff --git a/gen/tagmanager2-cli/README.md b/gen/tagmanager2-cli/README.md index a7bf1f25a8..2f593cbe83 100644 --- a/gen/tagmanager2-cli/README.md +++ b/gen/tagmanager2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Tag Manager* API at revision *20171108*. The CLI is at version *1.0.8*. +This documentation was generated from the *Tag Manager* API at revision *20190220*. The CLI is at version *1.0.8*. ```bash tagmanager2 [options] @@ -36,7 +36,6 @@ tagmanager2 [options] containers-environments-delete [-p ]... containers-environments-get [-p ]... [-o ] containers-environments-list [-p ]... [-o ] - containers-environments-patch (-r )... [-p ]... [-o ] containers-environments-reauthorize (-r )... [-p ]... [-o ] containers-environments-update (-r )... [-p ]... [-o ] containers-get [-p ]... [-o ] @@ -67,11 +66,8 @@ tagmanager2 [options] containers-workspaces-folders-revert [-p ]... [-o ] containers-workspaces-folders-update (-r )... [-p ]... [-o ] containers-workspaces-get [-p ]... [-o ] - containers-workspaces-get-proposal [-p ]... [-o ] containers-workspaces-get-status [-p ]... [-o ] containers-workspaces-list [-p ]... [-o ] - containers-workspaces-proposal-create (-r )... [-p ]... [-o ] - containers-workspaces-proposal-delete [-p ]... containers-workspaces-quick-preview [-p ]... [-o ] containers-workspaces-resolve-conflict (-r )... [-p ]... containers-workspaces-sync [-p ]... [-o ] @@ -88,13 +84,18 @@ tagmanager2 [options] containers-workspaces-triggers-revert [-p ]... [-o ] containers-workspaces-triggers-update (-r )... [-p ]... [-o ] containers-workspaces-update (-r )... [-p ]... [-o ] - containers-workspaces-update-proposal (-r )... [-p ]... [-o ] containers-workspaces-variables-create (-r )... [-p ]... [-o ] containers-workspaces-variables-delete [-p ]... containers-workspaces-variables-get [-p ]... [-o ] containers-workspaces-variables-list [-p ]... [-o ] containers-workspaces-variables-revert [-p ]... [-o ] containers-workspaces-variables-update (-r )... [-p ]... [-o ] + containers-workspaces-zones-create (-r )... [-p ]... [-o ] + containers-workspaces-zones-delete [-p ]... + containers-workspaces-zones-get [-p ]... [-o ] + containers-workspaces-zones-list [-p ]... [-o ] + containers-workspaces-zones-revert [-p ]... [-o ] + containers-workspaces-zones-update (-r )... [-p ]... [-o ] get [-p ]... [-o ] list [-p ]... [-o ] update (-r )... [-p ]... [-o ] diff --git a/gen/tagmanager2-cli/mkdocs.yml b/gen/tagmanager2-cli/mkdocs.yml index b85e6d633d..a9e484ab5e 100644 --- a/gen/tagmanager2-cli/mkdocs.yml +++ b/gen/tagmanager2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Tag Manager v1.0.8+20171108 +site_name: Tag Manager v1.0.8+20190220 site_url: http://byron.github.io/google-apis-rs/google-tagmanager2-cli site_description: A complete library to interact with Tag Manager (protocol v2) @@ -15,7 +15,6 @@ pages: - ['accounts_containers-environments-delete.md', 'Accounts', 'Containers Environments Delete'] - ['accounts_containers-environments-get.md', 'Accounts', 'Containers Environments Get'] - ['accounts_containers-environments-list.md', 'Accounts', 'Containers Environments List'] -- ['accounts_containers-environments-patch.md', 'Accounts', 'Containers Environments Patch'] - ['accounts_containers-environments-reauthorize.md', 'Accounts', 'Containers Environments Reauthorize'] - ['accounts_containers-environments-update.md', 'Accounts', 'Containers Environments Update'] - ['accounts_containers-get.md', 'Accounts', 'Containers Get'] @@ -46,11 +45,8 @@ pages: - ['accounts_containers-workspaces-folders-revert.md', 'Accounts', 'Containers Workspaces Folders Revert'] - ['accounts_containers-workspaces-folders-update.md', 'Accounts', 'Containers Workspaces Folders Update'] - ['accounts_containers-workspaces-get.md', 'Accounts', 'Containers Workspaces Get'] -- ['accounts_containers-workspaces-get-proposal.md', 'Accounts', 'Containers Workspaces Get Proposal'] - ['accounts_containers-workspaces-get-status.md', 'Accounts', 'Containers Workspaces Get Status'] - ['accounts_containers-workspaces-list.md', 'Accounts', 'Containers Workspaces List'] -- ['accounts_containers-workspaces-proposal-create.md', 'Accounts', 'Containers Workspaces Proposal Create'] -- ['accounts_containers-workspaces-proposal-delete.md', 'Accounts', 'Containers Workspaces Proposal Delete'] - ['accounts_containers-workspaces-quick-preview.md', 'Accounts', 'Containers Workspaces Quick Preview'] - ['accounts_containers-workspaces-resolve-conflict.md', 'Accounts', 'Containers Workspaces Resolve Conflict'] - ['accounts_containers-workspaces-sync.md', 'Accounts', 'Containers Workspaces Sync'] @@ -67,13 +63,18 @@ pages: - ['accounts_containers-workspaces-triggers-revert.md', 'Accounts', 'Containers Workspaces Triggers Revert'] - ['accounts_containers-workspaces-triggers-update.md', 'Accounts', 'Containers Workspaces Triggers Update'] - ['accounts_containers-workspaces-update.md', 'Accounts', 'Containers Workspaces Update'] -- ['accounts_containers-workspaces-update-proposal.md', 'Accounts', 'Containers Workspaces Update Proposal'] - ['accounts_containers-workspaces-variables-create.md', 'Accounts', 'Containers Workspaces Variables Create'] - ['accounts_containers-workspaces-variables-delete.md', 'Accounts', 'Containers Workspaces Variables Delete'] - ['accounts_containers-workspaces-variables-get.md', 'Accounts', 'Containers Workspaces Variables Get'] - ['accounts_containers-workspaces-variables-list.md', 'Accounts', 'Containers Workspaces Variables List'] - ['accounts_containers-workspaces-variables-revert.md', 'Accounts', 'Containers Workspaces Variables Revert'] - ['accounts_containers-workspaces-variables-update.md', 'Accounts', 'Containers Workspaces Variables Update'] +- ['accounts_containers-workspaces-zones-create.md', 'Accounts', 'Containers Workspaces Zones Create'] +- ['accounts_containers-workspaces-zones-delete.md', 'Accounts', 'Containers Workspaces Zones Delete'] +- ['accounts_containers-workspaces-zones-get.md', 'Accounts', 'Containers Workspaces Zones Get'] +- ['accounts_containers-workspaces-zones-list.md', 'Accounts', 'Containers Workspaces Zones List'] +- ['accounts_containers-workspaces-zones-revert.md', 'Accounts', 'Containers Workspaces Zones Revert'] +- ['accounts_containers-workspaces-zones-update.md', 'Accounts', 'Containers Workspaces Zones Update'] - ['accounts_get.md', 'Accounts', 'Get'] - ['accounts_list.md', 'Accounts', 'List'] - ['accounts_update.md', 'Accounts', 'Update'] diff --git a/gen/tagmanager2-cli/src/main.rs b/gen/tagmanager2-cli/src/main.rs index dbd3c8439f..3763f4ce39 100644 --- a/gen/tagmanager2-cli/src/main.rs +++ b/gen/tagmanager2-cli/src/main.rs @@ -436,110 +436,6 @@ impl<'n> Engine<'n> { } } - fn _accounts_containers_environments_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "authorization-code" => Some(("authorizationCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "environment-id" => Some(("environmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "authorization-timestamp.nanos" => Some(("authorizationTimestamp.nanos", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "authorization-timestamp.seconds" => Some(("authorizationTimestamp.seconds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "enable-debug" => Some(("enableDebug", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "workspace-id" => Some(("workspaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "tag-manager-url" => Some(("tagManagerUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "container-version-id" => Some(("containerVersionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "path" => Some(("path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "container-id" => Some(("containerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "authorization-code", "authorization-timestamp", "container-id", "container-version-id", "description", "enable-debug", "environment-id", "fingerprint", "name", "nanos", "path", "seconds", "tag-manager-url", "type", "url", "workspace-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Environment = json::value::from_value(object).unwrap(); - let mut call = self.hub.accounts().containers_environments_patch(request, opt.value_of("path").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "fingerprint" => { - call = call.fingerprint(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["fingerprint"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _accounts_containers_environments_reauthorize(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -2519,55 +2415,6 @@ impl<'n> Engine<'n> { } } - fn _accounts_containers_workspaces_get_proposal(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.accounts().containers_workspaces_get_proposal(opt.value_of("path").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _accounts_containers_workspaces_get_status(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_workspaces_get_status(opt.value_of("path").unwrap_or("")); @@ -2676,129 +2523,6 @@ impl<'n> Engine<'n> { } } - fn _accounts_containers_workspaces_proposal_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "initial-comment.content" => Some(("initialComment.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "initial-comment"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::CreateWorkspaceProposalRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.accounts().containers_workspaces_proposal_create(request, opt.value_of("parent").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _accounts_containers_workspaces_proposal_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.accounts().containers_workspaces_proposal_delete(opt.value_of("path").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - fn _accounts_containers_workspaces_quick_preview(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_workspaces_quick_preview(opt.value_of("path").unwrap_or("")); @@ -2876,19 +2600,32 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "variable.schedule-start-ms" => Some(("variable.scheduleStartMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.schedule-end-ms" => Some(("variable.scheduleEndMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.container-id" => Some(("variable.containerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.variable-id" => Some(("variable.variableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.notes" => Some(("variable.notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-undefined-to-value.type" => Some(("variable.formatValue.convertUndefinedToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-undefined-to-value.value" => Some(("variable.formatValue.convertUndefinedToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-undefined-to-value.key" => Some(("variable.formatValue.convertUndefinedToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-false-to-value.type" => Some(("variable.formatValue.convertFalseToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-false-to-value.value" => Some(("variable.formatValue.convertFalseToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-false-to-value.key" => Some(("variable.formatValue.convertFalseToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-null-to-value.type" => Some(("variable.formatValue.convertNullToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-null-to-value.value" => Some(("variable.formatValue.convertNullToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-null-to-value.key" => Some(("variable.formatValue.convertNullToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.case-conversion-type" => Some(("variable.formatValue.caseConversionType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-true-to-value.type" => Some(("variable.formatValue.convertTrueToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-true-to-value.value" => Some(("variable.formatValue.convertTrueToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.format-value.convert-true-to-value.key" => Some(("variable.formatValue.convertTrueToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.name" => Some(("variable.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.enabling-trigger-id" => Some(("variable.enablingTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "variable.workspace-id" => Some(("variable.workspaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.tag-manager-url" => Some(("variable.tagManagerUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.fingerprint" => Some(("variable.fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.path" => Some(("variable.path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variable.account-id" => Some(("variable.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.type" => Some(("variable.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.parent-folder-id" => Some(("variable.parentFolderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable.disabling-trigger-id" => Some(("variable.disablingTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "variable.container-id" => Some(("variable.containerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "variable.account-id" => Some(("variable.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "change-status" => Some(("changeStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "trigger.max-timer-length-seconds.type" => Some(("trigger.maxTimerLengthSeconds.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "trigger.max-timer-length-seconds.value" => Some(("trigger.maxTimerLengthSeconds.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2985,7 +2722,7 @@ impl<'n> Engine<'n> { "folder.account-id" => Some(("folder.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "folder.name" => Some(("folder.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "blocking-rule-id", "blocking-trigger-id", "change-status", "check-validation", "container-id", "continuous-time-min-milliseconds", "disabling-trigger-id", "enabling-trigger-id", "event-name", "fingerprint", "firing-rule-id", "firing-trigger-id", "folder", "folder-id", "horizontal-scroll-percentage-list", "interval", "interval-seconds", "key", "limit", "live-only", "max-timer-length-seconds", "name", "notes", "parent-folder-id", "path", "paused", "priority", "schedule-end-ms", "schedule-start-ms", "selector", "tag", "tag-firing-option", "tag-id", "tag-manager-url", "total-time-min-milliseconds", "trigger", "trigger-id", "type", "unique-trigger-id", "value", "variable", "variable-id", "vertical-scroll-percentage-list", "visibility-selector", "visible-percentage-max", "visible-percentage-min", "wait-for-tags", "wait-for-tags-timeout", "workspace-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "blocking-rule-id", "blocking-trigger-id", "case-conversion-type", "change-status", "check-validation", "container-id", "continuous-time-min-milliseconds", "convert-false-to-value", "convert-null-to-value", "convert-true-to-value", "convert-undefined-to-value", "disabling-trigger-id", "enabling-trigger-id", "event-name", "fingerprint", "firing-rule-id", "firing-trigger-id", "folder", "folder-id", "format-value", "horizontal-scroll-percentage-list", "interval", "interval-seconds", "key", "limit", "live-only", "max-timer-length-seconds", "name", "notes", "parent-folder-id", "path", "paused", "priority", "schedule-end-ms", "schedule-start-ms", "selector", "tag", "tag-firing-option", "tag-id", "tag-manager-url", "total-time-min-milliseconds", "trigger", "trigger-id", "type", "unique-trigger-id", "value", "variable", "variable-id", "vertical-scroll-percentage-list", "visibility-selector", "visible-percentage-max", "visible-percentage-min", "wait-for-tags", "wait-for-tags-timeout", "workspace-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4119,90 +3856,6 @@ impl<'n> Engine<'n> { } } - fn _accounts_containers_workspaces_update_proposal(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "new-comment.content" => Some(("newComment.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["content", "fingerprint", "new-comment", "status"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::UpdateWorkspaceProposalRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.accounts().containers_workspaces_update_proposal(request, opt.value_of("path").unwrap_or("")); - for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema).expect("serde to work"); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - fn _accounts_containers_workspaces_variables_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -4228,21 +3881,34 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "schedule-start-ms" => Some(("scheduleStartMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "schedule-end-ms" => Some(("scheduleEndMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "container-id" => Some(("containerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable-id" => Some(("variableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-undefined-to-value.type" => Some(("formatValue.convertUndefinedToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-undefined-to-value.value" => Some(("formatValue.convertUndefinedToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-undefined-to-value.key" => Some(("formatValue.convertUndefinedToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-false-to-value.type" => Some(("formatValue.convertFalseToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-false-to-value.value" => Some(("formatValue.convertFalseToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-false-to-value.key" => Some(("formatValue.convertFalseToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-null-to-value.type" => Some(("formatValue.convertNullToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-null-to-value.value" => Some(("formatValue.convertNullToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-null-to-value.key" => Some(("formatValue.convertNullToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.case-conversion-type" => Some(("formatValue.caseConversionType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-true-to-value.type" => Some(("formatValue.convertTrueToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-true-to-value.value" => Some(("formatValue.convertTrueToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-true-to-value.key" => Some(("formatValue.convertTrueToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enabling-trigger-id" => Some(("enablingTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "workspace-id" => Some(("workspaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "tag-manager-url" => Some(("tagManagerUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "path" => Some(("path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "parent-folder-id" => Some(("parentFolderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "disabling-trigger-id" => Some(("disablingTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "container-id" => Some(("containerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "container-id", "disabling-trigger-id", "enabling-trigger-id", "fingerprint", "name", "notes", "parent-folder-id", "path", "schedule-end-ms", "schedule-start-ms", "tag-manager-url", "type", "variable-id", "workspace-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "case-conversion-type", "container-id", "convert-false-to-value", "convert-null-to-value", "convert-true-to-value", "convert-undefined-to-value", "disabling-trigger-id", "enabling-trigger-id", "fingerprint", "format-value", "key", "name", "notes", "parent-folder-id", "path", "schedule-end-ms", "schedule-start-ms", "tag-manager-url", "type", "value", "variable-id", "workspace-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4535,21 +4201,34 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "schedule-start-ms" => Some(("scheduleStartMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "schedule-end-ms" => Some(("scheduleEndMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "container-id" => Some(("containerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variable-id" => Some(("variableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-undefined-to-value.type" => Some(("formatValue.convertUndefinedToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-undefined-to-value.value" => Some(("formatValue.convertUndefinedToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-undefined-to-value.key" => Some(("formatValue.convertUndefinedToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-false-to-value.type" => Some(("formatValue.convertFalseToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-false-to-value.value" => Some(("formatValue.convertFalseToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-false-to-value.key" => Some(("formatValue.convertFalseToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-null-to-value.type" => Some(("formatValue.convertNullToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-null-to-value.value" => Some(("formatValue.convertNullToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-null-to-value.key" => Some(("formatValue.convertNullToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.case-conversion-type" => Some(("formatValue.caseConversionType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-true-to-value.type" => Some(("formatValue.convertTrueToValue.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-true-to-value.value" => Some(("formatValue.convertTrueToValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "format-value.convert-true-to-value.key" => Some(("formatValue.convertTrueToValue.key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enabling-trigger-id" => Some(("enablingTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "workspace-id" => Some(("workspaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "tag-manager-url" => Some(("tagManagerUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "path" => Some(("path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "parent-folder-id" => Some(("parentFolderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "disabling-trigger-id" => Some(("disablingTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "container-id" => Some(("containerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "container-id", "disabling-trigger-id", "enabling-trigger-id", "fingerprint", "name", "notes", "parent-folder-id", "path", "schedule-end-ms", "schedule-start-ms", "tag-manager-url", "type", "variable-id", "workspace-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "case-conversion-type", "container-id", "convert-false-to-value", "convert-null-to-value", "convert-true-to-value", "convert-undefined-to-value", "disabling-trigger-id", "enabling-trigger-id", "fingerprint", "format-value", "key", "name", "notes", "parent-folder-id", "path", "schedule-end-ms", "schedule-start-ms", "tag-manager-url", "type", "value", "variable-id", "workspace-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4613,6 +4292,410 @@ impl<'n> Engine<'n> { } } + fn _accounts_containers_workspaces_zones_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "container-id" => Some(("containerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone-id" => Some(("zoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "workspace-id" => Some(("workspaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-manager-url" => Some(("tagManagerUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path" => Some(("path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "boundary.custom-evaluation-trigger-id" => Some(("boundary.customEvaluationTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type-restriction.enable" => Some(("typeRestriction.enable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type-restriction.whitelisted-type-id" => Some(("typeRestriction.whitelistedTypeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "boundary", "container-id", "custom-evaluation-trigger-id", "enable", "fingerprint", "name", "notes", "path", "tag-manager-url", "type-restriction", "whitelisted-type-id", "workspace-id", "zone-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Zone = json::value::from_value(object).unwrap(); + let mut call = self.hub.accounts().containers_workspaces_zones_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_containers_workspaces_zones_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().containers_workspaces_zones_delete(opt.value_of("path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _accounts_containers_workspaces_zones_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().containers_workspaces_zones_get(opt.value_of("path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_containers_workspaces_zones_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().containers_workspaces_zones_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_containers_workspaces_zones_revert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().containers_workspaces_zones_revert(opt.value_of("path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "fingerprint" => { + call = call.fingerprint(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["fingerprint"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_containers_workspaces_zones_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "container-id" => Some(("containerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "zone-id" => Some(("zoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "workspace-id" => Some(("workspaceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-manager-url" => Some(("tagManagerUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path" => Some(("path", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "boundary.custom-evaluation-trigger-id" => Some(("boundary.customEvaluationTriggerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type-restriction.enable" => Some(("typeRestriction.enable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type-restriction.whitelisted-type-id" => Some(("typeRestriction.whitelistedTypeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "boundary", "container-id", "custom-evaluation-trigger-id", "enable", "fingerprint", "name", "notes", "path", "tag-manager-url", "type-restriction", "whitelisted-type-id", "workspace-id", "zone-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Zone = json::value::from_value(object).unwrap(); + let mut call = self.hub.accounts().containers_workspaces_zones_update(request, opt.value_of("path").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "fingerprint" => { + call = call.fingerprint(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["fingerprint"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().get(opt.value_of("path").unwrap_or("")); @@ -5168,9 +5251,6 @@ impl<'n> Engine<'n> { ("containers-environments-list", Some(opt)) => { call_result = self._accounts_containers_environments_list(opt, dry_run, &mut err); }, - ("containers-environments-patch", Some(opt)) => { - call_result = self._accounts_containers_environments_patch(opt, dry_run, &mut err); - }, ("containers-environments-reauthorize", Some(opt)) => { call_result = self._accounts_containers_environments_reauthorize(opt, dry_run, &mut err); }, @@ -5261,21 +5341,12 @@ impl<'n> Engine<'n> { ("containers-workspaces-get", Some(opt)) => { call_result = self._accounts_containers_workspaces_get(opt, dry_run, &mut err); }, - ("containers-workspaces-get-proposal", Some(opt)) => { - call_result = self._accounts_containers_workspaces_get_proposal(opt, dry_run, &mut err); - }, ("containers-workspaces-get-status", Some(opt)) => { call_result = self._accounts_containers_workspaces_get_status(opt, dry_run, &mut err); }, ("containers-workspaces-list", Some(opt)) => { call_result = self._accounts_containers_workspaces_list(opt, dry_run, &mut err); }, - ("containers-workspaces-proposal-create", Some(opt)) => { - call_result = self._accounts_containers_workspaces_proposal_create(opt, dry_run, &mut err); - }, - ("containers-workspaces-proposal-delete", Some(opt)) => { - call_result = self._accounts_containers_workspaces_proposal_delete(opt, dry_run, &mut err); - }, ("containers-workspaces-quick-preview", Some(opt)) => { call_result = self._accounts_containers_workspaces_quick_preview(opt, dry_run, &mut err); }, @@ -5324,9 +5395,6 @@ impl<'n> Engine<'n> { ("containers-workspaces-update", Some(opt)) => { call_result = self._accounts_containers_workspaces_update(opt, dry_run, &mut err); }, - ("containers-workspaces-update-proposal", Some(opt)) => { - call_result = self._accounts_containers_workspaces_update_proposal(opt, dry_run, &mut err); - }, ("containers-workspaces-variables-create", Some(opt)) => { call_result = self._accounts_containers_workspaces_variables_create(opt, dry_run, &mut err); }, @@ -5345,6 +5413,24 @@ impl<'n> Engine<'n> { ("containers-workspaces-variables-update", Some(opt)) => { call_result = self._accounts_containers_workspaces_variables_update(opt, dry_run, &mut err); }, + ("containers-workspaces-zones-create", Some(opt)) => { + call_result = self._accounts_containers_workspaces_zones_create(opt, dry_run, &mut err); + }, + ("containers-workspaces-zones-delete", Some(opt)) => { + call_result = self._accounts_containers_workspaces_zones_delete(opt, dry_run, &mut err); + }, + ("containers-workspaces-zones-get", Some(opt)) => { + call_result = self._accounts_containers_workspaces_zones_get(opt, dry_run, &mut err); + }, + ("containers-workspaces-zones-list", Some(opt)) => { + call_result = self._accounts_containers_workspaces_zones_list(opt, dry_run, &mut err); + }, + ("containers-workspaces-zones-revert", Some(opt)) => { + call_result = self._accounts_containers_workspaces_zones_revert(opt, dry_run, &mut err); + }, + ("containers-workspaces-zones-update", Some(opt)) => { + call_result = self._accounts_containers_workspaces_zones_update(opt, dry_run, &mut err); + }, ("get", Some(opt)) => { call_result = self._accounts_get(opt, dry_run, &mut err); }, @@ -5457,7 +5543,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("accounts", "methods: 'containers-create', 'containers-delete', 'containers-environments-create', 'containers-environments-delete', 'containers-environments-get', 'containers-environments-list', 'containers-environments-patch', 'containers-environments-reauthorize', 'containers-environments-update', 'containers-get', 'containers-list', 'containers-update', 'containers-version-headers-latest', 'containers-version-headers-list', 'containers-versions-delete', 'containers-versions-get', 'containers-versions-live', 'containers-versions-publish', 'containers-versions-set-latest', 'containers-versions-undelete', 'containers-versions-update', 'containers-workspaces-built-in-variables-create', 'containers-workspaces-built-in-variables-delete', 'containers-workspaces-built-in-variables-list', 'containers-workspaces-built-in-variables-revert', 'containers-workspaces-create', 'containers-workspaces-create-version', 'containers-workspaces-delete', 'containers-workspaces-folders-create', 'containers-workspaces-folders-delete', 'containers-workspaces-folders-entities', 'containers-workspaces-folders-get', 'containers-workspaces-folders-list', 'containers-workspaces-folders-move-entities-to-folder', 'containers-workspaces-folders-revert', 'containers-workspaces-folders-update', 'containers-workspaces-get', 'containers-workspaces-get-proposal', 'containers-workspaces-get-status', 'containers-workspaces-list', 'containers-workspaces-proposal-create', 'containers-workspaces-proposal-delete', 'containers-workspaces-quick-preview', 'containers-workspaces-resolve-conflict', 'containers-workspaces-sync', 'containers-workspaces-tags-create', 'containers-workspaces-tags-delete', 'containers-workspaces-tags-get', 'containers-workspaces-tags-list', 'containers-workspaces-tags-revert', 'containers-workspaces-tags-update', 'containers-workspaces-triggers-create', 'containers-workspaces-triggers-delete', 'containers-workspaces-triggers-get', 'containers-workspaces-triggers-list', 'containers-workspaces-triggers-revert', 'containers-workspaces-triggers-update', 'containers-workspaces-update', 'containers-workspaces-update-proposal', 'containers-workspaces-variables-create', 'containers-workspaces-variables-delete', 'containers-workspaces-variables-get', 'containers-workspaces-variables-list', 'containers-workspaces-variables-revert', 'containers-workspaces-variables-update', 'get', 'list', 'update', 'user-permissions-create', 'user-permissions-delete', 'user-permissions-get', 'user-permissions-list' and 'user-permissions-update'", vec![ + ("accounts", "methods: 'containers-create', 'containers-delete', 'containers-environments-create', 'containers-environments-delete', 'containers-environments-get', 'containers-environments-list', 'containers-environments-reauthorize', 'containers-environments-update', 'containers-get', 'containers-list', 'containers-update', 'containers-version-headers-latest', 'containers-version-headers-list', 'containers-versions-delete', 'containers-versions-get', 'containers-versions-live', 'containers-versions-publish', 'containers-versions-set-latest', 'containers-versions-undelete', 'containers-versions-update', 'containers-workspaces-built-in-variables-create', 'containers-workspaces-built-in-variables-delete', 'containers-workspaces-built-in-variables-list', 'containers-workspaces-built-in-variables-revert', 'containers-workspaces-create', 'containers-workspaces-create-version', 'containers-workspaces-delete', 'containers-workspaces-folders-create', 'containers-workspaces-folders-delete', 'containers-workspaces-folders-entities', 'containers-workspaces-folders-get', 'containers-workspaces-folders-list', 'containers-workspaces-folders-move-entities-to-folder', 'containers-workspaces-folders-revert', 'containers-workspaces-folders-update', 'containers-workspaces-get', 'containers-workspaces-get-status', 'containers-workspaces-list', 'containers-workspaces-quick-preview', 'containers-workspaces-resolve-conflict', 'containers-workspaces-sync', 'containers-workspaces-tags-create', 'containers-workspaces-tags-delete', 'containers-workspaces-tags-get', 'containers-workspaces-tags-list', 'containers-workspaces-tags-revert', 'containers-workspaces-tags-update', 'containers-workspaces-triggers-create', 'containers-workspaces-triggers-delete', 'containers-workspaces-triggers-get', 'containers-workspaces-triggers-list', 'containers-workspaces-triggers-revert', 'containers-workspaces-triggers-update', 'containers-workspaces-update', 'containers-workspaces-variables-create', 'containers-workspaces-variables-delete', 'containers-workspaces-variables-get', 'containers-workspaces-variables-list', 'containers-workspaces-variables-revert', 'containers-workspaces-variables-update', 'containers-workspaces-zones-create', 'containers-workspaces-zones-delete', 'containers-workspaces-zones-get', 'containers-workspaces-zones-list', 'containers-workspaces-zones-revert', 'containers-workspaces-zones-update', 'get', 'list', 'update', 'user-permissions-create', 'user-permissions-delete', 'user-permissions-get', 'user-permissions-list' and 'user-permissions-update'", vec![ ("containers-create", Some(r##"Creates a Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-create", @@ -5584,34 +5670,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("containers-environments-patch", - Some(r##"Updates a GTM Environment. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-environments-patch", - vec![ - (Some(r##"path"##), - None, - Some(r##"GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id}"##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -6296,28 +6354,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("containers-workspaces-get-proposal", - Some(r##"Gets a GTM Workspace Proposal."##), - "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-get-proposal", - vec![ - (Some(r##"path"##), - None, - Some(r##"GTM workspace proposal's relative path: Example: accounts/{aid}/containers/{cid}/workspace/{wid}/workspace_proposal"##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -6368,50 +6404,6 @@ fn main() { Some(false), Some(false)), ]), - ("containers-workspaces-proposal-create", - Some(r##"Creates a GTM Workspace Proposal."##), - "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-proposal-create", - vec![ - (Some(r##"parent"##), - None, - Some(r##"GTM Workspace's API relative path. Example: accounts/{aid}/containers/{cid}/workspace/{wid}"##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("containers-workspaces-proposal-delete", - Some(r##"Deletes a GTM Workspace Proposal."##), - "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-proposal-delete", - vec![ - (Some(r##"path"##), - None, - Some(r##"GTM workspace proposal's relative path: Example: accounts/{aid}/containers/{cid}/workspace/{wid}/workspace_proposal"##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), ("containers-workspaces-quick-preview", Some(r##"Quick previews a workspace by creating a fake container version from all entities in the provided workspace."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-quick-preview", @@ -6776,34 +6768,6 @@ fn main() { Some(false), Some(true)), - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("containers-workspaces-update-proposal", - Some(r##"Updates a GTM Workspace Proposal."##), - "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-update-proposal", - vec![ - (Some(r##"path"##), - None, - Some(r##"GTM workspace proposal's relative path: Example: accounts/{aid}/containers/{cid}/workspace/{wid}/workspace_proposal"##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -6942,6 +6906,144 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("containers-workspaces-zones-create", + Some(r##"Creates a GTM Zone."##), + "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-zones-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("containers-workspaces-zones-delete", + Some(r##"Deletes a GTM Zone."##), + "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-zones-delete", + vec![ + (Some(r##"path"##), + None, + Some(r##"GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("containers-workspaces-zones-get", + Some(r##"Gets a GTM Zone."##), + "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-zones-get", + vec![ + (Some(r##"path"##), + None, + Some(r##"GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("containers-workspaces-zones-list", + Some(r##"Lists all GTM Zones of a GTM container workspace."##), + "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-zones-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("containers-workspaces-zones-revert", + Some(r##"Reverts changes to a GTM Zone in a GTM Workspace."##), + "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-zones-revert", + vec![ + (Some(r##"path"##), + None, + Some(r##"GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("containers-workspaces-zones-update", + Some(r##"Updates a GTM Zone."##), + "Details at http://byron.github.io/google-apis-rs/google_tagmanager2_cli/accounts_containers-workspaces-zones-update", + vec![ + (Some(r##"path"##), + None, + Some(r##"GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id}"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -7136,7 +7238,7 @@ fn main() { let mut app = App::new("tagmanager2") .author("Sebastian Thiel ") - .version("1.0.8+20171108") + .version("1.0.8+20190220") .about("Accesses Tag Manager accounts and containers.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_tagmanager2_cli") .arg(Arg::with_name("url") diff --git a/gen/tagmanager2/Cargo.toml b/gen/tagmanager2/Cargo.toml index 2ffaa6fc6a..cfed90406f 100644 --- a/gen/tagmanager2/Cargo.toml +++ b/gen/tagmanager2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-tagmanager2" -version = "1.0.8+20171108" +version = "1.0.8+20190220" authors = ["Sebastian Thiel "] description = "A complete library to interact with Tag Manager (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tagmanager2" homepage = "https://developers.google.com/tag-manager/api/v2/" -documentation = "https://docs.rs/google-tagmanager2/1.0.8+20171108" +documentation = "https://docs.rs/google-tagmanager2/1.0.8+20190220" license = "MIT" keywords = ["tagmanager", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/tagmanager2/README.md b/gen/tagmanager2/README.md index b79bce68ec..4579e65026 100644 --- a/gen/tagmanager2/README.md +++ b/gen/tagmanager2/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-tagmanager2` library allows access to all features of the *Google Tag Manager* service. -This documentation was generated from *Tag Manager* crate version *1.0.8+20171108*, where *20171108* is the exact revision of the *tagmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Tag Manager* crate version *1.0.8+20190220*, where *20190220* is the exact revision of the *tagmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Tag Manager* *v2* API can be found at the [official documentation site](https://developers.google.com/tag-manager/api/v2/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.TagManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.TagManager.html) ... -* [accounts](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.Account.html) - * [*containers create*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerCreateCall.html), [*containers delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerDeleteCall.html), [*containers environments create*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerEnvironmentCreateCall.html), [*containers environments delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerEnvironmentDeleteCall.html), [*containers environments get*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerEnvironmentGetCall.html), [*containers environments list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerEnvironmentListCall.html), [*containers environments patch*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerEnvironmentPatchCall.html), [*containers environments reauthorize*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerEnvironmentReauthorizeCall.html), [*containers environments update*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerEnvironmentUpdateCall.html), [*containers get*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerGetCall.html), [*containers list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerListCall.html), [*containers update*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerUpdateCall.html), [*containers version_headers latest*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerVersionHeaderLatestCall.html), [*containers version_headers list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerVersionHeaderListCall.html), [*containers versions delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerVersionDeleteCall.html), [*containers versions get*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerVersionGetCall.html), [*containers versions live*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerVersionLiveCall.html), [*containers versions publish*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerVersionPublishCall.html), [*containers versions set_latest*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerVersionSetLatestCall.html), [*containers versions undelete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerVersionUndeleteCall.html), [*containers versions update*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerVersionUpdateCall.html), [*containers workspaces built_in_variables create*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceBuiltInVariableCreateCall.html), [*containers workspaces built_in_variables delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceBuiltInVariableDeleteCall.html), [*containers workspaces built_in_variables list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceBuiltInVariableListCall.html), [*containers workspaces built_in_variables revert*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceBuiltInVariableRevertCall.html), [*containers workspaces create*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceCreateCall.html), [*containers workspaces create_version*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceCreateVersionCall.html), [*containers workspaces delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceDeleteCall.html), [*containers workspaces folders create*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceFolderCreateCall.html), [*containers workspaces folders delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceFolderDeleteCall.html), [*containers workspaces folders entities*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceFolderEntityCall.html), [*containers workspaces folders get*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceFolderGetCall.html), [*containers workspaces folders list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceFolderListCall.html), [*containers workspaces folders move_entities_to_folder*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceFolderMoveEntitiesToFolderCall.html), [*containers workspaces folders revert*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceFolderRevertCall.html), [*containers workspaces folders update*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceFolderUpdateCall.html), [*containers workspaces get*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceGetCall.html), [*containers workspaces get proposal*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceGetProposalCall.html), [*containers workspaces get status*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceGetStatuCall.html), [*containers workspaces list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceListCall.html), [*containers workspaces proposal create*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceProposalCreateCall.html), [*containers workspaces proposal delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceProposalDeleteCall.html), [*containers workspaces quick_preview*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceQuickPreviewCall.html), [*containers workspaces resolve_conflict*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceResolveConflictCall.html), [*containers workspaces sync*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceSyncCall.html), [*containers workspaces tags create*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTagCreateCall.html), [*containers workspaces tags delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTagDeleteCall.html), [*containers workspaces tags get*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTagGetCall.html), [*containers workspaces tags list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTagListCall.html), [*containers workspaces tags revert*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTagRevertCall.html), [*containers workspaces tags update*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTagUpdateCall.html), [*containers workspaces triggers create*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTriggerCreateCall.html), [*containers workspaces triggers delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTriggerDeleteCall.html), [*containers workspaces triggers get*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTriggerGetCall.html), [*containers workspaces triggers list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTriggerListCall.html), [*containers workspaces triggers revert*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTriggerRevertCall.html), [*containers workspaces triggers update*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceTriggerUpdateCall.html), [*containers workspaces update*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceUpdateCall.html), [*containers workspaces update proposal*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceUpdateProposalCall.html), [*containers workspaces variables create*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceVariableCreateCall.html), [*containers workspaces variables delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceVariableDeleteCall.html), [*containers workspaces variables get*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceVariableGetCall.html), [*containers workspaces variables list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceVariableListCall.html), [*containers workspaces variables revert*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceVariableRevertCall.html), [*containers workspaces variables update*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountContainerWorkspaceVariableUpdateCall.html), [*get*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountGetCall.html), [*list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountListCall.html), [*update*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountUpdateCall.html), [*user_permissions create*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountUserPermissionCreateCall.html), [*user_permissions delete*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountUserPermissionDeleteCall.html), [*user_permissions get*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountUserPermissionGetCall.html), [*user_permissions list*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountUserPermissionListCall.html) and [*user_permissions update*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.AccountUserPermissionUpdateCall.html) +* [accounts](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.Account.html) + * [*containers create*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerCreateCall.html), [*containers delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerDeleteCall.html), [*containers environments create*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerEnvironmentCreateCall.html), [*containers environments delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerEnvironmentDeleteCall.html), [*containers environments get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerEnvironmentGetCall.html), [*containers environments list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerEnvironmentListCall.html), [*containers environments reauthorize*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerEnvironmentReauthorizeCall.html), [*containers environments update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerEnvironmentUpdateCall.html), [*containers get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerGetCall.html), [*containers list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerListCall.html), [*containers update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerUpdateCall.html), [*containers version_headers latest*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerVersionHeaderLatestCall.html), [*containers version_headers list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerVersionHeaderListCall.html), [*containers versions delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerVersionDeleteCall.html), [*containers versions get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerVersionGetCall.html), [*containers versions live*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerVersionLiveCall.html), [*containers versions publish*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerVersionPublishCall.html), [*containers versions set_latest*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerVersionSetLatestCall.html), [*containers versions undelete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerVersionUndeleteCall.html), [*containers versions update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerVersionUpdateCall.html), [*containers workspaces built_in_variables create*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceBuiltInVariableCreateCall.html), [*containers workspaces built_in_variables delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceBuiltInVariableDeleteCall.html), [*containers workspaces built_in_variables list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceBuiltInVariableListCall.html), [*containers workspaces built_in_variables revert*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceBuiltInVariableRevertCall.html), [*containers workspaces create*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceCreateCall.html), [*containers workspaces create_version*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceCreateVersionCall.html), [*containers workspaces delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceDeleteCall.html), [*containers workspaces folders create*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceFolderCreateCall.html), [*containers workspaces folders delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceFolderDeleteCall.html), [*containers workspaces folders entities*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceFolderEntityCall.html), [*containers workspaces folders get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceFolderGetCall.html), [*containers workspaces folders list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceFolderListCall.html), [*containers workspaces folders move_entities_to_folder*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceFolderMoveEntitiesToFolderCall.html), [*containers workspaces folders revert*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceFolderRevertCall.html), [*containers workspaces folders update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceFolderUpdateCall.html), [*containers workspaces get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceGetCall.html), [*containers workspaces get status*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceGetStatuCall.html), [*containers workspaces list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceListCall.html), [*containers workspaces quick_preview*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceQuickPreviewCall.html), [*containers workspaces resolve_conflict*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceResolveConflictCall.html), [*containers workspaces sync*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceSyncCall.html), [*containers workspaces tags create*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTagCreateCall.html), [*containers workspaces tags delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTagDeleteCall.html), [*containers workspaces tags get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTagGetCall.html), [*containers workspaces tags list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTagListCall.html), [*containers workspaces tags revert*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTagRevertCall.html), [*containers workspaces tags update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTagUpdateCall.html), [*containers workspaces triggers create*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTriggerCreateCall.html), [*containers workspaces triggers delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTriggerDeleteCall.html), [*containers workspaces triggers get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTriggerGetCall.html), [*containers workspaces triggers list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTriggerListCall.html), [*containers workspaces triggers revert*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTriggerRevertCall.html), [*containers workspaces triggers update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceTriggerUpdateCall.html), [*containers workspaces update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceUpdateCall.html), [*containers workspaces variables create*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceVariableCreateCall.html), [*containers workspaces variables delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceVariableDeleteCall.html), [*containers workspaces variables get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceVariableGetCall.html), [*containers workspaces variables list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceVariableListCall.html), [*containers workspaces variables revert*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceVariableRevertCall.html), [*containers workspaces variables update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceVariableUpdateCall.html), [*containers workspaces zones create*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceZoneCreateCall.html), [*containers workspaces zones delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceZoneDeleteCall.html), [*containers workspaces zones get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceZoneGetCall.html), [*containers workspaces zones list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceZoneListCall.html), [*containers workspaces zones revert*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceZoneRevertCall.html), [*containers workspaces zones update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountContainerWorkspaceZoneUpdateCall.html), [*get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountGetCall.html), [*list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountListCall.html), [*update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountUpdateCall.html), [*user_permissions create*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountUserPermissionCreateCall.html), [*user_permissions delete*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountUserPermissionDeleteCall.html), [*user_permissions get*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountUserPermissionGetCall.html), [*user_permissions list*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountUserPermissionListCall.html) and [*user_permissions update*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.AccountUserPermissionUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/struct.TagManager.html)** +* **[Hub](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/struct.TagManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.Part.html)** + * **[Parts](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -47,7 +47,7 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.accounts().containers_workspaces_get(...).doit() +let r = hub.accounts().containers_workspaces_zones_create(...).doit() let r = hub.accounts().containers_workspaces_folders_move_entities_to_folder(...).doit() let r = hub.accounts().containers_version_headers_latest(...).doit() let r = hub.accounts().containers_workspaces_triggers_create(...).doit() @@ -57,14 +57,16 @@ let r = hub.accounts().containers_workspaces_built_in_variables_delete(...).doit let r = hub.accounts().containers_environments_create(...).doit() let r = hub.accounts().containers_versions_publish(...).doit() let r = hub.accounts().containers_workspaces_folders_get(...).doit() +let r = hub.accounts().containers_workspaces_zones_revert(...).doit() let r = hub.accounts().containers_workspaces_tags_create(...).doit() let r = hub.accounts().containers_environments_delete(...).doit() +let r = hub.accounts().containers_workspaces_get(...).doit() let r = hub.accounts().containers_get(...).doit() let r = hub.accounts().user_permissions_create(...).doit() let r = hub.accounts().containers_workspaces_folders_list(...).doit() let r = hub.accounts().containers_environments_reauthorize(...).doit() let r = hub.accounts().containers_workspaces_delete(...).doit() -let r = hub.accounts().containers_workspaces_get_proposal(...).doit() +let r = hub.accounts().containers_workspaces_create(...).doit() let r = hub.accounts().user_permissions_list(...).doit() let r = hub.accounts().containers_workspaces_folders_delete(...).doit() let r = hub.accounts().containers_workspaces_quick_preview(...).doit() @@ -74,34 +76,34 @@ let r = hub.accounts().containers_workspaces_variables_update(...).doit() let r = hub.accounts().containers_environments_list(...).doit() let r = hub.accounts().containers_workspaces_tags_list(...).doit() let r = hub.accounts().containers_versions_undelete(...).doit() -let r = hub.accounts().containers_workspaces_triggers_list(...).doit() +let r = hub.accounts().containers_workspaces_zones_update(...).doit() +let r = hub.accounts().containers_workspaces_zones_get(...).doit() let r = hub.accounts().containers_workspaces_create_version(...).doit() let r = hub.accounts().containers_delete(...).doit() -let r = hub.accounts().containers_workspaces_create(...).doit() +let r = hub.accounts().containers_versions_delete(...).doit() let r = hub.accounts().update(...).doit() let r = hub.accounts().containers_version_headers_list(...).doit() let r = hub.accounts().containers_workspaces_built_in_variables_list(...).doit() +let r = hub.accounts().containers_workspaces_triggers_list(...).doit() let r = hub.accounts().user_permissions_update(...).doit() -let r = hub.accounts().containers_environments_get(...).doit() +let r = hub.accounts().containers_workspaces_zones_list(...).doit() let r = hub.accounts().get(...).doit() let r = hub.accounts().containers_versions_live(...).doit() let r = hub.accounts().list(...).doit() let r = hub.accounts().containers_workspaces_variables_list(...).doit() let r = hub.accounts().containers_workspaces_variables_revert(...).doit() +let r = hub.accounts().containers_workspaces_zones_delete(...).doit() let r = hub.accounts().containers_workspaces_folders_entities(...).doit() let r = hub.accounts().containers_workspaces_folders_create(...).doit() -let r = hub.accounts().containers_workspaces_get_status(...).doit() let r = hub.accounts().containers_workspaces_tags_delete(...).doit() let r = hub.accounts().containers_update(...).doit() -let r = hub.accounts().containers_environments_patch(...).doit() +let r = hub.accounts().containers_environments_get(...).doit() let r = hub.accounts().containers_workspaces_folders_update(...).doit() let r = hub.accounts().containers_workspaces_built_in_variables_create(...).doit() -let r = hub.accounts().containers_workspaces_proposal_delete(...).doit() let r = hub.accounts().containers_list(...).doit() let r = hub.accounts().containers_workspaces_triggers_delete(...).doit() let r = hub.accounts().containers_workspaces_sync(...).doit() let r = hub.accounts().containers_workspaces_tags_revert(...).doit() -let r = hub.accounts().containers_versions_delete(...).doit() let r = hub.accounts().containers_workspaces_tags_update(...).doit() let r = hub.accounts().containers_create(...).doit() let r = hub.accounts().containers_workspaces_triggers_update(...).doit() @@ -114,11 +116,10 @@ let r = hub.accounts().containers_workspaces_resolve_conflict(...).doit() let r = hub.accounts().containers_environments_update(...).doit() let r = hub.accounts().containers_workspaces_triggers_get(...).doit() let r = hub.accounts().containers_workspaces_folders_revert(...).doit() -let r = hub.accounts().containers_workspaces_proposal_create(...).doit() +let r = hub.accounts().containers_workspaces_get_status(...).doit() let r = hub.accounts().containers_versions_update(...).doit() let r = hub.accounts().containers_versions_get(...).doit() let r = hub.accounts().containers_workspaces_update(...).doit() -let r = hub.accounts().containers_workspaces_update_proposal(...).doit() let r = hub.accounts().user_permissions_delete(...).doit() ``` @@ -205,17 +206,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -225,29 +226,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-tagmanager2/1.0.8+20171108/google_tagmanager2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-tagmanager2/1.0.8+20190220/google_tagmanager2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/tagmanager2/src/lib.rs b/gen/tagmanager2/src/lib.rs index 2f2550c815..0682ee4326 100644 --- a/gen/tagmanager2/src/lib.rs +++ b/gen/tagmanager2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Tag Manager* crate version *1.0.8+20171108*, where *20171108* is the exact revision of the *tagmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Tag Manager* crate version *1.0.8+20190220*, where *20190220* is the exact revision of the *tagmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Tag Manager* *v2* API can be found at the //! [official documentation site](https://developers.google.com/tag-manager/api/v2/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.TagManager.html) ... //! //! * [accounts](struct.Account.html) -//! * [*containers create*](struct.AccountContainerCreateCall.html), [*containers delete*](struct.AccountContainerDeleteCall.html), [*containers environments create*](struct.AccountContainerEnvironmentCreateCall.html), [*containers environments delete*](struct.AccountContainerEnvironmentDeleteCall.html), [*containers environments get*](struct.AccountContainerEnvironmentGetCall.html), [*containers environments list*](struct.AccountContainerEnvironmentListCall.html), [*containers environments patch*](struct.AccountContainerEnvironmentPatchCall.html), [*containers environments reauthorize*](struct.AccountContainerEnvironmentReauthorizeCall.html), [*containers environments update*](struct.AccountContainerEnvironmentUpdateCall.html), [*containers get*](struct.AccountContainerGetCall.html), [*containers list*](struct.AccountContainerListCall.html), [*containers update*](struct.AccountContainerUpdateCall.html), [*containers version_headers latest*](struct.AccountContainerVersionHeaderLatestCall.html), [*containers version_headers list*](struct.AccountContainerVersionHeaderListCall.html), [*containers versions delete*](struct.AccountContainerVersionDeleteCall.html), [*containers versions get*](struct.AccountContainerVersionGetCall.html), [*containers versions live*](struct.AccountContainerVersionLiveCall.html), [*containers versions publish*](struct.AccountContainerVersionPublishCall.html), [*containers versions set_latest*](struct.AccountContainerVersionSetLatestCall.html), [*containers versions undelete*](struct.AccountContainerVersionUndeleteCall.html), [*containers versions update*](struct.AccountContainerVersionUpdateCall.html), [*containers workspaces built_in_variables create*](struct.AccountContainerWorkspaceBuiltInVariableCreateCall.html), [*containers workspaces built_in_variables delete*](struct.AccountContainerWorkspaceBuiltInVariableDeleteCall.html), [*containers workspaces built_in_variables list*](struct.AccountContainerWorkspaceBuiltInVariableListCall.html), [*containers workspaces built_in_variables revert*](struct.AccountContainerWorkspaceBuiltInVariableRevertCall.html), [*containers workspaces create*](struct.AccountContainerWorkspaceCreateCall.html), [*containers workspaces create_version*](struct.AccountContainerWorkspaceCreateVersionCall.html), [*containers workspaces delete*](struct.AccountContainerWorkspaceDeleteCall.html), [*containers workspaces folders create*](struct.AccountContainerWorkspaceFolderCreateCall.html), [*containers workspaces folders delete*](struct.AccountContainerWorkspaceFolderDeleteCall.html), [*containers workspaces folders entities*](struct.AccountContainerWorkspaceFolderEntityCall.html), [*containers workspaces folders get*](struct.AccountContainerWorkspaceFolderGetCall.html), [*containers workspaces folders list*](struct.AccountContainerWorkspaceFolderListCall.html), [*containers workspaces folders move_entities_to_folder*](struct.AccountContainerWorkspaceFolderMoveEntitiesToFolderCall.html), [*containers workspaces folders revert*](struct.AccountContainerWorkspaceFolderRevertCall.html), [*containers workspaces folders update*](struct.AccountContainerWorkspaceFolderUpdateCall.html), [*containers workspaces get*](struct.AccountContainerWorkspaceGetCall.html), [*containers workspaces get proposal*](struct.AccountContainerWorkspaceGetProposalCall.html), [*containers workspaces get status*](struct.AccountContainerWorkspaceGetStatuCall.html), [*containers workspaces list*](struct.AccountContainerWorkspaceListCall.html), [*containers workspaces proposal create*](struct.AccountContainerWorkspaceProposalCreateCall.html), [*containers workspaces proposal delete*](struct.AccountContainerWorkspaceProposalDeleteCall.html), [*containers workspaces quick_preview*](struct.AccountContainerWorkspaceQuickPreviewCall.html), [*containers workspaces resolve_conflict*](struct.AccountContainerWorkspaceResolveConflictCall.html), [*containers workspaces sync*](struct.AccountContainerWorkspaceSyncCall.html), [*containers workspaces tags create*](struct.AccountContainerWorkspaceTagCreateCall.html), [*containers workspaces tags delete*](struct.AccountContainerWorkspaceTagDeleteCall.html), [*containers workspaces tags get*](struct.AccountContainerWorkspaceTagGetCall.html), [*containers workspaces tags list*](struct.AccountContainerWorkspaceTagListCall.html), [*containers workspaces tags revert*](struct.AccountContainerWorkspaceTagRevertCall.html), [*containers workspaces tags update*](struct.AccountContainerWorkspaceTagUpdateCall.html), [*containers workspaces triggers create*](struct.AccountContainerWorkspaceTriggerCreateCall.html), [*containers workspaces triggers delete*](struct.AccountContainerWorkspaceTriggerDeleteCall.html), [*containers workspaces triggers get*](struct.AccountContainerWorkspaceTriggerGetCall.html), [*containers workspaces triggers list*](struct.AccountContainerWorkspaceTriggerListCall.html), [*containers workspaces triggers revert*](struct.AccountContainerWorkspaceTriggerRevertCall.html), [*containers workspaces triggers update*](struct.AccountContainerWorkspaceTriggerUpdateCall.html), [*containers workspaces update*](struct.AccountContainerWorkspaceUpdateCall.html), [*containers workspaces update proposal*](struct.AccountContainerWorkspaceUpdateProposalCall.html), [*containers workspaces variables create*](struct.AccountContainerWorkspaceVariableCreateCall.html), [*containers workspaces variables delete*](struct.AccountContainerWorkspaceVariableDeleteCall.html), [*containers workspaces variables get*](struct.AccountContainerWorkspaceVariableGetCall.html), [*containers workspaces variables list*](struct.AccountContainerWorkspaceVariableListCall.html), [*containers workspaces variables revert*](struct.AccountContainerWorkspaceVariableRevertCall.html), [*containers workspaces variables update*](struct.AccountContainerWorkspaceVariableUpdateCall.html), [*get*](struct.AccountGetCall.html), [*list*](struct.AccountListCall.html), [*update*](struct.AccountUpdateCall.html), [*user_permissions create*](struct.AccountUserPermissionCreateCall.html), [*user_permissions delete*](struct.AccountUserPermissionDeleteCall.html), [*user_permissions get*](struct.AccountUserPermissionGetCall.html), [*user_permissions list*](struct.AccountUserPermissionListCall.html) and [*user_permissions update*](struct.AccountUserPermissionUpdateCall.html) +//! * [*containers create*](struct.AccountContainerCreateCall.html), [*containers delete*](struct.AccountContainerDeleteCall.html), [*containers environments create*](struct.AccountContainerEnvironmentCreateCall.html), [*containers environments delete*](struct.AccountContainerEnvironmentDeleteCall.html), [*containers environments get*](struct.AccountContainerEnvironmentGetCall.html), [*containers environments list*](struct.AccountContainerEnvironmentListCall.html), [*containers environments reauthorize*](struct.AccountContainerEnvironmentReauthorizeCall.html), [*containers environments update*](struct.AccountContainerEnvironmentUpdateCall.html), [*containers get*](struct.AccountContainerGetCall.html), [*containers list*](struct.AccountContainerListCall.html), [*containers update*](struct.AccountContainerUpdateCall.html), [*containers version_headers latest*](struct.AccountContainerVersionHeaderLatestCall.html), [*containers version_headers list*](struct.AccountContainerVersionHeaderListCall.html), [*containers versions delete*](struct.AccountContainerVersionDeleteCall.html), [*containers versions get*](struct.AccountContainerVersionGetCall.html), [*containers versions live*](struct.AccountContainerVersionLiveCall.html), [*containers versions publish*](struct.AccountContainerVersionPublishCall.html), [*containers versions set_latest*](struct.AccountContainerVersionSetLatestCall.html), [*containers versions undelete*](struct.AccountContainerVersionUndeleteCall.html), [*containers versions update*](struct.AccountContainerVersionUpdateCall.html), [*containers workspaces built_in_variables create*](struct.AccountContainerWorkspaceBuiltInVariableCreateCall.html), [*containers workspaces built_in_variables delete*](struct.AccountContainerWorkspaceBuiltInVariableDeleteCall.html), [*containers workspaces built_in_variables list*](struct.AccountContainerWorkspaceBuiltInVariableListCall.html), [*containers workspaces built_in_variables revert*](struct.AccountContainerWorkspaceBuiltInVariableRevertCall.html), [*containers workspaces create*](struct.AccountContainerWorkspaceCreateCall.html), [*containers workspaces create_version*](struct.AccountContainerWorkspaceCreateVersionCall.html), [*containers workspaces delete*](struct.AccountContainerWorkspaceDeleteCall.html), [*containers workspaces folders create*](struct.AccountContainerWorkspaceFolderCreateCall.html), [*containers workspaces folders delete*](struct.AccountContainerWorkspaceFolderDeleteCall.html), [*containers workspaces folders entities*](struct.AccountContainerWorkspaceFolderEntityCall.html), [*containers workspaces folders get*](struct.AccountContainerWorkspaceFolderGetCall.html), [*containers workspaces folders list*](struct.AccountContainerWorkspaceFolderListCall.html), [*containers workspaces folders move_entities_to_folder*](struct.AccountContainerWorkspaceFolderMoveEntitiesToFolderCall.html), [*containers workspaces folders revert*](struct.AccountContainerWorkspaceFolderRevertCall.html), [*containers workspaces folders update*](struct.AccountContainerWorkspaceFolderUpdateCall.html), [*containers workspaces get*](struct.AccountContainerWorkspaceGetCall.html), [*containers workspaces get status*](struct.AccountContainerWorkspaceGetStatuCall.html), [*containers workspaces list*](struct.AccountContainerWorkspaceListCall.html), [*containers workspaces quick_preview*](struct.AccountContainerWorkspaceQuickPreviewCall.html), [*containers workspaces resolve_conflict*](struct.AccountContainerWorkspaceResolveConflictCall.html), [*containers workspaces sync*](struct.AccountContainerWorkspaceSyncCall.html), [*containers workspaces tags create*](struct.AccountContainerWorkspaceTagCreateCall.html), [*containers workspaces tags delete*](struct.AccountContainerWorkspaceTagDeleteCall.html), [*containers workspaces tags get*](struct.AccountContainerWorkspaceTagGetCall.html), [*containers workspaces tags list*](struct.AccountContainerWorkspaceTagListCall.html), [*containers workspaces tags revert*](struct.AccountContainerWorkspaceTagRevertCall.html), [*containers workspaces tags update*](struct.AccountContainerWorkspaceTagUpdateCall.html), [*containers workspaces triggers create*](struct.AccountContainerWorkspaceTriggerCreateCall.html), [*containers workspaces triggers delete*](struct.AccountContainerWorkspaceTriggerDeleteCall.html), [*containers workspaces triggers get*](struct.AccountContainerWorkspaceTriggerGetCall.html), [*containers workspaces triggers list*](struct.AccountContainerWorkspaceTriggerListCall.html), [*containers workspaces triggers revert*](struct.AccountContainerWorkspaceTriggerRevertCall.html), [*containers workspaces triggers update*](struct.AccountContainerWorkspaceTriggerUpdateCall.html), [*containers workspaces update*](struct.AccountContainerWorkspaceUpdateCall.html), [*containers workspaces variables create*](struct.AccountContainerWorkspaceVariableCreateCall.html), [*containers workspaces variables delete*](struct.AccountContainerWorkspaceVariableDeleteCall.html), [*containers workspaces variables get*](struct.AccountContainerWorkspaceVariableGetCall.html), [*containers workspaces variables list*](struct.AccountContainerWorkspaceVariableListCall.html), [*containers workspaces variables revert*](struct.AccountContainerWorkspaceVariableRevertCall.html), [*containers workspaces variables update*](struct.AccountContainerWorkspaceVariableUpdateCall.html), [*containers workspaces zones create*](struct.AccountContainerWorkspaceZoneCreateCall.html), [*containers workspaces zones delete*](struct.AccountContainerWorkspaceZoneDeleteCall.html), [*containers workspaces zones get*](struct.AccountContainerWorkspaceZoneGetCall.html), [*containers workspaces zones list*](struct.AccountContainerWorkspaceZoneListCall.html), [*containers workspaces zones revert*](struct.AccountContainerWorkspaceZoneRevertCall.html), [*containers workspaces zones update*](struct.AccountContainerWorkspaceZoneUpdateCall.html), [*get*](struct.AccountGetCall.html), [*list*](struct.AccountListCall.html), [*update*](struct.AccountUpdateCall.html), [*user_permissions create*](struct.AccountUserPermissionCreateCall.html), [*user_permissions delete*](struct.AccountUserPermissionDeleteCall.html), [*user_permissions get*](struct.AccountUserPermissionGetCall.html), [*user_permissions list*](struct.AccountUserPermissionListCall.html) and [*user_permissions update*](struct.AccountUserPermissionUpdateCall.html) //! //! //! @@ -47,7 +47,7 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.accounts().containers_workspaces_get(...).doit() +//! let r = hub.accounts().containers_workspaces_zones_create(...).doit() //! let r = hub.accounts().containers_workspaces_folders_move_entities_to_folder(...).doit() //! let r = hub.accounts().containers_version_headers_latest(...).doit() //! let r = hub.accounts().containers_workspaces_triggers_create(...).doit() @@ -57,14 +57,16 @@ //! let r = hub.accounts().containers_environments_create(...).doit() //! let r = hub.accounts().containers_versions_publish(...).doit() //! let r = hub.accounts().containers_workspaces_folders_get(...).doit() +//! let r = hub.accounts().containers_workspaces_zones_revert(...).doit() //! let r = hub.accounts().containers_workspaces_tags_create(...).doit() //! let r = hub.accounts().containers_environments_delete(...).doit() +//! let r = hub.accounts().containers_workspaces_get(...).doit() //! let r = hub.accounts().containers_get(...).doit() //! let r = hub.accounts().user_permissions_create(...).doit() //! let r = hub.accounts().containers_workspaces_folders_list(...).doit() //! let r = hub.accounts().containers_environments_reauthorize(...).doit() //! let r = hub.accounts().containers_workspaces_delete(...).doit() -//! let r = hub.accounts().containers_workspaces_get_proposal(...).doit() +//! let r = hub.accounts().containers_workspaces_create(...).doit() //! let r = hub.accounts().user_permissions_list(...).doit() //! let r = hub.accounts().containers_workspaces_folders_delete(...).doit() //! let r = hub.accounts().containers_workspaces_quick_preview(...).doit() @@ -74,34 +76,34 @@ //! let r = hub.accounts().containers_environments_list(...).doit() //! let r = hub.accounts().containers_workspaces_tags_list(...).doit() //! let r = hub.accounts().containers_versions_undelete(...).doit() -//! let r = hub.accounts().containers_workspaces_triggers_list(...).doit() +//! let r = hub.accounts().containers_workspaces_zones_update(...).doit() +//! let r = hub.accounts().containers_workspaces_zones_get(...).doit() //! let r = hub.accounts().containers_workspaces_create_version(...).doit() //! let r = hub.accounts().containers_delete(...).doit() -//! let r = hub.accounts().containers_workspaces_create(...).doit() +//! let r = hub.accounts().containers_versions_delete(...).doit() //! let r = hub.accounts().update(...).doit() //! let r = hub.accounts().containers_version_headers_list(...).doit() //! let r = hub.accounts().containers_workspaces_built_in_variables_list(...).doit() +//! let r = hub.accounts().containers_workspaces_triggers_list(...).doit() //! let r = hub.accounts().user_permissions_update(...).doit() -//! let r = hub.accounts().containers_environments_get(...).doit() +//! let r = hub.accounts().containers_workspaces_zones_list(...).doit() //! let r = hub.accounts().get(...).doit() //! let r = hub.accounts().containers_versions_live(...).doit() //! let r = hub.accounts().list(...).doit() //! let r = hub.accounts().containers_workspaces_variables_list(...).doit() //! let r = hub.accounts().containers_workspaces_variables_revert(...).doit() +//! let r = hub.accounts().containers_workspaces_zones_delete(...).doit() //! let r = hub.accounts().containers_workspaces_folders_entities(...).doit() //! let r = hub.accounts().containers_workspaces_folders_create(...).doit() -//! let r = hub.accounts().containers_workspaces_get_status(...).doit() //! let r = hub.accounts().containers_workspaces_tags_delete(...).doit() //! let r = hub.accounts().containers_update(...).doit() -//! let r = hub.accounts().containers_environments_patch(...).doit() +//! let r = hub.accounts().containers_environments_get(...).doit() //! let r = hub.accounts().containers_workspaces_folders_update(...).doit() //! let r = hub.accounts().containers_workspaces_built_in_variables_create(...).doit() -//! let r = hub.accounts().containers_workspaces_proposal_delete(...).doit() //! let r = hub.accounts().containers_list(...).doit() //! let r = hub.accounts().containers_workspaces_triggers_delete(...).doit() //! let r = hub.accounts().containers_workspaces_sync(...).doit() //! let r = hub.accounts().containers_workspaces_tags_revert(...).doit() -//! let r = hub.accounts().containers_versions_delete(...).doit() //! let r = hub.accounts().containers_workspaces_tags_update(...).doit() //! let r = hub.accounts().containers_create(...).doit() //! let r = hub.accounts().containers_workspaces_triggers_update(...).doit() @@ -114,11 +116,10 @@ //! let r = hub.accounts().containers_environments_update(...).doit() //! let r = hub.accounts().containers_workspaces_triggers_get(...).doit() //! let r = hub.accounts().containers_workspaces_folders_revert(...).doit() -//! let r = hub.accounts().containers_workspaces_proposal_create(...).doit() +//! let r = hub.accounts().containers_workspaces_get_status(...).doit() //! let r = hub.accounts().containers_versions_update(...).doit() //! let r = hub.accounts().containers_versions_get(...).doit() //! let r = hub.accounts().containers_workspaces_update(...).doit() -//! let r = hub.accounts().containers_workspaces_update_proposal(...).doit() //! let r = hub.accounts().user_permissions_delete(...).doit() //! ``` //! @@ -526,6 +527,32 @@ pub struct AccountAccess { impl Part for AccountAccess {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VariableFormatValue { + /// The value to convert if a variable value is undefined. + #[serde(rename="convertUndefinedToValue")] + pub convert_undefined_to_value: Option, + /// The value to convert if a variable value is false. + #[serde(rename="convertFalseToValue")] + pub convert_false_to_value: Option, + /// The option to convert a string-type variable value to either lowercase or uppercase. + #[serde(rename="caseConversionType")] + pub case_conversion_type: Option, + /// The value to convert if a variable value is null. + #[serde(rename="convertNullToValue")] + pub convert_null_to_value: Option, + /// The value to convert if a variable value is true. + #[serde(rename="convertTrueToValue")] + pub convert_true_to_value: Option, +} + +impl Part for VariableFormatValue {} + + /// Represents a Google Tag Manager Container, which specifies the platform tags will run on, manages workspaces, and retains container versions. /// /// # Activities @@ -573,7 +600,14 @@ impl ResponseResult for Container {} /// Represents a Google Tag Manager Zone's contents. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [containers workspaces zones create accounts](struct.AccountContainerWorkspaceZoneCreateCall.html) (request|response) +/// * [containers workspaces zones update accounts](struct.AccountContainerWorkspaceZoneUpdateCall.html) (request|response) +/// * [containers workspaces zones get accounts](struct.AccountContainerWorkspaceZoneGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Zone { @@ -610,7 +644,8 @@ pub struct Zone { pub account_id: Option, } -impl Part for Zone {} +impl RequestValue for Zone {} +impl ResponseResult for Zone {} /// List Containers Response. @@ -664,7 +699,6 @@ impl ResponseResult for ListVariablesResponse {} /// /// * [containers environments create accounts](struct.AccountContainerEnvironmentCreateCall.html) (request|response) /// * [containers environments reauthorize accounts](struct.AccountContainerEnvironmentReauthorizeCall.html) (request|response) -/// * [containers environments patch accounts](struct.AccountContainerEnvironmentPatchCall.html) (request|response) /// * [containers environments update accounts](struct.AccountContainerEnvironmentUpdateCall.html) (request|response) /// * [containers environments get accounts](struct.AccountContainerEnvironmentGetCall.html) (response) /// @@ -783,6 +817,9 @@ pub struct ContainerVersion { pub variable: Option>, /// GTM ContainerVersions's API relative path. pub path: Option, + /// The custom templates in the container that this version was taken from. + #[serde(rename="customTemplate")] + pub custom_template: Option>, /// GTM Account ID. #[serde(rename="accountId")] pub account_id: Option, @@ -1001,21 +1038,61 @@ pub struct GetWorkspaceStatusResponse { impl ResponseResult for GetWorkspaceStatusResponse {} -/// Represents an external user or internal Google Tag Manager system. +/// A Timestamp represents a point in time independent of any time zone or local calendar, encoded as a count of seconds and fractions of seconds at nanosecond resolution. The count is relative to an epoch at UTC midnight on January 1, 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar backwards to year one. +/// +/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap second table is needed for interpretation, using a [24-hour linear smear](https://developers.google.com/time/smear). +/// +/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. +/// +/// # Examples +/// +/// Example 1: Compute Timestamp from POSIX `time()`. +/// +/// Timestamp timestamp; timestamp.set_seconds(time(NULL)); timestamp.set_nanos(0); +/// +/// Example 2: Compute Timestamp from POSIX `gettimeofday()`. +/// +/// struct timeval tv; gettimeofday(&tv, NULL); +/// +/// Timestamp timestamp; timestamp.set_seconds(tv.tv_sec); timestamp.set_nanos(tv.tv_usec * 1000); +/// +/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. +/// +/// FILETIME ft; GetSystemTimeAsFileTime(&ft); UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; +/// +/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. Timestamp timestamp; timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); +/// +/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. +/// +/// long millis = System.currentTimeMillis(); +/// +/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) .setNanos((int) ((millis % 1000) * 1000000)).build(); +/// +/// +/// +/// Example 5: Compute Timestamp from current time in Python. +/// +/// timestamp = Timestamp() timestamp.GetCurrentTime() +/// +/// # JSON Mapping +/// +/// In JSON format, the Timestamp type is encoded as a string in the [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone is required. A proto3 JSON serializer should always use UTC (as indicated by "Z") when printing the Timestamp type and a proto3 JSON parser should be able to accept both UTC and other timezones (as indicated by an offset). +/// +/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on January 15, 2017. +/// +/// In JavaScript, one can convert a Date object to this format using the standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) method. In Python, a standard `datetime.datetime` object can be converted to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D ) to obtain a formatter capable of generating timestamps in this format. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WorkspaceProposalUser { - /// Gaia id associated with a user, absent for the Google Tag Manager system. - #[serde(rename="gaiaId")] - pub gaia_id: Option, - /// User type distinguishes between a user and the Google Tag Manager system. - #[serde(rename="type")] - pub type_: Option, +pub struct Timestamp { + /// Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. + pub nanos: Option, + /// Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. + pub seconds: Option, } -impl Part for WorkspaceProposalUser {} +impl Part for Timestamp {} /// Represents a child container of a Zone. @@ -1034,36 +1111,6 @@ pub struct ZoneChildContainer { impl Part for ZoneChildContainer {} -/// A workspace proposal represents an ongoing review of workspace changes in an effort to gain approval for container version creation. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [containers workspaces proposal create accounts](struct.AccountContainerWorkspaceProposalCreateCall.html) (response) -/// * [containers workspaces update proposal accounts](struct.AccountContainerWorkspaceUpdateProposalCall.html) (response) -/// * [containers workspaces get proposal accounts](struct.AccountContainerWorkspaceGetProposalCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WorkspaceProposal { - /// The status of the workspace proposal as it goes through review. - pub status: Option, - /// List of authors for the workspace proposal. - pub authors: Option>, - /// Lists of reviewers for the workspace proposal. - pub reviewers: Option>, - /// GTM workspace proposal's relative path. - pub path: Option, - /// The fingerprint of the GTM workspace proposal as computed at storage time. This value is recomputed whenever the proposal is modified. - pub fingerprint: Option, - /// Records the history of comments and status changes. - pub history: Option>, -} - -impl ResponseResult for WorkspaceProposal {} - - /// List triggers response. /// /// # Activities @@ -1130,9 +1177,8 @@ impl Part for SetupTag {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ContainerVersionHeader { - /// GTM Container ID. - #[serde(rename="containerId")] - pub container_id: Option, + /// Container version display name. + pub name: Option, /// Number of tags in the container version. #[serde(rename="numTags")] pub num_tags: Option, @@ -1144,8 +1190,12 @@ pub struct ContainerVersionHeader { /// Number of macros in the container version. #[serde(rename="numMacros")] pub num_macros: Option, - /// Container version display name. - pub name: Option, + /// Number of custom templates in the container version. + #[serde(rename="numCustomTemplates")] + pub num_custom_templates: Option, + /// GTM Container ID. + #[serde(rename="containerId")] + pub container_id: Option, /// Number of triggers in the container version. #[serde(rename="numTriggers")] pub num_triggers: Option, @@ -1243,9 +1293,6 @@ pub struct Variable { /// The end timestamp in milliseconds to schedule a variable. #[serde(rename="scheduleEndMs")] pub schedule_end_ms: Option, - /// The Variable ID uniquely identifies the GTM Variable. - #[serde(rename="variableId")] - pub variable_id: Option, /// GTM Container ID. #[serde(rename="containerId")] pub container_id: Option, @@ -1264,10 +1311,16 @@ pub struct Variable { pub account_id: Option, /// Variable display name. pub name: Option, + /// The Variable ID uniquely identifies the GTM Variable. + #[serde(rename="variableId")] + pub variable_id: Option, /// The variable's parameters. pub parameter: Option>, /// User notes on how to apply this variable in the container. pub notes: Option, + /// Option to convert a variable value to other value. + #[serde(rename="formatValue")] + pub format_value: Option, /// GTM Workspace ID. #[serde(rename="workspaceId")] pub workspace_id: Option, @@ -1304,29 +1357,39 @@ pub struct RevertVariableResponse { impl ResponseResult for RevertVariableResponse {} -/// A history event that represents a comment or status change in the proposal. +/// Represents a Google Tag Manager Custom Template's contents. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WorkspaceProposalHistory { - /// A user or reviewer comment. - pub comment: Option, - /// When this history event was added to the workspace proposal. - #[serde(rename="createdTimestamp")] - pub created_timestamp: Option, - /// The history type distinguishing between comments and status changes. - #[serde(rename="type")] - pub type_: Option, - /// The party responsible for the change in history. - #[serde(rename="createdBy")] - pub created_by: Option, - /// A change in the proposal's status. - #[serde(rename="statusChange")] - pub status_change: Option, +pub struct CustomTemplate { + /// The custom template in text format. + #[serde(rename="templateData")] + pub template_data: Option, + /// GTM Container ID. + #[serde(rename="containerId")] + pub container_id: Option, + /// The fingerprint of the GTM Custom Template as computed at storage time. This value is recomputed whenever the template is modified. + pub fingerprint: Option, + /// Custom Template display name. + pub name: Option, + /// GTM Workspace ID. + #[serde(rename="workspaceId")] + pub workspace_id: Option, + /// Auto generated link to the tag manager UI + #[serde(rename="tagManagerUrl")] + pub tag_manager_url: Option, + /// The Custom Template ID uniquely identifies the GTM custom template. + #[serde(rename="templateId")] + pub template_id: Option, + /// GTM Custom Template's API relative path. + pub path: Option, + /// GTM Account ID. + #[serde(rename="accountId")] + pub account_id: Option, } -impl Part for WorkspaceProposalHistory {} +impl Part for CustomTemplate {} /// Represents a predicate. @@ -1349,23 +1412,6 @@ pub struct Condition { impl Part for Condition {} -/// A change in the proposal's status. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WorkspaceProposalHistoryStatusChange { - /// The new proposal status after that status change. - #[serde(rename="newStatus")] - pub new_status: Option, - /// The old proposal status before the status change. - #[serde(rename="oldStatus")] - pub old_status: Option, -} - -impl Part for WorkspaceProposalHistoryStatusChange {} - - /// Represents a Google Tag Manager Account. /// /// # Activities @@ -1373,7 +1419,7 @@ impl Part for WorkspaceProposalHistoryStatusChange {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [containers workspaces get accounts](struct.AccountContainerWorkspaceGetCall.html) (none) +/// * [containers workspaces zones create accounts](struct.AccountContainerWorkspaceZoneCreateCall.html) (none) /// * [containers workspaces folders move_entities_to_folder accounts](struct.AccountContainerWorkspaceFolderMoveEntitiesToFolderCall.html) (none) /// * [containers version_headers latest accounts](struct.AccountContainerVersionHeaderLatestCall.html) (none) /// * [containers workspaces triggers create accounts](struct.AccountContainerWorkspaceTriggerCreateCall.html) (none) @@ -1383,14 +1429,16 @@ impl Part for WorkspaceProposalHistoryStatusChange {} /// * [containers environments create accounts](struct.AccountContainerEnvironmentCreateCall.html) (none) /// * [containers versions publish accounts](struct.AccountContainerVersionPublishCall.html) (none) /// * [containers workspaces folders get accounts](struct.AccountContainerWorkspaceFolderGetCall.html) (none) +/// * [containers workspaces zones revert accounts](struct.AccountContainerWorkspaceZoneRevertCall.html) (none) /// * [containers workspaces tags create accounts](struct.AccountContainerWorkspaceTagCreateCall.html) (none) /// * [containers environments delete accounts](struct.AccountContainerEnvironmentDeleteCall.html) (none) +/// * [containers workspaces get accounts](struct.AccountContainerWorkspaceGetCall.html) (none) /// * [containers get accounts](struct.AccountContainerGetCall.html) (none) /// * [user_permissions create accounts](struct.AccountUserPermissionCreateCall.html) (none) /// * [containers workspaces folders list accounts](struct.AccountContainerWorkspaceFolderListCall.html) (none) /// * [containers environments reauthorize accounts](struct.AccountContainerEnvironmentReauthorizeCall.html) (none) /// * [containers workspaces delete accounts](struct.AccountContainerWorkspaceDeleteCall.html) (none) -/// * [containers workspaces get proposal accounts](struct.AccountContainerWorkspaceGetProposalCall.html) (none) +/// * [containers workspaces create accounts](struct.AccountContainerWorkspaceCreateCall.html) (none) /// * [user_permissions list accounts](struct.AccountUserPermissionListCall.html) (none) /// * [containers workspaces folders delete accounts](struct.AccountContainerWorkspaceFolderDeleteCall.html) (none) /// * [containers workspaces quick_preview accounts](struct.AccountContainerWorkspaceQuickPreviewCall.html) (none) @@ -1400,34 +1448,34 @@ impl Part for WorkspaceProposalHistoryStatusChange {} /// * [containers environments list accounts](struct.AccountContainerEnvironmentListCall.html) (none) /// * [containers workspaces tags list accounts](struct.AccountContainerWorkspaceTagListCall.html) (none) /// * [containers versions undelete accounts](struct.AccountContainerVersionUndeleteCall.html) (none) -/// * [containers workspaces triggers list accounts](struct.AccountContainerWorkspaceTriggerListCall.html) (none) +/// * [containers workspaces zones update accounts](struct.AccountContainerWorkspaceZoneUpdateCall.html) (none) +/// * [containers workspaces zones get accounts](struct.AccountContainerWorkspaceZoneGetCall.html) (none) /// * [containers workspaces create_version accounts](struct.AccountContainerWorkspaceCreateVersionCall.html) (none) /// * [containers delete accounts](struct.AccountContainerDeleteCall.html) (none) -/// * [containers workspaces create accounts](struct.AccountContainerWorkspaceCreateCall.html) (none) +/// * [containers versions delete accounts](struct.AccountContainerVersionDeleteCall.html) (none) /// * [update accounts](struct.AccountUpdateCall.html) (request|response) /// * [containers version_headers list accounts](struct.AccountContainerVersionHeaderListCall.html) (none) /// * [containers workspaces built_in_variables list accounts](struct.AccountContainerWorkspaceBuiltInVariableListCall.html) (none) +/// * [containers workspaces triggers list accounts](struct.AccountContainerWorkspaceTriggerListCall.html) (none) /// * [user_permissions update accounts](struct.AccountUserPermissionUpdateCall.html) (none) -/// * [containers environments get accounts](struct.AccountContainerEnvironmentGetCall.html) (none) +/// * [containers workspaces zones list accounts](struct.AccountContainerWorkspaceZoneListCall.html) (none) /// * [get accounts](struct.AccountGetCall.html) (response) /// * [containers versions live accounts](struct.AccountContainerVersionLiveCall.html) (none) /// * [list accounts](struct.AccountListCall.html) (none) /// * [containers workspaces variables list accounts](struct.AccountContainerWorkspaceVariableListCall.html) (none) /// * [containers workspaces variables revert accounts](struct.AccountContainerWorkspaceVariableRevertCall.html) (none) +/// * [containers workspaces zones delete accounts](struct.AccountContainerWorkspaceZoneDeleteCall.html) (none) /// * [containers workspaces folders entities accounts](struct.AccountContainerWorkspaceFolderEntityCall.html) (none) /// * [containers workspaces folders create accounts](struct.AccountContainerWorkspaceFolderCreateCall.html) (none) -/// * [containers workspaces get status accounts](struct.AccountContainerWorkspaceGetStatuCall.html) (none) /// * [containers workspaces tags delete accounts](struct.AccountContainerWorkspaceTagDeleteCall.html) (none) /// * [containers update accounts](struct.AccountContainerUpdateCall.html) (none) -/// * [containers environments patch accounts](struct.AccountContainerEnvironmentPatchCall.html) (none) +/// * [containers environments get accounts](struct.AccountContainerEnvironmentGetCall.html) (none) /// * [containers workspaces folders update accounts](struct.AccountContainerWorkspaceFolderUpdateCall.html) (none) /// * [containers workspaces built_in_variables create accounts](struct.AccountContainerWorkspaceBuiltInVariableCreateCall.html) (none) -/// * [containers workspaces proposal delete accounts](struct.AccountContainerWorkspaceProposalDeleteCall.html) (none) /// * [containers list accounts](struct.AccountContainerListCall.html) (none) /// * [containers workspaces triggers delete accounts](struct.AccountContainerWorkspaceTriggerDeleteCall.html) (none) /// * [containers workspaces sync accounts](struct.AccountContainerWorkspaceSyncCall.html) (none) /// * [containers workspaces tags revert accounts](struct.AccountContainerWorkspaceTagRevertCall.html) (none) -/// * [containers versions delete accounts](struct.AccountContainerVersionDeleteCall.html) (none) /// * [containers workspaces tags update accounts](struct.AccountContainerWorkspaceTagUpdateCall.html) (none) /// * [containers create accounts](struct.AccountContainerCreateCall.html) (none) /// * [containers workspaces triggers update accounts](struct.AccountContainerWorkspaceTriggerUpdateCall.html) (none) @@ -1440,11 +1488,10 @@ impl Part for WorkspaceProposalHistoryStatusChange {} /// * [containers environments update accounts](struct.AccountContainerEnvironmentUpdateCall.html) (none) /// * [containers workspaces triggers get accounts](struct.AccountContainerWorkspaceTriggerGetCall.html) (none) /// * [containers workspaces folders revert accounts](struct.AccountContainerWorkspaceFolderRevertCall.html) (none) -/// * [containers workspaces proposal create accounts](struct.AccountContainerWorkspaceProposalCreateCall.html) (none) +/// * [containers workspaces get status accounts](struct.AccountContainerWorkspaceGetStatuCall.html) (none) /// * [containers versions update accounts](struct.AccountContainerVersionUpdateCall.html) (none) /// * [containers versions get accounts](struct.AccountContainerVersionGetCall.html) (none) /// * [containers workspaces update accounts](struct.AccountContainerWorkspaceUpdateCall.html) (none) -/// * [containers workspaces update proposal accounts](struct.AccountContainerWorkspaceUpdateProposalCall.html) (none) /// * [user_permissions delete accounts](struct.AccountUserPermissionDeleteCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] @@ -1916,25 +1963,25 @@ pub struct ListUserPermissionsResponse { impl ResponseResult for ListUserPermissionsResponse {} -/// Creates a workspace proposal to start a review of a workspace. +/// There is no detailed description. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [containers workspaces proposal create accounts](struct.AccountContainerWorkspaceProposalCreateCall.html) (request) +/// * [containers workspaces zones list accounts](struct.AccountContainerWorkspaceZoneListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateWorkspaceProposalRequest { - /// List of users to review the workspace proposal. - pub reviewers: Option>, - /// If present, an initial comment to associate with the workspace proposal. - #[serde(rename="initialComment")] - pub initial_comment: Option, +pub struct ListZonesResponse { + /// Continuation token for fetching the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// All GTM Zones of a GTM Container. + pub zone: Option>, } -impl RequestValue for CreateWorkspaceProposalRequest {} +impl ResponseResult for ListZonesResponse {} /// List Tags Response. @@ -1958,19 +2005,6 @@ pub struct ListTagsResponse { impl ResponseResult for ListTagsResponse {} -/// A comment from the reviewer or author. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WorkspaceProposalHistoryComment { - /// The contents of the reviewer or author comment. - pub content: Option, -} - -impl Part for WorkspaceProposalHistoryComment {} - - /// Options for new container versions. /// /// # Activities @@ -2036,57 +2070,22 @@ pub struct RevertBuiltInVariableResponse { impl ResponseResult for RevertBuiltInVariableResponse {} -/// A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time. It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from RFC 3339 date strings. See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). +/// The result of reverting a zone in a workspace. /// -/// # Examples +/// # Activities /// -/// Example 1: Compute Timestamp from POSIX `time()`. +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// Timestamp timestamp; timestamp.set_seconds(time(NULL)); timestamp.set_nanos(0); -/// -/// Example 2: Compute Timestamp from POSIX `gettimeofday()`. -/// -/// struct timeval tv; gettimeofday(&tv, NULL); -/// -/// Timestamp timestamp; timestamp.set_seconds(tv.tv_sec); timestamp.set_nanos(tv.tv_usec * 1000); -/// -/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. -/// -/// FILETIME ft; GetSystemTimeAsFileTime(&ft); UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; -/// -/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. Timestamp timestamp; timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); -/// -/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. -/// -/// long millis = System.currentTimeMillis(); -/// -/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) .setNanos((int) ((millis % 1000) * 1000000)).build(); -/// -/// -/// -/// Example 5: Compute Timestamp from current time in Python. -/// -/// timestamp = Timestamp() timestamp.GetCurrentTime() -/// -/// # JSON Mapping -/// -/// In JSON format, the Timestamp type is encoded as a string in the [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone is required, though only UTC (as indicated by "Z") is presently supported. -/// -/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on January 15, 2017. -/// -/// In JavaScript, one can convert a Date object to this format using the standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] method. In Python, a standard `datetime.datetime` object can be converted to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()) to obtain a formatter capable of generating timestamps in this format. -/// -/// This type is not used in any activity, and only used as *part* of another schema. +/// * [containers workspaces zones revert accounts](struct.AccountContainerWorkspaceZoneRevertCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Timestamp { - /// Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. - pub nanos: Option, - /// Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. - pub seconds: Option, +pub struct RevertZoneResponse { + /// Zone as it appears in the latest container version since the last workspace synchronization operation. If no zone is present, that means the zone was deleted in the latest container version. + pub zone: Option, } -impl Part for Timestamp {} +impl ResponseResult for RevertZoneResponse {} /// Represents a tag that fires after another tag in order to tear down dependencies. @@ -2106,31 +2105,6 @@ pub struct TeardownTag { impl Part for TeardownTag {} -/// Updates a workspace proposal with patch-like semantics. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [containers workspaces update proposal accounts](struct.AccountContainerWorkspaceUpdateProposalCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateWorkspaceProposalRequest { - /// If present, the status of the workspace proposal is updated. - pub status: Option, - /// If present, the list of reviewers of the workspace proposal is updated. - pub reviewers: Option>, - /// If present, a new comment is added to the workspace proposal history. - #[serde(rename="newComment")] - pub new_comment: Option, - /// When provided, this fingerprint must match the fingerprint of the proposal in storage. - pub fingerprint: Option, -} - -impl RequestValue for UpdateWorkspaceProposalRequest {} - - /// List container versions response. /// /// # Activities @@ -2182,7 +2156,7 @@ impl ResponseResult for ListContainerVersionsResponse {} /// ::default(), None); /// let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `containers_create(...)`, `containers_delete(...)`, `containers_environments_create(...)`, `containers_environments_delete(...)`, `containers_environments_get(...)`, `containers_environments_list(...)`, `containers_environments_patch(...)`, `containers_environments_reauthorize(...)`, `containers_environments_update(...)`, `containers_get(...)`, `containers_list(...)`, `containers_update(...)`, `containers_version_headers_latest(...)`, `containers_version_headers_list(...)`, `containers_versions_delete(...)`, `containers_versions_get(...)`, `containers_versions_live(...)`, `containers_versions_publish(...)`, `containers_versions_set_latest(...)`, `containers_versions_undelete(...)`, `containers_versions_update(...)`, `containers_workspaces_built_in_variables_create(...)`, `containers_workspaces_built_in_variables_delete(...)`, `containers_workspaces_built_in_variables_list(...)`, `containers_workspaces_built_in_variables_revert(...)`, `containers_workspaces_create(...)`, `containers_workspaces_create_version(...)`, `containers_workspaces_delete(...)`, `containers_workspaces_folders_create(...)`, `containers_workspaces_folders_delete(...)`, `containers_workspaces_folders_entities(...)`, `containers_workspaces_folders_get(...)`, `containers_workspaces_folders_list(...)`, `containers_workspaces_folders_move_entities_to_folder(...)`, `containers_workspaces_folders_revert(...)`, `containers_workspaces_folders_update(...)`, `containers_workspaces_get(...)`, `containers_workspaces_get_proposal(...)`, `containers_workspaces_get_status(...)`, `containers_workspaces_list(...)`, `containers_workspaces_proposal_create(...)`, `containers_workspaces_proposal_delete(...)`, `containers_workspaces_quick_preview(...)`, `containers_workspaces_resolve_conflict(...)`, `containers_workspaces_sync(...)`, `containers_workspaces_tags_create(...)`, `containers_workspaces_tags_delete(...)`, `containers_workspaces_tags_get(...)`, `containers_workspaces_tags_list(...)`, `containers_workspaces_tags_revert(...)`, `containers_workspaces_tags_update(...)`, `containers_workspaces_triggers_create(...)`, `containers_workspaces_triggers_delete(...)`, `containers_workspaces_triggers_get(...)`, `containers_workspaces_triggers_list(...)`, `containers_workspaces_triggers_revert(...)`, `containers_workspaces_triggers_update(...)`, `containers_workspaces_update(...)`, `containers_workspaces_update_proposal(...)`, `containers_workspaces_variables_create(...)`, `containers_workspaces_variables_delete(...)`, `containers_workspaces_variables_get(...)`, `containers_workspaces_variables_list(...)`, `containers_workspaces_variables_revert(...)`, `containers_workspaces_variables_update(...)`, `get(...)`, `list(...)`, `update(...)`, `user_permissions_create(...)`, `user_permissions_delete(...)`, `user_permissions_get(...)`, `user_permissions_list(...)` and `user_permissions_update(...)` +/// // like `containers_create(...)`, `containers_delete(...)`, `containers_environments_create(...)`, `containers_environments_delete(...)`, `containers_environments_get(...)`, `containers_environments_list(...)`, `containers_environments_reauthorize(...)`, `containers_environments_update(...)`, `containers_get(...)`, `containers_list(...)`, `containers_update(...)`, `containers_version_headers_latest(...)`, `containers_version_headers_list(...)`, `containers_versions_delete(...)`, `containers_versions_get(...)`, `containers_versions_live(...)`, `containers_versions_publish(...)`, `containers_versions_set_latest(...)`, `containers_versions_undelete(...)`, `containers_versions_update(...)`, `containers_workspaces_built_in_variables_create(...)`, `containers_workspaces_built_in_variables_delete(...)`, `containers_workspaces_built_in_variables_list(...)`, `containers_workspaces_built_in_variables_revert(...)`, `containers_workspaces_create(...)`, `containers_workspaces_create_version(...)`, `containers_workspaces_delete(...)`, `containers_workspaces_folders_create(...)`, `containers_workspaces_folders_delete(...)`, `containers_workspaces_folders_entities(...)`, `containers_workspaces_folders_get(...)`, `containers_workspaces_folders_list(...)`, `containers_workspaces_folders_move_entities_to_folder(...)`, `containers_workspaces_folders_revert(...)`, `containers_workspaces_folders_update(...)`, `containers_workspaces_get(...)`, `containers_workspaces_get_status(...)`, `containers_workspaces_list(...)`, `containers_workspaces_quick_preview(...)`, `containers_workspaces_resolve_conflict(...)`, `containers_workspaces_sync(...)`, `containers_workspaces_tags_create(...)`, `containers_workspaces_tags_delete(...)`, `containers_workspaces_tags_get(...)`, `containers_workspaces_tags_list(...)`, `containers_workspaces_tags_revert(...)`, `containers_workspaces_tags_update(...)`, `containers_workspaces_triggers_create(...)`, `containers_workspaces_triggers_delete(...)`, `containers_workspaces_triggers_get(...)`, `containers_workspaces_triggers_list(...)`, `containers_workspaces_triggers_revert(...)`, `containers_workspaces_triggers_update(...)`, `containers_workspaces_update(...)`, `containers_workspaces_variables_create(...)`, `containers_workspaces_variables_delete(...)`, `containers_workspaces_variables_get(...)`, `containers_workspaces_variables_list(...)`, `containers_workspaces_variables_revert(...)`, `containers_workspaces_variables_update(...)`, `containers_workspaces_zones_create(...)`, `containers_workspaces_zones_delete(...)`, `containers_workspaces_zones_get(...)`, `containers_workspaces_zones_list(...)`, `containers_workspaces_zones_revert(...)`, `containers_workspaces_zones_update(...)`, `get(...)`, `list(...)`, `update(...)`, `user_permissions_create(...)`, `user_permissions_delete(...)`, `user_permissions_get(...)`, `user_permissions_list(...)` and `user_permissions_update(...)` /// // to build up your call. /// let rb = hub.accounts(); /// # } @@ -2199,15 +2173,17 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a Workspace. + /// Creates a GTM Zone. /// /// # Arguments /// - /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} - pub fn containers_workspaces_get(&self, path: &str) -> AccountContainerWorkspaceGetCall<'a, C, A> { - AccountContainerWorkspaceGetCall { + /// * `request` - No description provided. + /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} + pub fn containers_workspaces_zones_create(&self, request: Zone, parent: &str) -> AccountContainerWorkspaceZoneCreateCall<'a, C, A> { + AccountContainerWorkspaceZoneCreateCall { hub: self.hub, - _path: path.to_string(), + _request: request, + _parent: parent.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2380,6 +2356,24 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Reverts changes to a GTM Zone in a GTM Workspace. + /// + /// # Arguments + /// + /// * `path` - GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id} + pub fn containers_workspaces_zones_revert(&self, path: &str) -> AccountContainerWorkspaceZoneRevertCall<'a, C, A> { + AccountContainerWorkspaceZoneRevertCall { + hub: self.hub, + _path: path.to_string(), + _fingerprint: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates a GTM Tag. @@ -2416,6 +2410,23 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets a Workspace. + /// + /// # Arguments + /// + /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} + pub fn containers_workspaces_get(&self, path: &str) -> AccountContainerWorkspaceGetCall<'a, C, A> { + AccountContainerWorkspaceGetCall { + hub: self.hub, + _path: path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Gets a Container. @@ -2508,16 +2519,19 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a GTM Workspace Proposal. + /// Creates a Workspace. /// /// # Arguments /// - /// * `path` - GTM workspace proposal's relative path: Example: accounts/{aid}/containers/{cid}/workspace/{wid}/workspace_proposal - pub fn containers_workspaces_get_proposal(&self, path: &str) -> AccountContainerWorkspaceGetProposalCall<'a, C, A> { - AccountContainerWorkspaceGetProposalCall { + /// * `request` - No description provided. + /// * `parent` - GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id} + pub fn containers_workspaces_create(&self, request: Workspace, parent: &str) -> AccountContainerWorkspaceCreateCall<'a, C, A> { + AccountContainerWorkspaceCreateCall { hub: self.hub, - _path: path.to_string(), + _request: request, + _parent: parent.to_string(), _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -2683,16 +2697,35 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists all GTM Triggers of a Container. + /// Updates a GTM Zone. /// /// # Arguments /// - /// * `parent` - GTM Workspaces's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} - pub fn containers_workspaces_triggers_list(&self, parent: &str) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> { - AccountContainerWorkspaceTriggerListCall { + /// * `request` - No description provided. + /// * `path` - GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id} + pub fn containers_workspaces_zones_update(&self, request: Zone, path: &str) -> AccountContainerWorkspaceZoneUpdateCall<'a, C, A> { + AccountContainerWorkspaceZoneUpdateCall { hub: self.hub, - _parent: parent.to_string(), - _page_token: Default::default(), + _request: request, + _path: path.to_string(), + _fingerprint: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a GTM Zone. + /// + /// # Arguments + /// + /// * `path` - GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id} + pub fn containers_workspaces_zones_get(&self, path: &str) -> AccountContainerWorkspaceZoneGetCall<'a, C, A> { + AccountContainerWorkspaceZoneGetCall { + hub: self.hub, + _path: path.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2737,17 +2770,15 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a Workspace. + /// Deletes a Container Version. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `parent` - GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id} - pub fn containers_workspaces_create(&self, request: Workspace, parent: &str) -> AccountContainerWorkspaceCreateCall<'a, C, A> { - AccountContainerWorkspaceCreateCall { + /// * `path` - GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id} + pub fn containers_versions_delete(&self, path: &str) -> AccountContainerVersionDeleteCall<'a, C, A> { + AccountContainerVersionDeleteCall { hub: self.hub, - _request: request, - _parent: parent.to_string(), + _path: path.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2811,6 +2842,24 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Lists all GTM Triggers of a Container. + /// + /// # Arguments + /// + /// * `parent` - GTM Workspaces's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} + pub fn containers_workspaces_triggers_list(&self, parent: &str) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> { + AccountContainerWorkspaceTriggerListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates a user's Account & Container access. @@ -2832,15 +2881,16 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a GTM Environment. + /// Lists all GTM Zones of a GTM container workspace. /// /// # Arguments /// - /// * `path` - GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id} - pub fn containers_environments_get(&self, path: &str) -> AccountContainerEnvironmentGetCall<'a, C, A> { - AccountContainerEnvironmentGetCall { + /// * `parent` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} + pub fn containers_workspaces_zones_list(&self, parent: &str) -> AccountContainerWorkspaceZoneListCall<'a, C, A> { + AccountContainerWorkspaceZoneListCall { hub: self.hub, - _path: path.to_string(), + _parent: parent.to_string(), + _page_token: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2930,6 +2980,23 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes a GTM Zone. + /// + /// # Arguments + /// + /// * `path` - GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id} + pub fn containers_workspaces_zones_delete(&self, path: &str) -> AccountContainerWorkspaceZoneDeleteCall<'a, C, A> { + AccountContainerWorkspaceZoneDeleteCall { + hub: self.hub, + _path: path.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// List all entities in a GTM Folder. @@ -2967,23 +3034,6 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Finds conflicting and modified entities in the workspace. - /// - /// # Arguments - /// - /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} - pub fn containers_workspaces_get_status(&self, path: &str) -> AccountContainerWorkspaceGetStatuCall<'a, C, A> { - AccountContainerWorkspaceGetStatuCall { - hub: self.hub, - _path: path.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Deletes a GTM Tag. @@ -3023,18 +3073,15 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a GTM Environment. This method supports patch semantics. + /// Gets a GTM Environment. /// /// # Arguments /// - /// * `request` - No description provided. /// * `path` - GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id} - pub fn containers_environments_patch(&self, request: Environment, path: &str) -> AccountContainerEnvironmentPatchCall<'a, C, A> { - AccountContainerEnvironmentPatchCall { + pub fn containers_environments_get(&self, path: &str) -> AccountContainerEnvironmentGetCall<'a, C, A> { + AccountContainerEnvironmentGetCall { hub: self.hub, - _request: request, _path: path.to_string(), - _fingerprint: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3079,22 +3126,6 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Deletes a GTM Workspace Proposal. - /// - /// # Arguments - /// - /// * `path` - GTM workspace proposal's relative path: Example: accounts/{aid}/containers/{cid}/workspace/{wid}/workspace_proposal - pub fn containers_workspaces_proposal_delete(&self, path: &str) -> AccountContainerWorkspaceProposalDeleteCall<'a, C, A> { - AccountContainerWorkspaceProposalDeleteCall { - hub: self.hub, - _path: path.to_string(), - _delegate: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Lists all Containers that belongs to a GTM Account. @@ -3165,23 +3196,6 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Deletes a Container Version. - /// - /// # Arguments - /// - /// * `path` - GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id} - pub fn containers_versions_delete(&self, path: &str) -> AccountContainerVersionDeleteCall<'a, C, A> { - AccountContainerVersionDeleteCall { - hub: self.hub, - _path: path.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Updates a GTM Tag. @@ -3406,18 +3420,17 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a GTM Workspace Proposal. + /// Finds conflicting and modified entities in the workspace. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `parent` - GTM Workspace's API relative path. Example: accounts/{aid}/containers/{cid}/workspace/{wid} - pub fn containers_workspaces_proposal_create(&self, request: CreateWorkspaceProposalRequest, parent: &str) -> AccountContainerWorkspaceProposalCreateCall<'a, C, A> { - AccountContainerWorkspaceProposalCreateCall { + /// * `path` - GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} + pub fn containers_workspaces_get_status(&self, path: &str) -> AccountContainerWorkspaceGetStatuCall<'a, C, A> { + AccountContainerWorkspaceGetStatuCall { hub: self.hub, - _request: request, - _parent: parent.to_string(), + _path: path.to_string(), _delegate: Default::default(), + _scopes: Default::default(), _additional_params: Default::default(), } } @@ -3480,24 +3493,6 @@ impl<'a, C, A> AccountMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Updates a GTM Workspace Proposal. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `path` - GTM workspace proposal's relative path: Example: accounts/{aid}/containers/{cid}/workspace/{wid}/workspace_proposal - pub fn containers_workspaces_update_proposal(&self, request: UpdateWorkspaceProposalRequest, path: &str) -> AccountContainerWorkspaceUpdateProposalCall<'a, C, A> { - AccountContainerWorkspaceUpdateProposalCall { - hub: self.hub, - _request: request, - _path: path.to_string(), - _delegate: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Removes a user from the account, revoking access to it and all of its containers. @@ -3524,9 +3519,9 @@ impl<'a, C, A> AccountMethods<'a, C, A> { // CallBuilders ### // ################# -/// Gets a Workspace. +/// Creates a GTM Zone. /// -/// A builder for the *containers.workspaces.get* method supported by a *account* resource. +/// A builder for the *containers.workspaces.zones.create* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. /// /// # Example @@ -3538,6 +3533,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_tagmanager2 as tagmanager2; +/// use tagmanager2::Zone; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -3548,30 +3544,36 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Zone::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_workspaces_get("path") +/// let result = hub.accounts().containers_workspaces_zones_create(req, "parent") /// .doit(); /// # } /// ``` -pub struct AccountContainerWorkspaceGetCall<'a, C, A> +pub struct AccountContainerWorkspaceZoneCreateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TagManager, - _path: String, + _request: Zone, + _parent: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountContainerWorkspaceGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountContainerWorkspaceZoneCreateCall<'a, C, A> {} -impl<'a, C, A> AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountContainerWorkspaceZoneCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Workspace)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Zone)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -3580,11 +3582,11 @@ impl<'a, C, A> AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("path", self._path.to_string())); - for &field in ["alt", "path"].iter() { + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.zones.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -3596,12 +3598,12 @@ impl<'a, C, A> AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["path"].iter() { + for param_name in ["parent"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -3626,11 +3628,19 @@ impl<'a, C, A> AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -3647,11 +3657,15 @@ impl<'a, C, A> AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceGetCall<'a, C, A> { - self._path = new_value.to_string(); + pub fn request(mut self, new_value: Zone) -> AccountContainerWorkspaceZoneCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceZoneCreateCall<'a, C, A> { + self._parent = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -3718,7 +3741,7 @@ impl<'a, C, A> AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceZoneCreateCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -3727,7 +3750,7 @@ impl<'a, C, A> AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AccountContainerWorkspaceGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneCreateCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -3748,7 +3771,7 @@ impl<'a, C, A> AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerWorkspaceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceZoneCreateCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -3884,7 +3907,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C, A> } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -3900,10 +3923,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C, A> } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3935,7 +3955,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C, A> request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4039,7 +4059,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderMoveEntitiesToFolderCall<'a, C, A> /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4169,7 +4189,7 @@ impl<'a, C, A> AccountContainerVersionHeaderLatestCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4185,10 +4205,7 @@ impl<'a, C, A> AccountContainerVersionHeaderLatestCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4208,7 +4225,7 @@ impl<'a, C, A> AccountContainerVersionHeaderLatestCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4286,7 +4303,7 @@ impl<'a, C, A> AccountContainerVersionHeaderLatestCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4423,7 +4440,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerCreateCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4439,10 +4456,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerCreateCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4474,7 +4488,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerCreateCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4564,7 +4578,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerCreateCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4699,7 +4713,7 @@ impl<'a, C, A> AccountContainerWorkspaceListCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4738,7 +4749,7 @@ impl<'a, C, A> AccountContainerWorkspaceListCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceListCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C, A> wher } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -4974,10 +4985,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C, A> wher } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4997,7 +5005,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C, A> wher let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5082,7 +5090,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableRevertCall<'a, C, A> wher /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5218,7 +5226,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C, A> wher } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5234,10 +5242,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C, A> wher } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5257,7 +5262,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C, A> wher let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5333,7 +5338,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableDeleteCall<'a, C, A> wher /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5470,7 +5475,7 @@ impl<'a, C, A> AccountContainerEnvironmentCreateCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5486,10 +5491,7 @@ impl<'a, C, A> AccountContainerEnvironmentCreateCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5521,7 +5523,7 @@ impl<'a, C, A> AccountContainerEnvironmentCreateCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5611,7 +5613,7 @@ impl<'a, C, A> AccountContainerEnvironmentCreateCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5746,7 +5748,7 @@ impl<'a, C, A> AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5785,7 +5784,7 @@ impl<'a, C, A> AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceFolderGetCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6016,10 +6015,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderGetCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6039,7 +6035,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderGetCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6117,7 +6113,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderGetCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6161,6 +6157,262 @@ impl<'a, C, A> AccountContainerWorkspaceFolderGetCall<'a, C, A> where C: BorrowM } +/// Reverts changes to a GTM Zone in a GTM Workspace. +/// +/// A builder for the *containers.workspaces.zones.revert* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_tagmanager2 as tagmanager2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use tagmanager2::TagManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().containers_workspaces_zones_revert("path") +/// .fingerprint("aliquyam") +/// .doit(); +/// # } +/// ``` +pub struct AccountContainerWorkspaceZoneRevertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a TagManager, + _path: String, + _fingerprint: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountContainerWorkspaceZoneRevertCall<'a, C, A> {} + +impl<'a, C, A> AccountContainerWorkspaceZoneRevertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RevertZoneResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.zones.revert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("path", self._path.to_string())); + if let Some(value) = self._fingerprint { + params.push(("fingerprint", value.to_string())); + } + for &field in ["alt", "path", "fingerprint"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{+path}:revert"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::EditContainer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+path}", "path")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["path"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id} + /// + /// Sets the *path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneRevertCall<'a, C, A> { + self._path = new_value.to_string(); + self + } + /// When provided, this fingerprint must match the fingerprint of the zone in storage. + /// + /// Sets the *fingerprint* query property to the given value. + pub fn fingerprint(mut self, new_value: &str) -> AccountContainerWorkspaceZoneRevertCall<'a, C, A> { + self._fingerprint = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceZoneRevertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneRevertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::EditContainer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceZoneRevertCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates a GTM Tag. /// /// A builder for the *containers.workspaces.tags.create* method supported by a *account* resource. @@ -6254,7 +6506,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagCreateCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6270,10 +6522,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagCreateCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6305,7 +6554,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagCreateCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6395,7 +6644,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagCreateCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6524,7 +6773,7 @@ impl<'a, C, A> AccountContainerEnvironmentDeleteCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -6540,10 +6789,7 @@ impl<'a, C, A> AccountContainerEnvironmentDeleteCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6563,7 +6809,7 @@ impl<'a, C, A> AccountContainerEnvironmentDeleteCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6631,7 +6877,7 @@ impl<'a, C, A> AccountContainerEnvironmentDeleteCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6675,6 +6921,250 @@ impl<'a, C, A> AccountContainerEnvironmentDeleteCall<'a, C, A> where C: BorrowMu } +/// Gets a Workspace. +/// +/// A builder for the *containers.workspaces.get* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_tagmanager2 as tagmanager2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use tagmanager2::TagManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().containers_workspaces_get("path") +/// .doit(); +/// # } +/// ``` +pub struct AccountContainerWorkspaceGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a TagManager, + _path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountContainerWorkspaceGetCall<'a, C, A> {} + +impl<'a, C, A> AccountContainerWorkspaceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Workspace)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("path", self._path.to_string())); + for &field in ["alt", "path"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{+path}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+path}", "path")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["path"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} + /// + /// Sets the *path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGetCall<'a, C, A> { + self._path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Gets a Container. /// /// A builder for the *containers.get* method supported by a *account* resource. @@ -6761,7 +7251,7 @@ impl<'a, C, A> AccountContainerGetCall<'a, C, A> where C: BorrowMut AccountContainerGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -6800,7 +7287,7 @@ impl<'a, C, A> AccountContainerGetCall<'a, C, A> where C: BorrowMut AccountContainerGetCall<'a, C, A> where C: BorrowMut AccountUserPermissionCreateCall<'a, C, A> where C: BorrowMut AccountUserPermissionCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7066,7 +7550,7 @@ impl<'a, C, A> AccountUserPermissionCreateCall<'a, C, A> where C: BorrowMut AccountUserPermissionCreateCall<'a, C, A> where C: BorrowMut AccountUserPermissionCreateCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceFolderListCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7307,10 +7791,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderListCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7330,7 +7811,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderListCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7415,7 +7896,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderListCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7552,7 +8033,7 @@ impl<'a, C, A> AccountContainerEnvironmentReauthorizeCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7568,10 +8049,7 @@ impl<'a, C, A> AccountContainerEnvironmentReauthorizeCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7603,7 +8081,7 @@ impl<'a, C, A> AccountContainerEnvironmentReauthorizeCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7693,7 +8171,7 @@ impl<'a, C, A> AccountContainerEnvironmentReauthorizeCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7822,7 +8300,7 @@ impl<'a, C, A> AccountContainerWorkspaceDeleteCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -7838,10 +8316,7 @@ impl<'a, C, A> AccountContainerWorkspaceDeleteCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7861,7 +8336,7 @@ impl<'a, C, A> AccountContainerWorkspaceDeleteCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7929,7 +8404,7 @@ impl<'a, C, A> AccountContainerWorkspaceDeleteCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7973,9 +8448,9 @@ impl<'a, C, A> AccountContainerWorkspaceDeleteCall<'a, C, A> where C: BorrowMut< } -/// Gets a GTM Workspace Proposal. +/// Creates a Workspace. /// -/// A builder for the *containers.workspaces.getProposal* method supported by a *account* resource. +/// A builder for the *containers.workspaces.create* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. /// /// # Example @@ -7987,6 +8462,7 @@ impl<'a, C, A> AccountContainerWorkspaceDeleteCall<'a, C, A> where C: BorrowMut< /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_tagmanager2 as tagmanager2; +/// use tagmanager2::Workspace; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -7997,29 +8473,36 @@ impl<'a, C, A> AccountContainerWorkspaceDeleteCall<'a, C, A> where C: BorrowMut< /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Workspace::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_workspaces_get_proposal("path") +/// let result = hub.accounts().containers_workspaces_create(req, "parent") /// .doit(); /// # } /// ``` -pub struct AccountContainerWorkspaceGetProposalCall<'a, C, A> +pub struct AccountContainerWorkspaceCreateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TagManager, - _path: String, + _request: Workspace, + _parent: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountContainerWorkspaceGetProposalCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountContainerWorkspaceCreateCall<'a, C, A> {} -impl<'a, C, A> AccountContainerWorkspaceGetProposalCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, WorkspaceProposal)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Workspace)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -8028,11 +8511,11 @@ impl<'a, C, A> AccountContainerWorkspaceGetProposalCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.getProposal", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("path", self._path.to_string())); - for &field in ["alt", "path"].iter() { + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -8044,21 +8527,12 @@ impl<'a, C, A> AccountContainerWorkspaceGetProposalCall<'a, C, A> where C: Borro params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "{+path}"; - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + let mut url = self.hub._base_url.clone() + "{+parent}/workspaces"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::EditContainer.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+path}", "path")].iter() { + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { let mut replace_with = String::new(); for &(name, ref value) in params.iter() { if name == param_name { @@ -8067,13 +8541,13 @@ impl<'a, C, A> AccountContainerWorkspaceGetProposalCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["path"].iter() { + for param_name in ["parent"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -8083,18 +8557,44 @@ impl<'a, C, A> AccountContainerWorkspaceGetProposalCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -8145,14 +8645,23 @@ impl<'a, C, A> AccountContainerWorkspaceGetProposalCall<'a, C, A> where C: Borro } - /// GTM workspace proposal's relative path: Example: accounts/{aid}/containers/{cid}/workspace/{wid}/workspace_proposal /// - /// Sets the *path* path property to the given value. + /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGetProposalCall<'a, C, A> { - self._path = new_value.to_string(); + pub fn request(mut self, new_value: Workspace) -> AccountContainerWorkspaceCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id} + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceCreateCall<'a, C, A> { + self._parent = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -8161,7 +8670,7 @@ impl<'a, C, A> AccountContainerWorkspaceGetProposalCall<'a, C, A> where C: Borro /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceGetProposalCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceCreateCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -8170,7 +8679,7 @@ impl<'a, C, A> AccountContainerWorkspaceGetProposalCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8182,12 +8691,35 @@ impl<'a, C, A> AccountContainerWorkspaceGetProposalCall<'a, C, A> where C: Borro /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceGetProposalCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceCreateCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::EditContainer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } } @@ -8219,7 +8751,7 @@ impl<'a, C, A> AccountContainerWorkspaceGetProposalCall<'a, C, A> where C: Borro /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().user_permissions_list("parent") -/// .page_token("amet") +/// .page_token("eirmod") /// .doit(); /// # } /// ``` @@ -8282,7 +8814,7 @@ impl<'a, C, A> AccountUserPermissionListCall<'a, C, A> where C: BorrowMut AccountUserPermissionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8321,7 +8850,7 @@ impl<'a, C, A> AccountUserPermissionListCall<'a, C, A> where C: BorrowMut AccountUserPermissionListCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceFolderDeleteCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8551,10 +9080,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderDeleteCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8574,7 +9100,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderDeleteCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8642,7 +9168,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderDeleteCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8772,7 +9298,7 @@ impl<'a, C, A> AccountContainerWorkspaceQuickPreviewCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -8788,10 +9314,7 @@ impl<'a, C, A> AccountContainerWorkspaceQuickPreviewCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8811,7 +9334,7 @@ impl<'a, C, A> AccountContainerWorkspaceQuickPreviewCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8889,7 +9412,7 @@ impl<'a, C, A> AccountContainerWorkspaceQuickPreviewCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9019,7 +9542,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableGetCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9035,10 +9558,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableGetCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9058,7 +9578,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableGetCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9136,7 +9656,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableGetCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9266,7 +9786,7 @@ impl<'a, C, A> AccountContainerVersionSetLatestCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9282,10 +9802,7 @@ impl<'a, C, A> AccountContainerVersionSetLatestCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9305,7 +9822,7 @@ impl<'a, C, A> AccountContainerVersionSetLatestCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9383,7 +9900,7 @@ impl<'a, C, A> AccountContainerVersionSetLatestCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9461,7 +9978,7 @@ impl<'a, C, A> AccountContainerVersionSetLatestCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_workspaces_variables_update(req, "path") -/// .fingerprint("aliquyam") +/// .fingerprint("sea") /// .doit(); /// # } /// ``` @@ -9525,7 +10042,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableUpdateCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9541,10 +10058,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableUpdateCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9576,7 +10090,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableUpdateCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9673,7 +10187,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableUpdateCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -9745,7 +10259,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableUpdateCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_environments_list("parent") -/// .page_token("Lorem") +/// .page_token("duo") /// .doit(); /// # } /// ``` @@ -9808,7 +10322,7 @@ impl<'a, C, A> AccountContainerEnvironmentListCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -9824,10 +10338,7 @@ impl<'a, C, A> AccountContainerEnvironmentListCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9847,7 +10358,7 @@ impl<'a, C, A> AccountContainerEnvironmentListCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9932,7 +10443,7 @@ impl<'a, C, A> AccountContainerEnvironmentListCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10004,7 +10515,7 @@ impl<'a, C, A> AccountContainerEnvironmentListCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_workspaces_tags_list("parent") -/// .page_token("et") +/// .page_token("eirmod") /// .doit(); /// # } /// ``` @@ -10067,7 +10578,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagListCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10083,10 +10594,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagListCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10106,7 +10614,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10191,7 +10699,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10321,7 +10829,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10337,10 +10845,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10360,7 +10865,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10438,7 +10943,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10482,9 +10987,296 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< } -/// Lists all GTM Triggers of a Container. +/// Updates a GTM Zone. /// -/// A builder for the *containers.workspaces.triggers.list* method supported by a *account* resource. +/// A builder for the *containers.workspaces.zones.update* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_tagmanager2 as tagmanager2; +/// use tagmanager2::Zone; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use tagmanager2::TagManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Zone::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().containers_workspaces_zones_update(req, "path") +/// .fingerprint("amet") +/// .doit(); +/// # } +/// ``` +pub struct AccountContainerWorkspaceZoneUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a TagManager, + _request: Zone, + _path: String, + _fingerprint: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountContainerWorkspaceZoneUpdateCall<'a, C, A> {} + +impl<'a, C, A> AccountContainerWorkspaceZoneUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Zone)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.zones.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("path", self._path.to_string())); + if let Some(value) = self._fingerprint { + params.push(("fingerprint", value.to_string())); + } + for &field in ["alt", "path", "fingerprint"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{+path}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::EditContainer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+path}", "path")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["path"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Zone) -> AccountContainerWorkspaceZoneUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id} + /// + /// Sets the *path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneUpdateCall<'a, C, A> { + self._path = new_value.to_string(); + self + } + /// When provided, this fingerprint must match the fingerprint of the zone in storage. + /// + /// Sets the *fingerprint* query property to the given value. + pub fn fingerprint(mut self, new_value: &str) -> AccountContainerWorkspaceZoneUpdateCall<'a, C, A> { + self._fingerprint = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceZoneUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::EditContainer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceZoneUpdateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets a GTM Zone. +/// +/// A builder for the *containers.workspaces.zones.get* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. /// /// # Example @@ -10509,29 +11301,27 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_workspaces_triggers_list("parent") -/// .page_token("eirmod") +/// let result = hub.accounts().containers_workspaces_zones_get("path") /// .doit(); /// # } /// ``` -pub struct AccountContainerWorkspaceTriggerListCall<'a, C, A> +pub struct AccountContainerWorkspaceZoneGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TagManager, - _parent: String, - _page_token: Option, + _path: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountContainerWorkspaceTriggerListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountContainerWorkspaceZoneGetCall<'a, C, A> {} -impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountContainerWorkspaceZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListTriggersResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Zone)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -10540,14 +11330,11 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.triggers.list", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.zones.get", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - for &field in ["alt", "parent", "pageToken"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("path", self._path.to_string())); + for &field in ["alt", "path"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -10559,12 +11346,12 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: Borro params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "{+parent}/triggers"; + let mut url = self.hub._base_url.clone() + "{+path}"; if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + for &(find_this, param_name) in [("{+path}", "path")].iter() { let mut replace_with = String::new(); for &(name, ref value) in params.iter() { if name == param_name { @@ -10573,13 +11360,13 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { + for param_name in ["path"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -10589,10 +11376,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10612,7 +11396,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10665,21 +11449,14 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: Borro } - /// GTM Workspaces's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} + /// GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id} /// - /// Sets the *parent* path property to the given value. + /// Sets the *path* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> { - self._parent = new_value.to_string(); - self - } - /// Continuation token for fetching the next page of results. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); + pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneGetCall<'a, C, A> { + self._path = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -10688,7 +11465,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: Borro /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceZoneGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -10697,7 +11474,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10709,7 +11486,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: Borro /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -10729,7 +11506,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: Borro /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceZoneGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -10834,7 +11611,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateVersionCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -10850,10 +11627,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateVersionCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10885,7 +11659,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateVersionCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10975,7 +11749,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateVersionCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11104,7 +11878,7 @@ impl<'a, C, A> AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11143,7 +11914,7 @@ impl<'a, C, A> AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Workspace::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_workspaces_create(req, "parent") +/// let result = hub.accounts().containers_versions_delete("path") /// .doit(); /// # } /// ``` -pub struct AccountContainerWorkspaceCreateCall<'a, C, A> +pub struct AccountContainerVersionDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TagManager, - _request: Workspace, - _parent: String, + _path: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountContainerWorkspaceCreateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountContainerVersionDeleteCall<'a, C, A> {} -impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Workspace)> { + pub fn doit(mut self) -> Result { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -11318,11 +12082,11 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(2 + self._additional_params.len()); + params.push(("path", self._path.to_string())); + for &field in ["path"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -11332,14 +12096,13 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< params.push((&name, value.clone())); } - params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "{+parent}/workspaces"; + let mut url = self.hub._base_url.clone() + "{+path}"; if self._scopes.len() == 0 { - self._scopes.insert(Scope::EditContainer.as_ref().to_string(), ()); + self._scopes.insert(Scope::EditContainerversion.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + for &(find_this, param_name) in [("{+path}", "path")].iter() { let mut replace_with = String::new(); for &(name, ref value) in params.iter() { if name == param_name { @@ -11348,13 +12111,13 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { + for param_name in ["path"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -11364,22 +12127,8 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -11396,15 +12145,11 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< } }; let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -11435,17 +12180,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< Ok(serr) => Err(Error::BadRequest(serr)) } } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; + let result_value = res; dlg.finished(true); return Ok(result_value) @@ -11455,23 +12190,14 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< } + /// GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id} /// - /// Sets the *request* property to the given value. + /// Sets the *path* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn request(mut self, new_value: Workspace) -> AccountContainerWorkspaceCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// GTM parent Container's API relative path. Example: accounts/{account_id}/containers/{container_id} - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceCreateCall<'a, C, A> { - self._parent = new_value.to_string(); + pub fn path(mut self, new_value: &str) -> AccountContainerVersionDeleteCall<'a, C, A> { + self._path = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -11480,7 +12206,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceCreateCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerVersionDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -11489,7 +12215,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11501,7 +12227,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceCreateCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountContainerVersionDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -11510,7 +12236,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::EditContainer`. + /// `Scope::EditContainerversion`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -11521,7 +12247,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVersionDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -11567,7 +12293,7 @@ impl<'a, C, A> AccountContainerWorkspaceCreateCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().update(req, "path") -/// .fingerprint("consetetur") +/// .fingerprint("dolor") /// .doit(); /// # } /// ``` @@ -11631,7 +12357,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11647,10 +12373,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -11682,7 +12405,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11779,7 +12502,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11851,8 +12574,8 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_version_headers_list("parent") -/// .page_token("ea") -/// .include_deleted(false) +/// .page_token("dolor") +/// .include_deleted(true) /// .doit(); /// # } /// ``` @@ -11919,7 +12642,7 @@ impl<'a, C, A> AccountContainerVersionHeaderListCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -11935,10 +12658,7 @@ impl<'a, C, A> AccountContainerVersionHeaderListCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11958,7 +12678,7 @@ impl<'a, C, A> AccountContainerVersionHeaderListCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12050,7 +12770,7 @@ impl<'a, C, A> AccountContainerVersionHeaderListCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12122,7 +12842,7 @@ impl<'a, C, A> AccountContainerVersionHeaderListCall<'a, C, A> where C: BorrowMu /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_workspaces_built_in_variables_list("parent") -/// .page_token("dolor") +/// .page_token("amet.") /// .doit(); /// # } /// ``` @@ -12185,7 +12905,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableListCall<'a, C, A> where } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12201,10 +12921,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableListCall<'a, C, A> where } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12224,7 +12941,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableListCall<'a, C, A> where let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12309,7 +13026,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableListCall<'a, C, A> where /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12353,6 +13070,262 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableListCall<'a, C, A> where } +/// Lists all GTM Triggers of a Container. +/// +/// A builder for the *containers.workspaces.triggers.list* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_tagmanager2 as tagmanager2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use tagmanager2::TagManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().containers_workspaces_triggers_list("parent") +/// .page_token("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct AccountContainerWorkspaceTriggerListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a TagManager, + _parent: String, + _page_token: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountContainerWorkspaceTriggerListCall<'a, C, A> {} + +impl<'a, C, A> AccountContainerWorkspaceTriggerListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListTriggersResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.triggers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + for &field in ["alt", "parent", "pageToken"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "{+parent}/triggers"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// GTM Workspaces's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Continuation token for fetching the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceTriggerListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Updates a user's Account & Container access. /// /// A builder for the *user_permissions.update* method supported by a *account* resource. @@ -12446,7 +13419,7 @@ impl<'a, C, A> AccountUserPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountUserPermissionUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12497,7 +13467,7 @@ impl<'a, C, A> AccountUserPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountUserPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountUserPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountUserPermissionUpdateCall<'a, C, A> where C: BorrowMut +pub struct AccountContainerWorkspaceZoneListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TagManager, - _path: String, + _parent: String, + _page_token: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountContainerEnvironmentGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountContainerWorkspaceZoneListCall<'a, C, A> {} -impl<'a, C, A> AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountContainerWorkspaceZoneListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Environment)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListZonesResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -12687,11 +13659,14 @@ impl<'a, C, A> AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.environments.get", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.zones.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("path", self._path.to_string())); - for &field in ["alt", "path"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + for &field in ["alt", "parent", "pageToken"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -12703,12 +13678,12 @@ impl<'a, C, A> AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["path"].iter() { + for param_name in ["parent"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -12733,10 +13708,7 @@ impl<'a, C, A> AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12756,7 +13728,7 @@ impl<'a, C, A> AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut AccountContainerEnvironmentGetCall<'a, C, A> { - self._path = new_value.to_string(); + pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceZoneListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// Continuation token for fetching the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountContainerWorkspaceZoneListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -12825,7 +13804,7 @@ impl<'a, C, A> AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut AccountContainerEnvironmentGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceZoneListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -12834,7 +13813,7 @@ impl<'a, C, A> AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> AccountContainerEnvironmentGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -12866,7 +13845,7 @@ impl<'a, C, A> AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerEnvironmentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceZoneListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -12964,7 +13943,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -12980,10 +13959,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13003,7 +13979,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13081,7 +14057,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13211,7 +14187,7 @@ impl<'a, C, A> AccountContainerVersionLiveCall<'a, C, A> where C: BorrowMut AccountContainerVersionLiveCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13250,7 +14223,7 @@ impl<'a, C, A> AccountContainerVersionLiveCall<'a, C, A> where C: BorrowMut AccountContainerVersionLiveCall<'a, C, A> where C: BorrowMut AccountContainerVersionLiveCall<'a, C, A> where C: BorrowMut AccountListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13475,7 +14445,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13550,7 +14520,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13622,7 +14592,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_workspaces_variables_list("parent") -/// .page_token("gubergren") +/// .page_token("sadipscing") /// .doit(); /// # } /// ``` @@ -13685,7 +14655,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableListCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -13701,10 +14671,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableListCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13724,7 +14691,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableListCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13809,7 +14776,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableListCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13881,7 +14848,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableListCall<'a, C, A> where C: Borr /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_workspaces_variables_revert("path") -/// .fingerprint("sit") +/// .fingerprint("sadipscing") /// .doit(); /// # } /// ``` @@ -13944,7 +14911,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableRevertCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -13960,10 +14927,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableRevertCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13983,7 +14947,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableRevertCall<'a, C, A> where C: Bo let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14068,7 +15032,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableRevertCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14112,6 +15076,239 @@ impl<'a, C, A> AccountContainerWorkspaceVariableRevertCall<'a, C, A> where C: Bo } +/// Deletes a GTM Zone. +/// +/// A builder for the *containers.workspaces.zones.delete* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_tagmanager2 as tagmanager2; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use tagmanager2::TagManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.accounts().containers_workspaces_zones_delete("path") +/// .doit(); +/// # } +/// ``` +pub struct AccountContainerWorkspaceZoneDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a TagManager, + _path: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountContainerWorkspaceZoneDeleteCall<'a, C, A> {} + +impl<'a, C, A> AccountContainerWorkspaceZoneDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.zones.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(2 + self._additional_params.len()); + params.push(("path", self._path.to_string())); + for &field in ["path"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "{+path}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::EditContainer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+path}", "path")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["path"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// GTM Zone's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id}/zones/{zone_id} + /// + /// Sets the *path* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceZoneDeleteCall<'a, C, A> { + self._path = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceZoneDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceZoneDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::EditContainer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceZoneDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// List all entities in a GTM Folder. /// /// A builder for the *containers.workspaces.folders.entities* method supported by a *account* resource. @@ -14140,7 +15337,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableRevertCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_workspaces_folders_entities("path") -/// .page_token("diam") +/// .page_token("dolore") /// .doit(); /// # } /// ``` @@ -14203,7 +15400,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderEntityCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -14219,10 +15416,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderEntityCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14242,7 +15436,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderEntityCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14327,7 +15521,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderEntityCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14464,7 +15658,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderCreateCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -14480,10 +15674,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderCreateCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14515,7 +15706,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderCreateCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14605,7 +15796,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderCreateCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14649,253 +15840,6 @@ impl<'a, C, A> AccountContainerWorkspaceFolderCreateCall<'a, C, A> where C: Borr } -/// Finds conflicting and modified entities in the workspace. -/// -/// A builder for the *containers.workspaces.getStatus* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_tagmanager2 as tagmanager2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use tagmanager2::TagManager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_workspaces_get_status("path") -/// .doit(); -/// # } -/// ``` -pub struct AccountContainerWorkspaceGetStatuCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a TagManager, - _path: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AccountContainerWorkspaceGetStatuCall<'a, C, A> {} - -impl<'a, C, A> AccountContainerWorkspaceGetStatuCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GetWorkspaceStatusResponse)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.getStatus", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("path", self._path.to_string())); - for &field in ["alt", "path"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{+path}/status"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+path}", "path")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["path"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} - /// - /// Sets the *path* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGetStatuCall<'a, C, A> { - self._path = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceGetStatuCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceGetStatuCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceGetStatuCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Deletes a GTM Tag. /// /// A builder for the *containers.workspaces.tags.delete* method supported by a *account* resource. @@ -14981,7 +15925,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagDeleteCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -14997,10 +15941,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagDeleteCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15020,7 +15961,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagDeleteCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15088,7 +16029,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagDeleteCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15166,7 +16107,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagDeleteCall<'a, C, A> where C: BorrowM /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_update(req, "path") -/// .fingerprint("sadipscing") +/// .fingerprint("et") /// .doit(); /// # } /// ``` @@ -15230,7 +16171,7 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15281,7 +16219,7 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = Environment::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_environments_patch(req, "path") -/// .fingerprint("consetetur") +/// let result = hub.accounts().containers_environments_get("path") /// .doit(); /// # } /// ``` -pub struct AccountContainerEnvironmentPatchCall<'a, C, A> +pub struct AccountContainerEnvironmentGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TagManager, - _request: Environment, _path: String, - _fingerprint: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountContainerEnvironmentPatchCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountContainerEnvironmentGetCall<'a, C, A> {} -impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountContainerEnvironmentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -15487,14 +16416,11 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.environments.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.environments.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); params.push(("path", self._path.to_string())); - if let Some(value) = self._fingerprint { - params.push(("fingerprint", value.to_string())); - } - for &field in ["alt", "path", "fingerprint"].iter() { + for &field in ["alt", "path"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -15508,7 +16434,7 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut let mut url = self.hub._base_url.clone() + "{+path}"; if self._scopes.len() == 0 { - self._scopes.insert(Scope::EditContainer.as_ref().to_string(), ()); + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{+path}", "path")].iter() { @@ -15520,7 +16446,7 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -15536,22 +16462,8 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -15568,15 +16480,11 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut } }; let auth_header = Authorization(Bearer { token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -15627,39 +16535,23 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut } - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Environment) -> AccountContainerEnvironmentPatchCall<'a, C, A> { - self._request = new_value; - self - } /// GTM Environment's API relative path. Example: accounts/{account_id}/containers/{container_id}/environments/{environment_id} /// /// Sets the *path* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn path(mut self, new_value: &str) -> AccountContainerEnvironmentPatchCall<'a, C, A> { + pub fn path(mut self, new_value: &str) -> AccountContainerEnvironmentGetCall<'a, C, A> { self._path = new_value.to_string(); self } - /// When provided, this fingerprint must match the fingerprint of the environment in storage. - /// - /// Sets the *fingerprint* query property to the given value. - pub fn fingerprint(mut self, new_value: &str) -> AccountContainerEnvironmentPatchCall<'a, C, A> { - self._fingerprint = Some(new_value.to_string()); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerEnvironmentPatchCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerEnvironmentGetCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -15668,7 +16560,7 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15680,7 +16572,7 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountContainerEnvironmentPatchCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountContainerEnvironmentGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -15689,7 +16581,7 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::EditContainer`. + /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -15700,7 +16592,7 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountContainerEnvironmentPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerEnvironmentGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -15746,7 +16638,7 @@ impl<'a, C, A> AccountContainerEnvironmentPatchCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_workspaces_folders_update(req, "path") -/// .fingerprint("duo") +/// .fingerprint("takimata") /// .doit(); /// # } /// ``` @@ -15810,7 +16702,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderUpdateCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -15826,10 +16718,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderUpdateCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15861,7 +16750,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderUpdateCall<'a, C, A> where C: Borr request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15958,7 +16847,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderUpdateCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16030,7 +16919,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderUpdateCall<'a, C, A> where C: Borr /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_workspaces_built_in_variables_create("parent") -/// .add_type("Lorem") +/// .add_type("kasd") /// .doit(); /// # } /// ``` @@ -16095,7 +16984,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C, A> wher } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -16111,10 +17000,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C, A> wher } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16134,7 +17020,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C, A> wher let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16220,7 +17106,7 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C, A> wher /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16264,213 +17150,6 @@ impl<'a, C, A> AccountContainerWorkspaceBuiltInVariableCreateCall<'a, C, A> wher } -/// Deletes a GTM Workspace Proposal. -/// -/// A builder for the *containers.workspaces.proposal.delete* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_tagmanager2 as tagmanager2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use tagmanager2::TagManager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_workspaces_proposal_delete("path") -/// .doit(); -/// # } -/// ``` -pub struct AccountContainerWorkspaceProposalDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a TagManager, - _path: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, -} - -impl<'a, C, A> CallBuilder for AccountContainerWorkspaceProposalDeleteCall<'a, C, A> {} - -impl<'a, C, A> AccountContainerWorkspaceProposalDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.proposal.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(2 + self._additional_params.len()); - params.push(("path", self._path.to_string())); - for &field in ["path"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = self.hub._base_url.clone() + "{+path}"; - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } - } - - for &(find_this, param_name) in [("{+path}", "path")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["path"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// GTM workspace proposal's relative path: Example: accounts/{aid}/containers/{cid}/workspace/{wid}/workspace_proposal - /// - /// Sets the *path* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceProposalDeleteCall<'a, C, A> { - self._path = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceProposalDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceProposalDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - -} - - /// Lists all Containers that belongs to a GTM Account. /// /// A builder for the *containers.list* method supported by a *account* resource. @@ -16499,7 +17178,7 @@ impl<'a, C, A> AccountContainerWorkspaceProposalDeleteCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_list("parent") -/// .page_token("consetetur") +/// .page_token("takimata") /// .doit(); /// # } /// ``` @@ -16562,7 +17241,7 @@ impl<'a, C, A> AccountContainerListCall<'a, C, A> where C: BorrowMut AccountContainerListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16601,7 +17277,7 @@ impl<'a, C, A> AccountContainerListCall<'a, C, A> where C: BorrowMut AccountContainerListCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceTriggerDeleteCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -16831,10 +17507,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerDeleteCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16854,7 +17527,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerDeleteCall<'a, C, A> where C: Bor let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16922,7 +17595,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerDeleteCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17052,7 +17725,7 @@ impl<'a, C, A> AccountContainerWorkspaceSyncCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceSyncCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17091,7 +17761,7 @@ impl<'a, C, A> AccountContainerWorkspaceSyncCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceSyncCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceSyncCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceTagRevertCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -17320,10 +17990,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagRevertCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17343,7 +18010,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagRevertCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17428,7 +18095,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagRevertCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17472,242 +18139,6 @@ impl<'a, C, A> AccountContainerWorkspaceTagRevertCall<'a, C, A> where C: BorrowM } -/// Deletes a Container Version. -/// -/// A builder for the *containers.versions.delete* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_tagmanager2 as tagmanager2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use tagmanager2::TagManager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_versions_delete("path") -/// .doit(); -/// # } -/// ``` -pub struct AccountContainerVersionDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a TagManager, - _path: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AccountContainerVersionDeleteCall<'a, C, A> {} - -impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(2 + self._additional_params.len()); - params.push(("path", self._path.to_string())); - for &field in ["path"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = self.hub._base_url.clone() + "{+path}"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::EditContainerversion.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+path}", "path")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["path"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(Bearer { token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// GTM ContainerVersion's API relative path. Example: accounts/{account_id}/containers/{container_id}/versions/{version_id} - /// - /// Sets the *path* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn path(mut self, new_value: &str) -> AccountContainerVersionDeleteCall<'a, C, A> { - self._path = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerVersionDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountContainerVersionDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::EditContainerversion`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// If `None` is specified, then all scopes will be removed and no default scope will be used either. - /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` - /// function for details). - /// - /// Usually there is more than one suitable scope to authorize an operation, some of which may - /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be - /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> AccountContainerVersionDeleteCall<'a, C, A> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - /// Updates a GTM Tag. /// /// A builder for the *containers.workspaces.tags.update* method supported by a *account* resource. @@ -17742,7 +18173,7 @@ impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceTagUpdateCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -17822,10 +18253,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagUpdateCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17857,7 +18285,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagUpdateCall<'a, C, A> where C: BorrowM request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17954,7 +18382,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagUpdateCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18091,7 +18519,7 @@ impl<'a, C, A> AccountContainerCreateCall<'a, C, A> where C: BorrowMut AccountContainerCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18142,7 +18567,7 @@ impl<'a, C, A> AccountContainerCreateCall<'a, C, A> where C: BorrowMut AccountContainerCreateCall<'a, C, A> where C: BorrowMut AccountContainerCreateCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceTriggerUpdateCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -18390,10 +18815,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerUpdateCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18425,7 +18847,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerUpdateCall<'a, C, A> where C: Bor request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18522,7 +18944,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerUpdateCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18659,7 +19081,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableCreateCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -18675,10 +19097,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableCreateCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18710,7 +19129,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableCreateCall<'a, C, A> where C: Bo request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18800,7 +19219,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableCreateCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18930,7 +19349,7 @@ impl<'a, C, A> AccountUserPermissionGetCall<'a, C, A> where C: BorrowMut AccountUserPermissionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18969,7 +19385,7 @@ impl<'a, C, A> AccountUserPermissionGetCall<'a, C, A> where C: BorrowMut AccountUserPermissionGetCall<'a, C, A> where C: BorrowMut AccountUserPermissionGetCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceTriggerRevertCall<'a, C, A> where C: Bor } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -19198,10 +19614,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerRevertCall<'a, C, A> where C: Bor } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19221,7 +19634,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerRevertCall<'a, C, A> where C: Bor let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19306,7 +19719,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerRevertCall<'a, C, A> where C: Bor /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19435,7 +19848,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableDeleteCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -19451,10 +19864,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableDeleteCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19474,7 +19884,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableDeleteCall<'a, C, A> where C: Bo let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19542,7 +19952,7 @@ impl<'a, C, A> AccountContainerWorkspaceVariableDeleteCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19672,7 +20082,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagGetCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -19688,10 +20098,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagGetCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19711,7 +20118,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagGetCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19789,7 +20196,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagGetCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19867,7 +20274,7 @@ impl<'a, C, A> AccountContainerWorkspaceTagGetCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_workspaces_resolve_conflict(req, "path") -/// .fingerprint("consetetur") +/// .fingerprint("gubergren") /// .doit(); /// # } /// ``` @@ -19930,7 +20337,7 @@ impl<'a, C, A> AccountContainerWorkspaceResolveConflictCall<'a, C, A> where C: B } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -19946,10 +20353,7 @@ impl<'a, C, A> AccountContainerWorkspaceResolveConflictCall<'a, C, A> where C: B } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19981,7 +20385,7 @@ impl<'a, C, A> AccountContainerWorkspaceResolveConflictCall<'a, C, A> where C: B request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20068,7 +20472,7 @@ impl<'a, C, A> AccountContainerWorkspaceResolveConflictCall<'a, C, A> where C: B /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20146,7 +20550,7 @@ impl<'a, C, A> AccountContainerWorkspaceResolveConflictCall<'a, C, A> where C: B /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_environments_update(req, "path") -/// .fingerprint("sed") +/// .fingerprint("eos") /// .doit(); /// # } /// ``` @@ -20210,7 +20614,7 @@ impl<'a, C, A> AccountContainerEnvironmentUpdateCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -20226,10 +20630,7 @@ impl<'a, C, A> AccountContainerEnvironmentUpdateCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20261,7 +20662,7 @@ impl<'a, C, A> AccountContainerEnvironmentUpdateCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20358,7 +20759,7 @@ impl<'a, C, A> AccountContainerEnvironmentUpdateCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20488,7 +20889,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerGetCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -20504,10 +20905,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerGetCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20527,7 +20925,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerGetCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20605,7 +21003,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerGetCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20677,7 +21075,7 @@ impl<'a, C, A> AccountContainerWorkspaceTriggerGetCall<'a, C, A> where C: Borrow /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_workspaces_folders_revert("path") -/// .fingerprint("aliquyam") +/// .fingerprint("labore") /// .doit(); /// # } /// ``` @@ -20740,7 +21138,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderRevertCall<'a, C, A> where C: Borr } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -20756,10 +21154,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderRevertCall<'a, C, A> where C: Borr } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20779,7 +21174,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderRevertCall<'a, C, A> where C: Borr let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20864,7 +21259,7 @@ impl<'a, C, A> AccountContainerWorkspaceFolderRevertCall<'a, C, A> where C: Borr /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20908,9 +21303,9 @@ impl<'a, C, A> AccountContainerWorkspaceFolderRevertCall<'a, C, A> where C: Borr } -/// Creates a GTM Workspace Proposal. +/// Finds conflicting and modified entities in the workspace. /// -/// A builder for the *containers.workspaces.proposal.create* method supported by a *account* resource. +/// A builder for the *containers.workspaces.getStatus* method supported by a *account* resource. /// It is not used directly, but through a `AccountMethods` instance. /// /// # Example @@ -20922,7 +21317,6 @@ impl<'a, C, A> AccountContainerWorkspaceFolderRevertCall<'a, C, A> where C: Borr /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_tagmanager2 as tagmanager2; -/// use tagmanager2::CreateWorkspaceProposalRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -20933,35 +21327,30 @@ impl<'a, C, A> AccountContainerWorkspaceFolderRevertCall<'a, C, A> where C: Borr /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = CreateWorkspaceProposalRequest::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_workspaces_proposal_create(req, "parent") +/// let result = hub.accounts().containers_workspaces_get_status("path") /// .doit(); /// # } /// ``` -pub struct AccountContainerWorkspaceProposalCreateCall<'a, C, A> +pub struct AccountContainerWorkspaceGetStatuCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TagManager, - _request: CreateWorkspaceProposalRequest, - _parent: String, + _path: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, + _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountContainerWorkspaceProposalCreateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AccountContainerWorkspaceGetStatuCall<'a, C, A> {} -impl<'a, C, A> AccountContainerWorkspaceProposalCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AccountContainerWorkspaceGetStatuCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, WorkspaceProposal)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GetWorkspaceStatusResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -20970,11 +21359,11 @@ impl<'a, C, A> AccountContainerWorkspaceProposalCreateCall<'a, C, A> where C: Bo Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.proposal.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("parent", self._parent.to_string())); - for &field in ["alt", "parent"].iter() { + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.getStatus", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("path", self._path.to_string())); + for &field in ["alt", "path"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -20986,21 +21375,12 @@ impl<'a, C, A> AccountContainerWorkspaceProposalCreateCall<'a, C, A> where C: Bo params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "{+parent}/proposal"; - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } + let mut url = self.hub._base_url.clone() + "{+path}/status"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + for &(find_this, param_name) in [("{+path}", "path")].iter() { let mut replace_with = String::new(); for &(name, ref value) in params.iter() { if name == param_name { @@ -21009,13 +21389,13 @@ impl<'a, C, A> AccountContainerWorkspaceProposalCreateCall<'a, C, A> where C: Bo } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["parent"].iter() { + for param_name in ["path"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -21025,33 +21405,29 @@ impl<'a, C, A> AccountContainerWorkspaceProposalCreateCall<'a, C, A> where C: Bo } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); + .header(auth_header.clone()); dlg.pre_request(); req.send() @@ -21102,23 +21478,14 @@ impl<'a, C, A> AccountContainerWorkspaceProposalCreateCall<'a, C, A> where C: Bo } + /// GTM Workspace's API relative path. Example: accounts/{account_id}/containers/{container_id}/workspaces/{workspace_id} /// - /// Sets the *request* property to the given value. + /// Sets the *path* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn request(mut self, new_value: CreateWorkspaceProposalRequest) -> AccountContainerWorkspaceProposalCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// GTM Workspace's API relative path. Example: accounts/{aid}/containers/{cid}/workspace/{wid} - /// - /// Sets the *parent* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> AccountContainerWorkspaceProposalCreateCall<'a, C, A> { - self._parent = new_value.to_string(); + pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceGetStatuCall<'a, C, A> { + self._path = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -21127,7 +21494,7 @@ impl<'a, C, A> AccountContainerWorkspaceProposalCreateCall<'a, C, A> where C: Bo /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceProposalCreateCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceGetStatuCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -21136,7 +21503,7 @@ impl<'a, C, A> AccountContainerWorkspaceProposalCreateCall<'a, C, A> where C: Bo /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21148,12 +21515,35 @@ impl<'a, C, A> AccountContainerWorkspaceProposalCreateCall<'a, C, A> where C: Bo /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceProposalCreateCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceGetStatuCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> AccountContainerWorkspaceGetStatuCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } } @@ -21191,7 +21581,7 @@ impl<'a, C, A> AccountContainerWorkspaceProposalCreateCall<'a, C, A> where C: Bo /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_versions_update(req, "path") -/// .fingerprint("sea") +/// .fingerprint("dolores") /// .doit(); /// # } /// ``` @@ -21255,7 +21645,7 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21306,7 +21693,7 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21577,7 +21961,7 @@ impl<'a, C, A> AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut AccountContainerWorkspaceUpdateCall<'a, C, A> where C: BorrowMut< } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -21820,10 +22204,7 @@ impl<'a, C, A> AccountContainerWorkspaceUpdateCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21855,7 +22236,7 @@ impl<'a, C, A> AccountContainerWorkspaceUpdateCall<'a, C, A> where C: BorrowMut< request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21952,7 +22333,7 @@ impl<'a, C, A> AccountContainerWorkspaceUpdateCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21996,255 +22377,6 @@ impl<'a, C, A> AccountContainerWorkspaceUpdateCall<'a, C, A> where C: BorrowMut< } -/// Updates a GTM Workspace Proposal. -/// -/// A builder for the *containers.workspaces.updateProposal* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_tagmanager2 as tagmanager2; -/// use tagmanager2::UpdateWorkspaceProposalRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use tagmanager2::TagManager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), -/// # ::default(), None); -/// # let mut hub = TagManager::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); -/// // As the method needs a request, you would usually fill it with the desired information -/// // into the respective structure. Some of the parts shown here might not be applicable ! -/// // Values shown here are possibly random and not representative ! -/// let mut req = UpdateWorkspaceProposalRequest::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `doit()`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.accounts().containers_workspaces_update_proposal(req, "path") -/// .doit(); -/// # } -/// ``` -pub struct AccountContainerWorkspaceUpdateProposalCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a TagManager, - _request: UpdateWorkspaceProposalRequest, - _path: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, -} - -impl<'a, C, A> CallBuilder for AccountContainerWorkspaceUpdateProposalCall<'a, C, A> {} - -impl<'a, C, A> AccountContainerWorkspaceUpdateProposalCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, WorkspaceProposal)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.workspaces.updateProposal", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("path", self._path.to_string())); - for &field in ["alt", "path"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "{+path}"; - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } - } - - for &(find_this, param_name) in [("{+path}", "path")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["path"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep(d); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: UpdateWorkspaceProposalRequest) -> AccountContainerWorkspaceUpdateProposalCall<'a, C, A> { - self._request = new_value; - self - } - /// GTM workspace proposal's relative path: Example: accounts/{aid}/containers/{cid}/workspace/{wid}/workspace_proposal - /// - /// Sets the *path* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn path(mut self, new_value: &str) -> AccountContainerWorkspaceUpdateProposalCall<'a, C, A> { - self._path = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> AccountContainerWorkspaceUpdateProposalCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountContainerWorkspaceUpdateProposalCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - -} - - /// Removes a user from the account, revoking access to it and all of its containers. /// /// A builder for the *user_permissions.delete* method supported by a *account* resource. @@ -22330,7 +22462,7 @@ impl<'a, C, A> AccountUserPermissionDeleteCall<'a, C, A> where C: BorrowMut AccountUserPermissionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22369,7 +22498,7 @@ impl<'a, C, A> AccountUserPermissionDeleteCall<'a, C, A> where C: BorrowMut AccountUserPermissionDeleteCall<'a, C, A> where C: BorrowMut TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -934,7 +931,7 @@ impl<'a, C, A> TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1029,7 +1026,7 @@ impl<'a, C, A> TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1187,10 +1184,7 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1210,7 +1204,7 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1332,7 +1326,7 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1483,10 +1477,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1518,7 +1509,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1618,7 +1609,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1763,10 +1754,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1786,7 +1774,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1874,7 +1862,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2029,10 +2017,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2064,7 +2049,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2182,7 +2167,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2326,10 +2311,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2349,7 +2331,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2437,7 +2419,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2583,10 +2565,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2606,7 +2585,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2704,7 +2683,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2859,10 +2838,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2894,7 +2870,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3012,7 +2988,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/tasks1-cli/Cargo.toml b/gen/tasks1-cli/Cargo.toml index 3291eaa1b1..628cacf691 100644 --- a/gen/tasks1-cli/Cargo.toml +++ b/gen/tasks1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-tasks1-cli" -version = "1.0.8+20141121" +version = "1.0.8+20190222" authors = ["Sebastian Thiel "] description = "A complete library to interact with tasks (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tasks1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-tasks1] path = "../tasks1" -version = "1.0.8+20141121" +version = "1.0.8+20190222" diff --git a/gen/tasks1-cli/README.md b/gen/tasks1-cli/README.md index 37c5254ce1..29d860db87 100644 --- a/gen/tasks1-cli/README.md +++ b/gen/tasks1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *tasks* API at revision *20141121*. The CLI is at version *1.0.8*. +This documentation was generated from the *tasks* API at revision *20190222*. The CLI is at version *1.0.8*. ```bash tasks1 [options] diff --git a/gen/tasks1-cli/mkdocs.yml b/gen/tasks1-cli/mkdocs.yml index 7703543175..e463bc007a 100644 --- a/gen/tasks1-cli/mkdocs.yml +++ b/gen/tasks1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: tasks v1.0.8+20141121 +site_name: tasks v1.0.8+20190222 site_url: http://byron.github.io/google-apis-rs/google-tasks1-cli site_description: A complete library to interact with tasks (protocol v1) diff --git a/gen/tasks1-cli/src/main.rs b/gen/tasks1-cli/src/main.rs index cd9371f96c..c5b5b1cfa4 100644 --- a/gen/tasks1-cli/src/main.rs +++ b/gen/tasks1-cli/src/main.rs @@ -1553,8 +1553,8 @@ fn main() { let mut app = App::new("tasks1") .author("Sebastian Thiel ") - .version("1.0.8+20141121") - .about("Lets you manage your tasks and task lists.") + .version("1.0.8+20190222") + .about("Manages your tasks and task lists.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_tasks1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/tasks1/Cargo.toml b/gen/tasks1/Cargo.toml index 75d01849c1..93da3131b5 100644 --- a/gen/tasks1/Cargo.toml +++ b/gen/tasks1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-tasks1" -version = "1.0.8+20141121" +version = "1.0.8+20190222" authors = ["Sebastian Thiel "] description = "A complete library to interact with tasks (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tasks1" homepage = "https://developers.google.com/google-apps/tasks/firstapp" -documentation = "https://docs.rs/google-tasks1/1.0.8+20141121" +documentation = "https://docs.rs/google-tasks1/1.0.8+20190222" license = "MIT" keywords = ["tasks", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/tasks1/README.md b/gen/tasks1/README.md index 9a52d75642..f05eadceb8 100644 --- a/gen/tasks1/README.md +++ b/gen/tasks1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-tasks1` library allows access to all features of the *Google tasks* service. -This documentation was generated from *tasks* crate version *1.0.8+20141121*, where *20141121* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *tasks* crate version *1.0.8+20190222*, where *20190222* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *tasks* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/tasks/firstapp). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TasksHub.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TasksHub.html) ... * tasklists - * [*delete*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TasklistDeleteCall.html), [*get*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TasklistGetCall.html), [*insert*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TasklistInsertCall.html), [*list*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TasklistListCall.html), [*patch*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TasklistPatchCall.html) and [*update*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TasklistUpdateCall.html) -* [tasks](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.Task.html) - * [*clear*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TaskClearCall.html), [*delete*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TaskDeleteCall.html), [*get*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TaskGetCall.html), [*insert*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TaskInsertCall.html), [*list*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TaskListCall.html), [*move*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TaskMoveCall.html), [*patch*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TaskPatchCall.html) and [*update*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TaskUpdateCall.html) + * [*delete*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TasklistDeleteCall.html), [*get*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TasklistGetCall.html), [*insert*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TasklistInsertCall.html), [*list*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TasklistListCall.html), [*patch*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TasklistPatchCall.html) and [*update*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TasklistUpdateCall.html) +* [tasks](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.Task.html) + * [*clear*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TaskClearCall.html), [*delete*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TaskDeleteCall.html), [*get*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TaskGetCall.html), [*insert*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TaskInsertCall.html), [*list*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TaskListCall.html), [*move*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TaskMoveCall.html), [*patch*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TaskPatchCall.html) and [*update*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TaskUpdateCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/struct.TasksHub.html)** +* **[Hub](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/struct.TasksHub.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.Part.html)** + * **[Parts](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -143,17 +143,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -163,29 +163,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-tasks1/1.0.8+20141121/google_tasks1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-tasks1/1.0.8+20190222/google_tasks1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/tasks1/src/lib.rs b/gen/tasks1/src/lib.rs index 342b7fa8a6..5ef2c2b4ee 100644 --- a/gen/tasks1/src/lib.rs +++ b/gen/tasks1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *tasks* crate version *1.0.8+20141121*, where *20141121* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *tasks* crate version *1.0.8+20190222*, where *20190222* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *tasks* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/tasks/firstapp). @@ -244,7 +244,7 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// Manage your tasks + /// Create, edit, organize, and delete all your tasks Full, /// View your tasks @@ -1065,10 +1065,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1088,7 +1085,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1186,7 +1183,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut self._page_token = Some(new_value.to_string()); self } - /// Maximum number of task lists returned on one page. Optional. The default is 100. + /// Maximum number of task lists returned on one page. Optional. The default is 20 (max allowed: 100). /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: &str) -> TaskListCall<'a, C, A> { @@ -1236,7 +1233,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1387,10 +1384,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1422,7 +1416,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1522,7 +1516,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1673,10 +1667,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1708,7 +1699,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1808,7 +1799,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1949,10 +1940,7 @@ impl<'a, C, A> TaskClearCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1972,7 +1960,7 @@ impl<'a, C, A> TaskClearCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2040,7 +2028,7 @@ impl<'a, C, A> TaskClearCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2194,10 +2182,7 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2217,7 +2202,7 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2319,7 +2304,7 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2462,10 +2447,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2485,7 +2467,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2563,7 +2545,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2707,10 +2689,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2730,7 +2709,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2818,7 +2797,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2977,10 +2956,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3012,7 +2988,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3116,7 +3092,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3245,10 +3221,7 @@ impl<'a, C, A> TasklistListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3268,7 +3241,7 @@ impl<'a, C, A> TasklistListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3328,7 +3301,7 @@ impl<'a, C, A> TasklistListCall<'a, C, A> where C: BorrowMut, A: self._page_token = Some(new_value.to_string()); self } - /// Maximum number of task lists returned on one page. Optional. The default is 100. + /// Maximum number of task lists returned on one page. Optional. The default is 20 (max allowed: 100). /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: &str) -> TasklistListCall<'a, C, A> { @@ -3350,7 +3323,7 @@ impl<'a, C, A> TasklistListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3499,10 +3472,7 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3534,7 +3504,7 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3624,7 +3594,7 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3765,10 +3735,7 @@ impl<'a, C, A> TasklistDeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3788,7 +3755,7 @@ impl<'a, C, A> TasklistDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3856,7 +3823,7 @@ impl<'a, C, A> TasklistDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4005,10 +3972,7 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4040,7 +4004,7 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4130,7 +4094,7 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4256,10 +4220,7 @@ impl<'a, C, A> TasklistInsertCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4291,7 +4252,7 @@ impl<'a, C, A> TasklistInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4371,7 +4332,7 @@ impl<'a, C, A> TasklistInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4513,10 +4474,7 @@ impl<'a, C, A> TasklistGetCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4536,7 +4494,7 @@ impl<'a, C, A> TasklistGetCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4614,7 +4572,7 @@ impl<'a, C, A> TasklistGetCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/testing1-cli/Cargo.toml b/gen/testing1-cli/Cargo.toml index 7fa1aa4c81..3aaca9ddb6 100644 --- a/gen/testing1-cli/Cargo.toml +++ b/gen/testing1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-testing1-cli" -version = "1.0.8+20181011" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with testing (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/testing1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-testing1] path = "../testing1" -version = "1.0.8+20181011" +version = "1.0.8+20190403" diff --git a/gen/testing1-cli/README.md b/gen/testing1-cli/README.md index 441d91fe70..fa8abae2ae 100644 --- a/gen/testing1-cli/README.md +++ b/gen/testing1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *testing* API at revision *20181011*. The CLI is at version *1.0.8*. +This documentation was generated from the *testing* API at revision *20190403*. The CLI is at version *1.0.8*. ```bash testing1 [options] diff --git a/gen/testing1-cli/mkdocs.yml b/gen/testing1-cli/mkdocs.yml index 5c197b3eb8..43b8989766 100644 --- a/gen/testing1-cli/mkdocs.yml +++ b/gen/testing1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: testing v1.0.8+20181011 +site_name: testing v1.0.8+20190403 site_url: http://byron.github.io/google-apis-rs/google-testing1-cli site_description: A complete library to interact with testing (protocol v1) diff --git a/gen/testing1-cli/src/main.rs b/gen/testing1-cli/src/main.rs index 8814797b6a..f3581e0482 100644 --- a/gen/testing1-cli/src/main.rs +++ b/gen/testing1-cli/src/main.rs @@ -214,26 +214,30 @@ impl<'n> Engine<'n> { "result-storage.tool-results-execution.project-id" => Some(("resultStorage.toolResultsExecution.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "result-storage.tool-results-execution.execution-id" => Some(("resultStorage.toolResultsExecution.executionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "result-storage.tool-results-execution.history-id" => Some(("resultStorage.toolResultsExecution.historyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "flaky-test-attempts" => Some(("flakyTestAttempts", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "test-specification.ios-test-setup.network-profile" => Some(("testSpecification.iosTestSetup.networkProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "test-specification.ios-xc-test.xcode-version" => Some(("testSpecification.iosXcTest.xcodeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "test-specification.ios-xc-test.app-bundle-id" => Some(("testSpecification.iosXcTest.appBundleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.ios-xc-test.xctestrun.gcs-path" => Some(("testSpecification.iosXcTest.xctestrun.gcsPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.ios-xc-test.tests-zip.gcs-path" => Some(("testSpecification.iosXcTest.testsZip.gcsPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "test-specification.ios-xc-test.xcode-version" => Some(("testSpecification.iosXcTest.xcodeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.test-timeout" => Some(("testSpecification.testTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.test-setup.directories-to-pull" => Some(("testSpecification.testSetup.directoriesToPull", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "test-specification.test-setup.network-profile" => Some(("testSpecification.testSetup.networkProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.disable-video-recording" => Some(("testSpecification.disableVideoRecording", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "test-specification.android-test-loop.scenarios" => Some(("testSpecification.androidTestLoop.scenarios", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "test-specification.disable-performance-metrics" => Some(("testSpecification.disablePerformanceMetrics", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "test-specification.android-test-loop.app-bundle.bundle-location.gcs-path" => Some(("testSpecification.androidTestLoop.appBundle.bundleLocation.gcsPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.android-test-loop.app-package-id" => Some(("testSpecification.androidTestLoop.appPackageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.android-test-loop.scenario-labels" => Some(("testSpecification.androidTestLoop.scenarioLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "test-specification.android-test-loop.scenarios" => Some(("testSpecification.androidTestLoop.scenarios", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "test-specification.android-test-loop.app-apk.gcs-path" => Some(("testSpecification.androidTestLoop.appApk.gcsPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "test-specification.auto-google-login" => Some(("testSpecification.autoGoogleLogin", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "test-specification.disable-performance-metrics" => Some(("testSpecification.disablePerformanceMetrics", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "test-specification.android-robo-test.app-bundle.bundle-location.gcs-path" => Some(("testSpecification.androidRoboTest.appBundle.bundleLocation.gcsPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.android-robo-test.robo-script.gcs-path" => Some(("testSpecification.androidRoboTest.roboScript.gcsPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.android-robo-test.app-apk.gcs-path" => Some(("testSpecification.androidRoboTest.appApk.gcsPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.android-robo-test.max-depth" => Some(("testSpecification.androidRoboTest.maxDepth", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "test-specification.android-robo-test.max-steps" => Some(("testSpecification.androidRoboTest.maxSteps", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "test-specification.android-robo-test.app-package-id" => Some(("testSpecification.androidRoboTest.appPackageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.android-robo-test.app-initial-activity" => Some(("testSpecification.androidRoboTest.appInitialActivity", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "test-specification.android-instrumentation-test.app-bundle.bundle-location.gcs-path" => Some(("testSpecification.androidInstrumentationTest.appBundle.bundleLocation.gcsPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.android-instrumentation-test.test-apk.gcs-path" => Some(("testSpecification.androidInstrumentationTest.testApk.gcsPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.android-instrumentation-test.test-runner-class" => Some(("testSpecification.androidInstrumentationTest.testRunnerClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "test-specification.android-instrumentation-test.test-package-id" => Some(("testSpecification.androidInstrumentationTest.testPackageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -246,11 +250,11 @@ impl<'n> Engine<'n> { "timestamp" => Some(("timestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "invalid-matrix-details" => Some(("invalidMatrixDetails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "environment-matrix.android-matrix.locales" => Some(("environmentMatrix.androidMatrix.locales", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "environment-matrix.android-matrix.orientations" => Some(("environmentMatrix.androidMatrix.orientations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "environment-matrix.android-matrix.android-version-ids" => Some(("environmentMatrix.androidMatrix.androidVersionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "environment-matrix.android-matrix.android-model-ids" => Some(("environmentMatrix.androidMatrix.androidModelIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "environment-matrix.android-matrix.android-version-ids" => Some(("environmentMatrix.androidMatrix.androidVersionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "environment-matrix.android-matrix.orientations" => Some(("environmentMatrix.androidMatrix.orientations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["android-instrumentation-test", "android-matrix", "android-model-ids", "android-robo-test", "android-test-loop", "android-version-ids", "app-apk", "app-initial-activity", "app-package-id", "auto-google-login", "client-info", "directories-to-pull", "disable-performance-metrics", "disable-video-recording", "environment-matrix", "execution-id", "gcs-path", "google-cloud-storage", "history-id", "invalid-matrix-details", "ios-test-setup", "ios-xc-test", "locales", "max-depth", "max-steps", "name", "network-profile", "orchestrator-option", "orientations", "project-id", "result-storage", "robo-script", "scenario-labels", "scenarios", "state", "test-apk", "test-matrix-id", "test-package-id", "test-runner-class", "test-setup", "test-specification", "test-targets", "test-timeout", "tests-zip", "timestamp", "tool-results-execution", "tool-results-history", "xcode-version", "xctestrun"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["android-instrumentation-test", "android-matrix", "android-model-ids", "android-robo-test", "android-test-loop", "android-version-ids", "app-apk", "app-bundle", "app-bundle-id", "app-initial-activity", "app-package-id", "bundle-location", "client-info", "directories-to-pull", "disable-performance-metrics", "disable-video-recording", "environment-matrix", "execution-id", "flaky-test-attempts", "gcs-path", "google-cloud-storage", "history-id", "invalid-matrix-details", "ios-test-setup", "ios-xc-test", "locales", "max-depth", "max-steps", "name", "network-profile", "orchestrator-option", "orientations", "project-id", "result-storage", "robo-script", "scenario-labels", "scenarios", "state", "test-apk", "test-matrix-id", "test-package-id", "test-runner-class", "test-setup", "test-specification", "test-targets", "test-timeout", "tests-zip", "timestamp", "tool-results-execution", "tool-results-history", "xcode-version", "xctestrun"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -553,7 +557,7 @@ fn main() { let arg_data = [ ("application-detail-service", "methods: 'get-apk-details'", vec![ ("get-apk-details", - Some(r##"Request the details of an Android application APK."##), + Some(r##"Gets the details of an Android application APK."##), "Details at http://byron.github.io/google-apis-rs/google_testing1_cli/application-detail-service_get-apk-details", vec![ (Some(r##"kv"##), @@ -614,7 +618,7 @@ fn main() { Some(false)), ]), ("test-matrices-create", - Some(r##"Request to run a matrix of tests according to the given specifications. + Some(r##"Creates and runs a matrix of tests according to the given specifications. Unsupported environments will be returned in the state UNSUPPORTED. Matrices are limited to at most 200 supported executions. @@ -650,7 +654,7 @@ fn main() { Some(false)), ]), ("test-matrices-get", - Some(r##"Check the status of a test matrix. + Some(r##"Checks the status of a test matrix. May return any of the following canonical error codes: @@ -687,7 +691,7 @@ fn main() { ("test-environment-catalog", "methods: 'get'", vec![ ("get", - Some(r##"Get the catalog of supported test environments. + Some(r##"Gets the catalog of supported test environments. May return any of the following canonical error codes: @@ -698,8 +702,7 @@ fn main() { vec![ (Some(r##"environment-type"##), None, - Some(r##"The type of environment that should be listed. - Required"##), + Some(r##"Required. The type of environment that should be listed."##), Some(true), Some(false)), @@ -721,7 +724,7 @@ fn main() { let mut app = App::new("testing1") .author("Sebastian Thiel ") - .version("1.0.8+20181011") + .version("1.0.8+20190403") .about("Allows developers to run automated tests for their mobile applications on Google infrastructure.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_testing1_cli") .arg(Arg::with_name("url") diff --git a/gen/testing1/Cargo.toml b/gen/testing1/Cargo.toml index 1aee09c87a..a2e237ceec 100644 --- a/gen/testing1/Cargo.toml +++ b/gen/testing1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-testing1" -version = "1.0.8+20181011" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with testing (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/testing1" homepage = "https://developers.google.com/cloud-test-lab/" -documentation = "https://docs.rs/google-testing1/1.0.8+20181011" +documentation = "https://docs.rs/google-testing1/1.0.8+20190403" license = "MIT" keywords = ["testing", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/testing1/README.md b/gen/testing1/README.md index 6d16b70003..f2ed6bfac1 100644 --- a/gen/testing1/README.md +++ b/gen/testing1/README.md @@ -5,20 +5,20 @@ DO NOT EDIT ! --> The `google-testing1` library allows access to all features of the *Google testing* service. -This documentation was generated from *testing* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *testing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *testing* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *testing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *testing* *v1* API can be found at the [official documentation site](https://developers.google.com/cloud-test-lab/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/struct.Testing.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/struct.Testing.html) ... * application detail service - * [*get apk details*](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/struct.ApplicationDetailServiceGetApkDetailCall.html) + * [*get apk details*](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/struct.ApplicationDetailServiceGetApkDetailCall.html) * projects - * [*test matrices cancel*](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/struct.ProjectTestMatriceCancelCall.html), [*test matrices create*](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/struct.ProjectTestMatriceCreateCall.html) and [*test matrices get*](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/struct.ProjectTestMatriceGetCall.html) -* [test environment catalog](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/struct.TestEnvironmentCatalog.html) - * [*get*](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/struct.TestEnvironmentCatalogGetCall.html) + * [*test matrices cancel*](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/struct.ProjectTestMatriceCancelCall.html), [*test matrices create*](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/struct.ProjectTestMatriceCreateCall.html) and [*test matrices get*](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/struct.ProjectTestMatriceGetCall.html) +* [test environment catalog](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/struct.TestEnvironmentCatalog.html) + * [*get*](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/struct.TestEnvironmentCatalogGetCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/struct.Testing.html)** +* **[Hub](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/struct.Testing.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.Part.html)** + * **[Parts](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -136,17 +136,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -156,29 +156,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-testing1/1.0.8+20181011/google_testing1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-testing1/1.0.8+20190403/google_testing1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/testing1/src/lib.rs b/gen/testing1/src/lib.rs index bce724bbb2..9744646019 100644 --- a/gen/testing1/src/lib.rs +++ b/gen/testing1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *testing* crate version *1.0.8+20181011*, where *20181011* is the exact revision of the *testing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *testing* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *testing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *testing* *v1* API can be found at the //! [official documentation site](https://developers.google.com/cloud-test-lab/). @@ -393,70 +393,46 @@ impl<'a, C, A> Testing /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AndroidDevice { - /// The locale the test device used for testing. - /// Use the EnvironmentDiscoveryService to get supported options. - /// Required + /// Required. The locale the test device used for testing. + /// Use the TestEnvironmentDiscoveryService to get supported options. pub locale: Option, - /// The id of the Android OS version to be used. - /// Use the EnvironmentDiscoveryService to get supported options. - /// Required + /// Required. The id of the Android OS version to be used. + /// Use the TestEnvironmentDiscoveryService to get supported options. #[serde(rename="androidVersionId")] pub android_version_id: Option, - /// The id of the Android device to be used. - /// Use the EnvironmentDiscoveryService to get supported options. - /// Required + /// Required. The id of the Android device to be used. + /// Use the TestEnvironmentDiscoveryService to get supported options. #[serde(rename="androidModelId")] pub android_model_id: Option, - /// How the device is oriented during the test. - /// Use the EnvironmentDiscoveryService to get supported options. - /// Required + /// Required. How the device is oriented during the test. + /// Use the TestEnvironmentDiscoveryService to get supported options. pub orientation: Option, } impl Part for AndroidDevice {} -/// Specifies a single test to be executed in a single environment. +/// Locations where the results of running the test are stored. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TestExecution { - /// The time this test execution was initially created. - /// @OutputOnly - pub timestamp: Option, - /// Id of the containing TestMatrix. - /// @OutputOnly - #[serde(rename="matrixId")] - pub matrix_id: Option, - /// Indicates the current progress of the test execution (e.g., FINISHED). - /// @OutputOnly - pub state: Option, - /// Unique id set by the backend. - /// @OutputOnly - pub id: Option, - /// How the host machine(s) are configured. - /// @OutputOnly - pub environment: Option, - /// How to run the test. - /// @OutputOnly - #[serde(rename="testSpecification")] - pub test_specification: Option, - /// The cloud project that owns the test execution. - /// @OutputOnly - #[serde(rename="projectId")] - pub project_id: Option, - /// Where the results for this execution are written. - /// @OutputOnly - #[serde(rename="toolResultsStep")] - pub tool_results_step: Option, - /// Additional details about the running test. - /// @OutputOnly - #[serde(rename="testDetails")] - pub test_details: Option, +pub struct ResultStorage { + /// The tool results history that contains the tool results execution that + /// results are written to. + /// + /// If not provided, the service will choose an appropriate value. + #[serde(rename="toolResultsHistory")] + pub tool_results_history: Option, + /// Required. + #[serde(rename="googleCloudStorage")] + pub google_cloud_storage: Option, + /// Output only. The tool results execution that results are written to. + #[serde(rename="toolResultsExecution")] + pub tool_results_execution: Option, } -impl Part for TestExecution {} +impl Part for ResultStorage {} /// Represents a tool results execution resource. @@ -467,16 +443,13 @@ impl Part for TestExecution {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ToolResultsExecution { - /// The cloud project that owns the tool results execution. - /// @OutputOnly + /// Output only. The cloud project that owns the tool results execution. #[serde(rename="projectId")] pub project_id: Option, - /// A tool results execution ID. - /// @OutputOnly + /// Output only. A tool results execution ID. #[serde(rename="executionId")] pub execution_id: Option, - /// A tool results history ID. - /// @OutputOnly + /// Output only. A tool results history ID. #[serde(rename="historyId")] pub history_id: Option, } @@ -484,6 +457,31 @@ pub struct ToolResultsExecution { impl Part for ToolResultsExecution {} +/// A single iOS device. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IosDevice { + /// Required. The locale the test device used for testing. + /// Use the TestEnvironmentDiscoveryService to get supported options. + pub locale: Option, + /// Required. The id of the iOS major software version to be used. + /// Use the TestEnvironmentDiscoveryService to get supported options. + #[serde(rename="iosVersionId")] + pub ios_version_id: Option, + /// Required. How the device is oriented during the test. + /// Use the TestEnvironmentDiscoveryService to get supported options. + pub orientation: Option, + /// Required. The id of the iOS device to be used. + /// Use the TestEnvironmentDiscoveryService to get supported options. + #[serde(rename="iosModelId")] + pub ios_model_id: Option, +} + +impl Part for IosDevice {} + + /// The section of an tag. /// https://developer.android.com/guide/topics/manifest/intent-filter-element.html /// @@ -491,13 +489,13 @@ impl Part for ToolResultsExecution {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IntentFilter { - /// The android:mimeType value of the tag + /// The android:mimeType value of the tag. #[serde(rename="mimeType")] pub mime_type: Option, - /// The android:name value of the tag + /// The android:name value of the tag. #[serde(rename="actionNames")] pub action_names: Option>, - /// The android:name value of the tag + /// The android:name value of the tag. #[serde(rename="categoryNames")] pub category_names: Option>, } @@ -523,7 +521,7 @@ impl Part for Environment {} /// A set of Android device configuration permutations is defined by the -/// the cross-product of the given axes. Internally, the given AndroidMatrix +/// the cross-product of the given axes. Internally, the given AndroidMatrix /// will be expanded into a set of AndroidDevices. /// /// Only supported permutations will be instantiated. Invalid permutations @@ -533,42 +531,44 @@ impl Part for Environment {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AndroidMatrix { - /// The ids of the set of Android OS version to be used. - /// Use the EnvironmentDiscoveryService to get supported options. - /// Required + /// Required. The ids of the set of Android OS version to be used. + /// Use the TestEnvironmentDiscoveryService to get supported options. #[serde(rename="androidVersionIds")] pub android_version_ids: Option>, - /// The set of orientations to test with. - /// Use the EnvironmentDiscoveryService to get supported options. - /// Required - pub orientations: Option>, - /// The set of locales the test device will enable for testing. - /// Use the EnvironmentDiscoveryService to get supported options. - /// Required - pub locales: Option>, - /// The ids of the set of Android device to be used. - /// Use the EnvironmentDiscoveryService to get supported options. - /// Required + /// Required. The ids of the set of Android device to be used. + /// Use the TestEnvironmentDiscoveryService to get supported options. #[serde(rename="androidModelIds")] pub android_model_ids: Option>, + /// Required. The set of locales the test device will enable for testing. + /// Use the TestEnvironmentDiscoveryService to get supported options. + pub locales: Option>, + /// Required. The set of orientations to test with. + /// Use the TestEnvironmentDiscoveryService to get supported options. + pub orientations: Option>, } impl Part for AndroidMatrix {} -/// Android application details based on application manifest and apk archive -/// contents +/// Response containing the current state of the specified test matrix. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [test matrices cancel projects](struct.ProjectTestMatriceCancelCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ApkDetail { - /// no description provided - #[serde(rename="apkManifest")] - pub apk_manifest: Option, +pub struct CancelTestMatrixResponse { + /// The current rolled-up state of the test matrix. + /// If this state is already final, then the cancelation request will + /// have no effect. + #[serde(rename="testState")] + pub test_state: Option, } -impl Part for ApkDetail {} +impl ResponseResult for CancelTestMatrixResponse {} /// A starting intent specified by an action, uri, and categories. @@ -581,10 +581,8 @@ pub struct StartActivityIntent { /// Required for START_ACTIVITY. pub action: Option, /// URI for the action. - /// Optional. pub uri: Option, /// Intent categories to set on the intent. - /// Optional. pub categories: Option>, } @@ -597,11 +595,11 @@ impl Part for StartActivityIntent {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct XcodeVersion { - /// Output only. The id for this version. - /// Example: "9.2" + /// The id for this version. + /// Example: "9.2". pub version: Option, - /// Output only. Tags for this Xcode version. - /// Examples: "default" + /// Tags for this Xcode version. + /// Example: "default". pub tags: Option>, } @@ -616,20 +614,16 @@ impl Part for XcodeVersion {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ToolResultsStep { - /// The cloud project that owns the tool results step. - /// @OutputOnly + /// Output only. The cloud project that owns the tool results step. #[serde(rename="projectId")] pub project_id: Option, - /// A tool results execution ID. - /// @OutputOnly + /// Output only. A tool results execution ID. #[serde(rename="executionId")] pub execution_id: Option, - /// A tool results step ID. - /// @OutputOnly + /// Output only. A tool results step ID. #[serde(rename="stepId")] pub step_id: Option, - /// A tool results history ID. - /// @OutputOnly + /// Output only. A tool results history ID. #[serde(rename="historyId")] pub history_id: Option, } @@ -637,73 +631,41 @@ pub struct ToolResultsStep { impl Part for ToolResultsStep {} -/// A test of an android application that explores the application on a virtual -/// or physical Android Device, finding culprits and crashes as it goes. +/// Data about the relative number of devices running a +/// given configuration of the Android platform. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AndroidRoboTest { - /// A set of directives Robo should apply during the crawl. - /// This allows users to customize the crawl. For example, the username and - /// password for a test account can be provided. - /// Optional - #[serde(rename="roboDirectives")] - pub robo_directives: Option>, - /// A JSON file with a sequence of actions Robo should perform as a prologue - /// for the crawl. - /// Optional - #[serde(rename="roboScript")] - pub robo_script: Option, - /// The APK for the application under test. - #[serde(rename="appApk")] - pub app_apk: Option, - /// The max depth of the traversal stack Robo can explore. Needs to be at least - /// 2 to make Robo explore the app beyond the first activity. - /// Default is 50. - /// Optional - #[serde(rename="maxDepth")] - pub max_depth: Option, - /// The intents used to launch the app for the crawl. - /// If none are provided, then the main launcher activity is launched. - /// If some are provided, then only those provided are launched (the main - /// launcher activity must be provided explicitly). - #[serde(rename="startingIntents")] - pub starting_intents: Option>, - /// The max number of steps Robo can execute. - /// Default is no limit. - /// Optional - #[serde(rename="maxSteps")] - pub max_steps: Option, - /// The java package for the application under test. - /// Optional, default is determined by examining the application's manifest. - #[serde(rename="appPackageId")] - pub app_package_id: Option, - /// The initial activity that should be used to start the app. - /// Optional - #[serde(rename="appInitialActivity")] - pub app_initial_activity: Option, +pub struct Distribution { + /// Output only. The time this distribution was measured. + #[serde(rename="measurementTime")] + pub measurement_time: Option, + /// Output only. The estimated fraction (0-1) of the total market with this + /// configuration. + #[serde(rename="marketShare")] + pub market_share: Option, } -impl Part for AndroidRoboTest {} +impl Part for Distribution {} -/// Network emulation parameters +/// Network emulation parameters. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TrafficRule { - /// Packet delay, must be >= 0 + /// Packet delay, must be >= 0. pub delay: Option, - /// Packet loss ratio (0.0 - 1.0) + /// Packet loss ratio (0.0 - 1.0). #[serde(rename="packetLossRatio")] pub packet_loss_ratio: Option, - /// Bandwidth in kbits/second + /// Bandwidth in kbits/second. pub bandwidth: Option, - /// Burst size in kbits + /// Burst size in kbits. pub burst: Option, - /// Packet duplication ratio (0.0 - 1.0) + /// Packet duplication ratio (0.0 - 1.0). #[serde(rename="packetDuplicationRatio")] pub packet_duplication_ratio: Option, } @@ -711,19 +673,64 @@ pub struct TrafficRule { impl Part for TrafficRule {} -/// A key-value pair passed as an environment variable to the test +/// A description of an Android device tests may be run on. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EnvironmentVariable { - /// Key for the environment variable - pub key: Option, - /// Value for the environment variable - pub value: Option, +pub struct AndroidModel { + /// Whether this device is a phone, tablet, wearable, etc. + #[serde(rename="formFactor")] + pub form_factor: Option, + /// The human-readable marketing name for this device model. + /// Examples: "Nexus 5", "Galaxy S5". + pub name: Option, + /// Whether this device is virtual or physical. + pub form: Option, + /// Tags for this dimension. + /// Examples: "default", "preview", "deprecated". + pub tags: Option>, + /// True if and only if tests with this model are recorded by stitching + /// together screenshots. See use_low_spec_video_recording in device config. + #[serde(rename="lowFpsVideoRecording")] + pub low_fps_video_recording: Option, + /// The company that this device is branded with. + /// Example: "Google", "Samsung". + pub brand: Option, + /// The unique opaque id for this model. + /// Use this for invoking the TestExecutionService. + pub id: Option, + /// The set of Android versions this device supports. + #[serde(rename="supportedVersionIds")] + pub supported_version_ids: Option>, + /// Screen density in DPI. + /// This corresponds to ro.sf.lcd_density + #[serde(rename="screenDensity")] + pub screen_density: Option, + /// The list of supported ABIs for this device. + /// This corresponds to either android.os.Build.SUPPORTED_ABIS (for API level + /// 21 and above) or android.os.Build.CPU_ABI/CPU_ABI2. + /// The most preferred ABI is the first element in the list. + /// + /// Elements are optionally prefixed by "version_id:" (where version_id is + /// the id of an AndroidVersion), denoting an ABI that is supported only on + /// a particular version. + #[serde(rename="supportedAbis")] + pub supported_abis: Option>, + /// Screen size in the horizontal (X) dimension measured in pixels. + #[serde(rename="screenX")] + pub screen_x: Option, + /// Screen size in the vertical (Y) dimension measured in pixels. + #[serde(rename="screenY")] + pub screen_y: Option, + /// The manufacturer of this device. + pub manufacturer: Option, + /// The name of the industrial design. + /// This corresponds to android.os.Build.DEVICE. + pub codename: Option, } -impl Part for EnvironmentVariable {} +impl Part for AndroidModel {} /// A list of Android device configurations in which the test is to be executed. @@ -732,8 +739,7 @@ impl Part for EnvironmentVariable {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AndroidDeviceList { - /// A list of Android devices - /// Required + /// Required. A list of Android devices. #[serde(rename="androidDevices")] pub android_devices: Option>, } @@ -750,8 +756,7 @@ pub struct ClientInfo { /// The list of detailed information about client. #[serde(rename="clientInfoDetails")] pub client_info_details: Option>, - /// Client name, such as gcloud. - /// Required + /// Required. Client name, such as gcloud. pub name: Option, } @@ -764,7 +769,7 @@ impl Part for ClientInfo {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IosTestSetup { - /// Optional. The network traffic profile used for running the test. + /// The network traffic profile used for running the test. /// Available network profiles can be queried by using the /// NETWORK_CONFIGURATION environment type when calling /// TestEnvironmentDiscoveryService.GetTestEnvironmentCatalog. @@ -805,12 +810,10 @@ impl ResponseResult for GetApkDetailsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IosXcTest { - /// Optional. The Xcode version that should be used for the test. - /// Use the EnvironmentDiscoveryService to get supported options. - /// Defaults to the latest Xcode version Firebase Test Lab supports. - #[serde(rename="xcodeVersion")] - pub xcode_version: Option, - /// Optional. An .xctestrun file that will override the .xctestrun file in the + /// Output only. The bundle id for the application under test. + #[serde(rename="appBundleId")] + pub app_bundle_id: Option, + /// An .xctestrun file that will override the .xctestrun file in the /// tests zip. Because the .xctestrun file contains environment variables along /// with test methods to run and/or ignore, this can be useful for sharding /// tests. Default is taken from the tests zip. @@ -821,6 +824,11 @@ pub struct IosXcTest { /// specified. #[serde(rename="testsZip")] pub tests_zip: Option, + /// The Xcode version that should be used for the test. + /// Use the TestEnvironmentDiscoveryService to get supported options. + /// Defaults to the latest Xcode version Firebase Test Lab supports. + #[serde(rename="xcodeVersion")] + pub xcode_version: Option, } impl Part for IosXcTest {} @@ -832,12 +840,10 @@ impl Part for IosXcTest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ToolResultsHistory { - /// The cloud project that owns the tool results history. - /// Required + /// Required. The cloud project that owns the tool results history. #[serde(rename="projectId")] pub project_id: Option, - /// A tool results history ID. - /// Required + /// Required. A tool results history ID. #[serde(rename="historyId")] pub history_id: Option, } @@ -845,28 +851,39 @@ pub struct ToolResultsHistory { impl Part for ToolResultsHistory {} -/// Locations where the results of running the test are stored. +/// Specifies a single test to be executed in a single environment. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResultStorage { - /// The tool results history that contains the tool results execution that - /// results are written to. - /// - /// Optional, if not provided the service will choose an appropriate value. - #[serde(rename="toolResultsHistory")] - pub tool_results_history: Option, - /// Required. - #[serde(rename="googleCloudStorage")] - pub google_cloud_storage: Option, - /// The tool results execution that results are written to. - /// @OutputOnly - #[serde(rename="toolResultsExecution")] - pub tool_results_execution: Option, +pub struct TestExecution { + /// Output only. The cloud project that owns the test execution. + #[serde(rename="projectId")] + pub project_id: Option, + /// Output only. Id of the containing TestMatrix. + #[serde(rename="matrixId")] + pub matrix_id: Option, + /// Output only. Indicates the current progress of the test execution + /// (e.g., FINISHED). + pub state: Option, + /// Output only. Unique id set by the backend. + pub id: Option, + /// Output only. How the host machine(s) are configured. + pub environment: Option, + /// Output only. How to run the test. + #[serde(rename="testSpecification")] + pub test_specification: Option, + /// Output only. The time this test execution was initially created. + pub timestamp: Option, + /// Output only. Where the results for this execution are written. + #[serde(rename="toolResultsStep")] + pub tool_results_step: Option, + /// Output only. Additional details about the running test. + #[serde(rename="testDetails")] + pub test_details: Option, } -impl Part for ResultStorage {} +impl Part for TestExecution {} /// An Android app manifest. See @@ -904,14 +921,12 @@ impl Part for ApkManifest {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestSetup { /// The device will be logged in on this account for the duration of the test. - /// Optional pub account: Option, - /// List of files to push to the device before starting the test. - /// - /// Optional - #[serde(rename="filesToPush")] - pub files_to_push: Option>, - /// Optional. The network traffic profile used for running the test. + /// Environment variables to set for the test (only applicable for + /// instrumentation tests). + #[serde(rename="environmentVariables")] + pub environment_variables: Option>, + /// The network traffic profile used for running the test. /// Available network profiles can be queried by using the /// NETWORK_CONFIGURATION environment type when calling /// TestEnvironmentDiscoveryService.GetTestEnvironmentCatalog. @@ -919,13 +934,8 @@ pub struct TestSetup { pub network_profile: Option, /// APKs to install in addition to those being directly tested. /// Currently capped at 100. - /// Optional #[serde(rename="additionalApks")] pub additional_apks: Option>, - /// Environment variables to set for the test (only applicable for - /// instrumentation tests). - #[serde(rename="environmentVariables")] - pub environment_variables: Option>, /// List of directories on the device to upload to GCS at the end of the test; /// they must be absolute paths under /sdcard or /data/local/tmp. /// Path names are restricted to characters a-z A-Z 0-9 _ - . + and / @@ -934,65 +944,49 @@ pub struct TestSetup { /// implicit path substitutions. E.g. if /sdcard on a particular device does /// not map to external storage, the system will replace it with the external /// storage path prefix for that device. - /// - /// Optional #[serde(rename="directoriesToPull")] pub directories_to_pull: Option>, + /// List of files to push to the device before starting the test. + #[serde(rename="filesToPush")] + pub files_to_push: Option>, } impl Part for TestSetup {} -/// A test of an Android Application with a Test Loop. -/// The intent will be implicitly added, since Games is the only -/// user of this api, for the time being. +/// The currently supported Android devices. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AndroidTestLoop { - /// The list of scenarios that should be run during the test. - /// Optional, default is all test loops, derived from the application's - /// manifest. - pub scenarios: Option>, - /// The java package for the application under test. - /// Optional, default is determined by examining the application's manifest. - #[serde(rename="appPackageId")] - pub app_package_id: Option, - /// The list of scenario labels that should be run during the test. - /// The scenario labels should map to labels defined in the application's - /// manifest. For example, player_experience and - /// com.google.test.loops.player_experience add all of the loops labeled in the - /// manifest with the com.google.test.loops.player_experience name to the - /// execution. - /// Optional. Scenarios can also be specified in the scenarios field. - #[serde(rename="scenarioLabels")] - pub scenario_labels: Option>, - /// The APK for the application under test. - #[serde(rename="appApk")] - pub app_apk: Option, +pub struct AndroidDeviceCatalog { + /// The set of supported Android device models. + pub models: Option>, + /// The set of supported runtime configurations. + #[serde(rename="runtimeConfiguration")] + pub runtime_configuration: Option, + /// The set of supported Android OS versions. + pub versions: Option>, } -impl Part for AndroidTestLoop {} +impl Part for AndroidDeviceCatalog {} -/// An opaque binary blob file to install on the device before the test starts +/// An opaque binary blob file to install on the device before the test starts. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ObbFile { - /// OBB file name which must conform to the format as specified by + /// Required. OBB file name which must conform to the format as specified by /// Android /// e.g. [main|patch].0300110.com.example.android.obb /// which will be installed into - /// /Android/obb// - /// on the device - /// Required + /// \/Android/obb/\/ + /// on the device. #[serde(rename="obbFileName")] pub obb_file_name: Option, - /// Opaque Binary Blob (OBB) file(s) to install on the device - /// Required + /// Required. Opaque Binary Blob (OBB) file(s) to install on the device. pub obb: Option, } @@ -1014,40 +1008,55 @@ impl Part for ObbFile {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Date { - /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without - /// a year. - pub year: Option, + /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a + /// month and day. + pub month: Option, /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0 /// if specifying a year by itself or a year and month where the day is not /// significant. pub day: Option, - /// Month of year. Must be from 1 to 12, or 0 if specifying a year without a - /// month and day. - pub month: Option, + /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without + /// a year. + pub year: Option, } impl Part for Date {} -/// The currently supported Android devices. +/// A test of an Android Application with a Test Loop. +/// The intent \ will be implicitly added, since Games is the only +/// user of this api, for the time being. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AndroidDeviceCatalog { - /// The set of supported Android device models. - /// @OutputOnly - pub models: Option>, - /// The set of supported runtime configurations. - /// @OutputOnly - #[serde(rename="runtimeConfiguration")] - pub runtime_configuration: Option, - /// The set of supported Android OS versions. - /// @OutputOnly - pub versions: Option>, +pub struct AndroidTestLoop { + /// A multi-apk app bundle for the application under test. + #[serde(rename="appBundle")] + pub app_bundle: Option, + /// The java package for the application under test. + /// The default is determined by examining the application's manifest. + #[serde(rename="appPackageId")] + pub app_package_id: Option, + /// The APK for the application under test. + #[serde(rename="appApk")] + pub app_apk: Option, + /// The list of scenario labels that should be run during the test. + /// The scenario labels should map to labels defined in the application's + /// manifest. For example, player_experience and + /// com.google.test.loops.player_experience add all of the loops labeled in the + /// manifest with the com.google.test.loops.player_experience name to the + /// execution. + /// Scenarios can also be specified in the scenarios field. + #[serde(rename="scenarioLabels")] + pub scenario_labels: Option>, + /// The list of scenarios that should be run during the test. + /// The default is all test loops, derived from the application's + /// manifest. + pub scenarios: Option>, } -impl Part for AndroidDeviceCatalog {} +impl Part for AndroidTestLoop {} /// A test of an Android application that can control an Android component @@ -1064,23 +1073,25 @@ impl Part for AndroidDeviceCatalog {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AndroidInstrumentationTest { - /// The APK containing the test code to be executed. - /// Required + /// A multi-apk app bundle for the application under test. + #[serde(rename="appBundle")] + pub app_bundle: Option, + /// Required. The APK containing the test code to be executed. #[serde(rename="testApk")] pub test_apk: Option, /// The InstrumentationTestRunner class. - /// Optional, default is determined by examining the application's manifest. + /// The default value is determined by examining the application's manifest. #[serde(rename="testRunnerClass")] pub test_runner_class: Option, /// The java package for the test to be executed. - /// Optional, default is determined by examining the application's manifest. + /// The default value is determined by examining the application's manifest. #[serde(rename="testPackageId")] pub test_package_id: Option, /// The APK for the application under test. #[serde(rename="appApk")] pub app_apk: Option, /// The java package for the application under test. - /// Optional, default is determined by examining the application's manifest. + /// The default value is determined by examining the application's manifest. #[serde(rename="appPackageId")] pub app_package_id: Option, /// The option of whether running each test within its own invocation of @@ -1096,7 +1107,7 @@ pub struct AndroidInstrumentationTest { /// /// for more information about Android Test Orchestrator. /// - /// Optional. If not set, the test will be run without the orchestrator. + /// If not set, the test will be run without the orchestrator. #[serde(rename="orchestratorOption")] pub orchestrator_option: Option, /// Each target must be fully qualified with the package name or class name, @@ -1105,7 +1116,7 @@ pub struct AndroidInstrumentationTest { /// - "class package_name.class_name" /// - "class package_name.class_name#method_name" /// - /// Optional, if empty, all targets in the module will be run. + /// If empty, all targets in the module will be run. #[serde(rename="testTargets")] pub test_targets: Option>, } @@ -1119,7 +1130,7 @@ impl Part for AndroidInstrumentationTest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IosDeviceList { - /// Required. A list of iOS devices + /// Required. A list of iOS devices. #[serde(rename="iosDevices")] pub ios_devices: Option>, } @@ -1133,30 +1144,86 @@ impl Part for IosDeviceList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestDetails { - /// Human-readable, detailed descriptions of the test's progress. + /// Output only. Human-readable, detailed descriptions of the test's progress. /// For example: "Provisioning a device", "Starting Test". /// /// During the course of execution new data may be appended /// to the end of progress_messages. - /// @OutputOnly #[serde(rename="progressMessages")] pub progress_messages: Option>, - /// If the TestState is ERROR, then this string will contain human-readable - /// details about the error. - /// @OutputOnly + /// Output only. If the TestState is ERROR, then this string will contain + /// human-readable details about the error. #[serde(rename="errorMessage")] pub error_message: Option, - /// Indicates that video will not be recorded for this execution either because - /// the user chose to disable it or the device does not support it. - /// See AndroidModel.video_recording_not_supported - /// @OutputOnly - #[serde(rename="videoRecordingDisabled")] - pub video_recording_disabled: Option, } impl Part for TestDetails {} +/// Key-value pair of detailed information about the client which invoked the +/// test. Examples: {'Version', '1.0'}, {'Release Track', 'BETA'}. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClientInfoDetail { + /// Required. The key of detailed client information. + pub key: Option, + /// Required. The value of detailed client information. + pub value: Option, +} + +impl Part for ClientInfoDetail {} + + +/// A storage location within Google cloud storage (GCS). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudStorage { + /// Required. The path to a directory in GCS that will + /// eventually contain the results for this test. + /// The requesting user must have write access on the bucket in the supplied + /// path. + #[serde(rename="gcsPath")] + pub gcs_path: Option, +} + +impl Part for GoogleCloudStorage {} + + +/// An Android App Bundle file format, containing a BundleConfig.pb file, +/// a base module directory, zero or more dynamic feature module directories. +///

See https://developer.android.com/guide/app-bundle/build for guidance on +/// building App Bundles. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AppBundle { + /// .aab file representing the app bundle under test. + #[serde(rename="bundleLocation")] + pub bundle_location: Option, +} + +impl Part for AppBundle {} + + +/// Identifies an account and how to log into it. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Account { + /// An automatic google login account. + #[serde(rename="googleAuto")] + pub google_auto: Option, +} + +impl Part for Account {} + + /// A description of an iOS device tests may be run on. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1164,22 +1231,21 @@ impl Part for TestDetails {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IosModel { /// Whether this device is a phone, tablet, wearable, etc. - /// @OutputOnly #[serde(rename="formFactor")] pub form_factor: Option, - /// Output only. The human-readable name for this device model. - /// Examples: "iPhone 4s", "iPad Mini 2" + /// The human-readable name for this device model. + /// Examples: "iPhone 4s", "iPad Mini 2". pub name: Option, - /// Output only. Tags for this dimension. - /// Examples: "default", "preview", "deprecated" + /// Tags for this dimension. + /// Examples: "default", "preview", "deprecated". pub tags: Option>, - /// Output only. The set of iOS major software versions this device supports. + /// The set of iOS major software versions this device supports. #[serde(rename="supportedVersionIds")] pub supported_version_ids: Option>, - /// Output only. The unique opaque id for this model. + /// The unique opaque id for this model. /// Use this for invoking the TestExecutionService. pub id: Option, - /// Output only. Device capabilities. + /// Device capabilities. /// Copied from /// https://developer.apple.com/library/archive/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/DeviceCompatibilityMatrix/DeviceCompatibilityMatrix.html #[serde(rename="deviceCapabilities")] @@ -1189,106 +1255,15 @@ pub struct IosModel { impl Part for IosModel {} -/// A group of one or more TestExecutions, built by taking a -/// product of values over a pre-defined set of axes. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [test matrices create projects](struct.ProjectTestMatriceCreateCall.html) (request|response) -/// * [test matrices get projects](struct.ProjectTestMatriceGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TestMatrix { - /// Information about the client which invoked the test. - /// Optional - #[serde(rename="clientInfo")] - pub client_info: Option, - /// The cloud project that owns the test matrix. - /// @OutputOnly - #[serde(rename="projectId")] - pub project_id: Option, - /// Where the results for the matrix are written. - /// Required - #[serde(rename="resultStorage")] - pub result_storage: Option, - /// Indicates the current progress of the test matrix (e.g., FINISHED) - /// @OutputOnly - pub state: Option, - /// The list of test executions that the service creates for this matrix. - /// @OutputOnly - #[serde(rename="testExecutions")] - pub test_executions: Option>, - /// How to run the test. - /// Required - #[serde(rename="testSpecification")] - pub test_specification: Option, - /// Unique id set by the service. - /// @OutputOnly - #[serde(rename="testMatrixId")] - pub test_matrix_id: Option, - /// The time this test matrix was initially created. - /// @OutputOnly - pub timestamp: Option, - /// Describes why the matrix is considered invalid. - /// Only useful for matrices in the INVALID state. - /// @OutputOnly - #[serde(rename="invalidMatrixDetails")] - pub invalid_matrix_details: Option, - /// How the host machine(s) are configured. - /// Required - #[serde(rename="environmentMatrix")] - pub environment_matrix: Option, -} - -impl RequestValue for TestMatrix {} -impl ResponseResult for TestMatrix {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NetworkConfiguration { - /// The unique opaque id for this network traffic configuration - /// @OutputOnly - pub id: Option, - /// The emulation rule applying to the download traffic - #[serde(rename="downRule")] - pub down_rule: Option, - /// The emulation rule applying to the upload traffic - #[serde(rename="upRule")] - pub up_rule: Option, -} - -impl Part for NetworkConfiguration {} - - -/// Identifies an account and how to log into it -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Account { - /// An automatic google login account - #[serde(rename="googleAuto")] - pub google_auto: Option, -} - -impl Part for Account {} - - /// The currently provided software environment on the devices under test. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ProvidedSoftwareCatalog { - /// A string representing the current version of Android Test Orchestrator that - /// is provided by TestExecutionService. Example: "1.0.2 beta" + /// A string representing the current version of Android Test + /// Orchestrator that is provided by TestExecutionService. + /// Example: "1.0.2 beta". #[serde(rename="orchestratorVersion")] pub orchestrator_version: Option, } @@ -1302,42 +1277,30 @@ impl Part for ProvidedSoftwareCatalog {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestSpecification { - /// Optional. Test setup requirements for iOS. + /// Test setup requirements for iOS. #[serde(rename="iosTestSetup")] pub ios_test_setup: Option, - /// An iOS XCTest, via an .xctestrun file + /// An iOS XCTest, via an .xctestrun file. #[serde(rename="iosXcTest")] pub ios_xc_test: Option, /// Max time a test execution is allowed to run before it is /// automatically cancelled. - /// Optional, default is 5 min. + /// The default value is 5 min. #[serde(rename="testTimeout")] pub test_timeout: Option, /// Test setup requirements for Android e.g. files to install, bootstrap /// scripts. - /// Optional #[serde(rename="testSetup")] pub test_setup: Option, /// Disables video recording; may reduce test latency. #[serde(rename="disableVideoRecording")] pub disable_video_recording: Option, - /// An Android Application with a Test Loop - #[serde(rename="androidTestLoop")] - pub android_test_loop: Option, - /// Enables automatic Google account login. - /// If set, the service will automatically generate a Google test account and - /// add it to the device, before executing the test. Note that test accounts - /// might be reused. - /// Many applications show their full set of functionalities when an account is - /// present on the device. Logging into the device with these generated - /// accounts allows testing more functionalities. - /// Default is false. - /// Optional - #[serde(rename="autoGoogleLogin")] - pub auto_google_login: Option, /// Disables performance metrics recording; may reduce test latency. #[serde(rename="disablePerformanceMetrics")] pub disable_performance_metrics: Option, + /// An Android Application with a Test Loop. + #[serde(rename="androidTestLoop")] + pub android_test_loop: Option, /// An Android robo test. #[serde(rename="androidRoboTest")] pub android_robo_test: Option, @@ -1370,7 +1333,7 @@ pub struct EnvironmentMatrix { impl Part for EnvironmentMatrix {} -/// Message for specifying the start activities to crawl +/// Message for specifying the start activities to crawl. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -1379,6 +1342,8 @@ pub struct RoboStartingIntent { /// no description provided #[serde(rename="startActivity")] pub start_activity: Option, + /// Timeout in seconds for each intent. + pub timeout: Option, /// no description provided #[serde(rename="launcherActivity")] pub launcher_activity: Option, @@ -1387,24 +1352,53 @@ pub struct RoboStartingIntent { impl Part for RoboStartingIntent {} -/// Data about the relative number of devices running a -/// given configuration of the Android platform. +/// A test of an android application that explores the application on a virtual +/// or physical Android Device, finding culprits and crashes as it goes. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Distribution { - /// The time this distribution was measured. - /// @OutputOnly - #[serde(rename="measurementTime")] - pub measurement_time: Option, - /// The estimated fraction (0-1) of the total market with this configuration. - /// @OutputOnly - #[serde(rename="marketShare")] - pub market_share: Option, +pub struct AndroidRoboTest { + /// A multi-apk app bundle for the application under test. + #[serde(rename="appBundle")] + pub app_bundle: Option, + /// A set of directives Robo should apply during the crawl. + /// This allows users to customize the crawl. For example, the username and + /// password for a test account can be provided. + #[serde(rename="roboDirectives")] + pub robo_directives: Option>, + /// A JSON file with a sequence of actions Robo should perform as a prologue + /// for the crawl. + #[serde(rename="roboScript")] + pub robo_script: Option, + /// The max number of steps Robo can execute. + /// Default is no limit. + #[serde(rename="maxSteps")] + pub max_steps: Option, + /// The max depth of the traversal stack Robo can explore. Needs to be at least + /// 2 to make Robo explore the app beyond the first activity. + /// Default is 50. + #[serde(rename="maxDepth")] + pub max_depth: Option, + /// The intents used to launch the app for the crawl. + /// If none are provided, then the main launcher activity is launched. + /// If some are provided, then only those provided are launched (the main + /// launcher activity must be provided explicitly). + #[serde(rename="startingIntents")] + pub starting_intents: Option>, + /// The APK for the application under test. + #[serde(rename="appApk")] + pub app_apk: Option, + /// The java package for the application under test. + /// The default value is determined by examining the application's manifest. + #[serde(rename="appPackageId")] + pub app_package_id: Option, + /// The initial activity that should be used to start the app. + #[serde(rename="appInitialActivity")] + pub app_initial_activity: Option, } -impl Part for Distribution {} +impl Part for AndroidRoboTest {} /// A reference to a file, used for user inputs. @@ -1427,40 +1421,34 @@ pub struct FileReference { impl RequestValue for FileReference {} -/// A version of the Android OS +/// A version of the Android OS. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AndroidVersion { /// The date this Android version became available in the market. - /// @OutputOnly #[serde(rename="releaseDate")] pub release_date: Option, /// A string representing this version of the Android OS. - /// Examples: "4.3", "4.4" - /// @OutputOnly + /// Examples: "4.3", "4.4". #[serde(rename="versionString")] pub version_string: Option, /// Tags for this dimension. - /// Examples: "default", "preview", "deprecated" + /// Examples: "default", "preview", "deprecated". pub tags: Option>, /// Market share for this version. - /// @OutputOnly pub distribution: Option, /// The API level for this Android version. - /// Examples: 18, 19 - /// @OutputOnly + /// Examples: 18, 19. #[serde(rename="apiLevel")] pub api_level: Option, /// The code name for this Android version. - /// Examples: "JellyBean", "KitKat" - /// @OutputOnly + /// Examples: "JellyBean", "KitKat". #[serde(rename="codeName")] pub code_name: Option, /// An opaque id for this Android version. /// Use this id to invoke the TestExecutionService. - /// @OutputOnly pub id: Option, } @@ -1476,21 +1464,19 @@ impl Part for AndroidVersion {} pub struct RoboDirective { /// The text that Robo is directed to set. If left empty, the directive will be /// treated as a CLICK on the element matching the resource_name. - /// Optional #[serde(rename="inputText")] pub input_text: Option, - /// The android resource name of the target UI element + /// Required. The android resource name of the target UI element. /// For example, /// in Java: R.string.foo /// in xml: @string/foo - /// Only the “foo” part is needed. + /// Only the "foo" part is needed. /// Reference doc: /// https://developer.android.com/guide/topics/resources/accessing-resources.html - /// Required #[serde(rename="resourceName")] pub resource_name: Option, - /// The type of action that Robo should perform on the specified element. - /// Required. + /// Required. The type of action that Robo should perform on the specified + /// element. #[serde(rename="actionType")] pub action_type: Option, } @@ -1498,57 +1484,51 @@ pub struct RoboDirective { impl Part for RoboDirective {} -/// An iOS version +/// An iOS version. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IosVersion { - /// Output only. An integer representing the major iOS version. - /// Examples: "8", "9" + /// An integer representing the major iOS version. + /// Examples: "8", "9". #[serde(rename="majorVersion")] pub major_version: Option, - /// Output only. The available Xcode versions for this version. - #[serde(rename="supportedXcodeVersionIds")] - pub supported_xcode_version_ids: Option>, - /// Output only. An integer representing the minor iOS version. - /// Examples: "1", "2" + /// Tags for this dimension. + /// Examples: "default", "preview", "deprecated". + pub tags: Option>, + /// An integer representing the minor iOS version. + /// Examples: "1", "2". #[serde(rename="minorVersion")] pub minor_version: Option, - /// Output only. An opaque id for this iOS version. + /// An opaque id for this iOS version. /// Use this id to invoke the TestExecutionService. pub id: Option, - /// Output only. Tags for this dimension. - /// Examples: "default", "preview", "deprecated" - pub tags: Option>, + /// The available Xcode versions for this version. + #[serde(rename="supportedXcodeVersionIds")] + pub supported_xcode_version_ids: Option>, } impl Part for IosVersion {} -/// A single iOS device. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct IosDevice { - /// Required. The locale the test device used for testing. - /// Use the EnvironmentDiscoveryService to get supported options. - pub locale: Option, - /// Required. The id of the iOS major software version to be used. - /// Use the EnvironmentDiscoveryService to get supported options. - #[serde(rename="iosVersionId")] - pub ios_version_id: Option, - /// Required. How the device is oriented during the test. - /// Use the EnvironmentDiscoveryService to get supported options. - pub orientation: Option, - /// Required. The id of the iOS device to be used. - /// Use the EnvironmentDiscoveryService to get supported options. - #[serde(rename="iosModelId")] - pub ios_model_id: Option, +pub struct NetworkConfiguration { + /// The unique opaque id for this network traffic configuration. + pub id: Option, + /// The emulation rule applying to the download traffic. + #[serde(rename="downRule")] + pub down_rule: Option, + /// The emulation rule applying to the upload traffic. + #[serde(rename="upRule")] + pub up_rule: Option, } -impl Part for IosDevice {} +impl Part for NetworkConfiguration {} /// Screen orientation of the device. @@ -1558,61 +1538,37 @@ impl Part for IosDevice {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Orientation { /// The id for this orientation. - /// Example: "portrait" - /// @OutputOnly + /// Example: "portrait". pub id: Option, /// A human-friendly name for this orientation. - /// Example: "portrait" - /// @OutputOnly + /// Example: "portrait". pub name: Option, /// Tags for this dimension. - /// Examples: "default" + /// Example: "default". pub tags: Option>, } impl Part for Orientation {} -/// Key-value pair of detailed information about the client which invoked the -/// test. For example {'Version', '1.0'}, {'Release Track', 'BETA'} -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ClientInfoDetail { - /// The value of detailed client information. - /// Required - pub value: Option, - /// The key of detailed client information. - /// Required - pub key: Option, -} - -impl Part for ClientInfoDetail {} - - /// A location/region designation for language. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Locale { - /// A human-friendly string representing the region for this locale. - /// Example: "United States" - /// Not present for every locale. - /// @OutputOnly + /// A human-friendly string representing the region for this + /// locale. Example: "United States". Not present for every locale. pub region: Option, - /// Tags for this dimension. - /// Examples: "default" - pub tags: Option>, /// The id for this locale. - /// Example: "en_US" - /// @OutputOnly + /// Example: "en_US". pub id: Option, /// A human-friendly name for this language/locale. - /// Example: "English" - /// @OutputOnly + /// Example: "English". pub name: Option, + /// Tags for this dimension. + /// Example: "default". + pub tags: Option>, } impl Part for Locale {} @@ -1625,10 +1581,8 @@ impl Part for Locale {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AndroidRuntimeConfiguration { /// The set of available orientations. - /// @OutputOnly pub orientations: Option>, /// The set of available locales. - /// @OutputOnly pub locales: Option>, } @@ -1646,15 +1600,15 @@ impl Part for AndroidRuntimeConfiguration {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestEnvironmentCatalog { - /// Supported network configurations - #[serde(rename="networkConfigurationCatalog")] - pub network_configuration_catalog: Option, - /// Android devices suitable for running Android Instrumentation Tests. - #[serde(rename="androidDeviceCatalog")] - pub android_device_catalog: Option, - /// Supported iOS devices + /// Supported iOS devices. #[serde(rename="iosDeviceCatalog")] pub ios_device_catalog: Option, + /// Supported Android devices. + #[serde(rename="androidDeviceCatalog")] + pub android_device_catalog: Option, + /// Supported network configurations. + #[serde(rename="networkConfigurationCatalog")] + pub network_configuration_catalog: Option, /// The software test environment provided by TestExecutionService. #[serde(rename="softwareCatalog")] pub software_catalog: Option, @@ -1663,77 +1617,19 @@ pub struct TestEnvironmentCatalog { impl ResponseResult for TestEnvironmentCatalog {} -/// A description of an Android device tests may be run on. +/// A key-value pair passed as an environment variable to the test. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AndroidModel { - /// Whether this device is a phone, tablet, wearable, etc. - /// @OutputOnly - #[serde(rename="formFactor")] - pub form_factor: Option, - /// The human-readable marketing name for this device model. - /// Examples: "Nexus 5", "Galaxy S5" - /// @OutputOnly - pub name: Option, - /// Whether this device is virtual or physical. - /// @OutputOnly - pub form: Option, - /// True if and only if tests with this model DO NOT have video output. - /// See also TestSpecification.disable_video_recording - /// @OutputOnly - #[serde(rename="videoRecordingNotSupported")] - pub video_recording_not_supported: Option, - /// Screen density in DPI. - /// This corresponds to ro.sf.lcd_density - /// @OutputOnly - #[serde(rename="screenDensity")] - pub screen_density: Option, - /// The company that this device is branded with. - /// Example: "Google", "Samsung" - /// @OutputOnly - pub brand: Option, - /// Tags for this dimension. - /// Examples: "default", "preview", "deprecated" - pub tags: Option>, - /// The unique opaque id for this model. - /// Use this for invoking the TestExecutionService. - /// @OutputOnly - pub id: Option, - /// The set of Android versions this device supports. - /// @OutputOnly - #[serde(rename="supportedVersionIds")] - pub supported_version_ids: Option>, - /// The list of supported ABIs for this device. - /// This corresponds to either android.os.Build.SUPPORTED_ABIS (for API level - /// 21 and above) or android.os.Build.CPU_ABI/CPU_ABI2. - /// The most preferred ABI is the first element in the list. - /// - /// Elements are optionally prefixed by "version_id:" (where version_id is - /// the id of an AndroidVersion), denoting an ABI that is supported only on - /// a particular version. - /// @OutputOnly - #[serde(rename="supportedAbis")] - pub supported_abis: Option>, - /// Screen size in the horizontal (X) dimension measured in pixels. - /// @OutputOnly - #[serde(rename="screenX")] - pub screen_x: Option, - /// Screen size in the vertical (Y) dimension measured in pixels. - /// @OutputOnly - #[serde(rename="screenY")] - pub screen_y: Option, - /// The manufacturer of this device. - /// @OutputOnly - pub manufacturer: Option, - /// The name of the industrial design. - /// This corresponds to android.os.Build.DEVICE - /// @OutputOnly - pub codename: Option, +pub struct EnvironmentVariable { + /// Key for the environment variable. + pub key: Option, + /// Value for the environment variable. + pub value: Option, } -impl Part for AndroidModel {} +impl Part for EnvironmentVariable {} /// An Android package file to install. @@ -1743,11 +1639,10 @@ impl Part for AndroidModel {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Apk { /// The java package for the APK to be installed. - /// Optional, value is determined by examining the application's manifest. + /// Value is determined by examining the application's manifest. #[serde(rename="packageName")] pub package_name: Option, /// The path to an APK to be installed on the device before the test begins. - /// Optional pub location: Option, } @@ -1760,37 +1655,76 @@ impl Part for Apk {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IosDeviceCatalog { - /// Output only. The set of supported iOS device models. + /// The set of supported iOS device models. pub models: Option>, - /// Output only. The set of supported Xcode versions. + /// The set of supported Xcode versions. #[serde(rename="xcodeVersions")] pub xcode_versions: Option>, - /// Output only. The set of supported runtime configurations. + /// The set of supported runtime configurations. #[serde(rename="runtimeConfiguration")] pub runtime_configuration: Option, - /// Output only. The set of supported iOS software versions. + /// The set of supported iOS software versions. pub versions: Option>, } impl Part for IosDeviceCatalog {} -/// A storage location within Google cloud storage (GCS). +/// A group of one or more TestExecutions, built by taking a +/// product of values over a pre-defined set of axes. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [test matrices create projects](struct.ProjectTestMatriceCreateCall.html) (request|response) +/// * [test matrices get projects](struct.ProjectTestMatriceGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudStorage { - /// The path to a directory in GCS that will - /// eventually contain the results for this test. - /// The requesting user must have write access on the bucket in the supplied - /// path. - /// Required - #[serde(rename="gcsPath")] - pub gcs_path: Option, +pub struct TestMatrix { + /// Information about the client which invoked the test. + #[serde(rename="clientInfo")] + pub client_info: Option, + /// The cloud project that owns the test matrix. + #[serde(rename="projectId")] + pub project_id: Option, + /// Required. Where the results for the matrix are written. + #[serde(rename="resultStorage")] + pub result_storage: Option, + /// The number of times a TestExecution should be re-attempted if one or more + /// of its test cases fail for any reason. + /// The maximum number of reruns allowed is 10. + /// + /// Default is 0, which implies no reruns. + #[serde(rename="flakyTestAttempts")] + pub flaky_test_attempts: Option, + /// Output only. Indicates the current progress of the test matrix + /// (e.g., FINISHED). + pub state: Option, + /// Output only. The list of test executions that the service creates for + /// this matrix. + #[serde(rename="testExecutions")] + pub test_executions: Option>, + /// Required. How to run the test. + #[serde(rename="testSpecification")] + pub test_specification: Option, + /// Output only. Unique id set by the service. + #[serde(rename="testMatrixId")] + pub test_matrix_id: Option, + /// Output only. The time this test matrix was initially created. + pub timestamp: Option, + /// Output only. Describes why the matrix is considered invalid. + /// Only useful for matrices in the INVALID state. + #[serde(rename="invalidMatrixDetails")] + pub invalid_matrix_details: Option, + /// Required. How the host machine(s) are configured. + #[serde(rename="environmentMatrix")] + pub environment_matrix: Option, } -impl Part for GoogleCloudStorage {} +impl RequestValue for TestMatrix {} +impl ResponseResult for TestMatrix {} /// Specifies an intent that starts the main launcher activity. @@ -1820,25 +1754,19 @@ pub struct DeviceFile { impl Part for DeviceFile {} -/// Response containing the current state of the specified test matrix. +/// Android application details based on application manifest and apk archive +/// contents. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [test matrices cancel projects](struct.ProjectTestMatriceCancelCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CancelTestMatrixResponse { - /// The current rolled-up state of the test matrix. - /// If this state is already final, then the cancelation request will - /// have no effect. - #[serde(rename="testState")] - pub test_state: Option, +pub struct ApkDetail { + /// no description provided + #[serde(rename="apkManifest")] + pub apk_manifest: Option, } -impl ResponseResult for CancelTestMatrixResponse {} +impl Part for ApkDetail {} /// iOS configuration that can be selected at the time a test is run. @@ -1847,25 +1775,25 @@ impl ResponseResult for CancelTestMatrixResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IosRuntimeConfiguration { - /// Output only. The set of available orientations. + /// The set of available orientations. pub orientations: Option>, - /// Output only. The set of available locales. + /// The set of available locales. pub locales: Option>, } impl Part for IosRuntimeConfiguration {} -/// A file or directory to install on the device before the test starts +/// A file or directory to install on the device before the test starts. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RegularFile { - /// Required + /// Required. The source file. pub content: Option, - /// Where to put the content on the device. Must be an absolute, whitelisted - /// path. If the file exists, it will be replaced. + /// Required. Where to put the content on the device. Must be an absolute, + /// whitelisted path. If the file exists, it will be replaced. /// The following device-side directories and any of their subdirectories are /// whitelisted: ///

${EXTERNAL_STORAGE}, or /sdcard

@@ -1881,7 +1809,6 @@ pub struct RegularFile { /// "http://developer.android.com/reference/android/os/Environment.html"> /// Environment API in app and test code to access files on the device in a /// portable way. - /// Required #[serde(rename="devicePath")] pub device_path: Option, } @@ -1964,7 +1891,7 @@ impl<'a, C, A> TestEnvironmentCatalogMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Get the catalog of supported test environments. + /// Gets the catalog of supported test environments. /// /// May return any of the following canonical error codes: /// @@ -1974,8 +1901,7 @@ impl<'a, C, A> TestEnvironmentCatalogMethods<'a, C, A> { /// /// # Arguments /// - /// * `environmentType` - The type of environment that should be listed. - /// Required + /// * `environmentType` - Required. The type of environment that should be listed. pub fn get(&self, environment_type: &str) -> TestEnvironmentCatalogGetCall<'a, C, A> { TestEnvironmentCatalogGetCall { hub: self.hub, @@ -2031,7 +1957,7 @@ impl<'a, C, A> ApplicationDetailServiceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Request the details of an Android application APK. + /// Gets the details of an Android application APK. /// /// # Arguments /// @@ -2090,7 +2016,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Request to run a matrix of tests according to the given specifications. + /// Creates and runs a matrix of tests according to the given specifications. /// Unsupported environments will be returned in the state UNSUPPORTED. /// Matrices are limited to at most 200 supported executions. /// @@ -2145,7 +2071,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Check the status of a test matrix. + /// Checks the status of a test matrix. /// /// May return any of the following canonical error codes: /// @@ -2177,7 +2103,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Get the catalog of supported test environments. +/// Gets the catalog of supported test environments. /// /// May return any of the following canonical error codes: /// @@ -2286,10 +2212,7 @@ impl<'a, C, A> TestEnvironmentCatalogGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2309,7 +2232,7 @@ impl<'a, C, A> TestEnvironmentCatalogGetCall<'a, C, A> where C: BorrowMut TestEnvironmentCatalogGetCall<'a, C, A> where C: BorrowMut TestEnvironmentCatalogGetCall<'a, C, A> where C: BorrowMut TestEnvironmentCatalogGetCall<'a, C, A> { @@ -2396,7 +2317,7 @@ impl<'a, C, A> TestEnvironmentCatalogGetCall<'a, C, A> where C: BorrowMut TestEnvironmentCatalogGetCall<'a, C, A> where C: BorrowMut ApplicationDetailServiceGetApkDetailCall<'a, C, A> where C: Borro } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2561,7 +2479,7 @@ impl<'a, C, A> ApplicationDetailServiceGetApkDetailCall<'a, C, A> where C: Borro request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2641,7 +2559,7 @@ impl<'a, C, A> ApplicationDetailServiceGetApkDetailCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2689,7 +2607,7 @@ impl<'a, C, A> ApplicationDetailServiceGetApkDetailCall<'a, C, A> where C: Borro } -/// Request to run a matrix of tests according to the given specifications. +/// Creates and runs a matrix of tests according to the given specifications. /// Unsupported environments will be returned in the state UNSUPPORTED. /// Matrices are limited to at most 200 supported executions. /// @@ -2807,10 +2725,7 @@ impl<'a, C, A> ProjectTestMatriceCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2842,7 +2757,7 @@ impl<'a, C, A> ProjectTestMatriceCreateCall<'a, C, A> where C: BorrowMut ProjectTestMatriceCreateCall<'a, C, A> where C: BorrowMut ProjectTestMatriceCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3123,7 +3035,7 @@ impl<'a, C, A> ProjectTestMatriceCancelCall<'a, C, A> where C: BorrowMut ProjectTestMatriceCancelCall<'a, C, A> where C: BorrowMut ProjectTestMatriceCancelCall<'a, C, A> where C: BorrowMut ProjectTestMatriceGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3388,7 +3297,7 @@ impl<'a, C, A> ProjectTestMatriceGetCall<'a, C, A> where C: BorrowMut ProjectTestMatriceGetCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with Texttospeech (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/texttospeech1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-texttospeech1] path = "../texttospeech1" -version = "1.0.8+20181005" +version = "1.0.8+20190322" diff --git a/gen/texttospeech1-cli/README.md b/gen/texttospeech1-cli/README.md index 69dd68c818..ccc2f0c59f 100644 --- a/gen/texttospeech1-cli/README.md +++ b/gen/texttospeech1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Texttospeech* API at revision *20181005*. The CLI is at version *1.0.8*. +This documentation was generated from the *Texttospeech* API at revision *20190322*. The CLI is at version *1.0.8*. ```bash texttospeech1 [options] diff --git a/gen/texttospeech1-cli/mkdocs.yml b/gen/texttospeech1-cli/mkdocs.yml index abc8754e9a..ea4e15393a 100644 --- a/gen/texttospeech1-cli/mkdocs.yml +++ b/gen/texttospeech1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Texttospeech v1.0.8+20181005 +site_name: Texttospeech v1.0.8+20190322 site_url: http://byron.github.io/google-apis-rs/google-texttospeech1-cli site_description: A complete library to interact with Texttospeech (protocol v1) diff --git a/gen/texttospeech1-cli/src/main.rs b/gen/texttospeech1-cli/src/main.rs index c76a6ce8b0..81a728960d 100644 --- a/gen/texttospeech1-cli/src/main.rs +++ b/gen/texttospeech1-cli/src/main.rs @@ -75,12 +75,13 @@ impl<'n> Engine<'n> { "voice.language-code" => Some(("voice.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "voice.name" => Some(("voice.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "audio-config.audio-encoding" => Some(("audioConfig.audioEncoding", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "audio-config.volume-gain-db" => Some(("audioConfig.volumeGainDb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "audio-config.effects-profile-id" => Some(("audioConfig.effectsProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "audio-config.sample-rate-hertz" => Some(("audioConfig.sampleRateHertz", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "audio-config.speaking-rate" => Some(("audioConfig.speakingRate", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "audio-config.pitch" => Some(("audioConfig.pitch", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "audio-config.speaking-rate" => Some(("audioConfig.speakingRate", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "audio-config.volume-gain-db" => Some(("audioConfig.volumeGainDb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["audio-config", "audio-encoding", "input", "language-code", "name", "pitch", "sample-rate-hertz", "speaking-rate", "ssml", "ssml-gender", "text", "voice", "volume-gain-db"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["audio-config", "audio-encoding", "effects-profile-id", "input", "language-code", "name", "pitch", "sample-rate-hertz", "speaking-rate", "ssml", "ssml-gender", "text", "voice", "volume-gain-db"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -357,7 +358,7 @@ fn main() { let mut app = App::new("texttospeech1") .author("Sebastian Thiel ") - .version("1.0.8+20181005") + .version("1.0.8+20190322") .about("Synthesizes natural-sounding speech by applying powerful neural network models.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_texttospeech1_cli") .arg(Arg::with_name("url") diff --git a/gen/texttospeech1/Cargo.toml b/gen/texttospeech1/Cargo.toml index 0a6957e0ca..f93e655c14 100644 --- a/gen/texttospeech1/Cargo.toml +++ b/gen/texttospeech1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-texttospeech1" -version = "1.0.8+20181005" +version = "1.0.8+20190322" authors = ["Sebastian Thiel "] description = "A complete library to interact with Texttospeech (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/texttospeech1" homepage = "https://cloud.google.com/text-to-speech/" -documentation = "https://docs.rs/google-texttospeech1/1.0.8+20181005" +documentation = "https://docs.rs/google-texttospeech1/1.0.8+20190322" license = "MIT" keywords = ["texttospeech", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/texttospeech1/README.md b/gen/texttospeech1/README.md index 783f0807da..f66a732651 100644 --- a/gen/texttospeech1/README.md +++ b/gen/texttospeech1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-texttospeech1` library allows access to all features of the *Google Texttospeech* service. -This documentation was generated from *Texttospeech* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *texttospeech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Texttospeech* crate version *1.0.8+20190322*, where *20190322* is the exact revision of the *texttospeech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Texttospeech* *v1* API can be found at the [official documentation site](https://cloud.google.com/text-to-speech/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/struct.Texttospeech.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/struct.Texttospeech.html) ... * text - * [*synthesize*](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/struct.TextSynthesizeCall.html) -* [voices](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/struct.Voice.html) - * [*list*](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/struct.VoiceListCall.html) + * [*synthesize*](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/struct.TextSynthesizeCall.html) +* [voices](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/struct.Voice.html) + * [*list*](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/struct.VoiceListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/struct.Texttospeech.html)** +* **[Hub](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/struct.Texttospeech.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.Part.html)** + * **[Parts](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -127,17 +127,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -147,29 +147,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-texttospeech1/1.0.8+20181005/google_texttospeech1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-texttospeech1/1.0.8+20190322/google_texttospeech1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/texttospeech1/src/lib.rs b/gen/texttospeech1/src/lib.rs index cc8e84e5a7..c8a3363d39 100644 --- a/gen/texttospeech1/src/lib.rs +++ b/gen/texttospeech1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Texttospeech* crate version *1.0.8+20181005*, where *20181005* is the exact revision of the *texttospeech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Texttospeech* crate version *1.0.8+20190322*, where *20190322* is the exact revision of the *texttospeech:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Texttospeech* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/text-to-speech/). @@ -434,6 +434,23 @@ impl RequestValue for SynthesizeSpeechRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AudioConfig { + /// An identifier which selects 'audio effects' profiles that are applied on + /// (post synthesized) text to speech. + /// Effects are applied on top of each other in the order they are given. + /// See + /// + /// [audio-profiles](https: + /// //cloud.google.com/text-to-speech/docs/audio-profiles) + /// for current supported profile ids. + #[serde(rename="effectsProfileId")] + pub effects_profile_id: Option>, + /// Required. The format of the requested audio byte stream. + #[serde(rename="audioEncoding")] + pub audio_encoding: Option, + /// Optional speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 + /// semitones from the original pitch. -20 means decrease 20 semitones from the + /// original pitch. + pub pitch: Option, /// The synthesis sample rate (in hertz) for this audio. Optional. If this is /// different from the voice's natural sample rate, then the synthesizer will /// honor this request by converting to the desired sample rate (which might @@ -442,13 +459,6 @@ pub struct AudioConfig { /// and return google.rpc.Code.INVALID_ARGUMENT. #[serde(rename="sampleRateHertz")] pub sample_rate_hertz: Option, - /// Optional speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 - /// semitones from the original pitch. -20 means decrease 20 semitones from the - /// original pitch. - pub pitch: Option, - /// Required. The format of the requested audio byte stream. - #[serde(rename="audioEncoding")] - pub audio_encoding: Option, /// Optional speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal /// native speed supported by the specific voice. 2.0 is twice as fast, and /// 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any @@ -763,10 +773,7 @@ impl<'a, C, A> TextSynthesizeCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -798,7 +805,7 @@ impl<'a, C, A> TextSynthesizeCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -878,7 +885,7 @@ impl<'a, C, A> TextSynthesizeCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -886,12 +893,12 @@ impl<'a, C, A> TextSynthesizeCall<'a, C, A> where C: BorrowMut, A /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> TextSynthesizeCall<'a, C, A> @@ -1006,10 +1013,7 @@ impl<'a, C, A> VoiceListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1029,7 +1033,7 @@ impl<'a, C, A> VoiceListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1111,7 +1115,7 @@ impl<'a, C, A> VoiceListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1119,12 +1123,12 @@ impl<'a, C, A> VoiceListCall<'a, C, A> where C: BorrowMut, A: oau /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *access_token* (query-string) - OAuth access token. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> VoiceListCall<'a, C, A> diff --git a/gen/tpu1-cli/Cargo.toml b/gen/tpu1-cli/Cargo.toml index f662c332ad..526ea4f160 100644 --- a/gen/tpu1-cli/Cargo.toml +++ b/gen/tpu1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-tpu1-cli" -version = "1.0.8+20181010" +version = "1.0.8+20190312" authors = ["Sebastian Thiel "] description = "A complete library to interact with TPU (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tpu1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-tpu1] path = "../tpu1" -version = "1.0.8+20181010" +version = "1.0.8+20190312" diff --git a/gen/tpu1-cli/README.md b/gen/tpu1-cli/README.md index a247497183..68bc12d18c 100644 --- a/gen/tpu1-cli/README.md +++ b/gen/tpu1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *TPU* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *TPU* API at revision *20190312*. The CLI is at version *1.0.8*. ```bash tpu1 [options] diff --git a/gen/tpu1-cli/mkdocs.yml b/gen/tpu1-cli/mkdocs.yml index 8fd0d2322b..86dde9d277 100644 --- a/gen/tpu1-cli/mkdocs.yml +++ b/gen/tpu1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: TPU v1.0.8+20181010 +site_name: TPU v1.0.8+20190312 site_url: http://byron.github.io/google-apis-rs/google-tpu1-cli site_description: A complete library to interact with TPU (protocol v1) diff --git a/gen/tpu1-cli/src/main.rs b/gen/tpu1-cli/src/main.rs index 1d75f247a7..f843fce879 100644 --- a/gen/tpu1-cli/src/main.rs +++ b/gen/tpu1-cli/src/main.rs @@ -1708,7 +1708,7 @@ fn main() { let mut app = App::new("tpu1") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190312") .about("TPU API provides customers with access to Google TPU technology.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_tpu1_cli") .arg(Arg::with_name("url") diff --git a/gen/tpu1/Cargo.toml b/gen/tpu1/Cargo.toml index a9fe7c9307..0c2347c052 100644 --- a/gen/tpu1/Cargo.toml +++ b/gen/tpu1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-tpu1" -version = "1.0.8+20181010" +version = "1.0.8+20190312" authors = ["Sebastian Thiel "] description = "A complete library to interact with TPU (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tpu1" homepage = "https://cloud.google.com/tpu/" -documentation = "https://docs.rs/google-tpu1/1.0.8+20181010" +documentation = "https://docs.rs/google-tpu1/1.0.8+20190312" license = "MIT" keywords = ["tpu", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/tpu1/README.md b/gen/tpu1/README.md index 28b5b590ff..9b1e6263c2 100644 --- a/gen/tpu1/README.md +++ b/gen/tpu1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-tpu1` library allows access to all features of the *Google TPU* service. -This documentation was generated from *TPU* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *tpu:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *TPU* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *tpu:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *TPU* *v1* API can be found at the [official documentation site](https://cloud.google.com/tpu/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.TPU.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.TPU.html) ... * projects - * [*locations accelerator types get*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationAcceleratorTypeGetCall.html), [*locations accelerator types list*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationAcceleratorTypeListCall.html), [*locations get*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationListCall.html), [*locations nodes create*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationNodeCreateCall.html), [*locations nodes delete*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationNodeDeleteCall.html), [*locations nodes get*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationNodeGetCall.html), [*locations nodes list*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationNodeListCall.html), [*locations nodes reimage*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationNodeReimageCall.html), [*locations nodes start*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationNodeStartCall.html), [*locations nodes stop*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationNodeStopCall.html), [*locations operations cancel*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationOperationGetCall.html), [*locations operations list*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationOperationListCall.html), [*locations tensorflow versions get*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationTensorflowVersionGetCall.html) and [*locations tensorflow versions list*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.ProjectLocationTensorflowVersionListCall.html) + * [*locations accelerator types get*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationAcceleratorTypeGetCall.html), [*locations accelerator types list*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationAcceleratorTypeListCall.html), [*locations get*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationListCall.html), [*locations nodes create*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationNodeCreateCall.html), [*locations nodes delete*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationNodeDeleteCall.html), [*locations nodes get*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationNodeGetCall.html), [*locations nodes list*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationNodeListCall.html), [*locations nodes reimage*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationNodeReimageCall.html), [*locations nodes start*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationNodeStartCall.html), [*locations nodes stop*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationNodeStopCall.html), [*locations operations cancel*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationOperationGetCall.html), [*locations operations list*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationOperationListCall.html), [*locations tensorflow versions get*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationTensorflowVersionGetCall.html) and [*locations tensorflow versions list*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.ProjectLocationTensorflowVersionListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/struct.TPU.html)** +* **[Hub](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/struct.TPU.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.Part.html)** + * **[Parts](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -136,17 +136,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -156,29 +156,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-tpu1/1.0.8+20181010/google_tpu1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-tpu1/1.0.8+20190312/google_tpu1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/tpu1/src/lib.rs b/gen/tpu1/src/lib.rs index f0ab85a713..a142aa22db 100644 --- a/gen/tpu1/src/lib.rs +++ b/gen/tpu1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *TPU* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *tpu:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *TPU* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *tpu:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *TPU* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/tpu/). @@ -377,17 +377,17 @@ impl<'a, C, A> TPU // ############ // SCHEMAS ### // ########## -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -464,172 +464,6 @@ pub struct NetworkEndpoint { impl Part for NetworkEndpoint {} -/// The response message for Locations.ListLocations. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations list projects](struct.ProjectLocationListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListLocationsResponse { - /// The standard List next-page token. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// A list of locations that matches the specified filter in the request. - pub locations: Option>, -} - -impl ResponseResult for ListLocationsResponse {} - - -/// A resource that represents Google Cloud Platform location. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Location { - /// The canonical id for this location. For example: `"us-east1"`. - #[serde(rename="locationId")] - pub location_id: Option, - /// Cross-service attributes for the location. For example - /// - /// {"cloud.googleapis.com/region": "us-east1"} - pub labels: Option>, - /// The friendly name for this location, typically a nearby city name. - /// For example, "Tokyo". - #[serde(rename="displayName")] - pub display_name: Option, - /// Resource name for the location, which may vary between implementations. - /// For example: `"projects/example-project/locations/us-east1"` - pub name: Option, - /// Service-specific metadata. For example the available capacity at the given - /// location. - pub metadata: Option>, -} - -impl ResponseResult for Location {} - - -/// Response for ListNodes. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations nodes list projects](struct.ProjectLocationNodeListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListNodesResponse { - /// The next page token or empty if none. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Locations that could not be reached. - pub unreachable: Option>, - /// The listed nodes. - pub nodes: Option>, -} - -impl ResponseResult for ListNodesResponse {} - - -/// This resource represents a long-running operation that is the result of a -/// network API call. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations operations get projects](struct.ProjectLocationOperationGetCall.html) (response) -/// * [locations nodes reimage projects](struct.ProjectLocationNodeReimageCall.html) (response) -/// * [locations nodes delete projects](struct.ProjectLocationNodeDeleteCall.html) (response) -/// * [locations nodes stop projects](struct.ProjectLocationNodeStopCall.html) (response) -/// * [locations nodes start projects](struct.ProjectLocationNodeStartCall.html) (response) -/// * [locations nodes create projects](struct.ProjectLocationNodeCreateCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// The error result of the operation in case of failure or cancellation. - pub error: Option, - /// If the value is `false`, it means the operation is still in progress. - /// If `true`, the operation is completed, and either `error` or `response` is - /// available. - pub done: Option, - /// The normal response of the operation in case of success. If the original - /// method returns no data on success, such as `Delete`, the response is - /// `google.protobuf.Empty`. If the original method is standard - /// `Get`/`Create`/`Update`, the response should be the resource. For other - /// methods, the response should have the type `XxxResponse`, where `Xxx` - /// is the original method name. For example, if the original method name - /// is `TakeSnapshot()`, the inferred response type is - /// `TakeSnapshotResponse`. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that - /// originally returns it. If you use the default HTTP mapping, the - /// `name` should have the format of `operations/some/unique/name`. - pub name: Option, - /// Service-specific metadata associated with the operation. It typically - /// contains progress information and common metadata such as create time. - /// Some services might not provide such metadata. Any method that returns a - /// long-running operation should document the metadata type, if any. - pub metadata: Option>, -} - -impl ResponseResult for Operation {} - - -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations operations delete projects](struct.ProjectLocationOperationDeleteCall.html) (response) -/// * [locations operations cancel projects](struct.ProjectLocationOperationCancelCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - -/// Request for ReimageNode. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations nodes reimage projects](struct.ProjectLocationNodeReimageCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReimageNodeRequest { - /// The version for reimage to create. - #[serde(rename="tensorflowVersion")] - pub tensorflow_version: Option, -} - -impl RequestValue for ReimageNodeRequest {} - - /// A TPU instance. /// /// # Activities @@ -717,6 +551,160 @@ impl RequestValue for Node {} impl ResponseResult for Node {} +/// The response message for Locations.ListLocations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations list projects](struct.ProjectLocationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLocationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of locations that matches the specified filter in the request. + pub locations: Option>, +} + +impl ResponseResult for ListLocationsResponse {} + + +/// A resource that represents Google Cloud Platform location. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Location { + /// The friendly name for this location, typically a nearby city name. + /// For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, + /// Resource name for the location, which may vary between implementations. + /// For example: `"projects/example-project/locations/us-east1"` + pub name: Option, + /// Service-specific metadata. For example the available capacity at the given + /// location. + pub metadata: Option>, +} + +impl ResponseResult for Location {} + + +/// Response for ListNodes. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations nodes list projects](struct.ProjectLocationNodeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListNodesResponse { + /// The next page token or empty if none. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Locations that could not be reached. + pub unreachable: Option>, + /// The listed nodes. + pub nodes: Option>, +} + +impl ResponseResult for ListNodesResponse {} + + +/// A accelerator type that a Node can be configured with. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations accelerator types get projects](struct.ProjectLocationAcceleratorTypeGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AcceleratorType { + /// the accelerator type. + #[serde(rename="type")] + pub type_: Option, + /// The resource name. + pub name: Option, +} + +impl ResponseResult for AcceleratorType {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations operations delete projects](struct.ProjectLocationOperationDeleteCall.html) (response) +/// * [locations operations cancel projects](struct.ProjectLocationOperationCancelCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// Request for ReimageNode. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations nodes reimage projects](struct.ProjectLocationNodeReimageCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReimageNodeRequest { + /// The version for reimage to create. + #[serde(rename="tensorflowVersion")] + pub tensorflow_version: Option, +} + +impl RequestValue for ReimageNodeRequest {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SchedulingConfig { + /// no description provided + pub preemptible: Option, +} + +impl Part for SchedulingConfig {} + + /// Request for StopNode. /// /// # Activities @@ -765,11 +753,11 @@ impl ResponseResult for ListTensorFlowVersionsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListOperationsResponse { - /// A list of operations that matches the specified filter in the request. - pub operations: Option>, /// The standard List next-page token. #[serde(rename="nextPageToken")] pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, } impl ResponseResult for ListOperationsResponse {} @@ -817,19 +805,6 @@ pub struct TensorFlowVersion { impl ResponseResult for TensorFlowVersion {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SchedulingConfig { - /// no description provided - pub preemptible: Option, -} - -impl Part for SchedulingConfig {} - - /// Request for StartNode. /// /// # Activities @@ -845,25 +820,50 @@ pub struct StartNodeRequest { _never_set: Option } impl RequestValue for StartNodeRequest {} -/// A accelerator type that a Node can be configured with. +/// This resource represents a long-running operation that is the result of a +/// network API call. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations accelerator types get projects](struct.ProjectLocationAcceleratorTypeGetCall.html) (response) +/// * [locations operations get projects](struct.ProjectLocationOperationGetCall.html) (response) +/// * [locations nodes reimage projects](struct.ProjectLocationNodeReimageCall.html) (response) +/// * [locations nodes delete projects](struct.ProjectLocationNodeDeleteCall.html) (response) +/// * [locations nodes stop projects](struct.ProjectLocationNodeStopCall.html) (response) +/// * [locations nodes start projects](struct.ProjectLocationNodeStartCall.html) (response) +/// * [locations nodes create projects](struct.ProjectLocationNodeCreateCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AcceleratorType { - /// the accelerator type. - #[serde(rename="type")] - pub type_: Option, - /// The resource name. +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, } -impl ResponseResult for AcceleratorType {} +impl ResponseResult for Operation {} @@ -1172,17 +1172,19 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists nodes. + /// List TensorFlow versions supported by this API. /// /// # Arguments /// /// * `parent` - The parent resource name. - pub fn locations_nodes_list(&self, parent: &str) -> ProjectLocationNodeListCall<'a, C, A> { - ProjectLocationNodeListCall { + pub fn locations_tensorflow_versions_list(&self, parent: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + ProjectLocationTensorflowVersionListCall { hub: self.hub, _parent: parent.to_string(), _page_token: Default::default(), _page_size: Default::default(), + _order_by: Default::default(), + _filter: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1228,19 +1230,17 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// List TensorFlow versions supported by this API. + /// Lists nodes. /// /// # Arguments /// /// * `parent` - The parent resource name. - pub fn locations_tensorflow_versions_list(&self, parent: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { - ProjectLocationTensorflowVersionListCall { + pub fn locations_nodes_list(&self, parent: &str) -> ProjectLocationNodeListCall<'a, C, A> { + ProjectLocationNodeListCall { hub: self.hub, _parent: parent.to_string(), _page_token: Default::default(), _page_size: Default::default(), - _order_by: Default::default(), - _filter: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1366,7 +1366,7 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1405,7 +1402,7 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationAcceleratorTypeGetCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1654,10 +1651,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeGetCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1677,7 +1671,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeGetCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1755,7 +1749,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeGetCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1909,7 +1903,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeListCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1925,10 +1919,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeListCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1948,7 +1939,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeListCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2054,7 +2045,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeListCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2203,7 +2194,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2242,7 +2230,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeReimageCall<'a, C, A> where C: BorrowMut ProjectLocationNodeReimageCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2533,7 +2518,7 @@ impl<'a, C, A> ProjectLocationNodeReimageCall<'a, C, A> where C: BorrowMut ProjectLocationNodeReimageCall<'a, C, A> where C: BorrowMut ProjectLocationTensorflowVersionGetCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2773,10 +2758,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionGetCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2796,7 +2778,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionGetCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2874,7 +2856,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionGetCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3010,7 +2992,7 @@ impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3049,7 +3028,7 @@ impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationNodeDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3300,7 +3276,7 @@ impl<'a, C, A> ProjectLocationNodeDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationNodeDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3554,7 +3527,7 @@ impl<'a, C, A> ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStopCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStopCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3824,7 +3794,7 @@ impl<'a, C, A> ProjectLocationNodeStopCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStopCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4096,7 +4063,7 @@ impl<'a, C, A> ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4347,7 +4311,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4617,7 +4578,7 @@ impl<'a, C, A> ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut +pub struct ProjectLocationTensorflowVersionListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TPU, _parent: String, _page_token: Option, _page_size: Option, + _order_by: Option, + _filter: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectLocationNodeListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectLocationTensorflowVersionListCall<'a, C, A> {} -impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListNodesResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListTensorFlowVersionsResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -4815,9 +4780,9 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tpu.projects.locations.nodes.list", + dlg.begin(MethodInfo { id: "tpu.projects.locations.tensorflowVersions.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -4825,7 +4790,13 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4890,7 +4858,7 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { self._parent = new_value.to_string(); self } /// The next_page_token value returned from a previous List request, if any. /// /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectLocationNodeListCall<'a, C, A> { + pub fn page_token(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } /// The maximum number of items to return. /// /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectLocationNodeListCall<'a, C, A> { + pub fn page_size(mut self, new_value: i32) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { self._page_size = Some(new_value); self } + /// Sort results. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// List filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationNodeListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -4982,7 +4964,7 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationNodeListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectLocationTensorflowVersionListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -5018,7 +5000,7 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLocationNodeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLocationTensorflowVersionListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -5064,7 +5046,7 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeCreateCall<'a, C, A> where C: BorrowMut ProjectLocationNodeCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5179,7 +5158,7 @@ impl<'a, C, A> ProjectLocationNodeCreateCall<'a, C, A> where C: BorrowMut ProjectLocationNodeCreateCall<'a, C, A> where C: BorrowMut ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5449,7 +5425,7 @@ impl<'a, C, A> ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut +pub struct ProjectLocationNodeListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TPU, _parent: String, _page_token: Option, _page_size: Option, - _order_by: Option, - _filter: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectLocationTensorflowVersionListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectLocationNodeListCall<'a, C, A> {} -impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListTensorFlowVersionsResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListNodesResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -5639,9 +5611,9 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tpu.projects.locations.tensorflowVersions.list", + dlg.begin(MethodInfo { id: "tpu.projects.locations.nodes.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -5649,13 +5621,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro if let Some(value) = self._page_size { params.push(("pageSize", value.to_string())); } - if let Some(value) = self._order_by { - params.push(("orderBy", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize", "orderBy", "filter"].iter() { + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5667,7 +5633,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/{+parent}/tensorflowVersions"; + let mut url = self.hub._base_url.clone() + "v1/{+parent}/nodes"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -5681,7 +5647,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5697,10 +5663,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5720,7 +5683,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5779,45 +5742,31 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> ProjectLocationNodeListCall<'a, C, A> { self._parent = new_value.to_string(); self } /// The next_page_token value returned from a previous List request, if any. /// /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + pub fn page_token(mut self, new_value: &str) -> ProjectLocationNodeListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } /// The maximum number of items to return. /// /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + pub fn page_size(mut self, new_value: i32) -> ProjectLocationNodeListCall<'a, C, A> { self._page_size = Some(new_value); self } - /// Sort results. - /// - /// Sets the *order by* query property to the given value. - pub fn order_by(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { - self._order_by = Some(new_value.to_string()); - self - } - /// List filter. - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationNodeListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -5826,7 +5775,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5842,7 +5791,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectLocationTensorflowVersionListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectLocationNodeListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -5862,7 +5811,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectLocationTensorflowVersionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLocationNodeListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { diff --git a/gen/tpu1_alpha1-cli/Cargo.toml b/gen/tpu1_alpha1-cli/Cargo.toml index f4d0a65d46..46e70efdef 100644 --- a/gen/tpu1_alpha1-cli/Cargo.toml +++ b/gen/tpu1_alpha1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-tpu1_alpha1-cli" -version = "1.0.8+20181010" +version = "1.0.8+20190312" authors = ["Sebastian Thiel "] description = "A complete library to interact with TPU (protocol v1alpha1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tpu1_alpha1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-tpu1_alpha1] path = "../tpu1_alpha1" -version = "1.0.8+20181010" +version = "1.0.8+20190312" diff --git a/gen/tpu1_alpha1-cli/README.md b/gen/tpu1_alpha1-cli/README.md index e827e0e636..52baef44d3 100644 --- a/gen/tpu1_alpha1-cli/README.md +++ b/gen/tpu1_alpha1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *TPU* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *TPU* API at revision *20190312*. The CLI is at version *1.0.8*. ```bash tpu1-alpha1 [options] diff --git a/gen/tpu1_alpha1-cli/mkdocs.yml b/gen/tpu1_alpha1-cli/mkdocs.yml index 6c0a0f24c3..c43bed2478 100644 --- a/gen/tpu1_alpha1-cli/mkdocs.yml +++ b/gen/tpu1_alpha1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: TPU v1.0.8+20181010 +site_name: TPU v1.0.8+20190312 site_url: http://byron.github.io/google-apis-rs/google-tpu1_alpha1-cli site_description: A complete library to interact with TPU (protocol v1alpha1) diff --git a/gen/tpu1_alpha1-cli/src/main.rs b/gen/tpu1_alpha1-cli/src/main.rs index a79067db0e..49a2ff7e53 100644 --- a/gen/tpu1_alpha1-cli/src/main.rs +++ b/gen/tpu1_alpha1-cli/src/main.rs @@ -305,7 +305,7 @@ impl<'n> Engine<'n> { "health-description" => Some(("healthDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "service-account" => Some(("serviceAccount", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "port" => Some(("port", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "tensorflow-version" => Some(("tensorflowVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -313,7 +313,7 @@ impl<'n> Engine<'n> { "health" => Some(("health", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "accelerator-type" => Some(("acceleratorType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cidr-block" => Some(("cidrBlock", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "port" => Some(("port", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["accelerator-type", "cidr-block", "create-time", "description", "health", "health-description", "ip-address", "labels", "name", "network", "port", "preemptible", "scheduling-config", "service-account", "state", "tensorflow-version"]); @@ -1708,7 +1708,7 @@ fn main() { let mut app = App::new("tpu1-alpha1") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190312") .about("TPU API provides customers with access to Google TPU technology.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_tpu1_alpha1_cli") .arg(Arg::with_name("url") diff --git a/gen/tpu1_alpha1/Cargo.toml b/gen/tpu1_alpha1/Cargo.toml index 0efbfb74a1..6a5aef4a79 100644 --- a/gen/tpu1_alpha1/Cargo.toml +++ b/gen/tpu1_alpha1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-tpu1_alpha1" -version = "1.0.8+20181010" +version = "1.0.8+20190312" authors = ["Sebastian Thiel "] description = "A complete library to interact with TPU (protocol v1alpha1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tpu1_alpha1" homepage = "https://cloud.google.com/tpu/" -documentation = "https://docs.rs/google-tpu1_alpha1/1.0.8+20181010" +documentation = "https://docs.rs/google-tpu1_alpha1/1.0.8+20190312" license = "MIT" keywords = ["tpu", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/tpu1_alpha1/README.md b/gen/tpu1_alpha1/README.md index d48276fd14..a2dac6f2fe 100644 --- a/gen/tpu1_alpha1/README.md +++ b/gen/tpu1_alpha1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-tpu1_alpha1` library allows access to all features of the *Google TPU* service. -This documentation was generated from *TPU* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *tpu:v1alpha1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *TPU* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *tpu:v1alpha1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *TPU* *v1_alpha1* API can be found at the [official documentation site](https://cloud.google.com/tpu/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.TPU.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.TPU.html) ... * projects - * [*locations accelerator types get*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationAcceleratorTypeGetCall.html), [*locations accelerator types list*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationAcceleratorTypeListCall.html), [*locations get*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationListCall.html), [*locations nodes create*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationNodeCreateCall.html), [*locations nodes delete*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationNodeDeleteCall.html), [*locations nodes get*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationNodeGetCall.html), [*locations nodes list*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationNodeListCall.html), [*locations nodes reimage*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationNodeReimageCall.html), [*locations nodes start*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationNodeStartCall.html), [*locations nodes stop*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationNodeStopCall.html), [*locations operations cancel*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationOperationGetCall.html), [*locations operations list*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationOperationListCall.html), [*locations tensorflow versions get*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationTensorflowVersionGetCall.html) and [*locations tensorflow versions list*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.ProjectLocationTensorflowVersionListCall.html) + * [*locations accelerator types get*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationAcceleratorTypeGetCall.html), [*locations accelerator types list*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationAcceleratorTypeListCall.html), [*locations get*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationGetCall.html), [*locations list*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationListCall.html), [*locations nodes create*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationNodeCreateCall.html), [*locations nodes delete*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationNodeDeleteCall.html), [*locations nodes get*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationNodeGetCall.html), [*locations nodes list*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationNodeListCall.html), [*locations nodes reimage*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationNodeReimageCall.html), [*locations nodes start*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationNodeStartCall.html), [*locations nodes stop*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationNodeStopCall.html), [*locations operations cancel*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationOperationCancelCall.html), [*locations operations delete*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationOperationDeleteCall.html), [*locations operations get*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationOperationGetCall.html), [*locations operations list*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationOperationListCall.html), [*locations tensorflow versions get*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationTensorflowVersionGetCall.html) and [*locations tensorflow versions list*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.ProjectLocationTensorflowVersionListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/struct.TPU.html)** +* **[Hub](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/struct.TPU.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.Part.html)** + * **[Parts](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -136,17 +136,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -156,29 +156,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-tpu1_alpha1/1.0.8+20181010/google_tpu1_alpha1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-tpu1_alpha1/1.0.8+20190312/google_tpu1_alpha1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/tpu1_alpha1/src/lib.rs b/gen/tpu1_alpha1/src/lib.rs index dac2ad9bbf..a7a8b80e2b 100644 --- a/gen/tpu1_alpha1/src/lib.rs +++ b/gen/tpu1_alpha1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *TPU* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *tpu:v1alpha1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *TPU* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *tpu:v1alpha1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *TPU* *v1_alpha1* API can be found at the //! [official documentation site](https://cloud.google.com/tpu/). @@ -377,17 +377,17 @@ impl<'a, C, A> TPU // ############ // SCHEMAS ### // ########## -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -464,172 +464,6 @@ pub struct NetworkEndpoint { impl Part for NetworkEndpoint {} -/// The response message for Locations.ListLocations. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations list projects](struct.ProjectLocationListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListLocationsResponse { - /// The standard List next-page token. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// A list of locations that matches the specified filter in the request. - pub locations: Option>, -} - -impl ResponseResult for ListLocationsResponse {} - - -/// A resource that represents Google Cloud Platform location. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Location { - /// The canonical id for this location. For example: `"us-east1"`. - #[serde(rename="locationId")] - pub location_id: Option, - /// Cross-service attributes for the location. For example - /// - /// {"cloud.googleapis.com/region": "us-east1"} - pub labels: Option>, - /// The friendly name for this location, typically a nearby city name. - /// For example, "Tokyo". - #[serde(rename="displayName")] - pub display_name: Option, - /// Resource name for the location, which may vary between implementations. - /// For example: `"projects/example-project/locations/us-east1"` - pub name: Option, - /// Service-specific metadata. For example the available capacity at the given - /// location. - pub metadata: Option>, -} - -impl ResponseResult for Location {} - - -/// Response for ListNodes. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations nodes list projects](struct.ProjectLocationNodeListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListNodesResponse { - /// The next page token or empty if none. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Locations that could not be reached. - pub unreachable: Option>, - /// The listed nodes. - pub nodes: Option>, -} - -impl ResponseResult for ListNodesResponse {} - - -/// This resource represents a long-running operation that is the result of a -/// network API call. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations operations get projects](struct.ProjectLocationOperationGetCall.html) (response) -/// * [locations nodes reimage projects](struct.ProjectLocationNodeReimageCall.html) (response) -/// * [locations nodes delete projects](struct.ProjectLocationNodeDeleteCall.html) (response) -/// * [locations nodes stop projects](struct.ProjectLocationNodeStopCall.html) (response) -/// * [locations nodes start projects](struct.ProjectLocationNodeStartCall.html) (response) -/// * [locations nodes create projects](struct.ProjectLocationNodeCreateCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// The error result of the operation in case of failure or cancellation. - pub error: Option, - /// If the value is `false`, it means the operation is still in progress. - /// If `true`, the operation is completed, and either `error` or `response` is - /// available. - pub done: Option, - /// The normal response of the operation in case of success. If the original - /// method returns no data on success, such as `Delete`, the response is - /// `google.protobuf.Empty`. If the original method is standard - /// `Get`/`Create`/`Update`, the response should be the resource. For other - /// methods, the response should have the type `XxxResponse`, where `Xxx` - /// is the original method name. For example, if the original method name - /// is `TakeSnapshot()`, the inferred response type is - /// `TakeSnapshotResponse`. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that - /// originally returns it. If you use the default HTTP mapping, the - /// `name` should have the format of `operations/some/unique/name`. - pub name: Option, - /// Service-specific metadata associated with the operation. It typically - /// contains progress information and common metadata such as create time. - /// Some services might not provide such metadata. Any method that returns a - /// long-running operation should document the metadata type, if any. - pub metadata: Option>, -} - -impl ResponseResult for Operation {} - - -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations operations delete projects](struct.ProjectLocationOperationDeleteCall.html) (response) -/// * [locations operations cancel projects](struct.ProjectLocationOperationCancelCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - -/// Request for ReimageNode. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [locations nodes reimage projects](struct.ProjectLocationNodeReimageCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReimageNodeRequest { - /// The version for reimage to create. - #[serde(rename="tensorflowVersion")] - pub tensorflow_version: Option, -} - -impl RequestValue for ReimageNodeRequest {} - - /// A TPU instance. /// /// # Activities @@ -675,9 +509,9 @@ pub struct Node { #[serde(rename="cidrBlock")] pub cidr_block: Option, /// Output only. - /// DEPRECATED! Use network_endpoints instead. - /// The network port for the TPU Node as visible to Compute Engine instances. - pub port: Option, + /// The time when the node was created. + #[serde(rename="createTime")] + pub create_time: Option, /// Output only. /// The immutable name of the TPU pub name: Option, @@ -693,9 +527,9 @@ pub struct Node { #[serde(rename="serviceAccount")] pub service_account: Option, /// Output only. - /// The time when the node was created. - #[serde(rename="createTime")] - pub create_time: Option, + /// DEPRECATED! Use network_endpoints instead. + /// The network port for the TPU Node as visible to Compute Engine instances. + pub port: Option, /// The version of Tensorflow running in the Node. /// Required. #[serde(rename="tensorflowVersion")] @@ -717,6 +551,160 @@ impl RequestValue for Node {} impl ResponseResult for Node {} +/// The response message for Locations.ListLocations. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations list projects](struct.ProjectLocationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLocationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of locations that matches the specified filter in the request. + pub locations: Option>, +} + +impl ResponseResult for ListLocationsResponse {} + + +/// A resource that represents Google Cloud Platform location. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations get projects](struct.ProjectLocationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Location { + /// The friendly name for this location, typically a nearby city name. + /// For example, "Tokyo". + #[serde(rename="displayName")] + pub display_name: Option, + /// Cross-service attributes for the location. For example + /// + /// {"cloud.googleapis.com/region": "us-east1"} + pub labels: Option>, + /// The canonical id for this location. For example: `"us-east1"`. + #[serde(rename="locationId")] + pub location_id: Option, + /// Resource name for the location, which may vary between implementations. + /// For example: `"projects/example-project/locations/us-east1"` + pub name: Option, + /// Service-specific metadata. For example the available capacity at the given + /// location. + pub metadata: Option>, +} + +impl ResponseResult for Location {} + + +/// Response for ListNodes. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations nodes list projects](struct.ProjectLocationNodeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListNodesResponse { + /// The next page token or empty if none. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Locations that could not be reached. + pub unreachable: Option>, + /// The listed nodes. + pub nodes: Option>, +} + +impl ResponseResult for ListNodesResponse {} + + +/// A accelerator type that a Node can be configured with. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations accelerator types get projects](struct.ProjectLocationAcceleratorTypeGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AcceleratorType { + /// the accelerator type. + #[serde(rename="type")] + pub type_: Option, + /// The resource name. + pub name: Option, +} + +impl ResponseResult for AcceleratorType {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations operations delete projects](struct.ProjectLocationOperationDeleteCall.html) (response) +/// * [locations operations cancel projects](struct.ProjectLocationOperationCancelCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// Request for ReimageNode. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations nodes reimage projects](struct.ProjectLocationNodeReimageCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReimageNodeRequest { + /// The version for reimage to create. + #[serde(rename="tensorflowVersion")] + pub tensorflow_version: Option, +} + +impl RequestValue for ReimageNodeRequest {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SchedulingConfig { + /// no description provided + pub preemptible: Option, +} + +impl Part for SchedulingConfig {} + + /// Request for StopNode. /// /// # Activities @@ -817,19 +805,6 @@ pub struct TensorFlowVersion { impl ResponseResult for TensorFlowVersion {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SchedulingConfig { - /// no description provided - pub preemptible: Option, -} - -impl Part for SchedulingConfig {} - - /// Request for StartNode. /// /// # Activities @@ -845,25 +820,50 @@ pub struct StartNodeRequest { _never_set: Option } impl RequestValue for StartNodeRequest {} -/// A accelerator type that a Node can be configured with. +/// This resource represents a long-running operation that is the result of a +/// network API call. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [locations accelerator types get projects](struct.ProjectLocationAcceleratorTypeGetCall.html) (response) +/// * [locations operations get projects](struct.ProjectLocationOperationGetCall.html) (response) +/// * [locations nodes reimage projects](struct.ProjectLocationNodeReimageCall.html) (response) +/// * [locations nodes delete projects](struct.ProjectLocationNodeDeleteCall.html) (response) +/// * [locations nodes stop projects](struct.ProjectLocationNodeStopCall.html) (response) +/// * [locations nodes start projects](struct.ProjectLocationNodeStartCall.html) (response) +/// * [locations nodes create projects](struct.ProjectLocationNodeCreateCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AcceleratorType { - /// the accelerator type. - #[serde(rename="type")] - pub type_: Option, - /// The resource name. +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, } -impl ResponseResult for AcceleratorType {} +impl ResponseResult for Operation {} @@ -1172,17 +1172,19 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists nodes. + /// Lists TensorFlow versions supported by this API. /// /// # Arguments /// /// * `parent` - The parent resource name. - pub fn locations_nodes_list(&self, parent: &str) -> ProjectLocationNodeListCall<'a, C, A> { - ProjectLocationNodeListCall { + pub fn locations_tensorflow_versions_list(&self, parent: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + ProjectLocationTensorflowVersionListCall { hub: self.hub, _parent: parent.to_string(), _page_token: Default::default(), _page_size: Default::default(), + _order_by: Default::default(), + _filter: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1228,19 +1230,17 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists TensorFlow versions supported by this API. + /// Lists nodes. /// /// # Arguments /// /// * `parent` - The parent resource name. - pub fn locations_tensorflow_versions_list(&self, parent: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { - ProjectLocationTensorflowVersionListCall { + pub fn locations_nodes_list(&self, parent: &str) -> ProjectLocationNodeListCall<'a, C, A> { + ProjectLocationNodeListCall { hub: self.hub, _parent: parent.to_string(), _page_token: Default::default(), _page_size: Default::default(), - _order_by: Default::default(), - _filter: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1366,7 +1366,7 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1405,7 +1402,7 @@ impl<'a, C, A> ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationOperationListCall<'a, C, A> where C: BorrowMut ProjectLocationAcceleratorTypeGetCall<'a, C, A> where C: BorrowMu } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1654,10 +1651,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeGetCall<'a, C, A> where C: BorrowMu } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1677,7 +1671,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeGetCall<'a, C, A> where C: BorrowMu let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1755,7 +1749,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeGetCall<'a, C, A> where C: BorrowMu /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1909,7 +1903,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeListCall<'a, C, A> where C: BorrowM } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1925,10 +1919,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeListCall<'a, C, A> where C: BorrowM } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1948,7 +1939,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeListCall<'a, C, A> where C: BorrowM let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2054,7 +2045,7 @@ impl<'a, C, A> ProjectLocationAcceleratorTypeListCall<'a, C, A> where C: BorrowM /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2203,7 +2194,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2242,7 +2230,7 @@ impl<'a, C, A> ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeReimageCall<'a, C, A> where C: BorrowMut ProjectLocationNodeReimageCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2533,7 +2518,7 @@ impl<'a, C, A> ProjectLocationNodeReimageCall<'a, C, A> where C: BorrowMut ProjectLocationNodeReimageCall<'a, C, A> where C: BorrowMut ProjectLocationTensorflowVersionGetCall<'a, C, A> where C: Borrow } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2773,10 +2758,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionGetCall<'a, C, A> where C: Borrow } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2796,7 +2778,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionGetCall<'a, C, A> where C: Borrow let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2874,7 +2856,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionGetCall<'a, C, A> where C: Borrow /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3010,7 +2992,7 @@ impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3049,7 +3028,7 @@ impl<'a, C, A> ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationOperationGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationNodeDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3300,7 +3276,7 @@ impl<'a, C, A> ProjectLocationNodeDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationNodeDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3554,7 +3527,7 @@ impl<'a, C, A> ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationOperationDeleteCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStopCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStopCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3824,7 +3794,7 @@ impl<'a, C, A> ProjectLocationNodeStopCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStopCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4096,7 +4063,7 @@ impl<'a, C, A> ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationOperationCancelCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4347,7 +4311,7 @@ impl<'a, C, A> ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4617,7 +4578,7 @@ impl<'a, C, A> ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut ProjectLocationNodeStartCall<'a, C, A> where C: BorrowMut +pub struct ProjectLocationTensorflowVersionListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TPU, _parent: String, _page_token: Option, _page_size: Option, + _order_by: Option, + _filter: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectLocationNodeListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectLocationTensorflowVersionListCall<'a, C, A> {} -impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListNodesResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListTensorFlowVersionsResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -4815,9 +4780,9 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tpu.projects.locations.nodes.list", + dlg.begin(MethodInfo { id: "tpu.projects.locations.tensorflowVersions.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -4825,7 +4790,13 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4890,7 +4858,7 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { self._parent = new_value.to_string(); self } /// The next_page_token value returned from a previous List request, if any. /// /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectLocationNodeListCall<'a, C, A> { + pub fn page_token(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } /// The maximum number of items to return. /// /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectLocationNodeListCall<'a, C, A> { + pub fn page_size(mut self, new_value: i32) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { self._page_size = Some(new_value); self } + /// Sort results. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// List filter. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationNodeListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -4982,7 +4964,7 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> ProjectLocationNodeListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectLocationTensorflowVersionListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -5018,7 +5000,7 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLocationNodeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLocationTensorflowVersionListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -5064,7 +5046,7 @@ impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut ProjectLocationNodeCreateCall<'a, C, A> where C: BorrowMut ProjectLocationNodeCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5179,7 +5158,7 @@ impl<'a, C, A> ProjectLocationNodeCreateCall<'a, C, A> where C: BorrowMut ProjectLocationNodeCreateCall<'a, C, A> where C: BorrowMut ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5449,7 +5425,7 @@ impl<'a, C, A> ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut ProjectLocationNodeGetCall<'a, C, A> where C: BorrowMut +pub struct ProjectLocationNodeListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a TPU, _parent: String, _page_token: Option, _page_size: Option, - _order_by: Option, - _filter: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ProjectLocationTensorflowVersionListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectLocationNodeListCall<'a, C, A> {} -impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectLocationNodeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListTensorFlowVersionsResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListNodesResponse)> { use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; @@ -5639,9 +5611,9 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tpu.projects.locations.tensorflowVersions.list", + dlg.begin(MethodInfo { id: "tpu.projects.locations.nodes.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("parent", self._parent.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -5649,13 +5621,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro if let Some(value) = self._page_size { params.push(("pageSize", value.to_string())); } - if let Some(value) = self._order_by { - params.push(("orderBy", value.to_string())); - } - if let Some(value) = self._filter { - params.push(("filter", value.to_string())); - } - for &field in ["alt", "parent", "pageToken", "pageSize", "orderBy", "filter"].iter() { + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5667,7 +5633,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1alpha1/{+parent}/tensorflowVersions"; + let mut url = self.hub._base_url.clone() + "v1alpha1/{+parent}/nodes"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } @@ -5681,7 +5647,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -5697,10 +5663,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5720,7 +5683,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -5779,45 +5742,31 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn parent(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + pub fn parent(mut self, new_value: &str) -> ProjectLocationNodeListCall<'a, C, A> { self._parent = new_value.to_string(); self } /// The next_page_token value returned from a previous List request, if any. /// /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + pub fn page_token(mut self, new_value: &str) -> ProjectLocationNodeListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } /// The maximum number of items to return. /// /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + pub fn page_size(mut self, new_value: i32) -> ProjectLocationNodeListCall<'a, C, A> { self._page_size = Some(new_value); self } - /// Sort results. - /// - /// Sets the *order by* query property to the given value. - pub fn order_by(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { - self._order_by = Some(new_value.to_string()); - self - } - /// List filter. - /// - /// Sets the *filter* query property to the given value. - pub fn filter(mut self, new_value: &str) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { - self._filter = Some(new_value.to_string()); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationTensorflowVersionListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationNodeListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -5826,7 +5775,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5842,7 +5791,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> ProjectLocationTensorflowVersionListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectLocationNodeListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -5862,7 +5811,7 @@ impl<'a, C, A> ProjectLocationTensorflowVersionListCall<'a, C, A> where C: Borro /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> ProjectLocationTensorflowVersionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLocationNodeListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { diff --git a/gen/translate2/Cargo.toml b/gen/translate2/Cargo.toml index a80cde714b..cfc53a5376 100644 --- a/gen/translate2/Cargo.toml +++ b/gen/translate2/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/translate2/src/lib.rs b/gen/translate2/src/lib.rs index 0ccda2e246..ac83301800 100644 --- a/gen/translate2/src/lib.rs +++ b/gen/translate2/src/lib.rs @@ -404,23 +404,22 @@ pub struct DetectionsListResponse { impl ResponseResult for DetectionsListResponse {} -/// The main language translation response message. +/// There is no detailed description. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [translate translations](struct.TranslationTranslateCall.html) (response) -/// * [list translations](struct.TranslationListCall.html) (response) +/// * [list languages](struct.LanguageListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TranslationsListResponse { - /// Translations contains list of translation results of given text - pub translations: Option>, +pub struct LanguagesListResponse { + /// List of source/target languages supported by the translation API. If target parameter is unspecified, the list is sorted by the ASCII code point order of the language code. If target parameter is specified, the list is sorted by the collation order of the language name in the target language. + pub languages: Option>, } -impl ResponseResult for TranslationsListResponse {} +impl ResponseResult for LanguagesListResponse {} /// An array of languages which we detect for the given text The most likely language list first. @@ -555,22 +554,23 @@ pub struct TranslationsResource { impl Part for TranslationsResource {} -/// There is no detailed description. +/// The main language translation response message. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list languages](struct.LanguageListCall.html) (response) +/// * [translate translations](struct.TranslationTranslateCall.html) (response) +/// * [list translations](struct.TranslationListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LanguagesListResponse { - /// List of source/target languages supported by the translation API. If target parameter is unspecified, the list is sorted by the ASCII code point order of the language code. If target parameter is specified, the list is sorted by the collation order of the language name in the target language. - pub languages: Option>, +pub struct TranslationsListResponse { + /// Translations contains list of translation results of given text + pub translations: Option>, } -impl ResponseResult for LanguagesListResponse {} +impl ResponseResult for TranslationsListResponse {} @@ -886,10 +886,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -909,7 +906,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -992,15 +989,15 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. @@ -1124,10 +1121,7 @@ impl<'a, C, A> DetectionDetectCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1159,7 +1153,7 @@ impl<'a, C, A> DetectionDetectCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1239,15 +1233,15 @@ impl<'a, C, A> DetectionDetectCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. @@ -1370,10 +1364,7 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1393,7 +1384,7 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1473,15 +1464,15 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. @@ -1605,10 +1596,7 @@ impl<'a, C, A> TranslationTranslateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1640,7 +1628,7 @@ impl<'a, C, A> TranslationTranslateCall<'a, C, A> where C: BorrowMut TranslationTranslateCall<'a, C, A> where C: BorrowMut TranslationListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1898,7 +1883,7 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2023,15 +2008,15 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. diff --git a/gen/urlshortener1/Cargo.toml b/gen/urlshortener1/Cargo.toml index 0e451eeaec..379ef3303e 100644 --- a/gen/urlshortener1/Cargo.toml +++ b/gen/urlshortener1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/urlshortener1/src/lib.rs b/gen/urlshortener1/src/lib.rs index 683304ed73..bca856cc7d 100644 --- a/gen/urlshortener1/src/lib.rs +++ b/gen/urlshortener1/src/lib.rs @@ -668,10 +668,7 @@ impl<'a, C, A> UrlInsertCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -703,7 +700,7 @@ impl<'a, C, A> UrlInsertCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -783,7 +780,7 @@ impl<'a, C, A> UrlInsertCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -909,10 +906,7 @@ impl<'a, C, A> UrlGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -932,7 +926,7 @@ impl<'a, C, A> UrlGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1017,7 +1011,7 @@ impl<'a, C, A> UrlGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1146,10 +1140,7 @@ impl<'a, C, A> UrlListCall<'a, C, A> where C: BorrowMut, A: oauth } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1169,7 +1160,7 @@ impl<'a, C, A> UrlListCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1251,7 +1242,7 @@ impl<'a, C, A> UrlListCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/vault1-cli/Cargo.toml b/gen/vault1-cli/Cargo.toml index 13571adf00..514ef3c253 100644 --- a/gen/vault1-cli/Cargo.toml +++ b/gen/vault1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-vault1-cli" -version = "1.0.8+20180827" +version = "1.0.8+20190312" authors = ["Sebastian Thiel "] description = "A complete library to interact with Vault (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/vault1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-vault1] path = "../vault1" -version = "1.0.8+20180827" +version = "1.0.8+20190312" diff --git a/gen/vault1-cli/README.md b/gen/vault1-cli/README.md index 6f45f1b1d9..040dfb5175 100644 --- a/gen/vault1-cli/README.md +++ b/gen/vault1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Vault* API at revision *20180827*. The CLI is at version *1.0.8*. +This documentation was generated from the *Vault* API at revision *20190312*. The CLI is at version *1.0.8*. ```bash vault1 [options] @@ -52,6 +52,10 @@ vault1 [options] list [-p ]... [-o ] remove-permissions (-r )... [-p ]... [-o ] reopen (-r )... [-p ]... [-o ] + saved-queries-create (-r )... [-p ]... [-o ] + saved-queries-delete [-p ]... [-o ] + saved-queries-get [-p ]... [-o ] + saved-queries-list [-p ]... [-o ] undelete (-r )... [-p ]... [-o ] update (-r )... [-p ]... [-o ] vault1 --help diff --git a/gen/vault1-cli/mkdocs.yml b/gen/vault1-cli/mkdocs.yml index 92a8f4d5fb..f497513ef4 100644 --- a/gen/vault1-cli/mkdocs.yml +++ b/gen/vault1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Vault v1.0.8+20180827 +site_name: Vault v1.0.8+20190312 site_url: http://byron.github.io/google-apis-rs/google-vault1-cli site_description: A complete library to interact with Vault (protocol v1) @@ -31,6 +31,10 @@ pages: - ['matters_list.md', 'Matters', 'List'] - ['matters_remove-permissions.md', 'Matters', 'Remove Permissions'] - ['matters_reopen.md', 'Matters', 'Reopen'] +- ['matters_saved-queries-create.md', 'Matters', 'Saved Queries Create'] +- ['matters_saved-queries-delete.md', 'Matters', 'Saved Queries Delete'] +- ['matters_saved-queries-get.md', 'Matters', 'Saved Queries Get'] +- ['matters_saved-queries-list.md', 'Matters', 'Saved Queries List'] - ['matters_undelete.md', 'Matters', 'Undelete'] - ['matters_update.md', 'Matters', 'Update'] diff --git a/gen/vault1-cli/src/main.rs b/gen/vault1-cli/src/main.rs index b1581234f0..f358c64048 100644 --- a/gen/vault1-cli/src/main.rs +++ b/gen/vault1-cli/src/main.rs @@ -243,8 +243,8 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "matter-id" => Some(("matterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "matter-id", "name", "state"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -388,8 +388,10 @@ impl<'n> Engine<'n> { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "matter-id" => Some(("matterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "export-options.mail-options.export-format" => Some(("exportOptions.mailOptions.exportFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "export-options.region" => Some(("exportOptions.region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "export-options.hangouts-chat-options.export-format" => Some(("exportOptions.hangoutsChatOptions.exportFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "export-options.mail-options.show-confidential-mode-content" => Some(("exportOptions.mailOptions.showConfidentialModeContent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "export-options.mail-options.export-format" => Some(("exportOptions.mailOptions.exportFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "export-options.drive-options.include-access-info" => Some(("exportOptions.driveOptions.includeAccessInfo", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "export-options.groups-options.export-format" => Some(("exportOptions.groupsOptions.exportFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "requester.display-name" => Some(("requester.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -411,7 +413,7 @@ impl<'n> Engine<'n> { "query.drive-options.include-team-drives" => Some(("query.driveOptions.includeTeamDrives", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-info", "corpus", "create-time", "data-scope", "display-name", "drive-options", "email", "emails", "end-time", "exclude-drafts", "export-format", "export-options", "exported-artifact-count", "groups-options", "hangouts-chat-info", "hangouts-chat-options", "id", "include-access-info", "include-rooms", "include-team-drives", "mail-options", "matter-id", "name", "org-unit-id", "org-unit-info", "query", "requester", "room-id", "search-method", "size-in-bytes", "start-time", "stats", "status", "team-drive-ids", "team-drive-info", "terms", "time-zone", "total-artifact-count", "version-date"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-info", "corpus", "create-time", "data-scope", "display-name", "drive-options", "email", "emails", "end-time", "exclude-drafts", "export-format", "export-options", "exported-artifact-count", "groups-options", "hangouts-chat-info", "hangouts-chat-options", "id", "include-access-info", "include-rooms", "include-team-drives", "mail-options", "matter-id", "name", "org-unit-id", "org-unit-info", "query", "region", "requester", "room-id", "search-method", "show-confidential-mode-content", "size-in-bytes", "start-time", "stats", "status", "team-drive-ids", "team-drive-info", "terms", "time-zone", "total-artifact-count", "version-date"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1651,6 +1653,272 @@ impl<'n> Engine<'n> { } } + fn _matters_saved_queries_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "matter-id" => Some(("matterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.terms" => Some(("query.terms", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.team-drive-info.team-drive-ids" => Some(("query.teamDriveInfo.teamDriveIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "query.mail-options.exclude-drafts" => Some(("query.mailOptions.excludeDrafts", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "query.search-method" => Some(("query.searchMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.hangouts-chat-info.room-id" => Some(("query.hangoutsChatInfo.roomId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "query.account-info.emails" => Some(("query.accountInfo.emails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "query.hangouts-chat-options.include-rooms" => Some(("query.hangoutsChatOptions.includeRooms", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "query.start-time" => Some(("query.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.org-unit-info.org-unit-id" => Some(("query.orgUnitInfo.orgUnitId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.time-zone" => Some(("query.timeZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.corpus" => Some(("query.corpus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.end-time" => Some(("query.endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.data-scope" => Some(("query.dataScope", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.drive-options.version-date" => Some(("query.driveOptions.versionDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "query.drive-options.include-team-drives" => Some(("query.driveOptions.includeTeamDrives", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "saved-query-id" => Some(("savedQueryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-info", "corpus", "create-time", "data-scope", "display-name", "drive-options", "emails", "end-time", "exclude-drafts", "hangouts-chat-info", "hangouts-chat-options", "include-rooms", "include-team-drives", "mail-options", "matter-id", "org-unit-id", "org-unit-info", "query", "room-id", "saved-query-id", "search-method", "start-time", "team-drive-ids", "team-drive-info", "terms", "time-zone", "version-date"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SavedQuery = json::value::from_value(object).unwrap(); + let mut call = self.hub.matters().saved_queries_create(request, opt.value_of("matter-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _matters_saved_queries_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.matters().saved_queries_delete(opt.value_of("matter-id").unwrap_or(""), opt.value_of("saved-query-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _matters_saved_queries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.matters().saved_queries_get(opt.value_of("matter-id").unwrap_or(""), opt.value_of("saved-query-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _matters_saved_queries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.matters().saved_queries_list(opt.value_of("matter-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _matters_undelete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { @@ -1760,8 +2028,8 @@ impl<'n> Engine<'n> { match &temp_cursor.to_string()[..] { "matter-id" => Some(("matterId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "matter-id", "name", "state"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -1896,6 +2164,18 @@ impl<'n> Engine<'n> { ("reopen", Some(opt)) => { call_result = self._matters_reopen(opt, dry_run, &mut err); }, + ("saved-queries-create", Some(opt)) => { + call_result = self._matters_saved_queries_create(opt, dry_run, &mut err); + }, + ("saved-queries-delete", Some(opt)) => { + call_result = self._matters_saved_queries_delete(opt, dry_run, &mut err); + }, + ("saved-queries-get", Some(opt)) => { + call_result = self._matters_saved_queries_get(opt, dry_run, &mut err); + }, + ("saved-queries-list", Some(opt)) => { + call_result = self._matters_saved_queries_list(opt, dry_run, &mut err); + }, ("undelete", Some(opt)) => { call_result = self._matters_undelete(opt, dry_run, &mut err); }, @@ -1993,7 +2273,7 @@ impl<'n> Engine<'n> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("matters", "methods: 'add-permissions', 'close', 'create', 'delete', 'exports-create', 'exports-delete', 'exports-get', 'exports-list', 'get', 'holds-accounts-create', 'holds-accounts-delete', 'holds-accounts-list', 'holds-add-held-accounts', 'holds-create', 'holds-delete', 'holds-get', 'holds-list', 'holds-remove-held-accounts', 'holds-update', 'list', 'remove-permissions', 'reopen', 'undelete' and 'update'", vec![ + ("matters", "methods: 'add-permissions', 'close', 'create', 'delete', 'exports-create', 'exports-delete', 'exports-get', 'exports-list', 'get', 'holds-accounts-create', 'holds-accounts-delete', 'holds-accounts-list', 'holds-add-held-accounts', 'holds-create', 'holds-delete', 'holds-get', 'holds-list', 'holds-remove-held-accounts', 'holds-update', 'list', 'remove-permissions', 'reopen', 'saved-queries-create', 'saved-queries-delete', 'saved-queries-get', 'saved-queries-list', 'undelete' and 'update'", vec![ ("add-permissions", Some(r##"Adds an account as a matter collaborator."##), "Details at http://byron.github.io/google-apis-rs/google_vault1_cli/matters_add-permissions", @@ -2607,6 +2887,117 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("saved-queries-create", + Some(r##"Creates a saved query."##), + "Details at http://byron.github.io/google-apis-rs/google_vault1_cli/matters_saved-queries-create", + vec![ + (Some(r##"matter-id"##), + None, + Some(r##"The matter id of the parent matter for which the saved query is to be + created."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("saved-queries-delete", + Some(r##"Deletes a saved query by Id."##), + "Details at http://byron.github.io/google-apis-rs/google_vault1_cli/matters_saved-queries-delete", + vec![ + (Some(r##"matter-id"##), + None, + Some(r##"The matter id of the parent matter for which the saved query is to be + deleted."##), + Some(true), + Some(false)), + + (Some(r##"saved-query-id"##), + None, + Some(r##"Id of the saved query to be deleted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("saved-queries-get", + Some(r##"Retrieves a saved query by Id."##), + "Details at http://byron.github.io/google-apis-rs/google_vault1_cli/matters_saved-queries-get", + vec![ + (Some(r##"matter-id"##), + None, + Some(r##"The matter id of the parent matter for which the saved query is to be + retrieved."##), + Some(true), + Some(false)), + + (Some(r##"saved-query-id"##), + None, + Some(r##"Id of the saved query to be retrieved."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("saved-queries-list", + Some(r##"Lists saved queries within a matter. An empty page token in + ListSavedQueriesResponse denotes no more saved queries to list."##), + "Details at http://byron.github.io/google-apis-rs/google_vault1_cli/matters_saved-queries-list", + vec![ + (Some(r##"matter-id"##), + None, + Some(r##"The matter id of the parent matter for which the saved queries are to be + retrieved."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -2678,7 +3069,7 @@ fn main() { let mut app = App::new("vault1") .author("Sebastian Thiel ") - .version("1.0.8+20180827") + .version("1.0.8+20190312") .about("Archiving and eDiscovery for G Suite.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_vault1_cli") .arg(Arg::with_name("url") diff --git a/gen/vault1/Cargo.toml b/gen/vault1/Cargo.toml index e82349d689..c2cba70a2b 100644 --- a/gen/vault1/Cargo.toml +++ b/gen/vault1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-vault1" -version = "1.0.8+20180827" +version = "1.0.8+20190312" authors = ["Sebastian Thiel "] description = "A complete library to interact with Vault (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/vault1" homepage = "https://developers.google.com/vault" -documentation = "https://docs.rs/google-vault1/1.0.8+20180827" +documentation = "https://docs.rs/google-vault1/1.0.8+20190312" license = "MIT" keywords = ["vault", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/vault1/README.md b/gen/vault1/README.md index c98ed4cd5e..612eb38b3e 100644 --- a/gen/vault1/README.md +++ b/gen/vault1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-vault1` library allows access to all features of the *Google Vault* service. -This documentation was generated from *Vault* crate version *1.0.8+20180827*, where *20180827* is the exact revision of the *vault:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Vault* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *vault:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Vault* *v1* API can be found at the [official documentation site](https://developers.google.com/vault). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.Vault.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.Vault.html) ... -* [matters](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.Matter.html) - * [*add permissions*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterAddPermissionCall.html), [*close*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterCloseCall.html), [*create*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterCreateCall.html), [*delete*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterDeleteCall.html), [*exports create*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterExportCreateCall.html), [*exports delete*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterExportDeleteCall.html), [*exports get*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterExportGetCall.html), [*exports list*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterExportListCall.html), [*get*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterGetCall.html), [*holds accounts create*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterHoldAccountCreateCall.html), [*holds accounts delete*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterHoldAccountDeleteCall.html), [*holds accounts list*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterHoldAccountListCall.html), [*holds add held accounts*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterHoldAddHeldAccountCall.html), [*holds create*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterHoldCreateCall.html), [*holds delete*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterHoldDeleteCall.html), [*holds get*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterHoldGetCall.html), [*holds list*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterHoldListCall.html), [*holds remove held accounts*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterHoldRemoveHeldAccountCall.html), [*holds update*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterHoldUpdateCall.html), [*list*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterListCall.html), [*remove permissions*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterRemovePermissionCall.html), [*reopen*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterReopenCall.html), [*undelete*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterUndeleteCall.html) and [*update*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.MatterUpdateCall.html) +* [matters](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.Matter.html) + * [*add permissions*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterAddPermissionCall.html), [*close*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterCloseCall.html), [*create*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterCreateCall.html), [*delete*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterDeleteCall.html), [*exports create*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterExportCreateCall.html), [*exports delete*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterExportDeleteCall.html), [*exports get*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterExportGetCall.html), [*exports list*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterExportListCall.html), [*get*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterGetCall.html), [*holds accounts create*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterHoldAccountCreateCall.html), [*holds accounts delete*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterHoldAccountDeleteCall.html), [*holds accounts list*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterHoldAccountListCall.html), [*holds add held accounts*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterHoldAddHeldAccountCall.html), [*holds create*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterHoldCreateCall.html), [*holds delete*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterHoldDeleteCall.html), [*holds get*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterHoldGetCall.html), [*holds list*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterHoldListCall.html), [*holds remove held accounts*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterHoldRemoveHeldAccountCall.html), [*holds update*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterHoldUpdateCall.html), [*list*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterListCall.html), [*remove permissions*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterRemovePermissionCall.html), [*reopen*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterReopenCall.html), [*saved queries create*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterSavedQueryCreateCall.html), [*saved queries delete*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterSavedQueryDeleteCall.html), [*saved queries get*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterSavedQueryGetCall.html), [*saved queries list*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterSavedQueryListCall.html), [*undelete*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterUndeleteCall.html) and [*update*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.MatterUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/struct.Vault.html)** +* **[Hub](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/struct.Vault.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.Part.html)** + * **[Parts](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -49,15 +49,17 @@ Or specifically ... ```ignore let r = hub.matters().holds_delete(...).doit() let r = hub.matters().holds_list(...).doit() +let r = hub.matters().saved_queries_delete(...).doit() let r = hub.matters().exports_create(...).doit() let r = hub.matters().update(...).doit() let r = hub.matters().holds_get(...).doit() let r = hub.matters().holds_accounts_list(...).doit() +let r = hub.matters().exports_list(...).doit() let r = hub.matters().exports_get(...).doit() let r = hub.matters().holds_add_held_accounts(...).doit() let r = hub.matters().undelete(...).doit() let r = hub.matters().remove_permissions(...).doit() -let r = hub.matters().holds_accounts_delete(...).doit() +let r = hub.matters().saved_queries_list(...).doit() let r = hub.matters().add_permissions(...).doit() let r = hub.matters().holds_update(...).doit() let r = hub.matters().close(...).doit() @@ -67,10 +69,12 @@ let r = hub.matters().holds_remove_held_accounts(...).doit() let r = hub.matters().create(...).doit() let r = hub.matters().list(...).doit() let r = hub.matters().reopen(...).doit() -let r = hub.matters().exports_list(...).doit() +let r = hub.matters().holds_accounts_delete(...).doit() let r = hub.matters().exports_delete(...).doit() let r = hub.matters().holds_accounts_create(...).doit() +let r = hub.matters().saved_queries_create(...).doit() let r = hub.matters().delete(...).doit() +let r = hub.matters().saved_queries_get(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -150,17 +154,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -170,29 +174,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-vault1/1.0.8+20180827/google_vault1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-vault1/1.0.8+20190312/google_vault1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/vault1/src/lib.rs b/gen/vault1/src/lib.rs index 26d252a714..00feefa43d 100644 --- a/gen/vault1/src/lib.rs +++ b/gen/vault1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Vault* crate version *1.0.8+20180827*, where *20180827* is the exact revision of the *vault:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Vault* crate version *1.0.8+20190312*, where *20190312* is the exact revision of the *vault:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Vault* *v1* API can be found at the //! [official documentation site](https://developers.google.com/vault). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.Vault.html) ... //! //! * [matters](struct.Matter.html) -//! * [*add permissions*](struct.MatterAddPermissionCall.html), [*close*](struct.MatterCloseCall.html), [*create*](struct.MatterCreateCall.html), [*delete*](struct.MatterDeleteCall.html), [*exports create*](struct.MatterExportCreateCall.html), [*exports delete*](struct.MatterExportDeleteCall.html), [*exports get*](struct.MatterExportGetCall.html), [*exports list*](struct.MatterExportListCall.html), [*get*](struct.MatterGetCall.html), [*holds accounts create*](struct.MatterHoldAccountCreateCall.html), [*holds accounts delete*](struct.MatterHoldAccountDeleteCall.html), [*holds accounts list*](struct.MatterHoldAccountListCall.html), [*holds add held accounts*](struct.MatterHoldAddHeldAccountCall.html), [*holds create*](struct.MatterHoldCreateCall.html), [*holds delete*](struct.MatterHoldDeleteCall.html), [*holds get*](struct.MatterHoldGetCall.html), [*holds list*](struct.MatterHoldListCall.html), [*holds remove held accounts*](struct.MatterHoldRemoveHeldAccountCall.html), [*holds update*](struct.MatterHoldUpdateCall.html), [*list*](struct.MatterListCall.html), [*remove permissions*](struct.MatterRemovePermissionCall.html), [*reopen*](struct.MatterReopenCall.html), [*undelete*](struct.MatterUndeleteCall.html) and [*update*](struct.MatterUpdateCall.html) +//! * [*add permissions*](struct.MatterAddPermissionCall.html), [*close*](struct.MatterCloseCall.html), [*create*](struct.MatterCreateCall.html), [*delete*](struct.MatterDeleteCall.html), [*exports create*](struct.MatterExportCreateCall.html), [*exports delete*](struct.MatterExportDeleteCall.html), [*exports get*](struct.MatterExportGetCall.html), [*exports list*](struct.MatterExportListCall.html), [*get*](struct.MatterGetCall.html), [*holds accounts create*](struct.MatterHoldAccountCreateCall.html), [*holds accounts delete*](struct.MatterHoldAccountDeleteCall.html), [*holds accounts list*](struct.MatterHoldAccountListCall.html), [*holds add held accounts*](struct.MatterHoldAddHeldAccountCall.html), [*holds create*](struct.MatterHoldCreateCall.html), [*holds delete*](struct.MatterHoldDeleteCall.html), [*holds get*](struct.MatterHoldGetCall.html), [*holds list*](struct.MatterHoldListCall.html), [*holds remove held accounts*](struct.MatterHoldRemoveHeldAccountCall.html), [*holds update*](struct.MatterHoldUpdateCall.html), [*list*](struct.MatterListCall.html), [*remove permissions*](struct.MatterRemovePermissionCall.html), [*reopen*](struct.MatterReopenCall.html), [*saved queries create*](struct.MatterSavedQueryCreateCall.html), [*saved queries delete*](struct.MatterSavedQueryDeleteCall.html), [*saved queries get*](struct.MatterSavedQueryGetCall.html), [*saved queries list*](struct.MatterSavedQueryListCall.html), [*undelete*](struct.MatterUndeleteCall.html) and [*update*](struct.MatterUpdateCall.html) //! //! //! @@ -49,15 +49,17 @@ //! ```ignore //! let r = hub.matters().holds_delete(...).doit() //! let r = hub.matters().holds_list(...).doit() +//! let r = hub.matters().saved_queries_delete(...).doit() //! let r = hub.matters().exports_create(...).doit() //! let r = hub.matters().update(...).doit() //! let r = hub.matters().holds_get(...).doit() //! let r = hub.matters().holds_accounts_list(...).doit() +//! let r = hub.matters().exports_list(...).doit() //! let r = hub.matters().exports_get(...).doit() //! let r = hub.matters().holds_add_held_accounts(...).doit() //! let r = hub.matters().undelete(...).doit() //! let r = hub.matters().remove_permissions(...).doit() -//! let r = hub.matters().holds_accounts_delete(...).doit() +//! let r = hub.matters().saved_queries_list(...).doit() //! let r = hub.matters().add_permissions(...).doit() //! let r = hub.matters().holds_update(...).doit() //! let r = hub.matters().close(...).doit() @@ -67,10 +69,12 @@ //! let r = hub.matters().create(...).doit() //! let r = hub.matters().list(...).doit() //! let r = hub.matters().reopen(...).doit() -//! let r = hub.matters().exports_list(...).doit() +//! let r = hub.matters().holds_accounts_delete(...).doit() //! let r = hub.matters().exports_delete(...).doit() //! let r = hub.matters().holds_accounts_create(...).doit() +//! let r = hub.matters().saved_queries_create(...).doit() //! let r = hub.matters().delete(...).doit() +//! let r = hub.matters().saved_queries_get(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -447,17 +451,22 @@ pub struct HangoutsChatInfo { impl Part for HangoutsChatInfo {} -/// Accounts to search +/// Response for batch create held accounts. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [holds add held accounts matters](struct.MatterHoldAddHeldAccountCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AccountInfo { - /// A set of accounts to search. - pub emails: Option>, +pub struct AddHeldAccountsResponse { + /// The list of responses, in the same order as the batch request. + pub responses: Option>, } -impl Part for AccountInfo {} +impl ResponseResult for AddHeldAccountsResponse {} /// Export advanced options @@ -466,12 +475,14 @@ impl Part for AccountInfo {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ExportOptions { - /// Option available for mail export. - #[serde(rename="mailOptions")] - pub mail_options: Option, /// Option available for Drive export. #[serde(rename="driveOptions")] pub drive_options: Option, + /// The requested export location. + pub region: Option, + /// Option available for mail export. + #[serde(rename="mailOptions")] + pub mail_options: Option, /// Option available for hangouts chat export. #[serde(rename="hangoutsChatOptions")] pub hangouts_chat_options: Option, @@ -682,66 +693,6 @@ pub struct HangoutsChatExportOptions { impl Part for HangoutsChatExportOptions {} -/// Stats of an export. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExportStats { - /// The size of export in bytes. - #[serde(rename="sizeInBytes")] - pub size_in_bytes: Option, - /// The number of documents already processed by the export. - #[serde(rename="exportedArtifactCount")] - pub exported_artifact_count: Option, - /// The number of documents to be exported. - #[serde(rename="totalArtifactCount")] - pub total_artifact_count: Option, -} - -impl Part for ExportStats {} - - -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [holds delete matters](struct.MatterHoldDeleteCall.html) (response) -/// * [holds accounts delete matters](struct.MatterHoldAccountDeleteCall.html) (response) -/// * [exports delete matters](struct.MatterExportDeleteCall.html) (response) -/// * [remove permissions matters](struct.MatterRemovePermissionCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } - -impl ResponseResult for Empty {} - - -/// The options for mail export. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MailExportOptions { - /// The export file format. - #[serde(rename="exportFormat")] - pub export_format: Option, -} - -impl Part for MailExportOptions {} - - /// An export file on cloud storage /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -766,6 +717,70 @@ pub struct CloudStorageFile { impl Part for CloudStorageFile {} +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [holds delete matters](struct.MatterHoldDeleteCall.html) (response) +/// * [holds accounts delete matters](struct.MatterHoldAccountDeleteCall.html) (response) +/// * [saved queries delete matters](struct.MatterSavedQueryDeleteCall.html) (response) +/// * [exports delete matters](struct.MatterExportDeleteCall.html) (response) +/// * [remove permissions matters](struct.MatterRemovePermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// The options for mail export. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MailExportOptions { + /// Set to true to export confidential mode content. + #[serde(rename="showConfidentialModeContent")] + pub show_confidential_mode_content: Option, + /// The export file format. + #[serde(rename="exportFormat")] + pub export_format: Option, +} + +impl Part for MailExportOptions {} + + +/// Stats of an export. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExportStats { + /// The size of export in bytes. + #[serde(rename="sizeInBytes")] + pub size_in_bytes: Option, + /// The number of documents already processed by the export. + #[serde(rename="exportedArtifactCount")] + pub exported_artifact_count: Option, + /// The number of documents to be exported. + #[serde(rename="totalArtifactCount")] + pub total_artifact_count: Option, +} + +impl Part for ExportStats {} + + /// Represents a hold within Vault. A hold restricts purging of /// artifacts based on the combination of the query and accounts restrictions. /// A hold can be configured to either apply to an explicitly configured set @@ -920,15 +935,17 @@ impl RequestValue for AddHeldAccountsRequest {} /// /// * [holds delete matters](struct.MatterHoldDeleteCall.html) (none) /// * [holds list matters](struct.MatterHoldListCall.html) (none) +/// * [saved queries delete matters](struct.MatterSavedQueryDeleteCall.html) (none) /// * [exports create matters](struct.MatterExportCreateCall.html) (none) /// * [update matters](struct.MatterUpdateCall.html) (request|response) /// * [holds get matters](struct.MatterHoldGetCall.html) (none) /// * [holds accounts list matters](struct.MatterHoldAccountListCall.html) (none) +/// * [exports list matters](struct.MatterExportListCall.html) (none) /// * [exports get matters](struct.MatterExportGetCall.html) (none) /// * [holds add held accounts matters](struct.MatterHoldAddHeldAccountCall.html) (none) /// * [undelete matters](struct.MatterUndeleteCall.html) (response) /// * [remove permissions matters](struct.MatterRemovePermissionCall.html) (none) -/// * [holds accounts delete matters](struct.MatterHoldAccountDeleteCall.html) (none) +/// * [saved queries list matters](struct.MatterSavedQueryListCall.html) (none) /// * [add permissions matters](struct.MatterAddPermissionCall.html) (none) /// * [holds update matters](struct.MatterHoldUpdateCall.html) (none) /// * [close matters](struct.MatterCloseCall.html) (none) @@ -938,27 +955,29 @@ impl RequestValue for AddHeldAccountsRequest {} /// * [create matters](struct.MatterCreateCall.html) (request|response) /// * [list matters](struct.MatterListCall.html) (none) /// * [reopen matters](struct.MatterReopenCall.html) (none) -/// * [exports list matters](struct.MatterExportListCall.html) (none) +/// * [holds accounts delete matters](struct.MatterHoldAccountDeleteCall.html) (none) /// * [exports delete matters](struct.MatterExportDeleteCall.html) (none) /// * [holds accounts create matters](struct.MatterHoldAccountCreateCall.html) (none) +/// * [saved queries create matters](struct.MatterSavedQueryCreateCall.html) (none) /// * [delete matters](struct.MatterDeleteCall.html) (response) +/// * [saved queries get matters](struct.MatterSavedQueryGetCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Matter { - /// List of users and access to the matter. Currently there is no programmer - /// defined limit on the number of permissions a matter can have. - #[serde(rename="matterPermissions")] - pub matter_permissions: Option>, /// The matter ID which is generated by the server. /// Should be blank when creating a new matter. #[serde(rename="matterId")] pub matter_id: Option, + /// List of users and access to the matter. Currently there is no programmer + /// defined limit on the number of permissions a matter can have. + #[serde(rename="matterPermissions")] + pub matter_permissions: Option>, /// The state of the matter. pub state: Option, - /// The name of the matter. - pub name: Option, /// The description of the matter. pub description: Option, + /// The name of the matter. + pub name: Option, } impl RequestValue for Matter {} @@ -1034,6 +1053,69 @@ pub struct AddHeldAccountResult { impl Part for AddHeldAccountResult {} +/// A query definition relevant for search & export. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Query { + /// The corpus-specific + /// search operators + /// used to generate search results. + pub terms: Option, + /// When 'TEAM_DRIVE' is chosen as search method, team_drive_info needs to be + /// specified. + #[serde(rename="teamDriveInfo")] + pub team_drive_info: Option, + /// For mail search, specify more options in this field. + #[serde(rename="mailOptions")] + pub mail_options: Option, + /// The search method to use. + #[serde(rename="searchMethod")] + pub search_method: Option, + /// When 'ROOM' is chosen as search method, hangout_chats_info needs to be + /// specified. (read-only) + #[serde(rename="hangoutsChatInfo")] + pub hangouts_chat_info: Option, + /// When 'ACCOUNT' is chosen as search method, + /// account_info needs to be specified. + #[serde(rename="accountInfo")] + pub account_info: Option, + /// For Drive search, specify more options in this field. + #[serde(rename="driveOptions")] + pub drive_options: Option, + /// The start time range for the search query. These timestamps are in GMT and + /// rounded down to the start of the given date. + #[serde(rename="startTime")] + pub start_time: Option, + /// When 'ORG_UNIT' is chosen as as search method, org_unit_info needs + /// to be specified. + #[serde(rename="orgUnitInfo")] + pub org_unit_info: Option, + /// The time zone name. + /// It should be an IANA TZ name, such as "America/Los_Angeles". + /// For more information, see + /// Time + /// Zone. + #[serde(rename="timeZone")] + pub time_zone: Option, + /// The corpus to search. + pub corpus: Option, + /// The end time range for the search query. These timestamps are in GMT and + /// rounded down to the start of the given date. + #[serde(rename="endTime")] + pub end_time: Option, + /// The data source to search from. + #[serde(rename="dataScope")] + pub data_scope: Option, + /// For hangouts chat search, specify more options in this field. (read-only) + #[serde(rename="hangoutsChatOptions")] + pub hangouts_chat_options: Option, +} + +impl Part for Query {} + + /// Remove a list of accounts from a hold. /// /// # Activities @@ -1144,22 +1226,25 @@ pub struct AddMatterPermissionsRequest { impl RequestValue for AddMatterPermissionsRequest {} -/// Returns a list of held accounts for a hold. +/// Query options for group holds. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [holds accounts list matters](struct.MatterHoldAccountListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListHeldAccountsResponse { - /// The held accounts on a hold. - pub accounts: Option>, +pub struct HeldGroupsQuery { + /// The end time range for the search query. These timestamps are in GMT and + /// rounded down to the start of the given date. + #[serde(rename="endTime")] + pub end_time: Option, + /// The search terms for the hold. + pub terms: Option, + /// The start time range for the search query. These timestamps are in GMT and + /// rounded down to the start of the given date. + #[serde(rename="startTime")] + pub start_time: Option, } -impl ResponseResult for ListHeldAccountsResponse {} +impl Part for HeldGroupsQuery {} /// Query options for mail holds. @@ -1221,43 +1306,58 @@ pub struct RemoveMatterPermissionsRequest { impl RequestValue for RemoveMatterPermissionsRequest {} -/// Response for batch create held accounts. +/// Definition of the response for method ListSaveQuery. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [holds add held accounts matters](struct.MatterHoldAddHeldAccountCall.html) (response) +/// * [saved queries list matters](struct.MatterSavedQueryListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddHeldAccountsResponse { - /// The list of responses, in the same order as the batch request. - pub responses: Option>, +pub struct ListSavedQueriesResponse { + /// Page token to retrieve the next page of results in the list. + /// If this is empty, then there are no more saved queries to list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of output saved queries. + #[serde(rename="savedQueries")] + pub saved_queries: Option>, } -impl ResponseResult for AddHeldAccountsResponse {} +impl ResponseResult for ListSavedQueriesResponse {} -/// Query options for group holds. +/// Accounts to search /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct HeldGroupsQuery { - /// The end time range for the search query. These timestamps are in GMT and - /// rounded down to the start of the given date. - #[serde(rename="endTime")] - pub end_time: Option, - /// The search terms for the hold. - pub terms: Option, - /// The start time range for the search query. These timestamps are in GMT and - /// rounded down to the start of the given date. - #[serde(rename="startTime")] - pub start_time: Option, +pub struct AccountInfo { + /// A set of accounts to search. + pub emails: Option>, } -impl Part for HeldGroupsQuery {} +impl Part for AccountInfo {} + + +/// Returns a list of held accounts for a hold. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [holds accounts list matters](struct.MatterHoldAccountListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListHeldAccountsResponse { + /// The held accounts on a hold. + pub accounts: Option>, +} + +impl ResponseResult for ListHeldAccountsResponse {} /// An export @@ -1318,67 +1418,40 @@ pub struct UserInfo { impl Part for UserInfo {} -/// A query definition relevant for search & export. +/// Definition of the saved query. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [saved queries create matters](struct.MatterSavedQueryCreateCall.html) (request|response) +/// * [saved queries get matters](struct.MatterSavedQueryGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Query { - /// The corpus-specific - /// search operators - /// used to generate search results. - pub terms: Option, - /// When 'TEAM_DRIVE' is chosen as search method, team_drive_info needs to be - /// specified. - #[serde(rename="teamDriveInfo")] - pub team_drive_info: Option, - /// For mail search, specify more options in this field. - #[serde(rename="mailOptions")] - pub mail_options: Option, - /// The search method to use. - #[serde(rename="searchMethod")] - pub search_method: Option, - /// When 'ROOM' is chosen as search method, hangout_chats_info needs to be - /// specified. (read-only) - #[serde(rename="hangoutsChatInfo")] - pub hangouts_chat_info: Option, - /// When 'ACCOUNT' is chosen as search method, - /// account_info needs to be specified. - #[serde(rename="accountInfo")] - pub account_info: Option, - /// For Drive search, specify more options in this field. - #[serde(rename="driveOptions")] - pub drive_options: Option, - /// The start time range for the search query. These timestamps are in GMT and - /// rounded down to the start of the given date. - #[serde(rename="startTime")] - pub start_time: Option, - /// When 'ORG_UNIT' is chosen as as search method, org_unit_info needs - /// to be specified. - #[serde(rename="orgUnitInfo")] - pub org_unit_info: Option, - /// The time zone name. - /// It should be an IANA TZ name, such as "America/Los_Angeles". - /// For more information, see - /// Time - /// Zone. - #[serde(rename="timeZone")] - pub time_zone: Option, - /// The corpus to search. - pub corpus: Option, - /// The end time range for the search query. These timestamps are in GMT and - /// rounded down to the start of the given date. - #[serde(rename="endTime")] - pub end_time: Option, - /// The data source to search from. - #[serde(rename="dataScope")] - pub data_scope: Option, - /// For hangouts chat search, specify more options in this field. (read-only) - #[serde(rename="hangoutsChatOptions")] - pub hangouts_chat_options: Option, +pub struct SavedQuery { + /// Output only. The matter id of the associated matter. + /// The server does not look at this field during create and always uses matter + /// id in the URL. + #[serde(rename="matterId")] + pub matter_id: Option, + /// The underlying Query object which contains all the information of the saved + /// query. + pub query: Option, + /// A unique identifier for the saved query. + #[serde(rename="savedQueryId")] + pub saved_query_id: Option, + /// Name of the saved query. + #[serde(rename="displayName")] + pub display_name: Option, + /// Output only. The server generated timestamp at which saved query was + /// created. + #[serde(rename="createTime")] + pub create_time: Option, } -impl Part for Query {} +impl RequestValue for SavedQuery {} +impl ResponseResult for SavedQuery {} /// Provides the list of matters. @@ -1445,7 +1518,7 @@ impl Part for HeldDriveQuery {} /// ::default(), None); /// let mut hub = Vault::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `add_permissions(...)`, `close(...)`, `create(...)`, `delete(...)`, `exports_create(...)`, `exports_delete(...)`, `exports_get(...)`, `exports_list(...)`, `get(...)`, `holds_accounts_create(...)`, `holds_accounts_delete(...)`, `holds_accounts_list(...)`, `holds_add_held_accounts(...)`, `holds_create(...)`, `holds_delete(...)`, `holds_get(...)`, `holds_list(...)`, `holds_remove_held_accounts(...)`, `holds_update(...)`, `list(...)`, `remove_permissions(...)`, `reopen(...)`, `undelete(...)` and `update(...)` +/// // like `add_permissions(...)`, `close(...)`, `create(...)`, `delete(...)`, `exports_create(...)`, `exports_delete(...)`, `exports_get(...)`, `exports_list(...)`, `get(...)`, `holds_accounts_create(...)`, `holds_accounts_delete(...)`, `holds_accounts_list(...)`, `holds_add_held_accounts(...)`, `holds_create(...)`, `holds_delete(...)`, `holds_get(...)`, `holds_list(...)`, `holds_remove_held_accounts(...)`, `holds_update(...)`, `list(...)`, `remove_permissions(...)`, `reopen(...)`, `saved_queries_create(...)`, `saved_queries_delete(...)`, `saved_queries_get(...)`, `saved_queries_list(...)`, `undelete(...)` and `update(...)` /// // to build up your call. /// let rb = hub.matters(); /// # } @@ -1500,6 +1573,26 @@ impl<'a, C, A> MatterMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes a saved query by Id. + /// + /// # Arguments + /// + /// * `matterId` - The matter id of the parent matter for which the saved query is to be + /// deleted. + /// * `savedQueryId` - Id of the saved query to be deleted. + pub fn saved_queries_delete(&self, matter_id: &str, saved_query_id: &str) -> MatterSavedQueryDeleteCall<'a, C, A> { + MatterSavedQueryDeleteCall { + hub: self.hub, + _matter_id: matter_id.to_string(), + _saved_query_id: saved_query_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates an Export. @@ -1583,6 +1676,25 @@ impl<'a, C, A> MatterMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Lists Exports. + /// + /// # Arguments + /// + /// * `matterId` - The matter ID. + pub fn exports_list(&self, matter_id: &str) -> MatterExportListCall<'a, C, A> { + MatterExportListCall { + hub: self.hub, + _matter_id: matter_id.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Gets an Export. @@ -1665,20 +1777,19 @@ impl<'a, C, A> MatterMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Removes a HeldAccount from a hold. If this request leaves the hold with - /// no held accounts, the hold will not apply to any accounts. + /// Lists saved queries within a matter. An empty page token in + /// ListSavedQueriesResponse denotes no more saved queries to list. /// /// # Arguments /// - /// * `matterId` - The matter ID. - /// * `holdId` - The hold ID. - /// * `accountId` - The ID of the account to remove from the hold. - pub fn holds_accounts_delete(&self, matter_id: &str, hold_id: &str, account_id: &str) -> MatterHoldAccountDeleteCall<'a, C, A> { - MatterHoldAccountDeleteCall { + /// * `matterId` - The matter id of the parent matter for which the saved queries are to be + /// retrieved. + pub fn saved_queries_list(&self, matter_id: &str) -> MatterSavedQueryListCall<'a, C, A> { + MatterSavedQueryListCall { hub: self.hub, _matter_id: matter_id.to_string(), - _hold_id: hold_id.to_string(), - _account_id: account_id.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1862,17 +1973,20 @@ impl<'a, C, A> MatterMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists Exports. + /// Removes a HeldAccount from a hold. If this request leaves the hold with + /// no held accounts, the hold will not apply to any accounts. /// /// # Arguments /// /// * `matterId` - The matter ID. - pub fn exports_list(&self, matter_id: &str) -> MatterExportListCall<'a, C, A> { - MatterExportListCall { + /// * `holdId` - The hold ID. + /// * `accountId` - The ID of the account to remove from the hold. + pub fn holds_accounts_delete(&self, matter_id: &str, hold_id: &str, account_id: &str) -> MatterHoldAccountDeleteCall<'a, C, A> { + MatterHoldAccountDeleteCall { hub: self.hub, _matter_id: matter_id.to_string(), - _page_token: Default::default(), - _page_size: Default::default(), + _hold_id: hold_id.to_string(), + _account_id: account_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -1921,6 +2035,26 @@ impl<'a, C, A> MatterMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Creates a saved query. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `matterId` - The matter id of the parent matter for which the saved query is to be + /// created. + pub fn saved_queries_create(&self, request: SavedQuery, matter_id: &str) -> MatterSavedQueryCreateCall<'a, C, A> { + MatterSavedQueryCreateCall { + hub: self.hub, + _request: request, + _matter_id: matter_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Deletes the specified matter. Returns matter with updated state. @@ -1937,6 +2071,26 @@ impl<'a, C, A> MatterMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a saved query by Id. + /// + /// # Arguments + /// + /// * `matterId` - The matter id of the parent matter for which the saved query is to be + /// retrieved. + /// * `savedQueryId` - Id of the saved query to be retrieved. + pub fn saved_queries_get(&self, matter_id: &str, saved_query_id: &str) -> MatterSavedQueryGetCall<'a, C, A> { + MatterSavedQueryGetCall { + hub: self.hub, + _matter_id: matter_id.to_string(), + _saved_query_id: saved_query_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -2047,10 +2201,7 @@ impl<'a, C, A> MatterHoldDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2070,7 +2221,7 @@ impl<'a, C, A> MatterHoldDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2158,7 +2309,7 @@ impl<'a, C, A> MatterHoldDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2320,10 +2471,7 @@ impl<'a, C, A> MatterHoldListCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2343,7 +2491,7 @@ impl<'a, C, A> MatterHoldListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2444,7 +2592,7 @@ impl<'a, C, A> MatterHoldListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2492,6 +2640,263 @@ impl<'a, C, A> MatterHoldListCall<'a, C, A> where C: BorrowMut, A } +/// Deletes a saved query by Id. +/// +/// A builder for the *savedQueries.delete* method supported by a *matter* resource. +/// It is not used directly, but through a `MatterMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vault1 as vault1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vault1::Vault; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vault::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.matters().saved_queries_delete("matterId", "savedQueryId") +/// .doit(); +/// # } +/// ``` +pub struct MatterSavedQueryDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vault, + _matter_id: String, + _saved_query_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MatterSavedQueryDeleteCall<'a, C, A> {} + +impl<'a, C, A> MatterSavedQueryDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vault.matters.savedQueries.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("matterId", self._matter_id.to_string())); + params.push(("savedQueryId", self._saved_query_id.to_string())); + for &field in ["alt", "matterId", "savedQueryId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/savedQueries/{savedQueryId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Ediscovery.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{matterId}", "matterId"), ("{savedQueryId}", "savedQueryId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["savedQueryId", "matterId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The matter id of the parent matter for which the saved query is to be + /// deleted. + /// + /// Sets the *matter id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn matter_id(mut self, new_value: &str) -> MatterSavedQueryDeleteCall<'a, C, A> { + self._matter_id = new_value.to_string(); + self + } + /// Id of the saved query to be deleted. + /// + /// Sets the *saved query id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn saved_query_id(mut self, new_value: &str) -> MatterSavedQueryDeleteCall<'a, C, A> { + self._saved_query_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MatterSavedQueryDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MatterSavedQueryDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Ediscovery`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MatterSavedQueryDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Creates an Export. /// /// A builder for the *exports.create* method supported by a *matter* resource. @@ -2597,10 +3002,7 @@ impl<'a, C, A> MatterExportCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2632,7 +3034,7 @@ impl<'a, C, A> MatterExportCreateCall<'a, C, A> where C: BorrowMut MatterExportCreateCall<'a, C, A> where C: BorrowMut MatterUpdateCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2913,7 +3312,7 @@ impl<'a, C, A> MatterUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3003,7 +3402,7 @@ impl<'a, C, A> MatterUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3079,7 +3478,7 @@ impl<'a, C, A> MatterUpdateCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.matters().holds_get("matterId", "holdId") -/// .view("justo") +/// .view("et") /// .doit(); /// # } /// ``` @@ -3156,10 +3555,7 @@ impl<'a, C, A> MatterHoldGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3179,7 +3575,7 @@ impl<'a, C, A> MatterHoldGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3274,7 +3670,7 @@ impl<'a, C, A> MatterHoldGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3425,10 +3821,7 @@ impl<'a, C, A> MatterHoldAccountListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3448,7 +3841,7 @@ impl<'a, C, A> MatterHoldAccountListCall<'a, C, A> where C: BorrowMut MatterHoldAccountListCall<'a, C, A> where C: BorrowMut MatterHoldAccountListCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Vault::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.matters().exports_list("matterId") +/// .page_token("et") +/// .page_size(-70) +/// .doit(); +/// # } +/// ``` +pub struct MatterExportListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vault, + _matter_id: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MatterExportListCall<'a, C, A> {} + +impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListExportsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vault.matters.exports.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("matterId", self._matter_id.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "matterId", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/exports"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::EdiscoveryReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{matterId}", "matterId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["matterId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The matter ID. + /// + /// Sets the *matter id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn matter_id(mut self, new_value: &str) -> MatterExportListCall<'a, C, A> { + self._matter_id = new_value.to_string(); + self + } + /// The pagination token as returned in the response. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> MatterExportListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The number of exports to return in the response. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> MatterExportListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MatterExportListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MatterExportListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::EdiscoveryReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MatterExportListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Gets an Export. /// /// A builder for the *exports.get* method supported by a *matter* resource. @@ -3684,10 +4345,7 @@ impl<'a, C, A> MatterExportGetCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3707,7 +4365,7 @@ impl<'a, C, A> MatterExportGetCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3795,7 +4453,7 @@ impl<'a, C, A> MatterExportGetCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3952,10 +4610,7 @@ impl<'a, C, A> MatterHoldAddHeldAccountCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3987,7 +4642,7 @@ impl<'a, C, A> MatterHoldAddHeldAccountCall<'a, C, A> where C: BorrowMut MatterHoldAddHeldAccountCall<'a, C, A> where C: BorrowMut MatterUndeleteCall<'a, C, A> where C: BorrowMut, A } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4275,7 +4927,7 @@ impl<'a, C, A> MatterUndeleteCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -4365,7 +5017,7 @@ impl<'a, C, A> MatterUndeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -4518,10 +5170,7 @@ impl<'a, C, A> MatterRemovePermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -4553,7 +5202,7 @@ impl<'a, C, A> MatterRemovePermissionCall<'a, C, A> where C: BorrowMut MatterRemovePermissionCall<'a, C, A> where C: BorrowMut MatterRemovePermissionCall<'a, C, A> where C: BorrowMut MatterRemovePermissionCall<'a, C, A> where C: BorrowMut +pub struct MatterSavedQueryListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Vault, _matter_id: String, - _hold_id: String, - _account_id: String, + _page_token: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for MatterHoldAccountDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for MatterSavedQueryListCall<'a, C, A> {} -impl<'a, C, A> MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> MatterSavedQueryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListSavedQueriesResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -4749,13 +5400,17 @@ impl<'a, C, A> MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "vault.matters.holds.accounts.delete", - http_method: hyper::method::Method::Delete }); + dlg.begin(MethodInfo { id: "vault.matters.savedQueries.list", + http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("matterId", self._matter_id.to_string())); - params.push(("holdId", self._hold_id.to_string())); - params.push(("accountId", self._account_id.to_string())); - for &field in ["alt", "matterId", "holdId", "accountId"].iter() { + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "matterId", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -4767,12 +5422,12 @@ impl<'a, C, A> MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -4783,8 +5438,8 @@ impl<'a, C, A> MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(3); - for param_name in ["accountId", "holdId", "matterId"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["matterId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -4794,10 +5449,7 @@ impl<'a, C, A> MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4817,7 +5469,7 @@ impl<'a, C, A> MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut MatterHoldAccountDeleteCall<'a, C, A> { + pub fn matter_id(mut self, new_value: &str) -> MatterSavedQueryListCall<'a, C, A> { self._matter_id = new_value.to_string(); self } - /// The hold ID. + /// The pagination token as returned in the previous response. + /// An empty token means start from the beginning. /// - /// Sets the *hold id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn hold_id(mut self, new_value: &str) -> MatterHoldAccountDeleteCall<'a, C, A> { - self._hold_id = new_value.to_string(); + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> MatterSavedQueryListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); self } - /// The ID of the account to remove from the hold. + /// The maximum number of saved queries to return. /// - /// Sets the *account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> MatterHoldAccountDeleteCall<'a, C, A> { - self._account_id = new_value.to_string(); + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> MatterSavedQueryListCall<'a, C, A> { + self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -4906,7 +5554,7 @@ impl<'a, C, A> MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut MatterHoldAccountDeleteCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MatterSavedQueryListCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -4915,7 +5563,7 @@ impl<'a, C, A> MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> MatterHoldAccountDeleteCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> MatterSavedQueryListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -4940,7 +5588,7 @@ impl<'a, C, A> MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MatterHoldAccountDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MatterSavedQueryListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -5068,10 +5716,7 @@ impl<'a, C, A> MatterAddPermissionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5103,7 +5748,7 @@ impl<'a, C, A> MatterAddPermissionCall<'a, C, A> where C: BorrowMut MatterAddPermissionCall<'a, C, A> where C: BorrowMut MatterHoldUpdateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5385,7 +6027,7 @@ impl<'a, C, A> MatterHoldUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5485,7 +6127,7 @@ impl<'a, C, A> MatterHoldUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5638,10 +6280,7 @@ impl<'a, C, A> MatterCloseCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -5673,7 +6312,7 @@ impl<'a, C, A> MatterCloseCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -5763,7 +6402,7 @@ impl<'a, C, A> MatterCloseCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -5839,7 +6478,7 @@ impl<'a, C, A> MatterCloseCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.matters().get("matterId") -/// .view("amet") +/// .view("invidunt") /// .doit(); /// # } /// ``` @@ -5914,10 +6553,7 @@ impl<'a, C, A> MatterGetCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -5937,7 +6573,7 @@ impl<'a, C, A> MatterGetCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -6022,7 +6658,7 @@ impl<'a, C, A> MatterGetCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6175,10 +6811,7 @@ impl<'a, C, A> MatterHoldCreateCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6210,7 +6843,7 @@ impl<'a, C, A> MatterHoldCreateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6300,7 +6933,7 @@ impl<'a, C, A> MatterHoldCreateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6457,10 +7090,7 @@ impl<'a, C, A> MatterHoldRemoveHeldAccountCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6492,7 +7122,7 @@ impl<'a, C, A> MatterHoldRemoveHeldAccountCall<'a, C, A> where C: BorrowMut MatterHoldRemoveHeldAccountCall<'a, C, A> where C: BorrowMut MatterCreateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -6759,7 +7386,7 @@ impl<'a, C, A> MatterCreateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -6839,7 +7466,7 @@ impl<'a, C, A> MatterCreateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -6915,10 +7542,10 @@ impl<'a, C, A> MatterCreateCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.matters().list() -/// .view("dolore") -/// .state("invidunt") -/// .page_token("aliquyam") -/// .page_size(-73) +/// .view("sea") +/// .state("et") +/// .page_token("duo") +/// .page_size(-21) /// .doit(); /// # } /// ``` @@ -6982,10 +7609,7 @@ impl<'a, C, A> MatterListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7005,7 +7629,7 @@ impl<'a, C, A> MatterListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7103,7 +7727,7 @@ impl<'a, C, A> MatterListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7256,10 +7880,7 @@ impl<'a, C, A> MatterReopenCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -7291,7 +7912,7 @@ impl<'a, C, A> MatterReopenCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -7381,7 +8002,7 @@ impl<'a, C, A> MatterReopenCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7429,9 +8050,10 @@ impl<'a, C, A> MatterReopenCall<'a, C, A> where C: BorrowMut, A: } -/// Lists Exports. +/// Removes a HeldAccount from a hold. If this request leaves the hold with +/// no held accounts, the hold will not apply to any accounts. /// -/// A builder for the *exports.list* method supported by a *matter* resource. +/// A builder for the *holds.accounts.delete* method supported by a *matter* resource. /// It is not used directly, but through a `MatterMethods` instance. /// /// # Example @@ -7456,31 +8078,29 @@ impl<'a, C, A> MatterReopenCall<'a, C, A> where C: BorrowMut, A: /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.matters().exports_list("matterId") -/// .page_token("et") -/// .page_size(-70) +/// let result = hub.matters().holds_accounts_delete("matterId", "holdId", "accountId") /// .doit(); /// # } /// ``` -pub struct MatterExportListCall<'a, C, A> +pub struct MatterHoldAccountDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Vault, _matter_id: String, - _page_token: Option, - _page_size: Option, + _hold_id: String, + _account_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for MatterExportListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for MatterHoldAccountDeleteCall<'a, C, A> {} -impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> MatterHoldAccountDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListExportsResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -7488,17 +8108,13 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "vault.matters.exports.list", - http_method: hyper::method::Method::Get }); + dlg.begin(MethodInfo { id: "vault.matters.holds.accounts.delete", + http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); params.push(("matterId", self._matter_id.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "matterId", "pageToken", "pageSize"].iter() { + params.push(("holdId", self._hold_id.to_string())); + params.push(("accountId", self._account_id.to_string())); + for &field in ["alt", "matterId", "holdId", "accountId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -7510,12 +8126,12 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/exports"; + let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/holds/{holdId}/accounts/{accountId}"; if self._scopes.len() == 0 { - self._scopes.insert(Scope::EdiscoveryReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::Ediscovery.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{matterId}", "matterId")].iter() { + for &(find_this, param_name) in [("{matterId}", "matterId"), ("{holdId}", "holdId"), ("{accountId}", "accountId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -7526,8 +8142,8 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["matterId"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["accountId", "holdId", "matterId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -7537,10 +8153,7 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7560,7 +8173,7 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7619,22 +8232,28 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn matter_id(mut self, new_value: &str) -> MatterExportListCall<'a, C, A> { + pub fn matter_id(mut self, new_value: &str) -> MatterHoldAccountDeleteCall<'a, C, A> { self._matter_id = new_value.to_string(); self } - /// The pagination token as returned in the response. + /// The hold ID. /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> MatterExportListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); + /// Sets the *hold id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn hold_id(mut self, new_value: &str) -> MatterHoldAccountDeleteCall<'a, C, A> { + self._hold_id = new_value.to_string(); self } - /// The number of exports to return in the response. + /// The ID of the account to remove from the hold. /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> MatterExportListCall<'a, C, A> { - self._page_size = Some(new_value); + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: &str) -> MatterHoldAccountDeleteCall<'a, C, A> { + self._account_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -7643,7 +8262,7 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> MatterExportListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MatterHoldAccountDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -7652,7 +8271,7 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -7668,7 +8287,7 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> MatterExportListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> MatterHoldAccountDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -7677,7 +8296,7 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, /// Identifies the authorization scope for the method you are building. /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::EdiscoveryReadonly`. + /// `Scope::Ediscovery`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -7688,7 +8307,7 @@ impl<'a, C, A> MatterExportListCall<'a, C, A> where C: BorrowMut, /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> MatterExportListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MatterHoldAccountDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -7800,10 +8419,7 @@ impl<'a, C, A> MatterExportDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -7823,7 +8439,7 @@ impl<'a, C, A> MatterExportDeleteCall<'a, C, A> where C: BorrowMut MatterExportDeleteCall<'a, C, A> where C: BorrowMut MatterHoldAccountCreateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -8103,7 +8716,7 @@ impl<'a, C, A> MatterHoldAccountCreateCall<'a, C, A> where C: BorrowMut MatterHoldAccountCreateCall<'a, C, A> where C: BorrowMut MatterHoldAccountCreateCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Vault::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = SavedQuery::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.matters().saved_queries_create(req, "matterId") +/// .doit(); +/// # } +/// ``` +pub struct MatterSavedQueryCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vault, + _request: SavedQuery, + _matter_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MatterSavedQueryCreateCall<'a, C, A> {} + +impl<'a, C, A> MatterSavedQueryCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SavedQuery)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vault.matters.savedQueries.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("matterId", self._matter_id.to_string())); + for &field in ["alt", "matterId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/savedQueries"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Ediscovery.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{matterId}", "matterId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["matterId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: SavedQuery) -> MatterSavedQueryCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The matter id of the parent matter for which the saved query is to be + /// created. + /// + /// Sets the *matter id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn matter_id(mut self, new_value: &str) -> MatterSavedQueryCreateCall<'a, C, A> { + self._matter_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MatterSavedQueryCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MatterSavedQueryCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Ediscovery`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MatterSavedQueryCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Deletes the specified matter. Returns matter with updated state. /// /// A builder for the *delete* method supported by a *matter* resource. @@ -8349,10 +9238,7 @@ impl<'a, C, A> MatterDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8372,7 +9258,7 @@ impl<'a, C, A> MatterDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -8450,7 +9336,7 @@ impl<'a, C, A> MatterDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -8498,3 +9384,260 @@ impl<'a, C, A> MatterDeleteCall<'a, C, A> where C: BorrowMut, A: } +/// Retrieves a saved query by Id. +/// +/// A builder for the *savedQueries.get* method supported by a *matter* resource. +/// It is not used directly, but through a `MatterMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vault1 as vault1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vault1::Vault; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vault::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.matters().saved_queries_get("matterId", "savedQueryId") +/// .doit(); +/// # } +/// ``` +pub struct MatterSavedQueryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vault, + _matter_id: String, + _saved_query_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MatterSavedQueryGetCall<'a, C, A> {} + +impl<'a, C, A> MatterSavedQueryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SavedQuery)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vault.matters.savedQueries.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("matterId", self._matter_id.to_string())); + params.push(("savedQueryId", self._saved_query_id.to_string())); + for &field in ["alt", "matterId", "savedQueryId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/matters/{matterId}/savedQueries/{savedQueryId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::EdiscoveryReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{matterId}", "matterId"), ("{savedQueryId}", "savedQueryId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["savedQueryId", "matterId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The matter id of the parent matter for which the saved query is to be + /// retrieved. + /// + /// Sets the *matter id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn matter_id(mut self, new_value: &str) -> MatterSavedQueryGetCall<'a, C, A> { + self._matter_id = new_value.to_string(); + self + } + /// Id of the saved query to be retrieved. + /// + /// Sets the *saved query id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn saved_query_id(mut self, new_value: &str) -> MatterSavedQueryGetCall<'a, C, A> { + self._saved_query_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> MatterSavedQueryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MatterSavedQueryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::EdiscoveryReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> MatterSavedQueryGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + diff --git a/gen/videointelligence1-cli/Cargo.toml b/gen/videointelligence1-cli/Cargo.toml index 17272120b7..896309f9d9 100644 --- a/gen/videointelligence1-cli/Cargo.toml +++ b/gen/videointelligence1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-videointelligence1-cli" -version = "1.0.8+20180920" +version = "1.0.8+20190308" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Video Intelligence (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/videointelligence1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-videointelligence1] path = "../videointelligence1" -version = "1.0.8+20180920" +version = "1.0.8+20190308" diff --git a/gen/videointelligence1-cli/README.md b/gen/videointelligence1-cli/README.md index d7a126bc64..e73b9c694b 100644 --- a/gen/videointelligence1-cli/README.md +++ b/gen/videointelligence1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Video Intelligence* API at revision *20180920*. The CLI is at version *1.0.8*. +This documentation was generated from the *Cloud Video Intelligence* API at revision *20190308*. The CLI is at version *1.0.8*. ```bash videointelligence1 [options] diff --git a/gen/videointelligence1-cli/mkdocs.yml b/gen/videointelligence1-cli/mkdocs.yml index a81118225f..63bdb92578 100644 --- a/gen/videointelligence1-cli/mkdocs.yml +++ b/gen/videointelligence1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Video Intelligence v1.0.8+20180920 +site_name: Cloud Video Intelligence v1.0.8+20190308 site_url: http://byron.github.io/google-apis-rs/google-videointelligence1-cli site_description: A complete library to interact with Cloud Video Intelligence (protocol v1) diff --git a/gen/videointelligence1-cli/src/main.rs b/gen/videointelligence1-cli/src/main.rs index 348d3df036..58d73679a9 100644 --- a/gen/videointelligence1-cli/src/main.rs +++ b/gen/videointelligence1-cli/src/main.rs @@ -323,17 +323,28 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "video-context.shot-change-detection-config.model" => Some(("videoContext.shotChangeDetectionConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-context.text-detection-config.language-hints" => Some(("videoContext.textDetectionConfig.languageHints", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "video-context.explicit-content-detection-config.model" => Some(("videoContext.explicitContentDetectionConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-context.speech-transcription-config.language-code" => Some(("videoContext.speechTranscriptionConfig.languageCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-context.speech-transcription-config.filter-profanity" => Some(("videoContext.speechTranscriptionConfig.filterProfanity", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-context.speech-transcription-config.enable-automatic-punctuation" => Some(("videoContext.speechTranscriptionConfig.enableAutomaticPunctuation", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-context.speech-transcription-config.enable-speaker-diarization" => Some(("videoContext.speechTranscriptionConfig.enableSpeakerDiarization", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-context.speech-transcription-config.max-alternatives" => Some(("videoContext.speechTranscriptionConfig.maxAlternatives", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-context.speech-transcription-config.audio-tracks" => Some(("videoContext.speechTranscriptionConfig.audioTracks", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "video-context.speech-transcription-config.diarization-speaker-count" => Some(("videoContext.speechTranscriptionConfig.diarizationSpeakerCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-context.speech-transcription-config.enable-word-confidence" => Some(("videoContext.speechTranscriptionConfig.enableWordConfidence", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "video-context.label-detection-config.label-detection-mode" => Some(("videoContext.labelDetectionConfig.labelDetectionMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "video-context.label-detection-config.model" => Some(("videoContext.labelDetectionConfig.model", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "video-context.label-detection-config.stationary-camera" => Some(("videoContext.labelDetectionConfig.stationaryCamera", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "video-context.label-detection-config.frame-confidence-threshold" => Some(("videoContext.labelDetectionConfig.frameConfidenceThreshold", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "video-context.label-detection-config.video-confidence-threshold" => Some(("videoContext.labelDetectionConfig.videoConfidenceThreshold", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "features" => Some(("features", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "input-content" => Some(("inputContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "input-uri" => Some(("inputUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "location-id" => Some(("locationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "output-uri" => Some(("outputUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["explicit-content-detection-config", "features", "input-content", "input-uri", "label-detection-config", "label-detection-mode", "location-id", "model", "output-uri", "shot-change-detection-config", "stationary-camera", "video-context"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["audio-tracks", "diarization-speaker-count", "enable-automatic-punctuation", "enable-speaker-diarization", "enable-word-confidence", "explicit-content-detection-config", "features", "filter-profanity", "frame-confidence-threshold", "input-content", "input-uri", "label-detection-config", "label-detection-mode", "language-code", "language-hints", "location-id", "max-alternatives", "model", "output-uri", "shot-change-detection-config", "speech-transcription-config", "stationary-camera", "text-detection-config", "video-confidence-threshold", "video-context"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -660,8 +671,8 @@ fn main() { let mut app = App::new("videointelligence1") .author("Sebastian Thiel ") - .version("1.0.8+20180920") - .about("Cloud Video Intelligence API.") + .version("1.0.8+20190308") + .about("Detects objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text. Supports both asynchronous API and streaming API.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_videointelligence1_cli") .arg(Arg::with_name("url") .long("scope") diff --git a/gen/videointelligence1/Cargo.toml b/gen/videointelligence1/Cargo.toml index 63b2cf4309..e22add054b 100644 --- a/gen/videointelligence1/Cargo.toml +++ b/gen/videointelligence1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-videointelligence1" -version = "1.0.8+20180920" +version = "1.0.8+20190308" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Video Intelligence (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/videointelligence1" homepage = "https://cloud.google.com/video-intelligence/docs/" -documentation = "https://docs.rs/google-videointelligence1/1.0.8+20180920" +documentation = "https://docs.rs/google-videointelligence1/1.0.8+20190308" license = "MIT" keywords = ["videointelligence", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/videointelligence1/README.md b/gen/videointelligence1/README.md index 388f64f319..b8369671bd 100644 --- a/gen/videointelligence1/README.md +++ b/gen/videointelligence1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-videointelligence1` library allows access to all features of the *Google Cloud Video Intelligence* service. -This documentation was generated from *Cloud Video Intelligence* crate version *1.0.8+20180920*, where *20180920* is the exact revision of the *videointelligence:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Cloud Video Intelligence* crate version *1.0.8+20190308*, where *20190308* is the exact revision of the *videointelligence:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Cloud Video Intelligence* *v1* API can be found at the [official documentation site](https://cloud.google.com/video-intelligence/docs/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/struct.CloudVideoIntelligence.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/struct.CloudVideoIntelligence.html) ... * operations - * [*cancel*](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/struct.OperationDeleteCall.html), [*get*](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/struct.OperationListCall.html) + * [*cancel*](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/struct.OperationDeleteCall.html), [*get*](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/struct.OperationListCall.html) * videos - * [*annotate*](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/struct.VideoAnnotateCall.html) + * [*annotate*](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/struct.VideoAnnotateCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/struct.CloudVideoIntelligence.html)** +* **[Hub](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/struct.CloudVideoIntelligence.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.Part.html)** + * **[Parts](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-videointelligence1/1.0.8+20180920/google_videointelligence1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-videointelligence1/1.0.8+20190308/google_videointelligence1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/videointelligence1/src/lib.rs b/gen/videointelligence1/src/lib.rs index ad029015b3..cc61f67813 100644 --- a/gen/videointelligence1/src/lib.rs +++ b/gen/videointelligence1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Video Intelligence* crate version *1.0.8+20180920*, where *20180920* is the exact revision of the *videointelligence:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Cloud Video Intelligence* crate version *1.0.8+20190308*, where *20190308* is the exact revision of the *videointelligence:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Cloud Video Intelligence* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/video-intelligence/docs/). @@ -376,6 +376,24 @@ impl<'a, C, A> CloudVideoIntelligence // ############ // SCHEMAS ### // ########## +/// Config for TEXT_DETECTION. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudVideointelligenceV1_TextDetectionConfig { + /// Language hint can be specified if the language to be detected is known a + /// priori. It can increase the accuracy of the detection. Language hint must + /// be language code in BCP-47 format. + /// + /// Automatic language detection is performed if no hint is provided. + #[serde(rename="languageHints")] + pub language_hints: Option>, +} + +impl Part for GoogleCloudVideointelligenceV1_TextDetectionConfig {} + + /// Video annotation request. /// /// # Activities @@ -451,25 +469,23 @@ pub struct GoogleProtobuf_Empty { _never_set: Option } impl ResponseResult for GoogleProtobuf_Empty {} -/// The response message for Operations.ListOperations. +/// Provides "hints" to the speech recognizer to favor specific words and phrases +/// in the results. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list operations](struct.OperationListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleLongrunning_ListOperationsResponse { - /// A list of operations that matches the specified filter in the request. - pub operations: Option>, - /// The standard List next-page token. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, +pub struct GoogleCloudVideointelligenceV1_SpeechContext { + /// *Optional* A list of strings containing words and phrases "hints" so that + /// the speech recognition is more likely to recognize them. This can be used + /// to improve the accuracy for specific words and phrases, for example, if + /// specific commands are typically spoken by the user. This can also be used + /// to add additional words to the vocabulary of the recognizer. See + /// [usage limits](https://cloud.google.com/speech/limits#content). + pub phrases: Option>, } -impl ResponseResult for GoogleLongrunning_ListOperationsResponse {} +impl Part for GoogleCloudVideointelligenceV1_SpeechContext {} /// Video segment. @@ -497,19 +513,25 @@ impl Part for GoogleCloudVideointelligenceV1_VideoSegment {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleCloudVideointelligenceV1_VideoContext { + /// Config for SHOT_CHANGE_DETECTION. + #[serde(rename="shotChangeDetectionConfig")] + pub shot_change_detection_config: Option, + /// Config for TEXT_DETECTION. + #[serde(rename="textDetectionConfig")] + pub text_detection_config: Option, + /// Config for EXPLICIT_CONTENT_DETECTION. + #[serde(rename="explicitContentDetectionConfig")] + pub explicit_content_detection_config: Option, + /// Config for SPEECH_TRANSCRIPTION. + #[serde(rename="speechTranscriptionConfig")] + pub speech_transcription_config: Option, /// Video segments to annotate. The segments may overlap and are not required /// to be contiguous or span the whole video. If unspecified, each video is /// treated as a single segment. pub segments: Option>, - /// Config for EXPLICIT_CONTENT_DETECTION. - #[serde(rename="explicitContentDetectionConfig")] - pub explicit_content_detection_config: Option, /// Config for LABEL_DETECTION. #[serde(rename="labelDetectionConfig")] pub label_detection_config: Option, - /// Config for SHOT_CHANGE_DETECTION. - #[serde(rename="shotChangeDetectionConfig")] - pub shot_change_detection_config: Option, } impl Part for GoogleCloudVideointelligenceV1_VideoContext {} @@ -557,29 +579,25 @@ pub struct GoogleLongrunning_Operation { impl ResponseResult for GoogleLongrunning_Operation {} -/// Config for LABEL_DETECTION. +/// The response message for Operations.ListOperations. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operations](struct.OperationListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudVideointelligenceV1_LabelDetectionConfig { - /// What labels should be detected with LABEL_DETECTION, in addition to - /// video-level labels or segment-level labels. - /// If unspecified, defaults to `SHOT_MODE`. - #[serde(rename="labelDetectionMode")] - pub label_detection_mode: Option, - /// Model to use for label detection. - /// Supported values: "builtin/stable" (the default if unset) and - /// "builtin/latest". - pub model: Option, - /// Whether the video has been shot from a stationary (i.e. non-moving) camera. - /// When set to true, might improve detection accuracy for moving objects. - /// Should be used with `SHOT_AND_FRAME_MODE` enabled. - #[serde(rename="stationaryCamera")] - pub stationary_camera: Option, +pub struct GoogleLongrunning_ListOperationsResponse { + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, } -impl Part for GoogleCloudVideointelligenceV1_LabelDetectionConfig {} +impl ResponseResult for GoogleLongrunning_ListOperationsResponse {} /// The request message for Operations.CancelOperation. @@ -597,32 +615,17 @@ pub struct GoogleLongrunning_CancelOperationRequest { _never_set: Option } impl RequestValue for GoogleLongrunning_CancelOperationRequest {} -/// Config for EXPLICIT_CONTENT_DETECTION. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GoogleCloudVideointelligenceV1_ExplicitContentDetectionConfig { - /// Model to use for explicit content detection. - /// Supported values: "builtin/stable" (the default if unset) and - /// "builtin/latest". - pub model: Option, -} - -impl Part for GoogleCloudVideointelligenceV1_ExplicitContentDetectionConfig {} - - -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -683,6 +686,87 @@ pub struct GoogleRpc_Status { impl Part for GoogleRpc_Status {} +/// Config for SPEECH_TRANSCRIPTION. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudVideointelligenceV1_SpeechTranscriptionConfig { + /// *Required* The language of the supplied audio as a + /// [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + /// Example: "en-US". + /// See [Language Support](https://cloud.google.com/speech/docs/languages) + /// for a list of the currently supported language codes. + #[serde(rename="languageCode")] + pub language_code: Option, + /// *Optional* If set to `true`, the server will attempt to filter out + /// profanities, replacing all but the initial character in each filtered word + /// with asterisks, e.g. "f***". If set to `false` or omitted, profanities + /// won't be filtered out. + #[serde(rename="filterProfanity")] + pub filter_profanity: Option, + /// *Optional* If 'true', adds punctuation to recognition result hypotheses. + /// This feature is only available in select languages. Setting this for + /// requests in other languages has no effect at all. The default 'false' value + /// does not add punctuation to result hypotheses. NOTE: "This is currently + /// offered as an experimental service, complimentary to all users. In the + /// future this may be exclusively available as a premium feature." + #[serde(rename="enableAutomaticPunctuation")] + pub enable_automatic_punctuation: Option, + /// *Optional* If 'true', enables speaker detection for each recognized word in + /// the top alternative of the recognition result using a speaker_tag provided + /// in the WordInfo. + /// Note: When this is true, we send all the words from the beginning of the + /// audio for the top alternative in every consecutive responses. + /// This is done in order to improve our speaker tags as our models learn to + /// identify the speakers in the conversation over time. + #[serde(rename="enableSpeakerDiarization")] + pub enable_speaker_diarization: Option, + /// *Optional* Maximum number of recognition hypotheses to be returned. + /// Specifically, the maximum number of `SpeechRecognitionAlternative` messages + /// within each `SpeechTranscription`. The server may return fewer than + /// `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will + /// return a maximum of one. If omitted, will return a maximum of one. + #[serde(rename="maxAlternatives")] + pub max_alternatives: Option, + /// *Optional* For file formats, such as MXF or MKV, supporting multiple audio + /// tracks, specify up to two tracks. Default: track 0. + #[serde(rename="audioTracks")] + pub audio_tracks: Option>, + /// *Optional* + /// If set, specifies the estimated number of speakers in the conversation. + /// If not set, defaults to '2'. + /// Ignored unless enable_speaker_diarization is set to true. + #[serde(rename="diarizationSpeakerCount")] + pub diarization_speaker_count: Option, + /// *Optional* If `true`, the top result includes a list of words and the + /// confidence for those words. If `false`, no word-level confidence + /// information is returned. The default is `false`. + #[serde(rename="enableWordConfidence")] + pub enable_word_confidence: Option, + /// *Optional* A means to provide context to assist the speech recognition. + #[serde(rename="speechContexts")] + pub speech_contexts: Option>, +} + +impl Part for GoogleCloudVideointelligenceV1_SpeechTranscriptionConfig {} + + +/// Config for EXPLICIT_CONTENT_DETECTION. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudVideointelligenceV1_ExplicitContentDetectionConfig { + /// Model to use for explicit content detection. + /// Supported values: "builtin/stable" (the default if unset) and + /// "builtin/latest". + pub model: Option, +} + +impl Part for GoogleCloudVideointelligenceV1_ExplicitContentDetectionConfig {} + + /// Config for SHOT_CHANGE_DETECTION. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -698,6 +782,47 @@ pub struct GoogleCloudVideointelligenceV1_ShotChangeDetectionConfig { impl Part for GoogleCloudVideointelligenceV1_ShotChangeDetectionConfig {} +/// Config for LABEL_DETECTION. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GoogleCloudVideointelligenceV1_LabelDetectionConfig { + /// What labels should be detected with LABEL_DETECTION, in addition to + /// video-level labels or segment-level labels. + /// If unspecified, defaults to `SHOT_MODE`. + #[serde(rename="labelDetectionMode")] + pub label_detection_mode: Option, + /// Model to use for label detection. + /// Supported values: "builtin/stable" (the default if unset) and + /// "builtin/latest". + pub model: Option, + /// Whether the video has been shot from a stationary (i.e. non-moving) camera. + /// When set to true, might improve detection accuracy for moving objects. + /// Should be used with `SHOT_AND_FRAME_MODE` enabled. + #[serde(rename="stationaryCamera")] + pub stationary_camera: Option, + /// The confidence threshold we perform filtering on the labels from + /// frame-level detection. If not set, it is set to 0.4 by default. The valid + /// range for this threshold is [0.1, 0.9]. Any value set outside of this + /// range will be clipped. + /// Note: for best results please follow the default threshold. We will update + /// the default threshold everytime when we release a new model. + #[serde(rename="frameConfidenceThreshold")] + pub frame_confidence_threshold: Option, + /// The confidence threshold we perform filtering on the labels from + /// video-level and shot-level detections. If not set, it is set to 0.3 by + /// default. The valid range for this threshold is [0.1, 0.9]. Any value set + /// outside of this range will be clipped. + /// Note: for best results please follow the default threshold. We will update + /// the default threshold everytime when we release a new model. + #[serde(rename="videoConfidenceThreshold")] + pub video_confidence_threshold: Option, +} + +impl Part for GoogleCloudVideointelligenceV1_LabelDetectionConfig {} + + // ################### // MethodBuilders ### @@ -994,7 +1119,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1010,10 +1135,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1033,7 +1155,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1111,7 +1233,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1263,10 +1385,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1286,7 +1405,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1382,7 +1501,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1518,7 +1637,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1534,10 +1653,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1557,7 +1673,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1635,7 +1751,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1785,7 +1901,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1801,10 +1917,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1836,7 +1949,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1926,7 +2039,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2059,10 +2172,7 @@ impl<'a, C, A> VideoAnnotateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2094,7 +2204,7 @@ impl<'a, C, A> VideoAnnotateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2174,7 +2284,7 @@ impl<'a, C, A> VideoAnnotateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/videointelligence1_beta1/Cargo.toml b/gen/videointelligence1_beta1/Cargo.toml index 8616d88d32..eb05ba9385 100644 --- a/gen/videointelligence1_beta1/Cargo.toml +++ b/gen/videointelligence1_beta1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/videointelligence1_beta1/src/lib.rs b/gen/videointelligence1_beta1/src/lib.rs index a88cd12df3..3fdc3b902d 100644 --- a/gen/videointelligence1_beta1/src/lib.rs +++ b/gen/videointelligence1_beta1/src/lib.rs @@ -743,10 +743,7 @@ impl<'a, C, A> VideoAnnotateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -778,7 +775,7 @@ impl<'a, C, A> VideoAnnotateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -858,7 +855,7 @@ impl<'a, C, A> VideoAnnotateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/vision1-cli/Cargo.toml b/gen/vision1-cli/Cargo.toml index c77965377e..c7af73d590 100644 --- a/gen/vision1-cli/Cargo.toml +++ b/gen/vision1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-vision1-cli" -version = "1.0.8+20181001" +version = "1.0.8+20190314" authors = ["Sebastian Thiel "] description = "A complete library to interact with Vision (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/vision1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-vision1] path = "../vision1" -version = "1.0.8+20181001" +version = "1.0.8+20190314" diff --git a/gen/vision1-cli/README.md b/gen/vision1-cli/README.md index 41d2238f01..160d98b4e9 100644 --- a/gen/vision1-cli/README.md +++ b/gen/vision1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Vision* API at revision *20181001*. The CLI is at version *1.0.8*. +This documentation was generated from the *Vision* API at revision *20190314*. The CLI is at version *1.0.8*. ```bash vision1 [options] @@ -40,6 +40,25 @@ vision1 [options] delete [-p ]... [-o ] get [-p ]... [-o ] list [-p ]... [-o ] + projects + locations-product-sets-add-product (-r )... [-p ]... [-o ] + locations-product-sets-create (-r )... [-p ]... [-o ] + locations-product-sets-delete [-p ]... [-o ] + locations-product-sets-get [-p ]... [-o ] + locations-product-sets-import (-r )... [-p ]... [-o ] + locations-product-sets-list [-p ]... [-o ] + locations-product-sets-patch (-r )... [-p ]... [-o ] + locations-product-sets-products-list [-p ]... [-o ] + locations-product-sets-remove-product (-r )... [-p ]... [-o ] + locations-products-create (-r )... [-p ]... [-o ] + locations-products-delete [-p ]... [-o ] + locations-products-get [-p ]... [-o ] + locations-products-list [-p ]... [-o ] + locations-products-patch (-r )... [-p ]... [-o ] + locations-products-reference-images-create (-r )... [-p ]... [-o ] + locations-products-reference-images-delete [-p ]... [-o ] + locations-products-reference-images-get [-p ]... [-o ] + locations-products-reference-images-list [-p ]... [-o ] vision1 --help Configuration: diff --git a/gen/vision1-cli/mkdocs.yml b/gen/vision1-cli/mkdocs.yml index 6eecbe6dfe..53c1ee6f45 100644 --- a/gen/vision1-cli/mkdocs.yml +++ b/gen/vision1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Vision v1.0.8+20181001 +site_name: Vision v1.0.8+20190314 site_url: http://byron.github.io/google-apis-rs/google-vision1-cli site_description: A complete library to interact with Vision (protocol v1) @@ -16,6 +16,24 @@ pages: - ['operations_delete.md', 'Operations', 'Delete'] - ['operations_get.md', 'Operations', 'Get'] - ['operations_list.md', 'Operations', 'List'] +- ['projects_locations-product-sets-add-product.md', 'Projects', 'Locations Product Sets Add Product'] +- ['projects_locations-product-sets-create.md', 'Projects', 'Locations Product Sets Create'] +- ['projects_locations-product-sets-delete.md', 'Projects', 'Locations Product Sets Delete'] +- ['projects_locations-product-sets-get.md', 'Projects', 'Locations Product Sets Get'] +- ['projects_locations-product-sets-import.md', 'Projects', 'Locations Product Sets Import'] +- ['projects_locations-product-sets-list.md', 'Projects', 'Locations Product Sets List'] +- ['projects_locations-product-sets-patch.md', 'Projects', 'Locations Product Sets Patch'] +- ['projects_locations-product-sets-products-list.md', 'Projects', 'Locations Product Sets Products List'] +- ['projects_locations-product-sets-remove-product.md', 'Projects', 'Locations Product Sets Remove Product'] +- ['projects_locations-products-create.md', 'Projects', 'Locations Products Create'] +- ['projects_locations-products-delete.md', 'Projects', 'Locations Products Delete'] +- ['projects_locations-products-get.md', 'Projects', 'Locations Products Get'] +- ['projects_locations-products-list.md', 'Projects', 'Locations Products List'] +- ['projects_locations-products-patch.md', 'Projects', 'Locations Products Patch'] +- ['projects_locations-products-reference-images-create.md', 'Projects', 'Locations Products Reference Images Create'] +- ['projects_locations-products-reference-images-delete.md', 'Projects', 'Locations Products Reference Images Delete'] +- ['projects_locations-products-reference-images-get.md', 'Projects', 'Locations Products Reference Images Get'] +- ['projects_locations-products-reference-images-list.md', 'Projects', 'Locations Products Reference Images List'] theme: readthedocs diff --git a/gen/vision1-cli/src/main.rs b/gen/vision1-cli/src/main.rs index bbb2e096df..8258146314 100644 --- a/gen/vision1-cli/src/main.rs +++ b/gen/vision1-cli/src/main.rs @@ -516,6 +516,1269 @@ impl<'n> Engine<'n> { } } + fn _projects_locations_product_sets_add_product(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "product" => Some(("product", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["product"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AddProductToProductSetRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_product_sets_add_product(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_product_sets_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "index-error.message" => Some(("indexError.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "index-error.code" => Some(("indexError.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "index-time" => Some(("indexTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["code", "display-name", "index-error", "index-time", "message", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ProductSet = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_product_sets_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "product-set-id" => { + call = call.product_set_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["product-set-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_product_sets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_product_sets_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_product_sets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_product_sets_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_product_sets_import(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "input-config.gcs-source.csv-file-uri" => Some(("inputConfig.gcsSource.csvFileUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["csv-file-uri", "gcs-source", "input-config"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ImportProductSetsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_product_sets_import(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_product_sets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_product_sets_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_product_sets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "index-error.message" => Some(("indexError.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "index-error.code" => Some(("indexError.code", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "index-time" => Some(("indexTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["code", "display-name", "index-error", "index-time", "message", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ProductSet = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_product_sets_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_product_sets_products_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_product_sets_products_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_product_sets_remove_product(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "product" => Some(("product", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["product"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemoveProductFromProductSetRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_product_sets_remove_product(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_products_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "product-category" => Some(("productCategory", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "display-name", "name", "product-category"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Product = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_products_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "product-id" => { + call = call.product_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["product-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_products_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_products_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_products_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_products_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_products_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_products_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_products_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "product-category" => Some(("productCategory", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "display-name", "name", "product-category"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Product = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_products_patch(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "update-mask" => { + call = call.update_mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["update-mask"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_products_reference_images_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "uri" => Some(("uri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["name", "uri"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ReferenceImage = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().locations_products_reference_images_create(request, opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "reference-image-id" => { + call = call.reference_image_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["reference-image-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_products_reference_images_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_products_reference_images_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_products_reference_images_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_products_reference_images_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_locations_products_reference_images_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().locations_products_reference_images_list(opt.value_of("parent").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema).expect("serde to work"); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); @@ -574,6 +1837,68 @@ impl<'n> Engine<'n> { } } }, + ("projects", Some(opt)) => { + match opt.subcommand() { + ("locations-product-sets-add-product", Some(opt)) => { + call_result = self._projects_locations_product_sets_add_product(opt, dry_run, &mut err); + }, + ("locations-product-sets-create", Some(opt)) => { + call_result = self._projects_locations_product_sets_create(opt, dry_run, &mut err); + }, + ("locations-product-sets-delete", Some(opt)) => { + call_result = self._projects_locations_product_sets_delete(opt, dry_run, &mut err); + }, + ("locations-product-sets-get", Some(opt)) => { + call_result = self._projects_locations_product_sets_get(opt, dry_run, &mut err); + }, + ("locations-product-sets-import", Some(opt)) => { + call_result = self._projects_locations_product_sets_import(opt, dry_run, &mut err); + }, + ("locations-product-sets-list", Some(opt)) => { + call_result = self._projects_locations_product_sets_list(opt, dry_run, &mut err); + }, + ("locations-product-sets-patch", Some(opt)) => { + call_result = self._projects_locations_product_sets_patch(opt, dry_run, &mut err); + }, + ("locations-product-sets-products-list", Some(opt)) => { + call_result = self._projects_locations_product_sets_products_list(opt, dry_run, &mut err); + }, + ("locations-product-sets-remove-product", Some(opt)) => { + call_result = self._projects_locations_product_sets_remove_product(opt, dry_run, &mut err); + }, + ("locations-products-create", Some(opt)) => { + call_result = self._projects_locations_products_create(opt, dry_run, &mut err); + }, + ("locations-products-delete", Some(opt)) => { + call_result = self._projects_locations_products_delete(opt, dry_run, &mut err); + }, + ("locations-products-get", Some(opt)) => { + call_result = self._projects_locations_products_get(opt, dry_run, &mut err); + }, + ("locations-products-list", Some(opt)) => { + call_result = self._projects_locations_products_list(opt, dry_run, &mut err); + }, + ("locations-products-patch", Some(opt)) => { + call_result = self._projects_locations_products_patch(opt, dry_run, &mut err); + }, + ("locations-products-reference-images-create", Some(opt)) => { + call_result = self._projects_locations_products_reference_images_create(opt, dry_run, &mut err); + }, + ("locations-products-reference-images-delete", Some(opt)) => { + call_result = self._projects_locations_products_reference_images_delete(opt, dry_run, &mut err); + }, + ("locations-products-reference-images-get", Some(opt)) => { + call_result = self._projects_locations_products_reference_images_get(opt, dry_run, &mut err); + }, + ("locations-products-reference-images-list", Some(opt)) => { + call_result = self._projects_locations_products_reference_images_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, _ => { err.issues.push(CLIError::MissingCommandError); writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); @@ -861,11 +2186,645 @@ fn main() { ]), ]), + ("projects", "methods: 'locations-product-sets-add-product', 'locations-product-sets-create', 'locations-product-sets-delete', 'locations-product-sets-get', 'locations-product-sets-import', 'locations-product-sets-list', 'locations-product-sets-patch', 'locations-product-sets-products-list', 'locations-product-sets-remove-product', 'locations-products-create', 'locations-products-delete', 'locations-products-get', 'locations-products-list', 'locations-products-patch', 'locations-products-reference-images-create', 'locations-products-reference-images-delete', 'locations-products-reference-images-get' and 'locations-products-reference-images-list'", vec![ + ("locations-product-sets-add-product", + Some(r##"Adds a Product to the specified ProductSet. If the Product is already + present, no change is made. + + One Product can be added to at most 100 ProductSets. + + Possible errors: + + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-product-sets-add-product", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name for the ProductSet to modify. + + Format is: + `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-product-sets-create", + Some(r##"Creates and returns a new ProductSet resource. + + Possible errors: + + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than + 4096 characters."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-product-sets-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The project in which the ProductSet should be created. + + Format is `projects/PROJECT_ID/locations/LOC_ID`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-product-sets-delete", + Some(r##"Permanently deletes a ProductSet. Products and ReferenceImages in the + ProductSet are not deleted. + + The actual image files are not deleted from Google Cloud Storage. + + Possible errors: + + * Returns NOT_FOUND if the ProductSet does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-product-sets-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name of the ProductSet to delete. + + Format is: + `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-product-sets-get", + Some(r##"Gets information associated with a ProductSet. + + Possible errors: + + * Returns NOT_FOUND if the ProductSet does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-product-sets-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name of the ProductSet to get. + + Format is: + `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-product-sets-import", + Some(r##"Asynchronous API that imports a list of reference images to specified + product sets based on a list of image information. + + The google.longrunning.Operation API can be used to keep track of the + progress and results of the request. + `Operation.metadata` contains `BatchOperationMetadata`. (progress) + `Operation.response` contains `ImportProductSetsResponse`. (results) + + The input source of this method is a csv file on Google Cloud Storage. + For the format of the csv file please see + ImportProductSetsGcsSource.csv_file_uri."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-product-sets-import", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The project in which the ProductSets should be imported. + + Format is `projects/PROJECT_ID/locations/LOC_ID`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-product-sets-list", + Some(r##"Lists ProductSets in an unspecified order. + + Possible errors: + + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + than 1."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-product-sets-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The project from which ProductSets should be listed. + + Format is `projects/PROJECT_ID/locations/LOC_ID`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-product-sets-patch", + Some(r##"Makes changes to a ProductSet resource. + Only display_name can be updated currently. + + Possible errors: + + * Returns NOT_FOUND if the ProductSet does not exist. + * Returns INVALID_ARGUMENT if display_name is present in update_mask but + missing from the request or longer than 4096 characters."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-product-sets-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the ProductSet. + + Format is: + `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + + This field is ignored when creating a ProductSet."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-product-sets-products-list", + Some(r##"Lists the Products in a ProductSet, in an unspecified order. If the + ProductSet does not exist, the products field of the response will be + empty. + + Possible errors: + + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-product-sets-products-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The ProductSet resource for which to retrieve Products. + + Format is: + `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-product-sets-remove-product", + Some(r##"Removes a Product from the specified ProductSet. + + Possible errors: + + * Returns NOT_FOUND If the Product is not found under the ProductSet."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-product-sets-remove-product", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name for the ProductSet to modify. + + Format is: + `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-products-create", + Some(r##"Creates and returns a new product resource. + + Possible errors: + + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 + characters. + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. + * Returns INVALID_ARGUMENT if product_category is missing or invalid."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-products-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The project in which the Product should be created. + + Format is + `projects/PROJECT_ID/locations/LOC_ID`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-products-delete", + Some(r##"Permanently deletes a product and its reference images. + + Metadata of the product and all its images will be deleted right away, but + search queries against ProductSets containing the product may still work + until all related caches are refreshed. + + Possible errors: + + * Returns NOT_FOUND if the product does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-products-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name of product to delete. + + Format is: + `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-products-get", + Some(r##"Gets information associated with a Product. + + Possible errors: + + * Returns NOT_FOUND if the Product does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-products-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"Resource name of the Product to get. + + Format is: + `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-products-list", + Some(r##"Lists products in an unspecified order. + + Possible errors: + + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-products-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"The project OR ProductSet from which Products should be listed. + + Format: + `projects/PROJECT_ID/locations/LOC_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-products-patch", + Some(r##"Makes changes to a Product resource. + Only the `display_name`, `description`, and `labels` fields can be updated + right now. + + If labels are updated, the change will not be reflected in queries until + the next index time. + + Possible errors: + + * Returns NOT_FOUND if the Product does not exist. + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + missing from the request or longer than 4096 characters. + * Returns INVALID_ARGUMENT if description is present in update_mask but is + longer than 4096 characters. + * Returns INVALID_ARGUMENT if product_category is present in update_mask."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-products-patch", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the product. + + Format is: + `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + + This field is ignored when creating a product."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-products-reference-images-create", + Some(r##"Creates and returns a new ReferenceImage resource. + + The `bounding_poly` field is optional. If `bounding_poly` is not specified, + the system will try to detect regions of interest in the image that are + compatible with the product_category on the parent product. If it is + specified, detection is ALWAYS skipped. The system converts polygons into + non-rotated rectangles. + + Note that the pipeline will resize the image if the image resolution is too + large to process (above 50MP). + + Possible errors: + + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 + characters. + * Returns INVALID_ARGUMENT if the product does not exist. + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing + compatible with the parent product's product_category is detected. + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-products-reference-images-create", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Resource name of the product in which to create the reference image. + + Format is + `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-products-reference-images-delete", + Some(r##"Permanently deletes a reference image. + + The image metadata will be deleted right away, but search queries + against ProductSets containing the image may still work until all related + caches are refreshed. + + The actual image files are not deleted from Google Cloud Storage. + + Possible errors: + + * Returns NOT_FOUND if the reference image does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-products-reference-images-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the reference image to delete. + + Format is: + + `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-products-reference-images-get", + Some(r##"Gets information associated with a ReferenceImage. + + Possible errors: + + * Returns NOT_FOUND if the specified image does not exist."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-products-reference-images-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the ReferenceImage to get. + + Format is: + + `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("locations-products-reference-images-list", + Some(r##"Lists reference images. + + Possible errors: + + * Returns NOT_FOUND if the parent product does not exist. + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less + than 1."##), + "Details at http://byron.github.io/google-apis-rs/google_vision1_cli/projects_locations-products-reference-images-list", + vec![ + (Some(r##"parent"##), + None, + Some(r##"Resource name of the product containing the reference images. + + Format is + `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ]; let mut app = App::new("vision1") .author("Sebastian Thiel ") - .version("1.0.8+20181001") + .version("1.0.8+20190314") .about("Integrates Google Vision features, including image labeling, face, logo, and landmark detection, optical character recognition (OCR), and detection of explicit content, into applications.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_vision1_cli") .arg(Arg::with_name("url") diff --git a/gen/vision1/Cargo.toml b/gen/vision1/Cargo.toml index 4d5f3c3cc1..42087674d4 100644 --- a/gen/vision1/Cargo.toml +++ b/gen/vision1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-vision1" -version = "1.0.8+20181001" +version = "1.0.8+20190314" authors = ["Sebastian Thiel "] description = "A complete library to interact with Vision (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/vision1" homepage = "https://cloud.google.com/vision/" -documentation = "https://docs.rs/google-vision1/1.0.8+20181001" +documentation = "https://docs.rs/google-vision1/1.0.8+20190314" license = "MIT" keywords = ["vision", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/vision1/README.md b/gen/vision1/README.md index beae9e8645..efe3024eba 100644 --- a/gen/vision1/README.md +++ b/gen/vision1/README.md @@ -5,22 +5,24 @@ DO NOT EDIT ! --> The `google-vision1` library allows access to all features of the *Google Vision* service. -This documentation was generated from *Vision* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *vision:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *Vision* crate version *1.0.8+20190314*, where *20190314* is the exact revision of the *vision:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *Vision* *v1* API can be found at the [official documentation site](https://cloud.google.com/vision/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.Vision.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.Vision.html) ... * files - * [*async batch annotate*](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.FileAsyncBatchAnnotateCall.html) -* [images](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.Image.html) - * [*annotate*](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.ImageAnnotateCall.html) + * [*async batch annotate*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.FileAsyncBatchAnnotateCall.html) +* [images](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.Image.html) + * [*annotate*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ImageAnnotateCall.html) * locations - * [*operations get*](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.LocationOperationGetCall.html) -* [operations](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.Operation.html) - * [*cancel*](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.OperationDeleteCall.html), [*get*](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.OperationListCall.html) + * [*operations get*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.LocationOperationGetCall.html) +* [operations](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.Operation.html) + * [*cancel*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.OperationCancelCall.html), [*delete*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.OperationDeleteCall.html), [*get*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.OperationListCall.html) +* projects + * [*locations product sets add product*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductSetAddProductCall.html), [*locations product sets create*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductSetCreateCall.html), [*locations product sets delete*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductSetDeleteCall.html), [*locations product sets get*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductSetGetCall.html), [*locations product sets import*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductSetImportCall.html), [*locations product sets list*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductSetListCall.html), [*locations product sets patch*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductSetPatchCall.html), [*locations product sets products list*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductSetProductListCall.html), [*locations product sets remove product*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductSetRemoveProductCall.html), [*locations products create*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductCreateCall.html), [*locations products delete*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductDeleteCall.html), [*locations products get*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductGetCall.html), [*locations products list*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductListCall.html), [*locations products patch*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductPatchCall.html), [*locations products reference images create*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductReferenceImageCreateCall.html), [*locations products reference images delete*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductReferenceImageDeleteCall.html), [*locations products reference images get*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductReferenceImageGetCall.html) and [*locations products reference images list*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.ProjectLocationProductReferenceImageListCall.html) @@ -29,17 +31,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/struct.Vision.html)** +* **[Hub](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/struct.Vision.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.Part.html)** + * **[Parts](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -59,6 +61,7 @@ let r = hub.operations().get(...).doit() let r = hub.operations().cancel(...).doit() let r = hub.operations().delete(...).doit() let r = hub.files().async_batch_annotate(...).doit() +let r = hub.projects().locations_product_sets_import(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -138,17 +141,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -158,29 +161,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-vision1/1.0.8+20181001/google_vision1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-vision1/1.0.8+20190314/google_vision1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/vision1/src/lib.rs b/gen/vision1/src/lib.rs index b86d8122b9..9a4f236ee8 100644 --- a/gen/vision1/src/lib.rs +++ b/gen/vision1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Vision* crate version *1.0.8+20181001*, where *20181001* is the exact revision of the *vision:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *Vision* crate version *1.0.8+20190314*, where *20190314* is the exact revision of the *vision:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *Vision* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/vision/). @@ -19,6 +19,8 @@ //! * [*operations get*](struct.LocationOperationGetCall.html) //! * [operations](struct.Operation.html) //! * [*cancel*](struct.OperationCancelCall.html), [*delete*](struct.OperationDeleteCall.html), [*get*](struct.OperationGetCall.html) and [*list*](struct.OperationListCall.html) +//! * projects +//! * [*locations product sets add product*](struct.ProjectLocationProductSetAddProductCall.html), [*locations product sets create*](struct.ProjectLocationProductSetCreateCall.html), [*locations product sets delete*](struct.ProjectLocationProductSetDeleteCall.html), [*locations product sets get*](struct.ProjectLocationProductSetGetCall.html), [*locations product sets import*](struct.ProjectLocationProductSetImportCall.html), [*locations product sets list*](struct.ProjectLocationProductSetListCall.html), [*locations product sets patch*](struct.ProjectLocationProductSetPatchCall.html), [*locations product sets products list*](struct.ProjectLocationProductSetProductListCall.html), [*locations product sets remove product*](struct.ProjectLocationProductSetRemoveProductCall.html), [*locations products create*](struct.ProjectLocationProductCreateCall.html), [*locations products delete*](struct.ProjectLocationProductDeleteCall.html), [*locations products get*](struct.ProjectLocationProductGetCall.html), [*locations products list*](struct.ProjectLocationProductListCall.html), [*locations products patch*](struct.ProjectLocationProductPatchCall.html), [*locations products reference images create*](struct.ProjectLocationProductReferenceImageCreateCall.html), [*locations products reference images delete*](struct.ProjectLocationProductReferenceImageDeleteCall.html), [*locations products reference images get*](struct.ProjectLocationProductReferenceImageGetCall.html) and [*locations products reference images list*](struct.ProjectLocationProductReferenceImageListCall.html) //! //! //! @@ -59,6 +61,7 @@ //! let r = hub.operations().cancel(...).doit() //! let r = hub.operations().delete(...).doit() //! let r = hub.files().async_batch_annotate(...).doit() +//! let r = hub.projects().locations_product_sets_import(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -358,6 +361,9 @@ impl<'a, C, A> Vision pub fn operations(&'a self) -> OperationMethods<'a, C, A> { OperationMethods { hub: &self } } + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } /// Set the user-agent header field to use in all requests to the server. /// It defaults to `google-api-rust-client/1.0.8`. @@ -388,22 +394,25 @@ impl<'a, C, A> Vision // ############ // SCHEMAS ### // ########## -/// Multiple image annotation requests are batched into a single service call. +/// Request message for the `AddProductToProductSet` method. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [annotate images](struct.ImageAnnotateCall.html) (request) +/// * [locations product sets add product projects](struct.ProjectLocationProductSetAddProductCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchAnnotateImagesRequest { - /// Individual image annotation requests for this batch. - pub requests: Option>, +pub struct AddProductToProductSetRequest { + /// The resource name for the Product to be added to this ProductSet. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + pub product: Option, } -impl RequestValue for BatchAnnotateImagesRequest {} +impl RequestValue for AddProductToProductSetRequest {} /// A vertex represents a 2D point in the image. @@ -422,6 +431,23 @@ pub struct Vertex { impl Part for Vertex {} +/// A product label represented as a key-value pair. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct KeyValue { + /// The key of the label attached to the product. Cannot be empty and cannot + /// exceed 128 bytes. + pub key: Option, + /// The value of the label attached to the product. Cannot be empty and + /// cannot exceed 128 bytes. + pub value: Option, +} + +impl Part for KeyValue {} + + /// The desired output location and metadata. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -449,20 +475,6 @@ pub struct OutputConfig { impl Part for OutputConfig {} -/// The Google Cloud Storage location where the input will be read from. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GcsSource { - /// Google Cloud Storage URI for the input file. This must only be a - /// Google Cloud Storage object. Wildcards are not currently supported. - pub uri: Option, -} - -impl Part for GcsSource {} - - /// Structural unit of text representing a number of words in certain order. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -483,7 +495,7 @@ pub struct Paragraph { /// 2----3 /// | | /// 1----0 - /// and the vertice order will still be (0, 1, 2, 3). + /// and the vertex order will still be (0, 1, 2, 3). #[serde(rename="boundingBox")] pub bounding_box: Option, /// Confidence of the OCR results for the paragraph. Range [0, 1]. @@ -497,86 +509,39 @@ pub struct Paragraph { impl Part for Paragraph {} -/// A face-specific landmark (for example, a face feature). +/// A vertex represents a 2D point in the image. +/// NOTE: the normalized vertex coordinates are relative to the original image +/// and range from 0 to 1. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Landmark { - /// Face landmark position. - pub position: Option, - /// Face landmark type. - #[serde(rename="type")] - pub type_: Option, -} - -impl Part for Landmark {} - - -/// A 3D position in the image, used primarily for Face detection landmarks. -/// A valid Position must have both x and y coordinates. -/// The position coordinates are in the same scale as the original image. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Position { +pub struct NormalizedVertex { /// Y coordinate. pub y: Option, /// X coordinate. pub x: Option, - /// Z coordinate (or depth). - pub z: Option, } -impl Part for Position {} +impl Part for NormalizedVertex {} -/// This resource represents a long-running operation that is the result of a -/// network API call. +/// Multiple image annotation requests are batched into a single service call. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list operations](struct.OperationListCall.html) (none) -/// * [operations get locations](struct.LocationOperationGetCall.html) (response) -/// * [get operations](struct.OperationGetCall.html) (response) -/// * [cancel operations](struct.OperationCancelCall.html) (none) -/// * [delete operations](struct.OperationDeleteCall.html) (none) -/// * [async batch annotate files](struct.FileAsyncBatchAnnotateCall.html) (response) +/// * [annotate images](struct.ImageAnnotateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// The error result of the operation in case of failure or cancellation. - pub error: Option, - /// If the value is `false`, it means the operation is still in progress. - /// If `true`, the operation is completed, and either `error` or `response` is - /// available. - pub done: Option, - /// The normal response of the operation in case of success. If the original - /// method returns no data on success, such as `Delete`, the response is - /// `google.protobuf.Empty`. If the original method is standard - /// `Get`/`Create`/`Update`, the response should be the resource. For other - /// methods, the response should have the type `XxxResponse`, where `Xxx` - /// is the original method name. For example, if the original method name - /// is `TakeSnapshot()`, the inferred response type is - /// `TakeSnapshotResponse`. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that - /// originally returns it. If you use the default HTTP mapping, the - /// `name` should have the format of `operations/some/unique/name`. - pub name: Option, - /// Service-specific metadata associated with the operation. It typically - /// contains progress information and common metadata such as create time. - /// Some services might not provide such metadata. Any method that returns a - /// long-running operation should document the metadata type, if any. - pub metadata: Option>, +pub struct BatchAnnotateImagesRequest { + /// Individual image annotation requests for this batch. + pub requests: Option>, } -impl Resource for Operation {} -impl ResponseResult for Operation {} +impl RequestValue for BatchAnnotateImagesRequest {} /// Label to provide extra metadata for the web detection. @@ -597,6 +562,27 @@ pub struct WebLabel { impl Part for WebLabel {} +/// TextAnnotation contains a structured representation of OCR extracted text. +/// The hierarchy of an OCR extracted text structure is like this: +/// TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol +/// Each structural component, starting from Page, may further have their own +/// properties. Properties describe detected languages, breaks etc.. Please refer +/// to the TextAnnotation.TextProperty message definition below for more +/// detail. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TextAnnotation { + /// UTF-8 text detected on the pages. + pub text: Option, + /// List of pages detected by OCR. + pub pages: Option>, +} + +impl Part for TextAnnotation {} + + /// Stores image properties, such as dominant colors. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -611,332 +597,120 @@ pub struct ImageProperties { impl Part for ImageProperties {} -/// Relevant information for the image from the Internet. +/// Information about the products similar to a single product in a query +/// image. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WebDetection { - /// Web pages containing the matching images from the Internet. - #[serde(rename="pagesWithMatchingImages")] - pub pages_with_matching_images: Option>, - /// The visually similar image results. - #[serde(rename="visuallySimilarImages")] - pub visually_similar_images: Option>, - /// Partial matching images from the Internet. - /// Those images are similar enough to share some key-point features. For - /// example an original image will likely have partial matching for its crops. - #[serde(rename="partialMatchingImages")] - pub partial_matching_images: Option>, - /// Deduced entities from similar images on the Internet. - #[serde(rename="webEntities")] - pub web_entities: Option>, - /// Fully matching images from the Internet. - /// Can include resized copies of the query image. - #[serde(rename="fullMatchingImages")] - pub full_matching_images: Option>, - /// The service's best guess as to the topic of the request image. - /// Inferred from similar images on the open web. - #[serde(rename="bestGuessLabels")] - pub best_guess_labels: Option>, -} - -impl Part for WebDetection {} - - -/// The desired input location and metadata. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InputConfig { - /// The type of the file. Currently only "application/pdf" and "image/tiff" - /// are supported. Wildcards are not supported. - #[serde(rename="mimeType")] - pub mime_type: Option, - /// The Google Cloud Storage location to read the input from. - #[serde(rename="gcsSource")] - pub gcs_source: Option, -} - -impl Part for InputConfig {} - - -/// Rectangle determined by min and max `LatLng` pairs. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LatLongRect { - /// Min lat/long pair. - #[serde(rename="minLatLng")] - pub min_lat_lng: Option, - /// Max lat/long pair. - #[serde(rename="maxLatLng")] - pub max_lat_lng: Option, -} - -impl Part for LatLongRect {} - - -/// Set of detected objects with bounding boxes. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LocalizedObjectAnnotation { - /// The BCP-47 language code, such as "en-US" or "sr-Latn". For more - /// information, see - /// http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - #[serde(rename="languageCode")] - pub language_code: Option, - /// Score of the result. Range [0, 1]. - pub score: Option, - /// Object ID that should align with EntityAnnotation mid. - pub mid: Option, - /// Image region to which this object belongs. This must be populated. +pub struct GroupedResult { + /// List of results, one for each product match. + pub results: Option>, + /// The bounding polygon around the product detected in the query image. #[serde(rename="boundingPoly")] pub bounding_poly: Option, - /// Object name, expressed in its `language_code` language. - pub name: Option, } -impl Part for LocalizedObjectAnnotation {} +impl Part for GroupedResult {} -/// The Google Cloud Storage location where the output will be written to. +/// An object representing a latitude/longitude pair. This is expressed as a pair +/// of doubles representing degrees latitude and degrees longitude. Unless +/// specified otherwise, this must conform to the +/// WGS84 +/// standard. Values must be within normalized ranges. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GcsDestination { - /// Google Cloud Storage URI where the results will be stored. Results will - /// be in JSON format and preceded by its corresponding input URI. This field - /// can either represent a single file, or a prefix for multiple outputs. - /// Prefixes must end in a `/`. - /// - /// Examples: - /// - /// * File: gs://bucket-name/filename.json - /// * Prefix: gs://bucket-name/prefix/here/ - /// * File: gs://bucket-name/prefix/here - /// - /// If multiple outputs, each response is still AnnotateFileResponse, each of - /// which contains some subset of the full list of AnnotateImageResponse. - /// Multiple outputs can happen if, for example, the output JSON is too large - /// and overflows into multiple sharded files. - pub uri: Option, +pub struct LatLng { + /// The latitude in degrees. It must be in the range [-90.0, +90.0]. + pub latitude: Option, + /// The longitude in degrees. It must be in the range [-180.0, +180.0]. + pub longitude: Option, } -impl Part for GcsDestination {} +impl Part for LatLng {} -/// Detected entity location information. +/// Information about a product. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LocationInfo { - /// lat/long location coordinates. - #[serde(rename="latLng")] - pub lat_lng: Option, -} - -impl Part for LocationInfo {} - - -/// Multiple async file annotation requests are batched into a single service -/// call. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [async batch annotate files](struct.FileAsyncBatchAnnotateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AsyncBatchAnnotateFilesRequest { - /// Individual async file annotation requests for this batch. - pub requests: Option>, -} - -impl RequestValue for AsyncBatchAnnotateFilesRequest {} - - -/// Logical element on the page. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Block { - /// The bounding box for the block. - /// The vertices are in the order of top-left, top-right, bottom-right, - /// bottom-left. When a rotation of the bounding box is detected the rotation - /// is represented as around the top-left corner as defined when the text is - /// read in the 'natural' orientation. - /// For example: - /// - /// * when the text is horizontal it might look like: - /// - /// 0----1 - /// | | - /// 3----2 - /// - /// * when it's rotated 180 degrees around the top-left corner it becomes: - /// - /// 2----3 - /// | | - /// 1----0 - /// - /// and the vertice order will still be (0, 1, 2, 3). - #[serde(rename="boundingBox")] - pub bounding_box: Option, - /// Confidence of the OCR results on the block. Range [0, 1]. - pub confidence: Option, - /// Additional information detected for the block. - pub property: Option, - /// Detected block type (text, image etc) for this block. - #[serde(rename="blockType")] - pub block_type: Option, - /// List of paragraphs in this block (if this blocks is of type text). - pub paragraphs: Option>, -} - -impl Part for Block {} - - -/// Client image to perform Google Cloud Vision API tasks over. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [annotate images](struct.ImageAnnotateCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Image { - /// Image content, represented as a stream of bytes. - /// Note: As with all `bytes` fields, protobuffers use a pure binary - /// representation, whereas JSON representations use base64. - pub content: Option, - /// Google Cloud Storage image location, or publicly-accessible image - /// URL. If both `content` and `source` are provided for an image, `content` - /// takes precedence and is used to perform the image annotation request. - pub source: Option, -} - -impl Resource for Image {} - - -/// If an image was produced from a file (e.g. a PDF), this message gives -/// information about the source of that image. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImageAnnotationContext { - /// If the file was a PDF or TIFF, this field gives the page number within - /// the file used to produce the image. - #[serde(rename="pageNumber")] - pub page_number: Option, - /// The URI of the file used to produce the image. - pub uri: Option, -} - -impl Part for ImageAnnotationContext {} - - -/// Entity deduced from similar images on the Internet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WebEntity { - /// Opaque entity ID. - #[serde(rename="entityId")] - pub entity_id: Option, - /// Overall relevancy score for the entity. - /// Not normalized and not comparable across different image queries. +pub struct ResultType { + /// The resource name of the image from the product that is the closest match + /// to the query. + pub image: Option, + /// A confidence level on the match, ranging from 0 (no confidence) to + /// 1 (full confidence). pub score: Option, - /// Canonical description of the entity, in English. - pub description: Option, + /// The Product. + pub product: Option, } -impl Part for WebEntity {} +impl Part for ResultType {} -/// A word representation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Word { - /// The bounding box for the word. - /// The vertices are in the order of top-left, top-right, bottom-right, - /// bottom-left. When a rotation of the bounding box is detected the rotation - /// is represented as around the top-left corner as defined when the text is - /// read in the 'natural' orientation. - /// For example: - /// * when the text is horizontal it might look like: - /// 0----1 - /// | | - /// 3----2 - /// * when it's rotated 180 degrees around the top-left corner it becomes: - /// 2----3 - /// | | - /// 1----0 - /// and the vertice order will still be (0, 1, 2, 3). - #[serde(rename="boundingBox")] - pub bounding_box: Option, - /// List of symbols in the word. - /// The order of the symbols follows the natural reading order. - pub symbols: Option>, - /// Confidence of the OCR results for the word. Range [0, 1]. - pub confidence: Option, - /// Additional information detected for the word. - pub property: Option, -} - -impl Part for Word {} - - -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -/// -/// The JSON representation for `Empty` is empty JSON object `{}`. +/// The request message for Operations.CancelOperation. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [delete operations](struct.OperationDeleteCall.html) (response) -/// * [cancel operations](struct.OperationCancelCall.html) (response) +/// * [cancel operations](struct.OperationCancelCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Empty { _never_set: Option } +pub struct CancelOperationRequest { _never_set: Option } -impl ResponseResult for Empty {} +impl RequestValue for CancelOperationRequest {} -/// The `Status` type defines a logical error model that is suitable for different -/// programming environments, including REST APIs and RPC APIs. It is used by -/// [gRPC](https://github.com/grpc). The error model is designed to be: +/// Parameters for a product search request. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ProductSearchParams { + /// The filtering expression. This can be used to restrict search results based + /// on Product labels. We currently support an AND of OR of key-value + /// expressions, where each expression within an OR must have the same key. + /// + /// For example, "(color = red OR color = blue) AND brand = Google" is + /// acceptable, but not "(color = red OR brand = Google)" or "color: red". + pub filter: Option, + /// The list of product categories to search in. Currently, we only consider + /// the first category, and either "homegoods", "apparel", or "toys" should be + /// specified. + #[serde(rename="productCategories")] + pub product_categories: Option>, + /// The resource name of a ProductSet to be searched for similar images. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + #[serde(rename="productSet")] + pub product_set: Option, + /// The bounding polygon around the area of interest in the image. + /// Optional. If it is not specified, system discretion will be applied. + #[serde(rename="boundingPoly")] + pub bounding_poly: Option, +} + +impl Part for ProductSearchParams {} + + +/// The `Status` type defines a logical error model that is suitable for +/// different programming environments, including REST APIs and RPC APIs. It is +/// used by [gRPC](https://github.com/grpc). The error model is designed to be: /// /// - Simple to use and understand for most users /// - Flexible enough to meet unexpected needs /// /// # Overview /// -/// The `Status` message contains three pieces of data: error code, error message, -/// and error details. The error code should be an enum value of +/// The `Status` message contains three pieces of data: error code, error +/// message, and error details. The error code should be an enum value of /// google.rpc.Code, but it may accept additional error codes if needed. The /// error message should be a developer-facing English message that helps /// developers *understand* and *resolve* the error. If a localized user-facing @@ -997,6 +771,924 @@ pub struct Status { impl Part for Status {} +/// Additional information detected on the structural component. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TextProperty { + /// Detected start or end of a text segment. + #[serde(rename="detectedBreak")] + pub detected_break: Option, + /// A list of detected languages together with confidence. + #[serde(rename="detectedLanguages")] + pub detected_languages: Option>, +} + +impl Part for TextProperty {} + + +/// Logical element on the page. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Block { + /// The bounding box for the block. + /// The vertices are in the order of top-left, top-right, bottom-right, + /// bottom-left. When a rotation of the bounding box is detected the rotation + /// is represented as around the top-left corner as defined when the text is + /// read in the 'natural' orientation. + /// For example: + /// + /// * when the text is horizontal it might look like: + /// + /// 0----1 + /// | | + /// 3----2 + /// + /// * when it's rotated 180 degrees around the top-left corner it becomes: + /// + /// 2----3 + /// | | + /// 1----0 + /// + /// and the vertex order will still be (0, 1, 2, 3). + #[serde(rename="boundingBox")] + pub bounding_box: Option, + /// Detected block type (text, image etc) for this block. + #[serde(rename="blockType")] + pub block_type: Option, + /// Additional information detected for the block. + pub property: Option, + /// Confidence of the OCR results on the block. Range [0, 1]. + pub confidence: Option, + /// List of paragraphs in this block (if this blocks is of type text). + pub paragraphs: Option>, +} + +impl Part for Block {} + + +/// The type of Google Cloud Vision API detection to perform, and the maximum +/// number of results to return for that type. Multiple `Feature` objects can +/// be specified in the `features` list. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Feature { + /// Model to use for the feature. + /// Supported values: "builtin/stable" (the default if unset) and + /// "builtin/latest". + pub model: Option, + /// The feature type. + #[serde(rename="type")] + pub type_: Option, + /// Maximum number of results of this type. Does not apply to + /// `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. + #[serde(rename="maxResults")] + pub max_results: Option, +} + +impl Part for Feature {} + + +/// Response message for the `ListReferenceImages` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations products reference images list projects](struct.ProjectLocationProductReferenceImageListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListReferenceImagesResponse { + /// The next_page_token returned from a previous List request, if any. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The maximum number of items to return. Default 10, maximum 100. + #[serde(rename="pageSize")] + pub page_size: Option, + /// The list of reference images. + #[serde(rename="referenceImages")] + pub reference_images: Option>, +} + +impl ResponseResult for ListReferenceImagesResponse {} + + +/// Detected language for a structural component. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DetectedLanguage { + /// The BCP-47 language code, such as "en-US" or "sr-Latn". For more + /// information, see + /// http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + #[serde(rename="languageCode")] + pub language_code: Option, + /// Confidence of detected language. Range [0, 1]. + pub confidence: Option, +} + +impl Part for DetectedLanguage {} + + +/// Parameters for crop hints annotation request. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CropHintsParams { + /// Aspect ratios in floats, representing the ratio of the width to the height + /// of the image. For example, if the desired aspect ratio is 4/3, the + /// corresponding float value should be 1.33333. If not specified, the + /// best possible crop is returned. The number of provided aspect ratios is + /// limited to a maximum of 16; any aspect ratios provided after the 16th are + /// ignored. + #[serde(rename="aspectRatios")] + pub aspect_ratios: Option>, +} + +impl Part for CropHintsParams {} + + +/// Request for performing Google Cloud Vision API tasks over a user-provided +/// image, with user-requested features, and with context information. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AnnotateImageRequest { + /// Additional context that may accompany the image. + #[serde(rename="imageContext")] + pub image_context: Option, + /// The image to be processed. + pub image: Option, + /// Requested features. + pub features: Option>, +} + +impl Part for AnnotateImageRequest {} + + +/// Set of crop hints that are used to generate new crops when serving images. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CropHintsAnnotation { + /// Crop hint results. + #[serde(rename="cropHints")] + pub crop_hints: Option>, +} + +impl Part for CropHintsAnnotation {} + + +/// Set of detected entity features. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EntityAnnotation { + /// **Deprecated. Use `score` instead.** + /// The accuracy of the entity detection in an image. + /// For example, for an image in which the "Eiffel Tower" entity is detected, + /// this field represents the confidence that there is a tower in the query + /// image. Range [0, 1]. + pub confidence: Option, + /// Entity textual description, expressed in its `locale` language. + pub description: Option, + /// The language code for the locale in which the entity textual + /// `description` is expressed. + pub locale: Option, + /// The relevancy of the ICA (Image Content Annotation) label to the + /// image. For example, the relevancy of "tower" is likely higher to an image + /// containing the detected "Eiffel Tower" than to an image containing a + /// detected distant towering building, even though the confidence that + /// there is a tower in each image may be the same. Range [0, 1]. + pub topicality: Option, + /// The location information for the detected entity. Multiple + /// `LocationInfo` elements can be present because one location may + /// indicate the location of the scene in the image, and another location + /// may indicate the location of the place where the image was taken. + /// Location information is usually present for landmarks. + pub locations: Option>, + /// Opaque entity ID. Some IDs may be available in + /// [Google Knowledge Graph Search + /// API](https://developers.google.com/knowledge-graph/). + pub mid: Option, + /// Overall score of the result. Range [0, 1]. + pub score: Option, + /// Image region to which this entity belongs. Not produced + /// for `LABEL_DETECTION` features. + #[serde(rename="boundingPoly")] + pub bounding_poly: Option, + /// Some entities may have optional user-supplied `Property` (name/value) + /// fields, such a score or string that qualifies the entity. + pub properties: Option>, +} + +impl Part for EntityAnnotation {} + + +/// Parameters for web detection request. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WebDetectionParams { + /// Whether to include results derived from the geo information in the image. + #[serde(rename="includeGeoResults")] + pub include_geo_results: Option, +} + +impl Part for WebDetectionParams {} + + +/// Metadata for online images. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WebImage { + /// The result image URL. + pub url: Option, + /// (Deprecated) Overall relevancy score for the image. + pub score: Option, +} + +impl Part for WebImage {} + + +/// A Product contains ReferenceImages. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations products get projects](struct.ProjectLocationProductGetCall.html) (response) +/// * [locations products patch projects](struct.ProjectLocationProductPatchCall.html) (request|response) +/// * [locations products create projects](struct.ProjectLocationProductCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Product { + /// Key-value pairs that can be attached to a product. At query time, + /// constraints can be specified based on the product_labels. + /// + /// Note that integer values can be provided as strings, e.g. "1199". Only + /// strings with integer values can match a range-based restriction which is + /// to be supported soon. + /// + /// Multiple values can be assigned to the same key. One product may have up to + /// 100 product_labels. + #[serde(rename="productLabels")] + pub product_labels: Option>, + /// The user-provided name for this Product. Must not be empty. Must be at most + /// 4096 characters long. + #[serde(rename="displayName")] + pub display_name: Option, + /// User-provided metadata to be stored with this product. Must be at most 4096 + /// characters long. + pub description: Option, + /// The category for the product identified by the reference image. This should + /// be either "homegoods", "apparel", or "toys". + /// + /// This field is immutable. + #[serde(rename="productCategory")] + pub product_category: Option, + /// The resource name of the product. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + /// + /// This field is ignored when creating a product. + pub name: Option, +} + +impl RequestValue for Product {} +impl ResponseResult for Product {} + + +/// Set of features pertaining to the image, computed by computer vision +/// methods over safe-search verticals (for example, adult, spoof, medical, +/// violence). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SafeSearchAnnotation { + /// Likelihood that this is a medical image. + pub medical: Option, + /// Likelihood that this image contains violent content. + pub violence: Option, + /// Spoof likelihood. The likelihood that an modification + /// was made to the image's canonical version to make it appear + /// funny or offensive. + pub spoof: Option, + /// Likelihood that the request image contains racy content. Racy content may + /// include (but is not limited to) skimpy or sheer clothing, strategically + /// covered nudity, lewd or provocative poses, or close-ups of sensitive + /// body areas. + pub racy: Option, + /// Represents the adult content likelihood for the image. Adult content may + /// contain elements such as nudity, pornographic images or cartoons, or + /// sexual activities. + pub adult: Option, +} + +impl Part for SafeSearchAnnotation {} + + +/// Color information consists of RGB channels, score, and the fraction of +/// the image that the color occupies in the image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ColorInfo { + /// RGB components of the color. + pub color: Option, + /// The fraction of pixels the color occupies in the image. + /// Value in range [0, 1]. + #[serde(rename="pixelFraction")] + pub pixel_fraction: Option, + /// Image-specific score for this color. Value in range [0, 1]. + pub score: Option, +} + +impl Part for ColorInfo {} + + +/// An offline file annotation request. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AsyncAnnotateFileRequest { + /// Additional context that may accompany the image(s) in the file. + #[serde(rename="imageContext")] + pub image_context: Option, + /// Required. The desired output location and metadata (e.g. format). + #[serde(rename="outputConfig")] + pub output_config: Option, + /// Required. Requested features. + pub features: Option>, + /// Required. Information about the input file. + #[serde(rename="inputConfig")] + pub input_config: Option, +} + +impl Part for AsyncAnnotateFileRequest {} + + +/// Response message for the `ListProductSets` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations product sets list projects](struct.ProjectLocationProductSetListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListProductSetsResponse { + /// Token to retrieve the next page of results, or empty if there are no more + /// results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of ProductSets. + #[serde(rename="productSets")] + pub product_sets: Option>, +} + +impl ResponseResult for ListProductSetsResponse {} + + +/// Response to an image annotation request. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AnnotateImageResponse { + /// If present, safe-search annotation has completed successfully. + #[serde(rename="safeSearchAnnotation")] + pub safe_search_annotation: Option, + /// If present, image properties were extracted successfully. + #[serde(rename="imagePropertiesAnnotation")] + pub image_properties_annotation: Option, + /// If present, web detection has completed successfully. + #[serde(rename="webDetection")] + pub web_detection: Option, + /// If present, localized object detection has completed successfully. + /// This will be sorted descending by confidence score. + #[serde(rename="localizedObjectAnnotations")] + pub localized_object_annotations: Option>, + /// If present, text (OCR) detection or document (OCR) text detection has + /// completed successfully. + /// This annotation provides the structural hierarchy for the OCR detected + /// text. + #[serde(rename="fullTextAnnotation")] + pub full_text_annotation: Option, + /// If present, label detection has completed successfully. + #[serde(rename="labelAnnotations")] + pub label_annotations: Option>, + /// If present, text (OCR) detection has completed successfully. + #[serde(rename="textAnnotations")] + pub text_annotations: Option>, + /// If present, face detection has completed successfully. + #[serde(rename="faceAnnotations")] + pub face_annotations: Option>, + /// If present, product search has completed successfully. + #[serde(rename="productSearchResults")] + pub product_search_results: Option, + /// If present, logo detection has completed successfully. + #[serde(rename="logoAnnotations")] + pub logo_annotations: Option>, + /// If present, landmark detection has completed successfully. + #[serde(rename="landmarkAnnotations")] + pub landmark_annotations: Option>, + /// If present, contextual information is needed to understand where this image + /// comes from. + pub context: Option, + /// If set, represents the error message for the operation. + /// Note that filled-in image annotations are guaranteed to be + /// correct, even when `error` is set. + pub error: Option, + /// If present, crop hints have completed successfully. + #[serde(rename="cropHintsAnnotation")] + pub crop_hints_annotation: Option, +} + +impl Part for AnnotateImageResponse {} + + +/// A ProductSet contains Products. A ProductSet can contain a maximum of 1 +/// million reference images. If the limit is exceeded, periodic indexing will +/// fail. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations product sets get projects](struct.ProjectLocationProductSetGetCall.html) (response) +/// * [locations product sets create projects](struct.ProjectLocationProductSetCreateCall.html) (request|response) +/// * [locations product sets patch projects](struct.ProjectLocationProductSetPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ProductSet { + /// The user-provided name for this ProductSet. Must not be empty. Must be at + /// most 4096 characters long. + #[serde(rename="displayName")] + pub display_name: Option, + /// Output only. If there was an error with indexing the product set, the field + /// is populated. + /// + /// This field is ignored when creating a ProductSet. + #[serde(rename="indexError")] + pub index_error: Option, + /// The resource name of the ProductSet. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + /// + /// This field is ignored when creating a ProductSet. + pub name: Option, + /// Output only. The time at which this ProductSet was last indexed. Query + /// results will reflect all updates before this time. If this ProductSet has + /// never been indexed, this timestamp is the default value + /// "1970-01-01T00:00:00Z". + /// + /// This field is ignored when creating a ProductSet. + #[serde(rename="indexTime")] + pub index_time: Option, +} + +impl RequestValue for ProductSet {} +impl ResponseResult for ProductSet {} + + +/// Metadata for web pages. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WebPage { + /// Title for the web page, may contain HTML markups. + #[serde(rename="pageTitle")] + pub page_title: Option, + /// The result web page URL. + pub url: Option, + /// (Deprecated) Overall relevancy score for the web page. + pub score: Option, + /// Partial matching images on the page. + /// Those images are similar enough to share some key-point features. For + /// example an original image will likely have partial matching for its + /// crops. + #[serde(rename="partialMatchingImages")] + pub partial_matching_images: Option>, + /// Fully matching images on the page. + /// Can include resized copies of the query image. + #[serde(rename="fullMatchingImages")] + pub full_matching_images: Option>, +} + +impl Part for WebPage {} + + +/// The Google Cloud Storage location where the input will be read from. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GcsSource { + /// Google Cloud Storage URI for the input file. This must only be a + /// Google Cloud Storage object. Wildcards are not currently supported. + pub uri: Option, +} + +impl Part for GcsSource {} + + +/// A face-specific landmark (for example, a face feature). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Landmark { + /// Face landmark position. + pub position: Option, + /// Face landmark type. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for Landmark {} + + +/// A 3D position in the image, used primarily for Face detection landmarks. +/// A valid Position must have both x and y coordinates. +/// The position coordinates are in the same scale as the original image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Position { + /// Y coordinate. + pub y: Option, + /// X coordinate. + pub x: Option, + /// Z coordinate (or depth). + pub z: Option, +} + +impl Part for Position {} + + +/// Request message for the `ImportProductSets` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations product sets import projects](struct.ProjectLocationProductSetImportCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImportProductSetsRequest { + /// The input content for the list of requests. + #[serde(rename="inputConfig")] + pub input_config: Option, +} + +impl RequestValue for ImportProductSetsRequest {} + + +/// The input content for the `ImportProductSets` method. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImportProductSetsInputConfig { + /// The Google Cloud Storage location for a csv file which preserves a list + /// of ImportProductSetRequests in each line. + #[serde(rename="gcsSource")] + pub gcs_source: Option, +} + +impl Part for ImportProductSetsInputConfig {} + + +/// This resource represents a long-running operation that is the result of a +/// network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operations](struct.OperationListCall.html) (none) +/// * [operations get locations](struct.LocationOperationGetCall.html) (response) +/// * [get operations](struct.OperationGetCall.html) (response) +/// * [cancel operations](struct.OperationCancelCall.html) (none) +/// * [delete operations](struct.OperationDeleteCall.html) (none) +/// * [async batch annotate files](struct.FileAsyncBatchAnnotateCall.html) (response) +/// * [locations product sets import projects](struct.ProjectLocationProductSetImportCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// The error result of the operation in case of failure or cancellation. + pub error: Option, + /// If the value is `false`, it means the operation is still in progress. + /// If `true`, the operation is completed, and either `error` or `response` is + /// available. + pub done: Option, + /// The normal response of the operation in case of success. If the original + /// method returns no data on success, such as `Delete`, the response is + /// `google.protobuf.Empty`. If the original method is standard + /// `Get`/`Create`/`Update`, the response should be the resource. For other + /// methods, the response should have the type `XxxResponse`, where `Xxx` + /// is the original method name. For example, if the original method name + /// is `TakeSnapshot()`, the inferred response type is + /// `TakeSnapshotResponse`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that + /// originally returns it. If you use the default HTTP mapping, the + /// `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// Service-specific metadata associated with the operation. It typically + /// contains progress information and common metadata such as create time. + /// Some services might not provide such metadata. Any method that returns a + /// long-running operation should document the metadata type, if any. + pub metadata: Option>, +} + +impl Resource for Operation {} +impl ResponseResult for Operation {} + + +/// The Google Cloud Storage location for a csv file which preserves a list of +/// ImportProductSetRequests in each line. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImportProductSetsGcsSource { + /// The Google Cloud Storage URI of the input csv file. + /// + /// The URI must start with `gs://`. + /// + /// The format of the input csv file should be one image per line. + /// In each line, there are 8 columns. + /// + /// 1. image-uri + /// 2. image-id + /// 3. product-set-id + /// 4. product-id + /// 5. product-category + /// 6. product-display-name + /// 7. labels + /// 8. bounding-poly + /// + /// The `image-uri`, `product-set-id`, `product-id`, and `product-category` + /// columns are required. All other columns are optional. + /// + /// If the `ProductSet` or `Product` specified by the `product-set-id` and + /// `product-id` values does not exist, then the system will create a new + /// `ProductSet` or `Product` for the image. In this case, the + /// `product-display-name` column refers to + /// display_name, the + /// `product-category` column refers to + /// product_category, and the + /// `labels` column refers to product_labels. + /// + /// The `image-id` column is optional but must be unique if provided. If it is + /// empty, the system will automatically assign a unique id to the image. + /// + /// The `product-display-name` column is optional. If it is empty, the system + /// sets the display_name field for the product to a + /// space (" "). You can update the `display_name` later by using the API. + /// + /// If a `Product` with the specified `product-id` already exists, then the + /// system ignores the `product-display-name`, `product-category`, and `labels` + /// columns. + /// + /// The `labels` column (optional) is a line containing a list of + /// comma-separated key-value pairs, in the following format: + /// + /// "key_1=value_1,key_2=value_2,...,key_n=value_n" + /// + /// The `bounding-poly` column (optional) identifies one region of + /// interest from the image in the same manner as `CreateReferenceImage`. If + /// you do not specify the `bounding-poly` column, then the system will try to + /// detect regions of interest automatically. + /// + /// At most one `bounding-poly` column is allowed per line. If the image + /// contains multiple regions of interest, add a line to the CSV file that + /// includes the same product information, and the `bounding-poly` values for + /// each region of interest. + /// + /// The `bounding-poly` column must contain an even number of comma-separated + /// numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + /// non-negative integers for absolute bounding polygons, and float values + /// in [0, 1] for normalized bounding polygons. + /// + /// The system will resize the image if the image resolution is too + /// large to process (larger than 20MP). + #[serde(rename="csvFileUri")] + pub csv_file_uri: Option, +} + +impl Part for ImportProductSetsGcsSource {} + + +/// Response to a batch image annotation request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [annotate images](struct.ImageAnnotateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BatchAnnotateImagesResponse { + /// Individual responses to image annotation requests within the batch. + pub responses: Option>, +} + +impl ResponseResult for BatchAnnotateImagesResponse {} + + +/// The desired input location and metadata. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InputConfig { + /// The type of the file. Currently only "application/pdf" and "image/tiff" + /// are supported. Wildcards are not supported. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// The Google Cloud Storage location to read the input from. + #[serde(rename="gcsSource")] + pub gcs_source: Option, +} + +impl Part for InputConfig {} + + +/// Rectangle determined by min and max `LatLng` pairs. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LatLongRect { + /// Min lat/long pair. + #[serde(rename="minLatLng")] + pub min_lat_lng: Option, + /// Max lat/long pair. + #[serde(rename="maxLatLng")] + pub max_lat_lng: Option, +} + +impl Part for LatLongRect {} + + +/// Request message for the `RemoveProductFromProductSet` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations product sets remove product projects](struct.ProjectLocationProductSetRemoveProductCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RemoveProductFromProductSetRequest { + /// The resource name for the Product to be removed from this ProductSet. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + pub product: Option, +} + +impl RequestValue for RemoveProductFromProductSetRequest {} + + +/// Set of detected objects with bounding boxes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LocalizedObjectAnnotation { + /// The BCP-47 language code, such as "en-US" or "sr-Latn". For more + /// information, see + /// http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + #[serde(rename="languageCode")] + pub language_code: Option, + /// Score of the result. Range [0, 1]. + pub score: Option, + /// Object ID that should align with EntityAnnotation mid. + pub mid: Option, + /// Image region to which this object belongs. This must be populated. + #[serde(rename="boundingPoly")] + pub bounding_poly: Option, + /// Object name, expressed in its `language_code` language. + pub name: Option, +} + +impl Part for LocalizedObjectAnnotation {} + + +/// The Google Cloud Storage location where the output will be written to. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GcsDestination { + /// Google Cloud Storage URI where the results will be stored. Results will + /// be in JSON format and preceded by its corresponding input URI. This field + /// can either represent a single file, or a prefix for multiple outputs. + /// Prefixes must end in a `/`. + /// + /// Examples: + /// + /// * File: gs://bucket-name/filename.json + /// * Prefix: gs://bucket-name/prefix/here/ + /// * File: gs://bucket-name/prefix/here + /// + /// If multiple outputs, each response is still AnnotateFileResponse, each of + /// which contains some subset of the full list of AnnotateImageResponse. + /// Multiple outputs can happen if, for example, the output JSON is too large + /// and overflows into multiple sharded files. + pub uri: Option, +} + +impl Part for GcsDestination {} + + +/// Response message for the `ListProductsInProductSet` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations product sets products list projects](struct.ProjectLocationProductSetProductListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListProductsInProductSetResponse { + /// Token to retrieve the next page of results, or empty if there are no more + /// results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of Products. + pub products: Option>, +} + +impl ResponseResult for ListProductsInProductSetResponse {} + + +/// Detected entity location information. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LocationInfo { + /// lat/long location coordinates. + #[serde(rename="latLng")] + pub lat_lng: Option, +} + +impl Part for LocationInfo {} + + +/// Multiple async file annotation requests are batched into a single service +/// call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [async batch annotate files](struct.FileAsyncBatchAnnotateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AsyncBatchAnnotateFilesRequest { + /// Individual async file annotation requests for this batch. + pub requests: Option>, +} + +impl RequestValue for AsyncBatchAnnotateFilesRequest {} + + /// A `Property` consists of a user-supplied name/value pair. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1015,6 +1707,166 @@ pub struct Property { impl Part for Property {} +/// Set of dominant colors and their corresponding scores. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DominantColorsAnnotation { + /// RGB color values with their score and pixel fraction. + pub colors: Option>, +} + +impl Part for DominantColorsAnnotation {} + + +/// Client image to perform Google Cloud Vision API tasks over. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [annotate images](struct.ImageAnnotateCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Image { + /// Image content, represented as a stream of bytes. + /// Note: As with all `bytes` fields, protobuffers use a pure binary + /// representation, whereas JSON representations use base64. + pub content: Option, + /// Google Cloud Storage image location, or publicly-accessible image + /// URL. If both `content` and `source` are provided for an image, `content` + /// takes precedence and is used to perform the image annotation request. + pub source: Option, +} + +impl Resource for Image {} + + +/// Entity deduced from similar images on the Internet. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WebEntity { + /// Opaque entity ID. + #[serde(rename="entityId")] + pub entity_id: Option, + /// Overall relevancy score for the entity. + /// Not normalized and not comparable across different image queries. + pub score: Option, + /// Canonical description of the entity, in English. + pub description: Option, +} + +impl Part for WebEntity {} + + +/// A word representation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Word { + /// The bounding box for the word. + /// The vertices are in the order of top-left, top-right, bottom-right, + /// bottom-left. When a rotation of the bounding box is detected the rotation + /// is represented as around the top-left corner as defined when the text is + /// read in the 'natural' orientation. + /// For example: + /// * when the text is horizontal it might look like: + /// 0----1 + /// | | + /// 3----2 + /// * when it's rotated 180 degrees around the top-left corner it becomes: + /// 2----3 + /// | | + /// 1----0 + /// and the vertex order will still be (0, 1, 2, 3). + #[serde(rename="boundingBox")] + pub bounding_box: Option, + /// List of symbols in the word. + /// The order of the symbols follows the natural reading order. + pub symbols: Option>, + /// Confidence of the OCR results for the word. Range [0, 1]. + pub confidence: Option, + /// Additional information detected for the word. + pub property: Option, +} + +impl Part for Word {} + + +/// Response message for the `ListProducts` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations products list projects](struct.ProjectLocationProductListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListProductsResponse { + /// Token to retrieve the next page of results, or empty if there are no more + /// results in the list. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// List of products. + pub products: Option>, +} + +impl ResponseResult for ListProductsResponse {} + + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete operations](struct.OperationDeleteCall.html) (response) +/// * [locations product sets delete projects](struct.ProjectLocationProductSetDeleteCall.html) (response) +/// * [locations products delete projects](struct.ProjectLocationProductDeleteCall.html) (response) +/// * [cancel operations](struct.OperationCancelCall.html) (response) +/// * [locations products reference images delete projects](struct.ProjectLocationProductReferenceImageDeleteCall.html) (response) +/// * [locations product sets add product projects](struct.ProjectLocationProductSetAddProductCall.html) (response) +/// * [locations product sets remove product projects](struct.ProjectLocationProductSetRemoveProductCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty { _never_set: Option } + +impl ResponseResult for Empty {} + + +/// If an image was produced from a file (e.g. a PDF), this message gives +/// information about the source of that image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImageAnnotationContext { + /// If the file was a PDF or TIFF, this field gives the page number within + /// the file used to produce the image. + #[serde(rename="pageNumber")] + pub page_number: Option, + /// The URI of the file used to produce the image. + pub uri: Option, +} + +impl Part for ImageAnnotationContext {} + + /// A single symbol representation. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1049,23 +1901,6 @@ pub struct Symbol { impl Part for Symbol {} -/// Additional information detected on the structural component. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TextProperty { - /// Detected start or end of a text segment. - #[serde(rename="detectedBreak")] - pub detected_break: Option, - /// A list of detected languages together with confidence. - #[serde(rename="detectedLanguages")] - pub detected_languages: Option>, -} - -impl Part for TextProperty {} - - /// External image source (Google Cloud Storage or web URL image location). /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1104,64 +1939,6 @@ pub struct ImageSource { impl Part for ImageSource {} -/// TextAnnotation contains a structured representation of OCR extracted text. -/// The hierarchy of an OCR extracted text structure is like this: -/// TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol -/// Each structural component, starting from Page, may further have their own -/// properties. Properties describe detected languages, breaks etc.. Please refer -/// to the TextAnnotation.TextProperty message definition below for more -/// detail. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TextAnnotation { - /// UTF-8 text detected on the pages. - pub text: Option, - /// List of pages detected by OCR. - pub pages: Option>, -} - -impl Part for TextAnnotation {} - - -/// Detected language for a structural component. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DetectedLanguage { - /// The BCP-47 language code, such as "en-US" or "sr-Latn". For more - /// information, see - /// http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - #[serde(rename="languageCode")] - pub language_code: Option, - /// Confidence of detected language. Range [0, 1]. - pub confidence: Option, -} - -impl Part for DetectedLanguage {} - - -/// Parameters for crop hints annotation request. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CropHintsParams { - /// Aspect ratios in floats, representing the ratio of the width to the height - /// of the image. For example, if the desired aspect ratio is 4/3, the - /// corresponding float value should be 1.33333. If not specified, the - /// best possible crop is returned. The number of provided aspect ratios is - /// limited to a maximum of 16; any aspect ratios provided after the 16th are - /// ignored. - #[serde(rename="aspectRatios")] - pub aspect_ratios: Option>, -} - -impl Part for CropHintsParams {} - - /// A bounding polygon for the detected image annotation. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1184,12 +1961,12 @@ impl Part for BoundingPoly {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DetectedBreak { - /// Detected break type. - #[serde(rename="type")] - pub type_: Option, /// True if break prepends the element. #[serde(rename="isPrefix")] pub is_prefix: Option, + /// Detected break type. + #[serde(rename="type")] + pub type_: Option, } impl Part for DetectedBreak {} @@ -1216,34 +1993,147 @@ pub struct ListOperationsResponse { impl ResponseResult for ListOperationsResponse {} -/// A vertex represents a 2D point in the image. -/// NOTE: the normalized vertex coordinates are relative to the original image -/// and range from 0 to 1. +/// Results for a product search request. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NormalizedVertex { - /// Y coordinate. - pub y: Option, - /// X coordinate. - pub x: Option, +pub struct ProductSearchResults { + /// List of results grouped by products detected in the query image. Each entry + /// corresponds to one bounding polygon in the query image, and contains the + /// matching products specific to that region. There may be duplicate product + /// matches in the union of all the per-product results. + #[serde(rename="productGroupedResults")] + pub product_grouped_results: Option>, + /// List of results, one for each product match. + pub results: Option>, + /// Timestamp of the index which provided these results. Changes made after + /// this time are not reflected in the current results. + #[serde(rename="indexTime")] + pub index_time: Option, } -impl Part for NormalizedVertex {} +impl Part for ProductSearchResults {} -/// Set of dominant colors and their corresponding scores. +/// Single crop hint that is used to generate a new crop when serving an image. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DominantColorsAnnotation { - /// RGB color values with their score and pixel fraction. - pub colors: Option>, +pub struct CropHint { + /// Confidence of this being a salient region. Range [0, 1]. + pub confidence: Option, + /// The bounding polygon for the crop region. The coordinates of the bounding + /// box are in the original image's scale. + #[serde(rename="boundingPoly")] + pub bounding_poly: Option, + /// Fraction of importance of this salient region with respect to the original + /// image. + #[serde(rename="importanceFraction")] + pub importance_fraction: Option, } -impl Part for DominantColorsAnnotation {} +impl Part for CropHint {} + + +/// Image context and/or feature-specific parameters. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImageContext { + /// Not used. + #[serde(rename="latLongRect")] + pub lat_long_rect: Option, + /// List of languages to use for TEXT_DETECTION. In most cases, an empty value + /// yields the best results since it enables automatic language detection. For + /// languages based on the Latin alphabet, setting `language_hints` is not + /// needed. In rare cases, when the language of the text in the image is known, + /// setting a hint will help get better results (although it will be a + /// significant hindrance if the hint is wrong). Text detection returns an + /// error if one or more of the specified languages is not one of the + /// [supported languages](/vision/docs/languages). + #[serde(rename="languageHints")] + pub language_hints: Option>, + /// Parameters for product search. + #[serde(rename="productSearchParams")] + pub product_search_params: Option, + /// Parameters for crop hints annotation request. + #[serde(rename="cropHintsParams")] + pub crop_hints_params: Option, + /// Parameters for web detection. + #[serde(rename="webDetectionParams")] + pub web_detection_params: Option, +} + +impl Part for ImageContext {} + + +/// A `ReferenceImage` represents a product image and its associated metadata, +/// such as bounding boxes. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [locations products reference images get projects](struct.ProjectLocationProductReferenceImageGetCall.html) (response) +/// * [locations products reference images create projects](struct.ProjectLocationProductReferenceImageCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReferenceImage { + /// Bounding polygons around the areas of interest in the reference image. + /// Optional. If this field is empty, the system will try to detect regions of + /// interest. At most 10 bounding polygons will be used. + /// + /// The provided shape is converted into a non-rotated rectangle. Once + /// converted, the small edge of the rectangle must be greater than or equal + /// to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + /// is not). + #[serde(rename="boundingPolys")] + pub bounding_polys: Option>, + /// The resource name of the reference image. + /// + /// Format is: + /// + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + /// + /// This field is ignored when creating a reference image. + pub name: Option, + /// The Google Cloud Storage URI of the reference image. + /// + /// The URI must start with `gs://`. + /// + /// Required. + pub uri: Option, +} + +impl RequestValue for ReferenceImage {} +impl ResponseResult for ReferenceImage {} + + +/// Detected page from OCR. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Page { + /// Page width. For PDFs the unit is points. For images (including + /// TIFFs) the unit is pixels. + pub width: Option, + /// Confidence of the OCR results on the page. Range [0, 1]. + pub confidence: Option, + /// Additional information detected on the page. + pub property: Option, + /// List of blocks of text, images etc on this page. + pub blocks: Option>, + /// Page height. For PDFs the unit is points. For images (including + /// TIFFs) the unit is pixels. + pub height: Option, +} + +impl Part for Page {} /// Represents a color in the RGBA color space. This representation is designed @@ -1252,7 +2142,12 @@ impl Part for DominantColorsAnnotation {} /// can be trivially provided to the constructor of "java.awt.Color" in Java; it /// can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" /// method in iOS; and, with just a little work, it can be easily formatted into -/// a CSS "rgba()" string in JavaScript, as well. Here are some examples: +/// a CSS "rgba()" string in JavaScript, as well. +/// +/// Note: this proto does not carry information about the absolute color space +/// that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, +/// DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color +/// space. /// /// Example (Java): /// @@ -1388,374 +2283,17 @@ pub struct Color { impl Part for Color {} -/// An object representing a latitude/longitude pair. This is expressed as a pair -/// of doubles representing degrees latitude and degrees longitude. Unless -/// specified otherwise, this must conform to the -/// WGS84 -/// standard. Values must be within normalized ranges. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LatLng { - /// The latitude in degrees. It must be in the range [-90.0, +90.0]. - pub latitude: Option, - /// The longitude in degrees. It must be in the range [-180.0, +180.0]. - pub longitude: Option, -} - -impl Part for LatLng {} - - -/// Request for performing Google Cloud Vision API tasks over a user-provided -/// image, with user-requested features. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AnnotateImageRequest { - /// Additional context that may accompany the image. - #[serde(rename="imageContext")] - pub image_context: Option, - /// The image to be processed. - pub image: Option, - /// Requested features. - pub features: Option>, -} - -impl Part for AnnotateImageRequest {} - - -/// The type of Google Cloud Vision API detection to perform, and the maximum -/// number of results to return for that type. Multiple `Feature` objects can -/// be specified in the `features` list. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Feature { - /// Model to use for the feature. - /// Supported values: "builtin/stable" (the default if unset) and - /// "builtin/latest". - pub model: Option, - /// The feature type. - #[serde(rename="type")] - pub type_: Option, - /// Maximum number of results of this type. Does not apply to - /// `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. - #[serde(rename="maxResults")] - pub max_results: Option, -} - -impl Part for Feature {} - - -/// Single crop hint that is used to generate a new crop when serving an image. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CropHint { - /// Confidence of this being a salient region. Range [0, 1]. - pub confidence: Option, - /// Fraction of importance of this salient region with respect to the original - /// image. - #[serde(rename="importanceFraction")] - pub importance_fraction: Option, - /// The bounding polygon for the crop region. The coordinates of the bounding - /// box are in the original image's scale, as returned in `ImageParams`. - #[serde(rename="boundingPoly")] - pub bounding_poly: Option, -} - -impl Part for CropHint {} - - -/// Set of crop hints that are used to generate new crops when serving images. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CropHintsAnnotation { - /// Crop hint results. - #[serde(rename="cropHints")] - pub crop_hints: Option>, -} - -impl Part for CropHintsAnnotation {} - - -/// Set of detected entity features. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EntityAnnotation { - /// **Deprecated. Use `score` instead.** - /// The accuracy of the entity detection in an image. - /// For example, for an image in which the "Eiffel Tower" entity is detected, - /// this field represents the confidence that there is a tower in the query - /// image. Range [0, 1]. - pub confidence: Option, - /// Entity textual description, expressed in its `locale` language. - pub description: Option, - /// The language code for the locale in which the entity textual - /// `description` is expressed. - pub locale: Option, - /// The relevancy of the ICA (Image Content Annotation) label to the - /// image. For example, the relevancy of "tower" is likely higher to an image - /// containing the detected "Eiffel Tower" than to an image containing a - /// detected distant towering building, even though the confidence that - /// there is a tower in each image may be the same. Range [0, 1]. - pub topicality: Option, - /// Opaque entity ID. Some IDs may be available in - /// [Google Knowledge Graph Search - /// API](https://developers.google.com/knowledge-graph/). - pub mid: Option, - /// The location information for the detected entity. Multiple - /// `LocationInfo` elements can be present because one location may - /// indicate the location of the scene in the image, and another location - /// may indicate the location of the place where the image was taken. - /// Location information is usually present for landmarks. - pub locations: Option>, - /// Overall score of the result. Range [0, 1]. - pub score: Option, - /// Image region to which this entity belongs. Not produced - /// for `LABEL_DETECTION` features. - #[serde(rename="boundingPoly")] - pub bounding_poly: Option, - /// Some entities may have optional user-supplied `Property` (name/value) - /// fields, such a score or string that qualifies the entity. - pub properties: Option>, -} - -impl Part for EntityAnnotation {} - - -/// Parameters for web detection request. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WebDetectionParams { - /// Whether to include results derived from the geo information in the image. - #[serde(rename="includeGeoResults")] - pub include_geo_results: Option, -} - -impl Part for WebDetectionParams {} - - -/// Metadata for online images. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WebImage { - /// The result image URL. - pub url: Option, - /// (Deprecated) Overall relevancy score for the image. - pub score: Option, -} - -impl Part for WebImage {} - - -/// Image context and/or feature-specific parameters. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImageContext { - /// Not used. - #[serde(rename="latLongRect")] - pub lat_long_rect: Option, - /// List of languages to use for TEXT_DETECTION. In most cases, an empty value - /// yields the best results since it enables automatic language detection. For - /// languages based on the Latin alphabet, setting `language_hints` is not - /// needed. In rare cases, when the language of the text in the image is known, - /// setting a hint will help get better results (although it will be a - /// significant hindrance if the hint is wrong). Text detection returns an - /// error if one or more of the specified languages is not one of the - /// [supported languages](/vision/docs/languages). - #[serde(rename="languageHints")] - pub language_hints: Option>, - /// Parameters for crop hints annotation request. - #[serde(rename="cropHintsParams")] - pub crop_hints_params: Option, - /// Parameters for web detection. - #[serde(rename="webDetectionParams")] - pub web_detection_params: Option, -} - -impl Part for ImageContext {} - - -/// Metadata for web pages. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WebPage { - /// The result web page URL. - pub url: Option, - /// Title for the web page, may contain HTML markups. - #[serde(rename="pageTitle")] - pub page_title: Option, - /// (Deprecated) Overall relevancy score for the web page. - pub score: Option, - /// Partial matching images on the page. - /// Those images are similar enough to share some key-point features. For - /// example an original image will likely have partial matching for its - /// crops. - #[serde(rename="partialMatchingImages")] - pub partial_matching_images: Option>, - /// Fully matching images on the page. - /// Can include resized copies of the query image. - #[serde(rename="fullMatchingImages")] - pub full_matching_images: Option>, -} - -impl Part for WebPage {} - - -/// Set of features pertaining to the image, computed by computer vision -/// methods over safe-search verticals (for example, adult, spoof, medical, -/// violence). -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SafeSearchAnnotation { - /// Spoof likelihood. The likelihood that an modification - /// was made to the image's canonical version to make it appear - /// funny or offensive. - pub spoof: Option, - /// Likelihood that this image contains violent content. - pub violence: Option, - /// Likelihood that this is a medical image. - pub medical: Option, - /// Likelihood that the request image contains racy content. Racy content may - /// include (but is not limited to) skimpy or sheer clothing, strategically - /// covered nudity, lewd or provocative poses, or close-ups of sensitive - /// body areas. - pub racy: Option, - /// Represents the adult content likelihood for the image. Adult content may - /// contain elements such as nudity, pornographic images or cartoons, or - /// sexual activities. - pub adult: Option, -} - -impl Part for SafeSearchAnnotation {} - - -/// Response to a batch image annotation request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [annotate images](struct.ImageAnnotateCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchAnnotateImagesResponse { - /// Individual responses to image annotation requests within the batch. - pub responses: Option>, -} - -impl ResponseResult for BatchAnnotateImagesResponse {} - - -/// The request message for Operations.CancelOperation. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [cancel operations](struct.OperationCancelCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CancelOperationRequest { _never_set: Option } - -impl RequestValue for CancelOperationRequest {} - - -/// Color information consists of RGB channels, score, and the fraction of -/// the image that the color occupies in the image. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ColorInfo { - /// RGB components of the color. - pub color: Option, - /// The fraction of pixels the color occupies in the image. - /// Value in range [0, 1]. - #[serde(rename="pixelFraction")] - pub pixel_fraction: Option, - /// Image-specific score for this color. Value in range [0, 1]. - pub score: Option, -} - -impl Part for ColorInfo {} - - -/// Detected page from OCR. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Page { - /// Page width. For PDFs the unit is points. For images (including - /// TIFFs) the unit is pixels. - pub width: Option, - /// Confidence of the OCR results on the page. Range [0, 1]. - pub confidence: Option, - /// Additional information detected on the page. - pub property: Option, - /// List of blocks of text, images etc on this page. - pub blocks: Option>, - /// Page height. For PDFs the unit is points. For images (including - /// TIFFs) the unit is pixels. - pub height: Option, -} - -impl Part for Page {} - - -/// An offline file annotation request. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AsyncAnnotateFileRequest { - /// Additional context that may accompany the image(s) in the file. - #[serde(rename="imageContext")] - pub image_context: Option, - /// Required. The desired output location and metadata (e.g. format). - #[serde(rename="outputConfig")] - pub output_config: Option, - /// Required. Information about the input file. - #[serde(rename="inputConfig")] - pub input_config: Option, - /// Required. Requested features. - pub features: Option>, -} - -impl Part for AsyncAnnotateFileRequest {} - - /// A face annotation object contains the results of face detection. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FaceAnnotation { - /// Sorrow likelihood. - #[serde(rename="sorrowLikelihood")] - pub sorrow_likelihood: Option, + /// Yaw angle, which indicates the leftward/rightward angle that the face is + /// pointing relative to the vertical plane perpendicular to the image. Range + /// [-180,180]. + #[serde(rename="panAngle")] + pub pan_angle: Option, /// Under-exposed likelihood. #[serde(rename="underExposedLikelihood")] pub under_exposed_likelihood: Option, @@ -1770,9 +2308,9 @@ pub struct FaceAnnotation { pub joy_likelihood: Option, /// Detected face landmarks. pub landmarks: Option>, - /// Surprise likelihood. - #[serde(rename="surpriseLikelihood")] - pub surprise_likelihood: Option, + /// Sorrow likelihood. + #[serde(rename="sorrowLikelihood")] + pub sorrow_likelihood: Option, /// Blurred likelihood. #[serde(rename="blurredLikelihood")] pub blurred_likelihood: Option, @@ -1784,7 +2322,7 @@ pub struct FaceAnnotation { #[serde(rename="angerLikelihood")] pub anger_likelihood: Option, /// The bounding polygon around the face. The coordinates of the bounding box - /// are in the original image's scale, as returned in `ImageParams`. + /// are in the original image's scale. /// The bounding box is computed to "frame" the face in accordance with human /// expectations. It is based on the landmarker results. /// Note that one or more x and/or y coordinates may not be generated in the @@ -1797,14 +2335,12 @@ pub struct FaceAnnotation { /// the face. Range [-180,180]. #[serde(rename="rollAngle")] pub roll_angle: Option, - /// Yaw angle, which indicates the leftward/rightward angle that the face is - /// pointing relative to the vertical plane perpendicular to the image. Range - /// [-180,180]. - #[serde(rename="panAngle")] - pub pan_angle: Option, /// Headwear likelihood. #[serde(rename="headwearLikelihood")] pub headwear_likelihood: Option, + /// Surprise likelihood. + #[serde(rename="surpriseLikelihood")] + pub surprise_likelihood: Option, /// The `fd_bounding_poly` bounding polygon is tighter than the /// `boundingPoly`, and encloses only the skin part of the face. Typically, it /// is used to eliminate the face from any image analysis that detects the @@ -1818,59 +2354,37 @@ pub struct FaceAnnotation { impl Part for FaceAnnotation {} -/// Response to an image annotation request. +/// Relevant information for the image from the Internet. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AnnotateImageResponse { - /// If present, safe-search annotation has completed successfully. - #[serde(rename="safeSearchAnnotation")] - pub safe_search_annotation: Option, - /// If present, text (OCR) detection has completed successfully. - #[serde(rename="textAnnotations")] - pub text_annotations: Option>, - /// If present, web detection has completed successfully. - #[serde(rename="webDetection")] - pub web_detection: Option, - /// If present, localized object detection has completed successfully. - /// This will be sorted descending by confidence score. - #[serde(rename="localizedObjectAnnotations")] - pub localized_object_annotations: Option>, - /// If present, text (OCR) detection or document (OCR) text detection has - /// completed successfully. - /// This annotation provides the structural hierarchy for the OCR detected - /// text. - #[serde(rename="fullTextAnnotation")] - pub full_text_annotation: Option, - /// If present, label detection has completed successfully. - #[serde(rename="labelAnnotations")] - pub label_annotations: Option>, - /// If present, image properties were extracted successfully. - #[serde(rename="imagePropertiesAnnotation")] - pub image_properties_annotation: Option, - /// If present, face detection has completed successfully. - #[serde(rename="faceAnnotations")] - pub face_annotations: Option>, - /// If present, logo detection has completed successfully. - #[serde(rename="logoAnnotations")] - pub logo_annotations: Option>, - /// If present, landmark detection has completed successfully. - #[serde(rename="landmarkAnnotations")] - pub landmark_annotations: Option>, - /// If present, contextual information is needed to understand where this image - /// comes from. - pub context: Option, - /// If set, represents the error message for the operation. - /// Note that filled-in image annotations are guaranteed to be - /// correct, even when `error` is set. - pub error: Option, - /// If present, crop hints have completed successfully. - #[serde(rename="cropHintsAnnotation")] - pub crop_hints_annotation: Option, +pub struct WebDetection { + /// Web pages containing the matching images from the Internet. + #[serde(rename="pagesWithMatchingImages")] + pub pages_with_matching_images: Option>, + /// The visually similar image results. + #[serde(rename="visuallySimilarImages")] + pub visually_similar_images: Option>, + /// Partial matching images from the Internet. + /// Those images are similar enough to share some key-point features. For + /// example an original image will likely have partial matching for its crops. + #[serde(rename="partialMatchingImages")] + pub partial_matching_images: Option>, + /// Deduced entities from similar images on the Internet. + #[serde(rename="webEntities")] + pub web_entities: Option>, + /// Fully matching images from the Internet. + /// Can include resized copies of the query image. + #[serde(rename="fullMatchingImages")] + pub full_matching_images: Option>, + /// The service's best guess as to the topic of the request image. + /// Inferred from similar images on the open web. + #[serde(rename="bestGuessLabels")] + pub best_guess_labels: Option>, } -impl Part for AnnotateImageResponse {} +impl Part for WebDetection {} @@ -1966,6 +2480,25 @@ impl<'a, C, A> OperationMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// # Arguments + /// + /// * `name` - The name of the operation resource. + pub fn get(&self, name: &str) -> OperationGetCall<'a, C, A> { + OperationGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Starts asynchronous cancellation on a long-running operation. The server @@ -1993,20 +2526,65 @@ impl<'a, C, A> OperationMethods<'a, C, A> { _additional_params: Default::default(), } } +} + + + +/// A builder providing access to all methods supported on *file* resources. +/// It is not used directly, but through the `Vision` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_vision1 as vision1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use vision1::Vision; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// ::default(), None); +/// let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `async_batch_annotate(...)` +/// // to build up your call. +/// let rb = hub.files(); +/// # } +/// ``` +pub struct FileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, +} + +impl<'a, C, A> MethodsBuilder for FileMethods<'a, C, A> {} + +impl<'a, C, A> FileMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the latest state of a long-running operation. Clients can use this - /// method to poll the operation result at intervals as recommended by the API - /// service. + /// Run asynchronous image detection and annotation for a list of generic + /// files, such as PDF files, which may contain multiple pages and multiple + /// images per page. Progress and results can be retrieved through the + /// `google.longrunning.Operations` interface. + /// `Operation.metadata` contains `OperationMetadata` (metadata). + /// `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). /// /// # Arguments /// - /// * `name` - The name of the operation resource. - pub fn get(&self, name: &str) -> OperationGetCall<'a, C, A> { - OperationGetCall { + /// * `request` - No description provided. + pub fn async_batch_annotate(&self, request: AsyncBatchAnnotateFilesRequest) -> FileAsyncBatchAnnotateCall<'a, C, A> { + FileAsyncBatchAnnotateCall { hub: self.hub, - _name: name.to_string(), + _request: request, _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2136,7 +2714,7 @@ impl<'a, C, A> LocationMethods<'a, C, A> { -/// A builder providing access to all methods supported on *file* resources. +/// A builder providing access to all methods supported on *project* resources. /// It is not used directly, but through the `Vision` hub. /// /// # Example @@ -2160,37 +2738,515 @@ impl<'a, C, A> LocationMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `async_batch_annotate(...)` +/// // like `locations_product_sets_add_product(...)`, `locations_product_sets_create(...)`, `locations_product_sets_delete(...)`, `locations_product_sets_get(...)`, `locations_product_sets_import(...)`, `locations_product_sets_list(...)`, `locations_product_sets_patch(...)`, `locations_product_sets_products_list(...)`, `locations_product_sets_remove_product(...)`, `locations_products_create(...)`, `locations_products_delete(...)`, `locations_products_get(...)`, `locations_products_list(...)`, `locations_products_patch(...)`, `locations_products_reference_images_create(...)`, `locations_products_reference_images_delete(...)`, `locations_products_reference_images_get(...)` and `locations_products_reference_images_list(...)` /// // to build up your call. -/// let rb = hub.files(); +/// let rb = hub.projects(); /// # } /// ``` -pub struct FileMethods<'a, C, A> +pub struct ProjectMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a Vision, } -impl<'a, C, A> MethodsBuilder for FileMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} -impl<'a, C, A> FileMethods<'a, C, A> { +impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Run asynchronous image detection and annotation for a list of generic - /// files, such as PDF files, which may contain multiple pages and multiple - /// images per page. Progress and results can be retrieved through the - /// `google.longrunning.Operations` interface. - /// `Operation.metadata` contains `OperationMetadata` (metadata). - /// `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). + /// Gets information associated with a Product. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND if the Product does not exist. + /// + /// # Arguments + /// + /// * `name` - Resource name of the Product to get. + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + pub fn locations_products_get(&self, name: &str) -> ProjectLocationProductGetCall<'a, C, A> { + ProjectLocationProductGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Permanently deletes a product and its reference images. + /// + /// Metadata of the product and all its images will be deleted right away, but + /// search queries against ProductSets containing the product may still work + /// until all related caches are refreshed. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND if the product does not exist. + /// + /// # Arguments + /// + /// * `name` - Resource name of product to delete. + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + pub fn locations_products_delete(&self, name: &str) -> ProjectLocationProductDeleteCall<'a, C, A> { + ProjectLocationProductDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists the Products in a ProductSet, in an unspecified order. If the + /// ProductSet does not exist, the products field of the response will be + /// empty. + /// + /// Possible errors: + /// + /// * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + /// + /// # Arguments + /// + /// * `name` - The ProductSet resource for which to retrieve Products. + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + pub fn locations_product_sets_products_list(&self, name: &str) -> ProjectLocationProductSetProductListCall<'a, C, A> { + ProjectLocationProductSetProductListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Permanently deletes a ProductSet. Products and ReferenceImages in the + /// ProductSet are not deleted. + /// + /// The actual image files are not deleted from Google Cloud Storage. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND if the ProductSet does not exist. + /// + /// # Arguments + /// + /// * `name` - Resource name of the ProductSet to delete. + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + pub fn locations_product_sets_delete(&self, name: &str) -> ProjectLocationProductSetDeleteCall<'a, C, A> { + ProjectLocationProductSetDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Removes a Product from the specified ProductSet. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND If the Product is not found under the ProductSet. /// /// # Arguments /// /// * `request` - No description provided. - pub fn async_batch_annotate(&self, request: AsyncBatchAnnotateFilesRequest) -> FileAsyncBatchAnnotateCall<'a, C, A> { - FileAsyncBatchAnnotateCall { + /// * `name` - The resource name for the ProductSet to modify. + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + pub fn locations_product_sets_remove_product(&self, request: RemoveProductFromProductSetRequest, name: &str) -> ProjectLocationProductSetRemoveProductCall<'a, C, A> { + ProjectLocationProductSetRemoveProductCall { hub: self.hub, _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists products in an unspecified order. + /// + /// Possible errors: + /// + /// * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + /// + /// # Arguments + /// + /// * `parent` - The project OR ProductSet from which Products should be listed. + /// Format: + /// `projects/PROJECT_ID/locations/LOC_ID` + pub fn locations_products_list(&self, parent: &str) -> ProjectLocationProductListCall<'a, C, A> { + ProjectLocationProductListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates and returns a new product resource. + /// + /// Possible errors: + /// + /// * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 + /// characters. + /// * Returns INVALID_ARGUMENT if description is longer than 4096 characters. + /// * Returns INVALID_ARGUMENT if product_category is missing or invalid. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The project in which the Product should be created. + /// Format is + /// `projects/PROJECT_ID/locations/LOC_ID`. + pub fn locations_products_create(&self, request: Product, parent: &str) -> ProjectLocationProductCreateCall<'a, C, A> { + ProjectLocationProductCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _product_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information associated with a ProductSet. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND if the ProductSet does not exist. + /// + /// # Arguments + /// + /// * `name` - Resource name of the ProductSet to get. + /// Format is: + /// `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` + pub fn locations_product_sets_get(&self, name: &str) -> ProjectLocationProductSetGetCall<'a, C, A> { + ProjectLocationProductSetGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates and returns a new ProductSet resource. + /// + /// Possible errors: + /// + /// * Returns INVALID_ARGUMENT if display_name is missing, or is longer than + /// 4096 characters. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The project in which the ProductSet should be created. + /// Format is `projects/PROJECT_ID/locations/LOC_ID`. + pub fn locations_product_sets_create(&self, request: ProductSet, parent: &str) -> ProjectLocationProductSetCreateCall<'a, C, A> { + ProjectLocationProductSetCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _product_set_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Adds a Product to the specified ProductSet. If the Product is already + /// present, no change is made. + /// + /// One Product can be added to at most 100 ProductSets. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name for the ProductSet to modify. + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + pub fn locations_product_sets_add_product(&self, request: AddProductToProductSetRequest, name: &str) -> ProjectLocationProductSetAddProductCall<'a, C, A> { + ProjectLocationProductSetAddProductCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Asynchronous API that imports a list of reference images to specified + /// product sets based on a list of image information. + /// + /// The google.longrunning.Operation API can be used to keep track of the + /// progress and results of the request. + /// `Operation.metadata` contains `BatchOperationMetadata`. (progress) + /// `Operation.response` contains `ImportProductSetsResponse`. (results) + /// + /// The input source of this method is a csv file on Google Cloud Storage. + /// For the format of the csv file please see + /// ImportProductSetsGcsSource.csv_file_uri. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - The project in which the ProductSets should be imported. + /// Format is `projects/PROJECT_ID/locations/LOC_ID`. + pub fn locations_product_sets_import(&self, request: ImportProductSetsRequest, parent: &str) -> ProjectLocationProductSetImportCall<'a, C, A> { + ProjectLocationProductSetImportCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Makes changes to a Product resource. + /// Only the `display_name`, `description`, and `labels` fields can be updated + /// right now. + /// + /// If labels are updated, the change will not be reflected in queries until + /// the next index time. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND if the Product does not exist. + /// * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + /// missing from the request or longer than 4096 characters. + /// * Returns INVALID_ARGUMENT if description is present in update_mask but is + /// longer than 4096 characters. + /// * Returns INVALID_ARGUMENT if product_category is present in update_mask. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the product. + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + /// This field is ignored when creating a product. + pub fn locations_products_patch(&self, request: Product, name: &str) -> ProjectLocationProductPatchCall<'a, C, A> { + ProjectLocationProductPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Makes changes to a ProductSet resource. + /// Only display_name can be updated currently. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND if the ProductSet does not exist. + /// * Returns INVALID_ARGUMENT if display_name is present in update_mask but + /// missing from the request or longer than 4096 characters. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the ProductSet. + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + /// This field is ignored when creating a ProductSet. + pub fn locations_product_sets_patch(&self, request: ProductSet, name: &str) -> ProjectLocationProductSetPatchCall<'a, C, A> { + ProjectLocationProductSetPatchCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _update_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists ProductSets in an unspecified order. + /// + /// Possible errors: + /// + /// * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + /// than 1. + /// + /// # Arguments + /// + /// * `parent` - The project from which ProductSets should be listed. + /// Format is `projects/PROJECT_ID/locations/LOC_ID`. + pub fn locations_product_sets_list(&self, parent: &str) -> ProjectLocationProductSetListCall<'a, C, A> { + ProjectLocationProductSetListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates and returns a new ReferenceImage resource. + /// + /// The `bounding_poly` field is optional. If `bounding_poly` is not specified, + /// the system will try to detect regions of interest in the image that are + /// compatible with the product_category on the parent product. If it is + /// specified, detection is ALWAYS skipped. The system converts polygons into + /// non-rotated rectangles. + /// + /// Note that the pipeline will resize the image if the image resolution is too + /// large to process (above 50MP). + /// + /// Possible errors: + /// + /// * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 + /// characters. + /// * Returns INVALID_ARGUMENT if the product does not exist. + /// * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing + /// compatible with the parent product's product_category is detected. + /// * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `parent` - Resource name of the product in which to create the reference image. + /// Format is + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + pub fn locations_products_reference_images_create(&self, request: ReferenceImage, parent: &str) -> ProjectLocationProductReferenceImageCreateCall<'a, C, A> { + ProjectLocationProductReferenceImageCreateCall { + hub: self.hub, + _request: request, + _parent: parent.to_string(), + _reference_image_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Permanently deletes a reference image. + /// + /// The image metadata will be deleted right away, but search queries + /// against ProductSets containing the image may still work until all related + /// caches are refreshed. + /// + /// The actual image files are not deleted from Google Cloud Storage. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND if the reference image does not exist. + /// + /// # Arguments + /// + /// * `name` - The resource name of the reference image to delete. + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + pub fn locations_products_reference_images_delete(&self, name: &str) -> ProjectLocationProductReferenceImageDeleteCall<'a, C, A> { + ProjectLocationProductReferenceImageDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information associated with a ReferenceImage. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND if the specified image does not exist. + /// + /// # Arguments + /// + /// * `name` - The resource name of the ReferenceImage to get. + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + pub fn locations_products_reference_images_get(&self, name: &str) -> ProjectLocationProductReferenceImageGetCall<'a, C, A> { + ProjectLocationProductReferenceImageGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists reference images. + /// + /// Possible errors: + /// + /// * Returns NOT_FOUND if the parent product does not exist. + /// * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less + /// than 1. + /// + /// # Arguments + /// + /// * `parent` - Resource name of the product containing the reference images. + /// Format is + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + pub fn locations_products_reference_images_list(&self, parent: &str) -> ProjectLocationProductReferenceImageListCall<'a, C, A> { + ProjectLocationProductReferenceImageListCall { + hub: self.hub, + _parent: parent.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2316,7 +3372,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2332,10 +3388,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2355,7 +3408,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2454,7 +3507,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2591,7 +3644,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2607,10 +3660,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2630,7 +3680,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2708,7 +3758,7 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2756,6 +3806,256 @@ impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, } +/// Gets the latest state of a long-running operation. Clients can use this +/// method to poll the operation result at intervals as recommended by the API +/// service. +/// +/// A builder for the *get* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.operations().get("name") +/// .doit(); +/// # } +/// ``` +pub struct OperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {} + +impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The name of the operation resource. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + /// Starts asynchronous cancellation on a long-running operation. The server /// makes a best effort to cancel the operation, but success is not /// guaranteed. If the server doesn't support this method, it returns @@ -2858,7 +4158,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -2874,10 +4174,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2909,7 +4206,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2999,7 +4296,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3047,12 +4344,15 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } -/// Gets the latest state of a long-running operation. Clients can use this -/// method to poll the operation result at intervals as recommended by the API -/// service. +/// Run asynchronous image detection and annotation for a list of generic +/// files, such as PDF files, which may contain multiple pages and multiple +/// images per page. Progress and results can be retrieved through the +/// `google.longrunning.Operations` interface. +/// `Operation.metadata` contains `OperationMetadata` (metadata). +/// `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). /// -/// A builder for the *get* method supported by a *operation* resource. -/// It is not used directly, but through a `OperationMethods` instance. +/// A builder for the *asyncBatchAnnotate* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. /// /// # Example /// @@ -3063,6 +4363,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// # extern crate hyper_rustls; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_vision1 as vision1; +/// use vision1::AsyncBatchAnnotateFilesRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -3073,31 +4374,35 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AsyncBatchAnnotateFilesRequest::default(); +/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.operations().get("name") +/// let result = hub.files().async_batch_annotate(req) /// .doit(); /// # } /// ``` -pub struct OperationGetCall<'a, C, A> +pub struct FileAsyncBatchAnnotateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Vision, - _name: String, + _request: AsyncBatchAnnotateFilesRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for FileAsyncBatchAnnotateCall<'a, C, A> {} -impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> FileAsyncBatchAnnotateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -3105,11 +4410,10 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "vision.operations.get", - http_method: hyper::method::Method::Get }); + dlg.begin(MethodInfo { id: "vision.files.asyncBatchAnnotate", + http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { + for &field in ["alt"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -3121,41 +4425,25 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/{+name}"; + let mut url = self.hub._base_url.clone() + "v1/files:asyncBatchAnnotate"; if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); loop { @@ -3172,11 +4460,15 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } }; let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); dlg.pre_request(); req.send() @@ -3227,14 +4519,13 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } - /// The name of the operation resource. /// - /// Sets the *name* path property to the given value. + /// Sets the *request* property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { - self._name = new_value.to_string(); + pub fn request(mut self, new_value: AsyncBatchAnnotateFilesRequest) -> FileAsyncBatchAnnotateCall<'a, C, A> { + self._request = new_value; self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -3243,7 +4534,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> OperationGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FileAsyncBatchAnnotateCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -3252,7 +4543,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3268,7 +4559,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> FileAsyncBatchAnnotateCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -3288,7 +4579,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. - pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileAsyncBatchAnnotateCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { @@ -3382,10 +4673,7 @@ impl<'a, C, A> ImageAnnotateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3417,7 +4705,7 @@ impl<'a, C, A> ImageAnnotateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3497,7 +4785,7 @@ impl<'a, C, A> ImageAnnotateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3633,7 +4921,7 @@ impl<'a, C, A> LocationOperationGetCall<'a, C, A> where C: BorrowMut LocationOperationGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3672,7 +4957,7 @@ impl<'a, C, A> LocationOperationGetCall<'a, C, A> where C: BorrowMut LocationOperationGetCall<'a, C, A> where C: BorrowMut LocationOperationGetCall<'a, C, A> where C: BorrowMut LocationOperationGetCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_products_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Product)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.products.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name of the Product to get. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Permanently deletes a product and its reference images. +/// +/// Metadata of the product and all its images will be deleted right away, but +/// search queries against ProductSets containing the product may still work +/// until all related caches are refreshed. +/// +/// Possible errors: +/// +/// * Returns NOT_FOUND if the product does not exist. +/// +/// A builder for the *locations.products.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_products_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.products.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name of product to delete. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists the Products in a ProductSet, in an unspecified order. If the +/// ProductSet does not exist, the products field of the response will be +/// empty. +/// +/// Possible errors: +/// +/// * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. +/// +/// A builder for the *locations.productSets.products.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_product_sets_products_list("name") +/// .page_token("et") +/// .page_size(-17) +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductSetProductListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _name: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductSetProductListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductSetProductListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListProductsInProductSetResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.productSets.products.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}/products"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ProductSet resource for which to retrieve Products. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductSetProductListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The next_page_token returned from a previous List request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationProductSetProductListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of items to return. Default 10, maximum 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationProductSetProductListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductSetProductListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductSetProductListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductSetProductListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Permanently deletes a ProductSet. Products and ReferenceImages in the +/// ProductSet are not deleted. +/// +/// The actual image files are not deleted from Google Cloud Storage. +/// +/// Possible errors: +/// +/// * Returns NOT_FOUND if the ProductSet does not exist. +/// +/// A builder for the *locations.productSets.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_product_sets_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductSetDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductSetDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductSetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.productSets.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name of the ProductSet to delete. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductSetDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductSetDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductSetDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductSetDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Removes a Product from the specified ProductSet. +/// +/// Possible errors: +/// +/// * Returns NOT_FOUND If the Product is not found under the ProductSet. +/// +/// A builder for the *locations.productSets.removeProduct* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// use vision1::RemoveProductFromProductSetRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -3831,32 +6168,34 @@ impl<'a, C, A> LocationOperationGetCall<'a, C, A> where C: BorrowMut +pub struct ProjectLocationProductSetRemoveProductCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Vision, - _request: AsyncBatchAnnotateFilesRequest, + _request: RemoveProductFromProductSetRequest, + _name: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for FileAsyncBatchAnnotateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProjectLocationProductSetRemoveProductCall<'a, C, A> {} -impl<'a, C, A> FileAsyncBatchAnnotateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProjectLocationProductSetRemoveProductCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -3864,10 +6203,11 @@ impl<'a, C, A> FileAsyncBatchAnnotateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "vision.files.asyncBatchAnnotate", + dlg.begin(MethodInfo { id: "vision.projects.locations.productSets.removeProduct", http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -3879,16 +6219,37 @@ impl<'a, C, A> FileAsyncBatchAnnotateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3920,7 +6281,7 @@ impl<'a, C, A> FileAsyncBatchAnnotateCall<'a, C, A> where C: BorrowMut FileAsyncBatchAnnotateCall<'a, C, A> where C: BorrowMut FileAsyncBatchAnnotateCall<'a, C, A> { + pub fn request(mut self, new_value: RemoveProductFromProductSetRequest) -> ProjectLocationProductSetRemoveProductCall<'a, C, A> { self._request = new_value; self } + /// The resource name for the ProductSet to modify. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductSetRemoveProductCall<'a, C, A> { + self._name = new_value.to_string(); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut Delegate) -> FileAsyncBatchAnnotateCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductSetRemoveProductCall<'a, C, A> { self._delegate = Some(new_value); self } @@ -4000,7 +6374,7 @@ impl<'a, C, A> FileAsyncBatchAnnotateCall<'a, C, A> where C: BorrowMut FileAsyncBatchAnnotateCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> FileAsyncBatchAnnotateCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductSetRemoveProductCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -4036,7 +6410,3742 @@ impl<'a, C, A> FileAsyncBatchAnnotateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FileAsyncBatchAnnotateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductSetRemoveProductCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists products in an unspecified order. +/// +/// Possible errors: +/// +/// * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. +/// +/// A builder for the *locations.products.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_products_list("parent") +/// .page_token("et") +/// .page_size(-70) +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListProductsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.products.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/products"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The project OR ProductSet from which Products should be listed. + /// + /// Format: + /// `projects/PROJECT_ID/locations/LOC_ID` + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationProductListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The next_page_token returned from a previous List request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationProductListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of items to return. Default 10, maximum 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationProductListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates and returns a new product resource. +/// +/// Possible errors: +/// +/// * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 +/// characters. +/// * Returns INVALID_ARGUMENT if description is longer than 4096 characters. +/// * Returns INVALID_ARGUMENT if product_category is missing or invalid. +/// +/// A builder for the *locations.products.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// use vision1::Product; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Product::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_products_create(req, "parent") +/// .product_id("sea") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _request: Product, + _parent: String, + _product_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Product)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.products.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._product_id { + params.push(("productId", value.to_string())); + } + for &field in ["alt", "parent", "productId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/products"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Product) -> ProjectLocationProductCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The project in which the Product should be created. + /// + /// Format is + /// `projects/PROJECT_ID/locations/LOC_ID`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationProductCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A user-supplied resource id for this Product. If set, the server will + /// attempt to use this value as the resource id. If it is already in use, an + /// error is returned with code ALREADY_EXISTS. Must be at most 128 characters + /// long. It cannot contain the character `/`. + /// + /// Sets the *product id* query property to the given value. + pub fn product_id(mut self, new_value: &str) -> ProjectLocationProductCreateCall<'a, C, A> { + self._product_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information associated with a ProductSet. +/// +/// Possible errors: +/// +/// * Returns NOT_FOUND if the ProductSet does not exist. +/// +/// A builder for the *locations.productSets.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_product_sets_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductSetGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductSetGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductSetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ProductSet)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.productSets.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name of the ProductSet to get. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductSetGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductSetGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductSetGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductSetGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates and returns a new ProductSet resource. +/// +/// Possible errors: +/// +/// * Returns INVALID_ARGUMENT if display_name is missing, or is longer than +/// 4096 characters. +/// +/// A builder for the *locations.productSets.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// use vision1::ProductSet; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ProductSet::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_product_sets_create(req, "parent") +/// .product_set_id("erat") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductSetCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _request: ProductSet, + _parent: String, + _product_set_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductSetCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductSetCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ProductSet)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.productSets.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._product_set_id { + params.push(("productSetId", value.to_string())); + } + for &field in ["alt", "parent", "productSetId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/productSets"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ProductSet) -> ProjectLocationProductSetCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The project in which the ProductSet should be created. + /// + /// Format is `projects/PROJECT_ID/locations/LOC_ID`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationProductSetCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A user-supplied resource id for this ProductSet. If set, the server will + /// attempt to use this value as the resource id. If it is already in use, an + /// error is returned with code ALREADY_EXISTS. Must be at most 128 characters + /// long. It cannot contain the character `/`. + /// + /// Sets the *product set id* query property to the given value. + pub fn product_set_id(mut self, new_value: &str) -> ProjectLocationProductSetCreateCall<'a, C, A> { + self._product_set_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductSetCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductSetCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductSetCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Adds a Product to the specified ProductSet. If the Product is already +/// present, no change is made. +/// +/// One Product can be added to at most 100 ProductSets. +/// +/// Possible errors: +/// +/// * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. +/// +/// A builder for the *locations.productSets.addProduct* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// use vision1::AddProductToProductSetRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = AddProductToProductSetRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_product_sets_add_product(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductSetAddProductCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _request: AddProductToProductSetRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductSetAddProductCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductSetAddProductCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.productSets.addProduct", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}:addProduct"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: AddProductToProductSetRequest) -> ProjectLocationProductSetAddProductCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name for the ProductSet to modify. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductSetAddProductCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductSetAddProductCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductSetAddProductCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductSetAddProductCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Asynchronous API that imports a list of reference images to specified +/// product sets based on a list of image information. +/// +/// The google.longrunning.Operation API can be used to keep track of the +/// progress and results of the request. +/// `Operation.metadata` contains `BatchOperationMetadata`. (progress) +/// `Operation.response` contains `ImportProductSetsResponse`. (results) +/// +/// The input source of this method is a csv file on Google Cloud Storage. +/// For the format of the csv file please see +/// ImportProductSetsGcsSource.csv_file_uri. +/// +/// A builder for the *locations.productSets.import* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// use vision1::ImportProductSetsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ImportProductSetsRequest::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_product_sets_import(req, "parent") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductSetImportCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _request: ImportProductSetsRequest, + _parent: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductSetImportCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductSetImportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.productSets.import", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + for &field in ["alt", "parent"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/productSets:import"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ImportProductSetsRequest) -> ProjectLocationProductSetImportCall<'a, C, A> { + self._request = new_value; + self + } + /// The project in which the ProductSets should be imported. + /// + /// Format is `projects/PROJECT_ID/locations/LOC_ID`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationProductSetImportCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductSetImportCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductSetImportCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductSetImportCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Makes changes to a Product resource. +/// Only the `display_name`, `description`, and `labels` fields can be updated +/// right now. +/// +/// If labels are updated, the change will not be reflected in queries until +/// the next index time. +/// +/// Possible errors: +/// +/// * Returns NOT_FOUND if the Product does not exist. +/// * Returns INVALID_ARGUMENT if display_name is present in update_mask but is +/// missing from the request or longer than 4096 characters. +/// * Returns INVALID_ARGUMENT if description is present in update_mask but is +/// longer than 4096 characters. +/// * Returns INVALID_ARGUMENT if product_category is present in update_mask. +/// +/// A builder for the *locations.products.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// use vision1::Product; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = Product::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_products_patch(req, "name") +/// .update_mask("elitr") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _request: Product, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Product)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.products.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Product) -> ProjectLocationProductPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the product. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + /// + /// This field is ignored when creating a product. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The FieldMask that specifies which fields + /// to update. + /// If update_mask isn't specified, all mutable fields are to be updated. + /// Valid mask paths include `product_labels`, `display_name`, and + /// `description`. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectLocationProductPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Makes changes to a ProductSet resource. +/// Only display_name can be updated currently. +/// +/// Possible errors: +/// +/// * Returns NOT_FOUND if the ProductSet does not exist. +/// * Returns INVALID_ARGUMENT if display_name is present in update_mask but +/// missing from the request or longer than 4096 characters. +/// +/// A builder for the *locations.productSets.patch* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// use vision1::ProductSet; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ProductSet::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_product_sets_patch(req, "name") +/// .update_mask("no") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductSetPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _request: ProductSet, + _name: String, + _update_mask: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductSetPatchCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductSetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ProductSet)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.productSets.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + if let Some(value) = self._update_mask { + params.push(("updateMask", value.to_string())); + } + for &field in ["alt", "name", "updateMask"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ProductSet) -> ProjectLocationProductSetPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the ProductSet. + /// + /// Format is: + /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + /// + /// This field is ignored when creating a ProductSet. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductSetPatchCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The FieldMask that specifies which fields to + /// update. + /// If update_mask isn't specified, all mutable fields are to be updated. + /// Valid mask path is `display_name`. + /// + /// Sets the *update mask* query property to the given value. + pub fn update_mask(mut self, new_value: &str) -> ProjectLocationProductSetPatchCall<'a, C, A> { + self._update_mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductSetPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductSetPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductSetPatchCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists ProductSets in an unspecified order. +/// +/// Possible errors: +/// +/// * Returns INVALID_ARGUMENT if page_size is greater than 100, or less +/// than 1. +/// +/// A builder for the *locations.productSets.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_product_sets_list("parent") +/// .page_token("eirmod") +/// .page_size(-33) +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductSetListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductSetListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductSetListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListProductSetsResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.productSets.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/productSets"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The project from which ProductSets should be listed. + /// + /// Format is `projects/PROJECT_ID/locations/LOC_ID`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationProductSetListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// The next_page_token returned from a previous List request, if any. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationProductSetListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of items to return. Default 10, maximum 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationProductSetListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductSetListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductSetListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductSetListCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates and returns a new ReferenceImage resource. +/// +/// The `bounding_poly` field is optional. If `bounding_poly` is not specified, +/// the system will try to detect regions of interest in the image that are +/// compatible with the product_category on the parent product. If it is +/// specified, detection is ALWAYS skipped. The system converts polygons into +/// non-rotated rectangles. +/// +/// Note that the pipeline will resize the image if the image resolution is too +/// large to process (above 50MP). +/// +/// Possible errors: +/// +/// * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 +/// characters. +/// * Returns INVALID_ARGUMENT if the product does not exist. +/// * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing +/// compatible with the parent product's product_category is detected. +/// * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. +/// +/// A builder for the *locations.products.referenceImages.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// use vision1::ReferenceImage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // As the method needs a request, you would usually fill it with the desired information +/// // into the respective structure. Some of the parts shown here might not be applicable ! +/// // Values shown here are possibly random and not representative ! +/// let mut req = ReferenceImage::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_products_reference_images_create(req, "parent") +/// .reference_image_id("aliquyam") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductReferenceImageCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _request: ReferenceImage, + _parent: String, + _reference_image_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductReferenceImageCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductReferenceImageCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ReferenceImage)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.products.referenceImages.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._reference_image_id { + params.push(("referenceImageId", value.to_string())); + } + for &field in ["alt", "parent", "referenceImageId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/referenceImages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ReferenceImage) -> ProjectLocationProductReferenceImageCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Resource name of the product in which to create the reference image. + /// + /// Format is + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationProductReferenceImageCreateCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A user-supplied resource id for the ReferenceImage to be added. If set, + /// the server will attempt to use this value as the resource id. If it is + /// already in use, an error is returned with code ALREADY_EXISTS. Must be at + /// most 128 characters long. It cannot contain the character `/`. + /// + /// Sets the *reference image id* query property to the given value. + pub fn reference_image_id(mut self, new_value: &str) -> ProjectLocationProductReferenceImageCreateCall<'a, C, A> { + self._reference_image_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductReferenceImageCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductReferenceImageCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductReferenceImageCreateCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Permanently deletes a reference image. +/// +/// The image metadata will be deleted right away, but search queries +/// against ProductSets containing the image may still work until all related +/// caches are refreshed. +/// +/// The actual image files are not deleted from Google Cloud Storage. +/// +/// Possible errors: +/// +/// * Returns NOT_FOUND if the reference image does not exist. +/// +/// A builder for the *locations.products.referenceImages.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_products_reference_images_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductReferenceImageDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductReferenceImageDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductReferenceImageDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.products.referenceImages.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the reference image to delete. + /// + /// Format is: + /// + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductReferenceImageDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductReferenceImageDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductReferenceImageDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductReferenceImageDeleteCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Gets information associated with a ReferenceImage. +/// +/// Possible errors: +/// +/// * Returns NOT_FOUND if the specified image does not exist. +/// +/// A builder for the *locations.products.referenceImages.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_products_reference_images_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductReferenceImageGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductReferenceImageGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductReferenceImageGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ReferenceImage)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.products.referenceImages.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+name}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the ReferenceImage to get. + /// + /// Format is: + /// + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ProjectLocationProductReferenceImageGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductReferenceImageGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductReferenceImageGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductReferenceImageGetCall<'a, C, A> + where T: Into>, + S: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Lists reference images. +/// +/// Possible errors: +/// +/// * Returns NOT_FOUND if the parent product does not exist. +/// * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less +/// than 1. +/// +/// A builder for the *locations.products.referenceImages.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_vision1 as vision1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use vision1::Vision; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), +/// # ::default(), None); +/// # let mut hub = Vision::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `doit()`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.projects().locations_products_reference_images_list("parent") +/// .page_token("et") +/// .page_size(-70) +/// .doit(); +/// # } +/// ``` +pub struct ProjectLocationProductReferenceImageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Vision, + _parent: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLocationProductReferenceImageListCall<'a, C, A> {} + +impl<'a, C, A> ProjectLocationProductReferenceImageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListReferenceImagesResponse)> { + use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "vision.projects.locations.products.referenceImages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("parent", self._parent.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "parent", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "v1/{+parent}/referenceImages"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+parent}", "parent")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["parent"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = hyper::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(Bearer { token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Resource name of the product containing the reference images. + /// + /// Format is + /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + /// + /// Sets the *parent* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn parent(mut self, new_value: &str) -> ProjectLocationProductReferenceImageListCall<'a, C, A> { + self._parent = new_value.to_string(); + self + } + /// A token identifying a page of results to be returned. This is the value + /// of `nextPageToken` returned in a previous reference image list request. + /// + /// Defaults to the first page if not specified. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectLocationProductReferenceImageListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of items to return. Default 10, maximum 100. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectLocationProductReferenceImageListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProjectLocationProductReferenceImageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLocationProductReferenceImageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// If `None` is specified, then all scopes will be removed and no default scope will be used either. + /// In that case, you have to specify your API-key using the `key` parameter (see the `param()` + /// function for details). + /// + /// Usually there is more than one suitable scope to authorize an operation, some of which may + /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be + /// sufficient, a read-write scope will do as well. + pub fn add_scope(mut self, scope: T) -> ProjectLocationProductReferenceImageListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { diff --git a/gen/webfonts1/Cargo.toml b/gen/webfonts1/Cargo.toml index 34d1ec5171..d63dedda45 100644 --- a/gen/webfonts1/Cargo.toml +++ b/gen/webfonts1/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/webfonts1/src/lib.rs b/gen/webfonts1/src/lib.rs index ba01a4e77e..ed047a4975 100644 --- a/gen/webfonts1/src/lib.rs +++ b/gen/webfonts1/src/lib.rs @@ -544,17 +544,14 @@ impl<'a, C, A> WebfontListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -628,7 +625,7 @@ impl<'a, C, A> WebfontListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/webmasters3/Cargo.toml b/gen/webmasters3/Cargo.toml index fcd1eaf936..6471ee8260 100644 --- a/gen/webmasters3/Cargo.toml +++ b/gen/webmasters3/Cargo.toml @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/webmasters3/src/lib.rs b/gen/webmasters3/src/lib.rs index 567bede593..d754bdb8f6 100644 --- a/gen/webmasters3/src/lib.rs +++ b/gen/webmasters3/src/lib.rs @@ -1299,10 +1299,7 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1322,7 +1319,7 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1400,7 +1397,7 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1543,10 +1540,7 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1566,7 +1560,7 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1644,7 +1638,7 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1788,10 +1782,7 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1811,7 +1802,7 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1899,7 +1890,7 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2046,10 +2037,7 @@ impl<'a, C, A> SitemapListCall<'a, C, A> where C: BorrowMut, A: o } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2069,7 +2057,7 @@ impl<'a, C, A> SitemapListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2154,7 +2142,7 @@ impl<'a, C, A> SitemapListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2296,10 +2284,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2319,7 +2304,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2397,7 +2382,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2538,10 +2523,7 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2561,7 +2543,7 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2629,7 +2611,7 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2748,10 +2730,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2771,7 +2750,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2839,7 +2818,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2980,10 +2959,7 @@ impl<'a, C, A> SiteDeleteCall<'a, C, A> where C: BorrowMut, A: oa } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3003,7 +2979,7 @@ impl<'a, C, A> SiteDeleteCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3071,7 +3047,7 @@ impl<'a, C, A> SiteDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3222,10 +3198,7 @@ impl<'a, C, A> SearchanalyticQueryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3257,7 +3230,7 @@ impl<'a, C, A> SearchanalyticQueryCall<'a, C, A> where C: BorrowMut SearchanalyticQueryCall<'a, C, A> where C: BorrowMut UrlcrawlerrorscountQueryCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3527,7 +3497,7 @@ impl<'a, C, A> UrlcrawlerrorscountQueryCall<'a, C, A> where C: BorrowMut UrlcrawlerrorscountQueryCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -3797,7 +3764,7 @@ impl<'a, C, A> UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4074,7 +4038,7 @@ impl<'a, C, A> UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -4342,7 +4303,7 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -4440,7 +4401,7 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/youtube3-cli/Cargo.toml b/gen/youtube3-cli/Cargo.toml index fe3808c5ce..aee902b31c 100644 --- a/gen/youtube3-cli/Cargo.toml +++ b/gen/youtube3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtube3-cli" -version = "1.0.8+20180511" +version = "1.0.8+20190128" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtube3-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-youtube3] path = "../youtube3" -version = "1.0.8+20180511" +version = "1.0.8+20190128" diff --git a/gen/youtube3-cli/README.md b/gen/youtube3-cli/README.md index 8e7a482c6d..44a9968d62 100644 --- a/gen/youtube3-cli/README.md +++ b/gen/youtube3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *YouTube* API at revision *20180511*. The CLI is at version *1.0.8*. +This documentation was generated from the *YouTube* API at revision *20190128*. The CLI is at version *1.0.8*. ```bash youtube3 [options] diff --git a/gen/youtube3-cli/mkdocs.yml b/gen/youtube3-cli/mkdocs.yml index 450a30daef..e2a158ac2d 100644 --- a/gen/youtube3-cli/mkdocs.yml +++ b/gen/youtube3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube v1.0.8+20180511 +site_name: YouTube v1.0.8+20190128 site_url: http://byron.github.io/google-apis-rs/google-youtube3-cli site_description: A complete library to interact with YouTube (protocol v3) diff --git a/gen/youtube3-cli/src/main.rs b/gen/youtube3-cli/src/main.rs index 6535ecf97b..554659ef2c 100644 --- a/gen/youtube3-cli/src/main.rs +++ b/gen/youtube3-cli/src/main.rs @@ -1323,12 +1323,11 @@ impl<'n> Engine<'n> { "snippet.thumbnails.standard.height" => Some(("snippet.thumbnails.standard.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "audit-details.community-guidelines-good-standing" => Some(("auditDetails.communityGuidelinesGoodStanding", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "audit-details.content-id-claims-good-standing" => Some(("auditDetails.contentIdClaimsGoodStanding", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "audit-details.overall-good-standing" => Some(("auditDetails.overallGoodStanding", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "audit-details.copyright-strikes-good-standing" => Some(("auditDetails.copyrightStrikesGoodStanding", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["audit-details", "background-color", "background-image-url", "banner-external-url", "banner-image-url", "banner-mobile-extra-hd-image-url", "banner-mobile-hd-image-url", "banner-mobile-image-url", "banner-mobile-low-image-url", "banner-mobile-medium-hd-image-url", "banner-tablet-extra-hd-image-url", "banner-tablet-hd-image-url", "banner-tablet-image-url", "banner-tablet-low-image-url", "banner-tv-high-image-url", "banner-tv-image-url", "banner-tv-low-image-url", "banner-tv-medium-image-url", "branding-settings", "channel", "comment-count", "community-guidelines-good-standing", "content-details", "content-id-claims-good-standing", "content-owner", "content-owner-details", "copyright-strikes-good-standing", "corner-position", "country", "custom-url", "default", "default-language", "default-tab", "default-timing", "description", "duration-ms", "etag", "favorites", "featured-channels-title", "featured-channels-urls", "featured-playlist-id", "height", "hidden-subscriber-count", "high", "id", "image", "invideo-promotion", "is-linked", "keywords", "kind", "large-branded-banner-image-imap-script", "large-branded-banner-image-url", "likes", "localized", "long-uploads-status", "maxres", "medium", "moderate-comments", "offset-ms", "overall-good-standing", "position", "privacy-status", "profile-color", "published-at", "related-playlists", "show-browse-view", "show-related-channels", "small-branded-banner-image-imap-script", "small-branded-banner-image-url", "snippet", "standard", "statistics", "status", "subscriber-count", "text-color", "thumbnails", "time-linked", "title", "topic-categories", "topic-details", "topic-ids", "tracking-analytics-account-id", "tracking-image-url", "type", "unsubscribed-trailer", "uploads", "url", "use-smart-timing", "value", "video-count", "view-count", "watch", "watch-history", "watch-icon-image-url", "watch-later", "width"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["audit-details", "background-color", "background-image-url", "banner-external-url", "banner-image-url", "banner-mobile-extra-hd-image-url", "banner-mobile-hd-image-url", "banner-mobile-image-url", "banner-mobile-low-image-url", "banner-mobile-medium-hd-image-url", "banner-tablet-extra-hd-image-url", "banner-tablet-hd-image-url", "banner-tablet-image-url", "banner-tablet-low-image-url", "banner-tv-high-image-url", "banner-tv-image-url", "banner-tv-low-image-url", "banner-tv-medium-image-url", "branding-settings", "channel", "comment-count", "community-guidelines-good-standing", "content-details", "content-id-claims-good-standing", "content-owner", "content-owner-details", "copyright-strikes-good-standing", "corner-position", "country", "custom-url", "default", "default-language", "default-tab", "default-timing", "description", "duration-ms", "etag", "favorites", "featured-channels-title", "featured-channels-urls", "featured-playlist-id", "height", "hidden-subscriber-count", "high", "id", "image", "invideo-promotion", "is-linked", "keywords", "kind", "large-branded-banner-image-imap-script", "large-branded-banner-image-url", "likes", "localized", "long-uploads-status", "maxres", "medium", "moderate-comments", "offset-ms", "position", "privacy-status", "profile-color", "published-at", "related-playlists", "show-browse-view", "show-related-channels", "small-branded-banner-image-imap-script", "small-branded-banner-image-url", "snippet", "standard", "statistics", "status", "subscriber-count", "text-color", "thumbnails", "time-linked", "title", "topic-categories", "topic-details", "topic-ids", "tracking-analytics-account-id", "tracking-image-url", "type", "unsubscribed-trailer", "uploads", "url", "use-smart-timing", "value", "video-count", "view-count", "watch", "watch-history", "watch-icon-image-url", "watch-later", "width"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3092,6 +3091,13 @@ impl<'n> Engine<'n> { "snippet.fan-funding-event-details.amount-display-string" => Some(("snippet.fanFundingEventDetails.amountDisplayString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.fan-funding-event-details.user-comment" => Some(("snippet.fanFundingEventDetails.userComment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.fan-funding-event-details.amount-micros" => Some(("snippet.fanFundingEventDetails.amountMicros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.super-sticker-details.tier" => Some(("snippet.superStickerDetails.tier", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "snippet.super-sticker-details.currency" => Some(("snippet.superStickerDetails.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.super-sticker-details.amount-display-string" => Some(("snippet.superStickerDetails.amountDisplayString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.super-sticker-details.super-sticker-metadata.alt-text" => Some(("snippet.superStickerDetails.superStickerMetadata.altText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.super-sticker-details.super-sticker-metadata.alt-text-language" => Some(("snippet.superStickerDetails.superStickerMetadata.altTextLanguage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.super-sticker-details.super-sticker-metadata.sticker-id" => Some(("snippet.superStickerDetails.superStickerMetadata.stickerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.super-sticker-details.amount-micros" => Some(("snippet.superStickerDetails.amountMicros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.has-display-content" => Some(("snippet.hasDisplayContent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "snippet.published-at" => Some(("snippet.publishedAt", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.user-banned-details.ban-duration-seconds" => Some(("snippet.userBannedDetails.banDurationSeconds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3124,7 +3130,7 @@ impl<'n> Engine<'n> { "author-details.channel-url" => Some(("authorDetails.channelUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["amount-display-string", "amount-micros", "author-channel-id", "author-details", "ban-duration-seconds", "ban-type", "banned-user-details", "channel-id", "channel-url", "currency", "deleted-message-id", "display-message", "display-name", "etag", "fan-funding-event-details", "has-display-content", "id", "is-chat-moderator", "is-chat-owner", "is-chat-sponsor", "is-verified", "item-id", "kind", "live-chat-id", "message-deleted-details", "message-retracted-details", "message-text", "poll-closed-details", "poll-edited-details", "poll-id", "poll-opened-details", "poll-voted-details", "profile-image-url", "prompt", "published-at", "retracted-message-id", "snippet", "super-chat-details", "text-message-details", "tier", "type", "user-banned-details", "user-comment"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["alt-text", "alt-text-language", "amount-display-string", "amount-micros", "author-channel-id", "author-details", "ban-duration-seconds", "ban-type", "banned-user-details", "channel-id", "channel-url", "currency", "deleted-message-id", "display-message", "display-name", "etag", "fan-funding-event-details", "has-display-content", "id", "is-chat-moderator", "is-chat-owner", "is-chat-sponsor", "is-verified", "item-id", "kind", "live-chat-id", "message-deleted-details", "message-retracted-details", "message-text", "poll-closed-details", "poll-edited-details", "poll-id", "poll-opened-details", "poll-voted-details", "profile-image-url", "prompt", "published-at", "retracted-message-id", "snippet", "sticker-id", "super-chat-details", "super-sticker-details", "super-sticker-metadata", "text-message-details", "tier", "type", "user-banned-details", "user-comment"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -8389,7 +8395,7 @@ fn main() { let mut app = App::new("youtube3") .author("Sebastian Thiel ") - .version("1.0.8+20180511") + .version("1.0.8+20190128") .about("Supports core YouTube features, such as uploading videos, creating and managing playlists, searching for content, and much more.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_youtube3_cli") .arg(Arg::with_name("url") diff --git a/gen/youtube3/Cargo.toml b/gen/youtube3/Cargo.toml index c7cec628ae..ad3313800e 100644 --- a/gen/youtube3/Cargo.toml +++ b/gen/youtube3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-youtube3" -version = "1.0.8+20180511" +version = "1.0.8+20190128" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtube3" homepage = "https://developers.google.com/youtube/v3" -documentation = "https://docs.rs/google-youtube3/1.0.8+20180511" +documentation = "https://docs.rs/google-youtube3/1.0.8+20190128" license = "MIT" keywords = ["youtube", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/youtube3/README.md b/gen/youtube3/README.md index 5bdc9c566c..f706edd8bd 100644 --- a/gen/youtube3/README.md +++ b/gen/youtube3/README.md @@ -5,84 +5,84 @@ DO NOT EDIT ! --> The `google-youtube3` library allows access to all features of the *Google YouTube* service. -This documentation was generated from *YouTube* crate version *1.0.8+20180511*, where *20180511* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *YouTube* crate version *1.0.8+20190128*, where *20190128* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *YouTube* *v3* API can be found at the [official documentation site](https://developers.google.com/youtube/v3). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.YouTube.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.YouTube.html) ... -* [activities](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.Activity.html) - * [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ActivityInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ActivityListCall.html) -* [captions](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.Caption.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CaptionDeleteCall.html), [*download*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CaptionDownloadCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CaptionInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CaptionListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CaptionUpdateCall.html) +* [activities](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.Activity.html) + * [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ActivityInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ActivityListCall.html) +* [captions](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.Caption.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CaptionDeleteCall.html), [*download*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CaptionDownloadCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CaptionInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CaptionListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CaptionUpdateCall.html) * channel banners - * [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ChannelBannerInsertCall.html) -* [channel sections](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ChannelSection.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ChannelSectionDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ChannelSectionInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ChannelSectionListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ChannelSectionUpdateCall.html) -* [channels](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.Channel.html) - * [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ChannelListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ChannelUpdateCall.html) -* [comment threads](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CommentThread.html) - * [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CommentThreadInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CommentThreadListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CommentThreadUpdateCall.html) -* [comments](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.Comment.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CommentDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CommentInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CommentListCall.html), [*mark as spam*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CommentMarkAsSpamCall.html), [*set moderation status*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CommentSetModerationStatuCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CommentUpdateCall.html) -* [guide categories](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.GuideCategory.html) - * [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.GuideCategoryListCall.html) -* [i18n languages](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.I18nLanguage.html) - * [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.I18nLanguageListCall.html) -* [i18n regions](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.I18nRegion.html) - * [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.I18nRegionListCall.html) -* [live broadcasts](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveBroadcast.html) - * [*bind*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveBroadcastBindCall.html), [*control*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveBroadcastControlCall.html), [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveBroadcastDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveBroadcastInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveBroadcastListCall.html), [*transition*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveBroadcastTransitionCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveBroadcastUpdateCall.html) -* [live chat bans](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatBan.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatBanDeleteCall.html) and [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatBanInsertCall.html) -* [live chat messages](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatMessage.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatMessageDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatMessageInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatMessageListCall.html) -* [live chat moderators](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatModerator.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatModeratorDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatModeratorInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveChatModeratorListCall.html) -* [live streams](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveStream.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveStreamDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveStreamInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveStreamListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.LiveStreamUpdateCall.html) -* [playlist items](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.PlaylistItem.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.PlaylistItemDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.PlaylistItemInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.PlaylistItemListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.PlaylistItemUpdateCall.html) -* [playlists](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.Playlist.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.PlaylistDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.PlaylistInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.PlaylistListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.PlaylistUpdateCall.html) + * [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ChannelBannerInsertCall.html) +* [channel sections](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ChannelSection.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ChannelSectionDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ChannelSectionInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ChannelSectionListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ChannelSectionUpdateCall.html) +* [channels](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.Channel.html) + * [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ChannelListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ChannelUpdateCall.html) +* [comment threads](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CommentThread.html) + * [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CommentThreadInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CommentThreadListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CommentThreadUpdateCall.html) +* [comments](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.Comment.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CommentDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CommentInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CommentListCall.html), [*mark as spam*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CommentMarkAsSpamCall.html), [*set moderation status*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CommentSetModerationStatuCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CommentUpdateCall.html) +* [guide categories](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.GuideCategory.html) + * [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.GuideCategoryListCall.html) +* [i18n languages](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.I18nLanguage.html) + * [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.I18nLanguageListCall.html) +* [i18n regions](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.I18nRegion.html) + * [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.I18nRegionListCall.html) +* [live broadcasts](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveBroadcast.html) + * [*bind*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveBroadcastBindCall.html), [*control*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveBroadcastControlCall.html), [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveBroadcastDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveBroadcastInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveBroadcastListCall.html), [*transition*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveBroadcastTransitionCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveBroadcastUpdateCall.html) +* [live chat bans](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatBan.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatBanDeleteCall.html) and [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatBanInsertCall.html) +* [live chat messages](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatMessage.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatMessageDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatMessageInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatMessageListCall.html) +* [live chat moderators](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatModerator.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatModeratorDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatModeratorInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveChatModeratorListCall.html) +* [live streams](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveStream.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveStreamDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveStreamInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveStreamListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.LiveStreamUpdateCall.html) +* [playlist items](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.PlaylistItem.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.PlaylistItemDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.PlaylistItemInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.PlaylistItemListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.PlaylistItemUpdateCall.html) +* [playlists](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.Playlist.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.PlaylistDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.PlaylistInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.PlaylistListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.PlaylistUpdateCall.html) * search - * [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.SearchListCall.html) -* [sponsors](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.Sponsor.html) - * [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.SponsorListCall.html) -* [subscriptions](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.Subscription.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.SubscriptionDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.SubscriptionInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.SubscriptionListCall.html) -* [super chat events](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.SuperChatEvent.html) - * [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.SuperChatEventListCall.html) -* [thumbnails](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.Thumbnail.html) - * [*set*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ThumbnailSetCall.html) -* [video abuse report reasons](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoAbuseReportReason.html) - * [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoAbuseReportReasonListCall.html) -* [video categories](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoCategory.html) - * [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoCategoryListCall.html) -* [videos](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.Video.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoDeleteCall.html), [*get rating*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoGetRatingCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoListCall.html), [*rate*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoRateCall.html), [*report abuse*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoReportAbuseCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoUpdateCall.html) + * [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.SearchListCall.html) +* [sponsors](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.Sponsor.html) + * [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.SponsorListCall.html) +* [subscriptions](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.Subscription.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.SubscriptionDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.SubscriptionInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.SubscriptionListCall.html) +* [super chat events](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.SuperChatEvent.html) + * [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.SuperChatEventListCall.html) +* [thumbnails](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.Thumbnail.html) + * [*set*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ThumbnailSetCall.html) +* [video abuse report reasons](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoAbuseReportReason.html) + * [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoAbuseReportReasonListCall.html) +* [video categories](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoCategory.html) + * [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoCategoryListCall.html) +* [videos](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.Video.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoDeleteCall.html), [*get rating*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoGetRatingCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoListCall.html), [*rate*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoRateCall.html), [*report abuse*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoReportAbuseCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoUpdateCall.html) * watermarks - * [*set*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.WatermarkSetCall.html) and [*unset*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.WatermarkUnsetCall.html) + * [*set*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.WatermarkSetCall.html) and [*unset*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.WatermarkUnsetCall.html) Upload supported by ... -* [*set thumbnails*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ThumbnailSetCall.html) -* [*insert captions*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CaptionInsertCall.html) -* [*insert videos*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.VideoInsertCall.html) -* [*set watermarks*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.WatermarkSetCall.html) -* [*insert channel banners*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.ChannelBannerInsertCall.html) -* [*update captions*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CaptionUpdateCall.html) +* [*set thumbnails*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ThumbnailSetCall.html) +* [*insert captions*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CaptionInsertCall.html) +* [*insert videos*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.VideoInsertCall.html) +* [*set watermarks*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.WatermarkSetCall.html) +* [*insert channel banners*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.ChannelBannerInsertCall.html) +* [*update captions*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CaptionUpdateCall.html) Download supported by ... -* [*download captions*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.CaptionDownloadCall.html) +* [*download captions*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.CaptionDownloadCall.html) Subscription supported by ... -* [*list playlist items*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.PlaylistItemListCall.html) +* [*list playlist items*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.PlaylistItemListCall.html) @@ -90,17 +90,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/struct.YouTube.html)** +* **[Hub](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/struct.YouTube.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.Part.html)** + * **[Parts](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -209,17 +209,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -229,29 +229,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-youtube3/1.0.8+20180511/google_youtube3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-youtube3/1.0.8+20190128/google_youtube3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/youtube3/src/lib.rs b/gen/youtube3/src/lib.rs index 48a23d7ede..8588428f9b 100644 --- a/gen/youtube3/src/lib.rs +++ b/gen/youtube3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *YouTube* crate version *1.0.8+20180511*, where *20180511* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *YouTube* crate version *1.0.8+20190128*, where *20190128* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *YouTube* *v3* API can be found at the //! [official documentation site](https://developers.google.com/youtube/v3). @@ -319,7 +319,7 @@ pub enum Scope { /// Manage your YouTube account Full, - /// Manage your YouTube account + /// See, edit, and permanently delete your YouTube videos, ratings, comments and captions ForceSsl, /// View and manage your assets and associated content on YouTube @@ -690,18 +690,15 @@ impl Part for PlaylistSnippet {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ChannelAuditDetails { - /// Whether or not the channel has any copyright strikes. - #[serde(rename="copyrightStrikesGoodStanding")] - pub copyright_strikes_good_standing: Option, /// Whether or not the channel respects the community guidelines. #[serde(rename="communityGuidelinesGoodStanding")] pub community_guidelines_good_standing: Option, /// Whether or not the channel has any unresolved claims. #[serde(rename="contentIdClaimsGoodStanding")] pub content_id_claims_good_standing: Option, - /// Describes the general state of the channel. This field will always show if there are any issues whatsoever with the channel. Currently this field represents the result of the logical and operation over the community guidelines good standing, the copyright strikes good standing and the content ID claims good standing, but this may change in the future. - #[serde(rename="overallGoodStanding")] - pub overall_good_standing: Option, + /// Whether or not the channel has any copyright strikes. + #[serde(rename="copyrightStrikesGoodStanding")] + pub copyright_strikes_good_standing: Option, } impl Part for ChannelAuditDetails {} @@ -1127,7 +1124,7 @@ impl Part for LiveChatTextMessageDetails {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LiveChatSuperChatDetails { - /// The tier in which the amount belongs to. Lower amounts belong to lower tiers. Starts at 1. + /// The tier in which the amount belongs. Lower amounts belong to lower tiers. The lowest tier is 1. pub tier: Option, /// The currency in which the purchase was made. pub currency: Option, @@ -1409,6 +1406,9 @@ pub struct SuperChatEventSnippet { /// The text contents of the comment left by the user. #[serde(rename="commentText")] pub comment_text: Option, + /// If this event is a Super Sticker event, this field will contain metadata about the Super Sticker. + #[serde(rename="superStickerMetadata")] + pub super_sticker_metadata: Option, /// Channel id where the event occurred. #[serde(rename="channelId")] pub channel_id: Option, @@ -1418,9 +1418,9 @@ pub struct SuperChatEventSnippet { /// The tier for the paid message, which is based on the amount of money spent to purchase the message. #[serde(rename="messageType")] pub message_type: Option, - /// The purchase amount, in micros of the purchase currency. e.g., 1 is represented as 1000000. - #[serde(rename="amountMicros")] - pub amount_micros: Option, + /// True if this event is a Super Sticker event. + #[serde(rename="isSuperStickerEvent")] + pub is_super_sticker_event: Option, /// The currency in which the purchase was made. ISO 4217. pub currency: Option, /// Details about the supporter. @@ -1431,6 +1431,9 @@ pub struct SuperChatEventSnippet { pub display_string: Option, /// If this event is a Super Chat for Good purchase, this field will contain information about the charity the purchase is donated to. pub nonprofit: Option, + /// The purchase amount, in micros of the purchase currency. e.g., 1 is represented as 1000000. + #[serde(rename="amountMicros")] + pub amount_micros: Option, /// The date and time when the event occurred. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. #[serde(rename="createdAt")] pub created_at: Option, @@ -1878,6 +1881,9 @@ pub struct LiveChatMessageSnippet { /// no description provided #[serde(rename="messageRetractedDetails")] pub message_retracted_details: Option, + /// no description provided + #[serde(rename="messageDeletedDetails")] + pub message_deleted_details: Option, /// Whether the message has display content that should be displayed to users. #[serde(rename="hasDisplayContent")] pub has_display_content: Option, @@ -1911,9 +1917,9 @@ pub struct LiveChatMessageSnippet { /// The ID of the user that authored this message, this field is not always filled. textMessageEvent - the user that wrote the message fanFundingEvent - the user that funded the broadcast newSponsorEvent - the user that just became a sponsor messageDeletedEvent - the moderator that took the action messageRetractedEvent - the author that retracted their message userBannedEvent - the moderator that took the action superChatEvent - the user that made the purchase #[serde(rename="authorChannelId")] pub author_channel_id: Option, - /// no description provided - #[serde(rename="messageDeletedDetails")] - pub message_deleted_details: Option, + /// Details about the Super Sticker event, this is only set if the type is 'superStickerEvent'. + #[serde(rename="superStickerDetails")] + pub super_sticker_details: Option, /// no description provided #[serde(rename="pollOpenedDetails")] pub poll_opened_details: Option, @@ -4163,18 +4169,28 @@ pub struct ChannelSectionSnippet { impl Part for ChannelSectionSnippet {} -/// Details about the content of a channel. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ChannelContentDetails { - /// no description provided - #[serde(rename="relatedPlaylists")] - pub related_playlists: Option, +pub struct LiveChatSuperStickerDetails { + /// The tier in which the amount belongs. Lower amounts belong to lower tiers. The lowest tier is 1. + pub tier: Option, + /// The currency in which the purchase was made. + pub currency: Option, + /// A rendered string that displays the fund amount and currency to the user. + #[serde(rename="amountDisplayString")] + pub amount_display_string: Option, + /// Information about the Super Sticker. + #[serde(rename="superStickerMetadata")] + pub super_sticker_metadata: Option, + /// The amount purchased by the user, in micros (1,750,000 micros = 1.75). + #[serde(rename="amountMicros")] + pub amount_micros: Option, } -impl Part for ChannelContentDetails {} +impl Part for LiveChatSuperStickerDetails {} /// Stub token pagination template to suppress results. @@ -4508,6 +4524,10 @@ pub struct ChannelSnippet { /// Localized title and description, read-only. pub localized: Option, /// A map of thumbnail images associated with the channel. For each object in the map, the key is the name of the thumbnail image, and the value is an object that contains other information about the thumbnail. + /// + /// When displaying thumbnails in your application, make sure that your code uses the image URLs exactly as they are returned in API responses. For example, your application should not use the http domain instead of the https domain in a URL returned in an API response. + /// + /// Beginning in July 2018, channel thumbnail URLs will only be available in the https domain, which is how the URLs appear in API responses. After that time, you might see broken images in your application if it tries to load YouTube images from the http domain. pub thumbnails: Option, } @@ -4877,6 +4897,26 @@ impl ToParts for SponsorListResponse { } } +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SuperStickerMetadata { + /// Internationalized alt text that describes the sticker image and any animation associated with it. + #[serde(rename="altText")] + pub alt_text: Option, + /// Specifies the localization language in which the alt text is returned. + #[serde(rename="altTextLanguage")] + pub alt_text_language: Option, + /// Unique identifier of the Super Sticker. This is a shorter form of the alt_text that includes pack name and a recognizable characteristic of the sticker. + #[serde(rename="stickerId")] + pub sticker_id: Option, +} + +impl Part for SuperStickerMetadata {} + + /// Project specific details about the content of a YouTube Video. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -5557,6 +5597,20 @@ pub struct PlaylistLocalization { impl Part for PlaylistLocalization {} +/// Details about the content of a channel. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChannelContentDetails { + /// no description provided + #[serde(rename="relatedPlaylists")] + pub related_playlists: Option, +} + +impl Part for ChannelContentDetails {} + + /// An i18nLanguage resource identifies a UI language currently supported by YouTube. /// /// # Activities @@ -8674,10 +8728,7 @@ impl<'a, C, A> ChannelSectionListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -8697,7 +8748,7 @@ impl<'a, C, A> ChannelSectionListCall<'a, C, A> where C: BorrowMut ChannelSectionListCall<'a, C, A> where C: BorrowMut ChannelSectionInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9013,7 +9061,7 @@ impl<'a, C, A> ChannelSectionInsertCall<'a, C, A> where C: BorrowMut ChannelSectionInsertCall<'a, C, A> where C: BorrowMut ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -9286,7 +9331,7 @@ impl<'a, C, A> ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9551,7 +9593,7 @@ impl<'a, C, A> ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut PlaylistInsertCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -9841,7 +9880,7 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9954,7 +9993,7 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10115,10 +10154,7 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10138,7 +10174,7 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10280,7 +10316,7 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10405,10 +10441,7 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -10428,7 +10461,7 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10505,7 +10538,7 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10641,10 +10674,7 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10676,7 +10706,7 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10780,7 +10810,7 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -10910,10 +10940,7 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -10945,7 +10972,7 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11024,7 +11051,7 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11205,10 +11232,7 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11228,7 +11252,7 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11400,7 +11424,7 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11522,10 +11546,7 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11545,7 +11566,7 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11623,7 +11644,7 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11749,10 +11770,7 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -11772,7 +11790,7 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11859,7 +11877,7 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -11984,10 +12002,7 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12007,7 +12022,7 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12084,7 +12099,7 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12220,10 +12235,7 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12255,7 +12267,7 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12361,7 +12373,7 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12527,10 +12539,7 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -12591,7 +12600,7 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -12802,7 +12811,7 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -12963,10 +12972,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -12986,7 +12992,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13122,7 +13128,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13255,10 +13261,7 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13290,7 +13293,7 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13383,7 +13386,7 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13544,10 +13547,7 @@ impl<'a, C, A> LiveStreamUpdateCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -13579,7 +13579,7 @@ impl<'a, C, A> LiveStreamUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -13710,7 +13710,7 @@ impl<'a, C, A> LiveStreamUpdateCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -13840,10 +13840,7 @@ impl<'a, C, A> LiveStreamDeleteCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -13863,7 +13860,7 @@ impl<'a, C, A> LiveStreamDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13951,7 +13948,7 @@ impl<'a, C, A> LiveStreamDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14119,10 +14116,7 @@ impl<'a, C, A> LiveStreamListCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -14142,7 +14136,7 @@ impl<'a, C, A> LiveStreamListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14275,7 +14269,7 @@ impl<'a, C, A> LiveStreamListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14436,10 +14430,7 @@ impl<'a, C, A> LiveStreamInsertCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14471,7 +14462,7 @@ impl<'a, C, A> LiveStreamInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14600,7 +14591,7 @@ impl<'a, C, A> LiveStreamInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -14736,10 +14727,7 @@ impl<'a, C, A> ChannelUpdateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -14771,7 +14759,7 @@ impl<'a, C, A> ChannelUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -14875,7 +14863,7 @@ impl<'a, C, A> ChannelUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15046,10 +15034,7 @@ impl<'a, C, A> ChannelListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15069,7 +15054,7 @@ impl<'a, C, A> ChannelListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15223,7 +15208,7 @@ impl<'a, C, A> ChannelListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15365,10 +15350,7 @@ impl<'a, C, A> WatermarkSetCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15429,7 +15411,7 @@ impl<'a, C, A> WatermarkSetCall<'a, C, A> where C: BorrowMut, A: _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -15593,7 +15575,7 @@ impl<'a, C, A> WatermarkSetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15718,10 +15700,7 @@ impl<'a, C, A> WatermarkUnsetCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -15741,7 +15720,7 @@ impl<'a, C, A> WatermarkUnsetCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -15818,7 +15797,7 @@ impl<'a, C, A> WatermarkUnsetCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -15949,10 +15928,7 @@ impl<'a, C, A> LiveChatModeratorInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -15984,7 +15960,7 @@ impl<'a, C, A> LiveChatModeratorInsertCall<'a, C, A> where C: BorrowMut LiveChatModeratorInsertCall<'a, C, A> where C: BorrowMut LiveChatModeratorListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16248,7 +16221,7 @@ impl<'a, C, A> LiveChatModeratorListCall<'a, C, A> where C: BorrowMut LiveChatModeratorListCall<'a, C, A> where C: BorrowMut LiveChatModeratorDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16498,7 +16468,7 @@ impl<'a, C, A> LiveChatModeratorDeleteCall<'a, C, A> where C: BorrowMut LiveChatModeratorDeleteCall<'a, C, A> where C: BorrowMut CaptionDeleteCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -16719,7 +16686,7 @@ impl<'a, C, A> CaptionDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16803,7 +16770,7 @@ impl<'a, C, A> CaptionDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -16959,10 +16926,7 @@ impl<'a, C, A> CaptionInsertCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -17023,7 +16987,7 @@ impl<'a, C, A> CaptionInsertCall<'a, C, A> where C: BorrowMut, A: _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -17216,7 +17180,7 @@ impl<'a, C, A> CaptionInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17380,10 +17344,7 @@ impl<'a, C, A> CaptionDownloadCall<'a, C, A> where C: BorrowMut, } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17403,7 +17364,7 @@ impl<'a, C, A> CaptionDownloadCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17501,7 +17462,7 @@ impl<'a, C, A> CaptionDownloadCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17653,10 +17614,7 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -17676,7 +17634,7 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17792,7 +17750,7 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -17948,10 +17906,7 @@ impl<'a, C, A> CaptionUpdateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -18012,7 +17967,7 @@ impl<'a, C, A> CaptionUpdateCall<'a, C, A> where C: BorrowMut, A: _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -18205,7 +18160,7 @@ impl<'a, C, A> CaptionUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18331,10 +18286,7 @@ impl<'a, C, A> I18nLanguageListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18354,7 +18306,7 @@ impl<'a, C, A> I18nLanguageListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18439,7 +18391,7 @@ impl<'a, C, A> I18nLanguageListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18575,10 +18527,7 @@ impl<'a, C, A> GuideCategoryListCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18598,7 +18547,7 @@ impl<'a, C, A> GuideCategoryListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18697,7 +18646,7 @@ impl<'a, C, A> GuideCategoryListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -18868,10 +18817,7 @@ impl<'a, C, A> CommentThreadListCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -18891,7 +18837,7 @@ impl<'a, C, A> CommentThreadListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19049,7 +18995,7 @@ impl<'a, C, A> CommentThreadListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19180,10 +19126,7 @@ impl<'a, C, A> CommentThreadUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19215,7 +19158,7 @@ impl<'a, C, A> CommentThreadUpdateCall<'a, C, A> where C: BorrowMut CommentThreadUpdateCall<'a, C, A> where C: BorrowMut CommentThreadInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19474,7 +19414,7 @@ impl<'a, C, A> CommentThreadInsertCall<'a, C, A> where C: BorrowMut CommentThreadInsertCall<'a, C, A> where C: BorrowMut CommentInsertCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -19733,7 +19670,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -19826,7 +19763,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -19946,10 +19883,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -19969,7 +19903,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20037,7 +19971,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20183,10 +20117,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20206,7 +20137,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20325,7 +20256,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20452,10 +20383,7 @@ impl<'a, C, A> CommentSetModerationStatuCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20475,7 +20403,7 @@ impl<'a, C, A> CommentSetModerationStatuCall<'a, C, A> where C: BorrowMut CommentSetModerationStatuCall<'a, C, A> where C: BorrowMut CommentUpdateCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -20728,7 +20653,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20821,7 +20746,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -20941,10 +20866,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -20964,7 +20886,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21032,7 +20954,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21168,10 +21090,7 @@ impl<'a, C, A> PlaylistItemInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21203,7 +21122,7 @@ impl<'a, C, A> PlaylistItemInsertCall<'a, C, A> where C: BorrowMut PlaylistItemInsertCall<'a, C, A> where C: BorrowMut PlaylistItemDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21453,7 +21369,7 @@ impl<'a, C, A> PlaylistItemDeleteCall<'a, C, A> where C: BorrowMut PlaylistItemDeleteCall<'a, C, A> where C: BorrowMut PlaylistItemListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -21704,7 +21617,7 @@ impl<'a, C, A> PlaylistItemListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21828,7 +21741,7 @@ impl<'a, C, A> PlaylistItemListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -21964,10 +21877,7 @@ impl<'a, C, A> PlaylistItemUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -21999,7 +21909,7 @@ impl<'a, C, A> PlaylistItemUpdateCall<'a, C, A> where C: BorrowMut PlaylistItemUpdateCall<'a, C, A> where C: BorrowMut LiveChatMessageListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22284,7 +22191,7 @@ impl<'a, C, A> LiveChatMessageListCall<'a, C, A> where C: BorrowMut LiveChatMessageListCall<'a, C, A> where C: BorrowMut LiveChatMessageDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -22550,7 +22454,7 @@ impl<'a, C, A> LiveChatMessageDeleteCall<'a, C, A> where C: BorrowMut LiveChatMessageDeleteCall<'a, C, A> where C: BorrowMut LiveChatMessageInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -22784,7 +22685,7 @@ impl<'a, C, A> LiveChatMessageInsertCall<'a, C, A> where C: BorrowMut LiveChatMessageInsertCall<'a, C, A> where C: BorrowMut VideoCategoryListCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23036,7 +22934,7 @@ impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23135,7 +23033,7 @@ impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23261,10 +23159,7 @@ impl<'a, C, A> I18nRegionListCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23284,7 +23179,7 @@ impl<'a, C, A> I18nRegionListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23369,7 +23264,7 @@ impl<'a, C, A> I18nRegionListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -23500,10 +23395,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -23535,7 +23427,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -23771,7 +23660,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionListCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24038,7 +23924,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24201,7 +24087,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24332,10 +24218,7 @@ impl<'a, C, A> LiveChatBanInsertCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -24367,7 +24250,7 @@ impl<'a, C, A> LiveChatBanInsertCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -24460,7 +24343,7 @@ impl<'a, C, A> LiveChatBanInsertCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24580,10 +24463,7 @@ impl<'a, C, A> LiveChatBanDeleteCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24603,7 +24483,7 @@ impl<'a, C, A> LiveChatBanDeleteCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24671,7 +24551,7 @@ impl<'a, C, A> LiveChatBanDeleteCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -24822,10 +24702,7 @@ impl<'a, C, A> SponsorListCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -24845,7 +24722,7 @@ impl<'a, C, A> SponsorListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24949,7 +24826,7 @@ impl<'a, C, A> SponsorListCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -25090,10 +24967,7 @@ impl<'a, C, A> VideoAbuseReportReasonListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25113,7 +24987,7 @@ impl<'a, C, A> VideoAbuseReportReasonListCall<'a, C, A> where C: BorrowMut VideoAbuseReportReasonListCall<'a, C, A> where C: BorrowMut LiveBroadcastControlCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -25390,7 +25261,7 @@ impl<'a, C, A> LiveBroadcastControlCall<'a, C, A> where C: BorrowMut LiveBroadcastControlCall<'a, C, A> where C: BorrowMut LiveBroadcastUpdateCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -25726,7 +25594,7 @@ impl<'a, C, A> LiveBroadcastUpdateCall<'a, C, A> where C: BorrowMut LiveBroadcastUpdateCall<'a, C, A> where C: BorrowMut LiveBroadcastTransitionCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26031,7 +25896,7 @@ impl<'a, C, A> LiveBroadcastTransitionCall<'a, C, A> where C: BorrowMut LiveBroadcastTransitionCall<'a, C, A> where C: BorrowMut LiveBroadcastInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -26352,7 +26214,7 @@ impl<'a, C, A> LiveBroadcastInsertCall<'a, C, A> where C: BorrowMut LiveBroadcastInsertCall<'a, C, A> where C: BorrowMut LiveBroadcastDeleteCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26634,7 +26493,7 @@ impl<'a, C, A> LiveBroadcastDeleteCall<'a, C, A> where C: BorrowMut LiveBroadcastDeleteCall<'a, C, A> where C: BorrowMut LiveBroadcastListCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -26923,7 +26779,7 @@ impl<'a, C, A> LiveBroadcastListCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -27070,7 +26926,7 @@ impl<'a, C, A> LiveBroadcastListCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27224,10 +27080,7 @@ impl<'a, C, A> LiveBroadcastBindCall<'a, C, A> where C: BorrowMut } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -27247,7 +27100,7 @@ impl<'a, C, A> LiveBroadcastBindCall<'a, C, A> where C: BorrowMut let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -27369,7 +27222,7 @@ impl<'a, C, A> LiveBroadcastBindCall<'a, C, A> where C: BorrowMut /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -27519,10 +27372,7 @@ impl<'a, C, A> ChannelBannerInsertCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -27583,7 +27433,7 @@ impl<'a, C, A> ChannelBannerInsertCall<'a, C, A> where C: BorrowMut (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -27754,7 +27604,7 @@ impl<'a, C, A> ChannelBannerInsertCall<'a, C, A> where C: BorrowMut SearchListCall<'a, C, A> where C: BorrowMut, A: oa } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28048,7 +27895,7 @@ impl<'a, C, A> SearchListCall<'a, C, A> where C: BorrowMut, A: oa let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -28350,7 +28197,7 @@ impl<'a, C, A> SearchListCall<'a, C, A> where C: BorrowMut, A: oa /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -28501,10 +28348,7 @@ impl<'a, C, A> SuperChatEventListCall<'a, C, A> where C: BorrowMut 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -28524,7 +28368,7 @@ impl<'a, C, A> SuperChatEventListCall<'a, C, A> where C: BorrowMut SuperChatEventListCall<'a, C, A> where C: BorrowMut ThumbnailSetCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut should_ask_dlg_for_url = false; @@ -28802,7 +28643,7 @@ impl<'a, C, A> ThumbnailSetCall<'a, C, A> where C: BorrowMut, A: }) } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -28975,7 +28816,7 @@ impl<'a, C, A> ThumbnailSetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/youtubeanalytics1-cli/Cargo.toml b/gen/youtubeanalytics1-cli/Cargo.toml index ceae993a3c..852e71bf4e 100644 --- a/gen/youtubeanalytics1-cli/Cargo.toml +++ b/gen/youtubeanalytics1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtubeanalytics1-cli" -version = "1.0.8+20181010" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube Analytics (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtubeanalytics1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-youtubeanalytics1] path = "../youtubeanalytics1" -version = "1.0.8+20181010" +version = "1.0.8+20190403" diff --git a/gen/youtubeanalytics1-cli/README.md b/gen/youtubeanalytics1-cli/README.md index 820a83560c..12a39150cd 100644 --- a/gen/youtubeanalytics1-cli/README.md +++ b/gen/youtubeanalytics1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *YouTube Analytics* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *YouTube Analytics* API at revision *20190403*. The CLI is at version *1.0.8*. ```bash youtubeanalytics1 [options] diff --git a/gen/youtubeanalytics1-cli/mkdocs.yml b/gen/youtubeanalytics1-cli/mkdocs.yml index cd3348f1d3..3530caff99 100644 --- a/gen/youtubeanalytics1-cli/mkdocs.yml +++ b/gen/youtubeanalytics1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube Analytics v1.0.8+20181010 +site_name: YouTube Analytics v1.0.8+20190403 site_url: http://byron.github.io/google-apis-rs/google-youtubeanalytics1-cli site_description: A complete library to interact with YouTube Analytics (protocol v1) diff --git a/gen/youtubeanalytics1-cli/src/main.rs b/gen/youtubeanalytics1-cli/src/main.rs index f8723ad6a5..2c03dd8476 100644 --- a/gen/youtubeanalytics1-cli/src/main.rs +++ b/gen/youtubeanalytics1-cli/src/main.rs @@ -947,7 +947,7 @@ fn main() { let mut app = App::new("youtubeanalytics1") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190403") .about("Retrieves your YouTube Analytics data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli") .arg(Arg::with_name("url") diff --git a/gen/youtubeanalytics1/Cargo.toml b/gen/youtubeanalytics1/Cargo.toml index a1a453f56f..f87ce5f4a2 100644 --- a/gen/youtubeanalytics1/Cargo.toml +++ b/gen/youtubeanalytics1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-youtubeanalytics1" -version = "1.0.8+20181010" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube Analytics (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtubeanalytics1" homepage = "http://developers.google.com/youtube/analytics/" -documentation = "https://docs.rs/google-youtubeanalytics1/1.0.8+20181010" +documentation = "https://docs.rs/google-youtubeanalytics1/1.0.8+20190403" license = "MIT" keywords = ["youtubeAnalytics", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/youtubeanalytics1/README.md b/gen/youtubeanalytics1/README.md index 725cf11db0..5535efefae 100644 --- a/gen/youtubeanalytics1/README.md +++ b/gen/youtubeanalytics1/README.md @@ -5,20 +5,20 @@ DO NOT EDIT ! --> The `google-youtubeanalytics1` library allows access to all features of the *Google YouTube Analytics* service. -This documentation was generated from *YouTube Analytics* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *YouTube Analytics* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *YouTube Analytics* *v1* API can be found at the [official documentation site](http://developers.google.com/youtube/analytics/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.YouTubeAnalytics.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.YouTubeAnalytics.html) ... -* [group items](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.GroupItem.html) - * [*delete*](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.GroupItemDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.GroupItemInsertCall.html) and [*list*](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.GroupItemListCall.html) -* [groups](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.Group.html) - * [*delete*](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.GroupDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.GroupListCall.html) and [*update*](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.GroupUpdateCall.html) +* [group items](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.GroupItem.html) + * [*delete*](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.GroupItemDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.GroupItemInsertCall.html) and [*list*](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.GroupItemListCall.html) +* [groups](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.Group.html) + * [*delete*](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.GroupDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.GroupListCall.html) and [*update*](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.GroupUpdateCall.html) * reports - * [*query*](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.ReportQueryCall.html) + * [*query*](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.ReportQueryCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/struct.YouTubeAnalytics.html)** +* **[Hub](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/struct.YouTubeAnalytics.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.Part.html)** + * **[Parts](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -135,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -155,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-youtubeanalytics1/1.0.8+20181010/google_youtubeanalytics1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-youtubeanalytics1/1.0.8+20190403/google_youtubeanalytics1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/youtubeanalytics1/src/lib.rs b/gen/youtubeanalytics1/src/lib.rs index 7bf5159ced..c3e5aa9110 100644 --- a/gen/youtubeanalytics1/src/lib.rs +++ b/gen/youtubeanalytics1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *YouTube Analytics* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *YouTube Analytics* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *YouTube Analytics* *v1* API can be found at the //! [official documentation site](http://developers.google.com/youtube/analytics/). @@ -1010,10 +1010,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1033,7 +1030,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1192,7 +1189,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1323,10 +1320,7 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1358,7 +1352,7 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1447,7 +1441,7 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1573,10 +1567,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1596,7 +1587,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1683,7 +1674,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1808,10 +1799,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1831,7 +1819,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1908,7 +1896,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2033,10 +2021,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2056,7 +2041,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2133,7 +2118,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2264,10 +2249,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2299,7 +2281,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2388,7 +2370,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2527,10 +2509,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2550,7 +2529,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2648,7 +2627,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2779,10 +2758,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2814,7 +2790,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2903,7 +2879,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/youtubeanalytics2-cli/Cargo.toml b/gen/youtubeanalytics2-cli/Cargo.toml index d0dbae2337..badba46aa6 100644 --- a/gen/youtubeanalytics2-cli/Cargo.toml +++ b/gen/youtubeanalytics2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtubeanalytics2-cli" -version = "1.0.8+20181010" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube Analytics (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtubeanalytics2-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-youtubeanalytics2] path = "../youtubeanalytics2" -version = "1.0.8+20181010" +version = "1.0.8+20190403" diff --git a/gen/youtubeanalytics2-cli/README.md b/gen/youtubeanalytics2-cli/README.md index 5d9cfa8f43..3145fd5fd1 100644 --- a/gen/youtubeanalytics2-cli/README.md +++ b/gen/youtubeanalytics2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *YouTube Analytics* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *YouTube Analytics* API at revision *20190403*. The CLI is at version *1.0.8*. ```bash youtubeanalytics2 [options] diff --git a/gen/youtubeanalytics2-cli/mkdocs.yml b/gen/youtubeanalytics2-cli/mkdocs.yml index af6fdca2e9..a92b566c1e 100644 --- a/gen/youtubeanalytics2-cli/mkdocs.yml +++ b/gen/youtubeanalytics2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube Analytics v1.0.8+20181010 +site_name: YouTube Analytics v1.0.8+20190403 site_url: http://byron.github.io/google-apis-rs/google-youtubeanalytics2-cli site_description: A complete library to interact with YouTube Analytics (protocol v2) diff --git a/gen/youtubeanalytics2-cli/src/main.rs b/gen/youtubeanalytics2-cli/src/main.rs index 6c6e9f78f7..4a20a1951e 100644 --- a/gen/youtubeanalytics2-cli/src/main.rs +++ b/gen/youtubeanalytics2-cli/src/main.rs @@ -963,7 +963,7 @@ fn main() { let mut app = App::new("youtubeanalytics2") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190403") .about("Retrieves your YouTube Analytics data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_youtubeanalytics2_cli") .arg(Arg::with_name("url") diff --git a/gen/youtubeanalytics2/Cargo.toml b/gen/youtubeanalytics2/Cargo.toml index 92677341a0..83aa6eb11a 100644 --- a/gen/youtubeanalytics2/Cargo.toml +++ b/gen/youtubeanalytics2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-youtubeanalytics2" -version = "1.0.8+20181010" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube Analytics (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtubeanalytics2" homepage = "https://developers.google.com/youtube/analytics" -documentation = "https://docs.rs/google-youtubeanalytics2/1.0.8+20181010" +documentation = "https://docs.rs/google-youtubeanalytics2/1.0.8+20190403" license = "MIT" keywords = ["youtubeAnalytics", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/youtubeanalytics2/README.md b/gen/youtubeanalytics2/README.md index 9d30769c32..069963ea24 100644 --- a/gen/youtubeanalytics2/README.md +++ b/gen/youtubeanalytics2/README.md @@ -5,20 +5,20 @@ DO NOT EDIT ! --> The `google-youtubeanalytics2` library allows access to all features of the *Google YouTube Analytics* service. -This documentation was generated from *YouTube Analytics* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *youtubeAnalytics:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *YouTube Analytics* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *youtubeAnalytics:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *YouTube Analytics* *v2* API can be found at the [official documentation site](https://developers.google.com/youtube/analytics). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.YouTubeAnalytics.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.YouTubeAnalytics.html) ... -* [group items](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.GroupItem.html) - * [*delete*](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.GroupItemDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.GroupItemInsertCall.html) and [*list*](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.GroupItemListCall.html) -* [groups](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.Group.html) - * [*delete*](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.GroupDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.GroupListCall.html) and [*update*](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.GroupUpdateCall.html) +* [group items](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.GroupItem.html) + * [*delete*](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.GroupItemDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.GroupItemInsertCall.html) and [*list*](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.GroupItemListCall.html) +* [groups](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.Group.html) + * [*delete*](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.GroupDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.GroupListCall.html) and [*update*](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.GroupUpdateCall.html) * reports - * [*query*](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.ReportQueryCall.html) + * [*query*](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.ReportQueryCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/struct.YouTubeAnalytics.html)** +* **[Hub](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/struct.YouTubeAnalytics.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.Part.html)** + * **[Parts](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -135,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -155,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-youtubeanalytics2/1.0.8+20181010/google_youtubeanalytics2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-youtubeanalytics2/1.0.8+20190403/google_youtubeanalytics2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/youtubeanalytics2/src/lib.rs b/gen/youtubeanalytics2/src/lib.rs index d94260a450..bc47d7a77c 100644 --- a/gen/youtubeanalytics2/src/lib.rs +++ b/gen/youtubeanalytics2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *YouTube Analytics* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *youtubeAnalytics:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *YouTube Analytics* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *youtubeAnalytics:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *YouTube Analytics* *v2* API can be found at the //! [official documentation site](https://developers.google.com/youtube/analytics). @@ -395,23 +395,28 @@ impl<'a, C, A> YouTubeAnalytics // ############ // SCHEMAS ### // ########## -/// The description of a column of the result table. +/// Request Error information. +/// +/// The presence of an error field signals that the operation +/// has failed. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResultTableColumnHeader { - /// The type of the data in the column (`STRING`, `INTEGER`, `FLOAT`, etc.). - #[serde(rename="dataType")] - pub data_type: Option, - /// The type of the column (`DIMENSION` or `METRIC`). - #[serde(rename="columnType")] - pub column_type: Option, - /// The name of the dimension or metric. - pub name: Option, +pub struct Errors { + /// Global error code. Deprecated and ignored. + /// Set custom error codes in ErrorProto.domain and ErrorProto.code + /// instead. + pub code: Option, + /// Request identifier generated by the service, which can be + /// used to identify the error in the logs + #[serde(rename="requestId")] + pub request_id: Option, + /// Specific error description and codes + pub error: Option>, } -impl Part for ResultTableColumnHeader {} +impl Part for Errors {} /// A group. @@ -565,37 +570,32 @@ pub struct ListGroupsResponse { /// Identifies the API resource's type. The value will be /// `youtube#groupListResponse`. pub kind: Option, - /// The Etag of this resource. - pub etag: Option, /// Apiary error details pub errors: Option, + /// The Etag of this resource. + pub etag: Option, } impl ResponseResult for ListGroupsResponse {} -/// Request Error information. -/// -/// The presence of an error field signals that the operation -/// has failed. +/// The description of a column of the result table. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Errors { - /// Global error code. Deprecated and ignored. - /// Set custom error codes in ErrorProto.domain and ErrorProto.code - /// instead. - pub code: Option, - /// Request identifier generated by the service, which can be - /// used to identify the error in the logs - #[serde(rename="requestId")] - pub request_id: Option, - /// Specific error description and codes - pub error: Option>, +pub struct ResultTableColumnHeader { + /// The type of the data in the column (`STRING`, `INTEGER`, `FLOAT`, etc.). + #[serde(rename="dataType")] + pub data_type: Option, + /// The type of the column (`DIMENSION` or `METRIC`). + #[serde(rename="columnType")] + pub column_type: Option, + /// The name of the dimension or metric. + pub name: Option, } -impl Part for Errors {} +impl Part for ResultTableColumnHeader {} /// A group snippet. @@ -740,10 +740,10 @@ pub struct ListGroupItemsResponse { /// Identifies the API resource's type. The value will be /// `youtube#groupItemListResponse`. pub kind: Option, - /// The Etag of this resource. - pub etag: Option, /// Apiary error details pub errors: Option, + /// The Etag of this resource. + pub etag: Option, } impl ResponseResult for ListGroupItemsResponse {} @@ -1153,10 +1153,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1176,7 +1173,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1367,7 +1364,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1502,10 +1499,7 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -1537,7 +1531,7 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -1634,7 +1628,7 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1767,10 +1761,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1790,7 +1781,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1883,7 +1874,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2016,10 +2007,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2039,7 +2027,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2132,7 +2120,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2265,10 +2253,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2288,7 +2273,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2381,7 +2366,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2516,10 +2501,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -2551,7 +2533,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -2648,7 +2630,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2793,10 +2775,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2816,7 +2795,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2932,7 +2911,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3067,10 +3046,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3102,7 +3078,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3199,7 +3175,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters diff --git a/gen/youtubereporting1-cli/Cargo.toml b/gen/youtubereporting1-cli/Cargo.toml index a58d5ebc55..9c2b6b5944 100644 --- a/gen/youtubereporting1-cli/Cargo.toml +++ b/gen/youtubereporting1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtubereporting1-cli" -version = "1.0.8+20181010" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube Reporting (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtubereporting1-cli" @@ -39,4 +39,4 @@ clap = "^2.0" [dependencies.google-youtubereporting1] path = "../youtubereporting1" -version = "1.0.8+20181010" +version = "1.0.8+20190403" diff --git a/gen/youtubereporting1-cli/README.md b/gen/youtubereporting1-cli/README.md index 1695476521..2013d48a97 100644 --- a/gen/youtubereporting1-cli/README.md +++ b/gen/youtubereporting1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *YouTube Reporting* API at revision *20181010*. The CLI is at version *1.0.8*. +This documentation was generated from the *YouTube Reporting* API at revision *20190403*. The CLI is at version *1.0.8*. ```bash youtubereporting1 [options] diff --git a/gen/youtubereporting1-cli/mkdocs.yml b/gen/youtubereporting1-cli/mkdocs.yml index b9c41e772e..7df146b3a5 100644 --- a/gen/youtubereporting1-cli/mkdocs.yml +++ b/gen/youtubereporting1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube Reporting v1.0.8+20181010 +site_name: YouTube Reporting v1.0.8+20190403 site_url: http://byron.github.io/google-apis-rs/google-youtubereporting1-cli site_description: A complete library to interact with YouTube Reporting (protocol v1) diff --git a/gen/youtubereporting1-cli/src/main.rs b/gen/youtubereporting1-cli/src/main.rs index 7db6c082fa..84d8da1031 100644 --- a/gen/youtubereporting1-cli/src/main.rs +++ b/gen/youtubereporting1-cli/src/main.rs @@ -70,11 +70,11 @@ impl<'n> Engine<'n> { let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "expire-time" => Some(("expireTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "report-type-id" => Some(("reportTypeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "system-managed" => Some(("systemManaged", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-time" => Some(("createTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { let suggestion = FieldCursor::did_you_mean(key, &vec!["create-time", "expire-time", "id", "name", "report-type-id", "system-managed"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); @@ -893,7 +893,7 @@ fn main() { let mut app = App::new("youtubereporting1") .author("Sebastian Thiel ") - .version("1.0.8+20181010") + .version("1.0.8+20190403") .about("Schedules reporting jobs containing your YouTube Analytics data and downloads the resulting bulk data reports in the form of CSV files.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_youtubereporting1_cli") .arg(Arg::with_name("url") diff --git a/gen/youtubereporting1/Cargo.toml b/gen/youtubereporting1/Cargo.toml index a49d313a75..f5c0047b60 100644 --- a/gen/youtubereporting1/Cargo.toml +++ b/gen/youtubereporting1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-youtubereporting1" -version = "1.0.8+20181010" +version = "1.0.8+20190403" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube Reporting (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtubereporting1" homepage = "https://developers.google.com/youtube/reporting/v1/reports/" -documentation = "https://docs.rs/google-youtubereporting1/1.0.8+20181010" +documentation = "https://docs.rs/google-youtubereporting1/1.0.8+20190403" license = "MIT" keywords = ["youtubereporting", "google", "protocol", "web", "api"] autobins = false @@ -25,7 +25,7 @@ serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" -url = "= 0.5" +url = "= 1.7" [features] diff --git a/gen/youtubereporting1/README.md b/gen/youtubereporting1/README.md index 01aac27ac6..3183704744 100644 --- a/gen/youtubereporting1/README.md +++ b/gen/youtubereporting1/README.md @@ -5,25 +5,25 @@ DO NOT EDIT ! --> The `google-youtubereporting1` library allows access to all features of the *Google YouTube Reporting* service. -This documentation was generated from *YouTube Reporting* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +This documentation was generated from *YouTube Reporting* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. Everything else about the *YouTube Reporting* *v1* API can be found at the [official documentation site](https://developers.google.com/youtube/reporting/v1/reports/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.YouTubeReporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.YouTubeReporting.html) ... -* [jobs](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.Job.html) - * [*create*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.JobCreateCall.html), [*delete*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.JobDeleteCall.html), [*get*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.JobGetCall.html), [*list*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.JobListCall.html), [*reports get*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.JobReportGetCall.html) and [*reports list*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.JobReportListCall.html) +* [jobs](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.Job.html) + * [*create*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.JobCreateCall.html), [*delete*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.JobDeleteCall.html), [*get*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.JobGetCall.html), [*list*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.JobListCall.html), [*reports get*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.JobReportGetCall.html) and [*reports list*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.JobReportListCall.html) * media - * [*download*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.MediaDownloadCall.html) -* [report types](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.ReportType.html) - * [*list*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.ReportTypeListCall.html) + * [*download*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.MediaDownloadCall.html) +* [report types](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.ReportType.html) + * [*list*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.ReportTypeListCall.html) Download supported by ... -* [*download media*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.MediaDownloadCall.html) +* [*download media*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.MediaDownloadCall.html) @@ -31,17 +31,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/struct.YouTubeReporting.html)** +* **[Hub](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/struct.YouTubeReporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.Part.html)** + * **[Parts](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -143,17 +143,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.ResponseResult.html), it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: `.param("alt", "media")`. @@ -163,29 +163,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.CallBuilder.html) before making the final `doit()` call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure. -The [delegate trait](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. ## Optional Parts in Server-Requests -All structures provided by this library are made to be [enocodable](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.Part.html) which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response. ## Builder Arguments -Using [method builders](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true. * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](https://docs.rs/google-youtubereporting1/1.0.8+20181010/google_youtubereporting1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-youtubereporting1/1.0.8+20190403/google_youtubereporting1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/youtubereporting1/src/lib.rs b/gen/youtubereporting1/src/lib.rs index 310d6d156f..069567417d 100644 --- a/gen/youtubereporting1/src/lib.rs +++ b/gen/youtubereporting1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *YouTube Reporting* crate version *1.0.8+20181010*, where *20181010* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. +//! This documentation was generated from *YouTube Reporting* crate version *1.0.8+20190403*, where *20190403* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.8*. //! //! Everything else about the *YouTube Reporting* *v1* API can be found at the //! [official documentation site](https://developers.google.com/youtube/reporting/v1/reports/). @@ -433,13 +433,13 @@ impl Part for GdataDownloadParameters {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GdataContentTypeInfo { - /// gdata - #[serde(rename="fromBytes")] - pub from_bytes: Option, /// gdata #[serde(rename="bestGuess")] pub best_guess: Option, /// gdata + #[serde(rename="fromBytes")] + pub from_bytes: Option, + /// gdata #[serde(rename="fromFileName")] pub from_file_name: Option, /// gdata @@ -480,10 +480,10 @@ pub struct GdataCompositeMedia { #[serde(rename="blobRef")] pub blob_ref: Option, /// gdata - pub path: Option, - /// gdata pub inline: Option, /// gdata + pub path: Option, + /// gdata #[serde(rename="referenceType")] pub reference_type: Option, /// gdata @@ -519,32 +519,6 @@ pub struct ListJobsResponse { impl ResponseResult for ListJobsResponse {} -/// gdata -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GdataDiffChecksumsResponse { - /// gdata - #[serde(rename="objectSizeBytes")] - pub object_size_bytes: Option, - /// gdata - #[serde(rename="chunkSizeBytes")] - pub chunk_size_bytes: Option, - /// gdata - #[serde(rename="checksumsLocation")] - pub checksums_location: Option, - /// gdata - #[serde(rename="objectLocation")] - pub object_location: Option, - /// gdata - #[serde(rename="objectVersion")] - pub object_version: Option, -} - -impl Part for GdataDiffChecksumsResponse {} - - /// gdata /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -573,6 +547,9 @@ impl Part for GdataDiffUploadResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ReportType { + /// The date/time when this report type was/will be deprecated. + #[serde(rename="deprecateTime")] + pub deprecate_time: Option, /// True if this a system-managed report type; otherwise false. Reporting jobs /// for system-managed report types are created automatically and can thus not /// be used in the `CreateJob` method. @@ -582,9 +559,6 @@ pub struct ReportType { pub id: Option, /// The name of the report type (max. 100 characters). pub name: Option, - /// The date/time when this report type was/will be deprecated. - #[serde(rename="deprecateTime")] - pub deprecate_time: Option, } impl Resource for ReportType {} @@ -618,13 +592,25 @@ impl ResponseResult for Empty {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GdataDiffDownloadResponse { +pub struct GdataBlobstore2Info { /// gdata - #[serde(rename="objectLocation")] - pub object_location: Option, + #[serde(rename="blobId")] + pub blob_id: Option, + /// gdata + #[serde(rename="readToken")] + pub read_token: Option, + /// gdata + #[serde(rename="downloadReadHandle")] + pub download_read_handle: Option, + /// gdata + #[serde(rename="blobGeneration")] + pub blob_generation: Option, + /// gdata + #[serde(rename="uploadMetadataContainer")] + pub upload_metadata_container: Option, } -impl Part for GdataDiffDownloadResponse {} +impl Part for GdataBlobstore2Info {} /// gdata @@ -673,6 +659,20 @@ pub struct ListReportTypesResponse { impl ResponseResult for ListReportTypesResponse {} +/// gdata +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GdataDiffDownloadResponse { + /// gdata + #[serde(rename="objectLocation")] + pub object_location: Option, +} + +impl Part for GdataDiffDownloadResponse {} + + /// gdata /// /// # Activities @@ -776,25 +776,25 @@ impl ResponseResult for GdataMedia {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GdataBlobstore2Info { +pub struct GdataDiffChecksumsResponse { /// gdata - #[serde(rename="blobId")] - pub blob_id: Option, + #[serde(rename="objectSizeBytes")] + pub object_size_bytes: Option, /// gdata - #[serde(rename="readToken")] - pub read_token: Option, + #[serde(rename="chunkSizeBytes")] + pub chunk_size_bytes: Option, /// gdata - #[serde(rename="downloadReadHandle")] - pub download_read_handle: Option, + #[serde(rename="checksumsLocation")] + pub checksums_location: Option, /// gdata - #[serde(rename="blobGeneration")] - pub blob_generation: Option, + #[serde(rename="objectLocation")] + pub object_location: Option, /// gdata - #[serde(rename="uploadMetadataContainer")] - pub upload_metadata_container: Option, + #[serde(rename="objectVersion")] + pub object_version: Option, } -impl Part for GdataBlobstore2Info {} +impl Part for GdataDiffChecksumsResponse {} /// gdata @@ -846,11 +846,11 @@ pub struct Job { /// otherwise false. #[serde(rename="systemManaged")] pub system_managed: Option, + /// The server-generated ID of the job (max. 40 characters). + pub id: Option, /// The creation date/time of the job. #[serde(rename="createTime")] pub create_time: Option, - /// The server-generated ID of the job (max. 40 characters). - pub id: Option, } impl RequestValue for Job {} @@ -1315,7 +1315,7 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: } } if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET); + replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string(); } url = url.replace(find_this, &replace_with); } @@ -1331,10 +1331,7 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1354,7 +1351,7 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1432,7 +1429,7 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1575,10 +1572,7 @@ impl<'a, C, A> ReportTypeListCall<'a, C, A> where C: BorrowMut, A } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1598,7 +1592,7 @@ impl<'a, C, A> ReportTypeListCall<'a, C, A> where C: BorrowMut, A let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1701,7 +1695,7 @@ impl<'a, C, A> ReportTypeListCall<'a, C, A> where C: BorrowMut, A /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -1852,10 +1846,7 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -1875,7 +1866,7 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -1961,7 +1952,7 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2114,10 +2105,7 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2137,7 +2125,7 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2233,7 +2221,7 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2384,10 +2372,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2407,7 +2392,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2493,7 +2478,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2670,10 +2655,7 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: } } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2693,7 +2675,7 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -2820,7 +2802,7 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -2963,10 +2945,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); @@ -2986,7 +2965,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3089,7 +3068,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters @@ -3224,10 +3203,7 @@ impl<'a, C, A> JobCreateCall<'a, C, A> where C: BorrowMut, A: oau } - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } + let url = hyper::Url::parse_with_params(&url, params).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = @@ -3259,7 +3235,7 @@ impl<'a, C, A> JobCreateCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone()) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -3347,7 +3323,7 @@ impl<'a, C, A> JobCreateCall<'a, C, A> where C: BorrowMut, A: oau /// It should be used to set parameters which are not yet available through their own /// setters. /// - /// Please note that this method must not be used to set any of the known paramters + /// Please note that this method must not be used to set any of the known parameters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters